@tscircuit/runframe 0.0.2443 → 0.0.2444

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5590,7 +5590,7 @@ try {
5590
5590
  `)},s7t=function(){var t=parseInt(document.body.getAttribute(ek)||"0",10);return isFinite(t)?t:0},sko=function(){ne.useEffect(function(){return document.body.setAttribute(ek,(s7t()+1).toString()),function(){var t=s7t()-1;t<=0?document.body.removeAttribute(ek):document.body.setAttribute(ek,t.toString())}},[])},ako=function(t){var e=t.noRelative,n=t.noImportant,o=t.gapMode,i=o===void 0?"margin":o;sko();var r=ne.useMemo(function(){return oko(i)},[i]);return ne.createElement(iko,{styles:rko(r,!e,i,n?"":"!important")})},c6e=!1;if(typeof window<"u")try{var Sre=Object.defineProperty({},"passive",{get:function(){return c6e=!0,!0}});window.addEventListener("test",Sre,Sre),window.removeEventListener("test",Sre,Sre)}catch{c6e=!1}var tk=c6e?{passive:!1}:!1,Ako=function(t){return t.tagName==="TEXTAREA"},a7t=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!Ako(t)&&n[e]==="visible")},cko=function(t){return a7t(t,"overflowY")},lko=function(t){return a7t(t,"overflowX")},A7t=function(t,e){var n=e.ownerDocument,o=e;do{typeof ShadowRoot<"u"&&o instanceof ShadowRoot&&(o=o.host);var i=c7t(t,o);if(i){var r=l7t(t,o),s=r[1],a=r[2];if(s>a)return!0}o=o.parentNode}while(o&&o!==n.body);return!1},gko=function(t){var e=t.scrollTop,n=t.scrollHeight,o=t.clientHeight;return[e,n,o]},uko=function(t){var e=t.scrollLeft,n=t.scrollWidth,o=t.clientWidth;return[e,n,o]},c7t=function(t,e){return t==="v"?cko(e):lko(e)},l7t=function(t,e){return t==="v"?gko(e):uko(e)},dko=function(t,e){return t==="h"&&e==="rtl"?-1:1},hko=function(t,e,n,o,i){var r=dko(t,window.getComputedStyle(e).direction),s=r*o,a=n.target,A=e.contains(a),c=!1,l=s>0,g=0,u=0;do{if(!a)break;var h=l7t(t,a),d=h[0],_=h[1],m=h[2],p=_-m-r*d;(d||p)&&c7t(t,a)&&(g+=p,u+=d);var I=a.parentNode;a=I&&I.nodeType===Node.DOCUMENT_FRAGMENT_NODE?I.host:I}while(!A&&a!==document.body||A&&(e.contains(a)||e===a));return(l&&Math.abs(g)<1||!l&&Math.abs(u)<1)&&(c=!0),c},bre=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},g7t=function(t){return[t.deltaX,t.deltaY]},u7t=function(t){return t&&"current"in t?t.current:t},_ko=function(t,e){return t[0]===e[0]&&t[1]===e[1]},mko=function(t){return`
5591
5591
  .block-interactivity-`.concat(t,` {pointer-events: none;}
5592
5592
  .allow-interactivity-`).concat(t,` {pointer-events: all;}
5593
- `)},pko=0,nk=[];function Iko(t){var e=ne.useRef([]),n=ne.useRef([0,0]),o=ne.useRef(),i=ne.useState(pko++)[0],r=ne.useState(r7t)[0],s=ne.useRef(t);ne.useEffect(function(){s.current=t},[t]),ne.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var _=HTo([t.lockRef.current],(t.shards||[]).map(u7t),!0).filter(Boolean);return _.forEach(function(m){return m.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),_.forEach(function(m){return m.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var a=ne.useCallback(function(_,m){if("touches"in _&&_.touches.length===2||_.type==="wheel"&&_.ctrlKey)return!s.current.allowPinchZoom;var p=bre(_),I=n.current,f="deltaX"in _?_.deltaX:I[0]-p[0],C="deltaY"in _?_.deltaY:I[1]-p[1],y,E=_.target,B=Math.abs(f)>Math.abs(C)?"h":"v";if("touches"in _&&B==="h"&&E.type==="range")return!1;var Q=window.getSelection(),b=Q&&Q.anchorNode,D=b?b===E||b.contains(E):!1;if(D)return!1;var R=A7t(B,E);if(!R)return!0;if(R?y=B:(y=B==="v"?"h":"v",R=A7t(B,E)),!R)return!1;if(!o.current&&"changedTouches"in _&&(f||C)&&(o.current=y),!y)return!0;var w=o.current||y;return hko(w,m,_,w==="h"?f:C)},[]),A=ne.useCallback(function(_){var m=_;if(!(!nk.length||nk[nk.length-1]!==r)){var p="deltaY"in m?g7t(m):bre(m),I=e.current.filter(function(y){return y.name===m.type&&(y.target===m.target||m.target===y.shadowParent)&&_ko(y.delta,p)})[0];if(I&&I.should){m.cancelable&&m.preventDefault();return}if(!I){var f=(s.current.shards||[]).map(u7t).filter(Boolean).filter(function(y){return y.contains(m.target)}),C=f.length>0?a(m,f[0]):!s.current.noIsolation;C&&m.cancelable&&m.preventDefault()}}},[]),c=ne.useCallback(function(_,m,p,I){var f={name:_,delta:m,target:p,should:I,shadowParent:fko(p)};e.current.push(f),setTimeout(function(){e.current=e.current.filter(function(C){return C!==f})},1)},[]),l=ne.useCallback(function(_){n.current=bre(_),o.current=void 0},[]),g=ne.useCallback(function(_){c(_.type,g7t(_),_.target,a(_,t.lockRef.current))},[]),u=ne.useCallback(function(_){c(_.type,bre(_),_.target,a(_,t.lockRef.current))},[]);ne.useEffect(function(){return nk.push(r),t.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:u}),document.addEventListener("wheel",A,tk),document.addEventListener("touchmove",A,tk),document.addEventListener("touchstart",l,tk),function(){nk=nk.filter(function(_){return _!==r}),document.removeEventListener("wheel",A,tk),document.removeEventListener("touchmove",A,tk),document.removeEventListener("touchstart",l,tk)}},[]);var h=t.removeScrollBar,d=t.inert;return ne.createElement(ne.Fragment,null,d?ne.createElement(r,{styles:mko(i)}):null,h?ne.createElement(ako,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function fko(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const Cko=qTo(i7t,Iko);var l6e=ne.forwardRef(function(t,e){return ne.createElement(Qre,WS({},t,{ref:e,sideCar:Cko}))});l6e.classNames=Qre.classNames;var yko=Object.defineProperty,bc=(t,e)=>yko(t,"name",{value:e,configurable:!0}),g6e=["Enter"," "],Eko=["ArrowDown","PageUp","Home"],d7t=["ArrowUp","PageDown","End"],xko=[...Eko,...d7t],Bko={ltr:[...g6e,"ArrowRight"],rtl:[...g6e,"ArrowLeft"]},Qko={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Dre="Menu",[KU,Sko,bko]=Hae(Dre),[b6,h7t]=RE(Dre,[bko,fre,Ez]),Pre=fre(),_7t=Ez(),[m7t,Tv]=b6(Dre),[Dko,UU]=b6(Dre),Pko=bc(t=>{const{__scopeMenu:e,open:n=!1,children:o,dir:i,onOpenChange:r,modal:s=!0}=t,a=Pre(e),[A,c]=ne.useState(null),l=ne.useRef(!1),g=AQ(r),u=Cz(i);return ne.useEffect(()=>{const h=bc(()=>{l.current=!0,document.addEventListener("pointerdown",d,{capture:!0,once:!0}),document.addEventListener("pointermove",d,{capture:!0,once:!0})},"handleKeyDown"),d=bc(()=>l.current=!1,"handlePointer");return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",d,{capture:!0}),document.removeEventListener("pointermove",d,{capture:!0})}},[]),ne.useEffect(()=>{if(!n)return;const h=bc(()=>g(!1),"handleBlur");return window.addEventListener("blur",h),()=>window.removeEventListener("blur",h)},[n,g]),j.jsx(i6e,{...a,children:j.jsx(m7t,{scope:e,open:n,onOpenChange:g,content:A,onContentChange:c,children:j.jsx(Dko,{scope:e,onClose:ne.useCallback(()=>g(!1),[g]),isUsingKeyboardRef:l,dir:u,modal:s,children:o})})})},"Menu"),p7t=ne.forwardRef(bc(function(e,n){const{__scopeMenu:o,...i}=e,r=Pre(o);return j.jsx(j9t,{...r,...i,ref:n})},"MenuAnchor")),I7t="MenuPortal",[vko,f7t]=b6(I7t,{forceMount:void 0}),Mko=bc(t=>{const{__scopeMenu:e,forceMount:n,children:o,container:i}=t,r=Tv(I7t,e);return j.jsx(vko,{scope:e,forceMount:n,children:j.jsx(cQ,{present:n||r.open,children:j.jsx($9t,{asChild:!0,container:i,children:o})})})},"MenuPortal"),FB="MenuContent",[wko,u6e]=b6(FB),Nko=ne.forwardRef(bc(function(e,n){const o=f7t(FB,e.__scopeMenu),{forceMount:i=o.forceMount,...r}=e,s=Tv(FB,e.__scopeMenu),a=UU(FB,e.__scopeMenu);return j.jsx(KU.Provider,{scope:e.__scopeMenu,children:j.jsx(cQ,{present:i||s.open,children:j.jsx(KU.Slot,{scope:e.__scopeMenu,children:a.modal?j.jsx(Rko,{...r,ref:n}):j.jsx(Tko,{...r,ref:n})})})})},"MenuContent")),Rko=ne.forwardRef(bc(function(e,n){const o=Tv(FB,e.__scopeMenu),i=ne.useRef(null),r=ag(n,i);return ne.useEffect(()=>{const s=i.current;if(s)return e7t(s)},[]),j.jsx(d6e,{...e,ref:r,trapFocus:o.open,disableOutsidePointerEvents:o.open,disableOutsideScroll:!0,onFocusOutside:Kr(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>o.onOpenChange(!1)})},"MenuRootContentModal")),Tko=ne.forwardRef(bc(function(e,n){const o=Tv(FB,e.__scopeMenu);return j.jsx(d6e,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>o.onOpenChange(!1)})},"MenuRootContentNonModal")),kko=Ib("MenuContent.ScrollLock"),d6e=ne.forwardRef(bc(function(e,n){const{__scopeMenu:o,loop:i=!1,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:A,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:g,onFocusOutside:u,onInteractOutside:h,onDismiss:d,disableOutsideScroll:_,...m}=e,p=Tv(FB,o),I=UU(FB,o),f=Pre(o),C=_7t(o),y=Sko(o),[E,B]=ne.useState(null),Q=ne.useRef(null),b=ag(n,Q,p.onContentChange),D=ne.useRef(0),R=ne.useRef(""),w=ne.useRef(0),H=ne.useRef(null),G=ne.useRef("right"),K=ne.useRef(0),U=_?l6e:ne.Fragment,q=_?{as:kko,allowPinchZoom:!0}:void 0,W=bc(re=>{const X=R.current+re,te=y().filter(Be=>!Be.disabled),se=document.activeElement,le=te.find(Be=>Be.ref.current===se)?.textValue,ue=te.map(Be=>Be.textValue),Ce=D7t(ue,X,le),Ee=te.find(Be=>Be.textValue===Ce)?.ref.current;bc((function Be(_e){R.current=_e,window.clearTimeout(D.current),_e!==""&&(D.current=window.setTimeout(()=>Be(""),1e3))}),"updateSearch")(X),Ee&&setTimeout(()=>Ee.focus())},"handleTypeaheadSearch");ne.useEffect(()=>()=>window.clearTimeout(D.current),[]),are();const ee=ne.useCallback(re=>G.current===H.current?.side&&v7t(re,H.current?.area),[]);return j.jsx(wko,{scope:o,searchRef:R,onItemEnter:ne.useCallback(re=>{ee(re)&&re.preventDefault()},[ee]),onItemLeave:ne.useCallback(re=>{ee(re)||(Q.current?.focus(),B(null))},[ee]),onTriggerLeave:ne.useCallback(re=>{ee(re)&&re.preventDefault()},[ee]),pointerGraceTimerRef:w,onPointerGraceIntentChange:ne.useCallback(re=>{H.current=re},[]),children:j.jsx(U,{...q,children:j.jsx(m9t,{asChild:!0,trapped:r,onMountAutoFocus:Kr(s,re=>{re.preventDefault(),Q.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:j.jsx(k3e,{asChild:!0,disableOutsidePointerEvents:A,onEscapeKeyDown:l,onPointerDownOutside:g,onFocusOutside:u,onInteractOutside:h,onDismiss:d,children:j.jsx(VNe,{asChild:!0,...C,dir:I.dir,orientation:"vertical",loop:i,currentTabStopId:E,onCurrentTabStopIdChange:B,onEntryFocus:Kr(c,re=>{I.isUsingKeyboardRef.current||re.preventDefault()}),preventScrollOnEntryFocus:!0,children:j.jsx(X9t,{role:"menu","aria-orientation":"vertical","data-state":m6e(p.open),"data-radix-menu-content":"",dir:I.dir,...f,...m,ref:b,style:{outline:"none",...m.style},onKeyDown:Kr(m.onKeyDown,re=>{const te=re.target.closest("[data-radix-menu-content]")===re.currentTarget,se=re.ctrlKey||re.altKey||re.metaKey,le=re.key.length===1;te&&(re.key==="Tab"&&re.preventDefault(),!se&&le&&W(re.key));const ue=Q.current;if(re.target!==ue||!xko.includes(re.key))return;re.preventDefault();const Ee=y().filter(Be=>!Be.disabled).map(Be=>Be.ref.current);d7t.includes(re.key)&&Ee.reverse(),S7t(Ee)}),onBlur:Kr(e.onBlur,re=>{re.currentTarget.contains(re.target)||(window.clearTimeout(D.current),R.current="")}),onPointerMove:Kr(e.onPointerMove,ok(re=>{const X=re.target,te=K.current!==re.clientX;if(re.currentTarget.contains(X)&&te){const se=re.clientX>K.current?"right":"left";G.current=se,K.current=re.clientX}}))})})})})})})},"MenuContentImpl")),Fko=ne.forwardRef(bc(function(e,n){const{__scopeMenu:o,...i}=e;return j.jsx(gu.div,{...i,ref:n})},"MenuLabel")),h6e="MenuItem",C7t="menu.itemSelect",_6e=ne.forwardRef(bc(function(e,n){const{disabled:o=!1,onSelect:i,...r}=e,s=ne.useRef(null),a=UU(h6e,e.__scopeMenu),A=u6e(h6e,e.__scopeMenu),c=ag(n,s),l=ne.useRef(!1),g=bc(()=>{const u=s.current;if(!o&&u){const h=new CustomEvent(C7t,{bubbles:!0,cancelable:!0});u.addEventListener(C7t,d=>i?.(d),{once:!0}),Uae(u,h),h.defaultPrevented?l.current=!1:a.onClose()}},"handleSelect");return j.jsx(y7t,{...r,ref:c,disabled:o,onClick:Kr(e.onClick,g),onPointerDown:u=>{e.onPointerDown?.(u),l.current=!0},onPointerUp:Kr(e.onPointerUp,u=>{l.current||u.currentTarget?.click()}),onKeyDown:Kr(e.onKeyDown,u=>{o||u.target!==u.currentTarget||A.searchRef.current!==""&&u.key===" "||g6e.includes(u.key)&&(u.currentTarget.click(),u.preventDefault())})})},"MenuItem")),y7t=ne.forwardRef(bc(function(e,n){const{__scopeMenu:o,disabled:i=!1,textValue:r,...s}=e,a=u6e(h6e,o),A=_7t(o),c=ne.useRef(null),l=ag(n,c),[g,u]=ne.useState(!1),[h,d]=ne.useState("");return ne.useEffect(()=>{const _=c.current;_&&d((_.textContent??"").trim())},[s.children]),j.jsx(KU.ItemSlot,{scope:o,disabled:i,textValue:r??h,children:j.jsx(JNe,{asChild:!0,...A,focusable:!i,children:j.jsx(gu.div,{role:"menuitem","data-highlighted":g?"":void 0,"aria-disabled":i||void 0,"data-disabled":i?"":void 0,...s,ref:l,onPointerMove:Kr(e.onPointerMove,ok(_=>{i?a.onItemLeave(_):(a.onItemEnter(_),_.defaultPrevented||_.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Kr(e.onPointerLeave,ok(_=>a.onItemLeave(_))),onFocus:Kr(e.onFocus,()=>u(!0)),onBlur:Kr(e.onBlur,()=>u(!1))})})})},"MenuItemImpl")),Lko=ne.forwardRef(bc(function(e,n){const{checked:o=!1,onCheckedChange:i,...r}=e;return j.jsx(x7t,{scope:e.__scopeMenu,checked:o,children:j.jsx(_6e,{role:"menuitemcheckbox","aria-checked":YU(o)?"mixed":o,...r,ref:n,"data-state":Mre(o),onSelect:Kr(r.onSelect,()=>i?.(YU(o)?!0:!o),{checkForDefaultPrevented:!1})})})},"MenuCheckboxItem")),Hko="MenuRadioGroup",[xZo,Gko]=b6(Hko,{value:void 0,onValueChange:bc(()=>{},"onValueChange")}),Oko="MenuRadioItem",Kko=ne.forwardRef(bc(function(e,n){const{value:o,...i}=e,r=Gko(Oko,e.__scopeMenu),s=o===r.value;return j.jsx(x7t,{scope:e.__scopeMenu,checked:s,children:j.jsx(_6e,{role:"menuitemradio","aria-checked":s,...i,ref:n,"data-state":Mre(s),onSelect:Kr(i.onSelect,()=>r.onValueChange?.(o),{checkForDefaultPrevented:!1})})})},"MenuRadioItem")),E7t="MenuItemIndicator",[x7t,Uko]=b6(E7t,{checked:!1}),Yko=ne.forwardRef(bc(function(e,n){const{__scopeMenu:o,forceMount:i,...r}=e,s=Uko(E7t,o);return j.jsx(cQ,{present:i||YU(s.checked)||s.checked===!0,children:j.jsx(gu.span,{...r,ref:n,"data-state":Mre(s.checked)})})},"MenuItemIndicator")),zko=ne.forwardRef(bc(function(e,n){const{__scopeMenu:o,...i}=e;return j.jsx(gu.div,{role:"separator","aria-orientation":"horizontal",...i,ref:n})},"MenuSeparator")),B7t="MenuSub",[Vko,Q7t]=b6(B7t),Jko=bc(t=>{const{__scopeMenu:e,children:n,open:o=!1,onOpenChange:i}=t,r=Tv(B7t,e),s=Pre(e),[a,A]=ne.useState(null),[c,l]=ne.useState(null),g=AQ(i);return ne.useEffect(()=>(r.open===!1&&g(!1),()=>g(!1)),[r.open,g]),j.jsx(i6e,{...s,children:j.jsx(m7t,{scope:e,open:o,onOpenChange:g,content:c,onContentChange:l,children:j.jsx(Vko,{scope:e,contentId:Ox(),triggerId:Ox(),trigger:a,onTriggerChange:A,children:n})})})},"MenuSub"),vre="MenuSubTrigger",qko=ne.forwardRef(bc(function(e,n){const o=Tv(vre,e.__scopeMenu),i=UU(vre,e.__scopeMenu),r=Q7t(vre,e.__scopeMenu),s=u6e(vre,e.__scopeMenu),a=ne.useRef(null),{pointerGraceTimerRef:A,onPointerGraceIntentChange:c}=s,l={__scopeMenu:e.__scopeMenu},g=ne.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);ne.useEffect(()=>g,[g]),ne.useEffect(()=>{const h=A.current;return()=>{window.clearTimeout(h),c(null)}},[A,c]);const u=ag(n,r.onTriggerChange);return j.jsx(p7t,{asChild:!0,...l,children:j.jsx(y7t,{id:r.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?r.contentId:void 0,"data-state":m6e(o.open),...e,ref:u,onClick:h=>{e.onClick?.(h),!(e.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),o.open||o.onOpenChange(!0))},onPointerMove:Kr(e.onPointerMove,ok(h=>{s.onItemEnter(h),!h.defaultPrevented&&!e.disabled&&!o.open&&!a.current&&(s.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{o.onOpenChange(!0),g()},100))})),onPointerLeave:Kr(e.onPointerLeave,ok(h=>{g();const d=o.content?.getBoundingClientRect();if(d){const _=o.content?.dataset.side,m=_==="right",p=m?-5:5,I=d[m?"left":"right"],f=d[m?"right":"left"];s.onPointerGraceIntentChange({area:[{x:h.clientX+p,y:h.clientY},{x:I,y:d.top},{x:f,y:d.top},{x:f,y:d.bottom},{x:I,y:d.bottom}],side:_}),window.clearTimeout(A.current),A.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(h),h.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:Kr(e.onKeyDown,h=>{e.disabled||h.target!==h.currentTarget||s.searchRef.current!==""&&h.key===" "||Bko[i.dir].includes(h.key)&&(o.onOpenChange(!0),o.content?.focus(),h.preventDefault())})})})},"MenuSubTrigger")),Wko="MenuSubContent",jko=ne.forwardRef(bc(function(e,n){const o=f7t(FB,e.__scopeMenu),{forceMount:i=o.forceMount,align:r="start",...s}=e,a=Tv(FB,e.__scopeMenu),A=UU(FB,e.__scopeMenu),c=Q7t(Wko,e.__scopeMenu),l=ne.useRef(null),g=ag(n,l);return j.jsx(KU.Provider,{scope:e.__scopeMenu,children:j.jsx(cQ,{present:i||a.open,children:j.jsx(KU.Slot,{scope:e.__scopeMenu,children:j.jsx(d6e,{id:c.contentId,"aria-labelledby":c.triggerId,...s,ref:g,align:r,side:A.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{A.isUsingKeyboardRef.current&&l.current?.focus(),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:Kr(e.onFocusOutside,u=>{u.target!==c.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:Kr(e.onEscapeKeyDown,u=>{A.onClose(),u.preventDefault()}),onKeyDown:Kr(e.onKeyDown,u=>{const h=u.currentTarget.contains(u.target),d=Qko[A.dir].includes(u.key);h&&d&&(a.onOpenChange(!1),c.trigger?.focus(),u.preventDefault())})})})})})},"MenuSubContent"));function m6e(t){return t?"open":"closed"}bc(m6e,"getOpenState");function YU(t){return t==="indeterminate"}bc(YU,"isIndeterminate");function Mre(t){return YU(t)?"indeterminate":t?"checked":"unchecked"}bc(Mre,"getCheckedState");function S7t(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}bc(S7t,"focusFirst");function b7t(t,e){return t.map((n,o)=>t[(e+o)%t.length])}bc(b7t,"wrapArray");function D7t(t,e,n){const i=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,r=n?t.indexOf(n):-1;let s=b7t(t,Math.max(r,0));i.length===1&&(s=s.filter(c=>c!==n));const A=s.find(c=>c.toLowerCase().startsWith(i.toLowerCase()));return A!==n?A:void 0}bc(D7t,"getNextMatch");function P7t(t,e){const{x:n,y:o}=t;let i=!1;for(let r=0,s=e.length-1;r<e.length;s=r++){const a=e[r],A=e[s],c=a.x,l=a.y,g=A.x,u=A.y;l>o!=u>o&&n<(g-c)*(o-l)/(u-l)+c&&(i=!i)}return i}bc(P7t,"isPointInPolygon");function v7t(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return P7t(n,e)}bc(v7t,"isPointerInGraceArea");function ok(t){return e=>e.pointerType==="mouse"?t(e):void 0}bc(ok,"whenMouse");var Xko=Pko,$ko=p7t,Zko=Mko,eFo=Nko,tFo=Fko,nFo=_6e,oFo=Lko,iFo=Kko,rFo=Yko,sFo=zko,aFo=Jko,AFo=qko,cFo=jko,lFo=Object.defineProperty,K2=(t,e)=>lFo(t,"name",{value:e,configurable:!0}),p6e="DropdownMenu",[gFo,BZo]=RE(p6e,[h7t]),U2=h7t(),[uFo,M7t]=gFo(p6e),dFo=K2(t=>{const{__scopeDropdownMenu:e,children:n,dir:o,open:i,defaultOpen:r,onOpenChange:s,modal:a=!0}=t,A=U2(e),c=ne.useRef(null),[l,g]=U5({prop:i,defaultProp:r??!1,onChange:s,caller:p6e});return j.jsx(uFo,{scope:e,triggerId:Ox(),triggerRef:c,contentId:Ox(),open:l,onOpenChange:g,onOpenToggle:ne.useCallback(()=>g(u=>!u),[g]),modal:a,children:j.jsx(Xko,{...A,open:l,onOpenChange:g,dir:o,modal:a,children:n})})},"DropdownMenu"),hFo="DropdownMenuTrigger",_Fo=ne.forwardRef(K2(function(e,n){const{__scopeDropdownMenu:o,disabled:i=!1,...r}=e,s=M7t(hFo,o),a=U2(o),A=ag(n,s.triggerRef);return j.jsx($ko,{asChild:!0,...a,children:j.jsx(gu.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":i?"":void 0,disabled:i,...r,ref:A,onPointerDown:Kr(e.onPointerDown,c=>{!i&&c.button===0&&c.ctrlKey===!1&&(s.onOpenToggle(),s.open||c.preventDefault())}),onKeyDown:Kr(e.onKeyDown,c=>{i||(["Enter"," "].includes(c.key)&&s.onOpenToggle(),c.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})},"DropdownMenuTrigger")),mFo=K2(t=>{const{__scopeDropdownMenu:e,...n}=t,o=U2(e);return j.jsx(Zko,{...o,...n})},"DropdownMenuPortal"),pFo="DropdownMenuContent",IFo=ne.forwardRef(K2(function(e,n){const{__scopeDropdownMenu:o,...i}=e,r=M7t(pFo,o),s=U2(o),a=ne.useRef(!1);return j.jsx(eFo,{id:r.contentId,"aria-labelledby":r.triggerId,...s,...i,ref:n,onCloseAutoFocus:Kr(e.onCloseAutoFocus,A=>{a.current||r.triggerRef.current?.focus(),a.current=!1,A.preventDefault()}),onInteractOutside:Kr(e.onInteractOutside,A=>{const c=A.detail.originalEvent,l=c.button===0&&c.ctrlKey===!0,g=c.button===2||l;(!r.modal||g)&&(a.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"DropdownMenuContent")),fFo=ne.forwardRef(K2(function(e,n){const{__scopeDropdownMenu:o,...i}=e,r=U2(o);return j.jsx(tFo,{...r,...i,ref:n})},"DropdownMenuLabel")),CFo=ne.forwardRef(K2(function(e,n){const{__scopeDropdownMenu:o,...i}=e,r=U2(o);return j.jsx(nFo,{...r,...i,ref:n})},"DropdownMenuItem")),yFo=ne.forwardRef(K2(function(e,n){const{__scopeDropdownMenu:o,...i}=e,r=U2(o);return j.jsx(oFo,{...r,...i,ref:n})},"DropdownMenuCheckboxItem")),EFo=ne.forwardRef(K2(function(e,n){const{__scopeDropdownMenu:o,...i}=e,r=U2(o);return j.jsx(iFo,{...r,...i,ref:n})},"DropdownMenuRadioItem")),xFo=ne.forwardRef(K2(function(e,n){const{__scopeDropdownMenu:o,...i}=e,r=U2(o);return j.jsx(rFo,{...r,...i,ref:n})},"DropdownMenuItemIndicator")),BFo=ne.forwardRef(K2(function(e,n){const{__scopeDropdownMenu:o,...i}=e,r=U2(o);return j.jsx(sFo,{...r,...i,ref:n})},"DropdownMenuSeparator")),QFo=K2(t=>{const{__scopeDropdownMenu:e,children:n,open:o,onOpenChange:i,defaultOpen:r}=t,s=U2(e),[a,A]=U5({prop:o,defaultProp:r??!1,onChange:i,caller:"DropdownMenuSub"});return j.jsx(aFo,{...s,open:a,onOpenChange:A,children:n})},"DropdownMenuSub"),SFo=ne.forwardRef(K2(function(e,n){const{__scopeDropdownMenu:o,...i}=e,r=U2(o);return j.jsx(AFo,{...r,...i,ref:n})},"DropdownMenuSubTrigger")),bFo=ne.forwardRef(K2(function(e,n){const{__scopeDropdownMenu:o,...i}=e,r=U2(o);return j.jsx(cFo,{...r,...i,ref:n,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"DropdownMenuSubContent")),wre=dFo,Nre=_Fo,zU=mFo,VU=IFo,w7t=fFo,ik=CFo,N7t=yFo,R7t=EFo,T7t=xFo,I6e=BFo,DFo=QFo,k7t=SFo,F7t=bFo;const Rre=wre,Tre=Nre,JU=zU,qU=DFo,rk=ne.forwardRef(({className:t,inset:e,children:n,...o},i)=>j.jsxs(k7t,{ref:i,className:ss("rf-flex rf-cursor-default rf-gap-2 rf-select-none rf-items-center rf-rounded-sm rf-px-2 rf-py-1.5 rf-text-sm rf-outline-none focus:rf-bg-zinc-100 data-[state=open]:rf-bg-zinc-100 [&_svg]:rf-pointer-events-none [&_svg]:rf-size-4 [&_svg]:rf-shrink-0 dark:focus:rf-bg-zinc-800 dark:data-[state=open]:rf-bg-zinc-800",e&&"rf-pl-8",t),...o,children:[n,j.jsx(HU,{className:"rf-ml-auto"})]}));rk.displayName=k7t.displayName;const sk=ne.forwardRef(({className:t,...e},n)=>j.jsx(F7t,{ref:n,className:ss("rf-z-50 rf-min-w-[8rem] rf-overflow-hidden rf-rounded-md rf-border rf-border-zinc-200 rf-bg-white rf-p-1 rf-text-zinc-950 rf-shadow-lg data-[state=open]:rf-animate-in data-[state=closed]:rf-animate-out data-[state=closed]:rf-fade-out-0 data-[state=open]:rf-fade-in-0 data-[state=closed]:rf-zoom-out-95 data-[state=open]:rf-zoom-in-95 data-[side=bottom]:rf-slide-in-from-top-2 data-[side=left]:rf-slide-in-from-right-2 data-[side=right]:rf-slide-in-from-left-2 data-[side=top]:rf-slide-in-from-bottom-2 dark:rf-border-zinc-800 dark:rf-bg-zinc-950 dark:rf-text-zinc-50",t),...e}));sk.displayName=F7t.displayName;const WU=ne.forwardRef(({className:t,sideOffset:e=4,...n},o)=>j.jsx(zU,{children:j.jsx(VU,{ref:o,sideOffset:e,className:ss("rf-z-50 rf-min-w-[8rem] rf-overflow-hidden rf-rounded-md rf-border rf-border-zinc-200 rf-bg-white rf-p-1 rf-text-zinc-950 rf-shadow-md dark:rf-border-zinc-800 dark:rf-bg-zinc-950 dark:rf-text-zinc-50","data-[state=open]:rf-animate-in data-[state=closed]:rf-animate-out data-[state=closed]:rf-fade-out-0 data-[state=open]:rf-fade-in-0 data-[state=closed]:rf-zoom-out-95 data-[state=open]:rf-zoom-in-95 data-[side=bottom]:rf-slide-in-from-top-2 data-[side=left]:rf-slide-in-from-right-2 data-[side=right]:rf-slide-in-from-left-2 data-[side=top]:rf-slide-in-from-bottom-2",t),...n})}));WU.displayName=VU.displayName;const Gh=ne.forwardRef(({className:t,inset:e,...n},o)=>j.jsx(ik,{ref:o,className:ss("rf-relative rf-flex rf-cursor-default rf-select-none rf-items-center rf-gap-2 rf-rounded-sm rf-px-2 rf-py-1.5 rf-text-sm rf-outline-none rf-transition-colors focus:rf-bg-zinc-100 focus:rf-text-zinc-900 data-[disabled]:rf-pointer-events-none data-[disabled]:rf-opacity-50 [&>svg]:rf-size-4 [&>svg]:rf-shrink-0 dark:focus:rf-bg-zinc-800 dark:focus:rf-text-zinc-50",e&&"rf-pl-8",t),...n}));Gh.displayName=ik.displayName;const PFo=ne.forwardRef(({className:t,children:e,checked:n,...o},i)=>j.jsxs(N7t,{ref:i,className:ss("rf-relative rf-flex rf-cursor-default rf-select-none rf-items-center rf-rounded-sm rf-py-1.5 rf-pl-8 rf-pr-2 rf-text-sm rf-outline-none rf-transition-colors focus:rf-bg-zinc-100 focus:rf-text-zinc-900 data-[disabled]:rf-pointer-events-none data-[disabled]:rf-opacity-50 dark:focus:rf-bg-zinc-800 dark:focus:rf-text-zinc-50",t),checked:n,...o,children:[j.jsx("span",{className:"rf-absolute rf-left-2 rf-flex rf-h-3.5 rf-w-3.5 rf-items-center rf-justify-center",children:j.jsx(T7t,{children:j.jsx(N3e,{className:"rf-h-4 rf-w-4"})})}),e]}));PFo.displayName=N7t.displayName;const vFo=ne.forwardRef(({className:t,children:e,...n},o)=>j.jsxs(R7t,{ref:o,className:ss("rf-relative rf-flex rf-cursor-default rf-select-none rf-items-center rf-rounded-sm rf-py-1.5 rf-pl-8 rf-pr-2 rf-text-sm rf-outline-none rf-transition-colors focus:rf-bg-zinc-100 focus:rf-text-zinc-900 data-[disabled]:rf-pointer-events-none data-[disabled]:rf-opacity-50 dark:focus:rf-bg-zinc-800 dark:focus:rf-text-zinc-50",t),...n,children:[j.jsx("span",{className:"rf-absolute rf-left-2 rf-flex rf-h-3.5 rf-w-3.5 rf-items-center rf-justify-center",children:j.jsx(T7t,{children:j.jsx(A9t,{className:"rf-h-2 rf-w-2 rf-fill-current"})})}),e]}));vFo.displayName=R7t.displayName;const MFo=ne.forwardRef(({className:t,inset:e,...n},o)=>j.jsx(w7t,{ref:o,className:ss("rf-px-2 rf-py-1.5 rf-text-sm rf-font-semibold",e&&"rf-pl-8",t),...n}));MFo.displayName=w7t.displayName;const L7t=ne.forwardRef(({className:t,...e},n)=>j.jsx(I6e,{ref:n,className:ss("rf--mx-1 rf-my-1 rf-h-px rf-bg-zinc-100 dark:rf-bg-zinc-800",t),...e}));L7t.displayName=I6e.displayName;const H7t=({autoroutingLog:t,onReportAutoroutingLog:e})=>j.jsx(j.Fragment,{children:Object.keys(t??{}).length>0&&j.jsxs(Rre,{children:[j.jsx(Tre,{asChild:!0,children:j.jsxs(Sc,{variant:"outline",children:[j.jsx(JNo,{className:"rf-w-4 rf-h-4 rf-mr-2"}),"Open Autorouting Log"]})}),j.jsx(WU,{className:"rf-w-96",children:Object.entries(t??{}).map(([n,{simpleRouteJson:o}])=>j.jsxs(Gh,{className:"rf-flex rf-justify-between rf-items-center",children:[j.jsx("span",{className:"rf-truncate rf-text-xs rf-mr-2",children:n}),j.jsxs("div",{className:"rf-flex rf-gap-2",children:[j.jsxs(Sc,{variant:"outline",size:"sm",onClick:i=>{i.stopPropagation();const r=new Blob([JSON.stringify(o,null,2)],{type:"application/json"}),s=URL.createObjectURL(r),a=document.createElement("a");a.href=s,a.download=`${n}-autorouting.json`,a.click(),URL.revokeObjectURL(s)},children:[j.jsx(R3e,{className:"rf-w-3 rf-h-3"}),"Download"]}),e&&j.jsxs(Sc,{variant:"outline",size:"sm",onClick:i=>{i.stopPropagation(),e&&e(n,{simpleRouteJson:o})},children:[j.jsx(aRo,{className:"rf-w-3 rf-h-3"}),"Report Bug"]})]})]},n))})]})}),wFo=({code:t,fsMap:e,autoroutingLog:n,circuitJsonErrors:o,circuitJsonWarnings:i,onReportAutoroutingLog:r,errorMessage:s,errorStack:a,circuitJson:A,evalVersion:c})=>{const l=ne.useMemo(()=>{const b=[];if(s&&b.push({type:"Execution Error",message:s,stack:a||void 0,source:"execution"}),o&&o.length>0)for(const D of o)b.push({type:D.type||"Circuit JSON Error",message:D.message||"No error message available",stack:D.stack||"",source:"circuitJson"});return b},[s,a,o]),g=ne.useMemo(()=>!A||!Array.isArray(A)?void 0:A.find(D=>D.type==="source_project_metadata")?.software_used_string,[A]),u=ne.useMemo(()=>{const b=[];if(i&&i.length>0)for(const D of i)b.push({type:D.type||"Circuit JSON Warning",message:D.message||"No warning message available",stack:D.stack||"",source:"circuitJson"});return b},[i]),h=()=>{if(e)try{return mqt(e instanceof Map?Object.fromEntries(e.entries()):e)}catch{}return gRo(t??"")},d=(b,D)=>{const R=`https://github.com/tscircuit/tscircuit.com/issues/new?title=${encodeURIComponent(b)}&body=${encodeURIComponent(D)}`;window.open(R,"_blank")};ne.useEffect(()=>{if(s){let b=s;a&&(b+=`
5593
+ `)},pko=0,nk=[];function Iko(t){var e=ne.useRef([]),n=ne.useRef([0,0]),o=ne.useRef(),i=ne.useState(pko++)[0],r=ne.useState(r7t)[0],s=ne.useRef(t);ne.useEffect(function(){s.current=t},[t]),ne.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var _=HTo([t.lockRef.current],(t.shards||[]).map(u7t),!0).filter(Boolean);return _.forEach(function(m){return m.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),_.forEach(function(m){return m.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var a=ne.useCallback(function(_,m){if("touches"in _&&_.touches.length===2||_.type==="wheel"&&_.ctrlKey)return!s.current.allowPinchZoom;var p=bre(_),I=n.current,f="deltaX"in _?_.deltaX:I[0]-p[0],C="deltaY"in _?_.deltaY:I[1]-p[1],y,E=_.target,B=Math.abs(f)>Math.abs(C)?"h":"v";if("touches"in _&&B==="h"&&E.type==="range")return!1;var Q=window.getSelection(),b=Q&&Q.anchorNode,D=b?b===E||b.contains(E):!1;if(D)return!1;var R=A7t(B,E);if(!R)return!0;if(R?y=B:(y=B==="v"?"h":"v",R=A7t(B,E)),!R)return!1;if(!o.current&&"changedTouches"in _&&(f||C)&&(o.current=y),!y)return!0;var w=o.current||y;return hko(w,m,_,w==="h"?f:C)},[]),A=ne.useCallback(function(_){var m=_;if(!(!nk.length||nk[nk.length-1]!==r)){var p="deltaY"in m?g7t(m):bre(m),I=e.current.filter(function(y){return y.name===m.type&&(y.target===m.target||m.target===y.shadowParent)&&_ko(y.delta,p)})[0];if(I&&I.should){m.cancelable&&m.preventDefault();return}if(!I){var f=(s.current.shards||[]).map(u7t).filter(Boolean).filter(function(y){return y.contains(m.target)}),C=f.length>0?a(m,f[0]):!s.current.noIsolation;C&&m.cancelable&&m.preventDefault()}}},[]),c=ne.useCallback(function(_,m,p,I){var f={name:_,delta:m,target:p,should:I,shadowParent:fko(p)};e.current.push(f),setTimeout(function(){e.current=e.current.filter(function(C){return C!==f})},1)},[]),l=ne.useCallback(function(_){n.current=bre(_),o.current=void 0},[]),g=ne.useCallback(function(_){c(_.type,g7t(_),_.target,a(_,t.lockRef.current))},[]),u=ne.useCallback(function(_){c(_.type,bre(_),_.target,a(_,t.lockRef.current))},[]);ne.useEffect(function(){return nk.push(r),t.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:u}),document.addEventListener("wheel",A,tk),document.addEventListener("touchmove",A,tk),document.addEventListener("touchstart",l,tk),function(){nk=nk.filter(function(_){return _!==r}),document.removeEventListener("wheel",A,tk),document.removeEventListener("touchmove",A,tk),document.removeEventListener("touchstart",l,tk)}},[]);var h=t.removeScrollBar,d=t.inert;return ne.createElement(ne.Fragment,null,d?ne.createElement(r,{styles:mko(i)}):null,h?ne.createElement(ako,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function fko(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const Cko=qTo(i7t,Iko);var l6e=ne.forwardRef(function(t,e){return ne.createElement(Qre,WS({},t,{ref:e,sideCar:Cko}))});l6e.classNames=Qre.classNames;var yko=Object.defineProperty,bc=(t,e)=>yko(t,"name",{value:e,configurable:!0}),g6e=["Enter"," "],Eko=["ArrowDown","PageUp","Home"],d7t=["ArrowUp","PageDown","End"],xko=[...Eko,...d7t],Bko={ltr:[...g6e,"ArrowRight"],rtl:[...g6e,"ArrowLeft"]},Qko={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Dre="Menu",[KU,Sko,bko]=Hae(Dre),[b6,h7t]=RE(Dre,[bko,fre,Ez]),Pre=fre(),_7t=Ez(),[m7t,Tv]=b6(Dre),[Dko,UU]=b6(Dre),Pko=bc(t=>{const{__scopeMenu:e,open:n=!1,children:o,dir:i,onOpenChange:r,modal:s=!0}=t,a=Pre(e),[A,c]=ne.useState(null),l=ne.useRef(!1),g=AQ(r),u=Cz(i);return ne.useEffect(()=>{const h=bc(()=>{l.current=!0,document.addEventListener("pointerdown",d,{capture:!0,once:!0}),document.addEventListener("pointermove",d,{capture:!0,once:!0})},"handleKeyDown"),d=bc(()=>l.current=!1,"handlePointer");return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",d,{capture:!0}),document.removeEventListener("pointermove",d,{capture:!0})}},[]),ne.useEffect(()=>{if(!n)return;const h=bc(()=>g(!1),"handleBlur");return window.addEventListener("blur",h),()=>window.removeEventListener("blur",h)},[n,g]),j.jsx(i6e,{...a,children:j.jsx(m7t,{scope:e,open:n,onOpenChange:g,content:A,onContentChange:c,children:j.jsx(Dko,{scope:e,onClose:ne.useCallback(()=>g(!1),[g]),isUsingKeyboardRef:l,dir:u,modal:s,children:o})})})},"Menu"),p7t=ne.forwardRef(bc(function(e,n){const{__scopeMenu:o,...i}=e,r=Pre(o);return j.jsx(j9t,{...r,...i,ref:n})},"MenuAnchor")),I7t="MenuPortal",[vko,f7t]=b6(I7t,{forceMount:void 0}),Mko=bc(t=>{const{__scopeMenu:e,forceMount:n,children:o,container:i}=t,r=Tv(I7t,e);return j.jsx(vko,{scope:e,forceMount:n,children:j.jsx(cQ,{present:n||r.open,children:j.jsx($9t,{asChild:!0,container:i,children:o})})})},"MenuPortal"),FB="MenuContent",[wko,u6e]=b6(FB),Nko=ne.forwardRef(bc(function(e,n){const o=f7t(FB,e.__scopeMenu),{forceMount:i=o.forceMount,...r}=e,s=Tv(FB,e.__scopeMenu),a=UU(FB,e.__scopeMenu);return j.jsx(KU.Provider,{scope:e.__scopeMenu,children:j.jsx(cQ,{present:i||s.open,children:j.jsx(KU.Slot,{scope:e.__scopeMenu,children:a.modal?j.jsx(Rko,{...r,ref:n}):j.jsx(Tko,{...r,ref:n})})})})},"MenuContent")),Rko=ne.forwardRef(bc(function(e,n){const o=Tv(FB,e.__scopeMenu),i=ne.useRef(null),r=ag(n,i);return ne.useEffect(()=>{const s=i.current;if(s)return e7t(s)},[]),j.jsx(d6e,{...e,ref:r,trapFocus:o.open,disableOutsidePointerEvents:o.open,disableOutsideScroll:!0,onFocusOutside:Kr(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>o.onOpenChange(!1)})},"MenuRootContentModal")),Tko=ne.forwardRef(bc(function(e,n){const o=Tv(FB,e.__scopeMenu);return j.jsx(d6e,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>o.onOpenChange(!1)})},"MenuRootContentNonModal")),kko=Ib("MenuContent.ScrollLock"),d6e=ne.forwardRef(bc(function(e,n){const{__scopeMenu:o,loop:i=!1,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:A,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:g,onFocusOutside:u,onInteractOutside:h,onDismiss:d,disableOutsideScroll:_,...m}=e,p=Tv(FB,o),I=UU(FB,o),f=Pre(o),C=_7t(o),y=Sko(o),[E,B]=ne.useState(null),Q=ne.useRef(null),b=ag(n,Q,p.onContentChange),D=ne.useRef(0),R=ne.useRef(""),w=ne.useRef(0),H=ne.useRef(null),G=ne.useRef("right"),K=ne.useRef(0),U=_?l6e:ne.Fragment,q=_?{as:kko,allowPinchZoom:!0}:void 0,W=bc(re=>{const X=R.current+re,te=y().filter(Be=>!Be.disabled),se=document.activeElement,le=te.find(Be=>Be.ref.current===se)?.textValue,ue=te.map(Be=>Be.textValue),Ce=D7t(ue,X,le),Ee=te.find(Be=>Be.textValue===Ce)?.ref.current;bc((function Be(_e){R.current=_e,window.clearTimeout(D.current),_e!==""&&(D.current=window.setTimeout(()=>Be(""),1e3))}),"updateSearch")(X),Ee&&setTimeout(()=>Ee.focus())},"handleTypeaheadSearch");ne.useEffect(()=>()=>window.clearTimeout(D.current),[]),are();const ee=ne.useCallback(re=>G.current===H.current?.side&&v7t(re,H.current?.area),[]);return j.jsx(wko,{scope:o,searchRef:R,onItemEnter:ne.useCallback(re=>{ee(re)&&re.preventDefault()},[ee]),onItemLeave:ne.useCallback(re=>{ee(re)||(Q.current?.focus(),B(null))},[ee]),onTriggerLeave:ne.useCallback(re=>{ee(re)&&re.preventDefault()},[ee]),pointerGraceTimerRef:w,onPointerGraceIntentChange:ne.useCallback(re=>{H.current=re},[]),children:j.jsx(U,{...q,children:j.jsx(m9t,{asChild:!0,trapped:r,onMountAutoFocus:Kr(s,re=>{re.preventDefault(),Q.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:j.jsx(k3e,{asChild:!0,disableOutsidePointerEvents:A,onEscapeKeyDown:l,onPointerDownOutside:g,onFocusOutside:u,onInteractOutside:h,onDismiss:d,children:j.jsx(VNe,{asChild:!0,...C,dir:I.dir,orientation:"vertical",loop:i,currentTabStopId:E,onCurrentTabStopIdChange:B,onEntryFocus:Kr(c,re=>{I.isUsingKeyboardRef.current||re.preventDefault()}),preventScrollOnEntryFocus:!0,children:j.jsx(X9t,{role:"menu","aria-orientation":"vertical","data-state":m6e(p.open),"data-radix-menu-content":"",dir:I.dir,...f,...m,ref:b,style:{outline:"none",...m.style},onKeyDown:Kr(m.onKeyDown,re=>{const te=re.target.closest("[data-radix-menu-content]")===re.currentTarget,se=re.ctrlKey||re.altKey||re.metaKey,le=re.key.length===1;te&&(re.key==="Tab"&&re.preventDefault(),!se&&le&&W(re.key));const ue=Q.current;if(re.target!==ue||!xko.includes(re.key))return;re.preventDefault();const Ee=y().filter(Be=>!Be.disabled).map(Be=>Be.ref.current);d7t.includes(re.key)&&Ee.reverse(),S7t(Ee)}),onBlur:Kr(e.onBlur,re=>{re.currentTarget.contains(re.target)||(window.clearTimeout(D.current),R.current="")}),onPointerMove:Kr(e.onPointerMove,ok(re=>{const X=re.target,te=K.current!==re.clientX;if(re.currentTarget.contains(X)&&te){const se=re.clientX>K.current?"right":"left";G.current=se,K.current=re.clientX}}))})})})})})})},"MenuContentImpl")),Fko=ne.forwardRef(bc(function(e,n){const{__scopeMenu:o,...i}=e;return j.jsx(gu.div,{...i,ref:n})},"MenuLabel")),h6e="MenuItem",C7t="menu.itemSelect",_6e=ne.forwardRef(bc(function(e,n){const{disabled:o=!1,onSelect:i,...r}=e,s=ne.useRef(null),a=UU(h6e,e.__scopeMenu),A=u6e(h6e,e.__scopeMenu),c=ag(n,s),l=ne.useRef(!1),g=bc(()=>{const u=s.current;if(!o&&u){const h=new CustomEvent(C7t,{bubbles:!0,cancelable:!0});u.addEventListener(C7t,d=>i?.(d),{once:!0}),Uae(u,h),h.defaultPrevented?l.current=!1:a.onClose()}},"handleSelect");return j.jsx(y7t,{...r,ref:c,disabled:o,onClick:Kr(e.onClick,g),onPointerDown:u=>{e.onPointerDown?.(u),l.current=!0},onPointerUp:Kr(e.onPointerUp,u=>{l.current||u.currentTarget?.click()}),onKeyDown:Kr(e.onKeyDown,u=>{o||u.target!==u.currentTarget||A.searchRef.current!==""&&u.key===" "||g6e.includes(u.key)&&(u.currentTarget.click(),u.preventDefault())})})},"MenuItem")),y7t=ne.forwardRef(bc(function(e,n){const{__scopeMenu:o,disabled:i=!1,textValue:r,...s}=e,a=u6e(h6e,o),A=_7t(o),c=ne.useRef(null),l=ag(n,c),[g,u]=ne.useState(!1),[h,d]=ne.useState("");return ne.useEffect(()=>{const _=c.current;_&&d((_.textContent??"").trim())},[s.children]),j.jsx(KU.ItemSlot,{scope:o,disabled:i,textValue:r??h,children:j.jsx(JNe,{asChild:!0,...A,focusable:!i,children:j.jsx(gu.div,{role:"menuitem","data-highlighted":g?"":void 0,"aria-disabled":i||void 0,"data-disabled":i?"":void 0,...s,ref:l,onPointerMove:Kr(e.onPointerMove,ok(_=>{i?a.onItemLeave(_):(a.onItemEnter(_),_.defaultPrevented||_.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Kr(e.onPointerLeave,ok(_=>a.onItemLeave(_))),onFocus:Kr(e.onFocus,()=>u(!0)),onBlur:Kr(e.onBlur,()=>u(!1))})})})},"MenuItemImpl")),Lko=ne.forwardRef(bc(function(e,n){const{checked:o=!1,onCheckedChange:i,...r}=e;return j.jsx(x7t,{scope:e.__scopeMenu,checked:o,children:j.jsx(_6e,{role:"menuitemcheckbox","aria-checked":YU(o)?"mixed":o,...r,ref:n,"data-state":Mre(o),onSelect:Kr(r.onSelect,()=>i?.(YU(o)?!0:!o),{checkForDefaultPrevented:!1})})})},"MenuCheckboxItem")),Hko="MenuRadioGroup",[xZo,Gko]=b6(Hko,{value:void 0,onValueChange:bc(()=>{},"onValueChange")}),Oko="MenuRadioItem",Kko=ne.forwardRef(bc(function(e,n){const{value:o,...i}=e,r=Gko(Oko,e.__scopeMenu),s=o===r.value;return j.jsx(x7t,{scope:e.__scopeMenu,checked:s,children:j.jsx(_6e,{role:"menuitemradio","aria-checked":s,...i,ref:n,"data-state":Mre(s),onSelect:Kr(i.onSelect,()=>r.onValueChange?.(o),{checkForDefaultPrevented:!1})})})},"MenuRadioItem")),E7t="MenuItemIndicator",[x7t,Uko]=b6(E7t,{checked:!1}),Yko=ne.forwardRef(bc(function(e,n){const{__scopeMenu:o,forceMount:i,...r}=e,s=Uko(E7t,o);return j.jsx(cQ,{present:i||YU(s.checked)||s.checked===!0,children:j.jsx(gu.span,{...r,ref:n,"data-state":Mre(s.checked)})})},"MenuItemIndicator")),zko=ne.forwardRef(bc(function(e,n){const{__scopeMenu:o,...i}=e;return j.jsx(gu.div,{role:"separator","aria-orientation":"horizontal",...i,ref:n})},"MenuSeparator")),B7t="MenuSub",[Vko,Q7t]=b6(B7t),Jko=bc(t=>{const{__scopeMenu:e,children:n,open:o=!1,onOpenChange:i}=t,r=Tv(B7t,e),s=Pre(e),[a,A]=ne.useState(null),[c,l]=ne.useState(null),g=AQ(i);return ne.useEffect(()=>(r.open===!1&&g(!1),()=>g(!1)),[r.open,g]),j.jsx(i6e,{...s,children:j.jsx(m7t,{scope:e,open:o,onOpenChange:g,content:c,onContentChange:l,children:j.jsx(Vko,{scope:e,contentId:Ox(),triggerId:Ox(),trigger:a,onTriggerChange:A,children:n})})})},"MenuSub"),vre="MenuSubTrigger",qko=ne.forwardRef(bc(function(e,n){const o=Tv(vre,e.__scopeMenu),i=UU(vre,e.__scopeMenu),r=Q7t(vre,e.__scopeMenu),s=u6e(vre,e.__scopeMenu),a=ne.useRef(null),{pointerGraceTimerRef:A,onPointerGraceIntentChange:c}=s,l={__scopeMenu:e.__scopeMenu},g=ne.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);ne.useEffect(()=>g,[g]),ne.useEffect(()=>{const h=A.current;return()=>{window.clearTimeout(h),c(null)}},[A,c]);const u=ag(n,r.onTriggerChange);return j.jsx(p7t,{asChild:!0,...l,children:j.jsx(y7t,{id:r.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?r.contentId:void 0,"data-state":m6e(o.open),...e,ref:u,onClick:h=>{e.onClick?.(h),!(e.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),o.open||o.onOpenChange(!0))},onPointerMove:Kr(e.onPointerMove,ok(h=>{s.onItemEnter(h),!h.defaultPrevented&&!e.disabled&&!o.open&&!a.current&&(s.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{o.onOpenChange(!0),g()},100))})),onPointerLeave:Kr(e.onPointerLeave,ok(h=>{g();const d=o.content?.getBoundingClientRect();if(d){const _=o.content?.dataset.side,m=_==="right",p=m?-5:5,I=d[m?"left":"right"],f=d[m?"right":"left"];s.onPointerGraceIntentChange({area:[{x:h.clientX+p,y:h.clientY},{x:I,y:d.top},{x:f,y:d.top},{x:f,y:d.bottom},{x:I,y:d.bottom}],side:_}),window.clearTimeout(A.current),A.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(h),h.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:Kr(e.onKeyDown,h=>{e.disabled||h.target!==h.currentTarget||s.searchRef.current!==""&&h.key===" "||Bko[i.dir].includes(h.key)&&(o.onOpenChange(!0),o.content?.focus(),h.preventDefault())})})})},"MenuSubTrigger")),Wko="MenuSubContent",jko=ne.forwardRef(bc(function(e,n){const o=f7t(FB,e.__scopeMenu),{forceMount:i=o.forceMount,align:r="start",...s}=e,a=Tv(FB,e.__scopeMenu),A=UU(FB,e.__scopeMenu),c=Q7t(Wko,e.__scopeMenu),l=ne.useRef(null),g=ag(n,l);return j.jsx(KU.Provider,{scope:e.__scopeMenu,children:j.jsx(cQ,{present:i||a.open,children:j.jsx(KU.Slot,{scope:e.__scopeMenu,children:j.jsx(d6e,{id:c.contentId,"aria-labelledby":c.triggerId,...s,ref:g,align:r,side:A.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{A.isUsingKeyboardRef.current&&l.current?.focus(),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:Kr(e.onFocusOutside,u=>{u.target!==c.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:Kr(e.onEscapeKeyDown,u=>{A.onClose(),u.preventDefault()}),onKeyDown:Kr(e.onKeyDown,u=>{const h=u.currentTarget.contains(u.target),d=Qko[A.dir].includes(u.key);h&&d&&(a.onOpenChange(!1),c.trigger?.focus(),u.preventDefault())})})})})})},"MenuSubContent"));function m6e(t){return t?"open":"closed"}bc(m6e,"getOpenState");function YU(t){return t==="indeterminate"}bc(YU,"isIndeterminate");function Mre(t){return YU(t)?"indeterminate":t?"checked":"unchecked"}bc(Mre,"getCheckedState");function S7t(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}bc(S7t,"focusFirst");function b7t(t,e){return t.map((n,o)=>t[(e+o)%t.length])}bc(b7t,"wrapArray");function D7t(t,e,n){const i=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,r=n?t.indexOf(n):-1;let s=b7t(t,Math.max(r,0));i.length===1&&(s=s.filter(c=>c!==n));const A=s.find(c=>c.toLowerCase().startsWith(i.toLowerCase()));return A!==n?A:void 0}bc(D7t,"getNextMatch");function P7t(t,e){const{x:n,y:o}=t;let i=!1;for(let r=0,s=e.length-1;r<e.length;s=r++){const a=e[r],A=e[s],c=a.x,l=a.y,g=A.x,u=A.y;l>o!=u>o&&n<(g-c)*(o-l)/(u-l)+c&&(i=!i)}return i}bc(P7t,"isPointInPolygon");function v7t(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return P7t(n,e)}bc(v7t,"isPointerInGraceArea");function ok(t){return e=>e.pointerType==="mouse"?t(e):void 0}bc(ok,"whenMouse");var Xko=Pko,$ko=p7t,Zko=Mko,eFo=Nko,tFo=Fko,nFo=_6e,oFo=Lko,iFo=Kko,rFo=Yko,sFo=zko,aFo=Jko,AFo=qko,cFo=jko,lFo=Object.defineProperty,K2=(t,e)=>lFo(t,"name",{value:e,configurable:!0}),p6e="DropdownMenu",[gFo,BZo]=RE(p6e,[h7t]),U2=h7t(),[uFo,M7t]=gFo(p6e),dFo=K2(t=>{const{__scopeDropdownMenu:e,children:n,dir:o,open:i,defaultOpen:r,onOpenChange:s,modal:a=!0}=t,A=U2(e),c=ne.useRef(null),[l,g]=U5({prop:i,defaultProp:r??!1,onChange:s,caller:p6e});return j.jsx(uFo,{scope:e,triggerId:Ox(),triggerRef:c,contentId:Ox(),open:l,onOpenChange:g,onOpenToggle:ne.useCallback(()=>g(u=>!u),[g]),modal:a,children:j.jsx(Xko,{...A,open:l,onOpenChange:g,dir:o,modal:a,children:n})})},"DropdownMenu"),hFo="DropdownMenuTrigger",_Fo=ne.forwardRef(K2(function(e,n){const{__scopeDropdownMenu:o,disabled:i=!1,...r}=e,s=M7t(hFo,o),a=U2(o),A=ag(n,s.triggerRef);return j.jsx($ko,{asChild:!0,...a,children:j.jsx(gu.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":i?"":void 0,disabled:i,...r,ref:A,onPointerDown:Kr(e.onPointerDown,c=>{!i&&c.button===0&&c.ctrlKey===!1&&(s.onOpenToggle(),s.open||c.preventDefault())}),onKeyDown:Kr(e.onKeyDown,c=>{i||(["Enter"," "].includes(c.key)&&s.onOpenToggle(),c.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})},"DropdownMenuTrigger")),mFo=K2(t=>{const{__scopeDropdownMenu:e,...n}=t,o=U2(e);return j.jsx(Zko,{...o,...n})},"DropdownMenuPortal"),pFo="DropdownMenuContent",IFo=ne.forwardRef(K2(function(e,n){const{__scopeDropdownMenu:o,...i}=e,r=M7t(pFo,o),s=U2(o),a=ne.useRef(!1);return j.jsx(eFo,{id:r.contentId,"aria-labelledby":r.triggerId,...s,...i,ref:n,onCloseAutoFocus:Kr(e.onCloseAutoFocus,A=>{a.current||r.triggerRef.current?.focus(),a.current=!1,A.preventDefault()}),onInteractOutside:Kr(e.onInteractOutside,A=>{const c=A.detail.originalEvent,l=c.button===0&&c.ctrlKey===!0,g=c.button===2||l;(!r.modal||g)&&(a.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"DropdownMenuContent")),fFo=ne.forwardRef(K2(function(e,n){const{__scopeDropdownMenu:o,...i}=e,r=U2(o);return j.jsx(tFo,{...r,...i,ref:n})},"DropdownMenuLabel")),CFo=ne.forwardRef(K2(function(e,n){const{__scopeDropdownMenu:o,...i}=e,r=U2(o);return j.jsx(nFo,{...r,...i,ref:n})},"DropdownMenuItem")),yFo=ne.forwardRef(K2(function(e,n){const{__scopeDropdownMenu:o,...i}=e,r=U2(o);return j.jsx(oFo,{...r,...i,ref:n})},"DropdownMenuCheckboxItem")),EFo=ne.forwardRef(K2(function(e,n){const{__scopeDropdownMenu:o,...i}=e,r=U2(o);return j.jsx(iFo,{...r,...i,ref:n})},"DropdownMenuRadioItem")),xFo=ne.forwardRef(K2(function(e,n){const{__scopeDropdownMenu:o,...i}=e,r=U2(o);return j.jsx(rFo,{...r,...i,ref:n})},"DropdownMenuItemIndicator")),BFo=ne.forwardRef(K2(function(e,n){const{__scopeDropdownMenu:o,...i}=e,r=U2(o);return j.jsx(sFo,{...r,...i,ref:n})},"DropdownMenuSeparator")),QFo=K2(t=>{const{__scopeDropdownMenu:e,children:n,open:o,onOpenChange:i,defaultOpen:r}=t,s=U2(e),[a,A]=U5({prop:o,defaultProp:r??!1,onChange:i,caller:"DropdownMenuSub"});return j.jsx(aFo,{...s,open:a,onOpenChange:A,children:n})},"DropdownMenuSub"),SFo=ne.forwardRef(K2(function(e,n){const{__scopeDropdownMenu:o,...i}=e,r=U2(o);return j.jsx(AFo,{...r,...i,ref:n})},"DropdownMenuSubTrigger")),bFo=ne.forwardRef(K2(function(e,n){const{__scopeDropdownMenu:o,...i}=e,r=U2(o);return j.jsx(cFo,{...r,...i,ref:n,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"DropdownMenuSubContent")),wre=dFo,Nre=_Fo,zU=mFo,VU=IFo,w7t=fFo,ik=CFo,N7t=yFo,R7t=EFo,T7t=xFo,I6e=BFo,DFo=QFo,k7t=SFo,F7t=bFo;const Rre=wre,Tre=Nre,JU=zU,qU=DFo,rk=ne.forwardRef(({className:t,inset:e,children:n,...o},i)=>j.jsxs(k7t,{ref:i,className:ss("rf-flex rf-cursor-default rf-gap-2 rf-select-none rf-items-center rf-rounded-sm rf-px-2 rf-py-1.5 rf-text-sm rf-outline-none focus:rf-bg-zinc-100 data-[state=open]:rf-bg-zinc-100 [&_svg]:rf-pointer-events-none [&_svg]:rf-size-4 [&_svg]:rf-shrink-0 dark:focus:rf-bg-zinc-800 dark:data-[state=open]:rf-bg-zinc-800",e&&"rf-pl-8",t),...o,children:[n,j.jsx(HU,{className:"rf-ml-auto"})]}));rk.displayName=k7t.displayName;const sk=ne.forwardRef(({className:t,...e},n)=>j.jsx(F7t,{ref:n,className:ss("rf-z-[102] rf-min-w-[8rem] rf-overflow-hidden rf-rounded-md rf-border rf-border-zinc-200 rf-bg-white rf-p-1 rf-text-zinc-950 rf-shadow-lg data-[state=open]:rf-animate-in data-[state=closed]:rf-animate-out data-[state=closed]:rf-fade-out-0 data-[state=open]:rf-fade-in-0 data-[state=closed]:rf-zoom-out-95 data-[state=open]:rf-zoom-in-95 data-[side=bottom]:rf-slide-in-from-top-2 data-[side=left]:rf-slide-in-from-right-2 data-[side=right]:rf-slide-in-from-left-2 data-[side=top]:rf-slide-in-from-bottom-2 dark:rf-border-zinc-800 dark:rf-bg-zinc-950 dark:rf-text-zinc-50",t),...e}));sk.displayName=F7t.displayName;const WU=ne.forwardRef(({className:t,sideOffset:e=4,...n},o)=>j.jsx(zU,{children:j.jsx(VU,{ref:o,sideOffset:e,className:ss("rf-z-50 rf-min-w-[8rem] rf-overflow-hidden rf-rounded-md rf-border rf-border-zinc-200 rf-bg-white rf-p-1 rf-text-zinc-950 rf-shadow-md dark:rf-border-zinc-800 dark:rf-bg-zinc-950 dark:rf-text-zinc-50","data-[state=open]:rf-animate-in data-[state=closed]:rf-animate-out data-[state=closed]:rf-fade-out-0 data-[state=open]:rf-fade-in-0 data-[state=closed]:rf-zoom-out-95 data-[state=open]:rf-zoom-in-95 data-[side=bottom]:rf-slide-in-from-top-2 data-[side=left]:rf-slide-in-from-right-2 data-[side=right]:rf-slide-in-from-left-2 data-[side=top]:rf-slide-in-from-bottom-2",t),...n})}));WU.displayName=VU.displayName;const Gh=ne.forwardRef(({className:t,inset:e,...n},o)=>j.jsx(ik,{ref:o,className:ss("rf-relative rf-flex rf-cursor-default rf-select-none rf-items-center rf-gap-2 rf-rounded-sm rf-px-2 rf-py-1.5 rf-text-sm rf-outline-none rf-transition-colors focus:rf-bg-zinc-100 focus:rf-text-zinc-900 data-[disabled]:rf-pointer-events-none data-[disabled]:rf-opacity-50 [&>svg]:rf-size-4 [&>svg]:rf-shrink-0 dark:focus:rf-bg-zinc-800 dark:focus:rf-text-zinc-50",e&&"rf-pl-8",t),...n}));Gh.displayName=ik.displayName;const PFo=ne.forwardRef(({className:t,children:e,checked:n,...o},i)=>j.jsxs(N7t,{ref:i,className:ss("rf-relative rf-flex rf-cursor-default rf-select-none rf-items-center rf-rounded-sm rf-py-1.5 rf-pl-8 rf-pr-2 rf-text-sm rf-outline-none rf-transition-colors focus:rf-bg-zinc-100 focus:rf-text-zinc-900 data-[disabled]:rf-pointer-events-none data-[disabled]:rf-opacity-50 dark:focus:rf-bg-zinc-800 dark:focus:rf-text-zinc-50",t),checked:n,...o,children:[j.jsx("span",{className:"rf-absolute rf-left-2 rf-flex rf-h-3.5 rf-w-3.5 rf-items-center rf-justify-center",children:j.jsx(T7t,{children:j.jsx(N3e,{className:"rf-h-4 rf-w-4"})})}),e]}));PFo.displayName=N7t.displayName;const vFo=ne.forwardRef(({className:t,children:e,...n},o)=>j.jsxs(R7t,{ref:o,className:ss("rf-relative rf-flex rf-cursor-default rf-select-none rf-items-center rf-rounded-sm rf-py-1.5 rf-pl-8 rf-pr-2 rf-text-sm rf-outline-none rf-transition-colors focus:rf-bg-zinc-100 focus:rf-text-zinc-900 data-[disabled]:rf-pointer-events-none data-[disabled]:rf-opacity-50 dark:focus:rf-bg-zinc-800 dark:focus:rf-text-zinc-50",t),...n,children:[j.jsx("span",{className:"rf-absolute rf-left-2 rf-flex rf-h-3.5 rf-w-3.5 rf-items-center rf-justify-center",children:j.jsx(T7t,{children:j.jsx(A9t,{className:"rf-h-2 rf-w-2 rf-fill-current"})})}),e]}));vFo.displayName=R7t.displayName;const MFo=ne.forwardRef(({className:t,inset:e,...n},o)=>j.jsx(w7t,{ref:o,className:ss("rf-px-2 rf-py-1.5 rf-text-sm rf-font-semibold",e&&"rf-pl-8",t),...n}));MFo.displayName=w7t.displayName;const L7t=ne.forwardRef(({className:t,...e},n)=>j.jsx(I6e,{ref:n,className:ss("rf--mx-1 rf-my-1 rf-h-px rf-bg-zinc-100 dark:rf-bg-zinc-800",t),...e}));L7t.displayName=I6e.displayName;const H7t=({autoroutingLog:t,onReportAutoroutingLog:e})=>j.jsx(j.Fragment,{children:Object.keys(t??{}).length>0&&j.jsxs(Rre,{children:[j.jsx(Tre,{asChild:!0,children:j.jsxs(Sc,{variant:"outline",children:[j.jsx(JNo,{className:"rf-w-4 rf-h-4 rf-mr-2"}),"Open Autorouting Log"]})}),j.jsx(WU,{className:"rf-w-96",children:Object.entries(t??{}).map(([n,{simpleRouteJson:o}])=>j.jsxs(Gh,{className:"rf-flex rf-justify-between rf-items-center",children:[j.jsx("span",{className:"rf-truncate rf-text-xs rf-mr-2",children:n}),j.jsxs("div",{className:"rf-flex rf-gap-2",children:[j.jsxs(Sc,{variant:"outline",size:"sm",onClick:i=>{i.stopPropagation();const r=new Blob([JSON.stringify(o,null,2)],{type:"application/json"}),s=URL.createObjectURL(r),a=document.createElement("a");a.href=s,a.download=`${n}-autorouting.json`,a.click(),URL.revokeObjectURL(s)},children:[j.jsx(R3e,{className:"rf-w-3 rf-h-3"}),"Download"]}),e&&j.jsxs(Sc,{variant:"outline",size:"sm",onClick:i=>{i.stopPropagation(),e&&e(n,{simpleRouteJson:o})},children:[j.jsx(aRo,{className:"rf-w-3 rf-h-3"}),"Report Bug"]})]})]},n))})]})}),wFo=({code:t,fsMap:e,autoroutingLog:n,circuitJsonErrors:o,circuitJsonWarnings:i,onReportAutoroutingLog:r,errorMessage:s,errorStack:a,circuitJson:A,evalVersion:c})=>{const l=ne.useMemo(()=>{const b=[];if(s&&b.push({type:"Execution Error",message:s,stack:a||void 0,source:"execution"}),o&&o.length>0)for(const D of o)b.push({type:D.type||"Circuit JSON Error",message:D.message||"No error message available",stack:D.stack||"",source:"circuitJson"});return b},[s,a,o]),g=ne.useMemo(()=>!A||!Array.isArray(A)?void 0:A.find(D=>D.type==="source_project_metadata")?.software_used_string,[A]),u=ne.useMemo(()=>{const b=[];if(i&&i.length>0)for(const D of i)b.push({type:D.type||"Circuit JSON Warning",message:D.message||"No warning message available",stack:D.stack||"",source:"circuitJson"});return b},[i]),h=()=>{if(e)try{return mqt(e instanceof Map?Object.fromEntries(e.entries()):e)}catch{}return gRo(t??"")},d=(b,D)=>{const R=`https://github.com/tscircuit/tscircuit.com/issues/new?title=${encodeURIComponent(b)}&body=${encodeURIComponent(D)}`;window.open(R,"_blank")};ne.useEffect(()=>{if(s){let b=s;a&&(b+=`
5594
5594
 
5595
5595
  ${a}`),typeof window<"u"&&(window.__TSCIRCUIT_LAST_EXECUTION_ERROR=b)}},[s,a]);const[_,m]=ne.useState(()=>{const b=new Set;return l.forEach((D,R)=>b.add(R)),b}),[p,I]=ne.useState(()=>{const b=new Set;return u.forEach((D,R)=>b.add(R)),b}),[f,C]=ne.useState(!1),[y,E]=ne.useState(!1);if(l.length===0&&u.length===0)return j.jsxs("div",{className:"px-2",children:[j.jsx("div",{className:"rf-mt-4 rf-bg-green-50 rf-rounded-md rf-border rf-border-green-200",children:j.jsxs("div",{className:"rf-p-4",children:[j.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-green-800 rf-mb-3",children:"No errors or warnings!"}),j.jsx("p",{className:"rf-text-sm rf-text-green-700",children:"Your code is running without any errors or warnings."})]})}),j.jsxs("div",{className:"rf-flex rf-gap-2 rf-mt-4 rf-justify-end",children:[j.jsx(H7t,{autoroutingLog:n,onReportAutoroutingLog:r}),j.jsxs(Sc,{variant:"outline",className:"rf-p-1",onClick:()=>{const b=h();d("Issue Report",`[Package code to reproduce](${b})`)},children:[j.jsx(w3e,{className:"rf-w-4 rf-h-4"}),"Report Issue"]})]})]});const B=b=>{m(D=>{const R=new Set(D);return R.has(b)?R.delete(b):R.add(b),R})},Q=b=>{I(D=>{const R=new Set(D);return R.has(b)?R.delete(b):R.add(b),R})};return j.jsx(j.Fragment,{children:j.jsxs("div",{className:"rf-w-full rf-flex rf-flex-col rf-h-full",children:[j.jsxs("div",{className:"rf-overflow-y-auto rf-min-h-0",children:[l.length>0&&j.jsxs("div",{className:"rf-mt-2",children:[j.jsxs("div",{className:"rf-text-xs rf-text-red-700 rf-font-semibold rf-px-2 rf-py-1 rf-bg-red-50 rf-border-b rf-border-red-200 rf-flex rf-items-center rf-gap-2 rf-cursor-pointer hover:rf-bg-red-100",onClick:()=>C(!f),children:[f?j.jsx(HU,{className:"rf-h-3 rf-w-3 rf-text-red-700"}):j.jsx(s9t,{className:"rf-h-3 rf-w-3 rf-text-red-700"}),j.jsxs("span",{children:[l.length," ",l.length===1?"error":"errors"]})]}),!f&&l.map((b,D)=>{const R=_.has(D);b.message;const w=b.stack||c||g;return j.jsxs("div",{className:"rf-bg-white hover:rf-bg-red-100",children:[j.jsxs("div",{className:"rf-flex rf-items-start rf-gap-1 rf-px-2 rf-pt-1 rf-pb-1 rf-cursor-pointer rf-bg-red-50/50",onClick:()=>w&&B(D),children:[j.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",style:{marginTop:"2px"},children:[j.jsx(VNo,{className:"rf-h-4 rf-w-4 rf-text-red-500 rf-flex-shrink-0"}),w&&j.jsx(HU,{className:`rf-h-3 rf-w-3 rf-text-red-500 rf-flex-shrink-0 rf-transition-transform ${R?"rf-rotate-90":""}`})]}),j.jsxs("div",{className:"rf-flex-1 rf-min-w-0 rf-leading-[1rem]",children:[j.jsxs("span",{className:"rf-text-xs rf-font-mono rf-text-red-700 rf-leading-[0.95rem]",children:[b.type,":"]}),j.jsx("span",{className:"rf-text-xs rf-font-mono rf-text-red-600 rf-ml-1 rf-leading-[0.95rem]",children:b.message})]})]}),R&&w&&j.jsxs("div",{className:"rf-bg-red-50/50 rf-pl-12",children:[b.stack?.split(`
5596
5596
  `).filter(H=>H.trim()).slice(1).map((H,G)=>j.jsx("div",{className:"rf-px-2 rf-leading-tight",children:j.jsx("span",{className:"rf-text-xs rf-font-mono rf-text-red-500",children:H})},G)),(c||g)&&j.jsx("div",{className:"rf-px-2",children:j.jsxs("span",{className:"rf-text-xs rf-font-mono rf-text-red-400",children:[c&&`@tscircuit/eval@${c}`,c&&g&&" • ",g]})})]})]},D)})]}),u.length>0&&j.jsxs("div",{className:"rf-mt-2",children:[j.jsxs("div",{className:"rf-text-xs rf-text-orange-700 rf-font-semibold rf-px-2 rf-py-1 rf-bg-orange-50 rf-border-b rf-border-orange-200 rf-flex rf-items-center rf-gap-2 rf-cursor-pointer hover:rf-bg-orange-100",onClick:()=>E(!y),children:[y?j.jsx(HU,{className:"rf-h-3 rf-w-3 rf-text-orange-700"}):j.jsx(s9t,{className:"rf-h-3 rf-w-3 rf-text-orange-700"}),j.jsxs("span",{children:[u.length," ",u.length===1?"warning":"warnings"]})]}),!y&&u.map((b,D)=>{const R=p.has(D);b.message;const w=!!b.stack;return j.jsxs("div",{className:"rf-bg-white hover:rf-bg-orange-100",children:[j.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2 rf-px-2 rf-py-1 rf-cursor-pointer rf-bg-orange-50/50",onClick:()=>w&&Q(D),children:[j.jsx(a9t,{className:"rf-h-4 rf-w-4 rf-text-orange-500 rf-flex-shrink-0"}),w&&j.jsx(HU,{className:`rf-h-3 rf-w-3 rf-text-orange-500 rf-flex-shrink-0 rf-transition-transform ${R?"rf-rotate-90":""}`}),j.jsxs("div",{className:"rf-flex-1 rf-min-w-0 rf-flex rf-items-center rf-flex-wrap",children:[j.jsxs("span",{className:"rf-text-xs rf-font-mono rf-text-orange-700 rf-break-words",children:[b.type,":"]}),j.jsx("span",{className:"rf-text-xs rf-font-mono rf-text-orange-600 rf-ml-1 rf-break-words",children:b.message})]})]}),R&&w&&j.jsx("div",{className:"rf-bg-orange-50/50 rf-pl-12",children:b.stack?.split(`
@@ -5756,7 +5756,7 @@ $1`).replace(/>(\s*)(?=<!--\s*\/)/g,"> ")}}});function wFt(t,e,n){if(!e||!n)retu
5756
5756
  &:hover {
5757
5757
  background-color: rgba(255, 255, 255, 0.1);
5758
5758
  }
5759
- `,...i,style:o,children:[j.jsx("input",{type:"radio",checked:e,onChange:()=>{},readOnly:!0}),j.jsx("span",{style:{color:"#eee"},children:t})]})},dYo=({children:t,elements:e})=>{const n=aYo(),{isMouseOverContainer:o,setIsMouseOverContainer:i,selectedLayer:r,selectLayer:s,editModes:a,viewSettings:A,setEditMode:c,setIsShowingRatsNest:l,setIsShowingMultipleTracesLength:g,setIsShowingAutorouting:u,setIsShowingDrcErrors:h,setIsShowingCopperPours:d,setIsShowingCourtyards:_,setIsShowingPcbGroups:m,setIsShowingGroupAnchorOffsets:p,setIsShowingSolderMask:I,setIsShowingSilkscreen:f,setIsShowingFabricationNotes:C,setIsShowingPcbNotes:y,setPcbGroupViewMode:E,setHoveredErrorId:B,setFocusedErrorId:Q}=n0(Me=>({isMouseOverContainer:Me.is_mouse_over_container,setIsMouseOverContainer:Me.setIsMouseOverContainer,selectedLayer:Me.selected_layer,selectLayer:Me.selectLayer,editModes:{in_move_footprint_mode:Me.in_move_footprint_mode,in_draw_trace_mode:Me.in_draw_trace_mode},viewSettings:{is_showing_rats_nest:Me.is_showing_rats_nest,is_showing_multiple_traces_length:Me.is_showing_multiple_traces_length,is_showing_autorouting:Me.is_showing_autorouting,is_showing_drc_errors:Me.is_showing_drc_errors,is_showing_copper_pours:Me.is_showing_copper_pours,is_showing_courtyards:Me.is_showing_courtyards,is_showing_pcb_groups:Me.is_showing_pcb_groups,is_showing_group_anchor_offsets:Me.is_showing_group_anchor_offsets,is_showing_solder_mask:Me.is_showing_solder_mask,is_showing_silkscreen:Me.is_showing_silkscreen,is_showing_fabrication_notes:Me.is_showing_fabrication_notes,is_showing_pcb_notes:Me.is_showing_pcb_notes,pcb_group_view_mode:Me.pcb_group_view_mode},setEditMode:Me.setEditMode,setIsShowingRatsNest:Me.setIsShowingRatsNest,setIsShowingMultipleTracesLength:Me.setIsShowingMultipleTracesLength,setIsShowingAutorouting:Me.setIsShowingAutorouting,setIsShowingDrcErrors:Me.setIsShowingDrcErrors,setIsShowingCopperPours:Me.setIsShowingCopperPours,setIsShowingCourtyards:Me.setIsShowingCourtyards,setIsShowingPcbGroups:Me.setIsShowingPcbGroups,setIsShowingGroupAnchorOffsets:Me.setIsShowingGroupAnchorOffsets,setIsShowingSolderMask:Me.setIsShowingSolderMask,setIsShowingSilkscreen:Me.setIsShowingSilkscreen,setIsShowingFabricationNotes:Me.setIsShowingFabricationNotes,setIsShowingPcbNotes:Me.setIsShowingPcbNotes,setPcbGroupViewMode:Me.setPcbGroupViewMode,setHoveredErrorId:Me.setHoveredErrorId,setFocusedErrorId:Me.setFocusedErrorId})),[b,D]=ne.useState(!1),[R,w]=ne.useState(!1),[H,G]=ne.useState(!1),[K,U]=ne.useState(!1),[q,W]=ne.useState(!1);ne.useEffect(()=>{const Me=()=>U(!0),Fe=()=>U(!1),Ye=()=>W(!0),Ne=()=>W(!1);return window.addEventListener("arm-dimension-tool",Me),window.addEventListener("disarm-dimension-tool",Fe),window.addEventListener("arm-bounds-tool",Ye),window.addEventListener("disarm-bounds-tool",Ne),()=>{window.removeEventListener("arm-dimension-tool",Me),window.removeEventListener("disarm-dimension-tool",Fe),window.removeEventListener("arm-bounds-tool",Ye),window.removeEventListener("disarm-bounds-tool",Ne)}},[]);const ee=G8e(e??[]),re=ee,X=ne.useRef(!1),te=ne.useRef(null),se={1:ee[0]?()=>s(ee[0]):()=>{},2:ee[1]?()=>s(ee[1]):()=>{},3:ee[2]?()=>s(ee[2]):()=>{},4:ee[3]?()=>s(ee[3]):()=>{},5:ee[4]?()=>s(ee[4]):()=>{},6:ee[5]?()=>s(ee[5]):()=>{},7:ee[6]?()=>s(ee[6]):()=>{},8:ee[7]?()=>s(ee[7]):()=>{},9:ee[8]?()=>s(ee[8]):()=>{},0:ee[9]?()=>s(ee[9]):()=>{}};ZS("1",se[1],te),ZS("2",se[2],te),ZS("3",se[3],te),ZS("4",se[4],te),ZS("5",se[5],te),ZS("6",se[6],te),ZS("7",se[7],te),ZS("8",se[8],te),ZS("9",se[9],te),ZS("0",se[0],te),ne.useLayoutEffect(()=>{if(X.current)return;X.current=!0;const Me=Fe=>{if(te.current){const Ye=te.current.getBoundingClientRect();Fe.clientX>=Ye.left&&Fe.clientX<=Ye.right&&Fe.clientY>=Ye.top&&Fe.clientY<=Ye.bottom&&i(!0)}document.removeEventListener("mousemove",Me)};return document.addEventListener("mousemove",Me),()=>{document.removeEventListener("mousemove",Me)}},[i]);const le=ne.useCallback(()=>{i(!0)},[i]),ue=ne.useCallback(()=>{o||i(!0)},[o,i]),Ce=ne.useCallback(()=>{i(!1),w(!1),D(!1),G(!1)},[i]),Ee=ne.useCallback(()=>{w(!R)},[R]),Be=ne.useCallback(()=>{const Me=!H;G(Me),Me&&D(!1),Me||B(null)},[H,B]),_e=ne.useCallback(()=>{G(!1)},[]),ye=ne.useCallback(()=>{c(a.in_draw_trace_mode?"off":"draw_trace")},[a.in_draw_trace_mode,c]),pe=ne.useCallback(()=>{c(a.in_move_footprint_mode?"off":"move_footprint")},[a.in_move_footprint_mode,c]),we=ne.useCallback(()=>{l(!A.is_showing_rats_nest)},[A.is_showing_rats_nest,l]),Ge=ne.useCallback(()=>{U(!0),W(!1),window.dispatchEvent(new Event("arm-dimension-tool"))},[]),Ve=ne.useCallback(()=>{W(!0),U(!1),window.dispatchEvent(new Event("arm-bounds-tool"))},[]),Ie=ne.useCallback(()=>{const Me=!b;D(Me),Me&&G(!1)},[b]),qe=ne.useCallback(Me=>{Me.stopPropagation()},[]);return j.jsxs("div",{ref:te,style:{position:"relative",zIndex:"999 !important"},onMouseEnter:le,onMouseLeave:Ce,onMouseMove:ue,children:[t,j.jsxs("div",{style:{position:"absolute",bottom:4,right:8,pointerEvents:"none",color:"white",fontSize:11,opacity:o?.5:0,transition:"opacity 1s",transitionDelay:"2s",fontFamily:"sans-serif"},children:["@tscircuit/pcb-viewer@",sYo.version]}),j.jsxs("div",{"data-toolbar-overlay":!0,onTouchStart:Me=>Me.stopPropagation(),onTouchEnd:Me=>Me.stopPropagation(),onTouchMove:Me=>Me.stopPropagation(),onMouseDown:qe,onMouseMove:qe,onMouseUp:qe,onPointerDown:qe,onPointerMove:qe,onPointerUp:qe,onWheel:qe,style:{position:"absolute",opacity:n||o?1:0,top:16,left:16,right:n?16:"auto",transition:o?"opacity 100ms linear":"opacity 300ms linear",zIndex:Vl.toolbarOverlay,color:"red",display:"flex",flexWrap:"wrap",maxWidth:"550px",gap:4,fontSize:12,fontFamily:"sans-serif"},children:[j.jsxs(Ov,{isSmallScreen:n,onClick:Ee,onMouseLeave:()=>{R&&w(!1)},children:[j.jsxs("div",{children:["layer:"," ",j.jsx("span",{style:{marginLeft:2,fontWeight:500,color:hse[r]},children:r})]}),R&&j.jsx("div",{style:{marginTop:4,minWidth:120},children:re.map(Me=>j.jsx(uYo,{name:Me,selected:Me===r,onClick:()=>{s(Me)}},Me))})]}),j.jsx(gYo,{elements:e,isOpen:H,isSmallScreen:n,onToggle:Be,onClose:_e,setHoveredErrorId:B,setFocusedErrorId:Q}),j.jsx(Ov,{isSmallScreen:n,style:{},onClick:ye,children:j.jsxs("div",{children:[a.in_draw_trace_mode?"✖ ":"","Edit Traces"]})}),j.jsx(Ov,{isSmallScreen:n,style:{},onClick:pe,children:j.jsxs("div",{children:[a.in_move_footprint_mode?"✖ ":"","Move Components"]})}),j.jsx(Ov,{isSmallScreen:n,style:{},onClick:we,children:j.jsxs("div",{children:[A.is_showing_rats_nest?"✖ ":"","Rats Nest"]})}),j.jsx(Ov,{isSmallScreen:n,style:K?{backgroundColor:"#444"}:{},onClick:Ge,children:j.jsx("div",{children:"📏"})}),j.jsx(Ov,{isSmallScreen:n,style:q?{backgroundColor:"#444"}:{},onClick:Ve,children:j.jsx("div",{children:"Bounds"})}),j.jsx(Ov,{isSmallScreen:n,onClick:Ie,children:j.jsxs("div",{children:[j.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:["View",j.jsx("span",{style:{fontSize:"8px",transform:b?"rotate(180deg)":"rotate(0)",transition:"transform 0.1s ease",display:"inline-block"},children:"▼"})]}),b&&j.jsxs("div",{style:{marginTop:4,minWidth:120},children:[j.jsx(GB,{label:"Show All Trace Lengths",checked:A.is_showing_multiple_traces_length,onClick:()=>{g(!A.is_showing_multiple_traces_length)}}),j.jsx(GB,{label:"Show Autorouting Animation",checked:A.is_showing_autorouting,onClick:()=>{u(!A.is_showing_autorouting)}}),j.jsx(GB,{label:"Show DRC Errors",checked:A.is_showing_drc_errors,onClick:()=>{h(!A.is_showing_drc_errors)}}),j.jsx(GB,{label:"Show Copper Pours",checked:A.is_showing_copper_pours,onClick:()=>{d(!A.is_showing_copper_pours)}}),j.jsx(GB,{label:"Show Courtyards",checked:A.is_showing_courtyards,onClick:()=>{_(!A.is_showing_courtyards)}}),j.jsx(GB,{label:"Show Solder Mask",checked:A.is_showing_solder_mask,onClick:()=>{I(!A.is_showing_solder_mask)}}),j.jsx(GB,{label:"Show Silkscreen",checked:A.is_showing_silkscreen,onClick:()=>{f(!A.is_showing_silkscreen)}}),j.jsx(GB,{label:"Show Fabrication Notes",checked:A.is_showing_fabrication_notes,onClick:()=>{C(!A.is_showing_fabrication_notes)}}),j.jsx(GB,{label:"Show PCB Notes",checked:A.is_showing_pcb_notes,onClick:()=>{y(!A.is_showing_pcb_notes)}}),j.jsx(GB,{label:"Show Group Anchor Offsets",checked:A.is_showing_group_anchor_offsets,onClick:()=>{p(!A.is_showing_group_anchor_offsets)}}),j.jsx(GB,{label:"Show PCB Groups",checked:A.is_showing_pcb_groups,onClick:()=>{m(!A.is_showing_pcb_groups)}}),A.is_showing_pcb_groups&&j.jsxs("div",{style:{marginLeft:16},children:[j.jsx(ILt,{label:"Show All Groups",checked:A.pcb_group_view_mode==="all",onClick:()=>{E("all")}}),j.jsx(ILt,{label:"Show Named Groups",checked:A.pcb_group_view_mode==="named_only",onClick:()=>{E("named_only")}})]})]})]})})]})]})},hYo=({children:t,transform:e=dl(),elements:n=[]})=>{const[o,{width:i,height:r}]=rY(),s=ne.useRef(null);return ne.useEffect(()=>{const a=s.current;if(!a||!i||!r)return;a.width=i,a.height=r;const A=a.getContext("2d");if(!A)return;A.clearRect(0,0,i,r);const c=n.filter(g=>g.type==="pcb_component"),l=n.filter(g=>g.type==="pcb_manual_edit_conflict_warning");A.strokeStyle=Fo.board.drc_warning,A.lineWidth=2,l.forEach(g=>{const u=c.find(U=>U.pcb_component_id===g.pcb_component_id);if(!u)return;const{width:h,height:d,center:_}=u,m=_t(e,_),p=h*Math.abs(e.a),I=d*Math.abs(e.d),f=.1*Math.abs(e.a),C=p+f*2,y=I+f*2,E=m.x-C/2,B=m.y-y/2;A.beginPath(),A.rect(E,B,C,y),A.stroke();const Q="Manual Edit Conflict",b=4,D=Math.max(8,Math.min(12,10*Math.abs(e.a)));A.font=`${D}px sans-serif`;const w=A.measureText(Q).width+b*2,H=D+b*2,G=E+(C-w)/2,K=B+y+5;A.fillStyle="rgba(0, 0, 0, 0.7)",A.beginPath(),A.roundRect(G,K,w,H,3),A.fill(),A.fillStyle=Fo.board.drc_warning,A.textAlign="center",A.textBaseline="middle",A.fillText(Q,G+w/2,K+H/2)})},[n,e,i,r]),j.jsxs("div",{ref:o,style:{position:"relative",width:"100%",height:"100%"},children:[t,j.jsx("canvas",{ref:s,style:{position:"absolute",top:0,left:0,pointerEvents:"none",zIndex:Vl.warnings}})]})},_Yo=t=>{const{transform:e,elements:n}=t,{hoveredErrorId:o,focusedErrorId:i,isShowingCopperPours:r,selectedLayer:s}=n0(y=>({hoveredErrorId:y.hovered_error_id,focusedErrorId:y.focused_error_id,isShowingCopperPours:y.is_showing_copper_pours,selectedLayer:y.selected_layer})),a=i??o,A=ne.useMemo(()=>r?n:n.filter(y=>y.type!=="pcb_copper_pour"),[n,r]),[c,l]=ne.useMemo(()=>{const y=A.flatMap(B=>iKo(B,t.elements)),E=OFt(t.elements);return[y,E]},[A,t.elements]),[g,u]=ne.useState({drawingObjectIdsWithMouseOver:new Set,primitiveIdsInMousedOverNet:[]}),[h,d]=ne.useState([]),_=ne.useRef(e??null),m=ne.useRef(null),p=ne.useMemo(()=>KFt(n),[n]),I=ne.useMemo(()=>{if(!a)return[];const E=n.filter(B=>B.type.includes("error")).find((B,Q)=>dk(B,Q)===a);return E?hKo(E):[]},[a,n]);ne.useEffect(()=>{e&&(_.current=e)},[e]),ne.useEffect(()=>()=>{JFt(m.current)},[]),ne.useEffect(()=>{if(!t.width||!t.height||!t.setTransform||!i)return;const y=VFt(n,i);if(!y)return;const E=uKo({error:y,indexes:p});if(!E)return;const B=_.current??e;if(!B)return;const Q=dKo({bounds:E,width:t.width,height:t.height});JFt(m.current),pKo({startTransform:B,endTransform:Q,durationMs:420,setAnimationFrameId:b=>{m.current=b},onUpdate:b=>{_.current=b,t.setTransform?.(b)}})},[i,n,p,t.height,t.setTransform,t.width]);const f=ne.useMemo(()=>{const y=[...g.primitiveIdsInMousedOverNet,...I];return rKo({primitivesWithoutInteractionMetadata:c,drawingObjectIdsWithMouseOver:g.drawingObjectIdsWithMouseOver,primitiveIdsInMousedOverNet:y})},[c,g,I]),C=ne.useCallback(y=>{const E=[];for(const b of y)if(b._element){const D=l.getNetConnectedToId("pcb_port_id"in b._element?b._element?.pcb_port_id:"pcb_trace_id"in b._element?b._element?.pcb_trace_id:"");E.push(...l.getIdsConnectedToNet(D))}const B=new Set(y.map(b=>b._pcb_drawing_object_id));u({drawingObjectIdsWithMouseOver:B,primitiveIdsInMousedOverNet:E});const Q=y.map(b=>b._parent_pcb_component?.type==="pcb_component"&&b._parent_pcb_component.pcb_component_id?b._parent_pcb_component.pcb_component_id:b._element?.type==="pcb_component"&&b._element.pcb_component_id?b._element.pcb_component_id:null).filter(b=>!!b);d(Array.from(new Set(Q)))},[l]);return j.jsx(oYo,{elements:A,transform:e,primitives:c,selectedLayer:s,onMouseHoverOverPrimitives:C,children:j.jsx(TUo,{disabled:!t.allowEditing,transform:e,soup:n,cancelPanDrag:t.cancelPanDrag,onCreateEditEvent:t.onCreateEditEvent,onModifyEditEvent:t.onModifyEditEvent,children:j.jsx(HUo,{disabled:!t.allowEditing,transform:e,soup:n,cancelPanDrag:t.cancelPanDrag,onCreateEditEvent:t.onCreateEditEvent,onModifyEditEvent:t.onModifyEditEvent,children:j.jsx(NUo,{transform:e,focusOnHover:t.focusOnHover,primitives:c,onBoundsSelected:t.onBoundsSelected,cancelPanDrag:t.cancelPanDrag,children:j.jsx(dYo,{elements:n,children:j.jsx(OUo,{transform:e,elements:n,children:j.jsx(rYo,{transform:e,soup:n,children:j.jsx(iYo,{transform:e,elements:n,hoveredComponentIds:h,children:j.jsx(BUo,{transform:e,debugGraphics:t.debugGraphics,children:j.jsx(hYo,{transform:e,elements:n,children:j.jsx(fUo,{transform:e,primitives:f,elements:A,width:t.width,height:t.height,grid:t.grid})})})})})})})})})})})},fse=t=>Number.isFinite(t)?t.toFixed(4):"NaN",mYo=t=>{let e=5381;for(let n=0;n<t.length;n++)e=(e<<5)+e+t.charCodeAt(n);return Math.abs(e)},pYo=t=>{if(!t?.length)return"0";const e=[];for(const i of t){if(!i?.type?.startsWith("pcb_"))continue;const r=SOo(i),s=L8e([i]),a=[fse(s.minX),fse(s.minY),fse(s.maxX),fse(s.maxY)].join(",");let A=`${r}:${a}`;if(i.type==="pcb_trace"){const c=(i.route??[]).length;A+=`:${c}`}e.push(A)}if(e.length===0)return"0";e.sort();const n=e.join(","),o=mYo(n);return`${e.length}_${o.toString(36)}`},IYo=t=>{if(!t)return"empty";const e=t.find(o=>o.type==="pcb_board");if(!e)return"no-board";const n=o=>Math.round(o*1e3)/1e3;return e.outline?e.outline.map(o=>`${n(o.x)}_${n(o.y)}`).join(","):`${n(e.width)}_${n(e.height)}`},fYo=Ti(Ji(400,300),gg(40,-40)),fLt=({circuitJson:t,debugGraphics:e,height:n=600,initialState:o,allowEditing:i=!0,editEvents:r,onEditEventsChanged:s,onBoundsSelected:a,focusOnHover:A=!1,clickToInteractEnabled:c=!1,disablePcbGroups:l=!1})=>{const[g,u]=ne.useState(!c),[h,d]=rY(),[_,m]=ne.useState(fYo),p=ne.useCallback(q=>{const W=q.target;return W instanceof Element?!W.closest("[data-toolbar-overlay]"):!0},[]),{ref:I,setTransform:f,cancelDrag:C}=WOo({transform:_,onSetTransform:m,enabled:g,shouldDrag:p});let[y,E]=ne.useState([]);y=r??y;const B=ne.useRef(!1),Q=ne.useRef(null),b=ne.useMemo(()=>pYo(t),[t]),D=IYo(t),R=()=>{const q=d?.width>0?d:{width:500,height:500},{center:W,width:ee,height:re}=H.some(se=>se.type.startsWith("pcb_"))?vOo(H.filter(se=>se.type.startsWith("pcb_"))):{center:{x:0,y:0},width:.001,height:.001},X=Math.min((q.width??0)/ee,(q.height??0)/re,100)*.75,te=Ti(Ji((q.width??0)/2,(q.height??0)/2),gg(X,-X,0,0),Ji(-W.x,-W.y));f(te)};ne.useEffect(()=>{d?.width&&t&&t.length!==0&&(B.current||(R(),B.current=!0))},[t,d]),ne.useEffect(()=>{B.current===!0&&R()},[D]);const w=ne.useMemo(()=>t?.filter(q=>q.type.startsWith("pcb_")||q.type.startsWith("source_"))??[],[b]),H=ne.useMemo(()=>slo({circuitJson:w,editEvents:y}),[w,y]),G=q=>{E([...y,q]),s?.([...y,q])},K=q=>{const W=y.map(ee=>ee.edit_event_id===q.edit_event_id?{...ee,...q}:ee);E(W),s?.(W)},U=ne.useMemo(()=>({...o,...l&&{is_showing_pcb_groups:!1}}),[o,l]);return j.jsxs("div",{ref:I,style:{position:"relative"},onContextMenu:q=>q.preventDefault(),children:[j.jsx("div",{ref:h,children:j.jsxs(TOo,{initialState:U,disablePcbGroups:l,children:[j.jsx(_Yo,{transform:_,setTransform:f,height:n,width:d.width,allowEditing:i,focusOnHover:A,onBoundsSelected:a,cancelPanDrag:C,onCreateEditEvent:G,onModifyEditEvent:K,grid:{spacing:1,view_window:{left:0,right:d.width||500,top:n,bottom:0}},elements:H,debugGraphics:e},d.width),j.jsx(FOo,{})]})}),c&&!g&&j.jsx("div",{onClick:()=>{u(!0),R()},onTouchStart:q=>{const W=q.touches[0];Q.current={x:W.clientX,y:W.clientY}},onTouchEnd:q=>{const W=q.changedTouches[0],ee=Q.current;if(!ee)return;const re=Math.abs(W.clientX-ee.x),X=Math.abs(W.clientY-ee.y);re<10&&X<10&&(q.preventDefault(),u(!0),R()),Q.current=null},style:{position:"absolute",inset:0,cursor:"pointer",zIndex:Vl.clickToInteractOverlay,display:"flex",alignItems:"center",justifyContent:"center",touchAction:"pan-x pan-y pinch-zoom"},children:j.jsx("div",{style:{backgroundColor:"rgba(0, 0, 0, 0.8)",color:"white",padding:"12px 24px",borderRadius:"8px",fontSize:"16px",pointerEvents:"none"},children:typeof window<"u"&&("ontouchstart"in window||navigator.maxTouchPoints>0)?"Touch to Interact":"Click to Interact"})})]})};const CYo=({circuitJson:t,containerClassName:e,...n})=>{const o=ne.useRef(null),[i,r]=ne.useState(620);return ne.useLayoutEffect(()=>{const s=()=>{if(o.current){const A=o.current.clientHeight,c=window.innerHeight;r(Math.min(Math.max(A,620),c))}};s();const a=new ResizeObserver(s);return o.current&&a.observe(o.current),window.addEventListener("resize",s),()=>{a.disconnect(),window.removeEventListener("resize",s)}},[]),j.jsx("div",{ref:o,className:e||"rf-w-full rf-h-full",children:j.jsx(fLt,{...n,circuitJson:t,height:i})})},yYo='*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*! tailwindcss v3.4.19 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{color:inherit;font-family:inherit;font-feature-settings:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}:root{--radius:0.5rem}.rf-pointer-events-none{pointer-events:none}.rf-invisible{visibility:hidden}.rf-fixed{position:fixed}.rf-absolute{position:absolute}.rf-relative{position:relative}.rf-inset-0{inset:0}.-rf-left-2{left:-.5rem}.-rf-right-10{right:-2.5rem}.-rf-right-2{right:-.5rem}.-rf-right-4{right:-1rem}.-rf-right-6{right:-1.5rem}.-rf-right-7{right:-1.75rem}.-rf-right-8{right:-2rem}.-rf-right-9{right:-2.25rem}.rf-bottom-full{bottom:100%}.rf-left-0{left:0}.rf-left-1{left:.25rem}.rf-left-1\\/2{left:50%}.rf-left-2{left:.5rem}.rf-left-\\[50\\%\\]{left:50%}.rf-right-0{right:0}.rf-right-1{right:.25rem}.rf-right-4{right:1rem}.rf-right-\\[4px\\]{right:4px}.rf-top-0{top:0}.rf-top-1{top:.25rem}.rf-top-2{top:.5rem}.rf-top-2\\.5{top:.625rem}.rf-top-\\[50\\%\\]{top:50%}.rf-top-\\[6px\\]{top:6px}.\\!rf-z-\\[101\\]{z-index:101!important}.\\!rf-z-\\[200\\]{z-index:200!important}.rf-z-10{z-index:10}.rf-z-50{z-index:50}.rf-z-\\[100\\]{z-index:100}.rf-z-\\[101\\]{z-index:101}.rf-z-\\[104\\]{z-index:104}.rf-order-1{order:1}.rf-order-2{order:2}.rf-order-3{order:3}.rf-m-0{margin:0}.rf-m-1{margin:.25rem}.rf-m-6{margin:1.5rem}.-rf-mx-1,.rf--mx-1{margin-left:-.25rem;margin-right:-.25rem}.rf-mx-1{margin-left:.25rem;margin-right:.25rem}.rf-mx-2{margin-left:.5rem;margin-right:.5rem}.rf-mx-4{margin-left:1rem;margin-right:1rem}.rf-mx-auto{margin-left:auto;margin-right:auto}.rf-my-1{margin-bottom:.25rem;margin-top:.25rem}.rf-my-12{margin-bottom:3rem;margin-top:3rem}.rf-my-4{margin-bottom:1rem;margin-top:1rem}.rf-my-auto{margin-bottom:auto;margin-top:auto}.rf-mb-0{margin-bottom:0}.rf-mb-0\\.5{margin-bottom:.125rem}.rf-mb-1{margin-bottom:.25rem}.rf-mb-12{margin-bottom:3rem}.rf-mb-2{margin-bottom:.5rem}.rf-mb-3{margin-bottom:.75rem}.rf-mb-4{margin-bottom:1rem}.rf-mb-6{margin-bottom:1.5rem}.rf-mb-8{margin-bottom:2rem}.rf-ml-1{margin-left:.25rem}.rf-ml-2{margin-left:.5rem}.rf-ml-6{margin-left:1.5rem}.rf-ml-auto{margin-left:auto}.rf-mr-1{margin-right:.25rem}.rf-mr-2{margin-right:.5rem}.rf-mr-4{margin-right:1rem}.rf-mt-0{margin-top:0}.rf-mt-0\\.5{margin-top:.125rem}.rf-mt-1{margin-top:.25rem}.rf-mt-2{margin-top:.5rem}.rf-mt-3{margin-top:.75rem}.rf-mt-4{margin-top:1rem}.rf-mt-5{margin-top:1.25rem}.rf-mt-auto{margin-top:auto}.rf-block{display:block}.rf-inline-block{display:inline-block}.rf-inline{display:inline}.rf-flex{display:flex}.rf-inline-flex{display:inline-flex}.rf-grid{display:grid}.rf-hidden{display:none}.rf-aspect-square{aspect-ratio:1/1}.rf-aspect-video{aspect-ratio:16/9}.rf-size-14{height:3.5rem;width:3.5rem}.rf-size-2{height:.5rem;width:.5rem}.rf-size-3{height:.75rem;width:.75rem}.rf-size-4{height:1rem;width:1rem}.\\!rf-h-2{height:.5rem!important}.\\!rf-h-2\\.5{height:.625rem!important}.\\!rf-h-3{height:.75rem!important}.\\!rf-h-full{height:100%!important}.rf-h-1{height:.25rem}.rf-h-10{height:2.5rem}.rf-h-12{height:3rem}.rf-h-2{height:.5rem}.rf-h-2\\.5{height:.625rem}.rf-h-20{height:5rem}.rf-h-24{height:6rem}.rf-h-3{height:.75rem}.rf-h-3\\.5{height:.875rem}.rf-h-4{height:1rem}.rf-h-5{height:1.25rem}.rf-h-6{height:1.5rem}.rf-h-60{height:15rem}.rf-h-64{height:16rem}.rf-h-7{height:1.75rem}.rf-h-8{height:2rem}.rf-h-9{height:2.25rem}.rf-h-\\[400px\\]{height:400px}.rf-h-\\[calc\\(100vh-52px\\)\\]{height:calc(100vh - 52px)}.rf-h-\\[calc\\(100vh-60px\\)\\]{height:calc(100vh - 60px)}.rf-h-\\[var\\(--radix-select-trigger-height\\)\\]{height:var(--radix-select-trigger-height)}.rf-h-auto{height:auto}.rf-h-fit{height:-moz-fit-content;height:fit-content}.rf-h-full{height:100%}.rf-h-px{height:1px}.rf-h-screen{height:100vh}.\\!rf-max-h-\\[40vh\\]{max-height:40vh!important}.\\!rf-max-h-\\[80vh\\]{max-height:80vh!important}.rf-max-h-16{max-height:4rem}.rf-max-h-20{max-height:5rem}.rf-max-h-24{max-height:6rem}.rf-max-h-28{max-height:7rem}.rf-max-h-32{max-height:8rem}.rf-max-h-96{max-height:24rem}.rf-max-h-\\[120px\\]{max-height:120px}.rf-max-h-\\[150px\\]{max-height:150px}.rf-max-h-\\[200px\\]{max-height:200px}.rf-max-h-\\[300px\\]{max-height:300px}.rf-max-h-\\[90vh\\]{max-height:90vh}.rf-max-h-full{max-height:100%}.rf-max-h-none{max-height:none}.rf-min-h-0{min-height:0}.rf-min-h-\\[100px\\]{min-height:100px}.rf-min-h-\\[200px\\]{min-height:200px}.rf-min-h-\\[300px\\]{min-height:300px}.rf-min-h-\\[620px\\]{min-height:620px}.rf-min-h-\\[calc\\(100vh-240px\\)\\]{min-height:calc(100vh - 240px)}.rf-min-h-full{min-height:100%}.\\!rf-w-2{width:.5rem!important}.\\!rf-w-2\\.5{width:.625rem!important}.\\!rf-w-\\[95vw\\]{width:95vw!important}.rf-w-1{width:.25rem}.rf-w-10{width:2.5rem}.rf-w-11{width:2.75rem}.rf-w-11\\/12{width:91.666667%}.rf-w-12{width:3rem}.rf-w-16{width:4rem}.rf-w-2{width:.5rem}.rf-w-2\\.5{width:.625rem}.rf-w-20{width:5rem}.rf-w-24{width:6rem}.rf-w-28{width:7rem}.rf-w-3{width:.75rem}.rf-w-3\\.5{width:.875rem}.rf-w-32{width:8rem}.rf-w-4{width:1rem}.rf-w-40{width:10rem}.rf-w-48{width:12rem}.rf-w-5{width:1.25rem}.rf-w-6{width:1.5rem}.rf-w-64{width:16rem}.rf-w-72{width:18rem}.rf-w-8{width:2rem}.rf-w-80{width:20rem}.rf-w-9{width:2.25rem}.rf-w-96{width:24rem}.rf-w-fit{width:-moz-fit-content;width:fit-content}.rf-w-full{width:100%}.rf-w-screen{width:100vw}.rf-min-w-0{min-width:0}.rf-min-w-10{min-width:2.5rem}.rf-min-w-16{min-width:4rem}.rf-min-w-32{min-width:8rem}.rf-min-w-80{min-width:20rem}.rf-min-w-96{min-width:24rem}.rf-min-w-\\[12px\\]{min-width:12px}.rf-min-w-\\[148px\\]{min-width:148px}.rf-min-w-\\[600px\\]{min-width:600px}.rf-min-w-\\[8rem\\]{min-width:8rem}.rf-min-w-\\[var\\(--radix-select-trigger-width\\)\\]{min-width:var(--radix-select-trigger-width)}.\\!rf-max-w-\\[95vw\\]{max-width:95vw!important}.rf-max-w-2xl{max-width:42rem}.rf-max-w-3xl{max-width:48rem}.rf-max-w-4xl{max-width:56rem}.rf-max-w-5xl{max-width:64rem}.rf-max-w-64{max-width:16rem}.rf-max-w-96{max-width:24rem}.rf-max-w-\\[1000px\\]{max-width:1000px}.rf-max-w-\\[150px\\]{max-width:150px}.rf-max-w-\\[200px\\]{max-width:200px}.rf-max-w-\\[320px\\]{max-width:320px}.rf-max-w-\\[40\\%\\]{max-width:40%}.rf-max-w-\\[600px\\]{max-width:600px}.rf-max-w-full{max-width:100%}.rf-max-w-lg{max-width:32rem}.rf-max-w-md{max-width:28rem}.rf-max-w-none{max-width:none}.rf-max-w-xl{max-width:36rem}.rf-max-w-xs{max-width:20rem}.rf-flex-1{flex:1 1 0%}.rf-flex-shrink-0,.rf-shrink-0{flex-shrink:0}.rf-flex-grow{flex-grow:1}.rf-table-auto{table-layout:auto}.rf-origin-\\[--radix-popover-content-transform-origin\\]{transform-origin:var(--radix-popover-content-transform-origin)}.-rf-translate-x-1{--tw-translate-x:-0.25rem}.-rf-translate-x-1,.-rf-translate-x-1\\/2{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))}.-rf-translate-x-1\\/2{--tw-translate-x:-50%}.-rf-translate-y-1{--tw-translate-y:-0.25rem}.-rf-translate-y-1,.rf--translate-x-1{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))}.rf--translate-x-1{--tw-translate-x:-0.25rem}.rf--translate-x-1\\/2{--tw-translate-x:-50%}.rf--translate-x-1\\/2,.rf--translate-y-1{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))}.rf--translate-y-1{--tw-translate-y:-0.25rem}.rf-translate-x-\\[-50\\%\\]{--tw-translate-x:-50%}.rf-translate-x-\\[-50\\%\\],.rf-translate-y-\\[-50\\%\\]{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))}.rf-translate-y-\\[-50\\%\\]{--tw-translate-y:-50%}.-rf-rotate-90{--tw-rotate:-90deg}.-rf-rotate-90,.rf-rotate-90{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))}.rf-rotate-90{--tw-rotate:90deg}.rf-transform{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))}@keyframes rf-pulse{50%{opacity:.5}}.rf-animate-pulse{animation:rf-pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes rf-spin{to{transform:rotate(1turn)}}.rf-animate-spin{animation:rf-spin 1s linear infinite}.rf-cursor-default{cursor:default}.rf-cursor-not-allowed{cursor:not-allowed}.rf-cursor-pointer{cursor:pointer}.rf-select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.rf-grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.rf-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.rf-grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.rf-flex-row{flex-direction:row}.rf-flex-col{flex-direction:column}.rf-flex-col-reverse{flex-direction:column-reverse}.rf-flex-wrap{flex-wrap:wrap}.rf-place-content-center{place-content:center}.rf-place-items-center{place-items:center}.rf-items-start{align-items:flex-start}.rf-items-end{align-items:flex-end}.rf-items-center{align-items:center}.rf-items-baseline{align-items:baseline}.rf-items-stretch{align-items:stretch}.rf-justify-end{justify-content:flex-end}.rf-justify-center{justify-content:center}.rf-justify-between{justify-content:space-between}.rf-gap-0{gap:0}.rf-gap-1{gap:.25rem}.rf-gap-1\\.5{gap:.375rem}.rf-gap-2{gap:.5rem}.rf-gap-3{gap:.75rem}.rf-gap-4{gap:1rem}.rf-gap-5{gap:1.25rem}.rf-gap-6{gap:1.5rem}.rf-gap-8{gap:2rem}.rf-space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.5rem*var(--tw-space-x-reverse))}.rf-space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.25rem*var(--tw-space-y-reverse));margin-top:calc(.25rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.5rem*var(--tw-space-y-reverse));margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.75rem*var(--tw-space-y-reverse));margin-top:calc(.75rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1.5rem*var(--tw-space-y-reverse));margin-top:calc(1.5rem*(1 - var(--tw-space-y-reverse)))}.rf-divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-bottom-width:calc(1px*var(--tw-divide-y-reverse));border-top-width:calc(1px*(1 - var(--tw-divide-y-reverse)))}.rf-overflow-auto{overflow:auto}.rf-overflow-hidden{overflow:hidden}.rf-overflow-visible{overflow:visible}.rf-overflow-x-auto{overflow-x:auto}.\\!rf-overflow-y-auto{overflow-y:auto!important}.rf-overflow-y-auto{overflow-y:auto}.rf-overflow-x-hidden{overflow-x:hidden}.rf-overflow-x-clip{overflow-x:clip}.rf-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rf-whitespace-normal{white-space:normal}.rf-whitespace-nowrap{white-space:nowrap}.rf-whitespace-pre-wrap{white-space:pre-wrap}.rf-text-nowrap{text-wrap:nowrap}.rf-break-words{overflow-wrap:break-word}.rf-break-all{word-break:break-all}.rf-rounded{border-radius:.25rem}.rf-rounded-2xl{border-radius:1rem}.rf-rounded-full{border-radius:9999px}.rf-rounded-lg{border-radius:var(--radius)}.rf-rounded-md{border-radius:calc(var(--radius) - 2px)}.rf-rounded-none{border-radius:0}.rf-rounded-sm{border-radius:calc(var(--radius) - 4px)}.rf-rounded-xl{border-radius:.75rem}.rf-border{border-width:1px}.rf-border-0{border-width:0}.rf-border-2{border-width:2px}.rf-border-b{border-bottom-width:1px}.rf-border-l-2{border-left-width:2px}.rf-border-l-4{border-left-width:4px}.rf-border-r{border-right-width:1px}.rf-border-t{border-top-width:1px}.rf-border-none{border-style:none}.rf-border-blue-200{--tw-border-opacity:1;border-color:rgb(191 219 254/var(--tw-border-opacity,1))}.rf-border-blue-300{--tw-border-opacity:1;border-color:rgb(147 197 253/var(--tw-border-opacity,1))}.rf-border-blue-400{--tw-border-opacity:1;border-color:rgb(96 165 250/var(--tw-border-opacity,1))}.rf-border-blue-500{--tw-border-opacity:1;border-color:rgb(59 130 246/var(--tw-border-opacity,1))}.rf-border-blue-600{--tw-border-opacity:1;border-color:rgb(37 99 235/var(--tw-border-opacity,1))}.rf-border-border{border-color:hsl(var(--border))}.rf-border-emerald-500{--tw-border-opacity:1;border-color:rgb(16 185 129/var(--tw-border-opacity,1))}.rf-border-gray-100{--tw-border-opacity:1;border-color:rgb(243 244 246/var(--tw-border-opacity,1))}.rf-border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity,1))}.rf-border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity,1))}.rf-border-green-200{--tw-border-opacity:1;border-color:rgb(187 247 208/var(--tw-border-opacity,1))}.rf-border-green-400{--tw-border-opacity:1;border-color:rgb(74 222 128/var(--tw-border-opacity,1))}.rf-border-input{border-color:hsl(var(--input))}.rf-border-neutral-200{--tw-border-opacity:1;border-color:rgb(229 229 229/var(--tw-border-opacity,1))}.rf-border-orange-100{--tw-border-opacity:1;border-color:rgb(255 237 213/var(--tw-border-opacity,1))}.rf-border-orange-200{--tw-border-opacity:1;border-color:rgb(254 215 170/var(--tw-border-opacity,1))}.rf-border-orange-500{--tw-border-opacity:1;border-color:rgb(249 115 22/var(--tw-border-opacity,1))}.rf-border-primary{border-color:hsl(var(--primary))}.rf-border-red-100{--tw-border-opacity:1;border-color:rgb(254 226 226/var(--tw-border-opacity,1))}.rf-border-red-200{--tw-border-opacity:1;border-color:rgb(254 202 202/var(--tw-border-opacity,1))}.rf-border-red-300{--tw-border-opacity:1;border-color:rgb(252 165 165/var(--tw-border-opacity,1))}.rf-border-red-400{--tw-border-opacity:1;border-color:rgb(248 113 113/var(--tw-border-opacity,1))}.rf-border-red-500{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity,1))}.rf-border-red-600{--tw-border-opacity:1;border-color:rgb(220 38 38/var(--tw-border-opacity,1))}.rf-border-red-700{--tw-border-opacity:1;border-color:rgb(185 28 28/var(--tw-border-opacity,1))}.rf-border-red-800{--tw-border-opacity:1;border-color:rgb(153 27 27/var(--tw-border-opacity,1))}.rf-border-slate-200{--tw-border-opacity:1;border-color:rgb(226 232 240/var(--tw-border-opacity,1))}.rf-border-slate-700{--tw-border-opacity:1;border-color:rgb(51 65 85/var(--tw-border-opacity,1))}.rf-border-slate-800{--tw-border-opacity:1;border-color:rgb(30 41 59/var(--tw-border-opacity,1))}.rf-border-slate-800\\/60{border-color:rgba(30,41,59,.6)}.rf-border-yellow-200{--tw-border-opacity:1;border-color:rgb(254 240 138/var(--tw-border-opacity,1))}.rf-border-zinc-200{--tw-border-opacity:1;border-color:rgb(228 228 231/var(--tw-border-opacity,1))}.rf-border-zinc-900{--tw-border-opacity:1;border-color:rgb(24 24 27/var(--tw-border-opacity,1))}.rf-border-l-blue-500{--tw-border-opacity:1;border-left-color:rgb(59 130 246/var(--tw-border-opacity,1))}.rf-border-t-blue-600{--tw-border-opacity:1;border-top-color:rgb(37 99 235/var(--tw-border-opacity,1))}.rf-bg-amber-50{--tw-bg-opacity:1;background-color:rgb(255 251 235/var(--tw-bg-opacity,1))}.rf-bg-amber-50\\/30{background-color:rgba(255,251,235,.3)}.rf-bg-background{background-color:hsl(var(--background))}.rf-bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity,1))}.rf-bg-black\\/80{background-color:rgba(0,0,0,.8)}.rf-bg-blue-100{--tw-bg-opacity:1;background-color:rgb(219 234 254/var(--tw-bg-opacity,1))}.rf-bg-blue-50{--tw-bg-opacity:1;background-color:rgb(239 246 255/var(--tw-bg-opacity,1))}.rf-bg-blue-500{--tw-bg-opacity:1;background-color:rgb(59 130 246/var(--tw-bg-opacity,1))}.rf-bg-blue-600{--tw-bg-opacity:1;background-color:rgb(37 99 235/var(--tw-bg-opacity,1))}.rf-bg-emerald-500{--tw-bg-opacity:1;background-color:rgb(16 185 129/var(--tw-bg-opacity,1))}.rf-bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.rf-bg-gray-200{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity,1))}.rf-bg-gray-300{--tw-bg-opacity:1;background-color:rgb(209 213 219/var(--tw-bg-opacity,1))}.rf-bg-gray-400{--tw-bg-opacity:1;background-color:rgb(156 163 175/var(--tw-bg-opacity,1))}.rf-bg-gray-50{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity,1))}.rf-bg-gray-500{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity,1))}.rf-bg-gray-700{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.rf-bg-gray-800{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.rf-bg-gray-900{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity,1))}.rf-bg-green-100{--tw-bg-opacity:1;background-color:rgb(220 252 231/var(--tw-bg-opacity,1))}.rf-bg-green-300{--tw-bg-opacity:1;background-color:rgb(134 239 172/var(--tw-bg-opacity,1))}.rf-bg-green-50{--tw-bg-opacity:1;background-color:rgb(240 253 244/var(--tw-bg-opacity,1))}.rf-bg-green-600{--tw-bg-opacity:1;background-color:rgb(22 163 74/var(--tw-bg-opacity,1))}.rf-bg-muted{background-color:hsl(var(--muted))}.rf-bg-neutral-100{--tw-bg-opacity:1;background-color:rgb(245 245 245/var(--tw-bg-opacity,1))}.rf-bg-neutral-50{--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.rf-bg-neutral-800{--tw-bg-opacity:1;background-color:rgb(38 38 38/var(--tw-bg-opacity,1))}.rf-bg-neutral-900{--tw-bg-opacity:1;background-color:rgb(23 23 23/var(--tw-bg-opacity,1))}.rf-bg-orange-100{--tw-bg-opacity:1;background-color:rgb(255 237 213/var(--tw-bg-opacity,1))}.rf-bg-orange-400{--tw-bg-opacity:1;background-color:rgb(251 146 60/var(--tw-bg-opacity,1))}.rf-bg-orange-50{--tw-bg-opacity:1;background-color:rgb(255 247 237/var(--tw-bg-opacity,1))}.rf-bg-orange-50\\/50{background-color:rgba(255,247,237,.5)}.rf-bg-orange-500{--tw-bg-opacity:1;background-color:rgb(249 115 22/var(--tw-bg-opacity,1))}.rf-bg-popover{background-color:hsl(var(--popover))}.rf-bg-purple-500{--tw-bg-opacity:1;background-color:rgb(168 85 247/var(--tw-bg-opacity,1))}.rf-bg-red-100{--tw-bg-opacity:1;background-color:rgb(254 226 226/var(--tw-bg-opacity,1))}.rf-bg-red-50{--tw-bg-opacity:1;background-color:rgb(254 242 242/var(--tw-bg-opacity,1))}.rf-bg-red-50\\/50{background-color:rgba(254,242,242,.5)}.rf-bg-red-500{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity,1))}.rf-bg-red-600{--tw-bg-opacity:1;background-color:rgb(220 38 38/var(--tw-bg-opacity,1))}.rf-bg-red-900{--tw-bg-opacity:1;background-color:rgb(127 29 29/var(--tw-bg-opacity,1))}.rf-bg-red-950{--tw-bg-opacity:1;background-color:rgb(69 10 10/var(--tw-bg-opacity,1))}.rf-bg-slate-50{--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity,1))}.rf-bg-slate-800{--tw-bg-opacity:1;background-color:rgb(30 41 59/var(--tw-bg-opacity,1))}.rf-bg-slate-900{--tw-bg-opacity:1;background-color:rgb(15 23 42/var(--tw-bg-opacity,1))}.rf-bg-transparent{background-color:transparent}.rf-bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.rf-bg-yellow-100{--tw-bg-opacity:1;background-color:rgb(254 249 195/var(--tw-bg-opacity,1))}.rf-bg-yellow-50{--tw-bg-opacity:1;background-color:rgb(254 252 232/var(--tw-bg-opacity,1))}.rf-bg-zinc-100{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.rf-bg-zinc-200{--tw-bg-opacity:1;background-color:rgb(228 228 231/var(--tw-bg-opacity,1))}.rf-bg-zinc-50{--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.rf-bg-zinc-800{--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.rf-bg-zinc-900{--tw-bg-opacity:1;background-color:rgb(24 24 27/var(--tw-bg-opacity,1))}.rf-bg-zinc-950{--tw-bg-opacity:1;background-color:rgb(9 9 11/var(--tw-bg-opacity,1))}.rf-bg-opacity-50{--tw-bg-opacity:0.5}.rf-bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.rf-from-blue-500{--tw-gradient-from:#3b82f6 var(--tw-gradient-from-position);--tw-gradient-to:rgba(59,130,246,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.rf-from-emerald-500{--tw-gradient-from:#10b981 var(--tw-gradient-from-position);--tw-gradient-to:rgba(16,185,129,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.rf-from-green-500{--tw-gradient-from:#22c55e var(--tw-gradient-from-position);--tw-gradient-to:rgba(34,197,94,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.rf-from-red-500{--tw-gradient-from:#ef4444 var(--tw-gradient-from-position);--tw-gradient-to:rgba(239,68,68,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.rf-to-blue-600{--tw-gradient-to:#2563eb var(--tw-gradient-to-position)}.rf-to-emerald-600{--tw-gradient-to:#059669 var(--tw-gradient-to-position)}.rf-to-green-600{--tw-gradient-to:#16a34a var(--tw-gradient-to-position)}.rf-to-red-600{--tw-gradient-to:#dc2626 var(--tw-gradient-to-position)}.rf-fill-amber-500{fill:#f59e0b}.rf-fill-current{fill:currentColor}.rf-object-contain{-o-object-fit:contain;object-fit:contain}.rf-object-cover{-o-object-fit:cover;object-fit:cover}.\\!rf-p-0{padding:0!important}.rf-p-0{padding:0}.rf-p-1{padding:.25rem}.rf-p-2{padding:.5rem}.rf-p-3{padding:.75rem}.rf-p-4{padding:1rem}.rf-p-5{padding:1.25rem}.rf-p-6{padding:1.5rem}.rf-p-8{padding:2rem}.rf-px-1{padding-left:.25rem;padding-right:.25rem}.rf-px-1\\.5{padding-left:.375rem;padding-right:.375rem}.rf-px-2{padding-left:.5rem;padding-right:.5rem}.rf-px-2\\.5{padding-left:.625rem;padding-right:.625rem}.rf-px-3{padding-left:.75rem;padding-right:.75rem}.rf-px-4{padding-left:1rem;padding-right:1rem}.rf-px-6{padding-left:1.5rem;padding-right:1.5rem}.rf-px-8{padding-left:2rem;padding-right:2rem}.rf-py-0{padding-bottom:0;padding-top:0}.rf-py-0\\.5{padding-bottom:.125rem;padding-top:.125rem}.rf-py-1{padding-bottom:.25rem;padding-top:.25rem}.rf-py-1\\.5{padding-bottom:.375rem;padding-top:.375rem}.rf-py-10{padding-bottom:2.5rem;padding-top:2.5rem}.rf-py-12{padding-bottom:3rem;padding-top:3rem}.rf-py-2{padding-bottom:.5rem;padding-top:.5rem}.rf-py-3{padding-bottom:.75rem;padding-top:.75rem}.rf-py-4{padding-bottom:1rem;padding-top:1rem}.rf-py-6{padding-bottom:1.5rem;padding-top:1.5rem}.rf-py-8{padding-bottom:2rem;padding-top:2rem}.rf-pb-0{padding-bottom:0}.rf-pb-1{padding-bottom:.25rem}.rf-pb-2{padding-bottom:.5rem}.rf-pb-3{padding-bottom:.75rem}.rf-pb-4{padding-bottom:1rem}.rf-pb-px{padding-bottom:1px}.rf-pl-10{padding-left:2.5rem}.rf-pl-11{padding-left:2.75rem}.rf-pl-12{padding-left:3rem}.rf-pl-2{padding-left:.5rem}.rf-pl-4{padding-left:1rem}.rf-pl-8{padding-left:2rem}.rf-pr-2{padding-right:.5rem}.rf-pt-0{padding-top:0}.rf-pt-1{padding-top:.25rem}.rf-pt-2{padding-top:.5rem}.rf-pt-4{padding-top:1rem}.rf-text-left{text-align:left}.rf-text-center{text-align:center}.rf-text-right{text-align:right}.rf-align-bottom{vertical-align:bottom}.rf-font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.rf-font-sans{font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.rf-text-2xl{font-size:1.5rem;line-height:2rem}.rf-text-3xl{font-size:1.875rem;line-height:2.25rem}.rf-text-\\[10px\\]{font-size:10px}.rf-text-\\[11px\\]{font-size:11px}.rf-text-\\[8px\\]{font-size:8px}.rf-text-base{font-size:1rem;line-height:1.5rem}.rf-text-lg{font-size:1.125rem;line-height:1.75rem}.rf-text-sm{font-size:.875rem;line-height:1.25rem}.rf-text-xl{font-size:1.25rem;line-height:1.75rem}.rf-text-xs{font-size:.75rem;line-height:1rem}.\\!rf-font-normal{font-weight:400!important}.rf-font-bold{font-weight:700}.rf-font-medium{font-weight:500}.rf-font-semibold{font-weight:600}.rf-uppercase{text-transform:uppercase}.rf-capitalize{text-transform:capitalize}.rf-tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.rf-leading-5{line-height:1.25rem}.rf-leading-\\[0\\.95rem\\]{line-height:.95rem}.rf-leading-\\[1rem\\]{line-height:1rem}.rf-leading-none{line-height:1}.rf-leading-relaxed{line-height:1.625}.rf-leading-tight{line-height:1.25}.rf-tracking-wide{letter-spacing:.025em}.rf-tracking-widest{letter-spacing:.1em}.rf-text-amber-500{--tw-text-opacity:1;color:rgb(245 158 11/var(--tw-text-opacity,1))}.rf-text-black{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity,1))}.rf-text-blue-500{--tw-text-opacity:1;color:rgb(59 130 246/var(--tw-text-opacity,1))}.rf-text-blue-600{--tw-text-opacity:1;color:rgb(37 99 235/var(--tw-text-opacity,1))}.rf-text-blue-700{--tw-text-opacity:1;color:rgb(29 78 216/var(--tw-text-opacity,1))}.rf-text-blue-800{--tw-text-opacity:1;color:rgb(30 64 175/var(--tw-text-opacity,1))}.rf-text-blue-900{--tw-text-opacity:1;color:rgb(30 58 138/var(--tw-text-opacity,1))}.rf-text-current{color:currentColor}.rf-text-emerald-600{--tw-text-opacity:1;color:rgb(5 150 105/var(--tw-text-opacity,1))}.rf-text-foreground{color:hsl(var(--foreground))}.rf-text-gray-200{--tw-text-opacity:1;color:rgb(229 231 235/var(--tw-text-opacity,1))}.rf-text-gray-300{--tw-text-opacity:1;color:rgb(209 213 219/var(--tw-text-opacity,1))}.rf-text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.rf-text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.rf-text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity,1))}.rf-text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity,1))}.rf-text-gray-800{--tw-text-opacity:1;color:rgb(31 41 55/var(--tw-text-opacity,1))}.rf-text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1))}.rf-text-green-500{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity,1))}.rf-text-green-600{--tw-text-opacity:1;color:rgb(22 163 74/var(--tw-text-opacity,1))}.rf-text-green-700{--tw-text-opacity:1;color:rgb(21 128 61/var(--tw-text-opacity,1))}.rf-text-green-800{--tw-text-opacity:1;color:rgb(22 101 52/var(--tw-text-opacity,1))}.rf-text-green-900{--tw-text-opacity:1;color:rgb(20 83 45/var(--tw-text-opacity,1))}.rf-text-muted{color:hsl(var(--muted))}.rf-text-muted-foreground{color:hsl(var(--muted-foreground))}.rf-text-neutral-50{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.rf-text-neutral-500{--tw-text-opacity:1;color:rgb(115 115 115/var(--tw-text-opacity,1))}.rf-text-neutral-900{--tw-text-opacity:1;color:rgb(23 23 23/var(--tw-text-opacity,1))}.rf-text-neutral-950{--tw-text-opacity:1;color:rgb(10 10 10/var(--tw-text-opacity,1))}.rf-text-orange-400{--tw-text-opacity:1;color:rgb(251 146 60/var(--tw-text-opacity,1))}.rf-text-orange-500{--tw-text-opacity:1;color:rgb(249 115 22/var(--tw-text-opacity,1))}.rf-text-orange-600{--tw-text-opacity:1;color:rgb(234 88 12/var(--tw-text-opacity,1))}.rf-text-orange-700{--tw-text-opacity:1;color:rgb(194 65 12/var(--tw-text-opacity,1))}.rf-text-orange-800{--tw-text-opacity:1;color:rgb(154 52 18/var(--tw-text-opacity,1))}.rf-text-popover-foreground{color:hsl(var(--popover-foreground))}.rf-text-red-200{--tw-text-opacity:1;color:rgb(254 202 202/var(--tw-text-opacity,1))}.rf-text-red-300{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.rf-text-red-400{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.rf-text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity,1))}.rf-text-red-600{--tw-text-opacity:1;color:rgb(220 38 38/var(--tw-text-opacity,1))}.rf-text-red-700{--tw-text-opacity:1;color:rgb(185 28 28/var(--tw-text-opacity,1))}.rf-text-red-800{--tw-text-opacity:1;color:rgb(153 27 27/var(--tw-text-opacity,1))}.rf-text-red-900{--tw-text-opacity:1;color:rgb(127 29 29/var(--tw-text-opacity,1))}.rf-text-slate-200{--tw-text-opacity:1;color:rgb(226 232 240/var(--tw-text-opacity,1))}.rf-text-slate-400{--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity,1))}.rf-text-slate-50{--tw-text-opacity:1;color:rgb(248 250 252/var(--tw-text-opacity,1))}.rf-text-slate-500{--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity,1))}.rf-text-slate-600{--tw-text-opacity:1;color:rgb(71 85 105/var(--tw-text-opacity,1))}.rf-text-slate-800{--tw-text-opacity:1;color:rgb(30 41 59/var(--tw-text-opacity,1))}.rf-text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.rf-text-yellow-400{--tw-text-opacity:1;color:rgb(250 204 21/var(--tw-text-opacity,1))}.rf-text-yellow-500{--tw-text-opacity:1;color:rgb(234 179 8/var(--tw-text-opacity,1))}.rf-text-yellow-600{--tw-text-opacity:1;color:rgb(202 138 4/var(--tw-text-opacity,1))}.rf-text-yellow-700{--tw-text-opacity:1;color:rgb(161 98 7/var(--tw-text-opacity,1))}.rf-text-yellow-900{--tw-text-opacity:1;color:rgb(113 63 18/var(--tw-text-opacity,1))}.rf-text-zinc-200{--tw-text-opacity:1;color:rgb(228 228 231/var(--tw-text-opacity,1))}.rf-text-zinc-300{--tw-text-opacity:1;color:rgb(212 212 216/var(--tw-text-opacity,1))}.rf-text-zinc-400{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.rf-text-zinc-50{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.rf-text-zinc-500{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.rf-text-zinc-900{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.rf-text-zinc-950{--tw-text-opacity:1;color:rgb(9 9 11/var(--tw-text-opacity,1))}.rf-underline{text-decoration-line:underline}.rf-line-through{text-decoration-line:line-through}.rf-underline-offset-4{text-underline-offset:4px}.rf-opacity-0{opacity:0}.rf-opacity-10{opacity:.1}.rf-opacity-100{opacity:1}.rf-opacity-25{opacity:.25}.rf-opacity-30{opacity:.3}.rf-opacity-50{opacity:.5}.rf-opacity-60{opacity:.6}.rf-opacity-70{opacity:.7}.rf-opacity-75{opacity:.75}.rf-shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}.rf-shadow,.rf-shadow-lg{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.rf-shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}.rf-shadow-md{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.rf-shadow-md,.rf-shadow-none{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.rf-shadow-none{--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000}.rf-shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}.rf-shadow-sm,.rf-shadow-xl{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.rf-shadow-xl{--tw-shadow:0 20px 25px -5px rgba(0,0,0,.1),0 8px 10px -6px rgba(0,0,0,.1);--tw-shadow-colored:0 20px 25px -5px var(--tw-shadow-color),0 8px 10px -6px var(--tw-shadow-color)}.rf-outline-none{outline:2px solid transparent;outline-offset:2px}.rf-ring-2{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.rf-ring-blue-500{--tw-ring-opacity:1;--tw-ring-color:rgb(59 130 246/var(--tw-ring-opacity,1))}.rf-ring-primary{--tw-ring-color:hsl(var(--primary))}.rf-ring-offset-background{--tw-ring-offset-color:hsl(var(--background))}.rf-ring-offset-white{--tw-ring-offset-color:#fff}.rf-transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-opacity{transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-transform{transition-duration:.15s;transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-duration-150{transition-duration:.15s}.rf-duration-200{transition-duration:.2s}.rf-ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0),var(--tw-enter-translate-y,0),0) scale3d(var(--tw-enter-scale,1),var(--tw-enter-scale,1),var(--tw-enter-scale,1)) rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0),var(--tw-exit-translate-y,0),0) scale3d(var(--tw-exit-scale,1),var(--tw-exit-scale,1),var(--tw-exit-scale,1)) rotate(var(--tw-exit-rotate,0))}}.rf-animate-in{animation-duration:.15s;animation-name:enter;--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial}.rf-fade-in-0{--tw-enter-opacity:0}.rf-zoom-in-95{--tw-enter-scale:.95}.rf-slide-in-from-left-1{--tw-enter-translate-x:-0.25rem}.rf-slide-out-to-left-1{--tw-exit-translate-x:-0.25rem}.rf-duration-150{animation-duration:.15s}.rf-duration-200{animation-duration:.2s}.rf-ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.no-scrollbar::-webkit-scrollbar{display:none}.no-scrollbar{-ms-overflow-style:none;scrollbar-width:none}.file\\:rf-border-0::file-selector-button{border-width:0}.file\\:rf-bg-transparent::file-selector-button{background-color:transparent}.file\\:rf-text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\\:rf-font-medium::file-selector-button{font-weight:500}.placeholder\\:rf-text-zinc-500::-moz-placeholder{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.placeholder\\:rf-text-zinc-500::placeholder{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.hover\\:rf-border-blue-300:hover{--tw-border-opacity:1;border-color:rgb(147 197 253/var(--tw-border-opacity,1))}.hover\\:\\!rf-bg-transparent:hover{background-color:transparent!important}.hover\\:rf-bg-blue-700:hover{--tw-bg-opacity:1;background-color:rgb(29 78 216/var(--tw-bg-opacity,1))}.hover\\:rf-bg-gray-50:hover{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity,1))}.hover\\:rf-bg-orange-100:hover{--tw-bg-opacity:1;background-color:rgb(255 237 213/var(--tw-bg-opacity,1))}.hover\\:rf-bg-red-100:hover{--tw-bg-opacity:1;background-color:rgb(254 226 226/var(--tw-bg-opacity,1))}.hover\\:rf-bg-red-500\\/90:hover{background-color:rgba(239,68,68,.9)}.hover\\:rf-bg-slate-100:hover{--tw-bg-opacity:1;background-color:rgb(241 245 249/var(--tw-bg-opacity,1))}.hover\\:rf-bg-slate-200:hover{--tw-bg-opacity:1;background-color:rgb(226 232 240/var(--tw-bg-opacity,1))}.hover\\:rf-bg-slate-50:hover{--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity,1))}.hover\\:rf-bg-zinc-100:hover{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.hover\\:rf-bg-zinc-100\\/80:hover{background-color:hsla(240,5%,96%,.8)}.hover\\:rf-bg-zinc-900\\/90:hover{background-color:rgba(24,24,27,.9)}.hover\\:rf-text-blue-800:hover{--tw-text-opacity:1;color:rgb(30 64 175/var(--tw-text-opacity,1))}.hover\\:rf-text-gray-700:hover{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity,1))}.hover\\:rf-text-red-400:hover{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.hover\\:rf-text-slate-800:hover{--tw-text-opacity:1;color:rgb(30 41 59/var(--tw-text-opacity,1))}.hover\\:rf-text-slate-900:hover{--tw-text-opacity:1;color:rgb(15 23 42/var(--tw-text-opacity,1))}.hover\\:rf-text-zinc-900:hover{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.hover\\:rf-underline:hover{text-decoration-line:underline}.focus\\:rf-bg-gray-100:focus{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.focus\\:rf-bg-zinc-100:focus{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.focus\\:rf-text-gray-900:focus{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1))}.focus\\:rf-text-zinc-900:focus{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.focus\\:rf-outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\\:rf-ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus\\:rf-ring-blue-500:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(59 130 246/var(--tw-ring-opacity,1))}.focus\\:rf-ring-ring:focus{--tw-ring-color:hsl(var(--ring))}.focus\\:rf-ring-offset-2:focus{--tw-ring-offset-width:2px}.focus-visible\\:rf-outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\\:rf-ring-1:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\\:rf-ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\\:rf-ring-zinc-950:focus-visible{--tw-ring-opacity:1;--tw-ring-color:rgb(9 9 11/var(--tw-ring-opacity,1))}.focus-visible\\:rf-ring-offset-2:focus-visible{--tw-ring-offset-width:2px}.disabled\\:rf-pointer-events-none:disabled{pointer-events:none}.disabled\\:rf-cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:rf-opacity-50:disabled{opacity:.5}.rf-group:hover .group-hover\\:rf-opacity-100,.rf-group\\/bar:hover .group-hover\\/bar\\:rf-opacity-100{opacity:1}.rf-peer:disabled~.peer-disabled\\:rf-cursor-not-allowed{cursor:not-allowed}.rf-peer:disabled~.peer-disabled\\:rf-opacity-70{opacity:.7}.data-\\[disabled\\=true\\]\\:rf-pointer-events-none[data-disabled=true],.data-\\[disabled\\]\\:rf-pointer-events-none[data-disabled]{pointer-events:none}.data-\\[side\\=bottom\\]\\:rf-translate-y-1[data-side=bottom]{--tw-translate-y:0.25rem}.data-\\[side\\=bottom\\]\\:rf-translate-y-1[data-side=bottom],.data-\\[side\\=left\\]\\:-rf-translate-x-1[data-side=left]{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))}.data-\\[side\\=left\\]\\:-rf-translate-x-1[data-side=left]{--tw-translate-x:-0.25rem}.data-\\[side\\=right\\]\\:rf-translate-x-1[data-side=right]{--tw-translate-x:0.25rem}.data-\\[side\\=right\\]\\:rf-translate-x-1[data-side=right],.data-\\[side\\=top\\]\\:-rf-translate-y-1[data-side=top]{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))}.data-\\[side\\=top\\]\\:-rf-translate-y-1[data-side=top]{--tw-translate-y:-0.25rem}.data-\\[selected\\=true\\]\\:rf-bg-zinc-100[data-selected=true]{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.data-\\[state\\=active\\]\\:rf-bg-white[data-state=active]{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.data-\\[state\\=checked\\]\\:rf-bg-zinc-900[data-state=checked]{--tw-bg-opacity:1;background-color:rgb(24 24 27/var(--tw-bg-opacity,1))}.data-\\[state\\=open\\]\\:rf-bg-zinc-100[data-state=open]{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.data-\\[selected\\=true\\]\\:rf-text-zinc-900[data-selected=true]{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.data-\\[state\\=active\\]\\:rf-text-zinc-950[data-state=active]{--tw-text-opacity:1;color:rgb(9 9 11/var(--tw-text-opacity,1))}.data-\\[state\\=checked\\]\\:rf-text-zinc-50[data-state=checked]{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.data-\\[disabled\\=true\\]\\:rf-opacity-50[data-disabled=true],.data-\\[disabled\\]\\:rf-opacity-50[data-disabled]{opacity:.5}.data-\\[state\\=active\\]\\:rf-shadow[data-state=active]{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.data-\\[state\\=open\\]\\:rf-animate-in[data-state=open]{animation-duration:.15s;animation-name:enter;--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial}.data-\\[state\\=closed\\]\\:rf-animate-out[data-state=closed]{animation-duration:.15s;animation-name:exit;--tw-exit-opacity:initial;--tw-exit-scale:initial;--tw-exit-rotate:initial;--tw-exit-translate-x:initial;--tw-exit-translate-y:initial}.data-\\[state\\=closed\\]\\:rf-fade-out-0[data-state=closed]{--tw-exit-opacity:0}.data-\\[state\\=open\\]\\:rf-fade-in-0[data-state=open]{--tw-enter-opacity:0}.data-\\[state\\=closed\\]\\:rf-zoom-out-95[data-state=closed]{--tw-exit-scale:.95}.data-\\[state\\=open\\]\\:rf-zoom-in-95[data-state=open]{--tw-enter-scale:.95}.data-\\[side\\=bottom\\]\\:rf-slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y:-0.5rem}.data-\\[side\\=left\\]\\:rf-slide-in-from-right-2[data-side=left]{--tw-enter-translate-x:0.5rem}.data-\\[side\\=right\\]\\:rf-slide-in-from-left-2[data-side=right]{--tw-enter-translate-x:-0.5rem}.data-\\[side\\=top\\]\\:rf-slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y:0.5rem}.data-\\[state\\=closed\\]\\:rf-slide-out-to-left-1\\/2[data-state=closed]{--tw-exit-translate-x:-50%}.data-\\[state\\=closed\\]\\:rf-slide-out-to-top-\\[48\\%\\][data-state=closed]{--tw-exit-translate-y:-48%}.data-\\[state\\=open\\]\\:rf-slide-in-from-left-1\\/2[data-state=open]{--tw-enter-translate-x:-50%}.data-\\[state\\=open\\]\\:rf-slide-in-from-top-\\[48\\%\\][data-state=open]{--tw-enter-translate-y:-48%}.dark\\:rf-border-zinc-50:is(.rf-dark *){--tw-border-opacity:1;border-color:rgb(250 250 250/var(--tw-border-opacity,1))}.dark\\:rf-border-zinc-800:is(.rf-dark *){--tw-border-opacity:1;border-color:rgb(39 39 42/var(--tw-border-opacity,1))}.dark\\:rf-bg-gray-700:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.dark\\:rf-bg-gray-800:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.dark\\:rf-bg-red-900:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(127 29 29/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-50:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-800:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-950:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(9 9 11/var(--tw-bg-opacity,1))}.dark\\:rf-text-gray-500:is(.rf-dark *){--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.dark\\:rf-text-zinc-400:is(.rf-dark *){--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.dark\\:rf-text-zinc-50:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:rf-text-zinc-900:is(.rf-dark *){--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.dark\\:rf-placeholder-zinc-400:is(.rf-dark *)::-moz-placeholder{--tw-placeholder-opacity:1;color:rgb(161 161 170/var(--tw-placeholder-opacity,1))}.dark\\:rf-placeholder-zinc-400:is(.rf-dark *)::placeholder{--tw-placeholder-opacity:1;color:rgb(161 161 170/var(--tw-placeholder-opacity,1))}.dark\\:rf-ring-offset-zinc-950:is(.rf-dark *){--tw-ring-offset-color:#09090b}.dark\\:placeholder\\:rf-text-zinc-400:is(.rf-dark *)::-moz-placeholder{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.dark\\:placeholder\\:rf-text-zinc-400:is(.rf-dark *)::placeholder{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.dark\\:hover\\:rf-bg-red-900\\/90:hover:is(.rf-dark *){background-color:rgba(127,29,29,.9)}.dark\\:hover\\:rf-bg-zinc-50\\/90:hover:is(.rf-dark *){background-color:hsla(0,0%,98%,.9)}.dark\\:hover\\:rf-bg-zinc-800:hover:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:hover\\:rf-bg-zinc-800\\/80:hover:is(.rf-dark *){background-color:rgba(39,39,42,.8)}.dark\\:hover\\:rf-text-zinc-50:hover:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:focus\\:rf-bg-zinc-800:focus:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:focus\\:rf-text-zinc-50:focus:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:focus-visible\\:rf-ring-zinc-300:focus-visible:is(.rf-dark *){--tw-ring-opacity:1;--tw-ring-color:rgb(212 212 216/var(--tw-ring-opacity,1))}.dark\\:data-\\[selected\\=true\\]\\:rf-bg-zinc-800[data-selected=true]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=active\\]\\:rf-bg-zinc-950[data-state=active]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(9 9 11/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=checked\\]\\:rf-bg-zinc-50[data-state=checked]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=open\\]\\:rf-bg-zinc-800[data-state=open]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:data-\\[selected\\=true\\]\\:rf-text-zinc-50[data-selected=true]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:data-\\[state\\=active\\]\\:rf-text-zinc-50[data-state=active]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:data-\\[state\\=checked\\]\\:rf-text-zinc-900[data-state=checked]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}@media (min-width:640px){.sm\\:rf-order-1{order:1}.sm\\:rf-order-2{order:2}.sm\\:rf-mt-0{margin-top:0}.sm\\:rf-mt-4{margin-top:1rem}.sm\\:rf-block{display:block}.sm\\:rf-inline{display:inline}.sm\\:rf-grid{display:grid}.sm\\:rf-hidden{display:none}.sm\\:rf-h-5{height:1.25rem}.sm\\:rf-w-1\\/2{width:50%}.sm\\:rf-w-5{width:1.25rem}.sm\\:rf-w-\\[90vw\\]{width:90vw}.sm\\:rf-w-auto{width:auto}.sm\\:rf-max-w-\\[500px\\]{max-width:500px}.sm\\:rf-max-w-md{max-width:28rem}.sm\\:rf-grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\\:rf-grid-cols-\\[1fr_auto\\]{grid-template-columns:1fr auto}.sm\\:rf-grid-cols-\\[minmax\\(0\\2c 1fr\\)_auto\\]{grid-template-columns:minmax(0,1fr) auto}.sm\\:rf-flex-row{flex-direction:row}.sm\\:rf-items-center{align-items:center}.sm\\:rf-justify-end{justify-content:flex-end}.sm\\:rf-gap-3{gap:.75rem}.sm\\:rf-gap-4{gap:1rem}.sm\\:rf-space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.5rem*var(--tw-space-x-reverse))}.sm\\:rf-rounded-lg{border-radius:var(--radius)}.sm\\:rf-p-3{padding:.75rem}.sm\\:rf-p-6{padding:1.5rem}.sm\\:rf-px-4{padding-left:1rem;padding-right:1rem}.sm\\:rf-px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\\:rf-py-6{padding-bottom:1.5rem;padding-top:1.5rem}.sm\\:rf-text-left{text-align:left}.sm\\:rf-text-2xl{font-size:1.5rem;line-height:2rem}.sm\\:rf-text-base{font-size:1rem;line-height:1.5rem}.sm\\:rf-text-sm{font-size:.875rem;line-height:1.25rem}.sm\\:rf-text-xl{font-size:1.25rem;line-height:1.75rem}}@media (min-width:768px){.md\\:rf-w-auto{width:auto}.md\\:rf-max-w-\\[660px\\]{max-width:660px}.md\\:rf-max-w-lg{max-width:32rem}.md\\:rf-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\\:rf-p-8{padding:2rem}.md\\:rf-py-8{padding-bottom:2rem;padding-top:2rem}.md\\:rf-text-3xl{font-size:1.875rem;line-height:2.25rem}}@media (min-width:1024px){.lg\\:rf-max-w-\\[720px\\]{max-width:720px}.lg\\:rf-max-w-xl{max-width:36rem}}@media (min-width:1280px){.xl\\:rf-max-w-\\[800px\\]{max-width:800px}}.\\[\\&\\>span\\]\\:rf-line-clamp-1>span{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\\[\\&\\>svg\\]\\:rf-size-4>svg{height:1rem;width:1rem}.\\[\\&\\>svg\\]\\:rf-shrink-0>svg{flex-shrink:0}.\\[\\&\\>svg\\]\\:rf-text-red-300>svg{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.\\[\\&\\>svg\\]\\:hover\\:rf-text-red-400:hover>svg{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-py-1\\.5 [cmdk-group-heading]{padding-bottom:.375rem;padding-top:.375rem}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-font-medium [cmdk-group-heading]{font-weight:500}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-text-zinc-500 [cmdk-group-heading]{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.dark\\:\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-text-zinc-400 [cmdk-group-heading]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.\\[\\&_\\[cmdk-group\\]\\:not\\(\\[hidden\\]\\)_\\~\\[cmdk-group\\]\\]\\:rf-pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\\[\\&_\\[cmdk-group\\]\\]\\:rf-px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\\[\\&_\\[cmdk-input-wrapper\\]_svg\\]\\:rf-h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\\[\\&_\\[cmdk-input-wrapper\\]_svg\\]\\:rf-w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\\[\\&_\\[cmdk-input\\]\\]\\:rf-h-12 [cmdk-input]{height:3rem}.\\[\\&_\\[cmdk-item\\]\\]\\:rf-px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\\[\\&_\\[cmdk-item\\]\\]\\:rf-py-3 [cmdk-item]{padding-bottom:.75rem;padding-top:.75rem}.\\[\\&_\\[cmdk-item\\]_svg\\]\\:rf-h-5 [cmdk-item] svg{height:1.25rem}.\\[\\&_\\[cmdk-item\\]_svg\\]\\:rf-w-5 [cmdk-item] svg{width:1.25rem}.\\[\\&_svg\\]\\:rf-pointer-events-none svg{pointer-events:none}.\\[\\&_svg\\]\\:rf-size-4 svg{height:1rem;width:1rem}.\\[\\&_svg\\]\\:rf-shrink-0 svg{flex-shrink:0}',CLt=()=>{ne.useEffect(()=>{if(document.querySelector('style[data-styles="tscircuit-runframe"]'))return;const e=document.createElement("style");e.setAttribute("data-styles","tscircuit-runframe"),e.textContent=yYo,document.head.appendChild(e)},[])},EYo=t=>{ne.useEffect(()=>(t?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[t])};function yLt(t,e,n){const[o,i]=ne.useState(()=>{if(n!==void 0)return n;try{const r=window.localStorage.getItem(t);return r?JSON.parse(r):e}catch(r){return console.error("Error reading from localStorage:",r),e}});return ne.useEffect(()=>{try{window.localStorage.setItem(t,JSON.stringify(o))}catch(r){console.error("Error writing to localStorage:",r)}},[t,o]),[o,i]}const ELt=t=>`hsl(${BB.indexOf(t)*137.5%360}, 70%, 50%)`,xYo=({phaseTimings:t})=>{if(!t)return null;const e=Object.values(t).reduce((n,o)=>n+o,0);return j.jsxs("div",{className:"rf-space-y-2 rf-w-full rf-px-4",children:[j.jsx("div",{className:"rf-relative rf-h-8 rf-flex rf-rounded-sm",children:BB.map(n=>{const o=t[n]||0,i=o/e*100;return j.jsx("div",{className:"rf-group/bar rf-relative rf-overflow-visible",style:{width:`${i}%`,backgroundColor:ELt(n)},children:j.jsxs("div",{className:"rf-opacity-0 group-hover/bar:rf-opacity-100 rf-transition-opacity rf-absolute rf-bottom-full rf-left-1/2 rf-transform -rf-translate-x-1/2 rf-mb-2 rf-px-2 rf-py-1 rf-text-xs rf-whitespace-nowrap rf-rounded rf-bg-gray-900 rf-text-white rf-pointer-events-none",children:[n,": ",o.toFixed(1),"ms"]})},n)})}),j.jsxs("div",{className:"rf-text-xs rf-text-gray-500",children:["Total: ",e.toFixed(2),"ms"]})]})},BYo=t=>{if(t instanceof Blob)return t;if(t==null)return"";if(typeof t=="string")return t;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{return String(t)}return String(t)},QYo=({renderLog:t,onRerunWithDebug:e})=>{const[n,o]=ne.useState("chronological"),[i,r]=ne.useState(""),s=[{value:"",label:"None"},{value:"DEBUG=Group_doInitialSchematicTraceRender",label:"DEBUG=Group_doInitialSchematicTraceRender"},{value:"DEBUG=Group_doInitialSchematicLayoutMatchpack",label:"DEBUG=Group_doInitialSchematicLayoutMatchpack"},{value:"DEBUG=Group_doInitialPcbLayoutPack",label:"DEBUG=Group_doInitialPcbLayoutPack"}];if(!t)return j.jsxs("div",{className:"rf-p-4 rf-bg-gray-100 rf-rounded-md",children:[j.jsx("div",{className:"rf-mb-4",children:"No render log, make sure this tab is open when you render"}),e&&j.jsxs("div",{className:"rf-flex rf-gap-2 rf-items-center",children:[j.jsx("select",{value:i,onChange:c=>r(c.target.value),className:"rf-px-3 rf-py-1 rf-border rf-rounded rf-text-xs rf-bg-white",children:s.map(c=>j.jsx("option",{value:c.value,children:c.label},c.value))}),j.jsx(Sc,{onClick:()=>e(i),size:"sm",className:"rf-text-xs",children:"Rerun Render with Debug"})]})]});const a=Object.entries(t?.phaseTimings??{});n==="chronological"?a.sort((c,l)=>BB.indexOf(c[0])-BB.indexOf(l[0])):a.sort((c,l)=>l[1]-c[1]);const A=a.reduce((c,[l,g])=>c+g,0);return j.jsxs("div",{className:"rf-bg-white",children:[j.jsxs("div",{className:"rf-flex rf-justify-between rf-items-center rf-mb-4",children:[j.jsx("div",{children:"Render Logs"}),j.jsxs("div",{className:"rf-flex rf-gap-4 rf-items-center",children:[e&&j.jsxs("div",{className:"rf-flex rf-gap-2 rf-items-center",children:[j.jsx("select",{value:i,onChange:c=>r(c.target.value),className:"rf-px-3 rf-py-1 rf-border rf-rounded rf-text-xs rf-bg-white",children:s.map(c=>j.jsx("option",{value:c.value,children:c.label},c.value))}),j.jsx(Sc,{onClick:()=>e(i),size:"sm",className:"rf-text-xs",children:"Rerun Render with Debug"})]}),j.jsx("div",{className:"rf-flex rf-gap-2 rf-items-center",children:j.jsxs("select",{onChange:c=>{if(c.target.value){const l=t?.debugOutputs?.find(g=>g.name===c.target.value);if(l){const g=BYo(l.content),u=g instanceof Blob?g:new Blob([g],{type:"text/plain"}),h=URL.createObjectURL(u),d=document.createElement("a");d.href=h,d.download=`debug-${l.name}.txt`,document.body.appendChild(d),d.click(),document.body.removeChild(d),URL.revokeObjectURL(h)}c.target.value=""}},disabled:!t?.debugOutputs||t.debugOutputs.length===0,className:"rf-px-3 rf-py-1 rf-border rf-rounded rf-text-xs rf-bg-white disabled:rf-opacity-50 disabled:rf-cursor-not-allowed",children:[j.jsx("option",{value:"",children:"Download Debug Output"}),t?.debugOutputs?.map(c=>j.jsx("option",{value:c.name,children:c.name},c.name))]})}),j.jsxs("div",{className:"rf-flex rf-text-xs rf-items-center",children:[j.jsx("div",{className:"rf-mr-2",children:"Sort by:"}),j.jsxs("select",{value:n,onChange:c=>o(c.target.value),className:"rf-px-2 rf-py-1 rf-border rf-rounded rf-text-xs",children:[j.jsx("option",{value:"chronological",children:"Phase Order"}),j.jsx("option",{value:"longest",children:"Duration"})]})]})]})]}),j.jsx(xYo,{phaseTimings:t.phaseTimings}),j.jsxs("table",{className:"rf-w-full rf-text-xs",children:[j.jsx("thead",{children:j.jsxs("tr",{children:[j.jsx("th",{className:"rf-text-left rf-p-2",children:"Phase Order"}),j.jsx("th",{className:"rf-text-left rf-p-2",children:"Phase"}),j.jsx("th",{className:"rf-text-left rf-p-2",children:"Duration (ms)"})]})}),j.jsx("tbody",{children:a.map(([c,l])=>j.jsxs("tr",{children:[j.jsx("td",{className:"rf-p-2",children:BB.indexOf(c)}),j.jsx("td",{className:"rf-p-2",children:c}),j.jsx("td",{className:"rf-p-2",children:j.jsx("div",{className:"rf-w-8",children:j.jsx("div",{className:"rf-h-2 rf-rounded-sm",style:{backgroundColor:ELt(c),width:`${l/A*100}%`}})})}),j.jsx("td",{className:"rf-p-2",children:j.jsxs("div",{className:"rf-flex w-full",children:[j.jsxs("span",{className:"rf-flex-grow",children:[l,"ms"]}),j.jsxs("span",{className:"rf-text-gray-500 rf-pr-2",children:[(l/A*100).toFixed(1),"%"]})]})})]},c))})]})]})},SYo=jr[typeof document<"u"&&document.createElement!==void 0?"useLayoutEffect":"useEffect"],bYo=t=>{const e=ne.useRef(t);return ne.useEffect(()=>{e.current=t}),e};function DYo(){}function PYo(t,e,n={}){const o=MYo(n.polyfill),i=bYo(e);return SYo(()=>{let r=!1;const s=t&&"current"in t?t.current:t;if(!s)return DYo;function a(A,c){r||i.current(A,c)}return o.subscribe(s,a),()=>{r=!0,o.unsubscribe(s,a)}},[t,o,i]),o.observer}function vYo(t){let e=!1,n=[];const o=new Map,i=new(t||window.ResizeObserver)((r,s)=>{n=n.concat(r);function a(){const A=new Set;for(let c=0;c<n.length;c++){if(A.has(n[c].target))continue;A.add(n[c].target);const l=o.get(n[c].target);l?.forEach(g=>g(n[c],s))}n=[],e=!1}e||window.requestAnimationFrame(a),e=!0});return{observer:i,subscribe(r,s){var a;i.observe(r);const A=(a=o.get(r))!==null&&a!==void 0?a:[];A.push(s),o.set(r,A)},unsubscribe(r,s){var a;const A=(a=o.get(r))!==null&&a!==void 0?a:[];if(A.length===1){i.unobserve(r),o.delete(r);return}const c=A.indexOf(s);c!==-1&&A.splice(c,1),o.set(r,A)}}}let z8e;const MYo=t=>z8e||(z8e=vYo(t));var wYo=t=>{const e={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const n of t.lines??[])for(const o of n.points??[])e.minX=Math.min(e.minX,o.x),e.minY=Math.min(e.minY,o.y),e.maxX=Math.max(e.maxX,o.x),e.maxY=Math.max(e.maxY,o.y);for(const n of t.rects??[]){const o=Aqn(n);e.minX=Math.min(e.minX,o.minX),e.minY=Math.min(e.minY,o.minY),e.maxX=Math.max(e.maxX,o.maxX),e.maxY=Math.max(e.maxY,o.maxY)}for(const n of t.polygons??[])for(const o of n.points??[])e.minX=Math.min(e.minX,o.x),e.minY=Math.min(e.minY,o.y),e.maxX=Math.max(e.maxX,o.x),e.maxY=Math.max(e.maxY,o.y);for(const n of t.points??[])e.minX=Math.min(e.minX,n.x),e.minY=Math.min(e.minY,n.y),e.maxX=Math.max(e.maxX,n.x),e.maxY=Math.max(e.maxY,n.y);for(const n of t.circles??[])e.minX=Math.min(e.minX,n.center.x-n.radius),e.minY=Math.min(e.minY,n.center.y-n.radius),e.maxX=Math.max(e.maxX,n.center.x+n.radius),e.maxY=Math.max(e.maxY,n.center.y+n.radius);for(const n of t.arrows??[]){const o=npt(n);e.minX=Math.min(e.minX,o.minX),e.minY=Math.min(e.minY,o.minY),e.maxX=Math.max(e.maxX,o.maxX),e.maxY=Math.max(e.maxY,o.maxY)}for(const n of t.texts??[])e.minX=Math.min(e.minX,n.x),e.minY=Math.min(e.minY,n.y),e.maxX=Math.max(e.maxX,n.x),e.maxY=Math.max(e.maxY,n.y);return e};function NYo(t){const e=l=>!l||l.length===0?0:l.reduce((g,u)=>{const h=Number.isNaN(u.step)?0:u.step||0;return Math.max(g,h)},0),n=e(t.points),o=e(t.lines),i=e(t.infiniteLines),r=e(t.rects),s=e(t.polygons),a=e(t.circles),A=e(t.texts),c=e(t.arrows);return Math.max(n,o,i,r,s,a,A,c)}var RYo=t=>t.slice().sort((e,n)=>n.width*n.height-e.width*e.height);function TYo(t){const{dimensionStart:e,dimensionEnd:n,screenDimensionStart:o,screenDimensionEnd:i,flipX:r,flipY:s}=t,a=n.x-e.x,A=n.y-e.y,c=Math.sqrt(a*a+A*A),l=i.x-o.x,g=i.y-o.y,u=Math.sqrt(l*l+g*g),h=Math.atan2(g,l)*(180/Math.PI),d=Math.abs(h)%90,m=Math.min(d,90-d)>15,p=(o.x+i.x)/2,I=(o.y+i.y)/2,f=15,C=h+90;let y=Math.cos(C*Math.PI/180)*f,E=Math.sin(C*Math.PI/180)*f;const B=l>0&&g<0,Q=l>0&&g>0,b=l<0&&g>0;r!==s&&!B&&(y=-y,E=-E),B&&(y+=Math.cos(C*Math.PI/180)*-45,E+=Math.sin(C*Math.PI/180)*-45),Q&&(y+=Math.cos(C*Math.PI/180)+-20,E+=Math.sin(C*Math.PI/180)+-10),b&&(y+=Math.cos(C*Math.PI/180)*10,E+=Math.sin(C*Math.PI/180)*10);const D=p+y,R=I+E;return{distance:c,screenDistance:u,x:D,y:R,show:c>.01&&u>30&&m}}function kYo(t){const{dimensionStart:e,dimensionEnd:n,screenDimensionStart:o,screenDimensionEnd:i,flipX:r,flipY:s}=t;return ne.useMemo(()=>TYo({dimensionStart:e,dimensionEnd:n,screenDimensionStart:o,screenDimensionEnd:i,flipX:r,flipY:s}),[e,n,o,i,r,s])}var FYo=({children:t,transform:e})=>{e||(e=XJn());const[n,o]=ne.useState(!1),[i,r]=ne.useState(!1),[s,a]=ne.useState({x:0,y:0}),[A,c]=ne.useState({x:0,y:0}),l=ne.useRef({x:0,y:0}),g=ne.useRef(null),u=ne.useRef(!1),d=g.current?.getBoundingClientRect(),_=ne.useCallback(()=>{u.current=!0,g.current?.focus()},[]),m=ne.useCallback(()=>{u.current=!1},[]);ne.useEffect(()=>{const y=E=>{const B=g.current?.contains(document.activeElement)||document.activeElement===g.current;!u.current&&!B||(E.key==="d"&&(a({x:l.current.x,y:l.current.y}),c({x:l.current.x,y:l.current.y}),o(Q=>!Q),r(!0)),E.key==="Escape"&&(o(!1),r(!1)))};return window.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y)}},[]);const p=_g(e,s),I=_g(e,A),f={left:Math.min(p.x,I.x),right:Math.max(p.x,I.x),top:Math.min(p.y,I.y),bottom:Math.max(p.y,I.y),flipX:p.x>I.x,flipY:p.y>I.y,width:0,height:0};f.width=f.right-f.left,f.height=f.bottom-f.top;const C=kYo({dimensionStart:s,dimensionEnd:A,screenDimensionStart:p,screenDimensionEnd:I,flipX:f.flipX,flipY:f.flipY});return j.jsxs("div",{ref:g,tabIndex:0,style:{position:"relative"},onMouseMove:y=>{const E=y.currentTarget.getBoundingClientRect(),B=y.clientX-E.left,Q=y.clientY-E.top,b=_g(AEe(e),{x:B,y:Q});l.current.x=b.x,l.current.y=b.y,i&&c({x:b.x,y:b.y})},onMouseDown:()=>{i?r(!1):n&&o(!1)},onMouseEnter:_,onMouseLeave:m,children:[t,n&&j.jsxs(j.Fragment,{children:[C.show&&j.jsx("div",{style:{position:"absolute",left:C.x,top:C.y,color:"red",mixBlendMode:"difference",pointerEvents:"none",fontSize:12,fontFamily:"sans-serif",whiteSpace:"nowrap",zIndex:30},children:C.distance.toFixed(2)}),j.jsx("div",{style:{position:"absolute",left:f.left,width:f.width,textAlign:"center",top:p.y+2,color:"red",mixBlendMode:"difference",pointerEvents:"none",marginTop:f.flipY?0:-20,fontSize:12,fontFamily:"sans-serif",zIndex:30},children:Math.abs(s.x-A.x).toFixed(2)}),j.jsx("div",{style:{position:"absolute",left:I.x,height:f.height,display:"flex",flexDirection:"column",justifyContent:"center",top:f.top,color:"red",pointerEvents:"none",mixBlendMode:"difference",fontSize:12,fontFamily:"sans-serif",zIndex:30},children:j.jsx("div",{style:{marginLeft:f.flipX?"-100%":4,paddingRight:4},children:Math.abs(s.y-A.y).toFixed(2)})}),j.jsxs("svg",{style:{position:"absolute",left:0,top:0,pointerEvents:"none",mixBlendMode:"difference",zIndex:30},width:d?.width||"100%",height:d?.height||"100%",children:[j.jsx("defs",{children:j.jsx("marker",{id:"head",orient:"auto",markerWidth:"3",markerHeight:"4",refX:"2",refY:"2",children:j.jsx("path",{d:"M0,0 V4 L2,2 Z",fill:"red"})})}),j.jsx("line",{x1:p.x,y1:p.y,x2:I.x,y2:I.y,markerEnd:"url(#head)",strokeWidth:1.5,fill:"none",stroke:"red"}),j.jsx("line",{x1:p.x,y1:p.y,x2:I.x,y2:p.y,strokeWidth:1.5,fill:"none",strokeDasharray:"2,2",stroke:"red"}),j.jsx("line",{x1:I.x,y1:p.y,x2:I.x,y2:I.y,strokeWidth:1.5,fill:"none",strokeDasharray:"2,2",stroke:"red"})]}),j.jsxs("div",{style:{right:0,bottom:0,position:"absolute",color:"red",fontFamily:"sans-serif",fontSize:12,margin:4},children:["(",s.x.toFixed(2),",",s.y.toFixed(2),")",j.jsx("br",{}),"(",A.x.toFixed(2),",",A.y.toFixed(2),")",j.jsx("br",{}),"dist:"," ",Math.sqrt((A.x-s.x)**2+(A.y-s.y)**2).toFixed(2)]})]})]})},LYo=({label:t,onClose:e})=>j.jsx("div",{role:"dialog","aria-modal":"true","aria-label":"Object label",onClick:e,style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",padding:16,background:"rgba(0, 0, 0, 0.28)"},children:j.jsxs("div",{onClick:n=>{n.stopPropagation()},style:{width:"min(420px, 100%)",background:"#fff",borderRadius:10,boxShadow:"0 12px 32px rgba(0, 0, 0, 0.2)",padding:16},children:[j.jsx("div",{style:{fontWeight:600,marginBottom:8},children:"Object label"}),j.jsx("div",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word",marginBottom:16},children:t}),j.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:j.jsx("button",{type:"button",onClick:e,children:"Close"})})]})}),xLt=(t,e,n,o,i,r)=>{const s=t-n,a=e-o,A=i-n,c=r-o,l=s*A+a*c,g=A*A+c*c;let u=-1;g!==0&&(u=l/g);let h=0,d=0;u<0?(h=n,d=o):u>1?(h=i,d=r):(h=n+u*A,d=o+u*c);const _=t-h,m=e-d;return Math.sqrt(_*_+m*m)},OB=(t,e)=>{try{return QJn(t,e)}catch{return e}},HYo=({arrow:t,index:e,interactiveState:n})=>{const{realToScreen:o,onObjectClicked:i,setHoverTooltip:r}=n,[s,a]=ne.useState(!1),A=ne.useMemo(()=>gEe(t),[t]),c=ne.useMemo(()=>({shaftStart:_g(o,A.shaftStart),shaftEnd:_g(o,A.shaftEnd),heads:A.heads.map(y=>({tip:_g(o,y.tip),base:_g(o,y.base),leftWing:_g(o,y.leftWing),rightWing:_g(o,y.rightWing)}))}),[A,o]),l=Math.abs(o.a),g=12,u=A.shaftWidth*(l||1),h=g*.6,d=ne.useMemo(()=>opt(c.shaftStart,c.shaftEnd,{fontSize:g,strokeWidth:u,normalPadding:6,alongOffset:t.label?h:0}),[c,g,u,t.label,h]),_=ne.useMemo(()=>opt(c.shaftStart,c.shaftEnd,{fontSize:g,strokeWidth:u,normalPadding:12,alongOffset:t.inlineLabel?-h:0}),[c,g,u,t.inlineLabel,h]),m=t.color||Nf[e%Nf.length]||"black",p=s?OB(.2,m):m,I=[t.label,t.inlineLabel].filter(Boolean).join(`
5759
+ `,...i,style:o,children:[j.jsx("input",{type:"radio",checked:e,onChange:()=>{},readOnly:!0}),j.jsx("span",{style:{color:"#eee"},children:t})]})},dYo=({children:t,elements:e})=>{const n=aYo(),{isMouseOverContainer:o,setIsMouseOverContainer:i,selectedLayer:r,selectLayer:s,editModes:a,viewSettings:A,setEditMode:c,setIsShowingRatsNest:l,setIsShowingMultipleTracesLength:g,setIsShowingAutorouting:u,setIsShowingDrcErrors:h,setIsShowingCopperPours:d,setIsShowingCourtyards:_,setIsShowingPcbGroups:m,setIsShowingGroupAnchorOffsets:p,setIsShowingSolderMask:I,setIsShowingSilkscreen:f,setIsShowingFabricationNotes:C,setIsShowingPcbNotes:y,setPcbGroupViewMode:E,setHoveredErrorId:B,setFocusedErrorId:Q}=n0(Me=>({isMouseOverContainer:Me.is_mouse_over_container,setIsMouseOverContainer:Me.setIsMouseOverContainer,selectedLayer:Me.selected_layer,selectLayer:Me.selectLayer,editModes:{in_move_footprint_mode:Me.in_move_footprint_mode,in_draw_trace_mode:Me.in_draw_trace_mode},viewSettings:{is_showing_rats_nest:Me.is_showing_rats_nest,is_showing_multiple_traces_length:Me.is_showing_multiple_traces_length,is_showing_autorouting:Me.is_showing_autorouting,is_showing_drc_errors:Me.is_showing_drc_errors,is_showing_copper_pours:Me.is_showing_copper_pours,is_showing_courtyards:Me.is_showing_courtyards,is_showing_pcb_groups:Me.is_showing_pcb_groups,is_showing_group_anchor_offsets:Me.is_showing_group_anchor_offsets,is_showing_solder_mask:Me.is_showing_solder_mask,is_showing_silkscreen:Me.is_showing_silkscreen,is_showing_fabrication_notes:Me.is_showing_fabrication_notes,is_showing_pcb_notes:Me.is_showing_pcb_notes,pcb_group_view_mode:Me.pcb_group_view_mode},setEditMode:Me.setEditMode,setIsShowingRatsNest:Me.setIsShowingRatsNest,setIsShowingMultipleTracesLength:Me.setIsShowingMultipleTracesLength,setIsShowingAutorouting:Me.setIsShowingAutorouting,setIsShowingDrcErrors:Me.setIsShowingDrcErrors,setIsShowingCopperPours:Me.setIsShowingCopperPours,setIsShowingCourtyards:Me.setIsShowingCourtyards,setIsShowingPcbGroups:Me.setIsShowingPcbGroups,setIsShowingGroupAnchorOffsets:Me.setIsShowingGroupAnchorOffsets,setIsShowingSolderMask:Me.setIsShowingSolderMask,setIsShowingSilkscreen:Me.setIsShowingSilkscreen,setIsShowingFabricationNotes:Me.setIsShowingFabricationNotes,setIsShowingPcbNotes:Me.setIsShowingPcbNotes,setPcbGroupViewMode:Me.setPcbGroupViewMode,setHoveredErrorId:Me.setHoveredErrorId,setFocusedErrorId:Me.setFocusedErrorId})),[b,D]=ne.useState(!1),[R,w]=ne.useState(!1),[H,G]=ne.useState(!1),[K,U]=ne.useState(!1),[q,W]=ne.useState(!1);ne.useEffect(()=>{const Me=()=>U(!0),Fe=()=>U(!1),Ye=()=>W(!0),Ne=()=>W(!1);return window.addEventListener("arm-dimension-tool",Me),window.addEventListener("disarm-dimension-tool",Fe),window.addEventListener("arm-bounds-tool",Ye),window.addEventListener("disarm-bounds-tool",Ne),()=>{window.removeEventListener("arm-dimension-tool",Me),window.removeEventListener("disarm-dimension-tool",Fe),window.removeEventListener("arm-bounds-tool",Ye),window.removeEventListener("disarm-bounds-tool",Ne)}},[]);const ee=G8e(e??[]),re=ee,X=ne.useRef(!1),te=ne.useRef(null),se={1:ee[0]?()=>s(ee[0]):()=>{},2:ee[1]?()=>s(ee[1]):()=>{},3:ee[2]?()=>s(ee[2]):()=>{},4:ee[3]?()=>s(ee[3]):()=>{},5:ee[4]?()=>s(ee[4]):()=>{},6:ee[5]?()=>s(ee[5]):()=>{},7:ee[6]?()=>s(ee[6]):()=>{},8:ee[7]?()=>s(ee[7]):()=>{},9:ee[8]?()=>s(ee[8]):()=>{},0:ee[9]?()=>s(ee[9]):()=>{}};ZS("1",se[1],te),ZS("2",se[2],te),ZS("3",se[3],te),ZS("4",se[4],te),ZS("5",se[5],te),ZS("6",se[6],te),ZS("7",se[7],te),ZS("8",se[8],te),ZS("9",se[9],te),ZS("0",se[0],te),ne.useLayoutEffect(()=>{if(X.current)return;X.current=!0;const Me=Fe=>{if(te.current){const Ye=te.current.getBoundingClientRect();Fe.clientX>=Ye.left&&Fe.clientX<=Ye.right&&Fe.clientY>=Ye.top&&Fe.clientY<=Ye.bottom&&i(!0)}document.removeEventListener("mousemove",Me)};return document.addEventListener("mousemove",Me),()=>{document.removeEventListener("mousemove",Me)}},[i]);const le=ne.useCallback(()=>{i(!0)},[i]),ue=ne.useCallback(()=>{o||i(!0)},[o,i]),Ce=ne.useCallback(()=>{i(!1),w(!1),D(!1),G(!1)},[i]),Ee=ne.useCallback(()=>{w(!R)},[R]),Be=ne.useCallback(()=>{const Me=!H;G(Me),Me&&D(!1),Me||B(null)},[H,B]),_e=ne.useCallback(()=>{G(!1)},[]),ye=ne.useCallback(()=>{c(a.in_draw_trace_mode?"off":"draw_trace")},[a.in_draw_trace_mode,c]),pe=ne.useCallback(()=>{c(a.in_move_footprint_mode?"off":"move_footprint")},[a.in_move_footprint_mode,c]),we=ne.useCallback(()=>{l(!A.is_showing_rats_nest)},[A.is_showing_rats_nest,l]),Ge=ne.useCallback(()=>{U(!0),W(!1),window.dispatchEvent(new Event("arm-dimension-tool"))},[]),Ve=ne.useCallback(()=>{W(!0),U(!1),window.dispatchEvent(new Event("arm-bounds-tool"))},[]),Ie=ne.useCallback(()=>{const Me=!b;D(Me),Me&&G(!1)},[b]),qe=ne.useCallback(Me=>{Me.stopPropagation()},[]);return j.jsxs("div",{ref:te,style:{position:"relative",zIndex:"999 !important"},onMouseEnter:le,onMouseLeave:Ce,onMouseMove:ue,children:[t,j.jsxs("div",{style:{position:"absolute",bottom:4,right:8,pointerEvents:"none",color:"white",fontSize:11,opacity:o?.5:0,transition:"opacity 1s",transitionDelay:"2s",fontFamily:"sans-serif"},children:["@tscircuit/pcb-viewer@",sYo.version]}),j.jsxs("div",{"data-toolbar-overlay":!0,onTouchStart:Me=>Me.stopPropagation(),onTouchEnd:Me=>Me.stopPropagation(),onTouchMove:Me=>Me.stopPropagation(),onMouseDown:qe,onMouseMove:qe,onMouseUp:qe,onPointerDown:qe,onPointerMove:qe,onPointerUp:qe,onWheel:qe,style:{position:"absolute",opacity:n||o?1:0,top:16,left:16,right:n?16:"auto",transition:o?"opacity 100ms linear":"opacity 300ms linear",zIndex:Vl.toolbarOverlay,color:"red",display:"flex",flexWrap:"wrap",maxWidth:"550px",gap:4,fontSize:12,fontFamily:"sans-serif"},children:[j.jsxs(Ov,{isSmallScreen:n,onClick:Ee,onMouseLeave:()=>{R&&w(!1)},children:[j.jsxs("div",{children:["layer:"," ",j.jsx("span",{style:{marginLeft:2,fontWeight:500,color:hse[r]},children:r})]}),R&&j.jsx("div",{style:{marginTop:4,minWidth:120},children:re.map(Me=>j.jsx(uYo,{name:Me,selected:Me===r,onClick:()=>{s(Me)}},Me))})]}),j.jsx(gYo,{elements:e,isOpen:H,isSmallScreen:n,onToggle:Be,onClose:_e,setHoveredErrorId:B,setFocusedErrorId:Q}),j.jsx(Ov,{isSmallScreen:n,style:{},onClick:ye,children:j.jsxs("div",{children:[a.in_draw_trace_mode?"✖ ":"","Edit Traces"]})}),j.jsx(Ov,{isSmallScreen:n,style:{},onClick:pe,children:j.jsxs("div",{children:[a.in_move_footprint_mode?"✖ ":"","Move Components"]})}),j.jsx(Ov,{isSmallScreen:n,style:{},onClick:we,children:j.jsxs("div",{children:[A.is_showing_rats_nest?"✖ ":"","Rats Nest"]})}),j.jsx(Ov,{isSmallScreen:n,style:K?{backgroundColor:"#444"}:{},onClick:Ge,children:j.jsx("div",{children:"📏"})}),j.jsx(Ov,{isSmallScreen:n,style:q?{backgroundColor:"#444"}:{},onClick:Ve,children:j.jsx("div",{children:"Bounds"})}),j.jsx(Ov,{isSmallScreen:n,onClick:Ie,children:j.jsxs("div",{children:[j.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:["View",j.jsx("span",{style:{fontSize:"8px",transform:b?"rotate(180deg)":"rotate(0)",transition:"transform 0.1s ease",display:"inline-block"},children:"▼"})]}),b&&j.jsxs("div",{style:{marginTop:4,minWidth:120},children:[j.jsx(GB,{label:"Show All Trace Lengths",checked:A.is_showing_multiple_traces_length,onClick:()=>{g(!A.is_showing_multiple_traces_length)}}),j.jsx(GB,{label:"Show Autorouting Animation",checked:A.is_showing_autorouting,onClick:()=>{u(!A.is_showing_autorouting)}}),j.jsx(GB,{label:"Show DRC Errors",checked:A.is_showing_drc_errors,onClick:()=>{h(!A.is_showing_drc_errors)}}),j.jsx(GB,{label:"Show Copper Pours",checked:A.is_showing_copper_pours,onClick:()=>{d(!A.is_showing_copper_pours)}}),j.jsx(GB,{label:"Show Courtyards",checked:A.is_showing_courtyards,onClick:()=>{_(!A.is_showing_courtyards)}}),j.jsx(GB,{label:"Show Solder Mask",checked:A.is_showing_solder_mask,onClick:()=>{I(!A.is_showing_solder_mask)}}),j.jsx(GB,{label:"Show Silkscreen",checked:A.is_showing_silkscreen,onClick:()=>{f(!A.is_showing_silkscreen)}}),j.jsx(GB,{label:"Show Fabrication Notes",checked:A.is_showing_fabrication_notes,onClick:()=>{C(!A.is_showing_fabrication_notes)}}),j.jsx(GB,{label:"Show PCB Notes",checked:A.is_showing_pcb_notes,onClick:()=>{y(!A.is_showing_pcb_notes)}}),j.jsx(GB,{label:"Show Group Anchor Offsets",checked:A.is_showing_group_anchor_offsets,onClick:()=>{p(!A.is_showing_group_anchor_offsets)}}),j.jsx(GB,{label:"Show PCB Groups",checked:A.is_showing_pcb_groups,onClick:()=>{m(!A.is_showing_pcb_groups)}}),A.is_showing_pcb_groups&&j.jsxs("div",{style:{marginLeft:16},children:[j.jsx(ILt,{label:"Show All Groups",checked:A.pcb_group_view_mode==="all",onClick:()=>{E("all")}}),j.jsx(ILt,{label:"Show Named Groups",checked:A.pcb_group_view_mode==="named_only",onClick:()=>{E("named_only")}})]})]})]})})]})]})},hYo=({children:t,transform:e=dl(),elements:n=[]})=>{const[o,{width:i,height:r}]=rY(),s=ne.useRef(null);return ne.useEffect(()=>{const a=s.current;if(!a||!i||!r)return;a.width=i,a.height=r;const A=a.getContext("2d");if(!A)return;A.clearRect(0,0,i,r);const c=n.filter(g=>g.type==="pcb_component"),l=n.filter(g=>g.type==="pcb_manual_edit_conflict_warning");A.strokeStyle=Fo.board.drc_warning,A.lineWidth=2,l.forEach(g=>{const u=c.find(U=>U.pcb_component_id===g.pcb_component_id);if(!u)return;const{width:h,height:d,center:_}=u,m=_t(e,_),p=h*Math.abs(e.a),I=d*Math.abs(e.d),f=.1*Math.abs(e.a),C=p+f*2,y=I+f*2,E=m.x-C/2,B=m.y-y/2;A.beginPath(),A.rect(E,B,C,y),A.stroke();const Q="Manual Edit Conflict",b=4,D=Math.max(8,Math.min(12,10*Math.abs(e.a)));A.font=`${D}px sans-serif`;const w=A.measureText(Q).width+b*2,H=D+b*2,G=E+(C-w)/2,K=B+y+5;A.fillStyle="rgba(0, 0, 0, 0.7)",A.beginPath(),A.roundRect(G,K,w,H,3),A.fill(),A.fillStyle=Fo.board.drc_warning,A.textAlign="center",A.textBaseline="middle",A.fillText(Q,G+w/2,K+H/2)})},[n,e,i,r]),j.jsxs("div",{ref:o,style:{position:"relative",width:"100%",height:"100%"},children:[t,j.jsx("canvas",{ref:s,style:{position:"absolute",top:0,left:0,pointerEvents:"none",zIndex:Vl.warnings}})]})},_Yo=t=>{const{transform:e,elements:n}=t,{hoveredErrorId:o,focusedErrorId:i,isShowingCopperPours:r,selectedLayer:s}=n0(y=>({hoveredErrorId:y.hovered_error_id,focusedErrorId:y.focused_error_id,isShowingCopperPours:y.is_showing_copper_pours,selectedLayer:y.selected_layer})),a=i??o,A=ne.useMemo(()=>r?n:n.filter(y=>y.type!=="pcb_copper_pour"),[n,r]),[c,l]=ne.useMemo(()=>{const y=A.flatMap(B=>iKo(B,t.elements)),E=OFt(t.elements);return[y,E]},[A,t.elements]),[g,u]=ne.useState({drawingObjectIdsWithMouseOver:new Set,primitiveIdsInMousedOverNet:[]}),[h,d]=ne.useState([]),_=ne.useRef(e??null),m=ne.useRef(null),p=ne.useMemo(()=>KFt(n),[n]),I=ne.useMemo(()=>{if(!a)return[];const E=n.filter(B=>B.type.includes("error")).find((B,Q)=>dk(B,Q)===a);return E?hKo(E):[]},[a,n]);ne.useEffect(()=>{e&&(_.current=e)},[e]),ne.useEffect(()=>()=>{JFt(m.current)},[]),ne.useEffect(()=>{if(!t.width||!t.height||!t.setTransform||!i)return;const y=VFt(n,i);if(!y)return;const E=uKo({error:y,indexes:p});if(!E)return;const B=_.current??e;if(!B)return;const Q=dKo({bounds:E,width:t.width,height:t.height});JFt(m.current),pKo({startTransform:B,endTransform:Q,durationMs:420,setAnimationFrameId:b=>{m.current=b},onUpdate:b=>{_.current=b,t.setTransform?.(b)}})},[i,n,p,t.height,t.setTransform,t.width]);const f=ne.useMemo(()=>{const y=[...g.primitiveIdsInMousedOverNet,...I];return rKo({primitivesWithoutInteractionMetadata:c,drawingObjectIdsWithMouseOver:g.drawingObjectIdsWithMouseOver,primitiveIdsInMousedOverNet:y})},[c,g,I]),C=ne.useCallback(y=>{const E=[];for(const b of y)if(b._element){const D=l.getNetConnectedToId("pcb_port_id"in b._element?b._element?.pcb_port_id:"pcb_trace_id"in b._element?b._element?.pcb_trace_id:"");E.push(...l.getIdsConnectedToNet(D))}const B=new Set(y.map(b=>b._pcb_drawing_object_id));u({drawingObjectIdsWithMouseOver:B,primitiveIdsInMousedOverNet:E});const Q=y.map(b=>b._parent_pcb_component?.type==="pcb_component"&&b._parent_pcb_component.pcb_component_id?b._parent_pcb_component.pcb_component_id:b._element?.type==="pcb_component"&&b._element.pcb_component_id?b._element.pcb_component_id:null).filter(b=>!!b);d(Array.from(new Set(Q)))},[l]);return j.jsx(oYo,{elements:A,transform:e,primitives:c,selectedLayer:s,onMouseHoverOverPrimitives:C,children:j.jsx(TUo,{disabled:!t.allowEditing,transform:e,soup:n,cancelPanDrag:t.cancelPanDrag,onCreateEditEvent:t.onCreateEditEvent,onModifyEditEvent:t.onModifyEditEvent,children:j.jsx(HUo,{disabled:!t.allowEditing,transform:e,soup:n,cancelPanDrag:t.cancelPanDrag,onCreateEditEvent:t.onCreateEditEvent,onModifyEditEvent:t.onModifyEditEvent,children:j.jsx(NUo,{transform:e,focusOnHover:t.focusOnHover,primitives:c,onBoundsSelected:t.onBoundsSelected,cancelPanDrag:t.cancelPanDrag,children:j.jsx(dYo,{elements:n,children:j.jsx(OUo,{transform:e,elements:n,children:j.jsx(rYo,{transform:e,soup:n,children:j.jsx(iYo,{transform:e,elements:n,hoveredComponentIds:h,children:j.jsx(BUo,{transform:e,debugGraphics:t.debugGraphics,children:j.jsx(hYo,{transform:e,elements:n,children:j.jsx(fUo,{transform:e,primitives:f,elements:A,width:t.width,height:t.height,grid:t.grid})})})})})})})})})})})},fse=t=>Number.isFinite(t)?t.toFixed(4):"NaN",mYo=t=>{let e=5381;for(let n=0;n<t.length;n++)e=(e<<5)+e+t.charCodeAt(n);return Math.abs(e)},pYo=t=>{if(!t?.length)return"0";const e=[];for(const i of t){if(!i?.type?.startsWith("pcb_"))continue;const r=SOo(i),s=L8e([i]),a=[fse(s.minX),fse(s.minY),fse(s.maxX),fse(s.maxY)].join(",");let A=`${r}:${a}`;if(i.type==="pcb_trace"){const c=(i.route??[]).length;A+=`:${c}`}e.push(A)}if(e.length===0)return"0";e.sort();const n=e.join(","),o=mYo(n);return`${e.length}_${o.toString(36)}`},IYo=t=>{if(!t)return"empty";const e=t.find(o=>o.type==="pcb_board");if(!e)return"no-board";const n=o=>Math.round(o*1e3)/1e3;return e.outline?e.outline.map(o=>`${n(o.x)}_${n(o.y)}`).join(","):`${n(e.width)}_${n(e.height)}`},fYo=Ti(Ji(400,300),gg(40,-40)),fLt=({circuitJson:t,debugGraphics:e,height:n=600,initialState:o,allowEditing:i=!0,editEvents:r,onEditEventsChanged:s,onBoundsSelected:a,focusOnHover:A=!1,clickToInteractEnabled:c=!1,disablePcbGroups:l=!1})=>{const[g,u]=ne.useState(!c),[h,d]=rY(),[_,m]=ne.useState(fYo),p=ne.useCallback(q=>{const W=q.target;return W instanceof Element?!W.closest("[data-toolbar-overlay]"):!0},[]),{ref:I,setTransform:f,cancelDrag:C}=WOo({transform:_,onSetTransform:m,enabled:g,shouldDrag:p});let[y,E]=ne.useState([]);y=r??y;const B=ne.useRef(!1),Q=ne.useRef(null),b=ne.useMemo(()=>pYo(t),[t]),D=IYo(t),R=()=>{const q=d?.width>0?d:{width:500,height:500},{center:W,width:ee,height:re}=H.some(se=>se.type.startsWith("pcb_"))?vOo(H.filter(se=>se.type.startsWith("pcb_"))):{center:{x:0,y:0},width:.001,height:.001},X=Math.min((q.width??0)/ee,(q.height??0)/re,100)*.75,te=Ti(Ji((q.width??0)/2,(q.height??0)/2),gg(X,-X,0,0),Ji(-W.x,-W.y));f(te)};ne.useEffect(()=>{d?.width&&t&&t.length!==0&&(B.current||(R(),B.current=!0))},[t,d]),ne.useEffect(()=>{B.current===!0&&R()},[D]);const w=ne.useMemo(()=>t?.filter(q=>q.type.startsWith("pcb_")||q.type.startsWith("source_"))??[],[b]),H=ne.useMemo(()=>slo({circuitJson:w,editEvents:y}),[w,y]),G=q=>{E([...y,q]),s?.([...y,q])},K=q=>{const W=y.map(ee=>ee.edit_event_id===q.edit_event_id?{...ee,...q}:ee);E(W),s?.(W)},U=ne.useMemo(()=>({...o,...l&&{is_showing_pcb_groups:!1}}),[o,l]);return j.jsxs("div",{ref:I,style:{position:"relative"},onContextMenu:q=>q.preventDefault(),children:[j.jsx("div",{ref:h,children:j.jsxs(TOo,{initialState:U,disablePcbGroups:l,children:[j.jsx(_Yo,{transform:_,setTransform:f,height:n,width:d.width,allowEditing:i,focusOnHover:A,onBoundsSelected:a,cancelPanDrag:C,onCreateEditEvent:G,onModifyEditEvent:K,grid:{spacing:1,view_window:{left:0,right:d.width||500,top:n,bottom:0}},elements:H,debugGraphics:e},d.width),j.jsx(FOo,{})]})}),c&&!g&&j.jsx("div",{onClick:()=>{u(!0),R()},onTouchStart:q=>{const W=q.touches[0];Q.current={x:W.clientX,y:W.clientY}},onTouchEnd:q=>{const W=q.changedTouches[0],ee=Q.current;if(!ee)return;const re=Math.abs(W.clientX-ee.x),X=Math.abs(W.clientY-ee.y);re<10&&X<10&&(q.preventDefault(),u(!0),R()),Q.current=null},style:{position:"absolute",inset:0,cursor:"pointer",zIndex:Vl.clickToInteractOverlay,display:"flex",alignItems:"center",justifyContent:"center",touchAction:"pan-x pan-y pinch-zoom"},children:j.jsx("div",{style:{backgroundColor:"rgba(0, 0, 0, 0.8)",color:"white",padding:"12px 24px",borderRadius:"8px",fontSize:"16px",pointerEvents:"none"},children:typeof window<"u"&&("ontouchstart"in window||navigator.maxTouchPoints>0)?"Touch to Interact":"Click to Interact"})})]})};const CYo=({circuitJson:t,containerClassName:e,...n})=>{const o=ne.useRef(null),[i,r]=ne.useState(620);return ne.useLayoutEffect(()=>{const s=()=>{if(o.current){const A=o.current.clientHeight,c=window.innerHeight;r(Math.min(Math.max(A,620),c))}};s();const a=new ResizeObserver(s);return o.current&&a.observe(o.current),window.addEventListener("resize",s),()=>{a.disconnect(),window.removeEventListener("resize",s)}},[]),j.jsx("div",{ref:o,className:e||"rf-w-full rf-h-full",children:j.jsx(fLt,{...n,circuitJson:t,height:i})})},yYo='*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*! tailwindcss v3.4.19 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{color:inherit;font-family:inherit;font-feature-settings:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}:root{--radius:0.5rem}.rf-pointer-events-none{pointer-events:none}.rf-invisible{visibility:hidden}.rf-fixed{position:fixed}.rf-absolute{position:absolute}.rf-relative{position:relative}.rf-inset-0{inset:0}.-rf-left-2{left:-.5rem}.-rf-right-10{right:-2.5rem}.-rf-right-2{right:-.5rem}.-rf-right-4{right:-1rem}.-rf-right-6{right:-1.5rem}.-rf-right-7{right:-1.75rem}.-rf-right-8{right:-2rem}.-rf-right-9{right:-2.25rem}.rf-bottom-full{bottom:100%}.rf-left-0{left:0}.rf-left-1{left:.25rem}.rf-left-1\\/2{left:50%}.rf-left-2{left:.5rem}.rf-left-\\[50\\%\\]{left:50%}.rf-right-0{right:0}.rf-right-1{right:.25rem}.rf-right-4{right:1rem}.rf-right-\\[4px\\]{right:4px}.rf-top-0{top:0}.rf-top-1{top:.25rem}.rf-top-2{top:.5rem}.rf-top-2\\.5{top:.625rem}.rf-top-\\[50\\%\\]{top:50%}.rf-top-\\[6px\\]{top:6px}.\\!rf-z-\\[101\\]{z-index:101!important}.\\!rf-z-\\[200\\]{z-index:200!important}.rf-z-10{z-index:10}.rf-z-50{z-index:50}.rf-z-\\[100\\]{z-index:100}.rf-z-\\[101\\]{z-index:101}.rf-z-\\[102\\]{z-index:102}.rf-order-1{order:1}.rf-order-2{order:2}.rf-order-3{order:3}.rf-m-0{margin:0}.rf-m-1{margin:.25rem}.rf-m-6{margin:1.5rem}.-rf-mx-1,.rf--mx-1{margin-left:-.25rem;margin-right:-.25rem}.rf-mx-1{margin-left:.25rem;margin-right:.25rem}.rf-mx-2{margin-left:.5rem;margin-right:.5rem}.rf-mx-4{margin-left:1rem;margin-right:1rem}.rf-mx-auto{margin-left:auto;margin-right:auto}.rf-my-1{margin-bottom:.25rem;margin-top:.25rem}.rf-my-12{margin-bottom:3rem;margin-top:3rem}.rf-my-4{margin-bottom:1rem;margin-top:1rem}.rf-my-auto{margin-bottom:auto;margin-top:auto}.rf-mb-0{margin-bottom:0}.rf-mb-0\\.5{margin-bottom:.125rem}.rf-mb-1{margin-bottom:.25rem}.rf-mb-12{margin-bottom:3rem}.rf-mb-2{margin-bottom:.5rem}.rf-mb-3{margin-bottom:.75rem}.rf-mb-4{margin-bottom:1rem}.rf-mb-6{margin-bottom:1.5rem}.rf-mb-8{margin-bottom:2rem}.rf-ml-1{margin-left:.25rem}.rf-ml-2{margin-left:.5rem}.rf-ml-6{margin-left:1.5rem}.rf-ml-auto{margin-left:auto}.rf-mr-1{margin-right:.25rem}.rf-mr-2{margin-right:.5rem}.rf-mr-4{margin-right:1rem}.rf-mt-0{margin-top:0}.rf-mt-0\\.5{margin-top:.125rem}.rf-mt-1{margin-top:.25rem}.rf-mt-2{margin-top:.5rem}.rf-mt-3{margin-top:.75rem}.rf-mt-4{margin-top:1rem}.rf-mt-5{margin-top:1.25rem}.rf-mt-auto{margin-top:auto}.rf-block{display:block}.rf-inline-block{display:inline-block}.rf-inline{display:inline}.rf-flex{display:flex}.rf-inline-flex{display:inline-flex}.rf-grid{display:grid}.rf-hidden{display:none}.rf-aspect-square{aspect-ratio:1/1}.rf-aspect-video{aspect-ratio:16/9}.rf-size-14{height:3.5rem;width:3.5rem}.rf-size-2{height:.5rem;width:.5rem}.rf-size-3{height:.75rem;width:.75rem}.rf-size-4{height:1rem;width:1rem}.\\!rf-h-2{height:.5rem!important}.\\!rf-h-2\\.5{height:.625rem!important}.\\!rf-h-3{height:.75rem!important}.\\!rf-h-full{height:100%!important}.rf-h-1{height:.25rem}.rf-h-10{height:2.5rem}.rf-h-12{height:3rem}.rf-h-2{height:.5rem}.rf-h-2\\.5{height:.625rem}.rf-h-20{height:5rem}.rf-h-24{height:6rem}.rf-h-3{height:.75rem}.rf-h-3\\.5{height:.875rem}.rf-h-4{height:1rem}.rf-h-5{height:1.25rem}.rf-h-6{height:1.5rem}.rf-h-60{height:15rem}.rf-h-64{height:16rem}.rf-h-7{height:1.75rem}.rf-h-8{height:2rem}.rf-h-9{height:2.25rem}.rf-h-\\[400px\\]{height:400px}.rf-h-\\[calc\\(100vh-52px\\)\\]{height:calc(100vh - 52px)}.rf-h-\\[calc\\(100vh-60px\\)\\]{height:calc(100vh - 60px)}.rf-h-\\[var\\(--radix-select-trigger-height\\)\\]{height:var(--radix-select-trigger-height)}.rf-h-auto{height:auto}.rf-h-fit{height:-moz-fit-content;height:fit-content}.rf-h-full{height:100%}.rf-h-px{height:1px}.rf-h-screen{height:100vh}.\\!rf-max-h-\\[40vh\\]{max-height:40vh!important}.\\!rf-max-h-\\[80vh\\]{max-height:80vh!important}.rf-max-h-16{max-height:4rem}.rf-max-h-20{max-height:5rem}.rf-max-h-24{max-height:6rem}.rf-max-h-28{max-height:7rem}.rf-max-h-32{max-height:8rem}.rf-max-h-96{max-height:24rem}.rf-max-h-\\[120px\\]{max-height:120px}.rf-max-h-\\[150px\\]{max-height:150px}.rf-max-h-\\[200px\\]{max-height:200px}.rf-max-h-\\[300px\\]{max-height:300px}.rf-max-h-\\[90vh\\]{max-height:90vh}.rf-max-h-full{max-height:100%}.rf-max-h-none{max-height:none}.rf-min-h-0{min-height:0}.rf-min-h-\\[100px\\]{min-height:100px}.rf-min-h-\\[200px\\]{min-height:200px}.rf-min-h-\\[300px\\]{min-height:300px}.rf-min-h-\\[620px\\]{min-height:620px}.rf-min-h-\\[calc\\(100vh-240px\\)\\]{min-height:calc(100vh - 240px)}.rf-min-h-full{min-height:100%}.\\!rf-w-2{width:.5rem!important}.\\!rf-w-2\\.5{width:.625rem!important}.\\!rf-w-\\[95vw\\]{width:95vw!important}.rf-w-1{width:.25rem}.rf-w-10{width:2.5rem}.rf-w-11{width:2.75rem}.rf-w-11\\/12{width:91.666667%}.rf-w-12{width:3rem}.rf-w-16{width:4rem}.rf-w-2{width:.5rem}.rf-w-2\\.5{width:.625rem}.rf-w-20{width:5rem}.rf-w-24{width:6rem}.rf-w-28{width:7rem}.rf-w-3{width:.75rem}.rf-w-3\\.5{width:.875rem}.rf-w-32{width:8rem}.rf-w-4{width:1rem}.rf-w-40{width:10rem}.rf-w-48{width:12rem}.rf-w-5{width:1.25rem}.rf-w-6{width:1.5rem}.rf-w-64{width:16rem}.rf-w-72{width:18rem}.rf-w-8{width:2rem}.rf-w-80{width:20rem}.rf-w-9{width:2.25rem}.rf-w-96{width:24rem}.rf-w-fit{width:-moz-fit-content;width:fit-content}.rf-w-full{width:100%}.rf-w-screen{width:100vw}.rf-min-w-0{min-width:0}.rf-min-w-10{min-width:2.5rem}.rf-min-w-16{min-width:4rem}.rf-min-w-32{min-width:8rem}.rf-min-w-80{min-width:20rem}.rf-min-w-96{min-width:24rem}.rf-min-w-\\[12px\\]{min-width:12px}.rf-min-w-\\[148px\\]{min-width:148px}.rf-min-w-\\[600px\\]{min-width:600px}.rf-min-w-\\[8rem\\]{min-width:8rem}.rf-min-w-\\[var\\(--radix-select-trigger-width\\)\\]{min-width:var(--radix-select-trigger-width)}.\\!rf-max-w-\\[95vw\\]{max-width:95vw!important}.rf-max-w-2xl{max-width:42rem}.rf-max-w-3xl{max-width:48rem}.rf-max-w-4xl{max-width:56rem}.rf-max-w-5xl{max-width:64rem}.rf-max-w-64{max-width:16rem}.rf-max-w-96{max-width:24rem}.rf-max-w-\\[1000px\\]{max-width:1000px}.rf-max-w-\\[150px\\]{max-width:150px}.rf-max-w-\\[200px\\]{max-width:200px}.rf-max-w-\\[320px\\]{max-width:320px}.rf-max-w-\\[40\\%\\]{max-width:40%}.rf-max-w-\\[600px\\]{max-width:600px}.rf-max-w-full{max-width:100%}.rf-max-w-lg{max-width:32rem}.rf-max-w-md{max-width:28rem}.rf-max-w-none{max-width:none}.rf-max-w-xl{max-width:36rem}.rf-max-w-xs{max-width:20rem}.rf-flex-1{flex:1 1 0%}.rf-flex-shrink-0,.rf-shrink-0{flex-shrink:0}.rf-flex-grow{flex-grow:1}.rf-table-auto{table-layout:auto}.rf-origin-\\[--radix-popover-content-transform-origin\\]{transform-origin:var(--radix-popover-content-transform-origin)}.-rf-translate-x-1{--tw-translate-x:-0.25rem}.-rf-translate-x-1,.-rf-translate-x-1\\/2{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))}.-rf-translate-x-1\\/2{--tw-translate-x:-50%}.-rf-translate-y-1{--tw-translate-y:-0.25rem}.-rf-translate-y-1,.rf--translate-x-1{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))}.rf--translate-x-1{--tw-translate-x:-0.25rem}.rf--translate-x-1\\/2{--tw-translate-x:-50%}.rf--translate-x-1\\/2,.rf--translate-y-1{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))}.rf--translate-y-1{--tw-translate-y:-0.25rem}.rf-translate-x-\\[-50\\%\\]{--tw-translate-x:-50%}.rf-translate-x-\\[-50\\%\\],.rf-translate-y-\\[-50\\%\\]{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))}.rf-translate-y-\\[-50\\%\\]{--tw-translate-y:-50%}.-rf-rotate-90{--tw-rotate:-90deg}.-rf-rotate-90,.rf-rotate-90{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))}.rf-rotate-90{--tw-rotate:90deg}.rf-transform{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))}@keyframes rf-pulse{50%{opacity:.5}}.rf-animate-pulse{animation:rf-pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes rf-spin{to{transform:rotate(1turn)}}.rf-animate-spin{animation:rf-spin 1s linear infinite}.rf-cursor-default{cursor:default}.rf-cursor-not-allowed{cursor:not-allowed}.rf-cursor-pointer{cursor:pointer}.rf-select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.rf-grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.rf-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.rf-grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.rf-flex-row{flex-direction:row}.rf-flex-col{flex-direction:column}.rf-flex-col-reverse{flex-direction:column-reverse}.rf-flex-wrap{flex-wrap:wrap}.rf-place-content-center{place-content:center}.rf-place-items-center{place-items:center}.rf-items-start{align-items:flex-start}.rf-items-end{align-items:flex-end}.rf-items-center{align-items:center}.rf-items-baseline{align-items:baseline}.rf-items-stretch{align-items:stretch}.rf-justify-end{justify-content:flex-end}.rf-justify-center{justify-content:center}.rf-justify-between{justify-content:space-between}.rf-gap-0{gap:0}.rf-gap-1{gap:.25rem}.rf-gap-1\\.5{gap:.375rem}.rf-gap-2{gap:.5rem}.rf-gap-3{gap:.75rem}.rf-gap-4{gap:1rem}.rf-gap-5{gap:1.25rem}.rf-gap-6{gap:1.5rem}.rf-gap-8{gap:2rem}.rf-space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.5rem*var(--tw-space-x-reverse))}.rf-space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.25rem*var(--tw-space-y-reverse));margin-top:calc(.25rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.5rem*var(--tw-space-y-reverse));margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.75rem*var(--tw-space-y-reverse));margin-top:calc(.75rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1.5rem*var(--tw-space-y-reverse));margin-top:calc(1.5rem*(1 - var(--tw-space-y-reverse)))}.rf-divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-bottom-width:calc(1px*var(--tw-divide-y-reverse));border-top-width:calc(1px*(1 - var(--tw-divide-y-reverse)))}.rf-overflow-auto{overflow:auto}.rf-overflow-hidden{overflow:hidden}.rf-overflow-visible{overflow:visible}.rf-overflow-x-auto{overflow-x:auto}.\\!rf-overflow-y-auto{overflow-y:auto!important}.rf-overflow-y-auto{overflow-y:auto}.rf-overflow-x-hidden{overflow-x:hidden}.rf-overflow-x-clip{overflow-x:clip}.rf-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rf-whitespace-normal{white-space:normal}.rf-whitespace-nowrap{white-space:nowrap}.rf-whitespace-pre-wrap{white-space:pre-wrap}.rf-text-nowrap{text-wrap:nowrap}.rf-break-words{overflow-wrap:break-word}.rf-break-all{word-break:break-all}.rf-rounded{border-radius:.25rem}.rf-rounded-2xl{border-radius:1rem}.rf-rounded-full{border-radius:9999px}.rf-rounded-lg{border-radius:var(--radius)}.rf-rounded-md{border-radius:calc(var(--radius) - 2px)}.rf-rounded-none{border-radius:0}.rf-rounded-sm{border-radius:calc(var(--radius) - 4px)}.rf-rounded-xl{border-radius:.75rem}.rf-border{border-width:1px}.rf-border-0{border-width:0}.rf-border-2{border-width:2px}.rf-border-b{border-bottom-width:1px}.rf-border-l-2{border-left-width:2px}.rf-border-l-4{border-left-width:4px}.rf-border-r{border-right-width:1px}.rf-border-t{border-top-width:1px}.rf-border-none{border-style:none}.rf-border-blue-200{--tw-border-opacity:1;border-color:rgb(191 219 254/var(--tw-border-opacity,1))}.rf-border-blue-300{--tw-border-opacity:1;border-color:rgb(147 197 253/var(--tw-border-opacity,1))}.rf-border-blue-400{--tw-border-opacity:1;border-color:rgb(96 165 250/var(--tw-border-opacity,1))}.rf-border-blue-500{--tw-border-opacity:1;border-color:rgb(59 130 246/var(--tw-border-opacity,1))}.rf-border-blue-600{--tw-border-opacity:1;border-color:rgb(37 99 235/var(--tw-border-opacity,1))}.rf-border-border{border-color:hsl(var(--border))}.rf-border-emerald-500{--tw-border-opacity:1;border-color:rgb(16 185 129/var(--tw-border-opacity,1))}.rf-border-gray-100{--tw-border-opacity:1;border-color:rgb(243 244 246/var(--tw-border-opacity,1))}.rf-border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity,1))}.rf-border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity,1))}.rf-border-green-200{--tw-border-opacity:1;border-color:rgb(187 247 208/var(--tw-border-opacity,1))}.rf-border-green-400{--tw-border-opacity:1;border-color:rgb(74 222 128/var(--tw-border-opacity,1))}.rf-border-input{border-color:hsl(var(--input))}.rf-border-neutral-200{--tw-border-opacity:1;border-color:rgb(229 229 229/var(--tw-border-opacity,1))}.rf-border-orange-100{--tw-border-opacity:1;border-color:rgb(255 237 213/var(--tw-border-opacity,1))}.rf-border-orange-200{--tw-border-opacity:1;border-color:rgb(254 215 170/var(--tw-border-opacity,1))}.rf-border-orange-500{--tw-border-opacity:1;border-color:rgb(249 115 22/var(--tw-border-opacity,1))}.rf-border-primary{border-color:hsl(var(--primary))}.rf-border-red-100{--tw-border-opacity:1;border-color:rgb(254 226 226/var(--tw-border-opacity,1))}.rf-border-red-200{--tw-border-opacity:1;border-color:rgb(254 202 202/var(--tw-border-opacity,1))}.rf-border-red-300{--tw-border-opacity:1;border-color:rgb(252 165 165/var(--tw-border-opacity,1))}.rf-border-red-400{--tw-border-opacity:1;border-color:rgb(248 113 113/var(--tw-border-opacity,1))}.rf-border-red-500{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity,1))}.rf-border-red-600{--tw-border-opacity:1;border-color:rgb(220 38 38/var(--tw-border-opacity,1))}.rf-border-red-700{--tw-border-opacity:1;border-color:rgb(185 28 28/var(--tw-border-opacity,1))}.rf-border-red-800{--tw-border-opacity:1;border-color:rgb(153 27 27/var(--tw-border-opacity,1))}.rf-border-slate-200{--tw-border-opacity:1;border-color:rgb(226 232 240/var(--tw-border-opacity,1))}.rf-border-slate-700{--tw-border-opacity:1;border-color:rgb(51 65 85/var(--tw-border-opacity,1))}.rf-border-slate-800{--tw-border-opacity:1;border-color:rgb(30 41 59/var(--tw-border-opacity,1))}.rf-border-slate-800\\/60{border-color:rgba(30,41,59,.6)}.rf-border-yellow-200{--tw-border-opacity:1;border-color:rgb(254 240 138/var(--tw-border-opacity,1))}.rf-border-zinc-200{--tw-border-opacity:1;border-color:rgb(228 228 231/var(--tw-border-opacity,1))}.rf-border-zinc-900{--tw-border-opacity:1;border-color:rgb(24 24 27/var(--tw-border-opacity,1))}.rf-border-l-blue-500{--tw-border-opacity:1;border-left-color:rgb(59 130 246/var(--tw-border-opacity,1))}.rf-border-t-blue-600{--tw-border-opacity:1;border-top-color:rgb(37 99 235/var(--tw-border-opacity,1))}.rf-bg-amber-50{--tw-bg-opacity:1;background-color:rgb(255 251 235/var(--tw-bg-opacity,1))}.rf-bg-amber-50\\/30{background-color:rgba(255,251,235,.3)}.rf-bg-background{background-color:hsl(var(--background))}.rf-bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity,1))}.rf-bg-black\\/80{background-color:rgba(0,0,0,.8)}.rf-bg-blue-100{--tw-bg-opacity:1;background-color:rgb(219 234 254/var(--tw-bg-opacity,1))}.rf-bg-blue-50{--tw-bg-opacity:1;background-color:rgb(239 246 255/var(--tw-bg-opacity,1))}.rf-bg-blue-500{--tw-bg-opacity:1;background-color:rgb(59 130 246/var(--tw-bg-opacity,1))}.rf-bg-blue-600{--tw-bg-opacity:1;background-color:rgb(37 99 235/var(--tw-bg-opacity,1))}.rf-bg-emerald-500{--tw-bg-opacity:1;background-color:rgb(16 185 129/var(--tw-bg-opacity,1))}.rf-bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.rf-bg-gray-200{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity,1))}.rf-bg-gray-300{--tw-bg-opacity:1;background-color:rgb(209 213 219/var(--tw-bg-opacity,1))}.rf-bg-gray-400{--tw-bg-opacity:1;background-color:rgb(156 163 175/var(--tw-bg-opacity,1))}.rf-bg-gray-50{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity,1))}.rf-bg-gray-500{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity,1))}.rf-bg-gray-700{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.rf-bg-gray-800{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.rf-bg-gray-900{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity,1))}.rf-bg-green-100{--tw-bg-opacity:1;background-color:rgb(220 252 231/var(--tw-bg-opacity,1))}.rf-bg-green-300{--tw-bg-opacity:1;background-color:rgb(134 239 172/var(--tw-bg-opacity,1))}.rf-bg-green-50{--tw-bg-opacity:1;background-color:rgb(240 253 244/var(--tw-bg-opacity,1))}.rf-bg-green-600{--tw-bg-opacity:1;background-color:rgb(22 163 74/var(--tw-bg-opacity,1))}.rf-bg-muted{background-color:hsl(var(--muted))}.rf-bg-neutral-100{--tw-bg-opacity:1;background-color:rgb(245 245 245/var(--tw-bg-opacity,1))}.rf-bg-neutral-50{--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.rf-bg-neutral-800{--tw-bg-opacity:1;background-color:rgb(38 38 38/var(--tw-bg-opacity,1))}.rf-bg-neutral-900{--tw-bg-opacity:1;background-color:rgb(23 23 23/var(--tw-bg-opacity,1))}.rf-bg-orange-100{--tw-bg-opacity:1;background-color:rgb(255 237 213/var(--tw-bg-opacity,1))}.rf-bg-orange-400{--tw-bg-opacity:1;background-color:rgb(251 146 60/var(--tw-bg-opacity,1))}.rf-bg-orange-50{--tw-bg-opacity:1;background-color:rgb(255 247 237/var(--tw-bg-opacity,1))}.rf-bg-orange-50\\/50{background-color:rgba(255,247,237,.5)}.rf-bg-orange-500{--tw-bg-opacity:1;background-color:rgb(249 115 22/var(--tw-bg-opacity,1))}.rf-bg-popover{background-color:hsl(var(--popover))}.rf-bg-purple-500{--tw-bg-opacity:1;background-color:rgb(168 85 247/var(--tw-bg-opacity,1))}.rf-bg-red-100{--tw-bg-opacity:1;background-color:rgb(254 226 226/var(--tw-bg-opacity,1))}.rf-bg-red-50{--tw-bg-opacity:1;background-color:rgb(254 242 242/var(--tw-bg-opacity,1))}.rf-bg-red-50\\/50{background-color:rgba(254,242,242,.5)}.rf-bg-red-500{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity,1))}.rf-bg-red-600{--tw-bg-opacity:1;background-color:rgb(220 38 38/var(--tw-bg-opacity,1))}.rf-bg-red-900{--tw-bg-opacity:1;background-color:rgb(127 29 29/var(--tw-bg-opacity,1))}.rf-bg-red-950{--tw-bg-opacity:1;background-color:rgb(69 10 10/var(--tw-bg-opacity,1))}.rf-bg-slate-50{--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity,1))}.rf-bg-slate-800{--tw-bg-opacity:1;background-color:rgb(30 41 59/var(--tw-bg-opacity,1))}.rf-bg-slate-900{--tw-bg-opacity:1;background-color:rgb(15 23 42/var(--tw-bg-opacity,1))}.rf-bg-transparent{background-color:transparent}.rf-bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.rf-bg-yellow-100{--tw-bg-opacity:1;background-color:rgb(254 249 195/var(--tw-bg-opacity,1))}.rf-bg-yellow-50{--tw-bg-opacity:1;background-color:rgb(254 252 232/var(--tw-bg-opacity,1))}.rf-bg-zinc-100{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.rf-bg-zinc-200{--tw-bg-opacity:1;background-color:rgb(228 228 231/var(--tw-bg-opacity,1))}.rf-bg-zinc-50{--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.rf-bg-zinc-800{--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.rf-bg-zinc-900{--tw-bg-opacity:1;background-color:rgb(24 24 27/var(--tw-bg-opacity,1))}.rf-bg-zinc-950{--tw-bg-opacity:1;background-color:rgb(9 9 11/var(--tw-bg-opacity,1))}.rf-bg-opacity-50{--tw-bg-opacity:0.5}.rf-bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.rf-from-blue-500{--tw-gradient-from:#3b82f6 var(--tw-gradient-from-position);--tw-gradient-to:rgba(59,130,246,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.rf-from-emerald-500{--tw-gradient-from:#10b981 var(--tw-gradient-from-position);--tw-gradient-to:rgba(16,185,129,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.rf-from-green-500{--tw-gradient-from:#22c55e var(--tw-gradient-from-position);--tw-gradient-to:rgba(34,197,94,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.rf-from-red-500{--tw-gradient-from:#ef4444 var(--tw-gradient-from-position);--tw-gradient-to:rgba(239,68,68,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.rf-to-blue-600{--tw-gradient-to:#2563eb var(--tw-gradient-to-position)}.rf-to-emerald-600{--tw-gradient-to:#059669 var(--tw-gradient-to-position)}.rf-to-green-600{--tw-gradient-to:#16a34a var(--tw-gradient-to-position)}.rf-to-red-600{--tw-gradient-to:#dc2626 var(--tw-gradient-to-position)}.rf-fill-amber-500{fill:#f59e0b}.rf-fill-current{fill:currentColor}.rf-object-contain{-o-object-fit:contain;object-fit:contain}.rf-object-cover{-o-object-fit:cover;object-fit:cover}.\\!rf-p-0{padding:0!important}.rf-p-0{padding:0}.rf-p-1{padding:.25rem}.rf-p-2{padding:.5rem}.rf-p-3{padding:.75rem}.rf-p-4{padding:1rem}.rf-p-5{padding:1.25rem}.rf-p-6{padding:1.5rem}.rf-p-8{padding:2rem}.rf-px-1{padding-left:.25rem;padding-right:.25rem}.rf-px-1\\.5{padding-left:.375rem;padding-right:.375rem}.rf-px-2{padding-left:.5rem;padding-right:.5rem}.rf-px-2\\.5{padding-left:.625rem;padding-right:.625rem}.rf-px-3{padding-left:.75rem;padding-right:.75rem}.rf-px-4{padding-left:1rem;padding-right:1rem}.rf-px-6{padding-left:1.5rem;padding-right:1.5rem}.rf-px-8{padding-left:2rem;padding-right:2rem}.rf-py-0{padding-bottom:0;padding-top:0}.rf-py-0\\.5{padding-bottom:.125rem;padding-top:.125rem}.rf-py-1{padding-bottom:.25rem;padding-top:.25rem}.rf-py-1\\.5{padding-bottom:.375rem;padding-top:.375rem}.rf-py-10{padding-bottom:2.5rem;padding-top:2.5rem}.rf-py-12{padding-bottom:3rem;padding-top:3rem}.rf-py-2{padding-bottom:.5rem;padding-top:.5rem}.rf-py-3{padding-bottom:.75rem;padding-top:.75rem}.rf-py-4{padding-bottom:1rem;padding-top:1rem}.rf-py-6{padding-bottom:1.5rem;padding-top:1.5rem}.rf-py-8{padding-bottom:2rem;padding-top:2rem}.rf-pb-0{padding-bottom:0}.rf-pb-1{padding-bottom:.25rem}.rf-pb-2{padding-bottom:.5rem}.rf-pb-3{padding-bottom:.75rem}.rf-pb-4{padding-bottom:1rem}.rf-pb-px{padding-bottom:1px}.rf-pl-10{padding-left:2.5rem}.rf-pl-11{padding-left:2.75rem}.rf-pl-12{padding-left:3rem}.rf-pl-2{padding-left:.5rem}.rf-pl-4{padding-left:1rem}.rf-pl-8{padding-left:2rem}.rf-pr-2{padding-right:.5rem}.rf-pt-0{padding-top:0}.rf-pt-1{padding-top:.25rem}.rf-pt-2{padding-top:.5rem}.rf-pt-4{padding-top:1rem}.rf-text-left{text-align:left}.rf-text-center{text-align:center}.rf-text-right{text-align:right}.rf-align-bottom{vertical-align:bottom}.rf-font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.rf-font-sans{font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.rf-text-2xl{font-size:1.5rem;line-height:2rem}.rf-text-3xl{font-size:1.875rem;line-height:2.25rem}.rf-text-\\[10px\\]{font-size:10px}.rf-text-\\[11px\\]{font-size:11px}.rf-text-\\[8px\\]{font-size:8px}.rf-text-base{font-size:1rem;line-height:1.5rem}.rf-text-lg{font-size:1.125rem;line-height:1.75rem}.rf-text-sm{font-size:.875rem;line-height:1.25rem}.rf-text-xl{font-size:1.25rem;line-height:1.75rem}.rf-text-xs{font-size:.75rem;line-height:1rem}.\\!rf-font-normal{font-weight:400!important}.rf-font-bold{font-weight:700}.rf-font-medium{font-weight:500}.rf-font-semibold{font-weight:600}.rf-uppercase{text-transform:uppercase}.rf-capitalize{text-transform:capitalize}.rf-tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.rf-leading-5{line-height:1.25rem}.rf-leading-\\[0\\.95rem\\]{line-height:.95rem}.rf-leading-\\[1rem\\]{line-height:1rem}.rf-leading-none{line-height:1}.rf-leading-relaxed{line-height:1.625}.rf-leading-tight{line-height:1.25}.rf-tracking-wide{letter-spacing:.025em}.rf-tracking-widest{letter-spacing:.1em}.rf-text-amber-500{--tw-text-opacity:1;color:rgb(245 158 11/var(--tw-text-opacity,1))}.rf-text-black{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity,1))}.rf-text-blue-500{--tw-text-opacity:1;color:rgb(59 130 246/var(--tw-text-opacity,1))}.rf-text-blue-600{--tw-text-opacity:1;color:rgb(37 99 235/var(--tw-text-opacity,1))}.rf-text-blue-700{--tw-text-opacity:1;color:rgb(29 78 216/var(--tw-text-opacity,1))}.rf-text-blue-800{--tw-text-opacity:1;color:rgb(30 64 175/var(--tw-text-opacity,1))}.rf-text-blue-900{--tw-text-opacity:1;color:rgb(30 58 138/var(--tw-text-opacity,1))}.rf-text-current{color:currentColor}.rf-text-emerald-600{--tw-text-opacity:1;color:rgb(5 150 105/var(--tw-text-opacity,1))}.rf-text-foreground{color:hsl(var(--foreground))}.rf-text-gray-200{--tw-text-opacity:1;color:rgb(229 231 235/var(--tw-text-opacity,1))}.rf-text-gray-300{--tw-text-opacity:1;color:rgb(209 213 219/var(--tw-text-opacity,1))}.rf-text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.rf-text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.rf-text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity,1))}.rf-text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity,1))}.rf-text-gray-800{--tw-text-opacity:1;color:rgb(31 41 55/var(--tw-text-opacity,1))}.rf-text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1))}.rf-text-green-500{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity,1))}.rf-text-green-600{--tw-text-opacity:1;color:rgb(22 163 74/var(--tw-text-opacity,1))}.rf-text-green-700{--tw-text-opacity:1;color:rgb(21 128 61/var(--tw-text-opacity,1))}.rf-text-green-800{--tw-text-opacity:1;color:rgb(22 101 52/var(--tw-text-opacity,1))}.rf-text-green-900{--tw-text-opacity:1;color:rgb(20 83 45/var(--tw-text-opacity,1))}.rf-text-muted{color:hsl(var(--muted))}.rf-text-muted-foreground{color:hsl(var(--muted-foreground))}.rf-text-neutral-50{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.rf-text-neutral-500{--tw-text-opacity:1;color:rgb(115 115 115/var(--tw-text-opacity,1))}.rf-text-neutral-900{--tw-text-opacity:1;color:rgb(23 23 23/var(--tw-text-opacity,1))}.rf-text-neutral-950{--tw-text-opacity:1;color:rgb(10 10 10/var(--tw-text-opacity,1))}.rf-text-orange-400{--tw-text-opacity:1;color:rgb(251 146 60/var(--tw-text-opacity,1))}.rf-text-orange-500{--tw-text-opacity:1;color:rgb(249 115 22/var(--tw-text-opacity,1))}.rf-text-orange-600{--tw-text-opacity:1;color:rgb(234 88 12/var(--tw-text-opacity,1))}.rf-text-orange-700{--tw-text-opacity:1;color:rgb(194 65 12/var(--tw-text-opacity,1))}.rf-text-orange-800{--tw-text-opacity:1;color:rgb(154 52 18/var(--tw-text-opacity,1))}.rf-text-popover-foreground{color:hsl(var(--popover-foreground))}.rf-text-red-200{--tw-text-opacity:1;color:rgb(254 202 202/var(--tw-text-opacity,1))}.rf-text-red-300{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.rf-text-red-400{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.rf-text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity,1))}.rf-text-red-600{--tw-text-opacity:1;color:rgb(220 38 38/var(--tw-text-opacity,1))}.rf-text-red-700{--tw-text-opacity:1;color:rgb(185 28 28/var(--tw-text-opacity,1))}.rf-text-red-800{--tw-text-opacity:1;color:rgb(153 27 27/var(--tw-text-opacity,1))}.rf-text-red-900{--tw-text-opacity:1;color:rgb(127 29 29/var(--tw-text-opacity,1))}.rf-text-slate-200{--tw-text-opacity:1;color:rgb(226 232 240/var(--tw-text-opacity,1))}.rf-text-slate-400{--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity,1))}.rf-text-slate-50{--tw-text-opacity:1;color:rgb(248 250 252/var(--tw-text-opacity,1))}.rf-text-slate-500{--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity,1))}.rf-text-slate-600{--tw-text-opacity:1;color:rgb(71 85 105/var(--tw-text-opacity,1))}.rf-text-slate-800{--tw-text-opacity:1;color:rgb(30 41 59/var(--tw-text-opacity,1))}.rf-text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.rf-text-yellow-400{--tw-text-opacity:1;color:rgb(250 204 21/var(--tw-text-opacity,1))}.rf-text-yellow-500{--tw-text-opacity:1;color:rgb(234 179 8/var(--tw-text-opacity,1))}.rf-text-yellow-600{--tw-text-opacity:1;color:rgb(202 138 4/var(--tw-text-opacity,1))}.rf-text-yellow-700{--tw-text-opacity:1;color:rgb(161 98 7/var(--tw-text-opacity,1))}.rf-text-yellow-900{--tw-text-opacity:1;color:rgb(113 63 18/var(--tw-text-opacity,1))}.rf-text-zinc-200{--tw-text-opacity:1;color:rgb(228 228 231/var(--tw-text-opacity,1))}.rf-text-zinc-300{--tw-text-opacity:1;color:rgb(212 212 216/var(--tw-text-opacity,1))}.rf-text-zinc-400{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.rf-text-zinc-50{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.rf-text-zinc-500{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.rf-text-zinc-900{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.rf-text-zinc-950{--tw-text-opacity:1;color:rgb(9 9 11/var(--tw-text-opacity,1))}.rf-underline{text-decoration-line:underline}.rf-line-through{text-decoration-line:line-through}.rf-underline-offset-4{text-underline-offset:4px}.rf-opacity-0{opacity:0}.rf-opacity-10{opacity:.1}.rf-opacity-100{opacity:1}.rf-opacity-25{opacity:.25}.rf-opacity-30{opacity:.3}.rf-opacity-50{opacity:.5}.rf-opacity-60{opacity:.6}.rf-opacity-70{opacity:.7}.rf-opacity-75{opacity:.75}.rf-shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}.rf-shadow,.rf-shadow-lg{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.rf-shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}.rf-shadow-md{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.rf-shadow-md,.rf-shadow-none{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.rf-shadow-none{--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000}.rf-shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}.rf-shadow-sm,.rf-shadow-xl{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.rf-shadow-xl{--tw-shadow:0 20px 25px -5px rgba(0,0,0,.1),0 8px 10px -6px rgba(0,0,0,.1);--tw-shadow-colored:0 20px 25px -5px var(--tw-shadow-color),0 8px 10px -6px var(--tw-shadow-color)}.rf-outline-none{outline:2px solid transparent;outline-offset:2px}.rf-ring-2{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.rf-ring-blue-500{--tw-ring-opacity:1;--tw-ring-color:rgb(59 130 246/var(--tw-ring-opacity,1))}.rf-ring-primary{--tw-ring-color:hsl(var(--primary))}.rf-ring-offset-background{--tw-ring-offset-color:hsl(var(--background))}.rf-ring-offset-white{--tw-ring-offset-color:#fff}.rf-transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-opacity{transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-transform{transition-duration:.15s;transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-duration-150{transition-duration:.15s}.rf-duration-200{transition-duration:.2s}.rf-ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0),var(--tw-enter-translate-y,0),0) scale3d(var(--tw-enter-scale,1),var(--tw-enter-scale,1),var(--tw-enter-scale,1)) rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0),var(--tw-exit-translate-y,0),0) scale3d(var(--tw-exit-scale,1),var(--tw-exit-scale,1),var(--tw-exit-scale,1)) rotate(var(--tw-exit-rotate,0))}}.rf-animate-in{animation-duration:.15s;animation-name:enter;--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial}.rf-fade-in-0{--tw-enter-opacity:0}.rf-zoom-in-95{--tw-enter-scale:.95}.rf-slide-in-from-left-1{--tw-enter-translate-x:-0.25rem}.rf-slide-out-to-left-1{--tw-exit-translate-x:-0.25rem}.rf-duration-150{animation-duration:.15s}.rf-duration-200{animation-duration:.2s}.rf-ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.no-scrollbar::-webkit-scrollbar{display:none}.no-scrollbar{-ms-overflow-style:none;scrollbar-width:none}.file\\:rf-border-0::file-selector-button{border-width:0}.file\\:rf-bg-transparent::file-selector-button{background-color:transparent}.file\\:rf-text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\\:rf-font-medium::file-selector-button{font-weight:500}.placeholder\\:rf-text-zinc-500::-moz-placeholder{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.placeholder\\:rf-text-zinc-500::placeholder{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.hover\\:rf-border-blue-300:hover{--tw-border-opacity:1;border-color:rgb(147 197 253/var(--tw-border-opacity,1))}.hover\\:\\!rf-bg-transparent:hover{background-color:transparent!important}.hover\\:rf-bg-blue-700:hover{--tw-bg-opacity:1;background-color:rgb(29 78 216/var(--tw-bg-opacity,1))}.hover\\:rf-bg-gray-50:hover{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity,1))}.hover\\:rf-bg-orange-100:hover{--tw-bg-opacity:1;background-color:rgb(255 237 213/var(--tw-bg-opacity,1))}.hover\\:rf-bg-red-100:hover{--tw-bg-opacity:1;background-color:rgb(254 226 226/var(--tw-bg-opacity,1))}.hover\\:rf-bg-red-500\\/90:hover{background-color:rgba(239,68,68,.9)}.hover\\:rf-bg-slate-100:hover{--tw-bg-opacity:1;background-color:rgb(241 245 249/var(--tw-bg-opacity,1))}.hover\\:rf-bg-slate-200:hover{--tw-bg-opacity:1;background-color:rgb(226 232 240/var(--tw-bg-opacity,1))}.hover\\:rf-bg-slate-50:hover{--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity,1))}.hover\\:rf-bg-zinc-100:hover{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.hover\\:rf-bg-zinc-100\\/80:hover{background-color:hsla(240,5%,96%,.8)}.hover\\:rf-bg-zinc-900\\/90:hover{background-color:rgba(24,24,27,.9)}.hover\\:rf-text-blue-800:hover{--tw-text-opacity:1;color:rgb(30 64 175/var(--tw-text-opacity,1))}.hover\\:rf-text-gray-700:hover{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity,1))}.hover\\:rf-text-red-400:hover{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.hover\\:rf-text-slate-800:hover{--tw-text-opacity:1;color:rgb(30 41 59/var(--tw-text-opacity,1))}.hover\\:rf-text-slate-900:hover{--tw-text-opacity:1;color:rgb(15 23 42/var(--tw-text-opacity,1))}.hover\\:rf-text-zinc-900:hover{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.hover\\:rf-underline:hover{text-decoration-line:underline}.focus\\:rf-bg-gray-100:focus{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.focus\\:rf-bg-zinc-100:focus{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.focus\\:rf-text-gray-900:focus{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1))}.focus\\:rf-text-zinc-900:focus{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.focus\\:rf-outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\\:rf-ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus\\:rf-ring-blue-500:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(59 130 246/var(--tw-ring-opacity,1))}.focus\\:rf-ring-ring:focus{--tw-ring-color:hsl(var(--ring))}.focus\\:rf-ring-offset-2:focus{--tw-ring-offset-width:2px}.focus-visible\\:rf-outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\\:rf-ring-1:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\\:rf-ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\\:rf-ring-zinc-950:focus-visible{--tw-ring-opacity:1;--tw-ring-color:rgb(9 9 11/var(--tw-ring-opacity,1))}.focus-visible\\:rf-ring-offset-2:focus-visible{--tw-ring-offset-width:2px}.disabled\\:rf-pointer-events-none:disabled{pointer-events:none}.disabled\\:rf-cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:rf-opacity-50:disabled{opacity:.5}.rf-group:hover .group-hover\\:rf-opacity-100,.rf-group\\/bar:hover .group-hover\\/bar\\:rf-opacity-100{opacity:1}.rf-peer:disabled~.peer-disabled\\:rf-cursor-not-allowed{cursor:not-allowed}.rf-peer:disabled~.peer-disabled\\:rf-opacity-70{opacity:.7}.data-\\[disabled\\=true\\]\\:rf-pointer-events-none[data-disabled=true],.data-\\[disabled\\]\\:rf-pointer-events-none[data-disabled]{pointer-events:none}.data-\\[side\\=bottom\\]\\:rf-translate-y-1[data-side=bottom]{--tw-translate-y:0.25rem}.data-\\[side\\=bottom\\]\\:rf-translate-y-1[data-side=bottom],.data-\\[side\\=left\\]\\:-rf-translate-x-1[data-side=left]{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))}.data-\\[side\\=left\\]\\:-rf-translate-x-1[data-side=left]{--tw-translate-x:-0.25rem}.data-\\[side\\=right\\]\\:rf-translate-x-1[data-side=right]{--tw-translate-x:0.25rem}.data-\\[side\\=right\\]\\:rf-translate-x-1[data-side=right],.data-\\[side\\=top\\]\\:-rf-translate-y-1[data-side=top]{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))}.data-\\[side\\=top\\]\\:-rf-translate-y-1[data-side=top]{--tw-translate-y:-0.25rem}.data-\\[selected\\=true\\]\\:rf-bg-zinc-100[data-selected=true]{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.data-\\[state\\=active\\]\\:rf-bg-white[data-state=active]{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.data-\\[state\\=checked\\]\\:rf-bg-zinc-900[data-state=checked]{--tw-bg-opacity:1;background-color:rgb(24 24 27/var(--tw-bg-opacity,1))}.data-\\[state\\=open\\]\\:rf-bg-zinc-100[data-state=open]{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.data-\\[selected\\=true\\]\\:rf-text-zinc-900[data-selected=true]{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.data-\\[state\\=active\\]\\:rf-text-zinc-950[data-state=active]{--tw-text-opacity:1;color:rgb(9 9 11/var(--tw-text-opacity,1))}.data-\\[state\\=checked\\]\\:rf-text-zinc-50[data-state=checked]{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.data-\\[disabled\\=true\\]\\:rf-opacity-50[data-disabled=true],.data-\\[disabled\\]\\:rf-opacity-50[data-disabled]{opacity:.5}.data-\\[state\\=active\\]\\:rf-shadow[data-state=active]{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.data-\\[state\\=open\\]\\:rf-animate-in[data-state=open]{animation-duration:.15s;animation-name:enter;--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial}.data-\\[state\\=closed\\]\\:rf-animate-out[data-state=closed]{animation-duration:.15s;animation-name:exit;--tw-exit-opacity:initial;--tw-exit-scale:initial;--tw-exit-rotate:initial;--tw-exit-translate-x:initial;--tw-exit-translate-y:initial}.data-\\[state\\=closed\\]\\:rf-fade-out-0[data-state=closed]{--tw-exit-opacity:0}.data-\\[state\\=open\\]\\:rf-fade-in-0[data-state=open]{--tw-enter-opacity:0}.data-\\[state\\=closed\\]\\:rf-zoom-out-95[data-state=closed]{--tw-exit-scale:.95}.data-\\[state\\=open\\]\\:rf-zoom-in-95[data-state=open]{--tw-enter-scale:.95}.data-\\[side\\=bottom\\]\\:rf-slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y:-0.5rem}.data-\\[side\\=left\\]\\:rf-slide-in-from-right-2[data-side=left]{--tw-enter-translate-x:0.5rem}.data-\\[side\\=right\\]\\:rf-slide-in-from-left-2[data-side=right]{--tw-enter-translate-x:-0.5rem}.data-\\[side\\=top\\]\\:rf-slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y:0.5rem}.data-\\[state\\=closed\\]\\:rf-slide-out-to-left-1\\/2[data-state=closed]{--tw-exit-translate-x:-50%}.data-\\[state\\=closed\\]\\:rf-slide-out-to-top-\\[48\\%\\][data-state=closed]{--tw-exit-translate-y:-48%}.data-\\[state\\=open\\]\\:rf-slide-in-from-left-1\\/2[data-state=open]{--tw-enter-translate-x:-50%}.data-\\[state\\=open\\]\\:rf-slide-in-from-top-\\[48\\%\\][data-state=open]{--tw-enter-translate-y:-48%}.dark\\:rf-border-zinc-50:is(.rf-dark *){--tw-border-opacity:1;border-color:rgb(250 250 250/var(--tw-border-opacity,1))}.dark\\:rf-border-zinc-800:is(.rf-dark *){--tw-border-opacity:1;border-color:rgb(39 39 42/var(--tw-border-opacity,1))}.dark\\:rf-bg-gray-700:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.dark\\:rf-bg-gray-800:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.dark\\:rf-bg-red-900:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(127 29 29/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-50:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-800:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-950:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(9 9 11/var(--tw-bg-opacity,1))}.dark\\:rf-text-gray-500:is(.rf-dark *){--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.dark\\:rf-text-zinc-400:is(.rf-dark *){--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.dark\\:rf-text-zinc-50:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:rf-text-zinc-900:is(.rf-dark *){--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.dark\\:rf-placeholder-zinc-400:is(.rf-dark *)::-moz-placeholder{--tw-placeholder-opacity:1;color:rgb(161 161 170/var(--tw-placeholder-opacity,1))}.dark\\:rf-placeholder-zinc-400:is(.rf-dark *)::placeholder{--tw-placeholder-opacity:1;color:rgb(161 161 170/var(--tw-placeholder-opacity,1))}.dark\\:rf-ring-offset-zinc-950:is(.rf-dark *){--tw-ring-offset-color:#09090b}.dark\\:placeholder\\:rf-text-zinc-400:is(.rf-dark *)::-moz-placeholder{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.dark\\:placeholder\\:rf-text-zinc-400:is(.rf-dark *)::placeholder{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.dark\\:hover\\:rf-bg-red-900\\/90:hover:is(.rf-dark *){background-color:rgba(127,29,29,.9)}.dark\\:hover\\:rf-bg-zinc-50\\/90:hover:is(.rf-dark *){background-color:hsla(0,0%,98%,.9)}.dark\\:hover\\:rf-bg-zinc-800:hover:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:hover\\:rf-bg-zinc-800\\/80:hover:is(.rf-dark *){background-color:rgba(39,39,42,.8)}.dark\\:hover\\:rf-text-zinc-50:hover:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:focus\\:rf-bg-zinc-800:focus:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:focus\\:rf-text-zinc-50:focus:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:focus-visible\\:rf-ring-zinc-300:focus-visible:is(.rf-dark *){--tw-ring-opacity:1;--tw-ring-color:rgb(212 212 216/var(--tw-ring-opacity,1))}.dark\\:data-\\[selected\\=true\\]\\:rf-bg-zinc-800[data-selected=true]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=active\\]\\:rf-bg-zinc-950[data-state=active]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(9 9 11/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=checked\\]\\:rf-bg-zinc-50[data-state=checked]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=open\\]\\:rf-bg-zinc-800[data-state=open]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:data-\\[selected\\=true\\]\\:rf-text-zinc-50[data-selected=true]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:data-\\[state\\=active\\]\\:rf-text-zinc-50[data-state=active]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:data-\\[state\\=checked\\]\\:rf-text-zinc-900[data-state=checked]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}@media (min-width:640px){.sm\\:rf-order-1{order:1}.sm\\:rf-order-2{order:2}.sm\\:rf-mt-0{margin-top:0}.sm\\:rf-mt-4{margin-top:1rem}.sm\\:rf-block{display:block}.sm\\:rf-inline{display:inline}.sm\\:rf-grid{display:grid}.sm\\:rf-hidden{display:none}.sm\\:rf-h-5{height:1.25rem}.sm\\:rf-w-1\\/2{width:50%}.sm\\:rf-w-5{width:1.25rem}.sm\\:rf-w-\\[90vw\\]{width:90vw}.sm\\:rf-w-auto{width:auto}.sm\\:rf-max-w-\\[500px\\]{max-width:500px}.sm\\:rf-max-w-md{max-width:28rem}.sm\\:rf-grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\\:rf-grid-cols-\\[1fr_auto\\]{grid-template-columns:1fr auto}.sm\\:rf-grid-cols-\\[minmax\\(0\\2c 1fr\\)_auto\\]{grid-template-columns:minmax(0,1fr) auto}.sm\\:rf-flex-row{flex-direction:row}.sm\\:rf-items-center{align-items:center}.sm\\:rf-justify-end{justify-content:flex-end}.sm\\:rf-gap-3{gap:.75rem}.sm\\:rf-gap-4{gap:1rem}.sm\\:rf-space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.5rem*var(--tw-space-x-reverse))}.sm\\:rf-rounded-lg{border-radius:var(--radius)}.sm\\:rf-p-3{padding:.75rem}.sm\\:rf-p-6{padding:1.5rem}.sm\\:rf-px-4{padding-left:1rem;padding-right:1rem}.sm\\:rf-px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\\:rf-py-6{padding-bottom:1.5rem;padding-top:1.5rem}.sm\\:rf-text-left{text-align:left}.sm\\:rf-text-2xl{font-size:1.5rem;line-height:2rem}.sm\\:rf-text-base{font-size:1rem;line-height:1.5rem}.sm\\:rf-text-sm{font-size:.875rem;line-height:1.25rem}.sm\\:rf-text-xl{font-size:1.25rem;line-height:1.75rem}}@media (min-width:768px){.md\\:rf-w-auto{width:auto}.md\\:rf-max-w-\\[660px\\]{max-width:660px}.md\\:rf-max-w-lg{max-width:32rem}.md\\:rf-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\\:rf-p-8{padding:2rem}.md\\:rf-py-8{padding-bottom:2rem;padding-top:2rem}.md\\:rf-text-3xl{font-size:1.875rem;line-height:2.25rem}}@media (min-width:1024px){.lg\\:rf-max-w-\\[720px\\]{max-width:720px}.lg\\:rf-max-w-xl{max-width:36rem}}@media (min-width:1280px){.xl\\:rf-max-w-\\[800px\\]{max-width:800px}}.\\[\\&\\>span\\]\\:rf-line-clamp-1>span{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\\[\\&\\>svg\\]\\:rf-size-4>svg{height:1rem;width:1rem}.\\[\\&\\>svg\\]\\:rf-shrink-0>svg{flex-shrink:0}.\\[\\&\\>svg\\]\\:rf-text-red-300>svg{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.\\[\\&\\>svg\\]\\:hover\\:rf-text-red-400:hover>svg{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-py-1\\.5 [cmdk-group-heading]{padding-bottom:.375rem;padding-top:.375rem}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-font-medium [cmdk-group-heading]{font-weight:500}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-text-zinc-500 [cmdk-group-heading]{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.dark\\:\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-text-zinc-400 [cmdk-group-heading]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.\\[\\&_\\[cmdk-group\\]\\:not\\(\\[hidden\\]\\)_\\~\\[cmdk-group\\]\\]\\:rf-pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\\[\\&_\\[cmdk-group\\]\\]\\:rf-px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\\[\\&_\\[cmdk-input-wrapper\\]_svg\\]\\:rf-h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\\[\\&_\\[cmdk-input-wrapper\\]_svg\\]\\:rf-w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\\[\\&_\\[cmdk-input\\]\\]\\:rf-h-12 [cmdk-input]{height:3rem}.\\[\\&_\\[cmdk-item\\]\\]\\:rf-px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\\[\\&_\\[cmdk-item\\]\\]\\:rf-py-3 [cmdk-item]{padding-bottom:.75rem;padding-top:.75rem}.\\[\\&_\\[cmdk-item\\]_svg\\]\\:rf-h-5 [cmdk-item] svg{height:1.25rem}.\\[\\&_\\[cmdk-item\\]_svg\\]\\:rf-w-5 [cmdk-item] svg{width:1.25rem}.\\[\\&_svg\\]\\:rf-pointer-events-none svg{pointer-events:none}.\\[\\&_svg\\]\\:rf-size-4 svg{height:1rem;width:1rem}.\\[\\&_svg\\]\\:rf-shrink-0 svg{flex-shrink:0}',CLt=()=>{ne.useEffect(()=>{if(document.querySelector('style[data-styles="tscircuit-runframe"]'))return;const e=document.createElement("style");e.setAttribute("data-styles","tscircuit-runframe"),e.textContent=yYo,document.head.appendChild(e)},[])},EYo=t=>{ne.useEffect(()=>(t?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[t])};function yLt(t,e,n){const[o,i]=ne.useState(()=>{if(n!==void 0)return n;try{const r=window.localStorage.getItem(t);return r?JSON.parse(r):e}catch(r){return console.error("Error reading from localStorage:",r),e}});return ne.useEffect(()=>{try{window.localStorage.setItem(t,JSON.stringify(o))}catch(r){console.error("Error writing to localStorage:",r)}},[t,o]),[o,i]}const ELt=t=>`hsl(${BB.indexOf(t)*137.5%360}, 70%, 50%)`,xYo=({phaseTimings:t})=>{if(!t)return null;const e=Object.values(t).reduce((n,o)=>n+o,0);return j.jsxs("div",{className:"rf-space-y-2 rf-w-full rf-px-4",children:[j.jsx("div",{className:"rf-relative rf-h-8 rf-flex rf-rounded-sm",children:BB.map(n=>{const o=t[n]||0,i=o/e*100;return j.jsx("div",{className:"rf-group/bar rf-relative rf-overflow-visible",style:{width:`${i}%`,backgroundColor:ELt(n)},children:j.jsxs("div",{className:"rf-opacity-0 group-hover/bar:rf-opacity-100 rf-transition-opacity rf-absolute rf-bottom-full rf-left-1/2 rf-transform -rf-translate-x-1/2 rf-mb-2 rf-px-2 rf-py-1 rf-text-xs rf-whitespace-nowrap rf-rounded rf-bg-gray-900 rf-text-white rf-pointer-events-none",children:[n,": ",o.toFixed(1),"ms"]})},n)})}),j.jsxs("div",{className:"rf-text-xs rf-text-gray-500",children:["Total: ",e.toFixed(2),"ms"]})]})},BYo=t=>{if(t instanceof Blob)return t;if(t==null)return"";if(typeof t=="string")return t;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{return String(t)}return String(t)},QYo=({renderLog:t,onRerunWithDebug:e})=>{const[n,o]=ne.useState("chronological"),[i,r]=ne.useState(""),s=[{value:"",label:"None"},{value:"DEBUG=Group_doInitialSchematicTraceRender",label:"DEBUG=Group_doInitialSchematicTraceRender"},{value:"DEBUG=Group_doInitialSchematicLayoutMatchpack",label:"DEBUG=Group_doInitialSchematicLayoutMatchpack"},{value:"DEBUG=Group_doInitialPcbLayoutPack",label:"DEBUG=Group_doInitialPcbLayoutPack"}];if(!t)return j.jsxs("div",{className:"rf-p-4 rf-bg-gray-100 rf-rounded-md",children:[j.jsx("div",{className:"rf-mb-4",children:"No render log, make sure this tab is open when you render"}),e&&j.jsxs("div",{className:"rf-flex rf-gap-2 rf-items-center",children:[j.jsx("select",{value:i,onChange:c=>r(c.target.value),className:"rf-px-3 rf-py-1 rf-border rf-rounded rf-text-xs rf-bg-white",children:s.map(c=>j.jsx("option",{value:c.value,children:c.label},c.value))}),j.jsx(Sc,{onClick:()=>e(i),size:"sm",className:"rf-text-xs",children:"Rerun Render with Debug"})]})]});const a=Object.entries(t?.phaseTimings??{});n==="chronological"?a.sort((c,l)=>BB.indexOf(c[0])-BB.indexOf(l[0])):a.sort((c,l)=>l[1]-c[1]);const A=a.reduce((c,[l,g])=>c+g,0);return j.jsxs("div",{className:"rf-bg-white",children:[j.jsxs("div",{className:"rf-flex rf-justify-between rf-items-center rf-mb-4",children:[j.jsx("div",{children:"Render Logs"}),j.jsxs("div",{className:"rf-flex rf-gap-4 rf-items-center",children:[e&&j.jsxs("div",{className:"rf-flex rf-gap-2 rf-items-center",children:[j.jsx("select",{value:i,onChange:c=>r(c.target.value),className:"rf-px-3 rf-py-1 rf-border rf-rounded rf-text-xs rf-bg-white",children:s.map(c=>j.jsx("option",{value:c.value,children:c.label},c.value))}),j.jsx(Sc,{onClick:()=>e(i),size:"sm",className:"rf-text-xs",children:"Rerun Render with Debug"})]}),j.jsx("div",{className:"rf-flex rf-gap-2 rf-items-center",children:j.jsxs("select",{onChange:c=>{if(c.target.value){const l=t?.debugOutputs?.find(g=>g.name===c.target.value);if(l){const g=BYo(l.content),u=g instanceof Blob?g:new Blob([g],{type:"text/plain"}),h=URL.createObjectURL(u),d=document.createElement("a");d.href=h,d.download=`debug-${l.name}.txt`,document.body.appendChild(d),d.click(),document.body.removeChild(d),URL.revokeObjectURL(h)}c.target.value=""}},disabled:!t?.debugOutputs||t.debugOutputs.length===0,className:"rf-px-3 rf-py-1 rf-border rf-rounded rf-text-xs rf-bg-white disabled:rf-opacity-50 disabled:rf-cursor-not-allowed",children:[j.jsx("option",{value:"",children:"Download Debug Output"}),t?.debugOutputs?.map(c=>j.jsx("option",{value:c.name,children:c.name},c.name))]})}),j.jsxs("div",{className:"rf-flex rf-text-xs rf-items-center",children:[j.jsx("div",{className:"rf-mr-2",children:"Sort by:"}),j.jsxs("select",{value:n,onChange:c=>o(c.target.value),className:"rf-px-2 rf-py-1 rf-border rf-rounded rf-text-xs",children:[j.jsx("option",{value:"chronological",children:"Phase Order"}),j.jsx("option",{value:"longest",children:"Duration"})]})]})]})]}),j.jsx(xYo,{phaseTimings:t.phaseTimings}),j.jsxs("table",{className:"rf-w-full rf-text-xs",children:[j.jsx("thead",{children:j.jsxs("tr",{children:[j.jsx("th",{className:"rf-text-left rf-p-2",children:"Phase Order"}),j.jsx("th",{className:"rf-text-left rf-p-2",children:"Phase"}),j.jsx("th",{className:"rf-text-left rf-p-2",children:"Duration (ms)"})]})}),j.jsx("tbody",{children:a.map(([c,l])=>j.jsxs("tr",{children:[j.jsx("td",{className:"rf-p-2",children:BB.indexOf(c)}),j.jsx("td",{className:"rf-p-2",children:c}),j.jsx("td",{className:"rf-p-2",children:j.jsx("div",{className:"rf-w-8",children:j.jsx("div",{className:"rf-h-2 rf-rounded-sm",style:{backgroundColor:ELt(c),width:`${l/A*100}%`}})})}),j.jsx("td",{className:"rf-p-2",children:j.jsxs("div",{className:"rf-flex w-full",children:[j.jsxs("span",{className:"rf-flex-grow",children:[l,"ms"]}),j.jsxs("span",{className:"rf-text-gray-500 rf-pr-2",children:[(l/A*100).toFixed(1),"%"]})]})})]},c))})]})]})},SYo=jr[typeof document<"u"&&document.createElement!==void 0?"useLayoutEffect":"useEffect"],bYo=t=>{const e=ne.useRef(t);return ne.useEffect(()=>{e.current=t}),e};function DYo(){}function PYo(t,e,n={}){const o=MYo(n.polyfill),i=bYo(e);return SYo(()=>{let r=!1;const s=t&&"current"in t?t.current:t;if(!s)return DYo;function a(A,c){r||i.current(A,c)}return o.subscribe(s,a),()=>{r=!0,o.unsubscribe(s,a)}},[t,o,i]),o.observer}function vYo(t){let e=!1,n=[];const o=new Map,i=new(t||window.ResizeObserver)((r,s)=>{n=n.concat(r);function a(){const A=new Set;for(let c=0;c<n.length;c++){if(A.has(n[c].target))continue;A.add(n[c].target);const l=o.get(n[c].target);l?.forEach(g=>g(n[c],s))}n=[],e=!1}e||window.requestAnimationFrame(a),e=!0});return{observer:i,subscribe(r,s){var a;i.observe(r);const A=(a=o.get(r))!==null&&a!==void 0?a:[];A.push(s),o.set(r,A)},unsubscribe(r,s){var a;const A=(a=o.get(r))!==null&&a!==void 0?a:[];if(A.length===1){i.unobserve(r),o.delete(r);return}const c=A.indexOf(s);c!==-1&&A.splice(c,1),o.set(r,A)}}}let z8e;const MYo=t=>z8e||(z8e=vYo(t));var wYo=t=>{const e={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const n of t.lines??[])for(const o of n.points??[])e.minX=Math.min(e.minX,o.x),e.minY=Math.min(e.minY,o.y),e.maxX=Math.max(e.maxX,o.x),e.maxY=Math.max(e.maxY,o.y);for(const n of t.rects??[]){const o=Aqn(n);e.minX=Math.min(e.minX,o.minX),e.minY=Math.min(e.minY,o.minY),e.maxX=Math.max(e.maxX,o.maxX),e.maxY=Math.max(e.maxY,o.maxY)}for(const n of t.polygons??[])for(const o of n.points??[])e.minX=Math.min(e.minX,o.x),e.minY=Math.min(e.minY,o.y),e.maxX=Math.max(e.maxX,o.x),e.maxY=Math.max(e.maxY,o.y);for(const n of t.points??[])e.minX=Math.min(e.minX,n.x),e.minY=Math.min(e.minY,n.y),e.maxX=Math.max(e.maxX,n.x),e.maxY=Math.max(e.maxY,n.y);for(const n of t.circles??[])e.minX=Math.min(e.minX,n.center.x-n.radius),e.minY=Math.min(e.minY,n.center.y-n.radius),e.maxX=Math.max(e.maxX,n.center.x+n.radius),e.maxY=Math.max(e.maxY,n.center.y+n.radius);for(const n of t.arrows??[]){const o=npt(n);e.minX=Math.min(e.minX,o.minX),e.minY=Math.min(e.minY,o.minY),e.maxX=Math.max(e.maxX,o.maxX),e.maxY=Math.max(e.maxY,o.maxY)}for(const n of t.texts??[])e.minX=Math.min(e.minX,n.x),e.minY=Math.min(e.minY,n.y),e.maxX=Math.max(e.maxX,n.x),e.maxY=Math.max(e.maxY,n.y);return e};function NYo(t){const e=l=>!l||l.length===0?0:l.reduce((g,u)=>{const h=Number.isNaN(u.step)?0:u.step||0;return Math.max(g,h)},0),n=e(t.points),o=e(t.lines),i=e(t.infiniteLines),r=e(t.rects),s=e(t.polygons),a=e(t.circles),A=e(t.texts),c=e(t.arrows);return Math.max(n,o,i,r,s,a,A,c)}var RYo=t=>t.slice().sort((e,n)=>n.width*n.height-e.width*e.height);function TYo(t){const{dimensionStart:e,dimensionEnd:n,screenDimensionStart:o,screenDimensionEnd:i,flipX:r,flipY:s}=t,a=n.x-e.x,A=n.y-e.y,c=Math.sqrt(a*a+A*A),l=i.x-o.x,g=i.y-o.y,u=Math.sqrt(l*l+g*g),h=Math.atan2(g,l)*(180/Math.PI),d=Math.abs(h)%90,m=Math.min(d,90-d)>15,p=(o.x+i.x)/2,I=(o.y+i.y)/2,f=15,C=h+90;let y=Math.cos(C*Math.PI/180)*f,E=Math.sin(C*Math.PI/180)*f;const B=l>0&&g<0,Q=l>0&&g>0,b=l<0&&g>0;r!==s&&!B&&(y=-y,E=-E),B&&(y+=Math.cos(C*Math.PI/180)*-45,E+=Math.sin(C*Math.PI/180)*-45),Q&&(y+=Math.cos(C*Math.PI/180)+-20,E+=Math.sin(C*Math.PI/180)+-10),b&&(y+=Math.cos(C*Math.PI/180)*10,E+=Math.sin(C*Math.PI/180)*10);const D=p+y,R=I+E;return{distance:c,screenDistance:u,x:D,y:R,show:c>.01&&u>30&&m}}function kYo(t){const{dimensionStart:e,dimensionEnd:n,screenDimensionStart:o,screenDimensionEnd:i,flipX:r,flipY:s}=t;return ne.useMemo(()=>TYo({dimensionStart:e,dimensionEnd:n,screenDimensionStart:o,screenDimensionEnd:i,flipX:r,flipY:s}),[e,n,o,i,r,s])}var FYo=({children:t,transform:e})=>{e||(e=XJn());const[n,o]=ne.useState(!1),[i,r]=ne.useState(!1),[s,a]=ne.useState({x:0,y:0}),[A,c]=ne.useState({x:0,y:0}),l=ne.useRef({x:0,y:0}),g=ne.useRef(null),u=ne.useRef(!1),d=g.current?.getBoundingClientRect(),_=ne.useCallback(()=>{u.current=!0,g.current?.focus()},[]),m=ne.useCallback(()=>{u.current=!1},[]);ne.useEffect(()=>{const y=E=>{const B=g.current?.contains(document.activeElement)||document.activeElement===g.current;!u.current&&!B||(E.key==="d"&&(a({x:l.current.x,y:l.current.y}),c({x:l.current.x,y:l.current.y}),o(Q=>!Q),r(!0)),E.key==="Escape"&&(o(!1),r(!1)))};return window.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y)}},[]);const p=_g(e,s),I=_g(e,A),f={left:Math.min(p.x,I.x),right:Math.max(p.x,I.x),top:Math.min(p.y,I.y),bottom:Math.max(p.y,I.y),flipX:p.x>I.x,flipY:p.y>I.y,width:0,height:0};f.width=f.right-f.left,f.height=f.bottom-f.top;const C=kYo({dimensionStart:s,dimensionEnd:A,screenDimensionStart:p,screenDimensionEnd:I,flipX:f.flipX,flipY:f.flipY});return j.jsxs("div",{ref:g,tabIndex:0,style:{position:"relative"},onMouseMove:y=>{const E=y.currentTarget.getBoundingClientRect(),B=y.clientX-E.left,Q=y.clientY-E.top,b=_g(AEe(e),{x:B,y:Q});l.current.x=b.x,l.current.y=b.y,i&&c({x:b.x,y:b.y})},onMouseDown:()=>{i?r(!1):n&&o(!1)},onMouseEnter:_,onMouseLeave:m,children:[t,n&&j.jsxs(j.Fragment,{children:[C.show&&j.jsx("div",{style:{position:"absolute",left:C.x,top:C.y,color:"red",mixBlendMode:"difference",pointerEvents:"none",fontSize:12,fontFamily:"sans-serif",whiteSpace:"nowrap",zIndex:30},children:C.distance.toFixed(2)}),j.jsx("div",{style:{position:"absolute",left:f.left,width:f.width,textAlign:"center",top:p.y+2,color:"red",mixBlendMode:"difference",pointerEvents:"none",marginTop:f.flipY?0:-20,fontSize:12,fontFamily:"sans-serif",zIndex:30},children:Math.abs(s.x-A.x).toFixed(2)}),j.jsx("div",{style:{position:"absolute",left:I.x,height:f.height,display:"flex",flexDirection:"column",justifyContent:"center",top:f.top,color:"red",pointerEvents:"none",mixBlendMode:"difference",fontSize:12,fontFamily:"sans-serif",zIndex:30},children:j.jsx("div",{style:{marginLeft:f.flipX?"-100%":4,paddingRight:4},children:Math.abs(s.y-A.y).toFixed(2)})}),j.jsxs("svg",{style:{position:"absolute",left:0,top:0,pointerEvents:"none",mixBlendMode:"difference",zIndex:30},width:d?.width||"100%",height:d?.height||"100%",children:[j.jsx("defs",{children:j.jsx("marker",{id:"head",orient:"auto",markerWidth:"3",markerHeight:"4",refX:"2",refY:"2",children:j.jsx("path",{d:"M0,0 V4 L2,2 Z",fill:"red"})})}),j.jsx("line",{x1:p.x,y1:p.y,x2:I.x,y2:I.y,markerEnd:"url(#head)",strokeWidth:1.5,fill:"none",stroke:"red"}),j.jsx("line",{x1:p.x,y1:p.y,x2:I.x,y2:p.y,strokeWidth:1.5,fill:"none",strokeDasharray:"2,2",stroke:"red"}),j.jsx("line",{x1:I.x,y1:p.y,x2:I.x,y2:I.y,strokeWidth:1.5,fill:"none",strokeDasharray:"2,2",stroke:"red"})]}),j.jsxs("div",{style:{right:0,bottom:0,position:"absolute",color:"red",fontFamily:"sans-serif",fontSize:12,margin:4},children:["(",s.x.toFixed(2),",",s.y.toFixed(2),")",j.jsx("br",{}),"(",A.x.toFixed(2),",",A.y.toFixed(2),")",j.jsx("br",{}),"dist:"," ",Math.sqrt((A.x-s.x)**2+(A.y-s.y)**2).toFixed(2)]})]})]})},LYo=({label:t,onClose:e})=>j.jsx("div",{role:"dialog","aria-modal":"true","aria-label":"Object label",onClick:e,style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",padding:16,background:"rgba(0, 0, 0, 0.28)"},children:j.jsxs("div",{onClick:n=>{n.stopPropagation()},style:{width:"min(420px, 100%)",background:"#fff",borderRadius:10,boxShadow:"0 12px 32px rgba(0, 0, 0, 0.2)",padding:16},children:[j.jsx("div",{style:{fontWeight:600,marginBottom:8},children:"Object label"}),j.jsx("div",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word",marginBottom:16},children:t}),j.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:j.jsx("button",{type:"button",onClick:e,children:"Close"})})]})}),xLt=(t,e,n,o,i,r)=>{const s=t-n,a=e-o,A=i-n,c=r-o,l=s*A+a*c,g=A*A+c*c;let u=-1;g!==0&&(u=l/g);let h=0,d=0;u<0?(h=n,d=o):u>1?(h=i,d=r):(h=n+u*A,d=o+u*c);const _=t-h,m=e-d;return Math.sqrt(_*_+m*m)},OB=(t,e)=>{try{return QJn(t,e)}catch{return e}},HYo=({arrow:t,index:e,interactiveState:n})=>{const{realToScreen:o,onObjectClicked:i,setHoverTooltip:r}=n,[s,a]=ne.useState(!1),A=ne.useMemo(()=>gEe(t),[t]),c=ne.useMemo(()=>({shaftStart:_g(o,A.shaftStart),shaftEnd:_g(o,A.shaftEnd),heads:A.heads.map(y=>({tip:_g(o,y.tip),base:_g(o,y.base),leftWing:_g(o,y.leftWing),rightWing:_g(o,y.rightWing)}))}),[A,o]),l=Math.abs(o.a),g=12,u=A.shaftWidth*(l||1),h=g*.6,d=ne.useMemo(()=>opt(c.shaftStart,c.shaftEnd,{fontSize:g,strokeWidth:u,normalPadding:6,alongOffset:t.label?h:0}),[c,g,u,t.label,h]),_=ne.useMemo(()=>opt(c.shaftStart,c.shaftEnd,{fontSize:g,strokeWidth:u,normalPadding:12,alongOffset:t.inlineLabel?-h:0}),[c,g,u,t.inlineLabel,h]),m=t.color||Nf[e%Nf.length]||"black",p=s?OB(.2,m):m,I=[t.label,t.inlineLabel].filter(Boolean).join(`
5760
5760
  `),f=t.label?_:d;ne.useEffect(()=>{if(!(!s||!I))return r?.({text:I,x:f.x,y:f.y}),()=>{r?.(null)}},[s,r,f.x,f.y,I]);const C=y=>{const E=y.currentTarget.getBoundingClientRect(),B=y.clientX-E.left,Q=y.clientY-E.top,b=10,R=[{from:c.shaftStart,to:c.shaftEnd},...c.heads.flatMap(w=>[{from:w.base,to:w.leftWing},{from:w.leftWing,to:w.tip},{from:w.tip,to:w.rightWing},{from:w.rightWing,to:w.base}])].some(({from:w,to:H})=>xLt(B,Q,w.x,w.y,H.x,H.y)<b);a(R)};return j.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",pointerEvents:"none"},children:j.jsxs("svg",{style:{width:"100%",height:"100%",pointerEvents:"auto"},onMouseMove:C,onMouseLeave:()=>{a(!1),r?.(null)},onClick:s?y=>{y.stopPropagation(),i?.({type:"arrow",index:e,object:t})}:void 0,children:[j.jsx("line",{x1:c.shaftStart.x,y1:c.shaftStart.y,x2:c.shaftEnd.x,y2:c.shaftEnd.y,stroke:p,strokeWidth:u,strokeLinecap:"round",pointerEvents:"stroke"}),c.heads.map((y,E)=>j.jsx("polygon",{points:`${y.tip.x},${y.tip.y} ${y.leftWing.x},${y.leftWing.y} ${y.rightWing.x},${y.rightWing.y}`,fill:p},E))]})})},GYo=({circle:t,interactiveState:e,index:n})=>{const o=Nf[n%Nf.length];let{center:i,radius:r,fill:s,stroke:a,layer:A,step:c,label:l}=t;const{activeLayers:g,activeStep:u,realToScreen:h,onObjectClicked:d,setHoverTooltip:_}=e,[m,p]=ne.useState(!1),I=_g(h,i),f=r*h.a;let C=s||o;return m&&(C=OB(.2,C),a=a&&OB(.2,a)),ne.useEffect(()=>{if(!(!m||!l))return _?.({text:l,x:I.x,y:I.y-f}),()=>{_?.(null)}},[m,l,I.x,I.y,f,_]),j.jsx("div",{style:{position:"absolute",left:I.x-f,top:I.y-f,width:f*2,height:f*2,borderRadius:"50%",backgroundColor:C,border:a?`2px solid ${a}`:"none",cursor:"pointer",transition:"border-color 0.2s"},onMouseEnter:()=>p(!0),onMouseLeave:()=>{p(!1),_?.(null)},onClick:()=>d?.({type:"circle",index:n,object:t})})},OYo=({x:t,y:e,onSaveCamera:n,onLoadCamera:o,onClearCamera:i,onAddMark:r,onClearMarks:s,onClose:a})=>{const A=ne.useRef(null);ne.useEffect(()=>{const h=d=>{A.current&&!A.current.contains(d.target)&&a()};return document.addEventListener("mousedown",h),()=>{document.removeEventListener("mousedown",h)}},[a]);const c={position:"absolute",left:t,top:e,backgroundColor:"white",border:"1px solid #ccc",borderRadius:3,boxShadow:"0 2px 6px rgba(0,0,0,0.1)",padding:0,zIndex:1e3,minWidth:160,fontSize:"12px"},l={padding:"4px 8px",cursor:"pointer",userSelect:"none",lineHeight:"1.5"},g=h=>{h.currentTarget.style.backgroundColor="#f5f5f5"},u=h=>{h.currentTarget.style.backgroundColor=""};return j.jsxs("div",{ref:A,style:c,children:[j.jsx("div",{style:l,onClick:()=>{n(),a()},onMouseEnter:g,onMouseLeave:u,children:"Save Camera Position"}),j.jsx("div",{style:l,onClick:()=>{o(),a()},onMouseEnter:g,onMouseLeave:u,children:"Load Camera Position"}),j.jsx("div",{style:l,onClick:()=>{i(),a()},onMouseEnter:g,onMouseLeave:u,children:"Clear Saved Camera Position"}),j.jsx("div",{style:l,onClick:()=>{r(),a()},onMouseEnter:g,onMouseLeave:u,children:"Add Mark"}),j.jsx("div",{style:l,onClick:()=>{s(),a()},onMouseEnter:g,onMouseLeave:u,children:"Clear Marks"})]})},KYo=({infiniteLine:t,index:e,interactiveState:n,size:o})=>{const{realToScreen:i,onObjectClicked:r,setHoverTooltip:s}=n,[a,A]=ne.useState(!1),c=nqn(i,o.width,o.height),l=tqn(t,c);if(!l)return null;const[g,u]=l,h=_g(i,g),d=_g(i,u),_=t.strokeColor??Nf[e%Nf.length],m=(t.strokeWidth??1/Math.abs(i.a))*Math.abs(i.a),p=(h.x+d.x)/2,I=(h.y+d.y)/2;return j.jsx("div",{style:{position:"absolute",top:0,left:0,width:o.width,height:o.height,pointerEvents:"none"},children:j.jsxs("svg",{style:{width:o.width,height:o.height,pointerEvents:"none"},children:[j.jsx("line",{x1:h.x,y1:h.y,x2:d.x,y2:d.y,stroke:"transparent",strokeWidth:m+10,pointerEvents:"stroke",onMouseEnter:()=>{A(!0),t.label&&s?.({text:t.label,x:p,y:I})},onMouseLeave:()=>{A(!1),s?.(null)},onClick:()=>r?.({type:"infinite-line",index:e,object:t})}),j.jsx("line",{x1:h.x,y1:h.y,x2:d.x,y2:d.y,stroke:a?OB(.2,_):_,strokeWidth:m,strokeDasharray:t.strokeDash?typeof t.strokeDash=="string"?t.strokeDash:t.strokeDash.map(f=>f*Math.abs(i.a)).join(","):void 0,pointerEvents:"none"})]})})},UYo=({line:t,index:e,interactiveState:n,size:o,mousePosition:i})=>{const{activeLayers:r,activeStep:s,realToScreen:a,onObjectClicked:A,setHoverTooltip:c}=n,{points:l,layer:g,step:u,strokeColor:h,strokeWidth:d=1/a.a,strokeDash:_}=t,m=l.map(Q=>_g(a,Q)),p=d*Math.abs(a.a),C=Math.max(p/2+3,6),y=C*2,E=ne.useMemo(()=>{if(!i)return!1;for(let Q=0;Q<m.length-1;Q++)if(xLt(i.x,i.y,m[Q].x,m[Q].y,m[Q+1].x,m[Q+1].y)<=C)return!0;return!1},[C,i,m]),B=h??Nf[e%Nf.length];return ne.useEffect(()=>{if(!(!E||!t.label||!i))return c?.({text:t.label,x:i.x,y:i.y}),()=>{c?.(null)}},[E,t.label,i?.x,i?.y,c]),j.jsx("div",{style:{position:"absolute",top:0,left:0,width:o.width,height:o.height,pointerEvents:"none"},children:j.jsxs("svg",{style:{width:o.width,height:o.height,overflow:"visible",pointerEvents:"none"},children:[j.jsx("polyline",{points:m.map(Q=>`${Q.x},${Q.y}`).join(" "),stroke:"transparent",fill:"none",strokeWidth:y,strokeLinecap:"round",strokeLinejoin:"round",pointerEvents:"stroke",onClick:E?()=>A?.({type:"line",index:e,object:t}):void 0}),j.jsx("polyline",{points:m.map(Q=>`${Q.x},${Q.y}`).join(" "),stroke:E?OB(.2,B):B,fill:"none",strokeWidth:p,strokeDasharray:_?typeof _=="string"?_:`${_[0]*Math.abs(a.a)}, ${_[1]*Math.abs(a.a)}`:void 0,strokeLinecap:"round",strokeLinejoin:"round",pointerEvents:"none"})]})})},YYo=({marker:t,transform:e})=>{const[n,o]=_g(e,[t.x,t.y]);return j.jsx("svg",{style:{position:"absolute",top:0,left:0,pointerEvents:"none",zIndex:900},children:j.jsxs("g",{transform:`translate(${n}, ${o})`,children:[j.jsx("circle",{r:7,fill:"rgba(255, 0, 0, 0.5)",stroke:"rgba(255, 0, 0, 0.8)",strokeWidth:2}),j.jsx("circle",{r:2,fill:"rgba(255, 0, 0, 0.9)"})]})})},zYo=({point:t,interactiveState:e,index:n})=>{const{color:o,label:i,layer:r,step:s}=t,{activeLayers:a,activeStep:A,realToScreen:c,onObjectClicked:l,setHoverTooltip:g}=e,[u,h]=ne.useState(!1),d=_g(c,t),_=10,m=`${i?`${i}
5761
5761
  `:""}x: ${t.x.toFixed(2)}, y: ${t.y.toFixed(2)}`;return ne.useEffect(()=>{if(u)return g?.({text:m,x:d.x,y:d.y-_/2}),()=>{g?.(null)}},[u,d.x,d.y,g,m]),j.jsx("div",{style:{position:"absolute",left:d.x-_/2,top:d.y-_/2,width:_,height:_,borderRadius:"50%",border:`2px solid ${u?OB(.2,o??Nf[n%Nf.length]):o??Nf[n%Nf.length]}`,cursor:"pointer",transition:"border-color 0.2s"},onMouseEnter:()=>h(!0),onMouseLeave:()=>{h(!1),g?.(null)},onClick:()=>l?.({type:"point",index:n,object:t})})},VYo=({polygon:t,interactiveState:e,index:n})=>{const{points:o,fill:i,stroke:r,strokeWidth:s}=t,{realToScreen:a,onObjectClicked:A,setHoverTooltip:c}=e,[l,g]=ne.useState(!1),u=!!(o&&o.length>0),h=u?o.map(q=>_g(a,q)):[],d=h.map(q=>q.x),_=h.map(q=>q.y),m=u?Math.min(...d):0,p=u?Math.max(...d):0,I=u?Math.min(..._):0,f=u?Math.max(..._):0,C=4,y=m-C,E=I-C,B=Math.max(p-m,0)+C*2,Q=Math.max(f-I,0)+C*2,b=h.map(q=>({x:q.x-y,y:q.y-E})),D=Nf[n%Nf.length],w=i!==void 0||r!==void 0?i||"transparent":D,H=r,G=l?OB(.2,w):w,K=H?l?OB(.2,H):H:void 0,U=s===void 0?void 0:s*a.a;return ne.useEffect(()=>{if(!(!u||!l||!t.label))return c?.({text:t.label,x:(m+p)/2,y:E}),()=>{c?.(null)}},[u,l,p,m,t.label,c,E]),u?j.jsx("div",{style:{position:"absolute",top:E,left:y,width:B,height:Q,pointerEvents:"none"},children:j.jsx("svg",{width:B,height:Q,style:{display:"block"},children:j.jsx("polygon",{points:b.map(q=>`${q.x},${q.y}`).join(" "),fill:G,stroke:K??"none",strokeWidth:U,pointerEvents:"all",onMouseEnter:()=>g(!0),onMouseLeave:()=>{g(!1),c?.(null)},onClick:()=>A?.({type:"polygon",index:n,object:t})})})}):null},JYo=({rect:t,interactiveState:e,index:n})=>{const o=Nf[n%Nf.length];let{fill:i,stroke:r}=t;const{activeLayers:s,activeStep:a,realToScreen:A,onObjectClicked:c,setHoverTooltip:l}=e,[g,u]=ne.useState(!1),h=cqn(t,A);let _=i!==void 0||r!==void 0?i||"transparent":o;return g&&(_=OB(.2,_),r=OB(.2,r)),ne.useEffect(()=>{if(!(!g||!t.label))return l?.({text:t.label,x:h.center.x,y:h.center.y-h.height/2}),()=>{l?.(null)}},[g,h.center.x,h.center.y,h.height,t.label,l]),j.jsx("div",{style:{position:"absolute",left:h.center.x,top:h.center.y,width:h.width,height:h.height,transform:"translate(-50%, -50%)",pointerEvents:"none"},children:j.jsx("div",{style:{width:"100%",height:"100%",backgroundColor:_,border:r?`2px solid ${g?OB(.2,r):r}`:"none",boxSizing:"border-box",cursor:"pointer",transition:"border-color 0.2s",transformOrigin:"center",transform:`rotate(${h.angleDegrees}deg)`,pointerEvents:"auto"},onMouseEnter:()=>u(!0),onMouseLeave:()=>{u(!1),l?.(null)},onClick:()=>c?.({type:"rect",index:n,object:t})})})},qYo=({textObj:t,interactiveState:e,index:n})=>{const{realToScreen:o,onObjectClicked:i}=e,{x:r,y:s,text:a,color:A,fontSize:c,anchorSide:l}=t,g=_g(o,{x:r,y:s}),h={top_left:"translate(0%, 0%)",top_center:"translate(-50%, 0%)",top_right:"translate(-100%, 0%)",center_left:"translate(0%, -50%)",center:"translate(-50%, -50%)",center_right:"translate(-100%, -50%)",bottom_left:"translate(0%, -100%)",bottom_center:"translate(-50%, -100%)",bottom_right:"translate(-100%, -100%)"}[l??"center"];return j.jsx("div",{style:{position:"absolute",left:g.x,top:g.y,transform:h,color:A||"black",fontSize:c??12,whiteSpace:"pre",cursor:"default"},onClick:()=>i?.({type:"text",index:n,object:t}),children:a})},WYo=({text:t})=>j.jsx("div",{style:{background:"white",border:"1px solid #ccc",boxShadow:"0 0 10px 0 rgba(0, 0, 0, 0.1)",borderRadius:"4px",padding:"4px 8px",fontSize:"12px",minWidth:"120px",maxWidth:"300px",whiteSpace:"pre-wrap",overflowWrap:"anywhere",zIndex:100},children:t}),Ex=5,jYo=(t,e)=>ne.useMemo(()=>(n,o)=>{const i=_g(t,n),r=_g(t,o),s=-Ex,a=e.width+Ex,A=-Ex,c=e.height+Ex;if(i.x>=s&&i.x<=a&&i.y>=A&&i.y<=c||r.x>=s&&r.x<=a&&r.y>=A&&r.y<=c)return!0;const l=(g,u,h,d)=>{const _=(u.x-g.x)*(d.y-h.y)-(u.y-g.y)*(d.x-h.x);if(_===0)return!1;const m=((d.y-h.y)*(d.x-g.x)+(h.x-d.x)*(d.y-g.y))/_,p=((g.y-u.y)*(d.x-g.x)+(u.x-g.x)*(d.y-g.y))/_;return m>=0&&m<=1&&p>=0&&p<=1};return l(i,r,{x:s,y:A},{x:a,y:A})||l(i,r,{x:a,y:A},{x:a,y:c})||l(i,r,{x:s,y:c},{x:a,y:c})||l(i,r,{x:s,y:A},{x:s,y:c})},[t,e]),XYo=(t,e)=>ne.useMemo(()=>n=>{const o=_g(t,n);return o.x>=-Ex&&o.x<=e.width+Ex&&o.y>=-Ex&&o.y<=e.height+Ex},[t,e]),$Yo=({isPointOnScreen:t,doesLineIntersectViewport:e,filterLayerAndStep:n})=>ne.useMemo(()=>o=>{if(!n(o))return!1;if(o.points.some(i=>t(i)))return!0;for(let i=0;i<o.points.length-1;i++)if(e(o.points[i],o.points[i+1]))return!0;return!!(o.points.length>2&&o.closed&&e(o.points[o.points.length-1],o.points[0]))},[t,e,n]),ZYo=({isPointOnScreen:t,filterLayerAndStep:e})=>ne.useMemo(()=>n=>e(n)?t(n):!1,[t,e]),ezo=({realToScreen:t,isPointOnScreen:e,doesLineIntersectViewport:n,filterLayerAndStep:o})=>ne.useMemo(()=>i=>{if(!o(i))return!1;const{center:r}=i,[s,a,A,c]=Zmt(i,t);return e(r)||e(s)||e(a)||e(A)||e(c)?!0:n(s,a)||n(a,A)||n(A,c)||n(c,s)},[t,e,n,o]),tzo=({isPointOnScreen:t,filterLayerAndStep:e,realToScreen:n,size:o})=>ne.useMemo(()=>i=>{if(!e(i))return!1;const{center:r,radius:s}=i;if(t(r)||t({x:r.x+s,y:r.y})||t({x:r.x-s,y:r.y})||t({x:r.x,y:r.y+s})||t({x:r.x,y:r.y-s}))return!0;const a=_g(n,r),A=Math.abs(n.a),c=s*A,l=-Ex,g=o.width+Ex,u=-Ex,h=o.height+Ex;if(a.x>=l&&a.x<=g&&(Math.abs(a.y-u)<=c||Math.abs(a.y-h)<=c)||a.y>=u&&a.y<=h&&(Math.abs(a.x-l)<=c||Math.abs(a.x-g)<=c))return!0;const d=(m,p)=>{const I=a.x-m,f=a.y-p;return I*I+f*f},_=c*c;return d(l,u)<=_||d(g,u)<=_||d(l,h)<=_||d(g,h)<=_},[t,e,n,o]),nzo=({isPointOnScreen:t,filterLayerAndStep:e})=>ne.useMemo(()=>n=>e(n)?t({x:n.x,y:n.y}):!1,[t,e]),ozo=({isPointOnScreen:t,doesLineIntersectViewport:e})=>ne.useMemo(()=>n=>{const o=gEe(n),{shaftStart:i,shaftEnd:r,heads:s}=o;return t(i)||t(r)||s.some(A=>t(A.tip)||t(A.leftWing)||t(A.rightWing)||t(A.base))?!0:[[i,r],...s.flatMap(A=>[[A.base,A.leftWing],[A.leftWing,A.tip],[A.tip,A.rightWing],[A.rightWing,A.base]])].some(([A,c])=>e(A,c))},[t,e]),izo=({isPointOnScreen:t,doesLineIntersectViewport:e,filterLayerAndStep:n})=>ne.useMemo(()=>o=>{if(!n(o)||!o.points||o.points.length===0)return!1;if(o.points.some(i=>t(i)))return!0;for(let i=0;i<o.points.length;i++){const r=o.points[i],s=o.points[(i+1)%o.points.length];if(e(r,s))return!0}return!1},[t,e,n]),rzo=1e3,szo=({graphics:t,onObjectClicked:e,objectLimit:n,height:o=600,stepMetadata:i,alwaysShowToolbar:r=!1})=>{const[s,a]=ne.useState(null),[A,c]=ne.useState(null),[l,g]=ne.useState(!0),[u,h]=ne.useState({width:600,height:o}),[d,_]=ne.useState(null),[m,p]=ne.useState(!1),[I,f]=ne.useState(null),[C,y]=ne.useState([]),[E,B]=ne.useState(null),[Q,b]=ne.useState(null),D=Array.from(new Set([...t.lines?.map(mt=>mt.layer).filter(Boolean)??[],...t.infiniteLines?.map(mt=>mt.layer).filter(Boolean)??[],...t.rects?.map(mt=>mt.layer).filter(Boolean)??[],...t.polygons?.map(mt=>mt.layer).filter(Boolean)??[],...t.points?.map(mt=>mt.layer).filter(Boolean)??[],...t.texts?.map(mt=>mt.layer).filter(Boolean)??[],...t.circles?.map(mt=>mt.layer).filter(Boolean)??[]])),R=NYo(t),w=ne.useMemo(()=>{const mt=wYo(t),Pt=mt.maxX-mt.minX,Ft=mt.maxY-mt.minY;return{minX:mt.minX-Pt/10,minY:mt.minY-Ft/10,maxX:mt.maxX+Pt/10,maxY:mt.maxY+Ft/10}},[t]),H=ne.useCallback(()=>{const mt=window.location.pathname,Pt=window.location.search;return`saved-camera-position-${mt}${Pt}`},[]),G=ne.useCallback(()=>{const mt=Math.max(w.maxX-w.minX,1),Pt=Math.max(w.maxY-w.minY,1),Ft=Math.min(u.width/mt,u.height/Pt);return $Jn(ste(u.width/2,u.height/2),ZJn(Ft,-Ft),ste(-(w.maxX+w.minX)/2,-(w.maxY+w.minY)/2))},[u,w]),K=ne.useCallback(()=>{try{const mt=localStorage.getItem(H());if(mt)return JSON.parse(mt)}catch(mt){console.error("Error loading saved data:",mt)}return null},[H]),U=ne.useCallback(()=>K()?.transform||null,[K]),{transform:q,ref:W,setTransform:ee}=TFo({initialTransform:G()});PYo(W,mt=>{h({width:mt.contentRect.width,height:mt.contentRect.height})}),ne.useEffect(()=>{const mt=K();mt?.markers&&y(mt.markers)},[K]);const re=ne.useCallback(mt=>{mt.preventDefault();const Pt=mt.clientX,Ft=mt.clientY,Zt=mt.currentTarget.getBoundingClientRect(),en=Zt.left,Ut=Zt.top,fe=window.innerWidth,st=window.innerHeight,ct=160,ht=100;let Tt=Pt-en,Ht=Ft-Ut;Pt>fe/2&&(Tt=Tt-ct),Ft>st/2&&(Ht=Ht-ht),_({x:Tt,y:Ht,clientX:Pt,clientY:Ft})},[]),X=ne.useCallback((mt,Pt)=>{try{const Ft={transform:mt,markers:Pt};localStorage.setItem(H(),JSON.stringify(Ft))}catch(Ft){console.error("Error saving data:",Ft)}},[H]),te=ne.useCallback(()=>{X(q,C)},[X,q,C]),se=ne.useCallback(()=>{try{const mt=U();mt&&ee(mt)}catch(mt){console.error("Error loading camera position:",mt)}},[U,ee]),le=ne.useCallback(()=>{try{const mt=G();X(mt,C),ee(mt)}catch(mt){console.error("Error clearing camera position:",mt)}},[X,G,ee,C]),ue=ne.useCallback(()=>{if(d)try{const mt={x:d.clientX,y:d.clientY},Pt=W.current?.getBoundingClientRect();if(Pt){const Ft=mt.x-Pt.left,Zt=mt.y-Pt.top,en=AEe(q),[Ut,fe]=_g(en,[Ft,Zt]),st={x:Ut,y:fe},ct=[...C,st];y(ct);const ht=K();ht?.transform&&X(ht.transform,ct)}}catch(mt){console.error("Error adding marker:",mt)}},[d,W,q,C,X]),Ce=ne.useCallback(()=>{y([]);const mt=K();mt?.transform&&X(mt.transform,[])},[K,X]),Ee=ne.useCallback(mt=>{switch(mt.type){case"arrow":return[mt.object.label,mt.object.inlineLabel].filter(Boolean).join(`
5762
5762
  `);case"text":return mt.object.text??"";default:return mt.object.label??""}},[]),Be=ne.useCallback(mt=>{if(e?.(mt),!m)return;const Pt=Ee(mt);f(Pt||null)},[m,Ee,e]);ne.useEffect(()=>{if(!I)return;const mt=Pt=>{Pt.key==="Escape"&&f(null)};return window.addEventListener("keydown",mt),()=>{window.removeEventListener("keydown",mt)}},[I]);const _e={activeLayers:s,activeStep:l?R:A,realToScreen:q,onObjectClicked:Be,setHoverTooltip:b},ye=R>0?i?.[l?R:A??-1]?.title:void 0,pe=XYo(q,u),we=jYo(q,u),Ge=mt=>{if(s&&mt.layer&&!s.includes(mt.layer))return!1;const Pt=l?R:A;return!(Pt!==null&&mt.step!==void 0&&mt.step!==Pt)},Ve=$Yo({isPointOnScreen:pe,doesLineIntersectViewport:we,filterLayerAndStep:Ge}),Ie=ZYo({isPointOnScreen:pe,filterLayerAndStep:Ge}),qe=ezo({realToScreen:q,isPointOnScreen:pe,doesLineIntersectViewport:we,filterLayerAndStep:Ge}),Me=tzo({isPointOnScreen:pe,filterLayerAndStep:Ge,realToScreen:q,size:u}),Fe=nzo({isPointOnScreen:pe,filterLayerAndStep:Ge}),Ye=ozo({isPointOnScreen:pe,doesLineIntersectViewport:we}),Ne=izo({isPointOnScreen:pe,doesLineIntersectViewport:we,filterLayerAndStep:Ge}),De=(mt,Pt)=>{if(!mt)return[];const Ft=mt.map((Zt,en)=>({...Zt,originalIndex:en})).filter(Pt);return n?Ft.slice(-n):Ft},Ke=ne.useMemo(()=>De(t.lines,Ve).sort((mt,Pt)=>(mt.zIndex??0)-(Pt.zIndex??0)||mt.originalIndex-Pt.originalIndex),[t.lines,Ve,n]),ve=ne.useMemo(()=>De(t.infiniteLines,Ge),[t.infiniteLines,Ge,n]),Je=ne.useMemo(()=>RYo(De(t.rects,qe)),[t.rects,qe,n]),$e=ne.useMemo(()=>De(t.polygons,Ne),[t.polygons,Ne,n]),at=ne.useMemo(()=>De(t.points,Ie),[t.points,Ie,n]),gt=ne.useMemo(()=>De(t.circles,Me),[t.circles,Me,n]),dt=ne.useMemo(()=>De(t.texts,Fe),[t.texts,Fe,n]),lt=ne.useMemo(()=>De(t.arrows,Ye),[t.arrows,Ye,n]),nt=ve.length+Ke.length+Je.length+$e.length+at.length+gt.length+dt.length+lt.length,xt=n&&nt>n;return j.jsxs("div",{children:[j.jsxs("div",{style:{margin:8,display:"flex",alignItems:"center",gap:12,flexWrap:"wrap"},children:[D.length>1&&j.jsxs("select",{value:s?s[0]:"",onChange:mt=>{const Pt=mt.target.value;a(Pt===""?null:[Pt])},style:{marginRight:8},children:[j.jsx("option",{value:"",children:"All Layers"}),D.map(mt=>j.jsx("option",{value:mt,children:mt},mt))]}),R>0&&j.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:8},children:["Step:",j.jsx("input",{type:"number",min:0,max:R,value:A??0,onChange:mt=>{const Pt=parseInt(mt.target.value);g(!1),c(Number.isNaN(Pt)?null:Pt)},disabled:A===null}),j.jsxs("label",{children:[j.jsx("input",{type:"checkbox",style:{marginRight:4},checked:A!==null,onChange:mt=>{g(!1),c(mt.target.checked?0:null)}}),"Filter by step"]}),j.jsxs("label",{children:[j.jsx("input",{type:"checkbox",style:{marginRight:4},checked:l,onChange:mt=>{g(mt.target.checked),c(null)}}),"Show last step"]}),xt&&j.jsxs("span",{style:{color:"red",fontSize:"12px"},children:["Display limited to ",n," objects. Received:"," ",nt,"."]})]}),j.jsxs("label",{children:[j.jsx("input",{type:"checkbox",style:{marginRight:4},checked:m,onChange:mt=>{const Pt=mt.target.checked;p(Pt),Pt||f(null)}}),"Enable Object Interation"]}),R>0&&ye&&j.jsx("div",{style:{marginLeft:"auto",textAlign:"right"},children:ye})]}),j.jsxs("div",{ref:W,style:{position:"relative",height:o,overflow:"hidden"},onMouseMove:mt=>{const Pt=W.current?.getBoundingClientRect();Pt&&B({x:mt.clientX-Pt.left,y:mt.clientY-Pt.top})},onMouseLeave:()=>B(null),onContextMenu:re,children:[j.jsxs(FYo,{transform:q,children:[lt.map(mt=>j.jsx(HYo,{arrow:mt,index:mt.originalIndex,interactiveState:_e},mt.originalIndex)),ve.map(mt=>j.jsx(KYo,{infiniteLine:mt,index:mt.originalIndex,interactiveState:_e,size:u},mt.originalIndex)),Ke.map(mt=>j.jsx(UYo,{line:mt,index:mt.originalIndex,interactiveState:_e,size:u,mousePosition:E},mt.originalIndex)),Je.map(mt=>j.jsx(JYo,{rect:mt,index:mt.originalIndex,interactiveState:_e},mt.originalIndex)),$e.map(mt=>j.jsx(VYo,{polygon:mt,index:mt.originalIndex,interactiveState:_e},mt.originalIndex)),gt.map(mt=>j.jsx(GYo,{circle:mt,index:mt.originalIndex,interactiveState:_e},mt.originalIndex)),dt.map(mt=>j.jsx(qYo,{textObj:mt,index:mt.originalIndex,interactiveState:_e},mt.originalIndex)),at.map(mt=>j.jsx(zYo,{point:mt,index:mt.originalIndex,interactiveState:_e},mt.originalIndex)),j.jsx(Zre.SuperGrid,{stringifyCoord:(mt,Pt)=>`${mt.toFixed(2)}, ${Pt.toFixed(2)}`,width:u.width,height:u.height,transform:q})]}),C.map((mt,Pt)=>j.jsx(YYo,{marker:mt,index:Pt,transform:q},Pt)),Q&&j.jsx("div",{style:{position:"absolute",left:Q.x,top:Q.y-8,transform:"translate(-50%, -100%)",pointerEvents:"none",zIndex:rzo},children:j.jsx(WYo,{text:Q.text})}),d&&j.jsx(OYo,{x:d.x,y:d.y,onSaveCamera:te,onLoadCamera:se,onClearCamera:le,onAddMark:ue,onClearMarks:Ce,onClose:()=>_(null)}),I&&j.jsx(LYo,{label:I,onClose:()=>{f(null)}})]})]})},AY=t=>{if(t===null||typeof t!="object")return t;if(Array.isArray(t))return t.map(AY);const e={};for(const[n,o]of Object.entries(t))n.startsWith("_")||(e[n]=AY(o));return e},azo=({solver:t,className:e=""})=>{const[n,o]=ne.useState(!1),i=ne.useRef(null);ne.useEffect(()=>{const A=c=>{i.current&&!i.current.contains(c.target)&&o(!1)};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[]);const r=()=>{try{if(typeof t.getConstructorParams!="function"){alert(`getConstructorParams() is not implemented for ${t.constructor.name}`);return}const A=AY(t.getConstructorParams()),c=new Blob([JSON.stringify(A,null,2)],{type:"application/json"}),l=URL.createObjectURL(c),g=document.createElement("a");g.href=l,g.download=`${t.constructor.name}_params.json`,g.click(),URL.revokeObjectURL(l)}catch(A){alert(`Error downloading params for ${t.constructor.name}: ${A instanceof Error?A.message:String(A)}`)}o(!1)},s=()=>{try{const A=AY(t.getConstructorParams()),c=t.constructor.name,l=c==="SchematicTracePipelineSolver";let g;l?g=`import { PipelineDebugger } from "site/components/PipelineDebugger"
@@ -5791,7 +5791,7 @@ test("${c} should solve problem correctly", () => {
5791
5791
  // Add more specific assertions based on expected output
5792
5792
  // expect(solver.netLabelPlacementSolver!.netLabelPlacements).toMatchInlineSnapshot()
5793
5793
  })
5794
- `,g=new Blob([l],{type:"text/plain"}),u=URL.createObjectURL(g),h=document.createElement("a");h.href=u,h.download=`${c}.test.ts`,h.click(),URL.revokeObjectURL(u)}catch(A){alert(`Error generating test.ts for ${t.constructor.name}: ${A instanceof Error?A.message:String(A)}`)}o(!1)};return j.jsxs("div",{className:`relative ${e}`,ref:i,children:[j.jsx("button",{className:"px-2 py-1 rounded text-xs cursor-pointer",onClick:()=>o(!n),title:`Download options for ${t.constructor.name}`,children:t.constructor.name}),n&&j.jsxs("div",{className:"absolute top-full left-0 mt-1 bg-white border border-gray-300 rounded shadow-lg z-10 min-w-[150px]",children:[j.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:r,children:"Download JSON"}),j.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:s,children:"Download page.tsx"}),j.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:a,children:"Download test.ts"})]})]})},BLt=t=>t.activeSubSolver?[t,...BLt(t.activeSubSolver)]:[t],Azo=({solver:t})=>{const e=BLt(t);return j.jsx("div",{className:"flex gap-1 items-center text-sm pt-1",children:e.map((n,o)=>j.jsxs("div",{className:"flex items-center",children:[o>0&&j.jsx("span",{className:"text-gray-400 mx-1",children:"→"}),j.jsx(azo,{solver:n})]},n.constructor.name))})},czo=({solver:t,triggerRender:e,animationSpeed:n=25,onSolverStarted:o,onSolverCompleted:i})=>{const[r,s]=ne.useReducer(_=>!_,!1),a=ne.useRef(void 0),A=()=>{!t.solved&&!t.failed&&(t.step(),e())},c=()=>{!t.solved&&!t.failed&&(o&&o(t),t.solve(),e(),i&&i(t))},l=()=>{r?(a.current&&(clearInterval(a.current),a.current=void 0),s()):(s(),a.current=setInterval(()=>{if(t.solved||t.failed){a.current&&(clearInterval(a.current),a.current=void 0),s(),e(),i&&t.solved&&i(t);return}t.step(),e()},n))},g=()=>{const _=t;if(_.getCurrentPhase&&!t.solved&&!t.failed){const m=_.getCurrentPhase();for(;_.getCurrentPhase()===m&&!t.solved&&!t.failed;)t.step();e()}},u=()=>{if(t.solved||t.failed||r)return;const _=window.prompt("Step until which iteration?",`${t.iterations}`);if(_===null)return;const m=Number(_);if(!Number.isFinite(m)){window.alert("Please enter a valid number for the iteration");return}for(;t.iterations<m&&!t.solved&&!t.failed;)t.step();e(),t.solved&&i&&i(t)};ne.useEffect(()=>()=>{a.current&&clearInterval(a.current)},[]),ne.useEffect(()=>{(t.solved||t.failed)&&r&&(a.current&&(clearInterval(a.current),a.current=void 0),s())},[t.solved,t.failed,r]);const h=t.getCurrentPhase!==void 0,d=h?t.getCurrentPhase():null;return j.jsxs("div",{className:"space-y-2 p-2 border-b",children:[j.jsx("div",{className:"flex items-center",children:j.jsx(Azo,{solver:t})}),j.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[j.jsx("button",{onClick:A,disabled:t.solved||t.failed||r,className:"bg-blue-500 hover:bg-blue-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step"}),j.jsx("button",{onClick:c,disabled:t.solved||t.failed||r,className:"bg-green-500 hover:bg-green-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Solve"}),j.jsx("button",{onClick:l,disabled:t.solved||t.failed,className:`px-3 py-1 rounded text-white text-sm ${r?"bg-red-500 hover:bg-red-600":"bg-yellow-500 hover:bg-yellow-600"} disabled:bg-gray-300`,children:r?"Stop":"Animate"}),j.jsx("button",{onClick:u,disabled:t.solved||t.failed||r,className:"bg-orange-500 hover:bg-orange-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step Until Iteration"}),h&&j.jsx("button",{onClick:g,disabled:t.solved||t.failed||r,className:"bg-purple-500 hover:bg-purple-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Next Stage"}),j.jsxs("div",{className:"text-sm text-gray-600",children:["Iterations: ",t.iterations]}),t.timeToSolve!==void 0&&j.jsxs("div",{className:"text-sm text-gray-600",children:["Time: ",(t.timeToSolve/1e3).toFixed(3),"s"]}),d&&j.jsxs("div",{className:"text-sm text-gray-600",children:["Phase: ",j.jsx("span",{className:"font-medium",children:d})]}),t.solved&&j.jsx("div",{className:"px-2 py-1 bg-green-100 text-green-800 rounded text-sm",children:"Solved"}),t.failed&&j.jsx("div",{className:"px-2 py-1 bg-red-100 text-red-800 rounded text-sm",children:"Failed"})]}),t.error&&j.jsxs("div",{className:"text-red-600 text-sm",children:["Error: ",t.error]})]})},lzo=(t,e,n)=>{const o=t.currentPipelineStepIndex;return e<o?"Completed":e===o&&t.activeSubSolver?t.activeSubSolver.failed?"Failed":"In Progress":"Not Started"},gzo=(t,e)=>{const o=t.pipelineDef[e].solverName,i=lzo(t,e),r=t[o],s=t.firstIterationOfPhase?.[o]??null,a=t.iterations;let A=0;if(i==="Completed"){const u=t.pipelineDef[e+1],h=u?t.firstIterationOfPhase?.[u.solverName]:void 0;h!==void 0&&s!==null?A=h-s:s!==null&&(A=a-s)}else i==="In Progress"&&s!==null&&(A=a-s);const c=t.timeSpentOnPhase?.[o]??0;let l=0;i==="Completed"?l=1:i==="In Progress"&&r&&(l=r.progress??0);const g=r?.stats??null;return{index:e,name:o,status:i,firstIteration:s,iterations:A,progress:l,timeSpent:c,stats:g&&Object.keys(g).length>0?g:null,solverInstance:r??null}},uzo=({status:t})=>{const e={"Not Started":"text-blue-600","In Progress":"text-yellow-600",Completed:"text-green-600",Failed:"text-red-600"};return j.jsx("span",{className:`font-medium ${e[t]}`,children:t})},dzo=({progress:t})=>{if(t===0)return null;const e=Math.round(t*100);return j.jsxs("div",{className:"flex items-center gap-2",children:[j.jsx("div",{className:"w-20 h-2 bg-gray-200 rounded overflow-hidden",children:j.jsx("div",{className:"h-full bg-blue-500 transition-all duration-200",style:{width:`${e}%`}})}),j.jsxs("span",{className:"text-xs text-gray-500",children:[e,"%"]})]})},hzo=t=>Object.entries(t).map(([e,n])=>`${e}: ${n}`).join(", "),_zo=({stats:t})=>{if(!t||Object.keys(t).length===0)return j.jsx("span",{children:"-"});const e=Object.entries(t),n=hzo(t);return j.jsxs("details",{className:"cursor-pointer",children:[j.jsx("summary",{className:"whitespace-nowrap overflow-hidden text-ellipsis max-w-[200px]",children:n}),j.jsx("div",{className:"mt-1 text-xs",children:e.map(([o,i])=>j.jsxs("div",{children:[o,": ",String(i)]},o))})]})},V8e=t=>{if(t===null||typeof t!="object")return t;if(Array.isArray(t))return t.map(V8e);const e={};for(const[n,o]of Object.entries(t))n.startsWith("_")||(e[n]=V8e(o));return e},mzo=(t,e)=>{try{if(typeof t.getConstructorParams!="function"){alert(`getConstructorParams() is not implemented for ${e}`);return}const n=V8e(t.getConstructorParams()),o=new Blob([JSON.stringify(n,null,2)],{type:"application/json"}),i=URL.createObjectURL(o),r=document.createElement("a");r.href=i,r.download=`${e}_input.json`,r.click(),URL.revokeObjectURL(i)}catch(n){alert(`Error downloading input for ${e}: ${n instanceof Error?n.message:String(n)}`)}},pzo=({solver:t,onStepUntilPhase:e,onDownloadInput:n})=>{const o=t.pipelineDef.map((a,A)=>gzo(t,A)),i=a=>{e?.(a)},r=a=>{a.solverInstance&&(n?n(a.solverInstance,a.name):mzo(a.solverInstance,a.name))},s=a=>`${(a/1e3).toFixed(2)}s`;return j.jsxs("div",{className:"border-t border-gray-200",children:[j.jsx("div",{className:"px-4 py-2 bg-gray-50 border-b border-gray-200",children:j.jsx("h3",{className:"text-sm font-semibold text-gray-700",children:"Pipeline Steps"})}),j.jsx("div",{className:"overflow-x-auto",children:j.jsxs("table",{className:"w-full text-sm",children:[j.jsx("thead",{children:j.jsxs("tr",{className:"bg-gray-50 border-b border-gray-200",children:[j.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Step"}),j.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Status"}),j.jsxs("th",{className:"px-4 py-2 text-center font-semibold text-gray-700",children:["i",j.jsx("sub",{children:"0"})]}),j.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Iterations"}),j.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Progress"}),j.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Time"}),j.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Stats"}),j.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Input"})]})}),j.jsx("tbody",{children:o.map(a=>j.jsxs("tr",{className:`border-b border-gray-100 ${a.status==="In Progress"?"bg-yellow-50":""}`,children:[j.jsx("td",{className:"px-4 py-2",children:j.jsxs("div",{className:"flex items-center gap-2",children:[j.jsx("span",{className:"text-gray-400 w-6",children:String(a.index+1).padStart(2,"0")}),j.jsx("button",{onClick:()=>i(a.name),disabled:a.status==="Completed"||t.solved||t.failed,className:"text-blue-500 hover:text-blue-700 disabled:text-gray-300 disabled:cursor-not-allowed",title:`Step until ${a.name} completes`,children:j.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:j.jsx("path",{fillRule:"evenodd",d:"M4.5 5.653c0-1.426 1.529-2.33 2.779-1.643l11.54 6.348c1.295.712 1.295 2.573 0 3.285L7.28 19.991c-1.25.687-2.779-.217-2.779-1.643V5.653z",clipRule:"evenodd"})})}),j.jsx("span",{className:"font-medium text-gray-900",children:a.name})]})}),j.jsx("td",{className:"px-4 py-2",children:j.jsx(uzo,{status:a.status})}),j.jsx("td",{className:"px-4 py-2 text-center text-gray-600",children:a.firstIteration!==null?a.firstIteration:""}),j.jsx("td",{className:"px-4 py-2 text-gray-600",children:a.iterations}),j.jsx("td",{className:"px-4 py-2",children:j.jsx(dzo,{progress:a.progress})}),j.jsx("td",{className:"px-4 py-2 text-gray-600",children:s(a.timeSpent)}),j.jsx("td",{className:"px-4 py-2 text-gray-500",children:j.jsx(_zo,{stats:a.stats})}),j.jsx("td",{className:"px-4 py-2",children:a.solverInstance?j.jsxs("button",{onClick:()=>r(a),className:"flex items-center gap-1 text-blue-500 hover:text-blue-700",title:`Download input for ${a.name}`,children:[j.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:j.jsx("path",{fillRule:"evenodd",d:"M12 2.25a.75.75 0 01.75.75v11.69l3.22-3.22a.75.75 0 111.06 1.06l-4.5 4.5a.75.75 0 01-1.06 0l-4.5-4.5a.75.75 0 111.06-1.06l3.22 3.22V3a.75.75 0 01.75-.75zm-9 13.5a.75.75 0 01.75.75v2.25a1.5 1.5 0 001.5 1.5h13.5a1.5 1.5 0 001.5-1.5V16.5a.75.75 0 011.5 0v2.25a3 3 0 01-3 3H5.25a3 3 0 01-3-3V16.5a.75.75 0 01.75-.75z",clipRule:"evenodd"})}),j.jsx("span",{children:"Input"})]}):null})]},a.name))})]})})]})},Izo=class extends jr.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){console.error("InteractiveGraphics render error:",t)}render(){return this.state.hasError?this.props.fallback:this.props.children}};function fzo({graphics:t}){const e=t.points??[],n=t.lines??[],o=t.rects??[],i=t.circles??[],r=t.texts??[];let s=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,A=Number.NEGATIVE_INFINITY,c=Number.NEGATIVE_INFINITY;const l=(m,p)=>{typeof m=="number"&&(m<s&&(s=m),m>A&&(A=m)),typeof p=="number"&&(p<a&&(a=p),p>c&&(c=p))};for(const m of e)l(m.x,m.y);for(const m of n){const p=m.points??[];for(const I of p)l(I.x,I.y)}for(const m of o){const p=m.x??0,I=m.y??0,f=m.width??0,C=m.height??0;l(p,I),l(p+f,I+C)}for(const m of i){const p=m.x??0,I=m.y??0,f=m.radius??1;l(p-f,I-f),l(p+f,I+f)}for(const m of r)l(m.x,m.y);(!isFinite(s)||!isFinite(a)||!isFinite(A)||!isFinite(c))&&(s=-20,a=-20,A=20,c=20);const g=10,u=s-g,h=a-g,d=Math.max(1,A-s+2*g),_=Math.max(1,c-a+2*g);return j.jsxs("svg",{className:"w-full h-[400px] bg-white",viewBox:`${u} ${h} ${d} ${_}`,role:"img","aria-label":"Graphics fallback",children:[o.map((m,p)=>j.jsx("rect",{x:m.x??0,y:m.y??0,width:m.width??0,height:m.height??0,fill:"none",stroke:m.strokeColor??"black",strokeWidth:m.strokeWidth??1},`rect-${p}`)),n.map((m,p)=>j.jsx("polyline",{fill:"none",stroke:m.strokeColor??"black",strokeWidth:m.strokeWidth??1,points:(m.points??[]).map(I=>`${I.x??0},${I.y??0}`).join(" ")},`line-${p}`)),i.map((m,p)=>j.jsx("circle",{cx:m.x??0,cy:m.y??0,r:m.radius??1.5,fill:m.fillColor??"none",stroke:m.strokeColor??"black",strokeWidth:m.strokeWidth??1},`circle-${p}`)),e.map((m,p)=>j.jsx("circle",{cx:m.x??0,cy:m.y??0,r:m.radius??1.5,fill:m.color??"black"},`point-${p}`)),r.map((m,p)=>j.jsx("text",{x:m.x??0,y:m.y??0,fontSize:m.fontSize??10,fill:m.color??"black",children:m.text??""},`text-${p}`))]})}var Czo=({solver:t,animationSpeed:e=25,onSolverStarted:n,onSolverCompleted:o})=>{const[i,r]=ne.useReducer(l=>l+1,0),s=ne.useMemo(()=>{try{return t.visualize()||{points:[],lines:[],rects:[],circles:[]}}catch(l){return console.error("Visualization error:",l),{points:[],lines:[],rects:[],circles:[]}}},[t,i]),a=ne.useMemo(()=>(s.rects?.length||0)===0&&(s.lines?.length||0)===0&&(s.points?.length||0)===0&&(s.circles?.length||0)===0,[s]);ne.useEffect(()=>{if(!(typeof document>"u")&&!document.querySelector('script[src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"]')){const l=document.createElement("script");l.src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4",document.head.appendChild(l)}},[]);const A=t.pipelineDef!==void 0,c=l=>{const g=t;if(!t.solved&&!t.failed){for(;!t.solved&&!t.failed&&g.currentPipelineStepIndex<=g.pipelineDef.findIndex(u=>u.solverName===l);)t.step();r()}};return j.jsxs("div",{children:[j.jsx(czo,{solver:t,triggerRender:r,animationSpeed:e,onSolverStarted:n,onSolverCompleted:o}),a?j.jsx("div",{className:"p-4 text-gray-500",children:"No Graphics Yet"}):j.jsx(Izo,{fallback:j.jsx(fzo,{graphics:s}),children:j.jsx(szo,{graphics:s})}),A&&j.jsx(pzo,{solver:t,onStepUntilPhase:c})]})};const yzo=()=>{ne.useEffect(()=>{const t="tailwind-cdn-script";if(document.getElementById(t)||window.tailwind)return;const e=document.createElement("div");e.className="hidden",document.body.appendChild(e);const n=window.getComputedStyle(e).display==="none";if(document.body.removeChild(e),n)return;const o=document.createElement("script");o.id=t,o.src="https://cdn.tailwindcss.com",document.head.appendChild(o)},[])},Ezo=1e3,eb=(t,e)=>{const{fileName:n,mimeType:o="text/plain"}=e,i=t instanceof Blob?t:new Blob([t],{type:o}),r=URL.createObjectURL(i),s=document.createElement("a");s.href=r,s.download=n,s.target="_blank",s.rel="noopener noreferrer",s.style.display="none",document.body.appendChild(s),s.click(),document.body.removeChild(s),setTimeout(()=>{URL.revokeObjectURL(r)},Ezo)},QLt=t=>{let e=t.trim().replace(/[\\/:*?"<>|]/g,"_").replace(/[\x00-\x1f]/g,"").replace(/^\.+/,"").replace(/\.+$/,"").replace(/\s+/g," ").replace(/_+/g,"_");return/^(con|prn|aux|nul|com[0-9]|lpt[0-9])$/i.test(e)&&(e=`_${e}`),e=e.slice(0,200),e||"untitled"},tb="https://github.com/tscircuit/tscircuit-autorouter/issues/new",SLt="https://github.com/tscircuit/copper-pour-solver/issues/new",bLt="https://github.com/tscircuit/calculate-packing/issues/new",xzo="https://github.com/tscircuit/matchpack/issues/new",DLt="https://github.com/tscircuit/schematic-trace-solver/issues/new?template=json-bug-report.yml",Bzo={PackSolver2:bLt,LayoutPipelineSolver:xzo,AutoroutingPipelineSolver:tb,AssignableAutoroutingPipeline2:tb,AssignableAutoroutingPipeline3:tb,AutoroutingPipeline1_OriginalUnravel:tb,AutoroutingPipelineSolver3_HgPortPointPathing:tb,AutoroutingPipelineSolver4:tb,AutoroutingPipelineSolver5:tb,AutoroutingPipelineSolver7_MultiGraph:tb,AutoroutingPipelineSolver8:tb,CopperPourPipelineSolver:SLt,SchematicTracePipelineSolver:DLt},Qzo=t=>t.toLowerCase().includes("pack")?$No:t.toLowerCase().includes("rout")?rRo:zNo,PLt=t=>{const e=Bzo[t];if(e)return e;const n=t.toLowerCase();return n.includes("autorout")?tb:n.includes("schematic")&&n.includes("trace")?DLt:n.includes("copperpour")?SLt:n.includes("pack")?bLt:null},Szo=t=>`${QLt(`${t.componentName}-${t.solverName}`)}-solver-input.json`,vLt=t=>{eb(JSON.stringify(t.solverParams,null,2),{fileName:Szo(t),mimeType:"application/json"})},bzo=({solverEvent:t})=>{const e=PLt(t.solverName);return j.jsxs("div",{className:"rf-flex rf-items-center rf-justify-end rf-gap-2 rf-border-b rf-border-gray-200 rf-bg-gray-50 rf-px-4 rf-py-2",children:[j.jsxs(Sc,{type:"button",variant:"outline",size:"sm",onClick:()=>vLt(t),children:[j.jsx(R3e,{className:"rf-w-4 rf-h-4"}),"Download"]}),e?j.jsx(Sc,{asChild:!0,variant:"outline",size:"sm",children:j.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",children:[j.jsx(rre,{className:"rf-w-4 rf-h-4"}),"Report"]})}):j.jsxs(Sc,{type:"button",variant:"outline",size:"sm",disabled:!0,title:"No report link configured for this solver",children:[j.jsx(rre,{className:"rf-w-4 rf-h-4"}),"Report"]})]})},Dzo=({solverEvent:t})=>{const e=PLt(t.solverName);return e?j.jsx(Sc,{asChild:!0,variant:"ghost",size:"icon",className:"rf-h-8 rf-w-8",children:j.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",title:"Report solver bug","aria-label":"Report solver bug",children:j.jsx(rre,{className:"rf-w-4 rf-h-4"})})}):j.jsx(Sc,{type:"button",variant:"ghost",size:"icon",className:"rf-h-8 rf-w-8",disabled:!0,title:"No report link configured for this solver","aria-label":"Report solver bug",children:j.jsx(rre,{className:"rf-w-4 rf-h-4"})})},Pzo=({solverEvents:t=[]})=>{const[e,n]=ne.useState(null);yzo();const o=ne.useMemo(()=>{const a=new Map;for(const A of t){const c=`${A.componentName}-${A.solverName}`;a.set(c,A)}return a},[t]),i=ne.useMemo(()=>Array.from(o.keys()),[o]),r=e?o.get(e):null,s=ne.useMemo(()=>{if(!r)return{instance:null,error:null,classFound:!1};const a=oBe[r.solverName];if(!a)return{instance:null,error:`Solver class "${r.solverName}" not found in SOLVERS registry. Available: ${Object.keys(oBe).join(", ")}`,classFound:!1};try{const A=r.solverParams,c=A?.input!==void 0?A.input:A;return{instance:new a(c),error:null,classFound:!0}}catch(A){const c=A instanceof Error?A.message:String(A);return console.error("Failed to reconstruct solver:",A),{instance:null,error:`Failed to instantiate solver: ${c}`,classFound:!0}}},[r]);return t.length===0?j.jsx("div",{className:"rf-p-4",children:j.jsx("div",{className:"rf-bg-gray-50 rf-rounded-md rf-border rf-border-gray-200",children:j.jsxs("div",{className:"rf-p-4",children:[j.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800 rf-mb-3",children:"No Solvers Detected"}),j.jsx("p",{className:"rf-text-sm rf-text-gray-600",children:"Solvers will appear here when the circuit runs. Solvers are used for tasks like component packing and autorouting."})]})})}):j.jsxs("div",{className:"rf-flex rf-h-full rf-overflow-hidden",children:[j.jsxs("div",{className:"rf-w-64 rf-border-r rf-border-gray-200 rf-overflow-y-auto rf-flex-shrink-0",children:[j.jsxs("div",{className:"rf-text-xs rf-font-semibold rf-text-gray-500 rf-px-3 rf-py-2 rf-bg-gray-50 rf-border-b rf-border-gray-200",children:[i.length," ",i.length===1?"Solver":"Solvers"]}),i.map(a=>{const A=o.get(a),c=e===a;return j.jsx("div",{className:`rf-px-3 rf-py-2 rf-cursor-pointer rf-border-b rf-border-gray-100 ${c?"rf-bg-blue-50 rf-border-l-2 rf-border-l-blue-500":"hover:rf-bg-gray-50"}`,onClick:()=>n(a),children:(()=>{const l=Qzo(A.solverName);return j.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[j.jsx(l,{className:"rf-w-4 rf-h-4 rf-text-blue-500 rf-flex-shrink-0"}),j.jsxs("div",{className:"rf-flex-1 rf-min-w-0",children:[j.jsx("div",{className:"rf-text-sm rf-font-medium rf-text-gray-800 rf-truncate",children:A.componentName}),j.jsx("div",{className:"rf-text-xs rf-text-gray-500 rf-truncate",children:A.solverName})]})]})})()},a)})]}),j.jsx("div",{className:"rf-flex-1 rf-overflow-hidden",children:r?s.instance?j.jsxs("div",{className:"rf-flex rf-h-full rf-flex-col rf-overflow-y-auto",children:[j.jsx(bzo,{solverEvent:r}),j.jsx("div",{className:"rf-min-h-0 rf-flex-1",children:j.jsx(YS,{fallback:j.jsx("div",{className:"rf-p-4",children:j.jsxs("div",{className:"rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200 rf-p-4",children:[j.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-2",children:"Error Loading Solver Debugger"}),j.jsxs("p",{className:"rf-text-sm rf-text-red-600",children:["Failed to render the solver debugger for"," ",r.solverName]})]})}),children:j.jsx(Czo,{solver:s.instance})})})]}):j.jsxs("div",{className:"rf-p-4",children:[j.jsxs("div",{className:"rf-mb-4",children:[j.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800",children:r.solverName}),j.jsxs("p",{className:"rf-text-sm rf-text-gray-500",children:["Component: ",r.componentName]})]}),s.error&&j.jsx("div",{className:`rf-rounded-md rf-border rf-p-4 rf-mb-4 ${s.classFound?"rf-bg-red-50 rf-border-red-200":"rf-bg-yellow-50 rf-border-yellow-200"}`,children:j.jsx("p",{className:`rf-text-sm ${s.classFound?"rf-text-red-700":"rf-text-yellow-700"}`,children:s.error})}),j.jsxs("div",{className:"rf-border rf-border-gray-200 rf-rounded-md rf-overflow-hidden",children:[j.jsxs("div",{className:"rf-px-3 rf-py-2 rf-bg-gray-50 rf-flex rf-items-center rf-justify-between rf-gap-2",children:[j.jsx("span",{className:"rf-text-sm rf-font-medium rf-text-gray-700",children:"Solver Parameters"}),j.jsxs("div",{className:"rf-flex rf-items-center rf-gap-1",children:[j.jsx(Dzo,{solverEvent:r}),j.jsx(Sc,{type:"button",variant:"ghost",size:"icon",className:"rf-h-8 rf-w-8","aria-label":"Download solver input JSON",title:"Download solver input JSON",onClick:()=>vLt(r),children:j.jsx(R3e,{className:"rf-w-4 rf-h-4"})})]})]}),j.jsx("div",{className:"rf-p-3 rf-bg-white rf-border-t rf-border-gray-200",children:j.jsx("pre",{className:"rf-text-xs rf-font-mono rf-text-gray-600 rf-whitespace-pre-wrap rf-overflow-x-auto",children:JSON.stringify(r.solverParams,null,2)})})]})]}):j.jsx("div",{className:"rf-flex rf-items-center rf-justify-center rf-h-full",children:j.jsx("p",{className:"rf-text-sm rf-text-gray-500",children:"Select a solver from the list to view details"})})})]})},MLt=({errorMessage:t,errorStack:e,circuitJsonErrors:n})=>{ne.useEffect(()=>{if(t){const o=new Error(t);e&&(o.stack=e);try{v8.captureException(o)}catch{}}},[t,e]),ne.useEffect(()=>{if(n&&n.length>0)for(const o of n){const i=new Error(o.message||"Circuit JSON Error");o.stack&&(i.stack=o.stack);try{v8.captureException(i,{error_type:o.type})}catch{}}},[n])},vzo=t=>{ne.useEffect(()=>{try{XJt(t)}catch{}},[t.source,t.component,t.isWebEmbedded,t.activeTab])},wLt="0.0.2442",Mzo={version:wLt},J8e={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},q8e=new Map,Cse=t=>{const e=q8e.get(t);return e?Object.fromEntries(Object.entries(e.stores).map(([n,o])=>[n,o.getState()])):{}},wzo=(t,e,n)=>{if(t===void 0)return{type:"untracked",connection:e.connect(n)};const o=q8e.get(n.name);if(o)return{type:"tracked",store:t,...o};const i={connection:e.connect(n),stores:{}};return q8e.set(n.name,i),{type:"tracked",store:t,...i}},NLt=(t,e={})=>(n,o,i)=>{const{enabled:r,anonymousActionType:s,store:a,...A}=e;let c;try{c=(r??(J8e?"production":void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!c)return(J8e?"production":void 0)!=="production"&&r&&console.warn("[zustand devtools middleware] Please install/enable Redux devtools extension"),t(n,o,i);const{connection:l,...g}=wzo(a,c,A);let u=!0;i.setState=(_,m,p)=>{const I=n(_,m);if(!u)return I;const f=p===void 0?{type:s||"anonymous"}:typeof p=="string"?{type:p}:p;return a===void 0?(l?.send(f,o()),I):(l?.send({...f,type:`${a}/${f.type}`},{...Cse(A.name),[a]:i.getState()}),I)};const h=(..._)=>{const m=u;u=!1,n(..._),u=m},d=t(i.setState,o,i);if(g.type==="untracked"?l?.init(d):(g.stores[g.store]=i,l?.init(Object.fromEntries(Object.entries(g.stores).map(([_,m])=>[_,_===g.store?d:m.getState()])))),i.dispatchFromDevtools&&typeof i.dispatch=="function"){let _=!1;const m=i.dispatch;i.dispatch=(...p)=>{(J8e?"production":void 0)!=="production"&&p[0].type==="__setState"&&!_&&(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),_=!0),m(...p)}}return l.subscribe(_=>{var m;switch(_.type){case"ACTION":if(typeof _.payload!="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return W8e(_.payload,p=>{if(p.type==="__setState"){if(a===void 0){h(p.state);return}Object.keys(p.state).length!==1&&console.error(`
5794
+ `,g=new Blob([l],{type:"text/plain"}),u=URL.createObjectURL(g),h=document.createElement("a");h.href=u,h.download=`${c}.test.ts`,h.click(),URL.revokeObjectURL(u)}catch(A){alert(`Error generating test.ts for ${t.constructor.name}: ${A instanceof Error?A.message:String(A)}`)}o(!1)};return j.jsxs("div",{className:`relative ${e}`,ref:i,children:[j.jsx("button",{className:"px-2 py-1 rounded text-xs cursor-pointer",onClick:()=>o(!n),title:`Download options for ${t.constructor.name}`,children:t.constructor.name}),n&&j.jsxs("div",{className:"absolute top-full left-0 mt-1 bg-white border border-gray-300 rounded shadow-lg z-10 min-w-[150px]",children:[j.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:r,children:"Download JSON"}),j.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:s,children:"Download page.tsx"}),j.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:a,children:"Download test.ts"})]})]})},BLt=t=>t.activeSubSolver?[t,...BLt(t.activeSubSolver)]:[t],Azo=({solver:t})=>{const e=BLt(t);return j.jsx("div",{className:"flex gap-1 items-center text-sm pt-1",children:e.map((n,o)=>j.jsxs("div",{className:"flex items-center",children:[o>0&&j.jsx("span",{className:"text-gray-400 mx-1",children:"→"}),j.jsx(azo,{solver:n})]},n.constructor.name))})},czo=({solver:t,triggerRender:e,animationSpeed:n=25,onSolverStarted:o,onSolverCompleted:i})=>{const[r,s]=ne.useReducer(_=>!_,!1),a=ne.useRef(void 0),A=()=>{!t.solved&&!t.failed&&(t.step(),e())},c=()=>{!t.solved&&!t.failed&&(o&&o(t),t.solve(),e(),i&&i(t))},l=()=>{r?(a.current&&(clearInterval(a.current),a.current=void 0),s()):(s(),a.current=setInterval(()=>{if(t.solved||t.failed){a.current&&(clearInterval(a.current),a.current=void 0),s(),e(),i&&t.solved&&i(t);return}t.step(),e()},n))},g=()=>{const _=t;if(_.getCurrentPhase&&!t.solved&&!t.failed){const m=_.getCurrentPhase();for(;_.getCurrentPhase()===m&&!t.solved&&!t.failed;)t.step();e()}},u=()=>{if(t.solved||t.failed||r)return;const _=window.prompt("Step until which iteration?",`${t.iterations}`);if(_===null)return;const m=Number(_);if(!Number.isFinite(m)){window.alert("Please enter a valid number for the iteration");return}for(;t.iterations<m&&!t.solved&&!t.failed;)t.step();e(),t.solved&&i&&i(t)};ne.useEffect(()=>()=>{a.current&&clearInterval(a.current)},[]),ne.useEffect(()=>{(t.solved||t.failed)&&r&&(a.current&&(clearInterval(a.current),a.current=void 0),s())},[t.solved,t.failed,r]);const h=t.getCurrentPhase!==void 0,d=h?t.getCurrentPhase():null;return j.jsxs("div",{className:"space-y-2 p-2 border-b",children:[j.jsx("div",{className:"flex items-center",children:j.jsx(Azo,{solver:t})}),j.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[j.jsx("button",{onClick:A,disabled:t.solved||t.failed||r,className:"bg-blue-500 hover:bg-blue-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step"}),j.jsx("button",{onClick:c,disabled:t.solved||t.failed||r,className:"bg-green-500 hover:bg-green-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Solve"}),j.jsx("button",{onClick:l,disabled:t.solved||t.failed,className:`px-3 py-1 rounded text-white text-sm ${r?"bg-red-500 hover:bg-red-600":"bg-yellow-500 hover:bg-yellow-600"} disabled:bg-gray-300`,children:r?"Stop":"Animate"}),j.jsx("button",{onClick:u,disabled:t.solved||t.failed||r,className:"bg-orange-500 hover:bg-orange-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step Until Iteration"}),h&&j.jsx("button",{onClick:g,disabled:t.solved||t.failed||r,className:"bg-purple-500 hover:bg-purple-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Next Stage"}),j.jsxs("div",{className:"text-sm text-gray-600",children:["Iterations: ",t.iterations]}),t.timeToSolve!==void 0&&j.jsxs("div",{className:"text-sm text-gray-600",children:["Time: ",(t.timeToSolve/1e3).toFixed(3),"s"]}),d&&j.jsxs("div",{className:"text-sm text-gray-600",children:["Phase: ",j.jsx("span",{className:"font-medium",children:d})]}),t.solved&&j.jsx("div",{className:"px-2 py-1 bg-green-100 text-green-800 rounded text-sm",children:"Solved"}),t.failed&&j.jsx("div",{className:"px-2 py-1 bg-red-100 text-red-800 rounded text-sm",children:"Failed"})]}),t.error&&j.jsxs("div",{className:"text-red-600 text-sm",children:["Error: ",t.error]})]})},lzo=(t,e,n)=>{const o=t.currentPipelineStepIndex;return e<o?"Completed":e===o&&t.activeSubSolver?t.activeSubSolver.failed?"Failed":"In Progress":"Not Started"},gzo=(t,e)=>{const o=t.pipelineDef[e].solverName,i=lzo(t,e),r=t[o],s=t.firstIterationOfPhase?.[o]??null,a=t.iterations;let A=0;if(i==="Completed"){const u=t.pipelineDef[e+1],h=u?t.firstIterationOfPhase?.[u.solverName]:void 0;h!==void 0&&s!==null?A=h-s:s!==null&&(A=a-s)}else i==="In Progress"&&s!==null&&(A=a-s);const c=t.timeSpentOnPhase?.[o]??0;let l=0;i==="Completed"?l=1:i==="In Progress"&&r&&(l=r.progress??0);const g=r?.stats??null;return{index:e,name:o,status:i,firstIteration:s,iterations:A,progress:l,timeSpent:c,stats:g&&Object.keys(g).length>0?g:null,solverInstance:r??null}},uzo=({status:t})=>{const e={"Not Started":"text-blue-600","In Progress":"text-yellow-600",Completed:"text-green-600",Failed:"text-red-600"};return j.jsx("span",{className:`font-medium ${e[t]}`,children:t})},dzo=({progress:t})=>{if(t===0)return null;const e=Math.round(t*100);return j.jsxs("div",{className:"flex items-center gap-2",children:[j.jsx("div",{className:"w-20 h-2 bg-gray-200 rounded overflow-hidden",children:j.jsx("div",{className:"h-full bg-blue-500 transition-all duration-200",style:{width:`${e}%`}})}),j.jsxs("span",{className:"text-xs text-gray-500",children:[e,"%"]})]})},hzo=t=>Object.entries(t).map(([e,n])=>`${e}: ${n}`).join(", "),_zo=({stats:t})=>{if(!t||Object.keys(t).length===0)return j.jsx("span",{children:"-"});const e=Object.entries(t),n=hzo(t);return j.jsxs("details",{className:"cursor-pointer",children:[j.jsx("summary",{className:"whitespace-nowrap overflow-hidden text-ellipsis max-w-[200px]",children:n}),j.jsx("div",{className:"mt-1 text-xs",children:e.map(([o,i])=>j.jsxs("div",{children:[o,": ",String(i)]},o))})]})},V8e=t=>{if(t===null||typeof t!="object")return t;if(Array.isArray(t))return t.map(V8e);const e={};for(const[n,o]of Object.entries(t))n.startsWith("_")||(e[n]=V8e(o));return e},mzo=(t,e)=>{try{if(typeof t.getConstructorParams!="function"){alert(`getConstructorParams() is not implemented for ${e}`);return}const n=V8e(t.getConstructorParams()),o=new Blob([JSON.stringify(n,null,2)],{type:"application/json"}),i=URL.createObjectURL(o),r=document.createElement("a");r.href=i,r.download=`${e}_input.json`,r.click(),URL.revokeObjectURL(i)}catch(n){alert(`Error downloading input for ${e}: ${n instanceof Error?n.message:String(n)}`)}},pzo=({solver:t,onStepUntilPhase:e,onDownloadInput:n})=>{const o=t.pipelineDef.map((a,A)=>gzo(t,A)),i=a=>{e?.(a)},r=a=>{a.solverInstance&&(n?n(a.solverInstance,a.name):mzo(a.solverInstance,a.name))},s=a=>`${(a/1e3).toFixed(2)}s`;return j.jsxs("div",{className:"border-t border-gray-200",children:[j.jsx("div",{className:"px-4 py-2 bg-gray-50 border-b border-gray-200",children:j.jsx("h3",{className:"text-sm font-semibold text-gray-700",children:"Pipeline Steps"})}),j.jsx("div",{className:"overflow-x-auto",children:j.jsxs("table",{className:"w-full text-sm",children:[j.jsx("thead",{children:j.jsxs("tr",{className:"bg-gray-50 border-b border-gray-200",children:[j.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Step"}),j.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Status"}),j.jsxs("th",{className:"px-4 py-2 text-center font-semibold text-gray-700",children:["i",j.jsx("sub",{children:"0"})]}),j.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Iterations"}),j.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Progress"}),j.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Time"}),j.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Stats"}),j.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Input"})]})}),j.jsx("tbody",{children:o.map(a=>j.jsxs("tr",{className:`border-b border-gray-100 ${a.status==="In Progress"?"bg-yellow-50":""}`,children:[j.jsx("td",{className:"px-4 py-2",children:j.jsxs("div",{className:"flex items-center gap-2",children:[j.jsx("span",{className:"text-gray-400 w-6",children:String(a.index+1).padStart(2,"0")}),j.jsx("button",{onClick:()=>i(a.name),disabled:a.status==="Completed"||t.solved||t.failed,className:"text-blue-500 hover:text-blue-700 disabled:text-gray-300 disabled:cursor-not-allowed",title:`Step until ${a.name} completes`,children:j.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:j.jsx("path",{fillRule:"evenodd",d:"M4.5 5.653c0-1.426 1.529-2.33 2.779-1.643l11.54 6.348c1.295.712 1.295 2.573 0 3.285L7.28 19.991c-1.25.687-2.779-.217-2.779-1.643V5.653z",clipRule:"evenodd"})})}),j.jsx("span",{className:"font-medium text-gray-900",children:a.name})]})}),j.jsx("td",{className:"px-4 py-2",children:j.jsx(uzo,{status:a.status})}),j.jsx("td",{className:"px-4 py-2 text-center text-gray-600",children:a.firstIteration!==null?a.firstIteration:""}),j.jsx("td",{className:"px-4 py-2 text-gray-600",children:a.iterations}),j.jsx("td",{className:"px-4 py-2",children:j.jsx(dzo,{progress:a.progress})}),j.jsx("td",{className:"px-4 py-2 text-gray-600",children:s(a.timeSpent)}),j.jsx("td",{className:"px-4 py-2 text-gray-500",children:j.jsx(_zo,{stats:a.stats})}),j.jsx("td",{className:"px-4 py-2",children:a.solverInstance?j.jsxs("button",{onClick:()=>r(a),className:"flex items-center gap-1 text-blue-500 hover:text-blue-700",title:`Download input for ${a.name}`,children:[j.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:j.jsx("path",{fillRule:"evenodd",d:"M12 2.25a.75.75 0 01.75.75v11.69l3.22-3.22a.75.75 0 111.06 1.06l-4.5 4.5a.75.75 0 01-1.06 0l-4.5-4.5a.75.75 0 111.06-1.06l3.22 3.22V3a.75.75 0 01.75-.75zm-9 13.5a.75.75 0 01.75.75v2.25a1.5 1.5 0 001.5 1.5h13.5a1.5 1.5 0 001.5-1.5V16.5a.75.75 0 011.5 0v2.25a3 3 0 01-3 3H5.25a3 3 0 01-3-3V16.5a.75.75 0 01.75-.75z",clipRule:"evenodd"})}),j.jsx("span",{children:"Input"})]}):null})]},a.name))})]})})]})},Izo=class extends jr.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){console.error("InteractiveGraphics render error:",t)}render(){return this.state.hasError?this.props.fallback:this.props.children}};function fzo({graphics:t}){const e=t.points??[],n=t.lines??[],o=t.rects??[],i=t.circles??[],r=t.texts??[];let s=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,A=Number.NEGATIVE_INFINITY,c=Number.NEGATIVE_INFINITY;const l=(m,p)=>{typeof m=="number"&&(m<s&&(s=m),m>A&&(A=m)),typeof p=="number"&&(p<a&&(a=p),p>c&&(c=p))};for(const m of e)l(m.x,m.y);for(const m of n){const p=m.points??[];for(const I of p)l(I.x,I.y)}for(const m of o){const p=m.x??0,I=m.y??0,f=m.width??0,C=m.height??0;l(p,I),l(p+f,I+C)}for(const m of i){const p=m.x??0,I=m.y??0,f=m.radius??1;l(p-f,I-f),l(p+f,I+f)}for(const m of r)l(m.x,m.y);(!isFinite(s)||!isFinite(a)||!isFinite(A)||!isFinite(c))&&(s=-20,a=-20,A=20,c=20);const g=10,u=s-g,h=a-g,d=Math.max(1,A-s+2*g),_=Math.max(1,c-a+2*g);return j.jsxs("svg",{className:"w-full h-[400px] bg-white",viewBox:`${u} ${h} ${d} ${_}`,role:"img","aria-label":"Graphics fallback",children:[o.map((m,p)=>j.jsx("rect",{x:m.x??0,y:m.y??0,width:m.width??0,height:m.height??0,fill:"none",stroke:m.strokeColor??"black",strokeWidth:m.strokeWidth??1},`rect-${p}`)),n.map((m,p)=>j.jsx("polyline",{fill:"none",stroke:m.strokeColor??"black",strokeWidth:m.strokeWidth??1,points:(m.points??[]).map(I=>`${I.x??0},${I.y??0}`).join(" ")},`line-${p}`)),i.map((m,p)=>j.jsx("circle",{cx:m.x??0,cy:m.y??0,r:m.radius??1.5,fill:m.fillColor??"none",stroke:m.strokeColor??"black",strokeWidth:m.strokeWidth??1},`circle-${p}`)),e.map((m,p)=>j.jsx("circle",{cx:m.x??0,cy:m.y??0,r:m.radius??1.5,fill:m.color??"black"},`point-${p}`)),r.map((m,p)=>j.jsx("text",{x:m.x??0,y:m.y??0,fontSize:m.fontSize??10,fill:m.color??"black",children:m.text??""},`text-${p}`))]})}var Czo=({solver:t,animationSpeed:e=25,onSolverStarted:n,onSolverCompleted:o})=>{const[i,r]=ne.useReducer(l=>l+1,0),s=ne.useMemo(()=>{try{return t.visualize()||{points:[],lines:[],rects:[],circles:[]}}catch(l){return console.error("Visualization error:",l),{points:[],lines:[],rects:[],circles:[]}}},[t,i]),a=ne.useMemo(()=>(s.rects?.length||0)===0&&(s.lines?.length||0)===0&&(s.points?.length||0)===0&&(s.circles?.length||0)===0,[s]);ne.useEffect(()=>{if(!(typeof document>"u")&&!document.querySelector('script[src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"]')){const l=document.createElement("script");l.src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4",document.head.appendChild(l)}},[]);const A=t.pipelineDef!==void 0,c=l=>{const g=t;if(!t.solved&&!t.failed){for(;!t.solved&&!t.failed&&g.currentPipelineStepIndex<=g.pipelineDef.findIndex(u=>u.solverName===l);)t.step();r()}};return j.jsxs("div",{children:[j.jsx(czo,{solver:t,triggerRender:r,animationSpeed:e,onSolverStarted:n,onSolverCompleted:o}),a?j.jsx("div",{className:"p-4 text-gray-500",children:"No Graphics Yet"}):j.jsx(Izo,{fallback:j.jsx(fzo,{graphics:s}),children:j.jsx(szo,{graphics:s})}),A&&j.jsx(pzo,{solver:t,onStepUntilPhase:c})]})};const yzo=()=>{ne.useEffect(()=>{const t="tailwind-cdn-script";if(document.getElementById(t)||window.tailwind)return;const e=document.createElement("div");e.className="hidden",document.body.appendChild(e);const n=window.getComputedStyle(e).display==="none";if(document.body.removeChild(e),n)return;const o=document.createElement("script");o.id=t,o.src="https://cdn.tailwindcss.com",document.head.appendChild(o)},[])},Ezo=1e3,eb=(t,e)=>{const{fileName:n,mimeType:o="text/plain"}=e,i=t instanceof Blob?t:new Blob([t],{type:o}),r=URL.createObjectURL(i),s=document.createElement("a");s.href=r,s.download=n,s.target="_blank",s.rel="noopener noreferrer",s.style.display="none",document.body.appendChild(s),s.click(),document.body.removeChild(s),setTimeout(()=>{URL.revokeObjectURL(r)},Ezo)},QLt=t=>{let e=t.trim().replace(/[\\/:*?"<>|]/g,"_").replace(/[\x00-\x1f]/g,"").replace(/^\.+/,"").replace(/\.+$/,"").replace(/\s+/g," ").replace(/_+/g,"_");return/^(con|prn|aux|nul|com[0-9]|lpt[0-9])$/i.test(e)&&(e=`_${e}`),e=e.slice(0,200),e||"untitled"},tb="https://github.com/tscircuit/tscircuit-autorouter/issues/new",SLt="https://github.com/tscircuit/copper-pour-solver/issues/new",bLt="https://github.com/tscircuit/calculate-packing/issues/new",xzo="https://github.com/tscircuit/matchpack/issues/new",DLt="https://github.com/tscircuit/schematic-trace-solver/issues/new?template=json-bug-report.yml",Bzo={PackSolver2:bLt,LayoutPipelineSolver:xzo,AutoroutingPipelineSolver:tb,AssignableAutoroutingPipeline2:tb,AssignableAutoroutingPipeline3:tb,AutoroutingPipeline1_OriginalUnravel:tb,AutoroutingPipelineSolver3_HgPortPointPathing:tb,AutoroutingPipelineSolver4:tb,AutoroutingPipelineSolver5:tb,AutoroutingPipelineSolver7_MultiGraph:tb,AutoroutingPipelineSolver8:tb,CopperPourPipelineSolver:SLt,SchematicTracePipelineSolver:DLt},Qzo=t=>t.toLowerCase().includes("pack")?$No:t.toLowerCase().includes("rout")?rRo:zNo,PLt=t=>{const e=Bzo[t];if(e)return e;const n=t.toLowerCase();return n.includes("autorout")?tb:n.includes("schematic")&&n.includes("trace")?DLt:n.includes("copperpour")?SLt:n.includes("pack")?bLt:null},Szo=t=>`${QLt(`${t.componentName}-${t.solverName}`)}-solver-input.json`,vLt=t=>{eb(JSON.stringify(t.solverParams,null,2),{fileName:Szo(t),mimeType:"application/json"})},bzo=({solverEvent:t})=>{const e=PLt(t.solverName);return j.jsxs("div",{className:"rf-flex rf-items-center rf-justify-end rf-gap-2 rf-border-b rf-border-gray-200 rf-bg-gray-50 rf-px-4 rf-py-2",children:[j.jsxs(Sc,{type:"button",variant:"outline",size:"sm",onClick:()=>vLt(t),children:[j.jsx(R3e,{className:"rf-w-4 rf-h-4"}),"Download"]}),e?j.jsx(Sc,{asChild:!0,variant:"outline",size:"sm",children:j.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",children:[j.jsx(rre,{className:"rf-w-4 rf-h-4"}),"Report"]})}):j.jsxs(Sc,{type:"button",variant:"outline",size:"sm",disabled:!0,title:"No report link configured for this solver",children:[j.jsx(rre,{className:"rf-w-4 rf-h-4"}),"Report"]})]})},Dzo=({solverEvent:t})=>{const e=PLt(t.solverName);return e?j.jsx(Sc,{asChild:!0,variant:"ghost",size:"icon",className:"rf-h-8 rf-w-8",children:j.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",title:"Report solver bug","aria-label":"Report solver bug",children:j.jsx(rre,{className:"rf-w-4 rf-h-4"})})}):j.jsx(Sc,{type:"button",variant:"ghost",size:"icon",className:"rf-h-8 rf-w-8",disabled:!0,title:"No report link configured for this solver","aria-label":"Report solver bug",children:j.jsx(rre,{className:"rf-w-4 rf-h-4"})})},Pzo=({solverEvents:t=[]})=>{const[e,n]=ne.useState(null);yzo();const o=ne.useMemo(()=>{const a=new Map;for(const A of t){const c=`${A.componentName}-${A.solverName}`;a.set(c,A)}return a},[t]),i=ne.useMemo(()=>Array.from(o.keys()),[o]),r=e?o.get(e):null,s=ne.useMemo(()=>{if(!r)return{instance:null,error:null,classFound:!1};const a=oBe[r.solverName];if(!a)return{instance:null,error:`Solver class "${r.solverName}" not found in SOLVERS registry. Available: ${Object.keys(oBe).join(", ")}`,classFound:!1};try{const A=r.solverParams,c=A?.input!==void 0?A.input:A;return{instance:new a(c),error:null,classFound:!0}}catch(A){const c=A instanceof Error?A.message:String(A);return console.error("Failed to reconstruct solver:",A),{instance:null,error:`Failed to instantiate solver: ${c}`,classFound:!0}}},[r]);return t.length===0?j.jsx("div",{className:"rf-p-4",children:j.jsx("div",{className:"rf-bg-gray-50 rf-rounded-md rf-border rf-border-gray-200",children:j.jsxs("div",{className:"rf-p-4",children:[j.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800 rf-mb-3",children:"No Solvers Detected"}),j.jsx("p",{className:"rf-text-sm rf-text-gray-600",children:"Solvers will appear here when the circuit runs. Solvers are used for tasks like component packing and autorouting."})]})})}):j.jsxs("div",{className:"rf-flex rf-h-full rf-overflow-hidden",children:[j.jsxs("div",{className:"rf-w-64 rf-border-r rf-border-gray-200 rf-overflow-y-auto rf-flex-shrink-0",children:[j.jsxs("div",{className:"rf-text-xs rf-font-semibold rf-text-gray-500 rf-px-3 rf-py-2 rf-bg-gray-50 rf-border-b rf-border-gray-200",children:[i.length," ",i.length===1?"Solver":"Solvers"]}),i.map(a=>{const A=o.get(a),c=e===a;return j.jsx("div",{className:`rf-px-3 rf-py-2 rf-cursor-pointer rf-border-b rf-border-gray-100 ${c?"rf-bg-blue-50 rf-border-l-2 rf-border-l-blue-500":"hover:rf-bg-gray-50"}`,onClick:()=>n(a),children:(()=>{const l=Qzo(A.solverName);return j.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[j.jsx(l,{className:"rf-w-4 rf-h-4 rf-text-blue-500 rf-flex-shrink-0"}),j.jsxs("div",{className:"rf-flex-1 rf-min-w-0",children:[j.jsx("div",{className:"rf-text-sm rf-font-medium rf-text-gray-800 rf-truncate",children:A.componentName}),j.jsx("div",{className:"rf-text-xs rf-text-gray-500 rf-truncate",children:A.solverName})]})]})})()},a)})]}),j.jsx("div",{className:"rf-flex-1 rf-overflow-hidden",children:r?s.instance?j.jsxs("div",{className:"rf-flex rf-h-full rf-flex-col rf-overflow-y-auto",children:[j.jsx(bzo,{solverEvent:r}),j.jsx("div",{className:"rf-min-h-0 rf-flex-1",children:j.jsx(YS,{fallback:j.jsx("div",{className:"rf-p-4",children:j.jsxs("div",{className:"rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200 rf-p-4",children:[j.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-2",children:"Error Loading Solver Debugger"}),j.jsxs("p",{className:"rf-text-sm rf-text-red-600",children:["Failed to render the solver debugger for"," ",r.solverName]})]})}),children:j.jsx(Czo,{solver:s.instance})})})]}):j.jsxs("div",{className:"rf-p-4",children:[j.jsxs("div",{className:"rf-mb-4",children:[j.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800",children:r.solverName}),j.jsxs("p",{className:"rf-text-sm rf-text-gray-500",children:["Component: ",r.componentName]})]}),s.error&&j.jsx("div",{className:`rf-rounded-md rf-border rf-p-4 rf-mb-4 ${s.classFound?"rf-bg-red-50 rf-border-red-200":"rf-bg-yellow-50 rf-border-yellow-200"}`,children:j.jsx("p",{className:`rf-text-sm ${s.classFound?"rf-text-red-700":"rf-text-yellow-700"}`,children:s.error})}),j.jsxs("div",{className:"rf-border rf-border-gray-200 rf-rounded-md rf-overflow-hidden",children:[j.jsxs("div",{className:"rf-px-3 rf-py-2 rf-bg-gray-50 rf-flex rf-items-center rf-justify-between rf-gap-2",children:[j.jsx("span",{className:"rf-text-sm rf-font-medium rf-text-gray-700",children:"Solver Parameters"}),j.jsxs("div",{className:"rf-flex rf-items-center rf-gap-1",children:[j.jsx(Dzo,{solverEvent:r}),j.jsx(Sc,{type:"button",variant:"ghost",size:"icon",className:"rf-h-8 rf-w-8","aria-label":"Download solver input JSON",title:"Download solver input JSON",onClick:()=>vLt(r),children:j.jsx(R3e,{className:"rf-w-4 rf-h-4"})})]})]}),j.jsx("div",{className:"rf-p-3 rf-bg-white rf-border-t rf-border-gray-200",children:j.jsx("pre",{className:"rf-text-xs rf-font-mono rf-text-gray-600 rf-whitespace-pre-wrap rf-overflow-x-auto",children:JSON.stringify(r.solverParams,null,2)})})]})]}):j.jsx("div",{className:"rf-flex rf-items-center rf-justify-center rf-h-full",children:j.jsx("p",{className:"rf-text-sm rf-text-gray-500",children:"Select a solver from the list to view details"})})})]})},MLt=({errorMessage:t,errorStack:e,circuitJsonErrors:n})=>{ne.useEffect(()=>{if(t){const o=new Error(t);e&&(o.stack=e);try{v8.captureException(o)}catch{}}},[t,e]),ne.useEffect(()=>{if(n&&n.length>0)for(const o of n){const i=new Error(o.message||"Circuit JSON Error");o.stack&&(i.stack=o.stack);try{v8.captureException(i,{error_type:o.type})}catch{}}},[n])},vzo=t=>{ne.useEffect(()=>{try{XJt(t)}catch{}},[t.source,t.component,t.isWebEmbedded,t.activeTab])},wLt="0.0.2443",Mzo={version:wLt},J8e={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},q8e=new Map,Cse=t=>{const e=q8e.get(t);return e?Object.fromEntries(Object.entries(e.stores).map(([n,o])=>[n,o.getState()])):{}},wzo=(t,e,n)=>{if(t===void 0)return{type:"untracked",connection:e.connect(n)};const o=q8e.get(n.name);if(o)return{type:"tracked",store:t,...o};const i={connection:e.connect(n),stores:{}};return q8e.set(n.name,i),{type:"tracked",store:t,...i}},NLt=(t,e={})=>(n,o,i)=>{const{enabled:r,anonymousActionType:s,store:a,...A}=e;let c;try{c=(r??(J8e?"production":void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!c)return(J8e?"production":void 0)!=="production"&&r&&console.warn("[zustand devtools middleware] Please install/enable Redux devtools extension"),t(n,o,i);const{connection:l,...g}=wzo(a,c,A);let u=!0;i.setState=(_,m,p)=>{const I=n(_,m);if(!u)return I;const f=p===void 0?{type:s||"anonymous"}:typeof p=="string"?{type:p}:p;return a===void 0?(l?.send(f,o()),I):(l?.send({...f,type:`${a}/${f.type}`},{...Cse(A.name),[a]:i.getState()}),I)};const h=(..._)=>{const m=u;u=!1,n(..._),u=m},d=t(i.setState,o,i);if(g.type==="untracked"?l?.init(d):(g.stores[g.store]=i,l?.init(Object.fromEntries(Object.entries(g.stores).map(([_,m])=>[_,_===g.store?d:m.getState()])))),i.dispatchFromDevtools&&typeof i.dispatch=="function"){let _=!1;const m=i.dispatch;i.dispatch=(...p)=>{(J8e?"production":void 0)!=="production"&&p[0].type==="__setState"&&!_&&(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),_=!0),m(...p)}}return l.subscribe(_=>{var m;switch(_.type){case"ACTION":if(typeof _.payload!="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return W8e(_.payload,p=>{if(p.type==="__setState"){if(a===void 0){h(p.state);return}Object.keys(p.state).length!==1&&console.error(`
5795
5795
  [zustand devtools middleware] Unsupported __setState action format.
5796
5796
  When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),
5797
5797
  and value of this only key should be a state object. Example: { "type": "__setState", "state": { "abc123Store": { "foo": "bar" } } }
@@ -5872,4 +5872,4 @@ Please report this to https://github.com/markedjs/marked.`,t){const o="<p>An err
5872
5872
  rf-max-h-[90vh] rf-overflow-y-auto
5873
5873
  `,children:j.jsx("div",{className:"rf-relative rf-w-full",children:n==="initial"&&j.jsx(QWo,{onCancel:e,packageReleaseId:r??"",signIn:s??(()=>{}),isLoggedIn:a})})})})}),MWo=({isOpen:t,onClose:e,stage:n,setStage:o,signIn:i,isLoggedIn:r})=>{const s=nb(a=>a.circuitJson);return j.jsx(vWo,{signIn:i,isOpen:t,onClose:e,stage:n,setStage:o,circuitJson:s,isLoggedIn:r??!1})},wWo=()=>{const[t,e]=ne.useState(!1),[n,o]=ne.useState("initial");return{isOpen:t,stage:n,open:()=>e(!0),close:()=>{e(!1),o("initial")},setStage:o,OrderDialog:MWo}};async function oGt(){const t=await fetch(`${h5}/files/list`),{file_list:e}=await t.json(),n=new Map;for(const o of e){const r=await(await fetch(`${h5}/files/get?file_path=${encodeURIComponent(o.file_path)}`)).json();(r.file?.text_content||r.file?.binary_content_b64)&&n.set(o.file_path,{text_content:r.file.text_content,binary_content_b64:r.file.binary_content_b64})}return n}const NWo="https://api.tscircuit.com/bug_reports/view?bug_report_id=",RWo=t=>`${NWo}${t}`,TWo=t=>{const[e,n]=ne.useState(!1),[o,i]=ne.useState(!1),[r,s]=ne.useState(null),[a,A]=ne.useState(null),[c,l]=ne.useState([]),g=ne.useRef(null),[u,h]=ne.useState(null),[d,_]=ne.useState(0),m=t?.onLoginRequired,p=ne.useMemo(()=>hV()?!0:typeof document>"u"?!1:document.cookie.split(";").some(E=>E.trim().startsWith("session=")),[e]);ne.useEffect(()=>{if(e&&!u&&g.current){const E=typeof window<"u"?window.__TSCIRCUIT_LAST_EXECUTION_ERROR:void 0;E&&(g.current.value=`I'm getting this execution error:
5874
5874
 
5875
- ${E}`)}},[e,u]),ne.useEffect(()=>{e&&!u&&oGt().then(E=>{_(E.size)}).catch(E=>{console.error("Failed to fetch file count",E),_(0)})},[e,u]);const I=ne.useCallback(()=>{s(null),h(null),A(null),l([]),g.current&&(g.current.value=""),n(!0)},[]),f=ne.useCallback(()=>{n(!1)},[]),C=ne.useCallback(async()=>{i(!0),s(null),A(null),l([]);const E=OM(),B=g.current?.value||"";try{const Q=await oGt();if(Q.size===0){la.error("No project files available to include in the bug report"),i(!1);return}const b=new Date(Date.now()+1440*60*1e3).toISOString(),R=(await E.post("bug_reports/create",{json:{text:B.trim()||void 0,is_auto_deleted:!0,delete_at:b}}).json()).bug_report.bug_report_id,w=Array.from(Q.entries()),H=[];for(let K=0;K<w.length;K++){const[U,q]=w[K];A({current:K+1,total:w.length,currentFile:U});try{const W={bug_report_id:R,file_path:U};q.text_content&&(W.content_text=q.text_content),q.binary_content_b64&&(W.content_base64=q.binary_content_b64),await E.post("bug_reports/upload_file",{json:W})}catch(W){const ee=W instanceof HM?`HTTP ${W.response.status}`:W instanceof Error?W.message:"Upload failed";H.push({filePath:U,message:ee}),l([...H])}}A(null);const G=RWo(R);h({bugReportUrl:G})}catch(Q){if(console.error("Failed to submit bug report",Q),Q instanceof HM)if(Q.response.status===401)if(p){const b="Your session has expired. Please sign in again to continue.";s(b),la.error(b),m&&(f(),m())}else{const b="You must be logged in to report a bug. Please sign in via cli and try again.";s(b),la.error(b),setTimeout(()=>{m&&(f(),m())},1e3)}else{const b=`Failed to submit bug report (${Q.response.status})`;s(b),la.error(b)}else if(Q instanceof Error)s(Q.message),la.error(Q.message);else{const b="Failed to submit bug report";s(b),la.error(b)}}finally{i(!1)}},[p,m]);return{BugReportDialog:ne.useMemo(()=>{const E=a?Math.round(a.current/a.total*100):0;return j.jsx(WLt,{open:e,onOpenChange:B=>{B?(s(null),h(null),A(null),l([]),n(!0)):o||f()},children:j.jsxs(r9e,{children:[j.jsxs(s9e,{children:[j.jsx(A9e,{children:u?"Bug Report Created":"Report Bug"}),j.jsx(c9e,{asChild:!0,children:u?j.jsxs("div",{className:"rf-text-left rf-space-y-3 rf-text-sm",children:[j.jsx("p",{children:"Bug report created successfully."}),c.length>0&&j.jsxs("div",{className:"rf-bg-red-50 rf-border rf-border-red-200 rf-rounded rf-p-2 rf-max-h-28 rf-overflow-y-auto rf-overflow-x-hidden",children:[j.jsxs("p",{className:"rf-text-red-700 rf-font-medium rf-text-xs rf-mb-1",children:[c.length," file(s) failed:"]}),c.map((B,Q)=>j.jsxs("div",{className:"rf-text-red-600 rf-text-xs rf-mb-0.5",title:`${B.filePath}: ${B.message}`,children:[j.jsx("span",{className:"rf-font-medium rf-break-all",children:B.filePath.split("/").pop()}),j.jsx("span",{className:"rf-text-red-500 rf-block rf-truncate",children:B.message})]},Q))]}),j.jsx("div",{children:j.jsx("a",{className:"rf-text-blue-600 hover:rf-underline",href:u.bugReportUrl,target:"_blank",rel:"noreferrer",children:"View bug report"})}),j.jsxs("p",{children:["Please share this link privately with tscircuit staff so we can help debug. Join the",j.jsx("a",{className:"rf-ml-1 rf-text-blue-600 hover:rf-underline",href:"https://tscircuit.com/join",target:"_blank",rel:"noreferrer",children:"tscircuit Discord"}),"."]})]}):j.jsx("div",{className:"rf-text-left rf-space-y-3 rf-text-sm",children:a?j.jsxs("div",{className:"rf-space-y-2 rf-overflow-hidden",children:[j.jsxs("div",{className:"rf-flex rf-justify-between rf-text-xs",children:[j.jsx("span",{children:"Uploading files..."}),j.jsxs("span",{children:[a.current,"/",a.total]})]}),j.jsx("div",{className:"rf-w-full rf-h-2 rf-bg-gray-200 rf-rounded-full rf-overflow-hidden",children:j.jsx("div",{className:"rf-h-full rf-bg-blue-500 rf-transition-all rf-duration-150",style:{width:`${E}%`}})}),j.jsx("p",{className:"rf-text-xs rf-text-gray-500 rf-break-all rf-truncate rf-w-full rf-max-w-full",children:`${a.currentFile.slice(0,60)}${a.currentFile.length>60?"...":""}`}),c.length>0&&j.jsx("div",{className:"rf-bg-red-50 rf-border rf-border-red-200 rf-rounded rf-p-2 rf-max-h-20 rf-overflow-y-auto rf-overflow-x-hidden",children:c.map((B,Q)=>j.jsxs("div",{className:"rf-text-red-600 rf-text-xs rf-mb-0.5",title:`${B.filePath}: ${B.message}`,children:[j.jsx("span",{className:"rf-font-medium rf-break-all",children:B.filePath.split("/").pop()}),j.jsx("span",{className:"rf-text-red-500 rf-block rf-truncate",children:B.message})]},Q))})]}):j.jsxs(j.Fragment,{children:[j.jsxs("p",{children:["Reporting a bug will upload your entire project",d>0?` (${d} file${d===1?"":"s"})`:""," ","to tscircuit support."]}),j.jsxs("div",{className:"rf-space-y-2",children:[j.jsx("label",{htmlFor:"bug-description",className:"rf-block rf-font-medium",children:"Description (optional)"}),j.jsx("textarea",{ref:g,id:"bug-description",className:"rf-w-full rf-min-h-[100px] rf-px-3 rf-py-2 rf-text-sm rf-border rf-border-gray-300 rf-rounded-md focus:rf-outline-none focus:rf-ring-2 focus:rf-ring-blue-500",placeholder:"Describe the issue you're experiencing...",disabled:o})]}),j.jsxs("p",{children:["Share the generated bug report link privately with tscircuit staff so we can help debug your issue. You can also reach out on our",j.jsx("a",{className:"rf-ml-1 rf-text-blue-600 hover:rf-underline",href:"https://tscircuit.com/join",target:"_blank",rel:"noreferrer",children:"Discord community"}),"."]}),!p&&j.jsx("p",{className:"rf-text-red-600",children:"You appear to be logged out. Please log in before reporting a bug or the upload will fail."}),r&&j.jsx("p",{className:"rf-text-red-600",children:r})]})})})]}),j.jsx(a9e,{children:u?j.jsx("button",{type:"button",className:qT(),onClick:()=>{f()},children:"Close"}):j.jsxs(j.Fragment,{children:[j.jsx(l9e,{disabled:o,onClick:()=>{o||f()},children:"Cancel"}),!p&&m?j.jsx("button",{type:"button",className:qT(),onClick:B=>{B.preventDefault(),f(),m()},children:"Sign In"}):j.jsx("button",{type:"button",className:Kx(qT(),o&&"rf-opacity-70 rf-cursor-not-allowed"),disabled:o,onClick:B=>{B.preventDefault(),C()},children:o?"Reporting...":"Upload & Report"})]})})]})},"bug-report-dialog")},[e,o,f,r,u,d,p,C,m,a,c]),openBugReportDialog:I}};function kWo({open:t,onOpenChange:e,onExport:n}){const[o,i]=ne.useState(!1),r=()=>{n({includeSilkscreen:o}),e(!1)},s=()=>{e(!1)};return j.jsx(uY,{open:t,onOpenChange:e,children:j.jsxs(hk,{children:[j.jsxs(_k,{children:[j.jsx(mk,{children:"LightBurn Export Options"}),j.jsx(hY,{children:"Configure export settings for PCB laser ablation with LightBurn"})]}),j.jsx("div",{className:"rf-flex rf-flex-col rf-gap-4 rf-py-4",children:j.jsxs("div",{className:"rf-flex rf-items-center rf-space-x-2",children:[j.jsx(gY,{id:"includeSilkscreen",checked:o,onCheckedChange:a=>i(a===!0)}),j.jsx("label",{htmlFor:"includeSilkscreen",className:"rf-text-xs rf-font-medium rf-leading-none peer-disabled:rf-cursor-not-allowed peer-disabled:rf-opacity-70",children:"Include silkscreen layer"})]})}),j.jsxs(dY,{children:[j.jsx(Sc,{variant:"outline",onClick:s,children:"Cancel"}),j.jsx(Sc,{onClick:r,children:"Export"})]})]})})}const FWo=/#(\d+)/,LWo=t=>{const e=t.match(FWo);if(!e)return null;const n=Number.parseInt(e[1],10);return Number.isFinite(n)?n:null},HWo=t=>{if(typeof t=="number")return Number.isFinite(t)?t:null;if(typeof t=="string"){const e=new Date(t).getTime();return Number.isFinite(e)?e:null}return null},GWo=t=>{if(!t)return null;let e=null,n=-1,o=-1;for(const[i,r]of Object.entries(t)){const s=LWo(i),a=HWo(r.createdAt);if(s!==null){s>n&&(n=s,e={key:i,value:r});continue}if(n===-1){if(a!==null&&a>o){o=a,e={key:i,value:r};continue}e||(e={key:i,value:r})}}return e},OWo=t=>{const e=j8e(Be=>Be.lastRunEvalVersion),n=nb(Be=>Be.currentMainComponentPath),[o,i]=ne.useState(null),[r,s]=ne.useState(!1),[a,A]=ne.useState(!0),[c,l]=ne.useState(!1),[g,u]=ne.useState(null),[h,d]=ne.useState(null),[_,m]=ne.useState(!1),[p,I]=ne.useState(null),[f,C]=ne.useState(null),[y,E]=ne.useState(!1),[B,Q]=ne.useState(!1),[b,D]=ne.useState(!1),[R,w]=ne.useState(null),H=wWo(),G=nb(Be=>Be.pushEvent),K=nb(Be=>Be.recentEvents),U=ne.useMemo(()=>Date.now(),[]);Gzo(Be=>{if(!(new Date(Be.created_at).valueOf()<U+500)){if(Be.event_type==="FILE_UPDATED"){s(!0);return}if(Be.event_type==="SNIPPET_SAVED"){s(!1),A(!1),I("Snippet saved successfully."),E(!1);return}Be.event_type==="REQUEST_EXPORT"&&(Q(!0),I("Export processing..."),E(!1)),Be.event_type==="EXPORT_CREATED"&&(I(`Export created: ${Be.exportFilePath}`),E(!1),Q(!1))}}),ne.useEffect(()=>{if(!c||g===null)return;const Be=K.filter(pe=>new Date(pe.created_at).valueOf()>g),_e=Be.find(pe=>pe.event_type==="FAILED_TO_SAVE_SNIPPET"),ye=Be.find(pe=>pe.event_type==="SNIPPET_SAVED");_e&&(l(!1),u(null),C(_e.message??"Failed to save snippet. See console for error."),console.error(_e.message),E(!0),_e.error_code==="SNIPPET_UNSET"&&_e.available_snippet_names&&(d(_e.available_snippet_names),m(!0))),ye&&(l(!1),u(null),I("Snippet saved successfully."),E(!1))},[K,c]);const q=async()=>{l(!0),u(Date.now()),I(null),E(!1),await G({event_type:"REQUEST_TO_SAVE_SNIPPET",snippet_name:o})},ee=nb(Be=>Be.circuitJson)??t.circuitJson,[re,X]=ne.useState(!1),[te,se]=ne.useState(!1),{BugReportDialog:le,openBugReportDialog:ue}=TWo({onLoginRequired:t.onLoginRequired}),Ce=async Be=>{R&&(await EHt({circuitJson:R.circuitJson,projectName:R.projectName,options:Be}),w(null))},Ee=ne.useMemo(()=>GWo(t.autoroutingLog),[t.autoroutingLog]);return j.jsxs(j.Fragment,{children:[j.jsxs("div",{className:"rf-flex rf-items-center rf-gap-1 rf-flex-shrink-0",children:[j.jsxs(Rre,{children:[j.jsx(Tre,{asChild:!0,children:j.jsx("div",{className:"rf-whitespace-nowrap rf-text-xs font-medium rf-p-2 rf-mx-1 rf-cursor-pointer rf-relative",children:"File"})}),j.jsxs(WU,{className:"rf-z-[101]",children:[!t.isWebEmbedded&&j.jsxs(j.Fragment,{children:[j.jsx(Gh,{className:"rf-text-xs",onSelect:q,disabled:c,children:c?"Saving...":"Push"}),parseInt(window.location.port)>5e3&&j.jsx(Gh,{className:"rf-text-xs",onSelect:()=>{H.open()},children:"Order"}),j.jsx(Gh,{className:"rf-text-xs",onSelect:()=>X(!0),disabled:c,children:"Import"}),j.jsx(Gh,{className:"rf-text-xs",onSelect:()=>{if(!hV()){la.error("Requires tscircuit token");return}se(!0)},children:"AI Review"})]}),!t.isWebEmbedded&&t.onLoginRequired&&j.jsx(Gh,{className:"rf-text-xs",onSelect:()=>{t.onLoginRequired?.()},children:"Sign In"}),!t.isWebEmbedded&&j.jsxs(qU,{children:[j.jsx(rk,{className:"rf-text-xs",children:"Report Bug"}),j.jsx(JU,{children:j.jsxs(sk,{children:[j.jsx(Gh,{className:"rf-text-xs",onSelect:()=>{ue()},children:"Report Entire Circuit"}),j.jsx(Gh,{className:"rf-text-xs",disabled:!Ee||!t.onReportAutoroutingLog,onSelect:()=>{!Ee||!t.onReportAutoroutingLog||t.onReportAutoroutingLog(Ee.key,{simpleRouteJson:Ee.value.simpleRouteJson})},children:"Report Autorouter Bug"})]})})]}),j.jsxs(qU,{children:[j.jsx(rk,{className:"rf-text-xs",disabled:B,children:B?"Exporting...":"Export"}),j.jsx(JU,{children:j.jsx(sk,{children:nqo.map((Be,_e)=>j.jsx(Gh,{onSelect:()=>{if(!ee){la.error("No Circuit JSON to export");return}let ye="Untitled";if(n){const Ge=n.split("/").pop();Ge&&(ye=Ge.replace(/\.[^.]+$/,""))}const pe=t.projectName??o??ye,we=Ee?.value.simpleRouteJson;if(Be.name==="LightBurn"){w({circuitJson:ee,projectName:pe}),D(!0);return}oqo({exportName:Be.name,circuitJson:ee,simpleRouteJson:we,projectName:pe?.replace(/\.(board|circuit)$/,"")})},disabled:B||Be.name==="Simple Route JSON"&&!Ee,children:j.jsx("span",{className:"rf-text-xs",children:Be.name})},_e))})})]}),!t.isWebEmbedded&&j.jsxs(qU,{children:[j.jsx(rk,{className:"rf-text-xs",children:"Advanced"}),j.jsx(JU,{children:j.jsxs(sk,{children:[j.jsx(Gh,{className:"rf-flex rf-items-center rf-gap-2",children:j.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[j.jsx(gY,{id:"load-latest-eval",checked:t.shouldLoadLatestEval,onCheckedChange:Be=>{t.onChangeShouldLoadLatestEval?.(Be===!0)}}),j.jsx("label",{htmlFor:"load-latest-eval",className:"rf-text-xs rf-cursor-pointer",children:"Force Latest @tscircuit/eval"})]})}),e&&j.jsx(Gh,{className:"rf-flex rf-items-center rf-gap-2",children:j.jsx("div",{className:"rf-flex rf-items-center rf-gap-2",children:j.jsxs("span",{className:"rf-text-xs",children:["@tscircuit/eval@",e]})})}),j.jsx(Gh,{className:"rf-flex rf-items-center rf-gap-2",children:j.jsx("div",{className:"rf-flex rf-items-center rf-gap-2",children:j.jsxs("span",{className:"rf-text-xs",children:["@tscircuit/runframe@",Mzo.version]})})}),j.jsx(Gh,{className:"rf-flex rf-items-center rf-gap-2",onClick:()=>{window.open("/api/admin","_blank")},children:j.jsx("div",{className:"rf-flex rf-items-center rf-gap-2",children:j.jsx("span",{className:"rf-text-xs",children:"CLI Admin Panel"})})})]})})]})]}),j.jsx(WLt,{open:y,onOpenChange:E,children:j.jsxs(r9e,{children:[j.jsxs(s9e,{children:[j.jsx(A9e,{children:"Error Saving Snippet"}),j.jsx(c9e,{children:f})]}),j.jsx(a9e,{children:j.jsx(l9e,{onClick:()=>E(!1),children:"Dismiss"})})]})}),j.jsx(Hzo,{snippetNames:h??[],onSelect:async Be=>{l(!0),u(Date.now()),i(Be),await G({event_type:"REQUEST_TO_SAVE_SNIPPET",snippet_name:Be}),m(!1)},onCancel:()=>m(!1),isOpen:_})]}),j.jsxs(Rre,{children:[j.jsx(Tre,{asChild:!0,children:j.jsx("div",{className:"rf-whitespace-nowrap rf-text-xs font-medium rf-p-2 rf-mx-1 rf-cursor-pointer rf-relative",children:"View"})}),j.jsx(WU,{className:"rf-z-[104]",children:j.jsxs(qU,{children:[j.jsx(rk,{className:"rf-text-xs",children:"Schematic"}),j.jsx(JU,{children:j.jsxs(sk,{children:[j.jsx(Gh,{className:"rf-flex rf-items-center rf-gap-2",onSelect:Be=>Be.preventDefault(),children:j.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[j.jsx(gY,{id:"show-schematic-ports",checked:t.showSchematicPorts,onCheckedChange:Be=>{t.onChangeShowSchematicPorts?.(Be===!0)}}),j.jsx("label",{htmlFor:"show-schematic-ports",className:"rf-text-xs rf-cursor-pointer",children:"Show Schematic Ports"})]})}),j.jsx(Gh,{className:"rf-flex rf-items-center rf-gap-2",onSelect:Be=>Be.preventDefault(),children:j.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[j.jsx(gY,{id:"show-schematic-grid",checked:t.showSchematicDebugGrid,onCheckedChange:Be=>{t.onChangeShowSchematicDebugGrid?.(Be===!0)}}),j.jsx("label",{htmlFor:"show-schematic-grid",className:"rf-text-xs rf-cursor-pointer",children:"Show Schematic Grid"})]})})]})})]})})]})]}),le,j.jsx(kWo,{open:b,onOpenChange:D,onExport:Ce}),j.jsx(CHt,{isOpen:re,onClose:()=>X(!1)}),j.jsx(Kqo,{isOpen:te,onClose:()=>se(!1),packageName:o}),j.jsx(jvt,{position:"top-center",reverseOrder:!1,containerStyle:{zIndex:1e5},toastOptions:{className:"rf-break-all",style:{zIndex:1e5}}}),j.jsx(H.OrderDialog,{isOpen:H.isOpen,onClose:H.close,stage:H.stage,setStage:H.setStage})]})};var KWo=Object.defineProperty,UWo=(t,e)=>KWo(t,"name",{value:e,configurable:!0}),YWo=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),zWo=ne.forwardRef(UWo(function(e,n){return j.jsx(gu.span,{...e,ref:n,style:{...YWo,...e.style}})},"VisuallyHidden")),VWo=zWo,JWo=Object.defineProperty,MI=(t,e)=>JWo(t,"name",{value:e,configurable:!0}),[W9e,NZo]=RE("Tooltip",[fre]),j9e=fre(),qWo="TooltipProvider",WWo=700,X9e="tooltip.open",[jWo,$9e]=W9e(qWo),XWo=MI(t=>{const{__scopeTooltip:e,delayDuration:n=WWo,skipDelayDuration:o=300,disableHoverableContent:i=!1,children:r}=t,s=ne.useRef(!0),a=ne.useRef(!1),A=ne.useRef(0);return ne.useEffect(()=>{const c=A.current;return()=>window.clearTimeout(c)},[]),j.jsx(jWo,{scope:e,isOpenDelayedRef:s,delayDuration:n,onOpen:ne.useCallback(()=>{o<=0||(window.clearTimeout(A.current),s.current=!1)},[o]),onClose:ne.useCallback(()=>{o<=0||(window.clearTimeout(A.current),A.current=window.setTimeout(()=>s.current=!0,o))},[o]),isPointerInTransitRef:a,onPointerInTransitChange:ne.useCallback(c=>{a.current=c},[]),disableHoverableContent:i,children:r})},"TooltipProvider"),Z9e="Tooltip",[$Wo,Yse]=W9e(Z9e),ZWo=MI(t=>{const{__scopeTooltip:e,children:n,open:o,defaultOpen:i,onOpenChange:r,disableHoverableContent:s,delayDuration:a}=t,A=$9e(Z9e,t.__scopeTooltip),c=j9e(e),[l,g]=ne.useState(null),[u,h]=ne.useState(void 0),d=Ox(),_=ne.useRef(0),m=s??A.disableHoverableContent,p=a??A.delayDuration,I=ne.useRef(!1),[f,C]=U5({prop:o,defaultProp:i??!1,onChange:MI(D=>{D?(A.onOpen(),document.dispatchEvent(new CustomEvent(X9e))):A.onClose(),r?.(D)},"onChange"),caller:Z9e}),y=ne.useMemo(()=>f?I.current?"delayed-open":"instant-open":"closed",[f]),E=ne.useCallback(()=>{window.clearTimeout(_.current),_.current=0,I.current=!1,C(!0)},[C]),B=ne.useCallback(()=>{window.clearTimeout(_.current),_.current=0,C(!1)},[C]),Q=ne.useCallback(()=>{window.clearTimeout(_.current),_.current=window.setTimeout(()=>{I.current=!0,C(!0),_.current=0},p)},[p,C]);ne.useEffect(()=>()=>{_.current&&(window.clearTimeout(_.current),_.current=0)},[]);const b=u??d;return j.jsx(i6e,{...c,children:j.jsx($Wo,{scope:e,contentId:b,setContentId:h,open:f,stateAttribute:y,trigger:l,onTriggerChange:g,onTriggerEnter:ne.useCallback(()=>{A.isOpenDelayedRef.current?Q():E()},[A.isOpenDelayedRef,Q,E]),onTriggerLeave:ne.useCallback(()=>{m?B():(window.clearTimeout(_.current),_.current=0)},[B,m]),onOpen:E,onClose:B,disableHoverableContent:m,children:n})})},"Tooltip"),iGt="TooltipTrigger",ejo=ne.forwardRef(MI(function(e,n){const{__scopeTooltip:o,...i}=e,r=Yse(iGt,o),s=$9e(iGt,o),a=j9e(o),A=ne.useRef(null),c=ag(n,A,r.onTriggerChange),l=ne.useRef(!1),g=ne.useRef(!1),u=ne.useCallback(()=>l.current=!1,[]);return ne.useEffect(()=>()=>document.removeEventListener("pointerup",u),[u]),j.jsx(j9t,{asChild:!0,...a,children:j.jsx(gu.button,{"aria-describedby":r.open?r.contentId:void 0,"data-state":r.stateAttribute,...i,ref:c,onPointerMove:Kr(e.onPointerMove,h=>{h.pointerType!=="touch"&&!g.current&&!s.isPointerInTransitRef.current&&(r.onTriggerEnter(),g.current=!0)}),onPointerLeave:Kr(e.onPointerLeave,()=>{r.onTriggerLeave(),g.current=!1}),onPointerDown:Kr(e.onPointerDown,()=>{r.open&&r.onClose(),l.current=!0,document.addEventListener("pointerup",u,{once:!0})}),onFocus:Kr(e.onFocus,()=>{l.current||r.onOpen()}),onBlur:Kr(e.onBlur,r.onClose),onClick:Kr(e.onClick,r.onClose)})})},"TooltipTrigger")),tjo="TooltipPortal",[RZo,njo]=W9e(tjo,{forceMount:void 0}),xY="TooltipContent",ojo=ne.forwardRef(MI(function(e,n){const o=njo(xY,e.__scopeTooltip),{forceMount:i=o.forceMount,side:r="top",...s}=e,a=Yse(xY,e.__scopeTooltip);return j.jsx(cQ,{present:i||a.open,children:a.disableHoverableContent?j.jsx(rGt,{side:r,...s,ref:n}):j.jsx(ijo,{side:r,...s,ref:n})})},"TooltipContent")),ijo=ne.forwardRef(MI(function(e,n){const o=Yse(xY,e.__scopeTooltip),i=$9e(xY,e.__scopeTooltip),r=ne.useRef(null),s=ag(n,r),[a,A]=ne.useState(null),{trigger:c,onClose:l}=o,g=r.current,{onPointerInTransitChange:u}=i,h=ne.useCallback(()=>{A(null),u(!1)},[u]),d=ne.useCallback((_,m)=>{const p=_.currentTarget,I={x:_.clientX,y:_.clientY},f=sGt(I,p.getBoundingClientRect()),C=aGt(I,f),y=AGt(m.getBoundingClientRect()),E=lGt([...C,...y]);A(E),u(!0)},[u]);return ne.useEffect(()=>()=>h(),[h]),ne.useEffect(()=>{if(c&&g){const _=MI(p=>d(p,g),"handleTriggerLeave"),m=MI(p=>d(p,c),"handleContentLeave");return c.addEventListener("pointerleave",_),g.addEventListener("pointerleave",m),()=>{c.removeEventListener("pointerleave",_),g.removeEventListener("pointerleave",m)}}},[c,g,d,h]),ne.useEffect(()=>{if(a){const _=MI(m=>{const p=m.target,I={x:m.clientX,y:m.clientY},f=c?.contains(p)||g?.contains(p),C=!cGt(I,a);f?h():C&&(h(),l())},"handleTrackPointerGrace");return document.addEventListener("pointermove",_),()=>document.removeEventListener("pointermove",_)}},[c,g,a,l,h]),j.jsx(rGt,{...e,ref:s})},"TooltipContentHoverable")),rjo=yNe("TooltipContent"),rGt=ne.forwardRef(MI(function(e,n){const{__scopeTooltip:o,children:i,"aria-label":r,id:s,onEscapeKeyDown:a,onPointerDownOutside:A,...c}=e,l=Yse(xY,o),g=j9e(o),{onClose:u}=l;ne.useEffect(()=>(document.addEventListener(X9e,u),()=>document.removeEventListener(X9e,u)),[u]),ne.useEffect(()=>{if(l.trigger){const d=MI(_=>{_.target instanceof Node&&_.target.contains(l.trigger)&&u()},"handleScroll");return window.addEventListener("scroll",d,{capture:!0}),()=>window.removeEventListener("scroll",d,{capture:!0})}},[l.trigger,u]);const{setContentId:h}=l;return q1(()=>(h(s),()=>{h(void 0)}),[s,h]),j.jsx(k3e,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:A,onFocusOutside:d=>d.preventDefault(),onDismiss:u,children:j.jsxs(X9t,{"data-state":l.stateAttribute,role:r?void 0:"tooltip",id:r?void 0:l.contentId,...g,...c,ref:n,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[j.jsx(rjo,{children:i}),r?j.jsx(VWo,{id:l.contentId,role:"tooltip",children:r}):null]})})},"TooltipContentImpl"));function sGt(t,e){const n=Math.abs(e.top-t.y),o=Math.abs(e.bottom-t.y),i=Math.abs(e.right-t.x),r=Math.abs(e.left-t.x);switch(Math.min(n,o,i,r)){case r:return"left";case i:return"right";case n:return"top";case o:return"bottom";default:throw new Error("unreachable")}}MI(sGt,"getExitSideFromRect");function aGt(t,e,n=5){const o=[];switch(e){case"top":o.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":o.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":o.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":o.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return o}MI(aGt,"getPaddedExitPoints");function AGt(t){const{top:e,right:n,bottom:o,left:i}=t;return[{x:i,y:e},{x:n,y:e},{x:n,y:o},{x:i,y:o}]}MI(AGt,"getPointsFromRect");function cGt(t,e){const{x:n,y:o}=t;let i=!1;for(let r=0,s=e.length-1;r<e.length;s=r++){const a=e[r],A=e[s],c=a.x,l=a.y,g=A.x,u=A.y;l>o!=u>o&&n<(g-c)*(o-l)/(u-l)+c&&(i=!i)}return i}MI(cGt,"isPointInPolygon");function lGt(t){const e=t.slice();return e.sort((n,o)=>n.x<o.x?-1:n.x>o.x?1:n.y<o.y?-1:n.y>o.y?1:0),gGt(e)}MI(lGt,"getHull");function gGt(t){if(t.length<=1)return t.slice();const e=[];for(let o=0;o<t.length;o++){const i=t[o];for(;e.length>=2;){const r=e[e.length-1],s=e[e.length-2];if((r.x-s.x)*(i.y-s.y)>=(r.y-s.y)*(i.x-s.x))e.pop();else break}e.push(i)}e.pop();const n=[];for(let o=t.length-1;o>=0;o--){const i=t[o];for(;n.length>=2;){const r=n[n.length-1],s=n[n.length-2];if((r.x-s.x)*(i.y-s.y)>=(r.y-s.y)*(i.x-s.x))n.pop();else break}n.push(i)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}MI(gGt,"getHullPresorted");var sjo=XWo,ajo=ZWo,Ajo=ejo,uGt=ojo;const cjo=sjo,ljo=ajo,gjo=Ajo,dGt=ne.forwardRef(({className:t,sideOffset:e=4,...n},o)=>j.jsx(uGt,{ref:o,sideOffset:e,className:ss("z-50 overflow-hidden rounded-md bg-slate-900 px-3 py-1.5 text-xs text-slate-50 animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 dark:bg-slate-50 dark:text-slate-900",t),...n}));dGt.displayName=uGt.displayName;const ujo="24b58135-86c7-4e4b-bf6e-cca862bc4b26",hGt="runframe-crisp-chat-script",djo="tscircuit.com",BY=t=>{window.$crisp=window.$crisp||[],window.$crisp.push(t)},hjo=()=>{if(window.$crisp=window.$crisp||[],window.CRISP_WEBSITE_ID=ujo,window.__RUNFRAME_CRISP_CONFIGURED__||(window.__RUNFRAME_CRISP_CONFIGURED__=!0,BY(["do","chat:hide"]),BY(["on","chat:closed",()=>BY(["do","chat:hide"])])),!document.getElementById(hGt)){const t=document.createElement("script");t.id=hGt,t.src="https://client.crisp.chat/l.js",t.async=!0,document.head.appendChild(t)}},_jo=()=>{hjo(),BY(["do","chat:show"]),BY(["do","chat:open"])},mjo=({isCli:t,hostname:e=typeof window<"u"?window.location.hostname:void 0}={})=>e?.toLowerCase()===djo?!1:!!t,pjo=()=>j.jsx(cjo,{children:j.jsxs(ljo,{children:[j.jsx(gjo,{asChild:!0,children:j.jsx(Sc,{type:"button",variant:"ghost",size:"icon","aria-label":"Get Support or Give Feedback",onClick:_jo,className:"rf-h-8 rf-w-8",children:j.jsx(tRo,{className:"rf-h-4 rf-w-4 rf-text-gray-500"})})}),j.jsx(dGt,{side:"bottom",children:"Get Support or Give Feedback"})]})}),Ijo=["assembly","pinout","analog_simulation","bom","circuit_json","errors","render_log","solvers"],e7e=t=>t instanceof Error?t.message:"An unknown error occurred",fjo=({code:t,fsMap:e,onRunClicked:n=void 0,errorMessage:o,errorStack:i,circuitJson:r,autoroutingGraphics:s,showRightHeaderContent:a=!0,showCodeTab:A=!1,codeTabContent:c,showJsonTab:l=!0,showRenderLogTab:g=!0,onActiveTabChange:u,renderLog:h,showImportAndFormatButtons:d=!0,className:_,headerClassName:m,leftHeaderContent:p,readOnly:I,isStreaming:f,autoroutingLog:C,onReportAutoroutingLog:y,isRunningCode:E,hasCodeChangedSinceLastRun:B,onEditEvent:Q,editEvents:b,defaultActiveTab:D,defaultTab:R,availableTabs:w,autoRotate3dViewerDisabled:H,showSchematicDebugGrid:G=!1,showSchematicPorts:K=!1,onChangeShowSchematicDebugGrid:U,onChangeShowSchematicPorts:q,showToggleFullScreen:W=!0,defaultToFullScreen:ee=!1,activeEffectName:re,allowSelectingVersion:X=!0,showFileMenu:te=!1,isWebEmbedded:se=!1,isCli:le=!1,projectName:ue,schematicSvgOptions:Ce,hideSchematicInAnalogSimulation:Ee=!1,onRerunWithDebug:Be,solverEvents:_e,onPcbBoundsSelected:ye})=>{CLt();const{versions:pe,latestVersion:we,lastRunEvalVersion:Ge,search:Ve,setSearch:Ie,selectVersion:qe}=Nzo(X),Me=ne.useMemo(()=>r?r.filter(ht=>ht&&"error_type"in ht||ht.type.includes("error")):null,[r]),Fe=ne.useMemo(()=>r?r.filter(ht=>ht&&"warning_type"in ht||ht.type.includes("warning")):null,[r]),Ye=ne.useMemo(()=>r?r.some(ht=>ht.type==="schematic_group"):!0,[r]),Ne=ne.useMemo(()=>r?.some(ht=>ht.type==="pcb_panel"),[r]),De=ne.useMemo(()=>!r||!E||Me?.length?!1:r.some(Tt=>Tt.type==="simulation_experiment")&&!Tun(r),[r,Me,E]),Ke=ne.useMemo(()=>Me?.find(ht=>ht.type.startsWith("simulation_")),[Me]);MLt({errorMessage:o,errorStack:i,circuitJsonErrors:Me});const ve=R??w?.[0]??"pcb",[Je,$e]=yLt("runframe-active-tab",D??ve,D);vzo({source:"runframe",component:"CircuitJsonPreview",isWebEmbedded:se,activeTab:Je});const[at,gt]=ne.useState(null),[dt,lt]=ne.useState(ee),[nt,xt]=ne.useState(G),[mt,Pt]=ne.useState(K),Ft=U?G:nt,Zt=q?K:mt,en=U??xt,Ut=q??Pt;EYo(dt);const fe=ne.useCallback(ht=>{$e(ht),u?.(ht)},[u,$e]),st=()=>{lt(!dt)};ne.useEffect(()=>{o&&(Je!=="errors"&&gt(Je),fe("errors"))},[o]),ne.useEffect(()=>{(Je==="code"||Je==="errors")&&r&&!o&&fe(at??D??R??w?.[0]??"pcb")},[r]);const ct=ne.useCallback(ht=>{window.TSCIRCUIT_3D_OBJECT_REF=ht===null?void 0:ht},[]);return j.jsx("div",{className:ss("flex flex-col relative rf-overflow-x-hidden rf-h-full",_),children:j.jsx("div",{className:ss("rf-md:sticky rf-md:top-2 rf-h-full",dt&&"rf-fixed rf-top-0 rf-left-0 rf-w-full rf-h-full rf-bg-white rf-overflow-hidden"),children:j.jsxs(Wce,{value:Je,onValueChange:fe,className:"rf-flex-grow rf-flex rf-flex-col rf-h-full",children:[j.jsxs("div",{className:ss("rf-flex rf-items-center rf-gap-2 rf-p-2 rf-pb-0",m),children:[p,te&&!p&&j.jsx(OWo,{isWebEmbedded:se,circuitJson:r,projectName:ue,autoroutingLog:C,onReportAutoroutingLog:y,showSchematicDebugGrid:Ft,onChangeShowSchematicDebugGrid:en,showSchematicPorts:Zt,onChangeShowSchematicPorts:Ut}),(p||te)&&j.jsx("div",{className:"rf-flex-grow"}),!p&&!te&&E&&j.jsx(zS,{className:"rf-w-4 rf-h-4 rf-animate-spin"}),!p&&!te&&j.jsx("div",{className:"rf-flex-grow"}),h&&h.progress!==1&&!o&&j.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2 rf-min-w-0 rf-max-w-xs",children:[re?j.jsx("div",{className:"rf-text-xs rf-text-gray-500 rf-truncate rf-min-w-0",title:re,children:re}):h.lastRenderEvent&&j.jsx("div",{className:"rf-text-xs rf-text-gray-500 rf-truncate rf-min-w-0",title:h.lastRenderEvent?.phase??"",children:h.lastRenderEvent?.phase??""}),j.jsx("div",{className:"rf-w-4 rf-h-4 rf-bg-blue-500 rf-opacity-50 rf-rounded-full rf-text-white rf-flex-shrink-0",children:j.jsx(zS,{className:"rf-w-4 rf-h-4 rf-animate-spin"})}),j.jsxs("div",{className:"rf-text-xs rf-font-bold rf-text-gray-700 rf-tabular-nums rf-flex-shrink-0",children:[((h.progress??0)*100).toFixed(1),"%"]})]}),a&&mjo({isCli:le})&&j.jsx(pjo,{}),a&&j.jsxs(IV,{children:[A&&j.jsx(dQ,{value:"code",children:"Code"}),!w||w.includes("pcb")?j.jsxs(dQ,{value:"pcb",className:"rf-whitespace-nowrap",children:[r&&j.jsx("span",{className:ss("rf-inline-flex rf-items-center rf-justify-center rf-w-2 rf-h-2 rf-mr-1 rf-text-xs rf-font-bold rf-text-white rf-rounded-full",B?"rf-bg-gray-500":"rf-bg-blue-500")}),"PCB"]}):null,!w||w.includes("schematic")?j.jsxs(dQ,{value:"schematic",className:ss("rf-whitespace-nowrap",r&&!Ye&&"rf-opacity-50"),disabled:r?!Ye||Ne:!1,children:[r&&j.jsx("span",{className:ss("rf-inline-flex rf-items-center rf-justify-center rf-w-2 rf-h-2 rf-mr-1 rf-text-xs rf-font-bold rf-text-white rf-rounded-full",B?"rf-bg-gray-500":"rf-bg-blue-500")}),"Schematic"]}):null,!w||w.includes("cad")?j.jsxs(dQ,{value:"cad",children:[r&&j.jsx("span",{className:ss("inline-flex items-center justify-center w-2 h-2 mr-1 text-xs font-bold text-white rounded-full",B?"rf-bg-gray-500":"rf-bg-blue-500")}),"3D"]}):null,!["pcb","cad","schematic"].includes(Je)&&j.jsx(dQ,{value:Je,children:bFe(Je)}),j.jsxs(Rre,{children:[j.jsx(Tre,{asChild:!0,children:j.jsxs("div",{className:"rf-whitespace-nowrap rf-p-2 rf-mr-1 rf-cursor-pointer rf-relative",children:[j.jsx(WNo,{className:"rf-w-4 rf-h-4"}),(Me&&Me.length>0||o)&&j.jsx("span",{className:"rf-inline-flex rf-absolute rf-top-[6px] rf-right-[4px] rf-items-center rf-justify-center rf-w-1 rf-h-1 rf-ml-2 rf-text-[8px] rf-font-bold rf-text-white rf-bg-red-500 rf-rounded-full"})]})}),j.jsxs(WU,{className:"rf-*:text-xs rf-z-[101]",children:[Ijo.filter(ht=>!w||w.includes(ht)).map(ht=>j.jsxs(Gh,{onSelect:()=>fe(ht),children:[Je!==ht&&j.jsx(A9t,{className:"rf-w-3 rf-h-3 rf-opacity-30"}),Je===ht&&j.jsx(N3e,{className:"rf-w-3 rf-h-3"}),j.jsx("div",{className:"rf-pr-2",children:bFe(ht)}),ht==="errors"&&(Me&&Me.length>0||o)&&j.jsx("span",{className:"rf-inline-flex rf-items-center rf-justify-center rf-w-3 rf-h-3 rf-ml-2 rf-text-[8px] rf-font-bold rf-text-white rf-bg-red-500 rf-rounded-full",children:o?1:Me?.length}),ht==="solvers"&&_e&&_e.length>0&&j.jsx("span",{className:"rf-inline-flex rf-items-center rf-justify-center rf-min-w-[12px] rf-h-3 rf-px-1 rf-ml-2 rf-text-[8px] rf-font-bold rf-text-white rf-bg-blue-500 rf-rounded-full",children:_e.length})]},ht)),j.jsx(Gh,{disabled:!0,className:"rf-opacity-60 rf-cursor-default rf-select-none",children:j.jsxs("div",{className:"rf-pr-2 rf-text-xs rf-text-gray-500",children:["@tscircuit/runframe@",wLt.split(".").map((ht,Tt)=>Tt===2?parseInt(ht)+1:ht).join(".")]})}),X?j.jsxs(qU,{onOpenChange:ht=>!ht&&Ie(""),children:[j.jsx(rk,{className:"rf-text-xs rf-opacity-60",children:j.jsxs("div",{className:"rf-pr-2 rf-text-xs rf-text-gray-500",children:["@tscircuit/eval@",Ge??we??"latest"]})}),j.jsx(JU,{children:j.jsxs(sk,{className:"rf-*:text-xs rf-w-40 rf-max-h-[200px] rf-overflow-y-auto",children:[j.jsx("div",{className:"rf-p-1",children:j.jsx(b6e,{value:Ve,onChange:ht=>Ie(ht.target.value),placeholder:"Search...",className:"rf-h-7 rf-text-xs"})}),j.jsx(L7t,{}),j.jsx(Gh,{onSelect:()=>qe(null),children:we?`${we} (latest)`:"latest"}),pe.map(ht=>j.jsx(Gh,{onSelect:()=>qe(ht),children:ht},ht))]})})]}):Ge&&j.jsx(Gh,{disabled:!0,className:"rf-opacity-60 rf-cursor-default rf-select-none",children:j.jsxs("div",{className:"rf-pr-2 rf-text-xs rf-text-gray-500",children:["@tscircuit/eval@",Ge]})})]})]})]}),W&&j.jsx(Sc,{onClick:st,variant:"ghost",children:dt?j.jsx(nRo,{size:16}):j.jsx(XNo,{size:16})})]}),A&&j.jsx(Bf,{value:"code",className:"rf-flex-grow rf-overflow-hidden",children:j.jsx("div",{className:"rf-h-full",children:c})}),(!w||w.includes("pcb"))&&j.jsx(Bf,{value:"pcb",children:j.jsx("div",{className:ss("rf-overflow-hidden",dt?"rf-h-[calc(100vh-52px)]":"rf-h-full"),children:j.jsx(YS,{fallbackRender:({error:ht})=>j.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:j.jsxs("div",{className:"rf-p-4",children:[j.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error loading PCB viewer"}),j.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:e7e(ht)})]})}),children:r?j.jsx(CYo,{focusOnHover:!1,circuitJson:r,debugGraphics:s,onBoundsSelected:ye,containerClassName:ss("rf-h-full rf-w-full",dt?"rf-min-h-[calc(100vh-240px)]":"rf-min-h-[620px]"),onEditEventsChanged:ht=>{if(Q)for(const Tt of ht)Q(Tt)}}):j.jsx(c5,{onRunClicked:n})})})}),(!w||w.includes("assembly"))&&j.jsx(Bf,{value:"assembly",children:j.jsx("div",{className:ss("rf-overflow-auto",dt?"rf-h-[calc(100vh-60px)]":"rf-h-full rf-min-h-[620px]"),children:j.jsx(YS,{fallback:j.jsx("div",{children:"Error loading Assembly"}),children:r?j.jsx(kLo,{circuitJson:r,containerStyle:{height:"100%"},editingEnabled:!0,debugGrid:!0}):j.jsx(c5,{onRunClicked:n})})})}),(!w||w.includes("pinout"))&&j.jsx(Bf,{value:"pinout",children:j.jsx("div",{className:ss("rf-overflow-auto",dt?"rf-h-[calc(100vh-60px)]":"rf-h-full rf-min-h-[620px]"),children:j.jsx(YS,{fallback:j.jsx("div",{children:"Error loading Pinout Viewer"}),children:r?j.jsx(FLo,{circuitJson:r,containerStyle:{height:"100%"}}):j.jsx(c5,{onRunClicked:n})})})}),(!w||w.includes("schematic"))&&j.jsx(Bf,{value:"schematic",children:j.jsx("div",{className:ss("rf-overflow-auto rf-bg-white",dt?"rf-h-[calc(100vh-60px)]":"rf-h-full rf-min-h-[620px]"),children:j.jsx(YS,{fallbackRender:({error:ht})=>j.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:j.jsxs("div",{className:"rf-p-4",children:[j.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error loading Schematic"}),j.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:e7e(ht)})]})}),children:r?j.jsx(CLo,{circuitJson:r,containerStyle:{height:"100%"},editingEnabled:!0,onEditEvent:ht=>{Q?.(ht)},debugGrid:Ft,showSchematicPorts:Zt,css:Ce?.css,className:Ce?.className}):j.jsx(c5,{onRunClicked:n})})})}),(!w||w.includes("cad"))&&j.jsx(Bf,{value:"cad",children:j.jsx("div",{className:ss("rf-overflow-auto",dt?"rf-h-[calc(100vh-60px)]":"rf-h-full rf-min-h-[620px]"),children:j.jsx(YS,{fallbackRender:({error:ht,resetErrorBoundary:Tt})=>j.jsx(kNo,{error:ht,resetErrorBoundary:Tt}),children:r?j.jsx(RNo,{ref:ct,circuitJson:r,autoRotateDisabled:H},`cad-${dt}`):j.jsx(c5,{onRunClicked:n})})})}),(!w||w.includes("analog_simulation"))&&j.jsx(Bf,{value:"analog_simulation",children:j.jsx("div",{className:ss("rf-overflow-auto",dt?"rf-h-[calc(100vh-60px)]":"rf-h-full rf-min-h-[620px]"),children:j.jsx(YS,{fallback:j.jsx("div",{children:"Error loading Analog Simulation"}),children:r?Ke?j.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:j.jsxs("div",{className:"rf-p-4",children:[j.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error running analog simulation"}),j.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:Ke.message})]})}):De?j.jsx("div",{className:"rf-flex rf-h-full rf-min-h-[300px] rf-items-center rf-justify-center rf-bg-slate-50",children:j.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2 rf-text-sm rf-text-slate-600",children:[j.jsx(zS,{className:"rf-h-4 rf-w-4 rf-animate-spin"}),"Running analog simulation..."]})}):j.jsx(TLo,{circuitJson:r,hideSchematic:Ee,containerStyle:{height:"100%"}}):j.jsx(c5,{onRunClicked:n})})})}),(!w||w.includes("bom"))&&j.jsx(Bf,{value:"bom",children:j.jsx("div",{className:ss("rf-overflow-auto",dt?"rf-h-[calc(100vh-60px)]":"rf-h-full rf-min-h-[620px]"),children:j.jsx(YS,{fallbackRender:({error:ht})=>j.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:j.jsxs("div",{className:"rf-p-4",children:[j.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error loading Bill of Materials"}),j.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:e7e(ht)})]})}),children:r?j.jsx(ZLo,{circuitJson:r}):j.jsx(c5,{onRunClicked:n})})})}),(!w||w.includes("circuit_json"))&&j.jsx(Bf,{value:"circuit_json",children:j.jsx("div",{className:ss("rf-overflow-auto",dt?"rf-h-[calc(100vh-60px)]":"rf-h-full rf-min-h-[620px]"),children:j.jsx(YS,{fallback:j.jsx("div",{children:"Error loading JSON viewer"}),children:r?j.jsx(GLo,{elements:r}):j.jsx(c5,{onRunClicked:n})})})}),(!w||w.includes("errors"))&&j.jsx(Bf,{value:"errors",className:"rf-h-full",children:j.jsx("div",{className:ss("rf-overflow-hidden",dt?"rf-h-[calc(100vh-60px)]":"rf-h-full rf-min-h-[620px]"),children:o||Me&&Me.length>0||r?j.jsx(wFo,{code:t,fsMap:e,circuitJsonErrors:Me,circuitJsonWarnings:Fe,errorMessage:o,errorStack:i,circuitJson:r,evalVersion:Ge,autoroutingLog:C,onReportAutoroutingLog:y}):j.jsx(c5,{onRunClicked:n})})}),g&&(!w||w.includes("render_log"))&&j.jsx(Bf,{value:"render_log",children:j.jsx(QYo,{renderLog:h,onRerunWithDebug:Be})}),(!w||w.includes("solvers"))&&j.jsx(Bf,{value:"solvers",children:j.jsx("div",{className:ss("rf-overflow-hidden",dt?"rf-h-[calc(100vh-60px)]":"rf-h-full rf-min-h-[620px]"),children:j.jsx(YS,{fallback:j.jsx("div",{children:"Error loading Solvers view"}),children:j.jsx(Pzo,{solverEvents:_e})})})})]})})})};pUt.createRoot(document.getElementById("root")).render(j.jsx("div",{style:{height:"100vh"},children:j.jsx(fjo,{defaultActiveTab:"cad",autoRotate3dViewerDisabled:!0,showRightHeaderContent:!1,circuitJson:window.CIRCUIT_JSON||{},...window.CIRCUIT_JSON_PREVIEW_PROPS||{}})}));const Cjo=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}))}));
5875
+ ${E}`)}},[e,u]),ne.useEffect(()=>{e&&!u&&oGt().then(E=>{_(E.size)}).catch(E=>{console.error("Failed to fetch file count",E),_(0)})},[e,u]);const I=ne.useCallback(()=>{s(null),h(null),A(null),l([]),g.current&&(g.current.value=""),n(!0)},[]),f=ne.useCallback(()=>{n(!1)},[]),C=ne.useCallback(async()=>{i(!0),s(null),A(null),l([]);const E=OM(),B=g.current?.value||"";try{const Q=await oGt();if(Q.size===0){la.error("No project files available to include in the bug report"),i(!1);return}const b=new Date(Date.now()+1440*60*1e3).toISOString(),R=(await E.post("bug_reports/create",{json:{text:B.trim()||void 0,is_auto_deleted:!0,delete_at:b}}).json()).bug_report.bug_report_id,w=Array.from(Q.entries()),H=[];for(let K=0;K<w.length;K++){const[U,q]=w[K];A({current:K+1,total:w.length,currentFile:U});try{const W={bug_report_id:R,file_path:U};q.text_content&&(W.content_text=q.text_content),q.binary_content_b64&&(W.content_base64=q.binary_content_b64),await E.post("bug_reports/upload_file",{json:W})}catch(W){const ee=W instanceof HM?`HTTP ${W.response.status}`:W instanceof Error?W.message:"Upload failed";H.push({filePath:U,message:ee}),l([...H])}}A(null);const G=RWo(R);h({bugReportUrl:G})}catch(Q){if(console.error("Failed to submit bug report",Q),Q instanceof HM)if(Q.response.status===401)if(p){const b="Your session has expired. Please sign in again to continue.";s(b),la.error(b),m&&(f(),m())}else{const b="You must be logged in to report a bug. Please sign in via cli and try again.";s(b),la.error(b),setTimeout(()=>{m&&(f(),m())},1e3)}else{const b=`Failed to submit bug report (${Q.response.status})`;s(b),la.error(b)}else if(Q instanceof Error)s(Q.message),la.error(Q.message);else{const b="Failed to submit bug report";s(b),la.error(b)}}finally{i(!1)}},[p,m]);return{BugReportDialog:ne.useMemo(()=>{const E=a?Math.round(a.current/a.total*100):0;return j.jsx(WLt,{open:e,onOpenChange:B=>{B?(s(null),h(null),A(null),l([]),n(!0)):o||f()},children:j.jsxs(r9e,{children:[j.jsxs(s9e,{children:[j.jsx(A9e,{children:u?"Bug Report Created":"Report Bug"}),j.jsx(c9e,{asChild:!0,children:u?j.jsxs("div",{className:"rf-text-left rf-space-y-3 rf-text-sm",children:[j.jsx("p",{children:"Bug report created successfully."}),c.length>0&&j.jsxs("div",{className:"rf-bg-red-50 rf-border rf-border-red-200 rf-rounded rf-p-2 rf-max-h-28 rf-overflow-y-auto rf-overflow-x-hidden",children:[j.jsxs("p",{className:"rf-text-red-700 rf-font-medium rf-text-xs rf-mb-1",children:[c.length," file(s) failed:"]}),c.map((B,Q)=>j.jsxs("div",{className:"rf-text-red-600 rf-text-xs rf-mb-0.5",title:`${B.filePath}: ${B.message}`,children:[j.jsx("span",{className:"rf-font-medium rf-break-all",children:B.filePath.split("/").pop()}),j.jsx("span",{className:"rf-text-red-500 rf-block rf-truncate",children:B.message})]},Q))]}),j.jsx("div",{children:j.jsx("a",{className:"rf-text-blue-600 hover:rf-underline",href:u.bugReportUrl,target:"_blank",rel:"noreferrer",children:"View bug report"})}),j.jsxs("p",{children:["Please share this link privately with tscircuit staff so we can help debug. Join the",j.jsx("a",{className:"rf-ml-1 rf-text-blue-600 hover:rf-underline",href:"https://tscircuit.com/join",target:"_blank",rel:"noreferrer",children:"tscircuit Discord"}),"."]})]}):j.jsx("div",{className:"rf-text-left rf-space-y-3 rf-text-sm",children:a?j.jsxs("div",{className:"rf-space-y-2 rf-overflow-hidden",children:[j.jsxs("div",{className:"rf-flex rf-justify-between rf-text-xs",children:[j.jsx("span",{children:"Uploading files..."}),j.jsxs("span",{children:[a.current,"/",a.total]})]}),j.jsx("div",{className:"rf-w-full rf-h-2 rf-bg-gray-200 rf-rounded-full rf-overflow-hidden",children:j.jsx("div",{className:"rf-h-full rf-bg-blue-500 rf-transition-all rf-duration-150",style:{width:`${E}%`}})}),j.jsx("p",{className:"rf-text-xs rf-text-gray-500 rf-break-all rf-truncate rf-w-full rf-max-w-full",children:`${a.currentFile.slice(0,60)}${a.currentFile.length>60?"...":""}`}),c.length>0&&j.jsx("div",{className:"rf-bg-red-50 rf-border rf-border-red-200 rf-rounded rf-p-2 rf-max-h-20 rf-overflow-y-auto rf-overflow-x-hidden",children:c.map((B,Q)=>j.jsxs("div",{className:"rf-text-red-600 rf-text-xs rf-mb-0.5",title:`${B.filePath}: ${B.message}`,children:[j.jsx("span",{className:"rf-font-medium rf-break-all",children:B.filePath.split("/").pop()}),j.jsx("span",{className:"rf-text-red-500 rf-block rf-truncate",children:B.message})]},Q))})]}):j.jsxs(j.Fragment,{children:[j.jsxs("p",{children:["Reporting a bug will upload your entire project",d>0?` (${d} file${d===1?"":"s"})`:""," ","to tscircuit support."]}),j.jsxs("div",{className:"rf-space-y-2",children:[j.jsx("label",{htmlFor:"bug-description",className:"rf-block rf-font-medium",children:"Description (optional)"}),j.jsx("textarea",{ref:g,id:"bug-description",className:"rf-w-full rf-min-h-[100px] rf-px-3 rf-py-2 rf-text-sm rf-border rf-border-gray-300 rf-rounded-md focus:rf-outline-none focus:rf-ring-2 focus:rf-ring-blue-500",placeholder:"Describe the issue you're experiencing...",disabled:o})]}),j.jsxs("p",{children:["Share the generated bug report link privately with tscircuit staff so we can help debug your issue. You can also reach out on our",j.jsx("a",{className:"rf-ml-1 rf-text-blue-600 hover:rf-underline",href:"https://tscircuit.com/join",target:"_blank",rel:"noreferrer",children:"Discord community"}),"."]}),!p&&j.jsx("p",{className:"rf-text-red-600",children:"You appear to be logged out. Please log in before reporting a bug or the upload will fail."}),r&&j.jsx("p",{className:"rf-text-red-600",children:r})]})})})]}),j.jsx(a9e,{children:u?j.jsx("button",{type:"button",className:qT(),onClick:()=>{f()},children:"Close"}):j.jsxs(j.Fragment,{children:[j.jsx(l9e,{disabled:o,onClick:()=>{o||f()},children:"Cancel"}),!p&&m?j.jsx("button",{type:"button",className:qT(),onClick:B=>{B.preventDefault(),f(),m()},children:"Sign In"}):j.jsx("button",{type:"button",className:Kx(qT(),o&&"rf-opacity-70 rf-cursor-not-allowed"),disabled:o,onClick:B=>{B.preventDefault(),C()},children:o?"Reporting...":"Upload & Report"})]})})]})},"bug-report-dialog")},[e,o,f,r,u,d,p,C,m,a,c]),openBugReportDialog:I}};function kWo({open:t,onOpenChange:e,onExport:n}){const[o,i]=ne.useState(!1),r=()=>{n({includeSilkscreen:o}),e(!1)},s=()=>{e(!1)};return j.jsx(uY,{open:t,onOpenChange:e,children:j.jsxs(hk,{children:[j.jsxs(_k,{children:[j.jsx(mk,{children:"LightBurn Export Options"}),j.jsx(hY,{children:"Configure export settings for PCB laser ablation with LightBurn"})]}),j.jsx("div",{className:"rf-flex rf-flex-col rf-gap-4 rf-py-4",children:j.jsxs("div",{className:"rf-flex rf-items-center rf-space-x-2",children:[j.jsx(gY,{id:"includeSilkscreen",checked:o,onCheckedChange:a=>i(a===!0)}),j.jsx("label",{htmlFor:"includeSilkscreen",className:"rf-text-xs rf-font-medium rf-leading-none peer-disabled:rf-cursor-not-allowed peer-disabled:rf-opacity-70",children:"Include silkscreen layer"})]})}),j.jsxs(dY,{children:[j.jsx(Sc,{variant:"outline",onClick:s,children:"Cancel"}),j.jsx(Sc,{onClick:r,children:"Export"})]})]})})}const FWo=/#(\d+)/,LWo=t=>{const e=t.match(FWo);if(!e)return null;const n=Number.parseInt(e[1],10);return Number.isFinite(n)?n:null},HWo=t=>{if(typeof t=="number")return Number.isFinite(t)?t:null;if(typeof t=="string"){const e=new Date(t).getTime();return Number.isFinite(e)?e:null}return null},GWo=t=>{if(!t)return null;let e=null,n=-1,o=-1;for(const[i,r]of Object.entries(t)){const s=LWo(i),a=HWo(r.createdAt);if(s!==null){s>n&&(n=s,e={key:i,value:r});continue}if(n===-1){if(a!==null&&a>o){o=a,e={key:i,value:r};continue}e||(e={key:i,value:r})}}return e},OWo=t=>{const e=j8e(Be=>Be.lastRunEvalVersion),n=nb(Be=>Be.currentMainComponentPath),[o,i]=ne.useState(null),[r,s]=ne.useState(!1),[a,A]=ne.useState(!0),[c,l]=ne.useState(!1),[g,u]=ne.useState(null),[h,d]=ne.useState(null),[_,m]=ne.useState(!1),[p,I]=ne.useState(null),[f,C]=ne.useState(null),[y,E]=ne.useState(!1),[B,Q]=ne.useState(!1),[b,D]=ne.useState(!1),[R,w]=ne.useState(null),H=wWo(),G=nb(Be=>Be.pushEvent),K=nb(Be=>Be.recentEvents),U=ne.useMemo(()=>Date.now(),[]);Gzo(Be=>{if(!(new Date(Be.created_at).valueOf()<U+500)){if(Be.event_type==="FILE_UPDATED"){s(!0);return}if(Be.event_type==="SNIPPET_SAVED"){s(!1),A(!1),I("Snippet saved successfully."),E(!1);return}Be.event_type==="REQUEST_EXPORT"&&(Q(!0),I("Export processing..."),E(!1)),Be.event_type==="EXPORT_CREATED"&&(I(`Export created: ${Be.exportFilePath}`),E(!1),Q(!1))}}),ne.useEffect(()=>{if(!c||g===null)return;const Be=K.filter(pe=>new Date(pe.created_at).valueOf()>g),_e=Be.find(pe=>pe.event_type==="FAILED_TO_SAVE_SNIPPET"),ye=Be.find(pe=>pe.event_type==="SNIPPET_SAVED");_e&&(l(!1),u(null),C(_e.message??"Failed to save snippet. See console for error."),console.error(_e.message),E(!0),_e.error_code==="SNIPPET_UNSET"&&_e.available_snippet_names&&(d(_e.available_snippet_names),m(!0))),ye&&(l(!1),u(null),I("Snippet saved successfully."),E(!1))},[K,c]);const q=async()=>{l(!0),u(Date.now()),I(null),E(!1),await G({event_type:"REQUEST_TO_SAVE_SNIPPET",snippet_name:o})},ee=nb(Be=>Be.circuitJson)??t.circuitJson,[re,X]=ne.useState(!1),[te,se]=ne.useState(!1),{BugReportDialog:le,openBugReportDialog:ue}=TWo({onLoginRequired:t.onLoginRequired}),Ce=async Be=>{R&&(await EHt({circuitJson:R.circuitJson,projectName:R.projectName,options:Be}),w(null))},Ee=ne.useMemo(()=>GWo(t.autoroutingLog),[t.autoroutingLog]);return j.jsxs(j.Fragment,{children:[j.jsxs("div",{className:"rf-flex rf-items-center rf-gap-1 rf-flex-shrink-0",children:[j.jsxs(Rre,{children:[j.jsx(Tre,{asChild:!0,children:j.jsx("div",{className:"rf-whitespace-nowrap rf-text-xs font-medium rf-p-2 rf-mx-1 rf-cursor-pointer rf-relative",children:"File"})}),j.jsxs(WU,{className:"rf-z-[101]",children:[!t.isWebEmbedded&&j.jsxs(j.Fragment,{children:[j.jsx(Gh,{className:"rf-text-xs",onSelect:q,disabled:c,children:c?"Saving...":"Push"}),parseInt(window.location.port)>5e3&&j.jsx(Gh,{className:"rf-text-xs",onSelect:()=>{H.open()},children:"Order"}),j.jsx(Gh,{className:"rf-text-xs",onSelect:()=>X(!0),disabled:c,children:"Import"}),j.jsx(Gh,{className:"rf-text-xs",onSelect:()=>{if(!hV()){la.error("Requires tscircuit token");return}se(!0)},children:"AI Review"})]}),!t.isWebEmbedded&&t.onLoginRequired&&j.jsx(Gh,{className:"rf-text-xs",onSelect:()=>{t.onLoginRequired?.()},children:"Sign In"}),!t.isWebEmbedded&&j.jsxs(qU,{children:[j.jsx(rk,{className:"rf-text-xs",children:"Report Bug"}),j.jsx(JU,{children:j.jsxs(sk,{children:[j.jsx(Gh,{className:"rf-text-xs",onSelect:()=>{ue()},children:"Report Entire Circuit"}),j.jsx(Gh,{className:"rf-text-xs",disabled:!Ee||!t.onReportAutoroutingLog,onSelect:()=>{!Ee||!t.onReportAutoroutingLog||t.onReportAutoroutingLog(Ee.key,{simpleRouteJson:Ee.value.simpleRouteJson})},children:"Report Autorouter Bug"})]})})]}),j.jsxs(qU,{children:[j.jsx(rk,{className:"rf-text-xs",disabled:B,children:B?"Exporting...":"Export"}),j.jsx(JU,{children:j.jsx(sk,{children:nqo.map((Be,_e)=>j.jsx(Gh,{onSelect:()=>{if(!ee){la.error("No Circuit JSON to export");return}let ye="Untitled";if(n){const Ge=n.split("/").pop();Ge&&(ye=Ge.replace(/\.[^.]+$/,""))}const pe=t.projectName??o??ye,we=Ee?.value.simpleRouteJson;if(Be.name==="LightBurn"){w({circuitJson:ee,projectName:pe}),D(!0);return}oqo({exportName:Be.name,circuitJson:ee,simpleRouteJson:we,projectName:pe?.replace(/\.(board|circuit)$/,"")})},disabled:B||Be.name==="Simple Route JSON"&&!Ee,children:j.jsx("span",{className:"rf-text-xs",children:Be.name})},_e))})})]}),!t.isWebEmbedded&&j.jsxs(qU,{children:[j.jsx(rk,{className:"rf-text-xs",children:"Advanced"}),j.jsx(JU,{children:j.jsxs(sk,{children:[j.jsx(Gh,{className:"rf-flex rf-items-center rf-gap-2",children:j.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[j.jsx(gY,{id:"load-latest-eval",checked:t.shouldLoadLatestEval,onCheckedChange:Be=>{t.onChangeShouldLoadLatestEval?.(Be===!0)}}),j.jsx("label",{htmlFor:"load-latest-eval",className:"rf-text-xs rf-cursor-pointer",children:"Force Latest @tscircuit/eval"})]})}),e&&j.jsx(Gh,{className:"rf-flex rf-items-center rf-gap-2",children:j.jsx("div",{className:"rf-flex rf-items-center rf-gap-2",children:j.jsxs("span",{className:"rf-text-xs",children:["@tscircuit/eval@",e]})})}),j.jsx(Gh,{className:"rf-flex rf-items-center rf-gap-2",children:j.jsx("div",{className:"rf-flex rf-items-center rf-gap-2",children:j.jsxs("span",{className:"rf-text-xs",children:["@tscircuit/runframe@",Mzo.version]})})}),j.jsx(Gh,{className:"rf-flex rf-items-center rf-gap-2",onClick:()=>{window.open("/api/admin","_blank")},children:j.jsx("div",{className:"rf-flex rf-items-center rf-gap-2",children:j.jsx("span",{className:"rf-text-xs",children:"CLI Admin Panel"})})})]})})]})]}),j.jsx(WLt,{open:y,onOpenChange:E,children:j.jsxs(r9e,{children:[j.jsxs(s9e,{children:[j.jsx(A9e,{children:"Error Saving Snippet"}),j.jsx(c9e,{children:f})]}),j.jsx(a9e,{children:j.jsx(l9e,{onClick:()=>E(!1),children:"Dismiss"})})]})}),j.jsx(Hzo,{snippetNames:h??[],onSelect:async Be=>{l(!0),u(Date.now()),i(Be),await G({event_type:"REQUEST_TO_SAVE_SNIPPET",snippet_name:Be}),m(!1)},onCancel:()=>m(!1),isOpen:_})]}),j.jsxs(Rre,{children:[j.jsx(Tre,{asChild:!0,children:j.jsx("div",{className:"rf-whitespace-nowrap rf-text-xs font-medium rf-p-2 rf-mx-1 rf-cursor-pointer rf-relative",children:"View"})}),j.jsx(WU,{className:"rf-z-[101]",children:j.jsxs(qU,{children:[j.jsx(rk,{className:"rf-text-xs",children:"Schematic"}),j.jsx(JU,{children:j.jsxs(sk,{children:[j.jsx(Gh,{className:"rf-flex rf-items-center rf-gap-2",onSelect:Be=>Be.preventDefault(),children:j.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[j.jsx(gY,{id:"show-schematic-ports",checked:t.showSchematicPorts,onCheckedChange:Be=>{t.onChangeShowSchematicPorts?.(Be===!0)}}),j.jsx("label",{htmlFor:"show-schematic-ports",className:"rf-text-xs rf-cursor-pointer",children:"Show Schematic Ports"})]})}),j.jsx(Gh,{className:"rf-flex rf-items-center rf-gap-2",onSelect:Be=>Be.preventDefault(),children:j.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[j.jsx(gY,{id:"show-schematic-grid",checked:t.showSchematicDebugGrid,onCheckedChange:Be=>{t.onChangeShowSchematicDebugGrid?.(Be===!0)}}),j.jsx("label",{htmlFor:"show-schematic-grid",className:"rf-text-xs rf-cursor-pointer",children:"Show Schematic Grid"})]})})]})})]})})]})]}),le,j.jsx(kWo,{open:b,onOpenChange:D,onExport:Ce}),j.jsx(CHt,{isOpen:re,onClose:()=>X(!1)}),j.jsx(Kqo,{isOpen:te,onClose:()=>se(!1),packageName:o}),j.jsx(jvt,{position:"top-center",reverseOrder:!1,containerStyle:{zIndex:1e5},toastOptions:{className:"rf-break-all",style:{zIndex:1e5}}}),j.jsx(H.OrderDialog,{isOpen:H.isOpen,onClose:H.close,stage:H.stage,setStage:H.setStage})]})};var KWo=Object.defineProperty,UWo=(t,e)=>KWo(t,"name",{value:e,configurable:!0}),YWo=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),zWo=ne.forwardRef(UWo(function(e,n){return j.jsx(gu.span,{...e,ref:n,style:{...YWo,...e.style}})},"VisuallyHidden")),VWo=zWo,JWo=Object.defineProperty,MI=(t,e)=>JWo(t,"name",{value:e,configurable:!0}),[W9e,NZo]=RE("Tooltip",[fre]),j9e=fre(),qWo="TooltipProvider",WWo=700,X9e="tooltip.open",[jWo,$9e]=W9e(qWo),XWo=MI(t=>{const{__scopeTooltip:e,delayDuration:n=WWo,skipDelayDuration:o=300,disableHoverableContent:i=!1,children:r}=t,s=ne.useRef(!0),a=ne.useRef(!1),A=ne.useRef(0);return ne.useEffect(()=>{const c=A.current;return()=>window.clearTimeout(c)},[]),j.jsx(jWo,{scope:e,isOpenDelayedRef:s,delayDuration:n,onOpen:ne.useCallback(()=>{o<=0||(window.clearTimeout(A.current),s.current=!1)},[o]),onClose:ne.useCallback(()=>{o<=0||(window.clearTimeout(A.current),A.current=window.setTimeout(()=>s.current=!0,o))},[o]),isPointerInTransitRef:a,onPointerInTransitChange:ne.useCallback(c=>{a.current=c},[]),disableHoverableContent:i,children:r})},"TooltipProvider"),Z9e="Tooltip",[$Wo,Yse]=W9e(Z9e),ZWo=MI(t=>{const{__scopeTooltip:e,children:n,open:o,defaultOpen:i,onOpenChange:r,disableHoverableContent:s,delayDuration:a}=t,A=$9e(Z9e,t.__scopeTooltip),c=j9e(e),[l,g]=ne.useState(null),[u,h]=ne.useState(void 0),d=Ox(),_=ne.useRef(0),m=s??A.disableHoverableContent,p=a??A.delayDuration,I=ne.useRef(!1),[f,C]=U5({prop:o,defaultProp:i??!1,onChange:MI(D=>{D?(A.onOpen(),document.dispatchEvent(new CustomEvent(X9e))):A.onClose(),r?.(D)},"onChange"),caller:Z9e}),y=ne.useMemo(()=>f?I.current?"delayed-open":"instant-open":"closed",[f]),E=ne.useCallback(()=>{window.clearTimeout(_.current),_.current=0,I.current=!1,C(!0)},[C]),B=ne.useCallback(()=>{window.clearTimeout(_.current),_.current=0,C(!1)},[C]),Q=ne.useCallback(()=>{window.clearTimeout(_.current),_.current=window.setTimeout(()=>{I.current=!0,C(!0),_.current=0},p)},[p,C]);ne.useEffect(()=>()=>{_.current&&(window.clearTimeout(_.current),_.current=0)},[]);const b=u??d;return j.jsx(i6e,{...c,children:j.jsx($Wo,{scope:e,contentId:b,setContentId:h,open:f,stateAttribute:y,trigger:l,onTriggerChange:g,onTriggerEnter:ne.useCallback(()=>{A.isOpenDelayedRef.current?Q():E()},[A.isOpenDelayedRef,Q,E]),onTriggerLeave:ne.useCallback(()=>{m?B():(window.clearTimeout(_.current),_.current=0)},[B,m]),onOpen:E,onClose:B,disableHoverableContent:m,children:n})})},"Tooltip"),iGt="TooltipTrigger",ejo=ne.forwardRef(MI(function(e,n){const{__scopeTooltip:o,...i}=e,r=Yse(iGt,o),s=$9e(iGt,o),a=j9e(o),A=ne.useRef(null),c=ag(n,A,r.onTriggerChange),l=ne.useRef(!1),g=ne.useRef(!1),u=ne.useCallback(()=>l.current=!1,[]);return ne.useEffect(()=>()=>document.removeEventListener("pointerup",u),[u]),j.jsx(j9t,{asChild:!0,...a,children:j.jsx(gu.button,{"aria-describedby":r.open?r.contentId:void 0,"data-state":r.stateAttribute,...i,ref:c,onPointerMove:Kr(e.onPointerMove,h=>{h.pointerType!=="touch"&&!g.current&&!s.isPointerInTransitRef.current&&(r.onTriggerEnter(),g.current=!0)}),onPointerLeave:Kr(e.onPointerLeave,()=>{r.onTriggerLeave(),g.current=!1}),onPointerDown:Kr(e.onPointerDown,()=>{r.open&&r.onClose(),l.current=!0,document.addEventListener("pointerup",u,{once:!0})}),onFocus:Kr(e.onFocus,()=>{l.current||r.onOpen()}),onBlur:Kr(e.onBlur,r.onClose),onClick:Kr(e.onClick,r.onClose)})})},"TooltipTrigger")),tjo="TooltipPortal",[RZo,njo]=W9e(tjo,{forceMount:void 0}),xY="TooltipContent",ojo=ne.forwardRef(MI(function(e,n){const o=njo(xY,e.__scopeTooltip),{forceMount:i=o.forceMount,side:r="top",...s}=e,a=Yse(xY,e.__scopeTooltip);return j.jsx(cQ,{present:i||a.open,children:a.disableHoverableContent?j.jsx(rGt,{side:r,...s,ref:n}):j.jsx(ijo,{side:r,...s,ref:n})})},"TooltipContent")),ijo=ne.forwardRef(MI(function(e,n){const o=Yse(xY,e.__scopeTooltip),i=$9e(xY,e.__scopeTooltip),r=ne.useRef(null),s=ag(n,r),[a,A]=ne.useState(null),{trigger:c,onClose:l}=o,g=r.current,{onPointerInTransitChange:u}=i,h=ne.useCallback(()=>{A(null),u(!1)},[u]),d=ne.useCallback((_,m)=>{const p=_.currentTarget,I={x:_.clientX,y:_.clientY},f=sGt(I,p.getBoundingClientRect()),C=aGt(I,f),y=AGt(m.getBoundingClientRect()),E=lGt([...C,...y]);A(E),u(!0)},[u]);return ne.useEffect(()=>()=>h(),[h]),ne.useEffect(()=>{if(c&&g){const _=MI(p=>d(p,g),"handleTriggerLeave"),m=MI(p=>d(p,c),"handleContentLeave");return c.addEventListener("pointerleave",_),g.addEventListener("pointerleave",m),()=>{c.removeEventListener("pointerleave",_),g.removeEventListener("pointerleave",m)}}},[c,g,d,h]),ne.useEffect(()=>{if(a){const _=MI(m=>{const p=m.target,I={x:m.clientX,y:m.clientY},f=c?.contains(p)||g?.contains(p),C=!cGt(I,a);f?h():C&&(h(),l())},"handleTrackPointerGrace");return document.addEventListener("pointermove",_),()=>document.removeEventListener("pointermove",_)}},[c,g,a,l,h]),j.jsx(rGt,{...e,ref:s})},"TooltipContentHoverable")),rjo=yNe("TooltipContent"),rGt=ne.forwardRef(MI(function(e,n){const{__scopeTooltip:o,children:i,"aria-label":r,id:s,onEscapeKeyDown:a,onPointerDownOutside:A,...c}=e,l=Yse(xY,o),g=j9e(o),{onClose:u}=l;ne.useEffect(()=>(document.addEventListener(X9e,u),()=>document.removeEventListener(X9e,u)),[u]),ne.useEffect(()=>{if(l.trigger){const d=MI(_=>{_.target instanceof Node&&_.target.contains(l.trigger)&&u()},"handleScroll");return window.addEventListener("scroll",d,{capture:!0}),()=>window.removeEventListener("scroll",d,{capture:!0})}},[l.trigger,u]);const{setContentId:h}=l;return q1(()=>(h(s),()=>{h(void 0)}),[s,h]),j.jsx(k3e,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:A,onFocusOutside:d=>d.preventDefault(),onDismiss:u,children:j.jsxs(X9t,{"data-state":l.stateAttribute,role:r?void 0:"tooltip",id:r?void 0:l.contentId,...g,...c,ref:n,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[j.jsx(rjo,{children:i}),r?j.jsx(VWo,{id:l.contentId,role:"tooltip",children:r}):null]})})},"TooltipContentImpl"));function sGt(t,e){const n=Math.abs(e.top-t.y),o=Math.abs(e.bottom-t.y),i=Math.abs(e.right-t.x),r=Math.abs(e.left-t.x);switch(Math.min(n,o,i,r)){case r:return"left";case i:return"right";case n:return"top";case o:return"bottom";default:throw new Error("unreachable")}}MI(sGt,"getExitSideFromRect");function aGt(t,e,n=5){const o=[];switch(e){case"top":o.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":o.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":o.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":o.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return o}MI(aGt,"getPaddedExitPoints");function AGt(t){const{top:e,right:n,bottom:o,left:i}=t;return[{x:i,y:e},{x:n,y:e},{x:n,y:o},{x:i,y:o}]}MI(AGt,"getPointsFromRect");function cGt(t,e){const{x:n,y:o}=t;let i=!1;for(let r=0,s=e.length-1;r<e.length;s=r++){const a=e[r],A=e[s],c=a.x,l=a.y,g=A.x,u=A.y;l>o!=u>o&&n<(g-c)*(o-l)/(u-l)+c&&(i=!i)}return i}MI(cGt,"isPointInPolygon");function lGt(t){const e=t.slice();return e.sort((n,o)=>n.x<o.x?-1:n.x>o.x?1:n.y<o.y?-1:n.y>o.y?1:0),gGt(e)}MI(lGt,"getHull");function gGt(t){if(t.length<=1)return t.slice();const e=[];for(let o=0;o<t.length;o++){const i=t[o];for(;e.length>=2;){const r=e[e.length-1],s=e[e.length-2];if((r.x-s.x)*(i.y-s.y)>=(r.y-s.y)*(i.x-s.x))e.pop();else break}e.push(i)}e.pop();const n=[];for(let o=t.length-1;o>=0;o--){const i=t[o];for(;n.length>=2;){const r=n[n.length-1],s=n[n.length-2];if((r.x-s.x)*(i.y-s.y)>=(r.y-s.y)*(i.x-s.x))n.pop();else break}n.push(i)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}MI(gGt,"getHullPresorted");var sjo=XWo,ajo=ZWo,Ajo=ejo,uGt=ojo;const cjo=sjo,ljo=ajo,gjo=Ajo,dGt=ne.forwardRef(({className:t,sideOffset:e=4,...n},o)=>j.jsx(uGt,{ref:o,sideOffset:e,className:ss("z-50 overflow-hidden rounded-md bg-slate-900 px-3 py-1.5 text-xs text-slate-50 animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 dark:bg-slate-50 dark:text-slate-900",t),...n}));dGt.displayName=uGt.displayName;const ujo="24b58135-86c7-4e4b-bf6e-cca862bc4b26",hGt="runframe-crisp-chat-script",djo="tscircuit.com",BY=t=>{window.$crisp=window.$crisp||[],window.$crisp.push(t)},hjo=()=>{if(window.$crisp=window.$crisp||[],window.CRISP_WEBSITE_ID=ujo,window.__RUNFRAME_CRISP_CONFIGURED__||(window.__RUNFRAME_CRISP_CONFIGURED__=!0,BY(["do","chat:hide"]),BY(["on","chat:closed",()=>BY(["do","chat:hide"])])),!document.getElementById(hGt)){const t=document.createElement("script");t.id=hGt,t.src="https://client.crisp.chat/l.js",t.async=!0,document.head.appendChild(t)}},_jo=()=>{hjo(),BY(["do","chat:show"]),BY(["do","chat:open"])},mjo=({isCli:t,hostname:e=typeof window<"u"?window.location.hostname:void 0}={})=>e?.toLowerCase()===djo?!1:!!t,pjo=()=>j.jsx(cjo,{children:j.jsxs(ljo,{children:[j.jsx(gjo,{asChild:!0,children:j.jsx(Sc,{type:"button",variant:"ghost",size:"icon","aria-label":"Get Support or Give Feedback",onClick:_jo,className:"rf-h-8 rf-w-8",children:j.jsx(tRo,{className:"rf-h-4 rf-w-4 rf-text-gray-500"})})}),j.jsx(dGt,{side:"bottom",children:"Get Support or Give Feedback"})]})}),Ijo=["assembly","pinout","analog_simulation","bom","circuit_json","errors","render_log","solvers"],e7e=t=>t instanceof Error?t.message:"An unknown error occurred",fjo=({code:t,fsMap:e,onRunClicked:n=void 0,errorMessage:o,errorStack:i,circuitJson:r,autoroutingGraphics:s,showRightHeaderContent:a=!0,showCodeTab:A=!1,codeTabContent:c,showJsonTab:l=!0,showRenderLogTab:g=!0,onActiveTabChange:u,renderLog:h,showImportAndFormatButtons:d=!0,className:_,headerClassName:m,leftHeaderContent:p,readOnly:I,isStreaming:f,autoroutingLog:C,onReportAutoroutingLog:y,isRunningCode:E,hasCodeChangedSinceLastRun:B,onEditEvent:Q,editEvents:b,defaultActiveTab:D,defaultTab:R,availableTabs:w,autoRotate3dViewerDisabled:H,showSchematicDebugGrid:G=!1,showSchematicPorts:K=!1,onChangeShowSchematicDebugGrid:U,onChangeShowSchematicPorts:q,showToggleFullScreen:W=!0,defaultToFullScreen:ee=!1,activeEffectName:re,allowSelectingVersion:X=!0,showFileMenu:te=!1,isWebEmbedded:se=!1,isCli:le=!1,projectName:ue,schematicSvgOptions:Ce,hideSchematicInAnalogSimulation:Ee=!1,onRerunWithDebug:Be,solverEvents:_e,onPcbBoundsSelected:ye})=>{CLt();const{versions:pe,latestVersion:we,lastRunEvalVersion:Ge,search:Ve,setSearch:Ie,selectVersion:qe}=Nzo(X),Me=ne.useMemo(()=>r?r.filter(ht=>ht&&"error_type"in ht||ht.type.includes("error")):null,[r]),Fe=ne.useMemo(()=>r?r.filter(ht=>ht&&"warning_type"in ht||ht.type.includes("warning")):null,[r]),Ye=ne.useMemo(()=>r?r.some(ht=>ht.type==="schematic_group"):!0,[r]),Ne=ne.useMemo(()=>r?.some(ht=>ht.type==="pcb_panel"),[r]),De=ne.useMemo(()=>!r||!E||Me?.length?!1:r.some(Tt=>Tt.type==="simulation_experiment")&&!Tun(r),[r,Me,E]),Ke=ne.useMemo(()=>Me?.find(ht=>ht.type.startsWith("simulation_")),[Me]);MLt({errorMessage:o,errorStack:i,circuitJsonErrors:Me});const ve=R??w?.[0]??"pcb",[Je,$e]=yLt("runframe-active-tab",D??ve,D);vzo({source:"runframe",component:"CircuitJsonPreview",isWebEmbedded:se,activeTab:Je});const[at,gt]=ne.useState(null),[dt,lt]=ne.useState(ee),[nt,xt]=ne.useState(G),[mt,Pt]=ne.useState(K),Ft=U?G:nt,Zt=q?K:mt,en=U??xt,Ut=q??Pt;EYo(dt);const fe=ne.useCallback(ht=>{$e(ht),u?.(ht)},[u,$e]),st=()=>{lt(!dt)};ne.useEffect(()=>{o&&(Je!=="errors"&&gt(Je),fe("errors"))},[o]),ne.useEffect(()=>{(Je==="code"||Je==="errors")&&r&&!o&&fe(at??D??R??w?.[0]??"pcb")},[r]);const ct=ne.useCallback(ht=>{window.TSCIRCUIT_3D_OBJECT_REF=ht===null?void 0:ht},[]);return j.jsx("div",{className:ss("flex flex-col relative rf-overflow-x-hidden rf-h-full",_),children:j.jsx("div",{className:ss("rf-md:sticky rf-md:top-2 rf-h-full",dt&&"rf-fixed rf-top-0 rf-left-0 rf-w-full rf-h-full rf-bg-white rf-overflow-hidden"),children:j.jsxs(Wce,{value:Je,onValueChange:fe,className:"rf-flex-grow rf-flex rf-flex-col rf-h-full",children:[j.jsxs("div",{className:ss("rf-flex rf-items-center rf-gap-2 rf-p-2 rf-pb-0",m),children:[p,te&&!p&&j.jsx(OWo,{isWebEmbedded:se,circuitJson:r,projectName:ue,autoroutingLog:C,onReportAutoroutingLog:y,showSchematicDebugGrid:Ft,onChangeShowSchematicDebugGrid:en,showSchematicPorts:Zt,onChangeShowSchematicPorts:Ut}),(p||te)&&j.jsx("div",{className:"rf-flex-grow"}),!p&&!te&&E&&j.jsx(zS,{className:"rf-w-4 rf-h-4 rf-animate-spin"}),!p&&!te&&j.jsx("div",{className:"rf-flex-grow"}),h&&h.progress!==1&&!o&&j.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2 rf-min-w-0 rf-max-w-xs",children:[re?j.jsx("div",{className:"rf-text-xs rf-text-gray-500 rf-truncate rf-min-w-0",title:re,children:re}):h.lastRenderEvent&&j.jsx("div",{className:"rf-text-xs rf-text-gray-500 rf-truncate rf-min-w-0",title:h.lastRenderEvent?.phase??"",children:h.lastRenderEvent?.phase??""}),j.jsx("div",{className:"rf-w-4 rf-h-4 rf-bg-blue-500 rf-opacity-50 rf-rounded-full rf-text-white rf-flex-shrink-0",children:j.jsx(zS,{className:"rf-w-4 rf-h-4 rf-animate-spin"})}),j.jsxs("div",{className:"rf-text-xs rf-font-bold rf-text-gray-700 rf-tabular-nums rf-flex-shrink-0",children:[((h.progress??0)*100).toFixed(1),"%"]})]}),a&&mjo({isCli:le})&&j.jsx(pjo,{}),a&&j.jsxs(IV,{children:[A&&j.jsx(dQ,{value:"code",children:"Code"}),!w||w.includes("pcb")?j.jsxs(dQ,{value:"pcb",className:"rf-whitespace-nowrap",children:[r&&j.jsx("span",{className:ss("rf-inline-flex rf-items-center rf-justify-center rf-w-2 rf-h-2 rf-mr-1 rf-text-xs rf-font-bold rf-text-white rf-rounded-full",B?"rf-bg-gray-500":"rf-bg-blue-500")}),"PCB"]}):null,!w||w.includes("schematic")?j.jsxs(dQ,{value:"schematic",className:ss("rf-whitespace-nowrap",r&&!Ye&&"rf-opacity-50"),disabled:r?!Ye||Ne:!1,children:[r&&j.jsx("span",{className:ss("rf-inline-flex rf-items-center rf-justify-center rf-w-2 rf-h-2 rf-mr-1 rf-text-xs rf-font-bold rf-text-white rf-rounded-full",B?"rf-bg-gray-500":"rf-bg-blue-500")}),"Schematic"]}):null,!w||w.includes("cad")?j.jsxs(dQ,{value:"cad",children:[r&&j.jsx("span",{className:ss("inline-flex items-center justify-center w-2 h-2 mr-1 text-xs font-bold text-white rounded-full",B?"rf-bg-gray-500":"rf-bg-blue-500")}),"3D"]}):null,!["pcb","cad","schematic"].includes(Je)&&j.jsx(dQ,{value:Je,children:bFe(Je)}),j.jsxs(Rre,{children:[j.jsx(Tre,{asChild:!0,children:j.jsxs("div",{className:"rf-whitespace-nowrap rf-p-2 rf-mr-1 rf-cursor-pointer rf-relative",children:[j.jsx(WNo,{className:"rf-w-4 rf-h-4"}),(Me&&Me.length>0||o)&&j.jsx("span",{className:"rf-inline-flex rf-absolute rf-top-[6px] rf-right-[4px] rf-items-center rf-justify-center rf-w-1 rf-h-1 rf-ml-2 rf-text-[8px] rf-font-bold rf-text-white rf-bg-red-500 rf-rounded-full"})]})}),j.jsxs(WU,{className:"rf-*:text-xs rf-z-[101]",children:[Ijo.filter(ht=>!w||w.includes(ht)).map(ht=>j.jsxs(Gh,{onSelect:()=>fe(ht),children:[Je!==ht&&j.jsx(A9t,{className:"rf-w-3 rf-h-3 rf-opacity-30"}),Je===ht&&j.jsx(N3e,{className:"rf-w-3 rf-h-3"}),j.jsx("div",{className:"rf-pr-2",children:bFe(ht)}),ht==="errors"&&(Me&&Me.length>0||o)&&j.jsx("span",{className:"rf-inline-flex rf-items-center rf-justify-center rf-w-3 rf-h-3 rf-ml-2 rf-text-[8px] rf-font-bold rf-text-white rf-bg-red-500 rf-rounded-full",children:o?1:Me?.length}),ht==="solvers"&&_e&&_e.length>0&&j.jsx("span",{className:"rf-inline-flex rf-items-center rf-justify-center rf-min-w-[12px] rf-h-3 rf-px-1 rf-ml-2 rf-text-[8px] rf-font-bold rf-text-white rf-bg-blue-500 rf-rounded-full",children:_e.length})]},ht)),j.jsx(Gh,{disabled:!0,className:"rf-opacity-60 rf-cursor-default rf-select-none",children:j.jsxs("div",{className:"rf-pr-2 rf-text-xs rf-text-gray-500",children:["@tscircuit/runframe@",wLt.split(".").map((ht,Tt)=>Tt===2?parseInt(ht)+1:ht).join(".")]})}),X?j.jsxs(qU,{onOpenChange:ht=>!ht&&Ie(""),children:[j.jsx(rk,{className:"rf-text-xs rf-opacity-60",children:j.jsxs("div",{className:"rf-pr-2 rf-text-xs rf-text-gray-500",children:["@tscircuit/eval@",Ge??we??"latest"]})}),j.jsx(JU,{children:j.jsxs(sk,{className:"rf-*:text-xs rf-w-40 rf-max-h-[200px] rf-overflow-y-auto",children:[j.jsx("div",{className:"rf-p-1",children:j.jsx(b6e,{value:Ve,onChange:ht=>Ie(ht.target.value),placeholder:"Search...",className:"rf-h-7 rf-text-xs"})}),j.jsx(L7t,{}),j.jsx(Gh,{onSelect:()=>qe(null),children:we?`${we} (latest)`:"latest"}),pe.map(ht=>j.jsx(Gh,{onSelect:()=>qe(ht),children:ht},ht))]})})]}):Ge&&j.jsx(Gh,{disabled:!0,className:"rf-opacity-60 rf-cursor-default rf-select-none",children:j.jsxs("div",{className:"rf-pr-2 rf-text-xs rf-text-gray-500",children:["@tscircuit/eval@",Ge]})})]})]})]}),W&&j.jsx(Sc,{onClick:st,variant:"ghost",children:dt?j.jsx(nRo,{size:16}):j.jsx(XNo,{size:16})})]}),A&&j.jsx(Bf,{value:"code",className:"rf-flex-grow rf-overflow-hidden",children:j.jsx("div",{className:"rf-h-full",children:c})}),(!w||w.includes("pcb"))&&j.jsx(Bf,{value:"pcb",children:j.jsx("div",{className:ss("rf-overflow-hidden",dt?"rf-h-[calc(100vh-52px)]":"rf-h-full"),children:j.jsx(YS,{fallbackRender:({error:ht})=>j.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:j.jsxs("div",{className:"rf-p-4",children:[j.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error loading PCB viewer"}),j.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:e7e(ht)})]})}),children:r?j.jsx(CYo,{focusOnHover:!1,circuitJson:r,debugGraphics:s,onBoundsSelected:ye,containerClassName:ss("rf-h-full rf-w-full",dt?"rf-min-h-[calc(100vh-240px)]":"rf-min-h-[620px]"),onEditEventsChanged:ht=>{if(Q)for(const Tt of ht)Q(Tt)}}):j.jsx(c5,{onRunClicked:n})})})}),(!w||w.includes("assembly"))&&j.jsx(Bf,{value:"assembly",children:j.jsx("div",{className:ss("rf-overflow-auto",dt?"rf-h-[calc(100vh-60px)]":"rf-h-full rf-min-h-[620px]"),children:j.jsx(YS,{fallback:j.jsx("div",{children:"Error loading Assembly"}),children:r?j.jsx(kLo,{circuitJson:r,containerStyle:{height:"100%"},editingEnabled:!0,debugGrid:!0}):j.jsx(c5,{onRunClicked:n})})})}),(!w||w.includes("pinout"))&&j.jsx(Bf,{value:"pinout",children:j.jsx("div",{className:ss("rf-overflow-auto",dt?"rf-h-[calc(100vh-60px)]":"rf-h-full rf-min-h-[620px]"),children:j.jsx(YS,{fallback:j.jsx("div",{children:"Error loading Pinout Viewer"}),children:r?j.jsx(FLo,{circuitJson:r,containerStyle:{height:"100%"}}):j.jsx(c5,{onRunClicked:n})})})}),(!w||w.includes("schematic"))&&j.jsx(Bf,{value:"schematic",children:j.jsx("div",{className:ss("rf-overflow-auto rf-bg-white",dt?"rf-h-[calc(100vh-60px)]":"rf-h-full rf-min-h-[620px]"),children:j.jsx(YS,{fallbackRender:({error:ht})=>j.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:j.jsxs("div",{className:"rf-p-4",children:[j.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error loading Schematic"}),j.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:e7e(ht)})]})}),children:r?j.jsx(CLo,{circuitJson:r,containerStyle:{height:"100%"},editingEnabled:!0,onEditEvent:ht=>{Q?.(ht)},debugGrid:Ft,showSchematicPorts:Zt,css:Ce?.css,className:Ce?.className}):j.jsx(c5,{onRunClicked:n})})})}),(!w||w.includes("cad"))&&j.jsx(Bf,{value:"cad",children:j.jsx("div",{className:ss("rf-overflow-auto",dt?"rf-h-[calc(100vh-60px)]":"rf-h-full rf-min-h-[620px]"),children:j.jsx(YS,{fallbackRender:({error:ht,resetErrorBoundary:Tt})=>j.jsx(kNo,{error:ht,resetErrorBoundary:Tt}),children:r?j.jsx(RNo,{ref:ct,circuitJson:r,autoRotateDisabled:H},`cad-${dt}`):j.jsx(c5,{onRunClicked:n})})})}),(!w||w.includes("analog_simulation"))&&j.jsx(Bf,{value:"analog_simulation",children:j.jsx("div",{className:ss("rf-overflow-auto",dt?"rf-h-[calc(100vh-60px)]":"rf-h-full rf-min-h-[620px]"),children:j.jsx(YS,{fallback:j.jsx("div",{children:"Error loading Analog Simulation"}),children:r?Ke?j.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:j.jsxs("div",{className:"rf-p-4",children:[j.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error running analog simulation"}),j.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:Ke.message})]})}):De?j.jsx("div",{className:"rf-flex rf-h-full rf-min-h-[300px] rf-items-center rf-justify-center rf-bg-slate-50",children:j.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2 rf-text-sm rf-text-slate-600",children:[j.jsx(zS,{className:"rf-h-4 rf-w-4 rf-animate-spin"}),"Running analog simulation..."]})}):j.jsx(TLo,{circuitJson:r,hideSchematic:Ee,containerStyle:{height:"100%"}}):j.jsx(c5,{onRunClicked:n})})})}),(!w||w.includes("bom"))&&j.jsx(Bf,{value:"bom",children:j.jsx("div",{className:ss("rf-overflow-auto",dt?"rf-h-[calc(100vh-60px)]":"rf-h-full rf-min-h-[620px]"),children:j.jsx(YS,{fallbackRender:({error:ht})=>j.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:j.jsxs("div",{className:"rf-p-4",children:[j.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error loading Bill of Materials"}),j.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:e7e(ht)})]})}),children:r?j.jsx(ZLo,{circuitJson:r}):j.jsx(c5,{onRunClicked:n})})})}),(!w||w.includes("circuit_json"))&&j.jsx(Bf,{value:"circuit_json",children:j.jsx("div",{className:ss("rf-overflow-auto",dt?"rf-h-[calc(100vh-60px)]":"rf-h-full rf-min-h-[620px]"),children:j.jsx(YS,{fallback:j.jsx("div",{children:"Error loading JSON viewer"}),children:r?j.jsx(GLo,{elements:r}):j.jsx(c5,{onRunClicked:n})})})}),(!w||w.includes("errors"))&&j.jsx(Bf,{value:"errors",className:"rf-h-full",children:j.jsx("div",{className:ss("rf-overflow-hidden",dt?"rf-h-[calc(100vh-60px)]":"rf-h-full rf-min-h-[620px]"),children:o||Me&&Me.length>0||r?j.jsx(wFo,{code:t,fsMap:e,circuitJsonErrors:Me,circuitJsonWarnings:Fe,errorMessage:o,errorStack:i,circuitJson:r,evalVersion:Ge,autoroutingLog:C,onReportAutoroutingLog:y}):j.jsx(c5,{onRunClicked:n})})}),g&&(!w||w.includes("render_log"))&&j.jsx(Bf,{value:"render_log",children:j.jsx(QYo,{renderLog:h,onRerunWithDebug:Be})}),(!w||w.includes("solvers"))&&j.jsx(Bf,{value:"solvers",children:j.jsx("div",{className:ss("rf-overflow-hidden",dt?"rf-h-[calc(100vh-60px)]":"rf-h-full rf-min-h-[620px]"),children:j.jsx(YS,{fallback:j.jsx("div",{children:"Error loading Solvers view"}),children:j.jsx(Pzo,{solverEvents:_e})})})})]})})})};pUt.createRoot(document.getElementById("root")).render(j.jsx("div",{style:{height:"100vh"},children:j.jsx(fjo,{defaultActiveTab:"cad",autoRotate3dViewerDisabled:!0,showRightHeaderContent:!1,circuitJson:window.CIRCUIT_JSON||{},...window.CIRCUIT_JSON_PREVIEW_PROPS||{}})}));const Cjo=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}))}));