markshelf 0.1.0 → 0.1.1

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 (72) 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/server/app/_global-error.html +1 -1
  4. package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
  5. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  6. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  7. package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  8. package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  9. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  10. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  11. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  12. package/.next/standalone/.next/server/app/_not-found.rsc +2 -2
  13. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  14. package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  15. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  16. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  17. package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  18. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  19. package/.next/standalone/.next/server/app/index.html +1 -1
  20. package/.next/standalone/.next/server/app/index.rsc +3 -3
  21. package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  22. package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +3 -3
  23. package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  24. package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +2 -2
  25. package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  26. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  27. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  28. package/.next/standalone/.next/server/chunks/[root-of-the-server]__01cq2u6._.js +1 -1
  29. package/.next/standalone/.next/server/chunks/[root-of-the-server]__04otwp7._.js +1 -1
  30. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0_gt~a4._.js +1 -1
  31. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0owpp0l._.js +1 -1
  32. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0qnrcw7._.js +1 -1
  33. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0yvq0sd._.js +1 -1
  34. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0zoyna0._.js +1 -1
  35. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__09qrkq5._.js +2 -2
  36. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__02xfeo7._.js → [root-of-the-server]__0serya4._.js} +2 -2
  37. package/.next/standalone/.next/server/chunks/ssr/{node_modules_10q7x_t._.js → node_modules_05e-8m3._.js} +1 -1
  38. package/.next/standalone/.next/server/chunks/ssr/{node_modules_0oefcv4._.js → node_modules_06r3o30._.js} +1 -1
  39. package/.next/standalone/.next/server/chunks/ssr/{node_modules_0lys.40._.js → node_modules_09.cbx4._.js} +1 -1
  40. package/.next/standalone/.next/server/chunks/ssr/{node_modules_101pdto._.js → node_modules_0eva9q1._.js} +1 -1
  41. package/.next/standalone/.next/server/chunks/ssr/{node_modules_0743sl0._.js → node_modules_0ic-wja._.js} +1 -1
  42. package/.next/standalone/.next/server/chunks/ssr/{node_modules_0x7iroj._.js → node_modules_0w2-q.z._.js} +1 -1
  43. package/.next/standalone/.next/server/chunks/ssr/{node_modules_00qbe35._.js → node_modules_10cz306._.js} +1 -1
  44. package/.next/standalone/.next/server/chunks/ssr/{node_modules_07zbkkn._.js → node_modules_11wp0ye._.js} +1 -1
  45. package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
  46. package/.next/standalone/.next/server/pages/404.html +1 -1
  47. package/.next/standalone/.next/server/pages/500.html +1 -1
  48. package/.next/standalone/.next/static/chunks/00.xwfz0gk8.7.css +1 -0
  49. package/.next/standalone/.next/static/chunks/{0mul6i_5y5nib.js → 139fj3.hw83eu.js} +2 -2
  50. package/.next/standalone/package.json +1 -1
  51. package/.next/standalone/src/app/api/graph/route.ts +3 -3
  52. package/.next/standalone/src/app/page.tsx +8 -3
  53. package/.next/standalone/src/components/DetailPanel.tsx +5 -0
  54. package/.next/standalone/src/components/Markdown.tsx +2 -0
  55. package/.next/standalone/src/components/PreviewPopup.tsx +10 -2
  56. package/.next/standalone/src/components/TimelinePanel.tsx +50 -20
  57. package/.next/standalone/src/components/TreeView.tsx +2 -0
  58. package/.next/standalone/src/lib/docs.ts +10 -0
  59. package/.next/standalone/src/lib/links.ts +34 -0
  60. package/.next/standalone/test-docs/03_/346/247/213/351/200/240/343/201/256/345/217/257/350/246/226/345/214/226/01_/343/202/253/343/203/274/343/203/211/345/274/217/343/203/204/343/203/252/343/203/274/343/203/254/343/203/263/343/203/200/343/203/252/343/203/263/343/202/260/01_TreeCardView/343/202/263/343/203/263/343/203/235/343/203/274/343/203/215/343/203/263/343/203/210.md +4 -0
  61. package/.next/standalone/tsconfig.tsbuildinfo +1 -1
  62. package/.next/static/chunks/00.xwfz0gk8.7.css +1 -0
  63. package/.next/static/chunks/{0mul6i_5y5nib.js → 139fj3.hw83eu.js} +2 -2
  64. package/package.json +1 -1
  65. package/.next/standalone/.next/static/chunks/0-z8728dfqldb.css +0 -1
  66. package/.next/static/chunks/0-z8728dfqldb.css +0 -1
  67. /package/.next/standalone/.next/static/{DzGgEc3WbQyoCc88EJdiU → sLWumqeSCDw9D_U1fGYFC}/_buildManifest.js +0 -0
  68. /package/.next/standalone/.next/static/{DzGgEc3WbQyoCc88EJdiU → sLWumqeSCDw9D_U1fGYFC}/_clientMiddlewareManifest.js +0 -0
  69. /package/.next/standalone/.next/static/{DzGgEc3WbQyoCc88EJdiU → sLWumqeSCDw9D_U1fGYFC}/_ssgManifest.js +0 -0
  70. /package/.next/static/{DzGgEc3WbQyoCc88EJdiU → sLWumqeSCDw9D_U1fGYFC}/_buildManifest.js +0 -0
  71. /package/.next/static/{DzGgEc3WbQyoCc88EJdiU → sLWumqeSCDw9D_U1fGYFC}/_clientMiddlewareManifest.js +0 -0
  72. /package/.next/static/{DzGgEc3WbQyoCc88EJdiU → sLWumqeSCDw9D_U1fGYFC}/_ssgManifest.js +0 -0
