From b1830935ab40bc4908525c3567370dd719a8e7b4 Mon Sep 17 00:00:00 2001 From: Siddhartha Prasad Date: Wed, 4 Feb 2026 19:09:56 -0500 Subject: [PATCH] Sterling version update --- forge/sterling/build/assets/manifest.webapp | 2 +- forge/sterling/build/assets/yandex-browser-manifest.json | 2 +- forge/sterling/build/main.bundle.js | 2 +- .../build/vendor/react-component-integration.global.js | 2 +- forge/sterling/build/vendor/spytial-core-complete.global.js | 2 +- forge/sterling/build/version.json | 4 ++-- forge/sterling/update-sterling.sh | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/forge/sterling/build/assets/manifest.webapp b/forge/sterling/build/assets/manifest.webapp index fd64563e..41e880f0 100644 --- a/forge/sterling/build/assets/manifest.webapp +++ b/forge/sterling/build/assets/manifest.webapp @@ -1,5 +1,5 @@ { - "version": "2.1.4", + "version": "2.3.0", "name": "sterling-layout", "description": "Spytial Sterling is a fork of the Sterling visualizer that encodes spatial layout.", "icons": { diff --git a/forge/sterling/build/assets/yandex-browser-manifest.json b/forge/sterling/build/assets/yandex-browser-manifest.json index 944ca7f0..8a95a081 100644 --- a/forge/sterling/build/assets/yandex-browser-manifest.json +++ b/forge/sterling/build/assets/yandex-browser-manifest.json @@ -1,5 +1,5 @@ { - "version": "2.1.4", + "version": "2.3.0", "api_version": 1, "layout": { "logo": "yandex-browser-50x50.png", diff --git a/forge/sterling/build/main.bundle.js b/forge/sterling/build/main.bundle.js index eb666f63..e3766dae 100644 --- a/forge/sterling/build/main.bundle.js +++ b/forge/sterling/build/main.bundle.js @@ -1 +1 @@ -(()=>{"use strict";var e,t,n,r={50004:(e,t,n)=>{var r=n(85893),o=(n(54848),n(49203),n(31906),n(67294)),s=n(73935),i=n(39704),a=n(57247),l=n(105),c=n(68527),d=n(78654),p=n(35173);const h=()=>{const e=(0,l.mq)("DragBar");return(0,r.jsx)(c.xu,{__css:e})},u=()=>{const e=(0,l.mq)("DragHandle");return(0,r.jsx)(c.xu,Object.assign({className:"drag-handle",__css:e},{children:(0,r.jsx)(h,{})}))},m=e=>{const{children:t,rightPaneCollapsed:n,rightPaneInitialWidth:s,rightPaneMinWidth:i,rightPaneMaxWidth:a}=e,h=(0,o.useRef)(null),m=(0,l.mq)("Dashboard"),[g,x]=(0,o.useState)(0),[b,y]=(0,o.useState)(!1),[w,v]=(0,o.useState)(s),j=(0,o.useMemo)((()=>n?0:w),[n,w]),A=(0,o.useMemo)((()=>n?-w:0),[n,w]),S=(0,o.useMemo)((()=>f(void 0,0,j,b)),[0,j,!1,b]),M=(0,o.useMemo)((()=>f(w,void 0,A,b)),[w,A,b]),C=(0,o.useMemo)((()=>f(void 0,void 0,A+w,b)),[A,w,b]),I=(0,o.useCallback)(((e,t)=>{const n=t.target.getBoundingClientRect(),r=t.clientX-n.left;"right"===e&&(x(r),y(!0))}),[y]),O=(0,o.useCallback)((0,d.Z)((e=>{var t;if(b){const n=h.current;if(n){null===(t=window.getSelection())||void 0===t||t.empty();const r=n.getBoundingClientRect().width-e.clientX+g-5;v((0,p.Z)(r,i,a))}}}),16),[g,b,i,a]),k=(0,o.useCallback)((()=>{y(!1)}),[y]);(0,o.useEffect)((()=>(document.addEventListener("mousemove",O),document.addEventListener("mouseup",k),()=>{document.removeEventListener("mousemove",O),document.removeEventListener("mouseup",k)})),[O,k]);const N=o.Children.toArray(t).filter((e=>e));return 2===N.length?(0,r.jsxs)(c.xu,Object.assign({ref:h,__css:m},{children:[(0,r.jsx)("div",Object.assign({style:S},{children:N[0]})),(0,r.jsx)("div",Object.assign({style:M},{children:N[1]})),(0,r.jsx)("div",Object.assign({style:C,onMouseDown:e=>I("right",e)},{children:(0,r.jsx)(u,{})}))]})):null},g={baseStyle:{position:"fixed",top:"56px",right:"64px",bottom:"36px",left:"0"}};function f(e,t,n,r){const o={position:"absolute",top:"0",bottom:"0",transition:r?void 0:"all 200ms cubic-bezier(0.85, 0, 0.15, 1)"};return void 0!==e&&(o.width=`${e}px`),void 0!==t&&(o.left=`${t}px`),void 0!==n&&(o.right=`${n}px`),o}const x=(0,l.Gp)(((e,t)=>{const n=(0,l.mq)("Pane");return(0,r.jsx)(c.xu,Object.assign({__css:n,ref:t},e))})),b=e=>{const t=(0,l.mq)("LogList",e);return(0,r.jsx)(c.rj,Object.assign({__css:t},e))};const y=e=>{const{variant:t}=e,n=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o{const t=(0,l.mq)("Logo");return(0,r.jsx)(c.M5,Object.assign({__css:t},e,{children:"Spytial Sterling"}))},v=e=>{const t=(0,l.mq)("NavBar");return(0,r.jsx)(c.kC,Object.assign({__css:t},e))},j={baseStyle:{h:"56px",position:"fixed",top:0,left:0,right:0,display:"flex",alignItems:"center",gap:3,px:4,bg:"rgba(11, 17, 32, 0.92)",backgroundImage:"linear-gradient(120deg, #0f172a 0%, #111827 45%, #0b1224 100%)",color:"gray.100",borderBottom:"1px solid",borderColor:"whiteAlpha.200",boxShadow:"0 12px 40px rgba(15, 23, 42, 0.45)",backdropFilter:"saturate(180%) blur(12px)",zIndex:"banner"}};var A=n(68921);const S=e=>{const t=(0,l.mq)("NavButton");return(0,r.jsx)(A.zx,Object.assign({__css:t},e))},M=e=>{const t=(0,l.mq)("PaneBody");return(0,r.jsx)(c.xu,Object.assign({__css:t},e))},C={baseStyle:{position:"absolute",top:"56px",right:0,bottom:0,left:0,bg:"#f8fafc"}},I=e=>{const t=(0,l.mq)("PaneHeader");return(0,r.jsx)(c.xu,Object.assign({__css:t},e))},O={baseStyle:{position:"absolute",top:0,left:0,right:0,height:"56px",display:"flex",alignItems:"center",gap:"0.75rem",px:3,bg:"rgba(255, 255, 255, 0.92)",backgroundImage:"linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(248,250,252,0.9) 100%)",borderBottom:"1px solid",borderColor:"gray.200",boxShadow:"0 8px 30px rgba(15, 23, 42, 0.08)",backdropFilter:"saturate(180%) blur(6px)",zIndex:"banner"}},k=e=>{const t=(0,l.mq)("PaneTitle");return(0,r.jsx)(c.M5,Object.assign({__css:t},e))},N=e=>{const t=(0,l.mq)("SideBar");return(0,r.jsx)(c.kC,Object.assign({__css:Object.assign(Object.assign({},t),{overflowY:"auto"})},e))},z={baseStyle:{w:"64px",position:"fixed",top:"56px",right:0,bottom:"36px",display:"flex",flexDir:"column",alignItems:"stretch",fontSize:"xs",gap:"6px",px:2,py:3,borderLeft:"1px solid",borderColor:"whiteAlpha.200",bg:"rgba(11, 17, 32, 0.88)",backdropFilter:"saturate(180%) blur(12px)",boxShadow:"-12px 0 30px rgba(15, 23, 42, 0.35)",color:"gray.100",zIndex:"banner"}};const D=e=>{const{text:t}=e,n=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o{const t=(0,l.mq)("StatusBar");return(0,r.jsx)(c.kC,Object.assign({__css:t},e))},_={baseStyle:{h:"36px",position:"fixed",right:0,bottom:0,left:0,display:"flex",alignItems:"center",px:4,gap:3,fontSize:"sm",borderTop:"1px solid",borderColor:"whiteAlpha.200",bg:"rgba(12, 17, 30, 0.9)",color:"gray.100",backdropFilter:"saturate(180%) blur(10px)",boxShadow:"0 -8px 30px rgba(15, 23, 42, 0.3)"}},L=(0,a.B1C)({fonts:{body:"InterVariable",mono:"Fira Code VF, Fira Code, monospace"},styles:{global:{"html, body, #root":{w:"full",h:"full",overflow:"hidden",userSelect:"none",cursor:"default"}}},components:{Dashboard:g,DragBar:{baseStyle:{w:"1px",h:"full",transition:"all ease 0.25s",backgroundColor:"gray.300",".drag-handle:hover &":{backgroundColor:"gray.500"}}},DragHandle:{baseStyle:{w:"10px",h:"full",mx:"-5px",px:"5px",cursor:"col-resize",boxSizing:"border-box",backgroundColor:"transparent"}},Logo:{baseStyle:{px:3,py:2,fontWeight:"extrabold",fontSize:"md",letterSpacing:"0.22em",textTransform:"uppercase",color:"white",bg:"whiteAlpha.100",borderRadius:"lg",boxShadow:"inset 0 0 0 1px rgba(255, 255, 255, 0.12)",lineHeight:"1"}},LogList:{baseStyle:{display:"grid",backgroundColor:"gray.50",gridTemplateColumns:"fit-content(300px) 1fr",gridColumnGap:"0.35rem",gridAutoRows:"min-content",userSelect:"text"}},LogText:{baseStyle:{fontFamily:"mono",fontSize:"xs"},variants:{message:{color:"gray.900"},warning:{color:"yellow.400",fontWeight:"semibold"},error:{color:"red.500",fontWeight:"semibold"},timestamp:{display:"flex",alignItems:"center",color:"gray.500"}},defaultProps:{variant:"message"}},NavBar:j,NavButton:{baseStyle:{display:"flex",alignItems:"center",gap:"0.35rem",borderRadius:"full",px:4,py:2,lineHeight:1.1,fontSize:"sm",fontWeight:"semibold",color:"gray.100",bg:"whiteAlpha.50",border:"1px solid",borderColor:"whiteAlpha.200",boxShadow:"0 10px 30px rgba(15, 23, 42, 0.15)",transitionProperty:"common",transitionDuration:"normal",_hover:{bg:"whiteAlpha.200",color:"white",borderColor:"whiteAlpha.300",_disabled:{bg:"initial"}},_active:{bg:"white",color:"#0f172a",borderColor:"white",boxShadow:"0 12px 34px rgba(15, 23, 42, 0.35)"},_focusVisible:{boxShadow:"0 0 0 2px rgba(99, 102, 241, 0.6)",outline:"none"},_disabled:{opacity:.4,cursor:"not-allowed"}}},Pane:{baseStyle:{position:"absolute",top:0,right:0,bottom:0,left:0}},PaneBody:C,PaneHeader:O,PaneTitle:{baseStyle:{fontSize:"sm",fontWeight:"semibold",letterSpacing:"0.08em",textTransform:"uppercase",color:"#0f172a"}},SideBar:z,SideBarButton:{baseStyle:{display:"flex",cursor:"pointer",alignItems:"center",justifyContent:"center",py:4,fontSize:"xs",fontWeight:"semibold",transitionProperty:"common",transitionDuration:"normal",writingMode:"vertical-lr",textOrientation:"sideways",borderRadius:"lg",border:"1px solid",borderColor:"whiteAlpha.200",color:"gray.100",bg:"whiteAlpha.50",boxShadow:"0 10px 30px rgba(15, 23, 42, 0.12)",iconSpacing:"0.35rem",span:{marginRight:".12rem"},_hover:{bg:"whiteAlpha.200",color:"white",borderColor:"whiteAlpha.300",transform:"translateY(-1px)",_disabled:{bg:"initial"}},_active:{bg:"linear-gradient(180deg, #e0e7ff 0%, #c7d2fe 100%)",color:"#0f172a",borderColor:"white",boxShadow:"0 14px 36px rgba(15, 23, 42, 0.35)",transform:"translateY(-2px)"},_focusVisible:{boxShadow:"0 0 0 2px rgba(94, 234, 212, 0.65)",outline:"none"}}},StatusBar:_,View:{baseStyle:{w:"full",h:"full"}}}});var T=n(59876),P=n(11384);const B=e=>{const{text:t,variant:n,time:o}=e;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(y,Object.assign({variant:"timestamp",justifySelf:"end"},{children:[o?(0,P.Z)(o,"HH:mm:ss"):"--:--:--",(0,r.jsx)(T.XC,{})]})),(0,r.jsx)(y,Object.assign({variant:n},{children:t}))]})};var R=n(64657);function V(e,t){return e.nodes[t]}function $(e,t){return t?t.map((t=>V(e,t))):(0,R.Z)(e.nodes)}function F(e,t){return e.edges[t]}function G(e,t){return t?t.map((t=>F(e,t))):(0,R.Z)(e.edges)}function Z(e,t){return`arrow-${e}-[${t}]`}const W=(0,o.memo)((e=>{const{size:t,color:n}=e,o=Z(t,n),s=t/2;return(0,r.jsx)("marker",Object.assign({id:o,viewBox:`0 0 ${t} ${t}`,refX:0,refY:s,markerWidth:t,markerHeight:t,markerUnits:"userSpaceOnUse",orient:"auto",fill:n},{children:(0,r.jsx)("path",{d:`M 0 0 L ${t} ${s} L 0 ${t} z`})}))})),U=e=>{const{arrowHeads:t}=e;return(0,r.jsx)("defs",{children:t.map(((e,t)=>(0,r.jsx)(W,Object.assign({},e),t)))})},q=e=>(0,r.jsx)("text",Object.assign({x:e.x,y:e.y,style:e.style},e.props,{children:e.text})),Y=e=>{const{label:t,position:n}=e;return t.length!==n.length?null:(0,r.jsx)(r.Fragment,{children:t.map(((e,t)=>{const{x:o,y:s}=n[t];return(0,r.jsx)(q,Object.assign({x:o,y:s},e),t)}))})};var X=n(3759),H=n(18990),J=n(27470),Q=n(75908),K=n(74681),ee=n(85925),te=n(69786),ne=n(67185),re=n(14643);const oe=e=>{const{path:t,curve:n,style:s,onRender:i}=e,a=(0,o.useRef)(null),l=(0,o.useRef)(null),c=(0,o.useMemo)((()=>function(e){const t=(0,X.Z)().x((e=>e.x)).y((e=>e.y));switch(null==e?void 0:e.type){case"bspline":t.curve(H.ZP);break;case"bundle":t.curve(J.Z.beta(.85));break;case"cardinal":t.curve(Q.ZP.tension(0));break;case"catmullrom":t.curve(K.Z.alpha(.5));break;case"line":default:t.curve(ee.Z);break;case"monotonex":t.curve(te.Z);break;case"monotoney":t.curve(te.s);break;case"natural":t.curve(ne.Z);break;case"step":t.curve(re.ZP);break;case"stepafter":t.curve(re.cD);break;case"stepbefore":t.curve(re.RN)}return t}(n)),[n]),d=(0,o.useMemo)((()=>c(t)||""),[c,t]),p=`url(#${Z(10,s.stroke)})`;return(0,o.useLayoutEffect)((()=>{const e=a.current,n=l.current;if(e&&n){const r=e.getTotalLength(),o=e.getPointAtLength(r-10);n.setAttribute("d",c([...t.slice(0,-1),o])||"")}i&&a.current&&i(a.current)}),[i,t]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("path",{ref:l,style:s,markerEnd:p}),(0,r.jsx)("path",{ref:a,d,stroke:"transparent",strokeWidth:11,fill:"none"})]})},se=e=>{const{id:t,path:n,curve:s,style:i,labels:a}=e,[l,c]=(0,o.useState)([]),d=(0,o.useCallback)((e=>{a&&c(a.map((t=>function(e,t){const n=t.getTotalLength();if(void 0===e.position)return t.getPointAtLength(n/2);if("number"==typeof e.position){const r=(0,p.Z)(e.position,0,1);return t.getPointAtLength(r*n)}const r=(0,p.Z)(e.position.distance,0,n);return"source"===e.position.from?t.getPointAtLength(r):t.getPointAtLength(n-r)}(t,e))))}),[c,a]);return(0,r.jsxs)("g",Object.assign({id:`${t}`},{children:[(0,r.jsx)(oe,{path:n,curve:s,style:i,onRender:d}),a&&(0,r.jsx)(Y,{label:a,position:l})]}))},ie=(0,o.memo)((e=>{const{edges:t}=e;return(0,r.jsx)("g",Object.assign({className:"edges"},{children:t.map((e=>(0,r.jsx)(se,Object.assign({},e),e.id)))}))}));function ae(e,t){return{x:e.x+t.x,y:e.y+t.y}}function le(e){return Math.atan2(-e.y,-e.x)+Math.PI}function ce(e,t){return{x:e.x-t.x,y:e.y-t.y}}function de(e,t,n){return{x:e.x+n*Math.cos(t),y:e.y+n*Math.sin(t)}}var pe=n(5419);const he=(0,o.createContext)({nodeOffset:()=>({x:0,y:0}),onClickNode:()=>{},onMouseDown:()=>{},onMouseDownNode:()=>{},onMouseMove:()=>{},onMouseUp:()=>{},onMouseUpNode:()=>{},onWheel:()=>{},spreadMatrix:(0,pe.yR)(),zoomMatrix:(0,pe.yR)()});var ue=n(60953);const me={x:0,y:0};function ge(e,t,n){const r=t.getScreenCTM();if(r){const o=r.inverse(),s=(0,pe.SO)(n),i=t.createSVGPoint();i.x=e.clientX,i.y=e.clientY;const a=(0,pe.hC)(s,i.matrixTransform(o));return i.x=e.clientX+e.movementX,i.y=e.clientY+e.movementY,ce((0,pe.hC)(s,i.matrixTransform(o)),a)}return{x:0,y:0}}const fe=()=>!1;function xe(e){return(0,o.useCallback)(((t,n)=>{let r,o=n.callbacks;switch(n.type){case"clicknode":return r=(0,ue.Z)(null==o?void 0:o.onClickNode,fe),r(n.nodeId,n.event)?t:function(e,t){return e}(t);case"mousedown":return r=(0,ue.Z)(null==o?void 0:o.onMouseDown,fe),r(n.event)?t:function(e,t){return Object.assign(Object.assign({},e),{isPanning:!0})}(t);case"mousedownnode":return r=(0,ue.Z)(null==o?void 0:o.onMouseDownNode,fe),r(n.nodeId,n.event)?t:function(e,t){const{event:n,nodeId:r}=t;return n.preventDefault(),n.stopPropagation(),e.selection.push(r),e.isDragging=!0,e}(t,n);case"mousemove":return r=(0,ue.Z)(null==o?void 0:o.onMouseMove,fe),r(n.event)?t:function(e,t,n){if(n){if(e.isDragging)return function(e,t,n){const r=e.selection,o=Object.assign({},e.offsets),s=ge(t.event,n,e.zoomMatrix);return r.forEach((e=>{const t=o[e]||me;o[e]=ae(t,s)})),Object.assign(Object.assign({},e),{offsets:o})}(e,t,n);if(e.isPanning)return function(e,t,n){const r=ge(t.event,n,e.zoomMatrix),o=(0,pe.vs)([e.zoomMatrix,(0,pe.Iu)(r.x,r.y)]);return Object.assign(Object.assign({},e),{zoomMatrix:o})}(e,t,n)}return e}(t,n,e);case"mouseup":return r=(0,ue.Z)(null==o?void 0:o.onMouseUp,fe),r(n.event)?t:function(e,t){return Object.assign(Object.assign({},e),{isDragging:!1,isPanning:!1,offsets:{},selection:[]})}(t);case"mouseupnode":return r=(0,ue.Z)(null==o?void 0:o.onMouseUpNode,fe),r(n.nodeId,n.event)?t:(r=(0,ue.Z)(null==o?void 0:o.onSelectionMoved,fe),r(t.offsets)?t:function(e,t){const{event:n}=t;return n.preventDefault(),n.stopPropagation(),e.isDragging=!1,e.isPanning=!1,e.offsets={},e.selection=[],e}(t,n));case"wheel":if(r=(0,ue.Z)(null==o?void 0:o.onWheel,fe),r(n.event))return t;const s=t.spreadMatrix,i=t.zoomMatrix,a=function(e,t,n){const r=t.event,o=function(e){const t=e.shiftKey?e.deltaX:e.deltaY;return 0===t?0:t<0?1.055:.9478672985781991}(r);return n&&0!==o&&!r.ctrlKey?r.shiftKey?function(e,t,n,r){const o=r.getScreenCTM();if(o){const s=r.createSVGPoint();s.x=t.clientX,s.y=t.clientY;const i=s.matrixTransform(o.inverse()),{x:a,y:l}=(0,pe.hC)((0,pe.vs)((0,pe.SO)(e.spreadMatrix),(0,pe.SO)(e.zoomMatrix)),i),c=(0,pe.vs)(e.spreadMatrix,(0,pe.bA)(n,n,a,l));return Object.assign(Object.assign({},e),{spreadMatrix:c})}return e}(e,r,o,n):function(e,t,n,r){const o=r.getScreenCTM();if(o){const s=r.createSVGPoint();s.x=t.clientX,s.y=t.clientY;const i=s.matrixTransform(o.inverse()),{x:a,y:l}=(0,pe.hC)((0,pe.SO)(e.zoomMatrix),i),c=(0,pe.vs)(e.zoomMatrix,(0,pe.bA)(n,n,a,l));return Object.assign(Object.assign({},e),{zoomMatrix:c})}return e}(e,r,o,n):e}(t,n,e);return r=(0,ue.Z)(null==o?void 0:o.onSpreadChanged,fe),s!==a.spreadMatrix&&r(a.spreadMatrix)?t:(r=(0,ue.Z)(null==o?void 0:o.onZoomChanged,fe),i!==a.zoomMatrix&&r(a.zoomMatrix)?t:a)}return t}),[e])}const be=e=>{const{svg:t}=e,n=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o{i(function(e,t){return Object.assign(Object.assign({},e),{callbacks:t})}(e,n))}),[i,n]);return{nodeOffset:(0,o.useCallback)((e=>s.offsets[e]||{x:0,y:0}),[s.offsets]),onClickNode:(0,o.useCallback)(((e,t)=>a(function(e,t){return{type:"clicknode",nodeId:e,event:t}}(e,t))),[a]),onMouseDown:(0,o.useCallback)((e=>a(function(e){return{type:"mousedown",event:e}}(e))),[a]),onMouseDownNode:(0,o.useCallback)(((e,t)=>a(function(e,t){return{type:"mousedownnode",nodeId:e,event:t}}(e,t))),[a]),onMouseMove:(0,o.useCallback)((e=>a(function(e){return{type:"mousemove",event:e}}(e))),[a]),onMouseUp:(0,o.useCallback)((e=>a(function(e){return{type:"mouseup",event:e}}(e))),[a]),onMouseUpNode:(0,o.useCallback)(((e,t)=>a(function(e,t){return{type:"mouseupnode",event:t,nodeId:e}}(e,t))),[a]),onWheel:(0,o.useCallback)((e=>a(function(e){return{type:"wheel",event:e}}(e))),[a]),spreadMatrix:s.spreadMatrix,zoomMatrix:s.zoomMatrix}};const ye=()=>(0,o.useContext)(he),we=e=>{const{children:t,beforeUnmount:n}=e,s=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o()=>{n&&n(i)}),[n]),(0,r.jsx)(he.Provider,Object.assign({value:i},{children:t}))};const ve=e=>{const{label:t}=e;return(0,r.jsx)(r.Fragment,{children:t.map(((e,t)=>{const{offset:n}=e,o=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o{const{shape:t,style:n}=e;return(0,r.jsx)("circle",{r:t.radius,style:n})})),Ae=(0,o.memo)((e=>{const{shape:t,style:n}=e;return(0,r.jsx)("rect",{x:-t.width/2,y:-t.height/2,width:t.width,height:t.height,style:n})})),Se=(0,o.memo)((e=>{const{shape:t,style:n}=e;switch(t.shape){case"circle":return(0,r.jsx)(je,{shape:t,style:n});case"rectangle":return(0,r.jsx)(Ae,{shape:t,style:n})}return null})),Me=(0,o.memo)((e=>{const{id:t,position:n,shape:s,style:i,labels:a,superscripts:l}=e,{onClickNode:c,onMouseDownNode:d,onMouseUpNode:p,spreadMatrix:h,nodeOffset:u}=ye(),m=u(t),g=(0,o.useMemo)((()=>{const e=ae((0,pe.hC)(h,n),m);return`translate(${e.x} ${e.y})`}),[n,m,h]);return(0,r.jsxs)("g",Object.assign({id:t,transform:g,onClick:e=>c(t,e),onMouseDown:e=>d(t,e),onMouseUp:e=>p(t,e)},{children:[(0,r.jsx)(Se,{shape:s,style:i}),a&&(0,r.jsx)(ve,{label:a}),l&&(0,r.jsx)(ve,{label:l})]}))})),Ce=(0,o.memo)((e=>{const{nodes:t}=e;return(0,r.jsx)("g",Object.assign({className:"nodes"},{children:t.map((e=>(0,r.jsx)(Me,Object.assign({},e),e.id)))}))}));function Ie(e,t){return{a:e,b:t}}function Oe(e,t){const n=e.a,r=e.b,o=t.a,s=t.b,i=((s.x-o.x)*(n.y-o.y)-(s.y-o.y)*(n.x-o.x))/((s.y-o.y)*(r.x-n.x)-(s.x-o.x)*(r.y-n.y));return{x:n.x+i*(r.x-n.x),y:n.y+i*(r.y-n.y)}}function ke(e,t,n,r){switch(t.shape){case"circle":return function(e,t,n,r){return de(e,le(n),t+r/2)}(e,t.radius,n,r);case"rectangle":return function(e,t,n,r,o){const s=t+o,i=n+o,a=s/2,l=i/2,c=de(e,le(r),Math.max(s,i)),d=Ie(e,c),p=((h=d).a.y-h.b.y)/(h.a.x-h.b.x);var h;const u=p*a,m=l/p,g={x:e.x+a,y:e.y+l},f={x:e.x-a,y:e.y+l},x={x:e.x+a,y:e.y-l},b={x:e.x-a,y:e.y-l};if(-l<=u&&u<=l){if(e.xc.x)return Oe(Ie(f,b),d)}if(-a<=m&&m<=a){if(e.yc.y)return Oe(Ie(b,x),d)}return e}(e,t.width,t.height,n,r)}return e}function Ne(e){return void 0!==e}const ze=(0,o.memo)((e=>{const{id:t,graph:n,edgeCurves:s,edgeStyles:i,edgeLabels:a,nodeShapes:l,nodeStyles:c,nodeLabels:d,nodeSuperscripts:p}=e,h=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o$(n).map((e=>{const t={x:e.x,y:e.y},n=l[e.id],r=c[e.id],o=d?d[e.id]:void 0,s=p?p[e.id]:void 0;return{id:e.id,position:t,shape:n,style:r,labels:o,superscripts:s}}))),[n,l,c,d]),f=(0,o.useMemo)((()=>G(n).map((e=>{const t=V(n,e.source),r=V(n,e.target);if(!t||!r)return;const o=l[t.id],c=l[r.id],d=function(e,t,n,r,o,s,i,a){const l=e.waypoints||[],c=(0,pe.hC)(a,ae(t,r)),d=(0,pe.hC)(a,ae(o,i)),p=l.map((e=>(0,pe.hC)(a,e))),h=ke(c,n,ce((0,ue.Z)(p[0],d),c),0),u=ke(d,s,ce((0,ue.Z)(p[p.length-1],c),d),0);return[h,...p,u]}(e,t,o,u(t.id),r,c,u(r.id),m),p=s[e.id],h=i[e.id],g=a?a[e.id]:void 0;return{id:e.id,path:d,curve:p,style:h,labels:g}})).filter(Ne)),[n,m,s,i,a,u]),x=function(e){const t=new Set,n=[];return e.forEach((e=>{const r=e.stroke,o=Z(10,r);t.has(o)||(t.add(o),n.push({size:10,color:r}))})),n}(Object.values(i));return g.length<1&&g.push({id:"0",position:{x:0,y:0},shape:{shape:"rectangle",width:550,height:50},style:{fill:"transparent",stroke:"black"},labels:[{text:"There are no atoms to display (or the current theme has hidden them)",style:{fontSize:12,textAnchor:"middle",fontFamily:"monospace",userSelect:"none"}}]}),(0,r.jsxs)("g",Object.assign({id:t},h,{children:[(0,r.jsx)(U,{arrowHeads:x}),(0,r.jsx)(Ce,{nodes:g}),(0,r.jsx)(ie,{edges:f})]}))}));(0,o.forwardRef)(((e,t)=>{const{children:n}=e,o=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o(0,r.jsx)(A.zx,Object.assign({colorScheme:"green",size:"xs",ref:t},e))));var Ee=n(98765);const _e=(0,Ee.PH)("sterling/buttonClicked"),Le=(0,Ee.PH)("sterling/dataRequested"),Te=(0,Ee.PH)("sterling/evalRequested"),Pe=(0,Ee.PH)("sterling/metaRequested"),Be=(0,Ee.PH)("sterling/dataReceived"),Re=(0,Ee.PH)("sterling/evalReceived"),Ve=(0,Ee.PH)("sterling/metaReceived"),$e=(0,Ee.PH)("sterling/connect"),Fe=(0,Ee.PH)("sterling/disconnect"),Ge=(0,Ee.PH)("sterling/connected"),Ze=(0,Ee.PH)("sterling/connectionError"),We=(0,Ee.PH)("sterling/disconnected"),Ue=(0,Ee.PH)("sterling/error");function qe(e){return void 0!==e}function Ye(e,t){const n={};for(const r of e)n[t(r)]=r;return n}function Xe(e){return e.types[e.types.length-1]}function He(e){return e.atoms}function Je(e){return void 0!==e.meta&&!0===e.meta.builtin}function Qe(e,t,n){return"string"==typeof t&&(t=ct(e,t)),"string"!=typeof n&&(n=n.id),t.types.includes(n)}function Ke(e,t){const n=t.getAttribute("label");if(!n)throw new Error("No label attribute in atom element");return{_:"atom",id:n,type:e}}function et(e,t){return Array.from(t).map((t=>Ke(e,t)))}function tt(e,t){if("string"==typeof t&&(t=st(e,t)),!e.types[t.type])throw new Error(`The atom's type is not part of the instance: ${t.type}`);return e.types[t.type]}function nt(e,t){return Array.from(t).map((t=>function(e,t){return{_:"tuple",types:e,atoms:Array.from(t.querySelectorAll("atom")).map(((t,n)=>Ke(e[n],t).id))}}(e,t)))}function rt(e){return e.tuples}function ot(e,t){return Array.from(t).map((t=>function(e,t){const n=t.getAttribute("label");if(!n)throw new Error("No label found for field element");const r=function(e,t){const n=t.querySelectorAll("type");return Array.from(n).map((t=>{const n=t.getAttribute("ID");if(!n)throw new Error("Type element must have an ID attribute");const r=e[n];if(!r)throw new Error(`Type element with ID ${n} not found`);return r}))}(e,t);if(0===r.length)throw new Error("No types found for field element");return{_:"relation",id:`${r[0]}<:${n}`,name:n,types:r,tuples:nt(r,t.querySelectorAll("tuple"))}}(e,t)))}function st(e,t){const n=it(e).find((e=>e.id===t));if(!n)throw new Error(`Could not find atom with id ${t}`);return n}function it(e){return dt(e).map(He).reduce(((e,t)=>e.concat(t)),[])}function at(e){return Object.values(e.relations)}function lt(e){return Object.values(e.skolems)}function ct(e,t){const n=e.types[t];if(!n)throw new Error(`Could not find type with id ${t}`);return n}function dt(e){return Object.values(e.types)}function pt(e){const t=e.getAttribute("bitwidth");if(!t)throw new Error("No bitwidth found in instance");const n=function(e){const t={},n=e.querySelectorAll("sig");for(const e of n){const n=e.getAttribute("ID"),r=e.getAttribute("label");if(!n)throw new Error("No ID found for sig element");if(!r)throw new Error("No label found for sig element");t[n]=r}return t}(e),r=function(e,t){const n={},r=t.querySelectorAll("sig");for(const e of r)if(!ft(e)){const t=e.getAttribute("ID"),r=e.getAttribute("parentID"),o=e.getAttribute("label");if(!t)throw new Error("No ID found for sig element");if(!o)throw new Error("No label found for sig element");r&&(n[t]=r)}const o=(t,r)=>n[t]?o(n[t],[...r,e[t]]):r,s={};for(const t in e)s[e[t]]=o(t,[]);return s}(n,e),o=function(e,t){return Array.from(t).filter((e=>!ft(e))).map((t=>function(e,t){const n=t.getAttribute("label");if(!n)throw new Error("No label attribute in sig element");const r=e[n];if(!r)throw console.log(e),new Error(`No type hierarchy for ${n}`);const o=function(e){const t={};return"yes"===e.getAttribute("abstract")&&(t.abstract=!0),"yes"===e.getAttribute("builtin")&&(t.builtin=!0),"yes"===e.getAttribute("enum")&&(t.enum=!0),"yes"===e.getAttribute("meta")&&(t.meta=!0),"yes"===e.getAttribute("one")&&(t.one=!0),"yes"===e.getAttribute("private")&&(t.private=!0),0===Object.keys(t).length?void 0:t}(t),s={_:"type",id:n,types:r,atoms:et(n,t.querySelectorAll("atom")),meta:void 0};return qe(o)&&(s.meta=o),s}(e,t)))}(r,e.querySelectorAll("sig")),s=ot(n,e.querySelectorAll("field")),i=ot(n,e.querySelectorAll("skolem"));return function(e,t){const n=t.find((e=>"Int"===e.id));if(!n)throw new Error("Could not find Int type");n.atoms=function(e){const t=[],n=Math.pow(2,e);for(let e=-n/2;ee.id)),relations:Ye(s,(e=>e.id)),skolems:Ye(i,(e=>e.id))}}function ht(e){var t;const n=(new DOMParser).parseFromString(e,"application/xml"),r=Array.from(n.querySelectorAll("instance"));if(!r.length)throw new Error(`No Alloy instance in XML: ${e}`);const o=n.querySelectorAll("visualizer");let s,i,a;for(const e of o){const t=mt(e,"script"),n=mt(e,"theme"),r=mt(e,"cnd");i=null!=t?t:i,s=null!=r?r:s,a=null!=n?n:a}return{instances:r.map(pt),bitwidth:ut(r[0],"bitwidth"),command:mt(r[0],"command"),loopBack:null!==(t=ut(r[0],"backloop"))&&void 0!==t?t:ut(r[0],"loop"),maxSeq:ut(r[0],"maxseq"),maxTrace:ut(r[0],"maxtrace"),minTrace:ut(r[0],"mintrace"),traceLength:ut(r[0],"tracelength"),visualizerConfig:{script:gt(i),theme:gt(a),cnd:gt(s)}}}function ut(e,t){const n=e.getAttribute(t);return n?+n:void 0}function mt(e,t){const n=e.getAttribute(t);return n?`${n}`:void 0}function gt(e){return null==e?void 0:e.replaceAll(""",'"').replaceAll('\\"','"').replaceAll(">",">").replaceAll("<","<")}function ft(e){return e.querySelectorAll("type").length>0}function xt(e){return"alloy"===e.format}function bt(e){return Object.assign(Object.assign({},e),{parsed:ht(e.data)})}function yt(e,t){const n=function(e){return JSON.parse(e)}(e);!function(e){return"data"===e.type&&void 0!==e.payload}(n)?function(e){return"eval"===e.type&&void 0!==e.payload}(n)?t.dispatch(Re(n.payload)):function(e){return"meta"===e.type&&void 0!==e.payload}(n)&&t.dispatch(Ve(n.payload)):t.dispatch(Be(function(e,t){const{enter:n,update:r,exit:o}=e,s=function(e,t){const n=[];return e&&e.forEach((e=>{!function(e){const t=e.format;return"alloy"===t||"raw"===t}(e)?t.dispatch(Ue(`Unsupported data format in datum ${e.id}: ${e.format}`)):(e.id=`${e.id}`,n.push(e))})),n}(n,t);return{enter:s.map((e=>{switch(e.format){case"alloy":return bt(e);case"raw":return function(e){return Object.assign(Object.assign({},e),{parsed:e.data})}(e);default:throw new Error("Unsupported format fell through unexpectedly.")}})),update:r,exit:o}}(n.payload,t)))}function wt(e){e.dispatch(Ue("Not connected to a provider."))}function vt(e,t){e.send(JSON.stringify(t))}const jt=()=>(0,i.I0)(),At=i.v9;var St=n(18172);function Mt(e,t){return t in e.edges}function Ct(e,t){return t in e.nodes}var It=n(29428);function Ot(e,t){return t=t||[],function(e,t){return(0,St.Uy)(e,(e=>{t.forEach((t=>function(e,t){const{id:n,source:r,target:o}=t;if(n&&(s=e,i=[r,o],(0,It.Z)(i,(e=>Ct(s,e))))&&!Mt(e,n))e.edges[n]=t,function(e,t,n,r){e.predecessors.hasOwnProperty(n)||(e.predecessors[n]={}),e.predecessors[n].hasOwnProperty(t)||(e.predecessors[n][t]=[]),e.predecessors[n][t].push(r)}(e,r,o,n),function(e,t,n,r){e.successors.hasOwnProperty(t)||(e.successors[t]={}),e.successors[t].hasOwnProperty(n)||(e.successors[t][n]=[]),e.successors[t][n].push(r)}(e,r,o,n),function(e,t,n){e.inedges[t].push(n)}(e,o,n),function(e,t,n){e.outedges[t].push(n)}(e,r,n);else{if(!n)throw new Error("Cannot add an edge without an edge ID");if(!Ct(e,r))throw new Error(`Cannot add edge ${n}, the source node ${r} is not in the graph`);if(!Ct(e,o))throw new Error(`Cannot add edge ${n}, the target node ${o} is not in the graph`);if(Mt(e,n))throw new Error(`Cannot add edge, an edge with ID ${n} already exists in the graph`)}var s,i}(e,(0,St.cA)(t))))}))}(function(e,t){return(0,St.Uy)(e,(e=>{t.forEach((t=>function(e,t){const{id:n}=t;if(n&&!Ct(e,n))e.nodes[n]=t,e.predecessors[n]={},e.successors[n]={},e.inedges[n]=[],e.outedges[n]=[];else{if(!n)throw new Error("Cannot add a node without a node ID");if(Ct(e,n))throw new Error(`Cannot add node, a node with ID ${n} already exists in the graph`)}}(e,(0,St.cA)(t))))}))}({nodes:{},edges:{},predecessors:{},successors:{},inedges:{},outedges:{}},e=e||[]),t)}function kt(e,t){const n=e.edges;return!!n&&n.some((e=>{var n;return!0===e.asAttribute&&(null===(n=e.targets)||void 0===n?void 0:n.some((e=>"*"===e||e.relation===t)))}))}function Nt(e,t,n){if(n<2)return[0,0];if(!e)return[0,n-1];const r=e.edges;if(!r)return[0,n-1];const o=r.find((e=>{var n;return(e.sourceIndex||e.targetIndex)&&(null===(n=e.targets)||void 0===n?void 0:n.some((e=>"*"===e||e.relation===t)))}));return o?[o.sourceIndex?o.sourceIndex:0,o.targetIndex?o.targetIndex:n-1]:[0,n-1]}var zt=n(11022),Dt=n(935);function Et(e){return e.id}function _t(e,t){return`${e.id}:${t.atoms.join("->")}`}function Lt(e,t){var n,r;const o=(null===(n=null==t?void 0:t.hidden)||void 0===n?void 0:n.disconnected)||!1,s=o||(null===(r=null==t?void 0:t.hidden)||void 0===r?void 0:r.builtinDisconnected)||!1,{nodeIds:i,edgeIds:a}=function(e,t,n,r){const o=new Set,s=new Set;return at(e).forEach((t=>{rt(t).forEach((n=>{const i=n.atoms.map((t=>st(e,t))),[a,l]=function(e,t,n){if(n){const[r,o]=Nt(n,e.id,t.length);return[r?t[r]:(0,zt.Z)(t),o?t[o]:(0,Dt.Z)(t)]}return[(0,zt.Z)(t),(0,Dt.Z)(t)]}(t,i,r);a&&l&&(o.add(Et(a)),o.add(Et(l)),s.add(_t(t,n)))}))})),it(e).forEach((r=>{const s=Et(r);o.has(s)||t||function(e,t){return"string"==typeof t&&(t=st(e,t)),tt(e,t).types.map((t=>ct(e,t))).some(Je)}(e,r)&&n||o.add(s)})),{nodeIds:o,edgeIds:s}}(e,o,s,t),l=[];it(e).forEach((e=>{const t=Et(e);i.has(t)&&l.push({id:t,atom:e})}));const c=[];return at(e).forEach((n=>{t&&kt(t,n.id)||rt(n).forEach((r=>{const o=_t(n,r),s=r.atoms,[i,l]=Nt(t,n.id,s.length),d=i?s[i]:(0,zt.Z)(s),p=l?s[l]:(0,Dt.Z)(s);d&&p&&a.has(o)&&c.push({id:o,source:Et(st(e,d)),target:Et(st(e,p)),relation:n,tuple:r})}))})),Ot(l,c)}var Tt=n(79432),Pt=n(27961);function Bt(e,t,n,r){const o={},s={},i={},a={},l={},c={},d={},p=function(e,t){const n={"*":(r=[t],(0,Pt.Z)(r.map((e=>e.nodes?e.nodes.filter((e=>e.targets&&e.targets.some((e=>"*"===e)))):[]))))};var r;return dt(e).forEach((e=>{n[e.id]=function(e,t){return(0,Pt.Z)(t.map((t=>t.nodes?t.nodes.filter((t=>t.targets&&t.targets.some((t=>"*"!==t&&t.type===e)))):[])))}(e.id,[t])})),n}(t,r),h=function(e,t){const n={"*":(r=[t],(0,Pt.Z)(r.map((e=>e.edges?e.edges.filter((e=>e.targets&&e.targets.some((e=>"*"===e)))):[]))))};var r;return at(e).forEach((e=>{n[e.id]=function(e,t){return(0,Pt.Z)(t.map((t=>t.edges?t.edges.filter((t=>t.targets&&t.targets.some((t=>"*"!==t&&t.relation===e)))):[])))}(e.id,[t])})),n}(t,r),u={};at(t).forEach((e=>{kt(r,e.id)&&rt(e).forEach((t=>{const n=t.atoms;if(n.length>1){const t=n[0];u[t]||(u[t]=[]),u[t].push(`${e.name}: ${n.slice(1).join(", ")}`)}}))})),lt(t).forEach((e=>{rt(e).forEach((t=>{const n=t.atoms[0];u[n]||(u[n]=[]),u[n].push(`${e.name}`)}))})),$(n).forEach((e=>{i[e.id]=[{text:e.atom.id,props:{},style:{}}];const n=ct(t,e.atom.type);a[e.id]=[{text:n.types[0],props:{dy:"-1em"},style:{textAnchor:"middle",fontSize:"14px",fontStyle:"italic"}}],u[e.id]&&i[e.id].push(...u[e.id].map((e=>({text:e,props:{},style:{}})))),s[e.id]={}}));const m=e=>{if(e.tuple.atoms.length>2){const[t,n]=Nt(r,e.relation.id,e.tuple.atoms.length),o=e.tuple.atoms.slice();return o.splice(t,1),o.splice(n-1,1),e.relation.name+`[${o.join(", ")}]`}return e.relation.name};return G(n).forEach((e=>{d[e.id]=[{text:m(e),props:{},style:{}}],c[e.id]={}})),$(n).forEach((e=>{const{id:n,atom:r}=e;["*","univ",...tt(t,r).types.slice().reverse()].forEach((e=>{var t;null===(t=p[e])||void 0===t||t.forEach((e=>{var t;e.shape&&(o[n]=e.shape),(0,Tt.Z)(s[n],null===(t=e.styles)||void 0===t?void 0:t.node),i[n].forEach((t=>{var n,r;(0,Tt.Z)(t.props,null===(n=e.props)||void 0===n?void 0:n.label),(0,Tt.Z)(t.style,null===(r=e.styles)||void 0===r?void 0:r.label)})),Rt(i[n])}))}))})),G(n).forEach((e=>{const{id:t,relation:n,tuple:r}=e;["*",n.id].forEach((e=>{var n;null===(n=h[e])||void 0===n||n.forEach((e=>{var n;e.curve&&(l[t]=e.curve),(0,Tt.Z)(c[t],null===(n=e.styles)||void 0===n?void 0:n.edge),d[t].forEach((t=>{var n,r;(0,Tt.Z)(t.props,null===(n=e.props)||void 0===n?void 0:n.label),(0,Tt.Z)(t.style,null===(r=e.styles)||void 0===r?void 0:r.label)})),Rt(d[t])}))}))})),{id:e,graph:n,nodeShapes:o,nodeStyles:s,nodeLabels:i,nodeSuperscripts:a,edgeCurves:l,edgeLabels:d,edgeStyles:c}}function Rt(e){const t=e.length-1;e.forEach(((e,n)=>{e.props||(e.props={}),e.props.dy=n-t/2+.33+"em"}))}var Vt=n(70681),$t=n.n(Vt),Ft=n(5840),Gt=n(13209),Zt=n(44186),Wt=n(49360);function Ut(e,t){return Ot($(e).map((e=>{const n=t.nodePositions[e.id];return Object.assign(Object.assign({},e),{x:(null==n?void 0:n.x)||0,y:(null==n?void 0:n.y)||0})})),G(e).map((e=>Object.assign(Object.assign({},e),{waypoints:t.edgeWaypoints[e.id]||[]}))))}const qt=e=>void 0!==e.loopBack;var Yt=n(1185);function Xt(e,t){const n={};return t.forEach((t=>{const r=Xe(tt(e,t));if(n[r])throw new Error(`Cannot project ${t} and ${n[r]}. Both are of type ${r}`);n[r]=t})),{types:Ht(e,n),relations:Jt(e,n),skolems:e.skolems}}function Ht(e,t){const n={},r=Object.keys(t);for(const t in e.types){const o=e.types[t],s=r.some((t=>Qe(e,o,t)));n[t]={_:"type",id:o.id,types:o.types,atoms:s?[]:o.atoms,meta:o.meta}}return n}function Jt(e,t){const n={},r=Object.keys(t),o=Object.values(t);for(const t in e.relations){const s=e.relations[t],i=s.types.some((t=>r.some((n=>Qe(e,t,n))))),a=i?Qt(e,s.types,r):[];n[t]={_:"relation",id:s.id,name:s.name,types:i?en(s.types,a):s.types,tuples:i?Kt(s.tuples,a,o):s.tuples},i||(n[t]=s)}return n}function Qt(e,t,n){const r=[];return t.forEach(((t,o)=>{n.some((n=>Qe(e,t,n)))&&r.push(o)})),r}function Kt(e,t,n){return e.filter((e=>e.atoms.some((e=>n.includes(e))))).map((e=>({_:"tuple",types:en(e.types,t),atoms:en(e.atoms,t)}))).filter((e=>e.atoms.length>1))}function en(e,t){const n=[];for(let r=0;rt.map((t=>sn(e,t))).filter((e=>!(0,Wt.Z)(e))))),selectDatumById:sn},ln=function(e,t){return(e.orderByDatumId[t.id]||[]).map((t=>e.expressionsById[t]))},cn=function(e){return e.nextExpressionId};function dn(e){return e.length?e.slice().sort(((e,t)=>e.time===t.time?e.type.localeCompare(t.type):!0===e.time?-1:1)).map((e=>!0===e.time?`[${e.type}]`:`(${e.type})`)).join("|"):"|"}function pn(e,t){const n=hn(e,t);return n&&n.projections||[]}function hn(e,t){var n;return e.themeByGeneratorName[null!==(n=t.generatorName)&&void 0!==n?n:""]}const un={selectGraphLayout:function(e,t){const n=pn(e,t),r=e.layoutsByDatumId[t.id],o=dn(n);return r.layoutById[o]},selectHiddenRelations:function(e,t){return e.hiddenByDatumId[t.id]},selectProjections:pn,selectSpreadMatrix:function(e,t){var n;return null===(n=e.matricesByDatumId[t.id])||void 0===n?void 0:n.spreadMatrix},selectTheme:hn,selectTimeIndex:function(e,t){return e.timeByDatumId[t.id]||0},selectZoomMatrix:function(e,t){var n;return null===(n=e.matricesByDatumId[t.id])||void 0===n?void 0:n.zoomMatrix},selectCnDSpec:function(e,t){var n,r;const o=null!==(n=t.generatorName)&&void 0!==n?n:"";return null!==(r=e.cndSpecByGeneratorName[o])&&void 0!==r?r:""}},mn=function(e){return e.items},gn=function(e){return e.connected},fn=function(e){return e.providerName},xn=function(e){return e.providerGenerators},bn=function(e){return e.synthesisEnabled};function yn(e,t){let n=null!=t?t:e;if(n instanceof Function)return n;{let e=n;return()=>e}}function wn(e){return{top_left:{x:Math.min(...e.map((e=>e.top_left.x))),y:Math.min(...e.map((e=>e.top_left.y)))},bottom_right:{x:Math.max(...e.map((e=>e.bottom_right.x))),y:Math.max(...e.map((e=>e.bottom_right.y)))}}}function vn(e){return null==e||0==e.length?{x:0,y:0}:e.reduce(((t,n)=>({x:t.x+n.x/e.length,y:t.y+n.y/e.length})),{x:0,y:0})}function jn(e,t){return e.map((e=>()=>({x:e().x-t().x,y:e().y-t().y})))}function An(e){let t=1/0,n=1/0,r=-1/0,o=-1/0;return e.forEach((e=>{t=Math.min(t,e.x),r=Math.max(r,e.x),n=Math.min(n,e.y),o=Math.max(o,e.y)})),{top_left:{x:t,y:n},bottom_right:{x:r,y:o}}}function Sn(e,t){const n=[];for(let o=1;o<=t;o++){const s=e(2*Math.PI/t*o);if(!("x"in(r=s))||!("y"in r))throw"returned bounding box response not of type coords. Issue in edge.ts or utility.ts";n.push(s)}var r;return n}function Mn(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Cn(e){let t=Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2));return{x:e.x/t,y:e.y/t}}function In(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}function On(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function kn(e,t){const n=function(e,t){return e.x*t.x+e.y*t.y}(e,t)/(On(e)*On(t));return On(e)*On(t)==0?1/0:Math.acos(n)}function Nn(e,t,n,r){const o=e*n+t*r,s=Math.sqrt((e*e+t*t)*(n*n+r*r));let i=Math.acos(o/s);return e*r-t*n<0&&(i=-i),i}var zn=n(69364);const Dn="rgb(0, 0, 0)";class En{constructor(e){this.center=yn({x:0,y:0},e),this.origin_offset=yn({x:0,y:0},e),this.bounding_box_lam=e=>this.center(),this.hasBoundingBox=!1,this.children=[],this.dependents=[],this.masks=[]}boundingBox(){return 0==this.children.length?{top_left:this.center(),bottom_right:this.center()}:wn(this.children.map((e=>e.boundingBox())))}getChildren(){return this.children}setCenter(e){this.center=yn(this.center(),e)}hasLam(){return this.hasBoundingBox}getLam(){return this.hasBoundingBox?this.bounding_box_lam:(e=this.boundingBox(),t=>{const n=t%(2*Math.PI),r=e.top_left,o=e.bottom_right,s=Math.abs(r.y-o.y),i=Math.abs(r.x-o.x),a=Math.atan(s/i);if(2*Math.PI-a<=n||n<=a){const e=o.x;let t;return t=n>Math.PI?o.y-s/2+Math.tan(2*Math.PI-n)*i/2:o.y-s+Math.tan(n)*i/2,{x:e,y:t}}if(aMath.PI/2?r.x+s/(2*Math.tan(n-Math.PI/4)):r.x+i/2+s/(2*Math.tan(n)),{x:e,y:r.y}}if(Math.PI-a{r.append("rect").attr("x",e.top_left.x).attr("y",e.top_left.y).attr("width",Math.abs(e.top_left.x-e.bottom_right.x)).attr("height",Math.abs(e.top_left.y-e.bottom_right.y))})),n}render(e,t){let n;n=t?this.masks.concat(t):this.masks,this.children.forEach((t=>{t.render(e,n)}))}sterlingExpectCenter(e,t,n){if(this.center().x!==t)throw new Error(`${e}: center().x was not expected value (${t}); was ${this.center().x}`);if(this.center().y!==n)throw new Error(`${e}: center().y was not expected value (${n}); was ${this.center().y}`)}}class _n extends En{constructor(e){super(e.coords),this.text=yn("",e.text),this.fontSize=yn(15,e.fontSize),this.color=yn("rgb(0, 0, 0)",e.color),this.events=yn([],e.events),this.fontWeight=yn(400,e.fontWeight)}boundingBox(){return{top_left:{x:this.center().x-this.fontSize()/2,y:this.center().y-this.fontSize()/2},bottom_right:{x:this.center().x+this.fontSize()/2,y:this.center().y+this.fontSize()/2}}}setText(e){this.text=yn(this.text(),e)}setFontSize(e){this.fontSize=yn(this.fontSize(),e)}setTextColor(e){this.color=yn(this.color(),e)}setFontWeight(e){this.fontWeight=yn(this.fontWeight(),e)}render(e,t){let n,r="";n=t?this.masks.concat(t):this.masks,r=this.addMaskRender(n,e);const o=zn.Ys(e).append("text").attr("x",this.center().x).attr("y",this.center().y).attr("text-anchor","middle").attr("alignment-baseline","central").attr("font-size",this.fontSize).attr("font-weight",this.fontWeight).attr("mask",n.length>0?`url(#${r})`:"").attr("fill",this.color).text(this.text);this.events()&&this.events().forEach((e=>o.on(e.event,e.callback))),super.render(e)}}class Ln extends En{constructor(e){super(e.center),this.color=yn("rgb(0, 0, 0)",e.color),this.borderWidth=yn(2,e.borderWidth),this.borderColor=yn("rgb(255, 255, 255)",e.borderColor),this.label=new _n({text:e.label,coords:()=>this.center(),color:e.labelColor,fontSize:e.labelSize}),this.children.push(this.label),this.opacity=yn(1,e.opacity)}setColor(e){this.color=yn(this.color(),e)}setBorderWidth(e){this.borderWidth=yn(this.borderWidth(),e)}setBorderColor(e){this.borderColor=yn(this.borderColor(),e)}setLabelText(e){this.label.setText(e)}setLabelColor(e){this.label.setTextColor(e)}setLabelSize(e){this.label.setFontSize(e)}}class Tn extends Ln{constructor(e){var t;super(e),this.height=yn(0,e.height),this.width=yn(0,e.width),this.labelLocation=null!==(t=e.labelLocation)&&void 0!==t?t:"center";const n={x:0,y:0};if(e.center&&e.coords)throw"you cannot include both coords and a center as the two define the same thing";this.center=(()=>{if(e.center)return yn(n,e.center);{const t=yn(n,e.coords);return()=>{const e=t();return{x:e.x+this.width()/2,y:e.y+this.height()/2}}}})(),this.setLabelLocation()}boundingBox(){return{top_left:{x:this.center().x-this.width()/2,y:this.center().y-this.height()/2},bottom_right:{x:this.center().x+this.width()/2,y:this.center().y+this.height()/2}}}setLabelLocation(){switch(this.labelLocation){case"topLeft":this.label.setCenter((()=>({x:this.center().x-this.width()/2+2.5*this.label.text().length,y:this.center().y-this.height()/2-1*this.label.fontSize()})));break;case"topRight":this.label.setCenter((()=>({x:this.center().x+this.width()/2-2.5*this.label.text().length,y:this.center().y-this.height()/2-1*this.label.fontSize()})));break;case"bottomRight":this.label.setCenter((()=>({x:this.center().x+this.width()/2-2.5*this.label.text().length,y:this.center().y+this.height()/2+1*this.label.fontSize()})));break;case"bottomLeft":this.label.setCenter((()=>({x:this.center().x-this.width()/2+2.5*this.label.text().length,y:this.center().y+this.height()/2+1*this.label.fontSize()})))}}setWidth(e){this.width=yn(this.width(),e)}setHeight(e){this.height=yn(this.height(),e)}render(e,t){let n,r="";n=t?this.masks.concat(t):this.masks,r=this.addMaskRender(n,e),zn.Ys(e).append("rect").attr("x",this.center().x-this.width()/2).attr("y",this.center().y-this.height()/2).attr("width",this.width()).attr("height",this.height()).attr("stroke-width",this.borderWidth()).attr("stroke",this.borderColor()).attr("fill",this.color()).attr("mask",n.length>0?`url(#${r})`:"").attr("opacity",this.opacity()),super.render(e,n)}}class Pn extends Ln{constructor(e){super(e),this.radius=yn(0,e.radius),this.bounding_box_lam=e=>{const t=this.radius(),n=this.center();return{x:t*Math.cos(e)+n.x,y:t*Math.sin(e)+n.y}},this.hasBoundingBox=!0}boundingBox(){return{top_left:{x:this.center().x-this.radius(),y:this.center().y-this.radius()},bottom_right:{x:this.center().x+this.radius(),y:this.center().y+this.radius()}}}setRadius(e){this.radius=yn(0,e)}render(e,t){let n,r="";n=t?this.masks.concat(t):this.masks,r=this.addMaskRender(n,e),zn.Ys(e).append("circle").attr("cx",this.center().x).attr("cy",this.center().y).attr("r",this.radius).attr("stroke-width",this.borderWidth).attr("stroke",this.borderColor).attr("fill",this.color).attr("mask",n.length>0?`url(#${r})`:"").attr("opacity",this.opacity()),super.render(e,n)}}var Bn=n(28721);class Rn extends En{constructor(e){var t;let n;n=null!=e.points?e.points.map((e=>yn({x:0,y:0},e))):[],super((()=>vn(n.map((e=>e()))))),this.pointsRelative=jn(n,this.center),this.color=yn(Dn,e.color),this.width=yn(2,e.width),this.opacity=yn(1,e.opacity),this.arrow=null!==(t=e.arrow)&&void 0!==t&&t,this.style=yn("full",e.style),this.curve=yn({curveType:"none"},e.curve)}boundingBox(){return An(this.pointsRelative.map((e=>({x:e().x+this.center().x,y:e().y+this.center().y}))))}setColor(e){this.color=yn(this.color(),e)}setWidth(e){this.width=yn(this.width(),e)}setOpacity(e){this.opacity=yn(this.opacity(),e)}render(e,t){let n,r="";if(n=t?this.masks.concat(t):this.masks,r=this.addMaskRender(n,e),2==this.pointsRelative.length)for(;this.pointsRelative[0]().x==this.pointsRelative[1]().x||this.pointsRelative[0]().y==this.pointsRelative[1]().y;){if(this.pointsRelative[0]().x==this.pointsRelative[1]().x){const e=this.pointsRelative[0];this.pointsRelative[0]=()=>({x:e().x+1e-4,y:e().y})}if(this.pointsRelative[0]().y==this.pointsRelative[1]().y){const e=this.pointsRelative[0];this.pointsRelative[0]=()=>({x:e().x,y:e().y+1e-4})}}let o=this.pointsRelative.map((e=>({x:e().x+this.center().x,y:e().y+this.center().y})));const s=this.buildPathString(o);let i="0";if("dashed"==this.style()?i=5*this.width():"dotted"==this.style()&&(i=this.width()),this.arrow){const t=(0,Bn.Z)();zn.Ys(e).append("svg:defs").append("svg:marker").attr("id",t).attr("refX",11).attr("refY",6).attr("markerWidth",10*this.width()).attr("markerHeight",10*this.width()).attr("markerUnits","userSpaceOnUse").attr("orient","auto").append("path").attr("d","M 0 0 12 6 0 12 3 6").style("fill",this.color),zn.Ys(e).append("path").attr("d",s).attr("stroke-width",this.width).attr("stroke",this.color).attr("opacity",this.opacity()).attr("marker-end",`url(#${t})`).attr("mask",n.length>0?`url(#${r})`:"").style("stroke-dasharray",i).attr("fill","transparent"),super.render(e,n)}else zn.Ys(e).append("path").attr("d",s).attr("stroke-width",this.width).attr("stroke",this.color).attr("opacity",this.opacity()).attr("fill","transparent").attr("mask",n.length>0?`url(#${r})`:"").style("stroke-dasharray",i),super.render(e,n)}buildPathString(e){const t=this.curve();switch(t.curveType){case"none":const n=zn.ETc();return n.moveTo(e[0].x,e[0].y),e.forEach((e=>{n.lineTo(e.x,e.y)})),n.toString();case"arc":return`M ${e[0].x} ${e[0].y} \n A ${t.xradius} ${t.yradius} 0 0 \n ${void 0!==t.sweep?t.sweep:1} ${e[1].x} ${e[1].y}`;case"cubic":throw console.log("Error: cubic curves currently unsupported by Line"),new Error("cubic curves currently unsupported by Line");case"quadratic":throw console.log("Error: quadratic curves currently unsupported by Line"),new Error("quadratic curves currently unsupported by Line");default:throw console.log(`Error: unrecognized curveType in prop ${JSON.stringify(t)} (check you have not misspelled the field name)`),new Error(`unknown curveType field in Line prop ${JSON.stringify(t)} (check you have not misspelled the field name)`)}}}class Vn extends En{constructor(e){var t,n;super(e.coords);let r=yn({x:0,y:0},e.coords);this.center=()=>({x:r().x+this.width/2,y:r().y+this.height/2}),this.coords=()=>{const e=this.center();return{x:e.x-this.width/2,y:e.y-this.height/2}},this.height=e.height,this.width=e.width,this.root=e.root;let o=this.root.visualObject.center;this.root.visualObject.setCenter((()=>{const e=this.coords(),t=o();return{x:e.x+this.width/2+t.x,y:e.y+t.y}})),this.lines=[],this.subTrees=[],this.setUpSubtrees(),this.setLineColor(null!==(t=e.edgeColor)&&void 0!==t?t:"black"),this.setLineWidth(null!==(n=e.edgeWidth)&&void 0!==n?n:2)}setUpSubtrees(){let e=this.height/($n(this.root)-1),t=this.root.children.map((e=>Fn(e))).reduce(((e,t)=>e+t),0);this.subTrees=[];let n=0;this.subTrees=this.root.children.map((r=>{let o=Fn(r),s=n;return n+=o,new Vn({root:r,height:e*($n(r)-1),width:this.width*Fn(r)/t,coords:()=>{const n=this.coords();return{x:n.x+s/t*this.width,y:n.y+e}}})})),this.subTrees.forEach((e=>{this.lines.push(new Rn({points:[()=>{const e=this.root.visualObject.center();return{x:e.x,y:e.y}},()=>{const t=e.root.visualObject.center();return{x:t.x,y:t.y}}],color:Dn,width:2}))})),this.lines.forEach((e=>{this.children.push(e)})),this.subTrees.forEach((e=>{this.children.push(e)})),this.children.push(this.root.visualObject)}setLineColor(e){this.lines.forEach((t=>t.setColor(e))),this.subTrees.forEach((t=>t.setLineColor(e)))}setLineWidth(e){this.lines.forEach((t=>t.setWidth(e))),this.subTrees.forEach((t=>t.setLineWidth(e)))}}function $n(e){let t=0,n=[e];for(;0!=n.length;){t+=1;let e=[];n.forEach((t=>{t.children.forEach((t=>{e.push(t)}))})),n=e}return t}function Fn(e){let t=1,n=[e];for(;0!=n.length;){let e=[];n.forEach((t=>{t.children.forEach((t=>{e.push(t)}))})),n=e,t=Math.max(t,e.length)}return t}class Gn{static error(e,t,n){return n&&console.trace(),Error(`[${e}] ${t}`)}static missingAttribute(e,t){return Error(`[${e}] Missing attribute: ${t}`)}static missingElement(e,t){return Error(`[${e}] Missing element: <${t}>`)}}class Zn{constructor(e){this._tuples=e||[]}empty(){return 0===this._tuples.length}equals(e){return this.toString()===e.toString()}in(e){const t=new Set(e.tuples().map((e=>e.toString())));return this.tuples().every((e=>t.has(e.toString())))}join(e){if(Array.isArray(e))throw Gn.error("AlloySet",`[${e}] is an array, not an AlloySet, so unable to apply join.`);if(!(e instanceof Zn))throw Gn.error("AlloySet",`${e} is something other than an AlloySet, so unable to apply join.`);if(!this.tuples().length||!e.tuples().length)return new Zn;const t=function(e,t){const n=new Map;return t.forEach((e=>{const t=e.atoms()[0];n.has(t.id())||n.set(t.id(),[]),n.get(t.id()).push(e)})),n}(0,e.tuples()),n=[],r=this._tuples[0].atoms().length-1;return this.tuples().forEach((e=>{const o=e.atoms()[r],s=t.get(o.id());s&&s.forEach((t=>{const r=e.atoms().slice(0,-1).concat(...t.atoms().slice(1));n.push(new Wn(r))}))})),new Zn(function(e){const t=new Set;return e.filter((e=>{const n=e.atoms().map((e=>e.id())).join();return!t.has(n)&&(t.add(n),!0)}))}(n))}toString(){return this._tuples.map((e=>e.toString())).join("\n")}tuples(){return this._tuples.slice()}}class Wn extends Zn{constructor(e){super(),this._tuples=[this],this._atoms=e}atoms(){return this._atoms.slice()}toString(){return this._atoms.map((e=>e.id())).join(", ")}static tuplesFromXML(e,t){return Array.from(e).map((e=>{if(1===t.length)return Wn.buildTuple(t[0],e);const n=t.reduce(((t,n)=>{if(t)return t;try{return Wn.buildTuple(n,e)}catch(e){return}}),void 0);if(n)return n;throw Gn.error("AlloyField",`No match for tuple element ${e} in declared types ${t}`)}))}static buildTuple(e,t){const n=Array.from(t.querySelectorAll("atom")).map(((t,n)=>{const r=e[n],o=t.getAttribute("label");if(!o)throw Gn.missingAttribute("AlloyField","label");const s=r.atom(o);if(!s)throw Gn.error("AlloyField",`No atom: ${o} in type: ${r}`);return s}));return new Wn(n)}}class Un extends Zn{constructor(e,t){super();const n=t?t.applyProxy(this,function(e){return e.replace("/","$").replace("-","$")}(e)):this;return this._id=e,this._tuples=[new Wn([n])],n}clone(e){return new Un(this.id(),e)}id(){return this._id}static fromElement(e,t){const n=e.getAttribute("label");if(!n)throw Gn.missingAttribute("AlloyAtom","label");return new Un(n,t)}}const qn=[{name:"VisualObject",value:En},{name:"Shape",value:Ln},{name:"Grid",value:class extends En{constructor(e){super(e.grid_location),this.config=e;let t=yn({x:0,y:0},this.config.grid_location);this.center=()=>{const e=t();return{x:e.x+this.config.grid_dimensions.x_size*this.config.cell_size.x_size/2,y:e.y+this.config.grid_dimensions.y_size*this.config.cell_size.y_size/2}},this.coords=()=>{const e=this.center();return{x:e.x-this.config.grid_dimensions.x_size*this.config.cell_size.x_size/2,y:e.y-this.config.grid_dimensions.y_size*this.config.cell_size.y_size/2}},this.cells=new Array(this.config.grid_dimensions.y_size).fill([]);for(var n=0;nthis.config.cell_size.y_size)throw`Proposed object to add is taller than grid cells. Add "true" as the last parameter to\n grid.add() to hide this error.\n Grid cells are ${this.config.cell_size.y_size}\n units tall, while the object you want to add is ${n} units tall`;if(t>this.config.cell_size.x_size)throw`Proposed object to add is wider than grid cells. Add "true" as the last parameter to\n grid.add() to hide this error.\n Grid cells are ${this.config.cell_size.x_size}\n units tall, while the object you want to add is ${t} units tall`}add(e,t,n){if(!(t instanceof En))throw new Error("Grid can only add VisualObjects as children.");this.check_coords(e),n||this.check_bounding_box(t.boundingBox()),this.children.push(t),t.center=this.center_helper(e,t.origin_offset),this.cells[e.y][e.x]=t}center_helper(e,t){return()=>{let n=t();const r=this.coords();return{x:r.x+this.config.cell_size.x_size*(e.x+.5)+n.x,y:r.y+this.config.cell_size.y_size*(e.y+.5)+n.y}}}fill_grid_lines(){for(let e=0;e<=this.config.grid_dimensions.y_size;e++){const t=new Rn({points:[()=>{const t=this.coords();return{x:t.x,y:t.y+e*this.config.cell_size.y_size}},()=>{const t=this.coords();return{x:t.x+this.config.grid_dimensions.x_size*this.config.cell_size.x_size,y:t.y+e*this.config.cell_size.y_size}}]});this.gridlines.push(t),this.children.push(t)}for(let e=0;e<=this.config.grid_dimensions.x_size;e++){const t=new Rn({points:[()=>{const t=this.coords();return{x:t.x+e*this.config.cell_size.x_size,y:t.y}},()=>{const t=this.coords();return{x:t.x+e*this.config.cell_size.x_size,y:t.y+this.config.grid_dimensions.y_size*this.config.cell_size.y_size}}]});this.gridlines.push(t),this.children.push(t)}}hide_grid_lines(){this.gridlines.forEach((e=>{e.setOpacity(0)}))}fill(e,t){this.check_coords(e);const n=new Tn({height:this.config.cell_size.x_size,width:this.config.cell_size.y_size});n.setColor(t),this.add(e,n)}check_coords(e){if(!Number.isInteger(e.x)||!Number.isInteger(e.y))throw`non-integer indices given for grid coords. Inputted coords: ${e.x},${e.y}`;if(e.x<0||e.y<0)throw"negative indices given for grid coords";if(e.x>this.config.grid_dimensions.x_size-1||e.y>this.config.grid_dimensions.y_size-1)throw`coordinates out of bounds. Grid is of x_size ${this.config.grid_dimensions.x_size} and y_size ${this.config.grid_dimensions.y_size}\n\n Note: passing in 2 refers to index 2 which is the third element of the grid`}childAt(e,t){if(void 0!==this.cells[e]&&void 0!==this.cells[e][t])return this.cells[e][t]}}},{name:"Rectangle",value:Tn},{name:"Circle",value:Pn},{name:"Stage",value:class{constructor(){this.Children=[],this.masks=[]}add(e){if(!(e instanceof En))throw new Error("Stage can only add VisualObjects as children.");this.Children.push(e)}addAll(e){e.forEach((e=>{this.Children.push(e)}))}remove(e){this.Children=this.Children.filter((t=>t!==e))}addMask(e){this.masks.push(e)}childrenToTreeRecurse(e){const t=e.constructor.name,n={visualObject:new _n({text:t}),children:[]};return 0==e.getChildren().length||e.children.forEach((e=>{n.children.push(this.childrenToTreeRecurse(e))})),n}render(e,t){if(zn.Ys(e).selectAll("*").remove(),this.Children.forEach((t=>t.render(e,this.masks))),t){const e=t.getElementById("svg-container");e.getElementsByTagName("svg")[0].style.height="200%",e.getElementsByTagName("svg")[0].style.width="200%"}}}},{name:"TextBox",value:_n},{name:"Line",value:Rn},{name:"Polygon",value:class extends Ln{constructor(e){let t=e.points.map((e=>yn({x:0,y:0},e)));e.center=()=>vn(t.map((e=>e()))),super(e),this.pointsRelative=jn(t,this.center)}boundingBox(){return An(this.pointsRelative.map((e=>({x:e().x+this.center().x,y:e().y+this.center().y}))))}render(e,t){let n,r="";n=t?this.masks.concat(t):this.masks;let o=this.pointsRelative.map((e=>({x:e().x+this.center().x,y:e().y+this.center().y}))),s=zn.ETc();s.moveTo(o[0].x,o[0].y),o.forEach((e=>{s.lineTo(e.x,e.y)})),s.closePath(),r=this.addMaskRender(n,e),zn.Ys(e).append("path").attr("d",s.toString()).attr("stroke-width",this.borderWidth).attr("stroke",this.borderColor).attr("fill",this.color).attr("mask",n.length>0?`url(#${r})`:"").attr("opacity",this.opacity()),super.render(e,n)}}},{name:"Tree",value:Vn},{name:"Edge",value:class extends En{constructor(e){var t,n,r,o;super(),this.obj1=e.obj1,this.obj2=e.obj2,this.textProps=null!==(t=e.textProps)&&void 0!==t?t:{},this.lineProps=null!==(n=e.lineProps)&&void 0!==n?n:{points:[]},this.textLocation=null!==(r=e.textLocation)&&void 0!==r?r:"none",this.obj1CoordsStore={x:0,y:0},this.obj2CoordsStore={x:0,y:0},this.fast_imprecise=null!==(o=e.fast_imprecise)&&void 0!==o&&o,this.obj1Coords=()=>({x:0,y:0}),this.obj2Coords=()=>({x:0,y:0}),this.compute_points(30),this.makeLine(),this.makeText()}compute_points(e){const t=In(this.obj1.center(),this.obj2.center());this.obj2Coords=()=>this.opt_points(t,this.obj2,e,"obj1"),this.obj1Coords=()=>this.opt_points(t,this.obj1,e,"obj2")}opt_points(e,t,n,r){if(this.fast_imprecise){let e;if("obj1"==r)e=this.obj1CoordsStore;else{if("obj2"!=r)throw"bad arg for coordsstore";e=this.obj1CoordsStore}if(e.xt.boundingBox().top_left.x&&e.y>t.boundingBox().bottom_right.y&&e.y{Mn(t,e)function(e,t){if(e.x==t.x)return 90;{let n=(e.y-t.y)/(e.x-t.x);return Math.atan(n)}}(this.obj1Coords(),this.obj2Coords()),n=()=>Math.sqrt(Math.pow(e.fontSize(),2)+Math.pow(.14*e.text().length*e.fontSize(),2)),r=()=>{const e=this.arcMidpoint();return void 0!==e?e:In(this.obj1Coords(),this.obj2Coords())};switch(this.textLocation){case"above":e.setCenter((()=>({x:r().x+Math.cos(t()-Math.PI/2)*n(),y:r().y+Math.sin(t()-Math.PI/2)*n()})));break;case"below":e.setCenter((()=>({x:r().x+Math.cos(t()+Math.PI/2)*n(),y:r().y+Math.sin(t()+Math.PI/2)*n()})));break;case"left":e.setCenter((()=>t()<=0?{x:r().x+Math.cos(t()-Math.PI/2)*n(),y:r().y+Math.sin(t()-Math.PI/2)*n()}:{x:r().x+Math.cos(t()+Math.PI/2)*n(),y:r().y+Math.sin(t()+Math.PI/2)*n()}));break;case"right":e.setCenter((()=>t()<=0?{x:r().x+Math.cos(t()+Math.PI/2)*n(),y:r().y+Math.sin(t()+Math.PI/2)*n()}:{x:r().x+Math.cos(t()-Math.PI/2)*n(),y:r().y+Math.sin(t()-Math.PI/2)*n()}));break;case"clockwise":e.setCenter((()=>{let e=Cn({x:this.obj2Coords().x-this.obj1Coords().x,y:this.obj2Coords().y-this.obj1Coords().y});return{x:r().x-e.y*n(),y:r().y+e.x*n()}}));break;case"counterclockwise":e.setCenter((()=>{let e=Cn({x:this.obj2Coords().x-this.obj1Coords().x,y:this.obj2Coords().y-this.obj1Coords().y});return{x:r().x+e.y*n(),y:r().y-e.x*n()}}));break;default:console.log(`default text position: midpoint of line or arc: at ${JSON.stringify(r())}`),e.setCenter((()=>({x:r().x,y:r().y})))}this.children.push(e)}arcMidpoint(){if(!this.lineProps)return;const e=this.lineProps.curve instanceof Function?this.lineProps.curve():this.lineProps.curve;if(e){if("arc"===e.curveType){const t=function({x1:e,y1:t,rx:n,ry:r,phi:o,fA:s,fS:i,x2:a,y2:l}){let c,d,p,h,u;const m=2*Math.PI;if(0==n||0==r)throw Error("rx and ry can not be 0");n<0&&(n=-n),r<0&&(r=-r);const g=Math.sin(o),f=Math.cos(o),x=(e-a)/2,b=(t-l)/2,y=(e+a)/2,w=(t+l)/2,v=f*x+g*b,j=f*b-g*x,A=v*v/(n*n)+j*j/(r*r);A>1&&(n*=Math.sqrt(A),r*=Math.sqrt(A));var S=n*r,M=n*j,C=r*v,I=M*M+C*C;if(!I)throw Error("start point can not be same as end point");var O=Math.sqrt(Math.abs((S*S-I)/I));s==i&&(O=-O);var k=O*M/r,N=-O*C/n;c=f*k-g*N+y,d=g*k+f*N+w;var z=(v-k)/n,D=(v+k)/n,E=(j-N)/r,_=(j+N)/r;for(p=Nn(1,0,z,E),h=Nn(z,E,-D,-_);h>m;)h-=m;for(;h<0;)h+=m;for(0==i&&(h-=m),u=p+h;u>m;)u-=m;for(;u<0;)u+=m;return{cx:c,cy:d,startAngle:p,deltaAngle:h,endAngle:u,clockwise:1==i,rx:n,ry:r}}({x1:this.obj1Coords().x,y1:this.obj1Coords().y,rx:e.xradius,ry:e.yradius,phi:0,fA:!1,fS:1===e.sweep,x2:this.obj2Coords().x,y2:this.obj2Coords().y}),n=0===e.sweep;return{x:t.cx,y:n?t.cy+t.ry:t.cy-t.ry}}throw console.log(`unsupported curve type: ${e.curveType}`),new Error(`unsupported curve type: ${e.curveType}`)}}}},{name:"Hull",value:class extends En{constructor(e){var t,n;super(),this.fuzz=null!==(t=e.fuzz)&&void 0!==t?t:0,this.smooth=null!==(n=e.smooth)&&void 0!==n&&n,this.pts=function(e){let t=[],n=new Set;t.push(function(e){return e.sort(((e,t)=>e.x>t.x?1:t.x>e.x?-1:0))[0]}(e));let r=0;for(;0==r||t[r].x!=t[0].x||t[r].y!=t[0].y;){let o;0==r?o={x:0,y:1}:(o={x:t[r].x-t[r-1].x,y:t[r].y-t[r-1].y},n.add({x:t[r].x,y:t[r].y}));let s={x:0,y:0},i=2*Math.PI;e.forEach((e=>{if(!n.has({x:e.x,y:e.y})){let n={x:e.x-t[r].x,y:e.y-t[r].y},a=kn(o,n);(a{t.push({x:e.center().x,y:e.center().y})})):this.smooth?e.forEach((e=>{Sn(new Pn({radius:this.fuzz,center:e.center()}).getLam(),100).forEach((e=>t.push(e)))})):e.forEach((e=>{const n=new Tn({height:this.fuzz,width:this.fuzz});n.setCenter(e.center()),Sn(n.getLam(),100).forEach((e=>t.push(e)))})),t}render(e,t){let n;n=t?this.masks.concat(t):this.masks,new Rn({points:this.pts}).render(e,n)}}},{name:"ConjoinedObject",value:class extends En{constructor(e){super({x:0,y:0}),this.children=[],e&&e.forEach((e=>{this.add(e)}))}addOrdered(e,t){if(!(e instanceof En))throw new Error("ConjoinedObject can only add VisualObjects as children.");if(t>this.children.length)throw`Index larger than current number of objects stored plus 1. Add an index between 0 and ${this.children.length}`;this.children.splice(t,0,e)}add(e){this.addOrdered(e,0)}setCenter(e){this.children.forEach((t=>{t.setCenter(e)}))}}},{name:"boxUnion",value:wn},{name:"Ellipse",value:class extends Ln{constructor(e){super(e),this.height=yn(0,e.height),this.width=yn(0,e.width);let t=yn({x:0,y:0},e.coords);this.center=()=>{const e=t();return{x:e.x+this.width()/2,y:e.y+this.height()/2}}}boundingBox(){return{top_left:{x:this.center().x-this.width()/2,y:this.center().y-this.height()/2},bottom_right:{x:this.center().x+this.width()/2,y:this.center().y+this.height()/2}}}setWidth(e){this.width=yn(this.width(),e)}setHeight(e){this.height=yn(this.height(),e)}render(e,t){let n,r="";n=t?this.masks.concat(t):this.masks,r=this.addMaskRender(n,e),zn.Ys(e).append("ellipse").attr("cx",this.center().x-this.width()/2).attr("cy",this.center().y-this.height()/2).attr("rx",this.width()).attr("ry",this.height()).attr("stroke-width",this.borderWidth()).attr("stroke",this.borderColor()).attr("fill",this.color()).attr("mask",n.length>0?`url(#${r})`:"").attr("opacity",this.opacity()),super.render(e,n)}}},{name:"ImageBox",value:class extends En{constructor(e){super(e.coords),this.url=yn("",e.url),this.width=yn(100,e.width),this.height=yn(100,e.height)}boundingBox(){return{top_left:{x:this.center().x-this.width()/2,y:this.center().y-this.height()/2},bottom_right:{x:this.center().x+this.width()/2,y:this.center().y+this.height()/2}}}render(e,t){let n,r="";n=t?this.masks.concat(t):this.masks,r=this.addMaskRender(n,e),zn.Ys(e).append("svg:image").attr("x",this.center().x-this.width()/2).attr("y",this.center().y-this.height()/2).attr("width",this.width()).attr("height",this.height()).attr("mask",n.length>0?`url(#${r})`:"").attr("xlink:href",`${this.url()}`),super.render(e)}}},{name:"AlloySet",value:Zn},{name:"AlloyAtom",value:Un}];var Yn=n(25001);class Xn extends Zn{constructor(e,t,n){return super(),this._id=e,this._atoms=t,this._subsignatures=[],this._tuples=t.map((e=>new Wn([e]))),n?n.applyProxy(this,function(e){return e.replace(/^this\//,"").replace("/","$").replace("-","$")}(e)):this}atom(e){return this.atoms(!0).find((t=>t.id()===e))||null}atoms(e=!1){return e?this.atoms().concat(this.subSignatures().map((e=>e.atoms(!0))).reduce(((e,t)=>e.concat(t)),[])):this._atoms.slice()}tuples(){return this.atoms(!0).map((e=>new Wn([e])))}clone(e){const t=new Xn(this.id(),this.atoms().map((t=>t.clone(e))),e);return t._subsignatures=this.subSignatures().map((t=>t.clone(e))),t}id(){return this._id}subSignatures(e=!1){return e?this.subSignatures().concat(this.subSignatures().map((e=>e.subSignatures(!0))).reduce(((e,t)=>e.concat(t)),[])):this._subsignatures.slice()}static fromElement(e,t){const n=e.getAttribute("label");if(!n)throw Gn.missingAttribute("AlloySignature","label");const r=Array.from(e.querySelectorAll("atom")).map((e=>Un.fromElement(e,t)));return new Xn(n,r,t)}static intSignature(e,t){if(e<0)throw Gn.error("AlloySignature","Invalid bitwidth");const n=[];for(let r=Math.pow(2,e),o=-r/2;o{const n=e.getAttribute("ID"),o=e.getAttribute("label");if(!n)throw Gn.missingAttribute("AlloySignature","ID");const a=Xn.getParent(e);if(!a&&"univ"!==o)throw Gn.error("AlloySignature",`unable to resolve parent sig for non-univ sig ${o}`);const l="Int"===o||"seq/Int"===o?r:Xn.fromElement(e,t);return i.set(n,l),a&&"seq/Int"!==o&&(s.has(a)||s.set(a,[]),s.get(a).push(n)),l})),i.forEach(((e,t)=>{const n=s.get(t)||[];e._subsignatures=n.map((e=>i.get(e))).filter(Yn.$K)})),i}static getParent(e){const t=e.getAttribute("parentID"),n=e.getAttribute("label");if(!t&&"univ"!==n){const t=e.getElementsByTagName("type");if(1!==t.length)throw Gn.error("AlloySignature",`subset sig ${n} had no type or multiple types; this is unsupported`);if(t[0].getAttribute("ID"))return t[0].getAttribute("ID");throw Gn.missingAttribute("AlloySignature","type.ID")}return t}static typesFromXML(e,t){const n=e.querySelectorAll("types");if(!n)throw Gn.missingElement("AlloyField","types");return Array.from(n).map((e=>Xn.typesFromXMLSingle(e,t)))}static typesFromXMLSingle(e,t){return Array.from(e.querySelectorAll("type")).map((e=>{const n=e.getAttribute("ID");if(!n)throw Gn.missingAttribute("AlloyField","ID");const r=t.get(n);if(!r)throw Gn.error("Alloy Field",`No signature with ID: ${n}`);return r}))}}var Hn=n(44908),Jn=n.n(Hn);class Qn extends Zn{constructor(e,t){super(t),this._types=e}project(e){const t=Jn()(this.types().map((t=>t.map((t=>e.get(t))))).flat());t.some(Yn.$K)&&(this._tuples=this.tuples().filter((e=>e.atoms().every(((e,n)=>void 0===t[n]||t[n]===e)))).map((e=>new Wn(e.atoms().filter(((e,n)=>void 0===t[n]))))))}types(){return this._types.slice()}join(e){if(e instanceof Qn){const t=this.types().map((e=>e.at(-1))),n=e.types().map((e=>e.at(0)));if(!t.some((e=>n.includes(e))))throw Gn.error("Join",`Joining ${this} and ${e} will always be empty.`)}return super.join(e)}}class Kn extends Qn{constructor(e,t,n,r,o){return super(t,n),this._id=e,r?r.applyProxy(this,o?function(e){return e.replace(/-/g,"$").replace("/","$")}(o):e):this}clone(e,t){this.types().forEach((e=>{if(!this.types().every(Yn.$K))throw Gn.error("AlloyField","Missing type, cannot clone field")}));const n=this.tuples().map((e=>new Wn(e.atoms().map(((e,t)=>e.clone())))));if(t){const e=Reflect.get(this,"__var__");if(!e)throw Gn.error("AlloyField","Cannot use proxy to clone non-proxied field");return new Kn(this.id(),this.types(),n,t,e.toString())}return new Kn(this.id(),this.types(),n)}id(){return this._id}static fieldsFromXML(e,t,n){const r=Array.from(e.querySelectorAll("field")),o=new Map;return r.forEach((e=>{const t=e.getAttribute("label");if(!t)throw Gn.missingAttribute("AlloyField","label");o.set(t,(o.get(t)||0)+1)})),r.map((e=>{const r=e.getAttribute("label"),s=e.getAttribute("parentID"),i=Xn.typesFromXML(e,t);if(!r)throw Gn.missingAttribute("AlloyField","label");if(!s)throw Gn.missingAttribute("AlloyField","parentID");const a=o.get(r)||0,l=t.get(s);if(!l)throw Gn.error("AlloyField","Field parent type does not exist");const c=a>1?(d=r,p=l,`${Reflect.get(p,"__var__")}$${d}`):r;var d,p;const h=Wn.tuplesFromXML(e.querySelectorAll("tuple"),i);return new Kn(r,i,h,n,c)}))}}class er{constructor(){this._sets=new Map}applyProxy(e,t){const n=this._sets,r=t||`${n.size}`,o=this._finalize.bind(this);if(n.has(r))throw Gn.error("AlloyProxy",`Cannot apply proxy, ID already exists: ${r}. (This may be caused by a clash between sig and atom names.)`);const s=new Proxy(e,{get(e,r){if("symbol"==typeof r||r in e)return Reflect.get(e,r);if("number"!=typeof r&&isNaN(+r)){let s;const i=r.match(/\[(.*)]/);if(i){const r=n.get(i[1]);if(!r)throw Gn.error("Box Join",`Tried to join ${t} with ${i[1]} but no set ${i[1]} defined.`,!0);s=r.join(e)}else{const o=n.get(r);if(!o)throw Gn.error("Dot Join",`Tried to join ${t} with ${r} but no set ${r} defined.`,!0);s=e.join(o)}return o(s)}{const t=n.get(`${r}`);if(!t)throw Gn.error("Join",`Integer atom does not exist: ${r}`);return o(t.join(e))}}});return Reflect.set(s,Symbol.toPrimitive,(()=>`[${r}]`)),Reflect.set(s,"__var__",r),this._sets.set(r,s),s}_finalize(e){if(1===e.tuples().length&&1===e.tuples()[0].atoms().length){const t=e.tuples()[0].atoms()[0];return this._sets.get(t.id())||this.applyProxy(t,t.id())}return this.applyProxy(e)}}class tr extends Qn{constructor(e,t,n,r){return super(t,n),this._id=e,r?r.applyProxy(this,function(e){return e.replace(/^\$this\//,"$").replace("/","$").replace(/'/g,"$")}(e)):this}clone(e,t){const n=this.tuples().map((e=>new Wn(e.atoms().map(((e,t)=>e.clone())))));return new tr(this.id(),this.types(),n,t)}id(){return this._id}static skolemsFromXML(e,t,n){return Array.from(e.querySelectorAll("skolem")).map((e=>{const r=e.getAttribute("label"),o=Xn.typesFromXML(e,t),s=Wn.tuplesFromXML(e.querySelectorAll("tuple"),o);if(!r)throw Gn.missingAttribute("AlloySkolem","label");return new tr(r,o,s,n)}))}}class nr{constructor(e,t){this._proxy=new er,this._atoms=[],this._fields=[],this._signatures=[],this._skolems=[],this._projections=new Map,this._bitwidth=0,this._command="",this._filename="",this._sources=new Map,e&&this._buildFromXML(e,t)}atom(e){return this._atoms.find((t=>t.id()===e))||null}atoms(){return this._atoms.slice()}bitwidth(){return this._bitwidth}clone(){const e=new er,t=this.univ();if(!t)throw Gn.error("AlloyInstance","Cannot clone an instance without univ signature");const n=t.clone(e),r=[n,...n.subSignatures(!0)],o=n.atoms(!0),s=this.fields().map((t=>t.clone(r,e))),i=this.skolems().map((t=>t.clone(r,e))),a=new nr;return a._proxy=e,a._fields=s,a._signatures=r,a._atoms=o,a._skolems=i,a._bitwidth=this.bitwidth(),a._command=this.command(),a._filename=this.filename(),a}command(){return this._command}field(e){return this._fields.find((t=>t.id()===e))||null}fields(){return this._fields}filename(){return this._filename}project(e){const t=this.clone(),n=e.map((e=>t.atom(e.id())));if(!n.every(Yn.$K))throw Gn.error("AlloyInstance","Error cloning instance");const r=t.univ();if(!r)throw Gn.error("AlloyInstance","No univ signature");const o=r.subSignatures(),s=new Map;return n.forEach((e=>{o.forEach((t=>{if(t.atoms(!0).includes(e)){if(s.has(t))throw Gn.error("AlloyInstance","Cannot project over multiple atoms from the same signature");s.set(t,e)}}))})),this._projections=s,t.fields().forEach((e=>e.project(s))),t.skolems().forEach((e=>e.project(s))),t}projections(){return new Map(this._projections)}signature(e){return this.signatures().find((t=>t.id()===e))||null}signatures(){return this._signatures.slice()}skolem(e){return this.skolems().find((t=>t.id()===e))||null}skolems(){return this._skolems.slice()}sources(){return new Map(this._sources)}univ(){return this._signatures.find((e=>"univ"===e.id()))||null}_buildFromXML(e,t){const n=(new DOMParser).parseFromString(e,"application/xml"),r=n.querySelectorAll("instance"),o=void 0!==t?r[t]:r[0];if(!o)throw Gn.missingElement("AlloyInstance","instance");const s=o.getAttribute("bitwidth"),i=o.getAttribute("command"),a=o.getAttribute("filename"),l=o.getAttribute("maxseq");if(!s)throw Gn.missingAttribute("AlloyInstance","bitwidth");if(!i)throw Gn.missingAttribute("AlloyInstance","command");if(!a)throw Gn.missingAttribute("AlloyInstance","filename");if(!l)throw Gn.missingAttribute("AlloyInstance","maxseq");if(+s<1)throw Gn.error("AlloyInstance",`Invalid bitwidth ${s}`);this._bitwidth=+s,this._command=i,this._filename=a,this._atoms=[],this._fields=[],this._signatures=[],this._skolems=[];const c=Xn.signaturesFromXML(o,this._proxy);this._signatures=Array.from(c.values()),this._fields=Kn.fieldsFromXML(o,c,this._proxy),this._skolems=tr.skolemsFromXML(o,c,this._proxy),this._atoms=this._signatures.map((e=>e.atoms())).reduce(((e,t)=>e.concat(t)),[]),this._sources=new Map,Array.from(n.querySelectorAll("source")).forEach((e=>{const t=e.getAttribute("filename"),n=e.getAttribute("content");if(!t)throw Gn.missingAttribute("AlloyInstance","filename");if(!n)throw Gn.missingAttribute("AlloyInstance","content");this._sources.set(t,n)}))}}const rr="https://alloy-js.github.io/alloy-ts/classes/alloyinstance.alloyinstance-1.html",or=function(e){return e.stage},sr=function(e){return e.stageDimensions},ir=function(e){return e.text},ar=function(e,t,n){if(xt(e)){const r=e.data,o=e.parsed.instances.map(((e,t)=>new nr(r,t))),s=o[n],i=s.atoms(),a=[];t.forEach((e=>{const t=e.atom;if(t){const e=i.find((e=>e.id()===t));e&&a.push(e)}}));const l=s.project(a),c=l.signatures().map((e=>({name:Reflect.get(e,"__var__"),variable:e,type:"AlloySignature",typeUrl:"https://alloy-js.github.io/alloy-ts/classes/alloysignature.alloysignature-1.html"}))),d=l.atoms().filter((e=>isNaN(+e.id()))).map((e=>({name:Reflect.get(e,"__var__"),variable:e,type:"AlloyAtom",typeUrl:"https://alloy-js.github.io/alloy-ts/classes/alloyatom.alloyatom-1.html"}))),p=l.fields().map((e=>({name:Reflect.get(e,"__var__"),variable:e,type:"AlloyField",typeUrl:"https://alloy-js.github.io/alloy-ts/classes/alloyfield.alloyfield-1.html"}))),h=l.skolems().map((e=>({name:Reflect.get(e,"__var__"),variable:e,type:"AlloySkolem",typeUrl:"https://alloy-js.github.io/alloy-ts/classes/alloyskolem.alloyskolem-1.html"}))),u=qn.map((e=>({name:e.name,variable:e.value,type:"D3Helper",typeUrl:"https://csci1710.github.io/forge-documentation/sterling/d3fx.html"}))),m=[{name:"instance",variable:s,type:"AlloyInstance",typeUrl:rr},...c,...d,...p,...h,...u];return qt(e.parsed)&&m.unshift({name:"currentInstance",type:"number",variable:n},{name:"loopBack",type:"number",variable:e.parsed.loopBack},{name:"instances",variable:o,type:"AlloyInstance[]",typeUrl:rr}),m}return function(e){return"raw"===e.format}(e)?[{name:"data",variable:e.data,type:"string"}]:[]};function lr(e){return e.mainView}function cr(e){return e.graphViewDrawer}function dr(e){return e.tableViewDrawer}function pr(e){return e.scriptViewDrawer}const hr={selectAvailableViews:function(e){return e.availableViews},selectMainView:lr,selectGraphDrawer:cr,selectTableDrawer:dr,selectScriptDrawer:pr,selectDrawerIsCollapsed:(0,tn.P1)([lr,cr,dr,pr],((e,t,n,r)=>{switch(e){case"GraphView":return null===t;case"TableView":return null===n;case"ScriptView":return null===r;default:return!0}})),selectDrawerView:(0,tn.P1)([lr,cr,dr,pr],((e,t,n,r)=>{switch(e){case"GraphView":return t;case"TableView":return n;case"ScriptView":return r;default:return null}})),selectSelectedGenerator:function(e){return e.selectedGenerator}};function ur(e){return an.selectActiveDatum(e.data)}function mr(e){return hr.selectSelectedGenerator(e.ui)}function gr(e){return hr.selectAvailableViews(e.ui)}function fr(e){return an.selectData(e.data)}function xr(e,t){return xt(t)&&qt(t.parsed)}function br(e){return hr.selectDrawerIsCollapsed(e.ui)}function yr(e){return hr.selectDrawerView(e.ui)}function wr(e){return hr.selectGraphDrawer(e.ui)}function vr(e){const t=ur(e);return void 0!==t&&!0===t.evaluator}function jr(e,t){return ln(e.evaluator,t)}function Ar(e){return gn(e.provider)}function Sr(e){return mn(e.log)}function Mr(e){return hr.selectMainView(e.ui)}function Cr(e){return cn(e.evaluator)}function Ir(e,t){const n={};if(t&&xt(t)){const e=t.parsed.instances[0];(function(e){return(0,Yt.Z)(dt(e).map(Xe)).filter((e=>!(0,Wt.Z)(e)))})(e).forEach((t=>{const r=ct(e,t);n[t]=function(e,t){return it(e).filter((n=>function(e,t,n){return"string"==typeof t&&(t=st(e,t)),"string"!=typeof n&&(n=n.id),tt(e,t).types.includes(n)}(e,n,t)))}(e,r).map((e=>e.id))}))}return n}function Or(e,t){return un.selectProjections(e.graphs,t)}function kr(e){return fn(e.provider)}function Nr(e){return xn(e.provider)}function zr(e){return hr.selectScriptDrawer(e.ui)}function Dr(e){return or(e.script)}function Er(e){return sr(e.script)}function _r(e){return ir(e.script)}function Lr(e){return hr.selectTableDrawer(e.ui)}function Tr(e,t){return un.selectTimeIndex(e.graphs,t)}(0,tn.P1)([(e,t)=>t,(e,t)=>t?function(e,t){return un.selectGraphLayout(e.graphs,t)}(e,t):void 0,(e,t)=>t?function(e,t){return un.selectTheme(e.graphs,t)}(e,t):void 0,(e,t)=>t?Tr(e,t):void 0,(e,t)=>t?function(e,t){return un.selectHiddenRelations(e.graphs,t)}(e,t):void 0],((e,t,n,r,o)=>{if(e&&t&&n&&void 0!==r&&xt(e)&&o){const s=e.parsed.instances[r],i=n.projections||[],a=i.filter((e=>!0===e.time)),l=Xt(s,i.map((e=>e.atom)).filter(qe)),c=Lt(l,n);if(a.length)return a.map((e=>{let r=c;o[e.type]&&o[e.type].forEach((e=>{const t=G(r).filter((t=>t.relation.name===e)).map((e=>e.id));r=function(e,t){return(0,St.Uy)(e,(e=>{t.forEach((t=>{const n=F(e,t);n&&function(e,t){const{id:n,source:r,target:o}=t;delete e.edges[n],function(e,t,n,r){const o=e.predecessors[n][t];if(o){const s=o.indexOf(r);-1!==s&&o.splice(s,1),0===o.length&&delete e.predecessors[n][t]}}(e,r,o,n),function(e,t,n,r){const o=e.successors[t][n];if(o){const s=o.indexOf(r);-1!==s&&o.splice(s,1),0===o.length&&delete e.successors[t][n]}}(e,r,o,n),function(e,t,n){const r=e.inedges[t].indexOf(n);-1!==r&&e.inedges[t].splice(r,1)}(e,o,n),function(e,t,n){const r=e.outedges[t].indexOf(n);-1!==r&&e.outedges[t].splice(r,1)}(e,r,n)}(e,n)}))}))}(c,t)}));const s=Ut(r,t);return Bt("",l,s,n)}));const d=Ut(c,t);return[Bt("",l,d,n)]}return console.log(`datum: ${void 0!==e}`),console.log(`layout: ${void 0!==t}`),console.log(`theme: ${void 0!==n}`),console.log(`time: ${r}`),[]}));const Pr=(0,tn.P1)([(e,t)=>t,(e,t)=>Or(e,t),(e,t)=>Tr(e,t)],((e,t,n)=>ar(e,t,n))),Br=(0,tn.P1)([(e,t)=>t,(e,t)=>Tr(e,t)],((e,t)=>{if(xt(e)){const n=e.parsed.instances[t],r=function(e){const t=lt(e),n=at(e);return t.concat(n)}(n).map((e=>({title:e.name,type:"relation",headers:e.types,data:rt(e).map((e=>e.atoms))})));return[...r,...dt(n).map((e=>({title:e.id,type:"type",data:He(e).map((e=>[e.id]))})))]}return[]}));function Rr(e,t){return un.selectCnDSpec(e.graphs,t)}function Vr(e){return bn(e.provider)}function $r(e){return e.synthesis.isActive}function Fr(e){return e.synthesis.selectorType}function Gr(e){return e.synthesis.currentStep}function Zr(e){return e.synthesis.numInstances}function Wr(e){return e.synthesis.examples}function Ur(e){return e.synthesis.loadedInstances}function qr(e){return e.synthesis.result}function Yr(e){return e.synthesis.error}function Xr(e){return e.synthesis.isLoading}function Hr(e){return!e.synthesis.isLoading&&e.synthesis.examples.length===e.synthesis.numInstances&&e.synthesis.examples.every((e=>e.selectedAtomIds.length>0||e.selectedPairs.length>0))}function Jr(e){return e.synthesis.currentDataInstance}var Qr=n(10894),Kr=n(66653);const eo=e=>{const{expression:t}=e;return(0,r.jsxs)("div",Object.assign({className:"relative p-2 font-mono text-xs"},{children:[(0,r.jsxs)("div",Object.assign({className:"relative flex ml-6"},{children:[(0,r.jsx)("span",Object.assign({className:"absolute inset-y-0 -left-5"},{children:(0,r.jsx)(Qr.JO,{as:Kr.tOB})})),(0,r.jsx)("div",Object.assign({className:"font-semibold select-text"},{children:t.expression}))]})),(0,r.jsx)("div",Object.assign({className:"ml-6 text-gray-600 select-text"},{children:t.result}))]}))},to=e=>{const{datum:t}=e,n=At((e=>jr(e,t)));return(0,r.jsx)("div",Object.assign({className:"absolute inset-x-0 top-[35px] bottom-0 flex flex-col overflow-y-auto"},{children:n.map((e=>(0,r.jsx)(eo,{expression:e},e.id)))}))},no=e=>{const{datum:t}=e,[n,s]=(0,o.useState)(""),[i,a]=(0,o.useState)(null),l=At(vr),c=At(Cr),d=At((e=>jr(e,t))),p=jt(),h=(0,o.useCallback)((e=>{a(null),s(e.target.value)}),[]),u=(0,o.useCallback)((e=>{var t;if(!(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||(t=e.code,ro.includes(t))))switch(e.code){case"ArrowUp":null===i?d.length>0&&a(0):i{e.preventDefault(),n.length>0&&(p(Te({id:`${c}`,datumId:t.id,expression:n})),s(""),a(null))}),[t,c,n]),g=l?"gray.500":"gray.300",f=l?"Enter an expression...":"Evaluator disabled";return(0,r.jsx)("div",Object.assign({className:"absolute inset-x-0 top-0 h-[35px]"},{children:(0,r.jsxs)("form",Object.assign({className:"relative block font-mono",onSubmit:m},{children:[(0,r.jsx)("span",Object.assign({className:"sr-only"},{children:"Search"})),(0,r.jsx)("span",Object.assign({className:"absolute inset-y-0 left-0 flex items-center pl-2"},{children:(0,r.jsx)(Qr.JO,{color:g,as:Kr.tOB})})),(0,r.jsx)("input",{className:"h-[35px] text-xs placeholder:italic placeholder:text-gray-400 placeholder:text-xs block bg-white w-full border-b border-gray-100 focus:border-gray-200 py-2 pl-9 pr-3 focus:outline-none",placeholder:f,type:"text",disabled:!l,value:null===i?n:d[i].expression,onChange:h,onKeyDown:u})]}))}))},ro=["Unidentified","Escape","Enter","ControlLeft","ControlRight","ShiftLeft","ShiftRight","AltLeft","AltRight","CapsLock","OSLeft","OSRight","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","ScrollLock","ArrowLeft","ArrowRight"],oo=()=>{const e=At(ur);return e?(0,r.jsxs)("div",Object.assign({className:"absolute inset-0"},{children:[(0,r.jsx)(no,{datum:e}),(0,r.jsx)(to,{datum:e})]})):null},so=()=>(0,r.jsxs)("div",Object.assign({className:"flex items-center px-2 space-x-2"},{children:[(0,r.jsx)(Qr.JO,{as:Kr.RJr}),(0,r.jsx)(k,{children:"Evaluator"})]})),io=()=>{const e=At(Sr);return(0,r.jsx)(b,Object.assign({h:"full",px:2,py:1,overflowY:"auto"},{children:e.map(((e,t)=>(0,r.jsx)(B,{text:e.text,time:new Date(e.time),variant:e.type},t)))}))},ao=()=>(0,r.jsxs)("div",Object.assign({className:"flex items-center px-2 space-x-2"},{children:[(0,r.jsx)(Qr.JO,{className:"mt-0.5",as:Kr.t75}),(0,r.jsx)(k,{children:"Log"})]}));var lo=n(89583),co=n(57324),po=n(51649),ho=n(48707),uo=n(41947),mo=n(18124);const go={nodeWidth:100,nodeHeight:60,nodeSep:100,rankSep:100},fo={hidden:{builtinDisconnected:!0},nodes:[{shape:{shape:"rectangle",width:100,height:60},styles:{node:{stroke:"#333",strokeWidth:1,fill:"#ffffff"},label:{fontFamily:"monospace",fontSize:"14px",textAnchor:"middle",userSelect:"none",fill:"#333"}},props:{label:{dy:"0.33em"}},targets:["*"]}],edges:[{asAttribute:!1,sourceIndex:0,curve:{type:"bspline"},styles:{edge:{stroke:"#333",strokeWidth:1,fill:"none"},label:{fontFamily:"monospace",fontSize:"12px",textAnchor:"middle",userSelect:"none"}},targets:["*"]}]};function xo(e,t){var n;return null===(n=e.edges)||void 0===n?void 0:n.find((e=>{const n=e.targets,r=n?n[0]:void 0;return void 0!==n&&1===n.length&&void 0!==r&&"*"!==r&&r.relation===t}))}function bo(e,t){var n;return null===(n=e.nodes)||void 0===n?void 0:n.find((e=>{const n=e.targets,r=n?n[0]:void 0;return void 0!==n&&1===n.length&&void 0!==r&&"*"!==r&&r.type===t}))}function yo(e,t){var n;if(xt(t)){const r=e.themeByGeneratorName[null!==(n=t.generatorName)&&void 0!==n?n:""],o=r&&r.projections||[];if(o){const e=t.parsed.instances[0];o.forEach((t=>{if(!t.atom){const n=t.type,r=He(ct(e,n));r.length&&(t.atom=r[0].id)}}))}const s=dn(o),i=t.parsed.instances,a=o.map((e=>e.atom)).filter(qe),l=i.map((e=>Xt(e,a))).map((e=>Lt(e,r)));e.layoutsByDatumId[t.id].layoutById[s]=function(e,t){const n=new Set,r={};e.forEach((e=>{$(e).forEach((e=>{n.add(e.id)})),G(e).forEach((e=>{r[e.id]=e}))}));const o=new($t().graphlib.Graph)({multigraph:!0});o.setGraph({nodesep:t.nodeSep,ranksep:t.rankSep,rankdir:"TB"}),n.forEach((e=>{o.setNode(e,{label:e,width:t.nodeWidth,height:t.nodeHeight})})),(0,Ft.Z)(r,((e,t)=>{o.setEdge(e.source,e.target,{id:t})})),$t().layout(o);const s=function(e,t){const n=e.nodes().map((t=>e.node(t).x)),r=e.nodes().map((t=>e.node(t).y)),o=(0,Gt.Z)(n),s=(0,Gt.Z)(r),i=(0,Zt.Z)(n),a=(0,Zt.Z)(r);return{x:(0,Wt.Z)(o)||(0,Wt.Z)(i)?0:(i-o)/2+t.nodeWidth/2,y:(0,Wt.Z)(s)||(0,Wt.Z)(a)?0:(a-s)/2+t.nodeHeight/2}}(o,t),i={},a={};return o.nodes().forEach((e=>{const{x:t,y:n}=o.node(e);i[e]={x:t-s.x,y:n-s.y}})),o.edges().forEach((e=>{const{id:t,points:n}=o.edge(e);a[t]=n.slice(1,-1).map((e=>({x:e.x-s.x,y:e.y-s.y})))})),{nodePositions:i,edgeWaypoints:a}}(l,go)}}const wo={asAttributeSet:function(e,t){var n;const{datum:r,relation:o,asAttribute:s}=t.payload,i=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""];if(i){const e=xo(i,o);if(e)s?(0,ho.Z)(e,["asAttribute"],!0):(0,uo.Z)(e,["asAttribute"]);else if(s){const e={targets:[{relation:o}],asAttribute:!0};i.edges||(i.edges=[]),i.edges.push((0,St.cA)(e))}}},cndSpecSet:function(e,t){var n;const{datum:r,spec:o}=t.payload,s=null!==(n=r.generatorName)&&void 0!==n?n:"";e.cndSpecByGeneratorName[s]=o},curveRemoved:function(e,t){var n;const{datum:r,relation:o}=t.payload,s=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""];if(s){const e=xo(s,o);e&&(0,uo.Z)(e,["curve"])}},curveSet:function(e,t){var n;const{datum:r,relation:o,curve:s}=t.payload,i=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""];if(i){const e=xo(i,o);if(e)(0,ho.Z)(e,["curve"],s);else{const e={targets:[{relation:o}],curve:s};i.edges||(i.edges=[]),i.edges.push((0,St.cA)(e))}}},edgeLabelStyleRemoved:function(e,t){var n;const{datum:r,relation:o,style:s}=t.payload,i=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""];if(i){const e=xo(i,o);e&&(0,uo.Z)(e,["styles","label",s])}},edgeLabelStyleSet:function(e,t){var n;const{datum:r,relation:o,style:s,value:i}=t.payload,a=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""];if(a){const e=xo(a,o);if(e)(0,ho.Z)(e,["styles","label",s],i);else{const e={targets:[{relation:o}],styles:{label:{[s]:i}}};a.edges||(a.edges=[]),a.edges.push((0,St.cA)(e))}}},edgeStyleRemoved:function(e,t){var n;const{datum:r,relation:o,style:s}=t.payload,i=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""];if(i){const e=xo(i,o);e&&(0,uo.Z)(e,["styles","edge",s])}},edgeStyleSet:function(e,t){var n;const{datum:r,relation:o,style:s,value:i}=t.payload,a=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""];if(a){const e=xo(a,o);if(e)(0,ho.Z)(e,["styles","edge",s],i);else{const e={targets:[{relation:o}],styles:{edge:{[s]:i}}};a.edges||(a.edges=[]),a.edges.push((0,St.cA)(e))}}},edgeIndexSet:function(e,t){var n;const{datum:r,relation:o,which:s,value:i}=t.payload,a=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""];if(a){const t=xo(a,o);if(t)(0,ho.Z)(t,[s],i);else{const e={targets:[{relation:o}]};e[s]=i,a.edges||(a.edges=[]),a.edges.push((0,St.cA)(e))}yo(e,r)}},edgeIndexRemoved:function(e,t){var n;const{datum:r,relation:o,which:s}=t.payload,i=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""];if(i){const e=xo(i,o);e&&(0,uo.Z)(e,[s])}},graphSpread:function(e,t){const{datum:n,matrix:r}=t.payload,o=e.matricesByDatumId[n.id];o&&(o.spreadMatrix=r)},graphZoomed:function(e,t){const{datum:n,matrix:r}=t.payload,o=e.matricesByDatumId[n.id];o&&(o.zoomMatrix=r)},hiddenRelationAdded:function(e,t){const{datum:n,type:r,relation:o}=t.payload;e.hiddenByDatumId[n.id][r]||(e.hiddenByDatumId[n.id][r]=[]),e.hiddenByDatumId[n.id][r].push(o)},nodeLabelPropRemoved:function(e,t){var n;const{datum:r,type:o,prop:s}=t.payload,i=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""];if(i){const e=bo(i,o);e&&(0,uo.Z)(e,["props","label",s])}},nodeLabelPropSet:function(e,t){var n;const{datum:r,type:o,prop:s,value:i}=t.payload,a=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""];if(a){const e=bo(a,o);if(e)(0,ho.Z)(e,["props","label",s],i);else{const e={targets:[{type:o}],props:{label:{[s]:i}}};a.nodes||(a.nodes=[]),a.nodes.push((0,St.cA)(e))}}},nodeLabelStyleRemoved:function(e,t){var n;const{datum:r,type:o,style:s}=t.payload,i=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""];if(i){const e=bo(i,o);e&&(0,uo.Z)(e,["styles","label",s])}},nodeLabelStyleSet:function(e,t){var n;const{datum:r,type:o,style:s,value:i}=t.payload,a=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""];if(a){const e=bo(a,o);if(e)(0,ho.Z)(e,["styles","label",s],i);else{const e={targets:[{type:o}],styles:{label:{[s]:i}}};a.nodes||(a.nodes=[]),a.nodes.push((0,St.cA)(e))}}},nodesOffset:function(e,t){var n;const{datum:r,offsets:o}=t.payload,s=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""],i=dn(s&&s.projections||[]),a=e.layoutsByDatumId[r.id].layoutById[i];(0,Ft.Z)(o,((e,t)=>{const n=a.nodePositions[t];a.nodePositions[t]=ae(n,e)}))},projectionAdded:function(e,t){var n;const{datum:r,type:o,atom:s,time:i,timeOrdering:a}=t.payload,l={type:o,atom:s,time:i,timeOrdering:a},c=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""];c.projections?c.projections.push((0,St.cA)(l)):c.projections=[(0,St.cA)(l)],yo(e,r)},projectionOrderingSet:function(e,t){var n;const{datum:r,type:o,relation:s}=t.payload,i=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""],a=(i&&i.projections||[]).find((e=>e.type===o));a&&(s?a.timeOrdering=s:delete a.timeOrdering)},projectionRemoved:function(e,t){var n;const{datum:r,type:o}=t.payload,s=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""];s.projections&&(0,mo.Z)(s.projections,(e=>e.type===o)),yo(e,r)},projectionSet:function(e,t){var n;const{datum:r,type:o,atom:s}=t.payload,i=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""],a=(i&&i.projections||[]).find((e=>e.type===o));a&&(a.atom=s),yo(e,r)},saveThemeRequested:function(e,t){var n;const{datum:r}=t.payload,o=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""];if(o){const e=(0,St.Vk)(o),t=(0,St.Uy)(e,(e=>{var t;null===(t=e.projections)||void 0===t||t.forEach((e=>{(0,uo.Z)(e,"atom")}))})),n=JSON.stringify(t,null,2),r=document.createElement("a"),s=new Blob([n],{type:"application/json"});r.href=URL.createObjectURL(s),r.download="theme.json",r.click()}},shapeRemoved:function(e,t){var n;const{datum:r,type:o}=t.payload,s=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""];if(s){const e=bo(s,o);e&&(0,uo.Z)(e,["shape"])}},shapeSet:function(e,t){var n;const{datum:r,type:o,shape:s}=t.payload,i=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""];if(i){const e=bo(i,o);if(e)(0,ho.Z)(e,["shape"],s);else{const e={targets:[{type:o}],shape:s};i.nodes||(i.nodes=[]),i.nodes.push((0,St.cA)(e))}}},shapeStyleRemoved:function(e,t){var n;const{datum:r,type:o,style:s}=t.payload,i=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""];if(i){const e=bo(i,o);e&&(0,uo.Z)(e,["styles","node",s])}},shapeStyleSet:function(e,t){var n;const{datum:r,type:o,style:s,value:i}=t.payload,a=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""];if(a){const e=bo(a,o);if(e)(0,ho.Z)(e,["styles","node",s],i);else{const e={targets:[{type:o}],styles:{node:{[s]:i}}};a.nodes||(a.nodes=[]),a.nodes.push((0,St.cA)(e))}}},themeFileLoaded:function(e,t){var n;const{datum:r,data:o}=t.payload;e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""]=JSON.parse(o),yo(e,r)},timeIndexSet:function(e,t){const{datum:n,index:r}=t.payload;e.timeByDatumId[n.id]=r}},vo=function(e,t){const{enter:n}=t.payload;n&&n.filter(xt).forEach((t=>{var n,r,o;const s=t.id;e.matricesByDatumId[t.id]={datumId:s,spreadMatrix:(0,pe.yR)(),zoomMatrix:(0,pe.yR)()};const i=null!==(n=t.generatorName)&&void 0!==n?n:"";i in e.themeByGeneratorName||(e.themeByGeneratorName[i]=(0,St.cA)(fo)),e.layoutsByDatumId[s]={datumId:s,layoutById:{}},yo(e,t),e.timeByDatumId[s]=0,i in e.cndSpecByGeneratorName||(e.cndSpecByGeneratorName[i]=null!==(o=null===(r=t.parsed.visualizerConfig)||void 0===r?void 0:r.cnd)&&void 0!==o?o:"directives:\n - flag: hideDisconnectedBuiltIns"),e.hiddenByDatumId[s]={}}))},jo=(0,Ee.oM)({name:"graphs",initialState:{layoutsByDatumId:{},matricesByDatumId:{},themeByGeneratorName:{},timeByDatumId:{},hiddenByDatumId:{},cndSpecByGeneratorName:{}},reducers:wo,extraReducers:e=>e.addCase(Be,vo)}),{asAttributeSet:Ao,cndSpecSet:So,edgeLabelStyleRemoved:Mo,edgeLabelStyleSet:Co,edgeStyleRemoved:Io,edgeStyleSet:Oo,edgeIndexSet:ko,edgeIndexRemoved:No,curveRemoved:zo,curveSet:Do,graphSpread:Eo,graphZoomed:_o,hiddenRelationAdded:Lo,nodeLabelStyleRemoved:To,nodeLabelStyleSet:Po,nodeLabelPropRemoved:Bo,nodeLabelPropSet:Ro,nodesOffset:Vo,projectionAdded:$o,projectionOrderingSet:Fo,projectionRemoved:Go,projectionSet:Zo,shapeRemoved:Wo,saveThemeRequested:Uo,shapeSet:qo,shapeStyleRemoved:Yo,shapeStyleSet:Xo,themeFileLoaded:Ho,timeIndexSet:Jo}=jo.actions,Qo=jo.reducer,Ko=e=>{const{datum:t}=e,n=jt(),s=At((e=>function(e,t){const n=Ir(0,t),r=Or(e,t).map((e=>e.type)),o=(0,nn.Z)((0,rn.Z)(n),r);return(0,on.Z)(n,o)}(e,t))),i=(0,rn.Z)(s),a=(0,o.useCallback)((e=>{const r=s[e][0];n($o({datum:t,type:e,atom:r,time:!0}))}),[t,s]);return 0===i.length?null:(0,r.jsx)(c.M5,Object.assign({my:2},{children:(0,r.jsxs)(co.v2,{children:[(0,r.jsx)(co.j2,Object.assign({as:A.zx,colorScheme:"green",size:"xs",leftIcon:(0,r.jsx)(po.f8n,{})},{children:"Add Time Projection"})),(0,r.jsx)(co.qy,{children:i.map((e=>(0,r.jsx)(co.sN,Object.assign({onClick:()=>a(e)},{children:e}),e)))})]})}))};var es=n(11391),ts=n(5434);const ns=e=>{const{type:t,atom:n,atoms:o,onChange:s,onNext:i,onPrevious:a,onRemove:l,onToggle:c}=e;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",Object.assign({className:"text-sm px-2 flex items-center align-middle"},{children:t})),(0,r.jsx)("div",Object.assign({className:"flex items-center"},{children:(0,r.jsx)(es.Ph,Object.assign({className:"flex items-center",size:"xs",value:n,onChange:s},{children:o.map((e=>(0,r.jsx)("option",Object.assign({value:e},{children:e}),e)))}))})),(0,r.jsxs)("div",Object.assign({className:"px-2 flex items-center justify-end"},{children:[(0,r.jsxs)(A.hE,Object.assign({size:"xs",isAttached:!0},{children:[(0,r.jsx)(A.hU,{"aria-label":"Previous",icon:(0,r.jsx)(ts.G1X,{}),onClick:a}),(0,r.jsx)(A.hU,{"aria-label":"Remove",icon:(0,r.jsx)(ts.FU5,{}),onClick:l}),(0,r.jsx)(A.hU,{"aria-label":"Next",icon:(0,r.jsx)(ts.FNi,{}),onClick:i})]})),(0,r.jsx)(ts.G1X,{className:"-rotate-90 ml-2 cursor-pointer hover:text-black",onClick:c})]}))]})},rs=e=>{const{type:t,atom:n,atoms:o,relation:s,relations:i,onChange:a,onNext:l,onPrevious:c,onRelation:d,onRemove:p,onToggle:h,onHiddenRelation:u}=e;return(0,r.jsxs)("div",Object.assign({className:"m-2 p-2 col-span-3 flex flex-col border shadow"},{children:[(0,r.jsxs)("div",Object.assign({className:"flex justify-between pb-3"},{children:[(0,r.jsx)("div",Object.assign({className:"text-sm font-bold"},{children:t})),(0,r.jsx)(ts.G1X,{className:"rotate-90 cursor-pointer hover:text-black",onClick:h})]})),(0,r.jsxs)("div",Object.assign({className:"px-2 grid grid-cols-[minmax(max-content,auto)_minmax(max-content,auto)]"},{children:[(0,r.jsx)(es.Ph,Object.assign({size:"xs",value:n,onChange:a},{children:o.map((e=>(0,r.jsx)("option",Object.assign({value:e},{children:e}),e)))})),(0,r.jsx)("div",Object.assign({className:"mt-0.5 flex items-center justify-end"},{children:(0,r.jsxs)(A.hE,Object.assign({className:"px-2",size:"xs",isAttached:!0},{children:[(0,r.jsx)(A.zx,Object.assign({"aria-label":"Previous",leftIcon:(0,r.jsx)(ts.G1X,{}),onClick:c},{children:"Previous"})),(0,r.jsx)(A.zx,Object.assign({"aria-label":"Next",rightIcon:(0,r.jsx)(ts.FNi,{}),onClick:l},{children:"Next"}))]}))}))]})),(0,r.jsx)("div",Object.assign({className:"px-2 pt-2"},{children:s?(0,r.jsxs)("div",Object.assign({className:"px-2 text-sm flex justify-between items-center"},{children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("span",Object.assign({className:"font-semibold"},{children:s}))," defines total order"]}),(0,r.jsx)(ts.FU5,{onClick:()=>d(void 0)})]})):(0,r.jsxs)(co.v2,Object.assign({matchWidth:!0},{children:[(0,r.jsx)(co.j2,Object.assign({as:A.zx,width:"full",size:"xs",py:4},{children:"Select Ordering Relation"})),(0,r.jsx)(co.qy,{children:i.map((e=>(0,r.jsx)(co.sN,Object.assign({onClick:()=>d(e)},{children:e}),e)))})]}))})),(0,r.jsx)("div",Object.assign({className:"p-2"},{children:(0,r.jsxs)(co.v2,Object.assign({matchWidth:!0},{children:[(0,r.jsx)(co.j2,Object.assign({as:A.zx,width:"full",size:"xs",py:4},{children:"Hide a Relation"})),(0,r.jsx)(co.qy,{children:i.map((e=>(0,r.jsx)(co.sN,Object.assign({onClick:()=>u(e)},{children:e}),e)))})]}))})),(0,r.jsx)("div",Object.assign({className:"p-2"},{children:(0,r.jsx)(A.zx,Object.assign({"aria-label":"Remove",width:"full",size:"xs",py:4,colorScheme:"red",leftIcon:(0,r.jsx)(ts.FU5,{}),onClick:p},{children:"Remove Projection"}))}))]}))},os=e=>{const{datum:t,projection:n,atoms:s,relations:i}=e,{type:a,atom:l,timeOrdering:c}=n,[d,p]=(0,o.useState)(!1),h=jt(),u=(0,o.useCallback)((e=>{const n=e.target.value;h(Zo({datum:t,type:a,atom:n}))}),[t,a]),m=(0,o.useCallback)((()=>{if(l){const e=s.indexOf(l);e>0&&h(Zo({datum:t,type:a,atom:s[e-1]}))}}),[t,a,s,l]),g=(0,o.useCallback)((()=>{h(Go({datum:t,type:a}))}),[t,a]),f=(0,o.useCallback)((()=>{if(l){const e=s.indexOf(l);-1!==e&&e{h(Fo({datum:t,type:a,relation:e}))}),[t,a]),b=(0,o.useCallback)((e=>{h(Lo({datum:t,type:a,relation:e}))}),[t,a]),y=(0,o.useCallback)((()=>{p((e=>!e))}),[p]);return d?(0,r.jsx)(rs,{type:a,atom:l,atoms:s,relation:c,relations:i,onChange:u,onNext:f,onPrevious:m,onRemove:g,onRelation:x,onToggle:y,onHiddenRelation:b}):(0,r.jsx)(ns,{type:a,atom:l,atoms:s,relation:c,relations:i,onChange:u,onNext:f,onPrevious:m,onRemove:g,onRelation:x,onToggle:y,onHiddenRelation:b})},ss=({datum:e})=>{const t=At((t=>Ir(0,e))),n=At((t=>Or(t,e))).filter((e=>!0===e.time)),o=At((t=>function(e,t){return xt(t)?at(t.parsed.instances[0]).map((e=>e.name)):[]}(0,e)));return 0===n.length?null:(0,r.jsx)("div",Object.assign({className:"p-2 grid grid-cols-[minmax(min-content,max-content)_minmax(max-content,auto)_minmax(min-content,max-content)] gap-y-2"},{children:n.map((n=>{const s=n.type,i=t[s];return(0,r.jsx)(os,{datum:e,projection:n,atoms:i,relations:o},s)}))}))},is=({datum:e})=>At((t=>xr(0,e)))?null:(0,r.jsxs)("div",Object.assign({className:"flex flex-col justify-middle"},{children:[(0,r.jsx)(ss,{datum:e}),(0,r.jsx)(Ko,{datum:e})]}));var as=n(47516);const ls=e=>{const{collapsed:t,current:n,length:o,onChange:s,label:i,loopBack:a,onToggleCollapse:l}=e;return(0,r.jsx)("div",Object.assign({className:"flex"},{children:(0,r.jsxs)(A.hE,Object.assign({width:"full",isAttached:!0,size:"sm"},{children:[(0,r.jsx)(A.hU,{"aria-label":"First State",icon:(0,r.jsx)(as.pB9,{}),borderRadius:0,disabled:0===n,onClick:()=>s(0)}),(0,r.jsx)(A.hU,{"aria-label":"Previous State",borderRadius:0,icon:(0,r.jsx)(as.u_m,{}),disabled:0===n,onClick:()=>s(n-1)}),(0,r.jsx)(c.M5,Object.assign({width:"full",px:2,fontSize:"xs",bg:"gray.100"},{children:i(n)})),void 0!==a&&n===o-1?(0,r.jsx)(A.hU,{"aria-label":"Loop Back",borderRadius:0,icon:(0,r.jsx)(as.V3h,{}),onClick:()=>s(a)}):(0,r.jsx)(A.hU,{"aria-label":"First State",borderRadius:0,icon:(0,r.jsx)(as.OEZ,{}),disabled:n===o-1,onClick:()=>s(n+1)}),(0,r.jsx)(A.hU,{"aria-label":"Previous State",icon:(0,r.jsx)(as.xeH,{}),disabled:n===o-1,onClick:()=>s(o-1)}),(0,r.jsx)(A.hU,{"aria-label":"Toggle Minimap",size:"sm",borderRadius:0,borderLeftWidth:1,borderLeftColor:"gray.300",icon:t?(0,r.jsx)(as.OrA,{}):(0,r.jsx)(as.jRD,{}),onClick:()=>l()})]}))}))};function cs(e){const t={};return G(e).forEach((e=>{t[e.id]={type:"line"}})),t}function ds(e){const t={};return G(e).forEach((e=>{t[`${e.id}`]={stroke:"#4A5568",strokeWidth:1,fill:"none"}})),t}function ps(e,t){const n={};return $(e).forEach((e=>{const r=e.id===`${t}`;n[`${e.id}`]=[{text:e.id,style:{fill:r?"white":"#4A5568",fontFamily:"monospace",fontSize:"10px",fontWeight:r?"bold":"normal",textAnchor:"middle",userSelect:"none",cursor:"pointer"},props:{dy:"0.4em"}}]})),n}function hs(e){const t={};return $(e).forEach((e=>{t[`${e.id}`]={shape:"circle",radius:15}})),t}function us(e,t){const n={};return $(e).forEach((e=>{const r=e.id===`${t}`;n[e.id]={stroke:r?"#3B82F6":"#4A5568",strokeWidth:1,fill:r?"#3B82F6":"white",cursor:"pointer"}})),n}const ms=e=>{const t=function(e){return 50*(e.length-1)+45}(e),n=function(e){return void 0!==e.loopBack?75:45}(e),s=function(e){const{length:t,loopBack:n}=e,r=[],o=[],s=-50*(t-1)/2,i=void 0!==n?7.5:0;for(let e=0;e${e+1}`,source:`${e}`,target:`${e+1}`}):void 0!==n&&o.push({id:`${e}->${n}`,source:`${e}`,target:`${n}`,waypoints:[{x:s+50*e,y:i-30},{x:s+50*n,y:i-30}]});return Ot(r,o)}(e),i=`${-t/2} ${-n/2} ${t} ${n}`,a=(0,o.useRef)(null);return(0,r.jsx)("div",Object.assign({className:"grid place-items-center overflow-y-auto"},{children:(0,r.jsx)(we,Object.assign({svg:a.current,onMouseDown:()=>console.log("down"),onClickNode:t=>{e.onChange&&e.onChange(+t)}},{children:(0,r.jsx)("svg",Object.assign({ref:a,style:{minWidth:t},width:t,height:n,viewBox:i},{children:(0,r.jsx)(ze,{id:"minimap",graph:s,nodeShapes:hs(s),nodeStyles:us(s,e.current),nodeLabels:ps(s,e.current),edgeCurves:cs(s),edgeStyles:ds(s)})}))}))}))},gs=e=>{const{collapsed:t}=e;return(0,r.jsxs)("div",Object.assign({className:"border rounded mx-2"},{children:[(0,r.jsx)(ls,Object.assign({},e)),!t&&(0,r.jsx)(ms,Object.assign({},e))]}))},fs=({datum:e})=>{const t=jt(),[n,s]=(0,o.useState)(!1),i=At((t=>Tr(t,e))),a=At((t=>function(e,t){return xt(t)&&qt(t.parsed)?t.parsed.instances.length:1}(0,e))),l=At((t=>function(e,t){if(t&&xt(t)&&qt(t.parsed))return t.parsed.loopBack}(0,e))),c=(0,o.useCallback)((n=>{t(Jo({datum:e,index:n}))}),[e]);return(0,r.jsx)("div",Object.assign({className:"mx-1 my-2"},{children:(0,r.jsx)(gs,{collapsed:n,current:i,length:a,loopBack:l,label:e=>`State ${e+1}/${a}`,onChange:c,onToggleCollapse:()=>s((e=>!e))})}))},xs=({datum:e})=>At((t=>xr(0,e)))?(0,r.jsx)("div",Object.assign({className:"flex flex-col justify-middle"},{children:(0,r.jsx)(fs,{datum:e})})):null,bs=()=>{const e=At(ur);return e?(0,r.jsxs)("div",Object.assign({className:"absolute inset-0 flex flex-col overflow-y-auto"},{children:[(0,r.jsx)(is,{datum:e}),(0,r.jsx)(xs,{datum:e})]})):null},ys=()=>(0,r.jsxs)("div",Object.assign({className:"flex items-center px-2 space-x-2"},{children:[(0,r.jsx)(Qr.JO,{as:lo.rHK}),(0,r.jsx)(k,{children:"Time"})]}));var ws=n(47398);const vs={activeDatumSet:function(e,t){e.active=t.payload},dumpClicked:function(e){console.log((0,St.Vk)(e))}};var js=n(3231),As=n(54354),Ss=n(20924);const Ms=function(e,t){const{enter:n,update:r,exit:o}=t.payload;if(n){(0,js.Z)(n,(t=>{const n=t.id;e.datumById[n]||(e.datumById[n]=t,e.datumIds.push(n))}));const t=(0,Dt.Z)(n);t&&(e.active=t.id)}r&&(0,Ft.Z)(r,(t=>{const n=t.id;e.datumById[n]&&(0,As.Z)(e.datumById[n],t)})),o&&(0,Ft.Z)(o,(t=>{if(e.datumById[t]){delete e.datumById[t];const n=(0,Ss.Z)(e.datumIds,t);n>-1&&e.datumIds.splice(n,1),e.active===t&&(e.active=e.datumIds.length?e.datumIds[0]:null)}}))},Cs=(0,Ee.oM)({name:"data",initialState:{active:null,datumById:{},datumIds:[]},reducers:vs,extraReducers:e=>e.addCase(Be,Ms)}),{activeDatumSet:Is,dumpClicked:Os}=Cs.actions,ks=Cs.reducer;var Ns=n(2585),zs=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o{const{className:t,onClick:n}=e,o=zs(e,["className","onClick"]);return(0,r.jsx)("div",Object.assign({className:`contents ${n?"group":""} ${t||""}`,onClick:n},o))},Es=e=>{const{className:t}=e,n=zs(e,["className"]);return(0,r.jsx)("div",Object.assign({className:`\n flex items-center prose prose-sm truncate px-1 py-0.5 first:pl-2 last:pr-2 group-hover:bg-blue-600 group-active:bg-blue-700 group-hover:text-white select-none cursor-default group-hover:cursor-pointer ${t||""}`},n))},_s=e=>{var t;const{datum:n,active:o,onClickItem:s}=e,i=At((e=>function(e,t){return xr(0,t)}(0,n))),a=At((e=>function(e,t){return(Or(e,t)||[]).some((e=>!0===e.time))}(e,n))),l=o?"text-white bg-blue-600":"";return(0,r.jsxs)(Ds,Object.assign({onClick:e=>s(e,n)},{children:[(0,r.jsxs)(Es,Object.assign({className:l},{children:["Instance ",n.id," (from: '",null!==(t=n.generatorName)&&void 0!==t?t:"UNNAMED","')"]})),(0,r.jsx)(Es,Object.assign({className:l},{children:n.evaluator&&(0,r.jsx)(Qr.JO,{as:Kr.RJr})})),(0,r.jsxs)(Es,Object.assign({className:l},{children:[i&&(0,r.jsx)(Qr.JO,{as:lo.rHK}),a&&(0,r.jsx)(Qr.JO,{as:Ns.sYI})]}))]}))},Ls=e=>{const{data:t,active:n}=e,s=jt(),i=(0,o.useCallback)(((e,t)=>{s(Is(t.id))}),[]);return(0,r.jsx)("div",Object.assign({className:"w-full grid grid-cols-[minmax(max-content,auto)_repeat(2,min-content)]"},{children:t.map((e=>{const{id:t}=e;return(0,r.jsx)(_s,{datum:e,active:e===n,onClickItem:i},t)}))}))},Ts=function(e,t){const n=t.payload;n.views&&(e.availableViews=n.views.map((e=>{switch(e){case"graph":return"GraphView";case"table":return"TableView";case"script":return"ScriptView"}})),e.mainView=e.availableViews[0],n.generators&&n.generators.length>0&&(e.selectedGenerator=n.generators[0]))},Ps={availableViews:["GraphView","TableView","ScriptView"],mainView:"ScriptView",graphViewDrawer:"explorer",tableViewDrawer:null,scriptViewDrawer:"variables",selectedGenerator:void 0};const Bs=(0,Ee.oM)({name:"ui",initialState:Ps,reducers:{mainViewChanged:function(e,t){e.mainView=t.payload},commonDrawerViewChanged:function(e,t){const n=t.payload;switch(e.mainView){case"GraphView":e.graphViewDrawer=n===e.graphViewDrawer?null:n;break;case"TableView":e.tableViewDrawer=n===e.tableViewDrawer?null:n;break;case"ScriptView":e.scriptViewDrawer=n===e.scriptViewDrawer?null:n}},graphDrawerViewChanged:function(e,t){const n=t.payload;e.graphViewDrawer=n===e.graphViewDrawer?null:n},tableDrawerViewChanged:function(e,t){const n=t.payload;e.tableViewDrawer=n===e.tableViewDrawer?null:n},scriptDrawerViewChanged:function(e,t){const n=t.payload;e.scriptViewDrawer=n===e.scriptViewDrawer?null:n},selectedGeneratorChanged:function(e,t){const n=t.payload;e.selectedGenerator=n.generatorName}},extraReducers:e=>{e.addCase(Ve,Ts)}}),{mainViewChanged:Rs,commonDrawerViewChanged:Vs,graphDrawerViewChanged:$s,tableDrawerViewChanged:Fs,scriptDrawerViewChanged:Gs,selectedGeneratorChanged:Zs}=Bs.actions,Ws=Bs.reducer,Us=()=>{const e=At(ur),t=At(fr),n=At(Nr),s=jt(),i=At(mr);if(!e&&(!n||n.length<1))return null;const a=!t.some((e=>e.generatorName==i)),l=(0,o.useCallback)((()=>{void 0!==i&&a&&(console.log(`Running new generator: ${i}`),s(_e({id:void 0,onClick:"next",context:{generatorName:i}})))}),[i,t]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(c.xu,Object.assign({p:1,shadow:"md",borderWidth:"1px"},{children:[(0,r.jsx)(c.X6,Object.assign({fontSize:"sm",align:"center",fontWeight:"medium"},{children:"Select an Available Command"})),(0,r.jsxs)(c.kC,{children:[(0,r.jsx)(es.Ph,Object.assign({isDisabled:!n||n.length<1,value:i,onChange:e=>{const n=e.target.value,r=t.filter((e=>e.generatorName==n)).reverse()[0];console.log(`Selecting generator: ${n}. Latest id: ${null==r?void 0:r.id}`),s(Zs({generatorName:n})),s(Is(r?r.id:""))}},{children:null==n?void 0:n.map(((e,t)=>(0,r.jsx)("option",{children:e},t)))})),(0,r.jsx)(A.zx,Object.assign({size:"sm",margin:"1",onClick:l,isDisabled:!n||n.length<1||i&&(null==e?void 0:e.generatorName)===i||!a},{children:(0,r.jsx)(ws.u,Object.assign({hasArrow:!0,label:"Re-run Forge to refresh this command.",isDisabled:a},{children:"Run"}))}))]})]})),(0,r.jsx)(c.xu,Object.assign({p:1,shadow:"md",borderWidth:"1px"},{children:(0,r.jsxs)(c.X6,Object.assign({fontSize:"xs",align:"center",fontWeight:"normal"},{children:["Instance History for ",(0,r.jsx)("i",{children:i})]}))})),(0,r.jsx)("hr",{}),(0,r.jsx)("div",Object.assign({"aria-label":"explorer pane instance selector",className:"absolute flex flex-col overflow-y-auto"},{children:(0,r.jsx)(Ls,{data:t.filter((e=>e.generatorName==i)),active:e})}))]})},qs=()=>(0,r.jsxs)("div",Object.assign({className:"flex items-center px-2 space-x-2"},{children:[(0,r.jsx)(Qr.JO,{as:lo.rHK}),(0,r.jsx)(k,{children:"Explorer"})]}));var Ys=n(79352);const Xs=()=>{const e=jt(),t=At(ur),n=(0,o.useRef)(null),s=(0,o.useRef)(null),i=(0,o.useRef)(null),[a,l]=(0,o.useState)(!1),[c,d]=(0,o.useState)(!1),[p,h]=(0,o.useState)(!1),[u,m]=(0,o.useState)({}),g=At((e=>t?Rr(e,t):void 0));(0,o.useEffect)((()=>{m({}),window.currentProjections&&(window.currentProjections={}),console.log("Projections reset for new datum")}),[t]),(0,o.useEffect)((()=>{if(!document.getElementById("spytial-bootstrap-stylesheet")){const e=document.createElement("link");e.id="spytial-bootstrap-stylesheet",e.rel="stylesheet",e.href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css",e.integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM",e.crossOrigin="anonymous",document.head.appendChild(e)}}),[]),(0,o.useEffect)((()=>{if(s.current&&window.mountErrorMessageModal&&!c)try{window.mountErrorMessageModal("layout-error-mount"),d(!0),console.log("SpyTial Error Modal mounted in Layout Drawer")}catch(e){console.error("Failed to mount SpyTial Error Modal:",e)}}),[c]);const f=(0,o.useCallback)(((n,r)=>{var o;if(console.log(`Projection changed: ${n} -> ${r}`),m((e=>Object.assign(Object.assign({},e),{[n]:r}))),window.currentProjections||(window.currentProjections={}),window.currentProjections[n]=r,t){const n=(null===(o=window.getCurrentCNDSpecFromReact)||void 0===o?void 0:o.call(window))||"";e(So({datum:t,spec:n}))}}),[t,e]);return(0,o.useEffect)((()=>{if(i.current&&window.mountProjectionControls&&t)try{window.mountProjectionControls("layout-projection-mount",f),h(!0),console.log("Projection Controls mounted in Layout Drawer")}catch(e){console.error("Failed to mount Projection Controls:",e)}return()=>{h(!1)}}),[t,f]),(0,o.useEffect)((()=>{var e;if(n.current&&!a&&t){const t="directives:\n - flag: hideDisconnectedBuiltIns",n={initialYamlValue:g&&""!==g?g:t,initialDirectives:g&&""!==g?void 0:[{flag:"hideDisconnectedBuiltIns"}]};try{(null===(e=window.CndCore)||void 0===e?void 0:e.mountCndLayoutInterface)?(window.CndCore.mountCndLayoutInterface("cnd-editor-mount",n),l(!0),console.log("CnD Layout Interface mounted via CndCore"+(g?" with preloaded spec":" with default directives"))):window.mountCndLayoutInterface&&(window.mountCndLayoutInterface("cnd-editor-mount",n),l(!0),console.log("CnD Layout Interface mounted"+(g?" with preloaded spec":" with default directives")))}catch(e){console.error("Failed to mount CnD Layout Interface:",e)}}}),[a,t,g]),t?(0,r.jsxs)("div",Object.assign({className:"absolute inset-0 flex flex-col overflow-y-auto bg-slate-50/90 text-slate-900"},{children:[(0,r.jsx)("div",{id:"layout-error-mount",ref:s,className:"flex-shrink-0","aria-live":"polite"}),(0,r.jsxs)("div",Object.assign({className:"flex-1 space-y-3 p-3"},{children:[(0,r.jsx)("div",{id:"layout-projection-mount",ref:i,className:"rounded-lg border border-slate-200 bg-white/90 p-2 shadow-sm"}),(0,r.jsxs)("div",Object.assign({className:"flex gap-2"},{children:[(0,r.jsx)("button",Object.assign({type:"button",onClick:n=>{var r;if(n.preventDefault(),!t)return;window.clearAllErrors&&window.clearAllErrors();const o=(null===(r=window.getCurrentCNDSpecFromReact)||void 0===r?void 0:r.call(window))||"";e(So({datum:t,spec:o}))},className:"flex-1 rounded-lg bg-indigo-600 px-4 py-2.5 text-sm font-medium text-white shadow-sm transition hover:bg-indigo-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-offset-2"},{children:"Apply Layout"})),(0,r.jsxs)("label",Object.assign({className:"group relative flex-1 cursor-pointer"},{children:[(0,r.jsxs)("div",Object.assign({className:"flex items-center justify-center gap-2 rounded-lg border-2 border-dashed border-slate-300 bg-white px-4 py-2.5 text-sm font-medium text-slate-600 transition hover:border-indigo-400 hover:text-indigo-600 focus-within:border-indigo-500 focus-within:ring-2 focus-within:ring-indigo-200"},{children:[(0,r.jsx)("svg",Object.assign({className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},{children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"})})),"Upload .cnd"]})),(0,r.jsx)("input",{type:"file",accept:".cnd",onChange:n=>{var r;if(!t)return;const o=null===(r=n.target.files)||void 0===r?void 0:r[0];if(o){const n=new FileReader;n.onload=n=>{var r;const o=null===(r=n.target)||void 0===r?void 0:r.result;e(So({datum:t,spec:o}))},n.readAsText(o)}},className:"absolute inset-0 h-full w-full cursor-pointer opacity-0","aria-label":"Upload .cnd layout file"})]}))]})),(0,r.jsx)("div",Object.assign({className:"rounded-lg border border-slate-200 bg-white shadow-sm p-3"},{children:(0,r.jsx)("div",{id:"cnd-editor-mount",ref:n,className:"min-h-[360px] overflow-hidden rounded-lg border border-slate-200 bg-slate-50"})}))]}))]})):null},Hs=()=>(0,r.jsxs)("div",Object.assign({className:"w-full flex items-center px-2 space-x-2"},{children:[(0,r.jsx)(Qr.JO,{as:Ys.vWf}),(0,r.jsx)(k,{children:"Layout"})]})),Js=(0,Ee.oM)({name:"synthesis",initialState:{isActive:!1,selectorType:"unary",numInstances:3,currentStep:0,examples:[],draftSelection:{atomIds:[],pairs:[]},loadedInstances:[],currentDataInstance:null,result:null,error:null,isLoading:!1},reducers:{enterSynthesisMode:function(e,t){e.isActive=!0,e.selectorType=t.payload.selectorType,e.numInstances=t.payload.numInstances,e.currentStep=0,e.examples=[],e.loadedInstances=[],e.result=null,e.error=null,e.isLoading=!0},exitSynthesisMode:function(e){e.isActive=!1,e.currentStep=0,e.examples=[],e.loadedInstances=[],e.result=null,e.error=null,e.isLoading=!1},synthesisInstancesLoaded:function(e,t){e.loadedInstances=t.payload.instances,e.isLoading=!1,0===e.currentStep&&(e.currentStep=1)},synthesisLoadError:function(e,t){e.error=t.payload.error,e.isLoading=!1},addSynthesisExample:function(e,t){e.examples.push(t.payload),e.currentStep<=e.numInstances&&e.currentStep++},updateSynthesisExample:function(e,t){const{instanceIndex:n,selectedAtomIds:r,selectedPairs:o}=t.payload,s=e.examples.findIndex((e=>e.instanceIndex===n));s>=0&&(void 0!==r&&(e.examples[s].selectedAtomIds=r),void 0!==o&&(e.examples[s].selectedPairs=o))},synthesisStepBack:function(e){e.currentStep>1&&(e.currentStep--,e.examples.length>=e.currentStep&&e.examples.pop())},setSynthesisResult:function(e,t){e.result=t.payload,e.error=null,e.isLoading=!1},setSynthesisError:function(e,t){e.error=t.payload.error,e.result=null,e.isLoading=!1},startSynthesis:function(e){e.isLoading=!0,e.error=null},updateDraftSelection:function(e,t){void 0!==t.payload.atomIds&&(e.draftSelection.atomIds=t.payload.atomIds),void 0!==t.payload.pairs&&(e.draftSelection.pairs=t.payload.pairs)},commitDraftSelection:function(e,t){const{instanceIndex:n,dataInstance:r,atomIds:o=[],pairs:s=[]}=t.payload,i=e.examples.findIndex((e=>e.instanceIndex===n));i>=0?(e.examples[i].selectedAtomIds=o,e.examples[i].selectedPairs=s,e.examples[i].dataInstance=r):e.examples.push({instanceIndex:n,selectedAtomIds:[...o],selectedPairs:[...s],dataInstance:r}),e.draftSelection={atomIds:[],pairs:[]},e.currentStep<=e.numInstances&&e.currentStep++},setCurrentDataInstance:function(e,t){e.currentDataInstance=t.payload.dataInstance}}}),{enterSynthesisMode:Qs,exitSynthesisMode:Ks,synthesisInstancesLoaded:ei,synthesisLoadError:ti,addSynthesisExample:ni,updateSynthesisExample:ri,synthesisStepBack:oi,setSynthesisResult:si,setSynthesisError:ii,startSynthesis:ai,updateDraftSelection:li,commitDraftSelection:ci,setCurrentDataInstance:di}=Js.actions,pi=Js.reducer;var hi=n(38152),ui=n(79762),mi=n(9680),gi=n(72773);const fi=()=>{const e=jt(),t=At(ur),[n,s]=(0,o.useState)(3),[i,a]=(0,o.useState)("unary"),[l,d]=(0,o.useState)(!1);return(0,r.jsx)("div",Object.assign({className:"p-8 max-w-2xl mx-auto"},{children:(0,r.jsxs)(c.gC,Object.assign({spacing:6,align:"stretch"},{children:[(0,r.jsx)("div",{children:(0,r.jsx)(c.xv,Object.assign({fontSize:"2xl",fontWeight:"bold",mb:2},{children:"Selector Synthesis"}))}),(0,r.jsxs)(ui.NI,{children:[(0,r.jsx)(ui.lX,{children:"Selector Type"}),(0,r.jsx)(mi.Ee,Object.assign({value:i,onChange:e=>a(e)},{children:(0,r.jsxs)(c.Kq,Object.assign({direction:"column",spacing:3},{children:[(0,r.jsx)(mi.Y8,Object.assign({value:"unary"},{children:(0,r.jsx)(c.xv,Object.assign({fontWeight:"semibold"},{children:"Unary Selector (Atoms)"}))})),(0,r.jsx)(mi.Y8,Object.assign({value:"binary"},{children:(0,r.jsx)(c.xv,Object.assign({fontWeight:"semibold"},{children:"Binary Selector (Pairs/Relations)"}))}))]}))}))]}),(0,r.jsxs)(ui.NI,{children:[(0,r.jsx)(ui.lX,{children:"Number of Instances"}),(0,r.jsxs)(gi.Y2,Object.assign({value:n,onChange:(e,t)=>s(t),min:1,max:10,step:1},{children:[(0,r.jsx)(gi.zu,{}),(0,r.jsxs)(gi.Fi,{children:[(0,r.jsx)(gi.WQ,{}),(0,r.jsx)(gi.Y_,{})]})]}))]}),(0,r.jsx)(A.zx,Object.assign({colorScheme:"blue",size:"lg",onClick:()=>{return r=void 0,o=void 0,a=function*(){if(t&&window.CndCore){d(!0),e(Qs({numInstances:n,selectorType:i}));try{const n=t.data,r=window.CndCore.AlloyInstance.parseAlloyXML(n);if(!r.instances||0===r.instances.length)throw new Error("No instances found in Alloy XML");const o=new window.CndCore.AlloyDataInstance(r.instances[0]);console.log("[SynthesisSetup] Starting with first instance"),e(ei({instances:[o]}))}catch(t){e(ti({error:t.message})),d(!1)}}},new((s=void 0)||(s=Promise))((function(e,t){function n(e){try{l(a.next(e))}catch(e){t(e)}}function i(e){try{l(a.throw(e))}catch(e){t(e)}}function l(t){var r;t.done?e(t.value):(r=t.value,r instanceof s?r:new s((function(e){e(r)}))).then(n,i)}l((a=a.apply(r,o||[])).next())}));var r,o,s,a},isLoading:l,loadingText:"Loading instances...",w:"full"},{children:"Start Synthesis"}))]}))}))};var xi=n(4612);const bi=()=>{const e=jt(),t=At(Gr),n=At(Wr),s=At(Ur),i=At(Zr),a=At(ur),l=At(Jr),[d,p]=(0,o.useState)(""),[h,u]=(0,o.useState)([]),m=t-1,g=s[m],f=n.find((e=>e.instanceIndex===m));return(0,o.useEffect)((()=>{if(f)u(f.selectedAtomIds),p(f.selectedAtomIds.join(", "));else{u([]),p("");const e=document.querySelector("webcola-cnd-graph");e&&e.clearNodeHighlights&&e.clearNodeHighlights()}}),[m,f]),(0,o.useEffect)((()=>{const e=d.split(",").map((e=>e.trim())).filter((e=>e.length>0));u(e)}),[d]),g?(0,r.jsxs)("div",Object.assign({className:"flex flex-col h-full"},{children:[(0,r.jsxs)("div",Object.assign({className:"p-4 bg-blue-50 border-b border-blue-200"},{children:[(0,r.jsxs)(c.xv,Object.assign({fontSize:"sm",fontWeight:"semibold",mb:1,color:"blue.900"},{children:["Instance ",m+1," of ",i]})),(0,r.jsx)(c.xv,Object.assign({fontSize:"xs",color:"blue.700"},{children:"Enter atom IDs (comma-separated) that should match your selector. Atoms will be highlighted in the graph in real-time."}))]})),(0,r.jsx)("div",Object.assign({className:"p-4 space-y-4"},{children:(0,r.jsxs)("div",{children:[(0,r.jsx)("label",Object.assign({className:"block text-sm font-medium text-gray-700 mb-2"},{children:"Atom IDs (comma-separated)"})),(0,r.jsx)(xi.II,{value:d,onChange:e=>p(e.target.value),onBlur:()=>{const e=document.querySelector("webcola-cnd-graph");if(e){if(e.clearNodeHighlights&&e.clearNodeHighlights(),h.length>0&&e.highlightNodes){const t=e.highlightNodes(h);console.log("[SynthesisExample] Highlighted nodes:",h,"success:",t)}}else console.warn("[SynthesisExample] Graph element not found")},size:"lg",fontFamily:"monospace"})]})})),(0,r.jsx)("div",{className:"flex-1"}),(0,r.jsx)("div",Object.assign({className:"p-4 border-t bg-gray-50"},{children:(0,r.jsx)(A.zx,Object.assign({w:"full",colorScheme:"blue",size:"lg",onClick:()=>{l?(console.log("[SynthesisExample] Committing selection:",{instanceIndex:m,atomIds:h}),e(ci({instanceIndex:m,dataInstance:l,atomIds:h})),t{const e=jt(),t=At(Gr),n=At(Wr),s=At(Ur),i=At(Zr),a=At(ur),l=At(Jr),[d,p]=(0,o.useState)(""),[h,u]=(0,o.useState)([]),[m,g]=(0,o.useState)(null),f=t-1,x=s[f],b=n.find((e=>e.instanceIndex===f));return(0,o.useEffect)((()=>{if(b){u(b.selectedPairs);const e=b.selectedPairs.map((([e,t])=>`${e}:${t}`)).join(", ");p(e)}else{u([]),p("");const e=document.querySelector("webcola-cnd-graph");e&&e.clearNodeHighlights&&e.clearNodeHighlights()}}),[f,b]),(0,o.useEffect)((()=>{if(g(null),""===d.trim())return void u([]);const e=d.split(",").map((e=>e.trim())).filter((e=>e)),t=[];for(const n of e){const e=n.split(":");if(2!==e.length)return void g(`Invalid pair format: "${n}". Use format: First:Second`);const[r,o]=e.map((e=>e.trim()));if(!r||!o)return void g(`Empty node ID in pair: "${n}"`);t.push([r,o])}u(t)}),[d]),x?(0,r.jsxs)("div",Object.assign({className:"flex flex-col h-full"},{children:[(0,r.jsxs)("div",Object.assign({className:"p-4 bg-purple-50 border-b border-purple-200"},{children:[(0,r.jsxs)(c.xv,Object.assign({fontSize:"sm",fontWeight:"semibold",mb:1,color:"purple.900"},{children:["Instance ",f+1," of ",i," - Binary Selector"]})),(0,r.jsxs)(c.xv,Object.assign({fontSize:"xs",color:"purple.700"},{children:["Enter pairs of atom IDs (format: First:Second) separated by commas.",(0,r.jsx)("br",{}),"Pairs will be highlighted with arrows in the graph."]}))]})),(0,r.jsx)("div",Object.assign({className:"p-4 space-y-4"},{children:(0,r.jsxs)("div",{children:[(0,r.jsx)("label",Object.assign({className:"block text-sm font-medium text-gray-700 mb-2"},{children:"Node Pairs (format: First:Second, comma-separated)"})),(0,r.jsx)(xi.II,{value:d,onChange:e=>p(e.target.value),onBlur:()=>{const e=document.querySelector("webcola-cnd-graph");if(e){if(e.clearNodeHighlights&&e.clearNodeHighlights(),h.length>0&&!m&&e.highlightNodePairs){const t=e.highlightNodePairs(h,{showBadges:!0});console.log("[BinaryExample] Highlighted pairs:",h,"success:",t)}}else console.warn("[BinaryExample] Graph element not found")},size:"lg",fontFamily:"monospace",isInvalid:null!==m}),m&&(0,r.jsx)(c.xv,Object.assign({fontSize:"xs",color:"red.600",mt:1},{children:m}))]})})),(0,r.jsx)("div",{className:"flex-1"}),(0,r.jsx)("div",Object.assign({className:"p-4 border-t bg-gray-50"},{children:(0,r.jsx)(A.zx,Object.assign({w:"full",colorScheme:"purple",size:"lg",onClick:()=>{l?(console.log("[BinaryExample] Committing selection:",{instanceIndex:f,pairs:h}),e(ci({instanceIndex:f,dataInstance:l,pairs:h})),t{const e=jt(),t=At(ur),n=At(qr),o=At(Fr),s=At(Wr),i=At((e=>t?Rr(e,t):""));if(!n||!t)return(0,r.jsx)("div",Object.assign({className:"p-8 text-center"},{children:(0,r.jsx)(c.xv,Object.assign({color:"gray.500"},{children:"No synthesis result available"}))}));const a="unary"===o,l=a?n.matchesByInstance:n.pairMatchesByInstance;return(0,r.jsx)("div",Object.assign({className:"p-6 max-w-4xl mx-auto"},{children:(0,r.jsxs)(c.gC,Object.assign({spacing:6,align:"stretch"},{children:[(0,r.jsxs)(c.xu,Object.assign({borderWidth:2,borderColor:"green.500",rounded:"lg",p:4,bg:"green.50"},{children:[(0,r.jsxs)(c.xv,Object.assign({fontSize:"sm",fontWeight:"semibold",color:"green.700",mb:2},{children:["Synthesized ",a?"Unary":"Binary"," Selector"]})),(0,r.jsx)(c.EK,Object.assign({p:3,rounded:"md",fontSize:"lg",fontWeight:"bold",display:"block",bg:"white"},{children:n.expression}))]})),(0,r.jsxs)(c.xu,{children:[(0,r.jsx)(c.xv,Object.assign({fontSize:"lg",fontWeight:"semibold",mb:3},{children:"Matches Across Instances"})),(0,r.jsx)(wi.UQ,Object.assign({allowMultiple:!0},{children:l.map(((e,t)=>{const n=s[t];let o=!1;if(a){const t=e;o=n&&n.selectedAtomIds.every((e=>t.matchedAtomIds.includes(e)))&&n.selectedAtomIds.length===t.matchedAtomIds.length}else{const t=e,r=(null==n?void 0:n.selectedPairs)||[];o=r.every((([e,n])=>t.matchedPairs.some((([t,r])=>t===e&&r===n||t===n&&r===e))))&&r.length===t.matchedPairs.length}const i=a?e.matchedAtomIds.length:e.matchedPairs.length;return(0,r.jsxs)(wi.Qd,{children:[(0,r.jsx)("h2",{children:(0,r.jsxs)(wi.KF,{children:[(0,r.jsx)(c.xu,Object.assign({flex:"1",textAlign:"left"},{children:(0,r.jsxs)(c.Ug,{children:[(0,r.jsxs)(c.xv,Object.assign({fontWeight:"semibold"},{children:["Instance ",e.instanceIndex+1]})),(0,r.jsxs)(c.Ct,Object.assign({colorScheme:o?"green":"yellow"},{children:[i," matches"]})),o?(0,r.jsxs)(c.Ct,Object.assign({colorScheme:"green"},{children:[(0,r.jsx)(ts.HhX,{})," Exact"]})):(0,r.jsx)(c.Ct,Object.assign({colorScheme:"yellow"},{children:"Partial"}))]})})),(0,r.jsx)(wi.XE,{})]})}),(0,r.jsx)(wi.Hk,Object.assign({pb:4},{children:a?(0,r.jsxs)(c.gC,Object.assign({align:"stretch",spacing:2},{children:[(0,r.jsxs)("div",{children:[(0,r.jsx)(c.xv,Object.assign({fontSize:"sm",fontWeight:"semibold",mb:1},{children:"You selected:"})),(0,r.jsx)("div",Object.assign({className:"flex flex-wrap gap-1"},{children:null==n?void 0:n.selectedAtomIds.map((e=>(0,r.jsx)(c.Ct,Object.assign({colorScheme:"blue"},{children:e}),e)))}))]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(c.xv,Object.assign({fontSize:"sm",fontWeight:"semibold",mb:1},{children:"Selector matches:"})),(0,r.jsx)("div",Object.assign({className:"flex flex-wrap gap-1"},{children:e.matchedAtomIds.map((e=>(0,r.jsxs)(c.Ct,Object.assign({colorScheme:(null==n?void 0:n.selectedAtomIds.includes(e))?"green":"orange"},{children:[e,!(null==n?void 0:n.selectedAtomIds.includes(e))&&" (extra)"]}),e)))}))]})]})):(0,r.jsxs)(c.gC,Object.assign({align:"stretch",spacing:2},{children:[(0,r.jsxs)("div",{children:[(0,r.jsx)(c.xv,Object.assign({fontSize:"sm",fontWeight:"semibold",mb:1},{children:"You selected:"})),(0,r.jsx)(c.gC,Object.assign({align:"stretch",spacing:1},{children:null==n?void 0:n.selectedPairs.map((([e,t],n)=>(0,r.jsxs)(c.Ug,{children:[(0,r.jsx)(c.Ct,Object.assign({colorScheme:"blue"},{children:e})),(0,r.jsx)(ts.hdK,{}),(0,r.jsx)(c.Ct,Object.assign({colorScheme:"blue"},{children:t}))]},n)))}))]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(c.xv,Object.assign({fontSize:"sm",fontWeight:"semibold",mb:1},{children:"Selector matches:"})),(0,r.jsx)(c.gC,Object.assign({align:"stretch",spacing:1},{children:e.matchedPairs.map((([e,t],o)=>{const s=null==n?void 0:n.selectedPairs.some((([n,r])=>n===e&&r===t||n===t&&r===e));return(0,r.jsxs)(c.Ug,{children:[(0,r.jsx)(c.Ct,Object.assign({colorScheme:s?"green":"orange"},{children:e})),(0,r.jsx)(ts.hdK,{}),(0,r.jsx)(c.Ct,Object.assign({colorScheme:s?"green":"orange"},{children:t})),!s&&(0,r.jsx)(c.xv,Object.assign({fontSize:"xs"},{children:"(extra)"}))]},o)}))}))]})]}))}))]},e.instanceIndex)}))}))]}),(0,r.jsxs)(c.Ug,Object.assign({spacing:3,pt:4},{children:[(0,r.jsx)(A.zx,Object.assign({flex:1,colorScheme:"green",leftIcon:(0,r.jsx)(ts.HhX,{}),onClick:()=>{const r=i?`${i}\n\n# Synthesized ${o} selector\n# ${n.expression}\n`:`# Synthesized ${o} selector\n# ${n.expression}\n`;e(So({datum:t,spec:r})),e(Ks())},size:"lg"},{children:"Accept & Insert into Spec"})),(0,r.jsx)(A.zx,Object.assign({flex:1,variant:"outline",leftIcon:(0,r.jsx)(ts.FU5,{}),onClick:()=>{e(Ks())},size:"lg"},{children:"Reject & Try Again"}))]})),(0,r.jsx)(c.xu,Object.assign({bg:"blue.50",p:4,rounded:"md",borderWidth:1,borderColor:"blue.200"},{children:(0,r.jsxs)(c.xv,Object.assign({fontSize:"sm",color:"gray.700"},{children:[(0,r.jsx)("strong",{children:"Next steps:"})," The selector will be added as a comment in your CnD spec. You can use it in constraints (e.g., ",(0,r.jsxs)(c.EK,{children:["right(",n.expression,")"]}),") or directives (e.g., ",(0,r.jsxs)(c.EK,{children:["color red(",n.expression,")"]}),")."]}))}))]}))}))};const ji=()=>{const e=jt(),t=At(ur),n=At($r),s=At(Fr),i=At(Gr),a=At(Zr),l=At(Wr),d=(At(Ur),At(qr)),p=At(Yr),h=At(Xr),u=At(Hr),m=i>a&&null===d&&!h&&!p&&l.length===a,g=l.every((e=>e.selectedAtomIds.length>0||e.selectedPairs.length>0));if(console.log("[SynthesisPanel] State:",{currentStep:i,numInstances:a,result:d,isLoading:h,error:p,examplesLength:l.length,shouldSynthesize:m,canSynthesize:u,examplesHaveSelections:g,examples:l.map((e=>({instanceIndex:e.instanceIndex,selectedAtomIds:e.selectedAtomIds,selectedPairs:e.selectedPairs,hasDataInstance:!!e.dataInstance})))}),(0,o.useEffect)((()=>{var n,r,o,i;m&&u&&(console.log("[SynthesisPanel] Auto-triggering synthesis"),n=void 0,r=void 0,i=function*(){if(t&&window.CndCore){e(ai());try{const t=e=>new window.CndCore.AlloyDataInstance(e),n=(e,t)=>{const n=e.getAtoms();console.log("[Synthesis] Looking for atom:",t,"in",n.length,"atoms"),console.log("[Synthesis] Available atom IDs:",n.map((e=>e.id)));const r=n.find((e=>e.id===t));if(!r)throw new Error(`Atom not found: ${t}`);return r};if("unary"===s){console.log("[Synthesis] Starting unary synthesis with",l.length,"examples"),console.log("[Synthesis] Examples:",l.map((e=>({instanceIndex:e.instanceIndex,selectedAtomIds:e.selectedAtomIds,hasDataInstance:!!e.dataInstance}))));const r=l.map(((e,r)=>{const o=e.dataInstance;if(console.log(`[Synthesis] Example ${r}: rawInstanceData =`,o),!o)throw new Error(`Example ${e.instanceIndex+1}: Missing data instance`);const s=t(o);console.log(`[Synthesis] Example ${r}: recreated AlloyDataInstance with ${s.getAtoms().length} atoms`);const i=e.selectedAtomIds.map((e=>n(s,e)));return console.log(`[Synthesis] Example ${r}: converted ${e.selectedAtomIds.length} IDs to atoms`),{atoms:i,dataInstance:s}}));console.log("[Synthesis] Calling synthesizeAtomSelectorWithExplanation with:",r);const o=window.CndCore.synthesizeAtomSelectorWithExplanation(r,3);if(console.log("[Synthesis] Result:",o),!o)throw new Error("Synthesis failed - no selector found");const s=l.map(((e,n)=>{const r=t(e.dataInstance),s=new window.CndCore.SGraphQueryEvaluator;s.initialize({sourceData:r});const i=s.evaluate(o.expression);return{instanceIndex:n,matchedAtomIds:i.selectedAtoms?i.selectedAtoms().map((e=>e.id)):[]}}));e(si({expression:o.expression,explanation:o.explanation||null,matchesByInstance:s,pairMatchesByInstance:[]}))}else{const r=l.map((e=>{const r=e.dataInstance;if(!r)throw new Error(`Example ${e.instanceIndex+1}: Missing data instance`);const o=t(r);return{pairs:e.selectedPairs.map((([e,t])=>[n(o,e),n(o,t)])),dataInstance:o}})),o=window.CndCore.synthesizeBinarySelectorWithExplanation(r,3);if(!o)throw new Error("Synthesis failed - no binary selector found");const s=l.map(((e,n)=>{const r=t(e.dataInstance),s=new window.CndCore.SGraphQueryEvaluator;s.initialize({sourceData:r});const i=s.evaluate(o.expression);return{instanceIndex:n,matchedPairs:(i.selectedTuplesAll?i.selectedTuplesAll():[]).map((e=>[e[0].id,e[1].id]))}}));e(si({expression:o.expression,explanation:null,matchesByInstance:[],pairMatchesByInstance:s}))}}catch(t){e(ii({error:t.message||"Synthesis failed"}))}}},new((o=void 0)||(o=Promise))((function(e,t){function s(e){try{l(i.next(e))}catch(e){t(e)}}function a(e){try{l(i.throw(e))}catch(e){t(e)}}function l(t){var n;t.done?e(t.value):(n=t.value,n instanceof o?n:new o((function(e){e(n)}))).then(s,a)}l((i=i.apply(n,r||[])).next())})))}),[m,u]),!n)return null;const f=0===i?0:(i-1)/a*100,x=0===i,b=i>=1&&i<=a,y=i>a||null!==d;return(0,r.jsxs)("div",Object.assign({className:"absolute inset-0 flex flex-col bg-white"},{children:[(0,r.jsxs)("div",Object.assign({className:"p-4 border-b bg-blue-50 flex items-center justify-between"},{children:[(0,r.jsxs)("div",Object.assign({className:"flex items-center gap-2"},{children:[(0,r.jsx)(Qr.JO,{as:ts.tSv,boxSize:6,color:"blue.600"}),(0,r.jsxs)("div",{children:[(0,r.jsx)(k,{children:"Selector Synthesis"}),(0,r.jsxs)(c.xv,Object.assign({fontSize:"xs",color:"gray.600"},{children:[x&&"Configure synthesis parameters",b&&`Collecting examples (${l.length}/${a})`,y&&"Review synthesized selector"]}))]})]})),(0,r.jsx)(A.zx,Object.assign({size:"sm",leftIcon:(0,r.jsx)(ts.FU5,{}),onClick:()=>{e(Ks())},variant:"ghost"},{children:"Exit"}))]})),!x&&!y&&(0,r.jsx)(hi.Ex,{value:f,size:"xs",colorScheme:"blue"}),(0,r.jsxs)("div",Object.assign({className:"flex-1 overflow-y-auto"},{children:[x&&(0,r.jsx)(fi,{}),b&&("unary"===s?(0,r.jsx)(bi,{}):(0,r.jsx)(yi,{})),y&&(0,r.jsx)(vi,{})]})),!x&&!y&&(0,r.jsxs)("div",Object.assign({className:"p-4 border-t bg-gray-50 flex items-center justify-between"},{children:[(0,r.jsx)(A.zx,Object.assign({size:"sm",leftIcon:(0,r.jsx)(ts.KYK,{}),onClick:()=>e(oi()),isDisabled:i<=1,variant:"outline"},{children:"Previous"})),(0,r.jsxs)(c.xv,Object.assign({fontSize:"sm",color:"gray.600"},{children:["Instance ",i," of ",a]}))]})),p&&(0,r.jsxs)("div",Object.assign({className:"p-4 bg-red-50 border-t border-red-200 text-red-700 text-sm"},{children:[(0,r.jsx)("strong",{children:"Error:"})," ",p]}))]}))},Ai=()=>{const e=jt(),t=At(ur);return At($r)?(0,r.jsx)(ji,{}):t?(0,r.jsx)("div",Object.assign({className:"absolute inset-0 flex flex-col overflow-y-auto bg-slate-50/90 text-slate-900"},{children:(0,r.jsx)("div",Object.assign({className:"flex-1 space-y-4 p-4"},{children:(0,r.jsxs)("div",Object.assign({className:"space-y-4 rounded-xl border border-slate-200 bg-white/80 p-6 backdrop-blur shadow-sm"},{children:[(0,r.jsxs)("div",Object.assign({className:"flex items-center gap-3"},{children:[(0,r.jsx)(Qr.JO,{as:ts.tSv,boxSize:8,className:"text-fuchsia-600"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h2",Object.assign({className:"text-lg font-semibold text-slate-800"},{children:"Selector Synthesis"})),(0,r.jsx)("p",Object.assign({className:"text-sm text-slate-500"},{children:"Synthesize selectors from examples"}))]})]})),(0,r.jsx)("p",Object.assign({className:"text-sm text-slate-600 leading-relaxed"},{children:"Use this tool to automatically generate CnD selectors by providing positive and negative examples. Select atoms across multiple instances to define which elements should be matched by the selector."})),(0,r.jsxs)("div",Object.assign({className:"space-y-3 pt-2"},{children:[(0,r.jsxs)("div",Object.assign({className:"rounded-lg border border-slate-200 bg-slate-50 p-4"},{children:[(0,r.jsx)("h3",Object.assign({className:"font-medium text-slate-700 mb-2"},{children:"Selector Types"})),(0,r.jsxs)("ul",Object.assign({className:"text-sm text-slate-600 space-y-2"},{children:[(0,r.jsxs)("li",Object.assign({className:"flex items-start gap-2"},{children:[(0,r.jsx)("span",Object.assign({className:"inline-block w-5 h-5 rounded-full bg-fuchsia-100 text-fuchsia-600 text-xs flex items-center justify-center font-semibold mt-0.5"},{children:"1"})),(0,r.jsxs)("span",{children:[(0,r.jsx)("strong",{children:"Unary:"}),' Select individual atoms (e.g., "all Nodes with value > 5")']})]})),(0,r.jsxs)("li",Object.assign({className:"flex items-start gap-2"},{children:[(0,r.jsx)("span",Object.assign({className:"inline-block w-5 h-5 rounded-full bg-purple-100 text-purple-600 text-xs flex items-center justify-center font-semibold mt-0.5"},{children:"2"})),(0,r.jsxs)("span",{children:[(0,r.jsx)("strong",{children:"Binary:"}),' Select pairs of atoms/edges (e.g., "all edges where source.value < target.value")']})]}))]}))]})),(0,r.jsxs)("div",Object.assign({className:"grid gap-2 sm:grid-cols-2"},{children:[(0,r.jsxs)("button",Object.assign({type:"button",onClick:()=>e(Qs({numInstances:3,selectorType:"unary"})),className:"inline-flex items-center justify-center gap-2 rounded-lg bg-gradient-to-r from-fuchsia-600 to-purple-600 px-4 py-3 text-sm font-semibold text-white shadow-md transition hover:from-fuchsia-500 hover:to-purple-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-fuchsia-500 focus-visible:ring-offset-2 focus-visible:ring-offset-white"},{children:[(0,r.jsx)(Qr.JO,{as:ts.tSv}),"Synthesize Unary Selector"]})),(0,r.jsxs)("button",Object.assign({type:"button",onClick:()=>e(Qs({numInstances:3,selectorType:"binary"})),className:"inline-flex items-center justify-center gap-2 rounded-lg bg-gradient-to-r from-purple-600 to-indigo-600 px-4 py-3 text-sm font-semibold text-white shadow-md transition hover:from-purple-500 hover:to-indigo-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-purple-500 focus-visible:ring-offset-2 focus-visible:ring-offset-white"},{children:[(0,r.jsx)(Qr.JO,{as:ts.tSv}),"Synthesize Binary Selector"]}))]}))]}))]}))}))})):(0,r.jsxs)("div",Object.assign({className:"absolute inset-0 flex flex-col items-center justify-center bg-slate-50/90 p-8 text-center"},{children:[(0,r.jsx)(Qr.JO,{as:ts.tSv,boxSize:12,className:"mb-4 text-slate-300"}),(0,r.jsx)("p",Object.assign({className:"text-slate-500"},{children:"Load an instance to start synthesizing selectors."}))]}))},Si=()=>(0,r.jsxs)("div",Object.assign({className:"w-full flex items-center px-2 space-x-2"},{children:[(0,r.jsx)(Qr.JO,{as:ts.tSv}),(0,r.jsx)(k,{children:"Synthesis"})]})),Mi=()=>{const e=At(wr);return(0,r.jsxs)(r.Fragment,{children:["explorer"===e&&(0,r.jsx)(Us,{}),"state"===e&&(0,r.jsx)(bs,{}),"evaluator"===e&&(0,r.jsx)(oo,{}),"log"===e&&(0,r.jsx)(io,{}),"layout"===e&&(0,r.jsx)(Xs,{}),"synthesis"===e&&(0,r.jsx)(Ai,{})]})},Ci=()=>{const e=At(wr);return(0,r.jsxs)(r.Fragment,{children:["explorer"===e&&(0,r.jsx)(qs,{}),"state"===e&&(0,r.jsx)(ys,{}),"evaluator"===e&&(0,r.jsx)(so,{}),"log"===e&&(0,r.jsx)(ao,{}),"layout"===e&&(0,r.jsx)(Hs,{}),"synthesis"===e&&(0,r.jsx)(Si,{})]})};var Ii=n(14578);const Oi=e=>(0,r.jsx)("div",Object.assign({className:"contents group"},{children:e.children})),ki=e=>(0,r.jsx)("div",Object.assign({className:"px-4 py-0.5 prose text-xs group-hover:bg-slate-100"},{children:e.children})),Ni=e=>(0,r.jsx)("div",Object.assign({className:"px-4 py-0.5 text-xs font-mono group-hover:bg-slate-100"},{children:e.children})),zi=e=>{const{variable:t}=e;return(0,r.jsxs)(Oi,{children:[(0,r.jsx)(Ni,{children:t.name}),(0,r.jsx)(ki,{children:void 0!==t.typeUrl?(0,r.jsx)("a",Object.assign({target:"_blank",rel:"noopener noreferrer",href:t.typeUrl},{children:t.type})):t.type})]})},Di=e=>{const{datum:t}=e,n=At((e=>Pr(e,t)));return(0,r.jsxs)("div",Object.assign({className:"flex flex-col justify-middle"},{children:[(0,r.jsx)("div",Object.assign({className:"prose prose-md font-bold mx-2 my-2 border-b"},{children:"Datum Variables"})),(0,r.jsxs)("div",Object.assign({className:"grid grid-cols-2"},{children:[(0,r.jsx)("div",Object.assign({className:"px-4 prose prose-sm font-semibold"},{children:"Variable"})),(0,r.jsx)("div",Object.assign({className:"px-4 prose prose-sm font-semibold"},{children:"Type"})),n.map(((e,t)=>(0,r.jsx)(zi,{variable:e},t)))]}))]}))},Ei=()=>{const e=At(Dr),t=At(Er);return(0,r.jsxs)("div",Object.assign({className:"flex flex-col justify-middle"},{children:[(0,r.jsx)("div",Object.assign({className:"prose prose-md font-bold mx-2 my-2 border-b"},{children:"Stage Variables"})),(0,r.jsxs)("div",Object.assign({className:"grid grid-cols-2"},{children:[(0,r.jsx)("div",Object.assign({className:"px-4 prose prose-sm font-semibold"},{children:"Variable"})),(0,r.jsx)("div",Object.assign({className:"px-4 prose prose-sm font-semibold"},{children:"Value"})),(0,r.jsxs)(Oi,{children:[(0,r.jsx)(Ni,{children:e}),(0,r.jsxs)(ki,{children:["svg"===e&&(0,r.jsx)("a",Object.assign({target:"_blank",rel:"noopener noreferrer",href:"https://developer.mozilla.org/en-US/docs/Web/SVG"},{children:""})),"div"===e&&(0,r.jsx)("a",Object.assign({target:"_blank",rel:"noopener noreferrer",href:"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div"},{children:"
"})),"canvas"===e&&(0,r.jsx)("a",Object.assign({target:"_blank",rel:"noopener noreferrer",href:"https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API"},{children:""}))]})]}),(0,r.jsxs)(Oi,{children:[(0,r.jsx)(Ni,{children:"width"}),(0,r.jsx)(Ni,{children:t.width})]}),(0,r.jsxs)(Oi,{children:[(0,r.jsx)(Ni,{children:"height"}),(0,r.jsx)(Ni,{children:t.height})]})]}))]}))},_i=e=>{const{datum:t}=e;return(0,r.jsxs)("div",Object.assign({className:"absolute inset-0 flex flex-col overflow-y-auto"},{children:[(0,r.jsx)(Ei,{}),(0,r.jsx)(Di,{datum:t})]}))},Li=()=>(0,r.jsxs)("div",Object.assign({className:"w-full flex items-center px-2 space-x-2"},{children:[(0,r.jsx)(Qr.JO,{as:Ii.VuO}),(0,r.jsx)(k,{children:"Variables"})]})),Ti=()=>{const e=At(ur),t=At(zr);return(0,r.jsxs)(r.Fragment,{children:["explorer"===t&&(0,r.jsx)(Us,{}),"evaluator"===t&&(0,r.jsx)(oo,{}),"log"===t&&(0,r.jsx)(io,{}),"variables"===t&&e&&(0,r.jsx)(_i,{datum:e})]})},Pi=()=>{const e=At(zr);return(0,r.jsxs)(r.Fragment,{children:["explorer"===e&&(0,r.jsx)(qs,{}),"evaluator"===e&&(0,r.jsx)(so,{}),"log"===e&&(0,r.jsx)(ao,{}),"variables"===e&&(0,r.jsx)(Li,{})]})},Bi=()=>{const e=At(ur);return e?(0,r.jsx)("div",Object.assign({className:"absolute inset-0 flex flex-col overflow-y-auto"},{children:(0,r.jsx)(xs,{datum:e})})):null},Ri=()=>(0,r.jsxs)("div",Object.assign({className:"flex items-center px-2 space-x-2"},{children:[(0,r.jsx)(Qr.JO,{as:lo.rHK}),(0,r.jsx)(k,{children:"Time"})]})),Vi=()=>{console.log("table drawer explorer!");const e=At(Lr);return(0,r.jsxs)(r.Fragment,{children:["explorer"===e&&(0,r.jsx)(Us,{}),"state"===e&&(0,r.jsx)(Bi,{}),"evaluator"===e&&(0,r.jsx)(oo,{}),"log"===e&&(0,r.jsx)(io,{})]})},$i=()=>{const e=At(Lr);return(0,r.jsxs)(r.Fragment,{children:["explorer"===e&&(0,r.jsx)(qs,{}),"state"===e&&(0,r.jsx)(Ri,{}),"evaluator"===e&&(0,r.jsx)(so,{}),"log"===e&&(0,r.jsx)(ao,{})]})},Fi=()=>{const e=At(Mr);return(0,r.jsxs)(x,{children:[(0,r.jsxs)(I,Object.assign({className:"border-b"},{children:["GraphView"===e&&(0,r.jsx)(Ci,{}),"TableView"===e&&(0,r.jsx)($i,{}),"ScriptView"===e&&(0,r.jsx)(Pi,{})]})),(0,r.jsxs)(M,{children:["GraphView"===e&&(0,r.jsx)(Mi,{}),"TableView"===e&&(0,r.jsx)(Vi,{}),"ScriptView"===e&&(0,r.jsx)(Ti,{})]})]})};var Gi=n(53854);const Zi=()=>{const e=jt(),t=At(gr),n=At(Mr);return(0,r.jsxs)(r.Fragment,{children:[t.includes("GraphView")&&(0,r.jsx)(S,Object.assign({isActive:"GraphView"===n,mr:1,leftIcon:(0,r.jsx)(as.DvO,{}),onClick:()=>e(Rs("GraphView"))},{children:"Graph"})),t.includes("TableView")&&(0,r.jsx)(S,Object.assign({isActive:"TableView"===n,mr:1,leftIcon:(0,r.jsx)(lo.WHV,{}),onClick:()=>e(Rs("TableView"))},{children:"Table"})),t.includes("ScriptView")&&(0,r.jsx)(S,Object.assign({isActive:"ScriptView"===n,mr:1,leftIcon:(0,r.jsx)(Gi.aJo,{}),onClick:()=>e(Rs("ScriptView"))},{children:"Script"}))]})},Wi=()=>(0,r.jsxs)(v,Object.assign({className:"shadow"},{children:[(0,r.jsx)(w,{}),(0,r.jsx)(c.iz,{orientation:"vertical",mx:2}),(0,r.jsx)(c.LZ,{}),(0,r.jsx)(Zi,{})]}));var Ui=n(60155);const qi=()=>{const e=jt(),t=At(Mr),n=At(wr),o=At(Vr);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(D,{text:"Time",rightIcon:(0,r.jsx)(lo.rHK,{}),isActive:"GraphView"===t&&"state"===n,onClick:()=>e($s("state"))}),(0,r.jsx)(D,{text:"Layout",rightIcon:(0,r.jsx)(ts.df2,{}),isActive:"GraphView"===t&&"layout"===n,onClick:()=>e($s("layout"))}),o&&(0,r.jsx)(D,{text:"Synthesis",rightIcon:(0,r.jsx)(ts.tSv,{}),isActive:"GraphView"===t&&"synthesis"===n,onClick:()=>e($s("synthesis"))}),(0,r.jsx)(D,{text:"Settings",rightIcon:(0,r.jsx)(Ui.Fuo,{}),isActive:"GraphView"===t&&"settings"===n,onClick:()=>e($s("settings"))})]})},Yi=()=>{const e=jt(),t=At(Mr),n=At(zr);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(D,{text:"Variables",rightIcon:(0,r.jsx)(Ii.VuO,{}),isActive:"ScriptView"===t&&"variables"===n,onClick:()=>e(Gs("variables"))}),(0,r.jsx)(D,{text:"Settings",rightIcon:(0,r.jsx)(Ui.Fuo,{}),isActive:"ScriptView"===t&&"settings"===n,onClick:()=>e(Gs("settings"))})]})},Xi=()=>{const e=jt(),t=At(Mr),n=At(Lr);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(D,{text:"Time",rightIcon:(0,r.jsx)(lo.rHK,{}),isActive:"TableView"===t&&"state"===n,onClick:()=>e(Fs("state"))}),(0,r.jsx)(D,{text:"Settings",rightIcon:(0,r.jsx)(Ui.Fuo,{}),isActive:"TableView"===t&&"settings"===n,onClick:()=>e(Fs("settings"))})]})},Hi=()=>{const e=jt(),t=At(Mr),n=At(yr);return(0,r.jsxs)(N,{children:["GraphView"===t&&(0,r.jsx)(qi,{}),"TableView"===t&&(0,r.jsx)(Xi,{}),"ScriptView"===t&&(0,r.jsx)(Yi,{}),(0,r.jsx)(c.LZ,{}),(0,r.jsx)(D,{text:"Explorer",rightIcon:(0,r.jsx)(lo.rHK,{}),isActive:"explorer"===n,onClick:()=>e(Vs("explorer"))}),(0,r.jsx)(D,{text:"Evaluator",rightIcon:(0,r.jsx)(Kr.RJr,{}),isActive:"evaluator"===n,onClick:()=>e(Vs("evaluator"))}),(0,r.jsx)(D,{text:"Log",rightIcon:(0,r.jsx)(Kr.t75,{}),isActive:"log"===n,onClick:()=>e(Vs("log"))})]})};var Ji=function(e,t,n,r){return new(n||(n=Promise))((function(o,s){function i(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,a)}l((r=r.apply(e,t||[])).next())}))};const Qi=e=>{const{datum:t,cndSpec:n,timeIndex:s,priorState:i,onLayoutStateChange:a,synthesisMode:l=!1,onDataInstanceCreated:c}=e,d=(0,o.useRef)(null),p=(0,o.useRef)(null),[h,u]=(0,o.useState)(null),[m,g]=(0,o.useState)(!0),[f,x]=(0,o.useState)(void 0!==window.CndCore),b=(0,o.useRef)(null),y=(0,o.useRef)(!1),w=(0,o.useRef)(a);w.current=a,(0,o.useEffect)((()=>{if(f)return;const e=()=>{var e;return!!(null===(e=window.CndCore)||void 0===e?void 0:e.parseLayoutSpec)&&(console.log("CndCore is now available"),x(!0),!0)};if(e())return;let t=0;const n=setInterval((()=>{t++,(e()||t>=100)&&(clearInterval(n),t>=100&&!f&&(console.error("CndCore did not load within timeout"),u("CnD Core library failed to load. Please refresh the page."),g(!1)))}),100);return()=>clearInterval(n)}),[f]);const v=(0,o.useCallback)((()=>Ji(void 0,void 0,void 0,(function*(){p.current&&b.current&&(yield p.current.renderLayout(b.current))}))),[]),j=(0,o.useCallback)((()=>Ji(void 0,void 0,void 0,(function*(){var e;if(p.current){if(g(!0),u(null),void 0===window.CndCore)return u("CnD Core library is not available. Please check your internet connection."),void g(!1);try{const r=t.data;if(!r)throw new Error("No Alloy XML data available in datum");const o=window.CndCore.AlloyInstance.parseAlloyXML(r);if(!o.instances||0===o.instances.length)throw new Error("No instances found in Alloy XML");const a=void 0!==s?Math.min(s,o.instances.length-1):0,d=new window.CndCore.AlloyDataInstance(o.instances[a]);l&&c&&c(o.instances[a]);const h=new window.CndCore.SGraphQueryEvaluator;h.initialize({sourceData:d});let m=null;try{m=window.CndCore.parseLayoutSpec(n||""),window.clearAllErrors&&window.clearAllErrors()}catch(e){console.error("Layout spec parse error:",e),window.showParseError&&window.showParseError(e.message,"Layout Specification"),m=window.CndCore.parseLayoutSpec("")}const f=!0,x=0,y=new window.CndCore.LayoutInstance(m,h,x,f),w=window.currentProjections||{};console.log("Using projections:",w);const v=y.generateLayout(d,w);if(window.updateProjectionData&&v.projectionData?(console.log("Updating projection data:",v.projectionData),window.updateProjectionData(v.projectionData)):v.projectionData&&v.projectionData.length>0&&console.warn("Projection data available but updateProjectionData function not found. Projection controls may not display correctly."),v.error&&(console.error("Layout generation error:",v.error),v.error.errorMessages?window.showPositionalError?window.showPositionalError(v.error.errorMessages):u(`Positional constraint conflict: ${v.error.message}`):v.error.overlappingNodes?window.showGroupOverlapError?window.showGroupOverlapError(v.error.message):u(`Group overlap error: ${v.error.message}`):window.showGeneralError?window.showGeneralError(`Layout generation error: ${v.error.message}`):u(`Layout generation error: ${v.error.message}`),p.current&&p.current.setAttribute("unsat","")),b.current=v.layout,p.current&&v.layout){const t=(null===(e=v.layout.nodes)||void 0===e?void 0:e.map((e=>e.id||e.name||e.label)))||[],n=i&&i.positions&&i.positions.length>0,r=n?{priorState:i}:void 0;n&&i&&i.positions.map((e=>e.id)).filter((e=>t.includes(e))),yield p.current.renderLayout(v.layout,r)}g(!1)}catch(e){console.error("Error rendering SpyTial graph:",e),u(`Error rendering graph: ${e.message}`),g(!1)}}}))),[t.data,t.id,n,s,v,i]);return(0,o.useEffect)((()=>{if(!d.current||y.current)return;const e=document.createElement("webcola-cnd-graph");e.id="spytial-graph-container",e.setAttribute("layoutFormat","default"),e.setAttribute("aria-label","Interactive graph visualization"),e.style.cssText="\n width: 100%;\n height: 100%;\n min-height: 400px;\n display: block;\n ";const t=e=>{var t;if((null===(t=p.current)||void 0===t?void 0:t.getLayoutState)&&w.current){const e=p.current.getLayoutState();e&&e.positions&&e.positions.length>0&&w.current(e)}},n=e=>{var t;if((null===(t=p.current)||void 0===t?void 0:t.getLayoutState)&&w.current){const e=p.current.getLayoutState();e&&e.positions&&e.positions.length>0&&w.current(e)}},r=e=>{var t;if((null===(t=p.current)||void 0===t?void 0:t.getLayoutState)&&w.current){const e=p.current.getLayoutState();e&&e.positions&&e.positions.length>0&&w.current(e)}};return e.addEventListener("layout-complete",t),e.addEventListener("node-drag-end",n),e.addEventListener("viewbox-change",r),d.current.appendChild(e),p.current=e,y.current=!0,()=>{p.current&&(p.current.removeEventListener("layout-complete",t),p.current.removeEventListener("node-drag-end",n),p.current.removeEventListener("viewbox-change",r),p.current.clear&&p.current.clear(),d.current&&p.current.parentNode===d.current&&d.current.removeChild(p.current)),p.current=null,b.current=null,y.current=!1}}),[]),(0,o.useEffect)((()=>{p.current&&f&&j()}),[t.data,n,s,j,f]),(0,r.jsxs)("div",Object.assign({className:"absolute inset-0 flex flex-col",style:{background:"white",overflow:"hidden"}},{children:[(0,r.jsx)("div",{ref:d,style:{flex:1,position:"relative",minHeight:"400px",cursor:l?"pointer":"default"}}),m&&(0,r.jsx)("div",Object.assign({className:"absolute inset-0 flex items-center justify-center bg-white bg-opacity-75",style:{zIndex:10,pointerEvents:"none"}},{children:(0,r.jsx)("div",Object.assign({className:"text-gray-600"},{children:"Loading graph..."}))})),h&&(0,r.jsxs)("div",Object.assign({className:"absolute bottom-0 left-0 right-0 p-4 bg-red-100 border-t border-red-300 text-red-700",style:{zIndex:20}},{children:[(0,r.jsx)("strong",{children:"Error:"})," ",h]}))]}))},Ki=e=>{const t=jt(),{datumId:n,button:s,generatorId:i}=e,{text:a,onClick:l,mouseover:c}=s,d=(0,o.useCallback)((()=>{t(_e({id:n,onClick:l,context:{generatorName:i,id:n}}))}),[n,s]);return(0,r.jsx)(ws.u,Object.assign({hasArrow:!0,label:c,isDisabled:void 0===c},{children:(0,r.jsx)(De,Object.assign({onClick:d},{children:a}))}))},ea=e=>{const{datum:t}=e,{id:n,parsed:o,buttons:s,generatorName:i}=t,a=o.command;return(0,r.jsxs)("div",Object.assign({className:"w-full flex item-center space-x-2 px-2"},{children:[(0,r.jsxs)(k,Object.assign({className:"text-gray-400"},{children:["ID: ",n]})),(0,r.jsx)(k,{children:a}),(0,r.jsx)("div",{className:"grow"}),s&&s.map(((e,t)=>(0,r.jsx)(Ki,{datumId:n,generatorId:i,button:e},t)))]}))},ta=()=>{const e=jt(),t=At(ur),n=At((e=>t?Rr(e,t):"")),s=At((e=>t?Tr(e,t):0)),i=At($r),a=At(Gr),l=(0,o.useRef)(void 0),c=(0,o.useCallback)((e=>{l.current=e}),[]),d=(0,o.useCallback)((t=>{i&&e(di({dataInstance:t}))}),[e,i]);return(0,r.jsx)(x,Object.assign({className:"grid grid-flow-col divide-x divide-dashed"},{children:t?(0,r.jsx)("div",Object.assign({className:"relative"},{children:(0,r.jsxs)(x,{children:[(0,r.jsx)(I,Object.assign({className:"border-b"},{children:(0,r.jsx)(ea,{datum:t})})),(0,r.jsx)(M,{children:(0,r.jsx)(Qi,{datum:t,cndSpec:n,timeIndex:s,priorState:l.current,onLayoutStateChange:c,synthesisMode:i&&a>0,onDataInstanceCreated:d})})]})})):null}))};var na=n(4953);const ra=(0,Ee.oM)({name:"script",initialState:{stage:"svg",stageDimensions:{width:0,height:0},text:"",scriptTextByDatumId:{}},reducers:{scriptStageDimensionsSet(e,t){e.stageDimensions=t.payload},scriptStageSet(e,t){e.stage=t.payload},scriptTextSet(e,t){e.text=t.payload},scriptTextByDatumSet(e,t){const{id:n,text:r}=t.payload;e.scriptTextByDatumId[n]=r}},extraReducers:e=>e.addCase(Is,((e,t)=>{e.text=e.scriptTextByDatumId[t.payload]})).addCase(Be,((e,t)=>{const{enter:n,update:r,exit:o}=t.payload;if(n){(0,js.Z)(n,(t=>{"visualizerConfig"in t.parsed&&"script"in t.parsed.visualizerConfig&&(e.scriptTextByDatumId[t.id]=t.parsed.visualizerConfig.script)}));const t=(0,Dt.Z)(n);t&&(e.text=e.scriptTextByDatumId[t.id])}o&&(0,Ft.Z)(o,(t=>{e.scriptTextByDatumId[t]=""}))}))}),{scriptStageSet:oa,scriptStageDimensionsSet:sa,scriptTextSet:ia,scriptTextByDatumSet:aa}=ra.actions,la=ra.reducer;var ca=n(76815);function da(e){return(0,ca.pF)(e)}var pa=n(81493);const ha="\nclass AlloyError {\n static error(source: string, message: string): Error;\n\n static missingAttribute(source: string, attribute: string): Error;\n\n static missingElement(source: string, element: string): Error;\n}\n\nclass AlloySignature extends AlloySet {\n private readonly _id;\n private readonly _atoms;\n private _subsignatures;\n\n /**\n * Create a new Alloy signature.\n *\n * @param id The signature's unique ID\n * @param atoms The atoms defined by the signature\n * @param proxy If provided, a proxied signature will be created.\n */\n constructor(id: string, atoms: AlloyAtom[], proxy?: AlloyProxy);\n\n /**\n * Get an atom by ID\n * @param id The atom ID\n * @returns An atom or null if there is no atom with the specified ID\n */\n atom(id: string): AlloyAtom | null;\n\n /**\n * Get an array of all atoms in this signature.\n * @param recursive If false, return only atoms defined by this signature,\n * if true, include atoms defined by all subsignatures as well.\n */\n atoms(recursive?: boolean): AlloyAtom[];\n\n /**\n * Create a clone of this signature.\n * @param proxy If provided, a proxied clone will be returned.\n */\n clone(proxy?: AlloyProxy): AlloySignature;\n\n /**\n * Get the signature ID.\n */\n id(): string;\n\n /**\n * Get an array of all signatures that extend this signature.\n * @param recursive If false, return only signatures that are immediate\n * children of this signature. If true, return all signatures that are\n * descendants of this signature.\n */\n subSignatures(recursive?: boolean): AlloySignature[];\n\n /**\n * Create a signature from an XML element and populate the signature with\n * atoms. Any signatures that extend the one defined in the element are not\n * created.\n *\n * @param element The XML `````` element\n * @param proxy If provided, a proxied signature with proxied atoms will be\n * returned.\n */\n static fromElement(element: Element, proxy?: AlloyProxy): AlloySignature;\n\n /**\n * Create the Int signature.\n *\n * @param bitwidth The integer bitwidth, which must be greater than or equal to zero.\n * @param proxy If provided, a proxied Int signature with proxied atoms will\n * be returned.\n */\n static intSignature(bitwidth: number, proxy?: AlloyProxy): AlloySignature;\n\n /**\n * TODO: Check and document this.\n * @param intsig\n * @param proxy\n */\n static seqIntSignature(\n intsig: AlloySignature,\n proxy?: AlloyProxy\n ): AlloySignature;\n\n /**\n * Build all signatures from an XML `````` element. All signatures are\n * populated with atoms.\n *\n * @param instance The XML `````` element\n * @param proxy If provided, all signatures and atoms will be proxied.\n * @returns A map of string IDs, as defined by the \"ID\" attribute for each\n * signature, to [[AlloySignature]] objects.\n */\n static signaturesFromXML(\n instance: Element,\n proxy?: AlloyProxy\n ): Map;\n\n /**\n * Get an array of signature types associated with an XML element. Typically\n * this is used when parsing a field or skolem, as each `````` and ``````\n * element will have a `````` child. This method parses the types defined\n * in this element and returns the corresponding signatures.\n *\n * @param element The XML element that has a child\n * @param sigIDs A map of signature IDs to signatures\n */\n static typesFromXML(\n element: Element,\n sigIDs: Map\n ): AlloySignature[];\n}\n\nclass AlloySet {\n protected _tuples: AlloyTuple[];\n\n /**\n * Create a new Alloy set.\n *\n * @param tuples The tuples contained in the set\n */\n constructor(tuples?: AlloyTuple[]);\n\n /**\n * Returns true if the set is empty, false if it is not.\n */\n empty(): boolean;\n\n /**\n * Returns true if this set is equivalent to the provided set, false otherwise.\n * @param that The set to compare to\n */\n equals(that: AlloySet): boolean;\n\n /**\n * Returns true if this set is a subset of the provided set, false otherwise.\n * @param that The set to compare to\n */\n in(that: AlloySet): boolean;\n\n /**\n * Perform a join operation with another set. This operation is equivalent\n * to the dot join operator in Alloy, in which this set is on the left side\n * of the dot and that set is on the right side.\n *\n * @param that The other set\n */\n join(that: AlloySet): AlloySet;\n\n /**\n * Create a printable string representation of this set.\n */\n toString(): string;\n\n /**\n * Get an array of all tuples in this set.\n */\n tuples(): AlloyTuple[];\n}\n\nclass AlloyTuple extends AlloySet {\n private _atoms;\n\n /**\n * Create a new Alloy tuple.\n *\n * @param atoms The atoms, in order, that comprise the tuple.\n */\n constructor(atoms: AlloyAtom[]);\n\n /**\n * Get an ordered list of the atoms in this tuple.\n */\n atoms(): AlloyAtom[];\n\n /**\n * Create a printable string representation of this tuple.\n */\n toString(): string;\n\n /**\n * Create an array of tuples from a node list of `````` XML elements.\n *\n * @param elements A node list of `````` elements, typically created\n * using the ```querySelectorAll()``` method on a `````` or\n * `````` element.\n * @param types An ordered array of signatures that define the type of each\n * atom in each tuple, typically created using [[AlloySignature.typesFromXML]].\n */\n static tuplesFromXML(\n elements: NodeListOf,\n types: AlloySignature[]\n ): AlloyTuple[];\n}\n\nclass AlloyProxy {\n private readonly _sets;\n\n constructor();\n\n applyProxy(set: T, id?: string): T;\n\n private _finalize;\n}\n\n/**\n * In Alloy, an atom is a primitive entity that is indivisible, immutable, and\n * uninterpreted.\n */\nclass AlloyAtom extends AlloySet {\n private readonly _id;\n\n constructor(id: string, proxy?: AlloyProxy);\n\n clone(proxy?: AlloyProxy): AlloyAtom;\n\n id(): string;\n\n static fromElement(element: Element, proxy?: AlloyProxy): AlloyAtom;\n}\n\nclass AlloyTypedSet extends AlloySet {\n private readonly _types;\n\n constructor(types: AlloySignature[], tuples: AlloyTuple[]);\n\n project(atoms: Map): void;\n\n types(): AlloySignature[];\n}\n\nexport class AlloyField extends AlloyTypedSet {\n private readonly _id;\n\n /**\n * Create a new Alloy field.\n * @param id The field's unique ID\n * @param types An array of signatures defining the types of each column of the field\n * @param tuples The tuples defined by the field\n * @param proxy If provided, a proxied signature will be created.\n * @param varName If provided, the variable name to assign to this field when proxied.\n */\n constructor(\n id: string,\n types: AlloySignature[],\n tuples: AlloyTuple[],\n proxy?: AlloyProxy,\n varName?: string\n );\n\n /**\n * Create a clone of this field\n *\n * @param signatures An array of signatures. When creating the clone of this\n * field, the types associated with each column are not cloned. Instead,\n * provide an array of signatures and this method will find the corresponding\n * types by signature ID in the array and use them to define types of the\n * cloned field.\n * @param proxy If provided, a proxied clone will be returned.\n */\n clone(signatures: AlloySignature[], proxy?: AlloyProxy): AlloyField;\n\n /**\n * Get the field ID.\n */\n id(): string;\n\n /**\n * Build all fields from an XML `````` element. All fields are\n * fully populated with tuples.\n *\n * @param instance The XML `````` element\n * @param sigIDs A map of signature string IDs to signature objects\n * @param proxy If provided, all fields will be proxied.\n */\n static fieldsFromXML(\n instance: Element,\n sigIDs: Map,\n proxy?: AlloyProxy\n ): AlloyField[];\n}\n\nclass AlloySkolem extends AlloyTypedSet {\n private readonly _id;\n\n constructor(\n id: string,\n types: AlloySignature[],\n tuples: AlloyTuple[],\n proxy?: AlloyProxy\n );\n\n clone(signatures: AlloySignature[], proxy?: AlloyProxy): AlloySkolem;\n\n id(): string;\n\n static skolemsFromXML(\n instance: Element,\n sigIDs: Map,\n proxy?: AlloyProxy\n ): AlloySkolem[];\n}\n\n/**\n * In Alloy, when you run a predicate or check an assertion, the analyzer\n * searches for an _instance_ of an _analysis constraint_: an assignment of\n * values to the variables of the constraint for which the constraint evaluates\n * to true [[Jackson 2012](http://softwareabstractions.org/)].\n */\nclass AlloyInstance {\n private _proxy;\n private _atoms;\n private _fields;\n private _signatures;\n private _skolems;\n private _projections;\n private _bitwidth;\n private _command;\n private _filename;\n private _sources;\n\n /**\n * Create a new Alloy instance. If no text is provided, an empty instance\n * is created.\n * @param text A string containing the XML output from an Alloy instance\n * @param index\n */\n constructor(text?: string, index?: number);\n\n /**\n * Get an atom by ID.\n * @param id The atom ID\n * @returns An atom or null if there is no atom with the specified ID\n */\n atom(id: string): AlloyAtom | null;\n\n /**\n * Get an array of all atoms in the instance.\n */\n atoms(): AlloyAtom[];\n\n /**\n * Get the bitwidth of the instance.\n */\n bitwidth(): number;\n\n /**\n * Generate a deep clone of the instance.\n * @throws Error if the instance does not have a univ signature.\n */\n clone(): AlloyInstance;\n\n /**\n * Get the command used to generate the instance.\n */\n command(): string;\n\n /**\n * Get a field by ID.\n * @param id The field ID\n * @returns A field or null if there is no field with the specified ID\n */\n field(id: string): AlloyField | null;\n\n /**\n * Get an array of all fields in the instance.\n */\n fields(): AlloyField[];\n\n /**\n * Get the full path of the model used to generate the instance.\n */\n filename(): string;\n\n /**\n * Project the instance over the specified atoms. There may be a maximum of\n * one atom per signature that is a direct descendant of the univ signature.\n * @param atoms The list of atoms over which to project the instance.\n * @returns A clone of the instance with the projection applied.\n * @throws Error if there is more than one atom provided for any signature\n * that is a direct descendant of the univ signature.\n */\n project(atoms: AlloyAtom[]): AlloyInstance;\n\n /**\n * Get the currently projected atoms.\n * @returns A Map object with key-value pairs mapping signatures to projected atoms\n */\n projections(): Map;\n\n /**\n * Get a signature by ID\n * @param id The signature ID\n * @returns A signature or null if there is no signature with the specified ID\n */\n signature(id: string): AlloySignature | null;\n\n /**\n * Get an array of all signatures in the instance.\n */\n signatures(): AlloySignature[];\n\n /**\n * Get a skolem by ID\n * @param id The skolem ID\n * @returns A skolem or null if there is no skolem with the specified ID\n */\n skolem(id: string): AlloySkolem | null;\n\n /**\n * Get an array of all skolems in the instance.\n */\n skolems(): AlloySkolem[];\n\n /**\n * Get all source files that define the model from which this instance was created.\n * @returns A Map object with key-value pairs mapping full path names to file contents\n */\n sources(): Map;\n\n /**\n * Get the univ signature.\n * @returns The univ signature if it exists, null if it does not\n */\n univ(): AlloySignature | null;\n\n private _buildFromXML;\n}",ua=e=>{const{initialText:t,variables:n,editorRef:s,stageRef:i,beforeUnmount:a,onExecute:l}=e,[c,d]=(0,o.useState)(),p=(0,o.useCallback)((e=>{s(e),d(e)}),[]);return(0,o.useEffect)((()=>{if(c){c.addCommand(pa.Fd.KeyMod.WinCtrl|pa.Fd.KeyCode.Enter,(()=>{l()}));const e="ts:filename/alloy.d.js",t=pa.Fd.Uri.parse(e);null!==pa.Fd.editor.getModel(t)||(pa.Fd.languages.typescript.javascriptDefaults.setExtraLibs([{content:ha,filePath:"alloy.js"}]),pa.Fd.editor.createModel(ha,"typescript",t))}}),[c,l,i]),(0,o.useEffect)((()=>{const e=function(e){return e.map((e=>`declare const ${e.name}: ${e.type};`)).join("\n")}(n);pa.Fd.languages.typescript.javascriptDefaults.setExtraLibs([{content:"\n/**\n * To anyone adding to this library in the future: please take the following steps when adding\n * new VisualObjects.\n *\n * 1. If the object is to be accessible within sterling, add it to library within ScriptViewImports.\n * 2. Add the name of the file, minus .d.ts, to the list within d3lib-def-compiler/src/D3LibDefCompiler.java.\n * 3. Run the typescript compiler (\"tsc\" in terminal) from within the d3-packages folder.\n * 4. Run the main method within D3LibDefCompiler.\n *\n * If these steps are not followed, the file's definitions will either not be accessible within\n * sterling, or will not show up in monaco.\n */\ndeclare type BoundingBoxGenerator = (r: number) => Coords;\ndeclare class VisualObject {\n center: () => Coords;\n children: VisualObject[];\n dependents: VisualObject[];\n bounding_box_lam: BoundingBoxGenerator;\n hasBoundingBox: boolean;\n /**\n * Top level class, which all other visual objects will extend.\n * @param coords position of the object on screen.\n */\n constructor(coords?: Coords | (() => Coords));\n boundingBox(): BoundingBox;\n getChildren(): VisualObject[];\n /**\n * Shifts object to have new given center\n * @param center new center of the object\n */\n setCenter(center: Coords | (() => Coords)): void;\n hasLam(): Boolean;\n getLam(): BoundingBoxGenerator;\n /**\n * Renders the object to the screen.\n * @param svg HTML Svg object to which the object should be rendered.\n */\n render(svg: any): void;\n}\n//# sourceMappingURL=VisualObject.d.ts.map\ninterface ShapeProps {\n center?: Coords | (() => Coords);\n color?: string | (() => string);\n borderWidth?: number | (() => number);\n borderColor?: string | (() => string);\n label?: string | (() => string);\n labelColor?: string | (() => string);\n labelSize?: number | (() => number);\n opacity?: number | (() => number);\n}\n/**\n * Generic class for a large suite of \"shape\"-like objects.\n * Generally includes anything with an inside and an outside.\n * All shapes come with builtin label.\n */\ndeclare class Shape extends VisualObject {\n color: () => string;\n borderWidth: () => number;\n borderColor: () => string;\n opacity: () => number;\n label: TextBox;\n /**\n * Constructs a generic shape object. This is a top-level class,\n * which should not be used except as super class for other specific\n * shapes.\n * @param coords coordinates of the shape\n * @param color color of shape's interior\n * @param borderWidth width of Shape's border\n * @param borderColor color of border\n * @param label text to display atop the shape\n * @param labelColor color of text\n * @param labelSize size of text\n * @param style\n */\n constructor(props: ShapeProps);\n setColor(color: string | (() => string)): void;\n setBorderWidth(borderWidth: number | (() => number)): void;\n setBorderColor(borderColor: string | (() => string)): void;\n setLabelText(text: string | (() => string)): void;\n setLabelColor(labelColor: string | (() => string)): void;\n setLabelSize(labelSize: number | (() => number)): void;\n}\n//# sourceMappingURL=Shape.d.ts.map\ndeclare class Pane {\n Children: VisualObject[];\n constructor();\n add(addNode: VisualObject): void;\n render(svg: any): void;\n}\n//# sourceMappingURL=Pane.d.ts.map\ninterface gridProps {\n grid_location: Coords | (() => Coords);\n cell_size: {\n x_size: number;\n y_size: number;\n };\n grid_dimensions: {\n x_size: number;\n y_size: number;\n };\n}\ndeclare class Grid extends VisualObject {\n /**\n *\n * As one of the most common expressions of a graph is a matrix, we offer functionality\n * for building a grid of cells, where you can add visual objects to each square in the grid,\n * and they are automatically formatted into the grid (where the center of the object is aligned\n * to the center of the grid)\n *\n * Note: grid size is fixed! You can't change the size of a grid once it's created\n *\n */\n private coords;\n config: gridProps;\n cells: Array>;\n gridlines: Array;\n constructor(props: gridProps);\n private check_bounding_box;\n add(coords: Coords, add_object: VisualObject, ignore_warning?: boolean): void;\n private center_helper;\n private fill_grid_lines;\n hide_grid_lines(): void;\n fill(coords: Coords, color: string): void;\n private check_coords;\n}\n{};\n//# sourceMappingURL=Grid.d.ts.map\ninterface RectangleProps extends ShapeProps {\n height: number | (() => number);\n width: number | (() => number);\n coords?: Coords | (() => Coords);\n}\ndeclare class Rectangle extends Shape {\n height: () => number;\n width: () => number;\n /**\n * Creates a logical rectangle object\n * @param height height (y direction)\n * @param width width (x direction)\n * @param coords coordinates of the top-left point\n * @param color color for interior\n * @param borderWidth width of border\n * @param borderColor color of border\n * @param label text for label\n * @param labelColor color for label text\n * @param labelSize size of label text\n */\n constructor(props: RectangleProps);\n boundingBox(): BoundingBox;\n setWidth(width: number | (() => number)): void;\n setHeight(height: number | (() => number)): void;\n render(svg: any): void;\n}\n//# sourceMappingURL=Rectangle.d.ts.map\ninterface CircleProps extends ShapeProps {\n radius: number | (() => number);\n}\ndeclare class Circle extends Shape {\n radius: () => number;\n bounding_box_lam: BoundingBoxGenerator;\n /**\n * Creates a circle object at the given location\n * @param radius radius of circle\n * @param coords coordinates of circle's center\n * @param color color of interior\n * @param borderWidth width border\n * @param borderColor color for border\n * @param label text for label\n * @param labelColor color of label\n * @param labelSize size of label\n */\n constructor(props: CircleProps);\n boundingBox(): BoundingBox;\n setRadius(radius: number | (() => number)): void;\n render(svg: any): void;\n}\n//# sourceMappingURL=Circle.d.ts.map\ndeclare class Stage {\n Children: VisualObject[];\n constructor();\n add(addObject: VisualObject): void;\n children_to_tree_recurse(root: VisualObject): VisTree;\n render(svg: any, document?: any): void;\n}\n//# sourceMappingURL=Stage.d.ts.map\ninterface TextBoxProps {\n text?: string | (() => string);\n coords?: Coords | (() => Coords);\n color?: string | (() => string);\n fontSize?: number | (() => number);\n}\ndeclare class TextBox extends VisualObject {\n text: () => string;\n fontSize: () => number;\n color: () => string;\n /**\n * Displays given text.\n * @param text text to display\n * @param coords location for center of text\n * @param color text color\n * @param fontSize size of the text\n */\n constructor(props: TextBoxProps);\n boundingBox(): BoundingBox;\n setText(text: string | (() => string)): void;\n setFontSize(fontSize: number | (() => number)): void;\n setTextColor(color: string | (() => string)): void;\n render(svg: any): void;\n}\n//# sourceMappingURL=TextBox.d.ts.map\ninterface LineProps {\n points?: Coords[] | (() => Coords)[];\n arrow?: boolean;\n color?: string | (() => string);\n width?: number | (() => number);\n opacity?: number | (() => number);\n style?: string | (() => string);\n}\ndeclare class Line extends VisualObject {\n pointsRelative: (() => Coords)[];\n color: () => string;\n width: () => number;\n opacity: () => number;\n arrow: boolean;\n style: () => string;\n /**\n * Creates a line on the given poitns.\n * @param points list of points for the line to pass through\n * @param color color of line\n * @param width width of line\n * @param opacity of the line\n */\n constructor(props: LineProps);\n boundingBox(): BoundingBox;\n setColor(color: string | (() => string)): void;\n setWidth(width: number | (() => number)): void;\n setOpacity(opacity: number | (() => number)): void;\n render(svg: any): void;\n}\n//# sourceMappingURL=Line.d.ts.map\n/**\n * This class is not currently being used!!\n */\ndeclare class ConjoinedObject extends VisualObject {\n /**\n * Note: this code is untested!\n */\n children: VisualObject[];\n constructor(Children?: VisualObject[]);\n addOrdered(obj: VisualObject, index: number): void;\n add(obj: VisualObject): void;\n setCenter(coords: Coords): void;\n render(svg: any): void;\n}\n//# sourceMappingURL=ConjoinedObject.d.ts.map\ninterface PolygonProps extends ShapeProps {\n points: Coords[] | (() => Coords)[];\n}\n/**\n * Class Representing Polygonal objects. Takes the form of any\n * series of points, and will form a polygon with said points as the boundary.\n */\ndeclare class Polygon extends Shape {\n pointsRelative: (() => Coords)[];\n /**\n * Constructs a polygon object\n * @param points list of points forming outside\n * @param color color of interior\n * @param borderWidth width of the border\n * @param borderColor color of the border\n * @param label text to label with\n * @param labelColor color of label text\n * @param labelSize size of the label\n */\n constructor(props: PolygonProps);\n boundingBox(): BoundingBox;\n render(svg: any): void;\n}\n//# sourceMappingURL=Polygon.d.ts.map\ninterface Node {\n name: string;\n neighbors: string[];\n}\ndeclare class Graph extends VisualObject {\n nodes: Node[];\n node_radius: number;\n fixed_nodes: number;\n graph_dimensions: number;\n node_to_location: any;\n constructor(coords?: Coords, graph_dimensions?: number, fixed_nodes?: number, node_radius?: number);\n setCenter(center: Coords): void;\n center(): {\n x: any;\n y: any;\n };\n add(Nodes: Node[]): void;\n private set_fixed_nodes;\n private set_malleable_nodes;\n check_add_set(Nodes: Node[]): void;\n render(svg: any): void;\n render_lines(svg: any, connections: string[][]): void;\n render_nodes(svg: any): void;\n}\n//# sourceMappingURL=Graph.d.ts.map\n/**\n * This is going to be a generic utility file. Primarily for factoring\n * out algorithms with a higher level of computational complexity.\n */\ndeclare function toFunc(defaultValue: T, t?: T | (() => T)): (() => T);\ninterface Coords {\n x: number;\n y: number;\n}\n/**\n * Generic props for representing a box around an object.\n */\ninterface BoundingBox {\n top_left: Coords;\n bottom_right: Coords;\n}\ndeclare function boxUnion(boxes: BoundingBox[]): {\n top_left: {\n x: number;\n y: number;\n };\n bottom_right: {\n x: number;\n y: number;\n };\n};\ninterface ExperimentalBoundingBox {\n lambda: (radians: number) => Coords;\n}\n/**\n * Simple method averaging the coordinate points in a series.\n * @param points\n * @returns\n */\ndeclare function averagePath(points: Coords[]): Coords;\n/**\n * Shifts a function list of points according to a shift variable\n * @param pointList\n * @param shift\n * @returns\n */\ndeclare function shiftList(pointList: (() => Coords)[], shift: () => Coords): (() => Coords)[];\n/**\n * Utility function returning bounding box for a list of points\n * @param pointList list of points as coords\n * @returns bounding box\n */\ndeclare function boundsOfList(pointList: Coords[]): BoundingBox;\n//# sourceMappingURL=Utility.d.ts.map\n/**\n * Interface for node in a tree with a visualObject\n */\ninterface VisTree {\n visualObject: VisualObject;\n children: VisTree[];\n}\ninterface TreeProps {\n root: VisTree;\n height: number;\n width: number;\n coords?: Coords | (() => Coords);\n edgeColor?: string;\n edgeWidth?: number;\n}\ndeclare class Tree extends VisualObject {\n root: VisTree;\n height: number;\n width: number;\n private lines;\n private subTrees;\n private coords;\n /**\n * Builds a tree object, pulling all children nodes into proper locations and\n * adding lines where necessary.\n * @param root root of the tree of visual objects\n * @param height height of box to bound the tree\n * @param width width of box to bound the tree\n * @param coords top left point of the tree\n */\n constructor(props: TreeProps);\n private setUpSubtrees;\n setLineColor(color: string): void;\n setLineWidth(width: number): void;\n}\n//# sourceMappingURL=Tree.d.ts.map\n",filePath:"helpers.ts"},{content:ha+"\n"+e,filePath:"alloy.js"},{content:e,filePath:"variables.ts"}])}),[c,n]),(0,r.jsx)(pa.ZP,{"data-testid":"script-view-monaco-editor",language:"javascript",options:{automaticLayout:!0,scrollBeyondLastLine:!1,scrollbar:{verticalScrollbarSize:12},value:t},editorDidMount:p,editorWillUnmount:e=>{const t=e.getValue();a(t)}})},ma=e=>{const t=jt(),{datumId:n,button:s,generatorId:i}=e,{text:a,onClick:l,mouseover:c}=s,d=(0,o.useCallback)((()=>{t(_e({id:n,onClick:l,context:{generatorName:i,id:n}}))}),[n,s]);return(0,r.jsx)(ws.u,Object.assign({hasArrow:!0,label:c,isDisabled:void 0===c},{children:(0,r.jsx)(De,Object.assign({onClick:d},{children:a}))}))},ga=e=>{const{onExecute:t}=e,n=At(Dr),s=jt(),i=(0,o.useCallback)((e=>{s(oa(e))}),[]);return(0,r.jsxs)("div",Object.assign({className:"flex"},{children:[(0,r.jsx)(ws.u,Object.assign({hasArrow:!0,label:""},{children:(0,r.jsx)(A.zx,Object.assign({colorScheme:"blue",size:"xs",onClick:t},{children:"Run"}))})),(0,r.jsxs)(A.hE,Object.assign({className:"pl-2",isAttached:!0,colorScheme:"blue",size:"xs"},{children:[(0,r.jsx)(A.zx,Object.assign({isActive:"div"===n,onClick:()=>i("div")},{children:"
"})),(0,r.jsx)(A.zx,Object.assign({isActive:"canvas"===n,onClick:()=>i("canvas")},{children:""})),(0,r.jsx)(A.zx,Object.assign({isActive:"svg"===n,onClick:()=>i("svg")},{children:""}))]}))]}))},fa=e=>{const{datum:t,onExecute:n}=e,{id:o,parsed:s,buttons:i}=t,a=s.command;return(0,r.jsxs)("div",Object.assign({className:"w-full flex items-center space-x-2 px-2"},{children:[(0,r.jsxs)(k,Object.assign({className:"text-gray-400"},{children:["ID: ",o]})),(0,r.jsx)(k,{children:a}),(0,r.jsx)("div",{className:"grow"}),(0,r.jsx)(ga,{onExecute:n}),i&&i.map(((e,n)=>(0,r.jsx)(ma,{datumId:o,generatorId:t.generatorName,button:e},n)))]}))},xa=e=>{const{datum:t}=e,n=jt(),s=(0,na.pm)(),i=At(Dr),a=At(Er),l=At(_r),c=At((e=>Pr(e,t))),[d,p]=(0,o.useState)(),[h,u]=(0,o.useState)(null),m=(0,o.useRef)(null);((e,t)=>{const[n,r]=(0,o.useState)();(0,o.useLayoutEffect)((()=>{const n=e.current;if(n){r(n.getBoundingClientRect());const e=new ResizeObserver((e=>{e.forEach((e=>{e.target===n&&(t?t(e.contentRect):r(e.contentRect))}))}));return e.observe(n),()=>{e.unobserve(n)}}}),[e.current])})(m,(e=>{n(sa({width:e.width,height:e.height}))}));const g=(0,o.useCallback)((e=>{p(e)}),[]),f=(0,o.useCallback)((e=>{e&&u(e)}),[]),b=(0,o.useCallback)((e=>{e&&u(e)}),[]),y=(0,o.useCallback)((e=>{e&&u(e)}),[]),w=(0,o.useCallback)((e=>{n(ia(e)),n(aa({id:t.id,text:e}))}),[t]),v=(0,o.useCallback)((()=>{const e=null==d?void 0:d.getValue();if(e&&h&&a){n(ia(e)),n(aa({id:t.id,text:e}));const[r,o]=function(e){const t=e.split("\n"),n=[];let r=0;for(let e=0;e{try{new Function(i,"width","height",...qn.map((e=>e.name)),...c.map((e=>e.name)),...r.map((e=>function(e){return e.replaceAll("-","_")}(e))),o)(h,a.width,a.height,...qn.map((e=>e.value)),...c.map((e=>e.variable)),...e)}catch(e){s({variant:"top-accent",position:"bottom-right",title:e instanceof Error?e.name:"Error",description:ba(e),status:"error",duration:1e4,isClosable:!0})}}))}}),[d,i,h,a,c]);return(0,r.jsxs)(x,{children:[(0,r.jsx)(I,Object.assign({className:"border-b"},{children:(0,r.jsx)(fa,{datum:t,onExecute:v})})),(0,r.jsx)(M,{children:(0,r.jsxs)("div",Object.assign({className:"grid grid-cols-2 divide-x h-full"},{children:[(0,r.jsxs)(x,Object.assign({ref:m,className:"relative"},{children:["div"===i&&(0,r.jsx)("div",{ref:y,className:"w-full h-full"}),"canvas"===i&&(0,r.jsx)("canvas",{ref:b,className:"w-full h-full"}),"svg"===i&&(0,r.jsx)("div",Object.assign({"aria-label":"SVG Visualization",id:"svg-container",style:{height:"100%",width:"100%",overflow:"scroll"}},{children:(0,r.jsx)("svg",{ref:f,style:{width:"100%",height:"100%",backgroundColor:"snow"}})}))]})),(0,r.jsx)(x,Object.assign({className:"relative","aria-label":"Visualization Script","data-testid":"script-editor-pane"},{children:(0,r.jsx)(ua,{initialText:l,variables:c,editorRef:g,stageRef:h,beforeUnmount:w,onExecute:v})}))]}))})]})};function ba(e){if(!(e instanceof Error))return`${e}`;if(console.log(`Error stack: ${e.stack}`),null!=e.stack){const t=e.stack.match(new RegExp(".*(Function|):[0-9]+:[0-9]+.*","g"));if(t){const n=t[0].split(new RegExp(".*Function:|:"))[1].split(":");console.log(`rowCol: ${JSON.stringify(n)}`);const r=+n[0]-2;return n[1],`${e.message} Around line ${r} (computed via parsing error stack)`}}return`${e.message} (error location was not provided by the browser)`}const ya=()=>{const e=At(ur);return e?(0,r.jsx)(xa,{datum:e,"data-testid":"script-view-datum"}):null},wa=e=>{const{data:t}=e,n={gridTemplateColumns:`repeat(${t.data.length>0?t.data[0].length:0}, minmax(0, 1fr))`,borderCollapse:"collapse",textAlign:"left"};return(0,r.jsxs)("table",Object.assign({className:"prose shadow m-2 boarder prose text-xs font-mono",summary:t.title,role:"table",style:n},{children:[(0,r.jsx)("caption",Object.assign({className:"prose prose-sm font-semibold px-2 py-1 border shadow",style:{textAlign:"left"}},{children:t.title})),(0,r.jsx)("thead",Object.assign({className:"bg-slate-100"},{children:(0,r.jsx)("tr",{children:t.headers&&t.headers.map(((e,t)=>(0,r.jsx)("th",Object.assign({className:"font-semibold px-2 py-0.5",scope:"col","aria-labelledby":e},{children:e}),`header-${t}`)))})})),(0,r.jsx)("tbody",{children:t.data.map(((e,t)=>(0,r.jsx)("tr",{children:e.map(((e,n)=>(0,r.jsx)("td",Object.assign({className:"px-2 py-0.5 bg-white boarder",headers:`header-${n}`},{children:e}),`${t}${n}`)))},`row-${t}`)))})]}))},va=e=>{const{datum:t}=e,n=At((e=>Br(e,t)));return(0,r.jsx)(r.Fragment,{children:n.map(((e,t)=>(0,r.jsx)(wa,{data:e},t)))})},ja=e=>{const{datum:t}=e,{id:n,parsed:o,buttons:s}=t,i=o.command;return(0,r.jsxs)("div",Object.assign({className:"w-full flex items-center space-x-2 px-2"},{children:[(0,r.jsxs)(k,Object.assign({className:"text-gray-400"},{children:["ID: ",n]})),(0,r.jsx)(k,{children:i}),(0,r.jsx)("div",{className:"grow"}),s&&s.map(((e,o)=>(0,r.jsx)(ma,{datumId:n,generatorId:t.generatorName,button:e},o)))]}))},Aa=()=>{const e=At(ur);return e?(0,r.jsxs)(x,{children:[(0,r.jsx)(I,{children:(0,r.jsx)(ja,{datum:e})}),(0,r.jsx)(M,{children:(0,r.jsx)("div",Object.assign({className:"w-full h-full flex content-start items-start flex-wrap overflow-y-auto"},{children:(0,r.jsx)(va,{datum:e})}))})]}):null},Sa=()=>{const e=At(Mr);return(0,r.jsxs)(x,{children:["GraphView"===e&&(0,r.jsx)(ta,{}),"TableView"===e&&(0,r.jsx)(Aa,{}),"ScriptView"===e&&(0,r.jsx)(ya,{})]})};var Ma=n(97375);const Ca=e=>{const{isConnected:t}=e,n=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o{const t=At(Ar),n=At(kr),o=t?`Connected to ${n}`:"Not connected to a provider",s=t?"Connected":"Disconnected";return(0,r.jsx)(ws.u,Object.assign({hasArrow:!0,label:o},{children:(0,r.jsxs)(c.M5,Object.assign({},e,{children:[(0,r.jsx)(Ca,{isConnected:t}),(0,r.jsx)(c.xv,Object.assign({mx:1,userSelect:"none"},{children:s}))]}))}))};var Oa=n(45073),ka=n(33441);const Na=function(e,t){const{name:n,generators:r,features:o}=t.payload;e.providerName=n||"unknown provider",e.providerGenerators=null==r?void 0:r.slice(),e.features=(null==o?void 0:o.slice())||[]},za=function(e){e.connected=!0},Da=function(e){e.connected=!1},Ea=(0,Ee.oM)({name:"provider",initialState:{connected:!1,providerName:"unknown provider",providerGenerators:void 0,features:[],synthesisEnabled:!1},reducers:{synthesisFeatureEnabled(e,t){e.synthesisEnabled=t.payload}},extraReducers:e=>e.addCase(Ve,Na).addCase(Ge,za).addCase(We,Da)}),{synthesisFeatureEnabled:_a}=Ea.actions,La=Ea.reducer,Ta=e=>t=>n=>{const r=t(n);if(Be.match(n))try{const t=e.getState(),r=t.synthesis;if(r.isActive&&r.currentStep>0&&r.currentStep<=r.numInstances){const o=n.payload;if(o.enter&&o.enter.length>0&&window.CndCore){const n=o.enter[o.enter.length-1],s=t.data.datumById[t.data.active||""];if(console.log("[SynthesisMiddleware] New datum received:",{newDatumId:n.id,activeDatumId:null==s?void 0:s.id,generatorMatch:n.generatorName===(null==s?void 0:s.generatorName),currentStep:r.currentStep,numInstances:r.numInstances}),n.generatorName===(null==s?void 0:s.generatorName)){console.log("[SynthesisMiddleware] New instance from same generator, loading for synthesis");const t=window.CndCore.AlloyInstance.parseAlloyXML(n.data);if(t.instances&&t.instances.length>0){const n=new window.CndCore.AlloyDataInstance(t.instances[0]),o=[...r.loadedInstances,n];console.log("[SynthesisMiddleware] Loaded instance, total now:",o.length),e.dispatch(ei({instances:o}))}}}}}catch(e){console.error("[SynthesisMiddleware] Failed to load new instance:",e)}return r},Pa=function(e,t){const{id:n,result:r}=t.payload;e.expressionsById[n].result=r},Ba=function(e,t){const{id:n,datumId:r,expression:o}=t.payload,s=e.orderByDatumId[r]||[];e.nextExpressionId+=1,e.expressionsById[n]={id:n,datumId:r,expression:o,result:""},e.orderByDatumId[r]=[n,...s]},Ra=(0,Ee.oM)({name:"evaluator",initialState:{nextExpressionId:0,expressionsById:{},orderByDatumId:{}},reducers:{},extraReducers:e=>e.addCase(Re,Pa).addCase(Te,Ba)}),{}=Ra.actions,Va=Ra.reducer;function $a(e){return{type:"message",time:(new Date).toJSON(),text:e}}function Fa(e){return{type:"error",time:(new Date).toJSON(),text:e}}const Ga=function(e,t){e.items.push($a(`Datum selected - Datum ID: ${t.payload}`))},Za=function(e,t){const{id:n,onClick:r}=t.payload;e.items.push($a(`Click button - Datum ID: ${n} - Button: ${r}`))},Wa=function(e,t){const{enter:n,update:r,exit:o}=t.payload,s=(null==n?void 0:n.length)||0,i=(null==r?void 0:r.length)||0,a=(null==o?void 0:o.length)||0;e.items.push($a(`Receive data: ${s} enter, ${i} update, ${a} exit.`))},Ua=function(e){e.items.push($a("Request data."))},qa=function(e,t){const{name:n}=t.payload;e.items.push($a(`Receive metadata from ${n}.`))},Ya=function(e){e.items.push($a("Connection established."))},Xa=function(e,t){e.items.push(Fa(t.payload))},Ha=function(e){e.items.push($a("Connection lost."))},Ja=function(e,t){e.items.push(Fa(t.payload))},Qa=(0,Ee.oM)({name:"log",initialState:{items:[],filters:["message","warning","error"],sort:"ascending"},reducers:{filtersChanged:function(e,t){e.filters=t.payload},logCleared:function(e){e.items=[]},sortOrderChanged:function(e,t){e.sort=t.payload}},extraReducers:e=>e.addCase(Is,Ga).addCase(_e,Za).addCase(Be,Wa).addCase(Le,Ua).addCase(Ve,qa).addCase(Ge,Ya).addCase(Ze,Xa).addCase(We,Ha).addCase(Ue,Ja)}),{logCleared:Ka,sortOrderChanged:el,filtersChanged:tl}=Qa.actions,nl=Qa.reducer,rl=(0,Ee.xC)({reducer:{data:ks,evaluator:Va,graphs:Qo,log:nl,provider:La,script:la,synthesis:pi,ui:Ws},middleware:e=>e({serializableCheck:{ignoredPaths:["synthesis.loadedInstances"],ignoredActionPaths:["payload.instances"]}}).prepend(function(){let e=null,t=0;const n=()=>{window.clearInterval(t),t=0},r=()=>{e&&e.close()},o=()=>{e&&e.send("ping")},s=(i,a)=>{const l=i.dispatch;let c=!1;e&&r(),a=a||`ws://localhost:${window.location.search.slice(1)}`,e=new WebSocket(a),e.onopen=()=>{c=!0,window.setTimeout((()=>o()),3e3),l(Ge()),n()},e.onclose=()=>{c&&(c=!1,l(We())),e&&e.readyState===WebSocket.CLOSED&&(n(),t=window.setInterval((()=>s(i,a)),1e3))},e.onmessage=e=>{"pong"===e.data?window.setTimeout((()=>o()),3e3):yt(e.data,i)}};return t=>n=>o=>($e.match(o)?s(t,o.payload):Fe.match(o)?r():_e.match(o)?function(e,t,n){if(!e)return wt(t);vt(e,function(e,t){return{type:"click",version:1,payload:t}}(0,n))}(e,t,o.payload):Le.match(o)?function(e,t){if(!e)return wt(t);vt(e,{type:"data",version:1})}(e,t):Te.match(o)?function(e,t,n){if(!e)return wt(t);vt(e,function(e,t){return{type:"eval",version:1,payload:t}}(0,n))}(e,t,o.payload):Pe.match(o)&&function(e,t){if(!e)return wt(t);vt(e,{type:"meta",version:1})}(e,t),n(o))}(),(e=>t=>n=>{if(!Ge.match(n))return t(n);t(n),e.dispatch(Pe()),e.dispatch(Le())}),Ta)});function ol({isOpen:e,onClose:t}){const n=(0,o.useRef)(null);let[s,i]=(0,o.useState)("");const a=(0,na.pm)(),l=(0,o.useRef)(null);return(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)(Oa.u_,Object.assign({isOpen:e,onClose:t},{children:[(0,r.jsx)(Oa.ZA,{}),(0,r.jsxs)(Oa.hz,Object.assign({maxW:"70rem"},{children:[(0,r.jsx)(Oa.xB,{children:(0,r.jsx)(c.M5,{children:"Input Alloy-style XML datum (paste directly or load from file)"})}),(0,r.jsx)(Oa.ol,{}),(0,r.jsxs)(Oa.fe,Object.assign({pb:6},{children:[(0,r.jsx)(A.zx,Object.assign({onClick:()=>{var e;return null===(e=l.current)||void 0===e?void 0:e.click()}},{children:"Click to add XML from file"})),' ...or simply paste in an XML datum below. Then click the "Add Datum" button.',(0,r.jsx)(c.LZ,{h:"1rem"}),(0,r.jsx)(c.iz,{orientation:"horizontal",mx:5}),(0,r.jsx)(c.LZ,{h:"1rem"}),(0,r.jsxs)(ui.NI,{children:[(0,r.jsx)(ui.lX,{children:"XML datum string to add"}),(0,r.jsx)(ka.g,{minH:"20rem",ref:n,placeholder:'\n\n \n \n \n\n\n',value:s,onChange:e=>i(e.target.value)})]})]})),(0,r.jsxs)(Oa.mz,{children:[(0,r.jsx)(A.zx,Object.assign({onClick:()=>{var e;const r=null===(e=n.current)||void 0===e?void 0:e.value;if(void 0===r)return void t();const o=rl.getState().data.datumIds;console.log(o);const s=o.reduce(((e,t)=>isNaN(parseInt(t))?e:Math.max(e,parseInt(t)+1)),0);try{rl.dispatch(Be({enter:[bt({id:s.toString(),format:"alloy",data:r,buttons:[],evaluator:!1})],update:[],exit:[]}))}catch(e){a({variant:"top-accent",position:"bottom-right",title:e instanceof Error?e.name:"Error adding instance",description:e instanceof Error?e.message:"No further information is available.",status:"error",duration:1e4,isClosable:!0})}t()}},{children:"Add Datum"})),(0,r.jsx)(xi.II,{type:"file",ref:l,style:{display:"none"},onChange:e=>{var t;const n=new FileReader;n.onload=e=>{return t=this,n=void 0,o=function*(){var t;(null===(t=e.target)||void 0===t?void 0:t.result)&&(e.target.result instanceof ArrayBuffer?i(e.target.result.toString()):i(e.target.result))},new((r=void 0)||(r=Promise))((function(e,s){function i(e){try{l(o.next(e))}catch(e){s(e)}}function a(e){try{l(o.throw(e))}catch(e){s(e)}}function l(t){var n;t.done?e(t.value):(n=t.value,n instanceof r?n:new r((function(e){e(n)}))).then(i,a)}l((o=o.apply(t,n||[])).next())}));var t,n,r,o},(null===(t=e.target)||void 0===t?void 0:t.files)&&e.target.files.length>0&&n.readAsText(e.target.files[0])}})]})]}))]}))})}function sl({isOpen:e,onClose:t}){const n=At(Mr);return(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)(Oa.u_,Object.assign({isOpen:e,onClose:t},{children:[(0,r.jsx)(Oa.ZA,{}),(0,r.jsxs)(Oa.hz,Object.assign({maxW:"70rem"},{children:[(0,r.jsx)(Oa.xB,{children:(0,r.jsx)(c.M5,{children:"Using Spytial Sterling"})}),(0,r.jsx)(Oa.ol,{}),(0,r.jsxs)(Oa.fe,Object.assign({pb:6},{children:[(0,r.jsxs)(c.xu,Object.assign({as:"ul",listStyleType:"circle"},{children:[(0,r.jsxs)("li",{children:["Use the ",(0,r.jsx)("strong",{children:"evaluator"})," tab to query the value of expressions and constraints."]}),(0,r.jsxs)("li",{children:["The ",(0,r.jsx)("strong",{children:"explorer"})," tab lets you pick a run to visualize. Click on any prior instance to reload it in the visualizer."]})]})),(0,r.jsx)(c.iz,{orientation:"horizontal",colorScheme:"blackAlpha"}),"ScriptView"===n&&(0,r.jsx)(al,{}),"GraphView"===n&&(0,r.jsx)(il,{}),"TableView"===n&&(0,r.jsx)(ll,{})]}))]}))]}))})}function il(){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(c.M5,{children:(0,r.jsx)("strong",{children:"Graph View"})}),(0,r.jsxs)(c.xu,Object.assign({as:"ul",listStyleType:"circle"},{children:[(0,r.jsxs)("li",{children:[(0,r.jsx)("strong",{children:"Zoom"})," with the mouse wheel or with ",(0,r.jsx)("em",{children:"two fingers"})," on the trackpad."]}),(0,r.jsxs)("li",{children:["Use the ",(0,r.jsx)("strong",{children:"theme"})," tab on the sidebar to adjust styling options such as node coloring by sig, source and destination for edges, etc. You can also save the theme-definition file or load one you've already created."]}),(0,r.jsxs)("li",{children:["The ",(0,r.jsx)("strong",{children:"time"})," tab will let you adjust the layout according to time index, if that is appropriate for your model. In a Temporal model, you'll see a minimap and have the option to move back and forth in time. In a model that isn't explicitly temporal, you can still declare a sig as the time index and use it to navigate."]}),(0,r.jsxs)("li",{children:["The ",(0,r.jsx)("strong",{children:"layout"})," tab opens the CnD interface, which is an alternative graph-based visualization that gives more control over your instance diagram."]})]}))]})}function al(){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(c.M5,{children:(0,r.jsx)("strong",{children:"Script View"})}),(0,r.jsx)(c.xu,{as:"ul",listStyleType:"circle"})]})}function ll(){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(c.M5,{children:(0,r.jsx)("strong",{children:"Table View"})}),(0,r.jsx)(c.xu,{as:"ul",listStyleType:"circle"})]})}const cl=()=>{const e=jt(),t=(0,Ma.qY)(),n=(0,Ma.qY)();return(0,r.jsxs)(E,Object.assign({"data-testid":"app-status-bar"},{children:[(0,r.jsxs)("div",Object.assign({className:"cursor-pointer transition-colors hover:text-white",onClick:n.onOpen},{children:[(0,r.jsx)(c.LZ,{width:"50px"}),(0,r.jsx)(c.M5,{children:(0,r.jsx)("strong",{children:"Help"})})]})),(0,r.jsx)(sl,{isOpen:n.isOpen,onClose:n.onClose}),(0,r.jsx)(c.iz,{orientation:"vertical",mx:2}),(0,r.jsx)(c.LZ,{}),(0,r.jsx)(c.iz,{orientation:"vertical",mx:2}),(0,r.jsx)("div",Object.assign({className:"cursor-pointer transition-colors hover:text-white",onClick:t.onOpen},{children:"Manual Datum"})),(0,r.jsx)(ol,{isOpen:t.isOpen,onClose:t.onClose}),(0,r.jsx)(c.iz,{orientation:"vertical",mx:2}),(0,r.jsx)("div",Object.assign({className:"cursor-pointer transition-colors hover:text-white",onClick:()=>{e(Os())}},{children:"Console Dump"})),(0,r.jsx)(c.iz,{orientation:"vertical",mx:2}),(0,r.jsx)(Ia,{})]}))},dl={layout:{drawerWidth:350,drawerMinWidth:100,drawerMaxWidth:600,explorerWidth:250,explorerMinWidth:60,explorerMaxWidth:250}};var pl=n(93379),hl=n.n(pl),ul=n(7795),ml=n.n(ul),gl=n(90569),fl=n.n(gl),xl=n(3565),bl=n.n(xl),yl=n(19216),wl=n.n(yl),vl=n(44589),jl=n.n(vl),Al=n(50992),Sl={};Sl.styleTagTransform=jl(),Sl.setAttributes=bl(),Sl.insert=fl().bind(null,"head"),Sl.domAPI=ml(),Sl.insertStyleElement=wl(),hl()(Al.Z,Sl),Al.Z&&Al.Z.locals&&Al.Z.locals,s.render((0,r.jsx)(o.StrictMode,{children:(0,r.jsx)(a.xjn,Object.assign({theme:L},{children:(0,r.jsx)(i.zt,Object.assign({store:rl},{children:(0,r.jsx)((e=>{const{url:t}=e,{layout:n}=dl,s=jt(),i=At(br);return(0,o.useEffect)((()=>(s($e(t)),()=>{s(Fe())})),[t,s]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(m,Object.assign({rightPaneCollapsed:i,rightPaneInitialWidth:n.drawerWidth,rightPaneMinWidth:n.drawerMinWidth,rightPaneMaxWidth:n.drawerMaxWidth},{children:[(0,r.jsx)(Sa,{}),(0,r.jsx)(Fi,{})]})),(0,r.jsx)(Hi,{}),(0,r.jsx)(Wi,{}),(0,r.jsx)(cl,{})]})}),{url:void 0})}))}))}),document.getElementById("root"))},50992:(e,t,n)=>{n.d(t,{Z:()=>b});var r=n(8081),o=n.n(r),s=n(23645),i=n.n(s),a=n(61667),l=n.n(a),c=new URL(n(70909),n.b),d=new URL(n(133),n.b),p=new URL(n(23601),n.b),h=new URL(n(1686),n.b),u=i()(o()),m=l()(c),g=l()(d),f=l()(p),x=l()(h);u.push([e.id,"/*\n! tailwindcss v3.0.13 | MIT License | https://tailwindcss.com\n*//*\n1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)\n2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)\n*/\n\n*,\n::before,\n::after {\n box-sizing: border-box; /* 1 */\n border-width: 0; /* 2 */\n border-style: solid; /* 2 */\n border-color: #e5e7eb; /* 2 */\n}\n\n::before,\n::after {\n --tw-content: '';\n}\n\n/*\n1. Use a consistent sensible line-height in all browsers.\n2. Prevent adjustments of font size after orientation changes in iOS.\n3. Use a more readable tab size.\n4. Use the user's configured `sans` font-family by default.\n*/\n\nhtml {\n line-height: 1.5; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */\n -moz-tab-size: 4; /* 3 */\n -o-tab-size: 4;\n tab-size: 4; /* 3 */\n font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, \"Noto Sans\", sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"; /* 4 */\n}\n\n/*\n1. Remove the margin in all browsers.\n2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.\n*/\n\nbody {\n margin: 0; /* 1 */\n line-height: inherit; /* 2 */\n}\n\n/*\n1. Add the correct height in Firefox.\n2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)\n3. Ensure horizontal rules are visible by default.\n*/\n\nhr {\n height: 0; /* 1 */\n color: inherit; /* 2 */\n border-top-width: 1px; /* 3 */\n}\n\n/*\nAdd the correct text decoration in Chrome, Edge, and Safari.\n*/\n\nabbr:where([title]) {\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n}\n\n/*\nRemove the default font size and weight for headings.\n*/\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6 {\n font-size: inherit;\n font-weight: inherit;\n}\n\n/*\nReset links to optimize for opt-in styling instead of opt-out.\n*/\n\na {\n color: inherit;\n text-decoration: inherit;\n}\n\n/*\nAdd the correct font weight in Edge and Safari.\n*/\n\nb,\nstrong {\n font-weight: bolder;\n}\n\n/*\n1. Use the user's configured `mono` font family by default.\n2. Correct the odd `em` font sizing in all browsers.\n*/\n\ncode,\nkbd,\nsamp,\npre {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace; /* 1 */\n font-size: 1em; /* 2 */\n}\n\n/*\nAdd the correct font size in all browsers.\n*/\n\nsmall {\n font-size: 80%;\n}\n\n/*\nPrevent `sub` and `sup` elements from affecting the line height in all browsers.\n*/\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsub {\n bottom: -0.25em;\n}\n\nsup {\n top: -0.5em;\n}\n\n/*\n1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)\n2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)\n3. Remove gaps between table borders by default.\n*/\n\ntable {\n text-indent: 0; /* 1 */\n border-color: inherit; /* 2 */\n border-collapse: collapse; /* 3 */\n}\n\n/*\n1. Change the font styles in all browsers.\n2. Remove the margin in Firefox and Safari.\n3. Remove default padding in all browsers.\n*/\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n font-family: inherit; /* 1 */\n font-size: 100%; /* 1 */\n line-height: inherit; /* 1 */\n color: inherit; /* 1 */\n margin: 0; /* 2 */\n padding: 0; /* 3 */\n}\n\n/*\nRemove the inheritance of text transform in Edge and Firefox.\n*/\n\nbutton,\nselect {\n text-transform: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Remove default button styles.\n*/\n\nbutton,\n[type='button'],\n[type='reset'],\n[type='submit'] {\n -webkit-appearance: button; /* 1 */\n background-color: transparent; /* 2 */\n background-image: none; /* 2 */\n}\n\n/*\nUse the modern Firefox focus style for all focusable elements.\n*/\n\n:-moz-focusring {\n outline: auto;\n}\n\n/*\nRemove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)\n*/\n\n:-moz-ui-invalid {\n box-shadow: none;\n}\n\n/*\nAdd the correct vertical alignment in Chrome and Firefox.\n*/\n\nprogress {\n vertical-align: baseline;\n}\n\n/*\nCorrect the cursor style of increment and decrement buttons in Safari.\n*/\n\n::-webkit-inner-spin-button,\n::-webkit-outer-spin-button {\n height: auto;\n}\n\n/*\n1. Correct the odd appearance in Chrome and Safari.\n2. Correct the outline style in Safari.\n*/\n\n[type='search'] {\n -webkit-appearance: textfield; /* 1 */\n outline-offset: -2px; /* 2 */\n}\n\n/*\nRemove the inner padding in Chrome and Safari on macOS.\n*/\n\n::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Change font properties to `inherit` in Safari.\n*/\n\n::-webkit-file-upload-button {\n -webkit-appearance: button; /* 1 */\n font: inherit; /* 2 */\n}\n\n/*\nAdd the correct display in Chrome and Safari.\n*/\n\nsummary {\n display: list-item;\n}\n\n/*\nRemoves the default spacing and border for appropriate elements.\n*/\n\nblockquote,\ndl,\ndd,\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\nhr,\nfigure,\np,\npre {\n margin: 0;\n}\n\nfieldset {\n margin: 0;\n padding: 0;\n}\n\nlegend {\n padding: 0;\n}\n\nol,\nul,\nmenu {\n list-style: none;\n margin: 0;\n padding: 0;\n}\n\n/*\nPrevent resizing textareas horizontally by default.\n*/\n\ntextarea {\n resize: vertical;\n}\n\n/*\n1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)\n2. Set the default placeholder color to the user's configured gray 400 color.\n*/\n\ninput::-moz-placeholder, textarea::-moz-placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\ninput:-ms-input-placeholder, textarea:-ms-input-placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\ninput::placeholder,\ntextarea::placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\n/*\nSet the default cursor for buttons.\n*/\n\nbutton,\n[role=\"button\"] {\n cursor: pointer;\n}\n\n/*\nMake sure disabled buttons don't get the pointer cursor.\n*/\n:disabled {\n cursor: default;\n}\n\n/*\n1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)\n2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)\n This can trigger a poorly considered lint error in some tools but is included by design.\n*/\n\nimg,\nsvg,\nvideo,\ncanvas,\naudio,\niframe,\nembed,\nobject {\n display: block; /* 1 */\n vertical-align: middle; /* 2 */\n}\n\n/*\nConstrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)\n*/\n\nimg,\nvideo {\n max-width: 100%;\n height: auto;\n}\n\n/*\nEnsure the default browser behavior of the `hidden` attribute.\n*/\n\n[hidden] {\n display: none;\n}\n\n[type='text'],[type='email'],[type='url'],[type='password'],[type='number'],[type='date'],[type='datetime-local'],[type='month'],[type='search'],[type='tel'],[type='time'],[type='week'],[multiple],textarea,select {\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n background-color: #fff;\n border-color: #6b7280;\n border-width: 1px;\n border-radius: 0px;\n padding-top: 0.5rem;\n padding-right: 0.75rem;\n padding-bottom: 0.5rem;\n padding-left: 0.75rem;\n font-size: 1rem;\n line-height: 1.5rem;\n --tw-shadow: 0 0 #0000;\n}\n\n[type='text']:focus, [type='email']:focus, [type='url']:focus, [type='password']:focus, [type='number']:focus, [type='date']:focus, [type='datetime-local']:focus, [type='month']:focus, [type='search']:focus, [type='tel']:focus, [type='time']:focus, [type='week']:focus, [multiple]:focus, textarea:focus, select:focus {\n outline: 2px solid transparent;\n outline-offset: 2px;\n --tw-ring-inset: var(--tw-empty,/*!*/ /*!*/);\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: #2563eb;\n --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);\n --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);\n box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n border-color: #2563eb;\n}\n\ninput::-moz-placeholder, textarea::-moz-placeholder {\n color: #6b7280;\n opacity: 1;\n}\n\ninput:-ms-input-placeholder, textarea:-ms-input-placeholder {\n color: #6b7280;\n opacity: 1;\n}\n\ninput::placeholder,textarea::placeholder {\n color: #6b7280;\n opacity: 1;\n}\n\n::-webkit-datetime-edit-fields-wrapper {\n padding: 0;\n}\n\n::-webkit-date-and-time-value {\n min-height: 1.5em;\n}\n\nselect {\n background-image: url("+m+");\n background-position: right 0.5rem center;\n background-repeat: no-repeat;\n background-size: 1.5em 1.5em;\n padding-right: 2.5rem;\n -webkit-print-color-adjust: exact;\n color-adjust: exact;\n}\n\n[multiple] {\n background-image: initial;\n background-position: initial;\n background-repeat: unset;\n background-size: initial;\n padding-right: 0.75rem;\n -webkit-print-color-adjust: unset;\n color-adjust: unset;\n}\n\n[type='checkbox'],[type='radio'] {\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n padding: 0;\n -webkit-print-color-adjust: exact;\n color-adjust: exact;\n display: inline-block;\n vertical-align: middle;\n background-origin: border-box;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n flex-shrink: 0;\n height: 1rem;\n width: 1rem;\n color: #2563eb;\n background-color: #fff;\n border-color: #6b7280;\n border-width: 1px;\n --tw-shadow: 0 0 #0000;\n}\n\n[type='checkbox'] {\n border-radius: 0px;\n}\n\n[type='radio'] {\n border-radius: 100%;\n}\n\n[type='checkbox']:focus,[type='radio']:focus {\n outline: 2px solid transparent;\n outline-offset: 2px;\n --tw-ring-inset: var(--tw-empty,/*!*/ /*!*/);\n --tw-ring-offset-width: 2px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: #2563eb;\n --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);\n --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);\n box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n}\n\n[type='checkbox']:checked,[type='radio']:checked {\n border-color: transparent;\n background-color: currentColor;\n background-size: 100% 100%;\n background-position: center;\n background-repeat: no-repeat;\n}\n\n[type='checkbox']:checked {\n background-image: url("+g+");\n}\n\n[type='radio']:checked {\n background-image: url("+f+");\n}\n\n[type='checkbox']:checked:hover,[type='checkbox']:checked:focus,[type='radio']:checked:hover,[type='radio']:checked:focus {\n border-color: transparent;\n background-color: currentColor;\n}\n\n[type='checkbox']:indeterminate {\n background-image: url("+x+');\n border-color: transparent;\n background-color: currentColor;\n background-size: 100% 100%;\n background-position: center;\n background-repeat: no-repeat;\n}\n\n[type=\'checkbox\']:indeterminate:hover,[type=\'checkbox\']:indeterminate:focus {\n border-color: transparent;\n background-color: currentColor;\n}\n\n[type=\'file\'] {\n background: unset;\n border-color: inherit;\n border-width: 0;\n border-radius: 0;\n padding: 0;\n font-size: unset;\n line-height: inherit;\n}\n\n[type=\'file\']:focus {\n outline: 1px auto -webkit-focus-ring-color;\n}\n\n*, ::before, ::after {\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n}\n.container {\n width: 100%;\n}\n@media (min-width: 640px) {\n\n .container {\n max-width: 640px;\n }\n}\n@media (min-width: 768px) {\n\n .container {\n max-width: 768px;\n }\n}\n@media (min-width: 1024px) {\n\n .container {\n max-width: 1024px;\n }\n}\n@media (min-width: 1280px) {\n\n .container {\n max-width: 1280px;\n }\n}\n@media (min-width: 1536px) {\n\n .container {\n max-width: 1536px;\n }\n}\n.prose {\n color: var(--tw-prose-body);\n max-width: 65ch;\n}\n.prose :where([class~="lead"]):not(:where([class~="not-prose"] *)) {\n color: var(--tw-prose-lead);\n font-size: 1.25em;\n line-height: 1.6;\n margin-top: 1.2em;\n margin-bottom: 1.2em;\n}\n.prose :where(a):not(:where([class~="not-prose"] *)) {\n color: var(--tw-prose-links);\n text-decoration: underline;\n font-weight: 500;\n}\n.prose :where(strong):not(:where([class~="not-prose"] *)) {\n color: var(--tw-prose-bold);\n font-weight: 600;\n}\n.prose :where(ol):not(:where([class~="not-prose"] *)) {\n list-style-type: decimal;\n padding-left: 1.625em;\n}\n.prose :where(ol[type="A"]):not(:where([class~="not-prose"] *)) {\n list-style-type: upper-alpha;\n}\n.prose :where(ol[type="a"]):not(:where([class~="not-prose"] *)) {\n list-style-type: lower-alpha;\n}\n.prose :where(ol[type="A" s]):not(:where([class~="not-prose"] *)) {\n list-style-type: upper-alpha;\n}\n.prose :where(ol[type="a" s]):not(:where([class~="not-prose"] *)) {\n list-style-type: lower-alpha;\n}\n.prose :where(ol[type="I"]):not(:where([class~="not-prose"] *)) {\n list-style-type: upper-roman;\n}\n.prose :where(ol[type="i"]):not(:where([class~="not-prose"] *)) {\n list-style-type: lower-roman;\n}\n.prose :where(ol[type="I" s]):not(:where([class~="not-prose"] *)) {\n list-style-type: upper-roman;\n}\n.prose :where(ol[type="i" s]):not(:where([class~="not-prose"] *)) {\n list-style-type: lower-roman;\n}\n.prose :where(ol[type="1"]):not(:where([class~="not-prose"] *)) {\n list-style-type: decimal;\n}\n.prose :where(ul):not(:where([class~="not-prose"] *)) {\n list-style-type: disc;\n padding-left: 1.625em;\n}\n.prose :where(ol > li):not(:where([class~="not-prose"] *))::marker {\n font-weight: 400;\n color: var(--tw-prose-counters);\n}\n.prose :where(ul > li):not(:where([class~="not-prose"] *))::marker {\n color: var(--tw-prose-bullets);\n}\n.prose :where(hr):not(:where([class~="not-prose"] *)) {\n border-color: var(--tw-prose-hr);\n border-top-width: 1px;\n margin-top: 3em;\n margin-bottom: 3em;\n}\n.prose :where(blockquote):not(:where([class~="not-prose"] *)) {\n font-weight: 500;\n font-style: italic;\n color: var(--tw-prose-quotes);\n border-left-width: 0.25rem;\n border-left-color: var(--tw-prose-quote-borders);\n quotes: "\\201C""\\201D""\\2018""\\2019";\n margin-top: 1.6em;\n margin-bottom: 1.6em;\n padding-left: 1em;\n}\n.prose :where(blockquote p:first-of-type):not(:where([class~="not-prose"] *))::before {\n content: open-quote;\n}\n.prose :where(blockquote p:last-of-type):not(:where([class~="not-prose"] *))::after {\n content: close-quote;\n}\n.prose :where(h1):not(:where([class~="not-prose"] *)) {\n color: var(--tw-prose-headings);\n font-weight: 800;\n font-size: 2.25em;\n margin-top: 0;\n margin-bottom: 0.8888889em;\n line-height: 1.1111111;\n}\n.prose :where(h1 strong):not(:where([class~="not-prose"] *)) {\n font-weight: 900;\n}\n.prose :where(h2):not(:where([class~="not-prose"] *)) {\n color: var(--tw-prose-headings);\n font-weight: 700;\n font-size: 1.5em;\n margin-top: 2em;\n margin-bottom: 1em;\n line-height: 1.3333333;\n}\n.prose :where(h2 strong):not(:where([class~="not-prose"] *)) {\n font-weight: 800;\n}\n.prose :where(h3):not(:where([class~="not-prose"] *)) {\n color: var(--tw-prose-headings);\n font-weight: 600;\n font-size: 1.25em;\n margin-top: 1.6em;\n margin-bottom: 0.6em;\n line-height: 1.6;\n}\n.prose :where(h3 strong):not(:where([class~="not-prose"] *)) {\n font-weight: 700;\n}\n.prose :where(h4):not(:where([class~="not-prose"] *)) {\n color: var(--tw-prose-headings);\n font-weight: 600;\n margin-top: 1.5em;\n margin-bottom: 0.5em;\n line-height: 1.5;\n}\n.prose :where(h4 strong):not(:where([class~="not-prose"] *)) {\n font-weight: 700;\n}\n.prose :where(figure > *):not(:where([class~="not-prose"] *)) {\n margin-top: 0;\n margin-bottom: 0;\n}\n.prose :where(figcaption):not(:where([class~="not-prose"] *)) {\n color: var(--tw-prose-captions);\n font-size: 0.875em;\n line-height: 1.4285714;\n margin-top: 0.8571429em;\n}\n.prose :where(code):not(:where([class~="not-prose"] *)) {\n color: var(--tw-prose-code);\n font-weight: 600;\n font-size: 0.875em;\n}\n.prose :where(code):not(:where([class~="not-prose"] *))::before {\n content: "`";\n}\n.prose :where(code):not(:where([class~="not-prose"] *))::after {\n content: "`";\n}\n.prose :where(a code):not(:where([class~="not-prose"] *)) {\n color: var(--tw-prose-links);\n}\n.prose :where(pre):not(:where([class~="not-prose"] *)) {\n color: var(--tw-prose-pre-code);\n background-color: var(--tw-prose-pre-bg);\n overflow-x: auto;\n font-weight: 400;\n font-size: 0.875em;\n line-height: 1.7142857;\n margin-top: 1.7142857em;\n margin-bottom: 1.7142857em;\n border-radius: 0.375rem;\n padding-top: 0.8571429em;\n padding-right: 1.1428571em;\n padding-bottom: 0.8571429em;\n padding-left: 1.1428571em;\n}\n.prose :where(pre code):not(:where([class~="not-prose"] *)) {\n background-color: transparent;\n border-width: 0;\n border-radius: 0;\n padding: 0;\n font-weight: inherit;\n color: inherit;\n font-size: inherit;\n font-family: inherit;\n line-height: inherit;\n}\n.prose :where(pre code):not(:where([class~="not-prose"] *))::before {\n content: none;\n}\n.prose :where(pre code):not(:where([class~="not-prose"] *))::after {\n content: none;\n}\n.prose :where(table):not(:where([class~="not-prose"] *)) {\n width: 100%;\n table-layout: auto;\n text-align: left;\n margin-top: 2em;\n margin-bottom: 2em;\n font-size: 0.875em;\n line-height: 1.7142857;\n}\n.prose :where(thead):not(:where([class~="not-prose"] *)) {\n border-bottom-width: 1px;\n border-bottom-color: var(--tw-prose-th-borders);\n}\n.prose :where(thead th):not(:where([class~="not-prose"] *)) {\n color: var(--tw-prose-headings);\n font-weight: 600;\n vertical-align: bottom;\n padding-right: 0.5714286em;\n padding-bottom: 0.5714286em;\n padding-left: 0.5714286em;\n}\n.prose :where(tbody tr):not(:where([class~="not-prose"] *)) {\n border-bottom-width: 1px;\n border-bottom-color: var(--tw-prose-td-borders);\n}\n.prose :where(tbody tr:last-child):not(:where([class~="not-prose"] *)) {\n border-bottom-width: 0;\n}\n.prose :where(tbody td):not(:where([class~="not-prose"] *)) {\n vertical-align: baseline;\n padding-top: 0.5714286em;\n padding-right: 0.5714286em;\n padding-bottom: 0.5714286em;\n padding-left: 0.5714286em;\n}\n.prose {\n --tw-prose-body: #374151;\n --tw-prose-headings: #111827;\n --tw-prose-lead: #4b5563;\n --tw-prose-links: #111827;\n --tw-prose-bold: #111827;\n --tw-prose-counters: #6b7280;\n --tw-prose-bullets: #d1d5db;\n --tw-prose-hr: #e5e7eb;\n --tw-prose-quotes: #111827;\n --tw-prose-quote-borders: #e5e7eb;\n --tw-prose-captions: #6b7280;\n --tw-prose-code: #111827;\n --tw-prose-pre-code: #e5e7eb;\n --tw-prose-pre-bg: #1f2937;\n --tw-prose-th-borders: #d1d5db;\n --tw-prose-td-borders: #e5e7eb;\n --tw-prose-invert-body: #d1d5db;\n --tw-prose-invert-headings: #fff;\n --tw-prose-invert-lead: #9ca3af;\n --tw-prose-invert-links: #fff;\n --tw-prose-invert-bold: #fff;\n --tw-prose-invert-counters: #9ca3af;\n --tw-prose-invert-bullets: #4b5563;\n --tw-prose-invert-hr: #374151;\n --tw-prose-invert-quotes: #f3f4f6;\n --tw-prose-invert-quote-borders: #374151;\n --tw-prose-invert-captions: #9ca3af;\n --tw-prose-invert-code: #fff;\n --tw-prose-invert-pre-code: #d1d5db;\n --tw-prose-invert-pre-bg: rgb(0 0 0 / 50%);\n --tw-prose-invert-th-borders: #4b5563;\n --tw-prose-invert-td-borders: #374151;\n font-size: 1rem;\n line-height: 1.75;\n}\n.prose :where(p):not(:where([class~="not-prose"] *)) {\n margin-top: 1.25em;\n margin-bottom: 1.25em;\n}\n.prose :where(img):not(:where([class~="not-prose"] *)) {\n margin-top: 2em;\n margin-bottom: 2em;\n}\n.prose :where(video):not(:where([class~="not-prose"] *)) {\n margin-top: 2em;\n margin-bottom: 2em;\n}\n.prose :where(figure):not(:where([class~="not-prose"] *)) {\n margin-top: 2em;\n margin-bottom: 2em;\n}\n.prose :where(h2 code):not(:where([class~="not-prose"] *)) {\n font-size: 0.875em;\n}\n.prose :where(h3 code):not(:where([class~="not-prose"] *)) {\n font-size: 0.9em;\n}\n.prose :where(li):not(:where([class~="not-prose"] *)) {\n margin-top: 0.5em;\n margin-bottom: 0.5em;\n}\n.prose :where(ol > li):not(:where([class~="not-prose"] *)) {\n padding-left: 0.375em;\n}\n.prose :where(ul > li):not(:where([class~="not-prose"] *)) {\n padding-left: 0.375em;\n}\n.prose > :where(ul > li p):not(:where([class~="not-prose"] *)) {\n margin-top: 0.75em;\n margin-bottom: 0.75em;\n}\n.prose > :where(ul > li > *:first-child):not(:where([class~="not-prose"] *)) {\n margin-top: 1.25em;\n}\n.prose > :where(ul > li > *:last-child):not(:where([class~="not-prose"] *)) {\n margin-bottom: 1.25em;\n}\n.prose > :where(ol > li > *:first-child):not(:where([class~="not-prose"] *)) {\n margin-top: 1.25em;\n}\n.prose > :where(ol > li > *:last-child):not(:where([class~="not-prose"] *)) {\n margin-bottom: 1.25em;\n}\n.prose :where(ul ul, ul ol, ol ul, ol ol):not(:where([class~="not-prose"] *)) {\n margin-top: 0.75em;\n margin-bottom: 0.75em;\n}\n.prose :where(hr + *):not(:where([class~="not-prose"] *)) {\n margin-top: 0;\n}\n.prose :where(h2 + *):not(:where([class~="not-prose"] *)) {\n margin-top: 0;\n}\n.prose :where(h3 + *):not(:where([class~="not-prose"] *)) {\n margin-top: 0;\n}\n.prose :where(h4 + *):not(:where([class~="not-prose"] *)) {\n margin-top: 0;\n}\n.prose :where(thead th:first-child):not(:where([class~="not-prose"] *)) {\n padding-left: 0;\n}\n.prose :where(thead th:last-child):not(:where([class~="not-prose"] *)) {\n padding-right: 0;\n}\n.prose :where(tbody td:first-child):not(:where([class~="not-prose"] *)) {\n padding-left: 0;\n}\n.prose :where(tbody td:last-child):not(:where([class~="not-prose"] *)) {\n padding-right: 0;\n}\n.prose > :where(:first-child):not(:where([class~="not-prose"] *)) {\n margin-top: 0;\n}\n.prose > :where(:last-child):not(:where([class~="not-prose"] *)) {\n margin-bottom: 0;\n}\n.prose-sm {\n font-size: 0.875rem;\n line-height: 1.7142857;\n}\n.prose-sm :where(p):not(:where([class~="not-prose"] *)) {\n margin-top: 1.1428571em;\n margin-bottom: 1.1428571em;\n}\n.prose-sm :where([class~="lead"]):not(:where([class~="not-prose"] *)) {\n font-size: 1.2857143em;\n line-height: 1.5555556;\n margin-top: 0.8888889em;\n margin-bottom: 0.8888889em;\n}\n.prose-sm :where(blockquote):not(:where([class~="not-prose"] *)) {\n margin-top: 1.3333333em;\n margin-bottom: 1.3333333em;\n padding-left: 1.1111111em;\n}\n.prose-sm :where(h1):not(:where([class~="not-prose"] *)) {\n font-size: 2.1428571em;\n margin-top: 0;\n margin-bottom: 0.8em;\n line-height: 1.2;\n}\n.prose-sm :where(h2):not(:where([class~="not-prose"] *)) {\n font-size: 1.4285714em;\n margin-top: 1.6em;\n margin-bottom: 0.8em;\n line-height: 1.4;\n}\n.prose-sm :where(h3):not(:where([class~="not-prose"] *)) {\n font-size: 1.2857143em;\n margin-top: 1.5555556em;\n margin-bottom: 0.4444444em;\n line-height: 1.5555556;\n}\n.prose-sm :where(h4):not(:where([class~="not-prose"] *)) {\n margin-top: 1.4285714em;\n margin-bottom: 0.5714286em;\n line-height: 1.4285714;\n}\n.prose-sm :where(img):not(:where([class~="not-prose"] *)) {\n margin-top: 1.7142857em;\n margin-bottom: 1.7142857em;\n}\n.prose-sm :where(video):not(:where([class~="not-prose"] *)) {\n margin-top: 1.7142857em;\n margin-bottom: 1.7142857em;\n}\n.prose-sm :where(figure):not(:where([class~="not-prose"] *)) {\n margin-top: 1.7142857em;\n margin-bottom: 1.7142857em;\n}\n.prose-sm :where(figure > *):not(:where([class~="not-prose"] *)) {\n margin-top: 0;\n margin-bottom: 0;\n}\n.prose-sm :where(figcaption):not(:where([class~="not-prose"] *)) {\n font-size: 0.8571429em;\n line-height: 1.3333333;\n margin-top: 0.6666667em;\n}\n.prose-sm :where(code):not(:where([class~="not-prose"] *)) {\n font-size: 0.8571429em;\n}\n.prose-sm :where(h2 code):not(:where([class~="not-prose"] *)) {\n font-size: 0.9em;\n}\n.prose-sm :where(h3 code):not(:where([class~="not-prose"] *)) {\n font-size: 0.8888889em;\n}\n.prose-sm :where(pre):not(:where([class~="not-prose"] *)) {\n font-size: 0.8571429em;\n line-height: 1.6666667;\n margin-top: 1.6666667em;\n margin-bottom: 1.6666667em;\n border-radius: 0.25rem;\n padding-top: 0.6666667em;\n padding-right: 1em;\n padding-bottom: 0.6666667em;\n padding-left: 1em;\n}\n.prose-sm :where(ol):not(:where([class~="not-prose"] *)) {\n padding-left: 1.5714286em;\n}\n.prose-sm :where(ul):not(:where([class~="not-prose"] *)) {\n padding-left: 1.5714286em;\n}\n.prose-sm :where(li):not(:where([class~="not-prose"] *)) {\n margin-top: 0.2857143em;\n margin-bottom: 0.2857143em;\n}\n.prose-sm :where(ol > li):not(:where([class~="not-prose"] *)) {\n padding-left: 0.4285714em;\n}\n.prose-sm :where(ul > li):not(:where([class~="not-prose"] *)) {\n padding-left: 0.4285714em;\n}\n.prose-sm > :where(ul > li p):not(:where([class~="not-prose"] *)) {\n margin-top: 0.5714286em;\n margin-bottom: 0.5714286em;\n}\n.prose-sm > :where(ul > li > *:first-child):not(:where([class~="not-prose"] *)) {\n margin-top: 1.1428571em;\n}\n.prose-sm > :where(ul > li > *:last-child):not(:where([class~="not-prose"] *)) {\n margin-bottom: 1.1428571em;\n}\n.prose-sm > :where(ol > li > *:first-child):not(:where([class~="not-prose"] *)) {\n margin-top: 1.1428571em;\n}\n.prose-sm > :where(ol > li > *:last-child):not(:where([class~="not-prose"] *)) {\n margin-bottom: 1.1428571em;\n}\n.prose-sm :where(ul ul, ul ol, ol ul, ol ol):not(:where([class~="not-prose"] *)) {\n margin-top: 0.5714286em;\n margin-bottom: 0.5714286em;\n}\n.prose-sm :where(hr):not(:where([class~="not-prose"] *)) {\n margin-top: 2.8571429em;\n margin-bottom: 2.8571429em;\n}\n.prose-sm :where(hr + *):not(:where([class~="not-prose"] *)) {\n margin-top: 0;\n}\n.prose-sm :where(h2 + *):not(:where([class~="not-prose"] *)) {\n margin-top: 0;\n}\n.prose-sm :where(h3 + *):not(:where([class~="not-prose"] *)) {\n margin-top: 0;\n}\n.prose-sm :where(h4 + *):not(:where([class~="not-prose"] *)) {\n margin-top: 0;\n}\n.prose-sm :where(table):not(:where([class~="not-prose"] *)) {\n font-size: 0.8571429em;\n line-height: 1.5;\n}\n.prose-sm :where(thead th):not(:where([class~="not-prose"] *)) {\n padding-right: 1em;\n padding-bottom: 0.6666667em;\n padding-left: 1em;\n}\n.prose-sm :where(thead th:first-child):not(:where([class~="not-prose"] *)) {\n padding-left: 0;\n}\n.prose-sm :where(thead th:last-child):not(:where([class~="not-prose"] *)) {\n padding-right: 0;\n}\n.prose-sm :where(tbody td):not(:where([class~="not-prose"] *)) {\n padding-top: 0.6666667em;\n padding-right: 1em;\n padding-bottom: 0.6666667em;\n padding-left: 1em;\n}\n.prose-sm :where(tbody td:first-child):not(:where([class~="not-prose"] *)) {\n padding-left: 0;\n}\n.prose-sm :where(tbody td:last-child):not(:where([class~="not-prose"] *)) {\n padding-right: 0;\n}\n.prose-sm > :where(:first-child):not(:where([class~="not-prose"] *)) {\n margin-top: 0;\n}\n.prose-sm > :where(:last-child):not(:where([class~="not-prose"] *)) {\n margin-bottom: 0;\n}\n.sr-only {\n position: absolute !important;\n width: 1px !important;\n height: 1px !important;\n padding: 0 !important;\n margin: -1px !important;\n overflow: hidden !important;\n clip: rect(0, 0, 0, 0) !important;\n white-space: nowrap !important;\n border-width: 0 !important;\n}\n.visible {\n visibility: visible !important;\n}\n.fixed {\n position: fixed !important;\n}\n.absolute {\n position: absolute !important;\n}\n.relative {\n position: relative !important;\n}\n.inset-0 {\n top: 0px !important;\n right: 0px !important;\n bottom: 0px !important;\n left: 0px !important;\n}\n.inset-y-0 {\n top: 0px !important;\n bottom: 0px !important;\n}\n.inset-x-0 {\n left: 0px !important;\n right: 0px !important;\n}\n.top-0 {\n top: 0px !important;\n}\n.right-0 {\n right: 0px !important;\n}\n.left-0 {\n left: 0px !important;\n}\n.bottom-0 {\n bottom: 0px !important;\n}\n.-left-5 {\n left: -1.25rem !important;\n}\n.top-\\[35px\\] {\n top: 35px !important;\n}\n.col-span-3 {\n grid-column: span 3 / span 3 !important;\n}\n.m-2 {\n margin: 0.5rem !important;\n}\n.mx-2 {\n margin-left: 0.5rem !important;\n margin-right: 0.5rem !important;\n}\n.mx-auto {\n margin-left: auto !important;\n margin-right: auto !important;\n}\n.my-2 {\n margin-top: 0.5rem !important;\n margin-bottom: 0.5rem !important;\n}\n.mx-1 {\n margin-left: 0.25rem !important;\n margin-right: 0.25rem !important;\n}\n.mt-0\\.5 {\n margin-top: 0.125rem !important;\n}\n.mt-0 {\n margin-top: 0px !important;\n}\n.ml-6 {\n margin-left: 1.5rem !important;\n}\n.mb-2 {\n margin-bottom: 0.5rem !important;\n}\n.mb-4 {\n margin-bottom: 1rem !important;\n}\n.ml-2 {\n margin-left: 0.5rem !important;\n}\n.mt-3 {\n margin-top: 0.75rem !important;\n}\n.-mt-0\\.5 {\n margin-top: -0.125rem !important;\n}\n.-mt-0 {\n margin-top: -0px !important;\n}\n.block {\n display: block !important;\n}\n.inline-block {\n display: inline-block !important;\n}\n.flex {\n display: flex !important;\n}\n.inline-flex {\n display: inline-flex !important;\n}\n.table {\n display: table !important;\n}\n.grid {\n display: grid !important;\n}\n.contents {\n display: contents !important;\n}\n.hidden {\n display: none !important;\n}\n.h-\\[30px\\] {\n height: 30px !important;\n}\n.h-full {\n height: 100% !important;\n}\n.h-\\[35px\\] {\n height: 35px !important;\n}\n.h-5 {\n height: 1.25rem !important;\n}\n.h-4 {\n height: 1rem !important;\n}\n.min-h-\\[360px\\] {\n min-height: 360px !important;\n}\n.w-full {\n width: 100% !important;\n}\n.w-5 {\n width: 1.25rem !important;\n}\n.w-4 {\n width: 1rem !important;\n}\n.max-w-4xl {\n max-width: 56rem !important;\n}\n.max-w-2xl {\n max-width: 42rem !important;\n}\n.flex-1 {\n flex: 1 1 0% !important;\n}\n.flex-shrink-0 {\n flex-shrink: 0 !important;\n}\n.grow {\n flex-grow: 1 !important;\n}\n.-rotate-90 {\n --tw-rotate: -90deg !important;\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)) !important;\n}\n.rotate-90 {\n --tw-rotate: 90deg !important;\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)) !important;\n}\n.transform {\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)) !important;\n}\n.cursor-pointer {\n cursor: pointer !important;\n}\n.cursor-default {\n cursor: default !important;\n}\n.select-none {\n -webkit-user-select: none !important;\n -moz-user-select: none !important;\n -ms-user-select: none !important;\n user-select: none !important;\n}\n.select-text {\n -webkit-user-select: text !important;\n -moz-user-select: text !important;\n -ms-user-select: text !important;\n user-select: text !important;\n}\n.grid-flow-col {\n grid-auto-flow: column !important;\n}\n.grid-cols-2 {\n grid-template-columns: repeat(2, minmax(0, 1fr)) !important;\n}\n.grid-cols-\\[minmax\\(max-content\\2c auto\\)_repeat\\(2\\2c min-content\\)\\] {\n grid-template-columns: minmax(max-content,auto) repeat(2,min-content) !important;\n}\n.grid-cols-\\[minmax\\(min-content\\2c max-content\\)_minmax\\(max-content\\2c auto\\)_minmax\\(min-content\\2c max-content\\)\\] {\n grid-template-columns: minmax(min-content,max-content) minmax(max-content,auto) minmax(min-content,max-content) !important;\n}\n.grid-cols-\\[minmax\\(max-content\\2c auto\\)_minmax\\(max-content\\2c auto\\)\\] {\n grid-template-columns: minmax(max-content,auto) minmax(max-content,auto) !important;\n}\n.flex-col {\n flex-direction: column !important;\n}\n.flex-wrap {\n flex-wrap: wrap !important;\n}\n.place-content-center {\n place-content: center !important;\n}\n.place-items-center {\n place-items: center !important;\n}\n.content-start {\n align-content: flex-start !important;\n}\n.items-start {\n align-items: flex-start !important;\n}\n.items-center {\n align-items: center !important;\n}\n.justify-end {\n justify-content: flex-end !important;\n}\n.justify-center {\n justify-content: center !important;\n}\n.justify-between {\n justify-content: space-between !important;\n}\n.gap-3 {\n gap: 0.75rem !important;\n}\n.gap-2 {\n gap: 0.5rem !important;\n}\n.gap-1 {\n gap: 0.25rem !important;\n}\n.gap-y-2 {\n row-gap: 0.5rem !important;\n}\n.space-x-2 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-x-reverse: 0 !important;\n margin-right: calc(0.5rem * var(--tw-space-x-reverse)) !important;\n margin-left: calc(0.5rem * calc(1 - var(--tw-space-x-reverse))) !important;\n}\n.space-y-4 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0 !important;\n margin-top: calc(1rem * calc(1 - var(--tw-space-y-reverse))) !important;\n margin-bottom: calc(1rem * var(--tw-space-y-reverse)) !important;\n}\n.space-y-3 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0 !important;\n margin-top: calc(0.75rem * calc(1 - var(--tw-space-y-reverse))) !important;\n margin-bottom: calc(0.75rem * var(--tw-space-y-reverse)) !important;\n}\n.space-y-2 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0 !important;\n margin-top: calc(0.5rem * calc(1 - var(--tw-space-y-reverse))) !important;\n margin-bottom: calc(0.5rem * var(--tw-space-y-reverse)) !important;\n}\n.divide-x > :not([hidden]) ~ :not([hidden]) {\n --tw-divide-x-reverse: 0 !important;\n border-right-width: calc(1px * var(--tw-divide-x-reverse)) !important;\n border-left-width: calc(1px * calc(1 - var(--tw-divide-x-reverse))) !important;\n}\n.divide-dashed > :not([hidden]) ~ :not([hidden]) {\n border-style: dashed !important;\n}\n.overflow-hidden {\n overflow: hidden !important;\n}\n.overflow-y-auto {\n overflow-y: auto !important;\n}\n.truncate {\n overflow: hidden !important;\n text-overflow: ellipsis !important;\n white-space: nowrap !important;\n}\n.whitespace-nowrap {\n white-space: nowrap !important;\n}\n.rounded {\n border-radius: 0.25rem !important;\n}\n.rounded-xl {\n border-radius: 0.75rem !important;\n}\n.rounded-lg {\n border-radius: 0.5rem !important;\n}\n.rounded-full {\n border-radius: 9999px !important;\n}\n.border {\n border-width: 1px !important;\n}\n.border-2 {\n border-width: 2px !important;\n}\n.border-b {\n border-bottom-width: 1px !important;\n}\n.border-t {\n border-top-width: 1px !important;\n}\n.border-dashed {\n border-style: dashed !important;\n}\n.border-red-300 {\n --tw-border-opacity: 1 !important;\n border-color: rgb(252 165 165 / var(--tw-border-opacity)) !important;\n}\n.border-gray-100 {\n --tw-border-opacity: 1 !important;\n border-color: rgb(243 244 246 / var(--tw-border-opacity)) !important;\n}\n.border-purple-200 {\n --tw-border-opacity: 1 !important;\n border-color: rgb(233 213 255 / var(--tw-border-opacity)) !important;\n}\n.border-slate-200 {\n --tw-border-opacity: 1 !important;\n border-color: rgb(226 232 240 / var(--tw-border-opacity)) !important;\n}\n.border-blue-200 {\n --tw-border-opacity: 1 !important;\n border-color: rgb(191 219 254 / var(--tw-border-opacity)) !important;\n}\n.border-red-200 {\n --tw-border-opacity: 1 !important;\n border-color: rgb(254 202 202 / var(--tw-border-opacity)) !important;\n}\n.border-slate-300 {\n --tw-border-opacity: 1 !important;\n border-color: rgb(203 213 225 / var(--tw-border-opacity)) !important;\n}\n.bg-slate-100 {\n --tw-bg-opacity: 1 !important;\n background-color: rgb(241 245 249 / var(--tw-bg-opacity)) !important;\n}\n.bg-white {\n --tw-bg-opacity: 1 !important;\n background-color: rgb(255 255 255 / var(--tw-bg-opacity)) !important;\n}\n.bg-red-100 {\n --tw-bg-opacity: 1 !important;\n background-color: rgb(254 226 226 / var(--tw-bg-opacity)) !important;\n}\n.bg-purple-50 {\n --tw-bg-opacity: 1 !important;\n background-color: rgb(250 245 255 / var(--tw-bg-opacity)) !important;\n}\n.bg-gray-50 {\n --tw-bg-opacity: 1 !important;\n background-color: rgb(249 250 251 / var(--tw-bg-opacity)) !important;\n}\n.bg-slate-50\\/90 {\n background-color: rgb(248 250 252 / 0.9) !important;\n}\n.bg-white\\/80 {\n background-color: rgb(255 255 255 / 0.8) !important;\n}\n.bg-slate-50 {\n --tw-bg-opacity: 1 !important;\n background-color: rgb(248 250 252 / var(--tw-bg-opacity)) !important;\n}\n.bg-fuchsia-100 {\n --tw-bg-opacity: 1 !important;\n background-color: rgb(250 232 255 / var(--tw-bg-opacity)) !important;\n}\n.bg-purple-100 {\n --tw-bg-opacity: 1 !important;\n background-color: rgb(243 232 255 / var(--tw-bg-opacity)) !important;\n}\n.bg-blue-50 {\n --tw-bg-opacity: 1 !important;\n background-color: rgb(239 246 255 / var(--tw-bg-opacity)) !important;\n}\n.bg-red-50 {\n --tw-bg-opacity: 1 !important;\n background-color: rgb(254 242 242 / var(--tw-bg-opacity)) !important;\n}\n.bg-white\\/90 {\n background-color: rgb(255 255 255 / 0.9) !important;\n}\n.bg-indigo-600 {\n --tw-bg-opacity: 1 !important;\n background-color: rgb(79 70 229 / var(--tw-bg-opacity)) !important;\n}\n.bg-blue-600 {\n --tw-bg-opacity: 1 !important;\n background-color: rgb(37 99 235 / var(--tw-bg-opacity)) !important;\n}\n.bg-opacity-75 {\n --tw-bg-opacity: 0.75 !important;\n}\n.bg-gradient-to-r {\n background-image: linear-gradient(to right, var(--tw-gradient-stops)) !important;\n}\n.from-fuchsia-600 {\n --tw-gradient-from: #c026d3 !important;\n --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgb(192 38 211 / 0)) !important;\n}\n.from-purple-600 {\n --tw-gradient-from: #9333ea !important;\n --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgb(147 51 234 / 0)) !important;\n}\n.to-purple-600 {\n --tw-gradient-to: #9333ea !important;\n}\n.to-indigo-600 {\n --tw-gradient-to: #4f46e5 !important;\n}\n.p-4 {\n padding: 1rem !important;\n}\n.p-2 {\n padding: 0.5rem !important;\n}\n.p-8 {\n padding: 2rem !important;\n}\n.p-6 {\n padding: 1.5rem !important;\n}\n.p-3 {\n padding: 0.75rem !important;\n}\n.p-1 {\n padding: 0.25rem !important;\n}\n.px-2 {\n padding-left: 0.5rem !important;\n padding-right: 0.5rem !important;\n}\n.py-1 {\n padding-top: 0.25rem !important;\n padding-bottom: 0.25rem !important;\n}\n.py-0\\.5 {\n padding-top: 0.125rem !important;\n padding-bottom: 0.125rem !important;\n}\n.py-0 {\n padding-top: 0px !important;\n padding-bottom: 0px !important;\n}\n.py-2 {\n padding-top: 0.5rem !important;\n padding-bottom: 0.5rem !important;\n}\n.px-4 {\n padding-left: 1rem !important;\n padding-right: 1rem !important;\n}\n.py-3 {\n padding-top: 0.75rem !important;\n padding-bottom: 0.75rem !important;\n}\n.py-2\\.5 {\n padding-top: 0.625rem !important;\n padding-bottom: 0.625rem !important;\n}\n.px-1 {\n padding-left: 0.25rem !important;\n padding-right: 0.25rem !important;\n}\n.px-3 {\n padding-left: 0.75rem !important;\n padding-right: 0.75rem !important;\n}\n.pl-2 {\n padding-left: 0.5rem !important;\n}\n.pl-9 {\n padding-left: 2.25rem !important;\n}\n.pr-3 {\n padding-right: 0.75rem !important;\n}\n.pt-2 {\n padding-top: 0.5rem !important;\n}\n.pb-3 {\n padding-bottom: 0.75rem !important;\n}\n.text-center {\n text-align: center !important;\n}\n.align-middle {\n vertical-align: middle !important;\n}\n.font-mono {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !important;\n}\n.text-xs {\n font-size: 0.75rem !important;\n line-height: 1rem !important;\n}\n.text-sm {\n font-size: 0.875rem !important;\n line-height: 1.25rem !important;\n}\n.text-lg {\n font-size: 1.125rem !important;\n line-height: 1.75rem !important;\n}\n.font-semibold {\n font-weight: 600 !important;\n}\n.font-medium {\n font-weight: 500 !important;\n}\n.font-bold {\n font-weight: 700 !important;\n}\n.uppercase {\n text-transform: uppercase !important;\n}\n.leading-relaxed {\n line-height: 1.625 !important;\n}\n.text-gray-400 {\n --tw-text-opacity: 1 !important;\n color: rgb(156 163 175 / var(--tw-text-opacity)) !important;\n}\n.text-gray-600 {\n --tw-text-opacity: 1 !important;\n color: rgb(75 85 99 / var(--tw-text-opacity)) !important;\n}\n.text-red-700 {\n --tw-text-opacity: 1 !important;\n color: rgb(185 28 28 / var(--tw-text-opacity)) !important;\n}\n.text-gray-700 {\n --tw-text-opacity: 1 !important;\n color: rgb(55 65 81 / var(--tw-text-opacity)) !important;\n}\n.text-slate-300 {\n --tw-text-opacity: 1 !important;\n color: rgb(203 213 225 / var(--tw-text-opacity)) !important;\n}\n.text-slate-500 {\n --tw-text-opacity: 1 !important;\n color: rgb(100 116 139 / var(--tw-text-opacity)) !important;\n}\n.text-slate-900 {\n --tw-text-opacity: 1 !important;\n color: rgb(15 23 42 / var(--tw-text-opacity)) !important;\n}\n.text-fuchsia-600 {\n --tw-text-opacity: 1 !important;\n color: rgb(192 38 211 / var(--tw-text-opacity)) !important;\n}\n.text-slate-800 {\n --tw-text-opacity: 1 !important;\n color: rgb(30 41 59 / var(--tw-text-opacity)) !important;\n}\n.text-slate-600 {\n --tw-text-opacity: 1 !important;\n color: rgb(71 85 105 / var(--tw-text-opacity)) !important;\n}\n.text-slate-700 {\n --tw-text-opacity: 1 !important;\n color: rgb(51 65 85 / var(--tw-text-opacity)) !important;\n}\n.text-purple-600 {\n --tw-text-opacity: 1 !important;\n color: rgb(147 51 234 / var(--tw-text-opacity)) !important;\n}\n.text-white {\n --tw-text-opacity: 1 !important;\n color: rgb(255 255 255 / var(--tw-text-opacity)) !important;\n}\n.opacity-0 {\n opacity: 0 !important;\n}\n.shadow {\n --tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1) !important;\n --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color) !important;\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow) !important;\n}\n.shadow-sm {\n --tw-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05) !important;\n --tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color) !important;\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow) !important;\n}\n.shadow-md {\n --tw-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1) !important;\n --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color) !important;\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow) !important;\n}\n.outline {\n outline-style: solid !important;\n}\n.blur {\n --tw-blur: blur(8px) !important;\n filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow) !important;\n}\n.filter {\n filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow) !important;\n}\n.backdrop-blur {\n --tw-backdrop-blur: blur(8px) !important;\n backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia) !important;\n}\n.transition-colors {\n transition-property: color, background-color, border-color, fill, stroke, -webkit-text-decoration-color !important;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke !important;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, -webkit-text-decoration-color !important;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1) !important;\n transition-duration: 150ms !important;\n}\n.transition {\n transition-property: color, background-color, border-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-text-decoration-color !important;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter !important;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-text-decoration-color !important;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1) !important;\n transition-duration: 150ms !important;\n}\n.placeholder\\:text-xs::-moz-placeholder {\n font-size: 0.75rem !important;\n line-height: 1rem !important;\n}\n.placeholder\\:text-xs:-ms-input-placeholder {\n font-size: 0.75rem !important;\n line-height: 1rem !important;\n}\n.placeholder\\:text-xs::placeholder {\n font-size: 0.75rem !important;\n line-height: 1rem !important;\n}\n.placeholder\\:italic::-moz-placeholder {\n font-style: italic !important;\n}\n.placeholder\\:italic:-ms-input-placeholder {\n font-style: italic !important;\n}\n.placeholder\\:italic::placeholder {\n font-style: italic !important;\n}\n.placeholder\\:text-gray-400::-moz-placeholder {\n --tw-text-opacity: 1 !important;\n color: rgb(156 163 175 / var(--tw-text-opacity)) !important;\n}\n.placeholder\\:text-gray-400:-ms-input-placeholder {\n --tw-text-opacity: 1 !important;\n color: rgb(156 163 175 / var(--tw-text-opacity)) !important;\n}\n.placeholder\\:text-gray-400::placeholder {\n --tw-text-opacity: 1 !important;\n color: rgb(156 163 175 / var(--tw-text-opacity)) !important;\n}\n.first\\:pl-2:first-child {\n padding-left: 0.5rem !important;\n}\n.last\\:pr-2:last-child {\n padding-right: 0.5rem !important;\n}\n.focus-within\\:border-indigo-500:focus-within {\n --tw-border-opacity: 1 !important;\n border-color: rgb(99 102 241 / var(--tw-border-opacity)) !important;\n}\n.focus-within\\:ring-2:focus-within {\n --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color) !important;\n --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color) !important;\n box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000) !important;\n}\n.focus-within\\:ring-indigo-200:focus-within {\n --tw-ring-opacity: 1 !important;\n --tw-ring-color: rgb(199 210 254 / var(--tw-ring-opacity)) !important;\n}\n.hover\\:border-indigo-400:hover {\n --tw-border-opacity: 1 !important;\n border-color: rgb(129 140 248 / var(--tw-border-opacity)) !important;\n}\n.hover\\:bg-indigo-500:hover {\n --tw-bg-opacity: 1 !important;\n background-color: rgb(99 102 241 / var(--tw-bg-opacity)) !important;\n}\n.hover\\:from-fuchsia-500:hover {\n --tw-gradient-from: #d946ef !important;\n --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgb(217 70 239 / 0)) !important;\n}\n.hover\\:from-purple-500:hover {\n --tw-gradient-from: #a855f7 !important;\n --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgb(168 85 247 / 0)) !important;\n}\n.hover\\:to-purple-500:hover {\n --tw-gradient-to: #a855f7 !important;\n}\n.hover\\:to-indigo-500:hover {\n --tw-gradient-to: #6366f1 !important;\n}\n.hover\\:text-white:hover {\n --tw-text-opacity: 1 !important;\n color: rgb(255 255 255 / var(--tw-text-opacity)) !important;\n}\n.hover\\:text-indigo-600:hover {\n --tw-text-opacity: 1 !important;\n color: rgb(79 70 229 / var(--tw-text-opacity)) !important;\n}\n.hover\\:text-slate-400:hover {\n --tw-text-opacity: 1 !important;\n color: rgb(148 163 184 / var(--tw-text-opacity)) !important;\n}\n.hover\\:text-black:hover {\n --tw-text-opacity: 1 !important;\n color: rgb(0 0 0 / var(--tw-text-opacity)) !important;\n}\n.focus\\:border-gray-200:focus {\n --tw-border-opacity: 1 !important;\n border-color: rgb(229 231 235 / var(--tw-border-opacity)) !important;\n}\n.focus\\:outline-none:focus {\n outline: 2px solid transparent !important;\n outline-offset: 2px !important;\n}\n.focus-visible\\:outline-none:focus-visible {\n outline: 2px solid transparent !important;\n outline-offset: 2px !important;\n}\n.focus-visible\\:ring-2:focus-visible {\n --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color) !important;\n --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color) !important;\n box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000) !important;\n}\n.focus-visible\\:ring-fuchsia-500:focus-visible {\n --tw-ring-opacity: 1 !important;\n --tw-ring-color: rgb(217 70 239 / var(--tw-ring-opacity)) !important;\n}\n.focus-visible\\:ring-purple-500:focus-visible {\n --tw-ring-opacity: 1 !important;\n --tw-ring-color: rgb(168 85 247 / var(--tw-ring-opacity)) !important;\n}\n.focus-visible\\:ring-indigo-500:focus-visible {\n --tw-ring-opacity: 1 !important;\n --tw-ring-color: rgb(99 102 241 / var(--tw-ring-opacity)) !important;\n}\n.focus-visible\\:ring-offset-2:focus-visible {\n --tw-ring-offset-width: 2px !important;\n}\n.focus-visible\\:ring-offset-white:focus-visible {\n --tw-ring-offset-color: #fff !important;\n}\n.active\\:text-slate-800:active {\n --tw-text-opacity: 1 !important;\n color: rgb(30 41 59 / var(--tw-text-opacity)) !important;\n}\n.group:hover .group-hover\\:cursor-pointer {\n cursor: pointer !important;\n}\n.group:hover .group-hover\\:bg-slate-100 {\n --tw-bg-opacity: 1 !important;\n background-color: rgb(241 245 249 / var(--tw-bg-opacity)) !important;\n}\n.group:hover .group-hover\\:bg-blue-600 {\n --tw-bg-opacity: 1 !important;\n background-color: rgb(37 99 235 / var(--tw-bg-opacity)) !important;\n}\n.group:hover .group-hover\\:text-white {\n --tw-text-opacity: 1 !important;\n color: rgb(255 255 255 / var(--tw-text-opacity)) !important;\n}\n.group:active .group-active\\:bg-blue-700 {\n --tw-bg-opacity: 1 !important;\n background-color: rgb(29 78 216 / var(--tw-bg-opacity)) !important;\n}\n@media (min-width: 640px) {\n\n .sm\\:grid-cols-2 {\n grid-template-columns: repeat(2, minmax(0, 1fr)) !important;\n }\n}',""]);const b=u},94748:e=>{e.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuMTZEaa/1AAAAHUlEQVQYV2PYvXu3JAi7uLiAMaYAjAGTQBPYLQkAa/0Zef3qRswAAAAASUVORK5CYII="},4768:e=>{e.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAAL0lEQVQoz2NgCD3x//9/BhBYBWdhgFVAiVW4JBFKGIa4AqD0//9D3pt4I4tAdAMAHTQ/j5Zom30AAAAASUVORK5CYII="},35555:e=>{e.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAQAAADZc7J/AAAAz0lEQVRIx2NgYGBY/R8I/vx5eelX3n82IJ9FxGf6tksvf/8FiTMQAcAGQMDvSwu09abffY8QYSAScNk45G198eX//yev73/4///701eh//kZSARckrNBRvz//+8+6ZohwCzjGNjdgQxkAg7B9WADeBjIBqtJCbhRA0YNoIkBSNmaPEMoNmA0FkYNoFKhapJ6FGyAH3nauaSmPfwI0v/3OukVi0CIZ+F25KrtYcx/CTIy0e+rC7R1Z4KMICVTQQ14feVXIbR695u14+Ir4gwAAD49E54wc1kWAAAAAElFTkSuQmCC"},23601:e=>{e.exports="data:image/svg+xml,%3csvg viewBox=%270 0 16 16%27 fill=%27white%27 xmlns=%27http://www.w3.org/2000/svg%27%3e%3ccircle cx=%278%27 cy=%278%27 r=%273%27/%3e%3c/svg%3e"},133:e=>{e.exports="data:image/svg+xml,%3csvg viewBox=%270 0 16 16%27 fill=%27white%27 xmlns=%27http://www.w3.org/2000/svg%27%3e%3cpath d=%27M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z%27/%3e%3c/svg%3e"},1686:e=>{e.exports="data:image/svg+xml,%3csvg xmlns=%27http://www.w3.org/2000/svg%27 fill=%27none%27 viewBox=%270 0 16 16%27%3e%3cpath stroke=%27white%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27 stroke-width=%272%27 d=%27M4 8h8%27/%3e%3c/svg%3e"},70909:e=>{e.exports="data:image/svg+xml,%3csvg xmlns=%27http://www.w3.org/2000/svg%27 fill=%27none%27 viewBox=%270 0 20 20%27%3e%3cpath stroke=%27%236b7280%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27 stroke-width=%271.5%27 d=%27M6 8l4 4 4-4%27/%3e%3c/svg%3e"},6161:e=>{e.exports="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTMiIGhlaWdodD0iMzYiIHZpZXdCb3g9IjAgMCA1MyAzNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgY2xpcC1wYXRoPSJ1cmwoI2NsaXAwKSI+CjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNNDguMDM2NCA0LjAxMDQySDQuMDA3NzlMNC4wMDc3OSAzMi4wMjg2SDQ4LjAzNjRWNC4wMTA0MlpNNC4wMDc3OSAwLjAwNzgxMjVDMS43OTcyMSAwLjAwNzgxMjUgMC4wMDUxODc5OSAxLjc5OTg0IDAuMDA1MTg3OTkgNC4wMTA0MlYzMi4wMjg2QzAuMDA1MTg3OTkgMzQuMjM5MiAxLjc5NzIxIDM2LjAzMTIgNC4wMDc3OSAzNi4wMzEySDQ4LjAzNjRDNTAuMjQ3IDM2LjAzMTIgNTIuMDM5IDM0LjIzOTIgNTIuMDM5IDMyLjAyODZWNC4wMTA0MkM1Mi4wMzkgMS43OTk4NCA1MC4yNDcgMC4wMDc4MTI1IDQ4LjAzNjQgMC4wMDc4MTI1SDQuMDA3NzlaTTguMDEwNDIgOC4wMTMwMkgxMi4wMTNWMTIuMDE1Nkg4LjAxMDQyVjguMDEzMDJaTTIwLjAxODIgOC4wMTMwMkgxNi4wMTU2VjEyLjAxNTZIMjAuMDE4MlY4LjAxMzAyWk0yNC4wMjA4IDguMDEzMDJIMjguMDIzNFYxMi4wMTU2SDI0LjAyMDhWOC4wMTMwMlpNMzYuMDI4NiA4LjAxMzAySDMyLjAyNlYxMi4wMTU2SDM2LjAyODZWOC4wMTMwMlpNNDAuMDMxMiA4LjAxMzAySDQ0LjAzMzlWMTIuMDE1Nkg0MC4wMzEyVjguMDEzMDJaTTE2LjAxNTYgMTYuMDE4Mkg4LjAxMDQyVjIwLjAyMDhIMTYuMDE1NlYxNi4wMTgyWk0yMC4wMTgyIDE2LjAxODJIMjQuMDIwOFYyMC4wMjA4SDIwLjAxODJWMTYuMDE4MlpNMzIuMDI2IDE2LjAxODJIMjguMDIzNFYyMC4wMjA4SDMyLjAyNlYxNi4wMTgyWk00NC4wMzM5IDE2LjAxODJWMjAuMDIwOEgzNi4wMjg2VjE2LjAxODJINDQuMDMzOVpNMTIuMDEzIDI0LjAyMzRIOC4wMTA0MlYyOC4wMjZIMTIuMDEzVjI0LjAyMzRaTTE2LjAxNTYgMjQuMDIzNEgzNi4wMjg2VjI4LjAyNkgxNi4wMTU2VjI0LjAyMzRaTTQ0LjAzMzkgMjQuMDIzNEg0MC4wMzEyVjI4LjAyNkg0NC4wMzM5VjI0LjAyMzRaIiBmaWxsPSIjNDI0MjQyIi8+CjwvZz4KPGRlZnM+CjxjbGlwUGF0aCBpZD0iY2xpcDAiPgo8cmVjdCB3aWR0aD0iNTMiIGhlaWdodD0iMzYiIGZpbGw9IndoaXRlIi8+CjwvY2xpcFBhdGg+CjwvZGVmcz4KPC9zdmc+Cg=="},51096:e=>{e.exports="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTMiIGhlaWdodD0iMzYiIHZpZXdCb3g9IjAgMCA1MyAzNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgY2xpcC1wYXRoPSJ1cmwoI2NsaXAwKSI+CjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNNDguMDM2NCA0LjAxMDQySDQuMDA3NzlMNC4wMDc3OSAzMi4wMjg2SDQ4LjAzNjRWNC4wMTA0MlpNNC4wMDc3OSAwLjAwNzgxMjVDMS43OTcyMSAwLjAwNzgxMjUgMC4wMDUxODc5OSAxLjc5OTg0IDAuMDA1MTg3OTkgNC4wMTA0MlYzMi4wMjg2QzAuMDA1MTg3OTkgMzQuMjM5MiAxLjc5NzIxIDM2LjAzMTIgNC4wMDc3OSAzNi4wMzEySDQ4LjAzNjRDNTAuMjQ3IDM2LjAzMTIgNTIuMDM5IDM0LjIzOTIgNTIuMDM5IDMyLjAyODZWNC4wMTA0MkM1Mi4wMzkgMS43OTk4NCA1MC4yNDcgMC4wMDc4MTI1IDQ4LjAzNjQgMC4wMDc4MTI1SDQuMDA3NzlaTTguMDEwNDIgOC4wMTMwMkgxMi4wMTNWMTIuMDE1Nkg4LjAxMDQyVjguMDEzMDJaTTIwLjAxODIgOC4wMTMwMkgxNi4wMTU2VjEyLjAxNTZIMjAuMDE4MlY4LjAxMzAyWk0yNC4wMjA4IDguMDEzMDJIMjguMDIzNFYxMi4wMTU2SDI0LjAyMDhWOC4wMTMwMlpNMzYuMDI4NiA4LjAxMzAySDMyLjAyNlYxMi4wMTU2SDM2LjAyODZWOC4wMTMwMlpNNDAuMDMxMiA4LjAxMzAySDQ0LjAzMzlWMTIuMDE1Nkg0MC4wMzEyVjguMDEzMDJaTTE2LjAxNTYgMTYuMDE4Mkg4LjAxMDQyVjIwLjAyMDhIMTYuMDE1NlYxNi4wMTgyWk0yMC4wMTgyIDE2LjAxODJIMjQuMDIwOFYyMC4wMjA4SDIwLjAxODJWMTYuMDE4MlpNMzIuMDI2IDE2LjAxODJIMjguMDIzNFYyMC4wMjA4SDMyLjAyNlYxNi4wMTgyWk00NC4wMzM5IDE2LjAxODJWMjAuMDIwOEgzNi4wMjg2VjE2LjAxODJINDQuMDMzOVpNMTIuMDEzIDI0LjAyMzRIOC4wMTA0MlYyOC4wMjZIMTIuMDEzVjI0LjAyMzRaTTE2LjAxNTYgMjQuMDIzNEgzNi4wMjg2VjI4LjAyNkgxNi4wMTU2VjI0LjAyMzRaTTQ0LjAzMzkgMjQuMDIzNEg0MC4wMzEyVjI4LjAyNkg0NC4wMzM5VjI0LjAyMzRaIiBmaWxsPSIjQzVDNUM1Ii8+CjwvZz4KPGRlZnM+CjxjbGlwUGF0aCBpZD0iY2xpcDAiPgo8cmVjdCB3aWR0aD0iNTMiIGhlaWdodD0iMzYiIGZpbGw9IndoaXRlIi8+CjwvY2xpcFBhdGg+CjwvZGVmcz4KPC9zdmc+Cg=="}},o={};function s(e){var t=o[e];if(void 0!==t)return t.exports;var n=o[e]={id:e,loaded:!1,exports:{}};return r[e](n,n.exports,s),n.loaded=!0,n.exports}s.m=r,s.amdO={},e=[],s.O=(t,n,r,o)=>{if(!n){var i=1/0;for(d=0;d=o)&&Object.keys(s.O).every((e=>s.O[e](n[l])))?n.splice(l--,1):(a=!1,o0&&e[d-1][2]>o;d--)e[d]=e[d-1];e[d]=[n,r,o]},s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.f={},s.e=e=>Promise.all(Object.keys(s.f).reduce(((t,n)=>(s.f[n](e,t),t)),[])),s.u=e=>e+".bundle.js",s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.hmd=e=>((e=Object.create(e)).children||(e.children=[]),Object.defineProperty(e,"exports",{enumerable:!0,set:()=>{throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+e.id)}}),e),s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),t={},n="sterling-layout:",s.l=(e,r,o,i)=>{if(t[e])t[e].push(r);else{var a,l;if(void 0!==o)for(var c=document.getElementsByTagName("script"),d=0;d{a.onerror=a.onload=null,clearTimeout(u);var o=t[e];if(delete t[e],a.parentNode&&a.parentNode.removeChild(a),o&&o.forEach((e=>e(r))),n)return n(r)},u=setTimeout(h.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=h.bind(null,a.onerror),a.onload=h.bind(null,a.onload),l&&document.head.appendChild(a)}},s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),s.p="./",(()=>{s.b=document.baseURI||self.location.href;var e={179:0};s.f.j=(t,n)=>{var r=s.o(e,t)?e[t]:void 0;if(0!==r)if(r)n.push(r[2]);else{var o=new Promise(((n,o)=>r=e[t]=[n,o]));n.push(r[2]=o);var i=s.p+s.u(t),a=new Error;s.l(i,(n=>{if(s.o(e,t)&&(0!==(r=e[t])&&(e[t]=void 0),r)){var o=n&&("load"===n.type?"missing":n.type),i=n&&n.target&&n.target.src;a.message="Loading chunk "+t+" failed.\n("+o+": "+i+")",a.name="ChunkLoadError",a.type=o,a.request=i,r[1](a)}}),"chunk-"+t,t)}},s.O.j=t=>0===e[t];var t=(t,n)=>{var r,o,[i,a,l]=n,c=0;if(i.some((t=>0!==e[t]))){for(r in a)s.o(a,r)&&(s.m[r]=a[r]);if(l)var d=l(s)}for(t&&t(n);cs(50004)));i=s.O(i)})(); \ No newline at end of file +(()=>{"use strict";var e,t,n,r={67403:(e,t,n)=>{var r=n(85893),o=(n(54848),n(49203),n(31906),n(67294)),s=n(73935),i=n(39704),a=n(57247),l=n(105),c=n(68527),d=n(78654),p=n(35173);const u=()=>{const e=(0,l.mq)("DragBar");return(0,r.jsx)(c.xu,{__css:e})},h=()=>{const e=(0,l.mq)("DragHandle");return(0,r.jsx)(c.xu,Object.assign({className:"drag-handle",__css:e},{children:(0,r.jsx)(u,{})}))},m=e=>{const{children:t,rightPaneCollapsed:n,rightPaneInitialWidth:s,rightPaneMinWidth:i,rightPaneMaxWidth:a}=e,u=(0,o.useRef)(null),m=(0,l.mq)("Dashboard"),[g,f]=(0,o.useState)(0),[b,y]=(0,o.useState)(!1),[w,v]=(0,o.useState)(s),j=(0,o.useMemo)((()=>n?0:w),[n,w]),S=(0,o.useMemo)((()=>n?-w:0),[n,w]),A=(0,o.useMemo)((()=>x(void 0,0,j,b)),[0,j,!1,b]),C=(0,o.useMemo)((()=>x(w,void 0,S,b)),[w,S,b]),M=(0,o.useMemo)((()=>x(void 0,void 0,S+w,b)),[S,w,b]),I=(0,o.useCallback)(((e,t)=>{const n=t.target.getBoundingClientRect(),r=t.clientX-n.left;"right"===e&&(f(r),y(!0))}),[y]),O=(0,o.useCallback)((0,d.Z)((e=>{var t;if(b){const n=u.current;if(n){null===(t=window.getSelection())||void 0===t||t.empty();const r=n.getBoundingClientRect().width-e.clientX+g-5;v((0,p.Z)(r,i,a))}}}),16),[g,b,i,a]),k=(0,o.useCallback)((()=>{y(!1)}),[y]);(0,o.useEffect)((()=>(document.addEventListener("mousemove",O),document.addEventListener("mouseup",k),()=>{document.removeEventListener("mousemove",O),document.removeEventListener("mouseup",k)})),[O,k]);const N=o.Children.toArray(t).filter((e=>e));return 2===N.length?(0,r.jsxs)(c.xu,Object.assign({ref:u,__css:m},{children:[(0,r.jsx)("div",Object.assign({style:A},{children:N[0]})),(0,r.jsx)("div",Object.assign({style:C},{children:N[1]})),(0,r.jsx)("div",Object.assign({style:M,onMouseDown:e=>I("right",e)},{children:(0,r.jsx)(h,{})}))]})):null},g={baseStyle:{position:"fixed",top:"56px",right:"64px",bottom:"36px",left:"0"}};function x(e,t,n,r){const o={position:"absolute",top:"0",bottom:"0",transition:r?void 0:"all 200ms cubic-bezier(0.85, 0, 0.15, 1)"};return void 0!==e&&(o.width=`${e}px`),void 0!==t&&(o.left=`${t}px`),void 0!==n&&(o.right=`${n}px`),o}const f=(0,l.Gp)(((e,t)=>{const n=(0,l.mq)("Pane");return(0,r.jsx)(c.xu,Object.assign({__css:n,ref:t},e))})),b=e=>{const t=(0,l.mq)("LogList",e);return(0,r.jsx)(c.rj,Object.assign({__css:t},e))};const y=e=>{const{variant:t}=e,n=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o{const t=(0,l.mq)("Logo");return(0,r.jsx)(c.M5,Object.assign({__css:t},e,{children:"Spytial Sterling"}))},v=e=>{const t=(0,l.mq)("NavBar");return(0,r.jsx)(c.kC,Object.assign({__css:t},e))},j={baseStyle:{h:"56px",position:"fixed",top:0,left:0,right:0,display:"flex",alignItems:"center",gap:3,px:4,bg:"rgba(11, 17, 32, 0.92)",backgroundImage:"linear-gradient(120deg, #0f172a 0%, #111827 45%, #0b1224 100%)",color:"gray.100",borderBottom:"1px solid",borderColor:"whiteAlpha.200",boxShadow:"0 12px 40px rgba(15, 23, 42, 0.45)",backdropFilter:"saturate(180%) blur(12px)",zIndex:"banner"}};var S=n(68921);const A=e=>{const t=(0,l.mq)("NavButton");return(0,r.jsx)(S.zx,Object.assign({__css:t},e))},C=e=>{const t=(0,l.mq)("PaneBody");return(0,r.jsx)(c.xu,Object.assign({__css:t},e))},M={baseStyle:{position:"absolute",top:"56px",right:0,bottom:0,left:0,bg:"#f8fafc"}},I=e=>{const t=(0,l.mq)("PaneHeader");return(0,r.jsx)(c.xu,Object.assign({__css:t},e))},O={baseStyle:{position:"absolute",top:0,left:0,right:0,height:"56px",display:"flex",alignItems:"center",gap:"0.75rem",px:3,bg:"rgba(255, 255, 255, 0.92)",backgroundImage:"linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(248,250,252,0.9) 100%)",borderBottom:"1px solid",borderColor:"gray.200",boxShadow:"0 8px 30px rgba(15, 23, 42, 0.08)",backdropFilter:"saturate(180%) blur(6px)",zIndex:"banner"}},k=e=>{const t=(0,l.mq)("PaneTitle");return(0,r.jsx)(c.M5,Object.assign({__css:t},e))},N=e=>{const t=(0,l.mq)("SideBar");return(0,r.jsx)(c.kC,Object.assign({__css:Object.assign(Object.assign({},t),{overflowY:"auto"})},e))},D={baseStyle:{w:"64px",position:"fixed",top:"56px",right:0,bottom:"36px",display:"flex",flexDir:"column",alignItems:"stretch",fontSize:"xs",gap:"6px",px:2,py:3,borderLeft:"1px solid",borderColor:"whiteAlpha.200",bg:"rgba(11, 17, 32, 0.88)",backdropFilter:"saturate(180%) blur(12px)",boxShadow:"-12px 0 30px rgba(15, 23, 42, 0.35)",color:"gray.100",zIndex:"banner"}};const z=e=>{const{text:t}=e,n=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o{const t=(0,l.mq)("StatusBar");return(0,r.jsx)(c.kC,Object.assign({__css:t},e))},_={baseStyle:{h:"36px",position:"fixed",right:0,bottom:0,left:0,display:"flex",alignItems:"center",px:4,gap:3,fontSize:"sm",borderTop:"1px solid",borderColor:"whiteAlpha.200",bg:"rgba(12, 17, 30, 0.9)",color:"gray.100",backdropFilter:"saturate(180%) blur(10px)",boxShadow:"0 -8px 30px rgba(15, 23, 42, 0.3)"}},L=(0,a.B1C)({fonts:{body:"InterVariable",mono:"Fira Code VF, Fira Code, monospace"},styles:{global:{"html, body, #root":{w:"full",h:"full",overflow:"hidden",userSelect:"none",cursor:"default"}}},components:{Dashboard:g,DragBar:{baseStyle:{w:"1px",h:"full",transition:"all ease 0.25s",backgroundColor:"gray.300",".drag-handle:hover &":{backgroundColor:"gray.500"}}},DragHandle:{baseStyle:{w:"10px",h:"full",mx:"-5px",px:"5px",cursor:"col-resize",boxSizing:"border-box",backgroundColor:"transparent"}},Logo:{baseStyle:{px:3,py:2,fontWeight:"extrabold",fontSize:"md",letterSpacing:"0.22em",textTransform:"uppercase",color:"white",bg:"whiteAlpha.100",borderRadius:"lg",boxShadow:"inset 0 0 0 1px rgba(255, 255, 255, 0.12)",lineHeight:"1"}},LogList:{baseStyle:{display:"grid",backgroundColor:"gray.50",gridTemplateColumns:"fit-content(300px) 1fr",gridColumnGap:"0.35rem",gridAutoRows:"min-content",userSelect:"text"}},LogText:{baseStyle:{fontFamily:"mono",fontSize:"xs"},variants:{message:{color:"gray.900"},warning:{color:"yellow.400",fontWeight:"semibold"},error:{color:"red.500",fontWeight:"semibold"},timestamp:{display:"flex",alignItems:"center",color:"gray.500"}},defaultProps:{variant:"message"}},NavBar:j,NavButton:{baseStyle:{display:"flex",alignItems:"center",gap:"0.35rem",borderRadius:"full",px:4,py:2,lineHeight:1.1,fontSize:"sm",fontWeight:"semibold",color:"gray.100",bg:"whiteAlpha.50",border:"1px solid",borderColor:"whiteAlpha.200",boxShadow:"0 10px 30px rgba(15, 23, 42, 0.15)",transitionProperty:"common",transitionDuration:"normal",_hover:{bg:"whiteAlpha.200",color:"white",borderColor:"whiteAlpha.300",_disabled:{bg:"initial"}},_active:{bg:"white",color:"#0f172a",borderColor:"white",boxShadow:"0 12px 34px rgba(15, 23, 42, 0.35)"},_focusVisible:{boxShadow:"0 0 0 2px rgba(99, 102, 241, 0.6)",outline:"none"},_disabled:{opacity:.4,cursor:"not-allowed"}}},Pane:{baseStyle:{position:"absolute",top:0,right:0,bottom:0,left:0}},PaneBody:M,PaneHeader:O,PaneTitle:{baseStyle:{fontSize:"sm",fontWeight:"semibold",letterSpacing:"0.08em",textTransform:"uppercase",color:"#0f172a"}},SideBar:D,SideBarButton:{baseStyle:{display:"flex",cursor:"pointer",alignItems:"center",justifyContent:"center",py:4,fontSize:"xs",fontWeight:"semibold",transitionProperty:"common",transitionDuration:"normal",writingMode:"vertical-lr",textOrientation:"sideways",borderRadius:"lg",border:"1px solid",borderColor:"whiteAlpha.200",color:"gray.100",bg:"whiteAlpha.50",boxShadow:"0 10px 30px rgba(15, 23, 42, 0.12)",iconSpacing:"0.35rem",span:{marginRight:".12rem"},_hover:{bg:"whiteAlpha.200",color:"white",borderColor:"whiteAlpha.300",transform:"translateY(-1px)",_disabled:{bg:"initial"}},_active:{bg:"linear-gradient(180deg, #e0e7ff 0%, #c7d2fe 100%)",color:"#0f172a",borderColor:"white",boxShadow:"0 14px 36px rgba(15, 23, 42, 0.35)",transform:"translateY(-2px)"},_focusVisible:{boxShadow:"0 0 0 2px rgba(94, 234, 212, 0.65)",outline:"none"}}},StatusBar:_,View:{baseStyle:{w:"full",h:"full"}}}});var T=n(59876),P=n(11384);const B=e=>{const{text:t,variant:n,time:o}=e;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(y,Object.assign({variant:"timestamp",justifySelf:"end"},{children:[o?(0,P.Z)(o,"HH:mm:ss"):"--:--:--",(0,r.jsx)(T.XC,{})]})),(0,r.jsx)(y,Object.assign({variant:n},{children:t}))]})};var R=n(64657);function $(e,t){return e.nodes[t]}function V(e,t){return t?t.map((t=>$(e,t))):(0,R.Z)(e.nodes)}function F(e,t){return e.edges[t]}function G(e,t){return t?t.map((t=>F(e,t))):(0,R.Z)(e.edges)}function Z(e,t){return`arrow-${e}-[${t}]`}const W=(0,o.memo)((e=>{const{size:t,color:n}=e,o=Z(t,n),s=t/2;return(0,r.jsx)("marker",Object.assign({id:o,viewBox:`0 0 ${t} ${t}`,refX:0,refY:s,markerWidth:t,markerHeight:t,markerUnits:"userSpaceOnUse",orient:"auto",fill:n},{children:(0,r.jsx)("path",{d:`M 0 0 L ${t} ${s} L 0 ${t} z`})}))})),U=e=>{const{arrowHeads:t}=e;return(0,r.jsx)("defs",{children:t.map(((e,t)=>(0,r.jsx)(W,Object.assign({},e),t)))})},q=e=>(0,r.jsx)("text",Object.assign({x:e.x,y:e.y,style:e.style},e.props,{children:e.text})),Y=e=>{const{label:t,position:n}=e;return t.length!==n.length?null:(0,r.jsx)(r.Fragment,{children:t.map(((e,t)=>{const{x:o,y:s}=n[t];return(0,r.jsx)(q,Object.assign({x:o,y:s},e),t)}))})};var X=n(3759),H=n(18990),J=n(27470),Q=n(75908),K=n(74681),ee=n(85925),te=n(69786),ne=n(67185),re=n(14643);const oe=e=>{const{path:t,curve:n,style:s,onRender:i}=e,a=(0,o.useRef)(null),l=(0,o.useRef)(null),c=(0,o.useMemo)((()=>function(e){const t=(0,X.Z)().x((e=>e.x)).y((e=>e.y));switch(null==e?void 0:e.type){case"bspline":t.curve(H.ZP);break;case"bundle":t.curve(J.Z.beta(.85));break;case"cardinal":t.curve(Q.ZP.tension(0));break;case"catmullrom":t.curve(K.Z.alpha(.5));break;case"line":default:t.curve(ee.Z);break;case"monotonex":t.curve(te.Z);break;case"monotoney":t.curve(te.s);break;case"natural":t.curve(ne.Z);break;case"step":t.curve(re.ZP);break;case"stepafter":t.curve(re.cD);break;case"stepbefore":t.curve(re.RN)}return t}(n)),[n]),d=(0,o.useMemo)((()=>c(t)||""),[c,t]),p=`url(#${Z(10,s.stroke)})`;return(0,o.useLayoutEffect)((()=>{const e=a.current,n=l.current;if(e&&n){const r=e.getTotalLength(),o=e.getPointAtLength(r-10);n.setAttribute("d",c([...t.slice(0,-1),o])||"")}i&&a.current&&i(a.current)}),[i,t]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("path",{ref:l,style:s,markerEnd:p}),(0,r.jsx)("path",{ref:a,d,stroke:"transparent",strokeWidth:11,fill:"none"})]})},se=e=>{const{id:t,path:n,curve:s,style:i,labels:a}=e,[l,c]=(0,o.useState)([]),d=(0,o.useCallback)((e=>{a&&c(a.map((t=>function(e,t){const n=t.getTotalLength();if(void 0===e.position)return t.getPointAtLength(n/2);if("number"==typeof e.position){const r=(0,p.Z)(e.position,0,1);return t.getPointAtLength(r*n)}const r=(0,p.Z)(e.position.distance,0,n);return"source"===e.position.from?t.getPointAtLength(r):t.getPointAtLength(n-r)}(t,e))))}),[c,a]);return(0,r.jsxs)("g",Object.assign({id:`${t}`},{children:[(0,r.jsx)(oe,{path:n,curve:s,style:i,onRender:d}),a&&(0,r.jsx)(Y,{label:a,position:l})]}))},ie=(0,o.memo)((e=>{const{edges:t}=e;return(0,r.jsx)("g",Object.assign({className:"edges"},{children:t.map((e=>(0,r.jsx)(se,Object.assign({},e),e.id)))}))}));function ae(e,t){return{x:e.x+t.x,y:e.y+t.y}}function le(e){return Math.atan2(-e.y,-e.x)+Math.PI}function ce(e,t){return{x:e.x-t.x,y:e.y-t.y}}function de(e,t,n){return{x:e.x+n*Math.cos(t),y:e.y+n*Math.sin(t)}}var pe=n(5419);const ue=(0,o.createContext)({nodeOffset:()=>({x:0,y:0}),onClickNode:()=>{},onMouseDown:()=>{},onMouseDownNode:()=>{},onMouseMove:()=>{},onMouseUp:()=>{},onMouseUpNode:()=>{},onWheel:()=>{},spreadMatrix:(0,pe.yR)(),zoomMatrix:(0,pe.yR)()});var he=n(60953);const me={x:0,y:0};function ge(e,t,n){const r=t.getScreenCTM();if(r){const o=r.inverse(),s=(0,pe.SO)(n),i=t.createSVGPoint();i.x=e.clientX,i.y=e.clientY;const a=(0,pe.hC)(s,i.matrixTransform(o));return i.x=e.clientX+e.movementX,i.y=e.clientY+e.movementY,ce((0,pe.hC)(s,i.matrixTransform(o)),a)}return{x:0,y:0}}const xe=()=>!1;function fe(e){return(0,o.useCallback)(((t,n)=>{let r,o=n.callbacks;switch(n.type){case"clicknode":return r=(0,he.Z)(null==o?void 0:o.onClickNode,xe),r(n.nodeId,n.event)?t:function(e,t){return e}(t);case"mousedown":return r=(0,he.Z)(null==o?void 0:o.onMouseDown,xe),r(n.event)?t:function(e,t){return Object.assign(Object.assign({},e),{isPanning:!0})}(t);case"mousedownnode":return r=(0,he.Z)(null==o?void 0:o.onMouseDownNode,xe),r(n.nodeId,n.event)?t:function(e,t){const{event:n,nodeId:r}=t;return n.preventDefault(),n.stopPropagation(),e.selection.push(r),e.isDragging=!0,e}(t,n);case"mousemove":return r=(0,he.Z)(null==o?void 0:o.onMouseMove,xe),r(n.event)?t:function(e,t,n){if(n){if(e.isDragging)return function(e,t,n){const r=e.selection,o=Object.assign({},e.offsets),s=ge(t.event,n,e.zoomMatrix);return r.forEach((e=>{const t=o[e]||me;o[e]=ae(t,s)})),Object.assign(Object.assign({},e),{offsets:o})}(e,t,n);if(e.isPanning)return function(e,t,n){const r=ge(t.event,n,e.zoomMatrix),o=(0,pe.vs)([e.zoomMatrix,(0,pe.Iu)(r.x,r.y)]);return Object.assign(Object.assign({},e),{zoomMatrix:o})}(e,t,n)}return e}(t,n,e);case"mouseup":return r=(0,he.Z)(null==o?void 0:o.onMouseUp,xe),r(n.event)?t:function(e,t){return Object.assign(Object.assign({},e),{isDragging:!1,isPanning:!1,offsets:{},selection:[]})}(t);case"mouseupnode":return r=(0,he.Z)(null==o?void 0:o.onMouseUpNode,xe),r(n.nodeId,n.event)?t:(r=(0,he.Z)(null==o?void 0:o.onSelectionMoved,xe),r(t.offsets)?t:function(e,t){const{event:n}=t;return n.preventDefault(),n.stopPropagation(),e.isDragging=!1,e.isPanning=!1,e.offsets={},e.selection=[],e}(t,n));case"wheel":if(r=(0,he.Z)(null==o?void 0:o.onWheel,xe),r(n.event))return t;const s=t.spreadMatrix,i=t.zoomMatrix,a=function(e,t,n){const r=t.event,o=function(e){const t=e.shiftKey?e.deltaX:e.deltaY;return 0===t?0:t<0?1.055:.9478672985781991}(r);return n&&0!==o&&!r.ctrlKey?r.shiftKey?function(e,t,n,r){const o=r.getScreenCTM();if(o){const s=r.createSVGPoint();s.x=t.clientX,s.y=t.clientY;const i=s.matrixTransform(o.inverse()),{x:a,y:l}=(0,pe.hC)((0,pe.vs)((0,pe.SO)(e.spreadMatrix),(0,pe.SO)(e.zoomMatrix)),i),c=(0,pe.vs)(e.spreadMatrix,(0,pe.bA)(n,n,a,l));return Object.assign(Object.assign({},e),{spreadMatrix:c})}return e}(e,r,o,n):function(e,t,n,r){const o=r.getScreenCTM();if(o){const s=r.createSVGPoint();s.x=t.clientX,s.y=t.clientY;const i=s.matrixTransform(o.inverse()),{x:a,y:l}=(0,pe.hC)((0,pe.SO)(e.zoomMatrix),i),c=(0,pe.vs)(e.zoomMatrix,(0,pe.bA)(n,n,a,l));return Object.assign(Object.assign({},e),{zoomMatrix:c})}return e}(e,r,o,n):e}(t,n,e);return r=(0,he.Z)(null==o?void 0:o.onSpreadChanged,xe),s!==a.spreadMatrix&&r(a.spreadMatrix)?t:(r=(0,he.Z)(null==o?void 0:o.onZoomChanged,xe),i!==a.zoomMatrix&&r(a.zoomMatrix)?t:a)}return t}),[e])}const be=e=>{const{svg:t}=e,n=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o{i(function(e,t){return Object.assign(Object.assign({},e),{callbacks:t})}(e,n))}),[i,n]);return{nodeOffset:(0,o.useCallback)((e=>s.offsets[e]||{x:0,y:0}),[s.offsets]),onClickNode:(0,o.useCallback)(((e,t)=>a(function(e,t){return{type:"clicknode",nodeId:e,event:t}}(e,t))),[a]),onMouseDown:(0,o.useCallback)((e=>a(function(e){return{type:"mousedown",event:e}}(e))),[a]),onMouseDownNode:(0,o.useCallback)(((e,t)=>a(function(e,t){return{type:"mousedownnode",nodeId:e,event:t}}(e,t))),[a]),onMouseMove:(0,o.useCallback)((e=>a(function(e){return{type:"mousemove",event:e}}(e))),[a]),onMouseUp:(0,o.useCallback)((e=>a(function(e){return{type:"mouseup",event:e}}(e))),[a]),onMouseUpNode:(0,o.useCallback)(((e,t)=>a(function(e,t){return{type:"mouseupnode",event:t,nodeId:e}}(e,t))),[a]),onWheel:(0,o.useCallback)((e=>a(function(e){return{type:"wheel",event:e}}(e))),[a]),spreadMatrix:s.spreadMatrix,zoomMatrix:s.zoomMatrix}};const ye=()=>(0,o.useContext)(ue),we=e=>{const{children:t,beforeUnmount:n}=e,s=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o()=>{n&&n(i)}),[n]),(0,r.jsx)(ue.Provider,Object.assign({value:i},{children:t}))};const ve=e=>{const{label:t}=e;return(0,r.jsx)(r.Fragment,{children:t.map(((e,t)=>{const{offset:n}=e,o=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o{const{shape:t,style:n}=e;return(0,r.jsx)("circle",{r:t.radius,style:n})})),Se=(0,o.memo)((e=>{const{shape:t,style:n}=e;return(0,r.jsx)("rect",{x:-t.width/2,y:-t.height/2,width:t.width,height:t.height,style:n})})),Ae=(0,o.memo)((e=>{const{shape:t,style:n}=e;switch(t.shape){case"circle":return(0,r.jsx)(je,{shape:t,style:n});case"rectangle":return(0,r.jsx)(Se,{shape:t,style:n})}return null})),Ce=(0,o.memo)((e=>{const{id:t,position:n,shape:s,style:i,labels:a,superscripts:l}=e,{onClickNode:c,onMouseDownNode:d,onMouseUpNode:p,spreadMatrix:u,nodeOffset:h}=ye(),m=h(t),g=(0,o.useMemo)((()=>{const e=ae((0,pe.hC)(u,n),m);return`translate(${e.x} ${e.y})`}),[n,m,u]);return(0,r.jsxs)("g",Object.assign({id:t,transform:g,onClick:e=>c(t,e),onMouseDown:e=>d(t,e),onMouseUp:e=>p(t,e)},{children:[(0,r.jsx)(Ae,{shape:s,style:i}),a&&(0,r.jsx)(ve,{label:a}),l&&(0,r.jsx)(ve,{label:l})]}))})),Me=(0,o.memo)((e=>{const{nodes:t}=e;return(0,r.jsx)("g",Object.assign({className:"nodes"},{children:t.map((e=>(0,r.jsx)(Ce,Object.assign({},e),e.id)))}))}));function Ie(e,t){return{a:e,b:t}}function Oe(e,t){const n=e.a,r=e.b,o=t.a,s=t.b,i=((s.x-o.x)*(n.y-o.y)-(s.y-o.y)*(n.x-o.x))/((s.y-o.y)*(r.x-n.x)-(s.x-o.x)*(r.y-n.y));return{x:n.x+i*(r.x-n.x),y:n.y+i*(r.y-n.y)}}function ke(e,t,n,r){switch(t.shape){case"circle":return function(e,t,n,r){return de(e,le(n),t+r/2)}(e,t.radius,n,r);case"rectangle":return function(e,t,n,r,o){const s=t+o,i=n+o,a=s/2,l=i/2,c=de(e,le(r),Math.max(s,i)),d=Ie(e,c),p=((u=d).a.y-u.b.y)/(u.a.x-u.b.x);var u;const h=p*a,m=l/p,g={x:e.x+a,y:e.y+l},x={x:e.x-a,y:e.y+l},f={x:e.x+a,y:e.y-l},b={x:e.x-a,y:e.y-l};if(-l<=h&&h<=l){if(e.xc.x)return Oe(Ie(x,b),d)}if(-a<=m&&m<=a){if(e.yc.y)return Oe(Ie(b,f),d)}return e}(e,t.width,t.height,n,r)}return e}function Ne(e){return void 0!==e}const De=(0,o.memo)((e=>{const{id:t,graph:n,edgeCurves:s,edgeStyles:i,edgeLabels:a,nodeShapes:l,nodeStyles:c,nodeLabels:d,nodeSuperscripts:p}=e,u=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);oV(n).map((e=>{const t={x:e.x,y:e.y},n=l[e.id],r=c[e.id],o=d?d[e.id]:void 0,s=p?p[e.id]:void 0;return{id:e.id,position:t,shape:n,style:r,labels:o,superscripts:s}}))),[n,l,c,d]),x=(0,o.useMemo)((()=>G(n).map((e=>{const t=$(n,e.source),r=$(n,e.target);if(!t||!r)return;const o=l[t.id],c=l[r.id],d=function(e,t,n,r,o,s,i,a){const l=e.waypoints||[],c=(0,pe.hC)(a,ae(t,r)),d=(0,pe.hC)(a,ae(o,i)),p=l.map((e=>(0,pe.hC)(a,e))),u=ke(c,n,ce((0,he.Z)(p[0],d),c),0),h=ke(d,s,ce((0,he.Z)(p[p.length-1],c),d),0);return[u,...p,h]}(e,t,o,h(t.id),r,c,h(r.id),m),p=s[e.id],u=i[e.id],g=a?a[e.id]:void 0;return{id:e.id,path:d,curve:p,style:u,labels:g}})).filter(Ne)),[n,m,s,i,a,h]),f=function(e){const t=new Set,n=[];return e.forEach((e=>{const r=e.stroke,o=Z(10,r);t.has(o)||(t.add(o),n.push({size:10,color:r}))})),n}(Object.values(i));return g.length<1&&g.push({id:"0",position:{x:0,y:0},shape:{shape:"rectangle",width:550,height:50},style:{fill:"transparent",stroke:"black"},labels:[{text:"There are no atoms to display (or the current theme has hidden them)",style:{fontSize:12,textAnchor:"middle",fontFamily:"monospace",userSelect:"none"}}]}),(0,r.jsxs)("g",Object.assign({id:t},u,{children:[(0,r.jsx)(U,{arrowHeads:f}),(0,r.jsx)(Me,{nodes:g}),(0,r.jsx)(ie,{edges:x})]}))}));(0,o.forwardRef)(((e,t)=>{const{children:n}=e,o=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o(0,r.jsx)(S.zx,Object.assign({colorScheme:"green",size:"xs",ref:t},e))));var Ee=n(98765);const _e=(0,Ee.PH)("sterling/buttonClicked"),Le=(0,Ee.PH)("sterling/dataRequested"),Te=(0,Ee.PH)("sterling/evalRequested"),Pe=(0,Ee.PH)("sterling/metaRequested"),Be=(0,Ee.PH)("sterling/dataReceived"),Re=(0,Ee.PH)("sterling/evalReceived"),$e=(0,Ee.PH)("sterling/metaReceived"),Ve=(0,Ee.PH)("sterling/connect"),Fe=(0,Ee.PH)("sterling/disconnect"),Ge=(0,Ee.PH)("sterling/connected"),Ze=(0,Ee.PH)("sterling/connectionError"),We=(0,Ee.PH)("sterling/disconnected"),Ue=(0,Ee.PH)("sterling/error");function qe(e){return void 0!==e}function Ye(e,t){const n={};for(const r of e)n[t(r)]=r;return n}function Xe(e){return e.types[e.types.length-1]}function He(e){return e.atoms}function Je(e){return void 0!==e.meta&&!0===e.meta.builtin}function Qe(e,t,n){return"string"==typeof t&&(t=ct(e,t)),"string"!=typeof n&&(n=n.id),t.types.includes(n)}function Ke(e,t){const n=t.getAttribute("label");if(!n)throw new Error("No label attribute in atom element");return{_:"atom",id:n,type:e}}function et(e,t){return Array.from(t).map((t=>Ke(e,t)))}function tt(e,t){if("string"==typeof t&&(t=st(e,t)),!e.types[t.type])throw new Error(`The atom's type is not part of the instance: ${t.type}`);return e.types[t.type]}function nt(e,t){return Array.from(t).map((t=>function(e,t){return{_:"tuple",types:e,atoms:Array.from(t.querySelectorAll("atom")).map(((t,n)=>Ke(e[n],t).id))}}(e,t)))}function rt(e){return e.tuples}function ot(e,t){return Array.from(t).map((t=>function(e,t){const n=t.getAttribute("label");if(!n)throw new Error("No label found for field element");const r=function(e,t){const n=t.querySelectorAll("type");return Array.from(n).map((t=>{const n=t.getAttribute("ID");if(!n)throw new Error("Type element must have an ID attribute");const r=e[n];if(!r)throw new Error(`Type element with ID ${n} not found`);return r}))}(e,t);if(0===r.length)throw new Error("No types found for field element");return{_:"relation",id:`${r[0]}<:${n}`,name:n,types:r,tuples:nt(r,t.querySelectorAll("tuple"))}}(e,t)))}function st(e,t){const n=it(e).find((e=>e.id===t));if(!n)throw new Error(`Could not find atom with id ${t}`);return n}function it(e){return dt(e).map(He).reduce(((e,t)=>e.concat(t)),[])}function at(e){return Object.values(e.relations)}function lt(e){return Object.values(e.skolems)}function ct(e,t){const n=e.types[t];if(!n)throw new Error(`Could not find type with id ${t}`);return n}function dt(e){return Object.values(e.types)}function pt(e){const t=e.getAttribute("bitwidth");if(!t)throw new Error("No bitwidth found in instance");const n=function(e){const t={},n=e.querySelectorAll("sig");for(const e of n){const n=e.getAttribute("ID"),r=e.getAttribute("label");if(!n)throw new Error("No ID found for sig element");if(!r)throw new Error("No label found for sig element");t[n]=r}return t}(e),r=function(e,t){const n={},r=t.querySelectorAll("sig");for(const e of r)if(!xt(e)){const t=e.getAttribute("ID"),r=e.getAttribute("parentID"),o=e.getAttribute("label");if(!t)throw new Error("No ID found for sig element");if(!o)throw new Error("No label found for sig element");r&&(n[t]=r)}const o=(t,r)=>n[t]?o(n[t],[...r,e[t]]):r,s={};for(const t in e)s[e[t]]=o(t,[]);return s}(n,e),o=function(e,t){return Array.from(t).filter((e=>!xt(e))).map((t=>function(e,t){const n=t.getAttribute("label");if(!n)throw new Error("No label attribute in sig element");const r=e[n];if(!r)throw console.log(e),new Error(`No type hierarchy for ${n}`);const o=function(e){const t={};return"yes"===e.getAttribute("abstract")&&(t.abstract=!0),"yes"===e.getAttribute("builtin")&&(t.builtin=!0),"yes"===e.getAttribute("enum")&&(t.enum=!0),"yes"===e.getAttribute("meta")&&(t.meta=!0),"yes"===e.getAttribute("one")&&(t.one=!0),"yes"===e.getAttribute("private")&&(t.private=!0),0===Object.keys(t).length?void 0:t}(t),s={_:"type",id:n,types:r,atoms:et(n,t.querySelectorAll("atom")),meta:void 0};return qe(o)&&(s.meta=o),s}(e,t)))}(r,e.querySelectorAll("sig")),s=ot(n,e.querySelectorAll("field")),i=ot(n,e.querySelectorAll("skolem"));return function(e,t){const n=t.find((e=>"Int"===e.id));if(!n)throw new Error("Could not find Int type");n.atoms=function(e){const t=[],n=Math.pow(2,e);for(let e=-n/2;ee.id)),relations:Ye(s,(e=>e.id)),skolems:Ye(i,(e=>e.id))}}function ut(e){var t;const n=(new DOMParser).parseFromString(e,"application/xml"),r=Array.from(n.querySelectorAll("instance"));if(!r.length)throw new Error(`No Alloy instance in XML: ${e}`);const o=n.querySelectorAll("visualizer");let s,i,a;for(const e of o){const t=mt(e,"script"),n=mt(e,"theme"),r=mt(e,"cnd");i=null!=t?t:i,s=null!=r?r:s,a=null!=n?n:a}return{instances:r.map(pt),bitwidth:ht(r[0],"bitwidth"),command:mt(r[0],"command"),loopBack:null!==(t=ht(r[0],"backloop"))&&void 0!==t?t:ht(r[0],"loop"),maxSeq:ht(r[0],"maxseq"),maxTrace:ht(r[0],"maxtrace"),minTrace:ht(r[0],"mintrace"),traceLength:ht(r[0],"tracelength"),visualizerConfig:{script:gt(i),theme:gt(a),cnd:gt(s)}}}function ht(e,t){const n=e.getAttribute(t);return n?+n:void 0}function mt(e,t){const n=e.getAttribute(t);return n?`${n}`:void 0}function gt(e){return null==e?void 0:e.replaceAll(""",'"').replaceAll('\\"','"').replaceAll(">",">").replaceAll("<","<")}function xt(e){return e.querySelectorAll("type").length>0}function ft(e){return"alloy"===e.format}function bt(e){return Object.assign(Object.assign({},e),{parsed:ut(e.data)})}function yt(e,t){const n=function(e){return JSON.parse(e)}(e);!function(e){return"data"===e.type&&void 0!==e.payload}(n)?function(e){return"eval"===e.type&&void 0!==e.payload}(n)?t.dispatch(Re(n.payload)):function(e){return"meta"===e.type&&void 0!==e.payload}(n)&&t.dispatch($e(n.payload)):t.dispatch(Be(function(e,t){const{enter:n,update:r,exit:o}=e,s=function(e,t){const n=[];return e&&e.forEach((e=>{!function(e){const t=e.format;return"alloy"===t||"raw"===t}(e)?t.dispatch(Ue(`Unsupported data format in datum ${e.id}: ${e.format}`)):(e.id=`${e.id}`,n.push(e))})),n}(n,t);return{enter:s.map((e=>{switch(e.format){case"alloy":return bt(e);case"raw":return function(e){return Object.assign(Object.assign({},e),{parsed:e.data})}(e);default:throw new Error("Unsupported format fell through unexpectedly.")}})),update:r,exit:o}}(n.payload,t)))}function wt(e){e.dispatch(Ue("Not connected to a provider."))}function vt(e,t){e.send(JSON.stringify(t))}const jt=()=>(0,i.I0)(),St=i.v9;var At=n(18172);function Ct(e,t){return t in e.edges}function Mt(e,t){return t in e.nodes}var It=n(29428);function Ot(e,t){return t=t||[],function(e,t){return(0,At.Uy)(e,(e=>{t.forEach((t=>function(e,t){const{id:n,source:r,target:o}=t;if(n&&(s=e,i=[r,o],(0,It.Z)(i,(e=>Mt(s,e))))&&!Ct(e,n))e.edges[n]=t,function(e,t,n,r){e.predecessors.hasOwnProperty(n)||(e.predecessors[n]={}),e.predecessors[n].hasOwnProperty(t)||(e.predecessors[n][t]=[]),e.predecessors[n][t].push(r)}(e,r,o,n),function(e,t,n,r){e.successors.hasOwnProperty(t)||(e.successors[t]={}),e.successors[t].hasOwnProperty(n)||(e.successors[t][n]=[]),e.successors[t][n].push(r)}(e,r,o,n),function(e,t,n){e.inedges[t].push(n)}(e,o,n),function(e,t,n){e.outedges[t].push(n)}(e,r,n);else{if(!n)throw new Error("Cannot add an edge without an edge ID");if(!Mt(e,r))throw new Error(`Cannot add edge ${n}, the source node ${r} is not in the graph`);if(!Mt(e,o))throw new Error(`Cannot add edge ${n}, the target node ${o} is not in the graph`);if(Ct(e,n))throw new Error(`Cannot add edge, an edge with ID ${n} already exists in the graph`)}var s,i}(e,(0,At.cA)(t))))}))}(function(e,t){return(0,At.Uy)(e,(e=>{t.forEach((t=>function(e,t){const{id:n}=t;if(n&&!Mt(e,n))e.nodes[n]=t,e.predecessors[n]={},e.successors[n]={},e.inedges[n]=[],e.outedges[n]=[];else{if(!n)throw new Error("Cannot add a node without a node ID");if(Mt(e,n))throw new Error(`Cannot add node, a node with ID ${n} already exists in the graph`)}}(e,(0,At.cA)(t))))}))}({nodes:{},edges:{},predecessors:{},successors:{},inedges:{},outedges:{}},e=e||[]),t)}function kt(e,t){const n=e.edges;return!!n&&n.some((e=>{var n;return!0===e.asAttribute&&(null===(n=e.targets)||void 0===n?void 0:n.some((e=>"*"===e||e.relation===t)))}))}function Nt(e,t,n){if(n<2)return[0,0];if(!e)return[0,n-1];const r=e.edges;if(!r)return[0,n-1];const o=r.find((e=>{var n;return(e.sourceIndex||e.targetIndex)&&(null===(n=e.targets)||void 0===n?void 0:n.some((e=>"*"===e||e.relation===t)))}));return o?[o.sourceIndex?o.sourceIndex:0,o.targetIndex?o.targetIndex:n-1]:[0,n-1]}var Dt=n(11022),zt=n(935);function Et(e){return e.id}function _t(e,t){return`${e.id}:${t.atoms.join("->")}`}function Lt(e,t){var n,r;const o=(null===(n=null==t?void 0:t.hidden)||void 0===n?void 0:n.disconnected)||!1,s=o||(null===(r=null==t?void 0:t.hidden)||void 0===r?void 0:r.builtinDisconnected)||!1,{nodeIds:i,edgeIds:a}=function(e,t,n,r){const o=new Set,s=new Set;return at(e).forEach((t=>{rt(t).forEach((n=>{const i=n.atoms.map((t=>st(e,t))),[a,l]=function(e,t,n){if(n){const[r,o]=Nt(n,e.id,t.length);return[r?t[r]:(0,Dt.Z)(t),o?t[o]:(0,zt.Z)(t)]}return[(0,Dt.Z)(t),(0,zt.Z)(t)]}(t,i,r);a&&l&&(o.add(Et(a)),o.add(Et(l)),s.add(_t(t,n)))}))})),it(e).forEach((r=>{const s=Et(r);o.has(s)||t||function(e,t){return"string"==typeof t&&(t=st(e,t)),tt(e,t).types.map((t=>ct(e,t))).some(Je)}(e,r)&&n||o.add(s)})),{nodeIds:o,edgeIds:s}}(e,o,s,t),l=[];it(e).forEach((e=>{const t=Et(e);i.has(t)&&l.push({id:t,atom:e})}));const c=[];return at(e).forEach((n=>{t&&kt(t,n.id)||rt(n).forEach((r=>{const o=_t(n,r),s=r.atoms,[i,l]=Nt(t,n.id,s.length),d=i?s[i]:(0,Dt.Z)(s),p=l?s[l]:(0,zt.Z)(s);d&&p&&a.has(o)&&c.push({id:o,source:Et(st(e,d)),target:Et(st(e,p)),relation:n,tuple:r})}))})),Ot(l,c)}var Tt=n(79432),Pt=n(27961);function Bt(e,t,n,r){const o={},s={},i={},a={},l={},c={},d={},p=function(e,t){const n={"*":(r=[t],(0,Pt.Z)(r.map((e=>e.nodes?e.nodes.filter((e=>e.targets&&e.targets.some((e=>"*"===e)))):[]))))};var r;return dt(e).forEach((e=>{n[e.id]=function(e,t){return(0,Pt.Z)(t.map((t=>t.nodes?t.nodes.filter((t=>t.targets&&t.targets.some((t=>"*"!==t&&t.type===e)))):[])))}(e.id,[t])})),n}(t,r),u=function(e,t){const n={"*":(r=[t],(0,Pt.Z)(r.map((e=>e.edges?e.edges.filter((e=>e.targets&&e.targets.some((e=>"*"===e)))):[]))))};var r;return at(e).forEach((e=>{n[e.id]=function(e,t){return(0,Pt.Z)(t.map((t=>t.edges?t.edges.filter((t=>t.targets&&t.targets.some((t=>"*"!==t&&t.relation===e)))):[])))}(e.id,[t])})),n}(t,r),h={};at(t).forEach((e=>{kt(r,e.id)&&rt(e).forEach((t=>{const n=t.atoms;if(n.length>1){const t=n[0];h[t]||(h[t]=[]),h[t].push(`${e.name}: ${n.slice(1).join(", ")}`)}}))})),lt(t).forEach((e=>{rt(e).forEach((t=>{const n=t.atoms[0];h[n]||(h[n]=[]),h[n].push(`${e.name}`)}))})),V(n).forEach((e=>{i[e.id]=[{text:e.atom.id,props:{},style:{}}];const n=ct(t,e.atom.type);a[e.id]=[{text:n.types[0],props:{dy:"-1em"},style:{textAnchor:"middle",fontSize:"14px",fontStyle:"italic"}}],h[e.id]&&i[e.id].push(...h[e.id].map((e=>({text:e,props:{},style:{}})))),s[e.id]={}}));const m=e=>{if(e.tuple.atoms.length>2){const[t,n]=Nt(r,e.relation.id,e.tuple.atoms.length),o=e.tuple.atoms.slice();return o.splice(t,1),o.splice(n-1,1),e.relation.name+`[${o.join(", ")}]`}return e.relation.name};return G(n).forEach((e=>{d[e.id]=[{text:m(e),props:{},style:{}}],c[e.id]={}})),V(n).forEach((e=>{const{id:n,atom:r}=e;["*","univ",...tt(t,r).types.slice().reverse()].forEach((e=>{var t;null===(t=p[e])||void 0===t||t.forEach((e=>{var t;e.shape&&(o[n]=e.shape),(0,Tt.Z)(s[n],null===(t=e.styles)||void 0===t?void 0:t.node),i[n].forEach((t=>{var n,r;(0,Tt.Z)(t.props,null===(n=e.props)||void 0===n?void 0:n.label),(0,Tt.Z)(t.style,null===(r=e.styles)||void 0===r?void 0:r.label)})),Rt(i[n])}))}))})),G(n).forEach((e=>{const{id:t,relation:n,tuple:r}=e;["*",n.id].forEach((e=>{var n;null===(n=u[e])||void 0===n||n.forEach((e=>{var n;e.curve&&(l[t]=e.curve),(0,Tt.Z)(c[t],null===(n=e.styles)||void 0===n?void 0:n.edge),d[t].forEach((t=>{var n,r;(0,Tt.Z)(t.props,null===(n=e.props)||void 0===n?void 0:n.label),(0,Tt.Z)(t.style,null===(r=e.styles)||void 0===r?void 0:r.label)})),Rt(d[t])}))}))})),{id:e,graph:n,nodeShapes:o,nodeStyles:s,nodeLabels:i,nodeSuperscripts:a,edgeCurves:l,edgeLabels:d,edgeStyles:c}}function Rt(e){const t=e.length-1;e.forEach(((e,n)=>{e.props||(e.props={}),e.props.dy=n-t/2+.33+"em"}))}var $t=n(70681),Vt=n.n($t),Ft=n(5840),Gt=n(13209),Zt=n(44186),Wt=n(49360);function Ut(e,t){return Ot(V(e).map((e=>{const n=t.nodePositions[e.id];return Object.assign(Object.assign({},e),{x:(null==n?void 0:n.x)||0,y:(null==n?void 0:n.y)||0})})),G(e).map((e=>Object.assign(Object.assign({},e),{waypoints:t.edgeWaypoints[e.id]||[]}))))}const qt=e=>void 0!==e.loopBack;var Yt=n(1185);function Xt(e,t){const n={};return t.forEach((t=>{const r=Xe(tt(e,t));if(n[r])throw new Error(`Cannot project ${t} and ${n[r]}. Both are of type ${r}`);n[r]=t})),{types:Ht(e,n),relations:Jt(e,n),skolems:e.skolems}}function Ht(e,t){const n={},r=Object.keys(t);for(const t in e.types){const o=e.types[t],s=r.some((t=>Qe(e,o,t)));n[t]={_:"type",id:o.id,types:o.types,atoms:s?[]:o.atoms,meta:o.meta}}return n}function Jt(e,t){const n={},r=Object.keys(t),o=Object.values(t);for(const t in e.relations){const s=e.relations[t],i=s.types.some((t=>r.some((n=>Qe(e,t,n))))),a=i?Qt(e,s.types,r):[];n[t]={_:"relation",id:s.id,name:s.name,types:i?en(s.types,a):s.types,tuples:i?Kt(s.tuples,a,o):s.tuples},i||(n[t]=s)}return n}function Qt(e,t,n){const r=[];return t.forEach(((t,o)=>{n.some((n=>Qe(e,t,n)))&&r.push(o)})),r}function Kt(e,t,n){return e.filter((e=>e.atoms.some((e=>n.includes(e))))).map((e=>({_:"tuple",types:en(e.types,t),atoms:en(e.atoms,t)}))).filter((e=>e.atoms.length>1))}function en(e,t){const n=[];for(let r=0;rt.map((t=>sn(e,t))).filter((e=>!(0,Wt.Z)(e))))),selectDatumById:sn},ln=function(e,t){return(e.orderByDatumId[t.id]||[]).map((t=>e.expressionsById[t]))},cn=function(e){return e.nextExpressionId};function dn(e){return e.length?e.slice().sort(((e,t)=>e.time===t.time?e.type.localeCompare(t.type):!0===e.time?-1:1)).map((e=>!0===e.time?`[${e.type}]`:`(${e.type})`)).join("|"):"|"}function pn(e,t){const n=un(e,t);return n&&n.projections||[]}function un(e,t){var n;return e.themeByGeneratorName[null!==(n=t.generatorName)&&void 0!==n?n:""]}const hn={selectGraphLayout:function(e,t){const n=pn(e,t),r=e.layoutsByDatumId[t.id],o=dn(n);return r.layoutById[o]},selectHiddenRelations:function(e,t){return e.hiddenByDatumId[t.id]},selectProjections:pn,selectSelectedProjections:function(e,t){var n,r;const o=null!==(n=t.generatorName)&&void 0!==n?n:"";return null!==(r=e.selectedProjectionsByGeneratorName[o])&&void 0!==r?r:{}},selectSelectedTimeIndices:function(e,t){var n;return null!==(n=e.selectedTimeIndicesByDatumId[t.id])&&void 0!==n?n:[]},selectSpreadMatrix:function(e,t){var n;return null===(n=e.matricesByDatumId[t.id])||void 0===n?void 0:n.spreadMatrix},selectTheme:un,selectTimeIndex:function(e,t){return e.timeByDatumId[t.id]||0},selectZoomMatrix:function(e,t){var n;return null===(n=e.matricesByDatumId[t.id])||void 0===n?void 0:n.zoomMatrix},selectCnDSpec:function(e,t){var n,r;const o=null!==(n=t.generatorName)&&void 0!==n?n:"";return null!==(r=e.cndSpecByGeneratorName[o])&&void 0!==r?r:""}},mn=function(e){return e.items},gn=function(e){return e.connected},xn=function(e){return e.providerName},fn=function(e){return e.providerGenerators},bn=function(e){return e.synthesisEnabled};function yn(e,t){let n=null!=t?t:e;if(n instanceof Function)return n;{let e=n;return()=>e}}function wn(e){return{top_left:{x:Math.min(...e.map((e=>e.top_left.x))),y:Math.min(...e.map((e=>e.top_left.y)))},bottom_right:{x:Math.max(...e.map((e=>e.bottom_right.x))),y:Math.max(...e.map((e=>e.bottom_right.y)))}}}function vn(e){return null==e||0==e.length?{x:0,y:0}:e.reduce(((t,n)=>({x:t.x+n.x/e.length,y:t.y+n.y/e.length})),{x:0,y:0})}function jn(e,t){return e.map((e=>()=>({x:e().x-t().x,y:e().y-t().y})))}function Sn(e){let t=1/0,n=1/0,r=-1/0,o=-1/0;return e.forEach((e=>{t=Math.min(t,e.x),r=Math.max(r,e.x),n=Math.min(n,e.y),o=Math.max(o,e.y)})),{top_left:{x:t,y:n},bottom_right:{x:r,y:o}}}function An(e,t){const n=[];for(let o=1;o<=t;o++){const s=e(2*Math.PI/t*o);if(!("x"in(r=s))||!("y"in r))throw"returned bounding box response not of type coords. Issue in edge.ts or utility.ts";n.push(s)}var r;return n}function Cn(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Mn(e){let t=Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2));return{x:e.x/t,y:e.y/t}}function In(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}function On(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function kn(e,t){const n=function(e,t){return e.x*t.x+e.y*t.y}(e,t)/(On(e)*On(t));return On(e)*On(t)==0?1/0:Math.acos(n)}function Nn(e,t,n,r){const o=e*n+t*r,s=Math.sqrt((e*e+t*t)*(n*n+r*r));let i=Math.acos(o/s);return e*r-t*n<0&&(i=-i),i}var Dn=n(69364);const zn="rgb(0, 0, 0)";class En{constructor(e){this.center=yn({x:0,y:0},e),this.origin_offset=yn({x:0,y:0},e),this.bounding_box_lam=e=>this.center(),this.hasBoundingBox=!1,this.children=[],this.dependents=[],this.masks=[]}boundingBox(){return 0==this.children.length?{top_left:this.center(),bottom_right:this.center()}:wn(this.children.map((e=>e.boundingBox())))}getChildren(){return this.children}setCenter(e){this.center=yn(this.center(),e)}hasLam(){return this.hasBoundingBox}getLam(){return this.hasBoundingBox?this.bounding_box_lam:(e=this.boundingBox(),t=>{const n=t%(2*Math.PI),r=e.top_left,o=e.bottom_right,s=Math.abs(r.y-o.y),i=Math.abs(r.x-o.x),a=Math.atan(s/i);if(2*Math.PI-a<=n||n<=a){const e=o.x;let t;return t=n>Math.PI?o.y-s/2+Math.tan(2*Math.PI-n)*i/2:o.y-s+Math.tan(n)*i/2,{x:e,y:t}}if(aMath.PI/2?r.x+s/(2*Math.tan(n-Math.PI/4)):r.x+i/2+s/(2*Math.tan(n)),{x:e,y:r.y}}if(Math.PI-a{r.append("rect").attr("x",e.top_left.x).attr("y",e.top_left.y).attr("width",Math.abs(e.top_left.x-e.bottom_right.x)).attr("height",Math.abs(e.top_left.y-e.bottom_right.y))})),n}render(e,t){let n;n=t?this.masks.concat(t):this.masks,this.children.forEach((t=>{t.render(e,n)}))}sterlingExpectCenter(e,t,n){if(this.center().x!==t)throw new Error(`${e}: center().x was not expected value (${t}); was ${this.center().x}`);if(this.center().y!==n)throw new Error(`${e}: center().y was not expected value (${n}); was ${this.center().y}`)}}class _n extends En{constructor(e){super(e.coords),this.text=yn("",e.text),this.fontSize=yn(15,e.fontSize),this.color=yn("rgb(0, 0, 0)",e.color),this.events=yn([],e.events),this.fontWeight=yn(400,e.fontWeight)}boundingBox(){return{top_left:{x:this.center().x-this.fontSize()/2,y:this.center().y-this.fontSize()/2},bottom_right:{x:this.center().x+this.fontSize()/2,y:this.center().y+this.fontSize()/2}}}setText(e){this.text=yn(this.text(),e)}setFontSize(e){this.fontSize=yn(this.fontSize(),e)}setTextColor(e){this.color=yn(this.color(),e)}setFontWeight(e){this.fontWeight=yn(this.fontWeight(),e)}render(e,t){let n,r="";n=t?this.masks.concat(t):this.masks,r=this.addMaskRender(n,e);const o=Dn.Ys(e).append("text").attr("x",this.center().x).attr("y",this.center().y).attr("text-anchor","middle").attr("alignment-baseline","central").attr("font-size",this.fontSize).attr("font-weight",this.fontWeight).attr("mask",n.length>0?`url(#${r})`:"").attr("fill",this.color).text(this.text);this.events()&&this.events().forEach((e=>o.on(e.event,e.callback))),super.render(e)}}class Ln extends En{constructor(e){super(e.center),this.color=yn("rgb(0, 0, 0)",e.color),this.borderWidth=yn(2,e.borderWidth),this.borderColor=yn("rgb(255, 255, 255)",e.borderColor),this.label=new _n({text:e.label,coords:()=>this.center(),color:e.labelColor,fontSize:e.labelSize}),this.children.push(this.label),this.opacity=yn(1,e.opacity)}setColor(e){this.color=yn(this.color(),e)}setBorderWidth(e){this.borderWidth=yn(this.borderWidth(),e)}setBorderColor(e){this.borderColor=yn(this.borderColor(),e)}setLabelText(e){this.label.setText(e)}setLabelColor(e){this.label.setTextColor(e)}setLabelSize(e){this.label.setFontSize(e)}}class Tn extends Ln{constructor(e){var t;super(e),this.height=yn(0,e.height),this.width=yn(0,e.width),this.labelLocation=null!==(t=e.labelLocation)&&void 0!==t?t:"center";const n={x:0,y:0};if(e.center&&e.coords)throw"you cannot include both coords and a center as the two define the same thing";this.center=(()=>{if(e.center)return yn(n,e.center);{const t=yn(n,e.coords);return()=>{const e=t();return{x:e.x+this.width()/2,y:e.y+this.height()/2}}}})(),this.setLabelLocation()}boundingBox(){return{top_left:{x:this.center().x-this.width()/2,y:this.center().y-this.height()/2},bottom_right:{x:this.center().x+this.width()/2,y:this.center().y+this.height()/2}}}setLabelLocation(){switch(this.labelLocation){case"topLeft":this.label.setCenter((()=>({x:this.center().x-this.width()/2+2.5*this.label.text().length,y:this.center().y-this.height()/2-1*this.label.fontSize()})));break;case"topRight":this.label.setCenter((()=>({x:this.center().x+this.width()/2-2.5*this.label.text().length,y:this.center().y-this.height()/2-1*this.label.fontSize()})));break;case"bottomRight":this.label.setCenter((()=>({x:this.center().x+this.width()/2-2.5*this.label.text().length,y:this.center().y+this.height()/2+1*this.label.fontSize()})));break;case"bottomLeft":this.label.setCenter((()=>({x:this.center().x-this.width()/2+2.5*this.label.text().length,y:this.center().y+this.height()/2+1*this.label.fontSize()})))}}setWidth(e){this.width=yn(this.width(),e)}setHeight(e){this.height=yn(this.height(),e)}render(e,t){let n,r="";n=t?this.masks.concat(t):this.masks,r=this.addMaskRender(n,e),Dn.Ys(e).append("rect").attr("x",this.center().x-this.width()/2).attr("y",this.center().y-this.height()/2).attr("width",this.width()).attr("height",this.height()).attr("stroke-width",this.borderWidth()).attr("stroke",this.borderColor()).attr("fill",this.color()).attr("mask",n.length>0?`url(#${r})`:"").attr("opacity",this.opacity()),super.render(e,n)}}class Pn extends Ln{constructor(e){super(e),this.radius=yn(0,e.radius),this.bounding_box_lam=e=>{const t=this.radius(),n=this.center();return{x:t*Math.cos(e)+n.x,y:t*Math.sin(e)+n.y}},this.hasBoundingBox=!0}boundingBox(){return{top_left:{x:this.center().x-this.radius(),y:this.center().y-this.radius()},bottom_right:{x:this.center().x+this.radius(),y:this.center().y+this.radius()}}}setRadius(e){this.radius=yn(0,e)}render(e,t){let n,r="";n=t?this.masks.concat(t):this.masks,r=this.addMaskRender(n,e),Dn.Ys(e).append("circle").attr("cx",this.center().x).attr("cy",this.center().y).attr("r",this.radius).attr("stroke-width",this.borderWidth).attr("stroke",this.borderColor).attr("fill",this.color).attr("mask",n.length>0?`url(#${r})`:"").attr("opacity",this.opacity()),super.render(e,n)}}var Bn=n(28721);class Rn extends En{constructor(e){var t;let n;n=null!=e.points?e.points.map((e=>yn({x:0,y:0},e))):[],super((()=>vn(n.map((e=>e()))))),this.pointsRelative=jn(n,this.center),this.color=yn(zn,e.color),this.width=yn(2,e.width),this.opacity=yn(1,e.opacity),this.arrow=null!==(t=e.arrow)&&void 0!==t&&t,this.style=yn("full",e.style),this.curve=yn({curveType:"none"},e.curve)}boundingBox(){return Sn(this.pointsRelative.map((e=>({x:e().x+this.center().x,y:e().y+this.center().y}))))}setColor(e){this.color=yn(this.color(),e)}setWidth(e){this.width=yn(this.width(),e)}setOpacity(e){this.opacity=yn(this.opacity(),e)}render(e,t){let n,r="";if(n=t?this.masks.concat(t):this.masks,r=this.addMaskRender(n,e),2==this.pointsRelative.length)for(;this.pointsRelative[0]().x==this.pointsRelative[1]().x||this.pointsRelative[0]().y==this.pointsRelative[1]().y;){if(this.pointsRelative[0]().x==this.pointsRelative[1]().x){const e=this.pointsRelative[0];this.pointsRelative[0]=()=>({x:e().x+1e-4,y:e().y})}if(this.pointsRelative[0]().y==this.pointsRelative[1]().y){const e=this.pointsRelative[0];this.pointsRelative[0]=()=>({x:e().x,y:e().y+1e-4})}}let o=this.pointsRelative.map((e=>({x:e().x+this.center().x,y:e().y+this.center().y})));const s=this.buildPathString(o);let i="0";if("dashed"==this.style()?i=5*this.width():"dotted"==this.style()&&(i=this.width()),this.arrow){const t=(0,Bn.Z)();Dn.Ys(e).append("svg:defs").append("svg:marker").attr("id",t).attr("refX",11).attr("refY",6).attr("markerWidth",10*this.width()).attr("markerHeight",10*this.width()).attr("markerUnits","userSpaceOnUse").attr("orient","auto").append("path").attr("d","M 0 0 12 6 0 12 3 6").style("fill",this.color),Dn.Ys(e).append("path").attr("d",s).attr("stroke-width",this.width).attr("stroke",this.color).attr("opacity",this.opacity()).attr("marker-end",`url(#${t})`).attr("mask",n.length>0?`url(#${r})`:"").style("stroke-dasharray",i).attr("fill","transparent"),super.render(e,n)}else Dn.Ys(e).append("path").attr("d",s).attr("stroke-width",this.width).attr("stroke",this.color).attr("opacity",this.opacity()).attr("fill","transparent").attr("mask",n.length>0?`url(#${r})`:"").style("stroke-dasharray",i),super.render(e,n)}buildPathString(e){const t=this.curve();switch(t.curveType){case"none":const n=Dn.ETc();return n.moveTo(e[0].x,e[0].y),e.forEach((e=>{n.lineTo(e.x,e.y)})),n.toString();case"arc":return`M ${e[0].x} ${e[0].y} \n A ${t.xradius} ${t.yradius} 0 0 \n ${void 0!==t.sweep?t.sweep:1} ${e[1].x} ${e[1].y}`;case"cubic":throw console.log("Error: cubic curves currently unsupported by Line"),new Error("cubic curves currently unsupported by Line");case"quadratic":throw console.log("Error: quadratic curves currently unsupported by Line"),new Error("quadratic curves currently unsupported by Line");default:throw console.log(`Error: unrecognized curveType in prop ${JSON.stringify(t)} (check you have not misspelled the field name)`),new Error(`unknown curveType field in Line prop ${JSON.stringify(t)} (check you have not misspelled the field name)`)}}}class $n extends En{constructor(e){var t,n;super(e.coords);let r=yn({x:0,y:0},e.coords);this.center=()=>({x:r().x+this.width/2,y:r().y+this.height/2}),this.coords=()=>{const e=this.center();return{x:e.x-this.width/2,y:e.y-this.height/2}},this.height=e.height,this.width=e.width,this.root=e.root;let o=this.root.visualObject.center;this.root.visualObject.setCenter((()=>{const e=this.coords(),t=o();return{x:e.x+this.width/2+t.x,y:e.y+t.y}})),this.lines=[],this.subTrees=[],this.setUpSubtrees(),this.setLineColor(null!==(t=e.edgeColor)&&void 0!==t?t:"black"),this.setLineWidth(null!==(n=e.edgeWidth)&&void 0!==n?n:2)}setUpSubtrees(){let e=this.height/(Vn(this.root)-1),t=this.root.children.map((e=>Fn(e))).reduce(((e,t)=>e+t),0);this.subTrees=[];let n=0;this.subTrees=this.root.children.map((r=>{let o=Fn(r),s=n;return n+=o,new $n({root:r,height:e*(Vn(r)-1),width:this.width*Fn(r)/t,coords:()=>{const n=this.coords();return{x:n.x+s/t*this.width,y:n.y+e}}})})),this.subTrees.forEach((e=>{this.lines.push(new Rn({points:[()=>{const e=this.root.visualObject.center();return{x:e.x,y:e.y}},()=>{const t=e.root.visualObject.center();return{x:t.x,y:t.y}}],color:zn,width:2}))})),this.lines.forEach((e=>{this.children.push(e)})),this.subTrees.forEach((e=>{this.children.push(e)})),this.children.push(this.root.visualObject)}setLineColor(e){this.lines.forEach((t=>t.setColor(e))),this.subTrees.forEach((t=>t.setLineColor(e)))}setLineWidth(e){this.lines.forEach((t=>t.setWidth(e))),this.subTrees.forEach((t=>t.setLineWidth(e)))}}function Vn(e){let t=0,n=[e];for(;0!=n.length;){t+=1;let e=[];n.forEach((t=>{t.children.forEach((t=>{e.push(t)}))})),n=e}return t}function Fn(e){let t=1,n=[e];for(;0!=n.length;){let e=[];n.forEach((t=>{t.children.forEach((t=>{e.push(t)}))})),n=e,t=Math.max(t,e.length)}return t}class Gn{static error(e,t,n){return n&&console.trace(),Error(`[${e}] ${t}`)}static missingAttribute(e,t){return Error(`[${e}] Missing attribute: ${t}`)}static missingElement(e,t){return Error(`[${e}] Missing element: <${t}>`)}}class Zn{constructor(e){this._tuples=e||[]}empty(){return 0===this._tuples.length}equals(e){return this.toString()===e.toString()}in(e){const t=new Set(e.tuples().map((e=>e.toString())));return this.tuples().every((e=>t.has(e.toString())))}join(e){if(Array.isArray(e))throw Gn.error("AlloySet",`[${e}] is an array, not an AlloySet, so unable to apply join.`);if(!(e instanceof Zn))throw Gn.error("AlloySet",`${e} is something other than an AlloySet, so unable to apply join.`);if(!this.tuples().length||!e.tuples().length)return new Zn;const t=function(e,t){const n=new Map;return t.forEach((e=>{const t=e.atoms()[0];n.has(t.id())||n.set(t.id(),[]),n.get(t.id()).push(e)})),n}(0,e.tuples()),n=[],r=this._tuples[0].atoms().length-1;return this.tuples().forEach((e=>{const o=e.atoms()[r],s=t.get(o.id());s&&s.forEach((t=>{const r=e.atoms().slice(0,-1).concat(...t.atoms().slice(1));n.push(new Wn(r))}))})),new Zn(function(e){const t=new Set;return e.filter((e=>{const n=e.atoms().map((e=>e.id())).join();return!t.has(n)&&(t.add(n),!0)}))}(n))}toString(){return this._tuples.map((e=>e.toString())).join("\n")}tuples(){return this._tuples.slice()}}class Wn extends Zn{constructor(e){super(),this._tuples=[this],this._atoms=e}atoms(){return this._atoms.slice()}toString(){return this._atoms.map((e=>e.id())).join(", ")}static tuplesFromXML(e,t){return Array.from(e).map((e=>{if(1===t.length)return Wn.buildTuple(t[0],e);const n=t.reduce(((t,n)=>{if(t)return t;try{return Wn.buildTuple(n,e)}catch(e){return}}),void 0);if(n)return n;throw Gn.error("AlloyField",`No match for tuple element ${e} in declared types ${t}`)}))}static buildTuple(e,t){const n=Array.from(t.querySelectorAll("atom")).map(((t,n)=>{const r=e[n],o=t.getAttribute("label");if(!o)throw Gn.missingAttribute("AlloyField","label");const s=r.atom(o);if(!s)throw Gn.error("AlloyField",`No atom: ${o} in type: ${r}`);return s}));return new Wn(n)}}class Un extends Zn{constructor(e,t){super();const n=t?t.applyProxy(this,function(e){return e.replace("/","$").replace("-","$")}(e)):this;return this._id=e,this._tuples=[new Wn([n])],n}clone(e){return new Un(this.id(),e)}id(){return this._id}static fromElement(e,t){const n=e.getAttribute("label");if(!n)throw Gn.missingAttribute("AlloyAtom","label");return new Un(n,t)}}const qn=[{name:"VisualObject",value:En},{name:"Shape",value:Ln},{name:"Grid",value:class extends En{constructor(e){super(e.grid_location),this.config=e;let t=yn({x:0,y:0},this.config.grid_location);this.center=()=>{const e=t();return{x:e.x+this.config.grid_dimensions.x_size*this.config.cell_size.x_size/2,y:e.y+this.config.grid_dimensions.y_size*this.config.cell_size.y_size/2}},this.coords=()=>{const e=this.center();return{x:e.x-this.config.grid_dimensions.x_size*this.config.cell_size.x_size/2,y:e.y-this.config.grid_dimensions.y_size*this.config.cell_size.y_size/2}},this.cells=new Array(this.config.grid_dimensions.y_size).fill([]);for(var n=0;nthis.config.cell_size.y_size)throw`Proposed object to add is taller than grid cells. Add "true" as the last parameter to\n grid.add() to hide this error.\n Grid cells are ${this.config.cell_size.y_size}\n units tall, while the object you want to add is ${n} units tall`;if(t>this.config.cell_size.x_size)throw`Proposed object to add is wider than grid cells. Add "true" as the last parameter to\n grid.add() to hide this error.\n Grid cells are ${this.config.cell_size.x_size}\n units tall, while the object you want to add is ${t} units tall`}add(e,t,n){if(!(t instanceof En))throw new Error("Grid can only add VisualObjects as children.");this.check_coords(e),n||this.check_bounding_box(t.boundingBox()),this.children.push(t),t.center=this.center_helper(e,t.origin_offset),this.cells[e.y][e.x]=t}center_helper(e,t){return()=>{let n=t();const r=this.coords();return{x:r.x+this.config.cell_size.x_size*(e.x+.5)+n.x,y:r.y+this.config.cell_size.y_size*(e.y+.5)+n.y}}}fill_grid_lines(){for(let e=0;e<=this.config.grid_dimensions.y_size;e++){const t=new Rn({points:[()=>{const t=this.coords();return{x:t.x,y:t.y+e*this.config.cell_size.y_size}},()=>{const t=this.coords();return{x:t.x+this.config.grid_dimensions.x_size*this.config.cell_size.x_size,y:t.y+e*this.config.cell_size.y_size}}]});this.gridlines.push(t),this.children.push(t)}for(let e=0;e<=this.config.grid_dimensions.x_size;e++){const t=new Rn({points:[()=>{const t=this.coords();return{x:t.x+e*this.config.cell_size.x_size,y:t.y}},()=>{const t=this.coords();return{x:t.x+e*this.config.cell_size.x_size,y:t.y+this.config.grid_dimensions.y_size*this.config.cell_size.y_size}}]});this.gridlines.push(t),this.children.push(t)}}hide_grid_lines(){this.gridlines.forEach((e=>{e.setOpacity(0)}))}fill(e,t){this.check_coords(e);const n=new Tn({height:this.config.cell_size.x_size,width:this.config.cell_size.y_size});n.setColor(t),this.add(e,n)}check_coords(e){if(!Number.isInteger(e.x)||!Number.isInteger(e.y))throw`non-integer indices given for grid coords. Inputted coords: ${e.x},${e.y}`;if(e.x<0||e.y<0)throw"negative indices given for grid coords";if(e.x>this.config.grid_dimensions.x_size-1||e.y>this.config.grid_dimensions.y_size-1)throw`coordinates out of bounds. Grid is of x_size ${this.config.grid_dimensions.x_size} and y_size ${this.config.grid_dimensions.y_size}\n\n Note: passing in 2 refers to index 2 which is the third element of the grid`}childAt(e,t){if(void 0!==this.cells[e]&&void 0!==this.cells[e][t])return this.cells[e][t]}}},{name:"Rectangle",value:Tn},{name:"Circle",value:Pn},{name:"Stage",value:class{constructor(){this.Children=[],this.masks=[]}add(e){if(!(e instanceof En))throw new Error("Stage can only add VisualObjects as children.");this.Children.push(e)}addAll(e){e.forEach((e=>{this.Children.push(e)}))}remove(e){this.Children=this.Children.filter((t=>t!==e))}addMask(e){this.masks.push(e)}childrenToTreeRecurse(e){const t=e.constructor.name,n={visualObject:new _n({text:t}),children:[]};return 0==e.getChildren().length||e.children.forEach((e=>{n.children.push(this.childrenToTreeRecurse(e))})),n}render(e,t){if(Dn.Ys(e).selectAll("*").remove(),this.Children.forEach((t=>t.render(e,this.masks))),t){const e=t.getElementById("svg-container");e.getElementsByTagName("svg")[0].style.height="200%",e.getElementsByTagName("svg")[0].style.width="200%"}}}},{name:"TextBox",value:_n},{name:"Line",value:Rn},{name:"Polygon",value:class extends Ln{constructor(e){let t=e.points.map((e=>yn({x:0,y:0},e)));e.center=()=>vn(t.map((e=>e()))),super(e),this.pointsRelative=jn(t,this.center)}boundingBox(){return Sn(this.pointsRelative.map((e=>({x:e().x+this.center().x,y:e().y+this.center().y}))))}render(e,t){let n,r="";n=t?this.masks.concat(t):this.masks;let o=this.pointsRelative.map((e=>({x:e().x+this.center().x,y:e().y+this.center().y}))),s=Dn.ETc();s.moveTo(o[0].x,o[0].y),o.forEach((e=>{s.lineTo(e.x,e.y)})),s.closePath(),r=this.addMaskRender(n,e),Dn.Ys(e).append("path").attr("d",s.toString()).attr("stroke-width",this.borderWidth).attr("stroke",this.borderColor).attr("fill",this.color).attr("mask",n.length>0?`url(#${r})`:"").attr("opacity",this.opacity()),super.render(e,n)}}},{name:"Tree",value:$n},{name:"Edge",value:class extends En{constructor(e){var t,n,r,o;super(),this.obj1=e.obj1,this.obj2=e.obj2,this.textProps=null!==(t=e.textProps)&&void 0!==t?t:{},this.lineProps=null!==(n=e.lineProps)&&void 0!==n?n:{points:[]},this.textLocation=null!==(r=e.textLocation)&&void 0!==r?r:"none",this.obj1CoordsStore={x:0,y:0},this.obj2CoordsStore={x:0,y:0},this.fast_imprecise=null!==(o=e.fast_imprecise)&&void 0!==o&&o,this.obj1Coords=()=>({x:0,y:0}),this.obj2Coords=()=>({x:0,y:0}),this.compute_points(30),this.makeLine(),this.makeText()}compute_points(e){const t=In(this.obj1.center(),this.obj2.center());this.obj2Coords=()=>this.opt_points(t,this.obj2,e,"obj1"),this.obj1Coords=()=>this.opt_points(t,this.obj1,e,"obj2")}opt_points(e,t,n,r){if(this.fast_imprecise){let e;if("obj1"==r)e=this.obj1CoordsStore;else{if("obj2"!=r)throw"bad arg for coordsstore";e=this.obj1CoordsStore}if(e.xt.boundingBox().top_left.x&&e.y>t.boundingBox().bottom_right.y&&e.y{Cn(t,e)function(e,t){if(e.x==t.x)return 90;{let n=(e.y-t.y)/(e.x-t.x);return Math.atan(n)}}(this.obj1Coords(),this.obj2Coords()),n=()=>Math.sqrt(Math.pow(e.fontSize(),2)+Math.pow(.14*e.text().length*e.fontSize(),2)),r=()=>{const e=this.arcMidpoint();return void 0!==e?e:In(this.obj1Coords(),this.obj2Coords())};switch(this.textLocation){case"above":e.setCenter((()=>({x:r().x+Math.cos(t()-Math.PI/2)*n(),y:r().y+Math.sin(t()-Math.PI/2)*n()})));break;case"below":e.setCenter((()=>({x:r().x+Math.cos(t()+Math.PI/2)*n(),y:r().y+Math.sin(t()+Math.PI/2)*n()})));break;case"left":e.setCenter((()=>t()<=0?{x:r().x+Math.cos(t()-Math.PI/2)*n(),y:r().y+Math.sin(t()-Math.PI/2)*n()}:{x:r().x+Math.cos(t()+Math.PI/2)*n(),y:r().y+Math.sin(t()+Math.PI/2)*n()}));break;case"right":e.setCenter((()=>t()<=0?{x:r().x+Math.cos(t()+Math.PI/2)*n(),y:r().y+Math.sin(t()+Math.PI/2)*n()}:{x:r().x+Math.cos(t()-Math.PI/2)*n(),y:r().y+Math.sin(t()-Math.PI/2)*n()}));break;case"clockwise":e.setCenter((()=>{let e=Mn({x:this.obj2Coords().x-this.obj1Coords().x,y:this.obj2Coords().y-this.obj1Coords().y});return{x:r().x-e.y*n(),y:r().y+e.x*n()}}));break;case"counterclockwise":e.setCenter((()=>{let e=Mn({x:this.obj2Coords().x-this.obj1Coords().x,y:this.obj2Coords().y-this.obj1Coords().y});return{x:r().x+e.y*n(),y:r().y-e.x*n()}}));break;default:console.log(`default text position: midpoint of line or arc: at ${JSON.stringify(r())}`),e.setCenter((()=>({x:r().x,y:r().y})))}this.children.push(e)}arcMidpoint(){if(!this.lineProps)return;const e=this.lineProps.curve instanceof Function?this.lineProps.curve():this.lineProps.curve;if(e){if("arc"===e.curveType){const t=function({x1:e,y1:t,rx:n,ry:r,phi:o,fA:s,fS:i,x2:a,y2:l}){let c,d,p,u,h;const m=2*Math.PI;if(0==n||0==r)throw Error("rx and ry can not be 0");n<0&&(n=-n),r<0&&(r=-r);const g=Math.sin(o),x=Math.cos(o),f=(e-a)/2,b=(t-l)/2,y=(e+a)/2,w=(t+l)/2,v=x*f+g*b,j=x*b-g*f,S=v*v/(n*n)+j*j/(r*r);S>1&&(n*=Math.sqrt(S),r*=Math.sqrt(S));var A=n*r,C=n*j,M=r*v,I=C*C+M*M;if(!I)throw Error("start point can not be same as end point");var O=Math.sqrt(Math.abs((A*A-I)/I));s==i&&(O=-O);var k=O*C/r,N=-O*M/n;c=x*k-g*N+y,d=g*k+x*N+w;var D=(v-k)/n,z=(v+k)/n,E=(j-N)/r,_=(j+N)/r;for(p=Nn(1,0,D,E),u=Nn(D,E,-z,-_);u>m;)u-=m;for(;u<0;)u+=m;for(0==i&&(u-=m),h=p+u;h>m;)h-=m;for(;h<0;)h+=m;return{cx:c,cy:d,startAngle:p,deltaAngle:u,endAngle:h,clockwise:1==i,rx:n,ry:r}}({x1:this.obj1Coords().x,y1:this.obj1Coords().y,rx:e.xradius,ry:e.yradius,phi:0,fA:!1,fS:1===e.sweep,x2:this.obj2Coords().x,y2:this.obj2Coords().y}),n=0===e.sweep;return{x:t.cx,y:n?t.cy+t.ry:t.cy-t.ry}}throw console.log(`unsupported curve type: ${e.curveType}`),new Error(`unsupported curve type: ${e.curveType}`)}}}},{name:"Hull",value:class extends En{constructor(e){var t,n;super(),this.fuzz=null!==(t=e.fuzz)&&void 0!==t?t:0,this.smooth=null!==(n=e.smooth)&&void 0!==n&&n,this.pts=function(e){let t=[],n=new Set;t.push(function(e){return e.sort(((e,t)=>e.x>t.x?1:t.x>e.x?-1:0))[0]}(e));let r=0;for(;0==r||t[r].x!=t[0].x||t[r].y!=t[0].y;){let o;0==r?o={x:0,y:1}:(o={x:t[r].x-t[r-1].x,y:t[r].y-t[r-1].y},n.add({x:t[r].x,y:t[r].y}));let s={x:0,y:0},i=2*Math.PI;e.forEach((e=>{if(!n.has({x:e.x,y:e.y})){let n={x:e.x-t[r].x,y:e.y-t[r].y},a=kn(o,n);(a{t.push({x:e.center().x,y:e.center().y})})):this.smooth?e.forEach((e=>{An(new Pn({radius:this.fuzz,center:e.center()}).getLam(),100).forEach((e=>t.push(e)))})):e.forEach((e=>{const n=new Tn({height:this.fuzz,width:this.fuzz});n.setCenter(e.center()),An(n.getLam(),100).forEach((e=>t.push(e)))})),t}render(e,t){let n;n=t?this.masks.concat(t):this.masks,new Rn({points:this.pts}).render(e,n)}}},{name:"ConjoinedObject",value:class extends En{constructor(e){super({x:0,y:0}),this.children=[],e&&e.forEach((e=>{this.add(e)}))}addOrdered(e,t){if(!(e instanceof En))throw new Error("ConjoinedObject can only add VisualObjects as children.");if(t>this.children.length)throw`Index larger than current number of objects stored plus 1. Add an index between 0 and ${this.children.length}`;this.children.splice(t,0,e)}add(e){this.addOrdered(e,0)}setCenter(e){this.children.forEach((t=>{t.setCenter(e)}))}}},{name:"boxUnion",value:wn},{name:"Ellipse",value:class extends Ln{constructor(e){super(e),this.height=yn(0,e.height),this.width=yn(0,e.width);let t=yn({x:0,y:0},e.coords);this.center=()=>{const e=t();return{x:e.x+this.width()/2,y:e.y+this.height()/2}}}boundingBox(){return{top_left:{x:this.center().x-this.width()/2,y:this.center().y-this.height()/2},bottom_right:{x:this.center().x+this.width()/2,y:this.center().y+this.height()/2}}}setWidth(e){this.width=yn(this.width(),e)}setHeight(e){this.height=yn(this.height(),e)}render(e,t){let n,r="";n=t?this.masks.concat(t):this.masks,r=this.addMaskRender(n,e),Dn.Ys(e).append("ellipse").attr("cx",this.center().x-this.width()/2).attr("cy",this.center().y-this.height()/2).attr("rx",this.width()).attr("ry",this.height()).attr("stroke-width",this.borderWidth()).attr("stroke",this.borderColor()).attr("fill",this.color()).attr("mask",n.length>0?`url(#${r})`:"").attr("opacity",this.opacity()),super.render(e,n)}}},{name:"ImageBox",value:class extends En{constructor(e){super(e.coords),this.url=yn("",e.url),this.width=yn(100,e.width),this.height=yn(100,e.height)}boundingBox(){return{top_left:{x:this.center().x-this.width()/2,y:this.center().y-this.height()/2},bottom_right:{x:this.center().x+this.width()/2,y:this.center().y+this.height()/2}}}render(e,t){let n,r="";n=t?this.masks.concat(t):this.masks,r=this.addMaskRender(n,e),Dn.Ys(e).append("svg:image").attr("x",this.center().x-this.width()/2).attr("y",this.center().y-this.height()/2).attr("width",this.width()).attr("height",this.height()).attr("mask",n.length>0?`url(#${r})`:"").attr("xlink:href",`${this.url()}`),super.render(e)}}},{name:"AlloySet",value:Zn},{name:"AlloyAtom",value:Un}];var Yn=n(25001);class Xn extends Zn{constructor(e,t,n){return super(),this._id=e,this._atoms=t,this._subsignatures=[],this._tuples=t.map((e=>new Wn([e]))),n?n.applyProxy(this,function(e){return e.replace(/^this\//,"").replace("/","$").replace("-","$")}(e)):this}atom(e){return this.atoms(!0).find((t=>t.id()===e))||null}atoms(e=!1){return e?this.atoms().concat(this.subSignatures().map((e=>e.atoms(!0))).reduce(((e,t)=>e.concat(t)),[])):this._atoms.slice()}tuples(){return this.atoms(!0).map((e=>new Wn([e])))}clone(e){const t=new Xn(this.id(),this.atoms().map((t=>t.clone(e))),e);return t._subsignatures=this.subSignatures().map((t=>t.clone(e))),t}id(){return this._id}subSignatures(e=!1){return e?this.subSignatures().concat(this.subSignatures().map((e=>e.subSignatures(!0))).reduce(((e,t)=>e.concat(t)),[])):this._subsignatures.slice()}static fromElement(e,t){const n=e.getAttribute("label");if(!n)throw Gn.missingAttribute("AlloySignature","label");const r=Array.from(e.querySelectorAll("atom")).map((e=>Un.fromElement(e,t)));return new Xn(n,r,t)}static intSignature(e,t){if(e<0)throw Gn.error("AlloySignature","Invalid bitwidth");const n=[];for(let r=Math.pow(2,e),o=-r/2;o{const n=e.getAttribute("ID"),o=e.getAttribute("label");if(!n)throw Gn.missingAttribute("AlloySignature","ID");const a=Xn.getParent(e);if(!a&&"univ"!==o)throw Gn.error("AlloySignature",`unable to resolve parent sig for non-univ sig ${o}`);const l="Int"===o||"seq/Int"===o?r:Xn.fromElement(e,t);return i.set(n,l),a&&"seq/Int"!==o&&(s.has(a)||s.set(a,[]),s.get(a).push(n)),l})),i.forEach(((e,t)=>{const n=s.get(t)||[];e._subsignatures=n.map((e=>i.get(e))).filter(Yn.$K)})),i}static getParent(e){const t=e.getAttribute("parentID"),n=e.getAttribute("label");if(!t&&"univ"!==n){const t=e.getElementsByTagName("type");if(1!==t.length)throw Gn.error("AlloySignature",`subset sig ${n} had no type or multiple types; this is unsupported`);if(t[0].getAttribute("ID"))return t[0].getAttribute("ID");throw Gn.missingAttribute("AlloySignature","type.ID")}return t}static typesFromXML(e,t){const n=e.querySelectorAll("types");if(!n)throw Gn.missingElement("AlloyField","types");return Array.from(n).map((e=>Xn.typesFromXMLSingle(e,t)))}static typesFromXMLSingle(e,t){return Array.from(e.querySelectorAll("type")).map((e=>{const n=e.getAttribute("ID");if(!n)throw Gn.missingAttribute("AlloyField","ID");const r=t.get(n);if(!r)throw Gn.error("Alloy Field",`No signature with ID: ${n}`);return r}))}}var Hn=n(44908),Jn=n.n(Hn);class Qn extends Zn{constructor(e,t){super(t),this._types=e}project(e){const t=Jn()(this.types().map((t=>t.map((t=>e.get(t))))).flat());t.some(Yn.$K)&&(this._tuples=this.tuples().filter((e=>e.atoms().every(((e,n)=>void 0===t[n]||t[n]===e)))).map((e=>new Wn(e.atoms().filter(((e,n)=>void 0===t[n]))))))}types(){return this._types.slice()}join(e){if(e instanceof Qn){const t=this.types().map((e=>e.at(-1))),n=e.types().map((e=>e.at(0)));if(!t.some((e=>n.includes(e))))throw Gn.error("Join",`Joining ${this} and ${e} will always be empty.`)}return super.join(e)}}class Kn extends Qn{constructor(e,t,n,r,o){return super(t,n),this._id=e,r?r.applyProxy(this,o?function(e){return e.replace(/-/g,"$").replace("/","$")}(o):e):this}clone(e,t){this.types().forEach((e=>{if(!this.types().every(Yn.$K))throw Gn.error("AlloyField","Missing type, cannot clone field")}));const n=this.tuples().map((e=>new Wn(e.atoms().map(((e,t)=>e.clone())))));if(t){const e=Reflect.get(this,"__var__");if(!e)throw Gn.error("AlloyField","Cannot use proxy to clone non-proxied field");return new Kn(this.id(),this.types(),n,t,e.toString())}return new Kn(this.id(),this.types(),n)}id(){return this._id}static fieldsFromXML(e,t,n){const r=Array.from(e.querySelectorAll("field")),o=new Map;return r.forEach((e=>{const t=e.getAttribute("label");if(!t)throw Gn.missingAttribute("AlloyField","label");o.set(t,(o.get(t)||0)+1)})),r.map((e=>{const r=e.getAttribute("label"),s=e.getAttribute("parentID"),i=Xn.typesFromXML(e,t);if(!r)throw Gn.missingAttribute("AlloyField","label");if(!s)throw Gn.missingAttribute("AlloyField","parentID");const a=o.get(r)||0,l=t.get(s);if(!l)throw Gn.error("AlloyField","Field parent type does not exist");const c=a>1?(d=r,p=l,`${Reflect.get(p,"__var__")}$${d}`):r;var d,p;const u=Wn.tuplesFromXML(e.querySelectorAll("tuple"),i);return new Kn(r,i,u,n,c)}))}}class er{constructor(){this._sets=new Map}applyProxy(e,t){const n=this._sets,r=t||`${n.size}`,o=this._finalize.bind(this);if(n.has(r))throw Gn.error("AlloyProxy",`Cannot apply proxy, ID already exists: ${r}. (This may be caused by a clash between sig and atom names.)`);const s=new Proxy(e,{get(e,r){if("symbol"==typeof r||r in e)return Reflect.get(e,r);if("number"!=typeof r&&isNaN(+r)){let s;const i=r.match(/\[(.*)]/);if(i){const r=n.get(i[1]);if(!r)throw Gn.error("Box Join",`Tried to join ${t} with ${i[1]} but no set ${i[1]} defined.`,!0);s=r.join(e)}else{const o=n.get(r);if(!o)throw Gn.error("Dot Join",`Tried to join ${t} with ${r} but no set ${r} defined.`,!0);s=e.join(o)}return o(s)}{const t=n.get(`${r}`);if(!t)throw Gn.error("Join",`Integer atom does not exist: ${r}`);return o(t.join(e))}}});return Reflect.set(s,Symbol.toPrimitive,(()=>`[${r}]`)),Reflect.set(s,"__var__",r),this._sets.set(r,s),s}_finalize(e){if(1===e.tuples().length&&1===e.tuples()[0].atoms().length){const t=e.tuples()[0].atoms()[0];return this._sets.get(t.id())||this.applyProxy(t,t.id())}return this.applyProxy(e)}}class tr extends Qn{constructor(e,t,n,r){return super(t,n),this._id=e,r?r.applyProxy(this,function(e){return e.replace(/^\$this\//,"$").replace("/","$").replace(/'/g,"$")}(e)):this}clone(e,t){const n=this.tuples().map((e=>new Wn(e.atoms().map(((e,t)=>e.clone())))));return new tr(this.id(),this.types(),n,t)}id(){return this._id}static skolemsFromXML(e,t,n){return Array.from(e.querySelectorAll("skolem")).map((e=>{const r=e.getAttribute("label"),o=Xn.typesFromXML(e,t),s=Wn.tuplesFromXML(e.querySelectorAll("tuple"),o);if(!r)throw Gn.missingAttribute("AlloySkolem","label");return new tr(r,o,s,n)}))}}class nr{constructor(e,t){this._proxy=new er,this._atoms=[],this._fields=[],this._signatures=[],this._skolems=[],this._projections=new Map,this._bitwidth=0,this._command="",this._filename="",this._sources=new Map,e&&this._buildFromXML(e,t)}atom(e){return this._atoms.find((t=>t.id()===e))||null}atoms(){return this._atoms.slice()}bitwidth(){return this._bitwidth}clone(){const e=new er,t=this.univ();if(!t)throw Gn.error("AlloyInstance","Cannot clone an instance without univ signature");const n=t.clone(e),r=[n,...n.subSignatures(!0)],o=n.atoms(!0),s=this.fields().map((t=>t.clone(r,e))),i=this.skolems().map((t=>t.clone(r,e))),a=new nr;return a._proxy=e,a._fields=s,a._signatures=r,a._atoms=o,a._skolems=i,a._bitwidth=this.bitwidth(),a._command=this.command(),a._filename=this.filename(),a}command(){return this._command}field(e){return this._fields.find((t=>t.id()===e))||null}fields(){return this._fields}filename(){return this._filename}project(e){const t=this.clone(),n=e.map((e=>t.atom(e.id())));if(!n.every(Yn.$K))throw Gn.error("AlloyInstance","Error cloning instance");const r=t.univ();if(!r)throw Gn.error("AlloyInstance","No univ signature");const o=r.subSignatures(),s=new Map;return n.forEach((e=>{o.forEach((t=>{if(t.atoms(!0).includes(e)){if(s.has(t))throw Gn.error("AlloyInstance","Cannot project over multiple atoms from the same signature");s.set(t,e)}}))})),this._projections=s,t.fields().forEach((e=>e.project(s))),t.skolems().forEach((e=>e.project(s))),t}projections(){return new Map(this._projections)}signature(e){return this.signatures().find((t=>t.id()===e))||null}signatures(){return this._signatures.slice()}skolem(e){return this.skolems().find((t=>t.id()===e))||null}skolems(){return this._skolems.slice()}sources(){return new Map(this._sources)}univ(){return this._signatures.find((e=>"univ"===e.id()))||null}_buildFromXML(e,t){const n=(new DOMParser).parseFromString(e,"application/xml"),r=n.querySelectorAll("instance"),o=void 0!==t?r[t]:r[0];if(!o)throw Gn.missingElement("AlloyInstance","instance");const s=o.getAttribute("bitwidth"),i=o.getAttribute("command"),a=o.getAttribute("filename"),l=o.getAttribute("maxseq");if(!s)throw Gn.missingAttribute("AlloyInstance","bitwidth");if(!i)throw Gn.missingAttribute("AlloyInstance","command");if(!a)throw Gn.missingAttribute("AlloyInstance","filename");if(!l)throw Gn.missingAttribute("AlloyInstance","maxseq");if(+s<1)throw Gn.error("AlloyInstance",`Invalid bitwidth ${s}`);this._bitwidth=+s,this._command=i,this._filename=a,this._atoms=[],this._fields=[],this._signatures=[],this._skolems=[];const c=Xn.signaturesFromXML(o,this._proxy);this._signatures=Array.from(c.values()),this._fields=Kn.fieldsFromXML(o,c,this._proxy),this._skolems=tr.skolemsFromXML(o,c,this._proxy),this._atoms=this._signatures.map((e=>e.atoms())).reduce(((e,t)=>e.concat(t)),[]),this._sources=new Map,Array.from(n.querySelectorAll("source")).forEach((e=>{const t=e.getAttribute("filename"),n=e.getAttribute("content");if(!t)throw Gn.missingAttribute("AlloyInstance","filename");if(!n)throw Gn.missingAttribute("AlloyInstance","content");this._sources.set(t,n)}))}}const rr="https://alloy-js.github.io/alloy-ts/classes/alloyinstance.alloyinstance-1.html",or=function(e){return e.stage},sr=function(e){return e.stageDimensions},ir=function(e){return e.text},ar=function(e,t,n){if(ft(e)){const r=e.data,o=e.parsed.instances.map(((e,t)=>new nr(r,t))),s=o[n],i=s.atoms(),a=[];t.forEach((e=>{const t=e.atom;if(t){const e=i.find((e=>e.id()===t));e&&a.push(e)}}));const l=s.project(a),c=l.signatures().map((e=>({name:Reflect.get(e,"__var__"),variable:e,type:"AlloySignature",typeUrl:"https://alloy-js.github.io/alloy-ts/classes/alloysignature.alloysignature-1.html"}))),d=l.atoms().filter((e=>isNaN(+e.id()))).map((e=>({name:Reflect.get(e,"__var__"),variable:e,type:"AlloyAtom",typeUrl:"https://alloy-js.github.io/alloy-ts/classes/alloyatom.alloyatom-1.html"}))),p=l.fields().map((e=>({name:Reflect.get(e,"__var__"),variable:e,type:"AlloyField",typeUrl:"https://alloy-js.github.io/alloy-ts/classes/alloyfield.alloyfield-1.html"}))),u=l.skolems().map((e=>({name:Reflect.get(e,"__var__"),variable:e,type:"AlloySkolem",typeUrl:"https://alloy-js.github.io/alloy-ts/classes/alloyskolem.alloyskolem-1.html"}))),h=qn.map((e=>({name:e.name,variable:e.value,type:"D3Helper",typeUrl:"https://csci1710.github.io/forge-documentation/sterling/d3fx.html"}))),m=[{name:"instance",variable:s,type:"AlloyInstance",typeUrl:rr},...c,...d,...p,...u,...h];return qt(e.parsed)&&m.unshift({name:"currentInstance",type:"number",variable:n},{name:"loopBack",type:"number",variable:e.parsed.loopBack},{name:"instances",variable:o,type:"AlloyInstance[]",typeUrl:rr}),m}return function(e){return"raw"===e.format}(e)?[{name:"data",variable:e.data,type:"string"}]:[]};function lr(e){return e.mainView}function cr(e){return e.graphViewDrawer}function dr(e){return e.tableViewDrawer}function pr(e){return e.scriptViewDrawer}const ur={selectAvailableViews:function(e){return e.availableViews},selectMainView:lr,selectGraphDrawer:cr,selectTableDrawer:dr,selectScriptDrawer:pr,selectDrawerIsCollapsed:(0,tn.P1)([lr,cr,dr,pr],((e,t,n,r)=>{switch(e){case"GraphView":return null===t;case"TableView":return null===n;case"ScriptView":return null===r;default:return!0}})),selectDrawerView:(0,tn.P1)([lr,cr,dr,pr],((e,t,n,r)=>{switch(e){case"GraphView":return t;case"TableView":return n;case"ScriptView":return r;default:return null}})),selectSelectedGenerator:function(e){return e.selectedGenerator}};function hr(e){return an.selectActiveDatum(e.data)}function mr(e){return ur.selectSelectedGenerator(e.ui)}function gr(e){return ur.selectAvailableViews(e.ui)}function xr(e){return an.selectData(e.data)}function fr(e,t){return ft(t)&&qt(t.parsed)}function br(e){return ur.selectDrawerIsCollapsed(e.ui)}function yr(e){return ur.selectDrawerView(e.ui)}function wr(e){return ur.selectGraphDrawer(e.ui)}function vr(e){const t=hr(e);return void 0!==t&&!0===t.evaluator}function jr(e,t){return ln(e.evaluator,t)}function Sr(e){return gn(e.provider)}function Ar(e){return mn(e.log)}function Cr(e){return ur.selectMainView(e.ui)}function Mr(e){return cn(e.evaluator)}function Ir(e,t){const n={};if(t&&ft(t)){const e=t.parsed.instances[0];(function(e){return(0,Yt.Z)(dt(e).map(Xe)).filter((e=>!(0,Wt.Z)(e)))})(e).forEach((t=>{const r=ct(e,t);n[t]=function(e,t){return it(e).filter((n=>function(e,t,n){return"string"==typeof t&&(t=st(e,t)),"string"!=typeof n&&(n=n.id),tt(e,t).types.includes(n)}(e,n,t)))}(e,r).map((e=>e.id))}))}return n}function Or(e,t){return hn.selectProjections(e.graphs,t)}function kr(e){return xn(e.provider)}function Nr(e){return fn(e.provider)}function Dr(e){return ur.selectScriptDrawer(e.ui)}function zr(e){return or(e.script)}function Er(e){return sr(e.script)}function _r(e){return ir(e.script)}function Lr(e){return ur.selectTableDrawer(e.ui)}function Tr(e,t){return hn.selectTimeIndex(e.graphs,t)}function Pr(e,t){return ft(t)&&qt(t.parsed)?t.parsed.instances.length:1}(0,tn.P1)([(e,t)=>t,(e,t)=>t?function(e,t){return hn.selectGraphLayout(e.graphs,t)}(e,t):void 0,(e,t)=>t?function(e,t){return hn.selectTheme(e.graphs,t)}(e,t):void 0,(e,t)=>t?Tr(e,t):void 0,(e,t)=>t?function(e,t){return hn.selectHiddenRelations(e.graphs,t)}(e,t):void 0],((e,t,n,r,o)=>{if(e&&t&&n&&void 0!==r&&ft(e)&&o){const s=e.parsed.instances[r],i=n.projections||[],a=i.filter((e=>!0===e.time)),l=Xt(s,i.map((e=>e.atom)).filter(qe)),c=Lt(l,n);if(a.length)return a.map((e=>{let r=c;o[e.type]&&o[e.type].forEach((e=>{const t=G(r).filter((t=>t.relation.name===e)).map((e=>e.id));r=function(e,t){return(0,At.Uy)(e,(e=>{t.forEach((t=>{const n=F(e,t);n&&function(e,t){const{id:n,source:r,target:o}=t;delete e.edges[n],function(e,t,n,r){const o=e.predecessors[n][t];if(o){const s=o.indexOf(r);-1!==s&&o.splice(s,1),0===o.length&&delete e.predecessors[n][t]}}(e,r,o,n),function(e,t,n,r){const o=e.successors[t][n];if(o){const s=o.indexOf(r);-1!==s&&o.splice(s,1),0===o.length&&delete e.successors[t][n]}}(e,r,o,n),function(e,t,n){const r=e.inedges[t].indexOf(n);-1!==r&&e.inedges[t].splice(r,1)}(e,o,n),function(e,t,n){const r=e.outedges[t].indexOf(n);-1!==r&&e.outedges[t].splice(r,1)}(e,r,n)}(e,n)}))}))}(c,t)}));const s=Ut(r,t);return Bt("",l,s,n)}));const d=Ut(c,t);return[Bt("",l,d,n)]}return console.log(`datum: ${void 0!==e}`),console.log(`layout: ${void 0!==t}`),console.log(`theme: ${void 0!==n}`),console.log(`time: ${r}`),[]}));const Br=(0,tn.P1)([(e,t)=>t,(e,t)=>Or(e,t),(e,t)=>Tr(e,t)],((e,t,n)=>ar(e,t,n))),Rr=(0,tn.P1)([(e,t)=>t,(e,t)=>Tr(e,t)],((e,t)=>{if(ft(e)){const n=e.parsed.instances[t],r=function(e){const t=lt(e),n=at(e);return t.concat(n)}(n).map((e=>({title:e.name,type:"relation",headers:e.types,data:rt(e).map((e=>e.atoms))})));return[...r,...dt(n).map((e=>({title:e.id,type:"type",data:He(e).map((e=>[e.id]))})))]}return[]}));function $r(e,t){return hn.selectCnDSpec(e.graphs,t)}function Vr(e,t){return hn.selectSelectedProjections(e.graphs,t)}function Fr(e,t){return hn.selectSelectedTimeIndices(e.graphs,t)}function Gr(e){return bn(e.provider)}function Zr(e){return e.synthesis.isActive}function Wr(e){return e.synthesis.selectorType}function Ur(e){return e.synthesis.currentStep}function qr(e){return e.synthesis.numInstances}function Yr(e){return e.synthesis.examples}function Xr(e){return e.synthesis.loadedInstances}function Hr(e){return e.synthesis.result}function Jr(e){return e.synthesis.error}function Qr(e){return e.synthesis.isLoading}function Kr(e){return!e.synthesis.isLoading&&e.synthesis.examples.length===e.synthesis.numInstances&&e.synthesis.examples.every((e=>e.selectedAtomIds.length>0||e.selectedPairs.length>0))}function eo(e){return e.synthesis.currentDataInstance}var to=n(10894),no=n(66653);const ro=e=>{const{expression:t}=e;return(0,r.jsxs)("div",Object.assign({className:"relative p-2 font-mono text-xs"},{children:[(0,r.jsxs)("div",Object.assign({className:"relative flex ml-6"},{children:[(0,r.jsx)("span",Object.assign({className:"absolute inset-y-0 -left-5"},{children:(0,r.jsx)(to.JO,{as:no.tOB})})),(0,r.jsx)("div",Object.assign({className:"font-semibold select-text"},{children:t.expression}))]})),(0,r.jsx)("div",Object.assign({className:"ml-6 text-gray-600 select-text"},{children:t.result}))]}))},oo=e=>{const{datum:t}=e,n=St((e=>jr(e,t)));return(0,r.jsx)("div",Object.assign({className:"absolute inset-x-0 top-[35px] bottom-0 flex flex-col overflow-y-auto"},{children:n.map((e=>(0,r.jsx)(ro,{expression:e},e.id)))}))},so=e=>{const{datum:t}=e,[n,s]=(0,o.useState)(""),[i,a]=(0,o.useState)(null),l=St(vr),c=St(Mr),d=St((e=>jr(e,t))),p=jt(),u=(0,o.useCallback)((e=>{a(null),s(e.target.value)}),[]),h=(0,o.useCallback)((e=>{var t;if(!(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||(t=e.code,io.includes(t))))switch(e.code){case"ArrowUp":null===i?d.length>0&&a(0):i{e.preventDefault(),n.length>0&&(p(Te({id:`${c}`,datumId:t.id,expression:n})),s(""),a(null))}),[t,c,n]),g=l?"gray.500":"gray.300",x=l?"Enter an expression...":"Evaluator disabled";return(0,r.jsx)("div",Object.assign({className:"absolute inset-x-0 top-0 h-[35px]"},{children:(0,r.jsxs)("form",Object.assign({className:"relative block font-mono",onSubmit:m},{children:[(0,r.jsx)("span",Object.assign({className:"sr-only"},{children:"Search"})),(0,r.jsx)("span",Object.assign({className:"absolute inset-y-0 left-0 flex items-center pl-2"},{children:(0,r.jsx)(to.JO,{color:g,as:no.tOB})})),(0,r.jsx)("input",{className:"h-[35px] text-xs placeholder:italic placeholder:text-gray-400 placeholder:text-xs block bg-white w-full border-b border-gray-100 focus:border-gray-200 py-2 pl-9 pr-3 focus:outline-none",placeholder:x,type:"text",disabled:!l,value:null===i?n:d[i].expression,onChange:u,onKeyDown:h})]}))}))},io=["Unidentified","Escape","Enter","ControlLeft","ControlRight","ShiftLeft","ShiftRight","AltLeft","AltRight","CapsLock","OSLeft","OSRight","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","ScrollLock","ArrowLeft","ArrowRight"],ao=()=>{const e=St(hr);return e?(0,r.jsxs)("div",Object.assign({className:"absolute inset-0"},{children:[(0,r.jsx)(so,{datum:e}),(0,r.jsx)(oo,{datum:e})]})):null},lo=()=>(0,r.jsxs)("div",Object.assign({className:"flex items-center px-2 space-x-2"},{children:[(0,r.jsx)(to.JO,{as:no.RJr}),(0,r.jsx)(k,{children:"Evaluator"})]})),co=()=>{const e=St(Ar);return(0,r.jsx)(b,Object.assign({h:"full",px:2,py:1,overflowY:"auto"},{children:e.map(((e,t)=>(0,r.jsx)(B,{text:e.text,time:new Date(e.time),variant:e.type},t)))}))},po=()=>(0,r.jsxs)("div",Object.assign({className:"flex items-center px-2 space-x-2"},{children:[(0,r.jsx)(to.JO,{className:"mt-0.5",as:no.t75}),(0,r.jsx)(k,{children:"Log"})]}));var uo=n(89583),ho=n(57324),mo=n(51649),go=n(48707),xo=n(41947),fo=n(18124);const bo={nodeWidth:100,nodeHeight:60,nodeSep:100,rankSep:100},yo={hidden:{builtinDisconnected:!0},nodes:[{shape:{shape:"rectangle",width:100,height:60},styles:{node:{stroke:"#333",strokeWidth:1,fill:"#ffffff"},label:{fontFamily:"monospace",fontSize:"14px",textAnchor:"middle",userSelect:"none",fill:"#333"}},props:{label:{dy:"0.33em"}},targets:["*"]}],edges:[{asAttribute:!1,sourceIndex:0,curve:{type:"bspline"},styles:{edge:{stroke:"#333",strokeWidth:1,fill:"none"},label:{fontFamily:"monospace",fontSize:"12px",textAnchor:"middle",userSelect:"none"}},targets:["*"]}]};function wo(e,t){var n;return null===(n=e.edges)||void 0===n?void 0:n.find((e=>{const n=e.targets,r=n?n[0]:void 0;return void 0!==n&&1===n.length&&void 0!==r&&"*"!==r&&r.relation===t}))}function vo(e,t){var n;return null===(n=e.nodes)||void 0===n?void 0:n.find((e=>{const n=e.targets,r=n?n[0]:void 0;return void 0!==n&&1===n.length&&void 0!==r&&"*"!==r&&r.type===t}))}function jo(e,t){var n;if(ft(t)){const r=e.themeByGeneratorName[null!==(n=t.generatorName)&&void 0!==n?n:""],o=r&&r.projections||[];if(o){const e=t.parsed.instances[0];o.forEach((t=>{if(!t.atom){const n=t.type,r=He(ct(e,n));r.length&&(t.atom=r[0].id)}}))}const s=dn(o),i=t.parsed.instances,a=o.map((e=>e.atom)).filter(qe),l=i.map((e=>Xt(e,a))).map((e=>Lt(e,r)));e.layoutsByDatumId[t.id].layoutById[s]=function(e,t){const n=new Set,r={};e.forEach((e=>{V(e).forEach((e=>{n.add(e.id)})),G(e).forEach((e=>{r[e.id]=e}))}));const o=new(Vt().graphlib.Graph)({multigraph:!0});o.setGraph({nodesep:t.nodeSep,ranksep:t.rankSep,rankdir:"TB"}),n.forEach((e=>{o.setNode(e,{label:e,width:t.nodeWidth,height:t.nodeHeight})})),(0,Ft.Z)(r,((e,t)=>{o.setEdge(e.source,e.target,{id:t})})),Vt().layout(o);const s=function(e,t){const n=e.nodes().map((t=>e.node(t).x)),r=e.nodes().map((t=>e.node(t).y)),o=(0,Gt.Z)(n),s=(0,Gt.Z)(r),i=(0,Zt.Z)(n),a=(0,Zt.Z)(r);return{x:(0,Wt.Z)(o)||(0,Wt.Z)(i)?0:(i-o)/2+t.nodeWidth/2,y:(0,Wt.Z)(s)||(0,Wt.Z)(a)?0:(a-s)/2+t.nodeHeight/2}}(o,t),i={},a={};return o.nodes().forEach((e=>{const{x:t,y:n}=o.node(e);i[e]={x:t-s.x,y:n-s.y}})),o.edges().forEach((e=>{const{id:t,points:n}=o.edge(e);a[t]=n.slice(1,-1).map((e=>({x:e.x-s.x,y:e.y-s.y})))})),{nodePositions:i,edgeWaypoints:a}}(l,bo)}}const So={asAttributeSet:function(e,t){var n;const{datum:r,relation:o,asAttribute:s}=t.payload,i=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""];if(i){const e=wo(i,o);if(e)s?(0,go.Z)(e,["asAttribute"],!0):(0,xo.Z)(e,["asAttribute"]);else if(s){const e={targets:[{relation:o}],asAttribute:!0};i.edges||(i.edges=[]),i.edges.push((0,At.cA)(e))}}},cndSpecSet:function(e,t){var n;const{datum:r,spec:o}=t.payload,s=null!==(n=r.generatorName)&&void 0!==n?n:"";e.cndSpecByGeneratorName[s]=o},curveRemoved:function(e,t){var n;const{datum:r,relation:o}=t.payload,s=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""];if(s){const e=wo(s,o);e&&(0,xo.Z)(e,["curve"])}},curveSet:function(e,t){var n;const{datum:r,relation:o,curve:s}=t.payload,i=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""];if(i){const e=wo(i,o);if(e)(0,go.Z)(e,["curve"],s);else{const e={targets:[{relation:o}],curve:s};i.edges||(i.edges=[]),i.edges.push((0,At.cA)(e))}}},edgeLabelStyleRemoved:function(e,t){var n;const{datum:r,relation:o,style:s}=t.payload,i=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""];if(i){const e=wo(i,o);e&&(0,xo.Z)(e,["styles","label",s])}},edgeLabelStyleSet:function(e,t){var n;const{datum:r,relation:o,style:s,value:i}=t.payload,a=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""];if(a){const e=wo(a,o);if(e)(0,go.Z)(e,["styles","label",s],i);else{const e={targets:[{relation:o}],styles:{label:{[s]:i}}};a.edges||(a.edges=[]),a.edges.push((0,At.cA)(e))}}},edgeStyleRemoved:function(e,t){var n;const{datum:r,relation:o,style:s}=t.payload,i=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""];if(i){const e=wo(i,o);e&&(0,xo.Z)(e,["styles","edge",s])}},edgeStyleSet:function(e,t){var n;const{datum:r,relation:o,style:s,value:i}=t.payload,a=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""];if(a){const e=wo(a,o);if(e)(0,go.Z)(e,["styles","edge",s],i);else{const e={targets:[{relation:o}],styles:{edge:{[s]:i}}};a.edges||(a.edges=[]),a.edges.push((0,At.cA)(e))}}},edgeIndexSet:function(e,t){var n;const{datum:r,relation:o,which:s,value:i}=t.payload,a=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""];if(a){const t=wo(a,o);if(t)(0,go.Z)(t,[s],i);else{const e={targets:[{relation:o}]};e[s]=i,a.edges||(a.edges=[]),a.edges.push((0,At.cA)(e))}jo(e,r)}},edgeIndexRemoved:function(e,t){var n;const{datum:r,relation:o,which:s}=t.payload,i=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""];if(i){const e=wo(i,o);e&&(0,xo.Z)(e,[s])}},graphSpread:function(e,t){const{datum:n,matrix:r}=t.payload,o=e.matricesByDatumId[n.id];o&&(o.spreadMatrix=r)},graphZoomed:function(e,t){const{datum:n,matrix:r}=t.payload,o=e.matricesByDatumId[n.id];o&&(o.zoomMatrix=r)},hiddenRelationAdded:function(e,t){const{datum:n,type:r,relation:o}=t.payload;e.hiddenByDatumId[n.id][r]||(e.hiddenByDatumId[n.id][r]=[]),e.hiddenByDatumId[n.id][r].push(o)},nodeLabelPropRemoved:function(e,t){var n;const{datum:r,type:o,prop:s}=t.payload,i=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""];if(i){const e=vo(i,o);e&&(0,xo.Z)(e,["props","label",s])}},nodeLabelPropSet:function(e,t){var n;const{datum:r,type:o,prop:s,value:i}=t.payload,a=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""];if(a){const e=vo(a,o);if(e)(0,go.Z)(e,["props","label",s],i);else{const e={targets:[{type:o}],props:{label:{[s]:i}}};a.nodes||(a.nodes=[]),a.nodes.push((0,At.cA)(e))}}},nodeLabelStyleRemoved:function(e,t){var n;const{datum:r,type:o,style:s}=t.payload,i=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""];if(i){const e=vo(i,o);e&&(0,xo.Z)(e,["styles","label",s])}},nodeLabelStyleSet:function(e,t){var n;const{datum:r,type:o,style:s,value:i}=t.payload,a=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""];if(a){const e=vo(a,o);if(e)(0,go.Z)(e,["styles","label",s],i);else{const e={targets:[{type:o}],styles:{label:{[s]:i}}};a.nodes||(a.nodes=[]),a.nodes.push((0,At.cA)(e))}}},nodesOffset:function(e,t){var n;const{datum:r,offsets:o}=t.payload,s=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""],i=dn(s&&s.projections||[]),a=e.layoutsByDatumId[r.id].layoutById[i];(0,Ft.Z)(o,((e,t)=>{const n=a.nodePositions[t];a.nodePositions[t]=ae(n,e)}))},projectionAdded:function(e,t){var n;const{datum:r,type:o,atom:s,time:i,timeOrdering:a}=t.payload,l={type:o,atom:s,time:i,timeOrdering:a},c=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""];c.projections?c.projections.push((0,At.cA)(l)):c.projections=[(0,At.cA)(l)],jo(e,r)},projectionAtomToggled:function(e,t){var n;const{datum:r,projectionType:o,atomId:s}=t.payload,i=null!==(n=r.generatorName)&&void 0!==n?n:"";e.selectedProjectionsByGeneratorName[i]||(e.selectedProjectionsByGeneratorName[i]={}),e.selectedProjectionsByGeneratorName[i][o]||(e.selectedProjectionsByGeneratorName[i][o]=[]);const a=e.selectedProjectionsByGeneratorName[i][o],l=a.indexOf(s);-1===l?a.push(s):a.splice(l,1)},projectionOrderingSet:function(e,t){var n;const{datum:r,type:o,relation:s}=t.payload,i=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""],a=(i&&i.projections||[]).find((e=>e.type===o));a&&(s?a.timeOrdering=s:delete a.timeOrdering)},projectionRemoved:function(e,t){var n;const{datum:r,type:o}=t.payload,s=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""];s.projections&&(0,fo.Z)(s.projections,(e=>e.type===o)),jo(e,r)},projectionSet:function(e,t){var n;const{datum:r,type:o,atom:s}=t.payload,i=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""],a=(i&&i.projections||[]).find((e=>e.type===o));a&&(a.atom=s),jo(e,r)},saveThemeRequested:function(e,t){var n;const{datum:r}=t.payload,o=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""];if(o){const e=(0,At.Vk)(o),t=(0,At.Uy)(e,(e=>{var t;null===(t=e.projections)||void 0===t||t.forEach((e=>{(0,xo.Z)(e,"atom")}))})),n=JSON.stringify(t,null,2),r=document.createElement("a"),s=new Blob([n],{type:"application/json"});r.href=URL.createObjectURL(s),r.download="theme.json",r.click()}},selectedProjectionsSet:function(e,t){var n;const{datum:r,projectionType:o,selectedAtoms:s}=t.payload,i=null!==(n=r.generatorName)&&void 0!==n?n:"";e.selectedProjectionsByGeneratorName[i]||(e.selectedProjectionsByGeneratorName[i]={}),e.selectedProjectionsByGeneratorName[i][o]=s},selectedTimeIndicesSet:function(e,t){const{datum:n,selectedIndices:r}=t.payload;e.selectedTimeIndicesByDatumId[n.id]=r},shapeRemoved:function(e,t){var n;const{datum:r,type:o}=t.payload,s=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""];if(s){const e=vo(s,o);e&&(0,xo.Z)(e,["shape"])}},shapeSet:function(e,t){var n;const{datum:r,type:o,shape:s}=t.payload,i=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""];if(i){const e=vo(i,o);if(e)(0,go.Z)(e,["shape"],s);else{const e={targets:[{type:o}],shape:s};i.nodes||(i.nodes=[]),i.nodes.push((0,At.cA)(e))}}},shapeStyleRemoved:function(e,t){var n;const{datum:r,type:o,style:s}=t.payload,i=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""];if(i){const e=vo(i,o);e&&(0,xo.Z)(e,["styles","node",s])}},shapeStyleSet:function(e,t){var n;const{datum:r,type:o,style:s,value:i}=t.payload,a=e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""];if(a){const e=vo(a,o);if(e)(0,go.Z)(e,["styles","node",s],i);else{const e={targets:[{type:o}],styles:{node:{[s]:i}}};a.nodes||(a.nodes=[]),a.nodes.push((0,At.cA)(e))}}},themeFileLoaded:function(e,t){var n;const{datum:r,data:o}=t.payload;e.themeByGeneratorName[null!==(n=r.generatorName)&&void 0!==n?n:""]=JSON.parse(o),jo(e,r)},timeIndexSet:function(e,t){const{datum:n,index:r}=t.payload;e.timeByDatumId[n.id]=r},timeIndexToggled:function(e,t){const{datum:n,index:r}=t.payload;e.selectedTimeIndicesByDatumId[n.id]||(e.selectedTimeIndicesByDatumId[n.id]=[]);const o=e.selectedTimeIndicesByDatumId[n.id],s=o.indexOf(r);-1===s?(o.push(r),o.sort(((e,t)=>e-t))):o.length>1&&o.splice(s,1)}},Ao=function(e,t){const{enter:n}=t.payload;n&&n.filter(ft).forEach((t=>{var n,r,o;if((e=>{if(!e.instances||0===e.instances.length)return!1;const t=e.instances[0];return Object.values(t.types).some((e=>"No more instances! Some equivalent instances may have been removed through symmetry breaking."===e.id))})(t.parsed))return void console.log('[graphsExtraReducers] Skipping "no more instances" marker');const s=t.id;e.matricesByDatumId[t.id]={datumId:s,spreadMatrix:(0,pe.yR)(),zoomMatrix:(0,pe.yR)()};const i=null!==(n=t.generatorName)&&void 0!==n?n:"";i in e.themeByGeneratorName||(e.themeByGeneratorName[i]=(0,At.cA)(yo)),e.layoutsByDatumId[s]={datumId:s,layoutById:{}},jo(e,t),e.timeByDatumId[s]=0,i in e.cndSpecByGeneratorName||(e.cndSpecByGeneratorName[i]=null!==(o=null===(r=t.parsed.visualizerConfig)||void 0===r?void 0:r.cnd)&&void 0!==o?o:"directives:\n - flag: hideDisconnectedBuiltIns"),e.hiddenByDatumId[s]={}}))},Co=(0,Ee.oM)({name:"graphs",initialState:{layoutsByDatumId:{},matricesByDatumId:{},themeByGeneratorName:{},timeByDatumId:{},hiddenByDatumId:{},cndSpecByGeneratorName:{},selectedProjectionsByGeneratorName:{},selectedTimeIndicesByDatumId:{}},reducers:So,extraReducers:e=>e.addCase(Be,Ao)}),{asAttributeSet:Mo,cndSpecSet:Io,edgeLabelStyleRemoved:Oo,edgeLabelStyleSet:ko,edgeStyleRemoved:No,edgeStyleSet:Do,edgeIndexSet:zo,edgeIndexRemoved:Eo,curveRemoved:_o,curveSet:Lo,graphSpread:To,graphZoomed:Po,hiddenRelationAdded:Bo,nodeLabelStyleRemoved:Ro,nodeLabelStyleSet:$o,nodeLabelPropRemoved:Vo,nodeLabelPropSet:Fo,nodesOffset:Go,projectionAdded:Zo,projectionAtomToggled:Wo,projectionOrderingSet:Uo,projectionRemoved:qo,projectionSet:Yo,selectedProjectionsSet:Xo,selectedTimeIndicesSet:Ho,shapeRemoved:Jo,saveThemeRequested:Qo,shapeSet:Ko,shapeStyleRemoved:es,shapeStyleSet:ts,themeFileLoaded:ns,timeIndexSet:rs,timeIndexToggled:os}=Co.actions,ss=Co.reducer,is=e=>{const{datum:t}=e,n=jt(),s=St((e=>function(e,t){const n=Ir(0,t),r=Or(e,t).map((e=>e.type)),o=(0,nn.Z)((0,rn.Z)(n),r);return(0,on.Z)(n,o)}(e,t))),i=(0,rn.Z)(s),a=(0,o.useCallback)((e=>{const r=s[e][0];n(Zo({datum:t,type:e,atom:r,time:!0}))}),[t,s]);return 0===i.length?null:(0,r.jsx)(c.M5,Object.assign({my:2},{children:(0,r.jsxs)(ho.v2,{children:[(0,r.jsx)(ho.j2,Object.assign({as:S.zx,colorScheme:"green",size:"xs",leftIcon:(0,r.jsx)(mo.f8n,{})},{children:"Add Time Projection"})),(0,r.jsx)(ho.qy,{children:i.map((e=>(0,r.jsx)(ho.sN,Object.assign({onClick:()=>a(e)},{children:e}),e)))})]})}))};var as=n(11391),ls=n(5434);const cs=e=>{const{type:t,atom:n,atoms:o,onChange:s,onNext:i,onPrevious:a,onRemove:l,onToggle:c}=e;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",Object.assign({className:"text-sm px-2 flex items-center align-middle"},{children:t})),(0,r.jsx)("div",Object.assign({className:"flex items-center"},{children:(0,r.jsx)(as.Ph,Object.assign({className:"flex items-center",size:"xs",value:n,onChange:s},{children:o.map((e=>(0,r.jsx)("option",Object.assign({value:e},{children:e}),e)))}))})),(0,r.jsxs)("div",Object.assign({className:"px-2 flex items-center justify-end"},{children:[(0,r.jsxs)(S.hE,Object.assign({size:"xs",isAttached:!0},{children:[(0,r.jsx)(S.hU,{"aria-label":"Previous",icon:(0,r.jsx)(ls.G1X,{}),onClick:a}),(0,r.jsx)(S.hU,{"aria-label":"Remove",icon:(0,r.jsx)(ls.FU5,{}),onClick:l}),(0,r.jsx)(S.hU,{"aria-label":"Next",icon:(0,r.jsx)(ls.FNi,{}),onClick:i})]})),(0,r.jsx)(ls.G1X,{className:"-rotate-90 ml-2 cursor-pointer hover:text-black",onClick:c})]}))]})},ds=e=>{const{type:t,atom:n,atoms:o,relation:s,relations:i,onChange:a,onNext:l,onPrevious:c,onRelation:d,onRemove:p,onToggle:u,onHiddenRelation:h}=e;return(0,r.jsxs)("div",Object.assign({className:"m-2 p-2 col-span-3 flex flex-col border shadow"},{children:[(0,r.jsxs)("div",Object.assign({className:"flex justify-between pb-3"},{children:[(0,r.jsx)("div",Object.assign({className:"text-sm font-bold"},{children:t})),(0,r.jsx)(ls.G1X,{className:"rotate-90 cursor-pointer hover:text-black",onClick:u})]})),(0,r.jsxs)("div",Object.assign({className:"px-2 grid grid-cols-[minmax(max-content,auto)_minmax(max-content,auto)]"},{children:[(0,r.jsx)(as.Ph,Object.assign({size:"xs",value:n,onChange:a},{children:o.map((e=>(0,r.jsx)("option",Object.assign({value:e},{children:e}),e)))})),(0,r.jsx)("div",Object.assign({className:"mt-0.5 flex items-center justify-end"},{children:(0,r.jsxs)(S.hE,Object.assign({className:"px-2",size:"xs",isAttached:!0},{children:[(0,r.jsx)(S.zx,Object.assign({"aria-label":"Previous",leftIcon:(0,r.jsx)(ls.G1X,{}),onClick:c},{children:"Previous"})),(0,r.jsx)(S.zx,Object.assign({"aria-label":"Next",rightIcon:(0,r.jsx)(ls.FNi,{}),onClick:l},{children:"Next"}))]}))}))]})),(0,r.jsx)("div",Object.assign({className:"px-2 pt-2"},{children:s?(0,r.jsxs)("div",Object.assign({className:"px-2 text-sm flex justify-between items-center"},{children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("span",Object.assign({className:"font-semibold"},{children:s}))," defines total order"]}),(0,r.jsx)(ls.FU5,{onClick:()=>d(void 0)})]})):(0,r.jsxs)(ho.v2,Object.assign({matchWidth:!0},{children:[(0,r.jsx)(ho.j2,Object.assign({as:S.zx,width:"full",size:"xs",py:4},{children:"Select Ordering Relation"})),(0,r.jsx)(ho.qy,{children:i.map((e=>(0,r.jsx)(ho.sN,Object.assign({onClick:()=>d(e)},{children:e}),e)))})]}))})),(0,r.jsx)("div",Object.assign({className:"p-2"},{children:(0,r.jsxs)(ho.v2,Object.assign({matchWidth:!0},{children:[(0,r.jsx)(ho.j2,Object.assign({as:S.zx,width:"full",size:"xs",py:4},{children:"Hide a Relation"})),(0,r.jsx)(ho.qy,{children:i.map((e=>(0,r.jsx)(ho.sN,Object.assign({onClick:()=>h(e)},{children:e}),e)))})]}))})),(0,r.jsx)("div",Object.assign({className:"p-2"},{children:(0,r.jsx)(S.zx,Object.assign({"aria-label":"Remove",width:"full",size:"xs",py:4,colorScheme:"red",leftIcon:(0,r.jsx)(ls.FU5,{}),onClick:p},{children:"Remove Projection"}))}))]}))},ps=e=>{const{datum:t,projection:n,atoms:s,relations:i}=e,{type:a,atom:l,timeOrdering:c}=n,[d,p]=(0,o.useState)(!1),u=jt(),h=(0,o.useCallback)((e=>{const n=e.target.value;u(Yo({datum:t,type:a,atom:n}))}),[t,a]),m=(0,o.useCallback)((()=>{if(l){const e=s.indexOf(l);e>0&&u(Yo({datum:t,type:a,atom:s[e-1]}))}}),[t,a,s,l]),g=(0,o.useCallback)((()=>{u(qo({datum:t,type:a}))}),[t,a]),x=(0,o.useCallback)((()=>{if(l){const e=s.indexOf(l);-1!==e&&e{u(Uo({datum:t,type:a,relation:e}))}),[t,a]),b=(0,o.useCallback)((e=>{u(Bo({datum:t,type:a,relation:e}))}),[t,a]),y=(0,o.useCallback)((()=>{p((e=>!e))}),[p]);return d?(0,r.jsx)(ds,{type:a,atom:l,atoms:s,relation:c,relations:i,onChange:h,onNext:x,onPrevious:m,onRemove:g,onRelation:f,onToggle:y,onHiddenRelation:b}):(0,r.jsx)(cs,{type:a,atom:l,atoms:s,relation:c,relations:i,onChange:h,onNext:x,onPrevious:m,onRemove:g,onRelation:f,onToggle:y,onHiddenRelation:b})},us=({datum:e})=>{const t=St((t=>Ir(0,e))),n=St((t=>Or(t,e))).filter((e=>!0===e.time)),o=St((t=>function(e,t){return ft(t)?at(t.parsed.instances[0]).map((e=>e.name)):[]}(0,e)));return 0===n.length?null:(0,r.jsx)("div",Object.assign({className:"p-2 grid grid-cols-[minmax(min-content,max-content)_minmax(max-content,auto)_minmax(min-content,max-content)] gap-y-2"},{children:n.map((n=>{const s=n.type,i=t[s];return(0,r.jsx)(ps,{datum:e,projection:n,atoms:i,relations:o},s)}))}))},hs=({datum:e})=>St((t=>fr(0,e)))?null:(0,r.jsxs)("div",Object.assign({className:"flex flex-col justify-middle"},{children:[(0,r.jsx)(us,{datum:e}),(0,r.jsx)(is,{datum:e})]}));var ms=n(47516);const gs=e=>{const{collapsed:t,current:n,length:o,onChange:s,label:i,loopBack:a,onToggleCollapse:l}=e;return(0,r.jsx)("div",Object.assign({className:"flex"},{children:(0,r.jsxs)(S.hE,Object.assign({width:"full",isAttached:!0,size:"sm"},{children:[(0,r.jsx)(S.hU,{"aria-label":"First State",icon:(0,r.jsx)(ms.pB9,{}),borderRadius:0,disabled:0===n,onClick:()=>s(0)}),(0,r.jsx)(S.hU,{"aria-label":"Previous State",borderRadius:0,icon:(0,r.jsx)(ms.u_m,{}),disabled:0===n,onClick:()=>s(n-1)}),(0,r.jsx)(c.M5,Object.assign({width:"full",px:2,fontSize:"xs",bg:"gray.100"},{children:i(n)})),void 0!==a&&n===o-1?(0,r.jsx)(S.hU,{"aria-label":"Loop Back",borderRadius:0,icon:(0,r.jsx)(ms.V3h,{}),onClick:()=>s(a)}):(0,r.jsx)(S.hU,{"aria-label":"First State",borderRadius:0,icon:(0,r.jsx)(ms.OEZ,{}),disabled:n===o-1,onClick:()=>s(n+1)}),(0,r.jsx)(S.hU,{"aria-label":"Previous State",icon:(0,r.jsx)(ms.xeH,{}),disabled:n===o-1,onClick:()=>s(o-1)}),(0,r.jsx)(S.hU,{"aria-label":"Toggle Minimap",size:"sm",borderRadius:0,borderLeftWidth:1,borderLeftColor:"gray.300",icon:t?(0,r.jsx)(ms.OrA,{}):(0,r.jsx)(ms.jRD,{}),onClick:()=>l()})]}))}))};function xs(e){const t={};return G(e).forEach((e=>{t[e.id]={type:"line"}})),t}function fs(e){const t={};return G(e).forEach((e=>{t[`${e.id}`]={stroke:"#4A5568",strokeWidth:1,fill:"none"}})),t}function bs(e,t){const n={};return V(e).forEach((e=>{const r=e.id===`${t}`;n[`${e.id}`]=[{text:e.id,style:{fill:r?"white":"#4A5568",fontFamily:"monospace",fontSize:"10px",fontWeight:r?"bold":"normal",textAnchor:"middle",userSelect:"none",cursor:"pointer"},props:{dy:"0.4em"}}]})),n}function ys(e){const t={};return V(e).forEach((e=>{t[`${e.id}`]={shape:"circle",radius:15}})),t}function ws(e,t){const n={};return V(e).forEach((e=>{const r=e.id===`${t}`;n[e.id]={stroke:r?"#3B82F6":"#4A5568",strokeWidth:1,fill:r?"#3B82F6":"white",cursor:"pointer"}})),n}const vs=e=>{const t=function(e){return 50*(e.length-1)+45}(e),n=function(e){return void 0!==e.loopBack?75:45}(e),s=function(e){const{length:t,loopBack:n}=e,r=[],o=[],s=-50*(t-1)/2,i=void 0!==n?7.5:0;for(let e=0;e${e+1}`,source:`${e}`,target:`${e+1}`}):void 0!==n&&o.push({id:`${e}->${n}`,source:`${e}`,target:`${n}`,waypoints:[{x:s+50*e,y:i-30},{x:s+50*n,y:i-30}]});return Ot(r,o)}(e),i=`${-t/2} ${-n/2} ${t} ${n}`,a=(0,o.useRef)(null);return(0,r.jsx)("div",Object.assign({className:"grid place-items-center overflow-y-auto"},{children:(0,r.jsx)(we,Object.assign({svg:a.current,onMouseDown:()=>console.log("down"),onClickNode:t=>{e.onChange&&e.onChange(+t)}},{children:(0,r.jsx)("svg",Object.assign({ref:a,style:{minWidth:t},width:t,height:n,viewBox:i},{children:(0,r.jsx)(De,{id:"minimap",graph:s,nodeShapes:ys(s),nodeStyles:ws(s,e.current),nodeLabels:bs(s,e.current),edgeCurves:xs(s),edgeStyles:fs(s)})}))}))}))},js=e=>{const{collapsed:t}=e;return(0,r.jsxs)("div",Object.assign({className:"border rounded mx-2"},{children:[(0,r.jsx)(gs,Object.assign({},e)),!t&&(0,r.jsx)(vs,Object.assign({},e))]}))},Ss=({datum:e})=>{const t=jt(),[n,s]=(0,o.useState)(!1),[i,a]=(0,o.useState)(!1),l=St((t=>Tr(t,e))),c=St((t=>Pr(0,e))),d=St((t=>function(e,t){if(t&&ft(t)&&qt(t.parsed))return t.parsed.loopBack}(0,e))),p=St((t=>Fr(t,e))),u=(0,o.useCallback)((n=>{t(i?os({datum:e,index:n}):rs({datum:e,index:n}))}),[e,t,i]),h=(0,o.useCallback)((()=>{const n=!i;a(n),t(Ho(n?{datum:e,selectedIndices:[l]}:{datum:e,selectedIndices:[]}))}),[i,t,e,l]),m=(0,o.useCallback)((()=>{const n=Array.from({length:c},((e,t)=>t));t(Ho({datum:e,selectedIndices:n}))}),[t,e,c]),g=(0,o.useCallback)((()=>{t(Ho({datum:e,selectedIndices:c>1?[0,c-1]:[0]}))}),[t,e,c]);return(0,r.jsxs)("div",Object.assign({className:"mx-1 my-2"},{children:[c>1&&(0,r.jsxs)("div",Object.assign({className:"mb-2 flex items-center justify-between"},{children:[(0,r.jsx)("button",Object.assign({type:"button",onClick:h,className:`\n px-2 py-1 text-xs rounded-md transition-all font-medium\n ${i?"bg-blue-600 text-white shadow-sm":"bg-gray-100 text-gray-700 hover:bg-gray-200 border border-gray-200"}\n `},{children:i?"✓ Compare Mode":"Compare States"})),i&&(0,r.jsxs)("div",Object.assign({className:"flex gap-1"},{children:[(0,r.jsx)("button",Object.assign({type:"button",onClick:g,className:"px-2 py-1 text-xs rounded-md bg-gray-100 text-gray-700 hover:bg-gray-200 border border-gray-200"},{children:"First & Last"})),(0,r.jsx)("button",Object.assign({type:"button",onClick:m,className:"px-2 py-1 text-xs rounded-md bg-gray-100 text-gray-700 hover:bg-gray-200 border border-gray-200"},{children:"All"}))]}))]})),i&&(0,r.jsxs)("div",Object.assign({className:"mb-2"},{children:[(0,r.jsx)("p",Object.assign({className:"text-xs text-gray-500 mb-1.5"},{children:"Click states to compare side-by-side:"})),(0,r.jsx)("div",Object.assign({className:"flex flex-wrap gap-1"},{children:Array.from({length:c},((n,o)=>{const s=p.includes(o);return(0,r.jsx)("button",Object.assign({type:"button",onClick:()=>t(os({datum:e,index:o})),className:`\n w-8 h-8 text-xs rounded-md transition-all font-medium\n ${s?"bg-blue-600 text-white shadow-sm":"bg-gray-100 text-gray-700 hover:bg-gray-200 border border-gray-200"}\n `},{children:o+1}),o)}))})),p.length>1&&(0,r.jsxs)("p",Object.assign({className:"text-xs text-blue-600 mt-1.5 font-medium"},{children:["✓ ",p.length," states selected — showing side-by-side comparison"]}))]})),(0,r.jsx)(js,{collapsed:n,current:l,length:c,loopBack:d,label:e=>`State ${e+1}/${c}`,onChange:u,onToggleCollapse:()=>s((e=>!e))})]}))},As=({datum:e})=>St((t=>fr(0,e)))?(0,r.jsx)("div",Object.assign({className:"flex flex-col justify-middle"},{children:(0,r.jsx)(Ss,{datum:e})})):null,Cs=()=>{const e=St(hr);return e?(0,r.jsxs)("div",Object.assign({className:"absolute inset-0 flex flex-col overflow-y-auto"},{children:[(0,r.jsx)(hs,{datum:e}),(0,r.jsx)(As,{datum:e})]})):null},Ms=()=>(0,r.jsxs)("div",Object.assign({className:"flex items-center px-2 space-x-2"},{children:[(0,r.jsx)(to.JO,{as:uo.rHK}),(0,r.jsx)(k,{children:"Time"})]}));var Is=n(47398);const Os={activeDatumSet:function(e,t){e.active=t.payload},dumpClicked:function(e){console.log((0,At.Vk)(e))}};var ks=n(3231),Ns=n(54354),Ds=n(20924);const zs=function(e,t){const{enter:n,update:r,exit:o}=t.payload;if(n){(0,ks.Z)(n,(t=>{const n=t.id;e.datumById[n]||(e.datumById[n]=t,e.datumIds.push(n))}));const t=(0,zt.Z)(n);t&&(e.active=t.id)}r&&(0,Ft.Z)(r,(t=>{const n=t.id;e.datumById[n]&&(0,Ns.Z)(e.datumById[n],t)})),o&&(0,Ft.Z)(o,(t=>{if(e.datumById[t]){delete e.datumById[t];const n=(0,Ds.Z)(e.datumIds,t);n>-1&&e.datumIds.splice(n,1),e.active===t&&(e.active=e.datumIds.length?e.datumIds[0]:null)}}))},Es=(0,Ee.oM)({name:"data",initialState:{active:null,datumById:{},datumIds:[]},reducers:Os,extraReducers:e=>e.addCase(Be,zs)}),{activeDatumSet:_s,dumpClicked:Ls}=Es.actions,Ts=Es.reducer;var Ps=n(2585),Bs=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o{const{className:t,onClick:n}=e,o=Bs(e,["className","onClick"]);return(0,r.jsx)("div",Object.assign({className:`contents ${n?"group":""} ${t||""}`,onClick:n},o))},$s=e=>{const{className:t}=e,n=Bs(e,["className"]);return(0,r.jsx)("div",Object.assign({className:`\n flex items-center prose prose-sm truncate px-1 py-0.5 first:pl-2 last:pr-2 group-hover:bg-blue-600 group-active:bg-blue-700 group-hover:text-white select-none cursor-default group-hover:cursor-pointer ${t||""}`},n))},Vs=e=>{var t;const{datum:n,active:o,onClickItem:s}=e,i=St((e=>function(e,t){return fr(0,t)}(0,n))),a=St((e=>function(e,t){return(Or(e,t)||[]).some((e=>!0===e.time))}(e,n))),l=o?"text-white bg-blue-600":"";return(0,r.jsxs)(Rs,Object.assign({onClick:e=>s(e,n)},{children:[(0,r.jsxs)($s,Object.assign({className:l},{children:["Instance ",n.id," (from: '",null!==(t=n.generatorName)&&void 0!==t?t:"UNNAMED","')"]})),(0,r.jsx)($s,Object.assign({className:l},{children:n.evaluator&&(0,r.jsx)(to.JO,{as:no.RJr})})),(0,r.jsxs)($s,Object.assign({className:l},{children:[i&&(0,r.jsx)(to.JO,{as:uo.rHK}),a&&(0,r.jsx)(to.JO,{as:Ps.sYI})]}))]}))},Fs=e=>{const{data:t,active:n}=e,s=jt(),i=(0,o.useCallback)(((e,t)=>{s(_s(t.id))}),[]);return(0,r.jsx)("div",Object.assign({className:"w-full grid grid-cols-[minmax(max-content,auto)_repeat(2,min-content)]"},{children:t.map((e=>{const{id:t}=e;return(0,r.jsx)(Vs,{datum:e,active:e===n,onClickItem:i},t)}))}))},Gs=function(e,t){const n=t.payload;n.views&&(e.availableViews=n.views.map((e=>{switch(e){case"graph":return"GraphView";case"table":return"TableView";case"script":return"ScriptView"}})),e.mainView=e.availableViews[0],n.generators&&n.generators.length>0&&(e.selectedGenerator=n.generators[0]))},Zs={availableViews:["GraphView","TableView","ScriptView"],mainView:"ScriptView",graphViewDrawer:"explorer",tableViewDrawer:null,scriptViewDrawer:"variables",selectedGenerator:void 0};const Ws=(0,Ee.oM)({name:"ui",initialState:Zs,reducers:{mainViewChanged:function(e,t){e.mainView=t.payload},commonDrawerViewChanged:function(e,t){const n=t.payload;switch(e.mainView){case"GraphView":e.graphViewDrawer=n===e.graphViewDrawer?null:n;break;case"TableView":e.tableViewDrawer=n===e.tableViewDrawer?null:n;break;case"ScriptView":e.scriptViewDrawer=n===e.scriptViewDrawer?null:n}},graphDrawerViewChanged:function(e,t){const n=t.payload;e.graphViewDrawer=n===e.graphViewDrawer?null:n},tableDrawerViewChanged:function(e,t){const n=t.payload;e.tableViewDrawer=n===e.tableViewDrawer?null:n},scriptDrawerViewChanged:function(e,t){const n=t.payload;e.scriptViewDrawer=n===e.scriptViewDrawer?null:n},selectedGeneratorChanged:function(e,t){const n=t.payload;e.selectedGenerator=n.generatorName}},extraReducers:e=>{e.addCase($e,Gs)}}),{mainViewChanged:Us,commonDrawerViewChanged:qs,graphDrawerViewChanged:Ys,tableDrawerViewChanged:Xs,scriptDrawerViewChanged:Hs,selectedGeneratorChanged:Js}=Ws.actions,Qs=Ws.reducer,Ks=()=>{const e=St(hr),t=St(xr),n=St(Nr),s=jt(),i=St(mr);if(!e&&(!n||n.length<1))return null;const a=!t.some((e=>e.generatorName==i)),l=(0,o.useCallback)((()=>{void 0!==i&&a&&(console.log(`Running new generator: ${i}`),s(_e({id:void 0,onClick:"next",context:{generatorName:i}})))}),[i,t]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(c.xu,Object.assign({p:1,shadow:"md",borderWidth:"1px"},{children:[(0,r.jsx)(c.X6,Object.assign({fontSize:"sm",align:"center",fontWeight:"medium"},{children:"Select an Available Command"})),(0,r.jsxs)(c.kC,{children:[(0,r.jsx)(as.Ph,Object.assign({isDisabled:!n||n.length<1,value:i,onChange:e=>{const n=e.target.value,r=t.filter((e=>e.generatorName==n)).reverse()[0];console.log(`Selecting generator: ${n}. Latest id: ${null==r?void 0:r.id}`),s(Js({generatorName:n})),s(_s(r?r.id:""))}},{children:null==n?void 0:n.map(((e,t)=>(0,r.jsx)("option",{children:e},t)))})),(0,r.jsx)(S.zx,Object.assign({size:"sm",margin:"1",onClick:l,isDisabled:!n||n.length<1||i&&(null==e?void 0:e.generatorName)===i||!a},{children:(0,r.jsx)(Is.u,Object.assign({hasArrow:!0,label:"Re-run Forge to refresh this command.",isDisabled:a},{children:"Run"}))}))]})]})),(0,r.jsx)(c.xu,Object.assign({p:1,shadow:"md",borderWidth:"1px"},{children:(0,r.jsxs)(c.X6,Object.assign({fontSize:"xs",align:"center",fontWeight:"normal"},{children:["Instance History for ",(0,r.jsx)("i",{children:i})]}))})),(0,r.jsx)("hr",{}),(0,r.jsx)("div",Object.assign({"aria-label":"explorer pane instance selector",className:"absolute flex flex-col overflow-y-auto"},{children:(0,r.jsx)(Fs,{data:t.filter((e=>e.generatorName==i)),active:e})}))]})},ei=()=>(0,r.jsxs)("div",Object.assign({className:"flex items-center px-2 space-x-2"},{children:[(0,r.jsx)(to.JO,{as:uo.rHK}),(0,r.jsx)(k,{children:"Explorer"})]}));var ti=n(79352);const ni=()=>{const e=jt(),t=St(hr),n=(0,o.useRef)(null),s=(0,o.useRef)(null),[i,a]=(0,o.useState)(!1),[l,c]=(0,o.useState)(!1),[d,p]=(0,o.useState)([]),u=St((e=>t?$r(e,t):void 0)),h=u||"",m=St((e=>t?Vr(e,t):{}));if("undefined"!=typeof window){const e=window.updateProjectionData;if(!e||!e.__isMultiSelectHandler){const e=e=>{console.log("GraphLayoutDrawer received RAW projection data:",JSON.stringify(e,null,2));const t=e.map((e=>{const t=e.type||e.typeName||e.name||e.typeId||"",n=t,r=(e.atoms||[]).map((e=>"string"==typeof e?{id:e,label:e}:{id:e.id||e.atomId||e.name||e.label||"",label:e.label||e.name||e.id||e.atomId||""}));return console.log(`Normalized type: ${t}, atoms:`,r),{typeId:n,typeName:t,atoms:r}}));window.__lastProjectionData=t,window.dispatchEvent(new CustomEvent("projectionDataUpdated",{detail:t}))};e.__isMultiSelectHandler=!0,window.updateProjectionData=e}}(0,o.useEffect)((()=>{const n=n=>{const r=n.detail;p(r),t&&r.length>0&&r.forEach((n=>{0===(m[n.typeId]||[]).length&&n.atoms.length>0&&(e(Xo({datum:t,projectionType:n.typeId,selectedAtoms:[n.atoms[0].id]})),window.currentProjections||(window.currentProjections={}),window.currentProjections[n.typeId]=n.atoms[0].id)}))};window.addEventListener("projectionDataUpdated",n);const r=window.__lastProjectionData;return r&&r.length>0&&n({detail:r}),()=>{window.removeEventListener("projectionDataUpdated",n)}}),[t,m,e]),(0,o.useEffect)((()=>{p([]),window.currentProjections&&(window.currentProjections={})}),[t]),(0,o.useEffect)((()=>{if(!document.getElementById("spytial-bootstrap-stylesheet")){const e=document.createElement("link");e.id="spytial-bootstrap-stylesheet",e.rel="stylesheet",e.href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css",e.integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM",e.crossOrigin="anonymous",document.head.appendChild(e)}}),[]),(0,o.useEffect)((()=>{if(s.current&&window.mountErrorMessageModal&&!l)try{window.mountErrorMessageModal("layout-error-mount"),c(!0)}catch(e){console.error("Failed to mount SpyTial Error Modal:",e)}}),[l]);const g=(0,o.useCallback)(((n,r)=>{var o;if(!t)return;e(Wo({datum:t,projectionType:n,atomId:r}));const s=m[n]||[],i=s.includes(r)?s.filter((e=>e!==r)):[...s,r];window.currentProjections||(window.currentProjections={}),window.currentProjections[n]=i[0]||"";const a=(null===(o=window.getCurrentCNDSpecFromReact)||void 0===o?void 0:o.call(window))||h;e(Io({datum:t,spec:a}))}),[t,e,m,h]),x=(0,o.useCallback)(((n,r)=>{var o;if(!t)return;const s=(m[n]||[]).length===r.length?[r[0].id]:r.map((e=>e.id));e(Xo({datum:t,projectionType:n,selectedAtoms:s})),window.currentProjections||(window.currentProjections={}),window.currentProjections[n]=s[0]||"";const i=(null===(o=window.getCurrentCNDSpecFromReact)||void 0===o?void 0:o.call(window))||h;e(Io({datum:t,spec:i}))}),[t,e,m,h]);return(0,o.useEffect)((()=>{var e;if(n.current&&!i&&t){const t="directives:\n - flag: hideDisconnectedBuiltIns",n={initialYamlValue:u&&""!==u?u:t,initialDirectives:u&&""!==u?void 0:[{flag:"hideDisconnectedBuiltIns"}]};try{(null===(e=window.CndCore)||void 0===e?void 0:e.mountCndLayoutInterface)?(window.CndCore.mountCndLayoutInterface("cnd-editor-mount",n),a(!0)):window.mountCndLayoutInterface&&(window.mountCndLayoutInterface("cnd-editor-mount",n),a(!0))}catch(e){console.error("Failed to mount CnD Layout Interface:",e)}}}),[i,t,u]),t?(0,r.jsxs)("div",Object.assign({className:"absolute inset-0 flex flex-col overflow-y-auto bg-slate-50/90 text-slate-900"},{children:[(0,r.jsx)("div",{id:"layout-error-mount",ref:s,className:"flex-shrink-0","aria-live":"polite"}),(0,r.jsxs)("div",Object.assign({className:"flex-1 space-y-3 p-3"},{children:[d.length>0&&(0,r.jsxs)("div",Object.assign({className:"rounded-lg border border-slate-200 bg-white p-3 shadow-sm"},{children:[(0,r.jsxs)("div",Object.assign({className:"flex items-center justify-between mb-2"},{children:[(0,r.jsx)("span",Object.assign({className:"text-sm font-semibold text-gray-800"},{children:"Projections"})),(0,r.jsx)("span",Object.assign({className:"text-xs text-indigo-600 bg-indigo-50 px-2 py-0.5 rounded"},{children:"Multi-select"}))]})),(0,r.jsx)("p",Object.assign({className:"text-xs text-gray-500 mb-3"},{children:"Click atoms to toggle. Multiple selections show separate graphs."})),d.map((e=>{const t=m[e.typeId]||[],n=t.length===e.atoms.length;return(0,r.jsxs)("div",Object.assign({className:"mb-3 last:mb-0"},{children:[(0,r.jsxs)("div",Object.assign({className:"flex items-center justify-between mb-1.5"},{children:[(0,r.jsx)("label",Object.assign({className:"text-xs font-medium text-gray-700"},{children:e.typeName})),(0,r.jsx)("button",Object.assign({type:"button",onClick:()=>x(e.typeId,e.atoms),className:"text-xs text-indigo-600 hover:text-indigo-800"},{children:n?"Select one":"Select all"}))]})),(0,r.jsx)("div",Object.assign({className:"flex flex-wrap gap-1.5"},{children:e.atoms.map((n=>{const o=t.includes(n.id);return(0,r.jsx)("button",Object.assign({type:"button",onClick:()=>g(e.typeId,n.id),className:`\n px-2.5 py-1 text-xs rounded-md transition-all font-medium\n ${o?"bg-indigo-600 text-white shadow-sm":"bg-gray-100 text-gray-700 hover:bg-gray-200 border border-gray-200"}\n `},{children:n.label}),n.id)}))})),t.length>1&&(0,r.jsxs)("p",Object.assign({className:"text-xs text-indigo-600 mt-1.5 font-medium"},{children:["✓ ",t.length," selected — showing ",t.length," graphs"]}))]}),e.typeId)}))]})),(0,r.jsxs)("div",Object.assign({className:"flex gap-2"},{children:[(0,r.jsx)("button",Object.assign({type:"button",onClick:n=>{var r;if(n.preventDefault(),!t)return;window.clearAllErrors&&window.clearAllErrors();const o=(null===(r=window.getCurrentCNDSpecFromReact)||void 0===r?void 0:r.call(window))||"";e(Io({datum:t,spec:o}))},className:"flex-1 rounded-lg bg-indigo-600 px-4 py-2.5 text-sm font-medium text-white shadow-sm transition hover:bg-indigo-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-offset-2"},{children:"Apply Layout"})),(0,r.jsxs)("label",Object.assign({className:"group relative flex-1 cursor-pointer"},{children:[(0,r.jsxs)("div",Object.assign({className:"flex items-center justify-center gap-2 rounded-lg border-2 border-dashed border-slate-300 bg-white px-4 py-2.5 text-sm font-medium text-slate-600 transition hover:border-indigo-400 hover:text-indigo-600"},{children:[(0,r.jsx)("svg",Object.assign({className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},{children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"})})),"Upload .cnd"]})),(0,r.jsx)("input",{type:"file",accept:".cnd",onChange:n=>{var r;if(!t)return;const o=null===(r=n.target.files)||void 0===r?void 0:r[0];if(o){const n=new FileReader;n.onload=n=>{var r;const o=null===(r=n.target)||void 0===r?void 0:r.result;e(Io({datum:t,spec:o}))},n.readAsText(o)}},className:"absolute inset-0 h-full w-full cursor-pointer opacity-0"})]}))]})),(0,r.jsx)("div",Object.assign({className:"rounded-lg border border-slate-200 bg-white shadow-sm p-3"},{children:(0,r.jsx)("div",{id:"cnd-editor-mount",ref:n,className:"min-h-[360px] overflow-hidden rounded-lg border border-slate-200 bg-slate-50"})}))]}))]})):null},ri=()=>(0,r.jsxs)("div",Object.assign({className:"w-full flex items-center px-2 space-x-2"},{children:[(0,r.jsx)(to.JO,{as:ti.vWf}),(0,r.jsx)(k,{children:"Layout"})]})),oi=(0,Ee.oM)({name:"synthesis",initialState:{isActive:!1,selectorType:"unary",numInstances:3,currentStep:0,examples:[],draftSelection:{atomIds:[],pairs:[]},loadedInstances:[],currentDataInstance:null,result:null,error:null,isLoading:!1},reducers:{enterSynthesisMode:function(e,t){e.isActive=!0,e.selectorType=t.payload.selectorType,e.numInstances=t.payload.numInstances,e.currentStep=0,e.examples=[],e.loadedInstances=[],e.result=null,e.error=null,e.isLoading=!0},exitSynthesisMode:function(e){e.isActive=!1,e.currentStep=0,e.examples=[],e.loadedInstances=[],e.result=null,e.error=null,e.isLoading=!1},synthesisInstancesLoaded:function(e,t){e.loadedInstances=t.payload.instances,e.isLoading=!1,0===e.currentStep&&(e.currentStep=1)},synthesisLoadError:function(e,t){e.error=t.payload.error,e.isLoading=!1},synthesisOutOfInstances:function(e){e.isLoading=!1,e.error="No more instances available. Forge has exhausted all satisfying instances. Consider using fewer examples for synthesis."},addSynthesisExample:function(e,t){e.examples.push(t.payload),e.currentStep<=e.numInstances&&e.currentStep++},updateSynthesisExample:function(e,t){const{instanceIndex:n,selectedAtomIds:r,selectedPairs:o}=t.payload,s=e.examples.findIndex((e=>e.instanceIndex===n));s>=0&&(void 0!==r&&(e.examples[s].selectedAtomIds=r),void 0!==o&&(e.examples[s].selectedPairs=o))},synthesisStepBack:function(e){e.currentStep>1&&(e.currentStep--,e.examples.length>=e.currentStep&&e.examples.pop())},setSynthesisResult:function(e,t){e.result=t.payload,e.error=null,e.isLoading=!1},setSynthesisError:function(e,t){e.error=t.payload.error,e.result=null,e.isLoading=!1},startSynthesis:function(e){e.isLoading=!0,e.error=null},updateDraftSelection:function(e,t){void 0!==t.payload.atomIds&&(e.draftSelection.atomIds=t.payload.atomIds),void 0!==t.payload.pairs&&(e.draftSelection.pairs=t.payload.pairs)},commitDraftSelection:function(e,t){const{instanceIndex:n,dataInstance:r,atomIds:o=[],pairs:s=[]}=t.payload,i=e.examples.findIndex((e=>e.instanceIndex===n));i>=0?(e.examples[i].selectedAtomIds=o,e.examples[i].selectedPairs=s,e.examples[i].dataInstance=r):e.examples.push({instanceIndex:n,selectedAtomIds:[...o],selectedPairs:[...s],dataInstance:r}),e.draftSelection={atomIds:[],pairs:[]},e.currentStep<=e.numInstances&&e.currentStep++},setCurrentDataInstance:function(e,t){e.currentDataInstance=t.payload.dataInstance}}}),{enterSynthesisMode:si,exitSynthesisMode:ii,synthesisInstancesLoaded:ai,synthesisLoadError:li,synthesisOutOfInstances:ci,addSynthesisExample:di,updateSynthesisExample:pi,synthesisStepBack:ui,setSynthesisResult:hi,setSynthesisError:mi,startSynthesis:gi,updateDraftSelection:xi,commitDraftSelection:fi,setCurrentDataInstance:bi}=oi.actions,yi=oi.reducer;var wi=n(38152),vi=n(79762),ji=n(9680),Si=n(72773);const Ai=()=>{const e=jt(),t=St(hr),[n,s]=(0,o.useState)(3),[i,a]=(0,o.useState)("unary"),[l,d]=(0,o.useState)(!1);return(0,r.jsx)("div",Object.assign({className:"p-8 max-w-2xl mx-auto"},{children:(0,r.jsxs)(c.gC,Object.assign({spacing:6,align:"stretch"},{children:[(0,r.jsx)("div",{children:(0,r.jsx)(c.xv,Object.assign({fontSize:"2xl",fontWeight:"bold",mb:2},{children:"Selector Synthesis"}))}),(0,r.jsxs)(vi.NI,{children:[(0,r.jsx)(vi.lX,{children:"Selector Type"}),(0,r.jsx)(ji.Ee,Object.assign({value:i,onChange:e=>a(e)},{children:(0,r.jsxs)(c.Kq,Object.assign({direction:"column",spacing:3},{children:[(0,r.jsx)(ji.Y8,Object.assign({value:"unary"},{children:(0,r.jsx)(c.xv,Object.assign({fontWeight:"semibold"},{children:"Unary Selector (Atoms)"}))})),(0,r.jsx)(ji.Y8,Object.assign({value:"binary"},{children:(0,r.jsx)(c.xv,Object.assign({fontWeight:"semibold"},{children:"Binary Selector (Pairs/Relations)"}))}))]}))}))]}),(0,r.jsxs)(vi.NI,{children:[(0,r.jsx)(vi.lX,{children:"Number of Instances"}),(0,r.jsxs)(Si.Y2,Object.assign({value:n,onChange:(e,t)=>s(t),min:1,max:10,step:1},{children:[(0,r.jsx)(Si.zu,{}),(0,r.jsxs)(Si.Fi,{children:[(0,r.jsx)(Si.WQ,{}),(0,r.jsx)(Si.Y_,{})]})]}))]}),(0,r.jsx)(S.zx,Object.assign({colorScheme:"blue",size:"lg",onClick:()=>{return r=void 0,o=void 0,a=function*(){if(t&&window.CndCore){d(!0),e(si({numInstances:n,selectorType:i}));try{const n=t.data,r=window.CndCore.AlloyInstance.parseAlloyXML(n);if(!r.instances||0===r.instances.length)throw new Error("No instances found in Alloy XML");const o=new window.CndCore.AlloyDataInstance(r.instances[0]);if(function(e){var t;try{return((null===(t=e.getTypes)||void 0===t?void 0:t.call(e))||[]).some((e=>{var t;return"No more instances! Some equivalent instances may have been removed through symmetry breaking."===(e.id||(null===(t=e.getId)||void 0===t?void 0:t.call(e))||"")}))}catch(e){return!1}}(o))throw new Error("No instances available. The current result indicates all instances have been exhausted.");console.log("[SynthesisSetup] Starting with first instance"),e(ai({instances:[o]}))}catch(t){e(li({error:t.message})),d(!1)}}},new((s=void 0)||(s=Promise))((function(e,t){function n(e){try{l(a.next(e))}catch(e){t(e)}}function i(e){try{l(a.throw(e))}catch(e){t(e)}}function l(t){var r;t.done?e(t.value):(r=t.value,r instanceof s?r:new s((function(e){e(r)}))).then(n,i)}l((a=a.apply(r,o||[])).next())}));var r,o,s,a},isLoading:l,loadingText:"Loading instances...",w:"full"},{children:"Start Synthesis"}))]}))}))};var Ci=n(4612);const Mi=()=>{const e=jt(),t=St(Ur),n=St(Yr),s=St(Xr),i=St(qr),a=St(hr),l=St(eo),[d,p]=(0,o.useState)(""),[u,h]=(0,o.useState)([]),m=t-1,g=s[m],x=n.find((e=>e.instanceIndex===m));return(0,o.useEffect)((()=>{if(x)h(x.selectedAtomIds),p(x.selectedAtomIds.join(", "));else{h([]),p("");const e=document.querySelector("webcola-cnd-graph");e&&e.clearNodeHighlights&&e.clearNodeHighlights()}}),[m,x]),(0,o.useEffect)((()=>{const e=d.split(",").map((e=>e.trim())).filter((e=>e.length>0));h(e)}),[d]),g?(0,r.jsxs)("div",Object.assign({className:"flex flex-col h-full"},{children:[(0,r.jsxs)("div",Object.assign({className:"p-4 bg-blue-50 border-b border-blue-200"},{children:[(0,r.jsxs)(c.xv,Object.assign({fontSize:"sm",fontWeight:"semibold",mb:1,color:"blue.900"},{children:["Instance ",m+1," of ",i]})),(0,r.jsx)(c.xv,Object.assign({fontSize:"xs",color:"blue.700"},{children:"Enter atom IDs (comma-separated) that should match your selector. Atoms will be highlighted in the graph in real-time."}))]})),(0,r.jsx)("div",Object.assign({className:"p-4 space-y-4"},{children:(0,r.jsxs)("div",{children:[(0,r.jsx)("label",Object.assign({className:"block text-sm font-medium text-gray-700 mb-2"},{children:"Atom IDs (comma-separated)"})),(0,r.jsx)(Ci.II,{value:d,onChange:e=>p(e.target.value),onBlur:()=>{const e=document.querySelector("webcola-cnd-graph");if(e){if(e.clearNodeHighlights&&e.clearNodeHighlights(),u.length>0&&e.highlightNodes){const t=e.highlightNodes(u);console.log("[SynthesisExample] Highlighted nodes:",u,"success:",t)}}else console.warn("[SynthesisExample] Graph element not found")},size:"lg",fontFamily:"monospace"})]})})),(0,r.jsx)("div",{className:"flex-1"}),(0,r.jsx)("div",Object.assign({className:"p-4 border-t bg-gray-50"},{children:(0,r.jsx)(S.zx,Object.assign({w:"full",colorScheme:"blue",size:"lg",onClick:()=>{l?(console.log("[SynthesisExample] Committing selection:",{instanceIndex:m,atomIds:u}),e(fi({instanceIndex:m,dataInstance:l,atomIds:u})),t{const e=jt(),t=St(Ur),n=St(Yr),s=St(Xr),i=St(qr),a=St(hr),l=St(eo),[d,p]=(0,o.useState)(""),[u,h]=(0,o.useState)([]),[m,g]=(0,o.useState)(null),x=t-1,f=s[x],b=n.find((e=>e.instanceIndex===x));return(0,o.useEffect)((()=>{if(b){h(b.selectedPairs);const e=b.selectedPairs.map((([e,t])=>`${e}:${t}`)).join(", ");p(e)}else{h([]),p("");const e=document.querySelector("webcola-cnd-graph");e&&e.clearNodeHighlights&&e.clearNodeHighlights()}}),[x,b]),(0,o.useEffect)((()=>{if(g(null),""===d.trim())return void h([]);const e=d.split(",").map((e=>e.trim())).filter((e=>e)),t=[];for(const n of e){const e=n.split(":");if(2!==e.length)return void g(`Invalid pair format: "${n}". Use format: First:Second`);const[r,o]=e.map((e=>e.trim()));if(!r||!o)return void g(`Empty node ID in pair: "${n}"`);t.push([r,o])}h(t)}),[d]),f?(0,r.jsxs)("div",Object.assign({className:"flex flex-col h-full"},{children:[(0,r.jsxs)("div",Object.assign({className:"p-4 bg-purple-50 border-b border-purple-200"},{children:[(0,r.jsxs)(c.xv,Object.assign({fontSize:"sm",fontWeight:"semibold",mb:1,color:"purple.900"},{children:["Instance ",x+1," of ",i," - Binary Selector"]})),(0,r.jsxs)(c.xv,Object.assign({fontSize:"xs",color:"purple.700"},{children:["Enter pairs of atom IDs (format: First:Second) separated by commas.",(0,r.jsx)("br",{}),"Pairs will be highlighted with arrows in the graph."]}))]})),(0,r.jsx)("div",Object.assign({className:"p-4 space-y-4"},{children:(0,r.jsxs)("div",{children:[(0,r.jsx)("label",Object.assign({className:"block text-sm font-medium text-gray-700 mb-2"},{children:"Node Pairs (format: First:Second, comma-separated)"})),(0,r.jsx)(Ci.II,{value:d,onChange:e=>p(e.target.value),onBlur:()=>{const e=document.querySelector("webcola-cnd-graph");if(e){if(e.clearNodeHighlights&&e.clearNodeHighlights(),u.length>0&&!m&&e.highlightNodePairs){const t=e.highlightNodePairs(u,{showBadges:!0});console.log("[BinaryExample] Highlighted pairs:",u,"success:",t)}}else console.warn("[BinaryExample] Graph element not found")},size:"lg",fontFamily:"monospace",isInvalid:null!==m}),m&&(0,r.jsx)(c.xv,Object.assign({fontSize:"xs",color:"red.600",mt:1},{children:m}))]})})),(0,r.jsx)("div",{className:"flex-1"}),(0,r.jsx)("div",Object.assign({className:"p-4 border-t bg-gray-50"},{children:(0,r.jsx)(S.zx,Object.assign({w:"full",colorScheme:"purple",size:"lg",onClick:()=>{l?(console.log("[BinaryExample] Committing selection:",{instanceIndex:x,pairs:u}),e(fi({instanceIndex:x,dataInstance:l,pairs:u})),t{const e=jt(),t=St(hr),n=St(Hr),o=St(Wr),s=St(Yr),i=St((e=>t?$r(e,t):""));if(!n||!t)return(0,r.jsx)("div",Object.assign({className:"p-8 text-center"},{children:(0,r.jsx)(c.xv,Object.assign({color:"gray.500"},{children:"No synthesis result available"}))}));const a="unary"===o,l=a?n.matchesByInstance:n.pairMatchesByInstance;return(0,r.jsx)("div",Object.assign({className:"p-6 max-w-4xl mx-auto"},{children:(0,r.jsxs)(c.gC,Object.assign({spacing:6,align:"stretch"},{children:[(0,r.jsxs)(c.xu,Object.assign({borderWidth:2,borderColor:"green.500",rounded:"lg",p:4,bg:"green.50"},{children:[(0,r.jsxs)(c.xv,Object.assign({fontSize:"sm",fontWeight:"semibold",color:"green.700",mb:2},{children:["Synthesized ",a?"Unary":"Binary"," Selector"]})),(0,r.jsx)(c.EK,Object.assign({p:3,rounded:"md",fontSize:"lg",fontWeight:"bold",display:"block",bg:"white"},{children:n.expression}))]})),(0,r.jsxs)(c.xu,{children:[(0,r.jsx)(c.xv,Object.assign({fontSize:"lg",fontWeight:"semibold",mb:3},{children:"Matches Across Instances"})),(0,r.jsx)(Oi.UQ,Object.assign({allowMultiple:!0},{children:l.map(((e,t)=>{const n=s[t];let o=!1;if(a){const t=e;o=n&&n.selectedAtomIds.every((e=>t.matchedAtomIds.includes(e)))&&n.selectedAtomIds.length===t.matchedAtomIds.length}else{const t=e,r=(null==n?void 0:n.selectedPairs)||[];o=r.every((([e,n])=>t.matchedPairs.some((([t,r])=>t===e&&r===n||t===n&&r===e))))&&r.length===t.matchedPairs.length}const i=a?e.matchedAtomIds.length:e.matchedPairs.length;return(0,r.jsxs)(Oi.Qd,{children:[(0,r.jsx)("h2",{children:(0,r.jsxs)(Oi.KF,{children:[(0,r.jsx)(c.xu,Object.assign({flex:"1",textAlign:"left"},{children:(0,r.jsxs)(c.Ug,{children:[(0,r.jsxs)(c.xv,Object.assign({fontWeight:"semibold"},{children:["Instance ",e.instanceIndex+1]})),(0,r.jsxs)(c.Ct,Object.assign({colorScheme:o?"green":"yellow"},{children:[i," matches"]})),o?(0,r.jsxs)(c.Ct,Object.assign({colorScheme:"green"},{children:[(0,r.jsx)(ls.HhX,{})," Exact"]})):(0,r.jsx)(c.Ct,Object.assign({colorScheme:"yellow"},{children:"Partial"}))]})})),(0,r.jsx)(Oi.XE,{})]})}),(0,r.jsx)(Oi.Hk,Object.assign({pb:4},{children:a?(0,r.jsxs)(c.gC,Object.assign({align:"stretch",spacing:2},{children:[(0,r.jsxs)("div",{children:[(0,r.jsx)(c.xv,Object.assign({fontSize:"sm",fontWeight:"semibold",mb:1},{children:"You selected:"})),(0,r.jsx)("div",Object.assign({className:"flex flex-wrap gap-1"},{children:null==n?void 0:n.selectedAtomIds.map((e=>(0,r.jsx)(c.Ct,Object.assign({colorScheme:"blue"},{children:e}),e)))}))]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(c.xv,Object.assign({fontSize:"sm",fontWeight:"semibold",mb:1},{children:"Selector matches:"})),(0,r.jsx)("div",Object.assign({className:"flex flex-wrap gap-1"},{children:e.matchedAtomIds.map((e=>(0,r.jsxs)(c.Ct,Object.assign({colorScheme:(null==n?void 0:n.selectedAtomIds.includes(e))?"green":"orange"},{children:[e,!(null==n?void 0:n.selectedAtomIds.includes(e))&&" (extra)"]}),e)))}))]})]})):(0,r.jsxs)(c.gC,Object.assign({align:"stretch",spacing:2},{children:[(0,r.jsxs)("div",{children:[(0,r.jsx)(c.xv,Object.assign({fontSize:"sm",fontWeight:"semibold",mb:1},{children:"You selected:"})),(0,r.jsx)(c.gC,Object.assign({align:"stretch",spacing:1},{children:null==n?void 0:n.selectedPairs.map((([e,t],n)=>(0,r.jsxs)(c.Ug,{children:[(0,r.jsx)(c.Ct,Object.assign({colorScheme:"blue"},{children:e})),(0,r.jsx)(ls.hdK,{}),(0,r.jsx)(c.Ct,Object.assign({colorScheme:"blue"},{children:t}))]},n)))}))]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(c.xv,Object.assign({fontSize:"sm",fontWeight:"semibold",mb:1},{children:"Selector matches:"})),(0,r.jsx)(c.gC,Object.assign({align:"stretch",spacing:1},{children:e.matchedPairs.map((([e,t],o)=>{const s=null==n?void 0:n.selectedPairs.some((([n,r])=>n===e&&r===t||n===t&&r===e));return(0,r.jsxs)(c.Ug,{children:[(0,r.jsx)(c.Ct,Object.assign({colorScheme:s?"green":"orange"},{children:e})),(0,r.jsx)(ls.hdK,{}),(0,r.jsx)(c.Ct,Object.assign({colorScheme:s?"green":"orange"},{children:t})),!s&&(0,r.jsx)(c.xv,Object.assign({fontSize:"xs"},{children:"(extra)"}))]},o)}))}))]})]}))}))]},e.instanceIndex)}))}))]}),(0,r.jsxs)(c.Ug,Object.assign({spacing:3,pt:4},{children:[(0,r.jsx)(S.zx,Object.assign({flex:1,colorScheme:"green",leftIcon:(0,r.jsx)(ls.HhX,{}),onClick:()=>{const r=i?`${i}\n\n# Synthesized ${o} selector\n# ${n.expression}\n`:`# Synthesized ${o} selector\n# ${n.expression}\n`;e(Io({datum:t,spec:r})),e(ii())},size:"lg"},{children:"Accept & Insert into Spec"})),(0,r.jsx)(S.zx,Object.assign({flex:1,variant:"outline",leftIcon:(0,r.jsx)(ls.FU5,{}),onClick:()=>{e(ii())},size:"lg"},{children:"Reject & Try Again"}))]})),(0,r.jsx)(c.xu,Object.assign({bg:"blue.50",p:4,rounded:"md",borderWidth:1,borderColor:"blue.200"},{children:(0,r.jsxs)(c.xv,Object.assign({fontSize:"sm",color:"gray.700"},{children:[(0,r.jsx)("strong",{children:"Next steps:"})," The selector will be added as a comment in your CnD spec. You can use it in constraints (e.g., ",(0,r.jsxs)(c.EK,{children:["right(",n.expression,")"]}),") or directives (e.g., ",(0,r.jsxs)(c.EK,{children:["color red(",n.expression,")"]}),")."]}))}))]}))}))};const Ni=()=>{const e=jt(),t=St(hr),n=St(Zr),s=St(Wr),i=St(Ur),a=St(qr),l=St(Yr),d=(St(Xr),St(Hr)),p=St(Jr),u=St(Qr),h=St(Kr),m=i>a&&null===d&&!u&&!p&&l.length===a,g=l.every((e=>e.selectedAtomIds.length>0||e.selectedPairs.length>0));if(console.log("[SynthesisPanel] State:",{currentStep:i,numInstances:a,result:d,isLoading:u,error:p,examplesLength:l.length,shouldSynthesize:m,canSynthesize:h,examplesHaveSelections:g,examples:l.map((e=>({instanceIndex:e.instanceIndex,selectedAtomIds:e.selectedAtomIds,selectedPairs:e.selectedPairs,hasDataInstance:!!e.dataInstance})))}),(0,o.useEffect)((()=>{var n,r,o,i;m&&h&&(console.log("[SynthesisPanel] Auto-triggering synthesis"),n=void 0,r=void 0,i=function*(){if(t&&window.CndCore){e(gi());try{const t=e=>new window.CndCore.AlloyDataInstance(e),n=(e,t)=>{const n=e.getAtoms();console.log("[Synthesis] Looking for atom:",t,"in",n.length,"atoms"),console.log("[Synthesis] Available atom IDs:",n.map((e=>e.id)));const r=n.find((e=>e.id===t));if(!r)throw new Error(`Atom not found: ${t}`);return r};if("unary"===s){console.log("[Synthesis] Starting unary synthesis with",l.length,"examples"),console.log("[Synthesis] Examples:",l.map((e=>({instanceIndex:e.instanceIndex,selectedAtomIds:e.selectedAtomIds,hasDataInstance:!!e.dataInstance}))));const r=l.map(((e,r)=>{const o=e.dataInstance;if(console.log(`[Synthesis] Example ${r}: rawInstanceData =`,o),!o)throw new Error(`Example ${e.instanceIndex+1}: Missing data instance`);const s=t(o);console.log(`[Synthesis] Example ${r}: recreated AlloyDataInstance with ${s.getAtoms().length} atoms`);const i=e.selectedAtomIds.map((e=>n(s,e)));return console.log(`[Synthesis] Example ${r}: converted ${e.selectedAtomIds.length} IDs to atoms`),{atoms:i,dataInstance:s}}));console.log("[Synthesis] Calling synthesizeAtomSelectorWithExplanation with:",r);const o=window.CndCore.synthesizeAtomSelectorWithExplanation(r,3);if(console.log("[Synthesis] Result:",o),!o)throw new Error("Synthesis failed - no selector found");const s=l.map(((e,n)=>{const r=t(e.dataInstance),s=new window.CndCore.SGraphQueryEvaluator;s.initialize({sourceData:r});const i=s.evaluate(o.expression);return{instanceIndex:n,matchedAtomIds:i.selectedAtoms?i.selectedAtoms().map((e=>e.id)):[]}}));e(hi({expression:o.expression,explanation:o.explanation||null,matchesByInstance:s,pairMatchesByInstance:[]}))}else{const r=l.map((e=>{const r=e.dataInstance;if(!r)throw new Error(`Example ${e.instanceIndex+1}: Missing data instance`);const o=t(r);return{pairs:e.selectedPairs.map((([e,t])=>[n(o,e),n(o,t)])),dataInstance:o}})),o=window.CndCore.synthesizeBinarySelectorWithExplanation(r,3);if(!o)throw new Error("Synthesis failed - no binary selector found");const s=l.map(((e,n)=>{const r=t(e.dataInstance),s=new window.CndCore.SGraphQueryEvaluator;s.initialize({sourceData:r});const i=s.evaluate(o.expression);return{instanceIndex:n,matchedPairs:(i.selectedTuplesAll?i.selectedTuplesAll():[]).map((e=>[e[0].id,e[1].id]))}}));e(hi({expression:o.expression,explanation:null,matchesByInstance:[],pairMatchesByInstance:s}))}}catch(t){e(mi({error:t.message||"Synthesis failed"}))}}},new((o=void 0)||(o=Promise))((function(e,t){function s(e){try{l(i.next(e))}catch(e){t(e)}}function a(e){try{l(i.throw(e))}catch(e){t(e)}}function l(t){var n;t.done?e(t.value):(n=t.value,n instanceof o?n:new o((function(e){e(n)}))).then(s,a)}l((i=i.apply(n,r||[])).next())})))}),[m,h]),!n)return null;const x=0===i?0:(i-1)/a*100,f=0===i,b=i>=1&&i<=a,y=i>a||null!==d;return(0,r.jsxs)("div",Object.assign({className:"absolute inset-0 flex flex-col bg-white"},{children:[(0,r.jsxs)("div",Object.assign({className:"p-4 border-b bg-blue-50 flex items-center justify-between"},{children:[(0,r.jsxs)("div",Object.assign({className:"flex items-center gap-2"},{children:[(0,r.jsx)(to.JO,{as:ls.tSv,boxSize:6,color:"blue.600"}),(0,r.jsxs)("div",{children:[(0,r.jsx)(k,{children:"Selector Synthesis"}),(0,r.jsxs)(c.xv,Object.assign({fontSize:"xs",color:"gray.600"},{children:[f&&"Configure synthesis parameters",b&&`Collecting examples (${l.length}/${a})`,y&&"Review synthesized selector"]}))]})]})),(0,r.jsx)(S.zx,Object.assign({size:"sm",leftIcon:(0,r.jsx)(ls.FU5,{}),onClick:()=>{e(ii())},variant:"ghost"},{children:"Exit"}))]})),!f&&!y&&(0,r.jsx)(wi.Ex,{value:x,size:"xs",colorScheme:"blue"}),(0,r.jsxs)("div",Object.assign({className:"flex-1 overflow-y-auto"},{children:[f&&(0,r.jsx)(Ai,{}),b&&("unary"===s?(0,r.jsx)(Mi,{}):(0,r.jsx)(Ii,{})),y&&(0,r.jsx)(ki,{})]})),!f&&!y&&(0,r.jsxs)("div",Object.assign({className:"p-4 border-t bg-gray-50 flex items-center justify-between"},{children:[(0,r.jsx)(S.zx,Object.assign({size:"sm",leftIcon:(0,r.jsx)(ls.KYK,{}),onClick:()=>e(ui()),isDisabled:i<=1,variant:"outline"},{children:"Previous"})),(0,r.jsxs)(c.xv,Object.assign({fontSize:"sm",color:"gray.600"},{children:["Instance ",i," of ",a]}))]})),p&&(0,r.jsxs)("div",Object.assign({className:"p-4 bg-red-50 border-t border-red-200 text-red-700 text-sm"},{children:[(0,r.jsx)("strong",{children:"Error:"})," ",p]}))]}))},Di=()=>{const e=jt(),t=St(hr);return St(Zr)?(0,r.jsx)(Ni,{}):t?(0,r.jsx)("div",Object.assign({className:"absolute inset-0 flex flex-col overflow-y-auto bg-slate-50/90 text-slate-900"},{children:(0,r.jsx)("div",Object.assign({className:"flex-1 space-y-4 p-4"},{children:(0,r.jsxs)("div",Object.assign({className:"space-y-4 rounded-xl border border-slate-200 bg-white/80 p-6 backdrop-blur shadow-sm"},{children:[(0,r.jsxs)("div",Object.assign({className:"flex items-center gap-3"},{children:[(0,r.jsx)(to.JO,{as:ls.tSv,boxSize:8,className:"text-fuchsia-600"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h2",Object.assign({className:"text-lg font-semibold text-slate-800"},{children:"Selector Synthesis"})),(0,r.jsx)("p",Object.assign({className:"text-sm text-slate-500"},{children:"Synthesize selectors from examples"}))]})]})),(0,r.jsx)("p",Object.assign({className:"text-sm text-slate-600 leading-relaxed"},{children:"Use this tool to automatically generate CnD selectors by providing positive and negative examples. Select atoms across multiple instances to define which elements should be matched by the selector."})),(0,r.jsxs)("div",Object.assign({className:"space-y-3 pt-2"},{children:[(0,r.jsxs)("div",Object.assign({className:"rounded-lg border border-slate-200 bg-slate-50 p-4"},{children:[(0,r.jsx)("h3",Object.assign({className:"font-medium text-slate-700 mb-2"},{children:"Selector Types"})),(0,r.jsxs)("ul",Object.assign({className:"text-sm text-slate-600 space-y-2"},{children:[(0,r.jsxs)("li",Object.assign({className:"flex items-start gap-2"},{children:[(0,r.jsx)("span",Object.assign({className:"inline-block w-5 h-5 rounded-full bg-fuchsia-100 text-fuchsia-600 text-xs flex items-center justify-center font-semibold mt-0.5"},{children:"1"})),(0,r.jsxs)("span",{children:[(0,r.jsx)("strong",{children:"Unary:"}),' Select individual atoms (e.g., "all Nodes with value > 5")']})]})),(0,r.jsxs)("li",Object.assign({className:"flex items-start gap-2"},{children:[(0,r.jsx)("span",Object.assign({className:"inline-block w-5 h-5 rounded-full bg-purple-100 text-purple-600 text-xs flex items-center justify-center font-semibold mt-0.5"},{children:"2"})),(0,r.jsxs)("span",{children:[(0,r.jsx)("strong",{children:"Binary:"}),' Select pairs of atoms/edges (e.g., "all edges where source.value < target.value")']})]}))]}))]})),(0,r.jsxs)("div",Object.assign({className:"grid gap-2 sm:grid-cols-2"},{children:[(0,r.jsxs)("button",Object.assign({type:"button",onClick:()=>e(si({numInstances:3,selectorType:"unary"})),className:"inline-flex items-center justify-center gap-2 rounded-lg bg-gradient-to-r from-fuchsia-600 to-purple-600 px-4 py-3 text-sm font-semibold text-white shadow-md transition hover:from-fuchsia-500 hover:to-purple-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-fuchsia-500 focus-visible:ring-offset-2 focus-visible:ring-offset-white"},{children:[(0,r.jsx)(to.JO,{as:ls.tSv}),"Synthesize Unary Selector"]})),(0,r.jsxs)("button",Object.assign({type:"button",onClick:()=>e(si({numInstances:3,selectorType:"binary"})),className:"inline-flex items-center justify-center gap-2 rounded-lg bg-gradient-to-r from-purple-600 to-indigo-600 px-4 py-3 text-sm font-semibold text-white shadow-md transition hover:from-purple-500 hover:to-indigo-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-purple-500 focus-visible:ring-offset-2 focus-visible:ring-offset-white"},{children:[(0,r.jsx)(to.JO,{as:ls.tSv}),"Synthesize Binary Selector"]}))]}))]}))]}))}))})):(0,r.jsxs)("div",Object.assign({className:"absolute inset-0 flex flex-col items-center justify-center bg-slate-50/90 p-8 text-center"},{children:[(0,r.jsx)(to.JO,{as:ls.tSv,boxSize:12,className:"mb-4 text-slate-300"}),(0,r.jsx)("p",Object.assign({className:"text-slate-500"},{children:"Load an instance to start synthesizing selectors."}))]}))},zi=()=>(0,r.jsxs)("div",Object.assign({className:"w-full flex items-center px-2 space-x-2"},{children:[(0,r.jsx)(to.JO,{as:ls.tSv}),(0,r.jsx)(k,{children:"Synthesis"})]})),Ei=()=>{const e=St(wr);return(0,r.jsxs)(r.Fragment,{children:["explorer"===e&&(0,r.jsx)(Ks,{}),"state"===e&&(0,r.jsx)(Cs,{}),"evaluator"===e&&(0,r.jsx)(ao,{}),"log"===e&&(0,r.jsx)(co,{}),"layout"===e&&(0,r.jsx)(ni,{}),"synthesis"===e&&(0,r.jsx)(Di,{})]})},_i=()=>{const e=St(wr);return(0,r.jsxs)(r.Fragment,{children:["explorer"===e&&(0,r.jsx)(ei,{}),"state"===e&&(0,r.jsx)(Ms,{}),"evaluator"===e&&(0,r.jsx)(lo,{}),"log"===e&&(0,r.jsx)(po,{}),"layout"===e&&(0,r.jsx)(ri,{}),"synthesis"===e&&(0,r.jsx)(zi,{})]})};var Li=n(14578);const Ti=e=>(0,r.jsx)("div",Object.assign({className:"contents group"},{children:e.children})),Pi=e=>(0,r.jsx)("div",Object.assign({className:"px-4 py-0.5 prose text-xs group-hover:bg-slate-100"},{children:e.children})),Bi=e=>(0,r.jsx)("div",Object.assign({className:"px-4 py-0.5 text-xs font-mono group-hover:bg-slate-100"},{children:e.children})),Ri=e=>{const{variable:t}=e;return(0,r.jsxs)(Ti,{children:[(0,r.jsx)(Bi,{children:t.name}),(0,r.jsx)(Pi,{children:void 0!==t.typeUrl?(0,r.jsx)("a",Object.assign({target:"_blank",rel:"noopener noreferrer",href:t.typeUrl},{children:t.type})):t.type})]})},$i=e=>{const{datum:t}=e,n=St((e=>Br(e,t)));return(0,r.jsxs)("div",Object.assign({className:"flex flex-col justify-middle"},{children:[(0,r.jsx)("div",Object.assign({className:"prose prose-md font-bold mx-2 my-2 border-b"},{children:"Datum Variables"})),(0,r.jsxs)("div",Object.assign({className:"grid grid-cols-2"},{children:[(0,r.jsx)("div",Object.assign({className:"px-4 prose prose-sm font-semibold"},{children:"Variable"})),(0,r.jsx)("div",Object.assign({className:"px-4 prose prose-sm font-semibold"},{children:"Type"})),n.map(((e,t)=>(0,r.jsx)(Ri,{variable:e},t)))]}))]}))},Vi=()=>{const e=St(zr),t=St(Er);return(0,r.jsxs)("div",Object.assign({className:"flex flex-col justify-middle"},{children:[(0,r.jsx)("div",Object.assign({className:"prose prose-md font-bold mx-2 my-2 border-b"},{children:"Stage Variables"})),(0,r.jsxs)("div",Object.assign({className:"grid grid-cols-2"},{children:[(0,r.jsx)("div",Object.assign({className:"px-4 prose prose-sm font-semibold"},{children:"Variable"})),(0,r.jsx)("div",Object.assign({className:"px-4 prose prose-sm font-semibold"},{children:"Value"})),(0,r.jsxs)(Ti,{children:[(0,r.jsx)(Bi,{children:e}),(0,r.jsxs)(Pi,{children:["svg"===e&&(0,r.jsx)("a",Object.assign({target:"_blank",rel:"noopener noreferrer",href:"https://developer.mozilla.org/en-US/docs/Web/SVG"},{children:""})),"div"===e&&(0,r.jsx)("a",Object.assign({target:"_blank",rel:"noopener noreferrer",href:"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div"},{children:"
"})),"canvas"===e&&(0,r.jsx)("a",Object.assign({target:"_blank",rel:"noopener noreferrer",href:"https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API"},{children:""}))]})]}),(0,r.jsxs)(Ti,{children:[(0,r.jsx)(Bi,{children:"width"}),(0,r.jsx)(Bi,{children:t.width})]}),(0,r.jsxs)(Ti,{children:[(0,r.jsx)(Bi,{children:"height"}),(0,r.jsx)(Bi,{children:t.height})]})]}))]}))},Fi=e=>{const{datum:t}=e;return(0,r.jsxs)("div",Object.assign({className:"absolute inset-0 flex flex-col overflow-y-auto"},{children:[(0,r.jsx)(Vi,{}),(0,r.jsx)($i,{datum:t})]}))},Gi=()=>(0,r.jsxs)("div",Object.assign({className:"w-full flex items-center px-2 space-x-2"},{children:[(0,r.jsx)(to.JO,{as:Li.VuO}),(0,r.jsx)(k,{children:"Variables"})]})),Zi=()=>{const e=St(hr),t=St(Dr);return(0,r.jsxs)(r.Fragment,{children:["explorer"===t&&(0,r.jsx)(Ks,{}),"evaluator"===t&&(0,r.jsx)(ao,{}),"log"===t&&(0,r.jsx)(co,{}),"variables"===t&&e&&(0,r.jsx)(Fi,{datum:e})]})},Wi=()=>{const e=St(Dr);return(0,r.jsxs)(r.Fragment,{children:["explorer"===e&&(0,r.jsx)(ei,{}),"evaluator"===e&&(0,r.jsx)(lo,{}),"log"===e&&(0,r.jsx)(po,{}),"variables"===e&&(0,r.jsx)(Gi,{})]})},Ui=()=>{const e=St(hr);return e?(0,r.jsx)("div",Object.assign({className:"absolute inset-0 flex flex-col overflow-y-auto"},{children:(0,r.jsx)(As,{datum:e})})):null},qi=()=>(0,r.jsxs)("div",Object.assign({className:"flex items-center px-2 space-x-2"},{children:[(0,r.jsx)(to.JO,{as:uo.rHK}),(0,r.jsx)(k,{children:"Time"})]})),Yi=()=>{console.log("table drawer explorer!");const e=St(Lr);return(0,r.jsxs)(r.Fragment,{children:["explorer"===e&&(0,r.jsx)(Ks,{}),"state"===e&&(0,r.jsx)(Ui,{}),"evaluator"===e&&(0,r.jsx)(ao,{}),"log"===e&&(0,r.jsx)(co,{})]})},Xi=()=>{const e=St(Lr);return(0,r.jsxs)(r.Fragment,{children:["explorer"===e&&(0,r.jsx)(ei,{}),"state"===e&&(0,r.jsx)(qi,{}),"evaluator"===e&&(0,r.jsx)(lo,{}),"log"===e&&(0,r.jsx)(po,{})]})},Hi=()=>{const e=St(Cr);return(0,r.jsxs)(f,{children:[(0,r.jsxs)(I,Object.assign({className:"border-b"},{children:["GraphView"===e&&(0,r.jsx)(_i,{}),"TableView"===e&&(0,r.jsx)(Xi,{}),"ScriptView"===e&&(0,r.jsx)(Wi,{})]})),(0,r.jsxs)(C,{children:["GraphView"===e&&(0,r.jsx)(Ei,{}),"TableView"===e&&(0,r.jsx)(Yi,{}),"ScriptView"===e&&(0,r.jsx)(Zi,{})]})]})};var Ji=n(53854);const Qi=()=>{const e=jt(),t=St(gr),n=St(Cr);return(0,r.jsxs)(r.Fragment,{children:[t.includes("GraphView")&&(0,r.jsx)(A,Object.assign({isActive:"GraphView"===n,mr:1,leftIcon:(0,r.jsx)(ms.DvO,{}),onClick:()=>e(Us("GraphView"))},{children:"Graph"})),t.includes("TableView")&&(0,r.jsx)(A,Object.assign({isActive:"TableView"===n,mr:1,leftIcon:(0,r.jsx)(uo.WHV,{}),onClick:()=>e(Us("TableView"))},{children:"Table"})),t.includes("ScriptView")&&(0,r.jsx)(A,Object.assign({isActive:"ScriptView"===n,mr:1,leftIcon:(0,r.jsx)(Ji.aJo,{}),onClick:()=>e(Us("ScriptView"))},{children:"Script"}))]})},Ki=()=>(0,r.jsxs)(v,Object.assign({className:"shadow"},{children:[(0,r.jsx)(w,{}),(0,r.jsx)(c.iz,{orientation:"vertical",mx:2}),(0,r.jsx)(c.LZ,{}),(0,r.jsx)(Qi,{})]}));var ea=n(60155);const ta=()=>{const e=jt(),t=St(Cr),n=St(wr),o=St(Gr);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(z,{text:"Time",rightIcon:(0,r.jsx)(uo.rHK,{}),isActive:"GraphView"===t&&"state"===n,onClick:()=>e(Ys("state"))}),(0,r.jsx)(z,{text:"Layout",rightIcon:(0,r.jsx)(ls.df2,{}),isActive:"GraphView"===t&&"layout"===n,onClick:()=>e(Ys("layout"))}),o&&(0,r.jsx)(z,{text:"Synthesis",rightIcon:(0,r.jsx)(ls.tSv,{}),isActive:"GraphView"===t&&"synthesis"===n,onClick:()=>e(Ys("synthesis"))}),(0,r.jsx)(z,{text:"Settings",rightIcon:(0,r.jsx)(ea.Fuo,{}),isActive:"GraphView"===t&&"settings"===n,onClick:()=>e(Ys("settings"))})]})},na=()=>{const e=jt(),t=St(Cr),n=St(Dr);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(z,{text:"Variables",rightIcon:(0,r.jsx)(Li.VuO,{}),isActive:"ScriptView"===t&&"variables"===n,onClick:()=>e(Hs("variables"))}),(0,r.jsx)(z,{text:"Settings",rightIcon:(0,r.jsx)(ea.Fuo,{}),isActive:"ScriptView"===t&&"settings"===n,onClick:()=>e(Hs("settings"))})]})},ra=()=>{const e=jt(),t=St(Cr),n=St(Lr);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(z,{text:"Time",rightIcon:(0,r.jsx)(uo.rHK,{}),isActive:"TableView"===t&&"state"===n,onClick:()=>e(Xs("state"))}),(0,r.jsx)(z,{text:"Settings",rightIcon:(0,r.jsx)(ea.Fuo,{}),isActive:"TableView"===t&&"settings"===n,onClick:()=>e(Xs("settings"))})]})},oa=()=>{const e=jt(),t=St(Cr),n=St(yr);return(0,r.jsxs)(N,{children:["GraphView"===t&&(0,r.jsx)(ta,{}),"TableView"===t&&(0,r.jsx)(ra,{}),"ScriptView"===t&&(0,r.jsx)(na,{}),(0,r.jsx)(c.LZ,{}),(0,r.jsx)(z,{text:"Explorer",rightIcon:(0,r.jsx)(uo.rHK,{}),isActive:"explorer"===n,onClick:()=>e(qs("explorer"))}),(0,r.jsx)(z,{text:"Evaluator",rightIcon:(0,r.jsx)(no.RJr,{}),isActive:"evaluator"===n,onClick:()=>e(qs("evaluator"))}),(0,r.jsx)(z,{text:"Log",rightIcon:(0,r.jsx)(no.t75,{}),isActive:"log"===n,onClick:()=>e(qs("log"))})]})};var sa=function(e,t,n,r){return new(n||(n=Promise))((function(o,s){function i(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,a)}l((r=r.apply(e,t||[])).next())}))};const ia=e=>{const{datum:t,cndSpec:n,timeIndex:s,priorState:i,onLayoutStateChange:a,synthesisMode:l=!1,onDataInstanceCreated:c}=e,d=(0,o.useRef)(null),p=(0,o.useRef)(null),[u,h]=(0,o.useState)(null),[m,g]=(0,o.useState)(!0),[x,f]=(0,o.useState)(void 0!==window.CndCore),b=(0,o.useRef)(null),y=(0,o.useRef)(!1),w=(0,o.useRef)(a);w.current=a,(0,o.useEffect)((()=>{if(x)return;const e=()=>{var e;return!!(null===(e=window.CndCore)||void 0===e?void 0:e.parseLayoutSpec)&&(console.log("CndCore is now available"),f(!0),!0)};if(e())return;let t=0;const n=setInterval((()=>{t++,(e()||t>=100)&&(clearInterval(n),t>=100&&!x&&(console.error("CndCore did not load within timeout"),h("CnD Core library failed to load. Please refresh the page."),g(!1)))}),100);return()=>clearInterval(n)}),[x]);const v=(0,o.useCallback)((()=>sa(void 0,void 0,void 0,(function*(){p.current&&b.current&&(yield p.current.renderLayout(b.current))}))),[]),j=(0,o.useCallback)((()=>sa(void 0,void 0,void 0,(function*(){var e,r;if(p.current){if(g(!0),h(null),void 0===window.CndCore)return h("CnD Core library is not available. Please check your internet connection."),void g(!1);try{const o=t.data;if(!o)throw new Error("No Alloy XML data available in datum");const a=window.CndCore.AlloyInstance.parseAlloyXML(o);if(!a.instances||0===a.instances.length)throw new Error("No instances found in Alloy XML");const d=void 0!==s?Math.min(s,a.instances.length-1):0,u=new window.CndCore.AlloyDataInstance(a.instances[d]);if(function(e){var t;try{return((null===(t=e.getTypes)||void 0===t?void 0:t.call(e))||[]).some((e=>{var t;return"No more instances! Some equivalent instances may have been removed through symmetry breaking."===(e.id||(null===(t=e.getId)||void 0===t?void 0:t.call(e))||"")}))}catch(e){return!1}}(u))return console.log("No more instances available from Forge"),h("No more instances available. All satisfying instances have been exhausted."),g(!1),void((null===(e=p.current)||void 0===e?void 0:e.clear)&&p.current.clear());l&&c&&c(a.instances[d]);const m=new window.CndCore.SGraphQueryEvaluator;m.initialize({sourceData:u});let x=null;try{x=window.CndCore.parseLayoutSpec(n||""),window.clearAllErrors&&window.clearAllErrors()}catch(e){console.error("Layout spec parse error:",e),window.showParseError&&window.showParseError(e.message,"Layout Specification"),x=window.CndCore.parseLayoutSpec("")}const f=!0,y=0,w=new window.CndCore.LayoutInstance(x,m,y,f),v=window.currentProjections||{};console.log("Using projections:",v);const j=w.generateLayout(u,v);if(window.updateProjectionData&&j.projectionData?(console.log("Updating projection data:",j.projectionData),window.updateProjectionData(j.projectionData)):j.projectionData&&j.projectionData.length>0&&console.warn("Projection data available but updateProjectionData function not found. Projection controls may not display correctly."),j.error&&(console.error("Layout generation error:",j.error),j.error.errorMessages?window.showPositionalError?window.showPositionalError(j.error.errorMessages):h(`Positional constraint conflict: ${j.error.message}`):j.error.overlappingNodes?window.showGroupOverlapError?window.showGroupOverlapError(j.error.message):h(`Group overlap error: ${j.error.message}`):window.showGeneralError?window.showGeneralError(`Layout generation error: ${j.error.message}`):h(`Layout generation error: ${j.error.message}`),p.current&&p.current.setAttribute("unsat","")),b.current=j.layout,p.current&&j.layout){const e=(null===(r=j.layout.nodes)||void 0===r?void 0:r.map((e=>e.id||e.name||e.label)))||[],t=i&&i.positions&&i.positions.length>0,n=t?{priorState:i}:void 0;t&&i&&i.positions.map((e=>e.id)).filter((t=>e.includes(t))),yield p.current.renderLayout(j.layout,n)}g(!1)}catch(e){console.error("Error rendering SpyTial graph:",e),h(`Error rendering graph: ${e.message}`),g(!1)}}}))),[t.data,t.id,n,s,v,i]);return(0,o.useEffect)((()=>{if(!d.current||y.current)return;const e=document.createElement("webcola-cnd-graph");e.id="spytial-graph-container",e.setAttribute("layoutFormat","default"),e.setAttribute("aria-label","Interactive graph visualization"),e.style.cssText="\n width: 100%;\n height: 100%;\n min-height: 400px;\n display: block;\n ";const t=e=>{var t;if((null===(t=p.current)||void 0===t?void 0:t.getLayoutState)&&w.current){const e=p.current.getLayoutState();e&&e.positions&&e.positions.length>0&&w.current(e)}},n=e=>{var t;if((null===(t=p.current)||void 0===t?void 0:t.getLayoutState)&&w.current){const e=p.current.getLayoutState();e&&e.positions&&e.positions.length>0&&w.current(e)}},r=e=>{var t;if((null===(t=p.current)||void 0===t?void 0:t.getLayoutState)&&w.current){const e=p.current.getLayoutState();e&&e.positions&&e.positions.length>0&&w.current(e)}};return e.addEventListener("layout-complete",t),e.addEventListener("node-drag-end",n),e.addEventListener("viewbox-change",r),d.current.appendChild(e),p.current=e,y.current=!0,()=>{p.current&&(p.current.removeEventListener("layout-complete",t),p.current.removeEventListener("node-drag-end",n),p.current.removeEventListener("viewbox-change",r),p.current.clear&&p.current.clear(),d.current&&p.current.parentNode===d.current&&d.current.removeChild(p.current)),p.current=null,b.current=null,y.current=!1}}),[]),(0,o.useEffect)((()=>{p.current&&x&&j()}),[t.data,n,s,j,x]),(0,r.jsxs)("div",Object.assign({className:"absolute inset-0 flex flex-col",style:{background:"white",overflow:"hidden"}},{children:[(0,r.jsx)("div",{ref:d,style:{flex:1,position:"relative",minHeight:"400px",cursor:l?"pointer":"default"}}),m&&(0,r.jsx)("div",Object.assign({className:"absolute inset-0 flex items-center justify-center bg-white bg-opacity-75",style:{zIndex:10,pointerEvents:"none"}},{children:(0,r.jsx)("div",Object.assign({className:"text-gray-600"},{children:"Loading graph..."}))})),u&&(0,r.jsxs)("div",Object.assign({className:"absolute bottom-0 left-0 right-0 p-4 bg-red-100 border-t border-red-300 text-red-700",style:{zIndex:20}},{children:[(0,r.jsx)("strong",{children:"Error:"})," ",u]}))]}))};function aa(e){var t;try{return((null===(t=e.getTypes)||void 0===t?void 0:t.call(e))||[]).some((e=>{var t;return"No more instances! Some equivalent instances may have been removed through symmetry breaking."===(e.id||(null===(t=e.getId)||void 0===t?void 0:t.call(e))||"")}))}catch(e){return!1}}const la=e=>{const{datum:t,cndSpec:n,timeIndex:s,projectionType:i,atomId:a,atomLabel:l,index:c}=e,d=(0,o.useRef)(null),p=(0,o.useRef)(null),[u,h]=(0,o.useState)(null),[m,g]=(0,o.useState)(!0),x=(0,o.useRef)(!1),f=(0,o.useRef)(null);console.log(`[SingleProjectionPane] projectionType=${i}, atomId=${a}, atomLabel=${l}`);const b=(0,o.useCallback)((()=>{return e=void 0,r=void 0,c=function*(){if(p.current){if(g(!0),h(null),void 0===window.CndCore)return h("CnD Core library is not available."),void g(!1);try{const e=t.data;if(!e)throw new Error("No Alloy XML data available in datum");const r=window.CndCore.AlloyInstance.parseAlloyXML(e);if(!r.instances||0===r.instances.length)throw new Error("No instances found in Alloy XML");const o=void 0!==s?Math.min(s,r.instances.length-1):0,c=new window.CndCore.AlloyDataInstance(r.instances[o]);if(aa(c))return h("No more instances available."),void g(!1);const d=new window.CndCore.SGraphQueryEvaluator;d.initialize({sourceData:c});let u=null;try{u=window.CndCore.parseLayoutSpec(n||"")}catch(e){console.error(`[Projection ${l}] Layout spec parse error:`,e),u=window.CndCore.parseLayoutSpec("")}const m=!0,x=new window.CndCore.LayoutInstance(u,d,0,m),b=i?{[i]:a}:{};console.log(`[SingleProjectionPane ${l}] Generating with projection:`,i,"->",a,"Full projections:",b);const y=x.generateLayout(c,b);y.error&&(console.error(`[Projection ${l}] Layout generation error:`,y.error),h(`Layout error: ${y.error.message}`)),f.current=y.layout,p.current&&y.layout&&(yield p.current.renderLayout(y.layout)),g(!1)}catch(e){console.error(`[Projection ${l}] Error rendering graph:`,e),h(`Error: ${e.message}`),g(!1)}}},new((o=void 0)||(o=Promise))((function(t,n){function s(e){try{a(c.next(e))}catch(e){n(e)}}function i(e){try{a(c.throw(e))}catch(e){n(e)}}function a(e){var n;e.done?t(e.value):(n=e.value,n instanceof o?n:new o((function(e){e(n)}))).then(s,i)}a((c=c.apply(e,r||[])).next())}));var e,r,o,c}),[t.data,t.id,n,s,i,a,l]);return(0,o.useEffect)((()=>{if(!d.current||x.current)return;const e=document.createElement("webcola-cnd-graph");return e.id=`spytial-graph-projection-${c}`,e.setAttribute("layoutFormat","default"),e.setAttribute("aria-label",`Graph visualization for ${l}`),e.style.cssText="\n width: 100%;\n height: 100%;\n min-height: 200px;\n display: block;\n ",d.current.appendChild(e),p.current=e,x.current=!0,()=>{p.current&&(p.current.clear&&p.current.clear(),d.current&&p.current.parentNode===d.current&&d.current.removeChild(p.current)),p.current=null,f.current=null,x.current=!1}}),[c,l]),(0,o.useEffect)((()=>{p.current&&void 0!==window.CndCore&&b()}),[t.data,n,s,b]),(0,r.jsxs)("div",Object.assign({className:"relative flex flex-col border border-gray-300 rounded-lg overflow-hidden bg-white shadow-sm"},{children:[(0,r.jsx)("div",Object.assign({className:"px-3 py-2 bg-gray-100 border-b border-gray-200"},{children:(0,r.jsx)("span",Object.assign({className:"font-medium text-sm text-gray-700"},{children:l}))})),(0,r.jsx)("div",{ref:d,className:"flex-1",style:{minHeight:"250px",background:"white"}}),m&&(0,r.jsx)("div",Object.assign({className:"absolute inset-0 flex items-center justify-center bg-white bg-opacity-75",style:{zIndex:10,pointerEvents:"none"}},{children:(0,r.jsx)("div",Object.assign({className:"text-gray-600 text-sm"},{children:"Loading..."}))})),u&&(0,r.jsx)("div",Object.assign({className:"px-3 py-2 bg-red-50 border-t border-red-200 text-red-600 text-xs"},{children:u}))]}))},ca=e=>{const{datum:t,cndSpec:n,timeIndex:s,projectionType:i,selectedAtoms:a}=e;console.log("[MultiProjectionGraph] Props:",{projectionType:i,selectedAtoms:a,datumId:null==t?void 0:t.id});const[l,c]=(0,o.useState)([]),[d,p]=(0,o.useState)("undefined"!=typeof window&&void 0!==window.CndCore),[u,h]=(0,o.useState)(null);(0,o.useEffect)((()=>{if(d)return;const e=()=>!("undefined"==typeof window||!window.CndCore||"function"!=typeof window.CndCore.parseLayoutSpec||(p(!0),0));if(e())return;let t=0;const n=setInterval((()=>{t++,(e()||t>=100)&&(clearInterval(n),t>=100&&!d&&h("CnD Core library failed to load."))}),100);return()=>clearInterval(n)}),[d]),(0,o.useEffect)((()=>{if(d&&t.data)try{const e=t.data,n=window.CndCore.AlloyInstance.parseAlloyXML(e);if(!n.instances||0===n.instances.length)return void h("No instances found in Alloy XML");const r=void 0!==s?Math.min(s,n.instances.length-1):0,o=new window.CndCore.AlloyDataInstance(n.instances[r]);if(aa(o))return void h("No more instances available.");const i=new window.CndCore.SGraphQueryEvaluator;i.initialize({sourceData:o});const a=window.CndCore.parseLayoutSpec(""),l=new window.CndCore.LayoutInstance(a,i,0,!0).generateLayout(o,{});l.projectionData&&c(l.projectionData)}catch(e){console.error("Error extracting projection data:",e),h(`Error: ${e.message}`)}}),[t.data,s,d]);const m=(0,o.useMemo)((()=>{const e=l.find((e=>e.typeId===i||e.typeName===i));console.log("[MultiProjectionGraph] Looking for typeData:",{projectionType:i,found:e,allTypes:l.map((e=>({typeId:e.typeId,typeName:e.typeName})))});const t=(null==e?void 0:e.atoms)||[],n=new Map(t.map((e=>[e.id,e])));return a.map((e=>{const t=n.get(e);return{id:e,label:(null==t?void 0:t.label)||e}}))}),[l,i,a]),g=(0,o.useMemo)((()=>{const e=m.length;return e<=2?e:e<=4?2:e<=6?3:4}),[m.length]);if(u)return(0,r.jsx)("div",Object.assign({className:"flex items-center justify-center h-full p-4"},{children:(0,r.jsxs)("div",Object.assign({className:"text-red-600 bg-red-50 p-4 rounded-lg"},{children:[(0,r.jsx)("strong",{children:"Error:"})," ",u]}))}));if(!d)return(0,r.jsx)("div",Object.assign({className:"flex items-center justify-center h-full"},{children:(0,r.jsx)("div",Object.assign({className:"text-gray-600"},{children:"Loading CnD Core..."}))}));if(0===m.length)return(0,r.jsx)("div",Object.assign({className:"flex items-center justify-center h-full p-4"},{children:(0,r.jsxs)("div",Object.assign({className:"text-gray-600 bg-gray-50 p-4 rounded-lg"},{children:['No atoms selected for projection type "',i,'".']}))}));const x=(0,o.useMemo)((()=>{const e=l.find((e=>e.typeId===i||e.typeName===i));return(null==e?void 0:e.typeName)||i||"Unknown"}),[l,i]);return(0,r.jsxs)("div",Object.assign({className:"absolute inset-0 overflow-auto bg-gray-100 p-4"},{children:[(0,r.jsxs)("div",Object.assign({className:"mb-4 px-2"},{children:[(0,r.jsxs)("h2",Object.assign({className:"text-lg font-semibold text-gray-800"},{children:["Projections over ",x]})),(0,r.jsxs)("p",Object.assign({className:"text-sm text-gray-600"},{children:["Showing ",m.length," selected projection",1!==m.length?"s":""]}))]})),(0,r.jsx)("div",Object.assign({className:"grid gap-4",style:{gridTemplateColumns:`repeat(${g}, minmax(300px, 1fr))`}},{children:m.map(((e,o)=>(0,r.jsx)(la,{datum:t,cndSpec:n,timeIndex:s,projectionType:i,atomId:e.id,atomLabel:e.label,index:o},e.id)))}))]}))};const da=e=>{const{datum:t,cndSpec:n,timeIndex:s,traceLength:i,index:a}=e,l=(0,o.useRef)(null),c=(0,o.useRef)(null),[d,p]=(0,o.useState)(null),[u,h]=(0,o.useState)(!0),m=(0,o.useRef)(!1),g=(0,o.useRef)(null),x=(0,o.useCallback)((()=>{return e=void 0,r=void 0,i=function*(){if(c.current){if(h(!0),p(null),void 0===window.CndCore)return p("CnD Core library is not available."),void h(!1);try{const e=t.data;if(!e)throw new Error("No Alloy XML data available in datum");const r=window.CndCore.AlloyInstance.parseAlloyXML(e);if(!r.instances||0===r.instances.length)throw new Error("No instances found in Alloy XML");const o=Math.min(s,r.instances.length-1),i=new window.CndCore.AlloyDataInstance(r.instances[o]);if(function(e){var t;try{return((null===(t=e.getTypes)||void 0===t?void 0:t.call(e))||[]).some((e=>{var t;return"No more instances! Some equivalent instances may have been removed through symmetry breaking."===(e.id||(null===(t=e.getId)||void 0===t?void 0:t.call(e))||"")}))}catch(e){return!1}}(i))return p("No more instances available."),void h(!1);const a=new window.CndCore.SGraphQueryEvaluator;a.initialize({sourceData:i});let l=null;try{l=window.CndCore.parseLayoutSpec(n||"")}catch(e){console.error(`[Time ${s}] Layout spec parse error:`,e),l=window.CndCore.parseLayoutSpec("")}const d=!0,u=new window.CndCore.LayoutInstance(l,a,o,d),m=window.currentProjections||{},x=u.generateLayout(i,m);x.error&&(console.error(`[Time ${s}] Layout generation error:`,x.error),p(`Layout error: ${x.error.message}`)),g.current=x.layout,c.current&&x.layout&&(yield c.current.renderLayout(x.layout)),h(!1)}catch(e){console.error(`[Time ${s}] Error rendering graph:`,e),p(`Error: ${e.message}`),h(!1)}}},new((o=void 0)||(o=Promise))((function(t,n){function s(e){try{l(i.next(e))}catch(e){n(e)}}function a(e){try{l(i.throw(e))}catch(e){n(e)}}function l(e){var n;e.done?t(e.value):(n=e.value,n instanceof o?n:new o((function(e){e(n)}))).then(s,a)}l((i=i.apply(e,r||[])).next())}));var e,r,o,i}),[t.data,t.id,n,s]);return(0,o.useEffect)((()=>{if(!l.current||m.current)return;const e=document.createElement("webcola-cnd-graph");return e.id=`spytial-graph-temporal-${a}`,e.setAttribute("layoutFormat","default"),e.setAttribute("aria-label",`Graph visualization for time step ${s+1}`),e.style.cssText="\n width: 100%;\n height: 100%;\n min-height: 200px;\n display: block;\n ",l.current.appendChild(e),c.current=e,m.current=!0,()=>{c.current&&(c.current.clear&&c.current.clear(),l.current&&c.current.parentNode===l.current&&l.current.removeChild(c.current)),c.current=null,g.current=null,m.current=!1}}),[a,s]),(0,o.useEffect)((()=>{c.current&&void 0!==window.CndCore&&x()}),[t.data,n,s,x]),(0,r.jsxs)("div",Object.assign({className:"relative flex flex-col border border-gray-300 rounded-lg overflow-hidden bg-white shadow-sm"},{children:[(0,r.jsx)("div",Object.assign({className:"px-3 py-2 bg-blue-50 border-b border-blue-200"},{children:(0,r.jsxs)("span",Object.assign({className:"font-medium text-sm text-blue-800"},{children:["State ",s+1," of ",i]}))})),(0,r.jsx)("div",{ref:l,className:"flex-1",style:{minHeight:"250px",background:"white"}}),u&&(0,r.jsx)("div",Object.assign({className:"absolute inset-0 flex items-center justify-center bg-white bg-opacity-75",style:{zIndex:10,pointerEvents:"none"}},{children:(0,r.jsx)("div",Object.assign({className:"text-gray-600 text-sm"},{children:"Loading..."}))})),d&&(0,r.jsx)("div",Object.assign({className:"px-3 py-2 bg-red-50 border-t border-red-200 text-red-600 text-xs"},{children:d}))]}))},pa=e=>{const{datum:t,cndSpec:n,selectedTimeIndices:s,traceLength:i}=e,[a,l]=(0,o.useState)("undefined"!=typeof window&&void 0!==window.CndCore),[c,d]=(0,o.useState)(null);(0,o.useEffect)((()=>{if(a)return;const e=()=>!("undefined"==typeof window||!window.CndCore||"function"!=typeof window.CndCore.parseLayoutSpec||(l(!0),0));if(e())return;let t=0;const n=setInterval((()=>{t++,(e()||t>=100)&&(clearInterval(n),t>=100&&!a&&d("CnD Core library failed to load."))}),100);return()=>clearInterval(n)}),[a]);const p=(0,o.useMemo)((()=>{const e=s.length;return e<=2?e:e<=4?2:e<=6?3:4}),[s.length]);return c?(0,r.jsx)("div",Object.assign({className:"flex items-center justify-center h-full p-4"},{children:(0,r.jsxs)("div",Object.assign({className:"text-red-600 bg-red-50 p-4 rounded-lg"},{children:[(0,r.jsx)("strong",{children:"Error:"})," ",c]}))})):a?0===s.length?(0,r.jsx)("div",Object.assign({className:"flex items-center justify-center h-full p-4"},{children:(0,r.jsx)("div",Object.assign({className:"text-gray-600 bg-gray-50 p-4 rounded-lg"},{children:"No time steps selected."}))})):(0,r.jsxs)("div",Object.assign({className:"absolute inset-0 overflow-auto bg-gray-100 p-4"},{children:[(0,r.jsxs)("div",Object.assign({className:"mb-4 px-2"},{children:[(0,r.jsx)("h2",Object.assign({className:"text-lg font-semibold text-gray-800"},{children:"Temporal Comparison"})),(0,r.jsxs)("p",Object.assign({className:"text-sm text-gray-600"},{children:["Showing ",s.length," time step",1!==s.length?"s":""," of ",i]}))]})),(0,r.jsx)("div",Object.assign({className:"grid gap-4",style:{gridTemplateColumns:`repeat(${p}, minmax(300px, 1fr))`}},{children:s.map(((e,o)=>(0,r.jsx)(da,{datum:t,cndSpec:n,timeIndex:e,traceLength:i,index:o},`time-${e}`)))}))]})):(0,r.jsx)("div",Object.assign({className:"flex items-center justify-center h-full"},{children:(0,r.jsx)("div",Object.assign({className:"text-gray-600"},{children:"Loading CnD Core..."}))}))},ua=e=>{const t=jt(),{datumId:n,button:s,generatorId:i}=e,{text:a,onClick:l,mouseover:c}=s,d=(0,o.useCallback)((()=>{t(_e({id:n,onClick:l,context:{generatorName:i,id:n}}))}),[n,s]);return(0,r.jsx)(Is.u,Object.assign({hasArrow:!0,label:c,isDisabled:void 0===c},{children:(0,r.jsx)(ze,Object.assign({onClick:d},{children:a}))}))},ha=e=>{const{datum:t}=e,{id:n,parsed:o,buttons:s,generatorName:i}=t,a=o.command;return(0,r.jsxs)("div",Object.assign({className:"w-full flex item-center space-x-2 px-2"},{children:[(0,r.jsxs)(k,Object.assign({className:"text-gray-400"},{children:["ID: ",n]})),(0,r.jsx)(k,{children:a}),(0,r.jsx)("div",{className:"grow"}),s&&s.map(((e,t)=>(0,r.jsx)(ua,{datumId:n,generatorId:i,button:e},t)))]}))},ma=()=>{const e=jt(),t=St(hr),n=St((e=>t?$r(e,t):"")),s=St((e=>t?Tr(e,t):0)),i=St((e=>t?Pr(0,t):1)),a=St((e=>t?Vr(e,t):{})),l=St((e=>t?Fr(e,t):[])),c=(0,o.useMemo)((()=>{console.log("[GraphView] selectedProjections:",a);for(const[e,t]of Object.entries(a))if(console.log(`[GraphView] Checking typeId="${e}", atoms:`,t),t.length>1)return console.log(`[GraphView] Found multi-projection: typeId="${e}" with ${t.length} atoms`),{typeId:e,atoms:t};return null}),[a]),d=l.length>1,p=St(Zr),u=St(Ur),h=(0,o.useRef)(void 0),m=(0,o.useCallback)((e=>{h.current=e}),[]),g=(0,o.useCallback)((t=>{p&&e(bi({dataInstance:t}))}),[e,p]),x=null!==c&&!p&&!d,b=d&&!p;return(0,r.jsx)(f,Object.assign({className:"grid grid-flow-col divide-x divide-dashed"},{children:t?(0,r.jsx)("div",Object.assign({className:"relative"},{children:(0,r.jsxs)(f,{children:[(0,r.jsx)(I,Object.assign({className:"border-b"},{children:(0,r.jsx)(ha,{datum:t})})),(0,r.jsx)(C,{children:t?b?(0,r.jsx)(pa,{datum:t,cndSpec:n,selectedTimeIndices:l,traceLength:i}):x&&c?(0,r.jsx)(ca,{datum:t,cndSpec:n,timeIndex:s,projectionType:c.typeId,selectedAtoms:c.atoms}):(0,r.jsx)(ia,{datum:t,cndSpec:n,timeIndex:s,priorState:h.current,onLayoutStateChange:m,synthesisMode:p&&u>0,onDataInstanceCreated:g}):null})]})})):null}))};var ga=n(4953);const xa=(0,Ee.oM)({name:"script",initialState:{stage:"svg",stageDimensions:{width:0,height:0},text:"",scriptTextByDatumId:{}},reducers:{scriptStageDimensionsSet(e,t){e.stageDimensions=t.payload},scriptStageSet(e,t){e.stage=t.payload},scriptTextSet(e,t){e.text=t.payload},scriptTextByDatumSet(e,t){const{id:n,text:r}=t.payload;e.scriptTextByDatumId[n]=r}},extraReducers:e=>e.addCase(_s,((e,t)=>{e.text=e.scriptTextByDatumId[t.payload]})).addCase(Be,((e,t)=>{const{enter:n,update:r,exit:o}=t.payload;if(n){(0,ks.Z)(n,(t=>{"visualizerConfig"in t.parsed&&"script"in t.parsed.visualizerConfig&&(e.scriptTextByDatumId[t.id]=t.parsed.visualizerConfig.script)}));const t=(0,zt.Z)(n);t&&(e.text=e.scriptTextByDatumId[t.id])}o&&(0,Ft.Z)(o,(t=>{e.scriptTextByDatumId[t]=""}))}))}),{scriptStageSet:fa,scriptStageDimensionsSet:ba,scriptTextSet:ya,scriptTextByDatumSet:wa}=xa.actions,va=xa.reducer;var ja=n(76815);function Sa(e){return(0,ja.pF)(e)}var Aa=n(81493);const Ca="\nclass AlloyError {\n static error(source: string, message: string): Error;\n\n static missingAttribute(source: string, attribute: string): Error;\n\n static missingElement(source: string, element: string): Error;\n}\n\nclass AlloySignature extends AlloySet {\n private readonly _id;\n private readonly _atoms;\n private _subsignatures;\n\n /**\n * Create a new Alloy signature.\n *\n * @param id The signature's unique ID\n * @param atoms The atoms defined by the signature\n * @param proxy If provided, a proxied signature will be created.\n */\n constructor(id: string, atoms: AlloyAtom[], proxy?: AlloyProxy);\n\n /**\n * Get an atom by ID\n * @param id The atom ID\n * @returns An atom or null if there is no atom with the specified ID\n */\n atom(id: string): AlloyAtom | null;\n\n /**\n * Get an array of all atoms in this signature.\n * @param recursive If false, return only atoms defined by this signature,\n * if true, include atoms defined by all subsignatures as well.\n */\n atoms(recursive?: boolean): AlloyAtom[];\n\n /**\n * Create a clone of this signature.\n * @param proxy If provided, a proxied clone will be returned.\n */\n clone(proxy?: AlloyProxy): AlloySignature;\n\n /**\n * Get the signature ID.\n */\n id(): string;\n\n /**\n * Get an array of all signatures that extend this signature.\n * @param recursive If false, return only signatures that are immediate\n * children of this signature. If true, return all signatures that are\n * descendants of this signature.\n */\n subSignatures(recursive?: boolean): AlloySignature[];\n\n /**\n * Create a signature from an XML element and populate the signature with\n * atoms. Any signatures that extend the one defined in the element are not\n * created.\n *\n * @param element The XML `````` element\n * @param proxy If provided, a proxied signature with proxied atoms will be\n * returned.\n */\n static fromElement(element: Element, proxy?: AlloyProxy): AlloySignature;\n\n /**\n * Create the Int signature.\n *\n * @param bitwidth The integer bitwidth, which must be greater than or equal to zero.\n * @param proxy If provided, a proxied Int signature with proxied atoms will\n * be returned.\n */\n static intSignature(bitwidth: number, proxy?: AlloyProxy): AlloySignature;\n\n /**\n * TODO: Check and document this.\n * @param intsig\n * @param proxy\n */\n static seqIntSignature(\n intsig: AlloySignature,\n proxy?: AlloyProxy\n ): AlloySignature;\n\n /**\n * Build all signatures from an XML `````` element. All signatures are\n * populated with atoms.\n *\n * @param instance The XML `````` element\n * @param proxy If provided, all signatures and atoms will be proxied.\n * @returns A map of string IDs, as defined by the \"ID\" attribute for each\n * signature, to [[AlloySignature]] objects.\n */\n static signaturesFromXML(\n instance: Element,\n proxy?: AlloyProxy\n ): Map;\n\n /**\n * Get an array of signature types associated with an XML element. Typically\n * this is used when parsing a field or skolem, as each `````` and ``````\n * element will have a `````` child. This method parses the types defined\n * in this element and returns the corresponding signatures.\n *\n * @param element The XML element that has a child\n * @param sigIDs A map of signature IDs to signatures\n */\n static typesFromXML(\n element: Element,\n sigIDs: Map\n ): AlloySignature[];\n}\n\nclass AlloySet {\n protected _tuples: AlloyTuple[];\n\n /**\n * Create a new Alloy set.\n *\n * @param tuples The tuples contained in the set\n */\n constructor(tuples?: AlloyTuple[]);\n\n /**\n * Returns true if the set is empty, false if it is not.\n */\n empty(): boolean;\n\n /**\n * Returns true if this set is equivalent to the provided set, false otherwise.\n * @param that The set to compare to\n */\n equals(that: AlloySet): boolean;\n\n /**\n * Returns true if this set is a subset of the provided set, false otherwise.\n * @param that The set to compare to\n */\n in(that: AlloySet): boolean;\n\n /**\n * Perform a join operation with another set. This operation is equivalent\n * to the dot join operator in Alloy, in which this set is on the left side\n * of the dot and that set is on the right side.\n *\n * @param that The other set\n */\n join(that: AlloySet): AlloySet;\n\n /**\n * Create a printable string representation of this set.\n */\n toString(): string;\n\n /**\n * Get an array of all tuples in this set.\n */\n tuples(): AlloyTuple[];\n}\n\nclass AlloyTuple extends AlloySet {\n private _atoms;\n\n /**\n * Create a new Alloy tuple.\n *\n * @param atoms The atoms, in order, that comprise the tuple.\n */\n constructor(atoms: AlloyAtom[]);\n\n /**\n * Get an ordered list of the atoms in this tuple.\n */\n atoms(): AlloyAtom[];\n\n /**\n * Create a printable string representation of this tuple.\n */\n toString(): string;\n\n /**\n * Create an array of tuples from a node list of `````` XML elements.\n *\n * @param elements A node list of `````` elements, typically created\n * using the ```querySelectorAll()``` method on a `````` or\n * `````` element.\n * @param types An ordered array of signatures that define the type of each\n * atom in each tuple, typically created using [[AlloySignature.typesFromXML]].\n */\n static tuplesFromXML(\n elements: NodeListOf,\n types: AlloySignature[]\n ): AlloyTuple[];\n}\n\nclass AlloyProxy {\n private readonly _sets;\n\n constructor();\n\n applyProxy(set: T, id?: string): T;\n\n private _finalize;\n}\n\n/**\n * In Alloy, an atom is a primitive entity that is indivisible, immutable, and\n * uninterpreted.\n */\nclass AlloyAtom extends AlloySet {\n private readonly _id;\n\n constructor(id: string, proxy?: AlloyProxy);\n\n clone(proxy?: AlloyProxy): AlloyAtom;\n\n id(): string;\n\n static fromElement(element: Element, proxy?: AlloyProxy): AlloyAtom;\n}\n\nclass AlloyTypedSet extends AlloySet {\n private readonly _types;\n\n constructor(types: AlloySignature[], tuples: AlloyTuple[]);\n\n project(atoms: Map): void;\n\n types(): AlloySignature[];\n}\n\nexport class AlloyField extends AlloyTypedSet {\n private readonly _id;\n\n /**\n * Create a new Alloy field.\n * @param id The field's unique ID\n * @param types An array of signatures defining the types of each column of the field\n * @param tuples The tuples defined by the field\n * @param proxy If provided, a proxied signature will be created.\n * @param varName If provided, the variable name to assign to this field when proxied.\n */\n constructor(\n id: string,\n types: AlloySignature[],\n tuples: AlloyTuple[],\n proxy?: AlloyProxy,\n varName?: string\n );\n\n /**\n * Create a clone of this field\n *\n * @param signatures An array of signatures. When creating the clone of this\n * field, the types associated with each column are not cloned. Instead,\n * provide an array of signatures and this method will find the corresponding\n * types by signature ID in the array and use them to define types of the\n * cloned field.\n * @param proxy If provided, a proxied clone will be returned.\n */\n clone(signatures: AlloySignature[], proxy?: AlloyProxy): AlloyField;\n\n /**\n * Get the field ID.\n */\n id(): string;\n\n /**\n * Build all fields from an XML `````` element. All fields are\n * fully populated with tuples.\n *\n * @param instance The XML `````` element\n * @param sigIDs A map of signature string IDs to signature objects\n * @param proxy If provided, all fields will be proxied.\n */\n static fieldsFromXML(\n instance: Element,\n sigIDs: Map,\n proxy?: AlloyProxy\n ): AlloyField[];\n}\n\nclass AlloySkolem extends AlloyTypedSet {\n private readonly _id;\n\n constructor(\n id: string,\n types: AlloySignature[],\n tuples: AlloyTuple[],\n proxy?: AlloyProxy\n );\n\n clone(signatures: AlloySignature[], proxy?: AlloyProxy): AlloySkolem;\n\n id(): string;\n\n static skolemsFromXML(\n instance: Element,\n sigIDs: Map,\n proxy?: AlloyProxy\n ): AlloySkolem[];\n}\n\n/**\n * In Alloy, when you run a predicate or check an assertion, the analyzer\n * searches for an _instance_ of an _analysis constraint_: an assignment of\n * values to the variables of the constraint for which the constraint evaluates\n * to true [[Jackson 2012](http://softwareabstractions.org/)].\n */\nclass AlloyInstance {\n private _proxy;\n private _atoms;\n private _fields;\n private _signatures;\n private _skolems;\n private _projections;\n private _bitwidth;\n private _command;\n private _filename;\n private _sources;\n\n /**\n * Create a new Alloy instance. If no text is provided, an empty instance\n * is created.\n * @param text A string containing the XML output from an Alloy instance\n * @param index\n */\n constructor(text?: string, index?: number);\n\n /**\n * Get an atom by ID.\n * @param id The atom ID\n * @returns An atom or null if there is no atom with the specified ID\n */\n atom(id: string): AlloyAtom | null;\n\n /**\n * Get an array of all atoms in the instance.\n */\n atoms(): AlloyAtom[];\n\n /**\n * Get the bitwidth of the instance.\n */\n bitwidth(): number;\n\n /**\n * Generate a deep clone of the instance.\n * @throws Error if the instance does not have a univ signature.\n */\n clone(): AlloyInstance;\n\n /**\n * Get the command used to generate the instance.\n */\n command(): string;\n\n /**\n * Get a field by ID.\n * @param id The field ID\n * @returns A field or null if there is no field with the specified ID\n */\n field(id: string): AlloyField | null;\n\n /**\n * Get an array of all fields in the instance.\n */\n fields(): AlloyField[];\n\n /**\n * Get the full path of the model used to generate the instance.\n */\n filename(): string;\n\n /**\n * Project the instance over the specified atoms. There may be a maximum of\n * one atom per signature that is a direct descendant of the univ signature.\n * @param atoms The list of atoms over which to project the instance.\n * @returns A clone of the instance with the projection applied.\n * @throws Error if there is more than one atom provided for any signature\n * that is a direct descendant of the univ signature.\n */\n project(atoms: AlloyAtom[]): AlloyInstance;\n\n /**\n * Get the currently projected atoms.\n * @returns A Map object with key-value pairs mapping signatures to projected atoms\n */\n projections(): Map;\n\n /**\n * Get a signature by ID\n * @param id The signature ID\n * @returns A signature or null if there is no signature with the specified ID\n */\n signature(id: string): AlloySignature | null;\n\n /**\n * Get an array of all signatures in the instance.\n */\n signatures(): AlloySignature[];\n\n /**\n * Get a skolem by ID\n * @param id The skolem ID\n * @returns A skolem or null if there is no skolem with the specified ID\n */\n skolem(id: string): AlloySkolem | null;\n\n /**\n * Get an array of all skolems in the instance.\n */\n skolems(): AlloySkolem[];\n\n /**\n * Get all source files that define the model from which this instance was created.\n * @returns A Map object with key-value pairs mapping full path names to file contents\n */\n sources(): Map;\n\n /**\n * Get the univ signature.\n * @returns The univ signature if it exists, null if it does not\n */\n univ(): AlloySignature | null;\n\n private _buildFromXML;\n}",Ma=e=>{const{initialText:t,variables:n,editorRef:s,stageRef:i,beforeUnmount:a,onExecute:l}=e,[c,d]=(0,o.useState)(),p=(0,o.useCallback)((e=>{s(e),d(e)}),[]);return(0,o.useEffect)((()=>{if(c){c.addCommand(Aa.Fd.KeyMod.WinCtrl|Aa.Fd.KeyCode.Enter,(()=>{l()}));const e="ts:filename/alloy.d.js",t=Aa.Fd.Uri.parse(e);null!==Aa.Fd.editor.getModel(t)||(Aa.Fd.languages.typescript.javascriptDefaults.setExtraLibs([{content:Ca,filePath:"alloy.js"}]),Aa.Fd.editor.createModel(Ca,"typescript",t))}}),[c,l,i]),(0,o.useEffect)((()=>{const e=function(e){return e.map((e=>`declare const ${e.name}: ${e.type};`)).join("\n")}(n);Aa.Fd.languages.typescript.javascriptDefaults.setExtraLibs([{content:"\n/**\n * To anyone adding to this library in the future: please take the following steps when adding\n * new VisualObjects.\n *\n * 1. If the object is to be accessible within sterling, add it to library within ScriptViewImports.\n * 2. Add the name of the file, minus .d.ts, to the list within d3lib-def-compiler/src/D3LibDefCompiler.java.\n * 3. Run the typescript compiler (\"tsc\" in terminal) from within the d3-packages folder.\n * 4. Run the main method within D3LibDefCompiler.\n *\n * If these steps are not followed, the file's definitions will either not be accessible within\n * sterling, or will not show up in monaco.\n */\ndeclare type BoundingBoxGenerator = (r: number) => Coords;\ndeclare class VisualObject {\n center: () => Coords;\n children: VisualObject[];\n dependents: VisualObject[];\n bounding_box_lam: BoundingBoxGenerator;\n hasBoundingBox: boolean;\n /**\n * Top level class, which all other visual objects will extend.\n * @param coords position of the object on screen.\n */\n constructor(coords?: Coords | (() => Coords));\n boundingBox(): BoundingBox;\n getChildren(): VisualObject[];\n /**\n * Shifts object to have new given center\n * @param center new center of the object\n */\n setCenter(center: Coords | (() => Coords)): void;\n hasLam(): Boolean;\n getLam(): BoundingBoxGenerator;\n /**\n * Renders the object to the screen.\n * @param svg HTML Svg object to which the object should be rendered.\n */\n render(svg: any): void;\n}\n//# sourceMappingURL=VisualObject.d.ts.map\ninterface ShapeProps {\n center?: Coords | (() => Coords);\n color?: string | (() => string);\n borderWidth?: number | (() => number);\n borderColor?: string | (() => string);\n label?: string | (() => string);\n labelColor?: string | (() => string);\n labelSize?: number | (() => number);\n opacity?: number | (() => number);\n}\n/**\n * Generic class for a large suite of \"shape\"-like objects.\n * Generally includes anything with an inside and an outside.\n * All shapes come with builtin label.\n */\ndeclare class Shape extends VisualObject {\n color: () => string;\n borderWidth: () => number;\n borderColor: () => string;\n opacity: () => number;\n label: TextBox;\n /**\n * Constructs a generic shape object. This is a top-level class,\n * which should not be used except as super class for other specific\n * shapes.\n * @param coords coordinates of the shape\n * @param color color of shape's interior\n * @param borderWidth width of Shape's border\n * @param borderColor color of border\n * @param label text to display atop the shape\n * @param labelColor color of text\n * @param labelSize size of text\n * @param style\n */\n constructor(props: ShapeProps);\n setColor(color: string | (() => string)): void;\n setBorderWidth(borderWidth: number | (() => number)): void;\n setBorderColor(borderColor: string | (() => string)): void;\n setLabelText(text: string | (() => string)): void;\n setLabelColor(labelColor: string | (() => string)): void;\n setLabelSize(labelSize: number | (() => number)): void;\n}\n//# sourceMappingURL=Shape.d.ts.map\ndeclare class Pane {\n Children: VisualObject[];\n constructor();\n add(addNode: VisualObject): void;\n render(svg: any): void;\n}\n//# sourceMappingURL=Pane.d.ts.map\ninterface gridProps {\n grid_location: Coords | (() => Coords);\n cell_size: {\n x_size: number;\n y_size: number;\n };\n grid_dimensions: {\n x_size: number;\n y_size: number;\n };\n}\ndeclare class Grid extends VisualObject {\n /**\n *\n * As one of the most common expressions of a graph is a matrix, we offer functionality\n * for building a grid of cells, where you can add visual objects to each square in the grid,\n * and they are automatically formatted into the grid (where the center of the object is aligned\n * to the center of the grid)\n *\n * Note: grid size is fixed! You can't change the size of a grid once it's created\n *\n */\n private coords;\n config: gridProps;\n cells: Array>;\n gridlines: Array;\n constructor(props: gridProps);\n private check_bounding_box;\n add(coords: Coords, add_object: VisualObject, ignore_warning?: boolean): void;\n private center_helper;\n private fill_grid_lines;\n hide_grid_lines(): void;\n fill(coords: Coords, color: string): void;\n private check_coords;\n}\n{};\n//# sourceMappingURL=Grid.d.ts.map\ninterface RectangleProps extends ShapeProps {\n height: number | (() => number);\n width: number | (() => number);\n coords?: Coords | (() => Coords);\n}\ndeclare class Rectangle extends Shape {\n height: () => number;\n width: () => number;\n /**\n * Creates a logical rectangle object\n * @param height height (y direction)\n * @param width width (x direction)\n * @param coords coordinates of the top-left point\n * @param color color for interior\n * @param borderWidth width of border\n * @param borderColor color of border\n * @param label text for label\n * @param labelColor color for label text\n * @param labelSize size of label text\n */\n constructor(props: RectangleProps);\n boundingBox(): BoundingBox;\n setWidth(width: number | (() => number)): void;\n setHeight(height: number | (() => number)): void;\n render(svg: any): void;\n}\n//# sourceMappingURL=Rectangle.d.ts.map\ninterface CircleProps extends ShapeProps {\n radius: number | (() => number);\n}\ndeclare class Circle extends Shape {\n radius: () => number;\n bounding_box_lam: BoundingBoxGenerator;\n /**\n * Creates a circle object at the given location\n * @param radius radius of circle\n * @param coords coordinates of circle's center\n * @param color color of interior\n * @param borderWidth width border\n * @param borderColor color for border\n * @param label text for label\n * @param labelColor color of label\n * @param labelSize size of label\n */\n constructor(props: CircleProps);\n boundingBox(): BoundingBox;\n setRadius(radius: number | (() => number)): void;\n render(svg: any): void;\n}\n//# sourceMappingURL=Circle.d.ts.map\ndeclare class Stage {\n Children: VisualObject[];\n constructor();\n add(addObject: VisualObject): void;\n children_to_tree_recurse(root: VisualObject): VisTree;\n render(svg: any, document?: any): void;\n}\n//# sourceMappingURL=Stage.d.ts.map\ninterface TextBoxProps {\n text?: string | (() => string);\n coords?: Coords | (() => Coords);\n color?: string | (() => string);\n fontSize?: number | (() => number);\n}\ndeclare class TextBox extends VisualObject {\n text: () => string;\n fontSize: () => number;\n color: () => string;\n /**\n * Displays given text.\n * @param text text to display\n * @param coords location for center of text\n * @param color text color\n * @param fontSize size of the text\n */\n constructor(props: TextBoxProps);\n boundingBox(): BoundingBox;\n setText(text: string | (() => string)): void;\n setFontSize(fontSize: number | (() => number)): void;\n setTextColor(color: string | (() => string)): void;\n render(svg: any): void;\n}\n//# sourceMappingURL=TextBox.d.ts.map\ninterface LineProps {\n points?: Coords[] | (() => Coords)[];\n arrow?: boolean;\n color?: string | (() => string);\n width?: number | (() => number);\n opacity?: number | (() => number);\n style?: string | (() => string);\n}\ndeclare class Line extends VisualObject {\n pointsRelative: (() => Coords)[];\n color: () => string;\n width: () => number;\n opacity: () => number;\n arrow: boolean;\n style: () => string;\n /**\n * Creates a line on the given poitns.\n * @param points list of points for the line to pass through\n * @param color color of line\n * @param width width of line\n * @param opacity of the line\n */\n constructor(props: LineProps);\n boundingBox(): BoundingBox;\n setColor(color: string | (() => string)): void;\n setWidth(width: number | (() => number)): void;\n setOpacity(opacity: number | (() => number)): void;\n render(svg: any): void;\n}\n//# sourceMappingURL=Line.d.ts.map\n/**\n * This class is not currently being used!!\n */\ndeclare class ConjoinedObject extends VisualObject {\n /**\n * Note: this code is untested!\n */\n children: VisualObject[];\n constructor(Children?: VisualObject[]);\n addOrdered(obj: VisualObject, index: number): void;\n add(obj: VisualObject): void;\n setCenter(coords: Coords): void;\n render(svg: any): void;\n}\n//# sourceMappingURL=ConjoinedObject.d.ts.map\ninterface PolygonProps extends ShapeProps {\n points: Coords[] | (() => Coords)[];\n}\n/**\n * Class Representing Polygonal objects. Takes the form of any\n * series of points, and will form a polygon with said points as the boundary.\n */\ndeclare class Polygon extends Shape {\n pointsRelative: (() => Coords)[];\n /**\n * Constructs a polygon object\n * @param points list of points forming outside\n * @param color color of interior\n * @param borderWidth width of the border\n * @param borderColor color of the border\n * @param label text to label with\n * @param labelColor color of label text\n * @param labelSize size of the label\n */\n constructor(props: PolygonProps);\n boundingBox(): BoundingBox;\n render(svg: any): void;\n}\n//# sourceMappingURL=Polygon.d.ts.map\ninterface Node {\n name: string;\n neighbors: string[];\n}\ndeclare class Graph extends VisualObject {\n nodes: Node[];\n node_radius: number;\n fixed_nodes: number;\n graph_dimensions: number;\n node_to_location: any;\n constructor(coords?: Coords, graph_dimensions?: number, fixed_nodes?: number, node_radius?: number);\n setCenter(center: Coords): void;\n center(): {\n x: any;\n y: any;\n };\n add(Nodes: Node[]): void;\n private set_fixed_nodes;\n private set_malleable_nodes;\n check_add_set(Nodes: Node[]): void;\n render(svg: any): void;\n render_lines(svg: any, connections: string[][]): void;\n render_nodes(svg: any): void;\n}\n//# sourceMappingURL=Graph.d.ts.map\n/**\n * This is going to be a generic utility file. Primarily for factoring\n * out algorithms with a higher level of computational complexity.\n */\ndeclare function toFunc(defaultValue: T, t?: T | (() => T)): (() => T);\ninterface Coords {\n x: number;\n y: number;\n}\n/**\n * Generic props for representing a box around an object.\n */\ninterface BoundingBox {\n top_left: Coords;\n bottom_right: Coords;\n}\ndeclare function boxUnion(boxes: BoundingBox[]): {\n top_left: {\n x: number;\n y: number;\n };\n bottom_right: {\n x: number;\n y: number;\n };\n};\ninterface ExperimentalBoundingBox {\n lambda: (radians: number) => Coords;\n}\n/**\n * Simple method averaging the coordinate points in a series.\n * @param points\n * @returns\n */\ndeclare function averagePath(points: Coords[]): Coords;\n/**\n * Shifts a function list of points according to a shift variable\n * @param pointList\n * @param shift\n * @returns\n */\ndeclare function shiftList(pointList: (() => Coords)[], shift: () => Coords): (() => Coords)[];\n/**\n * Utility function returning bounding box for a list of points\n * @param pointList list of points as coords\n * @returns bounding box\n */\ndeclare function boundsOfList(pointList: Coords[]): BoundingBox;\n//# sourceMappingURL=Utility.d.ts.map\n/**\n * Interface for node in a tree with a visualObject\n */\ninterface VisTree {\n visualObject: VisualObject;\n children: VisTree[];\n}\ninterface TreeProps {\n root: VisTree;\n height: number;\n width: number;\n coords?: Coords | (() => Coords);\n edgeColor?: string;\n edgeWidth?: number;\n}\ndeclare class Tree extends VisualObject {\n root: VisTree;\n height: number;\n width: number;\n private lines;\n private subTrees;\n private coords;\n /**\n * Builds a tree object, pulling all children nodes into proper locations and\n * adding lines where necessary.\n * @param root root of the tree of visual objects\n * @param height height of box to bound the tree\n * @param width width of box to bound the tree\n * @param coords top left point of the tree\n */\n constructor(props: TreeProps);\n private setUpSubtrees;\n setLineColor(color: string): void;\n setLineWidth(width: number): void;\n}\n//# sourceMappingURL=Tree.d.ts.map\n",filePath:"helpers.ts"},{content:Ca+"\n"+e,filePath:"alloy.js"},{content:e,filePath:"variables.ts"}])}),[c,n]),(0,r.jsx)(Aa.ZP,{"data-testid":"script-view-monaco-editor",language:"javascript",options:{automaticLayout:!0,scrollBeyondLastLine:!1,scrollbar:{verticalScrollbarSize:12},value:t},editorDidMount:p,editorWillUnmount:e=>{const t=e.getValue();a(t)}})},Ia=e=>{const t=jt(),{datumId:n,button:s,generatorId:i}=e,{text:a,onClick:l,mouseover:c}=s,d=(0,o.useCallback)((()=>{t(_e({id:n,onClick:l,context:{generatorName:i,id:n}}))}),[n,s]);return(0,r.jsx)(Is.u,Object.assign({hasArrow:!0,label:c,isDisabled:void 0===c},{children:(0,r.jsx)(ze,Object.assign({onClick:d},{children:a}))}))},Oa=e=>{const{onExecute:t}=e,n=St(zr),s=jt(),i=(0,o.useCallback)((e=>{s(fa(e))}),[]);return(0,r.jsxs)("div",Object.assign({className:"flex"},{children:[(0,r.jsx)(Is.u,Object.assign({hasArrow:!0,label:""},{children:(0,r.jsx)(S.zx,Object.assign({colorScheme:"blue",size:"xs",onClick:t},{children:"Run"}))})),(0,r.jsxs)(S.hE,Object.assign({className:"pl-2",isAttached:!0,colorScheme:"blue",size:"xs"},{children:[(0,r.jsx)(S.zx,Object.assign({isActive:"div"===n,onClick:()=>i("div")},{children:"
"})),(0,r.jsx)(S.zx,Object.assign({isActive:"canvas"===n,onClick:()=>i("canvas")},{children:""})),(0,r.jsx)(S.zx,Object.assign({isActive:"svg"===n,onClick:()=>i("svg")},{children:""}))]}))]}))},ka=e=>{const{datum:t,onExecute:n}=e,{id:o,parsed:s,buttons:i}=t,a=s.command;return(0,r.jsxs)("div",Object.assign({className:"w-full flex items-center space-x-2 px-2"},{children:[(0,r.jsxs)(k,Object.assign({className:"text-gray-400"},{children:["ID: ",o]})),(0,r.jsx)(k,{children:a}),(0,r.jsx)("div",{className:"grow"}),(0,r.jsx)(Oa,{onExecute:n}),i&&i.map(((e,n)=>(0,r.jsx)(Ia,{datumId:o,generatorId:t.generatorName,button:e},n)))]}))},Na=e=>{const{datum:t}=e,n=jt(),s=(0,ga.pm)(),i=St(zr),a=St(Er),l=St(_r),c=St((e=>Br(e,t))),[d,p]=(0,o.useState)(),[u,h]=(0,o.useState)(null),m=(0,o.useRef)(null);((e,t)=>{const[n,r]=(0,o.useState)();(0,o.useLayoutEffect)((()=>{const n=e.current;if(n){r(n.getBoundingClientRect());const e=new ResizeObserver((e=>{e.forEach((e=>{e.target===n&&(t?t(e.contentRect):r(e.contentRect))}))}));return e.observe(n),()=>{e.unobserve(n)}}}),[e.current])})(m,(e=>{n(ba({width:e.width,height:e.height}))}));const g=(0,o.useCallback)((e=>{p(e)}),[]),x=(0,o.useCallback)((e=>{e&&h(e)}),[]),b=(0,o.useCallback)((e=>{e&&h(e)}),[]),y=(0,o.useCallback)((e=>{e&&h(e)}),[]),w=(0,o.useCallback)((e=>{n(ya(e)),n(wa({id:t.id,text:e}))}),[t]),v=(0,o.useCallback)((()=>{const e=null==d?void 0:d.getValue();if(e&&u&&a){n(ya(e)),n(wa({id:t.id,text:e}));const[r,o]=function(e){const t=e.split("\n"),n=[];let r=0;for(let e=0;e{try{new Function(i,"width","height",...qn.map((e=>e.name)),...c.map((e=>e.name)),...r.map((e=>function(e){return e.replaceAll("-","_")}(e))),o)(u,a.width,a.height,...qn.map((e=>e.value)),...c.map((e=>e.variable)),...e)}catch(e){s({variant:"top-accent",position:"bottom-right",title:e instanceof Error?e.name:"Error",description:Da(e),status:"error",duration:1e4,isClosable:!0})}}))}}),[d,i,u,a,c]);return(0,r.jsxs)(f,{children:[(0,r.jsx)(I,Object.assign({className:"border-b"},{children:(0,r.jsx)(ka,{datum:t,onExecute:v})})),(0,r.jsx)(C,{children:(0,r.jsxs)("div",Object.assign({className:"grid grid-cols-2 divide-x h-full"},{children:[(0,r.jsxs)(f,Object.assign({ref:m,className:"relative"},{children:["div"===i&&(0,r.jsx)("div",{ref:y,className:"w-full h-full"}),"canvas"===i&&(0,r.jsx)("canvas",{ref:b,className:"w-full h-full"}),"svg"===i&&(0,r.jsx)("div",Object.assign({"aria-label":"SVG Visualization",id:"svg-container",style:{height:"100%",width:"100%",overflow:"scroll"}},{children:(0,r.jsx)("svg",{ref:x,style:{width:"100%",height:"100%",backgroundColor:"snow"}})}))]})),(0,r.jsx)(f,Object.assign({className:"relative","aria-label":"Visualization Script","data-testid":"script-editor-pane"},{children:(0,r.jsx)(Ma,{initialText:l,variables:c,editorRef:g,stageRef:u,beforeUnmount:w,onExecute:v})}))]}))})]})};function Da(e){if(!(e instanceof Error))return`${e}`;if(console.log(`Error stack: ${e.stack}`),null!=e.stack){const t=e.stack.match(new RegExp(".*(Function|):[0-9]+:[0-9]+.*","g"));if(t){const n=t[0].split(new RegExp(".*Function:|:"))[1].split(":");console.log(`rowCol: ${JSON.stringify(n)}`);const r=+n[0]-2;return n[1],`${e.message} Around line ${r} (computed via parsing error stack)`}}return`${e.message} (error location was not provided by the browser)`}const za=()=>{const e=St(hr);return e?(0,r.jsx)(Na,{datum:e,"data-testid":"script-view-datum"}):null},Ea=e=>{const{data:t}=e,n={gridTemplateColumns:`repeat(${t.data.length>0?t.data[0].length:0}, minmax(0, 1fr))`,borderCollapse:"collapse",textAlign:"left"};return(0,r.jsxs)("table",Object.assign({className:"prose shadow m-2 boarder prose text-xs font-mono",summary:t.title,role:"table",style:n},{children:[(0,r.jsx)("caption",Object.assign({className:"prose prose-sm font-semibold px-2 py-1 border shadow",style:{textAlign:"left"}},{children:t.title})),(0,r.jsx)("thead",Object.assign({className:"bg-slate-100"},{children:(0,r.jsx)("tr",{children:t.headers&&t.headers.map(((e,t)=>(0,r.jsx)("th",Object.assign({className:"font-semibold px-2 py-0.5",scope:"col","aria-labelledby":e},{children:e}),`header-${t}`)))})})),(0,r.jsx)("tbody",{children:t.data.map(((e,t)=>(0,r.jsx)("tr",{children:e.map(((e,n)=>(0,r.jsx)("td",Object.assign({className:"px-2 py-0.5 bg-white boarder",headers:`header-${n}`},{children:e}),`${t}${n}`)))},`row-${t}`)))})]}))},_a=e=>{const{datum:t}=e,n=St((e=>Rr(e,t)));return(0,r.jsx)(r.Fragment,{children:n.map(((e,t)=>(0,r.jsx)(Ea,{data:e},t)))})},La=e=>{const{datum:t}=e,{id:n,parsed:o,buttons:s}=t,i=o.command;return(0,r.jsxs)("div",Object.assign({className:"w-full flex items-center space-x-2 px-2"},{children:[(0,r.jsxs)(k,Object.assign({className:"text-gray-400"},{children:["ID: ",n]})),(0,r.jsx)(k,{children:i}),(0,r.jsx)("div",{className:"grow"}),s&&s.map(((e,o)=>(0,r.jsx)(Ia,{datumId:n,generatorId:t.generatorName,button:e},o)))]}))},Ta=()=>{const e=St(hr);return e?(0,r.jsxs)(f,{children:[(0,r.jsx)(I,{children:(0,r.jsx)(La,{datum:e})}),(0,r.jsx)(C,{children:(0,r.jsx)("div",Object.assign({className:"w-full h-full flex content-start items-start flex-wrap overflow-y-auto"},{children:(0,r.jsx)(_a,{datum:e})}))})]}):null},Pa=()=>{const e=St(Cr);return(0,r.jsxs)(f,{children:["GraphView"===e&&(0,r.jsx)(ma,{}),"TableView"===e&&(0,r.jsx)(Ta,{}),"ScriptView"===e&&(0,r.jsx)(za,{})]})};var Ba=n(97375);const Ra=e=>{const{isConnected:t}=e,n=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o{const t=St(Sr),n=St(kr),o=t?`Connected to ${n}`:"Not connected to a provider",s=t?"Connected":"Disconnected";return(0,r.jsx)(Is.u,Object.assign({hasArrow:!0,label:o},{children:(0,r.jsxs)(c.M5,Object.assign({},e,{children:[(0,r.jsx)(Ra,{isConnected:t}),(0,r.jsx)(c.xv,Object.assign({mx:1,userSelect:"none"},{children:s}))]}))}))};var Va=n(45073),Fa=n(33441);const Ga=function(e,t){const{name:n,generators:r,features:o}=t.payload;e.providerName=n||"unknown provider",e.providerGenerators=null==r?void 0:r.slice(),e.features=(null==o?void 0:o.slice())||[]},Za=function(e){e.connected=!0},Wa=function(e){e.connected=!1},Ua=(0,Ee.oM)({name:"provider",initialState:{connected:!1,providerName:"unknown provider",providerGenerators:void 0,features:[],synthesisEnabled:!1},reducers:{synthesisFeatureEnabled(e,t){e.synthesisEnabled=t.payload}},extraReducers:e=>e.addCase($e,Ga).addCase(Ge,Za).addCase(We,Wa)}),{synthesisFeatureEnabled:qa}=Ua.actions,Ya=Ua.reducer,Xa=e=>t=>n=>{const r=t(n);if(Be.match(n))try{const t=e.getState(),o=t.synthesis;if(o.isActive&&o.currentStep>0&&o.currentStep<=o.numInstances){const s=n.payload;if(s.enter&&s.enter.length>0&&window.CndCore){const n=s.enter[s.enter.length-1],i=t.data.datumById[t.data.active||""];if(console.log("[SynthesisMiddleware] New datum received:",{newDatumId:n.id,activeDatumId:null==i?void 0:i.id,generatorMatch:n.generatorName===(null==i?void 0:i.generatorName),currentStep:o.currentStep,numInstances:o.numInstances}),n.generatorName===(null==i?void 0:i.generatorName)){console.log("[SynthesisMiddleware] New instance from same generator, loading for synthesis");const t=window.CndCore.AlloyInstance.parseAlloyXML(n.data);if(t.instances&&t.instances.length>0){const n=new window.CndCore.AlloyDataInstance(t.instances[0]);if(function(e){var t;try{return((null===(t=e.getTypes)||void 0===t?void 0:t.call(e))||[]).some((e=>{var t;return"No more instances! Some equivalent instances may have been removed through symmetry breaking."===(e.id||(null===(t=e.getId)||void 0===t?void 0:t.call(e))||"")}))}catch(e){return!1}}(n))return console.log("[SynthesisMiddleware] No more instances available from Forge"),e.dispatch(ci()),r;const s=[...o.loadedInstances,n];console.log("[SynthesisMiddleware] Loaded instance, total now:",s.length),e.dispatch(ai({instances:s}))}}}}}catch(e){console.error("[SynthesisMiddleware] Failed to load new instance:",e)}return r},Ha=function(e,t){const{id:n,result:r}=t.payload;e.expressionsById[n].result=r},Ja=function(e,t){const{id:n,datumId:r,expression:o}=t.payload,s=e.orderByDatumId[r]||[];e.nextExpressionId+=1,e.expressionsById[n]={id:n,datumId:r,expression:o,result:""},e.orderByDatumId[r]=[n,...s]},Qa=(0,Ee.oM)({name:"evaluator",initialState:{nextExpressionId:0,expressionsById:{},orderByDatumId:{}},reducers:{},extraReducers:e=>e.addCase(Re,Ha).addCase(Te,Ja)}),{}=Qa.actions,Ka=Qa.reducer;function el(e){return{type:"message",time:(new Date).toJSON(),text:e}}function tl(e){return{type:"error",time:(new Date).toJSON(),text:e}}const nl=function(e,t){e.items.push(el(`Datum selected - Datum ID: ${t.payload}`))},rl=function(e,t){const{id:n,onClick:r}=t.payload;e.items.push(el(`Click button - Datum ID: ${n} - Button: ${r}`))},ol=function(e,t){const{enter:n,update:r,exit:o}=t.payload,s=(null==n?void 0:n.length)||0,i=(null==r?void 0:r.length)||0,a=(null==o?void 0:o.length)||0;e.items.push(el(`Receive data: ${s} enter, ${i} update, ${a} exit.`))},sl=function(e){e.items.push(el("Request data."))},il=function(e,t){const{name:n}=t.payload;e.items.push(el(`Receive metadata from ${n}.`))},al=function(e){e.items.push(el("Connection established."))},ll=function(e,t){e.items.push(tl(t.payload))},cl=function(e){e.items.push(el("Connection lost."))},dl=function(e,t){e.items.push(tl(t.payload))},pl=(0,Ee.oM)({name:"log",initialState:{items:[],filters:["message","warning","error"],sort:"ascending"},reducers:{filtersChanged:function(e,t){e.filters=t.payload},logCleared:function(e){e.items=[]},sortOrderChanged:function(e,t){e.sort=t.payload}},extraReducers:e=>e.addCase(_s,nl).addCase(_e,rl).addCase(Be,ol).addCase(Le,sl).addCase($e,il).addCase(Ge,al).addCase(Ze,ll).addCase(We,cl).addCase(Ue,dl)}),{logCleared:ul,sortOrderChanged:hl,filtersChanged:ml}=pl.actions,gl=pl.reducer,xl=(0,Ee.xC)({reducer:{data:Ts,evaluator:Ka,graphs:ss,log:gl,provider:Ya,script:va,synthesis:yi,ui:Qs},middleware:e=>e({serializableCheck:{ignoredPaths:["synthesis.loadedInstances"],ignoredActionPaths:["payload.instances"]}}).prepend(function(){let e=null,t=0;const n=()=>{window.clearInterval(t),t=0},r=()=>{e&&e.close()},o=()=>{e&&e.send("ping")},s=(i,a)=>{const l=i.dispatch;let c=!1;e&&r(),a=a||`ws://localhost:${window.location.search.slice(1)}`,e=new WebSocket(a),e.onopen=()=>{c=!0,window.setTimeout((()=>o()),3e3),l(Ge()),n()},e.onclose=()=>{c&&(c=!1,l(We())),e&&e.readyState===WebSocket.CLOSED&&(n(),t=window.setInterval((()=>s(i,a)),1e3))},e.onmessage=e=>{"pong"===e.data?window.setTimeout((()=>o()),3e3):yt(e.data,i)}};return t=>n=>o=>(Ve.match(o)?s(t,o.payload):Fe.match(o)?r():_e.match(o)?function(e,t,n){if(!e)return wt(t);vt(e,function(e,t){return{type:"click",version:1,payload:t}}(0,n))}(e,t,o.payload):Le.match(o)?function(e,t){if(!e)return wt(t);vt(e,{type:"data",version:1})}(e,t):Te.match(o)?function(e,t,n){if(!e)return wt(t);vt(e,function(e,t){return{type:"eval",version:1,payload:t}}(0,n))}(e,t,o.payload):Pe.match(o)&&function(e,t){if(!e)return wt(t);vt(e,{type:"meta",version:1})}(e,t),n(o))}(),(e=>t=>n=>{if(!Ge.match(n))return t(n);t(n),e.dispatch(Pe()),e.dispatch(Le())}),Xa)});function fl({isOpen:e,onClose:t}){const n=(0,o.useRef)(null);let[s,i]=(0,o.useState)("");const a=(0,ga.pm)(),l=(0,o.useRef)(null);return(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)(Va.u_,Object.assign({isOpen:e,onClose:t},{children:[(0,r.jsx)(Va.ZA,{}),(0,r.jsxs)(Va.hz,Object.assign({maxW:"70rem"},{children:[(0,r.jsx)(Va.xB,{children:(0,r.jsx)(c.M5,{children:"Input Alloy-style XML datum (paste directly or load from file)"})}),(0,r.jsx)(Va.ol,{}),(0,r.jsxs)(Va.fe,Object.assign({pb:6},{children:[(0,r.jsx)(S.zx,Object.assign({onClick:()=>{var e;return null===(e=l.current)||void 0===e?void 0:e.click()}},{children:"Click to add XML from file"})),' ...or simply paste in an XML datum below. Then click the "Add Datum" button.',(0,r.jsx)(c.LZ,{h:"1rem"}),(0,r.jsx)(c.iz,{orientation:"horizontal",mx:5}),(0,r.jsx)(c.LZ,{h:"1rem"}),(0,r.jsxs)(vi.NI,{children:[(0,r.jsx)(vi.lX,{children:"XML datum string to add"}),(0,r.jsx)(Fa.g,{minH:"20rem",ref:n,placeholder:'\n\n \n \n \n\n\n',value:s,onChange:e=>i(e.target.value)})]})]})),(0,r.jsxs)(Va.mz,{children:[(0,r.jsx)(S.zx,Object.assign({onClick:()=>{var e;const r=null===(e=n.current)||void 0===e?void 0:e.value;if(void 0===r)return void t();const o=xl.getState().data.datumIds;console.log(o);const s=o.reduce(((e,t)=>isNaN(parseInt(t))?e:Math.max(e,parseInt(t)+1)),0);try{xl.dispatch(Be({enter:[bt({id:s.toString(),format:"alloy",data:r,buttons:[],evaluator:!1})],update:[],exit:[]}))}catch(e){a({variant:"top-accent",position:"bottom-right",title:e instanceof Error?e.name:"Error adding instance",description:e instanceof Error?e.message:"No further information is available.",status:"error",duration:1e4,isClosable:!0})}t()}},{children:"Add Datum"})),(0,r.jsx)(Ci.II,{type:"file",ref:l,style:{display:"none"},onChange:e=>{var t;const n=new FileReader;n.onload=e=>{return t=this,n=void 0,o=function*(){var t;(null===(t=e.target)||void 0===t?void 0:t.result)&&(e.target.result instanceof ArrayBuffer?i(e.target.result.toString()):i(e.target.result))},new((r=void 0)||(r=Promise))((function(e,s){function i(e){try{l(o.next(e))}catch(e){s(e)}}function a(e){try{l(o.throw(e))}catch(e){s(e)}}function l(t){var n;t.done?e(t.value):(n=t.value,n instanceof r?n:new r((function(e){e(n)}))).then(i,a)}l((o=o.apply(t,n||[])).next())}));var t,n,r,o},(null===(t=e.target)||void 0===t?void 0:t.files)&&e.target.files.length>0&&n.readAsText(e.target.files[0])}})]})]}))]}))})}function bl({isOpen:e,onClose:t}){const n=St(Cr);return(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)(Va.u_,Object.assign({isOpen:e,onClose:t},{children:[(0,r.jsx)(Va.ZA,{}),(0,r.jsxs)(Va.hz,Object.assign({maxW:"70rem"},{children:[(0,r.jsx)(Va.xB,{children:(0,r.jsx)(c.M5,{children:"Using Spytial Sterling"})}),(0,r.jsx)(Va.ol,{}),(0,r.jsxs)(Va.fe,Object.assign({pb:6},{children:[(0,r.jsxs)(c.xu,Object.assign({as:"ul",listStyleType:"circle"},{children:[(0,r.jsxs)("li",{children:["Use the ",(0,r.jsx)("strong",{children:"evaluator"})," tab to query the value of expressions and constraints."]}),(0,r.jsxs)("li",{children:["The ",(0,r.jsx)("strong",{children:"explorer"})," tab lets you pick a run to visualize. Click on any prior instance to reload it in the visualizer."]})]})),(0,r.jsx)(c.iz,{orientation:"horizontal",colorScheme:"blackAlpha"}),"ScriptView"===n&&(0,r.jsx)(wl,{}),"GraphView"===n&&(0,r.jsx)(yl,{}),"TableView"===n&&(0,r.jsx)(vl,{})]}))]}))]}))})}function yl(){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(c.M5,{children:(0,r.jsx)("strong",{children:"Graph View"})}),(0,r.jsxs)(c.xu,Object.assign({as:"ul",listStyleType:"circle"},{children:[(0,r.jsxs)("li",{children:[(0,r.jsx)("strong",{children:"Zoom"})," with the mouse wheel or with ",(0,r.jsx)("em",{children:"two fingers"})," on the trackpad."]}),(0,r.jsxs)("li",{children:["Use the ",(0,r.jsx)("strong",{children:"theme"})," tab on the sidebar to adjust styling options such as node coloring by sig, source and destination for edges, etc. You can also save the theme-definition file or load one you've already created."]}),(0,r.jsxs)("li",{children:["The ",(0,r.jsx)("strong",{children:"time"})," tab will let you adjust the layout according to time index, if that is appropriate for your model. In a Temporal model, you'll see a minimap and have the option to move back and forth in time. In a model that isn't explicitly temporal, you can still declare a sig as the time index and use it to navigate."]}),(0,r.jsxs)("li",{children:["The ",(0,r.jsx)("strong",{children:"layout"})," tab opens the CnD interface, which is an alternative graph-based visualization that gives more control over your instance diagram."]})]}))]})}function wl(){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(c.M5,{children:(0,r.jsx)("strong",{children:"Script View"})}),(0,r.jsx)(c.xu,{as:"ul",listStyleType:"circle"})]})}function vl(){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(c.M5,{children:(0,r.jsx)("strong",{children:"Table View"})}),(0,r.jsx)(c.xu,{as:"ul",listStyleType:"circle"})]})}const jl=()=>{const e=jt(),t=(0,Ba.qY)(),n=(0,Ba.qY)();return(0,r.jsxs)(E,Object.assign({"data-testid":"app-status-bar"},{children:[(0,r.jsxs)("div",Object.assign({className:"cursor-pointer transition-colors hover:text-white",onClick:n.onOpen},{children:[(0,r.jsx)(c.LZ,{width:"50px"}),(0,r.jsx)(c.M5,{children:(0,r.jsx)("strong",{children:"Help"})})]})),(0,r.jsx)(bl,{isOpen:n.isOpen,onClose:n.onClose}),(0,r.jsx)(c.iz,{orientation:"vertical",mx:2}),(0,r.jsx)(c.LZ,{}),(0,r.jsx)(c.iz,{orientation:"vertical",mx:2}),(0,r.jsx)("div",Object.assign({className:"cursor-pointer transition-colors hover:text-white",onClick:t.onOpen},{children:"Manual Datum"})),(0,r.jsx)(fl,{isOpen:t.isOpen,onClose:t.onClose}),(0,r.jsx)(c.iz,{orientation:"vertical",mx:2}),(0,r.jsx)("div",Object.assign({className:"cursor-pointer transition-colors hover:text-white",onClick:()=>{e(Ls())}},{children:"Console Dump"})),(0,r.jsx)(c.iz,{orientation:"vertical",mx:2}),(0,r.jsx)($a,{})]}))},Sl={layout:{drawerWidth:350,drawerMinWidth:100,drawerMaxWidth:600,explorerWidth:250,explorerMinWidth:60,explorerMaxWidth:250}};var Al=n(93379),Cl=n.n(Al),Ml=n(7795),Il=n.n(Ml),Ol=n(90569),kl=n.n(Ol),Nl=n(3565),Dl=n.n(Nl),zl=n(19216),El=n.n(zl),_l=n(44589),Ll=n.n(_l),Tl=n(50992),Pl={};Pl.styleTagTransform=Ll(),Pl.setAttributes=Dl(),Pl.insert=kl().bind(null,"head"),Pl.domAPI=Il(),Pl.insertStyleElement=El(),Cl()(Tl.Z,Pl),Tl.Z&&Tl.Z.locals&&Tl.Z.locals,s.render((0,r.jsx)(o.StrictMode,{children:(0,r.jsx)(a.xjn,Object.assign({theme:L},{children:(0,r.jsx)(i.zt,Object.assign({store:xl},{children:(0,r.jsx)((e=>{const{url:t}=e,{layout:n}=Sl,s=jt(),i=St(br);return(0,o.useEffect)((()=>(s(Ve(t)),()=>{s(Fe())})),[t,s]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(m,Object.assign({rightPaneCollapsed:i,rightPaneInitialWidth:n.drawerWidth,rightPaneMinWidth:n.drawerMinWidth,rightPaneMaxWidth:n.drawerMaxWidth},{children:[(0,r.jsx)(Pa,{}),(0,r.jsx)(Hi,{})]})),(0,r.jsx)(oa,{}),(0,r.jsx)(Ki,{}),(0,r.jsx)(jl,{})]})}),{url:void 0})}))}))}),document.getElementById("root"))},50992:(e,t,n)=>{n.d(t,{Z:()=>b});var r=n(8081),o=n.n(r),s=n(23645),i=n.n(s),a=n(61667),l=n.n(a),c=new URL(n(70909),n.b),d=new URL(n(133),n.b),p=new URL(n(23601),n.b),u=new URL(n(1686),n.b),h=i()(o()),m=l()(c),g=l()(d),x=l()(p),f=l()(u);h.push([e.id,"/*\n! tailwindcss v3.0.13 | MIT License | https://tailwindcss.com\n*//*\n1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)\n2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)\n*/\n\n*,\n::before,\n::after {\n box-sizing: border-box; /* 1 */\n border-width: 0; /* 2 */\n border-style: solid; /* 2 */\n border-color: #e5e7eb; /* 2 */\n}\n\n::before,\n::after {\n --tw-content: '';\n}\n\n/*\n1. Use a consistent sensible line-height in all browsers.\n2. Prevent adjustments of font size after orientation changes in iOS.\n3. Use a more readable tab size.\n4. Use the user's configured `sans` font-family by default.\n*/\n\nhtml {\n line-height: 1.5; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */\n -moz-tab-size: 4; /* 3 */\n -o-tab-size: 4;\n tab-size: 4; /* 3 */\n font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, \"Noto Sans\", sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"; /* 4 */\n}\n\n/*\n1. Remove the margin in all browsers.\n2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.\n*/\n\nbody {\n margin: 0; /* 1 */\n line-height: inherit; /* 2 */\n}\n\n/*\n1. Add the correct height in Firefox.\n2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)\n3. Ensure horizontal rules are visible by default.\n*/\n\nhr {\n height: 0; /* 1 */\n color: inherit; /* 2 */\n border-top-width: 1px; /* 3 */\n}\n\n/*\nAdd the correct text decoration in Chrome, Edge, and Safari.\n*/\n\nabbr:where([title]) {\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n}\n\n/*\nRemove the default font size and weight for headings.\n*/\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6 {\n font-size: inherit;\n font-weight: inherit;\n}\n\n/*\nReset links to optimize for opt-in styling instead of opt-out.\n*/\n\na {\n color: inherit;\n text-decoration: inherit;\n}\n\n/*\nAdd the correct font weight in Edge and Safari.\n*/\n\nb,\nstrong {\n font-weight: bolder;\n}\n\n/*\n1. Use the user's configured `mono` font family by default.\n2. Correct the odd `em` font sizing in all browsers.\n*/\n\ncode,\nkbd,\nsamp,\npre {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace; /* 1 */\n font-size: 1em; /* 2 */\n}\n\n/*\nAdd the correct font size in all browsers.\n*/\n\nsmall {\n font-size: 80%;\n}\n\n/*\nPrevent `sub` and `sup` elements from affecting the line height in all browsers.\n*/\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsub {\n bottom: -0.25em;\n}\n\nsup {\n top: -0.5em;\n}\n\n/*\n1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)\n2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)\n3. Remove gaps between table borders by default.\n*/\n\ntable {\n text-indent: 0; /* 1 */\n border-color: inherit; /* 2 */\n border-collapse: collapse; /* 3 */\n}\n\n/*\n1. Change the font styles in all browsers.\n2. Remove the margin in Firefox and Safari.\n3. Remove default padding in all browsers.\n*/\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n font-family: inherit; /* 1 */\n font-size: 100%; /* 1 */\n line-height: inherit; /* 1 */\n color: inherit; /* 1 */\n margin: 0; /* 2 */\n padding: 0; /* 3 */\n}\n\n/*\nRemove the inheritance of text transform in Edge and Firefox.\n*/\n\nbutton,\nselect {\n text-transform: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Remove default button styles.\n*/\n\nbutton,\n[type='button'],\n[type='reset'],\n[type='submit'] {\n -webkit-appearance: button; /* 1 */\n background-color: transparent; /* 2 */\n background-image: none; /* 2 */\n}\n\n/*\nUse the modern Firefox focus style for all focusable elements.\n*/\n\n:-moz-focusring {\n outline: auto;\n}\n\n/*\nRemove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)\n*/\n\n:-moz-ui-invalid {\n box-shadow: none;\n}\n\n/*\nAdd the correct vertical alignment in Chrome and Firefox.\n*/\n\nprogress {\n vertical-align: baseline;\n}\n\n/*\nCorrect the cursor style of increment and decrement buttons in Safari.\n*/\n\n::-webkit-inner-spin-button,\n::-webkit-outer-spin-button {\n height: auto;\n}\n\n/*\n1. Correct the odd appearance in Chrome and Safari.\n2. Correct the outline style in Safari.\n*/\n\n[type='search'] {\n -webkit-appearance: textfield; /* 1 */\n outline-offset: -2px; /* 2 */\n}\n\n/*\nRemove the inner padding in Chrome and Safari on macOS.\n*/\n\n::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Change font properties to `inherit` in Safari.\n*/\n\n::-webkit-file-upload-button {\n -webkit-appearance: button; /* 1 */\n font: inherit; /* 2 */\n}\n\n/*\nAdd the correct display in Chrome and Safari.\n*/\n\nsummary {\n display: list-item;\n}\n\n/*\nRemoves the default spacing and border for appropriate elements.\n*/\n\nblockquote,\ndl,\ndd,\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\nhr,\nfigure,\np,\npre {\n margin: 0;\n}\n\nfieldset {\n margin: 0;\n padding: 0;\n}\n\nlegend {\n padding: 0;\n}\n\nol,\nul,\nmenu {\n list-style: none;\n margin: 0;\n padding: 0;\n}\n\n/*\nPrevent resizing textareas horizontally by default.\n*/\n\ntextarea {\n resize: vertical;\n}\n\n/*\n1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)\n2. Set the default placeholder color to the user's configured gray 400 color.\n*/\n\ninput::-moz-placeholder, textarea::-moz-placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\ninput:-ms-input-placeholder, textarea:-ms-input-placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\ninput::placeholder,\ntextarea::placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\n/*\nSet the default cursor for buttons.\n*/\n\nbutton,\n[role=\"button\"] {\n cursor: pointer;\n}\n\n/*\nMake sure disabled buttons don't get the pointer cursor.\n*/\n:disabled {\n cursor: default;\n}\n\n/*\n1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)\n2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)\n This can trigger a poorly considered lint error in some tools but is included by design.\n*/\n\nimg,\nsvg,\nvideo,\ncanvas,\naudio,\niframe,\nembed,\nobject {\n display: block; /* 1 */\n vertical-align: middle; /* 2 */\n}\n\n/*\nConstrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)\n*/\n\nimg,\nvideo {\n max-width: 100%;\n height: auto;\n}\n\n/*\nEnsure the default browser behavior of the `hidden` attribute.\n*/\n\n[hidden] {\n display: none;\n}\n\n[type='text'],[type='email'],[type='url'],[type='password'],[type='number'],[type='date'],[type='datetime-local'],[type='month'],[type='search'],[type='tel'],[type='time'],[type='week'],[multiple],textarea,select {\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n background-color: #fff;\n border-color: #6b7280;\n border-width: 1px;\n border-radius: 0px;\n padding-top: 0.5rem;\n padding-right: 0.75rem;\n padding-bottom: 0.5rem;\n padding-left: 0.75rem;\n font-size: 1rem;\n line-height: 1.5rem;\n --tw-shadow: 0 0 #0000;\n}\n\n[type='text']:focus, [type='email']:focus, [type='url']:focus, [type='password']:focus, [type='number']:focus, [type='date']:focus, [type='datetime-local']:focus, [type='month']:focus, [type='search']:focus, [type='tel']:focus, [type='time']:focus, [type='week']:focus, [multiple]:focus, textarea:focus, select:focus {\n outline: 2px solid transparent;\n outline-offset: 2px;\n --tw-ring-inset: var(--tw-empty,/*!*/ /*!*/);\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: #2563eb;\n --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);\n --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);\n box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n border-color: #2563eb;\n}\n\ninput::-moz-placeholder, textarea::-moz-placeholder {\n color: #6b7280;\n opacity: 1;\n}\n\ninput:-ms-input-placeholder, textarea:-ms-input-placeholder {\n color: #6b7280;\n opacity: 1;\n}\n\ninput::placeholder,textarea::placeholder {\n color: #6b7280;\n opacity: 1;\n}\n\n::-webkit-datetime-edit-fields-wrapper {\n padding: 0;\n}\n\n::-webkit-date-and-time-value {\n min-height: 1.5em;\n}\n\nselect {\n background-image: url("+m+");\n background-position: right 0.5rem center;\n background-repeat: no-repeat;\n background-size: 1.5em 1.5em;\n padding-right: 2.5rem;\n -webkit-print-color-adjust: exact;\n color-adjust: exact;\n}\n\n[multiple] {\n background-image: initial;\n background-position: initial;\n background-repeat: unset;\n background-size: initial;\n padding-right: 0.75rem;\n -webkit-print-color-adjust: unset;\n color-adjust: unset;\n}\n\n[type='checkbox'],[type='radio'] {\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n padding: 0;\n -webkit-print-color-adjust: exact;\n color-adjust: exact;\n display: inline-block;\n vertical-align: middle;\n background-origin: border-box;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n flex-shrink: 0;\n height: 1rem;\n width: 1rem;\n color: #2563eb;\n background-color: #fff;\n border-color: #6b7280;\n border-width: 1px;\n --tw-shadow: 0 0 #0000;\n}\n\n[type='checkbox'] {\n border-radius: 0px;\n}\n\n[type='radio'] {\n border-radius: 100%;\n}\n\n[type='checkbox']:focus,[type='radio']:focus {\n outline: 2px solid transparent;\n outline-offset: 2px;\n --tw-ring-inset: var(--tw-empty,/*!*/ /*!*/);\n --tw-ring-offset-width: 2px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: #2563eb;\n --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);\n --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);\n box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n}\n\n[type='checkbox']:checked,[type='radio']:checked {\n border-color: transparent;\n background-color: currentColor;\n background-size: 100% 100%;\n background-position: center;\n background-repeat: no-repeat;\n}\n\n[type='checkbox']:checked {\n background-image: url("+g+");\n}\n\n[type='radio']:checked {\n background-image: url("+x+");\n}\n\n[type='checkbox']:checked:hover,[type='checkbox']:checked:focus,[type='radio']:checked:hover,[type='radio']:checked:focus {\n border-color: transparent;\n background-color: currentColor;\n}\n\n[type='checkbox']:indeterminate {\n background-image: url("+f+');\n border-color: transparent;\n background-color: currentColor;\n background-size: 100% 100%;\n background-position: center;\n background-repeat: no-repeat;\n}\n\n[type=\'checkbox\']:indeterminate:hover,[type=\'checkbox\']:indeterminate:focus {\n border-color: transparent;\n background-color: currentColor;\n}\n\n[type=\'file\'] {\n background: unset;\n border-color: inherit;\n border-width: 0;\n border-radius: 0;\n padding: 0;\n font-size: unset;\n line-height: inherit;\n}\n\n[type=\'file\']:focus {\n outline: 1px auto -webkit-focus-ring-color;\n}\n\n*, ::before, ::after {\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n}\n.container {\n width: 100%;\n}\n@media (min-width: 640px) {\n\n .container {\n max-width: 640px;\n }\n}\n@media (min-width: 768px) {\n\n .container {\n max-width: 768px;\n }\n}\n@media (min-width: 1024px) {\n\n .container {\n max-width: 1024px;\n }\n}\n@media (min-width: 1280px) {\n\n .container {\n max-width: 1280px;\n }\n}\n@media (min-width: 1536px) {\n\n .container {\n max-width: 1536px;\n }\n}\n.prose {\n color: var(--tw-prose-body);\n max-width: 65ch;\n}\n.prose :where([class~="lead"]):not(:where([class~="not-prose"] *)) {\n color: var(--tw-prose-lead);\n font-size: 1.25em;\n line-height: 1.6;\n margin-top: 1.2em;\n margin-bottom: 1.2em;\n}\n.prose :where(a):not(:where([class~="not-prose"] *)) {\n color: var(--tw-prose-links);\n text-decoration: underline;\n font-weight: 500;\n}\n.prose :where(strong):not(:where([class~="not-prose"] *)) {\n color: var(--tw-prose-bold);\n font-weight: 600;\n}\n.prose :where(ol):not(:where([class~="not-prose"] *)) {\n list-style-type: decimal;\n padding-left: 1.625em;\n}\n.prose :where(ol[type="A"]):not(:where([class~="not-prose"] *)) {\n list-style-type: upper-alpha;\n}\n.prose :where(ol[type="a"]):not(:where([class~="not-prose"] *)) {\n list-style-type: lower-alpha;\n}\n.prose :where(ol[type="A" s]):not(:where([class~="not-prose"] *)) {\n list-style-type: upper-alpha;\n}\n.prose :where(ol[type="a" s]):not(:where([class~="not-prose"] *)) {\n list-style-type: lower-alpha;\n}\n.prose :where(ol[type="I"]):not(:where([class~="not-prose"] *)) {\n list-style-type: upper-roman;\n}\n.prose :where(ol[type="i"]):not(:where([class~="not-prose"] *)) {\n list-style-type: lower-roman;\n}\n.prose :where(ol[type="I" s]):not(:where([class~="not-prose"] *)) {\n list-style-type: upper-roman;\n}\n.prose :where(ol[type="i" s]):not(:where([class~="not-prose"] *)) {\n list-style-type: lower-roman;\n}\n.prose :where(ol[type="1"]):not(:where([class~="not-prose"] *)) {\n list-style-type: decimal;\n}\n.prose :where(ul):not(:where([class~="not-prose"] *)) {\n list-style-type: disc;\n padding-left: 1.625em;\n}\n.prose :where(ol > li):not(:where([class~="not-prose"] *))::marker {\n font-weight: 400;\n color: var(--tw-prose-counters);\n}\n.prose :where(ul > li):not(:where([class~="not-prose"] *))::marker {\n color: var(--tw-prose-bullets);\n}\n.prose :where(hr):not(:where([class~="not-prose"] *)) {\n border-color: var(--tw-prose-hr);\n border-top-width: 1px;\n margin-top: 3em;\n margin-bottom: 3em;\n}\n.prose :where(blockquote):not(:where([class~="not-prose"] *)) {\n font-weight: 500;\n font-style: italic;\n color: var(--tw-prose-quotes);\n border-left-width: 0.25rem;\n border-left-color: var(--tw-prose-quote-borders);\n quotes: "\\201C""\\201D""\\2018""\\2019";\n margin-top: 1.6em;\n margin-bottom: 1.6em;\n padding-left: 1em;\n}\n.prose :where(blockquote p:first-of-type):not(:where([class~="not-prose"] *))::before {\n content: open-quote;\n}\n.prose :where(blockquote p:last-of-type):not(:where([class~="not-prose"] *))::after {\n content: close-quote;\n}\n.prose :where(h1):not(:where([class~="not-prose"] *)) {\n color: var(--tw-prose-headings);\n font-weight: 800;\n font-size: 2.25em;\n margin-top: 0;\n margin-bottom: 0.8888889em;\n line-height: 1.1111111;\n}\n.prose :where(h1 strong):not(:where([class~="not-prose"] *)) {\n font-weight: 900;\n}\n.prose :where(h2):not(:where([class~="not-prose"] *)) {\n color: var(--tw-prose-headings);\n font-weight: 700;\n font-size: 1.5em;\n margin-top: 2em;\n margin-bottom: 1em;\n line-height: 1.3333333;\n}\n.prose :where(h2 strong):not(:where([class~="not-prose"] *)) {\n font-weight: 800;\n}\n.prose :where(h3):not(:where([class~="not-prose"] *)) {\n color: var(--tw-prose-headings);\n font-weight: 600;\n font-size: 1.25em;\n margin-top: 1.6em;\n margin-bottom: 0.6em;\n line-height: 1.6;\n}\n.prose :where(h3 strong):not(:where([class~="not-prose"] *)) {\n font-weight: 700;\n}\n.prose :where(h4):not(:where([class~="not-prose"] *)) {\n color: var(--tw-prose-headings);\n font-weight: 600;\n margin-top: 1.5em;\n margin-bottom: 0.5em;\n line-height: 1.5;\n}\n.prose :where(h4 strong):not(:where([class~="not-prose"] *)) {\n font-weight: 700;\n}\n.prose :where(figure > *):not(:where([class~="not-prose"] *)) {\n margin-top: 0;\n margin-bottom: 0;\n}\n.prose :where(figcaption):not(:where([class~="not-prose"] *)) {\n color: var(--tw-prose-captions);\n font-size: 0.875em;\n line-height: 1.4285714;\n margin-top: 0.8571429em;\n}\n.prose :where(code):not(:where([class~="not-prose"] *)) {\n color: var(--tw-prose-code);\n font-weight: 600;\n font-size: 0.875em;\n}\n.prose :where(code):not(:where([class~="not-prose"] *))::before {\n content: "`";\n}\n.prose :where(code):not(:where([class~="not-prose"] *))::after {\n content: "`";\n}\n.prose :where(a code):not(:where([class~="not-prose"] *)) {\n color: var(--tw-prose-links);\n}\n.prose :where(pre):not(:where([class~="not-prose"] *)) {\n color: var(--tw-prose-pre-code);\n background-color: var(--tw-prose-pre-bg);\n overflow-x: auto;\n font-weight: 400;\n font-size: 0.875em;\n line-height: 1.7142857;\n margin-top: 1.7142857em;\n margin-bottom: 1.7142857em;\n border-radius: 0.375rem;\n padding-top: 0.8571429em;\n padding-right: 1.1428571em;\n padding-bottom: 0.8571429em;\n padding-left: 1.1428571em;\n}\n.prose :where(pre code):not(:where([class~="not-prose"] *)) {\n background-color: transparent;\n border-width: 0;\n border-radius: 0;\n padding: 0;\n font-weight: inherit;\n color: inherit;\n font-size: inherit;\n font-family: inherit;\n line-height: inherit;\n}\n.prose :where(pre code):not(:where([class~="not-prose"] *))::before {\n content: none;\n}\n.prose :where(pre code):not(:where([class~="not-prose"] *))::after {\n content: none;\n}\n.prose :where(table):not(:where([class~="not-prose"] *)) {\n width: 100%;\n table-layout: auto;\n text-align: left;\n margin-top: 2em;\n margin-bottom: 2em;\n font-size: 0.875em;\n line-height: 1.7142857;\n}\n.prose :where(thead):not(:where([class~="not-prose"] *)) {\n border-bottom-width: 1px;\n border-bottom-color: var(--tw-prose-th-borders);\n}\n.prose :where(thead th):not(:where([class~="not-prose"] *)) {\n color: var(--tw-prose-headings);\n font-weight: 600;\n vertical-align: bottom;\n padding-right: 0.5714286em;\n padding-bottom: 0.5714286em;\n padding-left: 0.5714286em;\n}\n.prose :where(tbody tr):not(:where([class~="not-prose"] *)) {\n border-bottom-width: 1px;\n border-bottom-color: var(--tw-prose-td-borders);\n}\n.prose :where(tbody tr:last-child):not(:where([class~="not-prose"] *)) {\n border-bottom-width: 0;\n}\n.prose :where(tbody td):not(:where([class~="not-prose"] *)) {\n vertical-align: baseline;\n padding-top: 0.5714286em;\n padding-right: 0.5714286em;\n padding-bottom: 0.5714286em;\n padding-left: 0.5714286em;\n}\n.prose {\n --tw-prose-body: #374151;\n --tw-prose-headings: #111827;\n --tw-prose-lead: #4b5563;\n --tw-prose-links: #111827;\n --tw-prose-bold: #111827;\n --tw-prose-counters: #6b7280;\n --tw-prose-bullets: #d1d5db;\n --tw-prose-hr: #e5e7eb;\n --tw-prose-quotes: #111827;\n --tw-prose-quote-borders: #e5e7eb;\n --tw-prose-captions: #6b7280;\n --tw-prose-code: #111827;\n --tw-prose-pre-code: #e5e7eb;\n --tw-prose-pre-bg: #1f2937;\n --tw-prose-th-borders: #d1d5db;\n --tw-prose-td-borders: #e5e7eb;\n --tw-prose-invert-body: #d1d5db;\n --tw-prose-invert-headings: #fff;\n --tw-prose-invert-lead: #9ca3af;\n --tw-prose-invert-links: #fff;\n --tw-prose-invert-bold: #fff;\n --tw-prose-invert-counters: #9ca3af;\n --tw-prose-invert-bullets: #4b5563;\n --tw-prose-invert-hr: #374151;\n --tw-prose-invert-quotes: #f3f4f6;\n --tw-prose-invert-quote-borders: #374151;\n --tw-prose-invert-captions: #9ca3af;\n --tw-prose-invert-code: #fff;\n --tw-prose-invert-pre-code: #d1d5db;\n --tw-prose-invert-pre-bg: rgb(0 0 0 / 50%);\n --tw-prose-invert-th-borders: #4b5563;\n --tw-prose-invert-td-borders: #374151;\n font-size: 1rem;\n line-height: 1.75;\n}\n.prose :where(p):not(:where([class~="not-prose"] *)) {\n margin-top: 1.25em;\n margin-bottom: 1.25em;\n}\n.prose :where(img):not(:where([class~="not-prose"] *)) {\n margin-top: 2em;\n margin-bottom: 2em;\n}\n.prose :where(video):not(:where([class~="not-prose"] *)) {\n margin-top: 2em;\n margin-bottom: 2em;\n}\n.prose :where(figure):not(:where([class~="not-prose"] *)) {\n margin-top: 2em;\n margin-bottom: 2em;\n}\n.prose :where(h2 code):not(:where([class~="not-prose"] *)) {\n font-size: 0.875em;\n}\n.prose :where(h3 code):not(:where([class~="not-prose"] *)) {\n font-size: 0.9em;\n}\n.prose :where(li):not(:where([class~="not-prose"] *)) {\n margin-top: 0.5em;\n margin-bottom: 0.5em;\n}\n.prose :where(ol > li):not(:where([class~="not-prose"] *)) {\n padding-left: 0.375em;\n}\n.prose :where(ul > li):not(:where([class~="not-prose"] *)) {\n padding-left: 0.375em;\n}\n.prose > :where(ul > li p):not(:where([class~="not-prose"] *)) {\n margin-top: 0.75em;\n margin-bottom: 0.75em;\n}\n.prose > :where(ul > li > *:first-child):not(:where([class~="not-prose"] *)) {\n margin-top: 1.25em;\n}\n.prose > :where(ul > li > *:last-child):not(:where([class~="not-prose"] *)) {\n margin-bottom: 1.25em;\n}\n.prose > :where(ol > li > *:first-child):not(:where([class~="not-prose"] *)) {\n margin-top: 1.25em;\n}\n.prose > :where(ol > li > *:last-child):not(:where([class~="not-prose"] *)) {\n margin-bottom: 1.25em;\n}\n.prose :where(ul ul, ul ol, ol ul, ol ol):not(:where([class~="not-prose"] *)) {\n margin-top: 0.75em;\n margin-bottom: 0.75em;\n}\n.prose :where(hr + *):not(:where([class~="not-prose"] *)) {\n margin-top: 0;\n}\n.prose :where(h2 + *):not(:where([class~="not-prose"] *)) {\n margin-top: 0;\n}\n.prose :where(h3 + *):not(:where([class~="not-prose"] *)) {\n margin-top: 0;\n}\n.prose :where(h4 + *):not(:where([class~="not-prose"] *)) {\n margin-top: 0;\n}\n.prose :where(thead th:first-child):not(:where([class~="not-prose"] *)) {\n padding-left: 0;\n}\n.prose :where(thead th:last-child):not(:where([class~="not-prose"] *)) {\n padding-right: 0;\n}\n.prose :where(tbody td:first-child):not(:where([class~="not-prose"] *)) {\n padding-left: 0;\n}\n.prose :where(tbody td:last-child):not(:where([class~="not-prose"] *)) {\n padding-right: 0;\n}\n.prose > :where(:first-child):not(:where([class~="not-prose"] *)) {\n margin-top: 0;\n}\n.prose > :where(:last-child):not(:where([class~="not-prose"] *)) {\n margin-bottom: 0;\n}\n.prose-sm {\n font-size: 0.875rem;\n line-height: 1.7142857;\n}\n.prose-sm :where(p):not(:where([class~="not-prose"] *)) {\n margin-top: 1.1428571em;\n margin-bottom: 1.1428571em;\n}\n.prose-sm :where([class~="lead"]):not(:where([class~="not-prose"] *)) {\n font-size: 1.2857143em;\n line-height: 1.5555556;\n margin-top: 0.8888889em;\n margin-bottom: 0.8888889em;\n}\n.prose-sm :where(blockquote):not(:where([class~="not-prose"] *)) {\n margin-top: 1.3333333em;\n margin-bottom: 1.3333333em;\n padding-left: 1.1111111em;\n}\n.prose-sm :where(h1):not(:where([class~="not-prose"] *)) {\n font-size: 2.1428571em;\n margin-top: 0;\n margin-bottom: 0.8em;\n line-height: 1.2;\n}\n.prose-sm :where(h2):not(:where([class~="not-prose"] *)) {\n font-size: 1.4285714em;\n margin-top: 1.6em;\n margin-bottom: 0.8em;\n line-height: 1.4;\n}\n.prose-sm :where(h3):not(:where([class~="not-prose"] *)) {\n font-size: 1.2857143em;\n margin-top: 1.5555556em;\n margin-bottom: 0.4444444em;\n line-height: 1.5555556;\n}\n.prose-sm :where(h4):not(:where([class~="not-prose"] *)) {\n margin-top: 1.4285714em;\n margin-bottom: 0.5714286em;\n line-height: 1.4285714;\n}\n.prose-sm :where(img):not(:where([class~="not-prose"] *)) {\n margin-top: 1.7142857em;\n margin-bottom: 1.7142857em;\n}\n.prose-sm :where(video):not(:where([class~="not-prose"] *)) {\n margin-top: 1.7142857em;\n margin-bottom: 1.7142857em;\n}\n.prose-sm :where(figure):not(:where([class~="not-prose"] *)) {\n margin-top: 1.7142857em;\n margin-bottom: 1.7142857em;\n}\n.prose-sm :where(figure > *):not(:where([class~="not-prose"] *)) {\n margin-top: 0;\n margin-bottom: 0;\n}\n.prose-sm :where(figcaption):not(:where([class~="not-prose"] *)) {\n font-size: 0.8571429em;\n line-height: 1.3333333;\n margin-top: 0.6666667em;\n}\n.prose-sm :where(code):not(:where([class~="not-prose"] *)) {\n font-size: 0.8571429em;\n}\n.prose-sm :where(h2 code):not(:where([class~="not-prose"] *)) {\n font-size: 0.9em;\n}\n.prose-sm :where(h3 code):not(:where([class~="not-prose"] *)) {\n font-size: 0.8888889em;\n}\n.prose-sm :where(pre):not(:where([class~="not-prose"] *)) {\n font-size: 0.8571429em;\n line-height: 1.6666667;\n margin-top: 1.6666667em;\n margin-bottom: 1.6666667em;\n border-radius: 0.25rem;\n padding-top: 0.6666667em;\n padding-right: 1em;\n padding-bottom: 0.6666667em;\n padding-left: 1em;\n}\n.prose-sm :where(ol):not(:where([class~="not-prose"] *)) {\n padding-left: 1.5714286em;\n}\n.prose-sm :where(ul):not(:where([class~="not-prose"] *)) {\n padding-left: 1.5714286em;\n}\n.prose-sm :where(li):not(:where([class~="not-prose"] *)) {\n margin-top: 0.2857143em;\n margin-bottom: 0.2857143em;\n}\n.prose-sm :where(ol > li):not(:where([class~="not-prose"] *)) {\n padding-left: 0.4285714em;\n}\n.prose-sm :where(ul > li):not(:where([class~="not-prose"] *)) {\n padding-left: 0.4285714em;\n}\n.prose-sm > :where(ul > li p):not(:where([class~="not-prose"] *)) {\n margin-top: 0.5714286em;\n margin-bottom: 0.5714286em;\n}\n.prose-sm > :where(ul > li > *:first-child):not(:where([class~="not-prose"] *)) {\n margin-top: 1.1428571em;\n}\n.prose-sm > :where(ul > li > *:last-child):not(:where([class~="not-prose"] *)) {\n margin-bottom: 1.1428571em;\n}\n.prose-sm > :where(ol > li > *:first-child):not(:where([class~="not-prose"] *)) {\n margin-top: 1.1428571em;\n}\n.prose-sm > :where(ol > li > *:last-child):not(:where([class~="not-prose"] *)) {\n margin-bottom: 1.1428571em;\n}\n.prose-sm :where(ul ul, ul ol, ol ul, ol ol):not(:where([class~="not-prose"] *)) {\n margin-top: 0.5714286em;\n margin-bottom: 0.5714286em;\n}\n.prose-sm :where(hr):not(:where([class~="not-prose"] *)) {\n margin-top: 2.8571429em;\n margin-bottom: 2.8571429em;\n}\n.prose-sm :where(hr + *):not(:where([class~="not-prose"] *)) {\n margin-top: 0;\n}\n.prose-sm :where(h2 + *):not(:where([class~="not-prose"] *)) {\n margin-top: 0;\n}\n.prose-sm :where(h3 + *):not(:where([class~="not-prose"] *)) {\n margin-top: 0;\n}\n.prose-sm :where(h4 + *):not(:where([class~="not-prose"] *)) {\n margin-top: 0;\n}\n.prose-sm :where(table):not(:where([class~="not-prose"] *)) {\n font-size: 0.8571429em;\n line-height: 1.5;\n}\n.prose-sm :where(thead th):not(:where([class~="not-prose"] *)) {\n padding-right: 1em;\n padding-bottom: 0.6666667em;\n padding-left: 1em;\n}\n.prose-sm :where(thead th:first-child):not(:where([class~="not-prose"] *)) {\n padding-left: 0;\n}\n.prose-sm :where(thead th:last-child):not(:where([class~="not-prose"] *)) {\n padding-right: 0;\n}\n.prose-sm :where(tbody td):not(:where([class~="not-prose"] *)) {\n padding-top: 0.6666667em;\n padding-right: 1em;\n padding-bottom: 0.6666667em;\n padding-left: 1em;\n}\n.prose-sm :where(tbody td:first-child):not(:where([class~="not-prose"] *)) {\n padding-left: 0;\n}\n.prose-sm :where(tbody td:last-child):not(:where([class~="not-prose"] *)) {\n padding-right: 0;\n}\n.prose-sm > :where(:first-child):not(:where([class~="not-prose"] *)) {\n margin-top: 0;\n}\n.prose-sm > :where(:last-child):not(:where([class~="not-prose"] *)) {\n margin-bottom: 0;\n}\n.sr-only {\n position: absolute !important;\n width: 1px !important;\n height: 1px !important;\n padding: 0 !important;\n margin: -1px !important;\n overflow: hidden !important;\n clip: rect(0, 0, 0, 0) !important;\n white-space: nowrap !important;\n border-width: 0 !important;\n}\n.visible {\n visibility: visible !important;\n}\n.fixed {\n position: fixed !important;\n}\n.absolute {\n position: absolute !important;\n}\n.relative {\n position: relative !important;\n}\n.inset-0 {\n top: 0px !important;\n right: 0px !important;\n bottom: 0px !important;\n left: 0px !important;\n}\n.inset-y-0 {\n top: 0px !important;\n bottom: 0px !important;\n}\n.inset-x-0 {\n left: 0px !important;\n right: 0px !important;\n}\n.top-0 {\n top: 0px !important;\n}\n.right-0 {\n right: 0px !important;\n}\n.left-0 {\n left: 0px !important;\n}\n.bottom-0 {\n bottom: 0px !important;\n}\n.-left-5 {\n left: -1.25rem !important;\n}\n.top-\\[35px\\] {\n top: 35px !important;\n}\n.col-span-3 {\n grid-column: span 3 / span 3 !important;\n}\n.m-2 {\n margin: 0.5rem !important;\n}\n.mx-2 {\n margin-left: 0.5rem !important;\n margin-right: 0.5rem !important;\n}\n.mx-auto {\n margin-left: auto !important;\n margin-right: auto !important;\n}\n.my-2 {\n margin-top: 0.5rem !important;\n margin-bottom: 0.5rem !important;\n}\n.mx-1 {\n margin-left: 0.25rem !important;\n margin-right: 0.25rem !important;\n}\n.mb-4 {\n margin-bottom: 1rem !important;\n}\n.mt-0\\.5 {\n margin-top: 0.125rem !important;\n}\n.mt-0 {\n margin-top: 0px !important;\n}\n.ml-6 {\n margin-left: 1.5rem !important;\n}\n.mb-2 {\n margin-bottom: 0.5rem !important;\n}\n.mb-3 {\n margin-bottom: 0.75rem !important;\n}\n.mb-1\\.5 {\n margin-bottom: 0.375rem !important;\n}\n.mb-1 {\n margin-bottom: 0.25rem !important;\n}\n.mt-1\\.5 {\n margin-top: 0.375rem !important;\n}\n.mt-1 {\n margin-top: 0.25rem !important;\n}\n.ml-2 {\n margin-left: 0.5rem !important;\n}\n.mt-3 {\n margin-top: 0.75rem !important;\n}\n.-mt-0\\.5 {\n margin-top: -0.125rem !important;\n}\n.-mt-0 {\n margin-top: -0px !important;\n}\n.block {\n display: block !important;\n}\n.inline-block {\n display: inline-block !important;\n}\n.flex {\n display: flex !important;\n}\n.inline-flex {\n display: inline-flex !important;\n}\n.table {\n display: table !important;\n}\n.grid {\n display: grid !important;\n}\n.contents {\n display: contents !important;\n}\n.hidden {\n display: none !important;\n}\n.h-\\[30px\\] {\n height: 30px !important;\n}\n.h-full {\n height: 100% !important;\n}\n.h-\\[35px\\] {\n height: 35px !important;\n}\n.h-5 {\n height: 1.25rem !important;\n}\n.h-4 {\n height: 1rem !important;\n}\n.h-8 {\n height: 2rem !important;\n}\n.min-h-\\[360px\\] {\n min-height: 360px !important;\n}\n.w-full {\n width: 100% !important;\n}\n.w-5 {\n width: 1.25rem !important;\n}\n.w-4 {\n width: 1rem !important;\n}\n.w-8 {\n width: 2rem !important;\n}\n.max-w-4xl {\n max-width: 56rem !important;\n}\n.max-w-2xl {\n max-width: 42rem !important;\n}\n.flex-1 {\n flex: 1 1 0% !important;\n}\n.flex-shrink-0 {\n flex-shrink: 0 !important;\n}\n.grow {\n flex-grow: 1 !important;\n}\n.-rotate-90 {\n --tw-rotate: -90deg !important;\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)) !important;\n}\n.rotate-90 {\n --tw-rotate: 90deg !important;\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)) !important;\n}\n.transform {\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)) !important;\n}\n.cursor-pointer {\n cursor: pointer !important;\n}\n.cursor-default {\n cursor: default !important;\n}\n.select-none {\n -webkit-user-select: none !important;\n -moz-user-select: none !important;\n -ms-user-select: none !important;\n user-select: none !important;\n}\n.select-text {\n -webkit-user-select: text !important;\n -moz-user-select: text !important;\n -ms-user-select: text !important;\n user-select: text !important;\n}\n.grid-flow-col {\n grid-auto-flow: column !important;\n}\n.grid-cols-2 {\n grid-template-columns: repeat(2, minmax(0, 1fr)) !important;\n}\n.grid-cols-\\[minmax\\(max-content\\2c auto\\)_repeat\\(2\\2c min-content\\)\\] {\n grid-template-columns: minmax(max-content,auto) repeat(2,min-content) !important;\n}\n.grid-cols-\\[minmax\\(min-content\\2c max-content\\)_minmax\\(max-content\\2c auto\\)_minmax\\(min-content\\2c max-content\\)\\] {\n grid-template-columns: minmax(min-content,max-content) minmax(max-content,auto) minmax(min-content,max-content) !important;\n}\n.grid-cols-\\[minmax\\(max-content\\2c auto\\)_minmax\\(max-content\\2c auto\\)\\] {\n grid-template-columns: minmax(max-content,auto) minmax(max-content,auto) !important;\n}\n.flex-col {\n flex-direction: column !important;\n}\n.flex-wrap {\n flex-wrap: wrap !important;\n}\n.place-content-center {\n place-content: center !important;\n}\n.place-items-center {\n place-items: center !important;\n}\n.content-start {\n align-content: flex-start !important;\n}\n.items-start {\n align-items: flex-start !important;\n}\n.items-center {\n align-items: center !important;\n}\n.justify-end {\n justify-content: flex-end !important;\n}\n.justify-center {\n justify-content: center !important;\n}\n.justify-between {\n justify-content: space-between !important;\n}\n.gap-4 {\n gap: 1rem !important;\n}\n.gap-3 {\n gap: 0.75rem !important;\n}\n.gap-2 {\n gap: 0.5rem !important;\n}\n.gap-1 {\n gap: 0.25rem !important;\n}\n.gap-1\\.5 {\n gap: 0.375rem !important;\n}\n.gap-y-2 {\n row-gap: 0.5rem !important;\n}\n.space-x-2 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-x-reverse: 0 !important;\n margin-right: calc(0.5rem * var(--tw-space-x-reverse)) !important;\n margin-left: calc(0.5rem * calc(1 - var(--tw-space-x-reverse))) !important;\n}\n.space-y-4 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0 !important;\n margin-top: calc(1rem * calc(1 - var(--tw-space-y-reverse))) !important;\n margin-bottom: calc(1rem * var(--tw-space-y-reverse)) !important;\n}\n.space-y-3 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0 !important;\n margin-top: calc(0.75rem * calc(1 - var(--tw-space-y-reverse))) !important;\n margin-bottom: calc(0.75rem * var(--tw-space-y-reverse)) !important;\n}\n.space-y-2 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0 !important;\n margin-top: calc(0.5rem * calc(1 - var(--tw-space-y-reverse))) !important;\n margin-bottom: calc(0.5rem * var(--tw-space-y-reverse)) !important;\n}\n.divide-x > :not([hidden]) ~ :not([hidden]) {\n --tw-divide-x-reverse: 0 !important;\n border-right-width: calc(1px * var(--tw-divide-x-reverse)) !important;\n border-left-width: calc(1px * calc(1 - var(--tw-divide-x-reverse))) !important;\n}\n.divide-dashed > :not([hidden]) ~ :not([hidden]) {\n border-style: dashed !important;\n}\n.overflow-auto {\n overflow: auto !important;\n}\n.overflow-hidden {\n overflow: hidden !important;\n}\n.overflow-y-auto {\n overflow-y: auto !important;\n}\n.truncate {\n overflow: hidden !important;\n text-overflow: ellipsis !important;\n white-space: nowrap !important;\n}\n.whitespace-nowrap {\n white-space: nowrap !important;\n}\n.rounded-lg {\n border-radius: 0.5rem !important;\n}\n.rounded {\n border-radius: 0.25rem !important;\n}\n.rounded-xl {\n border-radius: 0.75rem !important;\n}\n.rounded-full {\n border-radius: 9999px !important;\n}\n.rounded-md {\n border-radius: 0.375rem !important;\n}\n.border {\n border-width: 1px !important;\n}\n.border-2 {\n border-width: 2px !important;\n}\n.border-b {\n border-bottom-width: 1px !important;\n}\n.border-t {\n border-top-width: 1px !important;\n}\n.border-dashed {\n border-style: dashed !important;\n}\n.border-gray-300 {\n --tw-border-opacity: 1 !important;\n border-color: rgb(209 213 219 / var(--tw-border-opacity)) !important;\n}\n.border-gray-200 {\n --tw-border-opacity: 1 !important;\n border-color: rgb(229 231 235 / var(--tw-border-opacity)) !important;\n}\n.border-red-200 {\n --tw-border-opacity: 1 !important;\n border-color: rgb(254 202 202 / var(--tw-border-opacity)) !important;\n}\n.border-blue-200 {\n --tw-border-opacity: 1 !important;\n border-color: rgb(191 219 254 / var(--tw-border-opacity)) !important;\n}\n.border-red-300 {\n --tw-border-opacity: 1 !important;\n border-color: rgb(252 165 165 / var(--tw-border-opacity)) !important;\n}\n.border-gray-100 {\n --tw-border-opacity: 1 !important;\n border-color: rgb(243 244 246 / var(--tw-border-opacity)) !important;\n}\n.border-purple-200 {\n --tw-border-opacity: 1 !important;\n border-color: rgb(233 213 255 / var(--tw-border-opacity)) !important;\n}\n.border-slate-200 {\n --tw-border-opacity: 1 !important;\n border-color: rgb(226 232 240 / var(--tw-border-opacity)) !important;\n}\n.border-slate-300 {\n --tw-border-opacity: 1 !important;\n border-color: rgb(203 213 225 / var(--tw-border-opacity)) !important;\n}\n.bg-slate-100 {\n --tw-bg-opacity: 1 !important;\n background-color: rgb(241 245 249 / var(--tw-bg-opacity)) !important;\n}\n.bg-white {\n --tw-bg-opacity: 1 !important;\n background-color: rgb(255 255 255 / var(--tw-bg-opacity)) !important;\n}\n.bg-gray-100 {\n --tw-bg-opacity: 1 !important;\n background-color: rgb(243 244 246 / var(--tw-bg-opacity)) !important;\n}\n.bg-red-50 {\n --tw-bg-opacity: 1 !important;\n background-color: rgb(254 242 242 / var(--tw-bg-opacity)) !important;\n}\n.bg-gray-50 {\n --tw-bg-opacity: 1 !important;\n background-color: rgb(249 250 251 / var(--tw-bg-opacity)) !important;\n}\n.bg-blue-50 {\n --tw-bg-opacity: 1 !important;\n background-color: rgb(239 246 255 / var(--tw-bg-opacity)) !important;\n}\n.bg-red-100 {\n --tw-bg-opacity: 1 !important;\n background-color: rgb(254 226 226 / var(--tw-bg-opacity)) !important;\n}\n.bg-purple-50 {\n --tw-bg-opacity: 1 !important;\n background-color: rgb(250 245 255 / var(--tw-bg-opacity)) !important;\n}\n.bg-slate-50\\/90 {\n background-color: rgb(248 250 252 / 0.9) !important;\n}\n.bg-white\\/80 {\n background-color: rgb(255 255 255 / 0.8) !important;\n}\n.bg-slate-50 {\n --tw-bg-opacity: 1 !important;\n background-color: rgb(248 250 252 / var(--tw-bg-opacity)) !important;\n}\n.bg-fuchsia-100 {\n --tw-bg-opacity: 1 !important;\n background-color: rgb(250 232 255 / var(--tw-bg-opacity)) !important;\n}\n.bg-purple-100 {\n --tw-bg-opacity: 1 !important;\n background-color: rgb(243 232 255 / var(--tw-bg-opacity)) !important;\n}\n.bg-indigo-50 {\n --tw-bg-opacity: 1 !important;\n background-color: rgb(238 242 255 / var(--tw-bg-opacity)) !important;\n}\n.bg-indigo-600 {\n --tw-bg-opacity: 1 !important;\n background-color: rgb(79 70 229 / var(--tw-bg-opacity)) !important;\n}\n.bg-blue-600 {\n --tw-bg-opacity: 1 !important;\n background-color: rgb(37 99 235 / var(--tw-bg-opacity)) !important;\n}\n.bg-opacity-75 {\n --tw-bg-opacity: 0.75 !important;\n}\n.bg-gradient-to-r {\n background-image: linear-gradient(to right, var(--tw-gradient-stops)) !important;\n}\n.from-fuchsia-600 {\n --tw-gradient-from: #c026d3 !important;\n --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgb(192 38 211 / 0)) !important;\n}\n.from-purple-600 {\n --tw-gradient-from: #9333ea !important;\n --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgb(147 51 234 / 0)) !important;\n}\n.to-purple-600 {\n --tw-gradient-to: #9333ea !important;\n}\n.to-indigo-600 {\n --tw-gradient-to: #4f46e5 !important;\n}\n.p-4 {\n padding: 1rem !important;\n}\n.p-2 {\n padding: 0.5rem !important;\n}\n.p-8 {\n padding: 2rem !important;\n}\n.p-6 {\n padding: 1.5rem !important;\n}\n.p-3 {\n padding: 0.75rem !important;\n}\n.p-1 {\n padding: 0.25rem !important;\n}\n.px-2 {\n padding-left: 0.5rem !important;\n padding-right: 0.5rem !important;\n}\n.px-3 {\n padding-left: 0.75rem !important;\n padding-right: 0.75rem !important;\n}\n.py-2 {\n padding-top: 0.5rem !important;\n padding-bottom: 0.5rem !important;\n}\n.py-1 {\n padding-top: 0.25rem !important;\n padding-bottom: 0.25rem !important;\n}\n.py-0\\.5 {\n padding-top: 0.125rem !important;\n padding-bottom: 0.125rem !important;\n}\n.py-0 {\n padding-top: 0px !important;\n padding-bottom: 0px !important;\n}\n.px-4 {\n padding-left: 1rem !important;\n padding-right: 1rem !important;\n}\n.py-3 {\n padding-top: 0.75rem !important;\n padding-bottom: 0.75rem !important;\n}\n.px-2\\.5 {\n padding-left: 0.625rem !important;\n padding-right: 0.625rem !important;\n}\n.py-2\\.5 {\n padding-top: 0.625rem !important;\n padding-bottom: 0.625rem !important;\n}\n.px-1 {\n padding-left: 0.25rem !important;\n padding-right: 0.25rem !important;\n}\n.pl-2 {\n padding-left: 0.5rem !important;\n}\n.pl-9 {\n padding-left: 2.25rem !important;\n}\n.pr-3 {\n padding-right: 0.75rem !important;\n}\n.pt-2 {\n padding-top: 0.5rem !important;\n}\n.pb-3 {\n padding-bottom: 0.75rem !important;\n}\n.text-center {\n text-align: center !important;\n}\n.align-middle {\n vertical-align: middle !important;\n}\n.font-mono {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !important;\n}\n.text-sm {\n font-size: 0.875rem !important;\n line-height: 1.25rem !important;\n}\n.text-xs {\n font-size: 0.75rem !important;\n line-height: 1rem !important;\n}\n.text-lg {\n font-size: 1.125rem !important;\n line-height: 1.75rem !important;\n}\n.font-medium {\n font-weight: 500 !important;\n}\n.font-semibold {\n font-weight: 600 !important;\n}\n.font-bold {\n font-weight: 700 !important;\n}\n.uppercase {\n text-transform: uppercase !important;\n}\n.leading-relaxed {\n line-height: 1.625 !important;\n}\n.text-gray-400 {\n --tw-text-opacity: 1 !important;\n color: rgb(156 163 175 / var(--tw-text-opacity)) !important;\n}\n.text-gray-700 {\n --tw-text-opacity: 1 !important;\n color: rgb(55 65 81 / var(--tw-text-opacity)) !important;\n}\n.text-gray-600 {\n --tw-text-opacity: 1 !important;\n color: rgb(75 85 99 / var(--tw-text-opacity)) !important;\n}\n.text-red-600 {\n --tw-text-opacity: 1 !important;\n color: rgb(220 38 38 / var(--tw-text-opacity)) !important;\n}\n.text-gray-800 {\n --tw-text-opacity: 1 !important;\n color: rgb(31 41 55 / var(--tw-text-opacity)) !important;\n}\n.text-blue-800 {\n --tw-text-opacity: 1 !important;\n color: rgb(30 64 175 / var(--tw-text-opacity)) !important;\n}\n.text-red-700 {\n --tw-text-opacity: 1 !important;\n color: rgb(185 28 28 / var(--tw-text-opacity)) !important;\n}\n.text-slate-300 {\n --tw-text-opacity: 1 !important;\n color: rgb(203 213 225 / var(--tw-text-opacity)) !important;\n}\n.text-slate-500 {\n --tw-text-opacity: 1 !important;\n color: rgb(100 116 139 / var(--tw-text-opacity)) !important;\n}\n.text-slate-900 {\n --tw-text-opacity: 1 !important;\n color: rgb(15 23 42 / var(--tw-text-opacity)) !important;\n}\n.text-fuchsia-600 {\n --tw-text-opacity: 1 !important;\n color: rgb(192 38 211 / var(--tw-text-opacity)) !important;\n}\n.text-slate-800 {\n --tw-text-opacity: 1 !important;\n color: rgb(30 41 59 / var(--tw-text-opacity)) !important;\n}\n.text-slate-600 {\n --tw-text-opacity: 1 !important;\n color: rgb(71 85 105 / var(--tw-text-opacity)) !important;\n}\n.text-slate-700 {\n --tw-text-opacity: 1 !important;\n color: rgb(51 65 85 / var(--tw-text-opacity)) !important;\n}\n.text-purple-600 {\n --tw-text-opacity: 1 !important;\n color: rgb(147 51 234 / var(--tw-text-opacity)) !important;\n}\n.text-white {\n --tw-text-opacity: 1 !important;\n color: rgb(255 255 255 / var(--tw-text-opacity)) !important;\n}\n.text-indigo-600 {\n --tw-text-opacity: 1 !important;\n color: rgb(79 70 229 / var(--tw-text-opacity)) !important;\n}\n.text-gray-500 {\n --tw-text-opacity: 1 !important;\n color: rgb(107 114 128 / var(--tw-text-opacity)) !important;\n}\n.text-blue-600 {\n --tw-text-opacity: 1 !important;\n color: rgb(37 99 235 / var(--tw-text-opacity)) !important;\n}\n.opacity-0 {\n opacity: 0 !important;\n}\n.shadow {\n --tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1) !important;\n --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color) !important;\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow) !important;\n}\n.shadow-sm {\n --tw-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05) !important;\n --tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color) !important;\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow) !important;\n}\n.shadow-md {\n --tw-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1) !important;\n --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color) !important;\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow) !important;\n}\n.outline {\n outline-style: solid !important;\n}\n.blur {\n --tw-blur: blur(8px) !important;\n filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow) !important;\n}\n.filter {\n filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow) !important;\n}\n.backdrop-blur {\n --tw-backdrop-blur: blur(8px) !important;\n backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia) !important;\n}\n.transition-colors {\n transition-property: color, background-color, border-color, fill, stroke, -webkit-text-decoration-color !important;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke !important;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, -webkit-text-decoration-color !important;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1) !important;\n transition-duration: 150ms !important;\n}\n.transition {\n transition-property: color, background-color, border-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-text-decoration-color !important;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter !important;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-text-decoration-color !important;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1) !important;\n transition-duration: 150ms !important;\n}\n.transition-all {\n transition-property: all !important;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1) !important;\n transition-duration: 150ms !important;\n}\n.placeholder\\:text-xs::-moz-placeholder {\n font-size: 0.75rem !important;\n line-height: 1rem !important;\n}\n.placeholder\\:text-xs:-ms-input-placeholder {\n font-size: 0.75rem !important;\n line-height: 1rem !important;\n}\n.placeholder\\:text-xs::placeholder {\n font-size: 0.75rem !important;\n line-height: 1rem !important;\n}\n.placeholder\\:italic::-moz-placeholder {\n font-style: italic !important;\n}\n.placeholder\\:italic:-ms-input-placeholder {\n font-style: italic !important;\n}\n.placeholder\\:italic::placeholder {\n font-style: italic !important;\n}\n.placeholder\\:text-gray-400::-moz-placeholder {\n --tw-text-opacity: 1 !important;\n color: rgb(156 163 175 / var(--tw-text-opacity)) !important;\n}\n.placeholder\\:text-gray-400:-ms-input-placeholder {\n --tw-text-opacity: 1 !important;\n color: rgb(156 163 175 / var(--tw-text-opacity)) !important;\n}\n.placeholder\\:text-gray-400::placeholder {\n --tw-text-opacity: 1 !important;\n color: rgb(156 163 175 / var(--tw-text-opacity)) !important;\n}\n.first\\:pl-2:first-child {\n padding-left: 0.5rem !important;\n}\n.last\\:mb-0:last-child {\n margin-bottom: 0px !important;\n}\n.last\\:pr-2:last-child {\n padding-right: 0.5rem !important;\n}\n.hover\\:border-indigo-400:hover {\n --tw-border-opacity: 1 !important;\n border-color: rgb(129 140 248 / var(--tw-border-opacity)) !important;\n}\n.hover\\:bg-gray-200:hover {\n --tw-bg-opacity: 1 !important;\n background-color: rgb(229 231 235 / var(--tw-bg-opacity)) !important;\n}\n.hover\\:bg-indigo-500:hover {\n --tw-bg-opacity: 1 !important;\n background-color: rgb(99 102 241 / var(--tw-bg-opacity)) !important;\n}\n.hover\\:from-fuchsia-500:hover {\n --tw-gradient-from: #d946ef !important;\n --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgb(217 70 239 / 0)) !important;\n}\n.hover\\:from-purple-500:hover {\n --tw-gradient-from: #a855f7 !important;\n --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgb(168 85 247 / 0)) !important;\n}\n.hover\\:to-purple-500:hover {\n --tw-gradient-to: #a855f7 !important;\n}\n.hover\\:to-indigo-500:hover {\n --tw-gradient-to: #6366f1 !important;\n}\n.hover\\:text-white:hover {\n --tw-text-opacity: 1 !important;\n color: rgb(255 255 255 / var(--tw-text-opacity)) !important;\n}\n.hover\\:text-indigo-800:hover {\n --tw-text-opacity: 1 !important;\n color: rgb(55 48 163 / var(--tw-text-opacity)) !important;\n}\n.hover\\:text-indigo-600:hover {\n --tw-text-opacity: 1 !important;\n color: rgb(79 70 229 / var(--tw-text-opacity)) !important;\n}\n.hover\\:text-slate-400:hover {\n --tw-text-opacity: 1 !important;\n color: rgb(148 163 184 / var(--tw-text-opacity)) !important;\n}\n.hover\\:text-black:hover {\n --tw-text-opacity: 1 !important;\n color: rgb(0 0 0 / var(--tw-text-opacity)) !important;\n}\n.focus\\:border-gray-200:focus {\n --tw-border-opacity: 1 !important;\n border-color: rgb(229 231 235 / var(--tw-border-opacity)) !important;\n}\n.focus\\:outline-none:focus {\n outline: 2px solid transparent !important;\n outline-offset: 2px !important;\n}\n.focus-visible\\:outline-none:focus-visible {\n outline: 2px solid transparent !important;\n outline-offset: 2px !important;\n}\n.focus-visible\\:ring-2:focus-visible {\n --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color) !important;\n --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color) !important;\n box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000) !important;\n}\n.focus-visible\\:ring-fuchsia-500:focus-visible {\n --tw-ring-opacity: 1 !important;\n --tw-ring-color: rgb(217 70 239 / var(--tw-ring-opacity)) !important;\n}\n.focus-visible\\:ring-purple-500:focus-visible {\n --tw-ring-opacity: 1 !important;\n --tw-ring-color: rgb(168 85 247 / var(--tw-ring-opacity)) !important;\n}\n.focus-visible\\:ring-indigo-500:focus-visible {\n --tw-ring-opacity: 1 !important;\n --tw-ring-color: rgb(99 102 241 / var(--tw-ring-opacity)) !important;\n}\n.focus-visible\\:ring-offset-2:focus-visible {\n --tw-ring-offset-width: 2px !important;\n}\n.focus-visible\\:ring-offset-white:focus-visible {\n --tw-ring-offset-color: #fff !important;\n}\n.active\\:text-slate-800:active {\n --tw-text-opacity: 1 !important;\n color: rgb(30 41 59 / var(--tw-text-opacity)) !important;\n}\n.group:hover .group-hover\\:cursor-pointer {\n cursor: pointer !important;\n}\n.group:hover .group-hover\\:bg-slate-100 {\n --tw-bg-opacity: 1 !important;\n background-color: rgb(241 245 249 / var(--tw-bg-opacity)) !important;\n}\n.group:hover .group-hover\\:bg-blue-600 {\n --tw-bg-opacity: 1 !important;\n background-color: rgb(37 99 235 / var(--tw-bg-opacity)) !important;\n}\n.group:hover .group-hover\\:text-white {\n --tw-text-opacity: 1 !important;\n color: rgb(255 255 255 / var(--tw-text-opacity)) !important;\n}\n.group:active .group-active\\:bg-blue-700 {\n --tw-bg-opacity: 1 !important;\n background-color: rgb(29 78 216 / var(--tw-bg-opacity)) !important;\n}\n@media (min-width: 640px) {\n\n .sm\\:grid-cols-2 {\n grid-template-columns: repeat(2, minmax(0, 1fr)) !important;\n }\n}',""]);const b=h},94748:e=>{e.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuMTZEaa/1AAAAHUlEQVQYV2PYvXu3JAi7uLiAMaYAjAGTQBPYLQkAa/0Zef3qRswAAAAASUVORK5CYII="},4768:e=>{e.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAAL0lEQVQoz2NgCD3x//9/BhBYBWdhgFVAiVW4JBFKGIa4AqD0//9D3pt4I4tAdAMAHTQ/j5Zom30AAAAASUVORK5CYII="},35555:e=>{e.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAQAAADZc7J/AAAAz0lEQVRIx2NgYGBY/R8I/vx5eelX3n82IJ9FxGf6tksvf/8FiTMQAcAGQMDvSwu09abffY8QYSAScNk45G198eX//yev73/4///701eh//kZSARckrNBRvz//+8+6ZohwCzjGNjdgQxkAg7B9WADeBjIBqtJCbhRA0YNoIkBSNmaPEMoNmA0FkYNoFKhapJ6FGyAH3nauaSmPfwI0v/3OukVi0CIZ+F25KrtYcx/CTIy0e+rC7R1Z4KMICVTQQ14feVXIbR695u14+Ir4gwAAD49E54wc1kWAAAAAElFTkSuQmCC"},23601:e=>{e.exports="data:image/svg+xml,%3csvg viewBox=%270 0 16 16%27 fill=%27white%27 xmlns=%27http://www.w3.org/2000/svg%27%3e%3ccircle cx=%278%27 cy=%278%27 r=%273%27/%3e%3c/svg%3e"},133:e=>{e.exports="data:image/svg+xml,%3csvg viewBox=%270 0 16 16%27 fill=%27white%27 xmlns=%27http://www.w3.org/2000/svg%27%3e%3cpath d=%27M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z%27/%3e%3c/svg%3e"},1686:e=>{e.exports="data:image/svg+xml,%3csvg xmlns=%27http://www.w3.org/2000/svg%27 fill=%27none%27 viewBox=%270 0 16 16%27%3e%3cpath stroke=%27white%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27 stroke-width=%272%27 d=%27M4 8h8%27/%3e%3c/svg%3e"},70909:e=>{e.exports="data:image/svg+xml,%3csvg xmlns=%27http://www.w3.org/2000/svg%27 fill=%27none%27 viewBox=%270 0 20 20%27%3e%3cpath stroke=%27%236b7280%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27 stroke-width=%271.5%27 d=%27M6 8l4 4 4-4%27/%3e%3c/svg%3e"},6161:e=>{e.exports="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTMiIGhlaWdodD0iMzYiIHZpZXdCb3g9IjAgMCA1MyAzNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgY2xpcC1wYXRoPSJ1cmwoI2NsaXAwKSI+CjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNNDguMDM2NCA0LjAxMDQySDQuMDA3NzlMNC4wMDc3OSAzMi4wMjg2SDQ4LjAzNjRWNC4wMTA0MlpNNC4wMDc3OSAwLjAwNzgxMjVDMS43OTcyMSAwLjAwNzgxMjUgMC4wMDUxODc5OSAxLjc5OTg0IDAuMDA1MTg3OTkgNC4wMTA0MlYzMi4wMjg2QzAuMDA1MTg3OTkgMzQuMjM5MiAxLjc5NzIxIDM2LjAzMTIgNC4wMDc3OSAzNi4wMzEySDQ4LjAzNjRDNTAuMjQ3IDM2LjAzMTIgNTIuMDM5IDM0LjIzOTIgNTIuMDM5IDMyLjAyODZWNC4wMTA0MkM1Mi4wMzkgMS43OTk4NCA1MC4yNDcgMC4wMDc4MTI1IDQ4LjAzNjQgMC4wMDc4MTI1SDQuMDA3NzlaTTguMDEwNDIgOC4wMTMwMkgxMi4wMTNWMTIuMDE1Nkg4LjAxMDQyVjguMDEzMDJaTTIwLjAxODIgOC4wMTMwMkgxNi4wMTU2VjEyLjAxNTZIMjAuMDE4MlY4LjAxMzAyWk0yNC4wMjA4IDguMDEzMDJIMjguMDIzNFYxMi4wMTU2SDI0LjAyMDhWOC4wMTMwMlpNMzYuMDI4NiA4LjAxMzAySDMyLjAyNlYxMi4wMTU2SDM2LjAyODZWOC4wMTMwMlpNNDAuMDMxMiA4LjAxMzAySDQ0LjAzMzlWMTIuMDE1Nkg0MC4wMzEyVjguMDEzMDJaTTE2LjAxNTYgMTYuMDE4Mkg4LjAxMDQyVjIwLjAyMDhIMTYuMDE1NlYxNi4wMTgyWk0yMC4wMTgyIDE2LjAxODJIMjQuMDIwOFYyMC4wMjA4SDIwLjAxODJWMTYuMDE4MlpNMzIuMDI2IDE2LjAxODJIMjguMDIzNFYyMC4wMjA4SDMyLjAyNlYxNi4wMTgyWk00NC4wMzM5IDE2LjAxODJWMjAuMDIwOEgzNi4wMjg2VjE2LjAxODJINDQuMDMzOVpNMTIuMDEzIDI0LjAyMzRIOC4wMTA0MlYyOC4wMjZIMTIuMDEzVjI0LjAyMzRaTTE2LjAxNTYgMjQuMDIzNEgzNi4wMjg2VjI4LjAyNkgxNi4wMTU2VjI0LjAyMzRaTTQ0LjAzMzkgMjQuMDIzNEg0MC4wMzEyVjI4LjAyNkg0NC4wMzM5VjI0LjAyMzRaIiBmaWxsPSIjNDI0MjQyIi8+CjwvZz4KPGRlZnM+CjxjbGlwUGF0aCBpZD0iY2xpcDAiPgo8cmVjdCB3aWR0aD0iNTMiIGhlaWdodD0iMzYiIGZpbGw9IndoaXRlIi8+CjwvY2xpcFBhdGg+CjwvZGVmcz4KPC9zdmc+Cg=="},51096:e=>{e.exports="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTMiIGhlaWdodD0iMzYiIHZpZXdCb3g9IjAgMCA1MyAzNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgY2xpcC1wYXRoPSJ1cmwoI2NsaXAwKSI+CjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNNDguMDM2NCA0LjAxMDQySDQuMDA3NzlMNC4wMDc3OSAzMi4wMjg2SDQ4LjAzNjRWNC4wMTA0MlpNNC4wMDc3OSAwLjAwNzgxMjVDMS43OTcyMSAwLjAwNzgxMjUgMC4wMDUxODc5OSAxLjc5OTg0IDAuMDA1MTg3OTkgNC4wMTA0MlYzMi4wMjg2QzAuMDA1MTg3OTkgMzQuMjM5MiAxLjc5NzIxIDM2LjAzMTIgNC4wMDc3OSAzNi4wMzEySDQ4LjAzNjRDNTAuMjQ3IDM2LjAzMTIgNTIuMDM5IDM0LjIzOTIgNTIuMDM5IDMyLjAyODZWNC4wMTA0MkM1Mi4wMzkgMS43OTk4NCA1MC4yNDcgMC4wMDc4MTI1IDQ4LjAzNjQgMC4wMDc4MTI1SDQuMDA3NzlaTTguMDEwNDIgOC4wMTMwMkgxMi4wMTNWMTIuMDE1Nkg4LjAxMDQyVjguMDEzMDJaTTIwLjAxODIgOC4wMTMwMkgxNi4wMTU2VjEyLjAxNTZIMjAuMDE4MlY4LjAxMzAyWk0yNC4wMjA4IDguMDEzMDJIMjguMDIzNFYxMi4wMTU2SDI0LjAyMDhWOC4wMTMwMlpNMzYuMDI4NiA4LjAxMzAySDMyLjAyNlYxMi4wMTU2SDM2LjAyODZWOC4wMTMwMlpNNDAuMDMxMiA4LjAxMzAySDQ0LjAzMzlWMTIuMDE1Nkg0MC4wMzEyVjguMDEzMDJaTTE2LjAxNTYgMTYuMDE4Mkg4LjAxMDQyVjIwLjAyMDhIMTYuMDE1NlYxNi4wMTgyWk0yMC4wMTgyIDE2LjAxODJIMjQuMDIwOFYyMC4wMjA4SDIwLjAxODJWMTYuMDE4MlpNMzIuMDI2IDE2LjAxODJIMjguMDIzNFYyMC4wMjA4SDMyLjAyNlYxNi4wMTgyWk00NC4wMzM5IDE2LjAxODJWMjAuMDIwOEgzNi4wMjg2VjE2LjAxODJINDQuMDMzOVpNMTIuMDEzIDI0LjAyMzRIOC4wMTA0MlYyOC4wMjZIMTIuMDEzVjI0LjAyMzRaTTE2LjAxNTYgMjQuMDIzNEgzNi4wMjg2VjI4LjAyNkgxNi4wMTU2VjI0LjAyMzRaTTQ0LjAzMzkgMjQuMDIzNEg0MC4wMzEyVjI4LjAyNkg0NC4wMzM5VjI0LjAyMzRaIiBmaWxsPSIjQzVDNUM1Ii8+CjwvZz4KPGRlZnM+CjxjbGlwUGF0aCBpZD0iY2xpcDAiPgo8cmVjdCB3aWR0aD0iNTMiIGhlaWdodD0iMzYiIGZpbGw9IndoaXRlIi8+CjwvY2xpcFBhdGg+CjwvZGVmcz4KPC9zdmc+Cg=="}},o={};function s(e){var t=o[e];if(void 0!==t)return t.exports;var n=o[e]={id:e,loaded:!1,exports:{}};return r[e](n,n.exports,s),n.loaded=!0,n.exports}s.m=r,s.amdO={},e=[],s.O=(t,n,r,o)=>{if(!n){var i=1/0;for(d=0;d=o)&&Object.keys(s.O).every((e=>s.O[e](n[l])))?n.splice(l--,1):(a=!1,o0&&e[d-1][2]>o;d--)e[d]=e[d-1];e[d]=[n,r,o]},s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.f={},s.e=e=>Promise.all(Object.keys(s.f).reduce(((t,n)=>(s.f[n](e,t),t)),[])),s.u=e=>e+".bundle.js",s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.hmd=e=>((e=Object.create(e)).children||(e.children=[]),Object.defineProperty(e,"exports",{enumerable:!0,set:()=>{throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+e.id)}}),e),s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),t={},n="sterling-layout:",s.l=(e,r,o,i)=>{if(t[e])t[e].push(r);else{var a,l;if(void 0!==o)for(var c=document.getElementsByTagName("script"),d=0;d{a.onerror=a.onload=null,clearTimeout(h);var o=t[e];if(delete t[e],a.parentNode&&a.parentNode.removeChild(a),o&&o.forEach((e=>e(r))),n)return n(r)},h=setTimeout(u.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=u.bind(null,a.onerror),a.onload=u.bind(null,a.onload),l&&document.head.appendChild(a)}},s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),s.p="./",(()=>{s.b=document.baseURI||self.location.href;var e={179:0};s.f.j=(t,n)=>{var r=s.o(e,t)?e[t]:void 0;if(0!==r)if(r)n.push(r[2]);else{var o=new Promise(((n,o)=>r=e[t]=[n,o]));n.push(r[2]=o);var i=s.p+s.u(t),a=new Error;s.l(i,(n=>{if(s.o(e,t)&&(0!==(r=e[t])&&(e[t]=void 0),r)){var o=n&&("load"===n.type?"missing":n.type),i=n&&n.target&&n.target.src;a.message="Loading chunk "+t+" failed.\n("+o+": "+i+")",a.name="ChunkLoadError",a.type=o,a.request=i,r[1](a)}}),"chunk-"+t,t)}},s.O.j=t=>0===e[t];var t=(t,n)=>{var r,o,[i,a,l]=n,c=0;if(i.some((t=>0!==e[t]))){for(r in a)s.o(a,r)&&(s.m[r]=a[r]);if(l)var d=l(s)}for(t&&t(n);cs(67403)));i=s.O(i)})(); \ No newline at end of file diff --git a/forge/sterling/build/vendor/react-component-integration.global.js b/forge/sterling/build/vendor/react-component-integration.global.js index d4e7b043..3b0dfa9a 100644 --- a/forge/sterling/build/vendor/react-component-integration.global.js +++ b/forge/sterling/build/vendor/react-component-integration.global.js @@ -1,2 +1,2 @@ /*! For license information please see react-component-integration.global.js.LICENSE.txt */ -"use strict";var IntegratedDemo=(()=>{var e,t=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,i=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,l=(e=function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')},typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):e),s=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),u=(e,t,i,l)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let s of a(t))!o.call(e,s)&&s!==i&&n(e,s,{get:()=>t[s],enumerable:!(l=r(t,s))||l.enumerable});return e},c=(e,r,a)=>(a=null!=e?t(i(e)):{},u(!r&&e&&e.__esModule?a:n(a,"default",{value:e,enumerable:!0}),e)),d=s((e=>{var t=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),l=Symbol.for("react.context"),s=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),c=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),f=Symbol.iterator,p={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h=Object.assign,m={};function g(e,t,n){this.props=e,this.context=t,this.refs=m,this.updater=n||p}function y(){}function v(e,t,n){this.props=e,this.context=t,this.refs=m,this.updater=n||p}g.prototype.isReactComponent={},g.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},g.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},y.prototype=g.prototype;var b=v.prototype=new y;b.constructor=v,h(b,g.prototype),b.isPureReactComponent=!0;var x=Array.isArray,w={H:null,A:null,T:null,S:null,V:null},k=Object.prototype.hasOwnProperty;function C(e,n,r,a,i,o){return r=o.ref,{$$typeof:t,type:e,key:n,ref:void 0!==r?r:null,props:o}}function j(e){return"object"==typeof e&&null!==e&&e.$$typeof===t}var S=/\/+/g;function E(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,(function(e){return t[e]}))}(""+e.key):t.toString(36)}function _(){}function N(e,r,a,i,o){var l=typeof e;("undefined"===l||"boolean"===l)&&(e=null);var s=!1;if(null===e)s=!0;else switch(l){case"bigint":case"string":case"number":s=!0;break;case"object":switch(e.$$typeof){case t:case n:s=!0;break;case d:return N((s=e._init)(e._payload),r,a,i,o)}}if(s)return o=o(e),s=""===i?"."+E(e,0):i,x(o)?(a="",null!=s&&(a=s.replace(S,"$&/")+"/"),N(o,r,a,"",(function(e){return e}))):null!=o&&(j(o)&&(o=function(e,t){return C(e.type,t,void 0,0,0,e.props)}(o,a+(null==o.key||e&&e.key===o.key?"":(""+o.key).replace(S,"$&/")+"/")+s)),r.push(o)),1;s=0;var u=""===i?".":i+":";if(x(e))for(var c=0;c{t.exports=d()})),p=s((e=>{function t(e,t){var n=e.length;e.push(t);e:for(;0>>1,i=e[r];if(!(0>>1;ra(s,n))ua(c,s)?(e[r]=c,e[u]=n,r=u):(e[r]=s,e[l]=n,r=l);else{if(!(ua(c,n)))break e;e[r]=c,e[u]=n,r=u}}}return t}function a(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}e.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now?(i=performance,e.unstable_now=function(){return i.now()}):(o=Date,l=o.now(),e.unstable_now=function(){return o.now()-l});var i,o,l,s=[],u=[],c=1,d=null,f=3,p=!1,h=!1,m=!1,g=!1,y="function"==typeof setTimeout?setTimeout:null,v="function"==typeof clearTimeout?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;function x(e){for(var a=n(u);null!==a;){if(null===a.callback)r(u);else{if(!(a.startTime<=e))break;r(u),a.sortIndex=a.expirationTime,t(s,a)}a=n(u)}}function w(e){if(m=!1,x(e),!h)if(null!==n(s))h=!0,S||(S=!0,k());else{var t=n(u);null!==t&&P(w,t.startTime-e)}}var k,C,j,S=!1,E=-1,_=5,N=-1;function A(){return!(!g&&e.unstable_now()-N<_)}function I(){if(g=!1,S){var t=e.unstable_now();N=t;var a=!0;try{e:{h=!1,m&&(m=!1,v(E),E=-1),p=!0;var i=f;try{t:{for(x(t),d=n(s);null!==d&&!(d.expirationTime>t&&A());){var o=d.callback;if("function"==typeof o){d.callback=null,f=d.priorityLevel;var l=o(d.expirationTime<=t);if(t=e.unstable_now(),"function"==typeof l){d.callback=l,x(t),a=!0;break t}d===n(s)&&r(s),x(t)}else r(s);d=n(s)}if(null!==d)a=!0;else{var c=n(u);null!==c&&P(w,c.startTime-t),a=!1}}break e}finally{d=null,f=i,p=!1}a=void 0}}finally{a?k():S=!1}}}function P(t,n){E=y((function(){t(e.unstable_now())}),n)}"function"==typeof b?k=function(){b(I)}:typeof MessageChannel<"u"?(C=new MessageChannel,j=C.port2,C.port1.onmessage=I,k=function(){j.postMessage(null)}):k=function(){y(I,0)},e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125o?(r.sortIndex=i,t(u,r),null===n(s)&&r===n(u)&&(m?(v(E),E=-1):m=!0,P(w,i-o))):(r.sortIndex=l,t(s,r),h||p||(h=!0,S||(S=!0,k()))),r},e.unstable_shouldYield=A,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),h=s(((e,t)=>{t.exports=p()})),m=s((e=>{var t=f();function n(e){var t="https://react.dev/errors/"+e;if(1{(function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||"function"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}})(),t.exports=m()})),y=s((e=>{var t=h(),n=f(),r=g();function a(e){var t="https://react.dev/errors/"+e;if(1F||(e.current=R[F],R[F]=null,F--)}function B(e,t){F++,R[F]=e.current,e.current=t}var H=M(null),V=M(null),q=M(null),W=M(null);function G(e,t){switch(B(q,t),B(V,e),B(H,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?ld(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)e=sd(t=ld(t),e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}U(H),B(H,e)}function Y(){U(H),U(V),U(q)}function Q(e){null!==e.memoizedState&&B(W,e);var t=H.current,n=sd(t,e.type);t!==n&&(B(V,e),B(H,n))}function K(e){V.current===e&&(U(H),U(V)),W.current===e&&(U(W),Xd._currentValue=z)}var X=Object.prototype.hasOwnProperty,Z=t.unstable_scheduleCallback,J=t.unstable_cancelCallback,ee=t.unstable_shouldYield,te=t.unstable_requestPaint,ne=t.unstable_now,re=t.unstable_getCurrentPriorityLevel,ae=t.unstable_ImmediatePriority,ie=t.unstable_UserBlockingPriority,oe=t.unstable_NormalPriority,le=t.unstable_LowPriority,se=t.unstable_IdlePriority,ue=t.log,ce=t.unstable_setDisableYieldValue,de=null,fe=null;function pe(e){if("function"==typeof ue&&ce(e),fe&&"function"==typeof fe.setStrictMode)try{fe.setStrictMode(de,e)}catch{}}var he=Math.clz32?Math.clz32:function(e){return 0==(e>>>=0)?32:31-(me(e)/ge|0)|0},me=Math.log,ge=Math.LN2,ye=256,ve=4194304;function be(e){var t=42&e;if(0!==t)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return 4194048&e;case 4194304:case 8388608:case 16777216:case 33554432:return 62914560&e;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function xe(e,t,n){var r=e.pendingLanes;if(0===r)return 0;var a=0,i=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var l=134217727&r;return 0!==l?0!=(r=l&~i)?a=be(r):0!=(o&=l)?a=be(o):n||0!=(n=l&~e)&&(a=be(n)):0!=(l=r&~i)?a=be(l):0!==o?a=be(o):n||0!=(n=r&~e)&&(a=be(n)),0===a?0:0!==t&&t!==a&&0==(t&i)&&((i=a&-a)>=(n=t&-t)||32===i&&0!=(4194048&n))?t:a}function we(e,t){return 0==(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)}function ke(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;default:return-1}}function Ce(){var e=ye;return 0==(4194048&(ye<<=1))&&(ye=256),e}function je(){var e=ve;return 0==(62914560&(ve<<=1))&&(ve=4194304),e}function Se(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ee(e,t){e.pendingLanes|=t,268435456!==t&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function _e(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-he(t);e.entangledLanes|=t,e.entanglements[r]=1073741824|e.entanglements[r]|4194090&n}function Ne(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-he(n),a=1<)":-1--a||s[r]!==u[a]){var c="\n"+s[r].replace(" at new "," at ");return e.displayName&&c.includes("")&&(c=c.replace("",e.displayName)),c}}while(1<=r&&0<=a);break}}}finally{ot=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?it(n):""}function st(e){switch(e.tag){case 26:case 27:case 5:return it(e.type);case 16:return it("Lazy");case 13:return it("Suspense");case 19:return it("SuspenseList");case 0:case 15:return lt(e.type,!1);case 11:return lt(e.type.render,!1);case 1:return lt(e.type,!0);case 31:return it("Activity");default:return""}}function ut(e){try{var t="";do{t+=st(e),e=e.return}while(e);return t}catch(e){return"\nError generating stack: "+e.message+"\n"+e.stack}}function ct(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":case"object":return e;default:return""}}function dt(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function ft(e){e._valueTracker||(e._valueTracker=function(e){var t=dt(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&"function"==typeof n.get&&"function"==typeof n.set){var a=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(e){r=""+e,i.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function pt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=dt(e)?e.checked?"true":"false":e.value),(e=r)!==n&&(t.setValue(e),!0)}function ht(e){if(typeof(e=e||(typeof document<"u"?document:void 0))>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var mt=/[\n"\\]/g;function gt(e){return e.replace(mt,(function(e){return"\\"+e.charCodeAt(0).toString(16)+" "}))}function yt(e,t,n,r,a,i,o,l){e.name="",null!=o&&"function"!=typeof o&&"symbol"!=typeof o&&"boolean"!=typeof o?e.type=o:e.removeAttribute("type"),null!=t?"number"===o?(0===t&&""===e.value||e.value!=t)&&(e.value=""+ct(t)):e.value!==""+ct(t)&&(e.value=""+ct(t)):"submit"!==o&&"reset"!==o||e.removeAttribute("value"),null!=t?bt(e,o,ct(t)):null!=n?bt(e,o,ct(n)):null!=r&&e.removeAttribute("value"),null==a&&null!=i&&(e.defaultChecked=!!i),null!=a&&(e.checked=a&&"function"!=typeof a&&"symbol"!=typeof a),null!=l&&"function"!=typeof l&&"symbol"!=typeof l&&"boolean"!=typeof l?e.name=""+ct(l):e.removeAttribute("name")}function vt(e,t,n,r,a,i,o,l){if(null!=i&&"function"!=typeof i&&"symbol"!=typeof i&&"boolean"!=typeof i&&(e.type=i),null!=t||null!=n){if(("submit"===i||"reset"===i)&&null==t)return;n=null!=n?""+ct(n):"",t=null!=t?""+ct(t):n,l||t===e.value||(e.value=t),e.defaultValue=t}r="function"!=typeof(r=r??a)&&"symbol"!=typeof r&&!!r,e.checked=l?e.checked:!!r,e.defaultChecked=!!r,null!=o&&"function"!=typeof o&&"symbol"!=typeof o&&"boolean"!=typeof o&&(e.name=o)}function bt(e,t,n){"number"===t&&ht(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function xt(e,t,n,r){if(e=e.options,t){t={};for(var a=0;a"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Mt=!1;if(Ft)try{Ut={},Object.defineProperty(Ut,"passive",{get:function(){Mt=!0}}),window.addEventListener("test",Ut,Ut),window.removeEventListener("test",Ut,Ut)}catch{Mt=!1}var Ut,Bt=null,Ht=null,Vt=null;function qt(){if(Vt)return Vt;var e,t,n=Ht,r=n.length,a="value"in Bt?Bt.value:Bt.textContent,i=a.length;for(e=0;e=_n),In=!1;function Pn(e,t){switch(e){case"keyup":return-1!==Sn.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Tn(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var Ln=!1,On={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Dn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!On[e.type]:"textarea"===t}function $n(e,t,n,r){Lt?Ot?Ot.push(r):Ot=[r]:Lt=r,0<(t=Gc(t,"onChange")).length&&(n=new en("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var zn=null,Rn=null;function Fn(e){Fc(e,0)}function Mn(e){if(pt(Ve(e)))return e}function Un(e,t){if("change"===e)return t}var Bn,Hn,Vn,qn=!1;function Wn(){zn&&(zn.detachEvent("onpropertychange",Gn),Rn=zn=null)}function Gn(e){if("value"===e.propertyName&&Mn(Rn)){var t=[];$n(t,Rn,e,Tt(e)),zt(Fn,t)}}function Yn(e,t,n){"focusin"===e?(Wn(),Rn=n,(zn=t).attachEvent("onpropertychange",Gn)):"focusout"===e&&Wn()}function Qn(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return Mn(Rn)}function Kn(e,t){if("click"===e)return Mn(t)}function Xn(e,t){if("input"===e||"change"===e)return Mn(t)}Ft&&(Ft?((Hn="oninput"in document)||((Vn=document.createElement("div")).setAttribute("oninput","return;"),Hn="function"==typeof Vn.oninput),Bn=Hn):Bn=!1,qn=Bn&&(!document.documentMode||9=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=er(r)}}function nr(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?nr(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function rr(e){for(var t=ht((e=null!=e&&null!=e.ownerDocument&&null!=e.ownerDocument.defaultView?e.ownerDocument.defaultView:window).document);t instanceof e.HTMLIFrameElement;){try{var n="string"==typeof t.contentWindow.location.href}catch{n=!1}if(!n)break;t=ht((e=t.contentWindow).document)}return t}function ar(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}var ir=Ft&&"documentMode"in document&&11>=document.documentMode,or=null,lr=null,sr=null,ur=!1;function cr(e,t,n){var r=n.window===n?n.document:9===n.nodeType?n:n.ownerDocument;ur||null==or||or!==ht(r)||(r="selectionStart"in(r=or)&&ar(r)?{start:r.selectionStart,end:r.selectionEnd}:{anchorNode:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset},sr&&Jn(sr,r)||(sr=r,0<(r=Gc(lr,"onSelect")).length&&(t=new en("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=or)))}function dr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var fr={animationend:dr("Animation","AnimationEnd"),animationiteration:dr("Animation","AnimationIteration"),animationstart:dr("Animation","AnimationStart"),transitionrun:dr("Transition","TransitionRun"),transitionstart:dr("Transition","TransitionStart"),transitioncancel:dr("Transition","TransitionCancel"),transitionend:dr("Transition","TransitionEnd")},pr={},hr={};function mr(e){if(pr[e])return pr[e];if(!fr[e])return e;var t,n=fr[e];for(t in n)if(n.hasOwnProperty(t)&&t in hr)return pr[e]=n[t];return e}Ft&&(hr=document.createElement("div").style,"AnimationEvent"in window||(delete fr.animationend.animation,delete fr.animationiteration.animation,delete fr.animationstart.animation),"TransitionEvent"in window||delete fr.transitionend.transition);var gr=mr("animationend"),yr=mr("animationiteration"),vr=mr("animationstart"),br=mr("transitionrun"),xr=mr("transitionstart"),wr=mr("transitioncancel"),kr=mr("transitionend"),Cr=new Map,jr="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Sr(e,t){Cr.set(e,t),Qe(t,[e])}jr.push("scrollEnd");var Er=new WeakMap;function _r(e,t){if("object"==typeof e&&null!==e){var n=Er.get(e);return void 0!==n?n:(t={value:e,source:t,stack:ut(t)},Er.set(e,t),t)}return{value:e,source:t,stack:ut(t)}}var Nr=[],Ar=0,Ir=0;function Pr(){for(var e=Ar,t=Ir=Ar=0;t>=o,a-=o,ea=1<<32-he(t)+a|n<i?i:8;var o=D.T,l={};D.T=l,Vo(e,!1,t,n);try{var s=a(),u=D.S;if(null!==u&&u(l,s),null!==s&&"object"==typeof s&&"function"==typeof s.then){var c=function(e,t){var n=[],r={status:"pending",value:null,reason:null,then:function(e){n.push(e)}};return e.then((function(){r.status="fulfilled",r.value=t;for(var e=0;ep?(m=d,d=null):m=d.sibling;var y=h(a,d,l[p],s);if(null===y){null===d&&(d=m);break}e&&d&&null===y.alternate&&t(a,d),i=o(y,i,p),null===c?u=y:c.sibling=y,c=y,d=m}if(p===l.length)return n(a,d),sa&&na(a,p),u;if(null===d){for(;pm?(y=p,p=null):y=p.sibling;var b=h(i,p,v.value,u);if(null===b){null===p&&(p=y);break}e&&p&&null===b.alternate&&t(i,p),l=o(b,l,m),null===d?c=b:d.sibling=b,d=b,p=y}if(v.done)return n(i,p),sa&&na(i,m),c;if(null===p){for(;!v.done;m++,v=s.next())null!==(v=f(i,v.value,u))&&(l=o(v,l,m),null===d?c=v:d.sibling=v,d=v);return sa&&na(i,m),c}for(p=r(p);!v.done;m++,v=s.next())null!==(v=g(p,i,m,v.value,u))&&(e&&null!==v.alternate&&p.delete(null===v.key?m:v.key),l=o(v,l,m),null===d?c=v:d.sibling=v,d=v);return e&&p.forEach((function(e){return t(i,e)})),sa&&na(i,m),c}(s,u,c=b.call(c),d)}if("function"==typeof c.then)return v(s,u,el(c),d);if(c.$$typeof===k)return v(s,u,Ia(s,c),d);nl(s,c)}return"string"==typeof c&&""!==c||"number"==typeof c||"bigint"==typeof c?(c=""+c,null!==u&&6===u.tag?(n(s,u.sibling),(d=i(u,c)).return=s,s=d):(n(s,u),(d=qr(c,s.mode,d)).return=s,s=d),l(s)):n(s,u)}return function(e,t,n,r){try{Jo=0;var a=v(e,t,n,r);return Zo=null,a}catch(t){if(t===Ya||t===Ka)throw t;var i=Fr(29,t,null,e.mode);return i.lanes=r,i.return=e,i}}}var il=al(!0),ol=al(!1),ll=M(null),sl=null;function ul(e){var t=e.alternate;B(pl,1&pl.current),B(ll,e),null===sl&&(null===t||null!==gi.current||null!==t.memoizedState)&&(sl=e)}function cl(e){if(22===e.tag){if(B(pl,pl.current),B(ll,e),null===sl){var t=e.alternate;null!==t&&null!==t.memoizedState&&(sl=e)}}else dl()}function dl(){B(pl,pl.current),B(ll,ll.current)}function fl(e){U(ll),sl===e&&(sl=null),U(pl)}var pl=M(0);function hl(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||"$?"===n.data||bd(n)))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!=(128&t.flags))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}function ml(e,t,n,r){n=null==(n=n(r,t=e.memoizedState))?t:c({},t,n),e.memoizedState=n,0===e.lanes&&(e.updateQueue.baseState=n)}var gl={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=zu(),a=li(r);a.payload=t,null!=n&&(a.callback=n),null!==(t=si(e,a,r))&&(Fu(t,0,r),ui(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=zu(),a=li(r);a.tag=1,a.payload=t,null!=n&&(a.callback=n),null!==(t=si(e,a,r))&&(Fu(t,0,r),ui(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=zu(),r=li(n);r.tag=2,null!=t&&(r.callback=t),null!==(t=si(e,r,n))&&(Fu(t,0,n),ui(t,e,n))}};function yl(e,t,n,r,a,i,o){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(r,i,o):!(t.prototype&&t.prototype.isPureReactComponent&&Jn(n,r)&&Jn(a,i))}function vl(e,t,n,r){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,r),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&gl.enqueueReplaceState(t,t.state,null)}function bl(e,t){var n=t;if("ref"in t)for(var r in n={},t)"ref"!==r&&(n[r]=t[r]);if(e=e.defaultProps)for(var a in n===t&&(n=c({},n)),e)void 0===n[a]&&(n[a]=e[a]);return n}var xl="function"==typeof reportError?reportError:function(e){if("object"==typeof window&&"function"==typeof window.ErrorEvent){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:"object"==typeof e&&null!==e&&"string"==typeof e.message?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if("object"==typeof process&&"function"==typeof process.emit)return void process.emit("uncaughtException",e);console.error(e)};function wl(e){xl(e)}function kl(e){console.error(e)}function Cl(e){xl(e)}function jl(e,t){try{(0,e.onUncaughtError)(t.value,{componentStack:t.stack})}catch(e){setTimeout((function(){throw e}))}}function Sl(e,t,n){try{(0,e.onCaughtError)(n.value,{componentStack:n.stack,errorBoundary:1===t.tag?t.stateNode:null})}catch(e){setTimeout((function(){throw e}))}}function El(e,t,n){return(n=li(n)).tag=3,n.payload={element:null},n.callback=function(){jl(e,t)},n}function _l(e){return(e=li(e)).tag=3,e}function Nl(e,t,n,r){var a=n.type.getDerivedStateFromError;if("function"==typeof a){var i=r.value;e.payload=function(){return a(i)},e.callback=function(){Sl(t,n,r)}}var o=n.stateNode;null!==o&&"function"==typeof o.componentDidCatch&&(e.callback=function(){Sl(t,n,r),"function"!=typeof a&&(null===_u?_u=new Set([this]):_u.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:null!==e?e:""})})}var Al=Error(a(461)),Il=!1;function Pl(e,t,n,r){t.child=null===e?ol(t,null,n,r):il(t,e.child,n,r)}function Tl(e,t,n,r,a){n=n.render;var i=t.ref;if("ref"in r){var o={};for(var l in r)"ref"!==l&&(o[l]=r[l])}else o=r;return Na(t),r=Oi(e,t,n,o,i,a),l=Ri(),null===e||Il?(sa&&l&&aa(t),t.flags|=1,Pl(e,t,r,a),t.child):(Fi(e,t,a),Zl(e,t,a))}function Ll(e,t,n,r,a){if(null===e){var i=n.type;return"function"!=typeof i||Mr(i)||void 0!==i.defaultProps||null!==n.compare?((e=Hr(n.type,null,r,t,t.mode,a)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=i,Ol(e,t,i,r,a))}if(i=e.child,!Jl(e,a)){var o=i.memoizedProps;if((n=null!==(n=n.compare)?n:Jn)(o,r)&&e.ref===t.ref)return Zl(e,t,a)}return t.flags|=1,(e=Ur(i,r)).ref=t.ref,e.return=t,t.child=e}function Ol(e,t,n,r,a){if(null!==e){var i=e.memoizedProps;if(Jn(i,r)&&e.ref===t.ref){if(Il=!1,t.pendingProps=r=i,!Jl(e,a))return t.lanes=e.lanes,Zl(e,t,a);0!=(131072&e.flags)&&(Il=!0)}}return Rl(e,t,n,r,a)}function Dl(e,t,n){var r=t.pendingProps,a=r.children,i=null!==e?e.memoizedState:null;if("hidden"===r.mode){if(0!=(128&t.flags)){if(r=null!==i?i.baseLanes|n:n,null!==e){for(a=t.child=e.child,i=0;null!==a;)i=i|a.lanes|a.childLanes,a=a.sibling;t.childLanes=i&~r}else t.childLanes=0,t.child=null;return $l(e,t,r,n)}if(0==(536870912&n))return t.lanes=t.childLanes=536870912,$l(e,t,null!==i?i.baseLanes|n:n,n);t.memoizedState={baseLanes:0,cachePool:null},null!==e&&Wa(0,null!==i?i.cachePool:null),null!==i?vi(t,i):bi(),cl(t)}else null!==i?(Wa(0,i.cachePool),vi(t,i),dl(),t.memoizedState=null):(null!==e&&Wa(0,null),bi(),dl());return Pl(e,t,a,n),t.child}function $l(e,t,n,r){var a=qa();return a=null===a?null:{parent:Da._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},null!==e&&Wa(0,null),bi(),cl(t),null!==e&&Ea(e,t,r,!0),null}function zl(e,t){var n=t.ref;if(null===n)null!==e&&null!==e.ref&&(t.flags|=4194816);else{if("function"!=typeof n&&"object"!=typeof n)throw Error(a(284));(null===e||e.ref!==n)&&(t.flags|=4194816)}}function Rl(e,t,n,r,a){return Na(t),n=Oi(e,t,n,r,void 0,a),r=Ri(),null===e||Il?(sa&&r&&aa(t),t.flags|=1,Pl(e,t,n,a),t.child):(Fi(e,t,a),Zl(e,t,a))}function Fl(e,t,n,r,a,i){return Na(t),t.updateQueue=null,n=$i(t,r,n,a),Di(e),r=Ri(),null===e||Il?(sa&&r&&aa(t),t.flags|=1,Pl(e,t,n,i),t.child):(Fi(e,t,i),Zl(e,t,i))}function Ml(e,t,n,r,a){if(Na(t),null===t.stateNode){var i=zr,o=n.contextType;"object"==typeof o&&null!==o&&(i=Aa(o)),i=new n(r,i),t.memoizedState=null!==i.state&&void 0!==i.state?i.state:null,i.updater=gl,t.stateNode=i,i._reactInternals=t,(i=t.stateNode).props=r,i.state=t.memoizedState,i.refs={},ii(t),o=n.contextType,i.context="object"==typeof o&&null!==o?Aa(o):zr,i.state=t.memoizedState,"function"==typeof(o=n.getDerivedStateFromProps)&&(ml(t,n,o,r),i.state=t.memoizedState),"function"==typeof n.getDerivedStateFromProps||"function"==typeof i.getSnapshotBeforeUpdate||"function"!=typeof i.UNSAFE_componentWillMount&&"function"!=typeof i.componentWillMount||(o=i.state,"function"==typeof i.componentWillMount&&i.componentWillMount(),"function"==typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount(),o!==i.state&&gl.enqueueReplaceState(i,i.state,null),pi(t,r,i,a),fi(),i.state=t.memoizedState),"function"==typeof i.componentDidMount&&(t.flags|=4194308),r=!0}else if(null===e){i=t.stateNode;var l=t.memoizedProps,s=bl(n,l);i.props=s;var u=i.context,c=n.contextType;o=zr,"object"==typeof c&&null!==c&&(o=Aa(c));var d=n.getDerivedStateFromProps;c="function"==typeof d||"function"==typeof i.getSnapshotBeforeUpdate,l=t.pendingProps!==l,c||"function"!=typeof i.UNSAFE_componentWillReceiveProps&&"function"!=typeof i.componentWillReceiveProps||(l||u!==o)&&vl(t,i,r,o),ai=!1;var f=t.memoizedState;i.state=f,pi(t,r,i,a),fi(),u=t.memoizedState,l||f!==u||ai?("function"==typeof d&&(ml(t,n,d,r),u=t.memoizedState),(s=ai||yl(t,n,s,r,f,u,o))?(c||"function"!=typeof i.UNSAFE_componentWillMount&&"function"!=typeof i.componentWillMount||("function"==typeof i.componentWillMount&&i.componentWillMount(),"function"==typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount()),"function"==typeof i.componentDidMount&&(t.flags|=4194308)):("function"==typeof i.componentDidMount&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=u),i.props=r,i.state=u,i.context=o,r=s):("function"==typeof i.componentDidMount&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,oi(e,t),c=bl(n,o=t.memoizedProps),i.props=c,d=t.pendingProps,f=i.context,u=n.contextType,s=zr,"object"==typeof u&&null!==u&&(s=Aa(u)),(u="function"==typeof(l=n.getDerivedStateFromProps)||"function"==typeof i.getSnapshotBeforeUpdate)||"function"!=typeof i.UNSAFE_componentWillReceiveProps&&"function"!=typeof i.componentWillReceiveProps||(o!==d||f!==s)&&vl(t,i,r,s),ai=!1,f=t.memoizedState,i.state=f,pi(t,r,i,a),fi();var p=t.memoizedState;o!==d||f!==p||ai||null!==e&&null!==e.dependencies&&_a(e.dependencies)?("function"==typeof l&&(ml(t,n,l,r),p=t.memoizedState),(c=ai||yl(t,n,c,r,f,p,s)||null!==e&&null!==e.dependencies&&_a(e.dependencies))?(u||"function"!=typeof i.UNSAFE_componentWillUpdate&&"function"!=typeof i.componentWillUpdate||("function"==typeof i.componentWillUpdate&&i.componentWillUpdate(r,p,s),"function"==typeof i.UNSAFE_componentWillUpdate&&i.UNSAFE_componentWillUpdate(r,p,s)),"function"==typeof i.componentDidUpdate&&(t.flags|=4),"function"==typeof i.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof i.componentDidUpdate||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),"function"!=typeof i.getSnapshotBeforeUpdate||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),i.props=r,i.state=p,i.context=s,r=c):("function"!=typeof i.componentDidUpdate||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),"function"!=typeof i.getSnapshotBeforeUpdate||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return i=r,zl(e,t),r=0!=(128&t.flags),i||r?(i=t.stateNode,n=r&&"function"!=typeof n.getDerivedStateFromError?null:i.render(),t.flags|=1,null!==e&&r?(t.child=il(t,e.child,null,a),t.child=il(t,null,n,a)):Pl(e,t,n,a),t.memoizedState=i.state,e=t.child):e=Zl(e,t,a),e}function Ul(e,t,n,r){return ga(),t.flags|=256,Pl(e,t,n,r),t.child}var Bl={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Hl(e){return{baseLanes:e,cachePool:Ga()}}function Vl(e,t,n){return e=null!==e?e.childLanes&~n:0,t&&(e|=bu),e}function ql(e,t,n){var r,i=t.pendingProps,o=!1,l=0!=(128&t.flags);if((r=l)||(r=(null===e||null!==e.memoizedState)&&0!=(2&pl.current)),r&&(o=!0,t.flags&=-129),r=0!=(32&t.flags),t.flags&=-33,null===e){if(sa){if(o?ul(t):dl(),sa){var s,u=la;if(s=u){e:{for(s=u,u=ca;8!==s.nodeType;){if(!u){u=null;break e}if(null===(s=xd(s.nextSibling))){u=null;break e}}u=s}null!==u?(t.memoizedState={dehydrated:u,treeContext:null!==Jr?{id:ea,overflow:ta}:null,retryLane:536870912,hydrationErrors:null},(s=Fr(18,null,null,0)).stateNode=u,s.return=t,t.child=s,oa=t,la=null,s=!0):s=!1}s||fa(t)}if(null!==(u=t.memoizedState)&&null!==(u=u.dehydrated))return bd(u)?t.lanes=32:t.lanes=536870912,null;fl(t)}return u=i.children,i=i.fallback,o?(dl(),u=Gl({mode:"hidden",children:u},o=t.mode),i=Vr(i,o,n,null),u.return=t,i.return=t,u.sibling=i,t.child=u,(o=t.child).memoizedState=Hl(n),o.childLanes=Vl(e,r,n),t.memoizedState=Bl,i):(ul(t),Wl(t,u))}if(null!==(s=e.memoizedState)&&null!==(u=s.dehydrated)){if(l)256&t.flags?(ul(t),t.flags&=-257,t=Yl(e,t,n)):null!==t.memoizedState?(dl(),t.child=e.child,t.flags|=128,t=null):(dl(),o=i.fallback,u=t.mode,i=Gl({mode:"visible",children:i.children},u),(o=Vr(o,u,n,null)).flags|=2,i.return=t,o.return=t,i.sibling=o,t.child=i,il(t,e.child,null,n),(i=t.child).memoizedState=Hl(n),i.childLanes=Vl(e,r,n),t.memoizedState=Bl,t=o);else if(ul(t),bd(u)){if(r=u.nextSibling&&u.nextSibling.dataset)var c=r.dgst;r=c,(i=Error(a(419))).stack="",i.digest=r,va({value:i,source:null,stack:null}),t=Yl(e,t,n)}else if(Il||Ea(e,t,n,!1),r=0!=(n&e.childLanes),Il||r){if(null!==(r=ou)&&0!==(i=0!=((i=0!=(42&(i=n&-n))?1:Ae(i))&(r.suspendedLanes|n))?0:i)&&i!==s.retryLane)throw s.retryLane=i,Or(e,i),Fu(r,0,i),Al;"$?"===u.data||Ku(),t=Yl(e,t,n)}else"$?"===u.data?(t.flags|=192,t.child=e.child,t=null):(e=s.treeContext,la=xd(u.nextSibling),oa=t,sa=!0,ua=null,ca=!1,null!==e&&(Xr[Zr++]=ea,Xr[Zr++]=ta,Xr[Zr++]=Jr,ea=e.id,ta=e.overflow,Jr=t),(t=Wl(t,i.children)).flags|=4096);return t}return o?(dl(),o=i.fallback,u=t.mode,c=(s=e.child).sibling,(i=Ur(s,{mode:"hidden",children:i.children})).subtreeFlags=65011712&s.subtreeFlags,null!==c?o=Ur(c,o):(o=Vr(o,u,n,null)).flags|=2,o.return=t,i.return=t,i.sibling=o,t.child=i,i=o,o=t.child,null===(u=e.child.memoizedState)?u=Hl(n):(null!==(s=u.cachePool)?(c=Da._currentValue,s=s.parent!==c?{parent:c,pool:c}:s):s=Ga(),u={baseLanes:u.baseLanes|n,cachePool:s}),o.memoizedState=u,o.childLanes=Vl(e,r,n),t.memoizedState=Bl,i):(ul(t),e=(n=e.child).sibling,(n=Ur(n,{mode:"visible",children:i.children})).return=t,n.sibling=null,null!==e&&(null===(r=t.deletions)?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=n,t.memoizedState=null,n)}function Wl(e,t){return(t=Gl({mode:"visible",children:t},e.mode)).return=e,e.child=t}function Gl(e,t){return(e=Fr(22,e,null,t)).lanes=0,e.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},e}function Yl(e,t,n){return il(t,e.child,null,n),(e=Wl(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function Ql(e,t,n){e.lanes|=t;var r=e.alternate;null!==r&&(r.lanes|=t),ja(e.return,t,n)}function Kl(e,t,n,r,a){var i=e.memoizedState;null===i?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:a}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=a)}function Xl(e,t,n){var r=t.pendingProps,a=r.revealOrder,i=r.tail;if(Pl(e,t,r.children,n),0!=(2&(r=pl.current)))r=1&r|2,t.flags|=128;else{if(null!==e&&0!=(128&e.flags))e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&Ql(e,n,t);else if(19===e.tag)Ql(e,n,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}switch(B(pl,r),a){case"forwards":for(n=t.child,a=null;null!==n;)null!==(e=n.alternate)&&null===hl(e)&&(a=n),n=n.sibling;null===(n=a)?(a=t.child,t.child=null):(a=n.sibling,n.sibling=null),Kl(t,!1,a,n,i);break;case"backwards":for(n=null,a=t.child,t.child=null;null!==a;){if(null!==(e=a.alternate)&&null===hl(e)){t.child=a;break}e=a.sibling,a.sibling=n,n=a,a=e}Kl(t,!0,n,null,i);break;case"together":Kl(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Zl(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),gu|=t.lanes,0==(n&t.childLanes)){if(null===e)return null;if(Ea(e,t,n,!1),0==(n&t.childLanes))return null}if(null!==e&&t.child!==e.child)throw Error(a(153));if(null!==t.child){for(n=Ur(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=Ur(e,e.pendingProps)).return=t;n.sibling=null}return t.child}function Jl(e,t){return 0!=(e.lanes&t)||!(null===(e=e.dependencies)||!_a(e))}function es(e,t,n){if(null!==e)if(e.memoizedProps!==t.pendingProps)Il=!0;else{if(!Jl(e,n)&&0==(128&t.flags))return Il=!1,function(e,t,n){switch(t.tag){case 3:G(t,t.stateNode.containerInfo),ka(0,Da,e.memoizedState.cache),ga();break;case 27:case 5:Q(t);break;case 4:G(t,t.stateNode.containerInfo);break;case 10:ka(0,t.type,t.memoizedProps.value);break;case 13:var r=t.memoizedState;if(null!==r)return null!==r.dehydrated?(ul(t),t.flags|=128,null):0!=(n&t.child.childLanes)?ql(e,t,n):(ul(t),null!==(e=Zl(e,t,n))?e.sibling:null);ul(t);break;case 19:var a=0!=(128&e.flags);if((r=0!=(n&t.childLanes))||(Ea(e,t,n,!1),r=0!=(n&t.childLanes)),a){if(r)return Xl(e,t,n);t.flags|=128}if(null!==(a=t.memoizedState)&&(a.rendering=null,a.tail=null,a.lastEffect=null),B(pl,pl.current),r)break;return null;case 22:case 23:return t.lanes=0,Dl(e,t,n);case 24:ka(0,Da,e.memoizedState.cache)}return Zl(e,t,n)}(e,t,n);Il=0!=(131072&e.flags)}else Il=!1,sa&&0!=(1048576&t.flags)&&ra(t,Kr,t.index);switch(t.lanes=0,t.tag){case 16:e:{e=t.pendingProps;var r=t.elementType,i=r._init;if(r=i(r._payload),t.type=r,"function"!=typeof r){if(null!=r){if((i=r.$$typeof)===C){t.tag=11,t=Tl(null,t,r,e,n);break e}if(i===E){t.tag=14,t=Ll(null,t,r,e,n);break e}}throw t=L(r)||r,Error(a(306,t,""))}Mr(r)?(e=bl(r,e),t.tag=1,t=Ml(null,t,r,e,n)):(t.tag=0,t=Rl(null,t,r,e,n))}return t;case 0:return Rl(e,t,t.type,t.pendingProps,n);case 1:return Ml(e,t,r=t.type,i=bl(r,t.pendingProps),n);case 3:e:{if(G(t,t.stateNode.containerInfo),null===e)throw Error(a(387));r=t.pendingProps;var o=t.memoizedState;i=o.element,oi(e,t),pi(t,r,null,n);var l=t.memoizedState;if(r=l.cache,ka(0,Da,r),r!==o.cache&&Sa(t,[Da],n,!0),fi(),r=l.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:l.cache},t.updateQueue.baseState=o,t.memoizedState=o,256&t.flags){t=Ul(e,t,r,n);break e}if(r!==i){va(i=_r(Error(a(424)),t)),t=Ul(e,t,r,n);break e}for(e=9===(e=t.stateNode.containerInfo).nodeType?e.body:"HTML"===e.nodeName?e.ownerDocument.body:e,la=xd(e.firstChild),oa=t,sa=!0,ua=null,ca=!0,n=ol(t,null,r,n),t.child=n;n;)n.flags=-3&n.flags|4096,n=n.sibling}else{if(ga(),r===i){t=Zl(e,t,n);break e}Pl(e,t,r,n)}t=t.child}return t;case 26:return zl(e,t),null===e?(n=Pd(t.type,null,t.pendingProps,null))?t.memoizedState=n:sa||(n=t.type,e=t.pendingProps,(r=od(q.current).createElement(n))[Le]=t,r[Oe]=e,rd(r,n,e),We(r),t.stateNode=r):t.memoizedState=Pd(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Q(t),null===e&&sa&&(r=t.stateNode=Cd(t.type,t.pendingProps,q.current),oa=t,ca=!0,i=la,gd(t.type)?(wd=i,la=xd(r.firstChild)):la=i),Pl(e,t,t.pendingProps.children,n),zl(e,t),null===e&&(t.flags|=4194304),t.child;case 5:return null===e&&sa&&((i=r=la)&&(r=function(e,t,n,r){for(;1===e.nodeType;){var a=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&("INPUT"!==e.nodeName||"hidden"!==e.type))break}else if(r){if(!e[Me])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if("stylesheet"===(i=e.getAttribute("rel"))&&e.hasAttribute("data-precedence"))break;if(i!==a.rel||e.getAttribute("href")!==(null==a.href||""===a.href?null:a.href)||e.getAttribute("crossorigin")!==(null==a.crossOrigin?null:a.crossOrigin)||e.getAttribute("title")!==(null==a.title?null:a.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(((i=e.getAttribute("src"))!==(null==a.src?null:a.src)||e.getAttribute("type")!==(null==a.type?null:a.type)||e.getAttribute("crossorigin")!==(null==a.crossOrigin?null:a.crossOrigin))&&i&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else{if("input"!==t||"hidden"!==e.type)return e;var i=null==a.name?null:""+a.name;if("hidden"===a.type&&e.getAttribute("name")===i)return e}if(null===(e=xd(e.nextSibling)))break}return null}(r,t.type,t.pendingProps,ca),null!==r?(t.stateNode=r,oa=t,la=xd(r.firstChild),ca=!1,i=!0):i=!1),i||fa(t)),Q(t),i=t.type,o=t.pendingProps,l=null!==e?e.memoizedProps:null,r=o.children,ud(i,o)?r=null:null!==l&&ud(i,l)&&(t.flags|=32),null!==t.memoizedState&&(i=Oi(e,t,zi,null,null,n),Xd._currentValue=i),zl(e,t),Pl(e,t,r,n),t.child;case 6:return null===e&&sa&&((e=n=la)&&(n=function(e,t,n){if(""===t)return null;for(;3!==e.nodeType;)if((1!==e.nodeType||"INPUT"!==e.nodeName||"hidden"!==e.type)&&!n||null===(e=xd(e.nextSibling)))return null;return e}(n,t.pendingProps,ca),null!==n?(t.stateNode=n,oa=t,la=null,e=!0):e=!1),e||fa(t)),null;case 13:return ql(e,t,n);case 4:return G(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=il(t,null,r,n):Pl(e,t,r,n),t.child;case 11:return Tl(e,t,t.type,t.pendingProps,n);case 7:return Pl(e,t,t.pendingProps,n),t.child;case 8:case 12:return Pl(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,ka(0,t.type,r.value),Pl(e,t,r.children,n),t.child;case 9:return i=t.type._context,r=t.pendingProps.children,Na(t),r=r(i=Aa(i)),t.flags|=1,Pl(e,t,r,n),t.child;case 14:return Ll(e,t,t.type,t.pendingProps,n);case 15:return Ol(e,t,t.type,t.pendingProps,n);case 19:return Xl(e,t,n);case 31:return r=t.pendingProps,n=t.mode,r={mode:r.mode,children:r.children},null===e?((n=Gl(r,n)).ref=t.ref,t.child=n,n.return=t,t=n):((n=Ur(e.child,r)).ref=t.ref,t.child=n,n.return=t,t=n),t;case 22:return Dl(e,t,n);case 24:return Na(t),r=Aa(Da),null===e?(null===(i=qa())&&(i=ou,o=$a(),i.pooledCache=o,o.refCount++,null!==o&&(i.pooledCacheLanes|=n),i=o),t.memoizedState={parent:r,cache:i},ii(t),ka(0,Da,i)):(0!=(e.lanes&n)&&(oi(e,t),pi(t,null,null,n),fi()),i=e.memoizedState,o=t.memoizedState,i.parent!==r?(i={parent:r,cache:r},t.memoizedState=i,0===t.lanes&&(t.memoizedState=t.updateQueue.baseState=i),ka(0,Da,r)):(r=o.cache,ka(0,Da,r),r!==i.cache&&Sa(t,[Da],n,!0))),Pl(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(a(156,t.tag))}function ts(e){e.flags|=4}function ns(e,t){if("stylesheet"!==t.type||0!=(4&t.state.loading))e.flags&=-16777217;else if(e.flags|=16777216,!Vd(t)){if(null!==(t=ll.current)&&((4194048&su)===su?null!==sl:(62914560&su)!==su&&0==(536870912&su)||t!==sl))throw ti=Xa,Qa;e.flags|=8192}}function rs(e,t){null!==t&&(e.flags|=4),16384&e.flags&&(t=22!==e.tag?je():536870912,e.lanes|=t,xu|=t)}function as(e,t){if(!sa)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;null!==n;)null!==n.alternate&&(r=n),n=n.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function is(e){var t=null!==e.alternate&&e.alternate.child===e.child,n=0,r=0;if(t)for(var a=e.child;null!==a;)n|=a.lanes|a.childLanes,r|=65011712&a.subtreeFlags,r|=65011712&a.flags,a.return=e,a=a.sibling;else for(a=e.child;null!==a;)n|=a.lanes|a.childLanes,r|=a.subtreeFlags,r|=a.flags,a.return=e,a=a.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function os(e,t,n){var r=t.pendingProps;switch(ia(t),t.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:case 1:return is(t),null;case 3:return n=t.stateNode,r=null,null!==e&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Ca(Da),Y(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(null===e||null===e.child)&&(ma(t)?ts(t):null===e||e.memoizedState.isDehydrated&&0==(256&t.flags)||(t.flags|=1024,ya())),is(t),null;case 26:return n=t.memoizedState,null===e?(ts(t),null!==n?(is(t),ns(t,n)):(is(t),t.flags&=-16777217)):n?n!==e.memoizedState?(ts(t),is(t),ns(t,n)):(is(t),t.flags&=-16777217):(e.memoizedProps!==r&&ts(t),is(t),t.flags&=-16777217),null;case 27:K(t),n=q.current;var i=t.type;if(null!==e&&null!=t.stateNode)e.memoizedProps!==r&&ts(t);else{if(!r){if(null===t.stateNode)throw Error(a(166));return is(t),null}e=H.current,ma(t)?pa(t):(e=Cd(i,r,n),t.stateNode=e,ts(t))}return is(t),null;case 5:if(K(t),n=t.type,null!==e&&null!=t.stateNode)e.memoizedProps!==r&&ts(t);else{if(!r){if(null===t.stateNode)throw Error(a(166));return is(t),null}if(e=H.current,ma(t))pa(t);else{switch(i=od(q.current),e){case 1:e=i.createElementNS("http://www.w3.org/2000/svg",n);break;case 2:e=i.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;default:switch(n){case"svg":e=i.createElementNS("http://www.w3.org/2000/svg",n);break;case"math":e=i.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;case"script":(e=i.createElement("div")).innerHTML="${this.selector} is internally inconsistent.`}toHTML(){return`OrientationConstraint with directions [${this.directions.join(", ")}] and selector ${this.selector}`}},Ao=class extends _o{constructor(e,t){super(t),this.direction=e}isInternallyConsistent(){return"horizontal"===this.direction||"vertical"===this.direction}inconsistencyMessage(){return`Align Constraint with direction [${this.direction}] and selector ${this.selector} is internally inconsistent.`}toHTML(){return`AlignConstraint with direction [${this.direction}] and selector ${this.selector}`}},Io=class extends _o{constructor(e,t,n=!1){super(e),this.name=t,this.addEdge=n}toHTML(){return`GroupBySelector with selector ${this.selector} \n and name ${this.name}.`}},Po=class extends _o{constructor(e,t){super(t),this.direction=e}inconsistencyMessage(){return`Cyclic constraint with direction [${this.direction}] with selector ${this.selector} is inconsistent.`}toHTML(){return`Cyclic constraint with direction [${this.direction}] and selector ${this.selector}`}};function To(e,t){if(null!=e&&("number"!=typeof e||Number.isNaN(e)||e<=0))throw new Error(`Size ${t} must be greater than 0`)}function Lo(e,t){To(e.width,`${t} width`),To(e.height,`${t} height`)}var Oo="#000000";function Do(e){return!e||"object"!=typeof e||Array.isArray(e)?{}:e}function $o(e,t){let n={...e};for(let[e,r]of Object.entries(t))(void 0===n[e]||null===n[e])&&(n[e]=r);return n}function zo(e,t){let n=Do(t);switch(e){case"size":return $o(n,{width:100,height:60});case"align":return $o(n,{direction:"horizontal"});case"cyclic":return $o(n,{direction:"clockwise"});case"groupselector":return $o(n,{addEdge:!1});default:return{...n}}}function Ro(e,t){let n=Do(t);switch(e){case"size":return $o(n,{width:100,height:60});case"atomColor":case"edgeColor":return $o(n,{value:Oo});case"inferredEdge":return $o(n,{color:Oo});case"icon":return $o(n,{showLabels:!1});default:return{...n}}}var Fo=c(x());function Mo(e,t){function n(e){return"cyclic"===e?"cyclic":"orientation"===e?"orientation":"align"===e?"align":"groupfield"===e||"groupselector"===e?"group":"size"===e?"size":"hideAtom"===e?"hideAtom":"unknown"}let r=[];if(e.length>0){r.push("constraints:");for(let t of e){t.comment&&r.push(` # ${t.comment}`);let e={[n(t.type)]:zo(t.type,t.params)},a=Eo.dump([e],{flowLevel:2}).trim();r.push(" "+a)}}if(t.length>0){r.length>0&&r.push(""),r.push("directives:");for(let e of t){e.comment&&r.push(` # ${e.comment}`);let t=Ro(e.type,e.params);if("flag"===e.type){let n=t.flag||"";r.push(` - ${e.type}: ${n}`)}else{let n={[e.type]:t},a=Eo.dump([n],{flowLevel:2}).trim();r.push(" "+a)}}}return r.join("\n")+(r.length>0?"\n":"")}var Uo=["orientation","cyclic","group","align","size","hideAtom"],Bo=["atomColor","edgeColor","size","icon","projection","attribute","hideField","inferredEdge","hideAtom","flag","tag"],Ho=["constraints","directives"];function Vo(e){let t,n={isValid:!0,error:null,warnings:[]};if(!e||!e.trim())return n;try{t=Eo.load(e)}catch(e){if(e instanceof Eo.YAMLException){let t=void 0!==e.mark?.line?e.mark.line+1:void 0,r=void 0!==e.mark?.column?e.mark.column+1:void 0,a=t&&r?` (line ${t}, column ${r})`:"";n.isValid=!1,n.error=`YAML syntax error${a}: ${e.reason||e.message}`}else n.isValid=!1,n.error=`Invalid YAML: ${e.message}`;return n}if(t&&"object"==typeof t){let e=Object.keys(t);for(let t of e)Ho.includes(t)||n.warnings.push(`Unrecognized top-level key: "${t}". Expected: ${Ho.join(", ")}`);if(Array.isArray(t.constraints))for(let e=0;ee.cyclic)).map((e=>{if(!e.cyclic.selector)throw new Error("Cyclic constraint must have a selector");return new Po(e.cyclic.direction||"clockwise",e.cyclic.selector)}));n=function(e){let t=new Map,n=[];for(let r of e){let e=`${r.selector.trim()}|${r.direction}`;t.has(e)||(t.set(e,r),n.push(r))}return n}(n);let r={};n.forEach((e=>{let t=e.selector.trim();if(r[t]){if(r[t]!==e.direction)throw new Error(`Inconsistent cyclic constraint for selector ${t}: ${r[t]}, ${e.direction}`)}else r[t]=e.direction}));let a=t.filter((e=>e.orientation)).map((e=>{let t=e.orientation;if(!t.selector)throw new Error("Orientation constraint must have selector field");if(!t.directions)throw new Error("Orientation constraint must have directions field");let n=new No(t.directions,t.selector);if(!n.isInternallyConsistent())throw new Error(n.inconsistencyMessage());return n}));a=function(e){let t=new Map,n=[];for(let r of e){let e=`${r.selector.trim()}|${r.directions.sort().join(",")}`;t.has(e)||(t.set(e,r),n.push(r))}return n}(a);let i=t.filter((e=>e.group)).filter((e=>e.group.field)).map((e=>{if(null==e.group.groupOn)throw new Error("Grouping constraint must have groupOn field");if(null==e.group.field)throw new Error("Grouping constraint must specify a field");if(null==e.group.addToGroup)throw new Error("Grouping constraint must specify addToGroup");return new class{constructor(e,t,n,r){this.field=e,this.groupOn=t,this.addToGroup=n,this.selector=r}toHTML(){let e=this.selector?` with selector
${this.selector}
`:"";return`GroupByField on field
${this.field}
grouping field index
${this.groupOn}
\n adding to group index
${this.addToGroup}
${e}.`}}(e.group.field,e.group.groupOn,e.group.addToGroup,e.group.selector)}));i=function(e){let t=new Map,n=[];for(let r of e){let e=`${r.field}|${r.groupOn}|${r.addToGroup}|${r.selector||""}`;t.has(e)||(t.set(e,r),n.push(r))}return n}(i);let o=t.filter((e=>e.group)).filter((e=>e.group.selector&&e.group.name&&!e.group.field)).map((e=>{if(!e.group.selector)throw new Error("Grouping constraint must have a selector.");if(!e.group.name)throw new Error("Grouping constraint must have a name.");return new Io(e.group.selector,e.group.name,e.group.addEdge)}));o=function(e){let t=new Map,n=[];for(let r of e){let e=`${r.selector.trim()}|${r.name}|${r.addEdge}`;t.has(e)||(t.set(e,r),n.push(r))}return n}(o);let l=t.filter((e=>e.align)).map((e=>{if(!e.align.selector)throw new Error("Align constraint must have a selector");if(!e.align.direction)throw new Error("Align constraint must have a direction");let t=new Ao(e.align.direction,e.align.selector);if(!t.isInternallyConsistent())throw new Error(t.inconsistencyMessage());return t}));return l=function(e){let t=new Map,n=[];for(let r of e){let e=`${r.selector.trim()}|${r.direction}`;t.has(e)||(t.set(e,r),n.push(r))}return n}(l),{orientation:{relative:a,cyclic:n},alignment:l,grouping:{byfield:i,byselector:o}}}(n);a.constraints=e;let t=n;i=t.filter((e=>e.size)).map((e=>(Lo(e.size,"constraint"),{height:e.size.height,width:e.size.width,selector:e.size.selector}))),o=t.filter((e=>e.hideAtom)).map((e=>({selector:e.hideAtom.selector})))}catch(e){let t=e instanceof Error?e.message:String(e);throw new Error(`${t}`)}if(r&&Array.isArray(r))try{let e=function(e){let t=e,n=t.filter((e=>e.icon)).map((e=>({path:e.icon.path,selector:e.icon.selector,showLabels:e.icon.showLabels||!1}))),r=t.filter((e=>e.atomColor)).map((e=>({color:e.atomColor.value,selector:e.atomColor.selector}))),a=t.filter((e=>e.size)).map((e=>(Lo(e.size,"directive"),{height:e.size.height,width:e.size.width,selector:e.size.selector}))),i=t.filter((e=>e.edgeColor)).map((e=>({color:e.edgeColor.value,field:e.edgeColor.field,selector:e.edgeColor.selector,filter:e.edgeColor.filter,style:e.edgeColor.style,weight:e.edgeColor.weight,showLabel:e.edgeColor.showLabel,hidden:e.edgeColor.hidden}))),o=t.filter((e=>e.attribute)).map((e=>({field:e.attribute.field,selector:e.attribute.selector,filter:e.attribute.filter}))),l=t.filter((e=>e.hideField)).map((e=>({field:e.hideField.field,selector:e.hideField.selector,filter:e.hideField.filter}))),s=t.filter((e=>e.projection)).map((e=>({sig:e.projection.sig}))),u=t.filter((e=>e.flag)).map((e=>e.flag)),c=u.includes("hideDisconnected"),d=u.includes("hideDisconnectedBuiltIns"),f=t.filter((e=>e.inferredEdge)).map((e=>({name:e.inferredEdge.name,selector:e.inferredEdge.selector,color:e.inferredEdge.color,style:e.inferredEdge.style,weight:e.inferredEdge.weight}))),p=t.filter((e=>e.hideAtom)).map((e=>({selector:e.hideAtom.selector})));return{atomColors:r,sizes:a,icons:n,edgeColors:i,projections:s,attributes:o,tags:t.filter((e=>e.tag)).map((e=>({toTag:e.tag.toTag,name:e.tag.name,value:e.tag.value}))),hiddenFields:l,inferredEdges:f,hiddenAtoms:p,hideDisconnected:c,hideDisconnectedBuiltIns:d}}(r);a.directives=e,a.directives.sizes=[...i,...e.sizes],a.directives.hiddenAtoms=[...o,...e.hiddenAtoms]}catch(e){let t=e instanceof Error?e.message:String(e);throw new Error(`${t}`)}else a.directives.sizes=i,a.directives.hiddenAtoms=o}(e)}catch(e){return n.isValid=!1,n.error=`Spytial spec error: ${e.message}`,n}return n}var qo=e=>{let[t,n]=(0,ca.useState)(null),r=(0,ca.useCallback)((()=>{let t=Vo(e.yamlValue);n(t.error)}),[e.yamlValue]);return(0,ca.useEffect)((()=>{let t=Vo(e.yamlValue);n(t.error)}),[]),(0,Fo.jsx)("div",{className:"cnd-layout-interface__code-view",role:"region","aria-label":"YAML Code Editor",children:(0,Fo.jsxs)("div",{className:"code-view-card",children:[t&&(0,Fo.jsx)("div",{className:"alert alert-danger py-2 mb-2",role:"alert",children:(0,Fo.jsxs)("small",{children:[(0,Fo.jsx)("strong",{children:"❌ "}),t]})}),(0,Fo.jsx)("textarea",{id:"webcola-cnd",className:"form-control code-view-textarea",value:e.yamlValue,onChange:e.handleTextareaChange,onBlur:r,disabled:e.disabled,rows:16,spellCheck:!1,"aria-label":"CND Layout Specification YAML","aria-invalid":t?"true":"false",placeholder:""})]})})},Wo=c(f()),Go=(e=1e3)=>{let[t,n]=(0,Wo.useState)(!0);return(0,Wo.useEffect)((()=>{let t=setTimeout((()=>{n(!1)}),e);return()=>clearTimeout(t)}),[e]),{isHighlighted:t}},Yo=c(x()),Qo=(e,t,n)=>{let r=n;switch(e){case"cyclic":return(0,Yo.jsx)(Fr,{constraintData:t,onUpdate:n});case"orientation":default:return(0,Yo.jsx)(ra,{constraintData:t,onUpdate:n});case"align":return(0,Yo.jsx)(Pr,{constraintData:t,onUpdate:n});case"groupfield":return(0,Yo.jsx)(Hr,{constraintData:t,onUpdate:n});case"groupselector":return(0,Yo.jsx)(qr,{constraintData:t,onUpdate:n});case"size":return(0,Yo.jsx)(la,{constraintData:t,onUpdate:r});case"hideAtom":return(0,Yo.jsx)(Qr,{constraintData:t,onUpdate:r})}},Ko=e=>{let{isHighlighted:t}=Go(1e3),[n,r]=(0,Sr.useState)(!1),a=e.constraintData.collapsed??!1,i=(0,Sr.useCallback)((()=>{e.onUpdate({collapsed:!a})}),[a,e.onUpdate]),o=(0,Sr.useCallback)((t=>{e.onUpdate({comment:t.target.value})}),[e.onUpdate]),l=(0,Sr.useCallback)((t=>{let n=t.target.value;e.onUpdate({type:n,params:{}})}),[e.onUpdate]),s=[e.className?e.className:"",t?"highlight":"","noCodeCard",a?"noCodeCard--collapsed":""].filter(Boolean).join(" ");return(0,Yo.jsxs)("div",{className:s,...e.dragHandleProps,children:[(0,Yo.jsxs)("div",{className:"cardHeader",children:[(0,Yo.jsx)("button",{className:"collapseButton",title:a?"Expand":"Collapse","aria-label":a?"Expand constraint":"Collapse constraint","aria-expanded":!a,type:"button",onClick:i,children:(0,Yo.jsx)("span",{"aria-hidden":"true",children:a?"▶":"▼"})}),e.dragHandleProps&&(0,Yo.jsx)("span",{className:"dragHandle",title:"Drag to reorder","aria-label":"Drag handle",children:"⋮⋮"}),(0,Yo.jsx)("button",{className:"closeButton",title:"Remove constraint","aria-label":"Remove constraint",type:"button",onClick:e.onRemove,children:(0,Yo.jsx)("span",{"aria-hidden":"true",children:"×"})})]}),(0,Yo.jsxs)("div",{className:"input-group",children:[(0,Yo.jsx)("div",{className:"input-group-prepend",children:(0,Yo.jsx)("span",{className:"input-group-text",title:"Choose constraint type",children:"Constraint"})}),(0,Yo.jsxs)("select",{onChange:l,value:e.constraintData.type,children:[(0,Yo.jsx)("option",{value:"orientation",title:"Specify the relative positioning of elements.",children:"Orientation"}),(0,Yo.jsx)("option",{value:"cyclic",title:"Arrange elements along the perimeter of a circle.",children:"Cyclic"}),(0,Yo.jsx)("option",{value:"align",title:"Ensure elements are aligned horizontally or vertically.",children:"Align"}),(0,Yo.jsx)("option",{value:"groupfield",title:"Group elements based on a field.",children:"Group by field"}),(0,Yo.jsx)("option",{value:"groupselector",title:"Group elements based on a selector.",children:"Group by selector"}),(0,Yo.jsx)("option",{value:"size",title:"Set the width and height of elements matching the selector.",children:"Size"}),(0,Yo.jsx)("option",{value:"hideAtom",title:"Hide elements matching the selector from the visualization.",children:"Hide Atom"})]})]}),!a&&(0,Yo.jsxs)(Yo.Fragment,{children:[(0,Yo.jsx)("div",{className:"params",children:Qo(e.constraintData.type,e.constraintData,e.onUpdate)}),(0,Yo.jsx)("div",{className:"commentSection",children:n||e.constraintData.comment?(0,Yo.jsx)("input",{type:"text",className:"commentInput",placeholder:"Add a note...",value:e.constraintData.comment||"",onChange:o,onFocus:()=>r(!0),onBlur:()=>r(!1)}):(0,Yo.jsx)("button",{type:"button",className:"addCommentButton",onClick:()=>r(!0),children:"+ Add note"})})]}),a&&e.constraintData.comment&&(0,Yo.jsxs)("div",{className:"collapsedComment",title:e.constraintData.comment,children:["💬 ",e.constraintData.comment.length>30?e.constraintData.comment.slice(0,30)+"...":e.constraintData.comment]})]})},Xo=c(f()),Zo=c(x()),Jo=(e,t,n)=>{let r=n;switch(e){case"attribute":return(0,Zo.jsx)(Lr,{directiveData:t,onUpdate:n});case"hideField":return(0,Zo.jsx)(Xr,{directiveData:t,onUpdate:n});case"hideAtom":return(0,Zo.jsx)(Qr,{directiveData:t,onUpdate:r});case"icon":return(0,Zo.jsx)(Jr,{directiveData:t,onUpdate:n});case"atomColor":return(0,Zo.jsx)(Dr,{directiveData:t,onUpdate:n});case"edgeColor":return(0,Zo.jsx)(zr,{directiveData:t,onUpdate:n});case"size":return(0,Zo.jsx)(la,{directiveData:t,onUpdate:r});case"projection":return(0,Zo.jsx)(ia,{directiveData:t,onUpdate:n});case"flag":default:return(0,Zo.jsx)(Ur,{directiveData:t,onUpdate:n});case"inferredEdge":return(0,Zo.jsx)(Gr,{directiveData:t,onUpdate:n});case"tag":return(0,Zo.jsx)(ua,{directiveData:t,onUpdate:n})}},el=e=>{let{isHighlighted:t}=Go(1e3),[n,r]=(0,Xo.useState)(!1),a=e.directiveData.collapsed??!1,i=(0,Xo.useCallback)((()=>{e.onUpdate({collapsed:!a})}),[a,e.onUpdate]),o=(0,Xo.useCallback)((t=>{e.onUpdate({comment:t.target.value})}),[e.onUpdate]),l=(0,Xo.useCallback)((t=>{let n=t.target.value;e.onUpdate({type:n,params:{}})}),[e.onUpdate]),s=[t&&"highlight","noCodeCard",a?"noCodeCard--collapsed":""].filter(Boolean).join(" ");return(0,Zo.jsxs)("div",{className:s,...e.dragHandleProps,children:[(0,Zo.jsxs)("div",{className:"cardHeader",children:[(0,Zo.jsx)("button",{className:"collapseButton",title:a?"Expand":"Collapse","aria-label":a?"Expand directive":"Collapse directive","aria-expanded":!a,type:"button",onClick:i,children:(0,Zo.jsx)("span",{"aria-hidden":"true",children:a?"▶":"▼"})}),e.dragHandleProps&&(0,Zo.jsx)("span",{className:"dragHandle",title:"Drag to reorder","aria-label":"Drag handle",children:"⋮⋮"}),(0,Zo.jsx)("button",{className:"closeButton",title:"Remove directive","aria-label":"Remove directive",type:"button",onClick:e.onRemove,children:(0,Zo.jsx)("span",{"aria-hidden":"true",children:"×"})})]}),(0,Zo.jsxs)("div",{className:"input-group",children:[(0,Zo.jsx)("div",{className:"input-group-prepend",children:(0,Zo.jsx)("span",{className:"input-group-text",children:"Directive"})}),(0,Zo.jsxs)("select",{onChange:l,value:e.directiveData.type,children:[(0,Zo.jsx)("option",{value:"flag",children:"Visibility Flag"}),(0,Zo.jsx)("option",{value:"hideAtom",children:"Hide Atom"}),(0,Zo.jsx)("option",{value:"attribute",children:"Attribute"}),(0,Zo.jsx)("option",{value:"tag",children:"Tag"}),(0,Zo.jsx)("option",{value:"hideField",children:"Hide Field"}),(0,Zo.jsx)("option",{value:"icon",children:"Icon"}),(0,Zo.jsx)("option",{value:"atomColor",children:"Color (Atom)"}),(0,Zo.jsx)("option",{value:"edgeColor",children:"Edge Style"}),(0,Zo.jsx)("option",{value:"size",children:"Size"}),(0,Zo.jsx)("option",{value:"projection",children:"Projection"}),(0,Zo.jsx)("option",{value:"inferredEdge",children:"Inferred Edge"})]})]}),!a&&(0,Zo.jsxs)(Zo.Fragment,{children:[(0,Zo.jsx)("div",{className:"params",children:Jo(e.directiveData.type,e.directiveData,e.onUpdate)}),(0,Zo.jsx)("div",{className:"commentSection",children:n||e.directiveData.comment?(0,Zo.jsx)("input",{type:"text",className:"commentInput",placeholder:"Add a note...",value:e.directiveData.comment||"",onChange:o,onFocus:()=>r(!0),onBlur:()=>r(!1)}):(0,Zo.jsx)("button",{type:"button",className:"addCommentButton",onClick:()=>r(!0),children:"+ Add note"})})]}),a&&e.directiveData.comment&&(0,Zo.jsxs)("div",{className:"collapsedComment",title:e.directiveData.comment,children:["💬 ",e.directiveData.comment.length>30?e.directiveData.comment.slice(0,30)+"...":e.directiveData.comment]})]})},tl=c(x());function nl(){return typeof window<"u"&&window.crypto&&window.crypto.randomUUID?window.crypto.randomUUID():(console.error("Web Crypto API not available, falling back to Math.random for ID generation"),`${Date.now().toString(36)}-${Math.random().toString(36).substring(2,15)}-${Math.random().toString(36).substring(2,15)}`)}function rl(e){let t=[],n=[],r=Eo.load(e),a=r?.constraints,i=r?.directives,o=(e,t)=>{let n=new Map,r=e.split("\n"),a=!1,i="",o=-1;for(let e of r){let r=e.trim();if(r!==`${t}:`){if(a&&/^[a-zA-Z]/.test(r)&&r.endsWith(":")&&!r.startsWith("-"))a=!1;else if(a)if(r.startsWith("#")){let e=r.slice(1).trim();i=i?i+" "+e:e}else r.startsWith("-")&&(o++,i&&(n.set(o,i),i=""))}else a=!0}return n},l=o(e,"constraints"),s=o(e,"directives");if(a){if(!Array.isArray(a))throw new Error("Invalid YAML: 'constraints' should be an array");t=a.map(((e,t)=>{let n=function(e){let t=Object.keys(e)[0],n=e[t];if("cyclic"===t||"orientation"===t||"align"===t||"size"===t||"hideAtom"===t)return t;if("group"===t){if(n.selector)return"groupselector";if(n.field)return"groupfield"}return"unknown"}(e);if("unknown"===n)throw new Error(`Unsupported constraint type in YAML: ${JSON.stringify(e)}`);let r=zo(n,e[Object.keys(e)[0]]);return{id:nl(),type:n,params:r,comment:l.get(t)}}))}if(i){if(!Array.isArray(i))throw new Error("Invalid YAML: 'directives' should be an array");n=i.map(((e,t)=>{let n=Object.keys(e)[0],r=e[n];"string"==typeof r&&(r={flag:r}),(!r||"object"!=typeof r)&&(r={});let a=Ro(n,r);return{id:nl(),type:n,params:a,comment:s.get(t)}}))}return{constraints:t,directives:n}}var al=({yamlValue:e,constraints:t,setConstraints:n,directives:r,setDirectives:a,disabled:i=!1})=>{let[o,l]=(0,jr.useState)(null),[s,u]=(0,jr.useState)(null),c=(0,jr.useCallback)(((e,t)=>{n((n=>n.map((n=>{if(n.id===e){let e=void 0!==t.params?{...n.params,...t.params}:n.params,r={...n,...t,params:e};return{...r,params:zo(r.type,r.params)}}return n}))))}),[n]),d=(0,jr.useCallback)((e=>{n((t=>t.map((t=>({...t,collapsed:e})))))}),[n]),f=(0,jr.useCallback)(((e,t)=>{l(t),e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",t),e.target.classList.add("dragging")}),[]),p=(0,jr.useCallback)((e=>{l(null),e.target.classList.remove("dragging")}),[]),h=(0,jr.useCallback)((e=>{e.preventDefault(),e.dataTransfer.dropEffect="move"}),[]),m=(0,jr.useCallback)(((e,t)=>{e.preventDefault(),o&&o!==t&&n((e=>{let n=e.findIndex((e=>e.id===o)),r=e.findIndex((e=>e.id===t));if(-1===n||-1===r)return e;let a=[...e],[i]=a.splice(n,1);return a.splice(r,0,i),a}))}),[o,n]),g=(0,jr.useCallback)(((e,t)=>{a((n=>n.map((n=>{if(n.id!==e)return n;let r=void 0!==t.params?{...n.params,...t.params}:n.params,a={...n,...t,params:r};return{...a,params:Ro(a.type,a.params)}}))))}),[a]),y=(0,jr.useCallback)((e=>{a((t=>t.map((t=>({...t,collapsed:e})))))}),[a]),v=(0,jr.useCallback)(((e,t)=>{u(t),e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",t),e.target.classList.add("dragging")}),[]),b=(0,jr.useCallback)((e=>{u(null),e.target.classList.remove("dragging")}),[]),x=(0,jr.useCallback)((e=>{e.preventDefault(),e.dataTransfer.dropEffect="move"}),[]),w=(0,jr.useCallback)(((e,t)=>{e.preventDefault(),s&&s!==t&&a((e=>{let n=e.findIndex((e=>e.id===s)),r=e.findIndex((e=>e.id===t));if(-1===n||-1===r)return e;let a=[...e],[i]=a.splice(n,1);return a.splice(r,0,i),a}))}),[s,a]);return(0,jr.useEffect)((()=>{if(console.log(e),e)try{(e=>{let{constraints:t,directives:r}=rl(e);n((e=>t)),a((e=>r))})(e)}catch(e){console.error("Failed to load YAML into Structured Builder:",e)}}),[e]),(0,tl.jsxs)("section",{id:"noCodeViewContainer","aria-label":"Structured Builder Container",children:[(0,tl.jsxs)("div",{children:[(0,tl.jsxs)("div",{className:"sectionHeader",children:[(0,tl.jsxs)("h5",{children:["Constraints ",(0,tl.jsx)("button",{type:"button",onClick:()=>{let e={id:nl(),type:"orientation",params:{}};n((t=>[e,...t]))},title:"Click to add a new constraint","aria-label":"Click to add a new constraint",disabled:i,children:"+"})]}),t.length>0&&(0,tl.jsxs)("div",{className:"collapseAllButtons",children:[(0,tl.jsx)("button",{type:"button",className:"collapseAllButton",onClick:()=>d(!0),title:"Collapse all constraints",children:"Collapse All"}),(0,tl.jsx)("button",{type:"button",className:"collapseAllButton",onClick:()=>d(!1),title:"Expand all constraints",children:"Expand All"})]})]}),(0,tl.jsx)("section",{className:"cardContainer",id:"constraintContainer","aria-label":"Constraints List",children:t.map((e=>(0,tl.jsx)(Ko,{constraintData:e,onUpdate:t=>c(e.id,t),onRemove:()=>{n((t=>t.filter((t=>t.id!==e.id))))},dragHandleProps:{draggable:!0,onDragStart:t=>f(t,e.id),onDragEnd:p,onDragOver:h,onDrop:t=>m(t,e.id)}},e.id)))})]}),(0,tl.jsx)("hr",{}),(0,tl.jsxs)("div",{children:[(0,tl.jsxs)("div",{className:"sectionHeader",children:[(0,tl.jsxs)("h5",{children:["Directives ",(0,tl.jsx)("button",{type:"button",onClick:()=>{let e={id:nl(),type:"flag",params:{}};a((t=>[e,...t]))},title:"Click to add a new directive","aria-label":"Click to add a new directive",disabled:i,children:"+"})]}),r.length>0&&(0,tl.jsxs)("div",{className:"collapseAllButtons",children:[(0,tl.jsx)("button",{type:"button",className:"collapseAllButton",onClick:()=>y(!0),title:"Collapse all directives",children:"Collapse All"}),(0,tl.jsx)("button",{type:"button",className:"collapseAllButton",onClick:()=>y(!1),title:"Expand all directives",children:"Expand All"})]})]}),(0,tl.jsx)("section",{className:"cardContainer",id:"directiveContainer","aria-label":"Directives List",children:r.map((e=>(0,tl.jsx)(el,{directiveData:e,onUpdate:t=>g(e.id,t),onRemove:()=>{a((t=>t.filter((t=>t.id!==e.id))))},dragHandleProps:{draggable:!0,onDragStart:t=>v(t,e.id),onDragEnd:b,onDragOver:x,onDrop:t=>w(t,e.id)}},e.id)))})]})]})},il=c(x()),ol=({yamlValue:e,onChange:t,isNoCodeView:n,onViewChange:r,constraints:a,setConstraints:i,directives:o,setDirectives:l,className:s="",disabled:u=!1,"aria-label":c="CND Layout Specification Interface"})=>{let[d,f]=(0,Cr.useState)(null),[p,h]=(0,Cr.useState)(null),m=(0,Cr.useRef)(!1),g=(0,Cr.useRef)(""),y=(0,Cr.useCallback)((()=>({yaml:n?Mo(a,o):e,constraints:JSON.parse(JSON.stringify(a)),directives:JSON.parse(JSON.stringify(o))})),[n,e,a,o]),v=((0,Cr.useCallback)((()=>{if(m.current)return;let e=y(),t=JSON.stringify(e);t!==g.current&&(f({yaml:g.current?JSON.parse(g.current).yaml:"",constraints:g.current?JSON.parse(g.current).constraints:[],directives:g.current?JSON.parse(g.current).directives:[]}),h(null),g.current=t)}),[y]),(0,Cr.useRef)(null));(0,Cr.useEffect)((()=>m.current?(m.current=!1,void(g.current=JSON.stringify(y()))):(v.current&&clearTimeout(v.current),v.current=setTimeout((()=>{let e=y(),t=JSON.stringify(e);if(g.current&&t!==g.current){let e=JSON.parse(g.current);f(e),h(null)}g.current=t}),500),()=>{v.current&&clearTimeout(v.current)})),[e,a,o,y]),(0,Cr.useEffect)((()=>{g.current||(g.current=JSON.stringify(y()))}),[]);let b=(0,Cr.useCallback)((()=>{!d||u||(m.current=!0,h(y()),t(d.yaml),i((()=>d.constraints)),l((()=>d.directives)),f(null))}),[d,u,y,t,i,l]),x=(0,Cr.useCallback)((()=>{!p||u||(m.current=!0,f(y()),t(p.yaml),i((()=>p.constraints)),l((()=>p.directives)),h(null))}),[p,u,y,t,i,l]),w=(0,Cr.useCallback)((n=>{if(!u){if(n.target.checked)try{let t=rl(e);i((()=>t.constraints)),l((()=>t.directives))}catch(e){console.warn("Failed to parse YAML when switching to Structured Builder:",e)}else{let e=Mo(a,o);t(e)}r(n.target.checked)}}),[u,r,t,a,o,e,i,l]),k=(0,Cr.useCallback)((e=>{u||t(e.target.value)}),[u,t]),C=["cnd-layout-interface","container-fluid",u&&"cnd-layout-interface--disabled",s].filter(Boolean).join(" "),j=["cnd-layout-interface__toggle-label","small",!n&&"text-primary fw-semibold"].filter(Boolean).join(" "),S=["cnd-layout-interface__toggle-label","small",n&&"text-primary fw-semibold"].filter(Boolean).join(" ");return(0,il.jsxs)("section",{id:"cnd-layout-interface-container",className:C,"aria-label":c,children:[(0,il.jsxs)("div",{className:"d-flex justify-content-between align-items-center mb-3 pb-2 border-bottom",children:[(0,il.jsxs)("div",{className:"d-flex align-items-center gap-3",children:[(0,il.jsx)("span",{className:j,children:"Code View"}),(0,il.jsxs)("label",{className:"cnd-layout-interface__toggle",htmlFor:"cnd-layout-toggle",children:[(0,il.jsx)("input",{id:"cnd-layout-toggle",type:"checkbox",checked:n,onChange:w,disabled:u,className:"cnd-layout-interface__toggle-input","aria-describedby":"cnd-layout-toggle-description",role:"switch"}),(0,il.jsx)("span",{className:"cnd-layout-interface__toggle-slider"})]}),(0,il.jsx)("span",{className:S,children:"Structured Builder"})]}),(0,il.jsxs)("div",{className:"d-flex align-items-center gap-2",children:[(0,il.jsx)("button",{type:"button",className:"cnd-layout-interface__undo-btn",onClick:b,disabled:u||!d,"aria-label":"Undo last change",title:"Undo",children:"↶"}),(0,il.jsx)("button",{type:"button",className:"cnd-layout-interface__redo-btn",onClick:x,disabled:u||!p,"aria-label":"Redo last change",title:"Redo",children:"↷"})]})]}),(0,il.jsx)("div",{id:"cnd-layout-toggle-description",className:"visually-hidden",children:"Toggle between Code View (text editor) and Structured Builder (low-code visual editor) for CND layout specification"}),(0,il.jsx)("div",{className:"cnd-layout-interface__content",children:n?(0,il.jsx)(al,{yamlValue:e,constraints:a,setConstraints:i,directives:o,setDirectives:l}):(0,il.jsx)(qo,{constraints:a,directives:o,yamlValue:e,handleTextareaChange:k,disabled:u})})]})},ll=c(f()),sl=c(x());function ul(e,t){let n=e.getAtoms(),r=new Set(n.map((e=>e.id))),a=1,i=`${t}-${a}`;for(;r.has(i);)a++,i=`${t}-${a}`;return i}var cl=({instance:e,onChange:t,disabled:n=!1,className:r=""})=>{let[a,i]=(0,ll.useState)({id:"",label:"",type:"Entity"}),o=ul(e,a.type.trim()||"Entity"),[l,s]=(0,ll.useState)({name:"",atomIds:["",""]}),[u,c]=(0,ll.useState)(""),d=e.getAtoms(),f=e.getRelations(),p=(0,ll.useCallback)((()=>{t&&t(e)}),[e,t]),h=(0,ll.useCallback)((t=>{if(t.preventDefault(),!a.label.trim())return void c("Atom label is required");let n=a.type.trim()||"Entity",r=a.id.trim()||ul(e,n);if(r)if(e.getAtoms().some((e=>e.id===r)))c("Atom ID already exists");else try{let t={id:r,label:a.label.trim(),type:n};e.addAtom(t),i({id:"",label:"",type:"Entity"}),c(""),p()}catch(e){c(e instanceof Error?e.message:"Failed to add atom")}else c("Atom ID could not be generated")}),[a,e,p]),m=(0,ll.useCallback)((t=>{try{e.removeAtom(t),c(""),p()}catch(e){c(e instanceof Error?e.message:"Failed to remove atom")}}),[e,p]),g=(0,ll.useCallback)((()=>{s((e=>({...e,atomIds:[...e.atomIds,""]})))}),[]),y=(0,ll.useCallback)((()=>{s((e=>({...e,atomIds:e.atomIds.length>2?e.atomIds.slice(0,-1):e.atomIds})))}),[]),v=(0,ll.useCallback)(((e,t)=>{s((n=>({...n,atomIds:n.atomIds.map(((n,r)=>r===e?t:n))})))}),[]),b=(0,ll.useCallback)((t=>{if(t.preventDefault(),!l.name.trim())return void c("Relation name is required");let n=l.atomIds.map((e=>e.trim())).filter((e=>""!==e));if(n.length<2)c("At least 2 atoms are required for a relation");else if(n.length===l.atomIds.length)try{let t={atoms:n,types:n.map((()=>"unknown"))};e.addRelationTuple(l.name.trim(),t),s({name:"",atomIds:["",""]}),c(""),p()}catch(e){c(e instanceof Error?e.message:"Failed to add relation")}else c("All atom positions must be selected")}),[l,e,p]),x=(0,ll.useCallback)(((t,n)=>{try{e.removeRelationTuple(t,n),c(""),p()}catch(e){c(e instanceof Error?e.message:"Failed to remove relation")}}),[e,p]),w=(0,ll.useCallback)((()=>{try{e.getAtoms().map((e=>e.id)).forEach((t=>e.removeAtom(t))),e.getRelations().map((e=>e.id)).forEach((t=>{let n=e.getRelations().find((e=>e.id===t));n&&n.tuples.forEach((n=>e.removeRelationTuple(t,n)))})),c(""),p()}catch(e){c(e instanceof Error?e.message:"Failed to clear instance")}}),[e,p]),[k,C]=(0,ll.useState)(null),j=(0,ll.useCallback)((()=>{if(console.log("Instance in handleReify:",e),console.log("typeof instance.reify:",typeof e.reify),"function"==typeof e.reify)try{let t=e.reify();C(t)}catch(e){C("Re-ify failed: "+(e instanceof Error?e.message:String(e)))}else C("Re-ify not supported on this instance.")}),[e]),S=(0,ll.useCallback)((e=>2===e.atoms.length?`${e.atoms[0]} → ${e.atoms[1]}`:`(${e.atoms.join(", ")})`),[]);return(0,sl.jsxs)("div",{className:`instance-builder ${r}`,children:[(0,sl.jsxs)("div",{className:"instance-builder__header",children:[(0,sl.jsx)("h2",{children:"Instance Builder"}),(0,sl.jsxs)("div",{className:"instance-builder__stats",children:[(0,sl.jsxs)("span",{children:[d.length," atoms"]}),(0,sl.jsxs)("span",{children:[f.reduce(((e,t)=>e+t.tuples.length),0)," relations"]})]})]}),u&&(0,sl.jsxs)("div",{className:"instance-builder__error",children:[u,(0,sl.jsx)("button",{type:"button",onClick:()=>c(""),"aria-label":"Clear error",children:"×"})]}),(0,sl.jsxs)("div",{className:"instance-builder__content",children:[(0,sl.jsxs)("section",{className:"instance-builder__section",children:[(0,sl.jsx)("h3",{children:"Atoms"}),(0,sl.jsxs)("form",{onSubmit:h,className:"instance-builder__form",children:[(0,sl.jsxs)("div",{className:"form-row",children:[(0,sl.jsx)("input",{type:"text",placeholder:`ID (suggested: ${o})`,value:a.id,onChange:e=>i((t=>({...t,id:e.target.value}))),disabled:n,"aria-label":"Atom ID"}),(0,sl.jsx)("input",{type:"text",placeholder:"Label",value:a.label,onChange:e=>i((t=>({...t,label:e.target.value}))),disabled:n,required:!0}),(0,sl.jsx)("input",{type:"text",placeholder:"Type",value:a.type,onChange:e=>i((t=>({...t,type:e.target.value}))),disabled:n}),(0,sl.jsx)("button",{type:"submit",disabled:n,children:"Add Atom"})]}),""===a.id&&(0,sl.jsxs)("div",{style:{fontSize:"0.85em",color:"#888",marginTop:2},children:["Suggested ID: ",(0,sl.jsx)("code",{children:o})]})]}),(0,sl.jsx)("div",{className:"instance-builder__list",children:0===d.length?(0,sl.jsx)("p",{className:"empty-state",children:"No atoms yet. Add one above."}):d.map((e=>(0,sl.jsxs)("div",{className:"list-item",children:[(0,sl.jsxs)("div",{className:"item-info",children:[(0,sl.jsx)("strong",{children:e.id}),(0,sl.jsx)("span",{className:"item-label",children:e.label}),(0,sl.jsx)("span",{className:"item-type",children:e.type})]}),(0,sl.jsx)("button",{type:"button",onClick:()=>m(e.id),disabled:n,className:"remove-button","aria-label":`Remove atom ${e.id}`,children:"Remove"})]},e.id)))})]}),(0,sl.jsxs)("section",{className:"instance-builder__section",children:[(0,sl.jsx)("h3",{children:"Relations (N-ary Support)"}),(0,sl.jsxs)("form",{onSubmit:b,className:"instance-builder__form",children:[(0,sl.jsx)("div",{className:"form-row",children:(0,sl.jsx)("input",{type:"text",placeholder:"Relation Name",value:l.name,onChange:e=>s((t=>({...t,name:e.target.value}))),disabled:n,required:!0})}),(0,sl.jsxs)("div",{className:"relation-atoms",children:[(0,sl.jsxs)("div",{style:{fontSize:"0.9em",color:"#666",marginBottom:8},children:["Atoms (arity: ",l.atomIds.length,"):"]}),l.atomIds.map(((e,t)=>(0,sl.jsxs)("div",{className:"atom-selector",children:[(0,sl.jsxs)("label",{style:{fontSize:"0.85em",color:"#666"},children:["Position ",t+1,":"]}),(0,sl.jsxs)("select",{value:e,onChange:e=>v(t,e.target.value),disabled:n,required:!0,children:[(0,sl.jsx)("option",{value:"",children:"Select Atom"}),d.map((e=>(0,sl.jsxs)("option",{value:e.id,children:[e.id," (",e.label,")"]},e.id)))]})]},t))),(0,sl.jsxs)("div",{className:"arity-controls",style:{marginTop:8},children:[(0,sl.jsx)("button",{type:"button",onClick:g,disabled:n,style:{marginRight:8},children:"+ Add Position"}),l.atomIds.length>2&&(0,sl.jsx)("button",{type:"button",onClick:y,disabled:n,children:"- Remove Position"})]})]}),(0,sl.jsx)("div",{className:"form-row",style:{marginTop:12},children:(0,sl.jsx)("button",{type:"submit",disabled:n||l.atomIds.some((e=>!e.trim())),children:"Add Relation"})})]}),(0,sl.jsx)("div",{className:"instance-builder__list",children:0===f.length?(0,sl.jsx)("p",{className:"empty-state",children:"No relations yet. Add one above."}):f.map((e=>(0,sl.jsxs)("div",{className:"relation-group",children:[(0,sl.jsx)("h4",{children:e.name}),e.tuples.map(((t,r)=>(0,sl.jsxs)("div",{className:"list-item",children:[(0,sl.jsxs)("div",{className:"item-info",children:[(0,sl.jsx)("span",{children:S(t)}),(0,sl.jsxs)("span",{className:"item-type",style:{fontSize:"0.8em",color:"#666"},children:["arity: ",t.atoms.length]})]}),(0,sl.jsx)("button",{type:"button",onClick:()=>x(e.id,t),disabled:n,className:"remove-button","aria-label":`Remove relation ${e.name} tuple`,children:"Remove"})]},r)))]},e.id)))})]}),(0,sl.jsxs)("section",{className:"instance-builder__actions",children:[(0,sl.jsx)("button",{type:"button",onClick:w,disabled:n,className:"clear-button",children:"Clear All"}),(0,sl.jsx)("button",{type:"button",onClick:j,disabled:n,className:"reify-button",style:{marginLeft:8},children:"Re-ify"})]}),null!==k&&(0,sl.jsxs)("section",{className:"instance-builder__reify-result",style:{marginTop:12,background:"#f8f8f8",border:"1px solid #eee",borderRadius:4,padding:10},children:[(0,sl.jsx)("strong",{children:"Re-ify Result:"}),(0,sl.jsx)("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-all",margin:0},children:"string"==typeof k?k:JSON.stringify(k,null,2)})]})]})]})};function dl(e){return e.tuples}function fl(e){return e.atoms}function pl(e){return void 0!==e.meta&&!0===e.meta.builtin}function hl(e,t,n){return"string"==typeof t&&(t=bl(e,t)),"string"!=typeof n&&(n=n.id),t.types.includes(n)}function ml(e,t){let n=gl(e).find((e=>e.id===t));if(!n)throw new Error(`Could not find atom with id ${t}`);return n}function gl(e){return xl(e).map(fl).reduce(((e,t)=>e.concat(t)),[])}function yl(e){return Object.values(e.relations)}function vl(e,t){let n=[];for(let r of Object.values(e.skolems))for(let e of r.tuples)if(e.atoms.includes(t)){n.push(r.name);break}return n}function bl(e,t){let n=e.types[t];if(!n)throw new Error(`Could not find type with id ${t}`);return n}function xl(e){return Object.values(e.types)}function wl(e,t){if("string"==typeof t&&(t=ml(e,t)),!e.types[t.type])throw new Error(`The atom's type is not part of the instance: ${t.type}`);return e.types[t.type]}function kl(e,t){let n={},r=Object.keys(t);for(let t in e.types){let a=e.types[t],i=r.some((t=>hl(e,a,t)));n[t]={_:"type",id:a.id,types:a.types,atoms:i?[]:a.atoms,meta:a.meta}}return n}function Cl(e,t){let n={},r=Object.keys(t),a=Object.values(t);for(let t in e.relations){let i=e.relations[t],o=i.types.some((t=>r.some((n=>hl(e,t,n))))),l=o?jl(e,i.types,r):[];n[t]={_:"relation",id:i.id,name:i.name,types:o?El(i.types,l):i.types,tuples:o?Sl(i.tuples,l,a):i.tuples},o||(n[t]=i)}return n}function jl(e,t,n){let r=[];return t.forEach(((t,a)=>{n.some((n=>hl(e,t,n)))&&r.push(a)})),r}function Sl(e,t,n){return e.filter((e=>e.atoms.some((e=>n.includes(e))))).map((e=>({_:"tuple",types:El(e.types,t),atoms:El(e.atoms,t)}))).filter((e=>e.atoms.length>1))}function El(e,t){let n=[];for(let r=0;r")}`}var Al=c(br());var Il=class e{constructor(e){this.alloyInstance=e,this.eventListeners=new Map}addEventListener(e,t){this.eventListeners.has(e)||this.eventListeners.set(e,new Set),this.eventListeners.get(e).add(t)}removeEventListener(e,t){let n=this.eventListeners.get(e);n&&n.delete(t)}emitEvent(e){let t=this.eventListeners.get(e.type);t&&t.forEach((t=>{try{t(e)}catch(e){console.error("Error in data instance event listener:",e)}}))}getAtomType(e){let t=wl(this.alloyInstance,e);return{id:t.id,types:t.types,atoms:t.atoms.map((e=>{let t=vl(this.alloyInstance,e.id);return{id:e.id,label:e.id,type:e.type,labels:t.length>0?{skolems:t}:void 0}})),isBuiltin:pl(t)}}getTypes(){return xl(this.alloyInstance).map((e=>({id:e.id,types:e.types,atoms:e.atoms.map((e=>{let t=vl(this.alloyInstance,e.id);return{id:e.id,type:e.type,label:e.id,labels:t.length>0?{skolems:t}:void 0}})),isBuiltin:pl(e)})))}getAtoms(){return gl(this.alloyInstance).map((e=>{let t=vl(this.alloyInstance,e.id);return{id:e.id,type:e.type,label:e.id,labels:t.length>0?{skolems:t}:void 0}}))}getRelations(){return yl(this.alloyInstance).map((e=>({id:e.id,name:e.name,types:e.types,tuples:e.tuples.map((e=>({atoms:e.atoms,types:e.types})))})))}applyProjections(t){let n=function(e,t){let n={};return t.forEach((t=>{let r=function(e){return e.types[e.types.length-1]}(wl(e,t));if(n[r])throw new Error(`Cannot project ${t} and ${n[r]}. Both are of type ${r}`);n[r]=t})),{types:kl(e,n),relations:Cl(e,n),skolems:e.skolems}}(this.alloyInstance,t);return new e(n)}generateGraph(e,t){return function(e,t,n){let r=new Al.Graph({directed:!0,multigraph:!0}),{nodeIds:a,edgeIds:i}=function(e,t,n){let r=new Set,a=new Set;return yl(e).forEach((t=>{dl(t).forEach((n=>{let i=n.atoms.map((t=>ml(e,t))),[o,l]=function(e,t){return[t[0],t[t.length-1]]}(0,i);o&&l&&(r.add(_l(o)),r.add(_l(l)),a.add(Nl(t,n)))}))})),gl(e).forEach((a=>{let i=_l(a);r.has(i)||t||(!function(e,t){return"string"==typeof t&&(t=ml(e,t)),wl(e,t).types.map((t=>bl(e,t))).some(pl)}(e,a)||!n)&&r.add(i)})),{nodeIds:r,edgeIds:a}}(e,t,n);return gl(e).forEach((e=>{let t=_l(e);a.has(t)&&r.setNode(t,t)})),yl(e).forEach((t=>{dl(t).forEach((n=>{let a=Nl(t,n),o=n.atoms,[l,s]=function(e,t){return t<2?[0,0]:[0,t-1]}(t.id,o.length),u=l?o[l]:o[0],c=s?o[s]:o[o.length-1];if(u&&c&&i.has(a)){let n=o.slice(1,-1).join(","),i=n.length>0?`[${n}]`:"",l=t.name+i,s=_l(ml(e,u)),d=_l(ml(e,c));r.setEdge(s,d,l,a)}}))})),r}(this.alloyInstance,e,t)}getAlloyInstance(){return this.alloyInstance}reify(){let e="",t=this.alloyInstance.types,n={};for(let e in t){let r=t[e].atoms;n[e]=r.map((e=>`\`${e.id}`))}let r=this.alloyInstance.relations,a={};for(let e in r){let t=r[e],n=t.tuples.map((e=>`(${e.atoms.map((e=>`\`${e}`)).join("->")})`));a[t.name]=n}for(let t in n){let r=n[t];r.length>0&&(e+=`${t} = ${r.join("+")}\n`)}for(let t in a){let n=a[t];n.length>0?e+=`${t} = ${n.join("+")}\n`:e+=`no ${t}\n`}return`inst builtinstance {\n${e}\n}`}removeAtom(e){this.alloyInstance=function(e,t){let n=ml(e,t),r={...e.types},a={...e.relations},i={...e.skolems},o=r[n.type];if(o)return o.atoms=o.atoms.filter((e=>e.id!==t)),0===o.atoms.length&&delete r[o.id],Object.values(a).forEach((e=>{e.tuples=e.tuples.filter((e=>!e.atoms.includes(t)))})),Object.values(i).forEach((e=>{e.tuples=e.tuples.filter((e=>!e.atoms.includes(t)))})),{types:r,relations:a,skolems:i};throw new Error(`Could not find type for atom ${t}`)}(this.alloyInstance,e),this.emitEvent({type:"atomRemoved",data:{atomId:e}})}addAtom(e){let t={_:"atom",id:e.id,type:e.type};this.alloyInstance=function(e,t){let n={...e.types},r=n[t.type];if(r)r.atoms.push(t);else{let e={_:"type",id:t.type,types:[t.type,"univ"],atoms:[t]};n[e.id]=e}return{...e,types:n}}(this.alloyInstance,t),this.emitEvent({type:"atomAdded",data:{atom:e}})}addRelationTuple(e,t){let n={_:"tuple",atoms:t.atoms,types:t.types};this.alloyInstance=function(e,t,n){let r=e.relations[t],a={...e.relations},i={...e.skolems};return r?(r.tuples.push(n),a[r.id]=r):(r={id:t,name:t,tuples:[n],types:n.types,_:"relation"},a[t]=r),{...e,relations:a,skolems:i}}(this.alloyInstance,e,n),this.emitEvent({type:"relationTupleAdded",data:{relationId:e,tuple:t}})}removeRelationTuple(e,t){let n={_:"tuple",atoms:t.atoms,types:t.types};this.alloyInstance=function(e,t,n){let r=function(e,t){let n=e.relations[t];if(!n)throw new Error(`Could not find relation ${t}`);return n}(e,t),a={...e.relations},i={...e.skolems};return r.tuples=r.tuples.filter((e=>e!==n)),0===r.tuples.length?delete a[r.id]:a[r.id]=r,Object.values(i).forEach((e=>{e.tuples=e.tuples.filter((e=>e!==n)),0===e.tuples.length?delete i[e.id]:i[e.id]=e})),{...e,relations:a,skolems:i}}(this.alloyInstance,e,n),this.emitEvent({type:"relationTupleRemoved",data:{relationId:e,tuple:t}})}addFromDataInstance(e,t){if(!function(e){return e instanceof Il}(e))return!1;let n=e.getAlloyInstance(),r=new Map;return gl(n).forEach((e=>{let n=this.getAtomType(e.id).isBuiltin;if(t&&n){let t=this.getAtoms().find((t=>t.type===e.type&&t.label===e.id));if(t)return void r.set(e.id,t.id)}let a=`atom_${this.getAtoms().length+1}`;r.set(e.id,a),this.addAtom({id:a,type:e.type,label:e.id})})),yl(n).forEach((e=>{e.tuples.forEach((t=>{let n={atoms:t.atoms.map((e=>r.get(e)||e)),types:t.types};this.addRelationTuple(e.id,n)}))})),xl(n).forEach((e=>{this.getTypes().find((t=>t.id===e.id))||(this.alloyInstance.types[e.id]={_:"type",id:e.id,types:e.types,atoms:e.atoms.map((e=>({_:"atom",id:r.get(e.id)||e.id,type:e.type}))),meta:{builtin:!1,abstract:!1,enum:!1,one:!1,private:!1}})})),!0}},Pl=c(f()),Tl=c(x()),Ll=({systemError:e})=>{let[t,n]=(0,Pl.useState)({ids:[],source:null}),r=(e,t)=>{n({ids:[e.id,...e.relatedIds],source:t})},a=()=>n({ids:[],source:null}),i=e=>t.ids.includes(e)?"source"===t.source?"highlight-source":"highlight-diagram":"",o=e&&("parse-error"===e.type||"general-error"===e.type||"group-overlap-error"===e.type),l=e&&"positional-error"===e.type&&e.messages;if(!o&&!l)return console.error("Cannot display the following error:",e),null;let s=(0,Pl.useMemo)((()=>{let t=e.type;return"parse-error"===t?"Parse Error "+(e.source?`(${e.source})`:""):"group-overlap-error"===t?"Group Overlap Error "+(e.source?`(${e.source})`:""):"Error"}),[e]),u=(0,Pl.useMemo)((()=>{let t=l?e.messages:void 0;if(!t)return{sourceConstraints:[],diagramConstraints:[]};let n=function(e){let t=new Map;return e.minimalConflictingConstraints.forEach(((e,n)=>{t.has(n)||t.set(n,new Set),e.forEach((e=>t.get(n).add(e)))})),t.has(e.conflictingSourceConstraint)?t.get(e.conflictingSourceConstraint).add(e.conflictingConstraint):t.set(e.conflictingSourceConstraint,new Set([e.conflictingConstraint])),t}(t),r=[],a=[],i=new Map;return[...n.values()].forEach(((e,t)=>{[...e.values()].map(((e,n)=>{let r=`diagram-${t}-${n}`;i.set(e,r),a.push({id:r,content:e,relatedIds:[]})}))})),[...n.entries()].forEach((([e,t],n)=>{let o=`source-${n}`,l=[...t.values()].map((e=>i.get(e)));r.push({id:o,content:e,relatedIds:l}),l.forEach((e=>{let t=a.find((t=>t.id===e));t&&t.relatedIds.push(o)}))})),{sourceConstraints:r,diagramConstraints:a}}),[e]),{sourceConstraints:c,diagramConstraints:d}=u;return(0,Tl.jsxs)("div",{id:"error-message-modal",className:"mt-3 d-flex flex-column overflow-x-auto p-3 rounded border border-danger border-2",children:[(0,Tl.jsx)("h4",{style:{color:"var(--bs-danger)"},children:"Could not satisfy all constraints"}),(0,Tl.jsx)("p",{children:"Your data causes the following visualization constraints to conflict."}),o&&(0,Tl.jsx)(Tl.Fragment,{children:(0,Tl.jsxs)("div",{className:"card error-card",children:[(0,Tl.jsx)("div",{className:"card-header bg-light",children:(0,Tl.jsx)("strong",{children:s})}),(0,Tl.jsx)("div",{className:"card-body",children:(0,Tl.jsx)("code",{dangerouslySetInnerHTML:{__html:e.message}})})]})}),l&&(0,Tl.jsxs)(Tl.Fragment,{children:[(0,Tl.jsx)("p",{id:"hover-instructions",children:"Hover over the conflicting constraints to see the corresponding diagram elements that cannot be visualized. "}),(0,Tl.jsx)("div",{className:"constraint-relationship-table",children:(0,Tl.jsxs)("table",{className:"table table-bordered",children:[(0,Tl.jsx)("thead",{children:(0,Tl.jsxs)("tr",{children:[(0,Tl.jsx)("th",{children:"Source Constraints"}),(0,Tl.jsx)("th",{children:"Diagram Elements"})]})}),(0,Tl.jsx)("tbody",{children:(0,Tl.jsxs)("tr",{children:[(0,Tl.jsx)("td",{className:"source-constraints-cell p-0",children:c.map((e=>(0,Tl.jsx)("div",{"data-constraint-id":e.id,className:`constraint-item ${i(e.id)}`,onMouseEnter:()=>r(e,"source"),onMouseLeave:a,children:(0,Tl.jsx)("code",{dangerouslySetInnerHTML:{__html:e.content}})},e.id)))}),(0,Tl.jsx)("td",{className:"diagram-constraints-cell p-0",children:(0,Tl.jsx)("div",{className:"d-flex flex-column h-100",children:d.map((e=>(0,Tl.jsx)("div",{"data-constraint-id":e.id,className:`constraint-item ${i(e.id)}`,onMouseEnter:()=>r(e,"diagram"),onMouseLeave:a,children:(0,Tl.jsx)("code",{dangerouslySetInnerHTML:{__html:e.content}})},e.id)))})})]})})]})})]})]})},Ol=c(f()),Dl=c(x()),$l=({errorManager:e,className:t=""})=>{let[n,r]=(0,Ol.useState)(e.getCurrentError());if((0,Ol.useEffect)((()=>{e.onErrorChange(r)}),[e]),!n)return null;let a=`error-message-container ${t}`.trim();return(0,Dl.jsx)("div",{className:a,children:(0,Dl.jsx)(Ll,{systemError:n})})},zl=c(f()),Rl=c(f()),Fl=class{canHandle(e){let t=e.trim();return t.startsWith("remove ")&&t.length>7}getPriority(){return 200}getCommandPatterns(){return["remove ID","remove Label:Type","remove source.relation=target","remove relation","remove Atom.REL","remove edge_id"]}execute(e,t){let n=e.trim().substring(7);try{return n.includes(".")&&n.includes("=")?this.handleRemoveRelationTuple(n,t):n.includes(".")&&!n.includes("=")?this.handleRemoveAtomRelation(n,t):n.includes(":")&&!n.includes("->")?this.handleRemoveAtomByLabelType(n,t):this.looksLikeEdgeId(n,t)?this.handleRemoveEdgeById(n,t):/^[^\s:->().]+$/.test(n)?t.getAtoms().find((e=>e.id===n))?this.handleRemoveAtomById(n,t):t.getRelations().find((e=>e.name===n))?this.handleRemoveRelation(n,t):{success:!1,message:`Atom or relation not found: ${n}`}:{success:!1,message:`Invalid remove syntax: ${n}`}}catch(e){return{success:!1,message:e instanceof Error?e.message:"Failed to remove"}}}handleRemoveAtomById(e,t){let n=t.getAtoms().find((t=>t.id===e));return n?(t.removeAtom(n.id),{success:!0,message:`[${n.id}] Removed atom: ${n.label}:${n.type}`,action:"remove"}):{success:!1,message:`Atom not found with ID: ${e}`}}handleRemoveAtomByLabelType(e,t){let[n,r]=e.split(":"),a=t.getAtoms().find((e=>e.label===n.trim()&&e.type===r.trim()));return a?(t.removeAtom(a.id),{success:!0,message:`[${a.id}] Removed atom: ${a.label}:${a.type}`,action:"remove"}):{success:!1,message:`Atom not found: ${e}`}}handleRemoveRelationTuple(e,t){let n=e.match(/^([^.]+)\.([^=]+)=(.+)$/);if(!n)return{success:!1,message:`Invalid relation format: ${e}`};let r=n[1].trim(),a=n[2].trim(),i=n[3].trim(),o=t.getRelations().find((e=>e.name===a));if(!o)return{success:!1,message:`Relation '${a}' not found`};let l=o.tuples.find((e=>2===e.atoms.length&&e.atoms[0]===r&&e.atoms[1]===i));return l?(t.removeRelationTuple(a,l),{success:!0,message:`[${r}.${a}=${i}] Removed tuple: ${a}(${r}, ${i})`,action:"remove"}):{success:!1,message:`Tuple not found: ${r}.${a}=${i}`}}handleRemoveRelation(e,t){let n=t.getRelations().find((t=>t.name===e));if(!n)return{success:!1,message:`Relation '${e}' not found`};let r=n.tuples.length;return n.tuples.slice().forEach((n=>{t.removeRelationTuple(e,n)})),{success:!0,message:`[${e}] Removed relation '${e}' (${r} tuples)`,action:"remove"}}handleRemoveAtomRelation(e,t){let n=e.match(/^([^.]+)\.([^.]+)$/);if(!n)return{success:!1,message:`Invalid atom.relation syntax: ${e}`};let[,r,a]=n;if(!t.getAtoms().find((e=>e.id===r)))return{success:!1,message:`Atom '${r}' not found`};let i=t.getRelations().find((e=>e.name===a));if(!i)return{success:!1,message:`Relation '${a}' not found`};i.tuples.length;let o=i.tuples.filter((e=>e.atoms[0]===r));return 0===o.length?{success:!1,message:`No ${a} relations found for atom '${r}'`}:(o.forEach((e=>{t.removeRelationTuple(a,e)})),{success:!0,message:`[${r}.${a}] Removed ${o.length} ${a} relations from '${r}'`,action:"remove"})}looksLikeEdgeId(e,t){return e.includes(":")&&e.includes("->")}handleRemoveEdgeById(e,t){let n=e.indexOf(":");if(-1===n)return{success:!1,message:`Invalid edge ID format: ${e}. Expected format: relationName:atom1->atom2`};let r=e.substring(0,n),a=e.substring(n+1).split("->"),i=t.getRelations().find((e=>e.name===r));if(!i)return{success:!1,message:`Relation '${r}' not found`};let o=i.tuples.find((e=>e.atoms.length===a.length&&e.atoms.every(((e,t)=>e===a[t]))));return o?(t.removeRelationTuple(r,o),{success:!0,message:`[${e}] Removed edge: ${r}(${a.join(", ")})`,action:"remove"}):{success:!1,message:`Edge '${e}' not found`}}getHelp(){return["Remove Commands (sugar syntax):"," remove ID - Remove atom by ID"," remove Label:Type - Remove atom by label and type"," remove source.relation=target - Remove specific relation tuple"," remove Atom.REL - Remove all REL relations from Atom"," remove edge_id - Remove specific edge by ID"," remove relation - Remove entire relation","","Examples:",' remove alice - Remove atom with ID "alice"'," remove Alice:Person - Remove Alice:Person atom"," remove alice.friend=bob - Remove friend(alice, bob) tuple"," remove alice.friend - Remove all friend relations from alice"," remove friend:alice->bob - Remove edge by ID"," remove friend - Remove entire friend relation"]}},Ml=class{canHandle(e){let t=e.trim();return!(t.startsWith("remove ")||t.startsWith("add ")||["help","info","status","list","clear","reify"].includes(t.toLowerCase())||t.startsWith("[list:")||t.includes(".")&&t.includes("=")||t.includes("(")&&t.includes(")")||!(/^[^:]+:.+$/.test(t)&&!t.includes("->")||/^[^=]+=.+:.+$/.test(t)&&!t.includes("->")))}getPriority(){return 100}getCommandPatterns(){return["Label:Type","id=Label:Type"]}execute(e,t){let n=e.trim();return this.handleAdd(n,t)}handleAdd(e,t){try{let n=e.match(/^(?:([^=]+)=)?([^:]+):(.+)$/);if(!n)return{success:!1,message:"Invalid syntax. Use: add Label:Type or add id=Label:Type"};let[,r,a,i]=n,o=a.trim(),l=i.trim();if(!o||!l)return{success:!1,message:"Label and type cannot be empty"};let s,u=r?.trim()||this.generateAtomId(o,t),c={id:u,label:o,type:l};return t.addAtom(c),r?.trim(),s=`[${u}] Added atom: ${o}:${l}`,{success:!0,message:s,action:"add"}}catch(e){return{success:!1,message:e instanceof Error?e.message:"Failed to add atom"}}}generateAtomId(e,t){let n=new Set(t.getAtoms().map((e=>e.id)));if(!n.has(e))return e;let r=1,a=`${e}$${r}`;for(;n.has(a);)r++,a=`${e}$${r}`;return a}getHelp(){return["Atom Commands (sugar syntax):"," Label:Type - Add atom with generated ID"," id=Label:Type - Add atom with explicit ID","","Examples:"," Alice:Person - Creates [Alice] Alice:Person"," p1=Alice:Person - Creates [p1] Alice:Person","","Note: IDs are shown in [brackets] for easy referencing","All syntax is sugar that gets desugared to internal operations"]}},Ul=class{canHandle(e){let t=e.trim();return!t.startsWith("remove ")&&!t.startsWith("add ")&&!(!t.includes(".")||!t.includes("="))&&/^[^.]+\.[^=]+=.+$/.test(t)}getPriority(){return 115}getCommandPatterns(){return["source.relation=target"]}execute(e,t){let n=e.trim();return this.handleAdd(n,t)}handleAdd(e,t){try{let n=e.match(/^([^.]+)\.([^=]+)=(.+)$/);if(!n)return{success:!1,message:"Invalid syntax. Use: source.relation=target"};let r=n[1].trim(),a=n[2].trim(),i=n[3].trim();if(!r||!a||!i)return{success:!1,message:"Source, relation, and target cannot be empty"};let o=t.getAtoms(),l=new Set(o.map((e=>e.id)));if(!l.has(r))return{success:!1,message:`Source atom '${r}' does not exist`};if(!l.has(i))return{success:!1,message:`Target atom '${i}' does not exist`};let s=o.find((e=>e.id===r)),u=o.find((e=>e.id===i)),c={atoms:[r,i],types:[s.type,u.type]};return t.addRelationTuple(a,c),{success:!0,message:`[${r}.${a}=${i}] Added relation: ${a}(${r}, ${i})`,action:"add"}}catch(e){return{success:!1,message:e instanceof Error?e.message:"Failed to add relation"}}}getHelp(){return["Dot Notation Relation Commands (sugar syntax):"," source.relation=target - Add binary relation","","Examples:"," alice.friend=bob - Creates friend(alice, bob)"," alice.knows=charlie - Creates knows(alice, charlie)","","Note: Atoms must exist before creating relations","All syntax is sugar that gets desugared to internal operations"]}},Bl=c(br()),Hl=class e{constructor(e,t={},n){this.atoms=new Map,this.relations=new Map,this.types=new Map,this.objectToAtomId=new WeakMap,this.atomCounter=0,this.typeLabelCounters=new Map,this.originalObjects=new Map,this.eventListeners=new Map,this.externalEvaluator=null,this.options={stringsIdempotent:t.stringsIdempotent??!0,numbersIdempotent:t.numbersIdempotent??!0,booleansIdempotent:t.booleansIdempotent??!0,showFunctions:t.showFunctions??!1},this.externalEvaluator=n||null,this.initializeBuiltinTypes(),e&&this.parseObjectIteratively(e)}setExternalEvaluator(e){this.externalEvaluator=e}getExternalEvaluator(){return this.externalEvaluator}getOptions(){return{...this.options}}cacheConstructorPattern(t,n){if(0===n.length)return;let r=e.globalConstructorCache.get(t),a=++e.instantiationCounter;(!r||a>r.instantiation)&&e.globalConstructorCache.set(t,{pattern:[...n],instantiation:a})}getCachedConstructorPattern(t){let n=e.globalConstructorCache.get(t);return n?n.pattern:null}static getGlobalConstructorCache(){let t=new Map;for(let[n,r]of e.globalConstructorCache)t.set(n,[...r.pattern]);return t}static getGlobalConstructorCacheWithPriority(){return new Map(e.globalConstructorCache)}static clearGlobalConstructorCache(){e.globalConstructorCache.clear()}static async fromExpression(t,n={},r){let a=await e.evaluateExpression(t,r);if(!a.success)throw new Error(`Failed to evaluate Pyret expression: ${e.formatError(a.exn)}`);if(e.isPrimitive(a.result)){let t=new e(null,n,r),i="string"==typeof a.result?"String":"number"==typeof a.result?"Number":"Boolean",o={id:`result_${a.result}`,label:String(a.result),type:i};return t.addAtom(o),t}return new e(a.result,n,r)}static async evaluateExpression(t,n){try{let r=await n.run(t),a=e.findKeyAtAnyLevel(r,"exn");if(void 0!==a)return{success:!1,exn:a};let i=e.findKeyAtAnyLevel(r,"answer");return void 0!==i?{success:!0,result:i}:e.isPrimitive(r)?{success:!0,result:r}:{success:!1,exn:"Unable to find answer or exn in evaluation result"}}catch(e){return{success:!1,exn:e instanceof Error?e.message:"Unknown evaluation error"}}}static findKeyAtAnyLevel(t,n){if(t&&"object"==typeof t){if(n in t)return t[n];for(let r of Object.values(t))if(r&&"object"==typeof r){let t=e.findKeyAtAnyLevel(r,n);if(void 0!==t)return t}}}static isPrimitive(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e}static formatError(e){if(!e)return"Unknown error";if("string"==typeof e)return e;if("object"==typeof e&&null!==e){let t=e;if(t.message)return t.message;if(t.toString&&"function"==typeof t.toString)return t.toString()}return String(e)}tryReconstructFromRelations(e,t){let n=new Map;if(this.relations.forEach((t=>{t.tuples.forEach((r=>{if(r.atoms.length>=2&&r.atoms[0]===e.id){let e=t.name;n.has(e)||n.set(e,[]),n.get(e).push(...r.atoms.slice(1))}}))})),0===n.size)return e.type;let r=this.getCachedConstructorPattern(e.type);if(r){let a=[];for(let e of r){let r=n.get(e)||[];for(let e of r)a.push(this.reifyAtom(e,t))}if(a.length>0)return`${e.type}(${a.join(", ")})`}let a=Array.from(this.atoms.values()).filter((t=>t.type===e.type));for(let r of a){let a=this.originalObjects.get(r.id);if(a&&a.dict){let r=Object.keys(a.dict);this.cacheConstructorPattern(e.type,r);let i=[];for(let e of r){let r=n.get(e)||[];for(let e of r)i.push(this.reifyAtom(e,t))}if(i.length>0)return`${e.type}(${i.join(", ")})`;break}}console.error(`[PyretDataInstance] Could not determine constructor pattern for type '${e.type}'. Falling back to sorted field order.`);let i=Array.from(n.keys()).sort(),o=[];for(let e of i){let r=n.get(e)||[];for(let e of r)o.push(this.reifyAtom(e,t))}return o.length>0?`${e.type}(${o.join(", ")})`:e.type}hasExternalEvaluator(){return null!==this.externalEvaluator}addEventListener(e,t){this.eventListeners.has(e)||this.eventListeners.set(e,new Set),this.eventListeners.get(e).add(t)}removeEventListener(e,t){let n=this.eventListeners.get(e);n&&n.delete(t)}emitEvent(e){let t=this.eventListeners.get(e.type);t&&t.forEach((t=>{try{t(e)}catch(e){console.error("Error in data instance event listener:",e)}}))}addAtom(e){this.atoms.set(e.id,e),this.ensureTypeExists(e.type);let t=this.types.get(e.type);t&&!t.atoms.some((t=>t.id===e.id))&&t.atoms.push(e),this.emitEvent({type:"atomAdded",data:{atom:e}})}removeAtom(e){let t=this.atoms.get(e);this.atoms.delete(e),this.types.forEach((t=>{t.atoms=t.atoms.filter((t=>t.id!==e))})),this.relations.forEach((t=>{t.tuples=t.tuples.filter((t=>!t.atoms.includes(e)))})),t&&this.emitEvent({type:"atomRemoved",data:{atomId:e}})}removeRelationTuple(e,t){let n=this.relations.get(e);if(n){let r=n.tuples.length;n.tuples=n.tuples.filter((e=>!e.atoms.every(((e,n)=>e===t.atoms[n])))),n.tuples.length{t.tuples.forEach((t=>{for(let n=1;n!e.has(t.id)));return 0===t.length?"# No root atoms found":t.length>1?`[list-set: ${t.map((e=>this.reifyAtom(e.id,new Set))).join(", ")}]`:""+this.reifyAtom(t[0].id,new Set)}reifyAtom(e,t){if(t.has(e))return`/* cycle: ${e} */`;let n=this.atoms.get(e);if(!n)return`/* missing atom: ${e} */`;if(t.add(e),this.isBuiltinType(n.type)){let r=this.reifyPrimitive(n);return t.delete(e),r}let r=this.originalObjects.get(e);if(!r||!r.dict)return t.delete(e),this.tryReconstructFromRelations(n,t);let a=Object.keys(r.dict);if(this.cacheConstructorPattern(n.type,a),a.every((e=>/^\d+$/.test(e)))&&a.length>0){let n=a.sort(((e,t)=>parseInt(e,10)-parseInt(t,10))).map((n=>this.getRelationTargets(e,n).map((e=>this.reifyAtom(e,t))))).flat();return t.delete(e),`[list: ${n.join(", ")}]`}let i=[];for(let n of a){let r=this.getRelationTargets(e,n);for(let e of r)i.push(this.reifyAtom(e,t))}return t.delete(e),0===i.length?n.type:`${n.type}(${i.join(", ")})`}reifyPrimitive(e){return"String"===e.type?`"${e.label.replace(/"/g,'\\"')}"`:e.label}parseObjectIteratively(e){let t=[{obj:e}];for(;t.length>0;){let{obj:e,parentInfo:n}=t.shift();if(this.objectToAtomId.has(e)){if(n){let t=this.objectToAtomId.get(e);this.addRelationTuple(n.relationName,{atoms:[n.parentId,t],types:["PyretObject","PyretObject"]})}continue}let r=this.createAtomFromObject(e);if(this.originalObjects.set(r,e),e.dict&&"object"==typeof e.dict){let t=this.extractType(e),n=Object.keys(e.dict);this.cacheConstructorPattern(t,n)}n&&this.addRelationTuple(n.relationName,{atoms:[n.parentId,r],types:["PyretObject","PyretObject"]}),e.dict&&"object"==typeof e.dict&&(this.isPyretTable(e)?this.processTableSemantics(r,e):Object.entries(e.dict).forEach((([e,n])=>{if(this.options.showFunctions||!n||"object"!=typeof n||!("meth"in n)||!("full_meth"in n))if(this.isAtomicValue(n)){let t=this.createAtomFromPrimitive(n);this.addRelationTuple(e,{atoms:[r,t],types:["PyretObject","PyretObject"]})}else Array.isArray(n)?this.processArrayField(r,e,n,t):this.isPyretObject(n)&&t.push({obj:n,parentInfo:{parentId:r,relationName:e}})})))}}processArrayField(e,t,n,r){n.forEach(((n,a)=>{if(this.isAtomicValue(n)){let r=this.createAtomFromPrimitive(n);this.addRelationTuple(t,{atoms:[e,r],types:["PyretObject","PyretObject"]})}else if(Array.isArray(n)){let i=this.generateAtomId("Array"),o={id:i,type:"Array",label:`Array[${a}]`};this.atoms.set(i,o),this.ensureTypeExists("Array"),this.addRelationTuple(t,{atoms:[e,i],types:["PyretObject","PyretObject"]}),this.processArrayField(i,"element",n,r)}else this.isPyretObject(n)&&r.push({obj:n,parentInfo:{parentId:e,relationName:t}})}))}isPyretTable(e){return!(!e.dict||"object"!=typeof e.dict||e.brands&&"object"==typeof e.brands&&!Object.keys(e.brands).some((e=>e.includes("brandtable"))))&&"_header-raw-array"in e.dict&&"_rows-raw-array"in e.dict}processTableSemantics(e,t){let n=t.dict,r=n["_header-raw-array"],a=n["_rows-raw-array"];if(!Array.isArray(r)||!Array.isArray(a))return;let i=r.filter((e=>"string"==typeof e));0!==i.length&&a.forEach((e=>{if(!Array.isArray(e))return;let t=[];e.forEach((e=>{if(this.isAtomicValue(e)){let n=this.createAtomFromPrimitive(e);t.push(n)}})),t.length===i.length&&t.length>0&&this.addRelationTuple("row",{atoms:t,types:t.map((()=>"String"))})}))}createAtomFromObject(e){let t=this.extractType(e),n=this.generateAtomId(t),r={id:n,type:t,label:this.extractLabel(e)};return this.atoms.set(n,r),this.objectToAtomId.set(e,n),this.ensureTypeExists(t),n}createAtomFromPrimitive(e){let t;t=this.isRationalNumber(e)?this.rationalToDecimal(e):e;let n=this.mapPrimitiveType(t),r=String(t);if("String"===n&&this.options.stringsIdempotent||"Number"===n&&this.options.numbersIdempotent||"Boolean"===n&&this.options.booleansIdempotent){let e=Array.from(this.atoms.values()).find((e=>e.label===r&&e.type===n));if(e)return e.id}let a=this.generateAtomId(n),i={id:a,type:n,label:r};return this.atoms.set(a,i),this.ensureTypeExists(n),a}mapPrimitiveType(e){switch(typeof e){case"number":return"Number";case"string":return"String";case"boolean":return"Boolean";default:return"Value"}}extractMostSpecificBrand(e){let t,n,r=-1;for(let a of Object.keys(e)){let e=/^\$brand([a-zA-Z_]+)(\d+)$/.exec(a);if(e){let[,n,a]=e,i=parseInt(a,10);i>r&&(r=i,t=n)}else{let e=/^\$brand_?([a-zA-Z_]+)$/.exec(a);if(e){let[,t]=e;(!n||t>n)&&(n=t)}}}return t||n}extractType(e){if(e.$name&&"string"==typeof e.$name)return e.$name;if(e.brands&&"object"==typeof e.brands){let t=this.extractMostSpecificBrand(e.brands);if(t)return t}return"PyretObject"}extractLabel(e){if(e.$name&&"string"==typeof e.$name)return e.$name;let t=this.extractType(e),n=(this.typeLabelCounters.get(t)??0)+1;return this.typeLabelCounters.set(t,n),`${t}$${n}`}addRelationTuple(e,t){let n=t.atoms[0],r=t.atoms[t.atoms.length-1],a=t.atoms.slice(1,-1),i=this.atoms.get(n),o=this.atoms.get(r);if(!i||!o)return void console.warn(`Cannot create relation ${e}: missing atoms ${n} or ${r}`);let l=this.relations.get(e),s=e+(a.length>0?`[${a.join(", ")}]`:"");l||(l={id:e,name:s,types:[i.type,o.type],tuples:[]},this.relations.set(e,l)),l.tuples.some((e=>e.atoms[0]===n&&e.atoms[1]===r))||(l.tuples.push(t),this.emitEvent({type:"relationTupleAdded",data:{relationId:e,tuple:t}}))}ensureTypeExists(e){if(!this.types.has(e)){let t={id:e,types:[e,"PyretObject"],atoms:[],isBuiltin:this.isBuiltinType(e)};this.types.set(e,t)}}initializeBuiltinTypes(){["Number","String","Boolean","PyretObject"].forEach((e=>{let t={id:e,types:"PyretObject"===e?["PyretObject"]:[e,"PyretObject"],atoms:[],isBuiltin:!0};this.types.set(e,t)}))}isBuiltinType(e){return["Number","String","Boolean","PyretObject"].includes(e)}isRationalNumber(e){return"object"==typeof e&&null!==e&&"n"in e&&"d"in e&&"number"==typeof e.n&&"number"==typeof e.d}rationalToDecimal(e){return e.n/e.d}isAtomicValue(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||this.isRationalNumber(e)}isPyretObject(e){return"object"==typeof e&&null!==e&&("dict"in e||"brands"in e||"$name"in e)}generateAtomId(e){return`${e?e.toLowerCase().substring(0,3):"atom"}_${++this.atomCounter}`}getAtoms(){return Array.from(this.atoms.values())}getRelations(){let e=this.relations.values();return Array.from(e)}getTypes(){return this.types.forEach((e=>{e.atoms=this.getAtoms().filter((t=>t.type===e.id))})),Array.from(this.types.values())}getAtomType(e){let t=this.atoms.get(e);if(!t)throw new Error(`Atom with id '${e}' not found`);return this.types.get(t.type)||(this.ensureTypeExists(t.type),this.types.get(t.type))}generateGraph(e=!1,t=!1){let n=new Bl.Graph({directed:!0,multigraph:!0});if(this.getAtoms().forEach((e=>{n.setNode(e.id,{label:e.label})})),this.getRelations().forEach((e=>{e.tuples.forEach((t=>{if(t.atoms.length>=2){let r=t.atoms[0],a=t.atoms[t.atoms.length-1],i=t.atoms.slice(1,-1),o=e.name;if(i.length>0){let t=i.map((e=>{let t=this.atoms.get(e);return t?t.label:e}));o=`${e.name}[${t.join(", ")}]`}let l=function(e,t){return`${e.id}:${t.atoms.join("->")}`}(e,t);n.setEdge(r,a,o,l)}}))})),e||t){let r=[];n.nodes().forEach((a=>{let i=n.inEdges(a)||[],o=n.outEdges(a)||[];if(0===i.length&&0===o.length&&this.atoms.get(a)){let n=this.getAtomType(a).isBuiltin;(e||n&&t)&&r.push(a)}})),r.forEach((e=>n.removeNode(e)))}return n}applyProjections(t){if(0===t.length)return this;let n=Object.create(e.prototype);return n.atoms=new Map([...this.atoms].filter((([e])=>t.includes(e)))),n.relations=new Map,n.types=new Map,n.atomCounter=n.atoms.size,this.relations.forEach(((e,r)=>{let a=e.tuples.filter((e=>e.atoms.every((e=>t.includes(e)))));a.length>0&&n.relations.set(r,{...e,tuples:a})})),this.types.forEach(((e,r)=>{let a=e.atoms.filter((e=>t.includes(e.id)));a.length>0&&n.types.set(r,{...e,atoms:a})})),n}getRelationTargets(e,t){let n=[];return this.relations.forEach((r=>{r.name===t&&r.tuples.forEach((t=>{t.atoms[0]===e&&t.atoms.length>=2&&n.push(t.atoms[1])}))})),n}addFromDataInstance(t,n){if(!(t instanceof e))return!1;let r=t,a=new Map;return r.getAtoms().forEach((e=>{let t=this.isBuiltinType(e.type);if(n&&t&&("String"===e.type&&this.options.stringsIdempotent||"Number"===e.type&&this.options.numbersIdempotent||"Boolean"===e.type&&this.options.booleansIdempotent)){let t=Array.from(this.atoms.values()).find((t=>t.type===e.type&&t.label===e.label));if(t)return void a.set(e.id,t.id)}let i=this.generateAtomId(e.type);a.set(e.id,i);let o={...e,id:i};this.addAtom(o);let l=r.originalObjects.get(e.id);l&&this.originalObjects.set(i,l)})),r.getTypes().forEach((e=>{if(this.types.has(e.id)){let t=this.types.get(e.id),n=e.atoms.map((e=>({...e,id:a.get(e.id)||e.id})));t.atoms.push(...n)}else this.types.set(e.id,{...e,atoms:e.atoms.map((e=>({...e,id:a.get(e.id)||e.id})))})})),r.getRelations().forEach((e=>{let t=e.tuples.map((e=>({atoms:e.atoms.map((e=>a.get(e)||e)),types:e.types}))),n=this.relations.get(e.id);n?n.tuples.push(...t):this.relations.set(e.id,{...e,tuples:t})})),!0}};Hl.globalConstructorCache=new Map,Hl.instantiationCounter=0;var Vl=Hl,ql=class{canHandle(e){let t=e.trim().toLowerCase();return["help","info","status","list","clear","reify","list-ids","list-edges"].includes(t)}getPriority(){return 50}getCommandPatterns(){return["help","info","status","list","list-ids","list-edges","clear","reify"]}execute(e,t){switch(e.trim().toLowerCase()){case"help":return{success:!0,message:this.getGeneralHelp(),action:"help"};case"info":case"status":return this.getStatus(t);case"list":return this.listContents(t);case"list-ids":return this.listAtomIds(t);case"list-edges":return this.listEdgeIds(t);case"clear":return this.clearInstance(t);case"reify":return this.reifyInstance(t);default:return{success:!1,message:"Unknown info command"}}}listAtomIds(e){let t=e.getAtoms();if(0===t.length)return{success:!0,message:"No atoms found in instance.",action:"info"};let n="Internal Atom IDs:\n\n",r=t.reduce(((e,t)=>(e[t.type]||(e[t.type]=[]),e[t.type].push(t),e)),{});return Object.entries(r).forEach((([e,t])=>{n+=`${e}:\n`,t.forEach((e=>{n+=` ID: ${e.id} Label: ${e.label}\n`})),n+="\n"})),n+=`Total: ${t.length} atoms`,{success:!0,message:n,action:"info"}}listEdgeIds(e){let t=e.getRelations();if(0===t.length)return{success:!0,message:"No relations/edges found in instance.",action:"info"};let n="Internal Edge IDs:\n\n",r=0;return t.forEach((e=>{e.tuples.length>0&&(n+=`Relation: ${e.name}\n`,e.tuples.forEach(((t,a)=>{let i=`${e.name}:${t.atoms.join("->")}`;n+=` Edge ID: ${i}\n`,n+=` Tuple: (${t.atoms.join(", ")})\n`,r++})),n+="\n")})),n+=`Total: ${r} edges across ${t.length} relations`,{success:!0,message:n,action:"info"}}getStatus(e){let t=e.getAtoms(),n=e.getRelations(),r=n.reduce(((e,t)=>e+t.tuples.length),0),a=t.reduce(((e,t)=>(e[t.type]=(e[t.type]||0)+1,e)),{}),i=n.reduce(((e,t)=>(e[t.name]=t.tuples.length,e)),{}),o="Instance Status:\n";return o+=` Atoms: ${t.length}\n`,o+=` Relations: ${n.length}\n`,o+=` Tuples: ${r}\n\n`,Object.keys(a).length>0&&(o+="Types:\n",Object.entries(a).forEach((([e,t])=>{o+=` ${e}: ${t}\n`})),o+="\n"),Object.keys(i).length>0&&(o+="Relations:\n",Object.entries(i).forEach((([e,t])=>{o+=` ${e}: ${t} tuples\n`}))),{success:!0,message:o,action:"info"}}listContents(e){let t=e.getAtoms(),n=e.getRelations(),r="Instance Contents:\n\n";return t.length>0&&(r+="Atoms:\n",t.forEach((e=>{r+=` [${e.id}] ${e.label}:${e.type}\n`})),r+="\n"),n.length>0&&(r+="Relations:\n",n.forEach((e=>{r+=` ${e.name}:\n`,e.tuples.forEach((e=>{r+=` (${e.atoms.join(", ")})\n`}))}))),0===t.length&&0===n.length&&(r+="Empty instance - no atoms or relations defined."),{success:!0,message:r,action:"info"}}clearInstance(e){try{let t=e.getAtoms().map((e=>e.id));return t.forEach((t=>e.removeAtom(t))),{success:!0,message:`Cleared instance (removed ${t.length} atoms)`,action:"remove"}}catch(e){return{success:!1,message:e instanceof Error?e.message:"Failed to clear instance"}}}reifyInstance(e){try{if(e instanceof Vl)return{success:!0,message:`Pyret Constructor Notation:\n\n${e.reify()}`,action:"info"};{let t=e.getAtoms(),n=e.getRelations(),r="Data Instance Structure:\n\n";return t.length>0&&(r+="Atoms:\n",t.forEach((e=>{r+=` [${e.id}] ${e.label}:${e.type}\n`})),r+="\n"),n.length>0&&(r+="Relations:\n",n.forEach((e=>{r+=` ${e.name}:\n`,e.tuples.forEach((e=>{r+=` (${e.atoms.join(", ")})\n`}))}))),{success:!0,message:r,action:"info"}}}catch(e){return{success:!1,message:e instanceof Error?e.message:"Failed to reify instance"}}}getGeneralHelp(){return'REPL Interface Help:\n\nAvailable commands across all terminals:\n help - Show this help\n info - Show instance status \n status - Same as info\n list - List all atoms and relations\n list-ids - List internal atom IDs grouped by type\n list-edges - List internal edge IDs for all relations\n clear - Clear entire instance\n reify - Generate Pyret constructor notation (or generic representation)\n\nTerminal-specific commands vary by terminal type.\nClick the "?" button in each terminal header for specific help.'}getHelp(){return["Utility Commands:"," help - Show general help"," info - Show instance status"," status - Same as info"," list - List all contents"," list-ids - List internal atom IDs"," list-edges - List internal edge IDs"," clear - Clear entire instance"," reify - Generate Pyret constructor notation"]}},Wl=c(x()),Gl=[{id:"unified",title:"",description:"Supports atoms, relations, and extensions in one terminal",parsers:[new Fl,new class{canHandle(e){let t=e.trim();return!t.startsWith("add ")&&!t.startsWith("remove ")&&!(!t.startsWith("[list:")||!t.includes("]:"))}getPriority(){return 120}getCommandPatterns(){return["[list: item1,item2,item3]:type","[list: 1,2,3,4]:numbers"]}execute(e,t){let n=e.trim();return this.handleAdd(n,t)}handleAdd(e,t){try{let n=e.match(/^\[list:\s*([^\]]+)\]:(.+)$/);if(!n)return{success:!1,message:"Invalid syntax. Use: add [list: item1,item2,item3]:type"};let[,r,a]=n,i=r.split(",").map((e=>e.trim())).filter((e=>e)),o=a.trim();if(0===i.length)return{success:!1,message:"List cannot be empty"};let l="String",s=t.getAtoms(),u=new Set(s.map((e=>e.id)));if(i.every((e=>/^\d+$/.test(e))))l="Number";else if(i.every((e=>/^".*"$/.test(e)))){l="String";for(let e=0;eu.has(e)))&&(l=s.find((e=>e.id===i[0]))?.type||"Entity");let c=[];for(let e=0;e0?i.length:0;return{success:!0,message:`Added Pyret list: ${d} with ${i.length} items (${p} atoms, ${h} relations)`,action:"add"}}catch(e){return{success:!1,message:e instanceof Error?e.message:"Failed to add Pyret list"}}}generateListId(e,t){let n=new Set(e.getAtoms().map((e=>e.id))),r=1,a=`${t}-${r}`;for(;n.has(a);)r++,a=`${t}-${r}`;return a}addListRelations(e,t,n){if(0===n.length)return;let r="empty";for(let a=n.length-1;a>=0;a--){let i=n[a],o=`${t}-link-${a+1}`,l={id:o,label:`link(${i}, ${r})`,type:"link"};e.addAtom(l);let s={atoms:[i,r],types:["Item","link"]};try{e.addRelationTuple("link",s)}catch{}r=o}let a={atoms:[t,r],types:["List","link"]};try{e.addRelationTuple("link",a)}catch{}}getHelp(){return["Pyret List Commands (sugar syntax):"," [list: item1,item2,item3]:list_type - Add list with items"," [list: 1,2,3,4]:numbers - Add number list","","This automatically creates:"," - Individual atoms for each item (if they don't exist)"," - A list atom containing all items"," - first/rest relations for list structure","","Examples:"," [list: 1,2,3,4]:numberList - Creates numberList-1 as list ID"," [list: alice,bob,charlie]:personList - Creates personList-1 as list ID"," [list: red,green,blue]:colors - Creates colors-1 as list ID","","Note: All syntax is sugar that gets desugared to internal operations.","The list type name is used as-is to generate unique list IDs (type-1, type-2, etc.)"]}},new class{constructor(){this.atomParser=new Ml,this.dotRelationParser=new Ul}canHandle(e){let t=e.trim();if(this.isCommaSeperatedAtoms(t))return!0;if(t.includes(";")){let e=t.split(";").map((e=>e.trim())).filter((e=>e));return e.length>=2&&e.some((e=>this.atomParser.canHandle(e)||this.dotRelationParser.canHandle(e)))}return!1}isCommaSeperatedAtoms(e){return!1}getPriority(){return 115}getCommandPatterns(){return["Alice:Person; bob=Bob:Person; alice.friend=bob"]}execute(e,t){let n=e.trim();try{return n.includes(";")?this.handleSemicolonSeperatedCommands(n,t):{success:!1,message:"Unable to parse batch command"}}catch(e){return{success:!1,message:e instanceof Error?e.message:"Failed to execute batch command"}}}handleSemicolonSeperatedCommands(e,t){let n=e.split(";").map((e=>e.trim())).filter((e=>e)),r=[],a=[],i=0,o=0,l=0;for(let e of n)try{let n=null;this.atomParser.canHandle(e)?n=this.atomParser.execute(e,t):this.dotRelationParser.canHandle(e)&&(n=this.dotRelationParser.execute(e,t)),n?n.success?(r.push(n.message),i++,"add"===n.action&&o++,"remove"===n.action&&l++):a.push(`"${e}": ${n.message}`):a.push(`"${e}": No parser can handle this command`)}catch(t){a.push(`"${e}": ${t instanceof Error?t.message:"Unknown error"}`)}let s=[];return o>0&&s.push(`${o} added`),l>0&&s.push(`${l} removed`),i===n.length?{success:!0,message:`Batch command completed (${s.join(", ")}):\n${r.join("\n")}`,action:o>0?"add":l>0?"remove":"info"}:i>0?{success:!0,message:`Batch command partially completed (${i}/${n.length} commands):\n\nSuccessful:\n${r.join("\n")}\n\nErrors:\n${a.join("\n")}`,action:o>0?"add":l>0?"remove":"info"}:{success:!1,message:`Batch command failed:\n${a.join("\n")}`}}getHelp(){return["Batch Commands (sugar syntax):"," command1; command2; command3 - Execute multiple sugar commands","","Examples:"," Alice:Person; bob=Bob:Person; alice.friend=bob"," 1:Number; 2:Number; 3:Number","","Note: Semicolon-separated commands support any mix of atom/relation sugar syntax"]}},new Ul,new Ml,new ql].sort(((e,t)=>t.getPriority()-e.getPriority())),placeholder:""}],Yl=({instance:e,onChange:t,onCndSpecExtracted:n,disabled:r=!1,className:a="",terminals:i=Gl})=>{let[o,l]=(0,Rl.useState)((()=>{let e={};return i.forEach((t=>{e[t.id]={input:"",output:[],isExecuting:!1}})),e})),[s,u]=(0,Rl.useState)({nodes:!1,edges:!1}),c=(0,Rl.useRef)({}),d=e.getAtoms(),f=e.getRelations(),p=(f.reduce(((e,t)=>e+t.tuples.length),0),(0,Rl.useCallback)((e=>{let t=c.current[e];t&&(t.scrollTop=t.scrollHeight)}),[])),h=(0,Rl.useCallback)(((e,t)=>{l((n=>({...n,[e]:{...n[e],output:[...n[e].output,{...t,id:`${Date.now()}-${Math.random()}`,timestamp:new Date}]}}))),setTimeout((()=>p(e)),0)}),[p]),m=(0,Rl.useCallback)((()=>{t&&t(e)}),[e,t]),g=(0,Rl.useCallback)((e=>{u((t=>({...t,[e]:!t[e]})))}),[]),y=(0,Rl.useCallback)((async(t,r)=>{let a=i.find((e=>e.id===t));if(!a)return;let o=r.trim();if(!o)return;l((e=>({...e,[t]:{...e[t],isExecuting:!0}}))),h(t,{type:"command",message:o});let s=null,u=null;for(let t of a.parsers)if(t.canHandle(o)){u=t;try{let n=t.execute(o,e);s=await Promise.resolve(n);break}catch(e){s={success:!1,message:e instanceof Error?e.message:"Execution failed"};break}}s||(s={success:!1,message:`Unknown command: ${o}\n\nAvailable patterns:\n ${a.parsers.flatMap((e=>e.getCommandPatterns())).slice(0,8).join("\n ")}\n\nType 'help' for detailed information.`}),(!s.success||"help"===s.action||"info"===s.action)&&h(t,{type:s.success?"help"===s.action?"help":"info"===s.action?"info":"success":"error",message:s.message}),l((e=>({...e,[t]:{...e[t],input:"",isExecuting:!1}}))),s.success&&("add"===s.action||"remove"===s.action)&&m(),s.success&&s.extractedCndSpec&&n&&n(s.extractedCndSpec)}),[i,e,h,m,n]),v=(0,Rl.useCallback)(((e,t)=>{l((n=>({...n,[e]:{...n[e],input:t}})))}),[]),b=(0,Rl.useCallback)((async e=>{let t=o[e];if(!t||t.isExecuting)return;let n=t.input.split("\n").map((e=>e.trim())).filter((e=>e));for(let t of n)await y(e,t)}),[o,y]),x=(0,Rl.useCallback)(((e,t)=>{"Enter"===e.key&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),b(t))}),[b]),w=((0,Rl.useCallback)((e=>{l((t=>({...t,[e]:{...t[e],output:[]}})))}),[]),(0,Rl.useCallback)((e=>{let t=i.find((t=>t.id===e));if(!t)return;let n=`${t.title} Help:\n\n`;t.parsers.forEach((e=>{let t=e.getHelp();n+=t.join("\n")+"\n\n"})),h(e,{type:"help",message:n.trim()})}),[i,h])),k=(0,Rl.useCallback)((()=>{try{let t=e.getAtoms().map((e=>e.id));t.forEach((t=>e.removeAtom(t))),i.forEach((e=>{h(e.id,{type:"success",message:`Instance cleared (removed ${t.length} atoms)`})})),m()}catch(e){i.forEach((t=>{h(t.id,{type:"error",message:e instanceof Error?e.message:"Failed to clear instance"})}))}}),[e,i,h,m]);return(0,Wl.jsxs)("div",{className:`repl-interface ${a}`,children:[(0,Wl.jsxs)("div",{className:"repl-interface__main",children:[(0,Wl.jsx)("div",{className:"repl-interface__header",children:(0,Wl.jsxs)("div",{style:{display:"flex",gap:"8px"},children:[(0,Wl.jsx)("button",{onClick:()=>g("nodes"),style:{background:s.nodes?"#4ec9b0":"#2d2d30",color:s.nodes?"#1e1e1e":"#cccccc",border:"1px solid #3c3c3c",padding:"3px 6px",borderRadius:"3px",cursor:"pointer",fontSize:"0.75rem"},children:d.length}),(0,Wl.jsx)("button",{onClick:()=>g("edges"),style:{background:s.edges?"#4ec9b0":"#2d2d30",color:s.edges?"#1e1e1e":"#cccccc",border:"1px solid #3c3c3c",padding:"3px 6px",borderRadius:"3px",cursor:"pointer",fontSize:"0.75rem"},children:f.length})]})}),(0,Wl.jsx)("div",{className:"repl-interface__terminals",children:i.map((e=>{let t=o[e.id];return t?(0,Wl.jsxs)("div",{className:"repl-terminal",children:[(0,Wl.jsx)("div",{className:"repl-terminal__output",ref:t=>{c.current[e.id]=t},children:t.output.map((e=>(0,Wl.jsx)("div",{className:`repl-output-line ${e.type}`,children:e.message.split("\n").map(((e,t)=>(0,Wl.jsx)("div",{children:e},t)))},e.id)))}),(0,Wl.jsxs)("div",{className:"repl-terminal__input",children:[(0,Wl.jsx)("textarea",{value:t.input,onChange:t=>v(e.id,t.target.value),onKeyDown:t=>x(t,e.id),placeholder:e.placeholder,disabled:r||t.isExecuting,rows:2}),(0,Wl.jsxs)("div",{className:"repl-terminal__controls",children:[(0,Wl.jsx)("button",{className:"repl-interface__action-button danger",onClick:k,disabled:r,title:"Clear all data",style:{marginRight:"4px",fontSize:"10px",padding:"2px 6px"},children:"Clear"}),(0,Wl.jsx)("button",{className:"repl-interface__action-button",onClick:()=>w("unified"),disabled:r,title:"Show help",style:{marginRight:"4px",fontSize:"10px",padding:"2px 6px"},children:"?"}),(0,Wl.jsx)("button",{className:"repl-terminal__execute",onClick:()=>b(e.id),disabled:r||t.isExecuting||!t.input.trim(),title:"Execute commands (Ctrl+Enter)",children:t.isExecuting?"...":"▶"})]})]})]},e.id):null}))})]}),(s.nodes||s.edges)&&(0,Wl.jsxs)("div",{className:"repl-interface__drawers",children:[s.nodes&&(0,Wl.jsxs)("div",{className:"repl-interface__drawer",children:[(0,Wl.jsxs)("div",{className:"repl-interface__drawer-header",onClick:()=>g("nodes"),children:[(0,Wl.jsxs)("span",{children:["Atoms (",d.length,")"]}),(0,Wl.jsx)("span",{className:"repl-interface__drawer-toggle",children:"▼"})]}),(0,Wl.jsx)("div",{className:"repl-interface__drawer-content",children:0===d.length?(0,Wl.jsx)("div",{className:"repl-interface__drawer-empty",children:"No atoms"}):d.map((e=>(0,Wl.jsx)("div",{className:"repl-interface__drawer-item",children:(0,Wl.jsx)("div",{className:"repl-interface__drawer-item-content",children:(0,Wl.jsxs)("div",{className:"repl-interface__drawer-item-header",children:[e.label,":",e.type]})})},e.id)))})]}),s.edges&&(0,Wl.jsxs)("div",{className:"repl-interface__drawer",children:[(0,Wl.jsxs)("div",{className:"repl-interface__drawer-header",onClick:()=>g("edges"),children:[(0,Wl.jsxs)("span",{children:["Relations (",f.length,")"]}),(0,Wl.jsx)("span",{className:"repl-interface__drawer-toggle",children:"▼"})]}),(0,Wl.jsx)("div",{className:"repl-interface__drawer-content",children:0===f.length?(0,Wl.jsx)("div",{className:"repl-interface__drawer-empty",children:"No relations"}):f.map((e=>(0,Wl.jsxs)("div",{style:{marginBottom:"6px"},children:[(0,Wl.jsx)("div",{className:"repl-interface__drawer-item",children:(0,Wl.jsx)("div",{className:"repl-interface__drawer-item-content",children:(0,Wl.jsxs)("div",{className:"repl-interface__drawer-item-header",children:[e.name," (",e.tuples.length,")"]})})}),e.tuples.slice(0,3).map(((e,t)=>(0,Wl.jsx)("div",{className:"repl-interface__drawer-item",style:{marginLeft:"8px",fontSize:"0.7rem"},children:(0,Wl.jsx)("div",{className:"repl-interface__drawer-item-content",children:(0,Wl.jsx)("div",{className:"repl-interface__drawer-item-detail",children:e.atoms.join(" → ")})})},t))),e.tuples.length>3&&(0,Wl.jsxs)("div",{style:{marginLeft:"8px",fontSize:"0.7rem",color:"#6a737d"},children:["... and ",e.tuples.length-3," more"]})]},e.name)))})]})]})]})},Ql=class{constructor(e){this.evaluator=e||null}setEvaluator(e){this.evaluator=e}findKeyAtAnyLevel(e,t){if(e&&"object"==typeof e){if(t in e)return e[t];for(let n of Object.values(e))if(n&&"object"==typeof n){let e=this.findKeyAtAnyLevel(n,t);if(void 0!==e)return e}}}isPrimitive(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e}async evaluateExpression(e){if(!this.evaluator)throw new Error("No external Pyret evaluator available");try{let t=await this.evaluator.run(e),n=this.findKeyAtAnyLevel(t,"exn");if(void 0!==n)return{success:!1,exn:n};let r=this.findKeyAtAnyLevel(t,"answer");return void 0!==r?{success:!0,result:r}:this.isPrimitive(t)?{success:!0,result:t}:{success:!1,exn:"Unable to find answer or exn in evaluation result"}}catch(e){return{success:!1,exn:e instanceof Error?e.message:"Unknown evaluation error"}}}canHandle(e){let t=e.trim();return!("reify"!==t.toLowerCase()&&!/^['"`].*['"`]$/.test(t)&&!/^\d+(\.\d+)?$/.test(t)&&(!this.evaluator||t.startsWith("remove ")||["help","info","status","list","clear"].includes(t.toLowerCase())||/^[^:]+:.+$/.test(t)&&!t.includes("(")&&!t.includes("[")&&!t.includes("table:")&&!t.includes("row:")||t.includes(".")&&t.includes("=")&&!t.includes("(")||!(t.includes("(")&&t.includes(")")||t.includes("[")&&t.includes("]")||t.includes("table:")||t.includes("row:"))))}getPriority(){return 90}getCommandPatterns(){return["reify","[list: 1, 2, 3, 4]",'edge("id", "label", weight)']}execute(e,t){let n=e.trim();return"reify"===n.toLowerCase()?this.reifyInstance(t).then((e=>({success:!0,message:e.length>0?e.join("\n"):"No data to reify",action:"info"}))):this.evaluator?this.evaluateExpression(n).then((async e=>e.success?await this.addPyretResultToInstance(e.result,t,n):{success:!1,message:`Evaluation failed: ${this.formatError(e.exn)}`})).catch((e=>({success:!1,message:`Unexpected error during evaluation: ${this.formatError(e)}`}))):Promise.resolve({success:!1,message:"No external Pyret evaluator available. Cannot evaluate Pyret expressions.\n\nTo enable this feature, ensure window.__internalRepl is available."})}async reifyInstance(e){if(!this.evaluator)return["// No external Pyret evaluator available for reification"];let t=[];try{let n=e.getAtoms();for(let e of n)e.type?t.push(`${e.label}:${e.type}`):t.push(e.label);let r=e.getRelations();for(let e of r)for(let n of e.tuples)if(2===n.atoms.length)t.push(`${n.atoms[0]}.${e.name}=${n.atoms[1]}`);else{let r=n.atoms.map((e=>`"${e}"`)).join(", ");t.push(`${e.name}(${r})`)}return t}catch(e){return["// Error during reification:",`// ${e instanceof Error?e.message:"Unknown error"}`]}}async extractCndSpec(e,t){try{if(!this.evaluator)return;let e=`(${t})._cndspec()`,n=await this.evaluateExpression(e);if(n.success&&n.result&&"string"==typeof n.result)return n.result}catch(e){console.error("Error extracting CnD spec:",this.formatError(e))}}async addPyretResultToInstance(e,t,n){try{let r=await this.extractCndSpec(e,n);if(!this.evaluator)throw new Error("No external Pyret evaluator available");let a=await Vl.fromExpression(n,{},this.evaluator);return 0===a.getAtoms().length?{success:!1,message:"Pyret expression did not produce any data structures",extractedCndSpec:r}:t.addFromDataInstance?.(a,!0)?{success:!0,message:`Evaluated Pyret expression: ${n}\nAdded ${a.getAtoms().length} atoms and ${a.getRelations().reduce(((e,t)=>e+t.tuples.length),0)} relation tuples`+(r?"\nExtracted CnD specification from result":""),action:"add",extractedCndSpec:r}:this.fallbackAddToInstance(a,t,n,r)}catch(e){return{success:!1,message:`Failed to convert Pyret result to data instance: ${this.formatError(e)}`}}}fallbackAddToInstance(e,t,n,r){let a=0,i=0;for(let n of e.getAtoms())try{let e=n.id,r=new Set(t.getAtoms().map((e=>e.id))),i=1;for(;r.has(e);)e=`${n.id}_${i}`,i++;let o={...n,id:e};t.addAtom(o),a++}catch(e){console.warn("Failed to add atom:",e)}for(let n of e.getRelations())for(let e of n.tuples)try{t.addRelationTuple(n.name,e),i++}catch(e){console.warn("Failed to add relation tuple:",e)}return{success:!0,message:`Evaluated Pyret expression: ${n}\nAdded ${a} atoms and ${i} relation tuples`+(r?"\nExtracted CnD specification from result":""),action:"add",extractedCndSpec:r}}formatError(e){if(!e)return"Unknown error";if("string"==typeof e)return e;if("object"==typeof e&&null!==e){let t=e;if(t.message)return t.message;if(t.toString&&"function"==typeof t.toString)return t.toString()}return String(e)}getHelp(){let e=["Pyret Expression Commands (requires external evaluator):"," reify - Convert current data instance back to Pyret expressions",' edge("id", "label", weight) - Add edge data structure'," [list: 1, 2, 3, 4] - Add Pyret list"," tree(left, right) - Add tree data structure"," table: col1, col2 row: val1, val2 end - Add table data structure","","This parser can evaluate arbitrary Pyret expressions and convert","the results into atoms and relations in the data instance."];return this.evaluator?[...e,"","✓ External Pyret evaluator is available.","You can use any valid Pyret expression."]:[...e,"","⚠️ External Pyret evaluator not available.","This parser requires window.__internalRepl or similar.",'The "reify" command works without external evaluator.']}},Kl=c(x()),Xl=({initialInstance:e,onChange:t,onCndSpecExtracted:n,externalEvaluator:r,...a})=>{let[i,o]=(0,zl.useState)((()=>e||new Vl({dict:{},brands:{}}))),l=(0,zl.useMemo)((()=>{let e=new Ql(r),t=new class{constructor(e){this.evaluator=e||null}setEvaluator(e){this.evaluator=e}canHandle(e){let t=e.trim();if(!t.includes("=")||t.startsWith("remove ")||["help","info","status","list","clear","reify"].includes(t.toLowerCase()))return!1;if(t.includes(".")&&t.includes("=")&&t.indexOf(".")e.id===r))?{success:!1,message:`ID '${r}' is already in use. Use a different ID or remove the existing atom first.`}:this.isPrimitiveExpression(a)?this.handlePrimitiveAssignment(r,a,t):this.evaluator?await this.handleComplexAssignment(r,a,t):{success:!1,message:"No external Pyret evaluator available. Cannot evaluate complex expressions.\n\nTo enable this feature, ensure window.__internalRepl is available."}}catch(e){return{success:!1,message:`Failed to assign '${r}': ${e instanceof Error?e.message:"Unknown error"}`}}}isValidId(e){return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e)&&!["add","remove","help","info","list","clear","reify"].includes(e.toLowerCase())}looksLikePyretExpression(e){let t=e.trim();return!!this.isPrimitiveExpression(t)||t.includes("(")&&t.includes(")")||t.includes("[")&&t.includes("]")||t.includes("table:")||t.includes("row:")}isPrimitiveExpression(e){let t=e.trim();return/^\d+(\.\d+)?$/.test(t)||/^['"`].*['"`]$/.test(t)||"true"===t||"false"===t}handlePrimitiveAssignment(e,t,n){let r,a,i=t.trim();if(/^\d+(\.\d+)?$/.test(i))r=i.includes(".")?parseFloat(i):parseInt(i),a="Number";else if(/^['"`](.*)['"`]$/.test(i))r=i.slice(1,-1),a="String";else{if("true"!==i&&"false"!==i)return{success:!1,message:`Cannot parse primitive value: ${t}`};r="true"===i,a="Boolean"}let o={id:e,label:String(r),type:a};return n.addAtom(o),{success:!0,message:`[${e}] Assigned ${e} = ${r} (${a})`,action:"add"}}async handleComplexAssignment(e,t,n){if(!this.evaluator)throw new Error("External evaluator not available");try{let r=await this.evaluator.run(t);if(!this.evaluator.runtime.isSuccessResult(r))return{success:!1,message:`Failed to evaluate expression '${t}': ${this.formatError(r.exn)}`};let a=await Vl.fromExpression(t,!1,this.evaluator);if(0===a.getAtoms().length)return{success:!1,message:`Expression '${t}' did not produce any data structures`};let i=a.getAtoms(),o=i[0],l={id:e,label:o.label,type:o.type};return n.addAtom(l),(i.length>1||a.getRelations().length>0)&&await this.mergeInstanceWithIdMapping(a,n,o.id,e),{success:!0,message:`[${e}] Assigned ${e} = ${t}\nAdded ${i.length} atoms and ${a.getRelations().reduce(((e,t)=>e+t.tuples.length),0)} relation tuples`,action:"add"}}catch(e){return{success:!1,message:`Failed to evaluate and assign '${t}': ${e instanceof Error?e.message:"Unknown error"}`}}}async mergeInstanceWithIdMapping(e,t,n,r){let a=new Map;a.set(n,r);for(let r of e.getAtoms()){if(r.id===n)continue;let e=r.id,i=new Set(t.getAtoms().map((e=>e.id))),o=1;for(;i.has(e);)e=`${r.id}_${o}`,o++;a.set(r.id,e);let l={id:e,label:r.label,type:r.type};t.addAtom(l)}for(let n of e.getRelations())for(let e of n.tuples){let r=e.atoms.map((e=>a.get(e)||e));t.addRelationTuple(n.name,{atoms:r})}}formatError(e){return String(e&&"object"==typeof e&&"message"in e?e.message:e)}getHelp(){let e=["ID Allocation Commands (Pyret-style):"," id = expression - Assign specific ID to expression result","","Primitive Examples:",' x = 1 - Assign ID "x" to number 1',' name = "Alice" - Assign ID "name" to string "Alice"',' flag = true - Assign ID "flag" to boolean true'];return this.evaluator?e.push("","Complex Examples (with external evaluator):",' node = Black(1, 2) - Assign ID "node" to constructor result',' mylist = [list: 1, 2, 3] - Assign ID "mylist" to list',' tree = node(1, empty, empty) - Assign ID "tree" to tree structure'):e.push("","Note: Complex expressions require external Pyret evaluator"," Only primitive values (numbers, strings, booleans) are supported"),e}}(r);return[{id:"unified",title:r?"Full Pyret REPL":"Enhanced REPL",description:r?"Supports ID allocation (x=1), expression evaluation, and enhanced remove commands":"Supports ID allocation (x=1), enhanced remove commands, and basic operations",parsers:[new Fl,new Ul,t,new Ml,e,new ql].filter((e=>!(e instanceof Ql&&!r))).sort(((e,t)=>t.getPriority()-e.getPriority())),placeholder:'x = 1\nalice = "Alice"\nremove alice.friend\nlist-ids'}]}),[r]);return(0,zl.useEffect)((()=>{e&&e!==i&&o(e)}),[e]),(0,Kl.jsx)(Yl,{instance:i,onChange:e=>{e instanceof Vl&&(o(e),t?.(e))},onCndSpecExtracted:n,terminals:l,...a})},Zl=c(f()),Jl=c(x()),es=({instance:e,onChange:t,initialCndSpec:n="",showLayoutInterface:r=!0,style:a,replHeight:i="300px",visualizationHeight:o="400px"})=>{let[l,s]=(0,Zl.useState)(e),[u,c]=(0,Zl.useState)(n);(0,Zl.useEffect)((()=>{s(e)}),[e]);let d={display:"flex",flexDirection:"column",height:"100%",backgroundColor:"#f8f9fa",border:"1px solid #dee2e6",borderRadius:"8px",overflow:"hidden",...a},f={padding:"16px",borderBottom:"1px solid #dee2e6"},p={margin:"0 0 12px 0",fontSize:"14px",fontWeight:"bold",color:"#495057"};return(0,Jl.jsxs)("div",{style:d,children:[(0,Jl.jsxs)("div",{style:{...f,height:i,minHeight:"250px"},children:[(0,Jl.jsx)("h3",{style:p,children:"Command Interface"}),(0,Jl.jsx)("div",{style:{height:`calc(${i} - 40px)`},children:(0,Jl.jsx)(Yl,{instance:l,onChange:e=>{s(e),t?.(e)}})})]}),r&&(0,Jl.jsxs)("div",{style:{...f,height:"200px",minHeight:"150px"},children:[(0,Jl.jsx)("h3",{style:p,children:"Layout Specification"}),(0,Jl.jsx)("div",{style:{height:"calc(200px - 40px)"},children:(0,Jl.jsx)(ol,{instance:l,value:u,onChange:e=>{c(e)}})})]}),(0,Jl.jsxs)("div",{style:{...f,height:o,minHeight:"300px",borderBottom:"none",flex:1},children:[(0,Jl.jsx)("h3",{style:p,children:"Visualization"}),(0,Jl.jsx)("div",{style:{height:`calc(${o} - 40px)`,backgroundColor:"white",border:"1px solid #ccc",borderRadius:"4px",display:"flex",alignItems:"center",justifyContent:"center",color:"#6c757d"},children:(0,Jl.jsxs)("div",{style:{textAlign:"center"},children:[(0,Jl.jsx)("div",{style:{fontSize:"48px",marginBottom:"16px"},children:"📊"}),(0,Jl.jsx)("div",{children:"Visualization area ready for webcola-cnd-graph integration"}),(0,Jl.jsxs)("div",{style:{marginTop:"8px",fontSize:"12px"},children:["Current data: ",l.getAtoms().length," atoms, ",l.getRelations().length," relations"]}),u&&(0,Jl.jsxs)("div",{style:{marginTop:"8px",fontSize:"12px",color:"#28a745"},children:["CND spec: ",u.length," characters"]})]})})]})]})},ts=c(f()),ns=c(x()),rs=({evaluator:e,instanceNumber:t})=>{let[n,r]=ts.default.useState(""),[a,i]=ts.default.useState([]);return ts.default.useEffect((()=>{r(""),i([])}),[e,t]),(0,ns.jsxs)("div",{id:"evaluator-repl-container",children:[(0,ns.jsx)("input",{className:"code-input",id:"evaluator-input",type:"text",placeholder:"Enter expression to evaluate...",value:n,onChange:e=>r(e.target.value),onKeyDown:a=>{if("Enter"===a.key){a.preventDefault();let o=e.evaluate(n,{instanceIndex:t});i((e=>[[n,o.prettyPrint()],...e])),r("")}}}),(0,ns.jsx)("div",{id:"repl-output",children:a.map((([e,t],n)=>(0,ns.jsxs)(ts.default.Fragment,{children:[(0,ns.jsx)("p",{className:"repl-output-line",children:`> ${e}`}),(0,ns.jsx)("p",{className:"repl-output-line",children:t})]},n)))})]})},as=c(f()),is=c(x()),os=({graphElementId:e})=>{let[t,n]=(0,as.useState)([]),[r,a]=(0,as.useState)(!0),i=(0,as.useRef)(null);return(0,as.useEffect)((()=>{let t=document.getElementById(e);if(i.current=t,!i.current)return void console.warn(`RelationHighlighter: Element with id "${e}" not found`);let r=e=>{let t=e,{relations:r}=t.detail;n(r||[])};return i.current.addEventListener("relations-available",r),()=>{i.current&&i.current.removeEventListener("relations-available",r)}}),[e]),(0,is.jsxs)("div",{className:"relation-highlighter",children:[(0,is.jsxs)("div",{className:"relation-highlighter-header",onClick:()=>{a((e=>!e))},children:[(0,is.jsxs)("h3",{className:"relation-highlighter-title",children:["Relations (",t.length,")"]}),(0,is.jsx)("button",{className:"collapse-toggle "+(r?"collapsed":""),"aria-label":r?"Expand relations":"Collapse relations",children:"▼"})]}),(0,is.jsx)("div",{className:"relation-highlighter-content "+(r?"collapsed":""),children:0===t.length?(0,is.jsx)("p",{className:"no-relations",children:"No relations available"}):(0,is.jsx)("ul",{className:"relation-list",children:t.map((e=>(0,is.jsx)("li",{className:"relation-item",onMouseEnter:t=>((e,t)=>{let n=e.currentTarget.parentElement;if(!n)return;let r=n.getBoundingClientRect(),a=e.clientX-r.left,o=e.clientY-r.top;a>=0&&a<=n.clientWidth&&o>=0&&o<=n.clientHeight&&i.current&&"function"==typeof i.current.highlightRelation&&i.current.highlightRelation(t)})(t,e),onMouseLeave:()=>(e=>{i.current&&"function"==typeof i.current.clearHighlightRelation&&i.current.clearHighlightRelation(e)})(e),children:e},e)))})})]})},ls=c(x()),ss=({projectionData:e,onProjectionChange:t,className:n="",disabled:r=!1})=>e&&0!==e.length?(0,ls.jsxs)("div",{className:`projection-controls ${n}`,role:"region","aria-label":"Projection Controls",children:[(0,ls.jsxs)("div",{className:"projection-controls__header",children:[(0,ls.jsx)("h3",{className:"projection-controls__title",children:"Projections"}),(0,ls.jsx)("p",{className:"projection-controls__description",children:"Select which atom to project for each type"})]}),(0,ls.jsx)("div",{className:"projection-controls__list",children:e.map((e=>(0,ls.jsxs)("div",{className:"projection-controls__item",children:[(0,ls.jsx)("label",{htmlFor:`projection-${e.type}`,className:"projection-controls__label",children:e.type}),(0,ls.jsx)("select",{id:`projection-${e.type}`,className:"projection-controls__select",value:e.projectedAtom,onChange:n=>t(e.type,n.target.value),disabled:r||0===e.atoms.length,"aria-label":`Select atom to project for ${e.type}`,children:0===e.atoms.length?(0,ls.jsx)("option",{value:"",children:"No atoms available"}):e.atoms.map((e=>(0,ls.jsx)("option",{value:e,children:e},e)))})]},e.type)))})]}):null,us=c(x()),cs=class e{constructor(){this.constraints=[],this.directives=[],this.yamlValue="",this.isNoCodeView=!1}static getInstance(){return e.instance||(e.instance=new e),e.instance}initializeWithConfig(e){void 0!==e.initialYamlValue&&(this.yamlValue=e.initialYamlValue),void 0!==e.initialIsNoCodeView&&(this.isNoCodeView=e.initialIsNoCodeView),void 0!==e.initialConstraints&&(this.constraints=[...e.initialConstraints]),void 0!==e.initialDirectives&&(this.directives=[...e.initialDirectives])}setConstraints(e){this.constraints=e}setDirectives(e){this.directives=e}setYamlValue(e){this.yamlValue=e}setIsNoCodeView(e){this.isNoCodeView=e}getIsNoCodeView(){return this.isNoCodeView}getConstraints(){return[...this.constraints]}getDirectives(){return[...this.directives]}getYamlValue(){return this.yamlValue}generateCurrentYamlSpec(){try{return Mo(this.constraints,this.directives)}catch(e){return console.error("Failed to generate YAML spec from state:",e),""}}getCurrentCndSpec(){return this.isNoCodeView?this.generateCurrentYamlSpec().trim():this.yamlValue.trim()}},ds=class e{constructor(){this.instanceChangeCallbacks=[],this.currentInstance=new Il({types:{univ:{_:"type",id:"univ",types:[],atoms:[],meta:{builtin:!0,abstract:!1,enum:!1,one:!1,private:!1}},Int:{_:"type",id:"Int",types:["Int","univ"],atoms:[],meta:{builtin:!0,abstract:!1,enum:!1,one:!1,private:!1}},"seq/Int":{_:"type",id:"seq/Int",types:["seq/Int","univ"],atoms:[],meta:{builtin:!0,abstract:!1,enum:!1,one:!1,private:!1}}},relations:{},skolems:{}})}static getInstance(){return e.instance||(e.instance=new e),e.instance}getCurrentInstance(){return this.currentInstance}setCurrentInstance(e){this.currentInstance=e,this.notifyInstanceChange()}onInstanceChange(e){this.instanceChangeCallbacks.push(e)}notifyInstanceChange(){this.instanceChangeCallbacks.forEach((e=>{try{e(this.currentInstance)}catch(e){console.error("Error in instance change callback:",e)}}))}},fs=class e{constructor(){this.externalEvaluator=null,this.instanceChangeCallbacks=[],this.currentInstance=new Vl}static getInstance(){return e.instance||(e.instance=new e),e.instance}getCurrentInstance(){return this.currentInstance}setCurrentInstance(e){this.currentInstance=e,this.notifyInstanceChange()}getExternalEvaluator(){return this.externalEvaluator}setExternalEvaluator(e){this.externalEvaluator=e}onInstanceChange(e){this.instanceChangeCallbacks.push(e)}notifyInstanceChange(){this.instanceChangeCallbacks.forEach((e=>{try{e(this.currentInstance)}catch(e){console.error("Error in Pyret instance change callback:",e)}}))}reifyCurrentInstance(){try{return this.currentInstance.reify()}catch(e){return console.error("Error reifying current instance:",e),"/* Error generating Pyret notation */"}}},ps=new class{constructor(){this.currentError=null,this.errorCallbacks=[]}setError(e){this.currentError=e,this.notifyCallbacks()}clearError(){this.currentError=null,this.notifyCallbacks()}getCurrentError(){return this.currentError}onErrorChange(e){this.errorCallbacks.push(e)}hasError(){return null!==this.currentError}notifyCallbacks(){this.errorCallbacks.forEach((e=>e(this.currentError)))}},hs=({config:e})=>{let t=(0,wr.useMemo)((()=>cs.getInstance()),[]),[n,r]=(0,wr.useState)((()=>void 0!==e?.initialYamlValue?e.initialYamlValue:t.getYamlValue())),[a,i]=(0,wr.useState)((()=>void 0!==e?.initialIsNoCodeView?e.initialIsNoCodeView:t.getIsNoCodeView())),[o,l]=(0,wr.useState)((()=>void 0!==e?.initialConstraints?[...e.initialConstraints]:t.getConstraints())),[s,u]=(0,wr.useState)((()=>void 0!==e?.initialDirectives?[...e.initialDirectives]:t.getDirectives()));(0,wr.useEffect)((()=>{e&&t.initializeWithConfig(e)}),[e,t]),(0,wr.useEffect)((()=>{t.setConstraints(o)}),[o,t]),(0,wr.useEffect)((()=>{t.setDirectives(s)}),[s,t]),(0,wr.useEffect)((()=>{t.setYamlValue(n)}),[n,t]),(0,wr.useEffect)((()=>{t.setIsNoCodeView(a)}),[a,t]);let c=(0,wr.useCallback)((e=>{r(e),window.dispatchEvent(new CustomEvent("cnd-spec-changed",{detail:e}))}),[]),d=(0,wr.useCallback)((e=>{i(e),console.log(`Switched to ${e?"No Code":"Code"} View`)}),[]),f=(0,wr.useCallback)((e=>{l(e)}),[]),p=(0,wr.useCallback)((e=>{u(e)}),[]);return(0,us.jsx)(ol,{yamlValue:n,onChange:c,isNoCodeView:a,onViewChange:d,constraints:o,setConstraints:f,directives:s,setDirectives:p,"aria-label":"CND Layout Specification Editor"})},ms=()=>{let[e,t]=(0,wr.useState)((()=>ds.getInstance().getCurrentInstance()));(0,wr.useEffect)((()=>{ds.getInstance().onInstanceChange((e=>{t(e)})),window.currentInstance=e,window.updateFromBuilder&&window.updateFromBuilder()}),[e]);let n=(0,wr.useCallback)((e=>{t(e),ds.getInstance().setCurrentInstance(e),window.currentInstance=e,window.updateFromBuilder&&window.updateFromBuilder(),window.autoRenderGraph&&setTimeout((()=>window.autoRenderGraph()),50)}),[]);return(0,us.jsx)(cl,{instance:e,onChange:n,className:"cnd-integrated-builder"})},gs=({config:e})=>{let[t,n]=(0,wr.useState)((()=>e?.initialInstance?e.initialInstance:fs.getInstance().getCurrentInstance())),[r,a]=(0,wr.useState)((()=>e?.externalEvaluator?e.externalEvaluator:fs.getInstance().getExternalEvaluator()));(0,wr.useEffect)((()=>{let r=fs.getInstance();return e?.initialInstance&&r.setCurrentInstance(e.initialInstance),e?.externalEvaluator&&r.setExternalEvaluator(e.externalEvaluator),r.onInstanceChange((e=>{n(e)})),window.currentPyretInstance=t,()=>{}}),[e,t]);let i=(0,wr.useCallback)((e=>{e instanceof Vl&&(n(e),fs.getInstance().setCurrentInstance(e),window.currentPyretInstance=e,window.dispatchEvent(new CustomEvent("pyret-instance-changed",{detail:{instance:e}})))}),[]);return(0,us.jsx)(Xl,{initialInstance:t,onChange:i,externalEvaluator:r||void 0,disabled:e?.disabled,className:e?.className})},ys=({config:e})=>{let[t,n]=(0,wr.useState)((()=>e?.initialInstance?e.initialInstance:ds.getInstance().getCurrentInstance()));(0,wr.useEffect)((()=>{let r=ds.getInstance();e?.initialInstance&&r.setCurrentInstance(e.initialInstance),r.onInstanceChange((e=>{n(e)})),window.currentVisualizationInstance=t}),[e,t]);let r=(0,wr.useCallback)((e=>{n(e),ds.getInstance().setCurrentInstance(e),window.currentVisualizationInstance=e,window.autoRenderGraph&&setTimeout((()=>window.autoRenderGraph()),50),window.dispatchEvent(new CustomEvent("repl-visualization-changed",{detail:{instance:e}}))}),[]);return(0,us.jsx)(es,{instance:t,onChange:r,initialCndSpec:e?.initialCndSpec,showLayoutInterface:e?.showLayoutInterface,replHeight:e?.replHeight,visualizationHeight:e?.visualizationHeight,style:e?.style})};function vs(e="webcola-cnd-container",t){let n=document.getElementById(e);if(!n)return console.error(`CnD Layout Interface: Container '${e}' not found`),!1;if(t?.initialYamlValue&&(t.initialYamlValue,0))return console.error("Invalid YAML value provided in configuration"),!1;try{return(0,kr.createRoot)(n).render((0,us.jsx)(hs,{config:t})),t?console.log(`CnD Layout Interface mounted to #${e} with initial config:`,{yamlValue:t.initialYamlValue?`${t.initialYamlValue.length} characters`:"none",isNoCodeView:t.initialIsNoCodeView??"default",constraints:t.initialConstraints?.length??0,directives:t.initialDirectives?.length??0}):console.log(`CnD Layout Interface mounted to #${e}`),!0}catch(e){return console.error("Failed to mount CnD Layout Interface:",e),!1}}function bs(e="instance-builder-container"){let t=document.getElementById(e);if(!t)return console.error(`Instance Builder: Container '${e}' not found`),!1;try{return(0,kr.createRoot)(t).render((0,us.jsx)(ms,{})),console.log(`Instance Builder mounted to #${e}`),window.updateBuilderInstance=e=>{ds.getInstance().setCurrentInstance(e)},!0}catch(e){return console.error("Failed to mount Instance Builder:",e),!1}}function xs(){try{return ds.getInstance().getCurrentInstance()}catch(e){return void console.error("Error accessing InstanceBuilder instance:",e)}}function ws(){try{let e=cs.getInstance().generateCurrentYamlSpec();if(e.trim())return e;let t=document.querySelector("#webcola-cnd-container textarea");if(t&&t instanceof HTMLTextAreaElement)return t.value.trim();console.warn("CndLayoutInterface textarea not found")}catch(e){console.error("Error accessing CndLayoutInterface instance:",e)}}function ks(e="pyret-repl-container",t){let n=document.getElementById(e);if(!n)return console.error(`Pyret REPL: Container '${e}' not found`),!1;try{return(0,kr.createRoot)(n).render((0,us.jsx)(gs,{config:t})),t?console.log(`Pyret REPL mounted to #${e} with config:`,{hasInitialInstance:!!t.initialInstance,hasExternalEvaluator:!!t.externalEvaluator,disabled:t.disabled??!1,className:t.className??"default"}):console.log(`Pyret REPL mounted to #${e}`),window.getCurrentPyretInstance=()=>fs.getInstance().getCurrentInstance(),window.reifyCurrentPyretInstance=()=>fs.getInstance().reifyCurrentInstance(),window.updatePyretInstance=e=>{fs.getInstance().setCurrentInstance(e)},!0}catch(e){return console.error("Failed to mount Pyret REPL:",e),!1}}function Cs(e="repl-visualization-container",t){let n=document.getElementById(e);if(!n)return console.error(`REPL with Visualization: Container '${e}' not found`),!1;try{return(0,kr.createRoot)(n).render((0,us.jsx)(ys,{config:t})),t?console.log(`REPL with Visualization mounted to #${e} with config:`,{hasInitialInstance:!!t.initialInstance,initialCndSpec:t.initialCndSpec?`${t.initialCndSpec.length} characters`:"none",showLayoutInterface:t.showLayoutInterface??!0,replHeight:t.replHeight??"300px",visualizationHeight:t.visualizationHeight??"400px"}):console.log(`REPL with Visualization mounted to #${e}`),!0}catch(e){return console.error("Failed to mount REPL with Visualization:",e),!1}}function js(e="error-messages"){let t=document.getElementById(e);if(!t)return console.error(`Error Modal: Container '${e}' not found`),!1;try{return(0,kr.createRoot)(t).render((0,us.jsx)($l,{errorManager:ps})),console.log(`Error Modal mounted to #${e}`),!0}catch(e){return console.error("Failed to mount Error Modal:",e),!1}}function Ss(e,t,n){let r=document.getElementById(e);if(!r)return console.error(`Evaluator REPL: Container '${e}' not found`),!1;if(!t)return console.error("Evaluator REPL: No evaluator provided"),!1;try{return(0,kr.createRoot)(r).render((0,us.jsx)(rs,{evaluator:t,instanceNumber:n})),console.log(`Evaluator REPL mounted to #${e}`),!0}catch(e){return console.error("Failed to mount Evaluator REPL:",e),!1}}function Es(e,t){let n=document.getElementById(e);if(!n)return console.error(`Relation Highlighter: Container '${e}' not found`),!1;try{return(0,kr.createRoot)(n).render((0,us.jsx)(os,{graphElementId:t})),console.log(`Relation Highlighter mounted to #${e}`),!0}catch(e){return console.error("Failed to mount Relation Highlighter:",e),!1}}function _s(){console.log("Mounting all CnD components...");let e={layoutInterface:vs(),instanceBuilder:bs(),errorModal:js()},t=Object.values(e).filter(Boolean).length;return console.log(`Successfully mounted ${t}/3 CnD components`),e}function Ns(){console.log("Mounting all CnD components with Pyret REPL...");let e={layoutInterface:vs(),instanceBuilder:bs(),errorModal:js(),pyretRepl:ks(),replWithVisualization:Cs()},t=Object.values(e).filter(Boolean).length;return console.log(`Successfully mounted ${t}/5 CnD components with Pyret integration`),e}var As={showParseError:(e,t)=>{ps.setError({type:"parse-error",message:e,source:t})},showGroupOverlapError:(e,t)=>{ps.setError({type:"group-overlap-error",message:e,source:t})},showConstraintError:e=>{ps.setError({type:"positional-error",messages:e})},showGeneralError:e=>{ps.setError({type:"general-error",message:e})},clearAllErrors:()=>{ps.clearError()},hasActiveErrors:()=>ps.hasError()},Is=class e{constructor(){this.projectionData=[],this.onChangeCallback=null,this.updateCallback=null}static getInstance(){return e.instance||(e.instance=new e),e.instance}setProjectionData(e){this.projectionData=e,this.updateCallback&&this.updateCallback()}getProjectionData(){return this.projectionData}setOnChangeCallback(e){this.onChangeCallback=e}setUpdateCallback(e){this.updateCallback=e}handleProjectionChange(e,t){this.onChangeCallback&&this.onChangeCallback(e,t)}};function Ps(){let[e,t]=(0,wr.useState)([]);(0,wr.useEffect)((()=>{let e=Is.getInstance();t(e.getProjectionData()),e.setUpdateCallback((()=>{let n=e.getProjectionData();console.log("ProjectionControlsWrapper: Updating with new data:",n),t([...n])}))}),[]);let n=(0,wr.useCallback)(((e,n)=>{console.log(`ProjectionControlsWrapper: Selection changed - ${e} -> ${n}`),t((t=>t.map((t=>t.type===e?(console.log(`ProjectionControlsWrapper: Updating ${e} from ${t.projectedAtom} to ${n}`),{...t,projectedAtom:n}):t)))),Is.getInstance().handleProjectionChange(e,n)}),[]);return e&&0!==e.length?(0,us.jsx)(ss,{projectionData:e,onProjectionChange:n}):null}function Ts(e="projection-controls-container",t){let n=document.getElementById(e);if(!n)return console.error(`Projection Controls: Container '${e}' not found`),!1;try{let r=Is.getInstance();return t&&r.setOnChangeCallback(t),(0,kr.createRoot)(n).render((0,us.jsx)(Ps,{})),console.log(`Projection Controls mounted to #${e}`),!0}catch(e){return console.error("Failed to mount Projection Controls:",e),!1}}function Ls(e){Is.getInstance().setProjectionData(e)}var Os={getCurrentCndSpec:()=>{try{let e=cs.getInstance().getCurrentCndSpec();if(e.trim())return e;let t=document.querySelector("#webcola-cnd-container textarea");return t instanceof HTMLTextAreaElement?t.value.trim():void console.warn("CndLayoutInterface not found or empty")}catch(e){return void console.error("Error accessing CND specification:",e)}},getCurrentInstance:()=>{try{return ds.getInstance().getCurrentInstance()}catch(e){return void console.error("Error accessing current instance:",e)}},updateInstance:e=>{try{ds.getInstance().setCurrentInstance(e)}catch(e){console.error("Error updating instance:",e)}},getCurrentPyretInstance:()=>{try{return fs.getInstance().getCurrentInstance()}catch(e){return void console.error("Error accessing current Pyret instance:",e)}},updatePyretInstance:e=>{try{fs.getInstance().setCurrentInstance(e)}catch(e){console.error("Error updating Pyret instance:",e)}},reifyCurrentPyretInstance:()=>{try{return fs.getInstance().reifyCurrentInstance()}catch(e){return console.error("Error reifying current Pyret instance:",e),"/* Error generating Pyret notation */"}},setExternalPyretEvaluator:e=>{try{fs.getInstance().setExternalEvaluator(e)}catch(e){console.error("Error setting external Pyret evaluator:",e)}},getExternalPyretEvaluator:()=>{try{return fs.getInstance().getExternalEvaluator()}catch(e){return console.error("Error getting external Pyret evaluator:",e),null}}},Ds={mountCndLayoutInterface:vs,mountInstanceBuilder:bs,mountErrorMessageModal:js,mountAllComponents:_s,mountEvaluatorRepl:Ss,mountRelationHighlighter:Es,mountProjectionControls:Ts,mountPyretRepl:ks,mountReplWithVisualization:Cs,mountAllComponentsWithPyret:Ns,updateProjectionData:Ls,CndLayoutStateManager:cs,InstanceStateManager:ds,PyretReplStateManager:fs,ProjectionStateManager:Is,globalErrorManager:ps,ErrorAPI:As,DataAPI:Os,PyretDataInstance:Vl};return typeof window<"u"&&(window.CnDCore=Ds,window.mountCndLayoutInterface=vs,window.mountInstanceBuilder=bs,window.mountErrorMessageModal=js,window.mountIntegratedComponents=_s,window.mountEvaluatorRepl=Ss,window.mountRelationHighlighter=Es,window.mountProjectionControls=Ts,window.updateProjectionData=Ls,window.mountPyretRepl=ks,window.mountReplWithVisualization=Cs,window.mountAllComponentsWithPyret=Ns,window.getCurrentCNDSpecFromReact=Os.getCurrentCndSpec,window.getCurrentInstanceFromReact=Os.getCurrentInstance,window.getCurrentPyretInstanceFromReact=Os.getCurrentPyretInstance,window.reifyCurrentPyretInstanceFromReact=Os.reifyCurrentPyretInstance,window.updatePyretInstanceFromReact=Os.updatePyretInstance,window.setExternalPyretEvaluator=Os.setExternalPyretEvaluator,window.getExternalPyretEvaluator=Os.getExternalPyretEvaluator,window.showParseError=As.showParseError,window.showGroupOverlapError=As.showGroupOverlapError,window.showPositionalError=As.showConstraintError,window.showGeneralError=As.showGeneralError,window.clearAllErrors=As.clearAllErrors,console.log("CnD-Core CDN integration ready! Use window.CnDCore to access all features including Pyret REPL.")),(e=>u(n({},"__esModule",{value:!0}),e))(xr)})(); \ No newline at end of file +"use strict";var IntegratedDemo=(()=>{var e,t=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,i=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,l=(e=function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')},typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):e),s=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),u=(e,t,i,l)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let s of a(t))!o.call(e,s)&&s!==i&&n(e,s,{get:()=>t[s],enumerable:!(l=r(t,s))||l.enumerable});return e},c=(e,r,a)=>(a=null!=e?t(i(e)):{},u(!r&&e&&e.__esModule?a:n(a,"default",{value:e,enumerable:!0}),e)),d=s((e=>{var t=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),l=Symbol.for("react.context"),s=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),c=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),f=Symbol.iterator,p={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h=Object.assign,m={};function g(e,t,n){this.props=e,this.context=t,this.refs=m,this.updater=n||p}function y(){}function v(e,t,n){this.props=e,this.context=t,this.refs=m,this.updater=n||p}g.prototype.isReactComponent={},g.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},g.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},y.prototype=g.prototype;var b=v.prototype=new y;b.constructor=v,h(b,g.prototype),b.isPureReactComponent=!0;var x=Array.isArray,w={H:null,A:null,T:null,S:null,V:null},k=Object.prototype.hasOwnProperty;function C(e,n,r,a,i,o){return r=o.ref,{$$typeof:t,type:e,key:n,ref:void 0!==r?r:null,props:o}}function j(e){return"object"==typeof e&&null!==e&&e.$$typeof===t}var S=/\/+/g;function E(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,(function(e){return t[e]}))}(""+e.key):t.toString(36)}function _(){}function N(e,r,a,i,o){var l=typeof e;("undefined"===l||"boolean"===l)&&(e=null);var s=!1;if(null===e)s=!0;else switch(l){case"bigint":case"string":case"number":s=!0;break;case"object":switch(e.$$typeof){case t:case n:s=!0;break;case d:return N((s=e._init)(e._payload),r,a,i,o)}}if(s)return o=o(e),s=""===i?"."+E(e,0):i,x(o)?(a="",null!=s&&(a=s.replace(S,"$&/")+"/"),N(o,r,a,"",(function(e){return e}))):null!=o&&(j(o)&&(o=function(e,t){return C(e.type,t,void 0,0,0,e.props)}(o,a+(null==o.key||e&&e.key===o.key?"":(""+o.key).replace(S,"$&/")+"/")+s)),r.push(o)),1;s=0;var u=""===i?".":i+":";if(x(e))for(var c=0;c{t.exports=d()})),p=s((e=>{function t(e,t){var n=e.length;e.push(t);e:for(;0>>1,i=e[r];if(!(0>>1;ra(s,n))ua(c,s)?(e[r]=c,e[u]=n,r=u):(e[r]=s,e[l]=n,r=l);else{if(!(ua(c,n)))break e;e[r]=c,e[u]=n,r=u}}}return t}function a(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}e.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now?(i=performance,e.unstable_now=function(){return i.now()}):(o=Date,l=o.now(),e.unstable_now=function(){return o.now()-l});var i,o,l,s=[],u=[],c=1,d=null,f=3,p=!1,h=!1,m=!1,g=!1,y="function"==typeof setTimeout?setTimeout:null,v="function"==typeof clearTimeout?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;function x(e){for(var a=n(u);null!==a;){if(null===a.callback)r(u);else{if(!(a.startTime<=e))break;r(u),a.sortIndex=a.expirationTime,t(s,a)}a=n(u)}}function w(e){if(m=!1,x(e),!h)if(null!==n(s))h=!0,S||(S=!0,k());else{var t=n(u);null!==t&&P(w,t.startTime-e)}}var k,C,j,S=!1,E=-1,_=5,N=-1;function A(){return!(!g&&e.unstable_now()-N<_)}function I(){if(g=!1,S){var t=e.unstable_now();N=t;var a=!0;try{e:{h=!1,m&&(m=!1,v(E),E=-1),p=!0;var i=f;try{t:{for(x(t),d=n(s);null!==d&&!(d.expirationTime>t&&A());){var o=d.callback;if("function"==typeof o){d.callback=null,f=d.priorityLevel;var l=o(d.expirationTime<=t);if(t=e.unstable_now(),"function"==typeof l){d.callback=l,x(t),a=!0;break t}d===n(s)&&r(s),x(t)}else r(s);d=n(s)}if(null!==d)a=!0;else{var c=n(u);null!==c&&P(w,c.startTime-t),a=!1}}break e}finally{d=null,f=i,p=!1}a=void 0}}finally{a?k():S=!1}}}function P(t,n){E=y((function(){t(e.unstable_now())}),n)}"function"==typeof b?k=function(){b(I)}:typeof MessageChannel<"u"?(C=new MessageChannel,j=C.port2,C.port1.onmessage=I,k=function(){j.postMessage(null)}):k=function(){y(I,0)},e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125o?(r.sortIndex=i,t(u,r),null===n(s)&&r===n(u)&&(m?(v(E),E=-1):m=!0,P(w,i-o))):(r.sortIndex=l,t(s,r),h||p||(h=!0,S||(S=!0,k()))),r},e.unstable_shouldYield=A,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),h=s(((e,t)=>{t.exports=p()})),m=s((e=>{var t=f();function n(e){var t="https://react.dev/errors/"+e;if(1{(function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||"function"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}})(),t.exports=m()})),y=s((e=>{var t=h(),n=f(),r=g();function a(e){var t="https://react.dev/errors/"+e;if(1F||(e.current=R[F],R[F]=null,F--)}function B(e,t){F++,R[F]=e.current,e.current=t}var H=M(null),V=M(null),q=M(null),W=M(null);function G(e,t){switch(B(q,t),B(V,e),B(H,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?ld(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)e=sd(t=ld(t),e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}U(H),B(H,e)}function Y(){U(H),U(V),U(q)}function Q(e){null!==e.memoizedState&&B(W,e);var t=H.current,n=sd(t,e.type);t!==n&&(B(V,e),B(H,n))}function K(e){V.current===e&&(U(H),U(V)),W.current===e&&(U(W),Xd._currentValue=z)}var X=Object.prototype.hasOwnProperty,Z=t.unstable_scheduleCallback,J=t.unstable_cancelCallback,ee=t.unstable_shouldYield,te=t.unstable_requestPaint,ne=t.unstable_now,re=t.unstable_getCurrentPriorityLevel,ae=t.unstable_ImmediatePriority,ie=t.unstable_UserBlockingPriority,oe=t.unstable_NormalPriority,le=t.unstable_LowPriority,se=t.unstable_IdlePriority,ue=t.log,ce=t.unstable_setDisableYieldValue,de=null,fe=null;function pe(e){if("function"==typeof ue&&ce(e),fe&&"function"==typeof fe.setStrictMode)try{fe.setStrictMode(de,e)}catch{}}var he=Math.clz32?Math.clz32:function(e){return 0==(e>>>=0)?32:31-(me(e)/ge|0)|0},me=Math.log,ge=Math.LN2,ye=256,ve=4194304;function be(e){var t=42&e;if(0!==t)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return 4194048&e;case 4194304:case 8388608:case 16777216:case 33554432:return 62914560&e;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function xe(e,t,n){var r=e.pendingLanes;if(0===r)return 0;var a=0,i=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var l=134217727&r;return 0!==l?0!=(r=l&~i)?a=be(r):0!=(o&=l)?a=be(o):n||0!=(n=l&~e)&&(a=be(n)):0!=(l=r&~i)?a=be(l):0!==o?a=be(o):n||0!=(n=r&~e)&&(a=be(n)),0===a?0:0!==t&&t!==a&&0==(t&i)&&((i=a&-a)>=(n=t&-t)||32===i&&0!=(4194048&n))?t:a}function we(e,t){return 0==(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)}function ke(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;default:return-1}}function Ce(){var e=ye;return 0==(4194048&(ye<<=1))&&(ye=256),e}function je(){var e=ve;return 0==(62914560&(ve<<=1))&&(ve=4194304),e}function Se(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ee(e,t){e.pendingLanes|=t,268435456!==t&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function _e(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-he(t);e.entangledLanes|=t,e.entanglements[r]=1073741824|e.entanglements[r]|4194090&n}function Ne(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-he(n),a=1<)":-1--a||s[r]!==u[a]){var c="\n"+s[r].replace(" at new "," at ");return e.displayName&&c.includes("")&&(c=c.replace("",e.displayName)),c}}while(1<=r&&0<=a);break}}}finally{ot=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?it(n):""}function st(e){switch(e.tag){case 26:case 27:case 5:return it(e.type);case 16:return it("Lazy");case 13:return it("Suspense");case 19:return it("SuspenseList");case 0:case 15:return lt(e.type,!1);case 11:return lt(e.type.render,!1);case 1:return lt(e.type,!0);case 31:return it("Activity");default:return""}}function ut(e){try{var t="";do{t+=st(e),e=e.return}while(e);return t}catch(e){return"\nError generating stack: "+e.message+"\n"+e.stack}}function ct(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":case"object":return e;default:return""}}function dt(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function ft(e){e._valueTracker||(e._valueTracker=function(e){var t=dt(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&"function"==typeof n.get&&"function"==typeof n.set){var a=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(e){r=""+e,i.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function pt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=dt(e)?e.checked?"true":"false":e.value),(e=r)!==n&&(t.setValue(e),!0)}function ht(e){if(typeof(e=e||(typeof document<"u"?document:void 0))>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var mt=/[\n"\\]/g;function gt(e){return e.replace(mt,(function(e){return"\\"+e.charCodeAt(0).toString(16)+" "}))}function yt(e,t,n,r,a,i,o,l){e.name="",null!=o&&"function"!=typeof o&&"symbol"!=typeof o&&"boolean"!=typeof o?e.type=o:e.removeAttribute("type"),null!=t?"number"===o?(0===t&&""===e.value||e.value!=t)&&(e.value=""+ct(t)):e.value!==""+ct(t)&&(e.value=""+ct(t)):"submit"!==o&&"reset"!==o||e.removeAttribute("value"),null!=t?bt(e,o,ct(t)):null!=n?bt(e,o,ct(n)):null!=r&&e.removeAttribute("value"),null==a&&null!=i&&(e.defaultChecked=!!i),null!=a&&(e.checked=a&&"function"!=typeof a&&"symbol"!=typeof a),null!=l&&"function"!=typeof l&&"symbol"!=typeof l&&"boolean"!=typeof l?e.name=""+ct(l):e.removeAttribute("name")}function vt(e,t,n,r,a,i,o,l){if(null!=i&&"function"!=typeof i&&"symbol"!=typeof i&&"boolean"!=typeof i&&(e.type=i),null!=t||null!=n){if(("submit"===i||"reset"===i)&&null==t)return;n=null!=n?""+ct(n):"",t=null!=t?""+ct(t):n,l||t===e.value||(e.value=t),e.defaultValue=t}r="function"!=typeof(r=r??a)&&"symbol"!=typeof r&&!!r,e.checked=l?e.checked:!!r,e.defaultChecked=!!r,null!=o&&"function"!=typeof o&&"symbol"!=typeof o&&"boolean"!=typeof o&&(e.name=o)}function bt(e,t,n){"number"===t&&ht(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function xt(e,t,n,r){if(e=e.options,t){t={};for(var a=0;a"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Mt=!1;if(Ft)try{Ut={},Object.defineProperty(Ut,"passive",{get:function(){Mt=!0}}),window.addEventListener("test",Ut,Ut),window.removeEventListener("test",Ut,Ut)}catch{Mt=!1}var Ut,Bt=null,Ht=null,Vt=null;function qt(){if(Vt)return Vt;var e,t,n=Ht,r=n.length,a="value"in Bt?Bt.value:Bt.textContent,i=a.length;for(e=0;e=_n),In=!1;function Pn(e,t){switch(e){case"keyup":return-1!==Sn.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Tn(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var Ln=!1,On={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Dn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!On[e.type]:"textarea"===t}function $n(e,t,n,r){Lt?Ot?Ot.push(r):Ot=[r]:Lt=r,0<(t=Gc(t,"onChange")).length&&(n=new en("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var zn=null,Rn=null;function Fn(e){Fc(e,0)}function Mn(e){if(pt(Ve(e)))return e}function Un(e,t){if("change"===e)return t}var Bn,Hn,Vn,qn=!1;function Wn(){zn&&(zn.detachEvent("onpropertychange",Gn),Rn=zn=null)}function Gn(e){if("value"===e.propertyName&&Mn(Rn)){var t=[];$n(t,Rn,e,Tt(e)),zt(Fn,t)}}function Yn(e,t,n){"focusin"===e?(Wn(),Rn=n,(zn=t).attachEvent("onpropertychange",Gn)):"focusout"===e&&Wn()}function Qn(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return Mn(Rn)}function Kn(e,t){if("click"===e)return Mn(t)}function Xn(e,t){if("input"===e||"change"===e)return Mn(t)}Ft&&(Ft?((Hn="oninput"in document)||((Vn=document.createElement("div")).setAttribute("oninput","return;"),Hn="function"==typeof Vn.oninput),Bn=Hn):Bn=!1,qn=Bn&&(!document.documentMode||9=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=er(r)}}function nr(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?nr(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function rr(e){for(var t=ht((e=null!=e&&null!=e.ownerDocument&&null!=e.ownerDocument.defaultView?e.ownerDocument.defaultView:window).document);t instanceof e.HTMLIFrameElement;){try{var n="string"==typeof t.contentWindow.location.href}catch{n=!1}if(!n)break;t=ht((e=t.contentWindow).document)}return t}function ar(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}var ir=Ft&&"documentMode"in document&&11>=document.documentMode,or=null,lr=null,sr=null,ur=!1;function cr(e,t,n){var r=n.window===n?n.document:9===n.nodeType?n:n.ownerDocument;ur||null==or||or!==ht(r)||(r="selectionStart"in(r=or)&&ar(r)?{start:r.selectionStart,end:r.selectionEnd}:{anchorNode:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset},sr&&Jn(sr,r)||(sr=r,0<(r=Gc(lr,"onSelect")).length&&(t=new en("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=or)))}function dr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var fr={animationend:dr("Animation","AnimationEnd"),animationiteration:dr("Animation","AnimationIteration"),animationstart:dr("Animation","AnimationStart"),transitionrun:dr("Transition","TransitionRun"),transitionstart:dr("Transition","TransitionStart"),transitioncancel:dr("Transition","TransitionCancel"),transitionend:dr("Transition","TransitionEnd")},pr={},hr={};function mr(e){if(pr[e])return pr[e];if(!fr[e])return e;var t,n=fr[e];for(t in n)if(n.hasOwnProperty(t)&&t in hr)return pr[e]=n[t];return e}Ft&&(hr=document.createElement("div").style,"AnimationEvent"in window||(delete fr.animationend.animation,delete fr.animationiteration.animation,delete fr.animationstart.animation),"TransitionEvent"in window||delete fr.transitionend.transition);var gr=mr("animationend"),yr=mr("animationiteration"),vr=mr("animationstart"),br=mr("transitionrun"),xr=mr("transitionstart"),wr=mr("transitioncancel"),kr=mr("transitionend"),Cr=new Map,jr="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Sr(e,t){Cr.set(e,t),Qe(t,[e])}jr.push("scrollEnd");var Er=new WeakMap;function _r(e,t){if("object"==typeof e&&null!==e){var n=Er.get(e);return void 0!==n?n:(t={value:e,source:t,stack:ut(t)},Er.set(e,t),t)}return{value:e,source:t,stack:ut(t)}}var Nr=[],Ar=0,Ir=0;function Pr(){for(var e=Ar,t=Ir=Ar=0;t>=o,a-=o,ea=1<<32-he(t)+a|n<i?i:8;var o=D.T,l={};D.T=l,Vo(e,!1,t,n);try{var s=a(),u=D.S;if(null!==u&&u(l,s),null!==s&&"object"==typeof s&&"function"==typeof s.then){var c=function(e,t){var n=[],r={status:"pending",value:null,reason:null,then:function(e){n.push(e)}};return e.then((function(){r.status="fulfilled",r.value=t;for(var e=0;ep?(m=d,d=null):m=d.sibling;var y=h(a,d,l[p],s);if(null===y){null===d&&(d=m);break}e&&d&&null===y.alternate&&t(a,d),i=o(y,i,p),null===c?u=y:c.sibling=y,c=y,d=m}if(p===l.length)return n(a,d),sa&&na(a,p),u;if(null===d){for(;pm?(y=p,p=null):y=p.sibling;var b=h(i,p,v.value,u);if(null===b){null===p&&(p=y);break}e&&p&&null===b.alternate&&t(i,p),l=o(b,l,m),null===d?c=b:d.sibling=b,d=b,p=y}if(v.done)return n(i,p),sa&&na(i,m),c;if(null===p){for(;!v.done;m++,v=s.next())null!==(v=f(i,v.value,u))&&(l=o(v,l,m),null===d?c=v:d.sibling=v,d=v);return sa&&na(i,m),c}for(p=r(p);!v.done;m++,v=s.next())null!==(v=g(p,i,m,v.value,u))&&(e&&null!==v.alternate&&p.delete(null===v.key?m:v.key),l=o(v,l,m),null===d?c=v:d.sibling=v,d=v);return e&&p.forEach((function(e){return t(i,e)})),sa&&na(i,m),c}(s,u,c=b.call(c),d)}if("function"==typeof c.then)return v(s,u,el(c),d);if(c.$$typeof===k)return v(s,u,Ia(s,c),d);nl(s,c)}return"string"==typeof c&&""!==c||"number"==typeof c||"bigint"==typeof c?(c=""+c,null!==u&&6===u.tag?(n(s,u.sibling),(d=i(u,c)).return=s,s=d):(n(s,u),(d=qr(c,s.mode,d)).return=s,s=d),l(s)):n(s,u)}return function(e,t,n,r){try{Jo=0;var a=v(e,t,n,r);return Zo=null,a}catch(t){if(t===Ya||t===Ka)throw t;var i=Fr(29,t,null,e.mode);return i.lanes=r,i.return=e,i}}}var il=al(!0),ol=al(!1),ll=M(null),sl=null;function ul(e){var t=e.alternate;B(pl,1&pl.current),B(ll,e),null===sl&&(null===t||null!==gi.current||null!==t.memoizedState)&&(sl=e)}function cl(e){if(22===e.tag){if(B(pl,pl.current),B(ll,e),null===sl){var t=e.alternate;null!==t&&null!==t.memoizedState&&(sl=e)}}else dl()}function dl(){B(pl,pl.current),B(ll,ll.current)}function fl(e){U(ll),sl===e&&(sl=null),U(pl)}var pl=M(0);function hl(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||"$?"===n.data||bd(n)))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!=(128&t.flags))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}function ml(e,t,n,r){n=null==(n=n(r,t=e.memoizedState))?t:c({},t,n),e.memoizedState=n,0===e.lanes&&(e.updateQueue.baseState=n)}var gl={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=zu(),a=li(r);a.payload=t,null!=n&&(a.callback=n),null!==(t=si(e,a,r))&&(Fu(t,0,r),ui(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=zu(),a=li(r);a.tag=1,a.payload=t,null!=n&&(a.callback=n),null!==(t=si(e,a,r))&&(Fu(t,0,r),ui(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=zu(),r=li(n);r.tag=2,null!=t&&(r.callback=t),null!==(t=si(e,r,n))&&(Fu(t,0,n),ui(t,e,n))}};function yl(e,t,n,r,a,i,o){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(r,i,o):!(t.prototype&&t.prototype.isPureReactComponent&&Jn(n,r)&&Jn(a,i))}function vl(e,t,n,r){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,r),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&gl.enqueueReplaceState(t,t.state,null)}function bl(e,t){var n=t;if("ref"in t)for(var r in n={},t)"ref"!==r&&(n[r]=t[r]);if(e=e.defaultProps)for(var a in n===t&&(n=c({},n)),e)void 0===n[a]&&(n[a]=e[a]);return n}var xl="function"==typeof reportError?reportError:function(e){if("object"==typeof window&&"function"==typeof window.ErrorEvent){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:"object"==typeof e&&null!==e&&"string"==typeof e.message?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if("object"==typeof process&&"function"==typeof process.emit)return void process.emit("uncaughtException",e);console.error(e)};function wl(e){xl(e)}function kl(e){console.error(e)}function Cl(e){xl(e)}function jl(e,t){try{(0,e.onUncaughtError)(t.value,{componentStack:t.stack})}catch(e){setTimeout((function(){throw e}))}}function Sl(e,t,n){try{(0,e.onCaughtError)(n.value,{componentStack:n.stack,errorBoundary:1===t.tag?t.stateNode:null})}catch(e){setTimeout((function(){throw e}))}}function El(e,t,n){return(n=li(n)).tag=3,n.payload={element:null},n.callback=function(){jl(e,t)},n}function _l(e){return(e=li(e)).tag=3,e}function Nl(e,t,n,r){var a=n.type.getDerivedStateFromError;if("function"==typeof a){var i=r.value;e.payload=function(){return a(i)},e.callback=function(){Sl(t,n,r)}}var o=n.stateNode;null!==o&&"function"==typeof o.componentDidCatch&&(e.callback=function(){Sl(t,n,r),"function"!=typeof a&&(null===_u?_u=new Set([this]):_u.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:null!==e?e:""})})}var Al=Error(a(461)),Il=!1;function Pl(e,t,n,r){t.child=null===e?ol(t,null,n,r):il(t,e.child,n,r)}function Tl(e,t,n,r,a){n=n.render;var i=t.ref;if("ref"in r){var o={};for(var l in r)"ref"!==l&&(o[l]=r[l])}else o=r;return Na(t),r=Oi(e,t,n,o,i,a),l=Ri(),null===e||Il?(sa&&l&&aa(t),t.flags|=1,Pl(e,t,r,a),t.child):(Fi(e,t,a),Zl(e,t,a))}function Ll(e,t,n,r,a){if(null===e){var i=n.type;return"function"!=typeof i||Mr(i)||void 0!==i.defaultProps||null!==n.compare?((e=Hr(n.type,null,r,t,t.mode,a)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=i,Ol(e,t,i,r,a))}if(i=e.child,!Jl(e,a)){var o=i.memoizedProps;if((n=null!==(n=n.compare)?n:Jn)(o,r)&&e.ref===t.ref)return Zl(e,t,a)}return t.flags|=1,(e=Ur(i,r)).ref=t.ref,e.return=t,t.child=e}function Ol(e,t,n,r,a){if(null!==e){var i=e.memoizedProps;if(Jn(i,r)&&e.ref===t.ref){if(Il=!1,t.pendingProps=r=i,!Jl(e,a))return t.lanes=e.lanes,Zl(e,t,a);0!=(131072&e.flags)&&(Il=!0)}}return Rl(e,t,n,r,a)}function Dl(e,t,n){var r=t.pendingProps,a=r.children,i=null!==e?e.memoizedState:null;if("hidden"===r.mode){if(0!=(128&t.flags)){if(r=null!==i?i.baseLanes|n:n,null!==e){for(a=t.child=e.child,i=0;null!==a;)i=i|a.lanes|a.childLanes,a=a.sibling;t.childLanes=i&~r}else t.childLanes=0,t.child=null;return $l(e,t,r,n)}if(0==(536870912&n))return t.lanes=t.childLanes=536870912,$l(e,t,null!==i?i.baseLanes|n:n,n);t.memoizedState={baseLanes:0,cachePool:null},null!==e&&Wa(0,null!==i?i.cachePool:null),null!==i?vi(t,i):bi(),cl(t)}else null!==i?(Wa(0,i.cachePool),vi(t,i),dl(),t.memoizedState=null):(null!==e&&Wa(0,null),bi(),dl());return Pl(e,t,a,n),t.child}function $l(e,t,n,r){var a=qa();return a=null===a?null:{parent:Da._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},null!==e&&Wa(0,null),bi(),cl(t),null!==e&&Ea(e,t,r,!0),null}function zl(e,t){var n=t.ref;if(null===n)null!==e&&null!==e.ref&&(t.flags|=4194816);else{if("function"!=typeof n&&"object"!=typeof n)throw Error(a(284));(null===e||e.ref!==n)&&(t.flags|=4194816)}}function Rl(e,t,n,r,a){return Na(t),n=Oi(e,t,n,r,void 0,a),r=Ri(),null===e||Il?(sa&&r&&aa(t),t.flags|=1,Pl(e,t,n,a),t.child):(Fi(e,t,a),Zl(e,t,a))}function Fl(e,t,n,r,a,i){return Na(t),t.updateQueue=null,n=$i(t,r,n,a),Di(e),r=Ri(),null===e||Il?(sa&&r&&aa(t),t.flags|=1,Pl(e,t,n,i),t.child):(Fi(e,t,i),Zl(e,t,i))}function Ml(e,t,n,r,a){if(Na(t),null===t.stateNode){var i=zr,o=n.contextType;"object"==typeof o&&null!==o&&(i=Aa(o)),i=new n(r,i),t.memoizedState=null!==i.state&&void 0!==i.state?i.state:null,i.updater=gl,t.stateNode=i,i._reactInternals=t,(i=t.stateNode).props=r,i.state=t.memoizedState,i.refs={},ii(t),o=n.contextType,i.context="object"==typeof o&&null!==o?Aa(o):zr,i.state=t.memoizedState,"function"==typeof(o=n.getDerivedStateFromProps)&&(ml(t,n,o,r),i.state=t.memoizedState),"function"==typeof n.getDerivedStateFromProps||"function"==typeof i.getSnapshotBeforeUpdate||"function"!=typeof i.UNSAFE_componentWillMount&&"function"!=typeof i.componentWillMount||(o=i.state,"function"==typeof i.componentWillMount&&i.componentWillMount(),"function"==typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount(),o!==i.state&&gl.enqueueReplaceState(i,i.state,null),pi(t,r,i,a),fi(),i.state=t.memoizedState),"function"==typeof i.componentDidMount&&(t.flags|=4194308),r=!0}else if(null===e){i=t.stateNode;var l=t.memoizedProps,s=bl(n,l);i.props=s;var u=i.context,c=n.contextType;o=zr,"object"==typeof c&&null!==c&&(o=Aa(c));var d=n.getDerivedStateFromProps;c="function"==typeof d||"function"==typeof i.getSnapshotBeforeUpdate,l=t.pendingProps!==l,c||"function"!=typeof i.UNSAFE_componentWillReceiveProps&&"function"!=typeof i.componentWillReceiveProps||(l||u!==o)&&vl(t,i,r,o),ai=!1;var f=t.memoizedState;i.state=f,pi(t,r,i,a),fi(),u=t.memoizedState,l||f!==u||ai?("function"==typeof d&&(ml(t,n,d,r),u=t.memoizedState),(s=ai||yl(t,n,s,r,f,u,o))?(c||"function"!=typeof i.UNSAFE_componentWillMount&&"function"!=typeof i.componentWillMount||("function"==typeof i.componentWillMount&&i.componentWillMount(),"function"==typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount()),"function"==typeof i.componentDidMount&&(t.flags|=4194308)):("function"==typeof i.componentDidMount&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=u),i.props=r,i.state=u,i.context=o,r=s):("function"==typeof i.componentDidMount&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,oi(e,t),c=bl(n,o=t.memoizedProps),i.props=c,d=t.pendingProps,f=i.context,u=n.contextType,s=zr,"object"==typeof u&&null!==u&&(s=Aa(u)),(u="function"==typeof(l=n.getDerivedStateFromProps)||"function"==typeof i.getSnapshotBeforeUpdate)||"function"!=typeof i.UNSAFE_componentWillReceiveProps&&"function"!=typeof i.componentWillReceiveProps||(o!==d||f!==s)&&vl(t,i,r,s),ai=!1,f=t.memoizedState,i.state=f,pi(t,r,i,a),fi();var p=t.memoizedState;o!==d||f!==p||ai||null!==e&&null!==e.dependencies&&_a(e.dependencies)?("function"==typeof l&&(ml(t,n,l,r),p=t.memoizedState),(c=ai||yl(t,n,c,r,f,p,s)||null!==e&&null!==e.dependencies&&_a(e.dependencies))?(u||"function"!=typeof i.UNSAFE_componentWillUpdate&&"function"!=typeof i.componentWillUpdate||("function"==typeof i.componentWillUpdate&&i.componentWillUpdate(r,p,s),"function"==typeof i.UNSAFE_componentWillUpdate&&i.UNSAFE_componentWillUpdate(r,p,s)),"function"==typeof i.componentDidUpdate&&(t.flags|=4),"function"==typeof i.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof i.componentDidUpdate||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),"function"!=typeof i.getSnapshotBeforeUpdate||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),i.props=r,i.state=p,i.context=s,r=c):("function"!=typeof i.componentDidUpdate||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),"function"!=typeof i.getSnapshotBeforeUpdate||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return i=r,zl(e,t),r=0!=(128&t.flags),i||r?(i=t.stateNode,n=r&&"function"!=typeof n.getDerivedStateFromError?null:i.render(),t.flags|=1,null!==e&&r?(t.child=il(t,e.child,null,a),t.child=il(t,null,n,a)):Pl(e,t,n,a),t.memoizedState=i.state,e=t.child):e=Zl(e,t,a),e}function Ul(e,t,n,r){return ga(),t.flags|=256,Pl(e,t,n,r),t.child}var Bl={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Hl(e){return{baseLanes:e,cachePool:Ga()}}function Vl(e,t,n){return e=null!==e?e.childLanes&~n:0,t&&(e|=bu),e}function ql(e,t,n){var r,i=t.pendingProps,o=!1,l=0!=(128&t.flags);if((r=l)||(r=(null===e||null!==e.memoizedState)&&0!=(2&pl.current)),r&&(o=!0,t.flags&=-129),r=0!=(32&t.flags),t.flags&=-33,null===e){if(sa){if(o?ul(t):dl(),sa){var s,u=la;if(s=u){e:{for(s=u,u=ca;8!==s.nodeType;){if(!u){u=null;break e}if(null===(s=xd(s.nextSibling))){u=null;break e}}u=s}null!==u?(t.memoizedState={dehydrated:u,treeContext:null!==Jr?{id:ea,overflow:ta}:null,retryLane:536870912,hydrationErrors:null},(s=Fr(18,null,null,0)).stateNode=u,s.return=t,t.child=s,oa=t,la=null,s=!0):s=!1}s||fa(t)}if(null!==(u=t.memoizedState)&&null!==(u=u.dehydrated))return bd(u)?t.lanes=32:t.lanes=536870912,null;fl(t)}return u=i.children,i=i.fallback,o?(dl(),u=Gl({mode:"hidden",children:u},o=t.mode),i=Vr(i,o,n,null),u.return=t,i.return=t,u.sibling=i,t.child=u,(o=t.child).memoizedState=Hl(n),o.childLanes=Vl(e,r,n),t.memoizedState=Bl,i):(ul(t),Wl(t,u))}if(null!==(s=e.memoizedState)&&null!==(u=s.dehydrated)){if(l)256&t.flags?(ul(t),t.flags&=-257,t=Yl(e,t,n)):null!==t.memoizedState?(dl(),t.child=e.child,t.flags|=128,t=null):(dl(),o=i.fallback,u=t.mode,i=Gl({mode:"visible",children:i.children},u),(o=Vr(o,u,n,null)).flags|=2,i.return=t,o.return=t,i.sibling=o,t.child=i,il(t,e.child,null,n),(i=t.child).memoizedState=Hl(n),i.childLanes=Vl(e,r,n),t.memoizedState=Bl,t=o);else if(ul(t),bd(u)){if(r=u.nextSibling&&u.nextSibling.dataset)var c=r.dgst;r=c,(i=Error(a(419))).stack="",i.digest=r,va({value:i,source:null,stack:null}),t=Yl(e,t,n)}else if(Il||Ea(e,t,n,!1),r=0!=(n&e.childLanes),Il||r){if(null!==(r=ou)&&0!==(i=0!=((i=0!=(42&(i=n&-n))?1:Ae(i))&(r.suspendedLanes|n))?0:i)&&i!==s.retryLane)throw s.retryLane=i,Or(e,i),Fu(r,0,i),Al;"$?"===u.data||Ku(),t=Yl(e,t,n)}else"$?"===u.data?(t.flags|=192,t.child=e.child,t=null):(e=s.treeContext,la=xd(u.nextSibling),oa=t,sa=!0,ua=null,ca=!1,null!==e&&(Xr[Zr++]=ea,Xr[Zr++]=ta,Xr[Zr++]=Jr,ea=e.id,ta=e.overflow,Jr=t),(t=Wl(t,i.children)).flags|=4096);return t}return o?(dl(),o=i.fallback,u=t.mode,c=(s=e.child).sibling,(i=Ur(s,{mode:"hidden",children:i.children})).subtreeFlags=65011712&s.subtreeFlags,null!==c?o=Ur(c,o):(o=Vr(o,u,n,null)).flags|=2,o.return=t,i.return=t,i.sibling=o,t.child=i,i=o,o=t.child,null===(u=e.child.memoizedState)?u=Hl(n):(null!==(s=u.cachePool)?(c=Da._currentValue,s=s.parent!==c?{parent:c,pool:c}:s):s=Ga(),u={baseLanes:u.baseLanes|n,cachePool:s}),o.memoizedState=u,o.childLanes=Vl(e,r,n),t.memoizedState=Bl,i):(ul(t),e=(n=e.child).sibling,(n=Ur(n,{mode:"visible",children:i.children})).return=t,n.sibling=null,null!==e&&(null===(r=t.deletions)?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=n,t.memoizedState=null,n)}function Wl(e,t){return(t=Gl({mode:"visible",children:t},e.mode)).return=e,e.child=t}function Gl(e,t){return(e=Fr(22,e,null,t)).lanes=0,e.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},e}function Yl(e,t,n){return il(t,e.child,null,n),(e=Wl(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function Ql(e,t,n){e.lanes|=t;var r=e.alternate;null!==r&&(r.lanes|=t),ja(e.return,t,n)}function Kl(e,t,n,r,a){var i=e.memoizedState;null===i?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:a}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=a)}function Xl(e,t,n){var r=t.pendingProps,a=r.revealOrder,i=r.tail;if(Pl(e,t,r.children,n),0!=(2&(r=pl.current)))r=1&r|2,t.flags|=128;else{if(null!==e&&0!=(128&e.flags))e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&Ql(e,n,t);else if(19===e.tag)Ql(e,n,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}switch(B(pl,r),a){case"forwards":for(n=t.child,a=null;null!==n;)null!==(e=n.alternate)&&null===hl(e)&&(a=n),n=n.sibling;null===(n=a)?(a=t.child,t.child=null):(a=n.sibling,n.sibling=null),Kl(t,!1,a,n,i);break;case"backwards":for(n=null,a=t.child,t.child=null;null!==a;){if(null!==(e=a.alternate)&&null===hl(e)){t.child=a;break}e=a.sibling,a.sibling=n,n=a,a=e}Kl(t,!0,n,null,i);break;case"together":Kl(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Zl(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),gu|=t.lanes,0==(n&t.childLanes)){if(null===e)return null;if(Ea(e,t,n,!1),0==(n&t.childLanes))return null}if(null!==e&&t.child!==e.child)throw Error(a(153));if(null!==t.child){for(n=Ur(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=Ur(e,e.pendingProps)).return=t;n.sibling=null}return t.child}function Jl(e,t){return 0!=(e.lanes&t)||!(null===(e=e.dependencies)||!_a(e))}function es(e,t,n){if(null!==e)if(e.memoizedProps!==t.pendingProps)Il=!0;else{if(!Jl(e,n)&&0==(128&t.flags))return Il=!1,function(e,t,n){switch(t.tag){case 3:G(t,t.stateNode.containerInfo),ka(0,Da,e.memoizedState.cache),ga();break;case 27:case 5:Q(t);break;case 4:G(t,t.stateNode.containerInfo);break;case 10:ka(0,t.type,t.memoizedProps.value);break;case 13:var r=t.memoizedState;if(null!==r)return null!==r.dehydrated?(ul(t),t.flags|=128,null):0!=(n&t.child.childLanes)?ql(e,t,n):(ul(t),null!==(e=Zl(e,t,n))?e.sibling:null);ul(t);break;case 19:var a=0!=(128&e.flags);if((r=0!=(n&t.childLanes))||(Ea(e,t,n,!1),r=0!=(n&t.childLanes)),a){if(r)return Xl(e,t,n);t.flags|=128}if(null!==(a=t.memoizedState)&&(a.rendering=null,a.tail=null,a.lastEffect=null),B(pl,pl.current),r)break;return null;case 22:case 23:return t.lanes=0,Dl(e,t,n);case 24:ka(0,Da,e.memoizedState.cache)}return Zl(e,t,n)}(e,t,n);Il=0!=(131072&e.flags)}else Il=!1,sa&&0!=(1048576&t.flags)&&ra(t,Kr,t.index);switch(t.lanes=0,t.tag){case 16:e:{e=t.pendingProps;var r=t.elementType,i=r._init;if(r=i(r._payload),t.type=r,"function"!=typeof r){if(null!=r){if((i=r.$$typeof)===C){t.tag=11,t=Tl(null,t,r,e,n);break e}if(i===E){t.tag=14,t=Ll(null,t,r,e,n);break e}}throw t=L(r)||r,Error(a(306,t,""))}Mr(r)?(e=bl(r,e),t.tag=1,t=Ml(null,t,r,e,n)):(t.tag=0,t=Rl(null,t,r,e,n))}return t;case 0:return Rl(e,t,t.type,t.pendingProps,n);case 1:return Ml(e,t,r=t.type,i=bl(r,t.pendingProps),n);case 3:e:{if(G(t,t.stateNode.containerInfo),null===e)throw Error(a(387));r=t.pendingProps;var o=t.memoizedState;i=o.element,oi(e,t),pi(t,r,null,n);var l=t.memoizedState;if(r=l.cache,ka(0,Da,r),r!==o.cache&&Sa(t,[Da],n,!0),fi(),r=l.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:l.cache},t.updateQueue.baseState=o,t.memoizedState=o,256&t.flags){t=Ul(e,t,r,n);break e}if(r!==i){va(i=_r(Error(a(424)),t)),t=Ul(e,t,r,n);break e}for(e=9===(e=t.stateNode.containerInfo).nodeType?e.body:"HTML"===e.nodeName?e.ownerDocument.body:e,la=xd(e.firstChild),oa=t,sa=!0,ua=null,ca=!0,n=ol(t,null,r,n),t.child=n;n;)n.flags=-3&n.flags|4096,n=n.sibling}else{if(ga(),r===i){t=Zl(e,t,n);break e}Pl(e,t,r,n)}t=t.child}return t;case 26:return zl(e,t),null===e?(n=Pd(t.type,null,t.pendingProps,null))?t.memoizedState=n:sa||(n=t.type,e=t.pendingProps,(r=od(q.current).createElement(n))[Le]=t,r[Oe]=e,rd(r,n,e),We(r),t.stateNode=r):t.memoizedState=Pd(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Q(t),null===e&&sa&&(r=t.stateNode=Cd(t.type,t.pendingProps,q.current),oa=t,ca=!0,i=la,gd(t.type)?(wd=i,la=xd(r.firstChild)):la=i),Pl(e,t,t.pendingProps.children,n),zl(e,t),null===e&&(t.flags|=4194304),t.child;case 5:return null===e&&sa&&((i=r=la)&&(r=function(e,t,n,r){for(;1===e.nodeType;){var a=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&("INPUT"!==e.nodeName||"hidden"!==e.type))break}else if(r){if(!e[Me])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if("stylesheet"===(i=e.getAttribute("rel"))&&e.hasAttribute("data-precedence"))break;if(i!==a.rel||e.getAttribute("href")!==(null==a.href||""===a.href?null:a.href)||e.getAttribute("crossorigin")!==(null==a.crossOrigin?null:a.crossOrigin)||e.getAttribute("title")!==(null==a.title?null:a.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(((i=e.getAttribute("src"))!==(null==a.src?null:a.src)||e.getAttribute("type")!==(null==a.type?null:a.type)||e.getAttribute("crossorigin")!==(null==a.crossOrigin?null:a.crossOrigin))&&i&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else{if("input"!==t||"hidden"!==e.type)return e;var i=null==a.name?null:""+a.name;if("hidden"===a.type&&e.getAttribute("name")===i)return e}if(null===(e=xd(e.nextSibling)))break}return null}(r,t.type,t.pendingProps,ca),null!==r?(t.stateNode=r,oa=t,la=xd(r.firstChild),ca=!1,i=!0):i=!1),i||fa(t)),Q(t),i=t.type,o=t.pendingProps,l=null!==e?e.memoizedProps:null,r=o.children,ud(i,o)?r=null:null!==l&&ud(i,l)&&(t.flags|=32),null!==t.memoizedState&&(i=Oi(e,t,zi,null,null,n),Xd._currentValue=i),zl(e,t),Pl(e,t,r,n),t.child;case 6:return null===e&&sa&&((e=n=la)&&(n=function(e,t,n){if(""===t)return null;for(;3!==e.nodeType;)if((1!==e.nodeType||"INPUT"!==e.nodeName||"hidden"!==e.type)&&!n||null===(e=xd(e.nextSibling)))return null;return e}(n,t.pendingProps,ca),null!==n?(t.stateNode=n,oa=t,la=null,e=!0):e=!1),e||fa(t)),null;case 13:return ql(e,t,n);case 4:return G(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=il(t,null,r,n):Pl(e,t,r,n),t.child;case 11:return Tl(e,t,t.type,t.pendingProps,n);case 7:return Pl(e,t,t.pendingProps,n),t.child;case 8:case 12:return Pl(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,ka(0,t.type,r.value),Pl(e,t,r.children,n),t.child;case 9:return i=t.type._context,r=t.pendingProps.children,Na(t),r=r(i=Aa(i)),t.flags|=1,Pl(e,t,r,n),t.child;case 14:return Ll(e,t,t.type,t.pendingProps,n);case 15:return Ol(e,t,t.type,t.pendingProps,n);case 19:return Xl(e,t,n);case 31:return r=t.pendingProps,n=t.mode,r={mode:r.mode,children:r.children},null===e?((n=Gl(r,n)).ref=t.ref,t.child=n,n.return=t,t=n):((n=Ur(e.child,r)).ref=t.ref,t.child=n,n.return=t,t=n),t;case 22:return Dl(e,t,n);case 24:return Na(t),r=Aa(Da),null===e?(null===(i=qa())&&(i=ou,o=$a(),i.pooledCache=o,o.refCount++,null!==o&&(i.pooledCacheLanes|=n),i=o),t.memoizedState={parent:r,cache:i},ii(t),ka(0,Da,i)):(0!=(e.lanes&n)&&(oi(e,t),pi(t,null,null,n),fi()),i=e.memoizedState,o=t.memoizedState,i.parent!==r?(i={parent:r,cache:r},t.memoizedState=i,0===t.lanes&&(t.memoizedState=t.updateQueue.baseState=i),ka(0,Da,r)):(r=o.cache,ka(0,Da,r),r!==i.cache&&Sa(t,[Da],n,!0))),Pl(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(a(156,t.tag))}function ts(e){e.flags|=4}function ns(e,t){if("stylesheet"!==t.type||0!=(4&t.state.loading))e.flags&=-16777217;else if(e.flags|=16777216,!Vd(t)){if(null!==(t=ll.current)&&((4194048&su)===su?null!==sl:(62914560&su)!==su&&0==(536870912&su)||t!==sl))throw ti=Xa,Qa;e.flags|=8192}}function rs(e,t){null!==t&&(e.flags|=4),16384&e.flags&&(t=22!==e.tag?je():536870912,e.lanes|=t,xu|=t)}function as(e,t){if(!sa)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;null!==n;)null!==n.alternate&&(r=n),n=n.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function is(e){var t=null!==e.alternate&&e.alternate.child===e.child,n=0,r=0;if(t)for(var a=e.child;null!==a;)n|=a.lanes|a.childLanes,r|=65011712&a.subtreeFlags,r|=65011712&a.flags,a.return=e,a=a.sibling;else for(a=e.child;null!==a;)n|=a.lanes|a.childLanes,r|=a.subtreeFlags,r|=a.flags,a.return=e,a=a.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function os(e,t,n){var r=t.pendingProps;switch(ia(t),t.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:case 1:return is(t),null;case 3:return n=t.stateNode,r=null,null!==e&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Ca(Da),Y(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(null===e||null===e.child)&&(ma(t)?ts(t):null===e||e.memoizedState.isDehydrated&&0==(256&t.flags)||(t.flags|=1024,ya())),is(t),null;case 26:return n=t.memoizedState,null===e?(ts(t),null!==n?(is(t),ns(t,n)):(is(t),t.flags&=-16777217)):n?n!==e.memoizedState?(ts(t),is(t),ns(t,n)):(is(t),t.flags&=-16777217):(e.memoizedProps!==r&&ts(t),is(t),t.flags&=-16777217),null;case 27:K(t),n=q.current;var i=t.type;if(null!==e&&null!=t.stateNode)e.memoizedProps!==r&&ts(t);else{if(!r){if(null===t.stateNode)throw Error(a(166));return is(t),null}e=H.current,ma(t)?pa(t):(e=Cd(i,r,n),t.stateNode=e,ts(t))}return is(t),null;case 5:if(K(t),n=t.type,null!==e&&null!=t.stateNode)e.memoizedProps!==r&&ts(t);else{if(!r){if(null===t.stateNode)throw Error(a(166));return is(t),null}if(e=H.current,ma(t))pa(t);else{switch(i=od(q.current),e){case 1:e=i.createElementNS("http://www.w3.org/2000/svg",n);break;case 2:e=i.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;default:switch(n){case"svg":e=i.createElementNS("http://www.w3.org/2000/svg",n);break;case"math":e=i.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;case"script":(e=i.createElement("div")).innerHTML="