wiki-viewer 3.1.0 → 3.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/build-manifest.json +3 -3
  3. package/.next/standalone/.next/prerender-manifest.json +3 -3
  4. package/.next/standalone/.next/required-server-files.json +1 -1
  5. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  6. package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
  7. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  8. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  9. package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  10. package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  11. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  12. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  13. package/.next/standalone/.next/server/app/api/agent/activity/route.js.nft.json +1 -1
  14. package/.next/standalone/.next/server/app/api/agent/events/[...path]/route.js.nft.json +1 -1
  15. package/.next/standalone/.next/server/app/api/agent/files/[...path]/route.js.nft.json +1 -1
  16. package/.next/standalone/.next/server/app/api/agent/fs/file/[...path]/route.js.nft.json +1 -1
  17. package/.next/standalone/.next/server/app/api/agent/fs/ls/[[...path]]/route.js.nft.json +1 -1
  18. package/.next/standalone/.next/server/app/api/agent/fs/move/route.js.nft.json +1 -1
  19. package/.next/standalone/.next/server/app/api/agent/fs/search/route.js.nft.json +1 -1
  20. package/.next/standalone/.next/server/app/api/agent/settings/route.js.nft.json +1 -1
  21. package/.next/standalone/.next/server/app/api/agent/sidecar/[...path]/route.js.nft.json +1 -1
  22. package/.next/standalone/.next/server/app/api/app-proxy/[...path]/route.js +9 -8
  23. package/.next/standalone/.next/server/app/api/app-proxy/[...path]/route.js.nft.json +1 -1
  24. package/.next/standalone/.next/server/app/api/assets/[...path]/route.js.nft.json +1 -1
  25. package/.next/standalone/.next/server/app/api/pdf/save/route.js.nft.json +1 -1
  26. package/.next/standalone/.next/server/app/api/share/[token]/asset/route.js.nft.json +1 -1
  27. package/.next/standalone/.next/server/app/api/share/[token]/route.js.nft.json +1 -1
  28. package/.next/standalone/.next/server/app/api/share/route.js.nft.json +1 -1
  29. package/.next/standalone/.next/server/app/api/system/reveal/route.js.nft.json +1 -1
  30. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/branch/route.js.nft.json +1 -1
  31. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/open/route.js.nft.json +1 -1
  32. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/refresh/route.js.nft.json +1 -1
  33. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/route.js.nft.json +1 -1
  34. package/.next/standalone/.next/server/app/api/system/workspaces/route.js.nft.json +1 -1
  35. package/.next/standalone/.next/server/app/api/upload/[...path]/route.js.nft.json +1 -1
  36. package/.next/standalone/.next/server/app/api/wiki/app/route.js +4 -3
  37. package/.next/standalone/.next/server/app/api/wiki/app/route.js.nft.json +1 -1
  38. package/.next/standalone/.next/server/app/api/wiki/backlinks/route.js.nft.json +1 -1
  39. package/.next/standalone/.next/server/app/api/wiki/content/route.js.nft.json +1 -1
  40. package/.next/standalone/.next/server/app/api/wiki/download/route.js.nft.json +1 -1
  41. package/.next/standalone/.next/server/app/api/wiki/folder/route.js.nft.json +1 -1
  42. package/.next/standalone/.next/server/app/api/wiki/git-branches/route.js.nft.json +1 -1
  43. package/.next/standalone/.next/server/app/api/wiki/git-checkout/route.js.nft.json +1 -1
  44. package/.next/standalone/.next/server/app/api/wiki/git-diff/route.js.nft.json +1 -1
  45. package/.next/standalone/.next/server/app/api/wiki/git-file-info/route.js.nft.json +1 -1
  46. package/.next/standalone/.next/server/app/api/wiki/git-history/route.js.nft.json +1 -1
  47. package/.next/standalone/.next/server/app/api/wiki/git-pull/route.js.nft.json +1 -1
  48. package/.next/standalone/.next/server/app/api/wiki/hosted-apps/[slug]/route.js +5 -4
  49. package/.next/standalone/.next/server/app/api/wiki/hosted-apps/[slug]/route.js.nft.json +1 -1
  50. package/.next/standalone/.next/server/app/api/wiki/hosted-apps/route.js +5 -4
  51. package/.next/standalone/.next/server/app/api/wiki/hosted-apps/route.js.nft.json +1 -1
  52. package/.next/standalone/.next/server/app/api/wiki/move/route.js.nft.json +1 -1
  53. package/.next/standalone/.next/server/app/api/wiki/new-file/route.js.nft.json +1 -1
  54. package/.next/standalone/.next/server/app/api/wiki/outlinks/route.js.nft.json +1 -1
  55. package/.next/standalone/.next/server/app/api/wiki/page/route.js.nft.json +1 -1
  56. package/.next/standalone/.next/server/app/api/wiki/presence/route.js.nft.json +1 -1
  57. package/.next/standalone/.next/server/app/api/wiki/preview-token/route.js.nft.json +1 -1
  58. package/.next/standalone/.next/server/app/api/wiki/route.js.nft.json +1 -1
  59. package/.next/standalone/.next/server/app/api/wiki/scratch/route.js.nft.json +1 -1
  60. package/.next/standalone/.next/server/app/api/wiki/search/route.js.nft.json +1 -1
  61. package/.next/standalone/.next/server/app/api/wiki/slugs/route.js.nft.json +1 -1
  62. package/.next/standalone/.next/server/app/api/wiki/upload/route.js.nft.json +1 -1
  63. package/.next/standalone/.next/server/app/api/wiki/watch/route.js.nft.json +1 -1
  64. package/.next/standalone/.next/server/app/app/[slug]/[[...rest]]/route.js +5 -4
  65. package/.next/standalone/.next/server/app/app/[slug]/[[...rest]]/route.js.nft.json +1 -1
  66. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  67. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  68. package/.next/standalone/.next/server/app/s/[token]/page_client-reference-manifest.js +1 -1
  69. package/.next/standalone/.next/server/app/signin/page_client-reference-manifest.js +1 -1
  70. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0-eaqv1._.js +4 -0
  71. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0.fl467._.js +1 -1
  72. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0cqahds._.js +1 -1
  73. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0d619fd._.js +3 -0
  74. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0f.q.gf._.js +1 -1
  75. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0fc05ki._.js +1 -1
  76. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0fkfkc.._.js +1 -1
  77. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0skgiv0._.js +3 -0
  78. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0tuu3y1._.js +1 -1
  79. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0z5f4h8._.js +3 -0
  80. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0~-~tiv._.js +3 -0
  81. package/.next/standalone/.next/server/chunks/[root-of-the-server]__11ltgmp._.js +1 -1
  82. package/.next/standalone/.next/server/chunks/[root-of-the-server]__12g8s_j._.js +1 -1
  83. package/.next/standalone/.next/server/chunks/[root-of-the-server]__12xtht5._.js +3 -0
  84. package/.next/standalone/.next/server/chunks/ssr/{0~w0_katex_dist_katex_mjs_004-6gg._.js → 0~w0_katex_dist_katex_mjs_0q62ivk._.js} +1 -1
  85. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0zzulxc._.js → [root-of-the-server]__01rzr4_._.js} +2 -2
  86. package/.next/standalone/.next/server/chunks/ssr/_0_j0j3f._.js +2 -2
  87. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0n-3pyt._.js → node_modules__pnpm_02ffwq1._.js} +1 -1
  88. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_10a8956._.js → node_modules__pnpm_050~9nq._.js} +2 -2
  89. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0b9bnj1._.js → node_modules__pnpm_08m7m-a._.js} +1 -1
  90. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_07i6nnw._.js → node_modules__pnpm_0_.yify._.js} +2 -2
  91. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0rwoobw._.js → node_modules__pnpm_0aqjih7._.js} +1 -1
  92. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0zzmyff._.js → node_modules__pnpm_0d49_zw._.js} +1 -1
  93. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_01szzw7._.js → node_modules__pnpm_0dp1x47._.js} +1 -1
  94. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0ov8khx._.js → node_modules__pnpm_0eorjeh._.js} +1 -1
  95. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0zmfyg1._.js → node_modules__pnpm_0gsozg1._.js} +1 -1
  96. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0kwshwu._.js → node_modules__pnpm_0i4r.y0._.js} +1 -1
  97. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0g4ogpv._.js → node_modules__pnpm_0ibur64._.js} +2 -2
  98. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_051n.bu._.js → node_modules__pnpm_0m241jl._.js} +1 -1
  99. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_06txdm6._.js → node_modules__pnpm_0mempoh._.js} +1 -1
  100. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0c1zkc8._.js → node_modules__pnpm_0ourokm._.js} +1 -1
  101. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0stxmvb._.js → node_modules__pnpm_0r.tt1v._.js} +2 -2
  102. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_12i_666._.js → node_modules__pnpm_0raxwvs._.js} +2 -2
  103. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0wsap-p._.js → node_modules__pnpm_0t4fzpm._.js} +1 -1
  104. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_098x-sh._.js → node_modules__pnpm_0tfz13_._.js} +1 -1
  105. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_12lszjz._.js → node_modules__pnpm_0u3pcuw._.js} +1 -1
  106. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0yv85cb._.js → node_modules__pnpm_0um58j1._.js} +1 -1
  107. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0d9rl81._.js → node_modules__pnpm_0uuq018._.js} +1 -1
  108. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0m~epyq._.js → node_modules__pnpm_0w9yy9l._.js} +1 -1
  109. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0799nrj._.js → node_modules__pnpm_0whqcle._.js} +1 -1
  110. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_02sz98s._.js → node_modules__pnpm_0zf4hna._.js} +1 -1
  111. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0336q.m._.js → node_modules__pnpm_0~ifp4a._.js} +2 -2
  112. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0whug6y._.js → node_modules__pnpm_10j.ii0._.js} +2 -2
  113. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0p~s2t8._.js → node_modules__pnpm_13xyy7r._.js} +1 -1
  114. package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
  115. package/.next/standalone/.next/server/pages/500.html +1 -1
  116. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  117. package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
  118. package/.next/standalone/.next/static/chunks/{06t6t8alcyt6t.js → 0cz0xzb~lms_9.js} +2 -2
  119. package/.next/standalone/.next/static/chunks/{12-umagms5yro.css → 0~~v9pq1icp09.css} +15 -15
  120. package/.next/standalone/package.json +1 -1
  121. package/.next/standalone/server.js +1 -1
  122. package/bin/shared/ssh-target.js +3 -1
  123. package/package.json +1 -1
  124. package/.next/standalone/.next/server/chunks/[root-of-the-server]__02ovz0q._.js +0 -4
  125. package/.next/standalone/.next/server/chunks/[root-of-the-server]__07757zz._.js +0 -4
  126. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0pftyle._.js +0 -4
  127. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0qwikxp._.js +0 -4
  128. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0~q~4xc._.js +0 -4
  129. /package/.next/standalone/.next/static/{VYZLLvwqLcFG8USaPLlzQ → nfXY6poENgSEOPczB4Z-L}/_buildManifest.js +0 -0
  130. /package/.next/standalone/.next/static/{VYZLLvwqLcFG8USaPLlzQ → nfXY6poENgSEOPczB4Z-L}/_clientMiddlewareManifest.js +0 -0
  131. /package/.next/standalone/.next/static/{VYZLLvwqLcFG8USaPLlzQ → nfXY6poENgSEOPczB4Z-L}/_ssgManifest.js +0 -0