@@ -1,4 +1,4 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,26568,(e,t,n)=>{"use strict";var r=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,i=/\n/g,l=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,c=/^\s+|\s+$/g;function d(e){return e?e.replace(c,""):""}t.exports=function(e,t){if("string"!=typeof e)throw TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,c=1;function f(e){var t=e.match(i);t&&(n+=t.length);var r=e.lastIndexOf("\n");c=~r?e.length-r:c+e.length}function p(){var e={line:n,column:c};return function(t){return t.position=new h(e),g(l),t}}function h(e){this.start=e,this.end={line:n,column:c},this.source=t.source}function m(r){var i=Error(t.source+":"+n+":"+c+": "+r);if(i.reason=r,i.filename=t.source,i.line=n,i.column=c,i.source=e,t.silent);else throw i}function g(t){var n=t.exec(e);if(n){var r=n[0];return f(r),e=e.slice(r.length),n}}function x(e){var t;for(e=e||[];t=y();)!1!==t&&e.push(t);return e}function y(){var t=p();if("/"==e.charAt(0)&&"*"==e.charAt(1)){for(var n=2;""!=e.charAt(n)&&("*"!=e.charAt(n)||"/"!=e.charAt(n+1));)++n;if(n+=2,""===e.charAt(n-1))return m("End of comment missing");var r=e.slice(2,n-2);return c+=2,f(r),e=e.slice(n),c+=2,t({type:"comment",comment:r})}}h.prototype.content=e,g(l);var v,b=[];for(x(b);v=function(){var e=p(),t=g(a);if(t){if(y(),!g(o))return m("property missing ':'");var n=g(s),i=e({type:"declaration",property:d(t[0].replace(r,"")),value:n?d(n[0].replace(r,"")):""});return g(u),i}}();)!1!==v&&(b.push(v),x(b));return b}},70454,(e,t,n)=>{"use strict";var r=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(e,t){let n=null;if(!e||"string"!=typeof e)return n;let r=(0,i.default)(e),l="function"==typeof t;return r.forEach(e=>{if("declaration"!==e.type)return;let{property:r,value:i}=e;l?t(r,i,e):i&&((n=n||{})[r]=i)}),n};let i=r(e.r(26568))},65185,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.camelCase=void 0;var r=/^--[a-zA-Z0-9_-]+$/,i=/-([a-z])/g,l=/^[^-]+$/,a=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,s=function(e,t){return t.toUpperCase()},u=function(e,t){return"".concat(t,"-")};n.camelCase=function(e,t){var n;return(void 0===t&&(t={}),!(n=e)||l.test(n)||r.test(n))?e:(e=e.toLowerCase(),(e=t.reactCompat?e.replace(o,u):e.replace(a,u)).replace(i,s))}},15511,(e,t,n)=>{"use strict";var r=(e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(e.r(70454)),i=e.r(65185);function l(e,t){var n={};return e&&"string"==typeof e&&(0,r.default)(e,function(e,r){e&&r&&(n[(0,i.camelCase)(e,t)]=r)}),n}l.default=l,t.exports=l},4100,(e,t,n)=>{"use strict";var r=Object.prototype.hasOwnProperty,i=Object.prototype.toString,l=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===i.call(e)},s=function(e){if(!e||"[object Object]"!==i.call(e))return!1;var t,n=r.call(e,"constructor"),l=e.constructor&&e.constructor.prototype&&r.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!l)return!1;for(t in e);return void 0===t||r.call(e,t)},u=function(e,t){l&&"__proto__"===t.name?l(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},c=function(e,t){if("__proto__"===t){if(!r.call(e,t))return;else if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,l,a,d=arguments[0],f=1,p=arguments.length,h=!1;for("boolean"==typeof d&&(h=d,d=arguments[1]||{},f=2),(null==d||"object"!=typeof d&&"function"!=typeof d)&&(d={});f<p;++f)if(t=arguments[f],null!=t)for(n in t)r=c(d,n),d!==(i=c(t,n))&&(h&&i&&(s(i)||(l=o(i)))?(l?(l=!1,a=r&&o(r)?r:[]):a=r&&s(r)?r:{},u(d,{name:n,newValue:e(h,a,i)})):void 0!==i&&u(d,{name:n,newValue:i}));return d}},52683,e=>{"use strict";var t=e.i(54131),n=e.i(71645);let r=(...e)=>e.filter((e,t,n)=>!!e&&""!==e.trim()&&n.indexOf(e)===t).join(" ").trim(),i=e=>{let t=e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase());return t.charAt(0).toUpperCase()+t.slice(1)};var l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let a=(0,n.createContext)({}),o=(0,n.forwardRef)(({color:e,size:t,strokeWidth:i,absoluteStrokeWidth:o,className:s="",children:u,iconNode:c,...d},f)=>{let{size:p=24,strokeWidth:h=2,absoluteStrokeWidth:m=!1,color:g="currentColor",className:x=""}=(0,n.useContext)(a)??{},y=o??m?24*Number(i??h)/Number(t??p):i??h;return(0,n.createElement)("svg",{ref:f,...l,width:t??p??l.width,height:t??p??l.height,stroke:e??g,strokeWidth:y,className:r("lucide",x,s),...!u&&!(e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0;return!1})(d)&&{"aria-hidden":"true"},...d},[...c.map(([e,t])=>(0,n.createElement)(e,t)),...Array.isArray(u)?u:[u]])}),s=(e,t)=>{let l=(0,n.forwardRef)(({className:l,...a},s)=>(0,n.createElement)(o,{ref:s,iconNode:t,className:r(`lucide-${i(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,l),...a}));return l.displayName=i(e),l},u=s("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),c=s("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),d=s("folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),f=s("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);function p({entries:e,selectedPath:r,onSelect:i}){let[l,a]=(0,n.useState)(()=>{let t=new Set;for(let n of e)"folder"===n.type&&n.hasReadme&&t.add(n.path);return t}),o=(0,n.useRef)(null),s=(0,n.useRef)(null);(0,n.useEffect)(()=>{let t;if(!r)return;let n=(t=new Set,!function e(n,i){for(let l of n){if("file"===l.type&&l.path===r){for(let e of i)t.add(e);return!0}if("folder"===l.type){if(l.hasReadme&&l.path+"/README.md"===r){for(let e of i)t.add(e);return!0}if(l.children&&e(l.children,[...i,l.path]))return!0}}return!1}(e,[]),t);n.size>0&&a(e=>{let t=new Set(e);for(let e of n)t.add(e);return t}),requestAnimationFrame(()=>{s.current?.scrollIntoView({block:"nearest",behavior:"smooth"})})},[r,e]);let u=(0,n.useCallback)(e=>{a(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]);return(0,t.jsxs)("div",{ref:o,className:"h-full overflow-y-auto py-1 bg-[var(--bg-base)]",children:[e.map(e=>(0,t.jsx)(h,{entry:e,depth:0,selectedPath:r,selectedRef:s,expanded:l,onToggle:u,onSelect:i},e.path)),0===e.length&&(0,t.jsx)("div",{className:"text-[var(--text-muted)] text-[13px] p-4 text-center",children:"マークダウンファイルが見つかりません"})]})}function h({entry:e,depth:n,selectedPath:r,selectedRef:i,expanded:l,onToggle:a,onSelect:o}){let s="folder"===e.type&&!e.hasReadme,p=l.has(e.path),m="folder"===e.type&&e.children&&e.children.length>0,g="file"===e.type?r===e.path:e.hasReadme&&r===e.path+"/README.md";return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{ref:g?i:void 0,onClick:()=>{"folder"===e.type&&e.hasReadme?o(e.path+"/README.md"):s?a(e.path):o(e.path)},className:`
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,26568,(e,t,n)=>{"use strict";var r=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,i=/\n/g,l=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,c=/^\s+|\s+$/g;function d(e){return e?e.replace(c,""):""}t.exports=function(e,t){if("string"!=typeof e)throw TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,c=1;function f(e){var t=e.match(i);t&&(n+=t.length);var r=e.lastIndexOf("\n");c=~r?e.length-r:c+e.length}function p(){var e={line:n,column:c};return function(t){return t.position=new h(e),g(l),t}}function h(e){this.start=e,this.end={line:n,column:c},this.source=t.source}function m(r){var i=Error(t.source+":"+n+":"+c+": "+r);if(i.reason=r,i.filename=t.source,i.line=n,i.column=c,i.source=e,t.silent);else throw i}function g(t){var n=t.exec(e);if(n){var r=n[0];return f(r),e=e.slice(r.length),n}}function x(e){var t;for(e=e||[];t=y();)!1!==t&&e.push(t);return e}function y(){var t=p();if("/"==e.charAt(0)&&"*"==e.charAt(1)){for(var n=2;""!=e.charAt(n)&&("*"!=e.charAt(n)||"/"!=e.charAt(n+1));)++n;if(n+=2,""===e.charAt(n-1))return m("End of comment missing");var r=e.slice(2,n-2);return c+=2,f(r),e=e.slice(n),c+=2,t({type:"comment",comment:r})}}h.prototype.content=e,g(l);var v,b=[];for(x(b);v=function(){var e=p(),t=g(a);if(t){if(y(),!g(o))return m("property missing ':'");var n=g(s),i=e({type:"declaration",property:d(t[0].replace(r,"")),value:n?d(n[0].replace(r,"")):""});return g(u),i}}();)!1!==v&&(b.push(v),x(b));return b}},70454,(e,t,n)=>{"use strict";var r=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(e,t){let n=null;if(!e||"string"!=typeof e)return n;let r=(0,i.default)(e),l="function"==typeof t;return r.forEach(e=>{if("declaration"!==e.type)return;let{property:r,value:i}=e;l?t(r,i,e):i&&((n=n||{})[r]=i)}),n};let i=r(e.r(26568))},65185,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.camelCase=void 0;var r=/^--[a-zA-Z0-9_-]+$/,i=/-([a-z])/g,l=/^[^-]+$/,a=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,s=function(e,t){return t.toUpperCase()},u=function(e,t){return"".concat(t,"-")};n.camelCase=function(e,t){var n;return(void 0===t&&(t={}),!(n=e)||l.test(n)||r.test(n))?e:(e=e.toLowerCase(),(e=t.reactCompat?e.replace(o,u):e.replace(a,u)).replace(i,s))}},15511,(e,t,n)=>{"use strict";var r=(e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(e.r(70454)),i=e.r(65185);function l(e,t){var n={};return e&&"string"==typeof e&&(0,r.default)(e,function(e,r){e&&r&&(n[(0,i.camelCase)(e,t)]=r)}),n}l.default=l,t.exports=l},4100,(e,t,n)=>{"use strict";var r=Object.prototype.hasOwnProperty,i=Object.prototype.toString,l=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===i.call(e)},s=function(e){if(!e||"[object Object]"!==i.call(e))return!1;var t,n=r.call(e,"constructor"),l=e.constructor&&e.constructor.prototype&&r.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!l)return!1;for(t in e);return void 0===t||r.call(e,t)},u=function(e,t){l&&"__proto__"===t.name?l(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},c=function(e,t){if("__proto__"===t){if(!r.call(e,t))return;else if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,l,a,d=arguments[0],f=1,p=arguments.length,h=!1;for("boolean"==typeof d&&(h=d,d=arguments[1]||{},f=2),(null==d||"object"!=typeof d&&"function"!=typeof d)&&(d={});f<p;++f)if(t=arguments[f],null!=t)for(n in t)r=c(d,n),d!==(i=c(t,n))&&(h&&i&&(s(i)||(l=o(i)))?(l?(l=!1,a=r&&o(r)?r:[]):a=r&&s(r)?r:{},u(d,{name:n,newValue:e(h,a,i)})):void 0!==i&&u(d,{name:n,newValue:i}));return d}},52683,e=>{"use strict";var t=e.i(54131),n=e.i(71645);let r=(...e)=>e.filter((e,t,n)=>!!e&&""!==e.trim()&&n.indexOf(e)===t).join(" ").trim(),i=e=>{let t=e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase());return t.charAt(0).toUpperCase()+t.slice(1)};var l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let a=(0,n.createContext)({}),o=(0,n.forwardRef)(({color:e,size:t,strokeWidth:i,absoluteStrokeWidth:o,className:s="",children:u,iconNode:c,...d},f)=>{let{size:p=24,strokeWidth:h=2,absoluteStrokeWidth:m=!1,color:g="currentColor",className:x=""}=(0,n.useContext)(a)??{},y=o??m?24*Number(i??h)/Number(t??p):i??h;return(0,n.createElement)("svg",{ref:f,...l,width:t??p??l.width,height:t??p??l.height,stroke:e??g,strokeWidth:y,className:r("lucide",x,s),...!u&&!(e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0;return!1})(d)&&{"aria-hidden":"true"},...d},[...c.map(([e,t])=>(0,n.createElement)(e,t)),...Array.isArray(u)?u:[u]])}),s=(e,t)=>{let l=(0,n.forwardRef)(({className:l,...a},s)=>(0,n.createElement)(o,{ref:s,iconNode:t,className:r(`lucide-${i(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,l),...a}));return l.displayName=i(e),l},u=s("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),c=s("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),d=s("folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),f=s("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);function p({entries:e,selectedPath:r,onSelect:i}){let[l,a]=(0,n.useState)(()=>{let t=new Set;for(let n of e)"folder"===n.type&&n.hasReadme&&t.add(n.path);return t}),o=(0,n.useRef)(null),s=(0,n.useRef)(null);(0,n.useEffect)(()=>{let t;if(!r)return;let n=(t=new Set,!function e(n,i){for(let l of n){if("file"===l.type&&l.path===r){for(let e of i)t.add(e);return!0}if("folder"===l.type){if(l.hasReadme&&l.path+"/README.md"===r){for(let e of i)t.add(e);return!0}if(l.children&&e(l.children,[...i,l.path]))return!0}}return!1}(e,[]),t);n.size>0&&a(e=>{let t=new Set(e);for(let e of n)t.add(e);return t}),requestAnimationFrame(()=>{s.current?.scrollIntoView({block:"nearest",behavior:"smooth"})})},[r,e]);let u=(0,n.useCallback)(e=>{a(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]);return(0,t.jsxs)("div",{ref:o,className:"h-full overflow-y-auto py-1 bg-[var(--bg-base)]",children:[e.map(e=>(0,t.jsx)(h,{entry:e,depth:0,selectedPath:r,selectedRef:s,expanded:l,onToggle:u,onSelect:i},e.path)),0===e.length&&(0,t.jsx)("div",{className:"text-[var(--text-muted)] text-[13px] p-4 text-center",children:"マークダウンファイルが見つかりません"})]})}function h({entry:e,depth:n,selectedPath:r,selectedRef:i,expanded:l,onToggle:a,onSelect:o}){let s="folder"===e.type&&!e.hasReadme,p=l.has(e.path),m="folder"===e.type&&e.children&&e.children.length>0,g="file"===e.type?r===e.path:e.hasReadme&&r===e.path+"/README.md";return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{ref:g?i:void 0,onClick:()=>{"folder"===e.type&&e.hasReadme?(o(e.path+"/README.md"),m&&!p&&a(e.path)):s?a(e.path):o(e.path)},className:`
2
2
  flex items-center gap-1.5 cursor-pointer select-none
3
3
  h-7 pr-2 text-[12px] leading-none transition-colors
4
4
  ${g?"bg-[var(--brand-primary)]/10 text-[var(--text-primary)]":"text-[var(--text-secondary)] hover:bg-[var(--bg-hover)]"}
@@ -8,4 +8,4 @@ ${e.themeCSS}`),void 0!==e.fontFamily&&(n+=`
8
8
  :root { --mermaid-font-family: ${e.fontFamily}}`),void 0!==e.altFontFamily&&(n+=`
9
9
  :root { --mermaid-alt-font-family: ${e.altFontFamily}}`),t instanceof Map){let r=(0,r0.getEffectiveHtmlLabels)(e)?["> *","span"]:["rect","polygon","ellipse","circle","path"];t.forEach(e=>{(0,iw.default)(e.styles)||r.forEach(t=>{n+=aT(e.id,t,e.styles)}),(0,iw.default)(e.textStyles)||(n+=aT(e.id,"tspan",(e?.textStyles||[]).map(e=>e.replace("color","fill"))))})}return n},"createCssStyles"),aN=(0,r1.__name)((e,t,n,r)=>{var i,l,a;let o=aM(e,n),s=(0,r0.styles_default)(t,o,{...e.themeVariables,theme:e.theme,look:e.look},r);return iv((a=function e(t,n,r,i,l,a,o,s,u){for(var c,d,f,p,h,m,g=0,x=0,y=o,v=0,b=0,k=0,w=1,S=1,C=1,_=0,E="",j=l,A=a,D=i,L=E;S;)switch(k=_,_=ip()){case 40:if(108!=k&&58==ie(L,y-1)){-1!=(h=L+=r7(ig(_),"&","&\f"),m=r9(g?s[g-1]:0),h.indexOf("&\f",m))&&(C=-1);break}case 34:case 39:case 91:L+=ig(_);break;case 9:case 10:case 13:case 32:L+=function(e){for(;iu=ih();)if(iu<33)ip();else break;return im(e)>2||im(iu)>3?"":" "}(k);break;case 92:L+=function(e,t){for(var n;--t&&ip()&&!(iu<48)&&!(iu>102)&&(!(iu>57)||!(iu<65))&&(!(iu>70)||!(iu<97)););return n=is+(t<6&&32==ih()&&32==ip()),it(ic,e,n)}(is-1,7);continue;case 47:switch(ih()){case 42:case 47:ii((c=function(e,t){for(;ip();)if(e+iu===57)break;else if(e+iu===84&&47===ih())break;return"/*"+it(ic,t,is-1)+"*"+r8(47===e?e:ip())}(ip(),is),d=n,f=r,p=u,id(c,d,f,r6,r8(iu),it(c,2,-2),0,p)),u),(5==im(k||1)||5==im(ih()||1))&&ir(L)&&" "!==it(L,-1,void 0)&&(L+=" ");break;default:L+="/"}break;case 123*w:s[g++]=ir(L)*C;case 125*w:case 59:case 0:switch(_){case 0:case 125:S=0;case 59+x:-1==C&&(L=r7(L,/\f/g,"")),b>0&&(ir(L)-y||0===w&&47===k)&&ii(b>32?iy(L+";",i,r,y-1,u):iy(r7(L," ","")+";",i,r,y-2,u),u);break;case 59:L+=";";default:if(ii(D=ix(L,n,r,g,x,l,s,E,j=[],A=[],y,a),a),123===_)if(0===x)e(L,n,D,D,j,a,y,s,A);else{switch(v){case 99:if(110===ie(L,3))break;case 108:if(97===ie(L,2))break;default:x=0;case 100:case 109:case 115:}x?e(t,D,D,i&&ii(ix(t,D,D,0,0,l,s,E,l,j=[],y,A),A),l,A,y,s,i?j:A):e(L,D,D,D,[""],A,0,s,A)}}g=x=b=0,w=C=1,E=L="",y=o;break;case 58:y=1+ir(L),b=k;default:if(w<1){if(123==_)--w;else if(125==_&&0==w++&&125==(iu=is>0?ie(ic,--is):0,ia--,10===iu&&(ia=1,il--),iu))continue}switch(L+=r8(_),_*w){case 38:C=x>0?1:(L+="\f",-1);break;case 44:s[g++]=(ir(L)-1)*C,C=1;break;case 64:45===ih()&&(L+=ig(ip())),v=ih(),x=y=ir(E=L+=function(e){for(;!im(ih());)ip();return it(ic,e,is)}(is)),_++;break;case 45:45===k&&2==ir(L)&&(w=0)}}return a}("",null,null,null,[""],(l=i=`${r}{${s}}`,il=ia=1,io=ir(ic=l),is=0,i=[]),0,[0],i),ic="",a),ib)},"createUserStyles"),az=(0,r1.__name)((e="",t,n)=>{let r=e;return n||t||(r=r.replace(/marker-end="url\([\d+./:=?A-Za-z-]*?#/g,'marker-end="url(#')),r=(r=(0,rG.decodeEntities)(r)).replace(/<br>/g,"<br/>")},"cleanUpSvgCode"),aP=(0,r1.__name)((e="",t)=>{let n=t?.viewBox?.baseVal?.height?t.viewBox.baseVal.height+"px":"100%",r=aE(`<body style="margin:0">${e}</body>`);return`<iframe style="width:100%;height:${n};border:0;margin:0;" src="data:text/html;charset=UTF-8;base64,${r}" sandbox="allow-top-navigation-by-user-activation allow-popups">
10
10
  The "iframe" tag is not supported by your browser.
11
- </iframe>`},"putIntoIFrame"),aI=(0,r1.__name)((e,t,n,r,i)=>{let l=e.append("div");l.attr("id",n),r&&l.attr("style",r);let a=l.append("svg").attr("id",t).attr("width","100%").attr("xmlns","http://www.w3.org/2000/svg");return i&&a.attr("xmlns:xlink",i),a.append("g"),e},"appendDivSvgG");function aR(e,t){return e.append("iframe").attr("id",t).attr("style","width: 100%; height: 100%;").attr("sandbox","")}(0,r1.__name)(aR,"sandboxedIframe");var aF=(0,r1.__name)((e,t,n,r)=>{e.getElementById(t)?.remove(),e.getElementById(n)?.remove(),e.getElementById(r)?.remove()},"removeExistingElements"),aO=(0,r1.__name)(async function(e,t,n){let r,i;ap();let l=aD(t);t=l.code;let a=(0,r0.getConfig)();r1.log.debug(a),t.length>(a?.maxTextSize??5e4)&&(t="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa");let o="#"+e,s="i"+e,u="#"+s,c="d"+e,d="#"+c,f=(0,r1.__name)(()=>{let e=h?u:d,t=(0,r4.select)(e).node();t&&"remove"in t&&t.remove()},"removeTempElements"),p=(0,r4.select)("body"),h="sandbox"===a.securityLevel,m="loose"===a.securityLevel,g=a.fontFamily;if(void 0!==n){if(n&&(n.innerHTML=""),h){let e=aR((0,r4.select)(n),s);(p=(0,r4.select)(e.nodes()[0].contentDocument.body)).node().style.margin=0}else p=(0,r4.select)(n);aI(p,e,c,`font-family: ${g}`,"http://www.w3.org/1999/xlink")}else{if(aF(document,e,c,s),h){let e=aR((0,r4.select)("body"),s);(p=(0,r4.select)(e.nodes()[0].contentDocument.body)).node().style.margin=0}else p=(0,r4.select)("body");aI(p,e,c)}try{r=await ax.fromText(t,{title:l.title})}catch(e){if(a.suppressErrorRendering)throw f(),e;r=await ax.fromText("error"),i=e}let x=p.select(d).node(),y=r.type,v=x.firstChild,b=v.firstChild,k=aN(a,y,r.renderer.getClasses?.(t,r),o),w=document.createElement("style");w.innerHTML=k,v.insertBefore(w,b);try{await r.renderer.draw(t,e,"11.14.0",r)}catch(n){throw a.suppressErrorRendering?f():ly.draw(t,e,"11.14.0"),n}aU(y,p.select(`${d} svg`),r.db.getAccTitle?.(),r.db.getAccDescription?.()),p.select(`[id="${e}"]`).selectAll("foreignobject > *").attr("xmlns","http://www.w3.org/1999/xhtml");let S=p.select(d).node().innerHTML;if(r1.log.debug("config.arrowMarkerAbsolute",a.arrowMarkerAbsolute),S=az(S,h,(0,r0.evaluate)(a.arrowMarkerAbsolute)),h?S=aP(S,p.select(d+" svg").node()):m||(S=ik.default.sanitize(S,{ADD_TAGS:aj,ADD_ATTR:aA,HTML_INTEGRATION_POINTS:{foreignobject:!0}})),av(),i)throw i;return f(),{diagramType:y,svg:S,bindFunctions:r.db.bindFunctions}},"render");function aB(e={}){let t=(0,r0.assignWithDepth_default)({},e);t?.fontFamily&&!t.themeVariables?.fontFamily&&(t.themeVariables||(t.themeVariables={}),t.themeVariables.fontFamily=t.fontFamily),(0,r0.saveConfigFromInitialize)(t),t?.theme&&t.theme in r0.themes_default?t.themeVariables=r0.themes_default[t.theme].getThemeVariables(t.themeVariables):t&&(t.themeVariables=r0.themes_default.default.getThemeVariables(t.themeVariables));let n="object"==typeof t?(0,r0.setSiteConfig)(t):(0,r0.getSiteConfig)();(0,r1.setLogLevel)(n.logLevel),ap()}(0,r1.__name)(aB,"initialize");var aH=(0,r1.__name)((e,t={})=>{let{code:n}=a_(e);return ax.fromText(n,t)},"getDiagramFromText");function aU(e,t,n,r){am(t,e),ag(t,n,r,t.attr("id"))}(0,r1.__name)(aU,"addA11yInfo");var a$=Object.freeze({render:aO,parse:aL,getDiagramFromText:aH,initialize:aB,getConfig:r0.getConfig,setConfig:r0.setConfig,getSiteConfig:r0.getSiteConfig,updateSiteConfig:r0.updateSiteConfig,reset:(0,r1.__name)(()=>{(0,r0.reset)()},"reset"),globalReset:(0,r1.__name)(()=>{(0,r0.reset)(r0.defaultConfig)},"globalReset"),defaultConfig:r0.defaultConfig});(0,r1.setLogLevel)((0,r0.getConfig)().logLevel),(0,r0.reset)((0,r0.getConfig)());var aq=(0,r1.__name)((e,t,n)=>{r1.log.warn(e),(0,rG.isDetailedError)(e)?(n&&n(e.str,e.hash),t.push({...e,message:e.str,error:e})):(n&&n(e),e instanceof Error&&t.push({str:e.message,message:e.message,hash:e.name,error:e}))},"handleError"),aV=(0,r1.__name)(async function(e={querySelector:".mermaid"}){try{await aW(e)}catch(t){if((0,rG.isDetailedError)(t)&&r1.log.error(t.str),a6.parseError&&a6.parseError(t),!e.suppressErrors)throw r1.log.error("Use the suppressErrors option to suppress these errors"),t}},"run"),aW=(0,r1.__name)(async function({postRenderCallback:e,querySelector:t,nodes:n}={querySelector:".mermaid"}){let r,i,l=a$.getConfig();if(r1.log.debug(`${!e?"No ":""}Callback function found`),n)r=n;else if(t)r=document.querySelectorAll(t);else throw Error("Nodes and querySelector are both undefined");r1.log.debug(`Found ${r.length} diagrams`),l?.startOnLoad!==void 0&&(r1.log.debug("Start On Load: "+l?.startOnLoad),a$.updateSiteConfig({startOnLoad:l?.startOnLoad}));let a=new rG.utils_default.InitIDGenerator(l.deterministicIds,l.deterministicIDSeed),o=[];for(let t of Array.from(r)){if(r1.log.info("Rendering diagram: "+t.id),t.getAttribute("data-processed"))continue;t.setAttribute("data-processed","true");let n=`mermaid-${a.next()}`;i=t.innerHTML,i=(0,r2.dedent)(rG.utils_default.entityDecode(i)).trim().replace(/<br\s*\/?>/gi,"<br/>");let r=rG.utils_default.detectInit(i);r&&r1.log.debug("Detected early reinit: ",r);try{let{svg:r,bindFunctions:l}=await a2(n,i,t);t.innerHTML=r,e&&await e(n),l&&l(t)}catch(e){aq(e,o,a6.parseError)}}if(o.length>0)throw o[0]},"runThrowsErrors"),aK=(0,r1.__name)(function(e){a$.initialize(e)},"initialize"),aQ=(0,r1.__name)(async function(e,t,n){r1.log.warn("mermaid.init is deprecated. Please use run instead."),e&&aK(e);let r={postRenderCallback:n,querySelector:".mermaid"};"string"==typeof t?r.querySelector=t:t&&(t instanceof HTMLElement?r.nodes=[t]:r.nodes=t),await aV(r)},"init"),aZ=(0,r1.__name)(async(e,{lazyLoad:t=!0}={})=>{ap(),(0,r0.registerLazyLoadedDiagrams)(...e),!1===t&&await ah()},"registerExternalDiagrams"),aJ=(0,r1.__name)(function(){if(a6.startOnLoad){let{startOnLoad:e}=a$.getConfig();e&&a6.run().catch(e=>r1.log.error("Mermaid failed to initialize",e))}},"contentLoaded");"u">typeof document&&window.addEventListener("load",aJ,!1);var aX=(0,r1.__name)(function(e){a6.parseError=e},"setParseErrorHandler"),aY=[],aG=!1,a0=(0,r1.__name)(async()=>{if(!aG){for(aG=!0;aY.length>0;){let e=aY.shift();if(e)try{await e()}catch(e){r1.log.error("Error executing queue",e)}}aG=!1}},"executeQueue"),a1=(0,r1.__name)(async(e,t)=>new Promise((n,r)=>{let i=(0,r1.__name)(()=>new Promise((i,l)=>{a$.parse(e,t).then(e=>{i(e),n(e)},e=>{r1.log.error("Error parsing",e),a6.parseError?.(e),l(e),r(e)})}),"performCall");aY.push(i),a0().catch(r)}),"parse"),a2=(0,r1.__name)((e,t,n)=>new Promise((r,i)=>{let l=(0,r1.__name)(()=>new Promise((l,a)=>{a$.render(e,t,n).then(e=>{l(e),r(e)},e=>{r1.log.error("Error parsing",e),a6.parseError?.(e),a(e),i(e)})}),"performCall");aY.push(l),a0().catch(i)}),"render"),a4=(0,r1.__name)(()=>Object.keys(r0.detectors).map(e=>({id:e})),"getRegisteredDiagramsMetadata"),a6={startOnLoad:!0,mermaidAPI:a$,parse:a1,render:a2,init:aQ,run:aV,registerExternalDiagrams:aZ,registerLayoutLoaders:rX.registerLayoutLoaders,initialize:aK,parseError:void 0,contentLoaded:aJ,setParseErrorHandler:aX,detectType:r0.detectType,registerIconPacks:rY.registerIconPacks,getRegisteredDiagramsMetadata:a4};let a3=!1,a5=0;function a9({code:e}){let r=(0,n.useRef)(null),[i,l]=(0,n.useState)(null),[a,o]=(0,n.useState)(null),s=(0,n.useRef)(`mermaid-${++a5}`);return((0,n.useEffect)(()=>{let t=!1;return a3||(a3=!0,a6.initialize({startOnLoad:!1,theme:"default",securityLevel:"loose",fontFamily:"system-ui, sans-serif"})),(async()=>{try{let{svg:n}=await a6.render(s.current,e);t||(l(n),o(null))}catch(n){t||(o(n instanceof Error?n.message:"Mermaid render error"),l(null));let e=document.getElementById("d"+s.current);e?.remove()}})(),()=>{t=!0}},[e]),a)?(0,t.jsxs)("div",{className:"border border-red-200 bg-red-50 rounded p-3 text-xs text-red-700",children:[(0,t.jsx)("div",{className:"font-medium mb-1",children:"Mermaid エラー"}),(0,t.jsx)("pre",{className:"whitespace-pre-wrap",children:e})]}):i?(0,t.jsx)("div",{ref:r,className:"my-2 overflow-x-auto",dangerouslySetInnerHTML:{__html:i}}):(0,t.jsx)("div",{className:"text-xs text-[var(--text-muted)] py-2",children:"図を描画中..."})}function a8(e){return e.toLowerCase().replace(/[^\p{L}\p{N}\s-]/gu,"").replace(/\s+/g,"-").replace(/-+/g,"-").trim()}function a7({children:e,onHeadingsExtracted:r,fileRefs:i,currentPath:l,onNavigate:a,onPreviewShow:o,onPreviewHide:s}){let u=(0,n.useMemo)(()=>(function(e){let t,n=[],r=new Map,i=/^(#{1,4})\s+(.+)$/gm;for(;null!==(t=i.exec(e));){let e=t[1].length,i=t[2].replace(/[#*_`[\]]/g,"").trim(),l=a8(i)||"heading",a=r.get(l)??0;r.set(l,a+1);let o=0===a?l:`${l}-${a}`;n.push({id:o,text:i,level:e})}return n})(e),[e]),c=(0,n.useMemo)(()=>{let e=new Map;for(let t of u){let n=e.get(t.text)??[];n.push(t.id),e.set(t.text,n)}return e},[u]),d=(0,n.useMemo)(()=>new Map,[u]);(0,n.useEffect)(()=>{r?.(u)},[u,r]);let f=(0,n.useMemo)(()=>{if(!i||0===i.length)return null;let e=new Map;for(let t of i.filter(e=>e.displayName.length>2&&e.path!==l).sort((e,t)=>t.displayName.length-e.displayName.length))e.set(t.displayName,t.path);return e},[i,l]),p=(0,n.useMemo)(()=>{if(!f||0===f.size)return null;let e=Array.from(f.keys()).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"));return RegExp(`(${e.join("|")})`,"g")},[f]);function h(e){return function(n){let r=function(e){let t=c.get(e);if(!t)return a8(e)||"heading";let n=d.get(e)??0;return d.set(e,n+1),t[n%t.length]}("string"==typeof n.children?n.children:function e(t){return"string"==typeof t?t:"number"==typeof t?String(t):Array.isArray(t)?t.map(e).join(""):t&&"object"==typeof t&&"props"in t?e(t.props.children):""}(n.children)),i={...n,id:r};switch(e){case 1:return(0,t.jsx)("h1",{...i});case 2:return(0,t.jsx)("h2",{...i});case 3:return(0,t.jsx)("h3",{...i});default:return(0,t.jsx)("h4",{...i})}}}let m={h1:h(1),h2:h(2),h3:h(3),h4:h(4),code:({className:e,children:n,...r})=>{if(/language-mermaid/.exec(e||"")){let e=String(n).replace(/\n$/,"");return(0,t.jsx)(a9,{code:e})}return(0,t.jsx)("code",{className:e,...r,children:n})},pre:({children:e})=>e&&"object"==typeof e&&"type"in e&&e.type===a9?(0,t.jsx)(t.Fragment,{children:e}):(0,t.jsx)("pre",{children:e}),a:({href:e,children:n,...r})=>{if(e?.startsWith("autolink:")){let r=e.slice(9);return(0,t.jsx)("span",{className:"text-[var(--brand-primary)] border-b border-dashed border-[var(--brand-primary)] cursor-pointer hover:bg-blue-50 transition-colors",onClick:e=>{e.preventDefault(),a?.(r)},onMouseEnter:e=>{let t=e.target.getBoundingClientRect();o?.(r,t)},onMouseLeave:()=>s?.(),children:n})}return(0,t.jsx)("a",{href:e,...r,children:n})},p:({children:e,...n})=>(0,t.jsx)("p",{...n,children:g(e)}),li:({children:e,...n})=>(0,t.jsx)("li",{...n,children:g(e)}),td:({children:e,...n})=>(0,t.jsx)("td",{...n,children:g(e)})};function g(e){return p&&f?"string"==typeof e?x(e):Array.isArray(e)?e.map((e,n)=>"string"==typeof e?(0,t.jsx)("span",{children:x(e)},n):e):e:e}function x(e){let n;if(!p||!f)return e;let r=[],i=0;for(p.lastIndex=0;null!==(n=p.exec(e));){let l=n[0],u=f.get(l);u&&(n.index>i&&r.push(e.slice(i,n.index)),r.push((0,t.jsx)("span",{className:"text-[var(--brand-primary)] border-b border-dashed border-[var(--brand-primary)] cursor-pointer hover:bg-blue-50 transition-colors",onClick:e=>{e.preventDefault(),a?.(u)},onMouseEnter:e=>{let t=e.target.getBoundingClientRect();o?.(u,t)},onMouseLeave:()=>s?.(),children:l},`${n.index}-${l}`)),i=n.index+l.length)}return i<e.length&&r.push(e.slice(i)),0===r.length?e:r}return(0,t.jsx)("div",{className:"prose prose-sm max-w-none prose-headings:font-semibold prose-headings:tracking-tight prose-headings:text-[var(--text-primary)] prose-h1:text-lg prose-h1:leading-snug prose-h1:mb-4 prose-h2:text-[15px] prose-h2:leading-snug prose-h2:border-b prose-h2:border-[var(--border-default)] prose-h2:pb-2 prose-h2:mt-8 prose-h2:mb-3 prose-h3:text-[13px] prose-h3:leading-snug prose-h3:mt-6 prose-h3:mb-2 prose-p:text-[var(--text-secondary)] prose-p:text-[13px] prose-p:leading-[1.75] prose-li:text-[var(--text-secondary)] prose-li:text-[13px] prose-li:leading-[1.75] prose-strong:text-[var(--text-primary)] prose-strong:font-semibold prose-a:text-[var(--brand-primary)] prose-a:font-medium prose-a:no-underline hover:prose-a:underline prose-code:text-xs prose-code:text-[var(--text-primary)] prose-code:bg-[var(--bg-muted)] prose-code:px-1 prose-code:py-0.5 prose-code:rounded prose-code:before:content-none prose-code:after:content-none prose-pre:bg-[var(--bg-muted)] prose-pre:text-xs prose-pre:text-[var(--text-primary)] prose-table:text-[12px] prose-th:bg-[var(--bg-muted)] prose-th:text-[var(--text-primary)] prose-th:font-semibold prose-th:px-3 prose-th:py-1.5 prose-th:text-left prose-td:px-3 prose-td:py-1.5 prose-td:border-[var(--border-default)] prose-td:text-[var(--text-secondary)] prose-hr:border-[var(--border-default)] prose-blockquote:border-l-[var(--brand-primary)] prose-blockquote:text-[var(--text-muted)] prose-blockquote:not-italic prose-img:rounded-lg ",children:(0,t.jsx)(nR,{remarkPlugins:[rQ],components:m,children:e})})}let oe=s("git-commit-horizontal",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]]);function ot({filePath:e,hash:r}){let[i,l]=(0,n.useState)(null);return((0,n.useEffect)(()=>{l(null),fetch(`/api/diff?path=${encodeURIComponent(e)}&hash=${r}`).then(e=>e.json()).then(e=>l(e.diff)).catch(()=>l("(差分を取得できませんでした)"))},[e,r]),null===i)?(0,t.jsx)("div",{className:"text-[12px] text-[var(--text-muted)] py-2",children:"差分を読み込み中..."}):(0,t.jsx)("pre",{className:"text-[11px] font-[var(--font-mono)] bg-[var(--bg-muted)] rounded-lg p-3 overflow-x-auto leading-[1.7] border border-[var(--border-default)]",children:i.split("\n").filter(e=>!e.startsWith("diff --git")&&!e.startsWith("index ")&&!e.startsWith("new file")&&!e.startsWith("deleted file")&&!e.startsWith("similarity")&&!e.startsWith("rename ")&&!e.startsWith("old mode")&&!e.startsWith("new mode")).map((e,n)=>{let r="var(--text-secondary)",i="transparent";return e.startsWith("+")&&!e.startsWith("+++")?(r="var(--add-color)",i="var(--add-bg)"):e.startsWith("-")&&!e.startsWith("---")?(r="var(--del-color)",i="var(--del-bg)"):e.startsWith("@@")&&(r="var(--brand-primary)"),(0,t.jsx)("div",{style:{color:r,backgroundColor:i},className:"px-1 -mx-1 rounded-sm",children:e},n)})})}function on({filePath:e}){let[r,i]=(0,n.useState)([]),[l,a]=(0,n.useState)(!0),[o,s]=(0,n.useState)(null);return((0,n.useEffect)(()=>{a(!0),s(null),fetch(`/api/history?path=${encodeURIComponent(e)}`).then(e=>e.json()).then(e=>{i(e),a(!1)}).catch(()=>a(!1))},[e]),l)?(0,t.jsx)("div",{className:"p-4 text-[var(--text-muted)] text-[13px]",children:"読み込み中..."}):0===r.length?(0,t.jsx)("div",{className:"p-4 text-[var(--text-muted)] text-[13px]",children:"変更履歴がありません(git 管理外の可能性)"}):(0,t.jsx)("div",{className:"divide-y divide-[var(--border-default)]",children:r.map(n=>{let r=o===n.hash;return(0,t.jsxs)("div",{children:[(0,t.jsx)("button",{onClick:()=>s(r?null:n.hash),className:"w-full text-left px-4 py-3 hover:bg-[var(--bg-hover)] transition-colors",children:(0,t.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,t.jsx)(oe,{size:13,className:"text-[var(--text-muted)] mt-0.5 shrink-0"}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-[11px] font-[var(--font-mono)] text-[var(--brand-primary)] leading-none",children:n.hashShort}),(0,t.jsx)("span",{className:"text-[11px] text-[var(--text-muted)] leading-none",children:new Date(n.date).toLocaleString("ja-JP",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}),n.author&&(0,t.jsx)("span",{className:"text-[11px] text-[var(--text-muted)] leading-none",children:n.author})]}),(0,t.jsx)("p",{className:"text-[12px] text-[var(--text-secondary)] mt-1 leading-snug line-clamp-2",children:n.message})]}),(0,t.jsx)("span",{className:"text-[var(--text-muted)] shrink-0 mt-0.5",children:r?(0,t.jsx)(u,{size:13}):(0,t.jsx)(c,{size:13})})]})}),r&&(0,t.jsx)("div",{className:"px-4 pb-3",children:(0,t.jsx)(ot,{filePath:e,hash:n.hash})})]},n.hash)})})}function or({headings:e,scrollContainer:r}){let[i,l]=(0,n.useState)(null),a=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(!r||0===e.length)return;a.current?.disconnect();let t=new IntersectionObserver(e=>{for(let t of e)t.isIntersecting&&l(t.target.id)},{root:r,rootMargin:"0px 0px -70% 0px",threshold:.1});for(let n of(a.current=t,e)){let e=document.getElementById(n.id);e&&t.observe(e)}return()=>t.disconnect()},[e,r]);let o=(0,n.useCallback)(e=>{let t=document.getElementById(e);t&&(t.scrollIntoView({behavior:"smooth",block:"start"}),l(e))},[]);return 0===e.length?null:(0,t.jsxs)("nav",{className:"py-3 px-2 space-y-px",children:[(0,t.jsx)("div",{className:"text-[10px] font-medium text-[var(--text-muted)] tracking-wider uppercase px-1.5 mb-1.5",children:"目次"}),e.map(e=>(0,t.jsx)("button",{onClick:()=>o(e.id),className:`block w-full text-left text-[11px] leading-relaxed py-0.5 truncate transition-colors rounded px-1.5 ${i===e.id?"text-[var(--brand-primary)] font-medium bg-blue-50":"text-[var(--text-muted)] hover:text-[var(--text-secondary)] hover:bg-[var(--bg-hover)]"}`,style:{paddingLeft:`${(e.level-1)*10+6}px`},title:e.text,children:e.text},e.id))]})}let oi=s("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);function ol({path:e,position:r,onNavigate:i,onMouseEnter:l,onMouseLeave:a,fileRefs:o,depth:s=0}){let[u,c]=(0,n.useState)(null),[d,f]=(0,n.useState)(!1),p=(0,n.useRef)(null),[h,m]=(0,n.useState)(null),[g,x]=(0,n.useState)(null),[y,v]=(0,n.useState)(null),b=(0,n.useRef)(null),k=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(!e){c(null),x(null),v(null);return}f(!0),c(null),x(null),v(null),fetch(`/api/file?path=${encodeURIComponent(e)}`).then(e=>e.json()).then(e=>c(e.content??null)).catch(()=>c(null)).finally(()=>f(!1))},[e]),(0,n.useEffect)(()=>{if(!r||!p.current)return void m(r);let e=p.current.getBoundingClientRect(),t=window.innerWidth,n=window.innerHeight,{x:i,y:l}=r;i+e.width>t-16&&(i=t-e.width-16),i<16&&(i=16),l+e.height>n-16&&(l=r.y-e.height-8),m({x:i,y:l})},[r,u]);let w=(0,n.useCallback)((e,t)=>{s>=3||(k.current&&clearTimeout(k.current),b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{x(e),v({x:t.right+8,y:t.top})},200))},[s]),S=(0,n.useCallback)(()=>{b.current&&clearTimeout(b.current),k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{x(null),v(null)},300)},[]),C=(0,n.useCallback)(()=>{k.current&&clearTimeout(k.current)},[]),_=(0,n.useCallback)(()=>{S()},[S]);if(!e||!r)return null;let E=e.split("/").pop()?.replace(/\.md$/i,"")||e;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{ref:p,onMouseEnter:l,onMouseLeave:()=>{a(),S()},className:"fixed bg-[var(--bg-surface)] border border-[var(--border-default)] rounded-lg shadow-xl w-[480px] max-h-[420px] overflow-y-auto",style:{left:h?.x??r.x,top:h?.y??r.y,zIndex:50+s},children:[(0,t.jsx)("div",{className:"sticky top-0 bg-[var(--bg-surface)] border-b border-[var(--border-default)] px-3 py-2 flex items-center gap-2",children:(0,t.jsxs)("button",{onClick:()=>i(e),className:"text-xs font-medium text-[var(--brand-primary)] hover:underline truncate flex items-center gap-1",children:[E,(0,t.jsx)(oi,{size:10})]})}),(0,t.jsx)("div",{className:"p-3",children:d?(0,t.jsx)("div",{className:"text-xs text-[var(--text-muted)]",children:"読み込み中..."}):u?(0,t.jsx)("div",{className:"text-[11px]",children:(0,t.jsx)(a7,{fileRefs:o,currentPath:e,onNavigate:i,onPreviewShow:w,onPreviewHide:S,children:u})}):(0,t.jsx)("div",{className:"text-xs text-[var(--text-muted)]",children:"プレビューを表示できません"})})]}),(0,t.jsx)(ol,{path:g,position:y,onNavigate:i,onMouseEnter:C,onMouseLeave:_,fileRefs:o,depth:s+1})]})}var oa=e.i(77871);function oo({currentPath:e,onNavigate:r}){let i=(0,n.useRef)(null),l=(0,n.useRef)(null),[a,o]=(0,n.useState)(!0),[s,u]=(0,n.useState)(!1),[c,d]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{let t=!1;return o(!0),u(!1),d(!1),fetch("/api/graph").then(e=>e.json()).then(n=>{if(t||!i.current)return;let a=new Set;for(let t of(a.add(e),n.edges))t.source===e&&a.add(t.target),t.target===e&&a.add(t.source);let s=n.nodes.filter(e=>a.has(e.id)),c=n.edges.filter(e=>a.has(e.source)&&a.has(e.target));if(0===s.length){u(!0),o(!1);return}l.current?.destroy();let f=(0,oa.default)({container:i.current,elements:[...s.map(t=>({data:{id:t.id,label:t.label,isCurrent:t.id===e}})),...c.map((e,t)=>({data:{id:`e${t}`,source:e.source,target:e.target}}))],style:[{selector:"node",style:{label:"data(label)","text-valign":"bottom","text-halign":"center","font-size":"11px","font-family":"var(--font-sans)",color:"#4a5060","text-margin-y":6,"background-color":"#e8f0fe","border-width":2,"border-color":"#3b7ddb",width:28,height:28,"text-max-width":"100px","text-wrap":"ellipsis",cursor:"pointer"}},{selector:"node[?isCurrent]",style:{"background-color":"#2563eb","border-color":"#1d4ed8",color:"#1a1d23","font-weight":"bold",width:36,height:36}},{selector:"edge",style:{width:1.5,"line-color":"#c8ccd3","target-arrow-color":"#c8ccd3","target-arrow-shape":"triangle","curve-style":"bezier","arrow-scale":.8}},{selector:"node:active",style:{"overlay-opacity":0}}],layout:{name:"concentric",animate:!1,padding:50,minNodeSpacing:80,concentric:e=>e.data("isCurrent")?10:1,levelWidth:()=>1},userZoomingEnabled:!0,userPanningEnabled:!0,boxSelectionEnabled:!1,autoungrabify:!1});requestAnimationFrame(()=>{f.resize(),f.fit(void 0,50),f.zoom()>1.2&&f.zoom({level:1.2,renderedPosition:{x:i.current.clientWidth/2,y:i.current.clientHeight/2}}),f.center(f.nodes("[?isCurrent]")),d(!0)}),f.on("mouseover","node",e=>{let t=e.target;t.data("isCurrent")||t.style({"background-color":"#dbeafe","border-color":"#2563eb",color:"#1a1d23"}),i.current.style.cursor="pointer"}),f.on("mouseout","node",e=>{let t=e.target;t.data("isCurrent")||t.style({"background-color":"#e8f0fe","border-color":"#3b7ddb",color:"#4a5060"}),i.current.style.cursor="default"}),f.on("tap","node",t=>{let n=t.target.id();n!==e&&r(n)}),l.current=f,o(!1)}).catch(()=>{t||(u(!0),o(!1))}),()=>{t=!0,l.current?.destroy(),l.current=null}},[e,r]),(0,t.jsxs)("div",{className:"h-full flex flex-col relative",children:[(a||s)&&(0,t.jsx)("div",{className:"absolute inset-0 flex items-center justify-center text-[13px] text-[var(--text-muted)] z-10 bg-[var(--bg-surface)]",children:a?"グラフを構築中...":"このドキュメントへのリンクはありません"}),(0,t.jsx)("div",{ref:i,className:"flex-1 min-h-0 transition-opacity duration-150",style:{opacity:+!!c}})]})}let os=s("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]),ou=s("network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]),oc=s("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);function od({filePath:e,fileRefs:r,onNavigate:i,onGoBack:l,canGoBack:a}){let[o,s]=(0,n.useState)(null),[u,c]=(0,n.useState)("content"),[d,p]=(0,n.useState)([]),[h,m]=(0,n.useState)(()=>{{let e=localStorage.getItem("markshelf:tocWidth");return e&&Number(e)||176}}),g=(0,n.useRef)(null),x=(0,n.useRef)(null),[y,v]=(0,n.useState)(null),[b,k]=(0,n.useState)(null),w=(0,n.useRef)(null),S=(0,n.useRef)(null);(0,n.useEffect)(()=>{s(null),p([]),fetch(`/api/file?path=${encodeURIComponent(e)}`).then(e=>e.json()).then(e=>s(e.content??null)).catch(()=>s(null))},[e]);let C=(0,n.useCallback)((e,t)=>{S.current&&clearTimeout(S.current),w.current&&clearTimeout(w.current),w.current=setTimeout(()=>{v(e),k({x:t.left,y:t.bottom+4})},200)},[]),_=(0,n.useCallback)(()=>{w.current&&clearTimeout(w.current),S.current&&clearTimeout(S.current),S.current=setTimeout(()=>{v(null),k(null)},300)},[]),E=(0,n.useCallback)(()=>{S.current&&clearTimeout(S.current)},[]),j=(0,n.useCallback)(()=>{_()},[_]),A=(0,n.useCallback)(e=>{e.preventDefault(),document.body.style.userSelect="none",document.body.style.cursor="col-resize";let t=x.current?.parentElement,n=e=>{if(!t)return;let n=Math.max(120,Math.min(400,t.getBoundingClientRect().right-e.clientX));m(n),localStorage.setItem("markshelf:tocWidth",String(n))},r=()=>{document.body.style.userSelect="",document.body.style.cursor="",document.removeEventListener("mousemove",n),document.removeEventListener("mouseup",r)};document.addEventListener("mousemove",n),document.addEventListener("mouseup",r)},[]),D=e.split("/").pop()?.replace(/\.md$/i,"")||e;return(0,t.jsxs)("div",{className:"flex flex-col h-full",children:[(0,t.jsxs)("div",{className:"border-b border-[var(--border-default)] px-4 py-2.5 shrink-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[a&&(0,t.jsx)("button",{onClick:l,className:"shrink-0 p-0.5 rounded hover:bg-[var(--bg-muted)] text-[var(--text-muted)] hover:text-[var(--text-secondary)] transition-colors",title:"戻る",children:(0,t.jsx)(oc,{size:14})}),(0,t.jsx)("h2",{className:"font-semibold text-[14px] leading-snug truncate text-[var(--text-primary)]",children:D})]}),(0,t.jsxs)("div",{className:"flex gap-1",children:[(0,t.jsxs)("button",{onClick:()=>c("content"),className:`flex items-center gap-1.5 px-2.5 py-1 rounded-md text-[12px] font-medium transition-colors ${"content"===u?"bg-[var(--brand-primary)] text-white":"text-[var(--text-muted)] hover:bg-[var(--bg-muted)] hover:text-[var(--text-secondary)]"}`,children:[(0,t.jsx)(f,{size:12}),"内容"]}),(0,t.jsxs)("button",{onClick:()=>c("history"),className:`flex items-center gap-1.5 px-2.5 py-1 rounded-md text-[12px] font-medium transition-colors ${"history"===u?"bg-[var(--brand-primary)] text-white":"text-[var(--text-muted)] hover:bg-[var(--bg-muted)] hover:text-[var(--text-secondary)]"}`,children:[(0,t.jsx)(os,{size:12}),"変更履歴"]}),(0,t.jsxs)("button",{onClick:()=>c("links"),className:`flex items-center gap-1.5 px-2.5 py-1 rounded-md text-[12px] font-medium transition-colors ${"links"===u?"bg-[var(--brand-primary)] text-white":"text-[var(--text-muted)] hover:bg-[var(--bg-muted)] hover:text-[var(--text-secondary)]"}`,children:[(0,t.jsx)(ou,{size:12}),"リンク"]})]})]}),"content"===u?null!==o?(0,t.jsxs)("div",{className:"flex-1 flex overflow-hidden",children:[(0,t.jsx)("div",{className:"flex-1 overflow-y-auto",ref:g,children:(0,t.jsx)("div",{className:"p-4",children:(0,t.jsx)(a7,{onHeadingsExtracted:p,fileRefs:r,currentPath:e,onNavigate:i,onPreviewShow:C,onPreviewHide:_,children:o})})}),d.length>0&&(0,t.jsxs)("div",{className:"flex shrink-0",ref:x,children:[(0,t.jsx)("div",{className:"w-1 hover:bg-[var(--brand-primary)] bg-[var(--border-default)] cursor-col-resize shrink-0 transition-colors duration-150",onMouseDown:A}),(0,t.jsx)("div",{className:"overflow-y-auto border-l border-[var(--border-default)]",style:{width:h},children:(0,t.jsx)(or,{headings:d,scrollContainer:g.current})})]})]}):(0,t.jsx)("div",{className:"flex-1 p-4 text-[var(--text-muted)] text-sm",children:"読み込み中..."}):"history"===u?(0,t.jsx)("div",{className:"flex-1 overflow-y-auto",ref:g,children:(0,t.jsx)(on,{filePath:e})}):(0,t.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,t.jsx)(oo,{currentPath:e,onNavigate:e=>i?.(e)})}),(0,t.jsx)(ol,{path:y,position:b,onNavigate:e=>{v(null),k(null),i?.(e)},onMouseEnter:E,onMouseLeave:j,fileRefs:r})]})}let of=s("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),op=s("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function oh({onSelect:e}){let[r,i]=(0,n.useState)(""),[l,a]=(0,n.useState)([]),[o,s]=(0,n.useState)(!1),[u,c]=(0,n.useState)(!1),d=(0,n.useRef)(null),f=(0,n.useRef)(null),p=(0,n.useRef)(null),h=(0,n.useCallback)(e=>{if(!e.trim()){a([]),c(!1);return}s(!0),fetch(`/api/search?q=${encodeURIComponent(e.trim())}`).then(e=>e.json()).then(e=>{a(e.results??[]),c(!0)}).catch(()=>a([])).finally(()=>s(!1))},[]);return(0,n.useEffect)(()=>{let e=e=>{"Escape"===e.key&&(c(!1),f.current?.blur())},t=e=>{p.current&&!p.current.contains(e.target)&&c(!1)};return window.addEventListener("keydown",e),document.addEventListener("mousedown",t),()=>{window.removeEventListener("keydown",e),document.removeEventListener("mousedown",t)}},[]),(0,t.jsxs)("div",{ref:p,className:"relative px-4 pt-4 pb-2",children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(of,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-[var(--text-muted)]"}),(0,t.jsx)("input",{ref:f,type:"text",value:r,onChange:e=>{var t;i(t=e.target.value),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>h(t),300)},onFocus:()=>{l.length>0&&c(!0)},placeholder:"ドキュメントを検索...",className:"w-full pl-8 pr-8 py-1.5 text-[12px] leading-normal rounded-md border border-[var(--border-default)] bg-[var(--bg-surface)] text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:outline-none focus:ring-1 focus:ring-[var(--brand-primary)] focus:border-[var(--brand-primary)] transition-shadow"}),r&&(0,t.jsx)("button",{onClick:()=>{i(""),a([]),c(!1),f.current?.focus()},className:"absolute right-2 top-1/2 -translate-y-1/2 text-[var(--text-muted)] hover:text-[var(--text-secondary)]",children:(0,t.jsx)(op,{size:14})})]}),u&&(0,t.jsx)("div",{className:"absolute left-4 right-4 top-full mt-1 z-40 bg-[var(--bg-surface)] border border-[var(--border-default)] rounded-lg shadow-lg max-h-80 overflow-y-auto",children:o?(0,t.jsx)("div",{className:"p-3 text-xs text-[var(--text-muted)] text-center",children:"検索中..."}):0===l.length?(0,t.jsx)("div",{className:"p-3 text-xs text-[var(--text-muted)] text-center",children:"該当するドキュメントが見つかりません"}):l.map(n=>(0,t.jsxs)("button",{onClick:()=>{e(n.path),c(!1)},className:"w-full text-left px-3 py-2 hover:bg-[var(--bg-muted)] border-b border-[var(--border-default)] last:border-b-0 transition-colors",children:[(0,t.jsx)("div",{className:"text-[12px] font-medium text-[var(--text-primary)] truncate leading-snug",children:n.displayName}),(0,t.jsx)("div",{className:"text-[10px] text-[var(--text-muted)] font-[var(--font-mono)] truncate mb-1 leading-normal",children:n.path}),n.matches.slice(0,2).map(e=>(0,t.jsxs)("div",{className:"text-[10px] text-[var(--text-secondary)] truncate leading-relaxed",children:[(0,t.jsxs)("span",{className:"text-[var(--text-muted)] mr-1",children:["L",e.line]}),(0,t.jsx)(om,{text:e.text,query:r})]},e.line))]},n.path))})]})}function om({text:e,query:n}){if(!n.trim())return(0,t.jsx)(t.Fragment,{children:e});let r=e.toLowerCase().indexOf(n.toLowerCase());if(-1===r)return(0,t.jsx)(t.Fragment,{children:e});let i=e.slice(0,r),l=e.slice(r,r+n.length),a=e.slice(r+n.length);return(0,t.jsxs)(t.Fragment,{children:[i,(0,t.jsx)("span",{className:"bg-yellow-200 text-yellow-900 rounded px-0.5",children:l}),a]})}function og({onNavigate:e}){let[r,i]=(0,n.useState)([]),[l,a]=(0,n.useState)(!0),[o,s]=(0,n.useState)(null),[d,p]=(0,n.useState)(null);if((0,n.useEffect)(()=>{a(!0),fetch("/api/timeline").then(e=>e.json()).then(e=>{i(e.entries??[]),a(!1)}).catch(()=>a(!1))},[]),l)return(0,t.jsx)("div",{className:"flex-1 flex items-center justify-center text-[13px] text-[var(--text-muted)]",children:"タイムラインを読み込み中..."});if(0===r.length)return(0,t.jsx)("div",{className:"flex-1 flex items-center justify-center text-[13px] text-[var(--text-muted)]",children:"仕様変更の履歴がありません"});let h=new Map;for(let e of r){let t=new Date(e.date).toLocaleDateString("ja-JP",{year:"numeric",month:"2-digit",day:"2-digit"}),n=h.get(t)??[];n.push(e),h.set(t,n)}return(0,t.jsx)("div",{className:"flex-1 overflow-y-auto",children:Array.from(h.entries()).map(([n,r])=>(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"sticky top-0 z-10 bg-[var(--bg-base)] border-b border-[var(--border-default)] px-4 py-1.5",children:(0,t.jsx)("span",{className:"text-[11px] font-medium text-[var(--text-muted)] tracking-wide",children:n})}),r.map(n=>{let r=o===n.hash;return(0,t.jsxs)("div",{className:"border-b border-[var(--border-default)]",children:[(0,t.jsx)("button",{onClick:()=>s(r?null:n.hash),className:"w-full text-left px-4 py-2.5 hover:bg-[var(--bg-hover)] transition-colors",children:(0,t.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,t.jsx)(oe,{size:13,className:"text-[var(--text-muted)] mt-0.5 shrink-0"}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-[11px] font-[var(--font-mono)] text-[var(--brand-primary)] leading-none",children:n.hashShort}),(0,t.jsx)("span",{className:"text-[11px] text-[var(--text-muted)] leading-none",children:new Date(n.date).toLocaleTimeString("ja-JP",{hour:"2-digit",minute:"2-digit"})}),n.author&&(0,t.jsx)("span",{className:"text-[11px] text-[var(--text-muted)] leading-none",children:n.author})]}),(0,t.jsx)("p",{className:"text-[12px] text-[var(--text-secondary)] mt-1 leading-snug line-clamp-2",children:n.message}),(0,t.jsx)("div",{className:"flex items-center gap-1 mt-1.5",children:(0,t.jsxs)("span",{className:"text-[10px] text-[var(--text-muted)]",children:[n.files.length,"件のドキュメント変更"]})})]}),(0,t.jsx)("span",{className:"text-[var(--text-muted)] shrink-0 mt-0.5",children:r?(0,t.jsx)(u,{size:13}):(0,t.jsx)(c,{size:13})})]})}),r&&(0,t.jsx)("div",{className:"px-4 pb-3",children:(0,t.jsx)("div",{className:"space-y-1",children:n.files.map(r=>{let i=(r.split("/").pop()||r).replace(/^\d+[_\-.\s]/,"").replace(/\.md$/i,""),l=d?.hash===n.hash&&d?.file===r;return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 py-1 px-2 rounded hover:bg-[var(--bg-muted)] group",children:[(0,t.jsx)("button",{onClick:()=>p(l?null:{hash:n.hash,file:r}),className:"shrink-0 text-[var(--text-muted)] hover:text-[var(--text-primary)]",children:l?(0,t.jsx)(u,{size:12}):(0,t.jsx)(c,{size:12})}),(0,t.jsx)(f,{size:12,className:"shrink-0",style:{color:"var(--file-border)"}}),(0,t.jsx)("button",{onClick:()=>e(r),className:"text-[11px] text-[var(--text-secondary)] hover:text-[var(--brand-primary)] truncate text-left",title:r,children:i}),(0,t.jsx)("span",{className:"text-[10px] text-[var(--text-muted)] truncate ml-auto opacity-0 group-hover:opacity-100 transition-opacity",children:r})]}),l&&(0,t.jsx)("div",{className:"ml-6 mt-1 mb-2",children:(0,t.jsx)(ot,{filePath:r,hash:n.hash})})]},r)})})})]},n.hash)})]},n))})}let ox=s("clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]]);e.s(["default",0,function(){let[e,r]=(0,n.useState)([]),[i,l]=(0,n.useState)(""),[a,o]=(0,n.useState)(null),[s,u]=(0,n.useState)(260),[c,d]=(0,n.useState)(!1),f=(0,n.useRef)([]),h=(0,n.useCallback)(e=>{a&&e!==a&&f.current.push(a),o(e)},[a]),m=(0,n.useCallback)(()=>{let e=f.current.pop();e&&o(e)},[]),g=f.current.length>0;(0,n.useEffect)(()=>{fetch("/api/tree").then(e=>e.json()).then(e=>{r(e.tree??[]),l(e.root??"")})},[]),(0,n.useEffect)(()=>{let e=localStorage.getItem("markshelf:treeWidth");e&&u(Number(e)||260)},[]);let x=(0,n.useMemo)(()=>(function e(t){let n=[];for(let r of t)"file"===r.type&&n.push({path:r.path,displayName:r.displayName}),"folder"===r.type&&(r.hasReadme&&n.push({path:r.path+"/README.md",displayName:r.displayName}),r.children&&n.push(...e(r.children)));return n})(e),[e]),y=(0,n.useCallback)(e=>{e.preventDefault(),document.body.style.userSelect="none",document.body.style.cursor="col-resize";let t=e=>{let t=Math.max(180,Math.min(.4*window.innerWidth,e.clientX));u(t),localStorage.setItem("markshelf:treeWidth",String(t))},n=()=>{document.body.style.userSelect="",document.body.style.cursor="",document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",n)};document.addEventListener("mousemove",t),document.addEventListener("mouseup",n)},[]);return(0,t.jsxs)("div",{className:"h-screen flex flex-col",children:[(0,t.jsxs)("header",{className:"h-11 border-b border-[var(--border-default)] bg-[var(--bg-surface)] flex items-center px-5 shrink-0 gap-3",children:[(0,t.jsxs)("span",{className:"font-semibold text-[15px] tracking-tight leading-none",children:["Mark",(0,t.jsx)("span",{className:"text-[var(--brand-primary)]",children:"Shelf"})]}),i&&(0,t.jsx)("span",{className:"text-[11px] text-[var(--text-muted)] font-[var(--font-mono)] truncate leading-none",children:i}),(0,t.jsx)("div",{className:"ml-auto",children:(0,t.jsxs)("button",{onClick:()=>d(!c),className:`flex items-center gap-1.5 px-2.5 py-1 rounded-md text-[12px] font-medium transition-colors ${c?"bg-[var(--brand-primary)] text-white":"text-[var(--text-muted)] hover:bg-[var(--bg-muted)] hover:text-[var(--text-secondary)]"}`,children:[(0,t.jsx)(ox,{size:12}),"タイムライン"]})})]}),(0,t.jsxs)("div",{className:"flex flex-1 overflow-hidden",children:[(0,t.jsxs)("div",{className:"overflow-hidden flex flex-col shrink-0",style:{width:s},children:[(0,t.jsx)(oh,{onSelect:h}),(0,t.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,t.jsx)(p,{entries:e,selectedPath:a,onSelect:h})})]}),(0,t.jsx)("div",{className:"w-1.5 hover:bg-[var(--brand-primary)] bg-[var(--border-default)] cursor-col-resize shrink-0 transition-colors duration-150",onMouseDown:y}),(0,t.jsx)("div",{className:"flex-1 border-l border-[var(--border-default)] bg-[var(--bg-surface)] overflow-hidden flex flex-col",children:c?(0,t.jsx)(og,{onNavigate:e=>{h(e),d(!1)}}):a?(0,t.jsx)(od,{filePath:a,fileRefs:x,onNavigate:h,onGoBack:m,canGoBack:g}):(0,t.jsx)("div",{className:"p-6 text-[var(--text-muted)] text-sm flex items-center justify-center h-full",children:"ファイルをクリックして内容を表示"})})]})]})}],52683)}]);
11
+ </iframe>`},"putIntoIFrame"),aI=(0,r1.__name)((e,t,n,r,i)=>{let l=e.append("div");l.attr("id",n),r&&l.attr("style",r);let a=l.append("svg").attr("id",t).attr("width","100%").attr("xmlns","http://www.w3.org/2000/svg");return i&&a.attr("xmlns:xlink",i),a.append("g"),e},"appendDivSvgG");function aR(e,t){return e.append("iframe").attr("id",t).attr("style","width: 100%; height: 100%;").attr("sandbox","")}(0,r1.__name)(aR,"sandboxedIframe");var aF=(0,r1.__name)((e,t,n,r)=>{e.getElementById(t)?.remove(),e.getElementById(n)?.remove(),e.getElementById(r)?.remove()},"removeExistingElements"),aO=(0,r1.__name)(async function(e,t,n){let r,i;ap();let l=aD(t);t=l.code;let a=(0,r0.getConfig)();r1.log.debug(a),t.length>(a?.maxTextSize??5e4)&&(t="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa");let o="#"+e,s="i"+e,u="#"+s,c="d"+e,d="#"+c,f=(0,r1.__name)(()=>{let e=h?u:d,t=(0,r4.select)(e).node();t&&"remove"in t&&t.remove()},"removeTempElements"),p=(0,r4.select)("body"),h="sandbox"===a.securityLevel,m="loose"===a.securityLevel,g=a.fontFamily;if(void 0!==n){if(n&&(n.innerHTML=""),h){let e=aR((0,r4.select)(n),s);(p=(0,r4.select)(e.nodes()[0].contentDocument.body)).node().style.margin=0}else p=(0,r4.select)(n);aI(p,e,c,`font-family: ${g}`,"http://www.w3.org/1999/xlink")}else{if(aF(document,e,c,s),h){let e=aR((0,r4.select)("body"),s);(p=(0,r4.select)(e.nodes()[0].contentDocument.body)).node().style.margin=0}else p=(0,r4.select)("body");aI(p,e,c)}try{r=await ax.fromText(t,{title:l.title})}catch(e){if(a.suppressErrorRendering)throw f(),e;r=await ax.fromText("error"),i=e}let x=p.select(d).node(),y=r.type,v=x.firstChild,b=v.firstChild,k=aN(a,y,r.renderer.getClasses?.(t,r),o),w=document.createElement("style");w.innerHTML=k,v.insertBefore(w,b);try{await r.renderer.draw(t,e,"11.14.0",r)}catch(n){throw a.suppressErrorRendering?f():ly.draw(t,e,"11.14.0"),n}aU(y,p.select(`${d} svg`),r.db.getAccTitle?.(),r.db.getAccDescription?.()),p.select(`[id="${e}"]`).selectAll("foreignobject > *").attr("xmlns","http://www.w3.org/1999/xhtml");let S=p.select(d).node().innerHTML;if(r1.log.debug("config.arrowMarkerAbsolute",a.arrowMarkerAbsolute),S=az(S,h,(0,r0.evaluate)(a.arrowMarkerAbsolute)),h?S=aP(S,p.select(d+" svg").node()):m||(S=ik.default.sanitize(S,{ADD_TAGS:aj,ADD_ATTR:aA,HTML_INTEGRATION_POINTS:{foreignobject:!0}})),av(),i)throw i;return f(),{diagramType:y,svg:S,bindFunctions:r.db.bindFunctions}},"render");function aB(e={}){let t=(0,r0.assignWithDepth_default)({},e);t?.fontFamily&&!t.themeVariables?.fontFamily&&(t.themeVariables||(t.themeVariables={}),t.themeVariables.fontFamily=t.fontFamily),(0,r0.saveConfigFromInitialize)(t),t?.theme&&t.theme in r0.themes_default?t.themeVariables=r0.themes_default[t.theme].getThemeVariables(t.themeVariables):t&&(t.themeVariables=r0.themes_default.default.getThemeVariables(t.themeVariables));let n="object"==typeof t?(0,r0.setSiteConfig)(t):(0,r0.getSiteConfig)();(0,r1.setLogLevel)(n.logLevel),ap()}(0,r1.__name)(aB,"initialize");var aH=(0,r1.__name)((e,t={})=>{let{code:n}=a_(e);return ax.fromText(n,t)},"getDiagramFromText");function aU(e,t,n,r){am(t,e),ag(t,n,r,t.attr("id"))}(0,r1.__name)(aU,"addA11yInfo");var a$=Object.freeze({render:aO,parse:aL,getDiagramFromText:aH,initialize:aB,getConfig:r0.getConfig,setConfig:r0.setConfig,getSiteConfig:r0.getSiteConfig,updateSiteConfig:r0.updateSiteConfig,reset:(0,r1.__name)(()=>{(0,r0.reset)()},"reset"),globalReset:(0,r1.__name)(()=>{(0,r0.reset)(r0.defaultConfig)},"globalReset"),defaultConfig:r0.defaultConfig});(0,r1.setLogLevel)((0,r0.getConfig)().logLevel),(0,r0.reset)((0,r0.getConfig)());var aq=(0,r1.__name)((e,t,n)=>{r1.log.warn(e),(0,rG.isDetailedError)(e)?(n&&n(e.str,e.hash),t.push({...e,message:e.str,error:e})):(n&&n(e),e instanceof Error&&t.push({str:e.message,message:e.message,hash:e.name,error:e}))},"handleError"),aV=(0,r1.__name)(async function(e={querySelector:".mermaid"}){try{await aW(e)}catch(t){if((0,rG.isDetailedError)(t)&&r1.log.error(t.str),a6.parseError&&a6.parseError(t),!e.suppressErrors)throw r1.log.error("Use the suppressErrors option to suppress these errors"),t}},"run"),aW=(0,r1.__name)(async function({postRenderCallback:e,querySelector:t,nodes:n}={querySelector:".mermaid"}){let r,i,l=a$.getConfig();if(r1.log.debug(`${!e?"No ":""}Callback function found`),n)r=n;else if(t)r=document.querySelectorAll(t);else throw Error("Nodes and querySelector are both undefined");r1.log.debug(`Found ${r.length} diagrams`),l?.startOnLoad!==void 0&&(r1.log.debug("Start On Load: "+l?.startOnLoad),a$.updateSiteConfig({startOnLoad:l?.startOnLoad}));let a=new rG.utils_default.InitIDGenerator(l.deterministicIds,l.deterministicIDSeed),o=[];for(let t of Array.from(r)){if(r1.log.info("Rendering diagram: "+t.id),t.getAttribute("data-processed"))continue;t.setAttribute("data-processed","true");let n=`mermaid-${a.next()}`;i=t.innerHTML,i=(0,r2.dedent)(rG.utils_default.entityDecode(i)).trim().replace(/<br\s*\/?>/gi,"<br/>");let r=rG.utils_default.detectInit(i);r&&r1.log.debug("Detected early reinit: ",r);try{let{svg:r,bindFunctions:l}=await a2(n,i,t);t.innerHTML=r,e&&await e(n),l&&l(t)}catch(e){aq(e,o,a6.parseError)}}if(o.length>0)throw o[0]},"runThrowsErrors"),aK=(0,r1.__name)(function(e){a$.initialize(e)},"initialize"),aQ=(0,r1.__name)(async function(e,t,n){r1.log.warn("mermaid.init is deprecated. Please use run instead."),e&&aK(e);let r={postRenderCallback:n,querySelector:".mermaid"};"string"==typeof t?r.querySelector=t:t&&(t instanceof HTMLElement?r.nodes=[t]:r.nodes=t),await aV(r)},"init"),aZ=(0,r1.__name)(async(e,{lazyLoad:t=!0}={})=>{ap(),(0,r0.registerLazyLoadedDiagrams)(...e),!1===t&&await ah()},"registerExternalDiagrams"),aJ=(0,r1.__name)(function(){if(a6.startOnLoad){let{startOnLoad:e}=a$.getConfig();e&&a6.run().catch(e=>r1.log.error("Mermaid failed to initialize",e))}},"contentLoaded");"u">typeof document&&window.addEventListener("load",aJ,!1);var aX=(0,r1.__name)(function(e){a6.parseError=e},"setParseErrorHandler"),aY=[],aG=!1,a0=(0,r1.__name)(async()=>{if(!aG){for(aG=!0;aY.length>0;){let e=aY.shift();if(e)try{await e()}catch(e){r1.log.error("Error executing queue",e)}}aG=!1}},"executeQueue"),a1=(0,r1.__name)(async(e,t)=>new Promise((n,r)=>{let i=(0,r1.__name)(()=>new Promise((i,l)=>{a$.parse(e,t).then(e=>{i(e),n(e)},e=>{r1.log.error("Error parsing",e),a6.parseError?.(e),l(e),r(e)})}),"performCall");aY.push(i),a0().catch(r)}),"parse"),a2=(0,r1.__name)((e,t,n)=>new Promise((r,i)=>{let l=(0,r1.__name)(()=>new Promise((l,a)=>{a$.render(e,t,n).then(e=>{l(e),r(e)},e=>{r1.log.error("Error parsing",e),a6.parseError?.(e),a(e),i(e)})}),"performCall");aY.push(l),a0().catch(i)}),"render"),a4=(0,r1.__name)(()=>Object.keys(r0.detectors).map(e=>({id:e})),"getRegisteredDiagramsMetadata"),a6={startOnLoad:!0,mermaidAPI:a$,parse:a1,render:a2,init:aQ,run:aV,registerExternalDiagrams:aZ,registerLayoutLoaders:rX.registerLayoutLoaders,initialize:aK,parseError:void 0,contentLoaded:aJ,setParseErrorHandler:aX,detectType:r0.detectType,registerIconPacks:rY.registerIconPacks,getRegisteredDiagramsMetadata:a4};let a3=!1,a5=0;function a9({code:e}){let r=(0,n.useRef)(null),[i,l]=(0,n.useState)(null),[a,o]=(0,n.useState)(null),s=(0,n.useRef)(`mermaid-${++a5}`);return((0,n.useEffect)(()=>{let t=!1;return a3||(a3=!0,a6.initialize({startOnLoad:!1,theme:"default",securityLevel:"loose",fontFamily:"system-ui, sans-serif"})),(async()=>{try{let{svg:n}=await a6.render(s.current,e);t||(l(n),o(null))}catch(n){t||(o(n instanceof Error?n.message:"Mermaid render error"),l(null));let e=document.getElementById("d"+s.current);e?.remove()}})(),()=>{t=!0}},[e]),a)?(0,t.jsxs)("div",{className:"border border-red-200 bg-red-50 rounded p-3 text-xs text-red-700",children:[(0,t.jsx)("div",{className:"font-medium mb-1",children:"Mermaid エラー"}),(0,t.jsx)("pre",{className:"whitespace-pre-wrap",children:e})]}):i?(0,t.jsx)("div",{ref:r,className:"my-2 overflow-x-auto",dangerouslySetInnerHTML:{__html:i}}):(0,t.jsx)("div",{className:"text-xs text-[var(--text-muted)] py-2",children:"図を描画中..."})}function a8(e){return e.toLowerCase().replace(/[^\p{L}\p{N}\s-]/gu,"").replace(/\s+/g,"-").replace(/-+/g,"-").trim()}function a7({children:e,onHeadingsExtracted:r,fileRefs:i,currentPath:l,onNavigate:a,onPreviewShow:o,onPreviewHide:s}){let u=(0,n.useMemo)(()=>(function(e){let t,n=[],r=new Map,i=/^(#{1,4})\s+(.+)$/gm;for(;null!==(t=i.exec(e));){let e=t[1].length,i=t[2].replace(/[#*_`[\]]/g,"").trim(),l=a8(i)||"heading",a=r.get(l)??0;r.set(l,a+1);let o=0===a?l:`${l}-${a}`;n.push({id:o,text:i,level:e})}return n})(e),[e]),c=(0,n.useMemo)(()=>{let e=new Map;for(let t of u){let n=e.get(t.text)??[];n.push(t.id),e.set(t.text,n)}return e},[u]),d=(0,n.useMemo)(()=>new Map,[u]);(0,n.useEffect)(()=>{r?.(u)},[u,r]);let f=(0,n.useMemo)(()=>{if(!i||0===i.length)return null;let e=new Map;for(let t of i.filter(e=>e.displayName.length>2&&e.path!==l).sort((e,t)=>t.displayName.length-e.displayName.length))e.set(t.displayName,t.path);return e},[i,l]),p=(0,n.useMemo)(()=>{if(!f||0===f.size)return null;let e=Array.from(f.keys()).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"));return RegExp(`(${e.join("|")})`,"g")},[f]);function h(e){return function(n){let r=function(e){let t=c.get(e);if(!t)return a8(e)||"heading";let n=d.get(e)??0;return d.set(e,n+1),t[n%t.length]}("string"==typeof n.children?n.children:function e(t){return"string"==typeof t?t:"number"==typeof t?String(t):Array.isArray(t)?t.map(e).join(""):t&&"object"==typeof t&&"props"in t?e(t.props.children):""}(n.children)),i={...n,id:r};switch(e){case 1:return(0,t.jsx)("h1",{...i});case 2:return(0,t.jsx)("h2",{...i});case 3:return(0,t.jsx)("h3",{...i});default:return(0,t.jsx)("h4",{...i})}}}let m={h1:h(1),h2:h(2),h3:h(3),h4:h(4),code:({className:e,children:n,...r})=>{if(/language-mermaid/.exec(e||"")){let e=String(n).replace(/\n$/,"");return(0,t.jsx)(a9,{code:e})}return(0,t.jsx)("code",{className:e,...r,children:n})},pre:({children:e})=>e&&"object"==typeof e&&"type"in e&&e.type===a9?(0,t.jsx)(t.Fragment,{children:e}):(0,t.jsx)("pre",{children:e}),a:({href:e,children:n,...r})=>{if(e?.startsWith("autolink:")){let r=e.slice(9);return(0,t.jsx)("span",{className:"text-[var(--brand-primary)] border-b border-dashed border-[var(--brand-primary)] cursor-pointer hover:bg-blue-50 transition-colors",onClick:e=>{e.preventDefault(),s?.(),a?.(r)},onMouseEnter:e=>{let t=e.target.getBoundingClientRect();o?.(r,t)},onMouseLeave:()=>s?.(),children:n})}return(0,t.jsx)("a",{href:e,...r,children:n})},p:({children:e,...n})=>(0,t.jsx)("p",{...n,children:g(e)}),li:({children:e,...n})=>(0,t.jsx)("li",{...n,children:g(e)}),td:({children:e,...n})=>(0,t.jsx)("td",{...n,children:g(e)})};function g(e){return p&&f?"string"==typeof e?x(e):Array.isArray(e)?e.map((e,n)=>"string"==typeof e?(0,t.jsx)("span",{children:x(e)},n):e):e:e}function x(e){let n;if(!p||!f)return e;let r=[],i=0;for(p.lastIndex=0;null!==(n=p.exec(e));){let l=n[0],u=f.get(l);u&&(n.index>i&&r.push(e.slice(i,n.index)),r.push((0,t.jsx)("span",{className:"text-[var(--brand-primary)] border-b border-dashed border-[var(--brand-primary)] cursor-pointer hover:bg-blue-50 transition-colors",onClick:e=>{e.preventDefault(),s?.(),a?.(u)},onMouseEnter:e=>{let t=e.target.getBoundingClientRect();o?.(u,t)},onMouseLeave:()=>s?.(),children:l},`${n.index}-${l}`)),i=n.index+l.length)}return i<e.length&&r.push(e.slice(i)),0===r.length?e:r}return(0,t.jsx)("div",{className:"prose prose-sm max-w-none prose-headings:font-semibold prose-headings:tracking-tight prose-headings:text-[var(--text-primary)] prose-h1:text-lg prose-h1:leading-snug prose-h1:mb-4 prose-h2:text-[15px] prose-h2:leading-snug prose-h2:border-b prose-h2:border-[var(--border-default)] prose-h2:pb-2 prose-h2:mt-8 prose-h2:mb-3 prose-h3:text-[13px] prose-h3:leading-snug prose-h3:mt-6 prose-h3:mb-2 prose-p:text-[var(--text-secondary)] prose-p:text-[13px] prose-p:leading-[1.75] prose-li:text-[var(--text-secondary)] prose-li:text-[13px] prose-li:leading-[1.75] prose-strong:text-[var(--text-primary)] prose-strong:font-semibold prose-a:text-[var(--brand-primary)] prose-a:font-medium prose-a:no-underline hover:prose-a:underline prose-code:text-xs prose-code:text-[var(--text-primary)] prose-code:bg-[var(--bg-muted)] prose-code:px-1 prose-code:py-0.5 prose-code:rounded prose-code:before:content-none prose-code:after:content-none prose-pre:bg-[var(--bg-muted)] prose-pre:text-xs prose-pre:text-[var(--text-primary)] prose-table:text-[12px] prose-th:bg-[var(--bg-muted)] prose-th:text-[var(--text-primary)] prose-th:font-semibold prose-th:px-3 prose-th:py-1.5 prose-th:text-left prose-td:px-3 prose-td:py-1.5 prose-td:border-[var(--border-default)] prose-td:text-[var(--text-secondary)] prose-hr:border-[var(--border-default)] prose-blockquote:border-l-[var(--brand-primary)] prose-blockquote:text-[var(--text-muted)] prose-blockquote:not-italic prose-img:rounded-lg ",children:(0,t.jsx)(nR,{remarkPlugins:[rQ],components:m,children:e})})}let oe=s("git-commit-horizontal",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]]);function ot({filePath:e,hash:r}){let[i,l]=(0,n.useState)(null);return((0,n.useEffect)(()=>{l(null),fetch(`/api/diff?path=${encodeURIComponent(e)}&hash=${r}`).then(e=>e.json()).then(e=>l(e.diff)).catch(()=>l("(差分を取得できませんでした)"))},[e,r]),null===i)?(0,t.jsx)("div",{className:"text-[12px] text-[var(--text-muted)] py-2",children:"差分を読み込み中..."}):(0,t.jsx)("pre",{className:"text-[11px] font-[var(--font-mono)] bg-[var(--bg-muted)] rounded-lg p-3 overflow-x-auto leading-[1.7] border border-[var(--border-default)]",children:i.split("\n").filter(e=>!e.startsWith("diff --git")&&!e.startsWith("index ")&&!e.startsWith("new file")&&!e.startsWith("deleted file")&&!e.startsWith("similarity")&&!e.startsWith("rename ")&&!e.startsWith("old mode")&&!e.startsWith("new mode")).map((e,n)=>{let r="var(--text-secondary)",i="transparent";return e.startsWith("+")&&!e.startsWith("+++")?(r="var(--add-color)",i="var(--add-bg)"):e.startsWith("-")&&!e.startsWith("---")?(r="var(--del-color)",i="var(--del-bg)"):e.startsWith("@@")&&(r="var(--brand-primary)"),(0,t.jsx)("div",{style:{color:r,backgroundColor:i},className:"px-1 -mx-1 rounded-sm",children:e},n)})})}function on({filePath:e}){let[r,i]=(0,n.useState)([]),[l,a]=(0,n.useState)(!0),[o,s]=(0,n.useState)(null);return((0,n.useEffect)(()=>{a(!0),s(null),fetch(`/api/history?path=${encodeURIComponent(e)}`).then(e=>e.json()).then(e=>{i(e),a(!1)}).catch(()=>a(!1))},[e]),l)?(0,t.jsx)("div",{className:"p-4 text-[var(--text-muted)] text-[13px]",children:"読み込み中..."}):0===r.length?(0,t.jsx)("div",{className:"p-4 text-[var(--text-muted)] text-[13px]",children:"変更履歴がありません(git 管理外の可能性)"}):(0,t.jsx)("div",{className:"divide-y divide-[var(--border-default)]",children:r.map(n=>{let r=o===n.hash;return(0,t.jsxs)("div",{children:[(0,t.jsx)("button",{onClick:()=>s(r?null:n.hash),className:"w-full text-left px-4 py-3 hover:bg-[var(--bg-hover)] transition-colors",children:(0,t.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,t.jsx)(oe,{size:13,className:"text-[var(--text-muted)] mt-0.5 shrink-0"}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-[11px] font-[var(--font-mono)] text-[var(--brand-primary)] leading-none",children:n.hashShort}),(0,t.jsx)("span",{className:"text-[11px] text-[var(--text-muted)] leading-none",children:new Date(n.date).toLocaleString("ja-JP",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}),n.author&&(0,t.jsx)("span",{className:"text-[11px] text-[var(--text-muted)] leading-none",children:n.author})]}),(0,t.jsx)("p",{className:"text-[12px] text-[var(--text-secondary)] mt-1 leading-snug line-clamp-2",children:n.message})]}),(0,t.jsx)("span",{className:"text-[var(--text-muted)] shrink-0 mt-0.5",children:r?(0,t.jsx)(u,{size:13}):(0,t.jsx)(c,{size:13})})]})}),r&&(0,t.jsx)("div",{className:"px-4 pb-3",children:(0,t.jsx)(ot,{filePath:e,hash:n.hash})})]},n.hash)})})}function or({headings:e,scrollContainer:r}){let[i,l]=(0,n.useState)(null),a=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(!r||0===e.length)return;a.current?.disconnect();let t=new IntersectionObserver(e=>{for(let t of e)t.isIntersecting&&l(t.target.id)},{root:r,rootMargin:"0px 0px -70% 0px",threshold:.1});for(let n of(a.current=t,e)){let e=document.getElementById(n.id);e&&t.observe(e)}return()=>t.disconnect()},[e,r]);let o=(0,n.useCallback)(e=>{let t=document.getElementById(e);t&&(t.scrollIntoView({behavior:"smooth",block:"start"}),l(e))},[]);return 0===e.length?null:(0,t.jsxs)("nav",{className:"py-3 px-2 space-y-px",children:[(0,t.jsx)("div",{className:"text-[10px] font-medium text-[var(--text-muted)] tracking-wider uppercase px-1.5 mb-1.5",children:"目次"}),e.map(e=>(0,t.jsx)("button",{onClick:()=>o(e.id),className:`block w-full text-left text-[11px] leading-relaxed py-0.5 truncate transition-colors rounded px-1.5 ${i===e.id?"text-[var(--brand-primary)] font-medium bg-blue-50":"text-[var(--text-muted)] hover:text-[var(--text-secondary)] hover:bg-[var(--bg-hover)]"}`,style:{paddingLeft:`${(e.level-1)*10+6}px`},title:e.text,children:e.text},e.id))]})}let oi=s("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);function ol({path:e,position:r,onNavigate:i,onMouseEnter:l,onMouseLeave:a,fileRefs:o,depth:s=0}){let[u,c]=(0,n.useState)(null),[d,f]=(0,n.useState)(!1),p=(0,n.useRef)(null),[h,m]=(0,n.useState)(null),[g,x]=(0,n.useState)(null),[y,v]=(0,n.useState)(null),b=(0,n.useRef)(null),k=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(b.current&&clearTimeout(b.current),k.current&&clearTimeout(k.current),!e){c(null),x(null),v(null);return}f(!0),c(null),x(null),v(null),fetch(`/api/file?path=${encodeURIComponent(e)}`).then(e=>e.json()).then(e=>c(e.content??null)).catch(()=>c(null)).finally(()=>f(!1))},[e]),(0,n.useEffect)(()=>{if(!r||!p.current)return void m(r);let e=p.current.getBoundingClientRect(),t=window.innerWidth,n=window.innerHeight,{x:i,y:l}=r;i+e.width>t-16&&(i=t-e.width-16),i<16&&(i=16),l+e.height>n-16&&(l=r.y-e.height-8),m({x:i,y:l})},[r,u]);let w=(0,n.useCallback)((e,t)=>{s>=3||(k.current&&clearTimeout(k.current),b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{x(e),v({x:t.right+8,y:t.top})},200))},[s]),S=(0,n.useCallback)(()=>{b.current&&clearTimeout(b.current),k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{x(null),v(null)},300)},[]),C=(0,n.useCallback)(()=>{k.current&&clearTimeout(k.current),l()},[l]),_=(0,n.useCallback)(()=>{S(),a()},[S,a]);if(!e||!r)return null;let E=e.split("/").pop()?.replace(/\.md$/i,"")||e;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{ref:p,onMouseEnter:l,onMouseLeave:()=>{a(),S()},className:"fixed bg-[var(--bg-surface)] border border-[var(--border-default)] rounded-lg shadow-xl w-[480px] max-h-[420px] overflow-y-auto",style:{left:h?.x??r.x,top:h?.y??r.y,zIndex:50+s},children:[(0,t.jsx)("div",{className:"sticky top-0 bg-[var(--bg-surface)] border-b border-[var(--border-default)] px-3 py-2 flex items-center gap-2",children:(0,t.jsxs)("button",{onClick:()=>i(e),className:"text-xs font-medium text-[var(--brand-primary)] hover:underline truncate flex items-center gap-1",children:[E,(0,t.jsx)(oi,{size:10})]})}),(0,t.jsx)("div",{className:"p-3",children:d?(0,t.jsx)("div",{className:"text-xs text-[var(--text-muted)]",children:"読み込み中..."}):u?(0,t.jsx)("div",{className:"text-[11px]",children:(0,t.jsx)(a7,{fileRefs:o,currentPath:e,onNavigate:i,onPreviewShow:w,onPreviewHide:S,children:u})}):(0,t.jsx)("div",{className:"text-xs text-[var(--text-muted)]",children:"プレビューを表示できません"})})]}),(0,t.jsx)(ol,{path:g,position:y,onNavigate:i,onMouseEnter:C,onMouseLeave:_,fileRefs:o,depth:s+1})]})}var oa=e.i(77871);function oo({currentPath:e,onNavigate:r}){let i=(0,n.useRef)(null),l=(0,n.useRef)(null),[a,o]=(0,n.useState)(!0),[s,u]=(0,n.useState)(!1),[c,d]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{let t=!1;return o(!0),u(!1),d(!1),fetch("/api/graph").then(e=>e.json()).then(n=>{if(t||!i.current)return;let a=new Set;for(let t of(a.add(e),n.edges))t.source===e&&a.add(t.target),t.target===e&&a.add(t.source);let s=n.nodes.filter(e=>a.has(e.id)),c=n.edges.filter(e=>a.has(e.source)&&a.has(e.target));if(0===s.length){u(!0),o(!1);return}l.current?.destroy();let f=(0,oa.default)({container:i.current,elements:[...s.map(t=>({data:{id:t.id,label:t.label,isCurrent:t.id===e}})),...c.map((e,t)=>({data:{id:`e${t}`,source:e.source,target:e.target}}))],style:[{selector:"node",style:{label:"data(label)","text-valign":"bottom","text-halign":"center","font-size":"11px","font-family":"var(--font-sans)",color:"#4a5060","text-margin-y":6,"background-color":"#e8f0fe","border-width":2,"border-color":"#3b7ddb",width:28,height:28,"text-max-width":"100px","text-wrap":"ellipsis",cursor:"pointer"}},{selector:"node[?isCurrent]",style:{"background-color":"#2563eb","border-color":"#1d4ed8",color:"#1a1d23","font-weight":"bold",width:36,height:36}},{selector:"edge",style:{width:1.5,"line-color":"#c8ccd3","target-arrow-color":"#c8ccd3","target-arrow-shape":"triangle","curve-style":"bezier","arrow-scale":.8}},{selector:"node:active",style:{"overlay-opacity":0}}],layout:{name:"concentric",animate:!1,padding:50,minNodeSpacing:80,concentric:e=>e.data("isCurrent")?10:1,levelWidth:()=>1},userZoomingEnabled:!0,userPanningEnabled:!0,boxSelectionEnabled:!1,autoungrabify:!1});requestAnimationFrame(()=>{f.resize(),f.fit(void 0,50),f.zoom()>1.2&&f.zoom({level:1.2,renderedPosition:{x:i.current.clientWidth/2,y:i.current.clientHeight/2}}),f.center(f.nodes("[?isCurrent]")),d(!0)}),f.on("mouseover","node",e=>{let t=e.target;t.data("isCurrent")||t.style({"background-color":"#dbeafe","border-color":"#2563eb",color:"#1a1d23"}),i.current.style.cursor="pointer"}),f.on("mouseout","node",e=>{let t=e.target;t.data("isCurrent")||t.style({"background-color":"#e8f0fe","border-color":"#3b7ddb",color:"#4a5060"}),i.current.style.cursor="default"}),f.on("tap","node",t=>{let n=t.target.id();n!==e&&r(n)}),l.current=f,o(!1)}).catch(()=>{t||(u(!0),o(!1))}),()=>{t=!0,l.current?.destroy(),l.current=null}},[e,r]),(0,t.jsxs)("div",{className:"h-full flex flex-col relative",children:[(a||s)&&(0,t.jsx)("div",{className:"absolute inset-0 flex items-center justify-center text-[13px] text-[var(--text-muted)] z-10 bg-[var(--bg-surface)]",children:a?"グラフを構築中...":"このドキュメントへのリンクはありません"}),(0,t.jsx)("div",{ref:i,className:"flex-1 min-h-0 transition-opacity duration-150",style:{opacity:+!!c}})]})}let os=s("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]),ou=s("network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]),oc=s("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);function od({filePath:e,fileRefs:r,onNavigate:i,onGoBack:l,canGoBack:a}){let[o,s]=(0,n.useState)(null),[u,c]=(0,n.useState)("content"),[d,p]=(0,n.useState)([]),[h,m]=(0,n.useState)(()=>{{let e=localStorage.getItem("markshelf:tocWidth");return e&&Number(e)||176}}),g=(0,n.useRef)(null),x=(0,n.useRef)(null),[y,v]=(0,n.useState)(null),[b,k]=(0,n.useState)(null),w=(0,n.useRef)(null),S=(0,n.useRef)(null);(0,n.useEffect)(()=>{s(null),p([]),w.current&&clearTimeout(w.current),S.current&&clearTimeout(S.current),v(null),k(null),fetch(`/api/file?path=${encodeURIComponent(e)}`).then(e=>e.json()).then(e=>s(e.content??null)).catch(()=>s(null))},[e]);let C=(0,n.useCallback)((e,t)=>{S.current&&clearTimeout(S.current),w.current&&clearTimeout(w.current),w.current=setTimeout(()=>{v(e),k({x:t.left,y:t.bottom+4})},200)},[]),_=(0,n.useCallback)(()=>{w.current&&clearTimeout(w.current),S.current&&clearTimeout(S.current),S.current=setTimeout(()=>{v(null),k(null)},300)},[]),E=(0,n.useCallback)(()=>{S.current&&clearTimeout(S.current)},[]),j=(0,n.useCallback)(()=>{_()},[_]),A=(0,n.useCallback)(e=>{e.preventDefault(),document.body.style.userSelect="none",document.body.style.cursor="col-resize";let t=x.current?.parentElement,n=e=>{if(!t)return;let n=Math.max(120,Math.min(400,t.getBoundingClientRect().right-e.clientX));m(n),localStorage.setItem("markshelf:tocWidth",String(n))},r=()=>{document.body.style.userSelect="",document.body.style.cursor="",document.removeEventListener("mousemove",n),document.removeEventListener("mouseup",r)};document.addEventListener("mousemove",n),document.addEventListener("mouseup",r)},[]),D=e.split("/").pop()?.replace(/\.md$/i,"")||e;return(0,t.jsxs)("div",{className:"flex flex-col h-full",children:[(0,t.jsxs)("div",{className:"border-b border-[var(--border-default)] px-4 py-2.5 shrink-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[a&&(0,t.jsx)("button",{onClick:l,className:"shrink-0 p-0.5 rounded hover:bg-[var(--bg-muted)] text-[var(--text-muted)] hover:text-[var(--text-secondary)] transition-colors",title:"戻る",children:(0,t.jsx)(oc,{size:14})}),(0,t.jsx)("h2",{className:"font-semibold text-[14px] leading-snug truncate text-[var(--text-primary)]",children:D})]}),(0,t.jsxs)("div",{className:"flex gap-1",children:[(0,t.jsxs)("button",{onClick:()=>c("content"),className:`flex items-center gap-1.5 px-2.5 py-1 rounded-md text-[12px] font-medium transition-colors ${"content"===u?"bg-[var(--brand-primary)] text-white":"text-[var(--text-muted)] hover:bg-[var(--bg-muted)] hover:text-[var(--text-secondary)]"}`,children:[(0,t.jsx)(f,{size:12}),"内容"]}),(0,t.jsxs)("button",{onClick:()=>c("history"),className:`flex items-center gap-1.5 px-2.5 py-1 rounded-md text-[12px] font-medium transition-colors ${"history"===u?"bg-[var(--brand-primary)] text-white":"text-[var(--text-muted)] hover:bg-[var(--bg-muted)] hover:text-[var(--text-secondary)]"}`,children:[(0,t.jsx)(os,{size:12}),"変更履歴"]}),(0,t.jsxs)("button",{onClick:()=>c("links"),className:`flex items-center gap-1.5 px-2.5 py-1 rounded-md text-[12px] font-medium transition-colors ${"links"===u?"bg-[var(--brand-primary)] text-white":"text-[var(--text-muted)] hover:bg-[var(--bg-muted)] hover:text-[var(--text-secondary)]"}`,children:[(0,t.jsx)(ou,{size:12}),"リンク"]})]})]}),"content"===u?null!==o?(0,t.jsxs)("div",{className:"flex-1 flex overflow-hidden",children:[(0,t.jsx)("div",{className:"flex-1 overflow-y-auto",ref:g,children:(0,t.jsx)("div",{className:"p-4",children:(0,t.jsx)(a7,{onHeadingsExtracted:p,fileRefs:r,currentPath:e,onNavigate:i,onPreviewShow:C,onPreviewHide:_,children:o})})}),d.length>0&&(0,t.jsxs)("div",{className:"flex shrink-0",ref:x,children:[(0,t.jsx)("div",{className:"w-1 hover:bg-[var(--brand-primary)] bg-[var(--border-default)] cursor-col-resize shrink-0 transition-colors duration-150",onMouseDown:A}),(0,t.jsx)("div",{className:"overflow-y-auto border-l border-[var(--border-default)]",style:{width:h},children:(0,t.jsx)(or,{headings:d,scrollContainer:g.current})})]})]}):(0,t.jsx)("div",{className:"flex-1 p-4 text-[var(--text-muted)] text-sm",children:"読み込み中..."}):"history"===u?(0,t.jsx)("div",{className:"flex-1 overflow-y-auto",ref:g,children:(0,t.jsx)(on,{filePath:e})}):(0,t.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,t.jsx)(oo,{currentPath:e,onNavigate:e=>i?.(e)})}),(0,t.jsx)(ol,{path:y,position:b,onNavigate:e=>{v(null),k(null),i?.(e)},onMouseEnter:E,onMouseLeave:j,fileRefs:r})]})}let of=s("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),op=s("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function oh({onSelect:e}){let[r,i]=(0,n.useState)(""),[l,a]=(0,n.useState)([]),[o,s]=(0,n.useState)(!1),[u,c]=(0,n.useState)(!1),d=(0,n.useRef)(null),f=(0,n.useRef)(null),p=(0,n.useRef)(null),h=(0,n.useCallback)(e=>{if(!e.trim()){a([]),c(!1);return}s(!0),fetch(`/api/search?q=${encodeURIComponent(e.trim())}`).then(e=>e.json()).then(e=>{a(e.results??[]),c(!0)}).catch(()=>a([])).finally(()=>s(!1))},[]);return(0,n.useEffect)(()=>{let e=e=>{"Escape"===e.key&&(c(!1),f.current?.blur())},t=e=>{p.current&&!p.current.contains(e.target)&&c(!1)};return window.addEventListener("keydown",e),document.addEventListener("mousedown",t),()=>{window.removeEventListener("keydown",e),document.removeEventListener("mousedown",t)}},[]),(0,t.jsxs)("div",{ref:p,className:"relative px-4 pt-4 pb-2",children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(of,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-[var(--text-muted)]"}),(0,t.jsx)("input",{ref:f,type:"text",value:r,onChange:e=>{var t;i(t=e.target.value),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>h(t),300)},onFocus:()=>{l.length>0&&c(!0)},placeholder:"ドキュメントを検索...",className:"w-full pl-8 pr-8 py-1.5 text-[12px] leading-normal rounded-md border border-[var(--border-default)] bg-[var(--bg-surface)] text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:outline-none focus:ring-1 focus:ring-[var(--brand-primary)] focus:border-[var(--brand-primary)] transition-shadow"}),r&&(0,t.jsx)("button",{onClick:()=>{i(""),a([]),c(!1),f.current?.focus()},className:"absolute right-2 top-1/2 -translate-y-1/2 text-[var(--text-muted)] hover:text-[var(--text-secondary)]",children:(0,t.jsx)(op,{size:14})})]}),u&&(0,t.jsx)("div",{className:"absolute left-4 right-4 top-full mt-1 z-40 bg-[var(--bg-surface)] border border-[var(--border-default)] rounded-lg shadow-lg max-h-80 overflow-y-auto",children:o?(0,t.jsx)("div",{className:"p-3 text-xs text-[var(--text-muted)] text-center",children:"検索中..."}):0===l.length?(0,t.jsx)("div",{className:"p-3 text-xs text-[var(--text-muted)] text-center",children:"該当するドキュメントが見つかりません"}):l.map(n=>(0,t.jsxs)("button",{onClick:()=>{e(n.path),c(!1)},className:"w-full text-left px-3 py-2 hover:bg-[var(--bg-muted)] border-b border-[var(--border-default)] last:border-b-0 transition-colors",children:[(0,t.jsx)("div",{className:"text-[12px] font-medium text-[var(--text-primary)] truncate leading-snug",children:n.displayName}),(0,t.jsx)("div",{className:"text-[10px] text-[var(--text-muted)] font-[var(--font-mono)] truncate mb-1 leading-normal",children:n.path}),n.matches.slice(0,2).map(e=>(0,t.jsxs)("div",{className:"text-[10px] text-[var(--text-secondary)] truncate leading-relaxed",children:[(0,t.jsxs)("span",{className:"text-[var(--text-muted)] mr-1",children:["L",e.line]}),(0,t.jsx)(om,{text:e.text,query:r})]},e.line))]},n.path))})]})}function om({text:e,query:n}){if(!n.trim())return(0,t.jsx)(t.Fragment,{children:e});let r=e.toLowerCase().indexOf(n.toLowerCase());if(-1===r)return(0,t.jsx)(t.Fragment,{children:e});let i=e.slice(0,r),l=e.slice(r,r+n.length),a=e.slice(r+n.length);return(0,t.jsxs)(t.Fragment,{children:[i,(0,t.jsx)("span",{className:"bg-yellow-200 text-yellow-900 rounded px-0.5",children:l}),a]})}let og=s("clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]]);function ox({onNavigate:e,onClose:r}){let[i,l]=(0,n.useState)([]),[a,o]=(0,n.useState)(!0),[s,d]=(0,n.useState)(null),[p,h]=(0,n.useState)(null);(0,n.useEffect)(()=>{o(!0),fetch("/api/timeline").then(e=>e.json()).then(e=>{l(e.entries??[]),o(!1)}).catch(()=>o(!1))},[]),(0,n.useEffect)(()=>{let e=e=>{"Escape"===e.key&&r()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[r]);let m=new Map;for(let e of i){let t=new Date(e.date).toLocaleDateString("ja-JP",{year:"numeric",month:"2-digit",day:"2-digit"}),n=m.get(t)??[];n.push(e),m.set(t,n)}return(0,t.jsx)("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-black/40 backdrop-blur-sm",onClick:r,children:(0,t.jsxs)("div",{className:"bg-[var(--bg-surface)] rounded-lg shadow-2xl w-[90vw] max-w-4xl h-[85vh] flex flex-col overflow-hidden border border-[var(--border-default)]",onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 px-5 py-3 border-b border-[var(--border-default)] shrink-0",children:[(0,t.jsx)(og,{size:14,className:"text-[var(--brand-primary)]"}),(0,t.jsx)("h2",{className:"font-semibold text-[14px] text-[var(--text-primary)]",children:"変更タイムライン"}),(0,t.jsx)("span",{className:"text-[11px] text-[var(--text-muted)]",children:"リポジトリ全体の仕様変更履歴"}),(0,t.jsx)("button",{onClick:r,className:"ml-auto p-1 rounded hover:bg-[var(--bg-muted)] text-[var(--text-muted)] hover:text-[var(--text-secondary)] transition-colors",title:"閉じる (Esc)",children:(0,t.jsx)(op,{size:16})})]}),(0,t.jsx)("div",{className:"flex-1 overflow-y-auto",children:a?(0,t.jsx)("div",{className:"h-full flex items-center justify-center text-[13px] text-[var(--text-muted)]",children:"タイムラインを読み込み中..."}):0===i.length?(0,t.jsx)("div",{className:"h-full flex items-center justify-center text-[13px] text-[var(--text-muted)]",children:"仕様変更の履歴がありません"}):Array.from(m.entries()).map(([n,r])=>(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"sticky top-0 z-10 bg-[var(--bg-base)] border-b border-[var(--border-default)] px-4 py-1.5",children:(0,t.jsx)("span",{className:"text-[11px] font-medium text-[var(--text-muted)] tracking-wide",children:n})}),r.map(n=>{let r=s===n.hash;return(0,t.jsxs)("div",{className:"border-b border-[var(--border-default)]",children:[(0,t.jsx)("button",{onClick:()=>d(r?null:n.hash),className:"w-full text-left px-4 py-2.5 hover:bg-[var(--bg-hover)] transition-colors",children:(0,t.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,t.jsx)(oe,{size:13,className:"text-[var(--text-muted)] mt-0.5 shrink-0"}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-[11px] font-[var(--font-mono)] text-[var(--brand-primary)] leading-none",children:n.hashShort}),(0,t.jsx)("span",{className:"text-[11px] text-[var(--text-muted)] leading-none",children:new Date(n.date).toLocaleTimeString("ja-JP",{hour:"2-digit",minute:"2-digit"})}),n.author&&(0,t.jsx)("span",{className:"text-[11px] text-[var(--text-muted)] leading-none",children:n.author})]}),(0,t.jsx)("p",{className:"text-[12px] text-[var(--text-secondary)] mt-1 leading-snug line-clamp-2",children:n.message}),(0,t.jsx)("div",{className:"flex items-center gap-1 mt-1.5",children:(0,t.jsxs)("span",{className:"text-[10px] text-[var(--text-muted)]",children:[n.files.length,"件のドキュメント変更"]})})]}),(0,t.jsx)("span",{className:"text-[var(--text-muted)] shrink-0 mt-0.5",children:r?(0,t.jsx)(u,{size:13}):(0,t.jsx)(c,{size:13})})]})}),r&&(0,t.jsx)("div",{className:"px-4 pb-3",children:(0,t.jsx)("div",{className:"space-y-1",children:n.files.map(r=>{let i=(r.split("/").pop()||r).replace(/^\d+[_\-.\s]/,"").replace(/\.md$/i,""),l=p?.hash===n.hash&&p?.file===r;return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 py-1 px-2 rounded hover:bg-[var(--bg-muted)] group",children:[(0,t.jsx)("button",{onClick:()=>h(l?null:{hash:n.hash,file:r}),className:"shrink-0 text-[var(--text-muted)] hover:text-[var(--text-primary)]",children:l?(0,t.jsx)(u,{size:12}):(0,t.jsx)(c,{size:12})}),(0,t.jsx)(f,{size:12,className:"shrink-0",style:{color:"var(--file-border)"}}),(0,t.jsx)("button",{onClick:()=>e(r),className:"text-[11px] text-[var(--text-secondary)] hover:text-[var(--brand-primary)] truncate text-left",title:r,children:i}),(0,t.jsx)("span",{className:"text-[10px] text-[var(--text-muted)] truncate ml-auto opacity-0 group-hover:opacity-100 transition-opacity",children:r})]}),l&&(0,t.jsx)("div",{className:"ml-6 mt-1 mb-2",children:(0,t.jsx)(ot,{filePath:r,hash:n.hash})})]},r)})})})]},n.hash)})]},n))})]})})}e.s(["default",0,function(){let[e,r]=(0,n.useState)([]),[i,l]=(0,n.useState)(""),[a,o]=(0,n.useState)(null),[s,u]=(0,n.useState)(260),[c,d]=(0,n.useState)(!1),f=(0,n.useRef)([]),h=(0,n.useCallback)(e=>{a&&e!==a&&f.current.push(a),o(e)},[a]),m=(0,n.useCallback)(()=>{let e=f.current.pop();e&&o(e)},[]),g=f.current.length>0;(0,n.useEffect)(()=>{fetch("/api/tree").then(e=>e.json()).then(e=>{r(e.tree??[]),l(e.root??"")})},[]),(0,n.useEffect)(()=>{let e=localStorage.getItem("markshelf:treeWidth");e&&u(Number(e)||260)},[]);let x=(0,n.useMemo)(()=>(function e(t){let n=[];for(let r of t)"file"===r.type&&n.push({path:r.path,displayName:r.displayName}),"folder"===r.type&&(r.hasReadme&&n.push({path:r.path+"/README.md",displayName:r.displayName}),r.children&&n.push(...e(r.children)));return n})(e),[e]),y=(0,n.useCallback)(e=>{e.preventDefault(),document.body.style.userSelect="none",document.body.style.cursor="col-resize";let t=e=>{let t=Math.max(180,Math.min(.4*window.innerWidth,e.clientX));u(t),localStorage.setItem("markshelf:treeWidth",String(t))},n=()=>{document.body.style.userSelect="",document.body.style.cursor="",document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",n)};document.addEventListener("mousemove",t),document.addEventListener("mouseup",n)},[]);return(0,t.jsxs)("div",{className:"h-screen flex flex-col",children:[(0,t.jsxs)("header",{className:"h-11 border-b border-[var(--border-default)] bg-[var(--bg-surface)] flex items-center px-5 shrink-0 gap-3",children:[(0,t.jsxs)("span",{className:"font-semibold text-[15px] tracking-tight leading-none",children:["Mark",(0,t.jsx)("span",{className:"text-[var(--brand-primary)]",children:"Shelf"})]}),i&&(0,t.jsx)("span",{className:"text-[11px] text-[var(--text-muted)] font-[var(--font-mono)] truncate leading-none",children:i}),(0,t.jsx)("div",{className:"ml-auto",children:(0,t.jsxs)("button",{onClick:()=>d(!c),className:`flex items-center gap-1.5 px-2.5 py-1 rounded-md text-[12px] font-medium transition-colors ${c?"bg-[var(--brand-primary)] text-white":"text-[var(--text-muted)] hover:bg-[var(--bg-muted)] hover:text-[var(--text-secondary)]"}`,children:[(0,t.jsx)(og,{size:12}),"タイムライン"]})})]}),(0,t.jsxs)("div",{className:"flex flex-1 overflow-hidden",children:[(0,t.jsxs)("div",{className:"overflow-hidden flex flex-col shrink-0",style:{width:s},children:[(0,t.jsx)(oh,{onSelect:h}),(0,t.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,t.jsx)(p,{entries:e,selectedPath:a,onSelect:h})})]}),(0,t.jsx)("div",{className:"w-1.5 hover:bg-[var(--brand-primary)] bg-[var(--border-default)] cursor-col-resize shrink-0 transition-colors duration-150",onMouseDown:y}),(0,t.jsx)("div",{className:"flex-1 border-l border-[var(--border-default)] bg-[var(--bg-surface)] overflow-hidden flex flex-col",children:a?(0,t.jsx)(od,{filePath:a,fileRefs:x,onNavigate:h,onGoBack:m,canGoBack:g}):(0,t.jsx)("div",{className:"p-6 text-[var(--text-muted)] text-sm flex items-center justify-center h-full",children:"ファイルをクリックして内容を表示"})})]}),c&&(0,t.jsx)(ox,{onNavigate:e=>{h(e),d(!1)},onClose:()=>d(!1)})]})}],52683)}]);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "markshelf",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Structured markdown viewer for git repositories",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -1,10 +1,10 @@
1
1
  import { NextResponse } from "next/server";
2
- import { buildTree, flattenTree, readFile } from "@/lib/docs";
3
- import { buildLinkGraph } from "@/lib/links";
2
+ import { buildTree, flattenTree, readFile, statFile } from "@/lib/docs";
3
+ import { getCachedLinkGraph } from "@/lib/links";
4
4
 
5
5
  export async function GET() {
6
6
  const tree = buildTree();
7
7
  const files = flattenTree(tree);
8
- const graph = buildLinkGraph(files, readFile);
8
+ const graph = getCachedLinkGraph(files, readFile, statFile);
9
9
  return NextResponse.json(graph);
10
10
  }
@@ -136,9 +136,7 @@ export default function Home() {
136
136
  <div
137
137
  className="flex-1 border-l border-[var(--border-default)] bg-[var(--bg-surface)] overflow-hidden flex flex-col"
138
138
  >
139
- {showTimeline ? (
140
- <TimelinePanel onNavigate={(path) => { navigateTo(path); setShowTimeline(false); }} />
141
- ) : selectedPath ? (
139
+ {selectedPath ? (
142
140
  <DetailPanel
143
141
  filePath={selectedPath}
144
142
  fileRefs={fileRefs}
@@ -153,6 +151,13 @@ export default function Home() {
153
151
  )}
154
152
  </div>
155
153
  </div>
154
+
155
+ {showTimeline && (
156
+ <TimelinePanel
157
+ onNavigate={(path) => { navigateTo(path); setShowTimeline(false); }}
158
+ onClose={() => setShowTimeline(false)}
159
+ />
160
+ )}
156
161
  </div>
157
162
  );
158
163
  }
@@ -39,6 +39,11 @@ export function DetailPanel({ filePath, fileRefs, onNavigate, onGoBack, canGoBac
39
39
  useEffect(() => {
40
40
  setContent(null);
41
41
  setHeadings([]);
42
+ // Clear preview popup state and cancel any pending timers on navigation
43
+ if (showTimer.current) clearTimeout(showTimer.current);
44
+ if (hideTimer.current) clearTimeout(hideTimer.current);
45
+ setPreviewPath(null);
46
+ setPreviewPos(null);
42
47
  fetch(`/api/file?path=${encodeURIComponent(filePath)}`)
43
48
  .then((r) => r.json())
44
49
  .then((data) => setContent(data.content ?? null))
@@ -162,6 +162,7 @@ export function Markdown({
162
162
  className="text-[var(--brand-primary)] border-b border-dashed border-[var(--brand-primary)] cursor-pointer hover:bg-blue-50 transition-colors"
163
163
  onClick={(e) => {
164
164
  e.preventDefault();
165
+ onPreviewHide?.();
165
166
  onNavigate?.(targetPath);
166
167
  }}
167
168
  onMouseEnter={(e) => {
@@ -232,6 +233,7 @@ export function Markdown({
232
233
  className="text-[var(--brand-primary)] border-b border-dashed border-[var(--brand-primary)] cursor-pointer hover:bg-blue-50 transition-colors"
233
234
  onClick={(e) => {
234
235
  e.preventDefault();
236
+ onPreviewHide?.();
235
237
  onNavigate?.(targetPath);
236
238
  }}
237
239
  onMouseEnter={(e) => {
@@ -29,6 +29,10 @@ export function PreviewPopup({ path, position, onNavigate, onMouseEnter, onMouse
29
29
  const nestedHideTimer = useRef<ReturnType<typeof setTimeout>>(null);
30
30
 
31
31
  useEffect(() => {
32
+ // Cancel any pending nested popup timers whenever path changes
33
+ if (nestedShowTimer.current) clearTimeout(nestedShowTimer.current);
34
+ if (nestedHideTimer.current) clearTimeout(nestedHideTimer.current);
35
+
32
36
  if (!path) {
33
37
  setContent(null);
34
38
  setNestedPath(null);
@@ -85,11 +89,15 @@ export function PreviewPopup({ path, position, onNavigate, onMouseEnter, onMouse
85
89
 
86
90
  const handleNestedEnter = useCallback(() => {
87
91
  if (nestedHideTimer.current) clearTimeout(nestedHideTimer.current);
88
- }, []);
92
+ // Propagate upward so the parent popup's close timer is also cancelled
93
+ onMouseEnter();
94
+ }, [onMouseEnter]);
89
95
 
90
96
  const handleNestedLeave = useCallback(() => {
91
97
  handleNestedHide();
92
- }, [handleNestedHide]);
98
+ // Propagate upward so the parent chain starts closing too
99
+ onMouseLeave();
100
+ }, [handleNestedHide, onMouseLeave]);
93
101
 
94
102
  if (!path || !position) return null;
95
103
 
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
3
  import { useEffect, useState } from "react";
4
- import { GitCommit, FileText, ChevronDown, ChevronRight } from "lucide-react";
4
+ import { GitCommit, FileText, ChevronDown, ChevronRight, X, Clock } from "lucide-react";
5
5
  import { DiffView } from "./DiffView";
6
6
 
7
7
  interface TimelineEntry {
@@ -15,6 +15,7 @@ interface TimelineEntry {
15
15
 
16
16
  interface Props {
17
17
  onNavigate: (path: string) => void;
18
+ onClose: () => void;
18
19
  }
19
20
 
20
21
  function formatDate(iso: string): string {
@@ -38,7 +39,7 @@ function stripPrefix(name: string): string {
38
39
  return name.replace(/^\d+[_\-.\s]/, "").replace(/\.md$/i, "");
39
40
  }
40
41
 
41
- export function TimelinePanel({ onNavigate }: Props) {
42
+ export function TimelinePanel({ onNavigate, onClose }: Props) {
42
43
  const [entries, setEntries] = useState<TimelineEntry[]>([]);
43
44
  const [loading, setLoading] = useState(true);
44
45
  const [expandedHash, setExpandedHash] = useState<string | null>(null);
@@ -55,21 +56,13 @@ export function TimelinePanel({ onNavigate }: Props) {
55
56
  .catch(() => setLoading(false));
56
57
  }, []);
57
58
 
58
- if (loading) {
59
- return (
60
- <div className="flex-1 flex items-center justify-center text-[13px] text-[var(--text-muted)]">
61
- タイムラインを読み込み中...
62
- </div>
63
- );
64
- }
65
-
66
- if (entries.length === 0) {
67
- return (
68
- <div className="flex-1 flex items-center justify-center text-[13px] text-[var(--text-muted)]">
69
- 仕様変更の履歴がありません
70
- </div>
71
- );
72
- }
59
+ useEffect(() => {
60
+ const handleKeyDown = (e: KeyboardEvent) => {
61
+ if (e.key === "Escape") onClose();
62
+ };
63
+ window.addEventListener("keydown", handleKeyDown);
64
+ return () => window.removeEventListener("keydown", handleKeyDown);
65
+ }, [onClose]);
73
66
 
74
67
  // Group entries by date
75
68
  const grouped = new Map<string, TimelineEntry[]>();
@@ -81,8 +74,42 @@ export function TimelinePanel({ onNavigate }: Props) {
81
74
  }
82
75
 
83
76
  return (
84
- <div className="flex-1 overflow-y-auto">
85
- {Array.from(grouped.entries()).map(([dateKey, dateEntries]) => (
77
+ <div
78
+ className="fixed inset-0 z-[100] flex items-center justify-center bg-black/40 backdrop-blur-sm"
79
+ onClick={onClose}
80
+ >
81
+ <div
82
+ className="bg-[var(--bg-surface)] rounded-lg shadow-2xl w-[90vw] max-w-4xl h-[85vh] flex flex-col overflow-hidden border border-[var(--border-default)]"
83
+ onClick={(e) => e.stopPropagation()}
84
+ >
85
+ <div className="flex items-center gap-2 px-5 py-3 border-b border-[var(--border-default)] shrink-0">
86
+ <Clock size={14} className="text-[var(--brand-primary)]" />
87
+ <h2 className="font-semibold text-[14px] text-[var(--text-primary)]">
88
+ 変更タイムライン
89
+ </h2>
90
+ <span className="text-[11px] text-[var(--text-muted)]">
91
+ リポジトリ全体の仕様変更履歴
92
+ </span>
93
+ <button
94
+ onClick={onClose}
95
+ className="ml-auto p-1 rounded hover:bg-[var(--bg-muted)] text-[var(--text-muted)] hover:text-[var(--text-secondary)] transition-colors"
96
+ title="閉じる (Esc)"
97
+ >
98
+ <X size={16} />
99
+ </button>
100
+ </div>
101
+
102
+ <div className="flex-1 overflow-y-auto">
103
+ {loading ? (
104
+ <div className="h-full flex items-center justify-center text-[13px] text-[var(--text-muted)]">
105
+ タイムラインを読み込み中...
106
+ </div>
107
+ ) : entries.length === 0 ? (
108
+ <div className="h-full flex items-center justify-center text-[13px] text-[var(--text-muted)]">
109
+ 仕様変更の履歴がありません
110
+ </div>
111
+ ) : (
112
+ Array.from(grouped.entries()).map(([dateKey, dateEntries]) => (
86
113
  <div key={dateKey}>
87
114
  <div className="sticky top-0 z-10 bg-[var(--bg-base)] border-b border-[var(--border-default)] px-4 py-1.5">
88
115
  <span className="text-[11px] font-medium text-[var(--text-muted)] tracking-wide">
@@ -186,7 +213,10 @@ export function TimelinePanel({ onNavigate }: Props) {
186
213
  );
187
214
  })}
188
215
  </div>
189
- ))}
216
+ ))
217
+ )}
218
+ </div>
219
+ </div>
190
220
  </div>
191
221
  );
192
222
  }
@@ -143,6 +143,8 @@ function TreeNode({
143
143
  const handleClick = () => {
144
144
  if (entry.type === "folder" && entry.hasReadme) {
145
145
  onSelect(entry.path + "/README.md");
146
+ // Expand children when clicking a collapsed README folder, but don't collapse when already expanded
147
+ if (hasChildren && !isExpanded) onToggle(entry.path);
146
148
  } else if (isFolder) {
147
149
  onToggle(entry.path);
148
150
  } else {
@@ -105,6 +105,16 @@ export function readFile(relPath: string): string | null {
105
105
  }
106
106
  }
107
107
 
108
+ export function statFile(relPath: string): number | null {
109
+ const fullPath = path.resolve(DOCS_ROOT, relPath);
110
+ if (!fullPath.startsWith(path.resolve(DOCS_ROOT))) return null;
111
+ try {
112
+ return fs.statSync(fullPath).mtimeMs;
113
+ } catch {
114
+ return null;
115
+ }
116
+ }
117
+
108
118
  export interface FileRef {
109
119
  path: string;
110
120
  displayName: string;
@@ -71,3 +71,37 @@ export function buildLinkGraph(
71
71
 
72
72
  return { nodes, edges };
73
73
  }
74
+
75
+ // ---- In-memory cache ----
76
+
77
+ let cachedGraph: LinkGraph | null = null;
78
+ let cachedSignature: string | null = null;
79
+
80
+ function computeSignature(
81
+ files: FileRef[],
82
+ statFile: (path: string) => number | null,
83
+ ): string {
84
+ // Sort paths for stability, then join "path\0mtime"
85
+ const sorted = [...files].sort((a, b) => a.path.localeCompare(b.path));
86
+ const parts: string[] = [];
87
+ for (const f of sorted) {
88
+ const mtime = statFile(f.path) ?? 0;
89
+ parts.push(`${f.path}\0${mtime}\0${f.displayName}`);
90
+ }
91
+ return parts.join("\n");
92
+ }
93
+
94
+ export function getCachedLinkGraph(
95
+ files: FileRef[],
96
+ readFile: (path: string) => string | null,
97
+ statFile: (path: string) => number | null,
98
+ ): LinkGraph {
99
+ const signature = computeSignature(files, statFile);
100
+ if (cachedGraph && cachedSignature === signature) {
101
+ return cachedGraph;
102
+ }
103
+ const graph = buildLinkGraph(files, readFile);
104
+ cachedGraph = graph;
105
+ cachedSignature = signature;
106
+ return graph;
107
+ }