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