summaryrefslogtreecommitdiff
path: root/out/_next/static/chunks/pages/index-ae5392593603a38d540f.js
blob: 0701528b4ccc7d09748e5f0ea52982f287f220aa (about) (plain)
1
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[405],{70843:function(e,n,t){"use strict";t.r(n),t.d(n,{Graph:function(){return et},GraphPage:function(){return $n},default:function(){return Yn},getThemeColor:function(){return rt},hexToRGBA:function(){return it},normalizeLinkEnds:function(){return tt}});var r=t(87757),i=t.n(r),o=t(92137),l=t(87329),s=t(96156),c=t(34699),a=t(85893),u=t(67294),d=t(9008);function h(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 g(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?h(Object(t),!0).forEach((function(n){(0,s.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):h(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function f(e,n){var t,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=p(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)?g(g({},n),o):l;s!==o&&i.update(s);var c=(0,u.useState)(s),a=c[0],d=c[1];(0,u.useEffect)((function(){a!==s&&d(s)}),[e]);var h=function(e){e instanceof Function?d((function(n){var t=e(n);return i.update(t),t})):(d(e),i.update(e))};return[a,h]}function p(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 x=t(54533),j=t(81253),b=t(94096),v=t(48420),y=t(47516),m=t(35255),C=t(56884),O=function(e){var n=e.setJustification,t=e.setIndent,r=e.setFont,i=e.justification;return(0,a.jsxs)(b.k,{py:3,alignItems:"center",justifyContent:"space-between",pr:4,children:[(0,a.jsxs)(b.k,{children:[(0,a.jsx)(v.h,{variant:"ghost",icon:(0,a.jsx)(m.w,{}),"aria-label":"Previous node"}),(0,a.jsx)(v.h,{variant:"ghost",icon:(0,a.jsx)(C.X,{}),"aria-label":"Previous node"})]}),(0,a.jsxs)(b.k,{children:[(0,a.jsx)(v.h,{variant:"ghost","aria-label":"Justify content",icon:[(0,a.jsx)(y.v9V,{},"justify"),(0,a.jsx)(y.YSr,{},"left"),(0,a.jsx)(y.RXA,{},"right"),(0,a.jsx)(y.tr_,{},"center")][i],onClick:function(){return n((function(e){return(e+1)%4}))}}),(0,a.jsx)(v.h,{variant:"ghost","aria-label":"Indent Text",icon:(0,a.jsx)(y.WHD,{}),onClick:function(){t((function(e){return e?0:1}))}}),(0,a.jsx)(v.h,{variant:"ghost","aria-label":"Change font",icon:(0,a.jsx)(y.TlM,{}),onClick:function(){r((function(e){return"sans serif"===e?"serif":"sans serif"}))}})]})]})},w=t(48017),k=t(18835),S=t.n(k),P=t(13816),N=t.n(P),I=t(42728),L=t.n(I),D=t(77890),z=t.n(D),E=t(94986),Z=t.n(E),T=t(88541),B=t.n(T),R=t(71167),F=t.n(R),H=(t(74477),t(27431)),A=t.n(H),V=t(40980),W=t(64115),M=t(45170),X=t(67273),_=t(29356),q={".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":{fontFamily:"monospace",color:"red"},".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"},".code-highlighted":{backgroundColor:"#ffff00"},".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":{fontFamily:"monospace",color:"green"},".priority":{fontFamily:"monospace",color:"orange"},".tag":{backgroundColor:"#eee",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:{border:"1px solid #e6e6e6",borderRadius:"3px",backgroundColor:"#f2f2f2",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",color:"#555",backgroundColor:"#f2f2f299"},"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"}},U=q;function Q(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 G(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Q(Object(t),!0).forEach((function(n){(0,s.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Q(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var J=function(e){var n=e.setSidebarHighlightedNode,t=e.setPreviewNode,r=e.nodeById,i=e.href,o=e.children,s=(0,u.useContext)(_.N).highlightColor,d=rt(s,(0,V.useTheme)()),h=(0,c.Z)((0,l.Z)(i.matchAll(/(.*?)\:(.*)/g))[0],3),g=(h[0],h[1],h[2]);return(0,a.jsx)(W.x,{onMouseEnter:function(){return n(r[g])},onMouseLeave:function(){return n({})},tabIndex:0,display:"inline",overflow:"hidden",fontWeight:500,color:s,textDecoration:"underline",onClick:function(){return t(r[g])},_hover:{textDecoration:"none",cursor:"pointer",bgColor:d+"22"},_focus:{outlineColor:s},children:o})},K=function(e){var n,t,r,i,o,s=e.href,d=e.children,h=e.nodeById,g=e.setSidebarHighlightedNode,f=(e.previewNode,e.setPreviewNode),p=e.nodeByCite,x=(0,u.useState)(),j=x[0],b=x[1],v=(0,c.Z)((0,l.Z)(s.matchAll(/(.*?)\:(.*)/g))[0],3),y=(v[0],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""}(v[1],v[2])),m=S()().use(N()).use(L()).use(F()).use(A(),{createElement:u.createElement,components:{a:function(e){var n=e.children,t=e.href;return(0,a.jsx)(J,G({setSidebarHighlightedNode:g,nodeById:h,nodeByCite:p,setPreviewNode:f},{children:n,href:t}))}}}),C=encodeURIComponent(null===(n=h[y])||void 0===n?void 0:n.file);return(0,u.useMemo)((function(){!function(){var e;console.log(null===(e=h[y])||void 0===e?void 0:e.title),fetch("api/notes/".concat(C)).then((function(e){return e.text()})).then((function(e){if("error"===e);else{var n=m.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."}))}()}),[y]),y?(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)(M.J2,{gutter:12,trigger:"hover",placement:"top-start",children:[(0,a.jsx)(M.xo,{children:(0,a.jsx)(w.xu,{display:"inline",children:(0,a.jsx)(J,G({},{setSidebarHighlightedNode:g,setPreviewNode:f,nodeById:h,href:s,children:d,nodeByCite:p}),null!==(t=null===(r=h[y])||void 0===r?void 0:r.title)&&void 0!==t?t:y)})}),(0,a.jsx)(X.h,{children:(0,a.jsxs)(M.yk,{boxShadow:"xl",position:"relative",zIndex:"tooltip",onMouseEnter:function(){var e;return g(null!==(e=h[y])&&void 0!==e?e:{})},onMouseLeave:function(){return g({})},children:[(0,a.jsx)(M.QH,{}),(0,a.jsx)(M.b,{pb:5,fontSize:"xs",px:5,position:"relative",zIndex:"tooltip",maxHeight:300,overflow:"scroll",children:(0,a.jsx)(w.xu,{sx:U,children:j})})]},null!==(i=null===(o=h[y])||void 0===o?void 0:o.title)&&void 0!==i?i:y)})]})}):(0,a.jsx)(W.x,{display:"inline",color:"base.700",cursor:"not-allowed",children:d})},Y=function(e){var n=e.nodeById,t=e.setSidebarHighlightedNode,r=e.setPreviewNode,i=e.previewText,o=e.nodeByCite,l=S()().use(N()).use(Z()).use(B()).use(z()).use(L()).use(F()).use(A(),{createElement:u.createElement,components:{a:function(e){var i=e.children,l=e.href;return(0,a.jsx)(K,{nodeByCite:o,setSidebarHighlightedNode:t,href:"".concat(l),nodeById:n,setPreviewNode:r,children:"string"===typeof i?i:null})}}}),s=(0,u.useMemo)((function(){return l.processSync(i).result}),[i]);return(0,a.jsx)(a.Fragment,{children:s})};function $(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 ee(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?$(Object(t),!0).forEach((function(n){(0,s.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):$(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var ne=function(e){var n=e.setSidebarHighlightedNode,t=e.nodeById,r=e.nodeByCite,i=e.previewNode,o=e.setPreviewNode,l=(0,u.useState)(""),s=l[0],c=l[1],d=encodeURIComponent(i.file);return(0,u.useEffect)((function(){fetch("api/notes/".concat(d)).then((function(e){return e.text()})).then((function(e){"error"!==e&&c(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."}))}),[i.id]),(0,u.useEffect)((function(){return console.log("mount"),function(){return console.log("unmount")}}),[]),(0,a.jsx)(a.Fragment,{children:(null===i||void 0===i?void 0:i.id)&&(0,a.jsx)(Y,ee({},{nodeById:t,previewNode:i,setPreviewNode:o,previewText:s,nodeByCite:r,setSidebarHighlightedNode:n}))})},te=t(336),re=t(72026),ie=function(e){var n,t=e.previewNode,r=e.setPreviewNode,i=e.setSidebarHighlightedNode,o=e.nodeById,l=e.linksByNodeId,s=e.nodeByCite,u=(null!==(n=l[null===t||void 0===t?void 0:t.id])&&void 0!==n?n:[]).filter((function(e){var n=tt(e),r=(0,c.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,a.jsxs)(w.xu,{children:[(0,a.jsx)(te.X,{pt:4,children:"Backlinks (".concat(u.length,")")}),(0,a.jsx)(re.gC,{pt:2,spacing:3,alignItems:"start",divider:(0,a.jsx)(re.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,a.jsx)(w.xu,{overflow:"hidden",p:3,bg:"gray.300",width:"100%",children:(0,a.jsx)(K,{nodeByCite:s,setSidebarHighlightedNode:i,href:"id:".concat(e),nodeById:o,setPreviewNode:r,children:null===(l=o[e])||void 0===l?void 0:l.title})},e)}))})]})};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 le(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,s.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}var se=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;return(0,a.jsx)(w.xu,{pr:8,overflow:"scroll",height:"85%",className:"org",sx:le(le({},q),{},{textAlign:t[r]}),children:(null===i||void 0===i?void 0:i.id)&&(0,a.jsxs)(b.k,{height:"100%",flexDirection:"column",justifyContent:"space-between",children:[(0,a.jsx)(ne,le({},{setPreviewNode:n,previewNode:i,nodeById:o,nodeByCite:l,setSidebarHighlightedNode:s})),(0,a.jsx)(ie,le({},{setPreviewNode:n,previewNode:i,nodeById:o,linksByNodeId:c,nodeByCite:l,setSidebarHighlightedNode:s}))]})})},ce=t(25715),ae=t(86658),ue=t(61475);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,s.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=function(e){var n=e.isOpen,t=e.onOpen,r=e.onClose,i=e.previewNode,o=e.setPreviewNode,l=e.nodeById,s=e.linksByNodeId,c=e.nodeByCite,d=e.setSidebarHighlightedNode,h=(0,u.useContext)(_.N).highlightColor,g=(0,u.useState)(),f=g[0],p=g[1];(0,u.useEffect)((function(){null!==i&&void 0!==i&&i.id?(t(),p(i)):r()}),[null===i||void 0===i?void 0:i.id]);var x=(0,u.useState)(1),m=x[0],C=x[1],k=(0,u.useState)("sans serif"),S=(k[0],k[1]),P=(0,u.useState)(0),N=(P[0],P[1]);return(0,a.jsx)(ce.M,{direction:"right",in:n,style:{width:"clamp(400px, 30%, 500px)"},unmountOnExit:!0,children:(0,a.jsx)(b.k,{flexDirection:"row",height:"100%",children:(0,a.jsxs)(w.xu,{pl:2,color:"black",bg:"alt.100",w:"100%",paddingBottom:15,children:[(0,a.jsxs)(b.k,{justifyContent:"space-between",paddingTop:4,pl:4,pb:5,pr:3,alignItems:"top",color:"black",children:[(0,a.jsxs)(b.k,{alignItems:"center",whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",children:[(0,a.jsx)(y.UY3,{}),(0,a.jsx)(te.X,{pl:2,whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",lineHeight:1,size:"sm",fontWeight:600,color:"gray.800",children:null===f||void 0===f?void 0:f.title})]}),(0,a.jsx)(v.h,{icon:(0,a.jsx)(ue.U,{}),"aria-label":"Close file-viewer",variant:"link",onClick:r})]}),(0,a.jsx)(O,he({},{setJustification:C,setIndent:N,setFont:S,justification:m})),(0,a.jsx)(ae.$B,{autoHide:!0,renderThumbVertical:function(e){var n=e.style,t=(0,j.Z)(e,["style"]);return(0,a.jsx)(w.xu,he({style:he(he({},n),{},{borderRadius:10,backgroundColor:h}),color:"black"},t))},children:(0,a.jsx)(re.gC,{height:"100%",alignItems:"left",bg:"alt.100",paddingLeft:4,children:(0,a.jsx)(se,he({},{setPreviewNode:o,previewNode:i,nodeById:l,nodeByCite:c,setSidebarHighlightedNode:d,justification:m,justificationList:["justify","start","end","center"],linksByNodeId:s}))})})]})})})},fe=t(54309),pe=t(32351),xe=t(74860),je=t(36194),be=[],ve={};for(var ye in je.oY)for(var me in je.oY[ye]){var Ce=ye+me;"LinearNone"===Ce&&(Ce="Linear"),be.push(Ce),ve[Ce]=je.oY[ye][me]}var Oe=ve,we={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},ke={orphans:!1,parent:"heading",filelessCites:!1,tagsBlacklist:[],tagsWhitelist:[],bad:!0,nodes:[],links:[],date:[]},Se={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.5,labelFontSize:13,labelLength:40,labelWordWrap:25,labelLineSpace:1,highlight:!0,highlightNodeSize:2,highlightLinkSize:2,highlightFade:.8,highlightAnim:!0,animationSpeed:420,algorithmOptions:be,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:"gray.900",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},Pe={follow:"zoom",localSame:"add",zoomPadding:200,zoomSpeed:2e3},Ne={highlight:"hover",local:"double",follow:"never",context:"right",preview:"click"},Ie=["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"],Le=t(93924),De=t(83986),ze=t(48931),Ee=t(96699),Ze=t(40155),Te=t(56769),Be=t(6569),Re=t(67897),Fe=t(88134),He=t(47647);function Ae(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 Ve(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Ae(Object(t),!0).forEach((function(n){(0,s.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ae(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var We=function(e){var n=e.filter,t=e.setFilter,r=e.tags,i=e.highlightColor,o=e.mode,l=r.map((function(e){return{value:e,label:e}})),c="blacklist"===o?"tagsBlacklist":"tagsWhitelist",d=(0,u.useState)(n[c].map((function(e){return{value:e,label:e}}))),h=d[0],g=d[1];return(0,a.jsx)(He.CUIAutoComplete,{items:l,label:"Add tag to "+o,placeholder:" ",onCreateItem:function(e){return null},disableCreateItem:!0,selectedItems:h,onSelectedItemsChange:function(e){e.selectedItems&&(g(e.selectedItems),t(Ve(Ve({},n),{},(0,s.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}})},Me=t(2827);function Xe(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 _e(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Xe(Object(t),!0).forEach((function(n){(0,s.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Xe(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var qe=function(e){var n=e.colorList,t=e.tagColors,r=e.setTagColors,i=e.highlightColor,o=e.tags.map((function(e){return{value:e,label:e}})),l=(0,u.useState)(Object.keys(t).map((function(e){return{value:e,label:e}}))),c=l[0],d=l[1];return(0,a.jsxs)(w.xu,{children:[(0,a.jsx)(He.CUIAutoComplete,{items:o,label:"Add tag to filter",placeholder:" ",disableCreateItem:!0,selectedItems:c,onSelectedItemsChange:function(e){e.selectedItems&&(d(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,a.jsx)(re.gC,{spacing:2,justifyContent:"flex-start",divider:(0,a.jsx)(re.cX,{borderColor:"gray.500"}),align:"stretch",color:"gray.800",children:Object.keys(t).map((function(e){return(0,a.jsxs)(b.k,{alignItems:"center",justifyContent:"space-between",width:"100%",pl:2,children:[(0,a.jsx)(w.xu,{width:"100%",children:(0,a.jsx)(W.x,{fontWeight:"bold",children:e})}),(0,a.jsxs)(Re.v2,{isLazy:!0,placement:"right",children:[(0,a.jsx)(Re.j2,{as:Ze.z,colorScheme:"",color:"black",children:(0,a.jsx)(w.xu,{bgColor:t[e],borderRadius:"sm",height:6,width:6})}),(0,a.jsxs)(X.h,{children:[" ",(0,a.jsx)(Re.qy,{minW:10,zIndex:"popover",bgColor:"gray.200",children:n.map((function(n){return(0,a.jsx)(Re.sN,{onClick:function(){return r(_e(_e({},t),{},(0,s.Z)({},e,n)))},justifyContent:"space-between",alignItems:"center",display:"flex",children:(0,a.jsx)(w.xu,{bgColor:n,borderRadius:"sm",height:6,width:6})},n)}))})]})]}),(0,a.jsx)(v.h,{"aria-label":"Delete tag color",variant:"ghost",icon:(0,a.jsx)(Me.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"]})))),d(c.filter((function(n){return n.value!==e})))}})]},e)}))})]})};function Ue(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 Qe(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Ue(Object(t),!0).forEach((function(n){(0,s.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ue(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Ge=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,a.jsxs)(w.xu,{children:[(0,a.jsxs)(re.gC,{spacing:2,justifyContent:"flex-start",divider:(0,a.jsx)(re.cX,{borderColor:"gray.500"}),align:"stretch",paddingLeft:7,color:"gray.800",children:[(0,a.jsxs)(b.k,{alignItems:"center",justifyContent:"space-between",children:[(0,a.jsx)(W.x,{children:"Link children to..."}),(0,a.jsxs)(Re.v2,{isLazy:!0,placement:"right",children:[(0,a.jsx)(Re.j2,{as:Ze.z,rightIcon:(0,a.jsx)(Be.v,{}),colorScheme:"",color:"black",children:function(){switch(n.parent){case"parent":return(0,a.jsx)(W.x,{children:"File"});case"heading":return(0,a.jsx)(W.x,{children:"Heading"});default:return(0,a.jsx)(W.x,{children:"Nothing"})}}()}),(0,a.jsxs)(X.h,{children:[" ",(0,a.jsxs)(Re.qy,{bgColor:"gray.200",zIndex:"popover",children:[(0,a.jsx)(Re.sN,{onClick:function(){return t((function(e){return Qe(Qe({},e),{},{parent:""})}))},children:"Nothing"}),(0,a.jsx)(Re.sN,{onClick:function(){return t((function(e){return Qe(Qe({},e),{},{parent:"parent"})}))},children:"Parent file node"}),(0,a.jsx)(Re.sN,{onClick:function(){return t((function(e){return Qe(Qe({},e),{},{parent:"heading"})}))},children:"Next highest heading node"})]})]})]})]}),(0,a.jsxs)(b.k,{justifyContent:"space-between",children:[(0,a.jsx)(W.x,{children:"Orphans"}),(0,a.jsx)(Fe.r,{onChange:function(){t((function(e){return Qe(Qe({},e),{},{orphans:!e.orphans})}))},isChecked:n.orphans})]}),(0,a.jsxs)(b.k,{justifyContent:"space-between",children:[(0,a.jsx)(W.x,{children:"Citations without note files"}),(0,a.jsx)(Fe.r,{onChange:function(){t(Qe(Qe({},n),{},{filelessCites:!n.filelessCites}))},isChecked:n.filelessCites})]}),(0,a.jsxs)(b.k,{justifyContent:"space-between",children:[(0,a.jsx)(W.x,{children:"Non-existant nodes"}),(0,a.jsx)(Fe.r,{onChange:function(){i(Qe(Qe({},r),{},{bad:"white"})),t(Qe(Qe({},n),{},{bad:!n.bad}))},isChecked:n.bad})]})]}),(0,a.jsxs)(Te.UQ,{padding:0,allowToggle:!0,allowMultiple:!0,paddingLeft:3,children:[(0,a.jsxs)(Te.Qd,{children:[(0,a.jsxs)(Te.KF,{children:["Tag filters",(0,a.jsx)(Te.XE,{})]}),(0,a.jsxs)(Te.Hk,{pr:0,mr:0,children:[(0,a.jsx)(We,{highlightColor:o,filter:n,setFilter:t,tags:s,mode:"blacklist"}),(0,a.jsx)(We,{highlightColor:o,filter:n,setFilter:t,tags:s,mode:"whitelist"})]})]}),(0,a.jsxs)(Te.Qd,{children:[(0,a.jsxs)(Te.KF,{children:["Tag Colors",(0,a.jsx)(Te.XE,{})]}),(0,a.jsx)(Te.Hk,{pr:0,mr:0,children:(0,a.jsx)(qe,{tags:s,colorList:l,tagColors:r,setTagColors:i,highlightColor:o})})]})]})]})},Je=t(15267),Ke=t(24189),Ye=function(e){var n=e.infoText;return(0,a.jsx)(w.xu,{paddingLeft:"1",children:(0,a.jsx)(Ee.u,{label:n,placement:"top",color:"gray.100",bg:"gray.800",hasArrow:!0,children:(0,a.jsx)(Ke.h,{})})})},$e=function(e){var n=e.value,t=e.onChange,r=e.label,i=e.infoText,o=e.children;return(0,a.jsxs)(w.xu,{paddingTop:2,children:[(0,a.jsxs)(w.xu,{display:"flex",justifyContent:"space-between",paddingBottom:2,children:[(0,a.jsxs)(w.xu,{display:"flex",alignItems:"center",children:[(0,a.jsx)(W.x,{children:r}),i&&(0,a.jsx)(Ye,{infoText:i})]}),(0,a.jsx)(Fe.r,{isChecked:!!n,onChange:t})]}),(0,a.jsx)(Je.U,{in:!!n,animateOpacity:!0,children:(0,a.jsx)(w.xu,{paddingLeft:4,paddingTop:2,paddingBottom:2,children:o})})]},r)},en=t(24682),nn=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,d=(0,j.Z)(e,["min","max","step","value"]),h=d.onChange,g=d.label,f=d.infoText,p=(0,u.useContext)(_.N).highlightColor;return(0,a.jsxs)(w.xu,{children:[(0,a.jsxs)(w.xu,{display:"flex",alignItems:"flex-end",children:[(0,a.jsx)(W.x,{children:g}),f&&(0,a.jsx)(Ye,{infoText:f})]}),(0,a.jsxs)(en.iR,{value:c,onChange:h,min:t,max:i,step:l,children:[(0,a.jsx)(en.Uj,{children:(0,a.jsx)(en.Ms,{})}),(0,a.jsx)(Ee.u,{bg:p,label:c.toFixed(1),children:(0,a.jsx)(en.gs,{bg:"white"})})]})]},g)};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 rn(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,s.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 on=function(e){var n=e.physics,t=e.setPhysics,r=(0,u.useCallback)((function(e,n,r){t((function(t){return rn(rn({},t),{},(0,s.Z)({},n,e/r))}))}),[]);return(0,a.jsxs)(w.xu,{children:[(0,a.jsxs)(re.gC,{spacing:2,justifyContent:"flex-start",divider:(0,a.jsx)(re.cX,{borderColor:"gray.500"}),align:"stretch",paddingLeft:7,color:"gray.800",children:[(0,a.jsxs)($e,{label:"Gravity",value:n.gravityOn,onChange:function(){return t(rn(rn({},n),{},{gravityOn:!n.gravityOn}))},children:[(0,a.jsxs)(b.k,{justifyContent:"space-between",children:[(0,a.jsx)(W.x,{children:"Also in local"}),(0,a.jsx)(Fe.r,{onChange:function(){t((function(e){return rn(rn({},e),{},{gravityLocal:!e.gravityLocal})}))},isChecked:n.gravityLocal})]}),(0,a.jsx)(nn,{label:"Strength",value:10*n.gravity,onChange:function(e){return r(e,"gravity",10)}})]}),(0,a.jsx)(nn,{value:-n.charge/100,onChange:function(e){return r(e,"charge",-.01)},label:"Repulsive Force"}),(0,a.jsx)($e,{label:"Collision",infoText:"Perfomance sap, disable if slow",value:n.collision,onChange:function(){return t(rn(rn({},n),{},{collision:!n.collision}))},children:(0,a.jsx)(nn,{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,a.jsx)(nn,{value:5*n.linkStrength,onChange:function(e){return r(e,"linkStrength",5)},label:"Link Force"}),(0,a.jsx)(nn,{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,a.jsx)(nn,{label:"Viscosity",value:10*n.velocityDecay,onChange:function(e){return r(e,"velocityDecay",10)}})]}),(0,a.jsx)(w.xu,{children:(0,a.jsx)(Te.UQ,{paddingLeft:3,allowToggle:!0,children:(0,a.jsxs)(Te.Qd,{children:[(0,a.jsxs)(Te.KF,{children:[(0,a.jsx)(W.x,{children:"Advanced"}),(0,a.jsx)(Te.XE,{marginRight:2})]}),(0,a.jsx)(Te.Hk,{children:(0,a.jsxs)(re.gC,{spacing:2,justifyContent:"flex-start",divider:(0,a.jsx)(re.cX,{borderColor:"gray.500"}),align:"stretch",paddingLeft:3,color:"gray.800",children:[(0,a.jsx)(nn,{label:"Stabilization rate",value:50*n.alphaDecay,onChange:function(e){return r(e,"alphaDecay",50)}}),(0,a.jsx)($e,{label:"Center nodes",value:n.centering,onChange:function(){return t(rn(rn({},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,a.jsx)(nn,{label:"Centering Strength",value:n.centeringStrength,max:2,step:.01,onChange:function(e){return r(e,"centeringStrength",1)}})})]})})]})})})]})},ln=t(46049);function sn(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 cn(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?sn(Object(t),!0).forEach((function(n){(0,s.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):sn(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var an=function(e){var n=e.visuals,t=e.setVisuals;return(0,a.jsx)(re.gC,{spacing:2,justifyContent:"flex-start",divider:(0,a.jsx)(re.cX,{borderColor:"gray.500"}),align:"stretch",color:"gray.800",children:(0,a.jsx)(w.xu,{children:(0,a.jsx)($e,{label:"Highlight",onChange:function(){return t((function(e){return cn(cn({},e),{},{highlight:!e.highlight})}))},value:n.highlight,children:(0,a.jsxs)(re.gC,{spacing:1,justifyContent:"flex-start",divider:(0,a.jsx)(re.cX,{borderColor:"gray.400"}),align:"stretch",paddingLeft:0,children:[(0,a.jsx)(nn,{label:"Highlight Link Thickness",value:n.highlightLinkSize,onChange:function(e){return t((function(n){return cn(cn({},n),{},{highlightLinkSize:e})}))}}),(0,a.jsx)(nn,{label:"Highlight Node Size",value:n.highlightNodeSize,onChange:function(e){return t((function(n){return cn(cn({},n),{},{highlightNodeSize:e})}))}}),(0,a.jsx)(nn,{min:0,max:1,label:"Highlight Fade",value:n.highlightFade,onChange:function(e){return t((function(n){return cn(cn({},n),{},{highlightFade:e})}))}}),(0,a.jsxs)($e,{label:"Highlight Animation",onChange:function(){t((function(e){return cn(cn({},e),{},{highlightAnim:!e.highlightAnim})}))},value:n.highlightAnim,children:[(0,a.jsx)(nn,{label:"Animation speed",onChange:function(e){return t((function(n){return cn(cn({},n),{},{animationSpeed:e})}))},value:n.animationSpeed,infoText:"Slower speed has a chance of being buggy",min:50,max:1e3,step:10}),(0,a.jsx)(ln.Ph,{placeholder:n.algorithmName,onChange:function(e){t((function(n){return cn(cn({},n),{},{algorithmName:e.target.value})}))},children:n.algorithmOptions.map((function(e){return(0,a.jsx)("option",{value:e,children:e},e)}))})]})]})})})})},un=t(67546),dn=t(93441);function hn(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 gn(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?hn(Object(t),!0).forEach((function(n){(0,s.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):hn(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var fn=function(e){var n=e.label,t=e.colorList,r=e.value,i=e.visValue,o=e.setVisuals,l=(0,u.useCallback)((function(e){return o((function(n){return gn(gn({},n),{},(0,s.Z)({},r,e))}))}),[]);return(0,a.jsxs)(b.k,{alignItems:"center",justifyContent:"space-between",children:[(0,a.jsx)(W.x,{children:n}),(0,a.jsxs)(Re.v2,{isLazy:!0,placement:"right",children:[(0,a.jsx)(Re.j2,{as:Ze.z,colorScheme:"",color:"black",rightIcon:(0,a.jsx)(Be.v,{}),children:(0,a.jsx)(w.xu,{bgColor:i,borderRadius:"sm",height:6,width:6})}),(0,a.jsxs)(X.h,{children:[" ",(0,a.jsxs)(Re.qy,{minW:10,zIndex:"popover",bgColor:"gray.200",children:[(0,a.jsx)(Re.sN,{onClick:function(){return l("")},justifyContent:"space-between",alignItems:"center",display:"flex",children:(0,a.jsx)(w.xu,{height:6,width:6})}),t.map((function(e){return(0,a.jsx)(Re.sN,{onClick:function(){return l(e)},justifyContent:"space-between",alignItems:"center",display:"flex",children:(0,a.jsx)(w.xu,{bgColor:e,borderRadius:"sm",height:6,width:6})},e)}))]})]})]})]})};function pn(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 xn(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?pn(Object(t),!0).forEach((function(n){(0,s.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):pn(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var jn=function(e){var n=e.visuals,t=e.setVisualsCallback,r=e.highlightColor,i=e.setHighlightColor;return(0,a.jsx)(re.gC,{spacing:2,justifyContent:"flex-start",divider:(0,a.jsx)(re.cX,{borderColor:"gray.500"}),align:"stretch",color:"gray.800",children:(0,a.jsxs)(w.xu,{children:[(0,a.jsxs)(b.k,{alignItems:"center",justifyContent:"space-between",children:[(0,a.jsx)(W.x,{children:"Nodes"}),(0,a.jsx)(Ee.u,{label:"Shuffle node colors",children:(0,a.jsx)(v.h,{"aria-label":"Shuffle node colors",size:"sm",icon:(0,a.jsx)(un.n,{}),variant:"ghost",onClick:function(){var e,r=null!==(e=n.nodeColorScheme)&&void 0!==e?e:[];t(xn(xn({},n),{},{nodeColorScheme:r.map((function(e){return[Math.random(),e]})).sort((function(e,n){return(0,c.Z)(e,1)[0]-(0,c.Z)(n,1)[0]})).map((function(e){var n=(0,c.Z)(e,2);n[0];return n[1]}))}))}})}),(0,a.jsx)(Ee.u,{label:"Cycle node colors",children:(0,a.jsx)(v.h,{"aria-label":"Shift node colors",icon:(0,a.jsx)(dn.L,{}),size:"sm",variant:"ghost",onClick:function(){var e,r=null!==(e=n.nodeColorScheme)&&void 0!==e?e:[];t(xn(xn({},n),{},{nodeColorScheme:[].concat((0,l.Z)(r.slice(1,r.length)),[r[0]])}))}})}),(0,a.jsxs)(Re.v2,{isLazy:!0,placement:"right",closeOnSelect:!1,matchWidth:!0,children:[(0,a.jsx)(Re.j2,{width:20,as:Ze.z,colorScheme:"",color:"black",rightIcon:(0,a.jsx)(Be.v,{}),children:(0,a.jsx)(b.k,{height:6,width:6,flexDirection:"column",flexWrap:"wrap",children:n.nodeColorScheme.map((function(e){return(0,a.jsx)(w.xu,{bgColor:e,flex:"1 1 8px",borderRadius:"2xl"},e)}))})}),(0,a.jsxs)(X.h,{children:[" ",(0,a.jsx)(Re.qy,{minW:10,zIndex:"popover",bgColor:"gray.200",children:(0,a.jsx)(Re.__,{width:500,type:"checkbox",defaultValue:n.nodeColorScheme,onChange:function(e){e.length&&t(xn(xn({},n),{},{nodeColorScheme:e}))},children:Ie.map((function(e){return(0,a.jsx)(Re.ii,{isChecked:n.nodeColorScheme.some((function(n){return n===e})),value:e,isDisabled:1===n.nodeColorScheme.length&&n.nodeColorScheme[0]===e,children:(0,a.jsx)(w.xu,{justifyContent:"space-between",alignItems:"center",display:"flex",children:(0,a.jsx)(w.xu,{bgColor:e,borderRadius:"sm",height:6,width:6})})},e)}))})})]})]})]}),(0,a.jsxs)(b.k,{alignItems:"center",justifyContent:"space-between",children:[(0,a.jsx)(W.x,{children:"Links"}),(0,a.jsxs)(Re.v2,{isLazy:!0,placement:"right",children:[(0,a.jsx)(Re.j2,{as:Ze.z,colorScheme:"",color:"black",rightIcon:(0,a.jsx)(Be.v,{}),children:(0,a.jsx)(w.xu,{children:n.linkColorScheme?(0,a.jsx)(w.xu,{bgColor:n.linkColorScheme,borderRadius:"sm",height:6,width:6}):(0,a.jsx)(b.k,{height:6,width:6,flexDirection:"column",flexWrap:"wrap",children:n.nodeColorScheme.map((function(e){return(0,a.jsx)(w.xu,{bgColor:e,flex:"1 1 8px",borderRadius:"2xl"},e)}))})})}),(0,a.jsxs)(X.h,{children:[" ",(0,a.jsxs)(Re.qy,{minW:10,zIndex:"popover",bgColor:"gray.200",children:[(0,a.jsx)(Re.sN,{onClick:function(){return t(xn(xn({},n),{},{linkColorScheme:""}))},justifyContent:"space-between",alignItems:"center",display:"flex",children:(0,a.jsx)(b.k,{height:6,width:6,flexDirection:"column",flexWrap:"wrap",children:n.nodeColorScheme.map((function(e){return(0,a.jsx)(w.xu,{bgColor:e,flex:"1 1 8px",borderRadius:"2xl"},e)}))})}),Ie.map((function(e){return(0,a.jsx)(Re.sN,{onClick:function(){return t(xn(xn({},n),{},{linkColorScheme:e}))},justifyContent:"space-between",alignItems:"center",display:"flex",children:(0,a.jsx)(w.xu,{bgColor:e,borderRadius:"sm",height:6,width:6})},e)}))]})]})]})]}),(0,a.jsxs)(b.k,{alignItems:"center",justifyContent:"space-between",children:[(0,a.jsx)(W.x,{children:"Accent"}),(0,a.jsxs)(Re.v2,{isLazy:!0,placement:"right",children:[(0,a.jsx)(Re.j2,{as:Ze.z,colorScheme:"",color:"black",rightIcon:(0,a.jsx)(Be.v,{}),children:(0,a.jsx)(w.xu,{bgColor:r,borderRadius:"sm",height:6,width:6})}),(0,a.jsxs)(X.h,{children:[" ",(0,a.jsx)(Re.qy,{minW:10,zIndex:"popover",bgColor:"gray.200",children:Ie.map((function(e){return(0,a.jsx)(Re.sN,{onClick:function(){return i(e)},justifyContent:"space-between",alignItems:"center",display:"flex",children:(0,a.jsx)(w.xu,{bgColor:e,borderRadius:"sm",height:6,width:6})},e)}))})]})]})]}),(0,a.jsx)(fn,{colorList:Ie,label:"Link highlight",setVisuals:t,value:"linkHighlight",visValue:n.linkHighlight}),(0,a.jsx)(fn,{colorList:Ie,label:"Node highlight",setVisuals:t,value:"nodeHighlight",visValue:n.nodeHighlight}),(0,a.jsx)(fn,{colorList:Ie,label:"Background",setVisuals:t,value:"backgroundColor",visValue:n.backgroundColor}),(0,a.jsx)(fn,{colorList:Ie,label:"Emacs node",setVisuals:t,value:"emacsNodeColor",visValue:n.emacsNodeColor})]})})};function bn(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?bn(Object(t),!0).forEach((function(n){(0,s.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):bn(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,r=e.threeDim;return(0,a.jsx)(re.gC,{spacing:2,justifyContent:"flex-start",divider:(0,a.jsx)(re.cX,{borderColor:"gray.500"}),align:"stretch",color:"gray.800",children:(0,a.jsxs)(w.xu,{children:[(0,a.jsx)(nn,{label:"Node size",value:n.nodeRel,onChange:function(e){return t(vn(vn({},n),{},{nodeRel:e}))}}),(0,a.jsx)(nn,{label:"Node connections size scale",value:n.nodeSizeLinks,min:0,max:2,onChange:function(e){return t(vn(vn({},n),{},{nodeSizeLinks:e}))}}),(0,a.jsx)(nn,{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 vn(vn({},n),{},{nodeZoomSize:e})}))}}),r&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(nn,{label:"Node opacity",value:n.nodeOpacity,min:0,max:1,onChange:function(e){return t(vn(vn({},n),{},{nodeOpacity:e}))}}),(0,a.jsx)(nn,{label:"Node resolution",value:n.nodeResolution,min:5,max:32,step:1,onChange:function(e){return t(vn(vn({},n),{},{nodeResolution:e}))}})]}),(0,a.jsx)(nn,{label:"Link width",value:n.linkWidth,onChange:function(e){return t(vn(vn({},n),{},{linkWidth:e}))}}),r&&(0,a.jsx)(nn,{label:"Link opacity",min:0,max:1,value:n.linkOpacity,onChange:function(e){return t(vn(vn({},n),{},{linkOpacity:e}))}}),(0,a.jsxs)($e,{label:"Link arrows",value:n.arrows,onChange:function(){return t(vn(vn({},n),{},{arrows:!n.arrows}))},children:[(0,a.jsx)(nn,{label:"Arrow size",value:n.arrowsLength/10,onChange:function(e){return t(vn(vn({},n),{},{arrowsLength:10*e}))}}),(0,a.jsx)(nn,{label:"Arrow Position",value:n.arrowsPos,min:0,max:1,step:.01,onChange:function(e){return t(vn(vn({},n),{},{arrowsPos:e}))}}),(0,a.jsx)(fn,{colorList:Ie,label:"Arrow Color",setVisuals:t,value:"arrowsColor",visValue:n.arrowsColor},"arrow")]}),(0,a.jsxs)($e,{label:"Directional Particles",value:n.particles,onChange:function(){return t(vn(vn({},n),{},{particles:!n.particles}))},children:[(0,a.jsx)(nn,{label:"Particle Number",value:n.particlesNumber,max:5,step:1,onChange:function(e){return t(vn(vn({},n),{},{particlesNumber:e}))}}),(0,a.jsx)(nn,{label:"Particle Size",value:n.particlesWidth,onChange:function(e){return t(vn(vn({},n),{},{particlesWidth:e}))}})]})]})})};function mn(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 Cn(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?mn(Object(t),!0).forEach((function(n){(0,s.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):mn(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var On=function(e){var n=e.visuals,t=e.setVisuals;return(0,a.jsx)(re.gC,{spacing:2,justifyContent:"flex-start",divider:(0,a.jsx)(re.cX,{borderColor:"gray.500"}),align:"stretch",color:"gray.800",children:(0,a.jsxs)(w.xu,{children:[(0,a.jsxs)(b.k,{alignItems:"center",justifyContent:"space-between",children:[(0,a.jsx)(W.x,{children:"Show labels"}),(0,a.jsxs)(Re.v2,{isLazy:!0,placement:"right",children:[(0,a.jsx)(Re.j2,{as:Ze.z,colorScheme:"",color:"black",rightIcon:(0,a.jsx)(Be.v,{}),children:n.labels?n.labels<2?"On Highlight":"Always":"Never"}),(0,a.jsxs)(X.h,{children:[" ",(0,a.jsxs)(Re.qy,{zIndex:"popover",bgColor:"gray.200",children:[(0,a.jsx)(Re.sN,{onClick:function(){return t(Cn(Cn({},n),{},{labels:0}))},children:"Never"}),(0,a.jsx)(Re.sN,{onClick:function(){return t(Cn(Cn({},n),{},{labels:1}))},children:"On Highlight"}),(0,a.jsx)(Re.sN,{onClick:function(){return t(Cn(Cn({},n),{},{labels:2}))},children:"Always"}),(0,a.jsx)(Re.sN,{onClick:function(){return t(Cn(Cn({},n),{},{labels:3}))},children:"Always (even in 3D)"})]})]})]})]}),(0,a.jsxs)(re.gC,{spacing:1,justifyContent:"flex-start",divider:(0,a.jsx)(re.cX,{borderColor:"gray.400"}),align:"stretch",paddingLeft:2,color:"gray.800",children:[(0,a.jsx)(nn,{label:"Label font size",value:n.labelFontSize,min:5,max:20,step:.5,onChange:function(e){return t(Cn(Cn({},n),{},{labelFontSize:e}))}}),(0,a.jsx)(nn,{label:"Max. label characters",value:n.labelLength,min:10,max:100,step:1,onChange:function(e){return t(Cn(Cn({},n),{},{labelLength:e}))}}),(0,a.jsx)(nn,{label:"Max. label line length",value:n.labelWordWrap,min:10,max:100,step:1,onChange:function(e){return t(Cn(Cn({},n),{},{labelWordWrap:e}))}}),(0,a.jsx)(nn,{label:"Space between label lines",value:n.labelLineSpace,min:.2,max:3,step:.1,onChange:function(e){return t(Cn(Cn({},n),{},{labelLineSpace:e}))}}),(0,a.jsx)(fn,{colorList:Ie,label:"Text",setVisuals:t,value:"labelTextColor",visValue:n.labelTextColor}),(0,a.jsx)(fn,{colorList:Ie,label:"Background",setVisuals:t,value:"labelBackgroundColor",visValue:n.labelBackgroundColor}),(0,a.jsx)(Je.U,{in:!!n.labelBackgroundColor,animateOpacity:!0,children:(0,a.jsx)(w.xu,{paddingTop:2,children:(0,a.jsx)(nn,{label:"Background opacity",value:n.labelBackgroundOpacity,onChange:function(e){console.log(n.labelBackgroundOpacity),t(Cn(Cn({},n),{},{labelBackgroundOpacity:e}))},min:0,max:1,step:.01})})}),(0,a.jsx)(Je.U,{in:n.labels>1,animateOpacity:!0,children:(0,a.jsx)(w.xu,{paddingTop:2,children:(0,a.jsx)(nn,{label:"Label Appearance Scale",value:5*n.labelScale,onChange:function(e){return t(Cn(Cn({},n),{},{labelScale:e/5}))}})})})]})]})})};function wn(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?wn(Object(t),!0).forEach((function(n){(0,s.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):wn(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Sn=function(e){var n=e.visuals,t=e.setVisuals;return(0,a.jsx)(re.gC,{spacing:2,justifyContent:"flex-start",divider:(0,a.jsx)(re.cX,{borderColor:"gray.500"}),align:"stretch",color:"gray.800",children:(0,a.jsxs)(w.xu,{children:[(0,a.jsxs)($e,{label:"Dash cite links",infoText:"Add dashes to citation links made with org-roam-bibtex",value:n.citeDashes,onChange:function(){return t(kn(kn({},n),{},{citeDashes:!n.citeDashes}))},children:[(0,a.jsx)(nn,{label:"Dash length",value:n.citeDashLength/10,onChange:function(e){return t(kn(kn({},n),{},{citeDashLength:10*e}))}}),(0,a.jsx)(nn,{label:"Gap length",value:n.citeGapLength/5,onChange:function(e){return t(kn(kn({},n),{},{citeGapLength:5*e}))}})]}),(0,a.jsx)(fn,{colorList:Ie,label:"Citation node color",setVisuals:t,value:"citeNodeColor",visValue:n.citeNodeColor}),(0,a.jsx)(fn,{colorList:Ie,label:"Citation link color",setVisuals:t,value:"citeLinkColor",visValue:n.citeLinkColor}),(0,a.jsx)(fn,{colorList:Ie,label:"Reference link highlight",setVisuals:t,value:"citeLinkHighlightColor",visValue:n.citeLinkHighlightColor}),(0,a.jsxs)($e,{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(kn(kn({},n),{},{refDashes:!n.refDashes}))},children:[(0,a.jsx)(nn,{label:"Dash length",value:n.refDashLength/10,onChange:function(e){return t(kn(kn({},n),{},{refDashLength:10*e}))}}),(0,a.jsx)(nn,{label:"Gap length",value:n.refGapLength/5,onChange:function(e){return t(kn(kn({},n),{},{refGapLength:5*e}))}})]}),(0,a.jsx)(fn,{colorList:Ie,label:"Reference node color",setVisuals:t,value:"refNodeColor",visValue:n.refNodeColor}),(0,a.jsx)(fn,{colorList:Ie,label:"Reference link color",setVisuals:t,value:"refLinkColor",visValue:n.refLinkColor}),(0,a.jsx)(fn,{colorList:Ie,label:"Reference link highlight",setVisuals:t,value:"refLinkHighlightColor",visValue:n.refLinkHighlightColor})]})})},Pn=function(e){var n=e.visuals,t=e.setVisuals,r=e.highlightColor,i=e.setHighlightColor,o=e.threeDim,l=(0,u.useCallback)((function(e){return t(e)}),[]);return(0,a.jsx)(re.gC,{justifyContent:"flex-start",align:"stretch",children:(0,a.jsxs)(Te.UQ,{allowToggle:!0,defaultIndex:[0],paddingLeft:3,children:[(0,a.jsxs)(Te.Qd,{children:[(0,a.jsx)(Te.KF,{children:(0,a.jsxs)(b.k,{justifyContent:"space-between",w:"100%",children:[(0,a.jsx)(W.x,{children:"Colors"}),(0,a.jsx)(Te.XE,{marginRight:2})]})}),(0,a.jsx)(Te.Hk,{children:(0,a.jsx)(jn,{visuals:n,setVisualsCallback:l,highlightColor:r,setHighlightColor:i})})]}),(0,a.jsxs)(Te.Qd,{children:[(0,a.jsx)(Te.KF,{children:(0,a.jsxs)(b.k,{justifyContent:"space-between",w:"100%",children:[(0,a.jsx)(W.x,{children:"Nodes & Links"}),(0,a.jsx)(Te.XE,{marginRight:2})]})}),(0,a.jsx)(Te.Hk,{children:(0,a.jsx)(yn,{visuals:n,setVisuals:l,threeDim:o})})]}),(0,a.jsxs)(Te.Qd,{children:[(0,a.jsx)(Te.KF,{children:(0,a.jsxs)(b.k,{justifyContent:"space-between",w:"100%",children:[(0,a.jsx)(W.x,{children:"Labels"}),(0,a.jsx)(Te.XE,{marginRight:2})]})}),(0,a.jsx)(Te.Hk,{children:(0,a.jsx)(On,{visuals:n,setVisuals:l})})]}),(0,a.jsxs)(Te.Qd,{children:[(0,a.jsx)(Te.KF,{children:(0,a.jsxs)(b.k,{justifyContent:"space-between",w:"100%",children:[(0,a.jsx)(W.x,{children:"Highlighting"}),(0,a.jsx)(Te.XE,{marginRight:2})]})}),(0,a.jsx)(Te.Hk,{children:(0,a.jsx)(an,{visuals:n,setVisuals:l})})]}),(0,a.jsxs)(Te.Qd,{children:[(0,a.jsx)(Te.KF,{children:(0,a.jsxs)(b.k,{justifyContent:"space-between",w:"100%",children:[(0,a.jsx)(W.x,{children:"Citations"}),(0,a.jsx)(Te.XE,{marginRight:2})]})}),(0,a.jsx)(Te.Hk,{children:(0,a.jsx)(Sn,{visuals:n,setVisuals:l})})]})]})})};function Nn(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 In(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Nn(Object(t),!0).forEach((function(n){(0,s.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Nn(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Ln=function(e){var n=e.behavior,t=e.setBehavior,r=e.mouse,i=e.setMouse;return(0,a.jsxs)(re.gC,{spacing:2,justifyContent:"flex-start",divider:(0,a.jsx)(re.cX,{borderColor:"gray.500"}),align:"stretch",paddingLeft:7,color:"gray.800",children:[(0,a.jsxs)(b.k,{alignItems:"center",justifyContent:"space-between",children:[(0,a.jsx)(W.x,{children:"Preview node"}),(0,a.jsxs)(Re.v2,{isLazy:!0,placement:"right",children:[(0,a.jsx)(Re.j2,{as:Ze.z,rightIcon:(0,a.jsx)(Be.v,{}),colorScheme:"",color:"black",children:(0,a.jsx)(W.x,{children:r.preview?r.preview[0].toUpperCase()+r.preview.slice(1):"Never"})}),(0,a.jsxs)(X.h,{children:[" ",(0,a.jsxs)(Re.qy,{bgColor:"gray.200",zIndex:"popover",children:[(0,a.jsx)(Re.sN,{onClick:function(){return i(In(In({},r),{},{preview:""}))},children:"Never"}),(0,a.jsx)(Re.sN,{onClick:function(){return i(In(In({},r),{},{preview:"click"}))},children:"Click"}),(0,a.jsx)(Re.sN,{onClick:function(){return i(In(In({},r),{},{preview:"double"}))},children:"Double Click"})]})]})]})]}),(0,a.jsxs)(b.k,{alignItems:"center",justifyContent:"space-between",children:[(0,a.jsxs)(b.k,{children:[(0,a.jsx)(W.x,{children:"Expand Node"}),(0,a.jsx)(Ye,{infoText:"View only the node and its direct neighbors"})]}),(0,a.jsxs)(Re.v2,{isLazy:!0,placement:"right",children:[(0,a.jsx)(Re.j2,{as:Ze.z,rightIcon:(0,a.jsx)(Be.v,{}),colorScheme:"",color:"black",children:(0,a.jsx)(W.x,{children:r.local?r.local[0].toUpperCase()+r.local.slice(1):"Never"})}),(0,a.jsxs)(X.h,{children:[" ",(0,a.jsxs)(Re.qy,{zIndex:"popover",bgColor:"gray.200",children:[(0,a.jsx)(Re.sN,{onClick:function(){return i(In(In({},r),{},{local:""}))},children:"Never"}),(0,a.jsx)(Re.sN,{onClick:function(){return i(In(In({},r),{},{local:"click"}))},children:"Click"}),(0,a.jsx)(Re.sN,{onClick:function(){return i(In(In({},r),{},{local:"double"}))},children:"Double Click"}),(0,a.jsx)(Re.sN,{onClick:function(){return i(In(In({},r),{},{local:"right"}))},children:"Right Click"})]})]})]})]}),(0,a.jsxs)(b.k,{alignItems:"center",justifyContent:"space-between",children:[(0,a.jsx)(W.x,{children:"Open in Emacs"}),(0,a.jsxs)(Re.v2,{isLazy:!0,placement:"right",children:[(0,a.jsx)(Re.j2,{as:Ze.z,rightIcon:(0,a.jsx)(Be.v,{}),colorScheme:"",color:"black",children:(0,a.jsx)(W.x,{children:r.follow?r.follow[0].toUpperCase()+r.follow.slice(1):"Never"})}),(0,a.jsxs)(X.h,{children:[" ",(0,a.jsxs)(Re.qy,{bgColor:"gray.200",zIndex:"popover",children:[(0,a.jsx)(Re.sN,{onClick:function(){return i(In(In({},r),{},{follow:""}))},children:"Never"}),(0,a.jsx)(Re.sN,{onClick:function(){return i(In(In({},r),{},{follow:"click"}))},children:"Click"}),(0,a.jsx)(Re.sN,{onClick:function(){return i(In(In({},r),{},{follow:"double"}))},children:"Double Click"}),(0,a.jsx)(Re.sN,{onClick:function(){return i(In(In({},r),{},{follow:"right"}))},children:"Right Click"})]})]})]})]}),(0,a.jsxs)(b.k,{alignItems:"center",justifyContent:"space-between",children:[(0,a.jsx)(W.x,{children:"Follow Emacs by..."}),(0,a.jsxs)(Re.v2,{isLazy:!0,placement:"right",children:[(0,a.jsx)(Re.j2,{as:Ze.z,rightIcon:(0,a.jsx)(Be.v,{}),colorScheme:"",color:"black",children:(0,a.jsx)(W.x,{children:n.follow[0].toUpperCase()+n.follow.slice(1)})}),(0,a.jsxs)(X.h,{children:[" ",(0,a.jsxs)(Re.qy,{bgColor:"gray.200",zIndex:"popover",children:[(0,a.jsx)(Re.sN,{onClick:function(){return t(In(In({},n),{},{follow:"color"}))},children:"Just coloring the currently opened node"}),(0,a.jsx)(Re.sN,{onClick:function(){return t(In(In({},n),{},{follow:"local"}))},children:"Opening the local graph"}),(0,a.jsx)(Re.sN,{onClick:function(){return t(In(In({},n),{},{follow:"zoom"}))},children:"Zooming to the current node"})]})]})]})]}),(0,a.jsxs)(b.k,{alignItems:"center",justifyContent:"space-between",children:[(0,a.jsxs)(b.k,{children:[(0,a.jsx)(W.x,{children:"Local graph"}),(0,a.jsx)(Ye,{infoText:"When in local mode and clicking a new node, should I add that node's local graph or open the new one?"})]}),(0,a.jsxs)(Re.v2,{isLazy:!0,placement:"right",children:[(0,a.jsx)(Re.j2,{as:Ze.z,rightIcon:(0,a.jsx)(Be.v,{}),colorScheme:"",color:"black",children:(0,a.jsx)(W.x,{children:"add"===n.localSame?"Add":"Replace"})}),(0,a.jsxs)(X.h,{children:[" ",(0,a.jsxs)(Re.qy,{bgColor:"gray.200",zIndex:"popover",children:[(0,a.jsx)(Re.sN,{onClick:function(){return t(In(In({},n),{},{localSame:"replace"}))},children:"Open that nodes graph"}),(0,a.jsx)(Re.sN,{onClick:function(){return t(In(In({},n),{},{localSame:"add"}))},children:"Add node to local graph"})]})]})]})]}),(0,a.jsx)(nn,{label:"Zoom speed",value:n.zoomSpeed,min:0,max:4e3,step:100,onChange:function(e){return t(In(In({},n),{},{zoomSpeed:e}))}}),(0,a.jsx)(nn,{label:"Zoom padding",value:n.zoomPadding,min:0,max:400,step:1,onChange:function(e){return t(In(In({},n),{},{zoomPadding:e}))},infoText:"How much to zoom out to accomodate all nodes when changing the view."})]})};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 zn(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,s.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 En=function(e){var n=e.physics,t=e.setPhysics,r=e.threeDim,i=e.setThreeDim,o=e.filter,l=e.setFilter,s=e.visuals,d=e.setVisuals,h=e.mouse,g=e.setMouse,p=e.behavior,x=e.setBehavior,b=e.tags,y=e.tagColors,m=e.setTagColors,C=f("showTweaks",!1),O=(0,c.Z)(C,2),k=O[0],S=O[1],P=(0,u.useContext)(_.N),N=P.highlightColor,I=P.setHighlightColor;return k?(0,a.jsxs)(w.xu,{bg:"alt.100",w:"xs",marginTop:10,marginLeft:10,borderRadius:"xl",paddingBottom:5,zIndex:300,position:"relative",boxShadow:"xl",maxH:.92*globalThis.innerHeight,marginBottom:10,children:[(0,a.jsxs)(w.xu,{display:"flex",justifyContent:"space-between",alignItems:"center",paddingRight:2,paddingTop:1,children:[(0,a.jsx)(Ee.u,{label:"2D",children:(0,a.jsx)(Ze.z,{onClick:function(){return i(!r)},variant:"ghost",zIndex:"overlay",children:r?"3D":"2D"})}),(0,a.jsxs)(w.xu,{display:"flex",alignItems:"center",children:[(0,a.jsx)(Ee.u,{label:"Reset settings to defaults",children:(0,a.jsx)(v.h,{"aria-label":"Reset Defaults",icon:(0,a.jsx)(De.A,{}),onClick:function(){d(Se),l(ke),g(Ne),t(we),x(Pe)},variant:"none",size:"sm"})}),(0,a.jsx)(v.h,{size:"sm",icon:(0,a.jsx)(ze.T,{}),"aria-label":"Close Tweak Panel",variant:"ghost",onClick:function(){return S(!1)}})]})]}),(0,a.jsx)(ae.ZP,{autoHeight:!0,autoHeightMax:.85*globalThis.innerHeight,autoHide:!0,renderThumbVertical:function(e){var n=e.style,t=(0,j.Z)(e,["style"]);return(0,a.jsx)(w.xu,zn(zn({},t),{},{style:zn(zn({},n),{},{borderRadius:10}),bg:N}))},children:(0,a.jsxs)(Te.UQ,{allowMultiple:!0,allowToggle:!0,color:"black",children:[(0,a.jsxs)(Te.Qd,{children:[(0,a.jsxs)(Te.KF,{children:[(0,a.jsx)(Te.XE,{marginRight:2}),(0,a.jsx)(te.X,{size:"sm",children:"Filter"})]}),(0,a.jsx)(Te.Hk,{children:(0,a.jsx)(Ge,{filter:o,setFilter:l,tagColors:y,setTagColors:m,highlightColor:N,colorList:Ie,tags:b})})]}),(0,a.jsxs)(Te.Qd,{children:[(0,a.jsx)(Te.KF,{display:"flex",justifyContent:"space-between",children:(0,a.jsxs)(w.xu,{display:"flex",children:[(0,a.jsx)(Te.XE,{marginRight:2}),(0,a.jsx)(te.X,{size:"sm",children:"Physics"})]})}),(0,a.jsx)(Te.Hk,{children:(0,a.jsx)(on,{physics:n,setPhysics:t})})]}),(0,a.jsxs)(Te.Qd,{children:[(0,a.jsxs)(Te.KF,{children:[(0,a.jsx)(Te.XE,{marginRight:2}),(0,a.jsx)(te.X,{size:"sm",children:"Visual"})]}),(0,a.jsx)(Te.Hk,{children:(0,a.jsx)(Pn,{visuals:s,setVisuals:d,highlightColor:N,setHighlightColor:I,threeDim:r})})]}),(0,a.jsxs)(Te.Qd,{children:[(0,a.jsxs)(Te.KF,{children:[(0,a.jsx)(Te.XE,{marginRight:2}),(0,a.jsx)(te.X,{size:"sm",children:"Behavior"})]}),(0,a.jsx)(Te.Hk,{children:(0,a.jsx)(Ln,{behavior:p,setBehavior:x,mouse:h,setMouse:g})})]})]})})]}):(0,a.jsx)(w.xu,{position:"absolute",zIndex:"overlay",marginTop:10,marginLeft:10,display:k?"none":"block",children:(0,a.jsx)(v.h,{variant:"ghost","aria-label":"Settings",icon:(0,a.jsx)(Le.e,{}),onClick:function(){return S(!0)}})})},Zn=t(34552),Tn=t(94030),Bn=t(55830),Rn=t(46617),Fn=t(50862),Hn=t(68928);function An(e,n,t){t.send(JSON.stringify({command:e,data:n}))}function Vn(e,n){An("open",{id:e.id},n)}var Wn=function(e){e.background;var n=e.node,t=(e.nodeType,e.coordinates),r=e.handleLocal,i=e.menuClose,o=e.scope,l=e.webSocket,s=e.setPreviewNode,c=(0,xe.q)(),d=c.isOpen,h=c.onOpen,g=c.onClose;(0,u.useRef)();return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(w.xu,{position:"absolute",zIndex:"overlay",left:t[0]+10,top:t[1]-10,padding:5,children:(0,a.jsx)(Re.v2,{closeOnBlur:!1,defaultIsOpen:!0,onClose:function(){return i()},children:(0,a.jsxs)(Re.qy,{zIndex:"overlay",bgColor:"alt.100",borderColor:"gray.500",maxWidth:"xs",children:[n&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(te.X,{size:"sm",isTruncated:!0,px:3,py:1,children:n.title}),(0,a.jsx)(Re.R,{borderColor:"gray.500"})]}),0!==o.nodeIds.length&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(Re.sN,{onClick:function(){return r(n,"add")},icon:(0,a.jsx)(Tn.I,{}),children:"Expand local graph at node"}),(0,a.jsx)(Re.sN,{onClick:function(){return r(n,"replace")},icon:(0,a.jsx)(Bn.O,{}),children:"Open local graph for this node"})]}),null!==n&&void 0!==n&&n.properties.FILELESS?(0,a.jsx)(Re.sN,{icon:(0,a.jsx)(Fn.d,{}),onClick:function(){return function(e,n){An("create",{id:e.id,title:e.title,ref:e.properties.ROAM_REFS},n)}(n,l)},children:"Create node"}):(0,a.jsx)(Re.sN,{icon:(0,a.jsx)(Rn.d,{}),onClick:function(){return Vn(n,l)},children:"Open in Emacs"}),(null===n||void 0===n?void 0:n.properties.ROAM_REFS)&&(0,a.jsx)(Re.sN,{icon:(0,a.jsx)(Hn.h,{}),children:"Open in Zotero"}),0===o.nodeIds.length&&(0,a.jsx)(Re.sN,{icon:(0,a.jsx)(y.DvO,{}),onClick:function(){return r(n,"replace")},children:"Open local graph"}),(0,a.jsx)(Re.sN,{icon:(0,a.jsx)(Bn.O,{}),onClick:function(){s(n)},children:"Preview"}),0===(null===n||void 0===n?void 0:n.level)&&(0,a.jsx)(Re.sN,{closeOnSelect:!1,icon:(0,a.jsx)(Me.p,{color:"red.500"}),color:"red.500",onClick:h,children:"Permenantly delete note"})]})})}),(0,a.jsxs)(Zn.u_,{isCentered:!0,isOpen:d,onClose:g,children:[(0,a.jsx)(Zn.ZA,{}),(0,a.jsxs)(Zn.hz,{zIndex:"popover",children:[(0,a.jsx)(Zn.xB,{children:"Delete node?"}),(0,a.jsx)(Zn.ol,{}),(0,a.jsx)(Zn.fe,{children:(0,a.jsxs)(re.gC,{spacing:4,display:"flex",alignItems:"flex-start",children:[(0,a.jsx)(W.x,{children:"This will permanently delete your note:"}),(0,a.jsx)(W.x,{fontWeight:"bold",children:null===n||void 0===n?void 0:n.title}),0!==(null===n||void 0===n?void 0:n.level)&&(0,a.jsx)(W.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,a.jsx)(W.x,{children:"Are you sure you want to do continue?"})]})}),(0,a.jsxs)(Zn.mz,{children:[(0,a.jsx)(Ze.z,{mr:3,onClick:function(){console.log("closing"),g(),i()},children:"Cancel"}),(0,a.jsx)(Ze.z,{variant:"link",colorScheme:"red",ml:3,onClick:function(){console.log("aaaaa"),function(e,n){0===e.level&&An("delete",{id:e.id,file:e.file},n)}(n,l),g(),i()},children:"Delete node"})]})]})]})]})},Mn=t(31122),Xn=t(22663),_n=t.n(Xn),qn=t(22003);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,s.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=t.e(4).then(t.bind(t,57004)),Jn=t.g.window?t(61957).f$:null,Kn=t.g.window?t(61957).s6:null;function Yn(){var e=(0,u.useState)(!1),n=e[0],t=e[1];return(0,u.useEffect)((function(){t(!0)}),[]),n?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.default,{children:(0,a.jsx)("title",{children:"ORUI"})}),(0,a.jsx)($n,{})]}):null}function $n(){var e=f("3d",!1),n=(0,c.Z)(e,2),t=n[0],r=n[1],i=f("tagCols",{}),o=(0,c.Z)(i,2),d=o[0],h=o[1],g=(0,u.useState)({nodeIds:[]}),p=g[0],x=g[1],j=f("physics",we),y=(0,c.Z)(j,2),m=y[0],C=y[1],O=f("filter",ke),k=(0,c.Z)(O,2),S=k[0],P=k[1],N=f("visuals",Se),I=(0,c.Z)(N,2),L=I[0],D=I[1],z=(0,u.useState)(null),E=z[0],Z=z[1],T=(0,u.useState)(null),B=T[0],R=T[1],F=f("behavior",Pe),H=(0,c.Z)(F,2),A=H[0],V=H[1],W=f("mouse",Ne),M=(0,c.Z)(W,2),X=M[0],q=M[1],U=(0,u.useState)({}),Q=U[0],G=U[1],J=(0,u.useState)(null),K=J[0],Y=J[1],$=(0,xe.q)(),ee=$.isOpen,ne=$.onOpen,te=$.onClose,re=(0,u.useRef)({}),ie=(0,u.useRef)({}),oe=(0,u.useRef)({}),le=(0,u.useRef)([]),se=(0,u.useRef)(null),ce=(0,u.useRef)({nodes:[],links:[]});(0,u.useEffect)((function(){E&&(ce.current=E)}),[E]);var ae=(0,u.useContext)(_.N).setEmacsTheme,de=(0,u.useRef)({nodeIds:[]}),he=(0,u.useRef)(Pe);he.current=A;var fe=(0,u.useRef)(null);de.current=p;var pe=function(e,n){var t,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2e3,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:200;if("color"!==e){var o=se.current,s=de.current,c=he.current,a=null!==(t=ie.current[n])&&void 0!==t?t:[],u=Object.fromEntries([n].concat((0,l.Z)(a.flatMap((function(e){return[e.source,e.target]})))).map((function(e){return[e,{}]})));if("zoom"===e)return s.nodeIds.length&&x({nodeIds:[]}),void setTimeout((function(){return o.zoomToFit(r,i,(function(e){return u[e.id]}))}),50);if(!s.nodeIds.length)return x({nodeIds:[n]}),void setTimeout((function(){o.centerAt(0,0,10),o.zoomToFit(1,i)}),50);if("add"!==c.localSame)return x({nodeIds:[n]}),void setTimeout((function(){o.centerAt(0,0,10),o.zoomToFit(1,i)}),50);if(!s.nodeIds.includes(n)||!s.nodeIds.some((function(e){return u[e]})))return x({nodeIds:[n]}),void setTimeout((function(){o.centerAt(0,0,10),o.zoomToFit(1,i)}),50);x((function(e){return Qn(Qn({},e),{},{nodeIds:[].concat((0,l.Z)(e.nodeIds),[n])})})),setTimeout((function(){o.centerAt(0,0,10),o.zoomToFit(1,i)}),50)}};return(0,u.useEffect)((function(){fe.current=new qn.Z("ws://localhost:35903"),fe.current.addEventListener("open",(function(){console.log("Connection with Emacs established")})),fe.current.addEventListener("message",(function(e){var n=he.current,t=JSON.parse(e.data);switch(t.type){case"graphdata":return function(e){var n,t,r,i=re.current;le.current=null!==(n=e.tags)&&void 0!==n?n:[];var o=null!==(t=e.nodes)&&void 0!==t?t:[],a=null!==(r=e.links)&&void 0!==r?r:[],u=o.reduce((function(e,n){var t;return Qn(Qn({},e),{},(0,s.Z)({},n.file,[].concat((0,l.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"}})):[]}));re.current=Object.fromEntries(o.map((function(e){return[e.id,e]})));var g=[].concat((0,l.Z)(a),(0,l.Z)(d),(0,l.Z)(h)),f=[],p=g.map((function(e){var n=e.source,t=e.target;return re.current[n]?re.current[t]?e:(f.push({id:t,tags:["bad"],properties:{FILELESS:"yes",bad:"yes"},file:"",title:t,level:0,pos:0,olp:null}),Qn(Qn({},e),{},{type:"bad"})):(f.push({id:n,tags:["bad"],properties:{FILELESS:"yes",bad:"yes"},file:"",title:n,level:0,pos:0,olp:null}),Qn(Qn({},e),{},{type:"bad"}))}));re.current=Qn(Qn({},re.current),Object.fromEntries(f.map((function(e){return[e.id,e]})))),ie.current=p.reduce((function(e,n){var t,r,i;return Qn(Qn({},e),{},(i={},(0,s.Z)(i,n.source,[].concat((0,l.Z)(null!==(t=e[n.source])&&void 0!==t?t:[]),[n])),(0,s.Z)(i,n.target,[].concat((0,l.Z)(null!==(r=e[n.target])&&void 0!==r?r:[]),[n])),i))}),{});var x=[].concat((0,l.Z)(o),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?Qn(Qn({},e),{},(0,s.Z)({},i,n)):e}),{});var j={nodes:x,links:p},b=ce.current;if(0===b.nodes.length){var v=JSON.parse(JSON.stringify(j));return ce.current=v,void Z(v)}var y=[].concat((0,l.Z)(b.nodes.flatMap((function(e){var n,t=null!==(n=re.current[null===e||void 0===e?void 0:e.id])&&void 0!==n&&n;return t?[Qn(Qn({},e),t)]:[]}))),(0,l.Z)(Object.keys(re.current).filter((function(e){return!i[e]})).map((function(e){return re.current[e]})))),m=y.reduce((function(e,n,t){var r=null===n||void 0===n?void 0:n.id;return Qn(Qn({},e),{},(0,s.Z)({},r,t))}),{}),C=p.map((function(e){var n=tt(e),t=(0,c.Z)(n,2),r=t[0],i=t[1];return Qn(Qn({},e),{},{source:y[m[r]],target:y[m[i]]})}));Z({nodes:y,links:C})}(t.data);case"theme":return ae(t.data);case"command":switch(t.data.commandName){case"local":var r=A.zoomSpeed,i=A.zoomPadding;pe("local",t.data.id,r,i),R(t.data.id);break;case"zoom":var o,a,u=(null===t||void 0===t||null===(o=t.data)||void 0===o?void 0:o.speed)||n.zoomSpeed,d=(null===t||void 0===t||null===(a=t.data)||void 0===a?void 0:a.padding)||n.zoomPadding;pe("zoom",t.data.id,u,d),R(t.data.id);break;case"follow":pe(n.follow,t.data.id,n.zoomSpeed,n.zoomPadding),R(t.data.id);break;default:return console.error("unknown message type",t.type)}}}))}),[]),(0,u.useEffect)((function(){var e=se.current;!e||p.nodeIds.length>1||(p.nodeIds.length||!m.gravityOn?setTimeout((function(){e.zoomToFit(5,200)}),50):e.zoomToFit())}),[p.nodeIds]),E?(0,a.jsxs)(w.xu,{display:"flex",alignItems:"flex-start",flexDirection:"row",height:"100%",overflow:"hidden",children:[(0,a.jsxs)(w.xu,{display:"flex",justifyContent:"space-between",flexDirection:"row",height:"100%",width:"100%",children:[(0,a.jsx)(En,Qn(Qn({},{physics:m,setPhysics:C,threeDim:t,setThreeDim:r,filter:S,setFilter:P,visuals:L,setVisuals:D,mouse:X,setMouse:q,behavior:A,setBehavior:V,tagColors:d,setTagColors:h}),{},{tags:le.current})),(0,a.jsx)(b.k,{height:"100%",flexDirection:"column",marginLeft:"auto",children:!ee&&(0,a.jsx)(v.h,{icon:(0,a.jsx)(ue.U,{}),"aria-label":"Open org-viewer",zIndex:2,onClick:ne,variant:"ghost",marginTop:10,mr:8})})]}),(0,a.jsxs)(b.k,{position:"absolute",alignItems:"top",overflow:"hidden",children:[(0,a.jsx)(et,Qn({ref:se,nodeById:re.current,linksByNodeId:ie.current,webSocket:fe.current},{physics:m,graphData:E,threeDim:t,emacsNodeId:B,filter:S,visuals:L,behavior:A,mouse:X,scope:p,setScope:x,tagColors:d,setPreviewNode:G,sidebarHighlightedNode:K})),(0,a.jsx)(ge,Qn(Qn({},{isOpen:ee,onOpen:ne,onClose:te,previewNode:Q,setPreviewNode:G,setSidebarHighlightedNode:Y}),{},{nodeById:re.current,linksByNodeId:ie.current,nodeByCite:oe.current}))]})]}):null}var et=(0,u.forwardRef)((function(e,n){var t=e.physics,r=e.graphData,d=e.threeDim,h=e.linksByNodeId,g=e.filter,f=e.emacsNodeId,p=e.nodeById,j=e.visuals,b=e.behavior,v=e.mouse,y=e.scope,m=e.setScope,C=e.webSocket,O=e.tagColors,k=e.setPreviewNode,S=e.sidebarHighlightedNode,P=(0,fe.iP)(),N=(0,c.Z)(P,2),I=(N[0],N[1]),L=(0,u.useState)(null),D=L[0],z=L[1],E=(0,u.useState)(null),Z=E[0],T=E[1],B=(0,u.useState)([0,0]),R=B[0],F=B[1],H=(0,V.useTheme)(),A=(0,u.useContext)(_.N).emacsTheme,W=function(e,n){"replace"!==n?y.nodeIds.includes(e.id)||m((function(n){return Qn(Qn({},n),{},{nodeIds:[].concat((0,l.Z)(n.nodeIds),[e.id])})})):m({nodeIds:[e.id]})},M=(0,xe.q)(),X=function(e,n,t){switch(e){case v.local:W(n,b.localSame);break;case v.follow:Vn(n,C);break;case v.context:!function(e,n){F([n.pageX,n.pageY]),T(e),M.onOpen()}(n,t);case v.preview:k(n)}},q=(0,u.useRef)(null);(0,u.useEffect)((function(){f&&z(p[f])}),[f]);var U=(0,u.useRef)({}),Q=(0,u.useRef)({}),G=(0,u.useMemo)((function(){var e;Q.current={};var n=null===r||void 0===r||null===(e=r.nodes)||void 0===e?void 0:e.filter((function(e){var n=e;return g.tagsBlacklist.length&&g.tagsBlacklist.some((function(e){return n.tags.indexOf(e)>-1}))||g.tagsWhitelist.length>0&&!g.tagsWhitelist.some((function(e){return n.tags.indexOf(e)>-1}))||g.filelessCites&&n.properties.FILELESS?(Q.current=Qn(Qn({},Q.current),{},(0,s.Z)({},n.id,n)),!1):!g.bad||!n.properties.bad||(Q.current=Qn(Qn({},Q.current),{},(0,s.Z)({},n.id,n)),!1)})).filter((function(e){var n,t=(null!==(n=h[null===e||void 0===e?void 0:e.id])&&void 0!==n?n:[]).filter((function(e){return!Q.current[e.source]&&!Q.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})),i=r.links.filter((function(e){var n=tt(e),r=(0,c.Z)(n,2),i=r[0],o=r[1];if(!t.includes(i)||!t.includes(o))return!1;var l=e;return g.parent?"heading"===g.parent?"parent"!==l.type:"heading"!==l.type:!["parent","heading"].includes(l.type)}));return U.current=i.reduce((function(e,n){var t,r,i,o=n,a=tt(o),u=(0,c.Z)(a,2),d=u[0],h=u[1];return Qn(Qn({},e),{},(i={},(0,s.Z)(i,d,[].concat((0,l.Z)(null!==(t=e[d])&&void 0!==t?t:[]),[o])),(0,s.Z)(i,h,[].concat((0,l.Z)(null!==(r=e[h])&&void 0!==r?r:[]),[o])),i))}),{}),{nodes:n,links:i}}),[g,r]),J=(0,u.useState)({nodes:[],links:[]}),K=J[0],Y=J[1];(0,u.useEffect)((function(){if(y.nodeIds.length){var e=y.nodeIds.length>1?K.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=U.current[e])&&void 0!==n?n:[]).forEach((function(e){var n=tt(e),t=(0,c.Z)(n,2),o=t[0],l=t[1];i.includes(o)?i.includes(l)||r.push(l):r.push(o)}))})),t=r,r.forEach((function(e){return e&&i.push(e)})),r=[]})),i}(y.nodeIds,1),r=G.nodes.filter((function(r){var i;return e.length?!n.includes(r.id)&&(null!==(i=U.current[r.id])&&void 0!==i?i:[]).some((function(e){return y.nodeIds.includes(e.source)||y.nodeIds.includes(e.target)})):t.includes(r.id)})).map((function(e){return Qn(Qn({},e),{},{x:0,y:0,vy:0,vx:0})})),i=[].concat((0,l.Z)(e),(0,l.Z)(r)),o=i.map((function(e){return e.id})),s=y.nodeIds.length>1?K.links:[],a=G.links.filter((function(e){var t=tt(e),r=(0,c.Z)(t,2),i=r[0],l=r[1];return!(s.length&&n.includes(l)&&n.includes(i))&&(o.includes(i)&&o.includes(l))})).map((function(e){var n=tt(e),t=(0,c.Z)(n,2);return{source:t[0],target:t[1]}})),u=[].concat((0,l.Z)(s),(0,l.Z)(a));Y({nodes:i,links:u})}}),[g,y,r]),(0,u.useEffect)((function(){(0,o.Z)(i().mark((function e(){var r,o;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.current,e.next=3,Gn;case 3:o=e.sent,!t.gravityOn||y.nodeIds.length&&!t.gravityLocal?(r.d3Force("x",null),r.d3Force("y",null),d&&r.d3Force("z",null)):(r.d3Force("x",o.forceX().strength(t.gravity)),r.d3Force("y",o.forceY().strength(t.gravity)),d&&r.d3Force("z",o.forceZ().strength(t.gravity))),t.centering?r.d3Force("center",o.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?o.forceCollide().radius(t.collisionStrength):null);case 10:case"end":return e.stop()}}),e)})))()}),[t,d,y]),(0,u.useEffect)((function(){var e;null===(e=n.current)||void 0===e||e.d3ReheatSimulation()}),[t,y.nodeIds.length]);var $=(0,u.useRef)(0),ee=(0,u.useState)(1),ne=ee[0],te=ee[1],re=(0,pe._7)((function(e){return te(e)}),{duration:j.animationSpeed,algorithm:Oe[j.algorithmName]}),ie=(0,c.Z)(re,2),oe=ie[0],le=ie[1],se=(0,pe._7)((function(e){return te(Math.min(ne,-1*(e-1)))}),{duration:j.animationSpeed,algorithm:Oe[j.algorithmName]}),ce=(0,c.Z)(se,2),ae=ce[0],ue=ce[1];(0,u.useEffect)((function(){console.log("aaa"),null!==S&&void 0!==S&&S.id?z(S):z(null)}),[S]);var de=(0,u.useMemo)((function(){if(!q.current)return{};var e=U.current[q.current.id];return e?Object.fromEntries([q.current.id].concat((0,l.Z)(e.flatMap((function(e){return[e.source,e.target]})))).map((function(e){return[e,{}]}))):{}}),[JSON.stringify(q.current),JSON.stringify(U.current)]),he=(0,u.useRef)(null);(0,u.useEffect)((function(){if(q.current=D,D&&(he.current=D),!j.highlightAnim)return te(D?1:0);D?oe():(le(),ne>.5?ae():te(0))}),[D]);var ge=(0,u.useMemo)((function(){return Object.fromEntries(Ie.map((function(e){var n=rt(e,H),t=Ie.map((function(e){return[e,x.Z(n,rt(e,H))]}));return[e,Object.fromEntries(t)]})))}),[A]),je=(0,u.useMemo)((function(){var e,n,t,r=null!==(e=U.current[null===(n=he.current)||void 0===n?void 0:n.id])&&void 0!==e?e:[];return Object.fromEntries([null===(t=he.current)||void 0===t?void 0:t.id].concat((0,l.Z)(r.flatMap((function(e){return tt(e)})))).map((function(e){return[e,{}]})))}),[JSON.stringify(D),he.current,U.current]),be=function(e){var n,t,r,i,o,l=null!==(n=null===(t=U.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))]},ve=function(e,n){return U.current[e].length>U.current[n].length?be(e):be(n)},ye=(0,u.useMemo)((function(){return rt(j.labelTextColor,H)}),[j.labelTextColor,A]),me=(0,u.useMemo)((function(){return rt(j.labelBackgroundColor,H)}),[j.labelBackgroundColor,A]),Ce=function(e){var n,t=null!==(n=U.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*(de[e.id]||je[e.id]?1+ne*(j.highlightNodeSize-1):1)},we=(0,u.useState)(!1),ke=we[0],Se=we[1],Pe=(0,u.useState)(1),Ne=Pe[0],Le=Pe[1],De={graphData:y.nodeIds.length?K:G,height:I,backgroundColor:H.colors.gray[j.backgroundColor],warmupTicks:1===y.nodeIds.length?100:y.nodeIds.length>1?20:0,onZoom:function(e){var n=e.k;e.x,e.y;return Le(n)},nodeLabel:function(e){return e.title},nodeColor:function(e){return function(e,n){var t=de[e.id]||je[e.id];if(j.emacsNodeColor&&e.id===f)return rt(j.emacsNodeColor,n);if(O&&e.tags.some((function(e){return O[e]}))){var r=O[e.tags.filter((function(e){return O[e]}))[0]];return ge[r][j.backgroundColor](j.highlightFade*ne)}return j.citeNodeColor&&e.properties.ROAM_REFS&&e.properties.FILELESS?t?rt(j.citeNodeColor,n):ge[j.citeNodeColor][j.backgroundColor](j.highlightFade*ne):j.refNodeColor&&e.properties.ROAM_REFS?t?rt(j.refNodeColor,n):ge[j.refNodeColor][j.backgroundColor](j.highlightFade*ne):t?j.nodeHighlight?ge[be(e.id)][j.nodeHighlight](ne):rt(be(e.id),n):ge[be(e.id)][j.backgroundColor](j.highlightFade*ne)}(e,H)},nodeRelSize:j.nodeRel,nodeVal:function(e){return Ce(e)/Math.pow(Ne,j.nodeZoomSize)},nodeCanvasObject:function(e,n,t){if(e&&!ke&&j.labels){var r=je[e.id];if(!(t<=j.labelScale||1===j.labels)||de[e.id]||r){var i=e.title,o=i.substring(0,j.labelLength),s=j.labelFontSize/(.75*Math.min(Math.max(.5,t),3)),c=[1.1*n.measureText(o).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?ne:de[e.id]||je[e.id]?Math.max(a,ne):1*a*(-1*(j.highlightFade*ne-1))},d=8*Math.cbrt(Ce(e)*j.nodeRel);if(j.labelBackgroundColor&&j.labelBackgroundOpacity){var h=u()*j.labelBackgroundOpacity,g=it(me,h);n.fillStyle=g,n.fillRect.apply(n,[e.x-c[0]/2,e.y-c[1]/2+d].concat((0,l.Z)(c)))}var f=u();n.textAlign="center",n.textBaseline="middle";var p=it(ye,f);n.fillStyle=p,n.font="".concat(s,"px Sans-Serif");var x=_n()(o,{width:j.labelWordWrap}).split("\n");(i.length>j.labelLength?[].concat((0,l.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 rt(j.arrowsColor,H)}: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=nt(e,q.current),o=nt(e,he.current),l=i||o,s=e;return j.refLinkColor&&"ref"===s.type?l&&(j.refLinkHighlightColor||j.linkHighlight)?ge[j.refLinkColor][j.refLinkHighlightColor||j.linkHighlight](ne):ge[j.refLinkColor][j.backgroundColor](j.highlightFade*ne):j.citeLinkColor&&null!==(n=s.type)&&void 0!==n&&n.includes("cite")?l&&(j.citeLinkHighlightColor||j.linkHighlight)?ge[j.citeLinkColor][j.citeLinkHighlightColor||j.linkHighlight](ne):ge[j.citeLinkColor][j.backgroundColor](j.highlightFade*ne):function(e,n,t,r){if(!j.linkHighlight&&!j.linkColorScheme&&!t)return rt(ve(e,n),r);if(!t&&!j.linkColorScheme){var i=ve(e,n);return ge[i][j.backgroundColor](j.highlightFade*ne)}return t?j.linkHighlight||j.linkColorScheme?j.linkHighlight?j.linkColorScheme?ge[j.linkColorScheme][j.linkHighlight](ne):ge[ve(e,n)][j.linkHighlight](ne):rt(j.linkColorScheme,r):rt(ve(e,n),r):ge[j.linkColorScheme][j.backgroundColor](j.highlightFade*ne)}(t,r,l,H)},linkWidth:function(e){if(1===j.highlightLinkSize)return j.linkWidth;var n=nt(e,q.current),t=nt(e,he.current);return n||t?j.linkWidth*(1+ne*(j.highlightLinkSize-1)):j.linkWidth},linkDirectionalParticleWidth:j.particlesWidth,d3AlphaDecay:t.alphaDecay,d3AlphaMin:t.alphaMin,d3VelocityDecay:t.velocityDecay,onNodeClick:function(e,n){var t=e;M.onClose();var r=n.timeStamp-$.current<200;if($.current=n.timeStamp,r)return X("double",t,n);var i=$.current;return setTimeout((function(){if($.current===i)return X("click",t,n)}),200)},onBackgroundClick:function(){M.onClose(),z(null),0!==y.nodeIds.length&&m((function(e){return Qn(Qn({},e),{},{nodeIds:[]})}))},onNodeHover:function(e){j.highlight&&(D||(ue(),te(0)),z(e))},onNodeRightClick:function(e,n){X("right",e,n)},onNodeDrag:function(e){M.onClose(),z(e),Se(!0)},onNodeDragEnd:function(){z(null),Se(!1)}};return(0,a.jsxs)(w.xu,{overflow:"hidden",children:[M.isOpen&&(0,a.jsx)(Wn,{scope:y,node:Z,nodeType:null===Z||void 0===Z?void 0:Z.id,background:!1,coordinates:R,handleLocal:W,menuClose:M.onClose.bind(M),webSocket:C,setPreviewNode:k}),d?(0,a.jsx)(Kn,Qn(Qn({ref:n},De),{},{nodeThreeObjectExtend:!0,backgroundColor:H.colors.white,nodeOpacity:j.nodeOpacity,nodeResolution:j.nodeResolution,linkOpacity:j.linkOpacity,nodeThreeObject:function(e){if(j.labels&&(!(j.labels<3)||de[e.id])){var n=new Mn.Z(e.title.substring(0,40));return n.color=rt(j.labelTextColor,H),n.backgroundColor=rt(j.labelBackgroundColor,H),n.padding=2,n.textHeight=8,n}}})):(0,a.jsx)(Jn,Qn(Qn({ref:n},De),{},{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 nt(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 tt(e){return["object"===typeof e.source?e.source.id:e.source,"object"===typeof e.target?e.target.id:e.target]}function rt(e,n){return e.split(".").reduce((function(e,n){return e[n]}),n.colors)}function it(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(70843)}])}},function(e){e.O(0,[774,737,874,573,446,599,888,179],(function(){return n=45301,e(e.s=n);var n}));var n=e.O();_N_E=n}]);