summaryrefslogtreecommitdiff
path: root/out/_next/static/chunks/pages/index-95b9c11346a5459ef7c3.js
blob: b10454bc03571049f2796b345321ffefda50f188 (about) (plain)
1
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[405],{64685:function(e,n,t){"use strict";t.r(n),t.d(n,{Graph:function(){return Et},GraphPage:function(){return zt},default:function(){return Lt},getThemeColor:function(){return Tt},hexToRGBA:function(){return Bt},normalizeLinkEnds:function(){return Rt}});var r=t(15861),i=t(42982),o=t(4942),l=t(70885),s=t(87757),c=t.n(s),a=t(40980),u=t(74860),d=t(95869),h=t(48017),g=t(94096),f=t(96699),p=t(48420),x=t(57775),j=t(54309),v=t(52596),b=t(9008),m=t(67294),y=t(47516),C=t(63750),w=t(22003),O=t(31122),k=t(7520),S=t(22663),P=t.n(S),N=t(36194),I=[],D={};for(var L in N.oY)for(var z in N.oY[L]){var E=L+z;"LinearNone"===E&&(E="Linear"),I.push(E),D[E]=N.oY[L][z]}var Z=D,R={enabled:!0,charge:-700,collision:!0,collisionStrength:20,centering:!0,centeringStrength:.2,linkStrength:.3,linkIts:1,alphaDecay:.05,alphaTarget:0,alphaMin:0,velocityDecay:.25,gravity:.3,gravityOn:!0,gravityLocal:!1},T={orphans:!1,dailies:!1,parent:"heading",filelessCites:!1,tagsBlacklist:[],tagsWhitelist:[],bad:!0,nodes:[],links:[],date:[]},B={particles:!1,particlesNumber:0,particlesWidth:4,arrows:!1,arrowsLength:1,arrowsPos:.5,arrowsColor:"",linkOpacity:.8,linkWidth:1,nodeRel:4,nodeOpacity:1,nodeResolution:12,labels:2,labelScale:1,labelFontSize:10,labelLength:40,labelWordWrap:25,labelLineSpace:1,highlight:!0,highlightNodeSize:1.2,highlightLinkSize:2,highlightFade:.8,highlightAnim:!0,animationSpeed:420,algorithmOptions:I,algorithmName:"SinusoidalOut",linkColorScheme:"gray.500",nodeColorScheme:["red.500","gray.600","yellow.500","green.500","cyan.500","blue.500","pink.500","purple.500","orange.500"],nodeHighlight:"purple.500",linkHighlight:"purple.500",backgroundColor:"white",emacsNodeColor:"gray.800",labelTextColor:"black",labelBackgroundColor:"",labelBackgroundOpacity:.7,citeDashes:!0,citeDashLength:35,citeGapLength:15,citeLinkColor:"gray.700",citeLinkHighlightColor:"",citeNodeColor:"black",refDashes:!0,refDashLength:35,refGapLength:15,refLinkColor:"gray.700",refLinkHighlightColor:"",refNodeColor:"black",nodeSizeLinks:.5,nodeZoomSize:1.3},F={follow:"zoom",localSame:"add",zoomPadding:200,zoomSpeed:2e3},H={highlight:"hover",local:"double",follow:"never",context:"right",preview:"click",backgroundExitsLocal:!1},M=["red.500","orange.500","yellow.500","green.500","cyan.500","blue.500","pink.500","purple.500","white","gray.100","gray.200","gray.300","gray.400","gray.500","gray.600","gray.700","gray.800","gray.900","black"],W=t(11252),A=t(336),V=t(85675),X=t(72026),_=t(64115),U=t(49364),q=t(94030),G=t(46617),J=t(50862),Q=t(68928),K=t(55830),Y=t(2827);function $(e,n,t){t.send(JSON.stringify({command:e,data:n}))}function ee(e,n){$("open",{id:e.id},n)}var ne=t(85305),te=t(77787),re=t(45987),ie=t(80658),oe=t(38554),le=t.n(oe),se=t(84461),ce=t(73808),ae=t(53869),ue=t(39629);function de(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function he(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?de(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):de(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var ge={ease:[.25,.1,.25,1],easeIn:[.4,0,1,1],easeOut:[0,0,.2,1],easeInOut:[.4,0,.2,1]};var fe=function(e,n){return he(he({},e),{},{delay:(0,ce.hj)(n)?n:null===n||void 0===n?void 0:n.enter})},pe=function(e,n){return he(he({},e),{},{delay:(0,ce.hj)(n)?n:null===n||void 0===n?void 0:n.exit})},xe=t(85893),je=["in","unmountOnExit","animateOpacity","startingSize","endingSize","dimension","style","className","transition","transitionEnd"];function ve(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function be(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?ve(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ve(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var me=function(e){return null!=e&&parseInt(e.toString(),10)>0},ye={exit:{size:{duration:.2,ease:ge.ease},opacity:{duration:.3,ease:ge.ease}},enter:{size:{duration:.3,ease:ge.ease},opacity:{duration:.4,ease:ge.ease}}},Ce={exit:function(e){var n,t,r=e.animateOpacity,i=e.startingSize,l=e.transition,s=e.transitionEnd,c=e.delay,a=e.dimension;return be(be({},r&&{opacity:me(i)?1:0}),{},(t={overflow:"hidden"},(0,o.Z)(t,a,i),(0,o.Z)(t,"transitionEnd",null===s||void 0===s?void 0:s.exit),(0,o.Z)(t,"transition",null!==(n=null===l||void 0===l?void 0:l.exit)&&void 0!==n?n:pe(ye.exit,c)),t))},enter:function(e){var n,t,r=e.animateOpacity,i=e.endingSize,l=e.transition,s=e.transitionEnd,c=e.delay,a=e.dimension;return be(be({},r&&{opacity:1}),{},(t={},(0,o.Z)(t,a,i),(0,o.Z)(t,"transitionEnd",null===s||void 0===s?void 0:s.enter),(0,o.Z)(t,"transition",null!==(n=null===l||void 0===l?void 0:l.enter)&&void 0!==n?n:fe(ye.enter,c)),t))}},we=m.forwardRef((function(e,n){var t=e.in,r=e.unmountOnExit,i=e.animateOpacity,o=void 0===i||i,s=e.startingSize,c=void 0===s?0:s,a=e.endingSize,u=void 0===a?"auto":a,d=e.dimension,h=void 0===d?"height":d,g=e.style,f=e.className,p=e.transition,x=e.transitionEnd,j=(0,re.Z)(e,je),v=m.useState(!1),b=(0,l.Z)(v,2),y=b[0],C=b[1];m.useEffect((function(){var e=setTimeout((function(){C(!0)}));return function(){return clearTimeout(e)}}),[]),(0,ie.ZK)({condition:Boolean(c>0&&r),message:"startingSize and unmountOnExit are mutually exclusive. You can't use them together"});var w=parseFloat(c.toString())>0,O={startingSize:c,endingSize:u,animateOpacity:o,dimension:h,transition:y?p:{enter:{duration:0}},transitionEnd:le()(x,{enter:{overflow:"initial"},exit:r?void 0:{display:w?"block":"none"}})},k=!r||t,S=t||r?"enter":"exit";return(0,xe.jsx)(ae.M,{initial:!1,custom:O,children:k&&(0,xe.jsx)(ue.E.div,be(be({ref:n},j),{},{className:(0,se.cx)("chakra-collapse",f),style:be({overflow:"hidden",display:"block"},g),custom:O,variants:Ce,initial:!!r&&"exit",animate:S,exit:"exit"}))})}));function Oe(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function ke(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Oe(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Oe(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}ce.Ts&&(we.displayName="Collapse");var Se=function(e){var n=e.setTagColors,t=e.setFilter,r=e.filter,l=e.tagColors,s=e.target,c=r.tagsBlacklist,a=r.tagsWhitelist,d=c.indexOf(s)>-1,f=a.indexOf(s)>-1,p=(0,u.q)();return(0,xe.jsxs)(xe.Fragment,{children:[(0,xe.jsx)(W.sN,{icon:(0,xe.jsx)(h.xu,{bgColor:l[s],borderRadius:"sm",height:3,width:3,borderColor:l[s]||"gray.600",borderWidth:1}),closeOnSelect:!1,onClick:p.onToggle,children:(0,xe.jsx)(_.x,{children:"Change color"})}),(0,xe.jsx)(we,{in:p.isOpen,children:(0,xe.jsx)(g.k,{ml:2,mt:2,flexWrap:"wrap",children:M.map((function(e){return(0,xe.jsx)(h.xu,{children:(0,xe.jsx)(h.xu,{tabIndex:0,cursor:"pointer",onClick:function(){return n(ke(ke({},l),{},(0,o.Z)({},s,e)))},bgColor:e,m:1,borderRadius:"sm",height:3,width:3})},e)}))})}),!f&&(0,xe.jsx)(W.sN,{onClick:function(){t(d?function(e){return ke(ke({},e),{},{tagsBlacklist:e.tagsBlacklist.filter((function(e){return e!==s}))})}:function(e){return ke(ke({},e),{},{tagsBlacklist:[].concat((0,i.Z)(e.tagsBlacklist),[s])})})},icon:d?(0,xe.jsx)(ne.V,{}):(0,xe.jsx)(te.t,{}),children:d?"Remove from blacklist":"Add to blacklist"}),!d&&(0,xe.jsx)(W.sN,{onClick:function(){t(f?function(e){return ke(ke({},e),{},{tagsWhitelist:e.tagsWhitelist.filter((function(e){return e!==s}))})}:function(e){return ke(ke({},e),{},{tagsWhitelist:[].concat((0,i.Z)(e.tagsWhitelist),[s])})})},icon:f?(0,xe.jsx)(ne.V,{}):(0,xe.jsx)(K.O,{}),children:f?"Remove from whitelist":"Add to whitelist"})]})},Pe=function(e){e.background;var n,t,r=e.target,i=(e.nodeType,e.coordinates),o=e.handleLocal,l=e.menuClose,s=e.scope,c=e.webSocket,a=e.setPreviewNode,d=e.setTagColors,h=e.tagColors,g=e.setFilter,f=e.filter,p=(0,u.q)(),x=p.isOpen,j=p.onOpen,v=p.onClose;(0,m.useRef)();return(0,xe.jsxs)(xe.Fragment,{children:[(0,xe.jsx)(W.v2,{defaultIsOpen:!0,closeOnBlur:!1,onClose:function(){return l()},children:(0,xe.jsx)(W.qy,{zIndex:"overlay",bgColor:"white",color:"black",position:"absolute",left:i.left,top:i.top,right:i.right,bottom:i.bottom,fontSize:"xs",boxShadow:"xl",children:"string"!==typeof r?(0,xe.jsxs)(xe.Fragment,{children:[r&&(0,xe.jsxs)(xe.Fragment,{children:[(0,xe.jsx)(A.X,{size:"xs",isTruncated:!0,px:3,py:1,children:r.title}),(0,xe.jsx)(W.R,{borderColor:"gray.500"})]}),0!==s.nodeIds.length&&(0,xe.jsxs)(xe.Fragment,{children:[(0,xe.jsx)(W.sN,{onClick:function(){return o(r,"add")},icon:(0,xe.jsx)(q.I,{}),children:"Expand local graph at node"}),(0,xe.jsx)(W.sN,{onClick:function(){return o(r,"replace")},icon:(0,xe.jsx)(y.DvO,{}),children:"Open local graph for this node"})]}),null!==r&&void 0!==r&&null!==(n=r.properties)&&void 0!==n&&n.FILELESS?(0,xe.jsx)(W.sN,{icon:(0,xe.jsx)(J.d,{}),onClick:function(){return function(e,n){$("create",{id:e.id,title:e.title,ref:e.properties.ROAM_REFS},n)}(r,c)},children:"Create node"}):(0,xe.jsx)(W.sN,{icon:(0,xe.jsx)(G.d,{}),onClick:function(){return ee(r,c)},children:"Open in Emacs"}),(null===r||void 0===r||null===(t=r.properties)||void 0===t?void 0:t.ROAM_REFS)&&(0,xe.jsx)(W.sN,{icon:(0,xe.jsx)(Q.h,{}),children:"Open in Zotero"}),0===s.nodeIds.length&&(0,xe.jsx)(W.sN,{icon:(0,xe.jsx)(y.DvO,{}),onClick:function(){return o(r,"replace")},children:"Open local graph"}),(0,xe.jsx)(W.sN,{icon:(0,xe.jsx)(K.O,{}),onClick:function(){a(r)},children:"Preview"}),0===(null===r||void 0===r?void 0:r.level)&&(0,xe.jsx)(W.sN,{closeOnSelect:!1,icon:(0,xe.jsx)(Y.p,{color:"red.500"}),color:"red.500",onClick:j,children:"Permenantly delete note"})]}):(0,xe.jsx)(Se,{target:r,tagColors:h,filter:f,setTagColors:d,setFilter:g})})}),"string"!==typeof r&&(0,xe.jsxs)(V.u_,{isCentered:!0,isOpen:x,onClose:v,children:[(0,xe.jsx)(V.ZA,{}),(0,xe.jsxs)(V.hz,{zIndex:"popover",children:[(0,xe.jsx)(V.xB,{children:"Delete node?"}),(0,xe.jsx)(V.ol,{}),(0,xe.jsx)(V.fe,{children:(0,xe.jsxs)(X.gC,{spacing:4,display:"flex",alignItems:"flex-start",children:[(0,xe.jsx)(_.x,{children:"This will permanently delete your note:"}),(0,xe.jsx)(_.x,{fontWeight:"bold",children:null===r||void 0===r?void 0:r.title}),0!==(null===r||void 0===r?void 0:r.level)&&(0,xe.jsx)(_.x,{children:"This will only delete the from this heading until but not including the next node. Your parent file and all other nodes will not be deleted."}),(0,xe.jsx)(_.x,{children:"Are you sure you want to do continue?"})]})}),(0,xe.jsxs)(V.mz,{children:[(0,xe.jsx)(U.z,{mr:3,onClick:function(){console.log("closing"),v(),l()},children:"Cancel"}),(0,xe.jsx)(U.z,{variant:"link",colorScheme:"red",ml:3,onClick:function(){console.log("aaaaa"),function(e,n){0===e.level&&$("delete",{id:e.id,file:e.file},n)}(r,c),v(),l()},children:"Delete node"})]})]})]})]})},Ne=t(67101),Ie=t(35255),De=t(56884),Le=function(e){var n=e.setJustification,t=(e.setIndent,e.setFont,e.justification),r=(e.setPreviewNode,e.canUndo),i=e.canRedo,o=(e.resetPreviewNode,e.previousPreviewNode),l=e.nextPreviewNode;return(0,xe.jsxs)(g.k,{flex:"0 1 40px",pb:3,alignItems:"center",justifyContent:"space-between",pl:1,pr:1,children:[(0,xe.jsx)(g.k,{children:(0,xe.jsxs)(Ne.h,{isAttached:!0,children:[(0,xe.jsx)(f.u,{label:"Go backward",children:(0,xe.jsx)(p.h,{variant:"subtle",icon:(0,xe.jsx)(Ie.w,{}),"aria-label":"Previous node",disabled:!r,onClick:function(){return o()}})}),(0,xe.jsx)(f.u,{label:"Go forward",children:(0,xe.jsx)(p.h,{variant:"subtle",icon:(0,xe.jsx)(De.X,{}),"aria-label":"Next node",disabled:!i,onClick:function(){return l()}})})]})}),(0,xe.jsx)(g.k,{children:(0,xe.jsx)(f.u,{label:"Justify content",children:(0,xe.jsx)(p.h,{variant:"subtle","aria-label":"Justify content",icon:[(0,xe.jsx)(y.v9V,{},"justify"),(0,xe.jsx)(y.YSr,{},"left"),(0,xe.jsx)(y.RXA,{},"right"),(0,xe.jsx)(y.tr_,{},"center")][t],onClick:function(){return n((function(e){return(e+1)%4}))}})})})]})},ze=t(35528);function Ee(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function Ze(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Ee(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ee(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Re=function(e){var n,t=e.filter,r=e.setFilter,o=e.tagColors,l=(e.setTagColors,e.openContextMenu),s=e.previewNode;return s.tags&&null!==(null===s||void 0===s?void 0:s.tags[0])?(0,xe.jsx)(g.k,{mb:2,flexWrap:"wrap",children:null===s||void 0===s||null===(n=s.tags)||void 0===n?void 0:n.map((function(e){var n,s,c,a=null!==(n=t.tagsBlacklist)&&void 0!==n?n:[],u=null!==(s=t.tagsWhitelist)&&void 0!==s?s:[],d=a.includes(e),h=u.includes(e);return(0,xe.jsxs)(ze.Vp,{tabIndex:0,mr:2,mt:2,onContextMenu:function(n){n.preventDefault(),l(e,n)},cursor:"pointer",onClick:function(){r(d?function(n){return Ze(Ze({},n),{},{tagsBlacklist:n.tagsBlacklist.filter((function(n){return n!==e})),tagsWhitelist:[].concat((0,i.Z)(n.tagsWhitelist),[e])})}:h?function(n){return Ze(Ze({},n),{},{tagsWhitelist:n.tagsWhitelist.filter((function(n){return n!==e}))})}:function(n){return Ze(Ze({},n),{},{tagsBlacklist:[].concat((0,i.Z)(n.tagsBlacklist),[e])})})},size:"sm",variant:"outline",colorScheme:(null===(c=o[e])||void 0===c?void 0:c.replaceAll(/(.*?)\..*/g,"$1"))||void 0,children:[(0,xe.jsx)(ze.Sn,{children:e}),d?(0,xe.jsx)(ze.bq,{as:te.t}):h?(0,xe.jsx)(ze.bq,{as:K.O}):null]},e)}))}):null},Te=t(18835),Be=t.n(Te),Fe=t(13816),He=t.n(Fe),Me=t(42728),We=t.n(Me),Ae=t(77890),Ve=t.n(Ae),Xe=t(94986),_e=t.n(Xe),Ue=t(88541),qe=t.n(Ue),Ge=t(71167),Je=t.n(Ge),Qe=(t(85062),t(27431)),Ke=t.n(Qe),Ye=t(45170),$e=t(67273),en=t(29356),nn={".katex":{overflowX:"scroll"},h1:{color:"black",lineHeight:"1.2",fontSize:"20",fontWeight:"bold",marginBottom:3},h2:{fontSize:"18",marginBottom:2,color:"black"},h3:{fontSize:"16",fontWeight:"600 !important",marginBottom:".5em",color:"black"},h4:{fontSize:"14",fontWeight:"500 !important",marginBottom:".25em",fontStyle:"italic",color:"black"},ol:{paddingLeft:"5"},ul:{paddingLeft:"5"},p:{fontSize:"14",fontWeight:"500 !important",paddingBottom:".5em"},div:{hyphens:"auto !important"},".title":{textAlign:"center",marginBottom:".2em"},".subtitle":{textAlign:"center",fontSize:"medium",fontWeight:"bold",marginTop:0},".TODO":{color:"red.500"},".equationContainer":{display:"table",textAlign:"center",width:"100%"},".equation":{verticalAlign:"middle"},".equation-label":{display:"tableCell",textAlign:"right",verticalAlign:"middle"},".inlinetask":{padding:"10px",border:"2px solid gray",margin:"10px",background:"#ffffcc"},"#org-div-home-and-up":{textAlign:"right",fontSize:"70 % ",whiteSpace:"nowrap"},textarea:{overflowX:"auto"},".linenr":{fontSize:"smaller"},".org-info-js_info-navigation":{borderStyle:"none"},"#org-info-js_console-label":{fontSize:"10px",fontWeight:"bold",whiteSpace:"nowrap"},".org-info-js_search-highlight":{backgroundColor:"#ffff00",color:"#000000",fontWeight:"bold"},".org-svg":{width:"90%"},".DONE":{color:"green"},".priority":{fontFamily:"monospace",color:"orange"},".tag":{backgroundColor:"white",fontFamily:"monospace",padding:"2px",fontSize:"80%",fontWeight:"normal"},".timestamp":{color:"#bebebe"},".timestamp-kwd":{color:"#5f9ea0"},".org-right":{marginLeft:"auto",marginRight:"0px",textAlign:"right"},".org-left":{marginLeft:"0px",marginRight:"auto",textAlign:"left"},".org-center":{marginLeft:"auto",marginRight:"auto",textAlign:"center"},".underline":{textDecoration:"underline"},"#postamble p":{fontSize:"90%",margin:".2em"},"#preamble p":{fontSize:"90%",margin:".2em"},"p.verse":{marginLeft:"3%"},pre:{borderRadius:"3px",backgroundColor:"white",padding:"8pt",fontFamily:"monospace",overflow:"auto",margin:"1.2em"},"pre.src":{position:"relative",overflow:"auto"},"pre.src:before":{display:"none",position:"absolute",top:"-8px",right:"12px",padding:"3px",backgroundColor:"white"},"caption.t-above":{captionSide:"top"},"caption.t-bottom":{captionSide:"bottom"},"th.org-right":{textAlign:"center"},"th.org-left":{textAlign:"center"},"th.org-center":{textAlign:"center"},"td.org-right":{textAlign:"right"},"td.org-left":{textAlign:"left"},"td.org-center":{textAlign:"center"},".footpara":{display:"inline"},".footdef":{marginBottom:"1em"},".figure":{padding:"1em"},".figure p":{textAlign:"center"}},tn=nn,rn=t(25675),on=t(62520),ln=t.n(on),sn=function(e){var n=e.src,t=e.file,r=(0,m.useState)(null),i=(r[0],r[1],ln().dirname(t)),o=encodeURIComponent(encodeURIComponent(ln().join(i,n)));return(0,xe.jsx)(rn.default,{layout:"responsive",loader:function(e){var n=e.src;e.width,e.quality;return"http://localhost:35901/img/".concat(n)},src:o,alt:"",width:"100%",height:"100%"})},cn=function(e){var n=e.setSidebarHighlightedNode,t=e.setPreviewNode,r=e.nodeById,o=e.openContextMenu,s=e.href,c=e.children,u=(0,m.useContext)(en.N).highlightColor,d=Tt(u,(0,a.useTheme)()),h=(0,l.Z)((0,i.Z)(s.matchAll(/(.*?)\:(.*)/g))[0],3),g=(h[0],h[1],h[2]);return(0,xe.jsx)(_.x,{onMouseEnter:function(){return n(r[g])},onMouseLeave:function(){return n({})},tabIndex:0,display:"inline",overflow:"hidden",fontWeight:500,color:u,textDecoration:"underline",onContextMenu:function(e){e.preventDefault(),o(r[g],e)},onClick:function(){return t(r[g])},_hover:{textDecoration:"none",cursor:"pointer",bgColor:d+"22"},_focus:{outlineColor:u},children:c})},an=function e(n){var t,r,o,s,c,a=n.href,u=n.children,d=n.nodeById,g=n.setSidebarHighlightedNode,f=(n.previewNode,n.setPreviewNode),p=n.nodeByCite,x=n.openContextMenu,j=(0,m.useState)(null),v=j[0],b=j[1],y=(0,l.Z)((0,i.Z)(a.matchAll(/(.*?)\:(.*)/g))[0],3),C=(y[0],y[1]),w=y[2],O=(0,m.useState)(!1),k=O[0],S=O[1],P=function(e,n){if("id"===e)return n;if(e.includes("cite")){var t,r=null!==(t=p[n])&&void 0!==t&&t;return r?null!==r&&void 0!==r&&r.properties.FILELESS?"":null===r||void 0===r?void 0:r.id:""}return""}(C,w),N=encodeURIComponent(encodeURIComponent(null===(t=d[P])||void 0===t?void 0:t.file)),I=Be()().use(He()).use(We()).use(Je()).use(Ke(),{createElement:m.createElement,components:{a:function(n){var t=n.children,r=n.href;return(0,xe.jsx)(e,{nodeByCite:p,setSidebarHighlightedNode:g,href:r,nodeById:d,setPreviewNode:f,openContextMenu:x,children:t})},img:function(e){var n,t=e.src;return(0,xe.jsx)(sn,{src:t,file:null===(n=d[P])||void 0===n?void 0:n.file})}}});return(0,m.useEffect)((function(){v||k&&fetch("http://localhost:35901/file/".concat(N)).then((function(e){return e.text()})).then((function(e){if("error"===e);else{var n=I.processSync(e).result;b(n)}})).catch((function(e){return console.log(e),"Could not fetch the text for some reason, sorry!\n\n This can happen because you have an id with forward slashes (/) in it."}))}),[k,v]),P?(0,xe.jsx)(xe.Fragment,{children:(0,xe.jsxs)(Ye.J2,{gutter:12,trigger:"hover",placement:"top-start",children:[(0,xe.jsx)(Ye.xo,{children:(0,xe.jsx)(h.xu,{display:"inline",onMouseEnter:function(){return S(!0)},onMouseLeave:function(){return S(!1)},children:(0,xe.jsx)(cn,{setSidebarHighlightedNode:g,setPreviewNode:f,nodeById:d,href:a,children:u,nodeByCite:p,openContextMenu:x},null!==(r=null===(o=d[P])||void 0===o?void 0:o.title)&&void 0!==r?r:P)})}),(0,xe.jsx)($e.h,{children:(0,xe.jsxs)(Ye.yk,{boxShadow:"xl",position:"relative",zIndex:"tooltip",onMouseEnter:function(){var e;g(null!==(e=d[P])&&void 0!==e?e:{})},onMouseLeave:function(){g({})},children:[(0,xe.jsx)(Ye.QH,{}),(0,xe.jsx)(Ye.b,{pb:5,fontSize:"xs",px:5,position:"relative",zIndex:"tooltip",maxHeight:300,overflow:"scroll",children:(0,xe.jsx)(h.xu,{color:"black",sx:tn,children:v})})]},null!==(s=null===(c=d[P])||void 0===c?void 0:c.title)&&void 0!==s?s:P)})]})}):(0,xe.jsx)(_.x,{display:"inline",color:"base.700",cursor:"not-allowed",children:u})},un=function(e){var n=e.nodeById,t=e.setSidebarHighlightedNode,r=e.setPreviewNode,i=e.previewText,o=e.nodeByCite,l=e.previewNode,s=e.openContextMenu,c=Be()().use(He()).use(_e()).use(qe()).use(Ve()).use(We()).use(Je()).use(Ke(),{createElement:m.createElement,components:{a:function(e){var i=e.children,l=e.href;return(0,xe.jsx)(an,{nodeByCite:o,setSidebarHighlightedNode:t,href:"".concat(l),nodeById:n,setPreviewNode:r,openContextMenu:s,children:i})},img:function(e){var n=e.src;return(0,xe.jsx)(sn,{src:n,file:l.file})}}}),a=(0,m.useMemo)((function(){return c.processSync(i).result}),[i]);return(0,xe.jsx)(xe.Fragment,{children:a})},dn=function(e){var n=e.openContextMenu,t=e.setSidebarHighlightedNode,r=e.nodeById,i=e.nodeByCite,o=e.previewNode,l=e.setPreviewNode,s=(0,m.useState)(""),c=s[0],a=s[1],u=encodeURIComponent(encodeURIComponent(o.file));return(0,m.useEffect)((function(){fetch("http://localhost:35901/file/".concat(u)).then((function(e){return e.text()})).then((function(e){"error"!==e&&a(e)})).catch((function(e){return console.log(e),"Could not fetch the text for some reason, sorry!\n\n This can happen because you have an id with forward slashes (/) in it."}))}),[o.id]),(0,xe.jsx)(xe.Fragment,{children:(null===o||void 0===o?void 0:o.id)&&(0,xe.jsx)(un,{nodeById:r,previewNode:o,setPreviewNode:l,previewText:c,nodeByCite:i,setSidebarHighlightedNode:t,openContextMenu:n})})},hn=function(e){var n,t=e.previewNode,r=e.setPreviewNode,i=e.setSidebarHighlightedNode,o=e.nodeById,s=e.linksByNodeId,c=e.nodeByCite,a=e.openContextMenu,u=(null!==(n=s[null===t||void 0===t?void 0:t.id])&&void 0!==n?n:[]).filter((function(e){var n=Rt(e),r=(0,l.Z)(n,2),i=r[0];r[1];return i!==(null===t||void 0===t?void 0:t.id)})).map((function(e){return e.source}));return(0,xe.jsxs)(h.xu,{children:[(0,xe.jsx)(A.X,{pt:4,children:"Backlinks (".concat(u.length,")")}),(0,xe.jsx)(X.gC,{py:2,spacing:3,alignItems:"start",divider:(0,xe.jsx)(X.cX,{borderColor:"gray.500"}),align:"stretch",color:"gray.800",children:(null===t||void 0===t?void 0:t.id)&&u.map((function(e){var n,t,l;n=null===(t=o[e])||void 0===t?void 0:t.title;return(0,xe.jsx)(h.xu,{overflow:"hidden",p:3,bg:"gray.300",width:"100%",children:(0,xe.jsx)(an,{nodeByCite:c,setSidebarHighlightedNode:i,href:"id:".concat(e),nodeById:o,setPreviewNode:r,openContextMenu:a,children:null===(l=o[e])||void 0===l?void 0:l.title})},e)}))})]})};function gn(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function fn(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?gn(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):gn(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var pn=function(e){var n=e.setPreviewNode,t=e.justificationList,r=e.justification,i=e.previewNode,o=e.nodeById,l=e.nodeByCite,s=e.setSidebarHighlightedNode,c=e.linksByNodeId,a=e.openContextMenu;return(0,xe.jsx)(h.xu,{pr:8,overflow:"scroll",height:"100%",className:"org",sx:fn(fn({},nn),{},{textAlign:t[r]}),children:(null===i||void 0===i?void 0:i.id)&&(0,xe.jsxs)(g.k,{height:"100%",flexDirection:"column",justifyContent:"space-between",children:[(0,xe.jsx)(dn,{setPreviewNode:n,previewNode:i,nodeById:o,nodeByCite:l,setSidebarHighlightedNode:s,openContextMenu:a}),(0,xe.jsx)(hn,{setPreviewNode:n,previewNode:i,nodeById:o,linksByNodeId:c,nodeByCite:l,setSidebarHighlightedNode:s,openContextMenu:a})]})})},xn=t(29119);function jn(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function vn(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?jn(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):jn(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function bn(e,n){var t,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=mn(e,null!==(t=r.storage)&&void 0!==t?t:localStorage),o=i.get(),l=void 0!==o?o:n,s=null!=o&&"object"===typeof o&&!1===Array.isArray(o)?vn(vn({},n),o):l;s!==o&&i.update(s);var c=(0,m.useState)(s),a=c[0],u=c[1];(0,m.useEffect)((function(){a!==s&&u(s)}),[e]);var d=function(e){e instanceof Function?u((function(n){var t=e(n);return i.update(t),t})):(u(e),i.update(e))};return[a,d]}function mn(e,n){return{get:function(){var t=n.getItem(e);if(t&&"undefined"!==t)return JSON.parse(t)},update:function(t){n.setItem(e,JSON.stringify(t))},remove:function(){n.removeItem(e)}}}var yn=function(e){var n=e.isOpen,t=e.onOpen,r=e.onClose,i=e.previewNode,o=e.setPreviewNode,s=e.nodeById,c=e.linksByNodeId,a=e.nodeByCite,u=e.setSidebarHighlightedNode,d=e.canUndo,h=e.canRedo,f=e.resetPreviewNode,x=e.previousPreviewNode,j=e.nextPreviewNode,v=e.openContextMenu,b=(e.scope,e.setScope,e.windowWidth),C=e.filter,w=e.setFilter,O=e.tagColors,k=e.setTagColors,S=((0,m.useContext)(en.N).highlightColor,(0,m.useState)()),P=S[0],N=S[1],I=bn("sidebarWidth",400),D=(0,l.Z)(I,2),L=D[0],z=D[1];(0,m.useEffect)((function(){null!==i&&void 0!==i&&i.id?(t(),N(i)):r()}),[null===i||void 0===i?void 0:i.id]);var E=(0,m.useState)(1),Z=E[0],R=E[1],T=(0,m.useState)("sans serif"),B=(T[0],T[1]),F=(0,m.useState)(0),H=(F[0],F[1]);return(0,xe.jsx)(we,{animateOpacity:!1,dimension:"width",in:n,unmountOnExit:!0,startingSize:0,style:{height:"100vh"},children:(0,xe.jsx)(xn.e,{size:{height:"100vh",width:L},onResizeStop:function(e,n,t,r){z((function(e){return e+r.width}))},enable:{top:!1,right:!1,bottom:!1,left:!0,topRight:!1,bottomRight:!1,bottomLeft:!1,topLeft:!1},minWidth:"220px",maxWidth:b-200,children:(0,xe.jsxs)(g.k,{flexDir:"column",h:"100vh",pl:2,color:"black",bg:"alt.100",width:"100%",children:[(0,xe.jsxs)(g.k,{pl:4,alignItems:"center",color:"black",width:"100%",children:[(0,xe.jsx)(g.k,{flexShrink:0,children:(0,xe.jsx)(y.UY3,{onContextMenu:function(e){e.preventDefault(),v(i,e)}})}),(0,xe.jsx)(g.k,{whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",onContextMenu:function(e){e.preventDefault(),v(i,e)},children:(0,xe.jsx)(A.X,{pl:2,whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",lineHeight:1,size:"sm",fontWeight:600,color:"gray.800",children:null===P||void 0===P?void 0:P.title})}),(0,xe.jsx)(g.k,{flexDir:"row",ml:"auto",children:(0,xe.jsx)(p.h,{m:1,icon:(0,xe.jsx)(y.T41,{}),"aria-label":"Options",variant:"subtle",onClick:function(e){v(i,e,{left:void 0,top:12,right:20-b,bottom:void 0})}})})]}),(0,xe.jsx)(Le,{setJustification:R,setIndent:H,setFont:B,justification:Z,setPreviewNode:o,canUndo:d,canRedo:h,resetPreviewNode:f,previousPreviewNode:x,nextPreviewNode:j}),(0,xe.jsxs)(X.gC,{flexGrow:1,overflow:"scroll",alignItems:"left",bg:"alt.100",paddingLeft:4,children:[(0,xe.jsx)(Re,{filter:C,setFilter:w,tagColors:O,setTagColors:k,openContextMenu:v,previewNode:i}),(0,xe.jsx)(pn,{setPreviewNode:o,previewNode:i,nodeById:s,nodeByCite:a,setSidebarHighlightedNode:u,justification:Z,justificationList:["justify","start","end","center"],linksByNodeId:c,openContextMenu:v})]})]})})})},Cn=t(93924),wn=t(83986),On=t(48931),kn=t(56769),Sn=t(86658),Pn=t(6569),Nn=t(88134),In=t(47647);function Dn(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function Ln(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Dn(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Dn(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var zn=function(e){var n=e.filter,t=e.setFilter,r=e.tags,i=e.highlightColor,l=e.mode,s=r.map((function(e){return{value:e,label:e}})),c="blacklist"===l?"tagsBlacklist":"tagsWhitelist",a=(0,m.useState)(n[c].map((function(e){return{value:e,label:e}}))),u=a[0],d=a[1];return(0,xe.jsx)(In.CUIAutoComplete,{items:s,label:"Add tag to "+l,placeholder:" ",onCreateItem:function(e){return null},disableCreateItem:!0,selectedItems:u,onSelectedItemsChange:function(e){e.selectedItems&&(d(e.selectedItems),t(Ln(Ln({},n),{},(0,o.Z)({},c,e.selectedItems.map((function(e){return e.value}))))))},listItemStyleProps:{overflow:"hidden"},highlightItemBg:"gray.400",toggleButtonStyleProps:{variant:"outline"},inputStyleProps:{focusBorderColor:i,color:"gray.800",borderColor:"gray.600"},tagStyleProps:{rounded:"full",bg:i,height:8,paddingLeft:4,fontWeight:"bold"},hideToggleButton:!0,itemRenderer:function(e){return e.label}})};function En(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function Zn(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?En(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):En(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Rn=function(e){var n=e.colorList,t=e.tagColors,r=e.setTagColors,i=e.highlightColor,l=e.tags.map((function(e){return{value:e,label:e}})),s=(0,m.useState)(Object.keys(t).map((function(e){return{value:e,label:e}}))),c=s[0],a=s[1];return(0,xe.jsxs)(h.xu,{children:[(0,xe.jsx)(In.CUIAutoComplete,{items:l,label:"Add tag to filter",placeholder:" ",disableCreateItem:!0,selectedItems:c,onSelectedItemsChange:function(e){e.selectedItems&&(a(Array.from(new Set(e.selectedItems))),r(Object.fromEntries(Array.from(new Set(e.selectedItems)).map((function(e){var n;return[e.label,null!==(n=t[e.label])&&void 0!==n?n:"gray.600"]})))))},listItemStyleProps:{overflow:"hidden"},highlightItemBg:"gray.400",toggleButtonStyleProps:{variant:"outline"},inputStyleProps:{focusBorderColor:i,color:"gray.800",borderColor:"gray.600"},tagStyleProps:{display:"none",rounded:"full",bg:i,height:8,paddingLeft:4,fontWeight:"bold"},hideToggleButton:!0,itemRenderer:function(e){return e.label}}),(0,xe.jsx)(X.gC,{spacing:2,justifyContent:"flex-start",divider:(0,xe.jsx)(X.cX,{borderColor:"gray.500"}),align:"stretch",color:"gray.800",children:Object.keys(t).map((function(e){return(0,xe.jsxs)(g.k,{alignItems:"center",justifyContent:"space-between",width:"100%",pl:2,children:[(0,xe.jsx)(h.xu,{width:"100%",children:(0,xe.jsx)(_.x,{fontWeight:"bold",children:e})}),(0,xe.jsxs)(W.v2,{isLazy:!0,placement:"right",children:[(0,xe.jsx)(W.j2,{as:U.z,colorScheme:"",color:"black",children:(0,xe.jsx)(h.xu,{bgColor:t[e],borderRadius:"sm",height:6,width:6})}),(0,xe.jsxs)($e.h,{children:[" ",(0,xe.jsx)(W.qy,{minW:10,zIndex:"popover",bgColor:"gray.200",children:n.map((function(n){return(0,xe.jsx)(W.sN,{onClick:function(){return r(Zn(Zn({},t),{},(0,o.Z)({},e,n)))},justifyContent:"space-between",alignItems:"center",display:"flex",children:(0,xe.jsx)(h.xu,{bgColor:n,borderRadius:"sm",height:6,width:6})},n)}))})]})]}),(0,xe.jsx)(p.h,{"aria-label":"Delete tag color",variant:"ghost",icon:(0,xe.jsx)(Y.p,{}),onClick:function(){r(Object.fromEntries(Array.from(new Set(c)).map((function(e){var n;return[e.label,null!==(n=t[e.label])&&void 0!==n?n:"gray.600"]})))),a(c.filter((function(n){return n.value!==e})))}})]},e)}))})]})};function Tn(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function Bn(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Tn(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Tn(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Fn=function(e){var n=e.filter,t=e.setFilter,r=e.tagColors,i=e.setTagColors,o=e.highlightColor,l=e.colorList,s=e.tags;return(0,xe.jsxs)(h.xu,{children:[(0,xe.jsxs)(X.gC,{spacing:2,justifyContent:"flex-start",divider:(0,xe.jsx)(X.cX,{borderColor:"gray.500"}),align:"stretch",paddingLeft:7,color:"gray.800",children:[(0,xe.jsxs)(g.k,{alignItems:"center",justifyContent:"space-between",children:[(0,xe.jsx)(_.x,{children:"Link children to"}),(0,xe.jsxs)(W.v2,{isLazy:!0,placement:"right",children:[(0,xe.jsx)(W.j2,{as:U.z,rightIcon:(0,xe.jsx)(Pn.v,{}),colorScheme:"",color:"black",size:"sm",children:function(){switch(n.parent){case"parent":return(0,xe.jsx)(_.x,{children:"File"});case"heading":return(0,xe.jsx)(_.x,{children:"Heading"});default:return(0,xe.jsx)(_.x,{children:"Nothing"})}}()}),(0,xe.jsxs)($e.h,{children:[" ",(0,xe.jsxs)(W.qy,{bgColor:"gray.200",zIndex:"popover",children:[(0,xe.jsx)(W.sN,{onClick:function(){return t((function(e){return Bn(Bn({},e),{},{parent:""})}))},children:"Nothing"}),(0,xe.jsx)(W.sN,{onClick:function(){return t((function(e){return Bn(Bn({},e),{},{parent:"parent"})}))},children:"Parent file node"}),(0,xe.jsx)(W.sN,{onClick:function(){return t((function(e){return Bn(Bn({},e),{},{parent:"heading"})}))},children:"Next highest heading node"})]})]})]})]}),(0,xe.jsxs)(g.k,{justifyContent:"space-between",children:[(0,xe.jsx)(_.x,{children:"Orphans"}),(0,xe.jsx)(Nn.r,{onChange:function(){t((function(e){return Bn(Bn({},e),{},{orphans:!e.orphans})}))},isChecked:n.orphans})]}),(0,xe.jsxs)(g.k,{justifyContent:"space-between",children:[(0,xe.jsx)(_.x,{children:"Dailies"}),(0,xe.jsx)(Nn.r,{onChange:function(){t((function(e){return Bn(Bn({},e),{},{dailies:!e.dailies})}))},isChecked:n.dailies})]}),(0,xe.jsxs)(g.k,{justifyContent:"space-between",children:[(0,xe.jsx)(_.x,{children:"Citations without note files"}),(0,xe.jsx)(Nn.r,{onChange:function(){t(Bn(Bn({},n),{},{filelessCites:!n.filelessCites}))},isChecked:n.filelessCites})]}),(0,xe.jsxs)(g.k,{justifyContent:"space-between",children:[(0,xe.jsx)(_.x,{children:"Non-existant nodes"}),(0,xe.jsx)(Nn.r,{onChange:function(){i(Bn(Bn({},r),{},{bad:"white"})),t(Bn(Bn({},n),{},{bad:!n.bad}))},isChecked:n.bad})]})]}),(0,xe.jsxs)(kn.UQ,{padding:0,allowToggle:!0,allowMultiple:!0,paddingLeft:3,children:[(0,xe.jsxs)(kn.Qd,{children:[(0,xe.jsxs)(kn.KF,{children:["Tag filters",(0,xe.jsx)(kn.XE,{})]}),(0,xe.jsxs)(kn.Hk,{pr:0,mr:0,children:[(0,xe.jsx)(zn,{highlightColor:o,filter:n,setFilter:t,tags:s,mode:"blacklist"}),(0,xe.jsx)(zn,{highlightColor:o,filter:n,setFilter:t,tags:s,mode:"whitelist"})]})]}),(0,xe.jsxs)(kn.Qd,{children:[(0,xe.jsxs)(kn.KF,{children:["Tag colors",(0,xe.jsx)(kn.XE,{})]}),(0,xe.jsx)(kn.Hk,{pr:0,mr:0,children:(0,xe.jsx)(Rn,{tags:s,colorList:l,tagColors:r,setTagColors:i,highlightColor:o})})]})]})]})},Hn=t(15267),Mn=t(24189),Wn=function(e){var n=e.infoText;return(0,xe.jsx)(h.xu,{paddingLeft:"1",children:(0,xe.jsx)(f.u,{label:n,placement:"top",color:"gray.100",bg:"gray.800",hasArrow:!0,children:(0,xe.jsx)(Mn.h,{})})})},An=function(e){var n=e.value,t=e.onChange,r=e.label,i=e.infoText,o=e.children;return(0,xe.jsxs)(h.xu,{paddingTop:2,children:[(0,xe.jsxs)(h.xu,{display:"flex",justifyContent:"space-between",paddingBottom:2,children:[(0,xe.jsxs)(h.xu,{display:"flex",alignItems:"center",children:[(0,xe.jsx)(_.x,{children:r}),i&&(0,xe.jsx)(Wn,{infoText:i})]}),(0,xe.jsx)(Nn.r,{isChecked:!!n,onChange:t})]}),(0,xe.jsx)(Hn.U,{in:!!n,animateOpacity:!0,children:(0,xe.jsx)(h.xu,{paddingLeft:4,paddingTop:2,paddingBottom:2,children:o})})]},r)},Vn=t(24682),Xn=["min","max","step","value"],_n=function(e){var n=e.min,t=void 0===n?0:n,r=e.max,i=void 0===r?10:r,o=e.step,l=void 0===o?.1:o,s=e.value,c=void 0===s?1:s,a=(0,re.Z)(e,Xn),u=a.onChange,d=a.label,g=a.infoText,p=(0,m.useContext)(en.N).highlightColor;return(0,xe.jsxs)(h.xu,{pt:1,pb:2,children:[(0,xe.jsxs)(h.xu,{display:"flex",alignItems:"flex-end",children:[(0,xe.jsx)(_.x,{children:d}),g&&(0,xe.jsx)(Wn,{infoText:g})]}),(0,xe.jsxs)(Vn.iR,{value:c,onChange:u,min:t,max:i,step:l,children:[(0,xe.jsx)(Vn.Uj,{children:(0,xe.jsx)(Vn.Ms,{})}),(0,xe.jsx)(f.u,{bg:p,label:c.toFixed(1),children:(0,xe.jsx)(Vn.gs,{bg:"white"})})]})]},d)};function Un(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function qn(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Un(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Un(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Gn=function(e){var n=e.physics,t=e.setPhysics,r=(0,m.useCallback)((function(e,n,r){t((function(t){return qn(qn({},t),{},(0,o.Z)({},n,e/r))}))}),[]);return(0,xe.jsxs)(h.xu,{children:[(0,xe.jsxs)(X.gC,{spacing:2,justifyContent:"flex-start",divider:(0,xe.jsx)(X.cX,{borderColor:"gray.500"}),align:"stretch",paddingLeft:7,color:"gray.800",children:[(0,xe.jsxs)(An,{label:"Gravity",value:n.gravityOn,onChange:function(){return t(qn(qn({},n),{},{gravityOn:!n.gravityOn}))},children:[(0,xe.jsxs)(g.k,{justifyContent:"space-between",children:[(0,xe.jsx)(_.x,{children:"Also in local"}),(0,xe.jsx)(Nn.r,{onChange:function(){t((function(e){return qn(qn({},e),{},{gravityLocal:!e.gravityLocal})}))},isChecked:n.gravityLocal})]}),(0,xe.jsx)(_n,{label:"Strength",value:10*n.gravity,onChange:function(e){return r(e,"gravity",10)}})]}),(0,xe.jsx)(_n,{value:-n.charge/100,onChange:function(e){return r(e,"charge",-.01)},label:"Repulsive Force"}),(0,xe.jsx)(An,{label:"Collision",infoText:"Perfomance sap, disable if slow",value:n.collision,onChange:function(){return t(qn(qn({},n),{},{collision:!n.collision}))},children:(0,xe.jsx)(_n,{value:n.collisionStrength/5,onChange:function(e){return r(e,"collisionStrength",.2)},label:"Collision Radius",infoText:"Easy with this one, high values can lead to a real jiggly mess"})}),(0,xe.jsx)(_n,{value:5*n.linkStrength,onChange:function(e){return r(e,"linkStrength",5)},label:"Link Force"}),(0,xe.jsx)(_n,{label:"Link Iterations",value:n.linkIts,onChange:function(e){return r(e,"linkIts",1)},min:0,max:6,step:1,infoText:"How many links down the line the physics of a single node affects (Slow)"}),(0,xe.jsx)(_n,{label:"Viscosity",value:10*n.velocityDecay,onChange:function(e){return r(e,"velocityDecay",10)}})]}),(0,xe.jsx)(h.xu,{children:(0,xe.jsx)(kn.UQ,{paddingLeft:3,allowToggle:!0,children:(0,xe.jsxs)(kn.Qd,{children:[(0,xe.jsxs)(kn.KF,{children:[(0,xe.jsx)(_.x,{children:"Advanced"}),(0,xe.jsx)(kn.XE,{marginRight:2})]}),(0,xe.jsx)(kn.Hk,{children:(0,xe.jsxs)(X.gC,{spacing:2,justifyContent:"flex-start",divider:(0,xe.jsx)(X.cX,{borderColor:"gray.500"}),align:"stretch",paddingLeft:3,color:"gray.800",children:[(0,xe.jsx)(_n,{label:"Stabilization rate",value:50*n.alphaDecay,onChange:function(e){return r(e,"alphaDecay",50)}}),(0,xe.jsx)(An,{label:"Center nodes",value:n.centering,onChange:function(){return t(qn(qn({},n),{},{centering:!n.centering}))},infoText:"Keeps the nodes in the center of the viewport. If disabled you can drag the nodes anywhere you want.",children:(0,xe.jsx)(_n,{label:"Centering Strength",value:n.centeringStrength,max:2,step:.01,onChange:function(e){return r(e,"centeringStrength",1)}})})]})})]})})})]})},Jn=t(46049);function Qn(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function Kn(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Qn(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Qn(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Yn=function(e){var n=e.visuals,t=e.setVisuals;return(0,xe.jsx)(X.gC,{spacing:2,justifyContent:"flex-start",divider:(0,xe.jsx)(X.cX,{borderColor:"gray.500"}),align:"stretch",color:"gray.800",children:(0,xe.jsx)(h.xu,{children:(0,xe.jsx)(An,{label:"Highlight",onChange:function(){return t((function(e){return Kn(Kn({},e),{},{highlight:!e.highlight})}))},value:n.highlight,children:(0,xe.jsxs)(X.gC,{spacing:1,justifyContent:"flex-start",divider:(0,xe.jsx)(X.cX,{borderColor:"gray.400"}),align:"stretch",paddingLeft:0,children:[(0,xe.jsx)(_n,{label:"Highlight Link Thickness",value:n.highlightLinkSize,onChange:function(e){return t((function(n){return Kn(Kn({},n),{},{highlightLinkSize:e})}))}}),(0,xe.jsx)(_n,{label:"Highlight Node Size",value:n.highlightNodeSize,onChange:function(e){return t((function(n){return Kn(Kn({},n),{},{highlightNodeSize:e})}))}}),(0,xe.jsx)(_n,{min:0,max:1,label:"Highlight Fade",value:n.highlightFade,onChange:function(e){return t((function(n){return Kn(Kn({},n),{},{highlightFade:e})}))}}),(0,xe.jsxs)(An,{label:"Highlight Animation",onChange:function(){t((function(e){return Kn(Kn({},e),{},{highlightAnim:!e.highlightAnim})}))},value:n.highlightAnim,children:[(0,xe.jsx)(_n,{label:"Animation speed",onChange:function(e){return t((function(n){return Kn(Kn({},n),{},{animationSpeed:e})}))},value:n.animationSpeed,infoText:"Slower speed has a chance of being buggy",min:50,max:1e3,step:10}),(0,xe.jsx)(Jn.Ph,{placeholder:n.algorithmName,onChange:function(e){t((function(n){return Kn(Kn({},n),{},{algorithmName:e.target.value})}))},children:n.algorithmOptions.map((function(e){return(0,xe.jsx)("option",{value:e,children:e},e)}))})]})]})})})})},$n=t(67546),et=t(93441);function nt(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function tt(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?nt(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):nt(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var rt=function(e){var n=e.label,t=e.colorList,r=e.value,i=e.visValue,l=e.setVisuals,s=e.noEmpty,c=(0,m.useCallback)((function(e){return l((function(n){return tt(tt({},n),{},(0,o.Z)({},r,e))}))}),[]);return(0,xe.jsxs)(g.k,{alignItems:"center",justifyContent:"space-between",children:[(0,xe.jsx)(_.x,{children:n}),(0,xe.jsxs)(Ye.J2,{isLazy:!0,placement:"right",children:[(0,xe.jsx)(Ye.xo,{children:(0,xe.jsx)(U.z,{colorScheme:"",color:"black",rightIcon:(0,xe.jsx)(Pn.v,{}),children:(0,xe.jsx)(h.xu,{bgColor:i,borderRadius:"sm",height:6,width:6})})}),(0,xe.jsx)($e.h,{children:(0,xe.jsx)(Ye.yk,{zIndex:"tooltip",maxW:36,position:"relative",children:(0,xe.jsxs)(g.k,{flexWrap:"wrap",bgColor:"gray.200",children:[!s&&(0,xe.jsx)(h.xu,{onClick:function(){return c("")},justifyContent:"space-between",alignItems:"center",display:"flex",m:1,children:(0,xe.jsx)(h.xu,{height:6,width:6,borderColor:"gray.600",borderRadius:"xl",borderWidth:1})}),t.map((function(e){return(0,xe.jsx)(h.xu,{m:1,onClick:function(){return c(e)},justifyContent:"space-between",alignItems:"center",display:"flex",children:(0,xe.jsx)(h.xu,{bgColor:e,borderRadius:"xl",height:6,width:6})},e)}))]})})})]})]})};function it(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function ot(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?it(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):it(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var lt=function(e){var n=e.visuals,t=e.setVisualsCallback,r=e.highlightColor,o=e.setHighlightColor;return(0,xe.jsx)(X.gC,{spacing:2,justifyContent:"flex-start",divider:(0,xe.jsx)(X.cX,{borderColor:"gray.500"}),align:"stretch",color:"gray.800",children:(0,xe.jsxs)(h.xu,{children:[(0,xe.jsxs)(g.k,{alignItems:"center",justifyContent:"space-between",children:[(0,xe.jsx)(_.x,{children:"Nodes"}),(0,xe.jsx)(f.u,{label:"Shuffle node colors",children:(0,xe.jsx)(p.h,{"aria-label":"Shuffle node colors",size:"sm",icon:(0,xe.jsx)($n.n,{}),variant:"ghost",onClick:function(){var e,r=null!==(e=n.nodeColorScheme)&&void 0!==e?e:[];t(ot(ot({},n),{},{nodeColorScheme:r.map((function(e){return[Math.random(),e]})).sort((function(e,n){return(0,l.Z)(e,1)[0]-(0,l.Z)(n,1)[0]})).map((function(e){var n=(0,l.Z)(e,2);n[0];return n[1]}))}))}})}),(0,xe.jsx)(f.u,{label:"Cycle node colors",children:(0,xe.jsx)(p.h,{"aria-label":"Shift node colors",icon:(0,xe.jsx)(et.L,{}),size:"sm",variant:"ghost",onClick:function(){var e,r=null!==(e=n.nodeColorScheme)&&void 0!==e?e:[];t(ot(ot({},n),{},{nodeColorScheme:[].concat((0,i.Z)(r.slice(1,r.length)),[r[0]])}))}})}),(0,xe.jsxs)(W.v2,{isLazy:!0,placement:"right",closeOnSelect:!1,matchWidth:!0,children:[(0,xe.jsx)(W.j2,{width:20,as:U.z,colorScheme:"",color:"black",rightIcon:(0,xe.jsx)(Pn.v,{}),children:(0,xe.jsx)(g.k,{height:6,width:6,flexDirection:"column",flexWrap:"wrap",children:n.nodeColorScheme.map((function(e){return(0,xe.jsx)(h.xu,{bgColor:e,flex:"1 1 8px",borderRadius:"2xl"},e)}))})}),(0,xe.jsxs)($e.h,{children:[" ",(0,xe.jsx)(W.qy,{minW:10,zIndex:"popover",bgColor:"gray.200",children:(0,xe.jsx)(W.__,{width:500,type:"checkbox",defaultValue:n.nodeColorScheme,onChange:function(e){e.length&&t(ot(ot({},n),{},{nodeColorScheme:e}))},children:M.map((function(e){return(0,xe.jsx)(W.ii,{isChecked:n.nodeColorScheme.some((function(n){return n===e})),value:e,isDisabled:1===n.nodeColorScheme.length&&n.nodeColorScheme[0]===e,children:(0,xe.jsx)(h.xu,{justifyContent:"space-between",alignItems:"center",display:"flex",children:(0,xe.jsx)(h.xu,{bgColor:e,borderRadius:"sm",height:6,width:6})})},e)}))})})]})]})]}),(0,xe.jsxs)(g.k,{alignItems:"center",justifyContent:"space-between",children:[(0,xe.jsx)(_.x,{children:"Links"}),(0,xe.jsxs)(W.v2,{isLazy:!0,placement:"right",children:[(0,xe.jsx)(W.j2,{as:U.z,colorScheme:"",color:"black",rightIcon:(0,xe.jsx)(Pn.v,{}),children:(0,xe.jsx)(h.xu,{children:n.linkColorScheme?(0,xe.jsx)(h.xu,{bgColor:n.linkColorScheme,borderRadius:"sm",height:6,width:6}):(0,xe.jsx)(g.k,{height:6,width:6,flexDirection:"column",flexWrap:"wrap",children:n.nodeColorScheme.map((function(e){return(0,xe.jsx)(h.xu,{bgColor:e,flex:"1 1 8px",borderRadius:"2xl"},e)}))})})}),(0,xe.jsxs)($e.h,{children:[" ",(0,xe.jsxs)(W.qy,{minW:10,zIndex:"popover",bgColor:"gray.200",children:[(0,xe.jsx)(W.sN,{onClick:function(){return t(ot(ot({},n),{},{linkColorScheme:""}))},justifyContent:"space-between",alignItems:"center",display:"flex",children:(0,xe.jsx)(g.k,{height:6,width:6,flexDirection:"column",flexWrap:"wrap",children:n.nodeColorScheme.map((function(e){return(0,xe.jsx)(h.xu,{bgColor:e,flex:"1 1 8px",borderRadius:"2xl"},e)}))})}),M.map((function(e){return(0,xe.jsx)(W.sN,{onClick:function(){return t(ot(ot({},n),{},{linkColorScheme:e}))},justifyContent:"space-between",alignItems:"center",display:"flex",children:(0,xe.jsx)(h.xu,{bgColor:e,borderRadius:"sm",height:6,width:6})},e)}))]})]})]})]}),(0,xe.jsxs)(g.k,{alignItems:"center",justifyContent:"space-between",children:[(0,xe.jsx)(_.x,{children:"Accent"}),(0,xe.jsxs)(W.v2,{isLazy:!0,placement:"right",children:[(0,xe.jsx)(W.j2,{as:U.z,colorScheme:"",color:"black",rightIcon:(0,xe.jsx)(Pn.v,{}),children:(0,xe.jsx)(h.xu,{bgColor:r,borderRadius:"sm",height:6,width:6})}),(0,xe.jsxs)($e.h,{children:[" ",(0,xe.jsx)(W.qy,{minW:10,zIndex:"popover",bgColor:"gray.200",children:M.map((function(e){return(0,xe.jsx)(W.sN,{onClick:function(){return o(e)},justifyContent:"space-between",alignItems:"center",display:"flex",children:(0,xe.jsx)(h.xu,{bgColor:e,borderRadius:"sm",height:6,width:6})},e)}))})]})]})]}),(0,xe.jsx)(rt,{colorList:M,label:"Link highlight",setVisuals:t,value:"linkHighlight",visValue:n.linkHighlight}),(0,xe.jsx)(rt,{colorList:M,label:"Node highlight",setVisuals:t,value:"nodeHighlight",visValue:n.nodeHighlight}),(0,xe.jsx)(rt,{colorList:M,label:"Background",setVisuals:t,value:"backgroundColor",visValue:n.backgroundColor}),(0,xe.jsx)(rt,{colorList:M,label:"Emacs node",setVisuals:t,value:"emacsNodeColor",visValue:n.emacsNodeColor})]})})};function st(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function ct(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?st(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):st(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var at=function(e){var n=e.visuals,t=e.setVisuals,r=e.threeDim;return(0,xe.jsx)(X.gC,{spacing:2,justifyContent:"flex-start",divider:(0,xe.jsx)(X.cX,{borderColor:"gray.500"}),align:"stretch",color:"gray.800",children:(0,xe.jsxs)(h.xu,{children:[(0,xe.jsx)(_n,{label:"Node size",value:n.nodeRel,onChange:function(e){return t(ct(ct({},n),{},{nodeRel:e}))}}),(0,xe.jsx)(_n,{label:"Node connections size scale",value:n.nodeSizeLinks,min:0,max:2,onChange:function(e){return t(ct(ct({},n),{},{nodeSizeLinks:e}))}}),(0,xe.jsx)(_n,{label:"Node zoom invariance",value:n.nodeZoomSize,min:0,max:2,infoText:"How much the graph will try to keep the nodesize consistent across zoom scales. 0 is no consistency, node will always be their true size, 1 is linear, 2 is quadratic.",onChange:function(e){return t((function(n){return ct(ct({},n),{},{nodeZoomSize:e})}))}}),r&&(0,xe.jsxs)(xe.Fragment,{children:[(0,xe.jsx)(_n,{label:"Node opacity",value:n.nodeOpacity,min:0,max:1,onChange:function(e){return t(ct(ct({},n),{},{nodeOpacity:e}))}}),(0,xe.jsx)(_n,{label:"Node resolution",value:n.nodeResolution,min:5,max:32,step:1,onChange:function(e){return t(ct(ct({},n),{},{nodeResolution:e}))}})]}),(0,xe.jsx)(_n,{label:"Link width",value:n.linkWidth,onChange:function(e){return t(ct(ct({},n),{},{linkWidth:e}))}}),r&&(0,xe.jsx)(_n,{label:"Link opacity",min:0,max:1,value:n.linkOpacity,onChange:function(e){return t(ct(ct({},n),{},{linkOpacity:e}))}}),(0,xe.jsxs)(An,{label:"Link arrows",value:n.arrows,onChange:function(){return t(ct(ct({},n),{},{arrows:!n.arrows}))},children:[(0,xe.jsx)(_n,{label:"Arrow size",value:n.arrowsLength/10,onChange:function(e){return t(ct(ct({},n),{},{arrowsLength:10*e}))}}),(0,xe.jsx)(_n,{label:"Arrow Position",value:n.arrowsPos,min:0,max:1,step:.01,onChange:function(e){return t(ct(ct({},n),{},{arrowsPos:e}))}}),(0,xe.jsx)(rt,{colorList:M,label:"Arrow Color",setVisuals:t,value:"arrowsColor",visValue:n.arrowsColor},"arrow")]}),(0,xe.jsxs)(An,{label:"Directional Particles",value:n.particles,onChange:function(){return t(ct(ct({},n),{},{particles:!n.particles}))},children:[(0,xe.jsx)(_n,{label:"Particle Number",value:n.particlesNumber,max:5,step:1,onChange:function(e){return t(ct(ct({},n),{},{particlesNumber:e}))}}),(0,xe.jsx)(_n,{label:"Particle Size",value:n.particlesWidth,onChange:function(e){return t(ct(ct({},n),{},{particlesWidth:e}))}})]})]})})};function ut(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function dt(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?ut(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ut(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var ht=function(e){var n=e.visuals,t=e.setVisuals;return(0,xe.jsx)(X.gC,{spacing:2,justifyContent:"flex-start",divider:(0,xe.jsx)(X.cX,{borderColor:"gray.500"}),align:"stretch",color:"gray.800",children:(0,xe.jsxs)(h.xu,{children:[(0,xe.jsxs)(g.k,{alignItems:"center",justifyContent:"space-between",children:[(0,xe.jsx)(_.x,{children:"Show labels"}),(0,xe.jsxs)(W.v2,{isLazy:!0,placement:"right",children:[(0,xe.jsx)(W.j2,{as:U.z,colorScheme:"",color:"black",rightIcon:(0,xe.jsx)(Pn.v,{}),children:n.labels?n.labels<2?"On Highlight":"Always":"Never"}),(0,xe.jsxs)($e.h,{children:[" ",(0,xe.jsxs)(W.qy,{zIndex:"popover",bgColor:"gray.200",children:[(0,xe.jsx)(W.sN,{onClick:function(){return t(dt(dt({},n),{},{labels:0}))},children:"Never"}),(0,xe.jsx)(W.sN,{onClick:function(){return t(dt(dt({},n),{},{labels:1}))},children:"On Highlight"}),(0,xe.jsx)(W.sN,{onClick:function(){return t(dt(dt({},n),{},{labels:2}))},children:"Always"}),(0,xe.jsx)(W.sN,{onClick:function(){return t(dt(dt({},n),{},{labels:3}))},children:"Always (even in 3D)"})]})]})]})]}),(0,xe.jsxs)(X.gC,{spacing:1,justifyContent:"flex-start",divider:(0,xe.jsx)(X.cX,{borderColor:"gray.400"}),align:"stretch",paddingLeft:2,color:"gray.800",children:[(0,xe.jsx)(_n,{label:"Label font size",value:n.labelFontSize,min:5,max:20,step:.5,onChange:function(e){return t(dt(dt({},n),{},{labelFontSize:e}))}}),(0,xe.jsx)(_n,{label:"Max. label characters",value:n.labelLength,min:10,max:100,step:1,onChange:function(e){return t(dt(dt({},n),{},{labelLength:e}))}}),(0,xe.jsx)(_n,{label:"Max. label line length",value:n.labelWordWrap,min:10,max:100,step:1,onChange:function(e){return t(dt(dt({},n),{},{labelWordWrap:e}))}}),(0,xe.jsx)(_n,{label:"Space between label lines",value:n.labelLineSpace,min:.2,max:3,step:.1,onChange:function(e){return t(dt(dt({},n),{},{labelLineSpace:e}))}}),(0,xe.jsx)(rt,{colorList:M,label:"Text",setVisuals:t,value:"labelTextColor",visValue:n.labelTextColor}),(0,xe.jsx)(rt,{colorList:M,label:"Background",setVisuals:t,value:"labelBackgroundColor",visValue:n.labelBackgroundColor}),(0,xe.jsx)(Hn.U,{in:!!n.labelBackgroundColor,animateOpacity:!0,children:(0,xe.jsx)(h.xu,{paddingTop:2,children:(0,xe.jsx)(_n,{label:"Background opacity",value:n.labelBackgroundOpacity,onChange:function(e){console.log(n.labelBackgroundOpacity),t(dt(dt({},n),{},{labelBackgroundOpacity:e}))},min:0,max:1,step:.01})})}),(0,xe.jsx)(Hn.U,{in:n.labels>1,animateOpacity:!0,children:(0,xe.jsx)(h.xu,{paddingTop:2,children:(0,xe.jsx)(_n,{label:"Label Appearance Scale",value:5*n.labelScale,onChange:function(e){return t(dt(dt({},n),{},{labelScale:e/5}))}})})})]})]})})};function gt(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function ft(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?gt(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):gt(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var pt=function(e){var n=e.visuals,t=e.setVisuals;return(0,xe.jsx)(X.gC,{spacing:2,justifyContent:"flex-start",divider:(0,xe.jsx)(X.cX,{borderColor:"gray.500"}),align:"stretch",color:"gray.800",children:(0,xe.jsxs)(h.xu,{children:[(0,xe.jsxs)(An,{label:"Dash cite links",infoText:"Add dashes to citation links made with org-roam-bibtex",value:n.citeDashes,onChange:function(){return t(ft(ft({},n),{},{citeDashes:!n.citeDashes}))},children:[(0,xe.jsx)(_n,{label:"Dash length",value:n.citeDashLength/10,onChange:function(e){return t(ft(ft({},n),{},{citeDashLength:10*e}))}}),(0,xe.jsx)(_n,{label:"Gap length",value:n.citeGapLength/5,onChange:function(e){return t(ft(ft({},n),{},{citeGapLength:5*e}))}})]}),(0,xe.jsx)(rt,{colorList:M,label:"Citation node color",setVisuals:t,value:"citeNodeColor",visValue:n.citeNodeColor}),(0,xe.jsx)(rt,{colorList:M,label:"Citation link color",setVisuals:t,value:"citeLinkColor",visValue:n.citeLinkColor}),(0,xe.jsx)(rt,{colorList:M,label:"Reference link highlight",setVisuals:t,value:"citeLinkHighlightColor",visValue:n.citeLinkHighlightColor}),(0,xe.jsxs)(An,{label:"Dash ref links",infoText:"Add dashes to citation links, whose target has a note, made with org-roam-bibtex",value:n.refDashes,onChange:function(){return t(ft(ft({},n),{},{refDashes:!n.refDashes}))},children:[(0,xe.jsx)(_n,{label:"Dash length",value:n.refDashLength/10,onChange:function(e){return t(ft(ft({},n),{},{refDashLength:10*e}))}}),(0,xe.jsx)(_n,{label:"Gap length",value:n.refGapLength/5,onChange:function(e){return t(ft(ft({},n),{},{refGapLength:5*e}))}})]}),(0,xe.jsx)(rt,{colorList:M,label:"Reference node color",setVisuals:t,value:"refNodeColor",visValue:n.refNodeColor}),(0,xe.jsx)(rt,{colorList:M,label:"Reference link color",setVisuals:t,value:"refLinkColor",visValue:n.refLinkColor}),(0,xe.jsx)(rt,{colorList:M,label:"Reference link highlight",setVisuals:t,value:"refLinkHighlightColor",visValue:n.refLinkHighlightColor})]})})},xt=t(67690),jt=function(){var e=(0,m.useContext)(en.N),n=e.emacsTheme,t=e.setEmacsTheme;e.highlightColor;return(0,xe.jsxs)(g.k,{alignItems:"center",justifyContent:"space-between",pl:7,pr:2,children:[(0,xe.jsx)(_.x,{children:"Theme"}),(0,xe.jsxs)(W.v2,{isLazy:!0,placement:"bottom",closeOnSelect:!1,children:[(0,xe.jsx)(W.j2,{as:U.z,colorScheme:"",color:"black",rightIcon:(0,xe.jsx)(Pn.v,{}),children:n[0]}),(0,xe.jsxs)(W.qy,{minW:10,zIndex:"popover",bgColor:"gray.200",children:[(0,xe.jsx)(W.sN,{onClick:function(){return""},justifyContent:"space-between",alignItems:"center",display:"flex",children:(0,xe.jsx)(h.xu,{height:6,width:6})}),Object.keys(xt.n).map((function(e,n){return(0,xe.jsxs)(W.sN,{onClick:function(){return t([e,xt.n[e]])},justifyContent:"space-between",alignItems:"center",display:"flex",children:[(0,xe.jsx)(_.x,{children:e}),(0,xe.jsx)(g.k,{height:6,width:20,flexDirection:"column",flexWrap:"wrap",children:Object.values(xt.n[e]).map((function(e){return(0,xe.jsx)(h.xu,{bgColor:e,flex:"1 1 8px"},e)}))})]},e)}))]})]})]})},vt=function(e){var n=e.visuals,t=e.setVisuals,r=e.highlightColor,i=e.setHighlightColor,o=e.threeDim,l=(0,m.useCallback)((function(e){return t(e)}),[]);return(0,xe.jsxs)(X.gC,{justifyContent:"flex-start",align:"stretch",children:[(0,xe.jsx)(jt,{}),(0,xe.jsxs)(kn.UQ,{allowToggle:!0,defaultIndex:[0],paddingLeft:3,children:[(0,xe.jsxs)(kn.Qd,{children:[(0,xe.jsx)(kn.KF,{children:(0,xe.jsxs)(g.k,{justifyContent:"space-between",w:"100%",children:[(0,xe.jsx)(_.x,{children:"Colors"}),(0,xe.jsx)(kn.XE,{marginRight:2})]})}),(0,xe.jsx)(kn.Hk,{children:(0,xe.jsx)(lt,{visuals:n,setVisualsCallback:l,highlightColor:r,setHighlightColor:i})})]}),(0,xe.jsxs)(kn.Qd,{children:[(0,xe.jsx)(kn.KF,{children:(0,xe.jsxs)(g.k,{justifyContent:"space-between",w:"100%",children:[(0,xe.jsx)(_.x,{children:"Nodes & Links"}),(0,xe.jsx)(kn.XE,{marginRight:2})]})}),(0,xe.jsx)(kn.Hk,{children:(0,xe.jsx)(at,{visuals:n,setVisuals:l,threeDim:o})})]}),(0,xe.jsxs)(kn.Qd,{children:[(0,xe.jsx)(kn.KF,{children:(0,xe.jsxs)(g.k,{justifyContent:"space-between",w:"100%",children:[(0,xe.jsx)(_.x,{children:"Labels"}),(0,xe.jsx)(kn.XE,{marginRight:2})]})}),(0,xe.jsx)(kn.Hk,{children:(0,xe.jsx)(ht,{visuals:n,setVisuals:l})})]}),(0,xe.jsxs)(kn.Qd,{children:[(0,xe.jsx)(kn.KF,{children:(0,xe.jsxs)(g.k,{justifyContent:"space-between",w:"100%",children:[(0,xe.jsx)(_.x,{children:"Highlighting"}),(0,xe.jsx)(kn.XE,{marginRight:2})]})}),(0,xe.jsx)(kn.Hk,{children:(0,xe.jsx)(Yn,{visuals:n,setVisuals:l})})]}),(0,xe.jsxs)(kn.Qd,{children:[(0,xe.jsx)(kn.KF,{children:(0,xe.jsxs)(g.k,{justifyContent:"space-between",w:"100%",children:[(0,xe.jsx)(_.x,{children:"Citations"}),(0,xe.jsx)(kn.XE,{marginRight:2})]})}),(0,xe.jsx)(kn.Hk,{children:(0,xe.jsx)(pt,{visuals:n,setVisuals:l})})]})]})]})};function bt(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function mt(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?bt(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):bt(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var yt=function(e){var n=e.behavior,t=e.setBehavior,r=e.mouse,i=e.setMouse;return(0,xe.jsxs)(X.gC,{spacing:2,justifyContent:"flex-start",divider:(0,xe.jsx)(X.cX,{borderColor:"gray.500"}),align:"stretch",paddingLeft:7,color:"gray.800",children:[(0,xe.jsxs)(g.k,{alignItems:"center",justifyContent:"space-between",children:[(0,xe.jsx)(_.x,{children:"Preview node"}),(0,xe.jsxs)(W.v2,{isLazy:!0,placement:"right",children:[(0,xe.jsx)(W.j2,{as:U.z,rightIcon:(0,xe.jsx)(Pn.v,{}),colorScheme:"",color:"black",children:(0,xe.jsx)(_.x,{children:r.preview?r.preview[0].toUpperCase()+r.preview.slice(1):"Never"})}),(0,xe.jsxs)($e.h,{children:[" ",(0,xe.jsxs)(W.qy,{bgColor:"gray.200",zIndex:"popover",children:[(0,xe.jsx)(W.sN,{onClick:function(){return i(mt(mt({},r),{},{preview:""}))},children:"Never"}),(0,xe.jsx)(W.sN,{onClick:function(){return i(mt(mt({},r),{},{preview:"click"}))},children:"Click"}),(0,xe.jsx)(W.sN,{onClick:function(){return i(mt(mt({},r),{},{preview:"double"}))},children:"Double Click"})]})]})]})]}),(0,xe.jsxs)(g.k,{alignItems:"center",justifyContent:"space-between",children:[(0,xe.jsxs)(g.k,{children:[(0,xe.jsx)(_.x,{children:"Expand Node"}),(0,xe.jsx)(Wn,{infoText:"View only the node and its direct neighbors"})]}),(0,xe.jsxs)(W.v2,{isLazy:!0,placement:"right",children:[(0,xe.jsx)(W.j2,{as:U.z,rightIcon:(0,xe.jsx)(Pn.v,{}),colorScheme:"",color:"black",children:(0,xe.jsx)(_.x,{children:r.local?r.local[0].toUpperCase()+r.local.slice(1):"Never"})}),(0,xe.jsxs)($e.h,{children:[" ",(0,xe.jsxs)(W.qy,{zIndex:"popover",bgColor:"gray.200",children:[(0,xe.jsx)(W.sN,{onClick:function(){return i(mt(mt({},r),{},{local:""}))},children:"Never"}),(0,xe.jsx)(W.sN,{onClick:function(){return i(mt(mt({},r),{},{local:"click"}))},children:"Click"}),(0,xe.jsx)(W.sN,{onClick:function(){return i(mt(mt({},r),{},{local:"double"}))},children:"Double Click"}),(0,xe.jsx)(W.sN,{onClick:function(){return i(mt(mt({},r),{},{local:"right"}))},children:"Right Click"})]})]})]})]}),(0,xe.jsxs)(g.k,{alignItems:"center",justifyContent:"space-between",children:[(0,xe.jsx)(_.x,{children:"Open in Emacs"}),(0,xe.jsxs)(W.v2,{isLazy:!0,placement:"right",children:[(0,xe.jsx)(W.j2,{as:U.z,rightIcon:(0,xe.jsx)(Pn.v,{}),colorScheme:"",color:"black",children:(0,xe.jsx)(_.x,{children:r.follow?r.follow[0].toUpperCase()+r.follow.slice(1):"Never"})}),(0,xe.jsxs)($e.h,{children:[" ",(0,xe.jsxs)(W.qy,{bgColor:"gray.200",zIndex:"popover",children:[(0,xe.jsx)(W.sN,{onClick:function(){return i(mt(mt({},r),{},{follow:""}))},children:"Never"}),(0,xe.jsx)(W.sN,{onClick:function(){return i(mt(mt({},r),{},{follow:"click"}))},children:"Click"}),(0,xe.jsx)(W.sN,{onClick:function(){return i(mt(mt({},r),{},{follow:"double"}))},children:"Double Click"}),(0,xe.jsx)(W.sN,{onClick:function(){return i(mt(mt({},r),{},{follow:"right"}))},children:"Right Click"})]})]})]})]}),(0,xe.jsxs)(g.k,{alignItems:"center",justifyContent:"space-between",children:[(0,xe.jsx)(_.x,{children:"Follow Emacs by..."}),(0,xe.jsxs)(W.v2,{isLazy:!0,placement:"right",children:[(0,xe.jsx)(W.j2,{as:U.z,rightIcon:(0,xe.jsx)(Pn.v,{}),colorScheme:"",color:"black",children:(0,xe.jsx)(_.x,{children:n.follow[0].toUpperCase()+n.follow.slice(1)})}),(0,xe.jsxs)($e.h,{children:[" ",(0,xe.jsxs)(W.qy,{bgColor:"gray.200",zIndex:"popover",children:[(0,xe.jsx)(W.sN,{onClick:function(){return t(mt(mt({},n),{},{follow:"color"}))},children:"Just coloring the currently opened node"}),(0,xe.jsx)(W.sN,{onClick:function(){return t(mt(mt({},n),{},{follow:"local"}))},children:"Opening the local graph"}),(0,xe.jsx)(W.sN,{onClick:function(){return t(mt(mt({},n),{},{follow:"zoom"}))},children:"Zooming to the current node"})]})]})]})]}),(0,xe.jsxs)(g.k,{alignItems:"center",justifyContent:"space-between",children:[(0,xe.jsxs)(g.k,{children:[(0,xe.jsx)(_.x,{children:"Local graph"}),(0,xe.jsx)(Wn,{infoText:"When in local mode and clicking a new node, should I add that node's local graph or open the new one?"})]}),(0,xe.jsxs)(W.v2,{isLazy:!0,placement:"right",children:[(0,xe.jsx)(W.j2,{as:U.z,rightIcon:(0,xe.jsx)(Pn.v,{}),colorScheme:"",color:"black",children:(0,xe.jsx)(_.x,{children:"add"===n.localSame?"Add":"Replace"})}),(0,xe.jsxs)($e.h,{children:[" ",(0,xe.jsxs)(W.qy,{bgColor:"gray.200",zIndex:"popover",children:[(0,xe.jsx)(W.sN,{onClick:function(){return t(mt(mt({},n),{},{localSame:"replace"}))},children:"Open that nodes graph"}),(0,xe.jsx)(W.sN,{onClick:function(){return t(mt(mt({},n),{},{localSame:"add"}))},children:"Add node to local graph"})]})]})]})]}),(0,xe.jsx)(_n,{label:"Zoom speed",value:n.zoomSpeed,min:0,max:4e3,step:100,onChange:function(e){return t(mt(mt({},n),{},{zoomSpeed:e}))}}),(0,xe.jsx)(_n,{label:"Zoom padding",value:n.zoomPadding,min:0,max:400,step:1,onChange:function(e){return t(mt(mt({},n),{},{zoomPadding:e}))},infoText:"How much to zoom out to accomodate all nodes when changing the view."})]})},Ct=["style"];function wt(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function Ot(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?wt(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):wt(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var kt=function(e){var n=e.physics,t=e.setPhysics,r=e.threeDim,i=e.setThreeDim,o=e.filter,s=e.setFilter,c=e.visuals,a=e.setVisuals,u=e.mouse,d=e.setMouse,g=e.behavior,x=e.setBehavior,j=e.tags,v=e.tagColors,b=e.setTagColors,y=bn("showTweaks",!1),C=(0,l.Z)(y,2),w=C[0],O=C[1],k=(0,m.useContext)(en.N),S=k.highlightColor,P=k.setHighlightColor;return w?(0,xe.jsxs)(h.xu,{position:"absolute",bg:"alt.100",w:"xs",marginTop:2,marginLeft:2,borderRadius:"lg",paddingBottom:5,zIndex:4,boxShadow:"xl",maxH:"95vh",fontSize:"sm",children:[(0,xe.jsxs)(h.xu,{display:"flex",justifyContent:"space-between",alignItems:"center",paddingRight:2,paddingTop:1,children:[(0,xe.jsx)(f.u,{label:"2D",children:(0,xe.jsx)(U.z,{onClick:function(){return i(!r)},variant:"subtle",zIndex:"overlay",children:r?"3D":"2D"})}),(0,xe.jsxs)(h.xu,{display:"flex",alignItems:"center",children:[(0,xe.jsx)(f.u,{label:"Reset settings to defaults",children:(0,xe.jsx)(p.h,{"aria-label":"Reset Defaults",icon:(0,xe.jsx)(wn.A,{}),onClick:function(){a(B),s(T),d(H),t(R),x(F)},variant:"subtle",size:"sm"})}),(0,xe.jsx)(p.h,{size:"sm",icon:(0,xe.jsx)(On.T,{}),"aria-label":"Close Tweak Panel",variant:"subtle",onClick:function(){return O(!1)}})]})]}),(0,xe.jsx)(Sn.ZP,{autoHeight:!0,autoHeightMax:.85*globalThis.innerHeight,autoHide:!0,renderThumbVertical:function(e){var n=e.style,t=(0,re.Z)(e,Ct);return(0,xe.jsx)(h.xu,Ot(Ot({},t),{},{style:Ot(Ot({},n),{},{borderRadius:10}),bg:S}))},children:(0,xe.jsxs)(kn.UQ,{allowMultiple:!0,allowToggle:!0,color:"black",children:[(0,xe.jsxs)(kn.Qd,{children:[(0,xe.jsxs)(kn.KF,{children:[(0,xe.jsx)(kn.XE,{marginRight:2}),(0,xe.jsx)(A.X,{size:"sm",children:"Filter"})]}),(0,xe.jsx)(kn.Hk,{children:(0,xe.jsx)(Fn,{filter:o,setFilter:s,tagColors:v,setTagColors:b,highlightColor:S,colorList:M,tags:j})})]}),(0,xe.jsxs)(kn.Qd,{children:[(0,xe.jsx)(kn.KF,{display:"flex",justifyContent:"space-between",children:(0,xe.jsxs)(h.xu,{display:"flex",children:[(0,xe.jsx)(kn.XE,{marginRight:2}),(0,xe.jsx)(A.X,{size:"sm",children:"Physics"})]})}),(0,xe.jsx)(kn.Hk,{children:(0,xe.jsx)(Gn,{physics:n,setPhysics:t})})]}),(0,xe.jsxs)(kn.Qd,{children:[(0,xe.jsxs)(kn.KF,{children:[(0,xe.jsx)(kn.XE,{marginRight:2}),(0,xe.jsx)(A.X,{size:"sm",children:"Visual"})]}),(0,xe.jsx)(kn.Hk,{children:(0,xe.jsx)(vt,{visuals:c,setVisuals:a,highlightColor:S,setHighlightColor:P,threeDim:r})})]}),(0,xe.jsxs)(kn.Qd,{children:[(0,xe.jsxs)(kn.KF,{children:[(0,xe.jsx)(kn.XE,{marginRight:2}),(0,xe.jsx)(A.X,{size:"sm",children:"Behavior"})]}),(0,xe.jsx)(kn.Hk,{children:(0,xe.jsx)(yt,{behavior:g,setBehavior:x,mouse:u,setMouse:d})})]})]})})]}):(0,xe.jsx)(h.xu,{position:"absolute",zIndex:"overlay",marginTop:0,marginLeft:0,display:w?"none":"block",children:(0,xe.jsx)(p.h,{variant:"subtle","aria-label":"Settings",icon:(0,xe.jsx)(Cn.e,{}),onClick:function(){return O(!0)}})})};function St(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function Pt(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?St(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):St(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Nt=t.e(907).then(t.bind(t,99907)),It=t.g.window?t(24878).f$:null,Dt=t.g.window?t(24878).s6:null;function Lt(){var e=(0,m.useState)(!1),n=e[0],t=e[1];return(0,m.useEffect)((function(){t(!0)}),[]),n?(0,xe.jsxs)(xe.Fragment,{children:[(0,xe.jsx)(b.default,{children:(0,xe.jsx)("title",{children:"ORUI"})}),(0,xe.jsx)(zt,{})]}):null}function zt(){var e=bn("3d",!1),n=(0,l.Z)(e,2),t=n[0],r=n[1],s=bn("tagCols",{}),c=(0,l.Z)(s,2),a=c[0],x=c[1],v=(0,m.useState)({nodeIds:[]}),b=v[0],O=v[1],S=bn("physics",R),P=(0,l.Z)(S,2),N=P[0],I=P[1],D=bn("filter",T),L=(0,l.Z)(D,2),z=L[0],E=L[1],Z=bn("visuals",B),M=(0,l.Z)(Z,2),W=M[0],A=M[1],V=(0,m.useState)(null),X=V[0],_=V[1],U=(0,m.useState)(null),q=U[0],G=U[1],J=bn("behavior",F),Q=(0,l.Z)(J,2),K=Q[0],Y=Q[1],$=bn("mouse",H),ee=(0,l.Z)($,2),ne=ee[0],te=ee[1],re=(0,k.Z)({}),ie=(0,l.Z)(re,2),oe=ie[0],le=ie[1],se=le.set,ce=le.reset,ae=le.undo,ue=le.redo,de=le.canUndo,he=le.canRedo,ge=(oe.past,oe.present),fe=(oe.future,(0,m.useState)(null)),pe=fe[0],je=fe[1],ve=(0,u.q)(),be=ve.isOpen,me=ve.onOpen,ye=ve.onClose,Ce=(0,m.useRef)({}),we=(0,m.useRef)({}),Oe=(0,m.useRef)({}),ke=(0,m.useRef)([]),Se=(0,m.useRef)(null),Ne=(0,m.useRef)({}),Ie=(0,m.useRef)({nodes:[],links:[]});(0,m.useEffect)((function(){X&&(Ie.current=X)}),[X]);var De=(0,m.useContext)(en.N).setEmacsTheme,Le=(0,m.useRef)({nodeIds:[]}),ze=(0,m.useRef)(F);ze.current=K;var Ee=(0,m.useRef)(null);Le.current=b;var Ze=function(e,n){var t,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2e3,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:200;if("color"!==e){var l=Se.current,s=Le.current,c=ze.current,a=null!==(t=we.current[n])&&void 0!==t?t:[],u=Object.fromEntries([n].concat((0,i.Z)(a.flatMap((function(e){return[e.source,e.target]})))).map((function(e){return[e,{}]})));if("zoom"===e)return s.nodeIds.length&&O({nodeIds:[]}),void setTimeout((function(){return l.zoomToFit(r,o,(function(e){return u[e.id]}))}),50);if(!s.nodeIds.length)return O({nodeIds:[n]}),void setTimeout((function(){l.centerAt(0,0,10),l.zoomToFit(1,o)}),50);if("add"!==c.localSame)return O({nodeIds:[n]}),void setTimeout((function(){l.centerAt(0,0,10),l.zoomToFit(1,o)}),50);if(!s.nodeIds.includes(n)||!s.nodeIds.some((function(e){return u[e]})))return O({nodeIds:[n]}),void setTimeout((function(){l.centerAt(0,0,10),l.zoomToFit(1,o)}),50);O((function(e){return Pt(Pt({},e),{},{nodeIds:[].concat((0,i.Z)(e.nodeIds),[n])})})),setTimeout((function(){l.centerAt(0,0,10),l.zoomToFit(1,o)}),50)}};(0,m.useEffect)((function(){Ee.current=new w.Z("ws://localhost:35903"),Ee.current.addEventListener("open",(function(){console.log("Connection with Emacs established")})),Ee.current.addEventListener("message",(function(e){var n=ze.current,t=JSON.parse(e.data);switch(t.type){case"graphdata":return function(e){var n,t,r,s=Ce.current;ke.current=null!==(n=e.tags)&&void 0!==n?n:[];var c=null!==(t=e.nodes)&&void 0!==t?t:[],a=null!==(r=e.links)&&void 0!==r?r:[],u=c.reduce((function(e,n){var t;return Pt(Pt({},e),{},(0,o.Z)({},n.file,[].concat((0,i.Z)(null!==(t=e[n.file])&&void 0!==t?t:[]),[n])))}),{}),d=Object.keys(u).flatMap((function(e){var n,t=null!==(n=u[e])&&void 0!==n?n:[],r=t.find((function(e){return 0===e.level})),i=t.filter((function(e){return 0!==e.level}));return r?i.map((function(e){var n=t.filter((function(n){var t;return!(n.level>=e.level||n.pos>=e.pos||null===(t=e.olp)||void 0===t||!t.includes(n.title))})).reduce((function(e,n){return n.level>e.level&&(e=n),e}),r);return{source:e.id,target:(null===n||void 0===n?void 0:n.id)||r.id,type:"heading"}})):[]})),h=Object.keys(u).flatMap((function(e){var n,t=null!==(n=u[e])&&void 0!==n?n:[],r=t.find((function(e){return 0===e.level})),i=t.filter((function(e){return 0!==e.level}));return r?i.map((function(e){return{source:e.id,target:r.id,type:"parent"}})):[]}));Ce.current=Object.fromEntries(c.map((function(e){return[e.id,e]})));var g=[].concat((0,i.Z)(a),(0,i.Z)(d),(0,i.Z)(h)),f=[],p=g.map((function(e){var n=e.source,t=e.target;return Ce.current[n]?Ce.current[t]?e:(f.push({id:t,tags:["bad"],properties:{FILELESS:"yes",bad:"yes"},file:"",title:t,level:0,pos:0,olp:null}),Pt(Pt({},e),{},{type:"bad"})):(f.push({id:n,tags:["bad"],properties:{FILELESS:"yes",bad:"yes"},file:"",title:n,level:0,pos:0,olp:null}),Pt(Pt({},e),{},{type:"bad"}))}));Ce.current=Pt(Pt({},Ce.current),Object.fromEntries(f.map((function(e){return[e.id,e]})))),we.current=p.reduce((function(e,n){var t,r,l;return Pt(Pt({},e),{},(l={},(0,o.Z)(l,n.source,[].concat((0,i.Z)(null!==(t=e[n.source])&&void 0!==t?t:[]),[n])),(0,o.Z)(l,n.target,[].concat((0,i.Z)(null!==(r=e[n.target])&&void 0!==r?r:[]),[n])),l))}),{});var x=[].concat((0,i.Z)(c),f);Oe.current=x.reduce((function(e,n){var t,r=null===(t=n.properties)||void 0===t?void 0:t.ROAM_REFS;if(null===r||void 0===r||!r.includes("cite"))return e;var i=r.replaceAll(/cite:(.*)/g,"$1");return i?Pt(Pt({},e),{},(0,o.Z)({},i,n)):e}),{});var j={nodes:x,links:p},v=Ie.current;if(0===v.nodes.length){var b=JSON.parse(JSON.stringify(j));return Ie.current=b,void _(b)}var m=[].concat((0,i.Z)(v.nodes.flatMap((function(e){var n,t=null!==(n=Ce.current[null===e||void 0===e?void 0:e.id])&&void 0!==n&&n;return t?[Pt(Pt({},e),t)]:[]}))),(0,i.Z)(Object.keys(Ce.current).filter((function(e){return!s[e]})).map((function(e){return Ce.current[e]})))),y=m.reduce((function(e,n,t){var r=null===n||void 0===n?void 0:n.id;return Pt(Pt({},e),{},(0,o.Z)({},r,t))}),{}),C=p.map((function(e){var n=Rt(e),t=(0,l.Z)(n,2),r=t[0],i=t[1];return Pt(Pt({},e),{},{source:m[y[r]],target:m[y[i]]})}));_({nodes:m,links:C})}(t.data);case"variables":return void(Ne.current=t.data);case"theme":return De(["custom",t.data]);case"command":switch(t.data.commandName){case"local":var r=K.zoomSpeed,s=K.zoomPadding;Ze("local",t.data.id,r,s),G(t.data.id);break;case"zoom":var c,a,u=(null===t||void 0===t||null===(c=t.data)||void 0===c?void 0:c.speed)||n.zoomSpeed,d=(null===t||void 0===t||null===(a=t.data)||void 0===a?void 0:a.padding)||n.zoomPadding;Ze("zoom",t.data.id,u,d),G(t.data.id);break;case"follow":Ze(n.follow,t.data.id,n.zoomSpeed,n.zoomPadding),G(t.data.id);break;default:return console.error("unknown message type",t.type)}}}))}),[]),(0,m.useEffect)((function(){var e=Se.current;!e||b.nodeIds.length>1||(b.nodeIds.length||!N.gravityOn?setTimeout((function(){e.zoomToFit(5,200)}),50):e.zoomToFit())}),[b.nodeIds]);var Re=(0,j.iP)(),Te=(0,l.Z)(Re,2),Be=Te[0],Fe=Te[1],He=(0,m.useRef)(),Me=(0,m.useState)(null),We=Me[0],Ae=Me[1],Ve=(0,m.useState)({left:0,top:0,right:void 0,bottom:void 0}),Xe=Ve[0],_e=Ve[1],Ue=(0,u.q)();(0,d.O)({ref:He,handler:function(){console.log("click"),Ue.onClose()}});var qe=function(e,n,t){_e(t||{left:n.pageX,top:n.pageY,right:void 0,bottom:void 0}),Ae(e),Ue.onOpen()},Ge=function(e,n){"replace"!==n?b.nodeIds.includes(e.id)||O((function(n){return Pt(Pt({},n),{},{nodeIds:[].concat((0,i.Z)(n.nodeIds),[e.id])})})):O({nodeIds:[e.id]})},Je=(0,m.useState)({type:"Graph",title:"Graph",icon:(0,xe.jsx)(y.DvO,{})}),Qe=(Je[0],Je[1],bn("mainWindowWidth",Be)),Ke=(0,l.Z)(Qe,2),Ye=Ke[0],$e=Ke[1];return X?(0,xe.jsxs)(h.xu,{display:"flex",alignItems:"flex-start",flexDirection:"row",height:"100vh",overflow:"clip",children:[(0,xe.jsx)(kt,{physics:N,setPhysics:I,threeDim:t,setThreeDim:r,filter:z,setFilter:E,visuals:W,setVisuals:A,mouse:ne,setMouse:te,behavior:K,setBehavior:Y,tagColors:a,setTagColors:x,tags:ke.current}),(0,xe.jsx)(h.xu,{position:"absolute",children:(0,xe.jsx)(Et,{nodeById:Ce.current,linksByNodeId:we.current,webSocket:Ee.current,variables:Ne.current,physics:N,graphData:X,threeDim:t,emacsNodeId:q,filter:z,visuals:W,behavior:K,mouse:ne,scope:b,setScope:O,tagColors:a,setPreviewNode:se,sidebarHighlightedNode:pe,windowWidth:Be,windowHeight:Fe,openContextMenu:qe,contextMenu:Ue,handleLocal:Ge,mainWindowWidth:Ye,setMainWindowWidth:$e,setContextMenuTarget:Ae,graphRef:Se})}),(0,xe.jsx)(h.xu,{position:"relative",zIndex:4,width:"100%",children:(0,xe.jsx)(g.k,{className:"headerBar",h:10,flexDir:"column",children:(0,xe.jsx)(g.k,{alignItems:"center",h:10,justifyContent:"flex-end",children:(0,xe.jsxs)(g.k,{height:"100%",flexDirection:"row",children:[b.nodeIds.length>0&&(0,xe.jsx)(f.u,{label:"Return to main graph",children:(0,xe.jsx)(p.h,{m:1,icon:(0,xe.jsx)(y.DvO,{}),"aria-label":"Exit local mode",onClick:function(){return O((function(e){return Pt(Pt({},e),{},{nodeIds:[]})}))},variant:"subtle"})}),(0,xe.jsx)(f.u,{label:be?"Close sidebar":"Open sidebar",children:(0,xe.jsx)(p.h,{m:1,icon:(0,xe.jsx)(C.iBV,{}),"aria-label":"Close file-viewer",variant:"subtle",onClick:be?ye:me})})]})})})}),(0,xe.jsx)(h.xu,{position:"relative",zIndex:4,children:(0,xe.jsx)(yn,{isOpen:be,onOpen:me,onClose:ye,previewNode:ge,setPreviewNode:se,canUndo:de,canRedo:he,previousPreviewNode:ae,nextPreviewNode:ue,resetPreviewNode:ce,setSidebarHighlightedNode:je,openContextMenu:qe,scope:b,setScope:O,windowWidth:Be,tagColors:a,setTagColors:x,filter:z,setFilter:E,nodeById:Ce.current,linksByNodeId:we.current,nodeByCite:Oe.current})}),Ue.isOpen&&(0,xe.jsx)("div",{ref:He,children:(0,xe.jsx)(Pe,{scope:b,target:We,background:!1,coordinates:Xe,handleLocal:Ge,menuClose:Ue.onClose.bind(Ue),webSocket:Ee.current,setPreviewNode:se,setFilter:E,filter:z,setTagColors:x,tagColors:a})})]}):null}var Et=function(e){var n=e.graphRef,t=e.physics,s=e.graphData,u=e.threeDim,d=e.linksByNodeId,g=e.filter,f=e.emacsNodeId,p=e.nodeById,j=e.visuals,b=e.behavior,y=e.mouse,C=e.scope,w=(e.setScope,e.webSocket),k=e.tagColors,S=e.setPreviewNode,N=e.sidebarHighlightedNode,I=e.windowWidth,D=e.windowHeight,L=(e.setContextMenuTarget,e.openContextMenu),z=e.contextMenu,E=e.handleLocal,R=e.variables,T=R.dailyDir,B=(R.roamDir,(0,m.useState)(null)),F=B[0],H=B[1],W=(0,a.useTheme)(),A=(0,m.useContext)(en.N).emacsTheme,V=function(e,n,t){switch(e){case y.preview:S(n);break;case y.local:E(n,b.localSame);break;case y.follow:ee(n,w);break;case y.context:L(n,t)}},X=(0,m.useRef)(null);(0,m.useEffect)((function(){f&&H(p[f])}),[f]);var _=(0,m.useRef)({}),U=(0,m.useRef)({}),q=(0,m.useMemo)((function(){var e;U.current={};var n=null===s||void 0===s||null===(e=s.nodes)||void 0===e?void 0:e.filter((function(e){var n,t,r,i=e;return g.tagsBlacklist.length&&g.tagsBlacklist.some((function(e){var n;return(null===i||void 0===i||null===(n=i.tags)||void 0===n?void 0:n.indexOf(e))>-1}))||g.tagsWhitelist.length>0&&!g.tagsWhitelist.some((function(e){var n;return(null===i||void 0===i||null===(n=i.tags)||void 0===n?void 0:n.indexOf(e))>-1}))||g.filelessCites&&null!==i&&void 0!==i&&null!==(n=i.properties)&&void 0!==n&&n.FILELESS||null!==g&&void 0!==g&&g.bad&&null!==i&&void 0!==i&&null!==(t=i.properties)&&void 0!==t&&t.bad?(U.current=Pt(Pt({},U.current),{},(0,o.Z)({},i.id,i)),!1):!(g.dailies&&T&&null!==(r=i.file)&&void 0!==r&&r.includes(T))||(U.current=Pt(Pt({},U.current),{},(0,o.Z)({},i.id,i)),!1)})).filter((function(e){var n,t=(null!==(n=d[null===e||void 0===e?void 0:e.id])&&void 0!==n?n:[]).filter((function(e){return!U.current[e.source]&&!U.current[e.target]}));return!g.orphans||(g.parent?0!==t.length:0!==t.length&&t.some((function(e){return!["parent","heading"].includes(e.type)})))})),t=n.map((function(e){return e.id})),r=s.links.filter((function(e){var n=Rt(e),r=(0,l.Z)(n,2),i=r[0],o=r[1];if(!t.includes(i)||!t.includes(o))return!1;var s=e;return g.parent?"heading"===g.parent?"parent"!==s.type:"heading"!==s.type:!["parent","heading"].includes(s.type)}));return _.current=r.reduce((function(e,n){var t,r,s,c=n,a=Rt(c),u=(0,l.Z)(a,2),d=u[0],h=u[1];return Pt(Pt({},e),{},(s={},(0,o.Z)(s,d,[].concat((0,i.Z)(null!==(t=e[d])&&void 0!==t?t:[]),[c])),(0,o.Z)(s,h,[].concat((0,i.Z)(null!==(r=e[h])&&void 0!==r?r:[]),[c])),s))}),{}),{nodes:n,links:r}}),[g,s]),G=(0,m.useState)({nodes:[],links:[]}),J=G[0],Q=G[1];(0,m.useEffect)((function(){if(C.nodeIds.length){var e=C.nodeIds.length>1?J.nodes:[],n=e.map((function(e){return e.id})),t=function(e,n){var t=[e[0]],r=[],i=[e[0]];return Array.from({length:n},(function(){t.forEach((function(e){var n;(null!==(n=_.current[e])&&void 0!==n?n:[]).forEach((function(e){var n=Rt(e),t=(0,l.Z)(n,2),o=t[0],s=t[1];i.includes(o)?i.includes(s)||r.push(s):r.push(o)}))})),t=r,r.forEach((function(e){return e&&i.push(e)})),r=[]})),i}(C.nodeIds,1),r=q.nodes.filter((function(r){var i;return e.length?!n.includes(r.id)&&(null!==(i=_.current[r.id])&&void 0!==i?i:[]).some((function(e){var n=Rt(e),t=(0,l.Z)(n,2),r=t[0],i=t[1];return C.nodeIds.includes(r)||C.nodeIds.includes(i)})):t.includes(r.id)})).map((function(e){return Pt(Pt({},e),{},{x:0,y:0,vy:0,vx:0})})),o=[].concat((0,i.Z)(e),(0,i.Z)(r)),s=o.map((function(e){return e.id})),c=C.nodeIds.length>1?J.links:[],a=q.links.filter((function(e){var t=Rt(e),r=(0,l.Z)(t,2),i=r[0],o=r[1];return!(c.length&&n.includes(o)&&n.includes(i))&&(s.includes(i)&&s.includes(o))})).map((function(e){var n=Rt(e),t=(0,l.Z)(n,2);return{source:t[0],target:t[1]}})),u=[].concat((0,i.Z)(c),(0,i.Z)(a));Q({nodes:o,links:u})}}),[g,C,JSON.stringify(s),q.links,q.nodes]),(0,m.useEffect)((function(){(0,r.Z)(c().mark((function e(){var r,i;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.current,e.next=3,Nt;case 3:i=e.sent,!t.gravityOn||C.nodeIds.length&&!t.gravityLocal?(r.d3Force("x",null),r.d3Force("y",null),u&&r.d3Force("z",null)):(r.d3Force("x",i.forceX().strength(t.gravity)),r.d3Force("y",i.forceY().strength(t.gravity)),u&&r.d3Force("z",i.forceZ().strength(t.gravity))),t.centering?r.d3Force("center",i.forceCenter().strength(t.centeringStrength)):r.d3Force("center",null),t.linkStrength&&r.d3Force("link").strength(t.linkStrength),t.linkIts&&r.d3Force("link").iterations(t.linkIts),t.charge&&r.d3Force("charge").strength(t.charge),r.d3Force("collide",t.collision?i.forceCollide().radius(t.collisionStrength):null);case 10:case"end":return e.stop()}}),e)})))()}),[t,u,C]),(0,m.useEffect)((function(){var e;null===(e=n.current)||void 0===e||e.d3ReheatSimulation()}),[t,C.nodeIds.length]);var K=(0,m.useRef)(0),Y=(0,m.useState)(1),$=Y[0],ne=Y[1],te=(0,x._7)((function(e){return ne(e)}),{duration:j.animationSpeed,algorithm:Z[j.algorithmName]}),re=(0,l.Z)(te,2),ie=re[0],oe=re[1],le=(0,x._7)((function(e){return ne(Math.min($,-1*(e-1)))}),{duration:j.animationSpeed,algorithm:Z[j.algorithmName]}),se=(0,l.Z)(le,2),ce=se[0],ae=se[1],ue=(0,m.useMemo)((function(){var e;if(!X.current)return{};var n=_.current[X.current.id];return n?Object.fromEntries([null===(e=X.current)||void 0===e?void 0:e.id].concat((0,i.Z)(n.flatMap((function(e){return[e.source,e.target]})))).map((function(e){return[e,{}]}))):{}}),[JSON.stringify(X.current),JSON.stringify(_.current)]);(0,m.useEffect)((function(){null!==N&&void 0!==N&&N.id?H(N):H(null)}),[N]);var de=(0,m.useRef)(null);(0,m.useEffect)((function(){if(X.current=F,F&&(de.current=F),!j.highlightAnim)return ne(F?1:0);F?ie():(oe(),$>.5?ce():ne(0))}),[F]);var he=(0,m.useMemo)((function(){return Object.fromEntries(M.map((function(e){var n=Tt(e,W),t=M.map((function(e){return[e,v.Z(n,Tt(e,W))]}));return[e,Object.fromEntries(t)]})))}),[A]),ge=(0,m.useMemo)((function(){var e,n,t,r=null!==(e=_.current[null===(n=de.current)||void 0===n?void 0:n.id])&&void 0!==e?e:[];return Object.fromEntries([null===(t=de.current)||void 0===t?void 0:t.id].concat((0,i.Z)(r.flatMap((function(e){return Rt(e)})))).map((function(e){return[e,{}]})))}),[JSON.stringify(F),de.current,_.current]),fe=function(e){var n,t,r,i,o,l=null!==(n=null===(t=_.current[e])||void 0===t?void 0:t.length)&&void 0!==n?n:0;return j.nodeColorScheme[(r=l,i=0,o=j.nodeColorScheme.length-1,Math.min(Math.max(r,i),o))]},pe=function(e,n){return _.current[e].length>_.current[n].length?fe(e):fe(n)},je=(0,m.useMemo)((function(){return Tt(j.labelTextColor,W)}),[j.labelTextColor,A]),ve=(0,m.useMemo)((function(){return Tt(j.labelBackgroundColor,W)}),[j.labelBackgroundColor,A]),be=function(e){var n,t=null!==(n=_.current[e.id])&&void 0!==n?n:[],r=t.length?t.filter((function(e){return"parent"===e.type})).length:0,i=3+t.length*j.nodeSizeLinks-(g.parent?0:r);return 1===j.highlightNodeSize?i:i*(ue[e.id]||ge[e.id]?1+$*(j.highlightNodeSize-1):1)},me=(0,m.useState)(!1),ye=me[0],Ce=me[1],we=(0,m.useRef)(1),Oe={graphData:C.nodeIds.length?J:q,width:I,height:D,backgroundColor:Tt(j.backgroundColor,W),warmupTicks:1===C.nodeIds.length?100:C.nodeIds.length>1?20:0,onZoom:function(e){var n=e.k;e.x,e.y;return we.current=n},nodeColor:function(e){return function(e,n){var t,r,i=ue[e.id]||ge[e.id];if(j.emacsNodeColor&&e.id===f)return Tt(j.emacsNodeColor,n);if(k&&null!==e&&void 0!==e&&e.tags.some((function(e){return k[e]}))){var o=k[null===e||void 0===e?void 0:e.tags.filter((function(e){return k[e]}))[0]];return i?he[o][o](j.highlightFade*$):he[o][j.backgroundColor](j.highlightFade*$)}return j.citeNodeColor&&null!==e&&void 0!==e&&null!==(t=e.properties)&&void 0!==t&&t.ROAM_REFS&&null!==e&&void 0!==e&&null!==(r=e.properties)&&void 0!==r&&r.FILELESS?i?Tt(j.citeNodeColor,n):he[j.citeNodeColor][j.backgroundColor](j.highlightFade*$):j.refNodeColor&&e.properties.ROAM_REFS?i?Tt(j.refNodeColor,n):he[j.refNodeColor][j.backgroundColor](j.highlightFade*$):i?j.nodeHighlight?he[fe(e.id)][j.nodeHighlight]($):Tt(fe(e.id),n):he[fe(e.id)][j.backgroundColor](j.highlightFade*$)}(e,W)},nodeRelSize:j.nodeRel,nodeVal:function(e){return be(e)/Math.pow(we.current,j.nodeZoomSize)},nodeCanvasObject:function(e,n,t){if(e&&!ye&&j.labels){var r=ge[e.id];if(!(t<=j.labelScale||1===j.labels)||ue[e.id]||r){var o=e.title,l=o.substring(0,j.labelLength),s=j.labelFontSize/(.75*Math.min(Math.max(.5,t),3)),c=[1.1*n.measureText(l).width,s].map((function(e){return e+.5*s})),a=Math.min(3*(t-j.labelScale)/j.labelScale,1),u=function(){return 1===j.labels||t<=j.labelScale?$:ue[e.id]||ge[e.id]?Math.max(a,$):1*a*(-1*(j.highlightFade*$-1))},d=8*Math.cbrt(be(e)*j.nodeRel);if(j.labelBackgroundColor&&j.labelBackgroundOpacity){var h=u()*j.labelBackgroundOpacity,g=Bt(ve,h);n.fillStyle=g,n.fillRect.apply(n,[e.x-c[0]/2,e.y-c[1]/2+d].concat((0,i.Z)(c)))}var f=u();n.textAlign="center",n.textBaseline="middle";var p=Bt(je,f);n.fillStyle=p,n.font="".concat(s,"px Sans-Serif");var x=P()(l,{width:j.labelWordWrap}).split("\n");(o.length>j.labelLength?[].concat((0,i.Z)(x.slice(0,-1)),["".concat(x.slice(-1),"...")]):x).forEach((function(t,r){n.fillText(t,e.x,e.y+d+j.labelLineSpace*s*r)}))}}},nodeCanvasObjectMode:function(){return"after"},linkDirectionalParticles:j.particles?j.particlesNumber:void 0,linkDirectionalArrowLength:j.arrows?j.arrowsLength:void 0,linkDirectionalArrowRelPos:j.arrowsPos,linkDirectionalArrowColor:j.arrowsColor?function(){return Tt(j.arrowsColor,W)}:void 0,linkColor:function(e){var n,t="object"===typeof e.source?e.source.id:e.source,r="object"===typeof e.target?e.target.id:e.target,i=Zt(e,X.current),o=Zt(e,de.current),l=i||o,s=e;return j.refLinkColor&&"ref"===s.type?l&&(j.refLinkHighlightColor||j.linkHighlight)?he[j.refLinkColor][j.refLinkHighlightColor||j.linkHighlight]($):he[j.refLinkColor][j.backgroundColor](j.highlightFade*$):j.citeLinkColor&&null!==(n=s.type)&&void 0!==n&&n.includes("cite")?l&&(j.citeLinkHighlightColor||j.linkHighlight)?he[j.citeLinkColor][j.citeLinkHighlightColor||j.linkHighlight]($):he[j.citeLinkColor][j.backgroundColor](j.highlightFade*$):function(e,n,t,r){if(!j.linkHighlight&&!j.linkColorScheme&&!t)return Tt(pe(e,n),r);if(!t&&!j.linkColorScheme){var i=pe(e,n);return he[i][j.backgroundColor](j.highlightFade*$)}return t?j.linkHighlight||j.linkColorScheme?j.linkHighlight?j.linkColorScheme?he[j.linkColorScheme][j.linkHighlight]($):he[pe(e,n)][j.linkHighlight]($):Tt(j.linkColorScheme,r):Tt(pe(e,n),r):he[j.linkColorScheme][j.backgroundColor](j.highlightFade*$)}(t,r,l,W)},linkWidth:function(e){if(1===j.highlightLinkSize)return j.linkWidth;var n=Zt(e,X.current),t=Zt(e,de.current);return n||t?j.linkWidth*(1+$*(j.highlightLinkSize-1)):j.linkWidth},linkDirectionalParticleWidth:j.particlesWidth,d3AlphaDecay:t.alphaDecay,d3AlphaMin:t.alphaMin,d3VelocityDecay:t.velocityDecay,onNodeClick:function(e,n){var t=e,r=n.timeStamp-K.current<200;if(K.current=n.timeStamp,r)return V("double",t,n);var i=K.current;return setTimeout((function(){if(K.current===i)return V("click",t,n)}),200)},onNodeHover:function(e){j.highlight&&(F||(ae(),ne(0)),H(e))},onNodeRightClick:function(e,n){V("right",e,n)},onNodeDrag:function(e){H(e),Ce(!0)},onNodeDragEnd:function(){H(null),Ce(!1)}};return console.log("hey"),(0,xe.jsx)(h.xu,{overflow:"hidden",onClick:z.onClose,children:u?(0,xe.jsx)(Dt,Pt(Pt({ref:n},Oe),{},{nodeThreeObjectExtend:!0,nodeOpacity:j.nodeOpacity,nodeResolution:j.nodeResolution,linkOpacity:j.linkOpacity,nodeThreeObject:function(e){if(j.labels&&(!(j.labels<3)||ue[e.id])){var n=new O.Z(e.title.substring(0,40));return n.color=Tt(j.labelTextColor,W),n.backgroundColor=Tt(j.labelBackgroundColor,W),n.padding=2,n.textHeight=8,n}}})):(0,xe.jsx)(It,Pt(Pt({ref:n},Oe),{},{linkLineDash:function(e){var n,t=e;return j.citeDashes&&null!==(n=t.type)&&void 0!==n&&n.includes("cite")?[j.citeDashLength,j.citeGapLength]:j.refDashes&&"ref"==t.type?[j.refDashLength,j.refGapLength]:null}}))})};function Zt(e,n){var t,r;return(null===(t=e.source)||void 0===t?void 0:t.id)===(null===n||void 0===n?void 0:n.id)||(null===(r=e.target)||void 0===r?void 0:r.id)===(null===n||void 0===n?void 0:n.id)}function Rt(e){return["object"===typeof e.source?e.source.id:e.source,"object"===typeof e.target?e.target.id:e.target]}function Tt(e,n){return e.split(".").reduce((function(e,n){return e[n]}),n.colors)}function Bt(e,n){return"rgba("+(e=e.replace("#","")).match(new RegExp("(.{"+e.length/3+"})","g")).map((function(n){return parseInt(e.length%2?n+n:n,16)})).concat(isFinite(n)?n:1).join(",")+")"}},45301:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/",function(){return t(64685)}])}},function(e){e.O(0,[774,737,13,874,573,446,667,888,179],(function(){return n=45301,e(e.s=n);var n}));var n=e.O();_N_E=n}]);