PageSourceSearch

https://reflect.app/_next/static/chunks/3727.07941c3147e31520.js

js reflect.app collected 2026-09-24 08:52:49 UTC 15,189 bytes, 1 lines download raw bytes

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]="e4d3d6ff-ed02-4f5b-8e47-df2e72f623d8",e._sentryDebugIdIdentifier="sentry-dbid-e4d3d6ff-ed02-4f5b-8e47-df2e72f623d8")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3727],{34209:function(e,t,n){n.d(t,{k:function(){return E}});var r=n(95170),a=n.n(r),i=n(73330),s=n(86534),o=n(21526),l=n(20967),c=n(29678),d=n(17291),u=n(28251),f=n(68358),h=n(25991);let m={key:"preferences-store",version:25},g={key:"user-store",version:25},p={key:"graph-store",version:34},x={key:"credential-store",version:25},b={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,...n}=e,{graphId:r,noteId:a}=(0,f.l7)(t.id);return{...n,graphId:r,noteId:a}}catch(e){return null}}).filter(h.Dw)}}}]},w={key:"ui-state-store",version:1,debounceInterval:500},y={key:"task-filter-store",version:1},v={key:"notes-map-filter-store",version:1};async function k(e){let{key:t,version:n}=e,r=N({key:t,version:n}),a=await l.j.getItem(r);if(a&&"string"==typeof a)try{let e=JSON.parse(a);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:n,version:r}=e,a=N({key:n,version:r}),i=JSON.stringify(t);await l.j.setItem(a,i)}function N(e){let{key:t,version:n}=e;return"".concat(t,"-").concat(n)}var S=n(97642);async function C(e,t){let{key:n,version:r,debounceInterval:a=2e3,saveOnUnload:i,migrations:o=[]}=t,l=async t=>{if((0,S.u)()){console.log("Skipping persistence because it is disabled");return}"onPersist"in e&&"function"==typeof e.onPersist&&e.onPersist(),await j({snapshot:t,key:n,version:r})},c=(0,d.Z)(l,a);(0,s.cfB)(e,c),i&&window.addEventListener("beforeunload",()=>{if((0,S.u)()){console.log("Skipping persistence because it is disabled");return}c.cancel(),l((0,s.vMv)(e))});let u=await M({key:n,version:r,migrations:o});u&&(0,s.Xx3)(e,u)}async function M(e){let{key:t,version:n,migrations:r}=e;return await k({key:t,version:n})||await z({migrations:r,key:t,version:n})}async function z(e){let{migrations:t,key:n,version:r}=e,a=t.find(e=>e.to===r);if(!a)return null;let i=await k({key:n,version:a.from});if(i)try{return a.migrate(i)}catch(e){(0,u.Tb)(e)}return null}var B=n(15608);async function I(){c.k.info("Setting up root store...");let e=new B.M({});return console.time("Loading stores"),await C(e.preferenceStore,m),await C(e.userStore,g),await C(e.graphStore,p),await C(e.credentialStore,x),await C(e.changeStore,b),await C(e.uiStateStore,w),await C(e.taskFilterStore,y),await C(e.notesMapFilterStore,v),console.timeEnd("Loading stores"),(0,s.m83)(e)||(0,s.v5r)(e),e}(0,s.QbW)({modelIdGenerator:o.O}),l.j.setup(a());let E=(0,i.Z)(I)},13727:function(e,t,n){n.r(t),n.d(t,{CleanBlankNotes:function(){return w}});var r=n(11527),a=n(3073),i=n(50959),s=n(62107),o=n(34209),l=n(13402),c=n(29995),d=n(17554);function u(e,t,n){return 0===t||0===n||t>=n?null:function(e){let t=Math.round(e/1e3);if(t<=0)return"0s";let n=Math.floor(t/3600),r=Math.floor(t%3600/60),a=t%60;return n>0?"".concat(n,"h ").concat(r,"m ").concat(a,"s"):r>0?"".concat(r,"m ").concat(a,"s"):"".concat(a,"s")}((Date.now()-e)/t*(n-t))}var f=n(67782),h=n(31229);async function m(e,t){t("Starting backup download...");try{return await (0,h.aT)(e,"json"),t("✅ Backup downloaded successfully! You can now start scanning."),!0}catch(e){return t("❌ Backup download failed: ".concat(e)),console.error("Backup download failed",e),!1}}async function g(e,t){return!!e.isBlank&&0===(await t.noteBacklinkStore.getIncomingBacklinkNoteIds(e.id)).length}function p(e){return e.subject&&e.subject.trim().length>0?e.subject:"(no subject)"}async function x(e,t,n){t("Starting scan...");let r=e.noteStore,a=r.regularBlankNotesQuery.orderBy("id","asc"),i=await r.table.getCount(a);t("Found ".concat(i," blank-body notes to check for incoming backlinks"));let s=[],o=Math.ceil(i/500),l=0;for(let c=0;c<o;c++){let o=500*c;for(let c of(await r.table.fetch(a.limit(500).offset(o)))){let a=await r.findById(c.id);a&&await g(a,e)&&(s.push(a),t('  Found empty note: "'.concat(p(a),'" (ID: ').concat(a.id,")"))),n({totalCount:i,scannedCount:++l})}await (0,f.P)()}return t("Scan complete! Found ".concat(s.length," redundant notes.")),s}async function b(e,t,n,r){n("Preparing to move ".concat(t.size," notes to trash..."));let a=e.noteStore,i=[];for(let e of t){let t=await a.findById(e);t&&i.push(t)}if(0===i.length)return n("  Nothing to trash."),0;n("Moving ".concat(i.length," notes to trash..."));let s=Math.ceil(i.length/500),o=0;for(let e=0;e<s;e++){let t=500*e,s=Math.min(t+500,i.length),l=i.slice(t,s);await a.deleteNotes(l),r(o+=l.length),n("  Moved ".concat(o,"/").concat(i.length," notes to trash")),await (0,f.P)()}return n("✅ Complete! All selected notes have been moved to trash."),i.length}function w(e){let{graphId:t}=e,n=(0,a.useRouter)(),f=(0,i.useRef)(null),[h,g]=(0,i.useState)("initial"),[w,y]=(0,i.useState)(),[v,k]=(0,i.useState)(!1),[j,N]=(0,i.useState)([]),[S,C]=(0,i.useState)(0),[M,z]=(0,i.useState)(0),[B,I]=(0,i.useState)(0),[E,D]=(0,i.useState)(0),[L,F]=(0,i.useState)(new Set),[T,_]=(0,i.useState)(0),[P,O]=(0,i.useState)([]);(0,i.useEffect)(()=>
1{(0,o.k)().then(y)},[]);let Z=e=>{O(t=>[...t,e]),setTimeout(()=>{f.current&&(f.current.scrollTop=f.current.scrollHeight)},1)},R=(0,i.useMemo)(()=>t&&(null==w?void 0:w.graphStore.findById(t)),[t,w]),X=(0,i.useMemo)(()=>[...j].sort((e,t)=>(e.subject||"").localeCompare(t.subject||"")),[j]),Q=async()=>{R&&(k(!1),g("downloading-backup"),await m(R,Z)&&k(!0),g("initial"))},q=async()=>{if(R){g("scanning"),N([]),C(0),z(0),F(new Set),I(Date.now());try{let e=await x(R,Z,e=>{let{totalCount:t,scannedCount:n}=e;z(t),C(n)});if(0===e.length){C(0),z(0),N([]),g("initial");return}N(e),g("review")}catch(e){Z("❌ Scan failed: ".concat(e)),console.error("Scan failed",e),C(0),z(0),N([]),g("initial")}}},A=async()=>{if(R&&0!==L.size){g("trashing"),_(0),D(Date.now());try{let e=await b(R,L,Z,e=>_(e));if(0===e){g("review");return}N([]),F(new Set),g("complete")}catch(e){Z("❌ Trash failed: ".concat(e)),console.error("Trash failed",e),g("review")}}},H=(e,t)=>{let n=new Set(L);t?n.add(e):n.delete(e),F(n)};if(!w)return null;if(w.userNeedsAuth)return(0,r.jsx)("a",{href:"/auth?redirect=back",children:"Log in first"});let W=M>0?Math.round(S/M*100):0,G=L.size>0?Math.round(T/L.size*100):0,J="scanning"===h?u(B,S,M):null,U="trashing"===h?u(E,T,L.size):null;return(0,r.jsx)("main",{className:"overflow-hidden",children:(0,r.jsx)(s.LD,{value:w,children:(0,r.jsx)(d.Q2,{children:(0,r.jsx)("div",{className:"flex h-screen flex-row items-center justify-center bg-gray-50 text-black",children:(0,r.jsxs)("div",{className:"min-w-[70%] space-y-4 rounded-md bg-white p-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("h2",{className:"text-xl font-semibold",children:"Clean Empty Notes"}),R&&(0,r.jsx)(l.zx,{onClick:()=>n.push("/g/".concat(R.id)),children:"Back to app"})]}),(0,r.jsx)("textarea",{ref:f,value:P.join(""),className:"block min-h-[300px] w-full rounded border bg-gray-50 p-2 font-mono text-sm text-gray-900",readOnly:!0,"aria-label":"Operation log"}),"scanning"===h&&(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"text-sm text-gray-600",children:["Scan progress: ",S,"/",M," (",W,"%)"]}),J&&(0,r.jsxs)("div",{className:"text-sm text-gray-500",children:["Estimated time remaining: ",J]}),(0,r.jsx)("div",{role:"progressbar","aria-valuenow":W,"aria-valuemin":0,"aria-valuemax":100,className:"h-2 w-full overflow-hidden rounded-full bg-gray-200",children:(0,r.jsx)("div",{className:"h-full bg-blue-500 transition-all duration-300",style:{width:"".concat(W,"%")}})})]}),"trashing"===h&&(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"text-sm text-gray-600",children:["Trash progress: ",T,"/",L.size," (",G,"%)"]}),U&&(0,r.jsxs)("div",{className:"text-sm text-gray-500",children:["Estimated time remaining: ",U]}),(0,r.jsx)("div",{role:"progressbar","aria-valuenow":G,"aria-valuemin":0,"aria-valuemax":100,className:"h-2 w-full overflow-hidden rounded-full bg-gray-200",children:(0,r.jsx)("div",{className:"h-full bg-blue-500 transition-all duration-300",style:{width:"".concat(G,"%")}})})]}),"review"===h&&j.length>0&&R&&(0,r.jsxs)("div",{className:"max-h-[400px] overflow-y-auto rounded border",children:[(0,r.jsxs)("div",{className:"sticky top-0 z-10 flex items-center space-x-2 border-b bg-white p-2",children:[(0,r.jsx)(c.X,{checked:j.every(e=>L.has(e.id)),onChange:e=>{e?F(new Set(j.map(e=>e.id))):F(new Set)}}),(0,r.jsxs)("span",{className:"font-semibold",children:["Select all (",L.size,"/",j.length,")"]})]}),(0,r.jsx)("div",{className:"space-y-1 p-2",children:X.map(e=>(0,r.jsxs)("div",{className:"flex items-center space-x-2 rounded p-2 hover:bg-gray-50",children:[(0,r.jsx)(c.X,{checked:L.has(e.id),onChange:t=>H(e.id,t)}),(0,r.jsx)("a",{className:"flex-1 truncate text-blue-500 hover:underline",href:"/g/".concat(R.id,"/").concat(e.id),target:"_blank",rel:"noopener noreferrer",children:p(e)}),(0,r.jsx)("span",{className:"text-xs text-gray-400",children:e.id})]},e.id))})]}),(0,r.jsxs)("footer",{className:"flex items-center justify-end space-x-4",children:["initial"===h&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(l.zx,{onClick:Q,children:v?"Re-download Backup":"Download Backup (Required)"}),(0,r.jsx)(l.zx,{onClick:q,disabled:!v||!R,children:"Start Scan"})]}),"review"===h&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("span",{className:"text-sm text-gray-600",children:["Selected ",L.size," notes"]}),(0,r.jsx)(l.zx,{onClick:A,disabled:0===L.size,children:"Move to Trash"})]}),"complete"===h&&(0,r.jsx)(l.zx,{onClick:()=>{g("initial"),k(!1),O([]),N([]),F(new Set),C(0),z(0),I(0),_(0),D(0)},children:"Done"}),("scanning"===h||"trashing"===h||"downloading-backup"===h)&&(0,r.jsx)("span",{className:"text-sm text-gray-600",children:"Processing..."})]})]})})})})})}},43917:function(e,t,n){n.d(t,{m:function(){return i}});var r=n(11527),a=n(4814);n(50959);let i=e=>{let{onClick:t,disabled:n,className:i="",small:s=!1,type:o="button",children:l}=e;return(0,r.jsx)("span",{className:"inline-flex",children:(0,r.jsx)("button",{onClick:t,type:o,disabled:n,className:(0,a.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,n){n.d(t,{zx:function(){return i},mI:function(){return s.m},KM:function(){return i}});var r=n(11527),a=n(4814);n(50959);let i=e=>{let{onClick:t,type:n="button",className:i="",children:s,disabled:o}=e;return(0,r.jsx)("button",{onClick:t,type:n,disabled:o,className:(0,a.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=n(43917);n(74014)},74014:function(e,t,n){n.d(t,{M:function(){return i}});var r=n(11527),a=n(4814);n(50959);let i=e=>{let{label:t="Submit",loadingLabel:n="Loading...",loading:i=!1,onClick:s,disabled:o,className:l}=e;return(0,r.jsx)("span",{className:"flex w-full rounded-md shadow-sm",children:(0,r.jsxs)("button",{type:"submit",onClick:s,disabled:i||o,className:(0,a.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||o)&&"cursor-auto opacity-50",l),children:[i&&(0,r.jsx)(r.Fragment,{children:(0,r.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,r.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,r.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,r.jsx)("span",{children:i?n:t})]})})}},29995:function(e,t,n){n.d(t,{X:function(){return i}});var r=n(11527),a=n(4814);n(50959);let i=e=>
1{let{checked:t,disabled:n,variant:i="square",onChange:s,onClick:o}=e;return(0,r.jsx)("input",{type:"checkbox",onChange:e=>null==s?void 0:s(e.target.checked),onClick:o,checked:!!t,disabled:n,readOnly:!0,className:(0,a.Z)("note-checkbox form-checkbox relative h-4 w-4 cursor-pointer border-gray-300 text-indigo-600 transition duration-100 hover:scale-105 focus:outline-none focus:ring focus:ring-indigo-500 focus:ring-offset-secondary active:scale-95",t?"border-indigo-600":"dark:border-gray-700",!t&&"dark:bg-gray-900","round"===i?"rounded-full":"rounded")})}},17554:function(e,t,n){n.d(t,{Q2:function(){return u},Fg:function(){return d}});var r=n(11527),a=n(4814),i=n(72811);n(50959);var s=n(63320),o=n(44301),l=n(62107),c=n(85795);function d(){let e=(0,c.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:n}=e,i=d();return(0,r.jsx)("div",{ref:t,className:(0,a.Z)(["app-theme","dark"===i?"dark":"light",(0,o.d)()&&"electron",(0,s.W)()&&"capacitor",(0,o.qx)()&&"iphone",(0,o.HM)()&&"ipad","select-none antialiased"]),style:{colorScheme:i},children:(0,r.jsx)("div",{className:"bg-background-stark font-sans text-coolgray-900 dark:text-near-white",children:n})})},{forwardRef:!0});u.displayName="Theme"},85795:function(e,t,n){n.d(t,{XU:function(){return s},nd:function(){return o},tv:function(){return i}});var r=n(50959);let a="function"==typeof window.matchMedia;function i(){var e;let t=a?window.matchMedia("(prefers-color-scheme: dark)"):{matches:!1},[n,i]=(0,r.useState)(t.matches?"dark":"light");return e=()=>{i(t.matches?"dark":"light")},(0,r.useEffect)(()=>{if(a){let t=window.matchMedia("(prefers-color-scheme: dark)");return s(t,e),()=>{o(t,e)}}},[a]),n}function s(e,t){e.addEventListener?e.addEventListener("change",e=>{t(e)}):e.addListener(e=>{t(e)})}function o(e,t){e.removeEventListener?e.removeEventListener("change",t):e.removeListener(t)}},97642:function(e,t,n){n.d(t,{d:function(){return a},u:function(){return i}});let r=!1;function a(){r=!0}function i(){return r}}}]);

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.