1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="90027ba9-dd17-4166-9ee9-bbb7e176a2a6",e._sentryDebugIdIdentifier="sentry-dbid-90027ba9-dd17-4166-9ee9-bbb7e176a2a6")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7316],{34209:function(e,t,r){r.d(t,{k:function(){return M}});var n=r(95170),o=r.n(n),i=r(73330),s=r(86534),a=r(21526),l=r(20967),d=r(29678),c=r(17291),u=r(28251),h=r(68358),p=r(25991);let f={key:"preferences-store",version:25},g={key:"user-store",version:25},m={key:"graph-store",version:34},v={key:"credential-store",version:25},y={key:"change-store",version:27,debounceInterval:500,saveOnUnload:!0,migrations:[{from:26,to:27,migrate:e=>{var t;return{...e,pendingCommits:(null!==(t=e.pendingCommits)&&void 0!==t?t:[]).map(e=>{try{let{noteRef:t,...r}=e,{graphId:n,noteId:o}=(0,h.l7)(t.id);return{...r,graphId:n,noteId:o}}catch(e){return null}}).filter(p.Dw)}}}]},b={key:"ui-state-store",version:1,debounceInterval:500},w={key:"task-filter-store",version:1},x={key:"notes-map-filter-store",version:1};async function k(e){let{key:t,version:r}=e,n=S({key:t,version:r}),o=await l.j.getItem(n);if(o&&"string"==typeof o)try{let e=JSON.parse(o);if(e&&"object"==typeof e)return e}catch(e){console.error("Error parsing stored item:",e)}return null}async function j(e){let{snapshot:t,key:r,version:n}=e,o=S({key:r,version:n}),i=JSON.stringify(t);await l.j.setItem(o,i)}function S(e){let{key:t,version:r}=e;return"".concat(t,"-").concat(r)}var N=r(97642);async function I(e,t){let{key:r,version:n,debounceInterval:o=2e3,saveOnUnload:i,migrations:a=[]}=t,l=async t=>{if((0,N.u)()){console.log("Skipping persistence because it is disabled");return}"onPersist"in e&&"function"==typeof e.onPersist&&e.onPersist(),await j({snapshot:t,key:r,version:n})},d=(0,c.Z)(l,o);(0,s.cfB)(e,d),i&&window.addEventListener("beforeunload",()=>{if((0,N.u)()){console.log("Skipping persistence because it is disabled");return}d.cancel(),l((0,s.vMv)(e))});let u=await D({key:r,version:n,migrations:a});u&&(0,s.Xx3)(e,u)}async function D(e){let{key:t,version:r,migrations:n}=e;return await k({key:t,version:r})||await L({migrations:n,key:t,version:r})}async function L(e){let{migrations:t,key:r,version:n}=e,o=t.find(e=>e.to===n);if(!o)return null;let i=await k({key:r,version:o.from});if(i)try{return o.migrate(i)}catch(e){(0,u.Tb)(e)}return null}var C=r(15608);async function E(){d.k.info("Setting up root store...");let e=new C.M({});return console.time("Loading stores"),await I(e.preferenceStore,f),await I(e.userStore,g),await I(e.graphStore,m),await I(e.credentialStore,v),await I(e.changeStore,y),await I(e.uiStateStore,b),await I(e.taskFilterStore,w),await I(e.notesMapFilterStore,x),console.timeEnd("Loading stores"),(0,s.m83)(e)||(0,s.v5r)(e),e}(0,s.QbW)({modelIdGenerator:a.O}),l.j.setup(o());let M=(0,i.Z)(E)},57316:function(e,t,r){r.r(t),r.d(t,{DebugFixMissingYjsDoc:function(){return k}});var n=r(15767),o=r(11527),i=r(89009),s=r(19884),a=r(44838),l=r(72811),d=r(62107),c=r(34209),u=r(13402),h=r(17554),p=r(65359),f=r(50682),g=r(93941),m=r(20704),v=r(11111),y=r(37259),b=r(34822),w=r(96309);class x{dispose(){}get graph(){var e;return this.graphId?null===(e=this.rootStore)||void 0===e?void 0:e.graphStore.findById(this.graphId):null}get assertGraph(){return(0,f.hu)(this.graph,"missing graph"),this.graph}get noteStore(){var e;return null===(e=this.graph)||void 0===e?void 0:e.noteStore}async fixCorruptedNotes(){var e,t;if(!(null===(e=this.graph)||void 0===e?void 0:e.encryptionKey)){this.log("Not ready");return}if(null===(t=this.rootStore)||void 0===t?void 0:t.userNeedsAuth){this.log("Not logged in");return}this.log("Getting all the notes from server... This may take a while.");let r=(0,i.J4)({db:b.db,graphId:this.graph.id}),n=w.RZ.query(r).withConverter((0,i.sh)()),o=await w.RZ.getDocsFromServer(n);this.log("Got ".concat(o.size," notes from server!"));let s=o.docs.filter(e=>!("yjs_doc"in e.data()));for(let e of(this.log("Found ".concat(s.length," corrupted notes!")),this.log(""),s))try{await this.fixNote(e)}catch(e){this.log("Error fixing: ".concat(e))}this.noteStore.lastSyncManager.setLastSync(null)}async fixNote(e){this.log("Fixing ".concat(e.id,"..."));let t=(0,i.Ul)({db:b.db,graphId:this.assertGraph.id,noteId:e.id}),r=await w.RZ.getDocsFromServer(t),n=await Promise.all(r.docs.map(t=>(0,m.PJ)({encryptionKey:this.assertGraph.encryptionKey,noteId:e.id,snapshot:t}))),o=this.createYjsDocFromCommits(n),s=(0,p.CI)(o);this.log("Reconstructed YJS doc, html: ".concat(s.substring(0,40),"...")),console.log("reconstructed html:",s),s?(await this.saveYjsDoc(e.id,o),this.log("Saved YJS doc for ".concat(e.id)),this.noteStore.table.delete(e.id)):this.log("Skipping save because HTML was empty!"),this.log("")}createYjsDocFromCommits(e){let t=new s.pU.Doc;for(let n of e){var r;for(let e of(n.yjsDocAsUpdate&&s.pU.applyUpdate(t,n.yjsDocAsUpdate),null!==(r=n.yjsUpdates)&&void 0!==r?r:[]))s.pU.logUpdate(e),s.pU.applyUpdate(t,e)}return t}async saveYjsDoc(e,t){let r=await (0,y.UF)(t,{encrypt:!0,key:this.assertGraph.encryptionKey,itemId:e});try{await (0,v.yh)(this.assertGraph,async t=>{var n;let o=(0,i.lB)({db:b.db,graphId:this.assertGraph.id,noteId:e}),s=await t.get(o);if(null===(n=s.data())||void 0===n?void 0:n.yjs_doc)throw Error("yjs doc exists!");t.update(o,{yjs_doc:r})})}catch(t){this.log("Error saving yjs doc for ".concat(e,": ").concat(t))}}log(e){this.logLines.push(e)}get logOutput(){return this.logLines.join("\n")}constructor(e){this.logLines=[],this.graphId=e.graphId,(0,a.makeObservable)(this),(0,c.k)().then(e=>{this.rootStore=e},e=>{throw e})}}(0,n.gn)([a.observable],x.prototype,"rootStore",void 0),(0,n.gn)([a.observable],x.prototype,"logLines",void 0),(0,n.gn)([a.observable],x.prototype,"graphId",void 0),(0,n.gn)([a.action],x.prototype,"log",null);let k=(0,l.Pi)(e=>{var t;let{graphId:r}=e,n=(0,g.D)(()=>new x({graphId:r}),[r]);return(null===(t=n.rootStore)||void 0===t?void 0:t.userNeedsAuth)?(0,o.jsx)("a",{href:"/auth?redirect=back",children:"Log in first"}):(0,o.jsx)("main",{className:"overflow-hidden",children:(0,o.jsx)(d.LD,{value:n.rootStore,children:(0,o.jsx)(h.Q2,{children:(0,o.jsx)("div",{className:"flex h-screen flex-row items-center justify-center bg-gray-50 text-black",children:(0,o.jsxs)("div",{className:"min-w-[70%] space-y-4 rounded-md bg-white p-4",children:[(0,o.jsx)("textarea",{value:n.logOutput,className:"block min-h-[300px] w-full text-sm",readOnly:!0}),(0,o.jsx)("footer",{className:"flex items-center justify-end space-x-4",children:(0,o.jsx)(u.zx,{onClick:()=>n.fixCorruptedNotes(),children:"Find corrupted notes"})})]})})})})})})},43917:function(e,t,r){r.d(t,{m:function(){return i}});var n=r(11527),o=r(4814);r(50959);let i=e=>{let{onClick:t,disabled:r,className:i="",small:s=!1,type:a="button",children:l}=e;return(0,n.jsx)("span",{className:"inline-flex",children:(0,n.jsx)("button",{onClick:t,type:a,disabled:r,className:(0,o.Z)(i,s?"px-4 py-2":"px-4 py-2 md:px-4 md:py-2","focus:shadow-outline-indigo inline-flex items-center space-x-2 rounded-md border border-transparent bg-indigo-100 text-2xs font-medium leading-5 text-indigo-600 outline-none hover:bg-indigo-50 focus:border-indigo-300 focus:outline-none active:bg-indigo-200 disabled:pointer-events-none disabled:cursor-default disabled:opacity-75 dark:border dark:border-gray-800 dark:bg-gray-900 dark:text-near-white dark:hover:bg-gray-800 dark:hover:text-white"),children:l})})}},13402:function(e,t,r){r.d(t,{zx:function(){return i},mI:function(){return s.m},KM:function(){return i}});var n=r(11527),o=r(4814);r(50959);let i=e=>{let{onClick:t,type:r="button",className:i="",children:s,disabled:a}=e;return(0,n.jsx)("button",{onClick:t,type:r,disabled:a,className:(0,o.Z)("inline-flex cursor-pointer items-center space-x-1 rounded-md border border-transparent bg-indigo-600 px-3 py-2 text-sm font-medium leading-4 text-white shadow-sm transition duration-300 ease-in-out hover:bg-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 disabled:cursor-not-allowed disabled:bg-gray-500",i),children:s})};var s=r(43917);r(74014)},74014:function(e,t,r){r.d(t,{M:function(){return i}});var n=r(11527),o=r(4814);r(50959);let i=e=>{let{label:t="Submit",loadingLabel:r="Loading...",loading:i=!1,onClick:s,disabled:a,className:l}=e;return(0,n.jsx)("span",{className:"flex w-full rounded-md shadow-sm",children:(0,n.jsxs)("button",{type:"submit",onClick:s,disabled:i||a,className:(0,o.Z)("relative inline-flex w-full min-w-28 justify-center shadow-sm","rounded-md border border-transparent bg-purple-600 px-4 py-2","text-base font-medium leading-6 text-white sm:text-sm sm:leading-5","focus:shadow-outline-purple hover:bg-purple-500 focus:border-purple-700 focus:outline-none","active:bg-purple-700","transition duration-300 ease-in-out",(i||a)&&"cursor-auto opacity-50",l),children:[i&&(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)("svg",{className:"absolute left-0 ml-2 h-5 w-5 animate-spin text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,n.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,n.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}),(0,n.jsx)("span",{children:i?r:t})]})})}},17554:function(e,t,r){r.d(t,{Q2:function(){return u},Fg:function(){return c}});var n=r(11527),o=r(4814),i=r(72811);r(50959);var s=r(63320),a=r(44301),l=r(62107),d=r(85795);function c(){let e=(0,d.tv)(),t=function(){let e=(0,l.bG)();return(null==e?void 0:e.theme)||"system"}();return"system"===t?e:t}let u=(0,i.Pi)((e,t)=>{let{children:r}=e,i=c();return(0,n.jsx)("div",{ref:t,className:(0,o.Z)(["app-theme","dark"===i?"dark":"light",(0,a.d)()&&"electron",(0,s.W)()&&"capacitor",(0,a.qx)()&&"iphone",(0,a.HM)()&&"ipad","select-none antialiased"]),style:{colorScheme:i},children:(0,n.jsx)("div",{className:"bg-background-stark font-sans text-coolgray-900 dark:text-near-white",children:r})})},{forwardRef:!0});u.displayName="Theme"},85795:function(e,t,r){r.d(t,{XU:function(){return s},nd:function(){return a},tv:function(){return i}});var n=r(50959);let o="function"==typeof window.matchMedia;function i(){var e;let t=o?window.matchMedia("(prefers-color-scheme: dark)"):{matches:!1}
1,[r,i]=(0,n.useState)(t.matches?"dark":"light");return e=()=>{i(t.matches?"dark":"light")},(0,n.useEffect)(()=>{if(o){let t=window.matchMedia("(prefers-color-scheme: dark)");return s(t,e),()=>{a(t,e)}}},[o]),r}function s(e,t){e.addEventListener?e.addEventListener("change",e=>{t(e)}):e.addListener(e=>{t(e)})}function a(e,t){e.removeEventListener?e.removeEventListener("change",t):e.removeListener(t)}},93941:function(e,t,r){r.d(t,{D:function(){return o}});var n=r(50959);function o(e,t){let r=(0,n.useRef)(null),o=(0,n.useMemo)(()=>{var t,n;null===(t=r.current)||void 0===t||t.dispose();let o=e();return r.current=o,null===(n=o.attach)||void 0===n||n.call(o),o},t);return(0,n.useEffect)(()=>()=>{var e;null===(e=r.current)||void 0===e||e.dispose(),r.current=null},[]),o}},97642:function(e,t,r){r.d(t,{d:function(){return o},u:function(){return i}});let n=!1;function o(){n=!0}function i(){return n}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.