@@ -1,4 +1,4 @@
1
- module.exports=[874533,(e,t,r)=>{t.exports=e.x("node:child_process",()=>require("node:child_process"))},812057,(e,t,r)=>{t.exports=e.x("node:util",()=>require("node:util"))},256294,296555,e=>{"use strict";let t;var r=e.i(874533),s=e.i(812057),a=e.i(912714),i=e.i(750227),n=e.i(660526);e.i(902157);let o=RegExp("[;|&$`<>(){}\\n\\r\\0]");function l(e){let{target:t,mountpoint:r,port:s}=e,a=t.user?`${t.user}@`:"",i=[`${a}${t.host}:${t.remotePath}`,r];s&&Number.isInteger(Number(s))&&Number(s)>0&&65536>Number(s)&&i.push("-p",String(s));let n=e.authMethod??"agent";!e.authMethod&&(null!=e.password?n="password":e.keyPath&&(n="keyfile"));let o=["reconnect","ServerAliveInterval=15","ServerAliveCountMax=3","compression=yes","cache=yes","kernel_cache","StrictHostKeyChecking=accept-new","BatchMode=yes"];if(e.readOnly&&o.push("ro"),"keyfile"===n&&e.keyPath&&(o.push(`IdentityFile=${e.keyPath}`),o.push("IdentitiesOnly=yes")),"password"===n){let e=o.indexOf("BatchMode=yes");e>=0&&o.splice(e,1),o.push("password_stdin"),o.push("PreferredAuthentications=password,keyboard-interactive"),o.push("PubkeyAuthentication=no"),o.push("NumberOfPasswordPrompts=1")}return e.extraOptions&&o.push(...e.extraOptions),i.push("-o",o.join(",")),i}e.s(["buildSshfsArgs",0,l,"isValidKeyPath",0,function(e){return!(!e||o.test(e)||e.includes(".."))&&(e.startsWith("/")||e.startsWith("~/"))},"parseSshTarget",0,function(e){let t;if(!e||o.test(e))return null;let r=e.trim(),s=r.indexOf(":");if(s<=0)return null;let a=r.slice(0,s),i=r.slice(s+1);if(!i.startsWith("/")||i.includes(".."))return null;let n=a,l=a.indexOf("@");return l>=0&&(t=a.slice(0,l),n=a.slice(l+1),!t)?null:n&&/^[a-zA-Z0-9.\-]+$/.test(n)&&(!t||/^[a-zA-Z0-9._\-]+$/.test(t))?{user:t,host:n,remotePath:i}:null}],296555);let u=(0,s.promisify)(r.execFile);function c(){return i.default.join(n.default.homedir(),".wiki-viewer","mounts")}async function d(){if(!0!==t)try{await u("sshfs",["--version"]),t=!0}catch{throw Error("sshfs binary not found. Install sshfs + FUSE (e.g. `apt install sshfs`, `brew install macfuse sshfs`) and ensure it is on PATH.")}}async function p(t){var r;let s=i.default.resolve(t),n=!1;try{n=(await (0,a.readFile)("/proc/mounts","utf8")).split("\n").some(e=>{let t=e.split(" ");return t[1]===s&&/fuse/.test(t[2]??"")})}catch{n=!1}return!!n&&(r=s,new Promise(t=>{let s=!1,a=setTimeout(()=>{s||(s=!0,t(!1))},4e3);e.A(687903).then(({readdir:e})=>e(r)).then(()=>{s||(s=!0,clearTimeout(a),t(!0))}).catch(()=>{s||(s=!0,clearTimeout(a),t(!1))})}))}async function h(e){await d(),await (0,a.mkdir)(e.mountpoint,{recursive:!0});let t=l(e);if(await new Promise((s,a)=>{let i=(0,r.spawn)("sshfs",t,{stdio:["pipe","ignore","pipe"]}),n="",o=setTimeout(()=>{i.kill("SIGKILL"),a(Error("sshfs mount timed out after 25s."))},25e3);i.stderr?.on("data",e=>{n+=e.toString()}),i.on("error",e=>{clearTimeout(o),a(e.message.includes("ENOENT")?Error("sshfs binary not found on PATH."):e)}),i.on("close",e=>{clearTimeout(o),0===e?s():a(Error(`sshfs exited ${e}: ${n.trim()||"mount failed"}`))}),"password"===e.authMethod&&i.stdin?.write((e.password??"")+"\n"),i.stdin?.end()}),!await p(e.mountpoint))throw Error("sshfs reported success but the mount is not live.")}async function f(e){let t=i.default.resolve(e);for(let[e,r]of[["fusermount",["-u","-z",t]],["umount",[t]]])try{await u(e,r);break}catch{}try{await (0,a.rmdir)(t)}catch{}}e.s(["assertSshfsAvailable",0,d,"isMounted",0,p,"mountSshfs",0,h,"mountpointFor",0,function(e){return i.default.join(c(),e)},"mountsDir",0,c,"unmountSshfs",0,f],256294)},536654,e=>{"use strict";var t=e.i(912714),r=e.i(750227);function s(e){return!!(r.default.isAbsolute(e)||".."===e||e.startsWith(".."+r.default.sep)||e.startsWith("../"))}async function a(e,i,n={}){let o;if(!e)return null;let l=function(e){if(e.includes("\0")||r.default.isAbsolute(e))return null;let t=e.replace(/\\/g,"/");return(("."===(t=r.default.posix.normalize(t))||"./"===t)&&(t=""),".."===t||t.startsWith("../")||/^[a-zA-Z]:\//.test(t)||t.startsWith("/"))?null:t}(i);if(null===l)return null;if(n.deniedSegments?.length){for(let e of l.split("/").filter(Boolean))if(n.deniedSegments.includes(e))return null}try{o=await (0,t.realpath)(e)}catch{return null}let u=l?r.default.join(o,l):o;try{let e=await (0,t.realpath)(u),a=r.default.relative(o,e);if(s(a))return null;return{relPath:l,absolutePath:e}}catch{if(!n.allowMissing)return null;let e=u;for(;;){let a=r.default.dirname(e);if(a===e)break;try{let e=await (0,t.realpath)(a),i=r.default.relative(o,e);if(s(i))return null;return{relPath:l,absolutePath:u}}catch{e=a}}return null}}e.s(["resolveWorkspacePath",0,a])},848475,e=>{"use strict";var t=e.i(750227);let r={".md":"text/markdown; charset=utf-8",".markdown":"text/markdown; charset=utf-8",".mdx":"text/markdown; charset=utf-8",".txt":"text/plain; charset=utf-8",".json":"application/json; charset=utf-8",".jsonc":"application/json; charset=utf-8",".ts":"text/typescript; charset=utf-8",".tsx":"text/typescript; charset=utf-8",".mts":"text/typescript; charset=utf-8",".js":"text/javascript; charset=utf-8",".jsx":"text/javascript; charset=utf-8",".mjs":"text/javascript; charset=utf-8",".html":"text/html; charset=utf-8",".htm":"text/html; charset=utf-8",".css":"text/css; charset=utf-8",".yaml":"text/yaml; charset=utf-8",".yml":"text/yaml; charset=utf-8",".toml":"text/toml; charset=utf-8",".xml":"application/xml; charset=utf-8",".svg":"image/svg+xml",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".ico":"image/x-icon",".bmp":"image/bmp",".pdf":"application/pdf",".zip":"application/zip",".tar":"application/x-tar",".gz":"application/gzip",".py":"text/x-python; charset=utf-8",".rs":"text/x-rustsrc; charset=utf-8",".go":"text/x-go; charset=utf-8",".sh":"text/x-shellscript; charset=utf-8",".csv":"text/csv; charset=utf-8",".tsv":"text/tab-separated-values; charset=utf-8",".env":"text/plain; charset=utf-8",".log":"text/plain; charset=utf-8",".ini":"text/plain; charset=utf-8",".conf":"text/plain; charset=utf-8",".mmd":"text/plain; charset=utf-8",".ipynb":"application/json; charset=utf-8",".docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document",".xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",".pptx":"application/vnd.openxmlformats-officedocument.presentationml.presentation",".doc":"application/msword",".xls":"application/vnd.ms-excel",".ppt":"application/vnd.ms-powerpoint",".mp4":"video/mp4",".webm":"video/webm",".mov":"video/quicktime",".m4v":"video/mp4",".mp3":"audio/mpeg",".wav":"audio/wav",".ogg":"audio/ogg",".m4a":"audio/mp4",".aac":"audio/aac"};e.s(["contentTypeForPath",0,function(e){return r[t.default.extname(e).toLowerCase()]??"application/octet-stream"}])},719126,e=>{"use strict";var t=e.i(666680),r=e.i(912714),s=e.i(750227),a=e.i(716234),i=e.i(536654),n=e.i(848475);async function o(e,t){if(!e)return null;let r=await (0,i.resolveWorkspacePath)(e,t,{allowMissing:!0,deniedSegments:a.DENIED_SEGMENTS});return r?.absolutePath??null}async function l(e,t){let s=420;try{let t=await (0,r.stat)(e);s=511&t.mode}catch{}let a=e+".~"+process.pid+"."+Date.now()+".tmp",i=await (0,r.open)(a,"w",s);try{await i.write(t),await i.datasync()}finally{await i.close()}await (0,r.rename)(a,e)}async function u(e,t){let a=s.default.dirname(e);if(t)return await (0,r.mkdir)(a,{recursive:!0}),!0;try{return await (0,r.stat)(a),!0}catch{return!1}}e.s(["atomicWrite",0,l,"ensureParentDir",0,u,"extractShaHex",0,function(e){return e.replace(/^"/,"").replace(/"$/,"").replace(/^sha256:/,"")},"isDeniedRelPath",0,function(e){let t=e.replace(/\\/g,"/");return a.DENIED_SEGMENTS.some(e=>t===e||t.startsWith(e+"/"))},"isMarkdown",0,function(e){return e.endsWith(".md")||e.endsWith(".markdown")},"looksLikeBinary",0,function(e){return e.slice(0,Math.min(e.length,8192)).includes(0)},"mimeByExt",0,function(e){return(0,n.contentTypeForPath)(e)},"safeAbsPath",0,o,"sha256ofBuf",0,function(e){return"sha256:"+(0,t.createHash)("sha256").update(e).digest("hex")}])},487018,e=>{"use strict";var t=e.x("node:sqlite",()=>require("node:sqlite"),!0);function r(e){return 1===e.length&&Array.isArray(e[0])?e[0]:e}class s{stmt;constructor(e){this.stmt=e}get reader(){return this.stmt.columns().length>0}all(...e){let t=r(e);return this.stmt.all(...t)}get(...e){let t=r(e);return this.stmt.get(...t)}run(...e){let t=r(e),s=this.stmt.run(...t);return{changes:Number(s.changes),lastInsertRowid:Number(s.lastInsertRowid)}}iterate(...e){let t=r(e);return this.stmt.iterate(...t)}}class a{db;constructor(e){this.db=new t.DatabaseSync(e),this.db.exec("PRAGMA busy_timeout = 5000"),this.db.exec("PRAGMA journal_mode = WAL")}prepare(e){return new s(this.db.prepare(e))}exec(e){this.db.exec(e)}close(){this.db.close()}pragma(e){this.db.exec(`PRAGMA ${e}`)}}e.s(["default",()=>a])},97082,e=>{"use strict";var t=e.i(487018),r=e.i(750227),s=e.i(660526),a=e.i(902157),i=e.i(666680);let n=null;function o(){var e;if(n)return n;let i=r.default.join(process.env.HOME??s.default.homedir(),".wiki-viewer");return(0,a.mkdirSync)(i,{recursive:!0}),(n=new t.default(r.default.join(i,"shared.db"))).pragma("journal_mode = WAL"),n.pragma("synchronous = NORMAL"),n.exec(`
1
+ module.exports=[874533,(e,t,r)=>{t.exports=e.x("node:child_process",()=>require("node:child_process"))},812057,(e,t,r)=>{t.exports=e.x("node:util",()=>require("node:util"))},256294,296555,e=>{"use strict";let t;var r=e.i(874533),s=e.i(812057),a=e.i(912714),i=e.i(750227),n=e.i(660526);e.i(902157);let o=RegExp("[;|&$`<>(){}\\n\\r\\0]");function l(e){let{target:t,mountpoint:r,port:s}=e,a=t.user?`${t.user}@`:"",i=[`${a}${t.host}:${t.remotePath}`,r];s&&Number.isInteger(Number(s))&&Number(s)>0&&65536>Number(s)&&i.push("-p",String(s));let n=e.authMethod??"agent";!e.authMethod&&(null!=e.password?n="password":e.keyPath&&(n="keyfile"));let o=["reconnect","ServerAliveInterval=15","ServerAliveCountMax=3","compression=yes","cache=yes","StrictHostKeyChecking=accept-new","BatchMode=yes"];if(e.readOnly&&o.push("ro"),"keyfile"===n&&e.keyPath&&(o.push(`IdentityFile=${e.keyPath}`),o.push("IdentitiesOnly=yes")),"password"===n){let e=o.indexOf("BatchMode=yes");e>=0&&o.splice(e,1),o.push("password_stdin"),o.push("PreferredAuthentications=password,keyboard-interactive"),o.push("PubkeyAuthentication=no"),o.push("NumberOfPasswordPrompts=1")}return e.extraOptions&&o.push(...e.extraOptions),i.push("-o",o.join(",")),i}e.s(["buildSshfsArgs",0,l,"isValidKeyPath",0,function(e){return!(!e||o.test(e)||e.includes(".."))&&(e.startsWith("/")||e.startsWith("~/"))},"parseSshTarget",0,function(e){let t;if(!e||o.test(e))return null;let r=e.trim(),s=r.indexOf(":");if(s<=0)return null;let a=r.slice(0,s),i=r.slice(s+1);if(!i.startsWith("/")||i.includes(".."))return null;let n=a,l=a.indexOf("@");return l>=0&&(t=a.slice(0,l),n=a.slice(l+1),!t)?null:n&&/^[a-zA-Z0-9.\-]+$/.test(n)&&(!t||/^[a-zA-Z0-9._\-]+$/.test(t))?{user:t,host:n,remotePath:i}:null}],296555);let u=(0,s.promisify)(r.execFile);function c(){return i.default.join(n.default.homedir(),".wiki-viewer","mounts")}async function d(){if(!0!==t)try{await u("sshfs",["--version"]),t=!0}catch{throw Error("sshfs binary not found. Install sshfs + FUSE (e.g. `apt install sshfs`, `brew install macfuse sshfs`) and ensure it is on PATH.")}}async function p(t){var r;let s=i.default.resolve(t),n=!1;try{n=(await (0,a.readFile)("/proc/mounts","utf8")).split("\n").some(e=>{let t=e.split(" ");return t[1]===s&&/fuse/.test(t[2]??"")})}catch{n=!1}return!!n&&(r=s,new Promise(t=>{let s=!1,a=setTimeout(()=>{s||(s=!0,t(!1))},4e3);e.A(687903).then(({readdir:e})=>e(r)).then(()=>{s||(s=!0,clearTimeout(a),t(!0))}).catch(()=>{s||(s=!0,clearTimeout(a),t(!1))})}))}async function h(e){await d(),await (0,a.mkdir)(e.mountpoint,{recursive:!0});let t=l(e);if(await new Promise((s,a)=>{let i=(0,r.spawn)("sshfs",t,{stdio:["pipe","ignore","pipe"]}),n="",o=setTimeout(()=>{i.kill("SIGKILL"),a(Error("sshfs mount timed out after 25s."))},25e3);i.stderr?.on("data",e=>{n+=e.toString()}),i.on("error",e=>{clearTimeout(o),a(e.message.includes("ENOENT")?Error("sshfs binary not found on PATH."):e)}),i.on("close",e=>{clearTimeout(o),0===e?s():a(Error(`sshfs exited ${e}: ${n.trim()||"mount failed"}`))}),"password"===e.authMethod&&i.stdin?.write((e.password??"")+"\n"),i.stdin?.end()}),!await p(e.mountpoint))throw Error("sshfs reported success but the mount is not live.")}async function f(e){let t=i.default.resolve(e);for(let[e,r]of[["fusermount",["-u","-z",t]],["umount",[t]]])try{await u(e,r);break}catch{}try{await (0,a.rmdir)(t)}catch{}}e.s(["assertSshfsAvailable",0,d,"isMounted",0,p,"mountSshfs",0,h,"mountpointFor",0,function(e){return i.default.join(c(),e)},"mountsDir",0,c,"unmountSshfs",0,f],256294)},536654,e=>{"use strict";var t=e.i(912714),r=e.i(750227);function s(e){return!!(r.default.isAbsolute(e)||".."===e||e.startsWith(".."+r.default.sep)||e.startsWith("../"))}async function a(e,i,n={}){let o;if(!e)return null;let l=function(e){if(e.includes("\0")||r.default.isAbsolute(e))return null;let t=e.replace(/\\/g,"/");return(("."===(t=r.default.posix.normalize(t))||"./"===t)&&(t=""),".."===t||t.startsWith("../")||/^[a-zA-Z]:\//.test(t)||t.startsWith("/"))?null:t}(i);if(null===l)return null;if(n.deniedSegments?.length){for(let e of l.split("/").filter(Boolean))if(n.deniedSegments.includes(e))return null}try{o=await (0,t.realpath)(e)}catch{return null}let u=l?r.default.join(o,l):o;try{let e=await (0,t.realpath)(u),a=r.default.relative(o,e);if(s(a))return null;return{relPath:l,absolutePath:e}}catch{if(!n.allowMissing)return null;let e=u;for(;;){let a=r.default.dirname(e);if(a===e)break;try{let e=await (0,t.realpath)(a),i=r.default.relative(o,e);if(s(i))return null;return{relPath:l,absolutePath:u}}catch{e=a}}return null}}e.s(["resolveWorkspacePath",0,a])},848475,e=>{"use strict";var t=e.i(750227);let r={".md":"text/markdown; charset=utf-8",".markdown":"text/markdown; charset=utf-8",".mdx":"text/markdown; charset=utf-8",".txt":"text/plain; charset=utf-8",".json":"application/json; charset=utf-8",".jsonc":"application/json; charset=utf-8",".ts":"text/typescript; charset=utf-8",".tsx":"text/typescript; charset=utf-8",".mts":"text/typescript; charset=utf-8",".js":"text/javascript; charset=utf-8",".jsx":"text/javascript; charset=utf-8",".mjs":"text/javascript; charset=utf-8",".html":"text/html; charset=utf-8",".htm":"text/html; charset=utf-8",".css":"text/css; charset=utf-8",".yaml":"text/yaml; charset=utf-8",".yml":"text/yaml; charset=utf-8",".toml":"text/toml; charset=utf-8",".xml":"application/xml; charset=utf-8",".svg":"image/svg+xml",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".ico":"image/x-icon",".bmp":"image/bmp",".pdf":"application/pdf",".zip":"application/zip",".tar":"application/x-tar",".gz":"application/gzip",".py":"text/x-python; charset=utf-8",".rs":"text/x-rustsrc; charset=utf-8",".go":"text/x-go; charset=utf-8",".sh":"text/x-shellscript; charset=utf-8",".csv":"text/csv; charset=utf-8",".tsv":"text/tab-separated-values; charset=utf-8",".env":"text/plain; charset=utf-8",".log":"text/plain; charset=utf-8",".ini":"text/plain; charset=utf-8",".conf":"text/plain; charset=utf-8",".mmd":"text/plain; charset=utf-8",".ipynb":"application/json; charset=utf-8",".docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document",".xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",".pptx":"application/vnd.openxmlformats-officedocument.presentationml.presentation",".doc":"application/msword",".xls":"application/vnd.ms-excel",".ppt":"application/vnd.ms-powerpoint",".mp4":"video/mp4",".webm":"video/webm",".mov":"video/quicktime",".m4v":"video/mp4",".mp3":"audio/mpeg",".wav":"audio/wav",".ogg":"audio/ogg",".m4a":"audio/mp4",".aac":"audio/aac"};e.s(["contentTypeForPath",0,function(e){return r[t.default.extname(e).toLowerCase()]??"application/octet-stream"}])},719126,e=>{"use strict";var t=e.i(666680),r=e.i(912714),s=e.i(750227),a=e.i(716234),i=e.i(536654),n=e.i(848475);async function o(e,t){if(!e)return null;let r=await (0,i.resolveWorkspacePath)(e,t,{allowMissing:!0,deniedSegments:a.DENIED_SEGMENTS});return r?.absolutePath??null}async function l(e,t){let s=420;try{let t=await (0,r.stat)(e);s=511&t.mode}catch{}let a=e+".~"+process.pid+"."+Date.now()+".tmp",i=await (0,r.open)(a,"w",s);try{await i.write(t),await i.datasync()}finally{await i.close()}await (0,r.rename)(a,e)}async function u(e,t){let a=s.default.dirname(e);if(t)return await (0,r.mkdir)(a,{recursive:!0}),!0;try{return await (0,r.stat)(a),!0}catch{return!1}}e.s(["atomicWrite",0,l,"ensureParentDir",0,u,"extractShaHex",0,function(e){return e.replace(/^"/,"").replace(/"$/,"").replace(/^sha256:/,"")},"isDeniedRelPath",0,function(e){let t=e.replace(/\\/g,"/");return a.DENIED_SEGMENTS.some(e=>t===e||t.startsWith(e+"/"))},"isMarkdown",0,function(e){return e.endsWith(".md")||e.endsWith(".markdown")},"looksLikeBinary",0,function(e){return e.slice(0,Math.min(e.length,8192)).includes(0)},"mimeByExt",0,function(e){return(0,n.contentTypeForPath)(e)},"safeAbsPath",0,o,"sha256ofBuf",0,function(e){return"sha256:"+(0,t.createHash)("sha256").update(e).digest("hex")}])},487018,e=>{"use strict";var t=e.x("node:sqlite",()=>require("node:sqlite"),!0);function r(e){return 1===e.length&&Array.isArray(e[0])?e[0]:e}class s{stmt;constructor(e){this.stmt=e}get reader(){return this.stmt.columns().length>0}all(...e){let t=r(e);return this.stmt.all(...t)}get(...e){let t=r(e);return this.stmt.get(...t)}run(...e){let t=r(e),s=this.stmt.run(...t);return{changes:Number(s.changes),lastInsertRowid:Number(s.lastInsertRowid)}}iterate(...e){let t=r(e);return this.stmt.iterate(...t)}}class a{db;constructor(e){this.db=new t.DatabaseSync(e),this.db.exec("PRAGMA busy_timeout = 5000"),this.db.exec("PRAGMA journal_mode = WAL")}prepare(e){return new s(this.db.prepare(e))}exec(e){this.db.exec(e)}close(){this.db.close()}pragma(e){this.db.exec(`PRAGMA ${e}`)}}e.s(["default",()=>a])},97082,e=>{"use strict";var t=e.i(487018),r=e.i(750227),s=e.i(660526),a=e.i(902157),i=e.i(666680);let n=null;function o(){var e;if(n)return n;let i=r.default.join(process.env.HOME??s.default.homedir(),".wiki-viewer");return(0,a.mkdirSync)(i,{recursive:!0}),(n=new t.default(r.default.join(i,"shared.db"))).pragma("journal_mode = WAL"),n.pragma("synchronous = NORMAL"),n.exec(`
2
2
  CREATE TABLE IF NOT EXISTS shared_docs (
3
3
  id TEXT PRIMARY KEY,
4
4
  workspace_id TEXT NOT NULL,
@@ -1,3 +1,3 @@
1
- module.exports=[583627,e=>{"use strict";var t=e.i(798003),r=e.i(254226);function s(){return(process.env.WIKI_ADMIN_EMAILS??"").split(",").map(e=>e.trim().toLowerCase()).filter(Boolean)}async function i(e,r){if(r){let e=s();if(e.length>0&&e.includes(r.toLowerCase()))return!0}return((await (0,t.readConfig)()).adminUserIds??[]).includes(e)}async function n(){return(await (0,t.readConfig)()).adminUserIds??[]}async function o(e){await (0,t.updateConfig)(t=>{let r=t.adminUserIds??[];return r.includes(e)?t:{...t,adminUserIds:[...r,e]}})}async function a(e){let r=s().length>0,i=!1;if(await (0,t.updateConfig)(t=>{let s=(t.adminUserIds??[]).filter(t=>t!==e);return 0!==s.length||r?{...t,adminUserIds:s}:(i=!0,t)}),i)throw Error("LAST_ADMIN: cannot remove the last admin with no WIKI_ADMIN_EMAILS configured")}async function u(e){if(s().length>0||r.SYNTHETIC_USER_IDS.has(e)||((await (0,t.readConfig)()).adminUserIds??[]).length>0)return;let i=!1;await (0,t.updateConfig)(t=>(t.adminUserIds??[]).length>0?t:(i=!0,{...t,adminUserIds:[e]})),i&&console.log(`[wiki-viewer] Bootstrap: first user ${e} promoted to admin`)}async function l(e){if("1"===process.env.WIKI_NO_AUTH)return{ok:!0,user:{id:"local",email:"local@localhost",name:"local"}};let t=await (0,r.requireUser)(e);return t.ok?await i(t.user.id,t.user.email)?{ok:!0,user:t.user}:{ok:!1,status:403,code:"ADMIN_REQUIRED"}:{ok:!1,status:401,code:"UNAUTHORIZED"}}e.s(["addAdmin",0,o,"ensureBootstrapAdmin",0,u,"isAdmin",0,i,"listAdmins",0,n,"removeAdmin",0,a,"requireAdmin",0,l])},874533,(e,t,r)=>{t.exports=e.x("node:child_process",()=>require("node:child_process"))},812057,(e,t,r)=>{t.exports=e.x("node:util",()=>require("node:util"))},256294,296555,e=>{"use strict";let t;var r=e.i(874533),s=e.i(812057),i=e.i(912714),n=e.i(750227),o=e.i(660526);e.i(902157);let a=RegExp("[;|&$`<>(){}\\n\\r\\0]");function u(e){let{target:t,mountpoint:r,port:s}=e,i=t.user?`${t.user}@`:"",n=[`${i}${t.host}:${t.remotePath}`,r];s&&Number.isInteger(Number(s))&&Number(s)>0&&65536>Number(s)&&n.push("-p",String(s));let o=e.authMethod??"agent";!e.authMethod&&(null!=e.password?o="password":e.keyPath&&(o="keyfile"));let a=["reconnect","ServerAliveInterval=15","ServerAliveCountMax=3","compression=yes","cache=yes","kernel_cache","StrictHostKeyChecking=accept-new","BatchMode=yes"];if(e.readOnly&&a.push("ro"),"keyfile"===o&&e.keyPath&&(a.push(`IdentityFile=${e.keyPath}`),a.push("IdentitiesOnly=yes")),"password"===o){let e=a.indexOf("BatchMode=yes");e>=0&&a.splice(e,1),a.push("password_stdin"),a.push("PreferredAuthentications=password,keyboard-interactive"),a.push("PubkeyAuthentication=no"),a.push("NumberOfPasswordPrompts=1")}return e.extraOptions&&a.push(...e.extraOptions),n.push("-o",a.join(",")),n}e.s(["buildSshfsArgs",0,u,"isValidKeyPath",0,function(e){return!(!e||a.test(e)||e.includes(".."))&&(e.startsWith("/")||e.startsWith("~/"))},"parseSshTarget",0,function(e){let t;if(!e||a.test(e))return null;let r=e.trim(),s=r.indexOf(":");if(s<=0)return null;let i=r.slice(0,s),n=r.slice(s+1);if(!n.startsWith("/")||n.includes(".."))return null;let o=i,u=i.indexOf("@");return u>=0&&(t=i.slice(0,u),o=i.slice(u+1),!t)?null:o&&/^[a-zA-Z0-9.\-]+$/.test(o)&&(!t||/^[a-zA-Z0-9._\-]+$/.test(t))?{user:t,host:o,remotePath:n}:null}],296555);let l=(0,s.promisify)(r.execFile);function c(){return n.default.join(o.default.homedir(),".wiki-viewer","mounts")}async function d(){if(!0!==t)try{await l("sshfs",["--version"]),t=!0}catch{throw Error("sshfs binary not found. Install sshfs + FUSE (e.g. `apt install sshfs`, `brew install macfuse sshfs`) and ensure it is on PATH.")}}async function f(t){var r;let s=n.default.resolve(t),o=!1;try{o=(await (0,i.readFile)("/proc/mounts","utf8")).split("\n").some(e=>{let t=e.split(" ");return t[1]===s&&/fuse/.test(t[2]??"")})}catch{o=!1}return!!o&&(r=s,new Promise(t=>{let s=!1,i=setTimeout(()=>{s||(s=!0,t(!1))},4e3);e.A(687903).then(({readdir:e})=>e(r)).then(()=>{s||(s=!0,clearTimeout(i),t(!0))}).catch(()=>{s||(s=!0,clearTimeout(i),t(!1))})}))}async function h(e){await d(),await (0,i.mkdir)(e.mountpoint,{recursive:!0});let t=u(e);if(await new Promise((s,i)=>{let n=(0,r.spawn)("sshfs",t,{stdio:["pipe","ignore","pipe"]}),o="",a=setTimeout(()=>{n.kill("SIGKILL"),i(Error("sshfs mount timed out after 25s."))},25e3);n.stderr?.on("data",e=>{o+=e.toString()}),n.on("error",e=>{clearTimeout(a),i(e.message.includes("ENOENT")?Error("sshfs binary not found on PATH."):e)}),n.on("close",e=>{clearTimeout(a),0===e?s():i(Error(`sshfs exited ${e}: ${o.trim()||"mount failed"}`))}),"password"===e.authMethod&&n.stdin?.write((e.password??"")+"\n"),n.stdin?.end()}),!await f(e.mountpoint))throw Error("sshfs reported success but the mount is not live.")}async function m(e){let t=n.default.resolve(e);for(let[e,r]of[["fusermount",["-u","-z",t]],["umount",[t]]])try{await l(e,r);break}catch{}try{await (0,i.rmdir)(t)}catch{}}e.s(["assertSshfsAvailable",0,d,"isMounted",0,f,"mountSshfs",0,h,"mountpointFor",0,function(e){return n.default.join(c(),e)},"mountsDir",0,c,"unmountSshfs",0,m],256294)},499465,e=>{"use strict";var t=e.i(750227),r=e.i(660526),s=e.i(902157),i=e.i(666680);let n=t.default.join(process.env.HOME??r.default.homedir(),".wiki-viewer"),o=t.default.join(n,"api-key");function a(){return(0,s.existsSync)(o)?(0,s.readFileSync)(o,"utf-8").trim():""}e.s(["ensureApiKey",0,function(){if((0,s.mkdirSync)(n,{recursive:!0}),!(0,s.existsSync)(o)){let e=(0,i.randomBytes)(32).toString("hex");(0,s.writeFileSync)(o,e,{mode:384});try{(0,s.chmodSync)(o,384)}catch{}return e}return(0,s.readFileSync)(o,"utf-8").trim()},"getApiKey",0,a,"isApiKeyRequest",0,function(e){return(function(e){let t=[],r=e.headers.get("authorization")??"";if(r.startsWith("Bearer ")){let e=r.slice(7).trim();e&&t.push(e)}return t})(e).some(e=>(function(e){let t=a();if(!t||!e||t.length!==e.length)return!1;try{return(0,i.timingSafeEqual)(Buffer.from(t,"utf-8"),Buffer.from(e,"utf-8"))}catch{return!1}})(e))},"rotateApiKey",0,function(){(0,s.mkdirSync)(n,{recursive:!0});let e=(0,i.randomBytes)(32).toString("hex");(0,s.writeFileSync)(o,e,{mode:384});try{(0,s.chmodSync)(o,384)}catch{}return e}])},660038,e=>{"use strict";var t=e.i(750227),r=e.i(666680),s=e.i(902157),i=e.i(254226),n=e.i(499465),o=e.i(583627),a=e.i(359211);async function u(e,i){var o;let a;if(!("1"===process.env.WIKI_NO_AUTH||(0,n.isApiKeyRequest)(e)))return{ok:!1,status:400,code:"root_requires_api_key"};let u=function(e){let r,i=t.default.resolve(e);try{r=(0,s.statSync)(i)}catch{return{ok:!1,code:"root_not_found"}}return r.isDirectory()?{ok:!0,rootDir:i}:{ok:!1,code:"root_not_a_directory"}}(i);return u.ok?{ok:!0,ws:(o=u.rootDir,a=(0,r.createHash)("sha256").update(o).digest("hex").slice(0,12),{id:`ws_eph_${a}`,name:t.default.basename(o)||"workspace",rootDir:o,createdAt:new Date(0).toISOString(),ephemeral:!0})}:{ok:!1,status:400,code:u.code}}async function l(e){let t,r=new URL(e.url);if("1"===process.env.WIKI_LITE){let t=r.searchParams.get("root");return t?u(e,t):{ok:!1,status:400,code:"root_required"}}await (0,a.migrateConfigToWorkspaces)();let s=r.searchParams.get("root");if(s)return u(e,s);let i=r.searchParams.get("ws")??e.headers.get("x-workspace")??null;if(i)t=await (0,a.getWorkspace)(i)??null;else{let e=await (0,a.listWorkspaces)();if(0===e.length)return{ok:!1,status:400,code:"WORKSPACE_REQUIRED"};t=e.slice().sort((e,t)=>{let r=e.lastOpenedAt?new Date(e.lastOpenedAt).getTime():0,s=t.lastOpenedAt?new Date(t.lastOpenedAt).getTime():0;return s!==r?s-r:e.id<t.id?-1:+(e.id>t.id)})[0]}return t?(t.ssh&&await (0,a.ensureWorkspaceMounted)(t),{ok:!0,ws:t}):{ok:!1,status:i?404:400,code:i?"WORKSPACE_NOT_FOUND":"WORKSPACE_REQUIRED"}}async function c(e,t="read"){if("1"===process.env.WIKI_NO_AUTH){let r=await l(e);if(!r.ok)return r;let{ws:s}=r;return"write"===t&&s.readOnly?{ok:!1,status:403,code:"WORKSPACE_READ_ONLY"}:{ok:!0,ws:s,rootDir:s.rootDir,userId:"local",isAdmin:!0}}let r=await (0,i.requireUser)(e);if(!r.ok)return{ok:!1,status:401,code:"UNAUTHORIZED"};let s=await (0,o.isAdmin)(r.user.id,r.user.email),n=await l(e);if(!n.ok)return n;let{ws:u}=n;return u.ephemeral||(0,a.userCanAccess)(u,r.user.id,s)?"write"===t&&u.readOnly?{ok:!1,status:403,code:"WORKSPACE_READ_ONLY"}:{ok:!0,ws:u,rootDir:u.rootDir,userId:r.user.id,isAdmin:s}:{ok:!1,status:403,code:"WORKSPACE_FORBIDDEN"}}async function d(e,t="read"){let r=await l(e);if(!r.ok)return r;let{ws:s}=r;return"write"===t&&s.readOnly?{ok:!1,status:403,code:"WORKSPACE_READ_ONLY"}:{ok:!0,ws:s,rootDir:s.rootDir}}e.s(["resolveWorkspaceForAgent",0,d,"resolveWorkspaceForUser",0,c],660038)}];
1
+ module.exports=[583627,e=>{"use strict";var t=e.i(798003),r=e.i(254226);function s(){return(process.env.WIKI_ADMIN_EMAILS??"").split(",").map(e=>e.trim().toLowerCase()).filter(Boolean)}async function i(e,r){if(r){let e=s();if(e.length>0&&e.includes(r.toLowerCase()))return!0}return((await (0,t.readConfig)()).adminUserIds??[]).includes(e)}async function n(){return(await (0,t.readConfig)()).adminUserIds??[]}async function o(e){await (0,t.updateConfig)(t=>{let r=t.adminUserIds??[];return r.includes(e)?t:{...t,adminUserIds:[...r,e]}})}async function a(e){let r=s().length>0,i=!1;if(await (0,t.updateConfig)(t=>{let s=(t.adminUserIds??[]).filter(t=>t!==e);return 0!==s.length||r?{...t,adminUserIds:s}:(i=!0,t)}),i)throw Error("LAST_ADMIN: cannot remove the last admin with no WIKI_ADMIN_EMAILS configured")}async function u(e){if(s().length>0||r.SYNTHETIC_USER_IDS.has(e)||((await (0,t.readConfig)()).adminUserIds??[]).length>0)return;let i=!1;await (0,t.updateConfig)(t=>(t.adminUserIds??[]).length>0?t:(i=!0,{...t,adminUserIds:[e]})),i&&console.log(`[wiki-viewer] Bootstrap: first user ${e} promoted to admin`)}async function l(e){if("1"===process.env.WIKI_NO_AUTH)return{ok:!0,user:{id:"local",email:"local@localhost",name:"local"}};let t=await (0,r.requireUser)(e);return t.ok?await i(t.user.id,t.user.email)?{ok:!0,user:t.user}:{ok:!1,status:403,code:"ADMIN_REQUIRED"}:{ok:!1,status:401,code:"UNAUTHORIZED"}}e.s(["addAdmin",0,o,"ensureBootstrapAdmin",0,u,"isAdmin",0,i,"listAdmins",0,n,"removeAdmin",0,a,"requireAdmin",0,l])},874533,(e,t,r)=>{t.exports=e.x("node:child_process",()=>require("node:child_process"))},812057,(e,t,r)=>{t.exports=e.x("node:util",()=>require("node:util"))},256294,296555,e=>{"use strict";let t;var r=e.i(874533),s=e.i(812057),i=e.i(912714),n=e.i(750227),o=e.i(660526);e.i(902157);let a=RegExp("[;|&$`<>(){}\\n\\r\\0]");function u(e){let{target:t,mountpoint:r,port:s}=e,i=t.user?`${t.user}@`:"",n=[`${i}${t.host}:${t.remotePath}`,r];s&&Number.isInteger(Number(s))&&Number(s)>0&&65536>Number(s)&&n.push("-p",String(s));let o=e.authMethod??"agent";!e.authMethod&&(null!=e.password?o="password":e.keyPath&&(o="keyfile"));let a=["reconnect","ServerAliveInterval=15","ServerAliveCountMax=3","compression=yes","cache=yes","StrictHostKeyChecking=accept-new","BatchMode=yes"];if(e.readOnly&&a.push("ro"),"keyfile"===o&&e.keyPath&&(a.push(`IdentityFile=${e.keyPath}`),a.push("IdentitiesOnly=yes")),"password"===o){let e=a.indexOf("BatchMode=yes");e>=0&&a.splice(e,1),a.push("password_stdin"),a.push("PreferredAuthentications=password,keyboard-interactive"),a.push("PubkeyAuthentication=no"),a.push("NumberOfPasswordPrompts=1")}return e.extraOptions&&a.push(...e.extraOptions),n.push("-o",a.join(",")),n}e.s(["buildSshfsArgs",0,u,"isValidKeyPath",0,function(e){return!(!e||a.test(e)||e.includes(".."))&&(e.startsWith("/")||e.startsWith("~/"))},"parseSshTarget",0,function(e){let t;if(!e||a.test(e))return null;let r=e.trim(),s=r.indexOf(":");if(s<=0)return null;let i=r.slice(0,s),n=r.slice(s+1);if(!n.startsWith("/")||n.includes(".."))return null;let o=i,u=i.indexOf("@");return u>=0&&(t=i.slice(0,u),o=i.slice(u+1),!t)?null:o&&/^[a-zA-Z0-9.\-]+$/.test(o)&&(!t||/^[a-zA-Z0-9._\-]+$/.test(t))?{user:t,host:o,remotePath:n}:null}],296555);let l=(0,s.promisify)(r.execFile);function c(){return n.default.join(o.default.homedir(),".wiki-viewer","mounts")}async function d(){if(!0!==t)try{await l("sshfs",["--version"]),t=!0}catch{throw Error("sshfs binary not found. Install sshfs + FUSE (e.g. `apt install sshfs`, `brew install macfuse sshfs`) and ensure it is on PATH.")}}async function f(t){var r;let s=n.default.resolve(t),o=!1;try{o=(await (0,i.readFile)("/proc/mounts","utf8")).split("\n").some(e=>{let t=e.split(" ");return t[1]===s&&/fuse/.test(t[2]??"")})}catch{o=!1}return!!o&&(r=s,new Promise(t=>{let s=!1,i=setTimeout(()=>{s||(s=!0,t(!1))},4e3);e.A(687903).then(({readdir:e})=>e(r)).then(()=>{s||(s=!0,clearTimeout(i),t(!0))}).catch(()=>{s||(s=!0,clearTimeout(i),t(!1))})}))}async function h(e){await d(),await (0,i.mkdir)(e.mountpoint,{recursive:!0});let t=u(e);if(await new Promise((s,i)=>{let n=(0,r.spawn)("sshfs",t,{stdio:["pipe","ignore","pipe"]}),o="",a=setTimeout(()=>{n.kill("SIGKILL"),i(Error("sshfs mount timed out after 25s."))},25e3);n.stderr?.on("data",e=>{o+=e.toString()}),n.on("error",e=>{clearTimeout(a),i(e.message.includes("ENOENT")?Error("sshfs binary not found on PATH."):e)}),n.on("close",e=>{clearTimeout(a),0===e?s():i(Error(`sshfs exited ${e}: ${o.trim()||"mount failed"}`))}),"password"===e.authMethod&&n.stdin?.write((e.password??"")+"\n"),n.stdin?.end()}),!await f(e.mountpoint))throw Error("sshfs reported success but the mount is not live.")}async function m(e){let t=n.default.resolve(e);for(let[e,r]of[["fusermount",["-u","-z",t]],["umount",[t]]])try{await l(e,r);break}catch{}try{await (0,i.rmdir)(t)}catch{}}e.s(["assertSshfsAvailable",0,d,"isMounted",0,f,"mountSshfs",0,h,"mountpointFor",0,function(e){return n.default.join(c(),e)},"mountsDir",0,c,"unmountSshfs",0,m],256294)},499465,e=>{"use strict";var t=e.i(750227),r=e.i(660526),s=e.i(902157),i=e.i(666680);let n=t.default.join(process.env.HOME??r.default.homedir(),".wiki-viewer"),o=t.default.join(n,"api-key");function a(){return(0,s.existsSync)(o)?(0,s.readFileSync)(o,"utf-8").trim():""}e.s(["ensureApiKey",0,function(){if((0,s.mkdirSync)(n,{recursive:!0}),!(0,s.existsSync)(o)){let e=(0,i.randomBytes)(32).toString("hex");(0,s.writeFileSync)(o,e,{mode:384});try{(0,s.chmodSync)(o,384)}catch{}return e}return(0,s.readFileSync)(o,"utf-8").trim()},"getApiKey",0,a,"isApiKeyRequest",0,function(e){return(function(e){let t=[],r=e.headers.get("authorization")??"";if(r.startsWith("Bearer ")){let e=r.slice(7).trim();e&&t.push(e)}return t})(e).some(e=>(function(e){let t=a();if(!t||!e||t.length!==e.length)return!1;try{return(0,i.timingSafeEqual)(Buffer.from(t,"utf-8"),Buffer.from(e,"utf-8"))}catch{return!1}})(e))},"rotateApiKey",0,function(){(0,s.mkdirSync)(n,{recursive:!0});let e=(0,i.randomBytes)(32).toString("hex");(0,s.writeFileSync)(o,e,{mode:384});try{(0,s.chmodSync)(o,384)}catch{}return e}])},660038,e=>{"use strict";var t=e.i(750227),r=e.i(666680),s=e.i(902157),i=e.i(254226),n=e.i(499465),o=e.i(583627),a=e.i(359211);async function u(e,i){var o;let a;if(!("1"===process.env.WIKI_NO_AUTH||(0,n.isApiKeyRequest)(e)))return{ok:!1,status:400,code:"root_requires_api_key"};let u=function(e){let r,i=t.default.resolve(e);try{r=(0,s.statSync)(i)}catch{return{ok:!1,code:"root_not_found"}}return r.isDirectory()?{ok:!0,rootDir:i}:{ok:!1,code:"root_not_a_directory"}}(i);return u.ok?{ok:!0,ws:(o=u.rootDir,a=(0,r.createHash)("sha256").update(o).digest("hex").slice(0,12),{id:`ws_eph_${a}`,name:t.default.basename(o)||"workspace",rootDir:o,createdAt:new Date(0).toISOString(),ephemeral:!0})}:{ok:!1,status:400,code:u.code}}async function l(e){let t,r=new URL(e.url);if("1"===process.env.WIKI_LITE){let t=r.searchParams.get("root");return t?u(e,t):{ok:!1,status:400,code:"root_required"}}await (0,a.migrateConfigToWorkspaces)();let s=r.searchParams.get("root");if(s)return u(e,s);let i=r.searchParams.get("ws")??e.headers.get("x-workspace")??null;if(i)t=await (0,a.getWorkspace)(i)??null;else{let e=await (0,a.listWorkspaces)();if(0===e.length)return{ok:!1,status:400,code:"WORKSPACE_REQUIRED"};t=e.slice().sort((e,t)=>{let r=e.lastOpenedAt?new Date(e.lastOpenedAt).getTime():0,s=t.lastOpenedAt?new Date(t.lastOpenedAt).getTime():0;return s!==r?s-r:e.id<t.id?-1:+(e.id>t.id)})[0]}return t?(t.ssh&&await (0,a.ensureWorkspaceMounted)(t),{ok:!0,ws:t}):{ok:!1,status:i?404:400,code:i?"WORKSPACE_NOT_FOUND":"WORKSPACE_REQUIRED"}}async function c(e,t="read"){if("1"===process.env.WIKI_NO_AUTH){let r=await l(e);if(!r.ok)return r;let{ws:s}=r;return"write"===t&&s.readOnly?{ok:!1,status:403,code:"WORKSPACE_READ_ONLY"}:{ok:!0,ws:s,rootDir:s.rootDir,userId:"local",isAdmin:!0}}let r=await (0,i.requireUser)(e);if(!r.ok)return{ok:!1,status:401,code:"UNAUTHORIZED"};let s=await (0,o.isAdmin)(r.user.id,r.user.email),n=await l(e);if(!n.ok)return n;let{ws:u}=n;return u.ephemeral||(0,a.userCanAccess)(u,r.user.id,s)?"write"===t&&u.readOnly?{ok:!1,status:403,code:"WORKSPACE_READ_ONLY"}:{ok:!0,ws:u,rootDir:u.rootDir,userId:r.user.id,isAdmin:s}:{ok:!1,status:403,code:"WORKSPACE_FORBIDDEN"}}async function d(e,t="read"){let r=await l(e);if(!r.ok)return r;let{ws:s}=r;return"write"===t&&s.readOnly?{ok:!1,status:403,code:"WORKSPACE_READ_ONLY"}:{ok:!0,ws:s,rootDir:s.rootDir}}e.s(["resolveWorkspaceForAgent",0,d,"resolveWorkspaceForUser",0,c],660038)}];
2
2
 
3
3
  //# sourceMappingURL=%5Broot-of-the-server%5D__12g8s_j._.js.map
@@ -0,0 +1,3 @@
1
+ module.exports=[402662,e=>{"use strict";var t=e.i(351216);e.s(["checkOrigin",0,function(e){let r=e.method.toUpperCase();if("GET"===r||"HEAD"===r||"OPTIONS"===r)return null;let s=e.headers.get("origin"),a=e.headers.get("referer");if(!s&&!a)return null;let n=function(e){let t=Array.from(new Set(["localhost","127.0.0.1",e.split(":")[0],...(process.env.WIKI_OWNER_HOSTS??"").split(",").map(e=>e.trim()).filter(Boolean)])),r=["",":3000",":3003"];e.includes(":")&&r.push(":"+e.split(":")[1]);let s=new Set;for(let e of t)for(let t of["http","https"])for(let a of r)s.add(`${t}://${e}${a}`);return s}(e.headers.get("host")??"");if(s)return n.has(s)?null:t.NextResponse.json({error:"FORBIDDEN",message:"Bad origin"},{status:403});if(a){try{let{protocol:e,host:t}=new URL(a);if(n.has(`${e}//${t}`))return null}catch{}return t.NextResponse.json({error:"FORBIDDEN",message:"Bad referer"},{status:403})}return null}])},814747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},224361,(e,t,r)=>{t.exports=e.x("util",()=>require("util"))},688947,(e,t,r)=>{t.exports=e.x("stream",()=>require("stream"))},427699,(e,t,r)=>{t.exports=e.x("events",()=>require("events"))},81111,(e,t,r)=>{t.exports=e.x("node:stream",()=>require("node:stream"))},275859,e=>{"use strict";var t=e.i(912714),r=e.i(750227);async function s(e,s){try{let a=r.default.join(e,s,"package.json");return(await (0,t.stat)(a)).isFile()}catch{return!1}}async function a(e,s){try{let a=r.default.join(e,s,"index.html");return(await (0,t.stat)(a)).isFile()}catch{return!1}}e.s(["isAppFolder",0,a,"isNodeApp",0,s])},711376,e=>{"use strict";var t=e.i(985426),r=e.i(257574),s=e.i(507835),a=e.i(457789),n=e.i(119791),i=e.i(141062),o=e.i(957291),l=e.i(535899),u=e.i(610241),p=e.i(62749),d=e.i(624891),c=e.i(725836),h=e.i(532736),v=e.i(257858),R=e.i(487476),f=e.i(193695);e.i(484264);var m=e.i(315709),_=e.i(351216),g=e.i(402662),w=e.i(660038),x=e.i(359211),E=e.i(345212),N=e.i(275859);function y(e){return"1"===process.env.WIKI_NO_AUTH||"1"===process.env.WIKI_ALLOW_APP_RUNNER||e.isAdmin}async function A(e){let t=await (0,w.resolveWorkspaceForUser)(e);if(!t.ok)return _.NextResponse.json({error:t.code},{status:t.status});let{searchParams:r}=new URL(e.url),s=r.get("path")??"",a=(0,E.getStatus)(t.ws.id,s),n=(0,x.safeWorkspacePath)(t.rootDir,s),i=n?(0,E.getScripts)(n):{scripts:[],defaultScript:null},o=await (0,N.isNodeApp)(t.rootDir,s);return _.NextResponse.json({...a,...i,isNodeApp:o})}async function k(e){let t=(0,g.checkOrigin)(e);if(t)return t;let r=await (0,w.resolveWorkspaceForUser)(e,"write");if(!r.ok)return _.NextResponse.json({error:r.code},{status:r.status});let{rootDir:s}=r;if(!y(r))return _.NextResponse.json({error:"ADMIN_REQUIRED"},{status:403});let a=await e.json(),n=a.path;if("string"!=typeof n)return _.NextResponse.json({error:"Missing path"},{status:400});let i=(0,x.safeWorkspacePath)(s,n);if(!i)return _.NextResponse.json({error:"Invalid path"},{status:400});let o="string"==typeof a.script?a.script:void 0;try{let e=await (0,E.startApp)(r.ws.id,n,i,o,{build:!0===a.rebuild});return _.NextResponse.json(e)}catch(e){return _.NextResponse.json({error:String(e)},{status:500})}}async function P(e){let t=(0,g.checkOrigin)(e);if(t)return t;let r=await (0,w.resolveWorkspaceForUser)(e,"write");if(!r.ok)return _.NextResponse.json({error:r.code},{status:r.status});if(!y(r))return _.NextResponse.json({error:"ADMIN_REQUIRED"},{status:403});let s=(await e.json()).path;return"string"!=typeof s?_.NextResponse.json({error:"Missing path"},{status:400}):((0,E.stopApp)(r.ws.id,s),_.NextResponse.json({ok:!0}))}e.s(["DELETE",0,P,"GET",0,A,"POST",0,k],41743);var j=e.i(41743);let C=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/wiki/app/route",pathname:"/api/wiki/app",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/wiki/app/route.ts",nextConfigOutput:"standalone",userland:j,...{}}),{workAsyncStorage:O,workUnitAsyncStorage:T,serverHooks:S}=C;async function b(e,t,s){s.requestMeta&&(0,a.setRequestMeta)(e,s.requestMeta),C.isDev&&(0,a.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let _="/api/wiki/app/route";_=_.replace(/\/index$/,"")||"/";let g=await C.prepare(e,t,{srcPage:_,multiZoneDraftMode:!1});if(!g)return t.statusCode=400,t.end("Bad Request"),null==s.waitUntil||s.waitUntil.call(s,Promise.resolve()),null;let{buildId:w,params:x,nextConfig:E,parsedUrl:N,isDraftMode:y,prerenderManifest:A,routerServerContext:k,isOnDemandRevalidate:P,revalidateOnlyGenerated:j,resolvedPathname:O,clientReferenceManifest:T,serverActionsManifest:S}=g,b=(0,o.normalizeAppPath)(_),q=!!(A.dynamicRoutes[b]||A.routes[O]),I=async()=>((null==k?void 0:k.render404)?await k.render404(e,t,N,!1):t.end("This page could not be found"),null);if(q&&!y){let e=!!A.routes[O],t=A.dynamicRoutes[b];if(t&&!1===t.fallback&&!e){if(E.adapterPath)return await I();throw new f.NoFallbackError}}let D=null;!q||C.isDev||y||(D="/index"===(D=O)?"/":D);let U=!0===C.isDev||!q,H=q&&!U;S&&T&&(0,i.setManifestsSingleton)({page:_,clientReferenceManifest:T,serverActionsManifest:S});let M=e.method||"GET",F=(0,n.getTracer)(),$=F.getActiveScopeSpan(),W=!!(null==k?void 0:k.isWrappedByNextServer),B=!!(0,a.getRequestMeta)(e,"minimalMode"),K=(0,a.getRequestMeta)(e,"incrementalCache")||await C.getIncrementalCache(e,E,A,B);null==K||K.resetRequestCache(),globalThis.__incrementalCache=K;let L={params:x,previewProps:A.preview,renderOpts:{experimental:{authInterrupts:!!E.experimental.authInterrupts},cacheComponents:!!E.cacheComponents,supportsDynamicResponse:U,incrementalCache:K,cacheLifeProfiles:E.cacheLife,waitUntil:s.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,s,a)=>C.onRequestError(e,t,s,a,k)},sharedContext:{buildId:w}},z=new l.NodeNextRequest(e),G=new l.NodeNextResponse(t),V=u.NextRequestAdapter.fromNodeNextRequest(z,(0,u.signalFromNodeResponse)(t));try{let a,i=async e=>C.handle(V,L).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=F.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==p.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let s=r.get("next.route");if(s){let t=`${M} ${s}`;e.setAttributes({"next.route":s,"http.route":s,"next.span_name":t}),e.updateName(t),a&&a!==e&&(a.setAttribute("http.route",s),a.updateName(t))}else e.updateName(`${M} ${_}`)}),o=async a=>{var n,o;let l=async({previousCacheEntry:r})=>{try{if(!B&&P&&j&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let n=await i(a);e.fetchMetrics=L.renderOpts.fetchMetrics;let o=L.renderOpts.pendingWaitUntil;o&&s.waitUntil&&(s.waitUntil(o),o=void 0);let l=L.renderOpts.collectedTags;if(!q)return await (0,c.sendResponse)(z,G,n,L.renderOpts.pendingWaitUntil),null;{let e=await n.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(n.headers);l&&(t[R.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==L.renderOpts.collectedRevalidate&&!(L.renderOpts.collectedRevalidate>=R.INFINITE_CACHE)&&L.renderOpts.collectedRevalidate,s=void 0===L.renderOpts.collectedExpire||L.renderOpts.collectedExpire>=R.INFINITE_CACHE?void 0:L.renderOpts.collectedExpire;return{value:{kind:m.CachedRouteKind.APP_ROUTE,status:n.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:s}}}}catch(t){throw(null==r?void 0:r.isStale)&&await C.onRequestError(e,t,{routerKind:"App Router",routePath:_,routeType:"route",revalidateReason:(0,d.getRevalidateReason)({isStaticGeneration:H,isOnDemandRevalidate:P})},!1,k),t}},u=await C.handleResponse({req:e,nextConfig:E,cacheKey:D,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:A,isRoutePPREnabled:!1,isOnDemandRevalidate:P,revalidateOnlyGenerated:j,responseGenerator:l,waitUntil:s.waitUntil,isMinimalMode:B});if(!q)return null;if((null==u||null==(n=u.value)?void 0:n.kind)!==m.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==u||null==(o=u.value)?void 0:o.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});B||t.setHeader("x-nextjs-cache",P?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),y&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let p=(0,h.fromNodeOutgoingHttpHeaders)(u.value.headers);return B&&q||p.delete(R.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||p.get("Cache-Control")||p.set("Cache-Control",(0,v.getCacheControlHeader)(u.cacheControl)),await (0,c.sendResponse)(z,G,new Response(u.value.body,{headers:p,status:u.value.status||200})),null};W&&$?await o($):(a=F.getActiveScopeSpan(),await F.withPropagatedContext(e.headers,()=>F.trace(p.BaseServerSpan.handleRequest,{spanName:`${M} ${_}`,kind:n.SpanKind.SERVER,attributes:{"http.method":M,"http.target":e.url}},o),void 0,!W))}catch(t){if(t instanceof f.NoFallbackError||await C.onRequestError(e,t,{routerKind:"App Router",routePath:b,routeType:"route",revalidateReason:(0,d.getRevalidateReason)({isStaticGeneration:H,isOnDemandRevalidate:P})},!1,k),q)throw t;return await (0,c.sendResponse)(z,G,new Response(null,{status:500})),null}}e.s(["handler",0,b,"patchFetch",0,function(){return(0,s.patchFetch)({workAsyncStorage:O,workUnitAsyncStorage:T})},"routeModule",0,C,"serverHooks",0,S,"workAsyncStorage",0,O,"workUnitAsyncStorage",0,T],711376)},168315,e=>{e.v(t=>Promise.all(["server/chunks/0sag_@better-auth_memory-adapter_dist_index_mjs_0pvj6im._.js"].map(t=>e.l(t))).then(()=>t(862112)))},769787,e=>{e.v(t=>Promise.all(["server/chunks/01er_better-auth_dist_adapters_kysely-adapter_index_mjs_0s~-4gu._.js"].map(t=>e.l(t))).then(()=>t(717789)))},580632,e=>{e.v(e=>Promise.resolve().then(()=>e(270406)))},947559,e=>{e.v(t=>Promise.all(["server/chunks/0ugq_@better-auth_kysely-adapter_dist_bun-sqlite-dialect-DzNwOpKv_mjs_0z1z6m4._.js"].map(t=>e.l(t))).then(()=>t(495181)))},715018,e=>{e.v(t=>Promise.all(["server/chunks/0ugq_@better-auth_kysely-adapter_dist_node-sqlite-dialect_mjs_0qqlvhl._.js"].map(t=>e.l(t))).then(()=>t(698370)))},146843,e=>{e.v(t=>Promise.all(["server/chunks/0ugq_@better-auth_kysely-adapter_dist_d1-sqlite-dialect-C2B7YsIT_mjs_0wynrz3._.js"].map(t=>e.l(t))).then(()=>t(143740)))},697743,e=>{e.v(t=>Promise.all(["server/chunks/0.u4_next_05jevxw._.js"].map(t=>e.l(t))).then(()=>t(428325)))},99243,e=>{e.v(e=>Promise.resolve().then(()=>e(313414)))},893412,e=>{e.v(e=>Promise.resolve().then(()=>e(499465)))},687903,e=>{e.v(e=>Promise.resolve().then(()=>e(912714)))}];
2
+
3
+ //# sourceMappingURL=%5Broot-of-the-server%5D__12xtht5._.js.map
@@ -1,3 +1,3 @@
1
1
  module.exports=[389424,a=>{a.v(b=>Promise.all(["server/chunks/ssr/0~w0_katex_dist_katex_mjs_0-.ao2a._.js"].map(b=>a.l(b))).then(()=>b(706823)))}];
2
2
 
3
- //# sourceMappingURL=0~w0_katex_dist_katex_mjs_004-6gg._.js.map
3
+ //# sourceMappingURL=0~w0_katex_dist_katex_mjs_0q62ivk._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[750227,(a,b,c)=>{b.exports=a.x("node:path",()=>require("node:path"))},857764,(a,b,c)=>{b.exports=a.x("node:url",()=>require("node:url"))},59639,(a,b,c)=>{b.exports=a.x("node:process",()=>require("node:process"))},462711,651212,316552,a=>{"use strict";var b=a.i(750227);a.s(["minpath",()=>b.default],462711);var c=a.i(59639);a.s(["minproc",()=>c.default],651212);var d=a.i(857764);a.s(["urlToPath",()=>d.fileURLToPath],316552)},463652,(a,b,c)=>{"use strict";c._=function(a){return a&&a.__esModule?a:{default:a}}},710149,a=>{"use strict";a.s(["apiUrl",0,function(a){if(!a.startsWith("/"))return a;let b=process.env.WIKI_URL_PREFIX??"";return!b||a.startsWith(b+"/")||a===b?a:b+a},"isLite",0,function(){return"1"===process.env.WIKI_LITE}])},314875,a=>{"use strict";var b=function(a,c){return(b=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)Object.prototype.hasOwnProperty.call(b,c)&&(a[c]=b[c])})(a,c)},c=function(){return(c=Object.assign||function(a){for(var b,c=1,d=arguments.length;c<d;c++)for(var e in b=arguments[c])Object.prototype.hasOwnProperty.call(b,e)&&(a[e]=b[e]);return a}).apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError,a.s(["__assign",()=>c,"__awaiter",0,function(a,b,c,d){return new(c||(c=Promise))(function(e,f){function g(a){try{i(d.next(a))}catch(a){f(a)}}function h(a){try{i(d.throw(a))}catch(a){f(a)}}function i(a){var b;a.done?e(a.value):((b=a.value)instanceof c?b:new c(function(a){a(b)})).then(g,h)}i((d=d.apply(a,b||[])).next())})},"__extends",0,function(a,c){if("function"!=typeof c&&null!==c)throw TypeError("Class extends value "+String(c)+" is not a constructor or null");function d(){this.constructor=a}b(a,c),a.prototype=null===c?Object.create(c):(d.prototype=c.prototype,new d)},"__generator",0,function(a,b){var c,d,e,f={label:0,sent:function(){if(1&e[0])throw e[1];return e[1]},trys:[],ops:[]},g=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return g.next=h(0),g.throw=h(1),g.return=h(2),"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function h(h){return function(i){var j=[h,i];if(c)throw TypeError("Generator is already executing.");for(;g&&(g=0,j[0]&&(f=0)),f;)try{if(c=1,d&&(e=2&j[0]?d.return:j[0]?d.throw||((e=d.return)&&e.call(d),0):d.next)&&!(e=e.call(d,j[1])).done)return e;switch(d=0,e&&(j=[2&j[0],e.value]),j[0]){case 0:case 1:e=j;break;case 4:return f.label++,{value:j[1],done:!1};case 5:f.label++,d=j[1],j=[0];continue;case 7:j=f.ops.pop(),f.trys.pop();continue;default:if(!(e=(e=f.trys).length>0&&e[e.length-1])&&(6===j[0]||2===j[0])){f=0;continue}if(3===j[0]&&(!e||j[1]>e[0]&&j[1]<e[3])){f.label=j[1];break}if(6===j[0]&&f.label<e[1]){f.label=e[1],e=j;break}if(e&&f.label<e[2]){f.label=e[2],f.ops.push(j);break}e[2]&&f.ops.pop(),f.trys.pop();continue}j=b.call(a,f)}catch(a){j=[6,a],d=0}finally{c=e=0}if(5&j[0])throw j[1];return{value:j[0]?j[1]:void 0,done:!0}}}},"__rest",0,function(a,b){var c={};for(var d in a)Object.prototype.hasOwnProperty.call(a,d)&&0>b.indexOf(d)&&(c[d]=a[d]);if(null!=a&&"function"==typeof Object.getOwnPropertySymbols)for(var e=0,d=Object.getOwnPropertySymbols(a);e<d.length;e++)0>b.indexOf(d[e])&&Object.prototype.propertyIsEnumerable.call(a,d[e])&&(c[d[e]]=a[d[e]]);return c},"__spreadArray",0,function(a,b,c){if(c||2==arguments.length)for(var d,e=0,f=b.length;e<f;e++)!d&&e in b||(d||(d=Array.prototype.slice.call(b,0,e)),d[e]=b[e]);return a.concat(d||Array.prototype.slice.call(b))}])},334743,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules__pnpm_07i6nnw._.js","server/chunks/ssr/node_modules__pnpm_04rulr6._.js","server/chunks/ssr/12y~_mermaid_dist_chunks_mermaid_core_chunk-5ZQYHXKU_mjs_0z1.978._.js","server/chunks/ssr/12y~_mermaid_dist_chunks_mermaid_core_chunk-XPW4576I_mjs_0u7glrg._.js","server/chunks/ssr/0hhx_roughjs_bundled_rough_esm_0hyphnf.js","server/chunks/ssr/12y~_mermaid_dist_mermaid_core_mjs_0hj_n-~._.js","server/chunks/ssr/12y~_mermaid_dist_chunks_mermaid_core_chunk-CSCIHK7Q_mjs_01i7moi._.js","server/chunks/ssr/12y~_mermaid_dist_chunks_mermaid_core_chunk-3OPIFGDE_mjs_09p1amp._.js","server/chunks/ssr/node_modules__pnpm_00krony._.js","server/chunks/ssr/12y~_mermaid_dist_chunks_mermaid_core_chunk-O5CBEL6O_mjs_11437bo._.js","server/chunks/ssr/12y~_mermaid_dist_chunks_mermaid_core_chunk-KSCS5N6A_mjs_0v4oeem._.js"].map(b=>a.l(b))).then(()=>b(496249)))},449971,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules__pnpm_0ts_t7o._.js"].map(b=>a.l(b))).then(()=>b(685796)))},56041,a=>{a.v(b=>Promise.all(["server/chunks/ssr/0a.g_remark-gfm_index_0x_9hnh.js"].map(b=>a.l(b))).then(()=>b(831167)))},403939,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules__pnpm_0icemj5._.js"].map(b=>a.l(b))).then(()=>b(831435)))},458647,a=>{a.v(b=>Promise.all(["server/chunks/ssr/[externals]__05-uq57._.js","server/chunks/ssr/node_modules__pnpm_0szp2v0._.js","server/chunks/ssr/0~c0_docx-preview_dist_docx-preview_mjs_107snq3._.js"].map(b=>a.l(b))).then(()=>b(204460)))},287443,a=>{a.v(b=>Promise.all(["server/chunks/ssr/[externals]__0btd01s._.js","server/chunks/ssr/node_modules__pnpm_0o~d81.._.js","server/chunks/ssr/node_modules__pnpm_0szp2v0._.js"].map(b=>a.l(b))).then(()=>b(170263)))},57386,a=>{a.v(b=>Promise.all(["server/chunks/ssr/0se0_xlsx_xlsx_mjs_12z-ju4._.js"].map(b=>a.l(b))).then(()=>b(86253)))}];
1
+ module.exports=[750227,(a,b,c)=>{b.exports=a.x("node:path",()=>require("node:path"))},857764,(a,b,c)=>{b.exports=a.x("node:url",()=>require("node:url"))},59639,(a,b,c)=>{b.exports=a.x("node:process",()=>require("node:process"))},462711,651212,316552,a=>{"use strict";var b=a.i(750227);a.s(["minpath",()=>b.default],462711);var c=a.i(59639);a.s(["minproc",()=>c.default],651212);var d=a.i(857764);a.s(["urlToPath",()=>d.fileURLToPath],316552)},463652,(a,b,c)=>{"use strict";c._=function(a){return a&&a.__esModule?a:{default:a}}},710149,a=>{"use strict";a.s(["apiUrl",0,function(a){if(!a.startsWith("/"))return a;let b=process.env.WIKI_URL_PREFIX??"";return!b||a.startsWith(b+"/")||a===b?a:b+a},"isLite",0,function(){return"1"===process.env.WIKI_LITE}])},314875,a=>{"use strict";var b=function(a,c){return(b=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)Object.prototype.hasOwnProperty.call(b,c)&&(a[c]=b[c])})(a,c)},c=function(){return(c=Object.assign||function(a){for(var b,c=1,d=arguments.length;c<d;c++)for(var e in b=arguments[c])Object.prototype.hasOwnProperty.call(b,e)&&(a[e]=b[e]);return a}).apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError,a.s(["__assign",()=>c,"__awaiter",0,function(a,b,c,d){return new(c||(c=Promise))(function(e,f){function g(a){try{i(d.next(a))}catch(a){f(a)}}function h(a){try{i(d.throw(a))}catch(a){f(a)}}function i(a){var b;a.done?e(a.value):((b=a.value)instanceof c?b:new c(function(a){a(b)})).then(g,h)}i((d=d.apply(a,b||[])).next())})},"__extends",0,function(a,c){if("function"!=typeof c&&null!==c)throw TypeError("Class extends value "+String(c)+" is not a constructor or null");function d(){this.constructor=a}b(a,c),a.prototype=null===c?Object.create(c):(d.prototype=c.prototype,new d)},"__generator",0,function(a,b){var c,d,e,f={label:0,sent:function(){if(1&e[0])throw e[1];return e[1]},trys:[],ops:[]},g=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return g.next=h(0),g.throw=h(1),g.return=h(2),"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function h(h){return function(i){var j=[h,i];if(c)throw TypeError("Generator is already executing.");for(;g&&(g=0,j[0]&&(f=0)),f;)try{if(c=1,d&&(e=2&j[0]?d.return:j[0]?d.throw||((e=d.return)&&e.call(d),0):d.next)&&!(e=e.call(d,j[1])).done)return e;switch(d=0,e&&(j=[2&j[0],e.value]),j[0]){case 0:case 1:e=j;break;case 4:return f.label++,{value:j[1],done:!1};case 5:f.label++,d=j[1],j=[0];continue;case 7:j=f.ops.pop(),f.trys.pop();continue;default:if(!(e=(e=f.trys).length>0&&e[e.length-1])&&(6===j[0]||2===j[0])){f=0;continue}if(3===j[0]&&(!e||j[1]>e[0]&&j[1]<e[3])){f.label=j[1];break}if(6===j[0]&&f.label<e[1]){f.label=e[1],e=j;break}if(e&&f.label<e[2]){f.label=e[2],f.ops.push(j);break}e[2]&&f.ops.pop(),f.trys.pop();continue}j=b.call(a,f)}catch(a){j=[6,a],d=0}finally{c=e=0}if(5&j[0])throw j[1];return{value:j[0]?j[1]:void 0,done:!0}}}},"__rest",0,function(a,b){var c={};for(var d in a)Object.prototype.hasOwnProperty.call(a,d)&&0>b.indexOf(d)&&(c[d]=a[d]);if(null!=a&&"function"==typeof Object.getOwnPropertySymbols)for(var e=0,d=Object.getOwnPropertySymbols(a);e<d.length;e++)0>b.indexOf(d[e])&&Object.prototype.propertyIsEnumerable.call(a,d[e])&&(c[d[e]]=a[d[e]]);return c},"__spreadArray",0,function(a,b,c){if(c||2==arguments.length)for(var d,e=0,f=b.length;e<f;e++)!d&&e in b||(d||(d=Array.prototype.slice.call(b,0,e)),d[e]=b[e]);return a.concat(d||Array.prototype.slice.call(b))}])},334743,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules__pnpm_0_.yify._.js","server/chunks/ssr/node_modules__pnpm_04rulr6._.js","server/chunks/ssr/12y~_mermaid_dist_chunks_mermaid_core_chunk-5ZQYHXKU_mjs_0z1.978._.js","server/chunks/ssr/12y~_mermaid_dist_chunks_mermaid_core_chunk-XPW4576I_mjs_0u7glrg._.js","server/chunks/ssr/0hhx_roughjs_bundled_rough_esm_0hyphnf.js","server/chunks/ssr/12y~_mermaid_dist_mermaid_core_mjs_0hj_n-~._.js","server/chunks/ssr/12y~_mermaid_dist_chunks_mermaid_core_chunk-CSCIHK7Q_mjs_01i7moi._.js","server/chunks/ssr/12y~_mermaid_dist_chunks_mermaid_core_chunk-3OPIFGDE_mjs_09p1amp._.js","server/chunks/ssr/node_modules__pnpm_00krony._.js","server/chunks/ssr/12y~_mermaid_dist_chunks_mermaid_core_chunk-O5CBEL6O_mjs_11437bo._.js","server/chunks/ssr/12y~_mermaid_dist_chunks_mermaid_core_chunk-KSCS5N6A_mjs_0v4oeem._.js"].map(b=>a.l(b))).then(()=>b(496249)))},449971,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules__pnpm_0ts_t7o._.js"].map(b=>a.l(b))).then(()=>b(685796)))},56041,a=>{a.v(b=>Promise.all(["server/chunks/ssr/0a.g_remark-gfm_index_0x_9hnh.js"].map(b=>a.l(b))).then(()=>b(831167)))},403939,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules__pnpm_0icemj5._.js"].map(b=>a.l(b))).then(()=>b(831435)))},458647,a=>{a.v(b=>Promise.all(["server/chunks/ssr/[externals]__05-uq57._.js","server/chunks/ssr/node_modules__pnpm_0szp2v0._.js","server/chunks/ssr/0~c0_docx-preview_dist_docx-preview_mjs_107snq3._.js"].map(b=>a.l(b))).then(()=>b(204460)))},287443,a=>{a.v(b=>Promise.all(["server/chunks/ssr/[externals]__0btd01s._.js","server/chunks/ssr/node_modules__pnpm_0o~d81.._.js","server/chunks/ssr/node_modules__pnpm_0szp2v0._.js"].map(b=>a.l(b))).then(()=>b(170263)))},57386,a=>{a.v(b=>Promise.all(["server/chunks/ssr/0se0_xlsx_xlsx_mjs_12z-ju4._.js"].map(b=>a.l(b))).then(()=>b(86253)))}];
2
2
 
3
- //# sourceMappingURL=%5Broot-of-the-server%5D__0zzulxc._.js.map
3
+ //# sourceMappingURL=%5Broot-of-the-server%5D__01rzr4_._.js.map