@openchambery/web 1.19.8-beta.3 → 1.19.8-beta.4

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 (55) hide show
  1. package/dist/assets/{AssistantView-TU8wOhLj.js → AssistantView-DqF_KliJ.js} +1 -1
  2. package/dist/assets/{DiagramView-BOYfHWSp.js → DiagramView-BOf0XyhQ.js} +1 -1
  3. package/dist/assets/FadeInOnReveal-CTlNE4Hg.js +1 -0
  4. package/dist/assets/MarkdownRenderer-BOu7M25-.js +2 -0
  5. package/dist/assets/MarkdownRendererImpl-CwOqt9-n.js +7 -0
  6. package/dist/assets/MarkstreamRendererImpl-CZwr50m3.js +3 -0
  7. package/dist/assets/{MobileDetailNavigation-D3gC-wqJ.js → MobileDetailNavigation-o35tPGJZ.js} +1 -1
  8. package/dist/assets/{MobileShareBridge-Clo8W8Ow.js → MobileShareBridge-CJv9FNN4.js} +1 -1
  9. package/dist/assets/{MobileSurface-B0OBBmC2.js → MobileSurface-FeJg2wvI.js} +1 -1
  10. package/dist/assets/{MultiRunWindow-CYw9m79v.js → MultiRunWindow-C4gTo26b.js} +1 -1
  11. package/dist/assets/{SettingsView-BP5Go6JV.js → SettingsView-DH1lKxhj.js} +1 -1
  12. package/dist/assets/{SettingsWindow-DruR0ngX.js → SettingsWindow-DfZYScHD.js} +1 -1
  13. package/dist/assets/{TerminalView-DkgbxCbf.js → TerminalView-Cvox0n-Y.js} +1 -1
  14. package/dist/assets/{ToolOutputDialog-CcapfAvG.js → ToolOutputDialog-DAjbYaQs.js} +2 -2
  15. package/dist/assets/{appThemeRegistry-Cct0L7cK.js → appThemeRegistry-B9dkdh17.js} +1 -1
  16. package/dist/assets/{gitApi-B6q9c8J5.js → gitApi-Cuvk5IMC.js} +1 -1
  17. package/dist/assets/{insertionBoundaries-BlEzQA4v.js → insertionBoundaries-BKBE6Sqv.js} +1 -1
  18. package/dist/assets/{main-C4p6J3eA.js → main-DJOnIS-J.js} +10 -10
  19. package/dist/assets/{main-CJKx5633.js → main-DgayyYBn.js} +2 -2
  20. package/dist/assets/markdown-worker-D_Fa477Q.js +2 -0
  21. package/dist/assets/{MarkdownLoadingSkeleton-DWs4Jg7b.js → markdownHeightCache-ClvyXMvt.js} +1 -1
  22. package/dist/assets/markdownTheme-DyJ4Gfcj.js +2 -0
  23. package/dist/assets/{miniChat-9vf0Ra29.js → miniChat-Bl8OAwWA.js} +2 -2
  24. package/dist/assets/{mobile-D6Xu4dR6.js → mobile-I1e-Q6Ti.js} +2 -2
  25. package/dist/assets/{multirun-n73MImF6.js → multirun-C4EEG6D4.js} +1 -1
  26. package/dist/assets/{projectMeta-BTFfasob.js → projectMeta-BaYjFN04.js} +1 -1
  27. package/dist/assets/{renderElectronMiniChatApp-Dk-Ai7GE.js → renderElectronMiniChatApp-a0VxaopQ.js} +2 -2
  28. package/dist/assets/renderMobileApp-Bov7RC9j.js +28 -0
  29. package/dist/assets/{runtimeConfig-HCVeOqcH.js → runtimeConfig-C4PbCqJy.js} +1 -1
  30. package/dist/assets/{runtimeEndpointReset-Co4VYv7K.js → runtimeEndpointReset-Dg84smE6.js} +6 -6
  31. package/dist/assets/{sessionLookup-DDMFe9R5.js → sessionLookup-Dy-vq8rt.js} +1 -1
  32. package/dist/assets/{useAppFontEffects-CkTZd9m1.js → useAppFontEffects-BsBNRjTC.js} +27 -27
  33. package/dist/assets/{useDesktopWindowControlsLayout-Do4mkQzu.js → useDesktopWindowControlsLayout-DI4_cCHr.js} +1 -1
  34. package/dist/assets/{useEffectiveDirectory-jX6SNwiF.js → useEffectiveDirectory-BFzFI3Zf.js} +1 -1
  35. package/dist/assets/{useMobileNavigationStore-wmyBBtul.js → useMobileNavigationStore-CUjhBNtJ.js} +1 -1
  36. package/dist/assets/{useSessionAutoCleanup-DwhZo63E.js → useSessionAutoCleanup-CYO684Np.js} +1 -1
  37. package/dist/assets/useWorkerHighlightedLines-DA0EngHm.js +7 -0
  38. package/dist/assets/{vendor-markstream-react-C3K8YH0d.js → vendor-markstream-react-BHKU7s_s.js} +4 -4
  39. package/dist/index.html +2 -2
  40. package/dist/mini-chat.html +2 -2
  41. package/dist/mobile.html +2 -2
  42. package/package.json +1 -1
  43. package/dist/assets/FadeInOnReveal-CK4asqVR.js +0 -1
  44. package/dist/assets/MarkdownRenderer-gTzL-JFf.js +0 -2
  45. package/dist/assets/MarkdownRendererImpl-B29qEz0c.js +0 -7
  46. package/dist/assets/MarkstreamRendererImpl-Cpemvp_q.js +0 -1
  47. package/dist/assets/fileReferenceActions-BJJtX_S5.js +0 -1
  48. package/dist/assets/markdown-worker-BuveaH3O.js +0 -1
  49. package/dist/assets/markdownHeightCache-CvUyZT4q.js +0 -1
  50. package/dist/assets/markdownTheme-CzZm3riB.js +0 -2
  51. package/dist/assets/outsideFileGrants-DnplRxr-.js +0 -1
  52. package/dist/assets/path-utils-jGozTg9d.js +0 -1
  53. package/dist/assets/renderMobileApp-BVksA9Z-.js +0 -28
  54. package/dist/assets/toolHelpers-DEvVP9U0.js +0 -2
  55. package/dist/assets/useWorkerHighlightedLines-Do6fIm-N.js +0 -7
package/dist/index.html CHANGED
@@ -552,7 +552,7 @@
552
552
  opacity: 0.72;
553
553
  }
554
554
  </style>
555
- <script type="module" crossorigin src="/assets/main-CJKx5633.js"></script>
555
+ <script type="module" crossorigin src="/assets/main-DgayyYBn.js"></script>
556
556
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-C0FnF6B9.js">
557
557
  <link rel="modulepreload" crossorigin href="/assets/vendor-base-ui-CnHfUmDN.js">
558
558
  <link rel="modulepreload" crossorigin href="/assets/vendor-zustand-B4dlGEM2.js">
@@ -569,7 +569,7 @@
569
569
  <link rel="modulepreload" crossorigin href="/assets/terminalApi-947l7Ra3.js">
570
570
  <link rel="modulepreload" crossorigin href="/assets/types-BuiqMmh_.js">
571
571
  <link rel="modulepreload" crossorigin href="/assets/capgoAdapter-DCowZ2ab.js">
572
- <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-HCVeOqcH.js">
572
+ <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-C4PbCqJy.js">
573
573
  <link rel="stylesheet" crossorigin href="/assets/src-DasvfkEg.css">
574
574
  </head>
575
575
  <body class="h-full bg-background text-foreground">
@@ -74,7 +74,7 @@
74
74
  }
75
75
  </style>
76
76
 
77
- <script type="module" crossorigin src="/assets/miniChat-9vf0Ra29.js"></script>
77
+ <script type="module" crossorigin src="/assets/miniChat-Bl8OAwWA.js"></script>
78
78
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-C0FnF6B9.js">
79
79
  <link rel="modulepreload" crossorigin href="/assets/vendor-base-ui-CnHfUmDN.js">
80
80
  <link rel="modulepreload" crossorigin href="/assets/vendor-zustand-B4dlGEM2.js">
@@ -91,7 +91,7 @@
91
91
  <link rel="modulepreload" crossorigin href="/assets/terminalApi-947l7Ra3.js">
92
92
  <link rel="modulepreload" crossorigin href="/assets/types-BuiqMmh_.js">
93
93
  <link rel="modulepreload" crossorigin href="/assets/capgoAdapter-DCowZ2ab.js">
94
- <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-HCVeOqcH.js">
94
+ <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-C4PbCqJy.js">
95
95
  <link rel="stylesheet" crossorigin href="/assets/src-DasvfkEg.css">
96
96
  </head>
97
97
  <body class="h-full bg-background text-foreground">
package/dist/mobile.html CHANGED
@@ -63,7 +63,7 @@
63
63
  })();
64
64
  </script>
65
65
 
66
- <script type="module" crossorigin src="/assets/mobile-D6Xu4dR6.js"></script>
66
+ <script type="module" crossorigin src="/assets/mobile-I1e-Q6Ti.js"></script>
67
67
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-C0FnF6B9.js">
68
68
  <link rel="modulepreload" crossorigin href="/assets/vendor-base-ui-CnHfUmDN.js">
69
69
  <link rel="modulepreload" crossorigin href="/assets/vendor-zustand-B4dlGEM2.js">
@@ -80,7 +80,7 @@
80
80
  <link rel="modulepreload" crossorigin href="/assets/terminalApi-947l7Ra3.js">
81
81
  <link rel="modulepreload" crossorigin href="/assets/types-BuiqMmh_.js">
82
82
  <link rel="modulepreload" crossorigin href="/assets/capgoAdapter-DCowZ2ab.js">
83
- <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-HCVeOqcH.js">
83
+ <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-C4PbCqJy.js">
84
84
  <link rel="stylesheet" crossorigin href="/assets/src-DasvfkEg.css">
85
85
  </head>
86
86
  <body class="h-full bg-background text-foreground">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openchambery/web",
3
- "version": "1.19.8-beta.3",
3
+ "version": "1.19.8-beta.4",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./server/index.js",
@@ -1 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{nt as t,rt as n}from"./vendor-base-ui-CnHfUmDN.js";import{n as r}from"./vendor-react-DLPElpoQ.js";import{t as i}from"./utils-BiK3tBGM.js";var a=500,o=12,s=(e={})=>{let t=e.delayMs??a,n=(e.moveThresholdPx??o)**2,r=e.schedule??((e,t)=>setTimeout(e,t)),i=e.clear??(e=>clearTimeout(e)),s=null,c=null,l=(t=!1)=>{s&&(i(s.timer),s=null,t||e.onPressedKeyChange?.(null))};return{start:({pointerId:n,key:i,clientX:a,clientY:o,onTrigger:u})=>{l(),e.onPressedKeyChange?.(i),s={pointerId:n,key:i,startX:a,startY:o,timer:r(()=>{!s||s.pointerId!==n||s.key!==i||(s.triggered=!0,c=i,u())},t),triggered:!1}},move:(e,t,r)=>{if(s?.pointerId!==e||s.triggered)return;let i=t-s.startX,a=r-s.startY;i*i+a*a>n&&l()},end:e=>{s?.pointerId===e&&l(s.triggered)},cancel:e=>{s?.pointerId===e&&l()},openFromContextMenu:(t,n)=>{l(),c=t,e.onPressedKeyChange?.(t),n()},consumeClick:e=>c===e&&(c=null,!0),reset:()=>{l(),c=null,e.onPressedKeyChange?.(null)}}},c=`#openchamber-skill:`,l=`#openchamber-agent:`,u=e=>`https://opencode.ai/docs/agents/#${encodeURIComponent(e)}`,d=e=>`${c}${encodeURIComponent(e)}`,f=e=>`${l}${encodeURIComponent(e)}`,p=e=>{if(!e?.startsWith(c))return null;try{return decodeURIComponent(e.slice(19))}catch{return null}},m=e=>{if(!e?.startsWith(l))return null;try{return decodeURIComponent(e.slice(19))}catch{return null}},h=[`user-blocking`,`visible`,`background`],g=e=>{let t={"user-blocking":{head:null,tail:null},visible:{head:null,tail:null},background:{head:null,tail:null}},n=Math.max(1,Math.floor(e.maxTasksPerFrame)),r=Math.max(1,e.frameBudgetMs),i=null,a=!1,o=0,s=e=>{let n=t[e.priority];e.previous=n.tail,n.tail?n.tail.next=e:n.head=e,n.tail=e},c=e=>{let n=t[e.priority];e.previous?e.previous.next=e.next:n.head=e.next,e.next?e.next.previous=e.previous:n.tail=e.previous,e.next=null,e.previous=null},l=()=>{for(let e of h){let n=t[e].head;if(n)return c(n),n.consumed=!0,--o,n}return null},u=()=>{i===null&&o!==0&&(i=e.requestFrame(d))},d=()=>{i=null;let t=e.now(),a=0;for(;o>0&&a<n;){let n=l();if(!n||(n.run(),a+=1,e.now()-t>=r))break}u()},f=()=>{i!==null||a||o===0||(a=!0,i=e.requestFrame(()=>{i=null,a=!1,u()}))};return{enqueue(t,n){let r={cancelled:!1,consumed:!1,next:null,previous:null,priority:n?.priority??`background`,run:t};return s(r),o+=1,!a&&i===null&&f(),()=>{r.cancelled||r.consumed||(r.cancelled=!0,c(r),--o,o===0&&(i!==null&&(e.cancelFrame(i),i=null),a=!1))}},clear(){for(let e of h){let n=t[e],r=n.head;for(;r;){let e=r.next;r.cancelled=!0,r.next=null,r.previous=null,r=e}n.head=null,n.tail=null}o=0,i!==null&&(e.cancelFrame(i),i=null),a=!1}}},_=null,v=()=>typeof window>`u`?null:_||(_=g({requestFrame:e=>window.requestAnimationFrame(e),cancelFrame:e=>window.cancelAnimationFrame(e),now:()=>performance.now(),maxTasksPerFrame:2,frameBudgetMs:6}),_),y=(e,t)=>{let n=v();return n?n.enqueue(e,t):(e(),()=>{})},b={textThrottleMs:20,markdownPaceMs:64},x={textThrottleMs:100,markdownPaceMs:128},S=e=>e===`android`?x:b,C=r(),w=e(n(),1),T=t(),E=w.createContext(!1),D=e=>{let t=(0,C.c)(3),{disabled:n,children:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,T.jsx)(E.Provider,{value:n,children:r}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i},O=e=>{let t=(0,C.c)(8),{children:n,className:r}=e,[a,o]=w.useState(!1),s,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=null,t=()=>o(!0);return typeof window<`u`&&typeof window.requestAnimationFrame==`function`?e=window.requestAnimationFrame(t):t(),()=>{e!==null&&typeof window<`u`&&typeof window.cancelAnimationFrame==`function`&&window.cancelAnimationFrame(e)}},c=[],t[0]=s,t[1]=c):(s=t[0],c=t[1]),w.useEffect(s,c);let l=a?`opacity-100 translate-y-0`:`opacity-0 translate-y-2`,u;t[2]!==r||t[3]!==l?(u=i(`w-full transition-all duration-300 ease-out`,l,r),t[2]=r,t[3]=l,t[4]=u):u=t[4];let d;return t[5]!==n||t[6]!==u?(d=(0,T.jsx)(`div`,{className:u,children:n}),t[5]=n,t[6]=u,t[7]=d):d=t[7],d},k=e=>{let t=(0,C.c)(5),{children:n,className:r,skipAnimation:i,forceAnimation:a,ignoreContextDisabled:o,respectReducedMotion:s}=e,c=a!==void 0&&a,l=o!==void 0&&o,u=s!==void 0&&s,d=w.useContext(E),f=u&&typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;if(!c||i||!l&&d||f){let e;return t[0]===n?e=t[1]:(e=(0,T.jsx)(T.Fragment,{children:n}),t[0]=n,t[1]=e),e}let p;return t[2]!==n||t[3]!==r?(p=(0,T.jsx)(O,{className:r,children:n}),t[2]=n,t[3]=r,t[4]=p):p=t[4],p};export{f as a,m as c,y as i,p as l,k as n,u as o,S as r,d as s,D as t,s as u};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkstreamRendererImpl-Cpemvp_q.js","assets/rolldown-runtime-C0FnF6B9.js","assets/vendor-base-ui-CnHfUmDN.js","assets/vendor-react-DLPElpoQ.js","assets/vendor-markstream-react-C3K8YH0d.js","assets/vendor-aparajita-capacitor-secure-storage-CjQdwfjS.js","assets/vendor-markstream-core-Cm34iPLL.js","assets/vendor-floating-ui-dom-BHhLtF5l.js","assets/vendor-floating-ui-core-Co1I1lFV.js","assets/vendor-markstream-react-CGQrpq8a.css","assets/vendor-reactuses-core-DDoDDyM9.js","assets/vendor-lodash-es-DfLbG5Af.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/useMobileNavigationStore-wmyBBtul.js","assets/useUIStore-CuaA8-Hp.js","assets/vendor-zustand-B4dlGEM2.js","assets/persistence-DdUac14I.js","assets/vendor-pathe-vBmvQE8f.js","assets/vendor-tanstack-query-core-BWz0ose6.js","assets/platform-B4KKLnZ5.js","assets/vendor-opencode-sdk-C07HQypa.js","assets/vendor-tanstack-react-query-D7pys_c9.js","assets/vendor-sonner-DVzioF3d.js","assets/clipboard-DJ4nQEuY.js","assets/store-BDFdnk6l.js","assets/useAssistantUIStore-me6s63b2.js","assets/vendor-fuse.js-DB5wDJbI.js","assets/utils-BiK3tBGM.js","assets/vendor-class-variance-authority-BLUaYARZ.js","assets/vendor-tailwind-merge-BicNWLTg.js","assets/useThemeSystem-DMzWVJaW.js","assets/useRuntimeAPIs-DSLXJybW.js","assets/url-Pk6tQ1EZ.js","assets/useEffectiveDirectory-jX6SNwiF.js","assets/markdownHeightCache-CvUyZT4q.js","assets/fileReferenceActions-BJJtX_S5.js","assets/toolHelpers-DEvVP9U0.js","assets/path-utils-jGozTg9d.js","assets/outsideFileGrants-DnplRxr-.js","assets/MarkstreamRendererImpl-CsNwy1T5.css","assets/MarkdownRendererImpl-B29qEz0c.js","assets/vendor-katex--B5dHUyk.js","assets/markdownTheme-CzZm3riB.js","assets/vendor-pierre-diffs-DX7XTPG3.js","assets/vendor-hast-util-to-html-B0p1k5Xa.js","assets/vendor-character-entities-legacy-Wut6vMuj.js","assets/vendor-character-entities-html4-DlN_yAFd.js","assets/vendor-ccount-CyGsA0u7.js","assets/vendor-comma-separated-tokens-B9ouxNNS.js","assets/vendor-oniguruma-to-es-CrHzjjSU.js","assets/vendor-oniguruma-parser-D2DIvhSP.js","assets/vendor-diff-Dq7CZNim.js","assets/vendor-lru_map-DpDied8H.js","assets/FadeInOnReveal-CK4asqVR.js","assets/MarkdownLoadingSkeleton-DWs4Jg7b.js","assets/markdown-worker-BuveaH3O.js","assets/vendor-morphdom-BbKiNDAu.js","assets/vendor-beautiful-mermaid-DykqIK5D.js","assets/vendor-dompurify-CeJNOzik.js","assets/vendor-marked-WVekxjAN.js","assets/vendor-remend-C3cXc-tf.js"])))=>i.map(i=>d[i]);
2
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{a as t}from"./vendor-zustand-B4dlGEM2.js";import{nt as n,rt as r}from"./vendor-base-ui-CnHfUmDN.js";import{o as i}from"./vendor-aparajita-capacitor-secure-storage-CjQdwfjS.js";import{n as a}from"./vendor-react-DLPElpoQ.js";import{t as o}from"./utils-BiK3tBGM.js";import{t as s}from"./MarkdownLoadingSkeleton-DWs4Jg7b.js";import{n as c,t as l}from"./markdownHeightCache-CvUyZT4q.js";var u=a(),d=e(r(),1),f=`openchamber:chunk-import-reload`,p=250,m=3e4,h=[/Importing a module script failed/i,/Failed to fetch dynamically imported module/i,/error loading dynamically imported module/i,/Loading chunk \S+ failed/i,/ChunkLoadError/i];function g(e){if(e instanceof Error)return`${e.name}\n${e.message}\n${e.stack??``}`;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function _(e){let t=g(e);return h.some(e=>e.test(t))}function v(e){return`1.19.8-beta.3:${g(e).slice(0,500)}`}function y(e){if(typeof window>`u`)return;let t=Date.now(),n=v(e),r=null;try{let e=window.sessionStorage.getItem(f);if(e)try{r=JSON.parse(e)}catch{r=null}}catch{return}let i=typeof r?.timestamp==`number`?r.timestamp:0;if(!(r?.signature===n&&t-i<m)){try{window.sessionStorage.setItem(f,JSON.stringify({signature:n,timestamp:t}))}catch{return}console.error(`[refresh-debug] chunk-import-reload`,{error:g(e).slice(0,1e3)}),window.setTimeout(()=>{window.location.reload()},0)}}async function b(e,t={}){let n=t.retries??1,r;for(let t=0;t<=n;t+=1)try{return await e()}catch(e){if(r=e,!_(e)||t>=n)break;await new Promise(e=>setTimeout(e,p*(t+1)))}throw _(r)&&y(r),r}var x=e=>(0,d.lazy)(()=>b(e)),S=(e,t)=>{try{let n=t??(typeof localStorage>`u`?null:localStorage);return n?n.getItem(e)===`1`:!1}catch{return!1}},C=(e,t)=>{try{let n=t??(typeof localStorage>`u`?null:localStorage);return!n||n.getItem(e)!==`0`}catch{return!0}},w=(e,t)=>{try{typeof localStorage<`u`&&localStorage.setItem(e,t?`1`:`0`)}catch{}},T=`oc:legend-timeline`,E=e=>S(T,e),D=`oc:markstream-react`,O=e=>C(D,e),k=t(e=>({legendTimelineEnabled:E(),setLegendTimelineEnabled:t=>{w(T,t),e({legendTimelineEnabled:t})},markstreamReactEnabled:O(),setMarkstreamReactEnabled:t=>{w(D,t),e({markstreamReactEnabled:t})}})),A=null,j=()=>(A??=i(()=>import(`./MarkstreamRendererImpl-Cpemvp_q.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39])).catch(e=>{throw A=null,e}),A),M=()=>{j().catch(()=>void 0)},N=null,P=()=>(N??=i(()=>import(`./MarkdownRendererImpl-B29qEz0c.js`),__vite__mapDeps([40,1,14,15,2,16,17,3,18,19,20,5,41,10,11,12,23,24,13,21,22,25,26,27,28,29,30,42,43,44,45,46,47,48,49,50,51,52,37,31,32,33,53,54,34,55,56,57,58,59,60,35,36,38])).catch(e=>{throw N=null,e}),N),F=()=>{P().catch(()=>void 0),O()&&M()},I=class extends d.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){console.warn(`[markstream-react] falling back to the current Markdown renderer`,e)}render(){return this.state.hasError?this.props.fallback:this.props.children}},L=d.createContext(!0),R=()=>d.useContext(L),z=n(),B=x(()=>P().then(e=>({default:e.MarkdownRenderer}))),V=x(()=>j().then(e=>({default:e.MarkstreamRenderer}))),H=x(()=>P().then(e=>({default:e.SimpleMarkdownRenderer}))),U=e=>e===`tool`?`markdown-content markdown-tool`:e===`reasoning`?`markdown-content markdown-reasoning`:`markdown-content leading-relaxed`,W=e=>{let t=(0,u.c)(15),n=k(q),r=typeof e.content==`string`?e.content:``,i=typeof e.variant==`string`?e.variant:`assistant`,a;t[0]!==r||t[1]!==n||t[2]!==e.reserveMeasuredHeight||t[3]!==i?(a=e.reserveMeasuredHeight?c(l(r,n?`markstream:${i}`:i)):void 0,t[0]=r,t[1]=n,t[2]=e.reserveMeasuredHeight,t[3]=i,t[4]=a):a=t[4];let d=a,f;t[5]!==e.className||t[6]!==e.variant?(f=o(`relative break-words w-full min-w-0`,U(e.variant),typeof e.className==`string`?e.className:void 0),t[5]=e.className,t[6]=e.variant,t[7]=f):f=t[7];let p;t[8]!==r||t[9]!==e.animated||t[10]!==d?(p=(0,z.jsx)(s,{animated:e.animated,content:r,reservedHeight:d}),t[8]=r,t[9]=e.animated,t[10]=d,t[11]=p):p=t[11];let m;return t[12]!==f||t[13]!==p?(m=(0,z.jsx)(`div`,{className:f,"aria-busy":`true`,"data-markdown-hydration":`deferred`,"data-markdown-ready":`false`,children:p}),t[12]=f,t[13]=p,t[14]=m):m=t[14],m},G=e=>{let t=(0,u.c)(9),n=R(),r=k(J);if(!n&&e.isStreaming!==!0){let n;return t[0]===e?n=t[1]:(n=(0,z.jsx)(W,{...e,animated:!1,reserveMeasuredHeight:!0}),t[0]=e,t[1]=n),n}let i;t[2]===e?i=t[3]:(i=(0,z.jsx)(d.Suspense,{fallback:(0,z.jsx)(W,{...e,reserveMeasuredHeight:!0}),children:(0,z.jsx)(B,{...e})}),t[2]=e,t[3]=i);let a=i;if(!r)return a;let o;t[4]===e?o=t[5]:(o=(0,z.jsx)(d.Suspense,{fallback:(0,z.jsx)(W,{...e,reserveMeasuredHeight:!0}),children:(0,z.jsx)(V,{...e})}),t[4]=e,t[5]=o);let s;return t[6]!==a||t[7]!==o?(s=(0,z.jsx)(I,{fallback:a,children:o}),t[6]=a,t[7]=o,t[8]=s):s=t[8],s},K=e=>{let t=(0,u.c)(4);if(!R()){let n;return t[0]===e?n=t[1]:(n=(0,z.jsx)(W,{...e,animated:!1}),t[0]=e,t[1]=n),n}let n;return t[2]===e?n=t[3]:(n=(0,z.jsx)(d.Suspense,{fallback:(0,z.jsx)(W,{...e}),children:(0,z.jsx)(H,{...e})}),t[2]=e,t[3]=n),n};function q(e){return e.markstreamReactEnabled}function J(e){return e.markstreamReactEnabled}export{k as a,F as i,K as n,x as o,L as r,G as t};
@@ -1,7 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{E as t,t as n}from"./useUIStore-CuaA8-Hp.js";import{$t as r}from"./persistence-DdUac14I.js";import{nt as i,rt as a}from"./vendor-base-ui-CnHfUmDN.js";import{t as o}from"./platform-B4KKLnZ5.js";import{n as s}from"./vendor-react-DLPElpoQ.js";import{n as c}from"./vendor-katex--B5dHUyk.js";import{n as l,r as u,u as d}from"./vendor-reactuses-core-DDoDDyM9.js";import{n as f,t as p}from"./clipboard-DJ4nQEuY.js";import{Oi as m}from"./useMobileNavigationStore-wmyBBtul.js";import{t as h}from"./utils-BiK3tBGM.js";import{t as g}from"./useThemeSystem-DMzWVJaW.js";import{c as _,f as v,h as y,n as b,o as x,r as S,s as C,t as w}from"./markdownTheme-CzZm3riB.js";import{n as ee}from"./useRuntimeAPIs-DSLXJybW.js";import{a as T,i as E,n as D,r as O}from"./url-Pk6tQ1EZ.js";import{n as te}from"./useEffectiveDirectory-jX6SNwiF.js";import{c as ne,i as k,l as re,n as ie,o as A,r as ae,u as j}from"./FadeInOnReveal-CK4asqVR.js";import{t as oe}from"./MarkdownLoadingSkeleton-DWs4Jg7b.js";import{i as M,r as N,t as se}from"./markdownHeightCache-CvUyZT4q.js";import{i as P,n as F,t as ce}from"./markdown-worker-BuveaH3O.js";import{t as I}from"./vendor-morphdom-BbKiNDAu.js";import{n as L,t as R}from"./vendor-beautiful-mermaid-DykqIK5D.js";import{t as z}from"./vendor-dompurify-CeJNOzik.js";import{t as B}from"./vendor-marked-WVekxjAN.js";import{t as V}from"./vendor-remend-C3cXc-tf.js";import{a as le,c as ue,d as H,f as de,i as fe,l as pe,m as U,n as me,r as he,s as ge,t as _e}from"./fileReferenceActions-BJJtX_S5.js";var W=e(a(),1),ve=s(),G=`data-md-stream-fence`,K=`data-md-stream-line`,ye=`data-md-stream-src`,be=`data-md-stream-applied`,xe=(e,t)=>{let n=Math.min(e.length,t.length);for(let r=0;r<n;r+=1)if(e[r]!==t[r])return r;return n},Se=e=>Array.from(e.children).filter(e=>e instanceof HTMLElement&&e.hasAttribute(`data-md-stream-line`)),Ce=(e,t)=>{let n=document.createElement(`span`);return n.setAttribute(K,String(t)),n.className=`line`,n.innerHTML=e,n},we=(e,t)=>{let n=Se(e),r=xe(n.map(e=>e.innerHTML),t);if(n.length===0&&e.childNodes.length>0&&t.length>0){e.replaceChildren();for(let n=0;n<t.length;n+=1)e.appendChild(Ce(t[n]??``,n));return{reused:0,replaced:0,added:t.length,removed:0}}let i=0;if(r<n.length&&r<t.length){let e=n[r];e&&(e.innerHTML=t[r]??``,e.setAttribute(K,String(r)),i=1)}let a=0;for(let e=n.length-1;e>=r+i;--e)n[e]?.remove(),a+=1;let o=0;for(let n=r+i;n<t.length;n+=1)e.appendChild(Ce(t[n]??``,n)),o+=1;return{reused:r,replaced:i,added:o,removed:a}},Te=e=>{if(e.includes(`data-md-stream-fence=`))return e;let t=e.toLowerCase().lastIndexOf(`<pre`);return t<0?e:`${e.slice(0,t)}${e.slice(t).replace(/<pre\b/i,`<pre ${G}="true"`)}`},Ee=(e,t)=>{if(!(e instanceof HTMLElement)||!(t instanceof HTMLElement)||e.getAttribute(`data-md-stream-fence`)!==`true`||t.getAttribute(`data-md-stream-fence`)!==`true`)return!1;let n=e.tagName===`CODE`?e:e.querySelector(`code`),r=t.tagName===`CODE`?t:t.querySelector(`code`);return n instanceof HTMLElement&&r instanceof HTMLElement&&n.setAttribute(ye,r.textContent??``),!0},De=e=>e.getAttribute(`data-md-stream-src`)??e.textContent??``,Oe=e=>{let t=e.querySelectorAll(`pre[${G}="true"]`),n=[];return t.forEach(e=>{let t=e.querySelector(`code`);t instanceof HTMLElement&&n.push(t)}),n},ke=e=>e.closest(`pre`)?.getAttribute(`data-md-lang`)||e.className.match(/language-([^\s"]+)/)?.[1]||`text`,Ae=async(e,t,n)=>{if(n?.signal?.aborted)return;let r=Oe(e);await Promise.all(r.map(async r=>{let i=De(r);if(!i||n?.signal?.aborted||r.getAttribute(`data-md-stream-applied`)===i)return;let a=ke(r);if(a===`mermaid`)return;let o=await t(i,a,n);!o||n?.signal?.aborted||!e.contains(r)||(we(r,o),r.setAttribute(be,i),r.removeAttribute(ye))}))},je=`text`,Me=/^(\d+):(\d+):(.+)$/,Ne={ts:`typescript`,mts:`typescript`,cts:`typescript`,tsx:`tsx`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,jsx:`jsx`,vue:`vue`,svelte:`svelte`,astro:`astro`,json:`json`,jsonc:`jsonc`,json5:`json5`,jsonl:`json`,ndjson:`json`,geojson:`json`,yaml:`yaml`,yml:`yaml`,toml:`toml`,ini:`ini`,cfg:`ini`,conf:`ini`,properties:`properties`,env:`dotenv`,css:`css`,scss:`scss`,sass:`sass`,less:`less`,styl:`stylus`,html:`html`,htm:`html`,xml:`xml`,svg:`xml`,md:`markdown`,markdown:`markdown`,mdown:`markdown`,mkd:`markdown`,mdx:`mdx`,py:`python`,pyw:`python`,pyi:`python`,rb:`ruby`,go:`go`,rs:`rust`,java:`java`,kt:`kotlin`,kts:`kotlin`,swift:`swift`,scala:`scala`,c:`c`,h:`c`,cc:`cpp`,cpp:`cpp`,cxx:`cpp`,hpp:`cpp`,hh:`cpp`,m:`objective-c`,mm:`objective-cpp`,cs:`csharp`,fs:`fsharp`,fsx:`fsharp`,vb:`vb`,php:`php`,pl:`perl`,pm:`perl`,lua:`lua`,r:`r`,dart:`dart`,ex:`elixir`,exs:`elixir`,erl:`erlang`,hrl:`erlang`,hs:`haskell`,clj:`clojure`,cljs:`clojure`,cljc:`clojure`,groovy:`groovy`,jl:`julia`,ml:`ocaml`,mli:`ocaml`,zig:`zig`,nix:`nix`,sol:`solidity`,prisma:`prisma`,proto:`proto`,graphql:`graphql`,gql:`graphql`,sql:`sql`,sh:`shellscript`,bash:`shellscript`,zsh:`shellscript`,fish:`shellscript`,ps1:`powershell`,psm1:`powershell`,bat:`bat`,cmd:`bat`,tf:`terraform`,tfvars:`terraform`,hcl:`hcl`,diff:`diff`,patch:`diff`,csv:`csv`,tex:`latex`,vim:`viml`,wgsl:`wgsl`,glsl:`glsl`,wat:`wasm`,mermaid:`mermaid`,mmd:`mermaid`},Pe={dockerfile:`docker`,containerfile:`docker`,makefile:`make`,gnumakefile:`make`,"cmakelists.txt":`cmake`,gemfile:`ruby`,rakefile:`ruby`,podfile:`ruby`,".env":`dotenv`,".bashrc":`shellscript`,".zshrc":`shellscript`,".profile":`shellscript`},Fe=e=>{let t=e.split(/[\\/]/).pop()?.toLowerCase()??``;if(!t)return je;let n=Pe[t];if(n)return n;let r=t.lastIndexOf(`.`);return r<=0?je:Ne[t.slice(r+1)]??je},Ie=e=>{let t=e?.trim()??``;if(!t)return{lang:je,label:je,reference:!1};let n=Me.exec(t);if(!n){let e=t.toLowerCase();return{lang:e,label:e,reference:!1}}let[,r=``,i=``,a=``]=n,o=r===i?r:`${r}-${i}`;return{lang:Fe(a),label:`${a}:${o}`,reference:!0}},Le=e=>e===` `||e===` `||e===`
2
- `||e===`\r`,Re=e=>e!==void 0&&e>=`0`&&e<=`9`,ze=e=>e===`\\`||e===`^`||e===`_`||e===`{`||e===`}`||e===`=`||e===`+`||e===`*`||e===`/`||e===`-`,Be=e=>{for(let t=0;t<e.length;t+=1){let n=e[t];if(n!==void 0&&ze(n))return!0}return!1},Ve=e=>{for(let t=0;t<e.length;t+=1){let n=e[t];if(n===`"`||n===`'`||Le(n))return!0}return!1},He=e=>{let t=0;for(;t<e.length;){let n=e.indexOf(`$`,t);if(n<0)return;let r=e[n+1];if(r===`$`||r!==void 0&&!Le(r))return n;t=n+1}},Ue=e=>{if(e[0]===`$`){if(e[1]===`$`){let t=e.indexOf(`$$`,2);return t<0?void 0:{raw:e.slice(0,t+2),text:e.slice(2,t),display:!0}}if(!(e.length<3||Le(e[1])))for(let t=1;t<e.length;t+=1){let n=e[t];if(n===`\\`){t+=1;continue}if(n!==`$`)continue;if(e[t+1]===`$`||Le(e[t-1]))return;if(Re(e[t+1]))continue;if(t===1)return;let r=e.slice(1,t);return Re(e[1])&&!Be(r)&&Ve(r)?void 0:{raw:e.slice(0,t+1),text:r,display:!1}}}},q=e=>e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`),We=e=>{let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(36)},Ge=e=>`${We(e.raw)}:${e.mode}:${+!!e.highlight}`,Ke=e=>/^\[[^\]]+\]:\s+\S+/m.test(e)||/^\[\^[^\]]+\]:\s+/m.test(e),qe=e=>{let t=e.match(/^[ \t]{0,3}(`{3,}|~{3,})/);if(!t)return!1;let n=t[1];if(!n)return!1;let r=n[0],i=n.length,a=e.trimEnd().split(`
3
- `).at(-1)?.trim()??``;return!RegExp(`^[\\t ]{0,3}${r}{${i},}[\\t ]*$`).test(a)},Je=e=>{try{return V(e,{linkMode:`text-only`})}catch{return e}},Ye=(e,t)=>{let n=t?`live`:`full`;if(Ke(e))return[{raw:e,src:Je(e),mode:n,highlight:!0}];let r;try{r=B.lexer(e)}catch{return[{raw:e,src:Je(e),mode:n,highlight:!0}]}let i=-1;for(let e=r.length-1;e>=0;--e)if(r[e]?.type!==`space`){i=e;break}if(i<0)return[{raw:e,src:Je(e),mode:n,highlight:!0}];let a=[];for(let e=0;e<r.length;e+=1){let t=r[e];if(!t||t.type===`space`)continue;let o=t.raw??``,s=e===i,c=t.type===`code`&&qe(o);a.push({raw:o,src:c?o:Je(o),mode:s?n:`full`,highlight:!c})}return a.length===0?[{raw:e,src:Je(e),mode:n,highlight:!0}]:a},Xe=16,Ze=new Map,Qe=(e,t)=>{let n=`${+!!t}:${e}`,r=Ze.get(n);if(r)return Ze.delete(n),Ze.set(n,r),r;let i=Ye(e,t);for(;Ze.size>=Xe;){let e=Ze.keys().next().value;if(typeof e!=`string`)break;Ze.delete(e)}return Ze.set(n,i),i},$e=(e,t,n)=>{try{return c.renderToString(e,{displayMode:n,throwOnError:!1})}catch{return t}},et=B.use({gfm:!0,breaks:!1,extensions:[{name:`inlineMath`,level:`inline`,start(e){let t=e.indexOf(`\\(`);return t<0?void 0:t},tokenizer(e){let t=/^\\\(([\s\S]+?)\\\)/.exec(e);if(t)return{type:`inlineMath`,raw:t[0],text:t[1]??``}},renderer(e){let t=e;return $e(t.text,t.raw,!1)}},{name:`blockMath`,level:`block`,start(e){let t=e.indexOf(`\\[`);return t<0?void 0:t},tokenizer(e){let t=/^\\\[([\s\S]+?)\\\]/.exec(e);if(t)return{type:`blockMath`,raw:t[0],text:t[1]??``}},renderer(e){let t=e;return $e(t.text,t.raw,!0)}},{name:`dollarMath`,level:`inline`,start(e){return He(e)},tokenizer(e){let t=Ue(e);if(t)return{type:`dollarMath`,raw:t.raw,text:t.text,display:t.display}},renderer(e){let t=e;return $e(t.text,t.raw,t.display)}}],renderer:{link({href:e,title:t,text:n}){let r=e??``,i=ne(r);if(i)return`<a href="${q(A(i))}" data-openchamber-agent-mention="true" class="text-primary hover:underline" target="_blank" rel="noopener noreferrer">${n}</a>`;let a=re(r);if(a)return`<a href="${q(r)}" data-skill-name="${q(a)}" class="text-primary hover:underline">${n}</a>`;let o=t?` title="${q(t)}"`:``;return`<a href="${q(r)}"${o} class="external-link" target="_blank" rel="noopener noreferrer">${n}</a>`}}}),tt=e=>e.replace(/\$\$([\s\S]*?)\$\$/g,(e,t)=>{try{return c.renderToString(t,{displayMode:!0,throwOnError:!1})}catch{return`$$${t}$$`}}),nt=e=>e.indexOf(`$`)===-1?e:e.split(/(<(?:pre|code|kbd)[^>]*>[\s\S]*?<\/(?:pre|code|kbd)>)/gi).map((e,t)=>t%2==1?e:tt(e)).join(``),rt=e=>nt(et.parse(e)),it=e=>{let t=rt(e.src);return e.highlight?t:Te(t)},at=/<pre><code(?:\s+class="language-([^"]*)")?>([\s\S]*?)<\/code><\/pre>/g,ot=1200,st=(e,t)=>{let n=1;for(let r=0;r<e.length;r+=1)if(e.charCodeAt(r)===10&&++n>t)return!0;return!1},ct=e=>e.replace(/&lt;/g,`<`).replace(/&gt;/g,`>`).replace(/&quot;/g,`"`).replace(/&#39;/g,`'`).replace(/&amp;/g,`&`),lt=e=>e.reference?`data-md-lang="${q(e.lang)}" data-md-label="${q(e.label)}"`:`data-md-lang="${q(e.lang)}"`,ut=async(e,t,n)=>{if(n.isCancelled?.())return null;let r=[...e.matchAll(at)];if(r.length===0)return e;let i=e;for(let e of r){if(n.isCancelled?.())return null;let[r,a,o]=e,s=Ie(a);if(s.lang===`mermaid`&&!s.reference)continue;let c=ct(o??``);if(st(c,n.lineLimit)){i=i.replace(r,()=>r.replace(`<pre`,`<pre ${lt(s)}`));continue}let l=await t(c,s.lang);if(n.isCancelled?.())return null;if(l){let e=l.replace(/^<pre/,`<pre ${lt(s)}`);i=i.replace(r,()=>e)}}return i},dt=(e,t)=>!t&&e.length<=480&&!e.includes("```"),ft={USE_PROFILES:{html:!0,mathMl:!0,svg:!0},ADD_TAGS:[`svg`,`path`,`g`,`rect`,`line`,`polygon`,`polyline`,`circle`,`ellipse`,`text`,`tspan`,`defs`,`marker`],ADD_ATTR:[`d`,`viewBox`,`preserveAspectRatio`,`xmlns`,`target`,`fill`,`stroke`,`stroke-width`,`transform`,`points`,`x`,`y`,`x1`,`y1`,`x2`,`y2`,`cx`,`cy`,`r`,`rx`,`ry`,`style`],FORBID_TAGS:[`script`],FORBID_CONTENTS:[`script`]},pt=!1,mt=()=>{pt||typeof window>`u`||!z.isSupported||(pt=!0,z.addHook(`uponSanitizeAttribute`,(e,t)=>{if(!(e instanceof HTMLImageElement)||t.attrName!==`src`)return;let n=typeof t.attrValue==`string`?t.attrValue:``;/^file:/i.test(n)&&(e.setAttribute(`data-md-image-source`,n),t.keepAttr=!1)}),z.addHook(`afterSanitizeAttributes`,e=>{e instanceof HTMLAnchorElement&&e.target===`_blank`&&e.setAttribute(`rel`,`noopener noreferrer`)}))},ht=e=>z.isSupported?(mt(),z.sanitize(e,ft)):``,gt=`data-md-sanitize-block`,_t=e=>{if(e.length===0)return[];if(e.length===1)return[ht(e[0])];if(!z.isSupported||typeof document>`u`)return e.map(e=>ht(e));let t=e.map((e,t)=>`<div ${gt}="${t}">${e}</div>`).join(``),n=document.createElement(`div`);n.innerHTML=ht(t);let r=e.map(()=>``);return n.querySelectorAll(`[${gt}]`).forEach(e=>{let t=Number(e.getAttribute(gt));Number.isInteger(t)&&t>=0&&t<r.length&&(r[t]=e.innerHTML)}),r},vt=()=>r()?200:ot,yt=240,bt=16777216,xt=160,St=8388608,Ct=new M({maxEntries:yt,maxBytes:bt}),wt=new M({maxEntries:xt,maxBytes:St}),Tt=e=>e.length*2,Et=(e,t)=>{Ct.set(e,t,Tt(e)+Tt(t.hash)+Tt(t.html))},Dt=async(e,t,n)=>ut(e,(e,r)=>ce(e,r,{signal:t,priority:n}),{lineLimit:vt(),isCancelled:()=>!!t?.aborted}),Ot=async(e,t,n)=>{if(t?.aborted)return null;let r=it(e);if(t?.aborted)return null;let i=e.highlight?await Dt(r,t,n):r;if(i===null||t?.aborted)return null;let a=ht(i);return t?.aborted?null:a},kt=e=>`${We(e)}:${e.length}`,At=e=>{let t=wt.get(kt(e));return t?.source===e?t.html:void 0},jt=(e,t)=>{let n=kt(e);wt.set(n,{source:e,html:t},Tt(n)+Tt(e)+Tt(t))},Mt=e=>{if(!e)return[];let t=Qe(e,!1),n=Array(t.length).fill(``),r=[],i=[];t.forEach((e,t)=>{let a=At(e.src);if(a!==void 0){n[t]=a;return}r.push(t),i.push(it(e))});let a=_t(i);return r.forEach((e,r)=>{let i=a[r]??``;n[e]=i;let o=t[e]?.src;o!==void 0&&jt(o,i)}),n},Nt=8,Pt=()=>typeof performance<`u`?performance.now():Date.now(),Ft=e=>e?.aborted?Promise.resolve(!1):new Promise(t=>{let n=!1,r=r=>{n||(n=!0,e?.removeEventListener(`abort`,a),t(r))},i=k(()=>{r(!e?.aborted)},{priority:`visible`}),a=()=>{i(),r(!1)};e?.addEventListener(`abort`,a,{once:!0})}),It=(e,t)=>{let n=[];for(let r=0;r<e.length;r+=1){let i=e[r];if(!i)return null;let a=We(i.raw),o=`${t}:${r}:${i.mode}`,s=Ct.get(o);if(!s||s.hash!==a)return null;n.push({id:Ge(i),html:s.html})}return n},Lt=(e,t,n)=>{let r=_t(t.map(e=>e.html));return t.map((t,i)=>{let a=e[i],o=r[i]??``;return a&&Et(`${n}:${i}:${a.mode}`,{hash:We(a.raw),html:o}),{id:t.id,html:o}})},Rt=async(e,t,n,r)=>{let i=n?`visible`:`background`,a=async(e,n)=>{if(r?.aborted)return null;let a=We(e.raw),o=Ge(e),s=`${t}:${n}:${e.mode}`,c=Ct.get(s);if(c&&c.hash===a)return{id:o,html:c.html};let l=await Ot(e,r,i);return l===null||r?.aborted?null:(Et(s,{hash:a,html:l}),{id:o,html:l})};if(n)return(await Promise.all(e.map(a))).filter(e=>e!==null);let o=[],s=0;for(let t=0;t<e.length&&!r?.aborted;t+=1){let n=e[t];if(!n)continue;if(Pt()>=s){if(!await Ft(r))break;s=Pt()+Nt}let i=await a(n,t);i&&o.push(i)}return o},zt=async(e,t,n,r)=>{if(!e)return[];let i=Qe(e,t),a=It(i,n);if(a)return a;let o=t?`visible`:`background`,s=[],c=[];for(let e=0;e<i.length;e+=1){let t=i[e];if(!t)continue;let r=Ct.get(`${n}:${e}:${t.mode}`);r&&r.hash===We(t.raw)||(s.push(t),c.push(e))}if(!dt(e,t)&&s.length>0)try{let e=await P({streaming:t,highlight:!0,highlightLineLimit:vt(),signal:r,priority:o,blocks:s});if(r?.aborted)return[];if(e&&e.length===s.length)return Lt(i,i.map((t,r)=>{let i=c.indexOf(r);if(i>=0)return e[i]??{id:Ge(t),html:``,highlight:t.highlight};let a=Ct.get(`${n}:${r}:${t.mode}`);return{id:Ge(t),html:a?.html??``,highlight:t.highlight}}),n)}catch{}return Rt(i,n,t,r)},J=e=>Number.isFinite(e)&&e>0,Bt=e=>{if(typeof e==`number`)return J(e)?e:null;if(typeof e!=`string`)return null;let t=e.trim().match(/^([+-]?(?:(?:\d+\.?\d*)|(?:\.\d+))(?:[eE][+-]?\d+)?)(?:px)?$/);if(!t)return null;let n=Number(t[1]);return J(n)?n:null},Vt=(e,t,n)=>Math.min(n,Math.max(t,e)),Ht=6,Ut=1.25,Wt=1.0015,Gt=16,Kt=1e3,qt=.5,Jt=12,Yt=400,Xt=`[data-markdown="mermaid-block"]`,Zt=e=>e.querySelector(Xt)!==null,Qt=e=>[e.x,e.y,e.width,e.height].map(e=>{let t=Number(e.toFixed(Ht));return Object.is(t,-0)?`0`:String(t)}).join(` `),$t=e=>{let t=e.viewBox?.trim().split(/[\s,]+/).map(e=>Number.parseFloat(e));if(t?.length===4){let[e,n,r,i]=t;if(Number.isFinite(e)&&Number.isFinite(n)&&J(r)&&J(i))return{x:e,y:n,width:r,height:i}}let n=Bt(e.width),r=Bt(e.height);return n===null||r===null?null:{x:0,y:0,width:n,height:r}},en=e=>{let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(36)},tn=e=>{let t=e.renderMode||`unknown`,n=e.svgMarkup??``;if(!n){let n=[e.viewBox??``,e.width??``,e.height??``];return n.some(e=>e!==``)?`${t}:bounds:${n.join(`:`)}`:`${t}:no-svg`}return[t,en(n)].join(`:`)},nn=(e,t)=>{if(!J(t.width)||!J(t.height))return e;let n=e.width/e.height,r=t.width/t.height;if(n>r){let t=e.width/r;return{x:e.x,y:e.y-(t-e.height)/2,width:e.width,height:t}}let i=e.height*r;return{x:e.x-(i-e.width)/2,y:e.y,width:i,height:e.height}},rn=({currentBox:e,viewport:t,delta:n})=>!J(t.width)||!J(t.height)||!J(e.width)||!J(e.height)?e:{x:e.x-n.x/t.width*e.width,y:e.y-n.y/t.height*e.height,width:e.width,height:e.height},an=(e,t,n)=>{let r=e*(t===1?Gt:t===2?J(n)?n:0:1);return Number.isFinite(r)?Vt(r,-1e3,Kt):0},on=e=>{let t=null;for(let n of e){if(!t){t=n;continue}return{center:{x:(t.x+n.x)/2,y:(t.y+n.y)/2},distance:Math.hypot(n.x-t.x,n.y-t.y)}}return null},sn=(e,t)=>{let n=t.x-e.x,r=t.y-e.y;return n*n+r*r>9},cn=({currentBox:e,contentBox:t,viewport:n,pointer:r,zoomFactor:i,minScale:a,maxScale:o})=>{if(!J(n.width)||!J(n.height)||!J(i)||!J(e.width)||!J(e.height)||!J(t.width)||!J(t.height)||!J(a)||!J(o))return e;let s=Math.min(a,o),c=Math.max(a,o),l=nn(t,n),u=Vt(l.width/e.width*i,s,c),d=l.width/u,f=d/(e.width/e.height),p=Vt(r.x/n.width,0,1),m=Vt(r.y/n.height,0,1),h=e.x+p*e.width,g=e.y+m*e.height;return{x:h-p*d,y:g-m*f,width:d,height:f}},ln=({currentBox:e,contentBox:t,viewport:n,previousGesture:r,gesture:i,minScale:a,maxScale:o})=>!J(r.distance)||!J(i.distance)?e:cn({currentBox:rn({currentBox:e,viewport:n,delta:{x:i.center.x-r.center.x,y:i.center.y-r.center.y}}),contentBox:t,viewport:n,pointer:i.center,zoomFactor:i.distance/r.distance,minScale:a,maxScale:o}),un=new WeakMap,dn=e=>e instanceof HTMLElement?un.get(e)??null:null,fn=e=>e.querySelector(`[data-markdown="mermaid-viewport"]`)??e.querySelector(`[data-markdown="mermaid"]`),pn=e=>{let t=e.querySelector(`[data-markdown="mermaid"] svg`),n=e.querySelector(`[data-markdown="mermaid"]`);return tn({renderMode:e.getAttribute(`data-mermaid-render`),svgMarkup:n?.getAttribute(`data-md-original-svg`)??t?.outerHTML??null,viewBox:t?.getAttribute(`viewBox`),width:t?.getAttribute(`width`),height:t?.getAttribute(`height`)})},Y=e=>{let t=e.getBoundingClientRect();return{width:t.width,height:t.height}},mn=(e,t)=>({x:e.clientX-t.left,y:e.clientY-t.top}),hn=(e,t)=>mn(e,t.getBoundingClientRect()),gn=e=>e instanceof Element&&!!e.closest(`button, a, [role="button"]`),_n=e=>{let t=fn(e),n=e.querySelector(`[data-markdown="mermaid"] svg`);if(!t||!n)return null;let r=$t({viewBox:n.getAttribute(`viewBox`),width:n.getAttribute(`width`),height:n.getAttribute(`height`)});if(!r)return null;let i=r,a=null,o=null,s=null,c=new Map,l=new Set,u=null,d=null,f=e=>{i=e,n.setAttribute(`viewBox`,Qt(e)),n.removeAttribute(`width`),n.removeAttribute(`height`)},p=()=>{f(nn(r,Y(t)))},m=(e,n)=>{f(cn({currentBox:i,contentBox:r,viewport:Y(t),pointer:e,zoomFactor:n,minScale:qt,maxScale:Jt}))},h=()=>{let e=Y(t);m({x:e.width/2,y:e.height/2},Ut)},g=()=>{let e=Y(t);m({x:e.width/2,y:e.height/2},1/Ut)},_=e=>{e.preventDefault(),e.stopPropagation();let n=an(e.deltaY,e.deltaMode,Y(t).height);m(hn(e,t),Wt**+-n)},v=e=>{try{t.setPointerCapture(e),l.add(e)}catch{}},y=e=>{if(l.delete(e))try{t.hasPointerCapture(e)&&t.releasePointerCapture(e)}catch{}},b=()=>{a=null,o=null,s=null,c.clear(),u=null},x=()=>{b(),e.removeAttribute(`data-mermaid-panning`),e.hasAttribute(`data-mermaid-suppress-click`)&&(d=window.setTimeout(()=>{e.removeAttribute(`data-mermaid-suppress-click`),d=null},Yt))},S=n=>{if(n.pointerType!==`touch`&&n.button!==0||gn(n.target))return;d!==null&&(window.clearTimeout(d),d=null),e.removeAttribute(`data-mermaid-suppress-click`);let r=hn(n,t);v(n.pointerId),e.setAttribute(`data-mermaid-panning`,`true`),n.pointerType===`touch`?(c.set(n.pointerId,r),c.size>=2?(a=null,o=null,s=null,u=on(c.values()),e.setAttribute(`data-mermaid-suppress-click`,`true`)):(a=n.pointerId,o=r,s=r)):(a=n.pointerId,o=r,s=r),n.preventDefault()},C=n=>{if(n.pointerType===`touch`){if(!c.has(n.pointerId))return;let a=hn(n,t);if(c.set(n.pointerId,a),c.size>=2){let a=on(c.values());u&&a&&f(ln({currentBox:i,contentBox:r,viewport:Y(t),previousGesture:u,gesture:a,minScale:qt,maxScale:Jt})),u=a,e.setAttribute(`data-mermaid-suppress-click`,`true`),n.preventDefault();return}}if(a!==n.pointerId||!s)return;let l=hn(n,t);f(rn({currentBox:i,viewport:Y(t),delta:{x:l.x-s.x,y:l.y-s.y}})),s=l,o&&sn(o,l)&&e.setAttribute(`data-mermaid-suppress-click`,`true`),n.preventDefault()},w=e=>{if(e.pointerType===`touch`||c.has(e.pointerId)){if(!c.has(e.pointerId))return;if(c.delete(e.pointerId),u=on(c.values()),c.size>0){for(let[e,t]of c){a=e,o=t,s=t;break}c.size>=2&&(a=null,o=null,s=null),y(e.pointerId);return}x(),y(e.pointerId);return}a===e.pointerId&&(x(),y(e.pointerId))},ee=()=>{p()};t.addEventListener(`wheel`,_,{passive:!1}),t.addEventListener(`pointerdown`,S),t.addEventListener(`pointermove`,C),t.addEventListener(`pointerup`,w),t.addEventListener(`pointercancel`,w),t.addEventListener(`lostpointercapture`,w),window.addEventListener(`resize`,ee);let T=typeof ResizeObserver>`u`?null:new ResizeObserver(ee);return T?.observe(t),p(),{zoomIn:h,zoomOut:g,fit:p,cleanup:()=>{t.removeEventListener(`wheel`,_),t.removeEventListener(`pointerdown`,S),t.removeEventListener(`pointermove`,C),t.removeEventListener(`pointerup`,w),t.removeEventListener(`pointercancel`,w),t.removeEventListener(`lostpointercapture`,w),window.removeEventListener(`resize`,ee),T?.disconnect(),d!==null&&window.clearTimeout(d);for(let e of Array.from(l))y(e);b(),e.removeAttribute(`data-mermaid-panning`),e.removeAttribute(`data-mermaid-suppress-click`),un.delete(e)}}},vn=e=>{let t=new Map,n=new Map,r=()=>{for(let[r,i]of Array.from(t.entries())){let a=pn(r);(!e.contains(r)||a!==n.get(r))&&(i.cleanup(),t.delete(r),n.delete(r))}for(let r of Array.from(e.querySelectorAll(Xt))){if(t.has(r)||r.querySelector(`[data-markdown="mermaid"] svg`)===null)continue;let e=_n(r);e&&(t.set(r,e),n.set(r,pn(r)),un.set(r,e))}};return r(),{refresh:r,cleanup:()=>{for(let e of t.values())e.cleanup();t.clear(),n.clear()}}},X=(e,t=`size-3.5`)=>`<svg class="oc-icon ${t}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><use href="#oc-${e}"></use></svg>`,yn={copy:X(`file-copy`),check:X(`check`),download:X(`download`),zoomIn:X(`add`),zoomOut:X(`subtract`),fit:X(`refresh`),textWrap:X(`text-wrap`),image:X(`file-image`,`size-10`),imageDownload:X(`download`,`size-3`),imageLoading:X(`loader-4`,`size-3.5 animate-spin motion-reduce:animate-none`)},bn=`p-1 rounded hover:bg-interactive-hover/60 text-muted-foreground hover:text-foreground transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--interactive-focus-ring)]`,xn=(e,t)=>{e.innerHTML=t},Z=(e,t,n)=>{let r=document.createElement(`button`);return r.type=`button`,r.className=bn,r.setAttribute(`data-md-action`,n),r.setAttribute(`title`,t),r.setAttribute(`aria-label`,t),xn(r,yn[e]),r},Sn=(e,t,n)=>{let r=e.querySelector(`[data-md-code-body]`),i=e.querySelector(`pre`),a=e.querySelector(`pre code`),o=e.querySelector(`[data-md-action="toggle-code-wrap"]`);if(e.setAttribute(`data-code-wrap`,t?`true`:`false`),r?.classList.toggle(`overflow-x-auto`,!t),r?.classList.toggle(`overflow-x-hidden`,t),i?.classList.toggle(`whitespace-pre-wrap`,t),i?.classList.toggle(`break-words`,t),a?.classList.toggle(`whitespace-pre-wrap`,t),a?.classList.toggle(`break-words`,t),i&&(i.style.whiteSpace=t?`pre-wrap`:`pre`,i.style.overflowWrap=t?`anywhere`:`normal`),a&&(a.style.whiteSpace=t?`pre-wrap`:`pre`,a.style.overflowWrap=t?`anywhere`:`normal`),o){let e=t?n.disableCodeWrap:n.enableCodeWrap;o.setAttribute(`title`,e),o.setAttribute(`aria-label`,e),o.classList.toggle(`text-foreground`,t),o.classList.toggle(`opacity-100`,t),o.classList.toggle(`text-muted-foreground`,!t),o.classList.toggle(`opacity-65`,!t),o.setAttribute(`aria-pressed`,t?`true`:`false`)}},Cn=e=>{let t=document.createElement(`div`);t.setAttribute(`data-md-code-line-numbers`,``),t.setAttribute(`aria-hidden`,`true`),t.className=`min-w-8 shrink-0 select-none border-r border-border/50 pr-3 text-right font-mono text-[13px] text-muted-foreground/45`;let n=e.textContent??``,r=Math.max(1,n.endsWith(`
4
- `)?n.split(`
5
- `).length-1:n.split(`
6
- `).length);for(let e=1;e<=r;e+=1){let n=document.createElement(`div`);n.className=`tabular-nums`,n.textContent=String(e),t.appendChild(n)}return t},wn=e=>{let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),r=n.nextNode();for(;r;)t.push(r),r=n.nextNode();return t},Tn=(e,t)=>{let n=0;for(let r of e){let e=n+r.data.length;if(t<=e)return{node:r,offset:Math.max(0,t-n)};n=e}let r=e.at(-1);return r?{node:r,offset:r.data.length}:null},En=(e,t)=>{let n=1/0,r=-1/0;for(let t=0;t<e.length;t+=1){let i=e[t];!i||i.width===0&&i.height===0||(i.top<n&&(n=i.top),i.bottom>r&&(r=i.bottom))}return!Number.isFinite(n)||r<=n?t:Math.max(t,r-n)},Dn=e=>Array.from(e.children).filter(e=>e instanceof HTMLElement&&e.classList.contains(`line`)),On=(e,t,n)=>{e.style.height=`${t}px`,e.style.lineHeight=`${n}px`},kn=(e,t,n)=>{let r=document.createRange();r.setStart(e.node,e.offset),r.setEnd(t.node,t.offset);let i=Math.max(En(r.getClientRects(),n),En([r.getBoundingClientRect()],n));return r.detach(),i},An=e=>{let t=e.querySelectorAll(`[data-component="markdown-code"]`);for(let e of Array.from(t)){let t=e.querySelector(`pre code`),n=e.querySelector(`[data-md-code-line-numbers]`);if(!t||!n)continue;let r=Array.from(n.children),i=window.getComputedStyle(t),a=Number.parseFloat(i.lineHeight)||20;n.style.fontFamily=i.fontFamily,n.style.fontSize=i.fontSize,n.style.lineHeight=`${a}px`;let o=Dn(t);if(o.length===r.length){let e=o.map(e=>e.getBoundingClientRect()),t=e=>(e?.textContent??``).length===0;for(let n=0;n<r.length;n+=1){let i=r[n],s=o[n],c=e[n];if(!i||!s||!c)continue;if(t(s)){On(i,a,a);continue}let l=o[n+1],u=e[n+1],d=u&&!t(l)?u.top:c.bottom;On(i,En([{top:c.top,bottom:d,width:1,height:d-c.top}],a),a)}continue}let s=t.textContent??``,c=wn(t),l=0;for(let e=0;e<r.length;e+=1){let t=s.indexOf(`
7
- `,l),n=t===-1?s.length:t,i=r[e];if(!i)continue;let o=Tn(c,l),u=Tn(c,n);!o||!u||l===n?On(i,a,a):On(i,kn(o,u,a),a),l=n+1}}},jn=e=>{window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>An(e))})},Mn=(e,t,n)=>{let r=e.querySelectorAll(`[data-component="markdown-code"]`);for(let e of Array.from(r)){let r=e.querySelector(`[data-md-code-body]`),i=e.querySelector(`pre`);r&&i&&!r.querySelector(`[data-md-code-line-numbers]`)&&(r.classList.add(`flex`,`gap-3`),r.insertBefore(Cn(i),i)),Sn(e,t,n)}jn(e)},Nn=(e,t,n,r)=>{xn(e,yn.check),e.setAttribute(`title`,t),e.setAttribute(`aria-label`,t),window.setTimeout(()=>{xn(e,yn[n]),e.setAttribute(`title`,r),e.setAttribute(`aria-label`,r)},2e3)},Pn=e=>{let t=e.querySelectorAll(`:not(pre) > code`);for(let e of Array.from(t))e.getAttribute(`data-markdown`)!==`inline-code`&&e.setAttribute(`data-markdown`,`inline-code`)},Fn=(e,t)=>{let n=e.querySelectorAll(`pre`);for(let e of Array.from(n)){if(e.querySelector(`code.language-mermaid`))continue;let n=e.parentElement;if(!n||n.closest(`[data-component="markdown-code"]`))continue;let r=e.querySelector(`code`)?.className.match(/language-([^\s"]+)/)?.[1],i=e.getAttribute(`data-md-label`)??e.getAttribute(`data-md-lang`)??Ie(r).label,a=document.createElement(`div`);a.setAttribute(`data-component`,`markdown-code`),a.className=`my-4 group overflow-hidden rounded-2xl border border-border/80 bg-[var(--surface-elevated)]`;let o=document.createElement(`div`);o.className=`flex items-center justify-between border-b border-border/70 px-3 py-1.5`;let s=document.createElement(`span`);s.className=`font-mono text-[13px] text-muted-foreground`,s.textContent=i;let c=Z(`copy`,t.labels.copy,`copy-code`),l=Z(`textWrap`,t.codeBlockLineWrap?t.labels.disableCodeWrap:t.labels.enableCodeWrap,`toggle-code-wrap`);o.appendChild(s);let u=document.createElement(`div`);u.className=`flex items-center gap-1`,u.appendChild(l),u.appendChild(c),o.appendChild(u);let d=document.createElement(`div`);d.setAttribute(`data-md-code-body`,``),d.className=`px-3 py-2.5 overflow-x-auto`,n.replaceChild(a,e),e.style.margin=`0`,e.style.background=`transparent`,e.classList.add(`min-w-0`,`w-full`,`flex-1`),d.appendChild(e),a.appendChild(o),a.appendChild(d),Sn(a,t.codeBlockLineWrap,t.labels)}},In=e=>{let t=e.querySelectorAll(`table`);for(let e of Array.from(t)){if(e.closest(`[data-markdown="table-wrapper"]`))continue;let t=document.createElement(`div`);t.className=`my-4`,t.setAttribute(`data-markdown`,`table-wrapper`);let n=document.createElement(`div`);n.setAttribute(`data-markdown`,`table-scroll`);let r=e.parentElement;if(r){r.replaceChild(t,e),e.setAttribute(`data-markdown`,`table`);for(let t of Array.from(e.querySelectorAll(`tr`)))t.setAttribute(`data-markdown`,`table-row`);for(let t of Array.from(e.querySelectorAll(`th`)))t.setAttribute(`data-markdown`,`table-header-cell`);for(let t of Array.from(e.querySelectorAll(`td`)))t.setAttribute(`data-markdown`,`table-cell`);n.appendChild(e),t.appendChild(n)}}},Ln=(e,t)=>{let n=e.querySelectorAll(`pre > code.language-mermaid`);for(let e of Array.from(n)){let n=e.parentElement;if(!n)continue;let r=(e.textContent??``).replace(/\s+$/,``),i=t.renderMermaid(r),a=document.createElement(`div`);a.setAttribute(`data-markdown`,`mermaid-block`),a.setAttribute(`data-md-source`,r),a.className=`group relative`;let o=document.createElement(`div`);o.setAttribute(`data-markdown`,`mermaid-scroll`);let s=document.createElement(`div`);if(s.setAttribute(`data-markdown`,`mermaid-toolbar`),s.className=`absolute top-1 right-2 flex items-center gap-1 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 transition-opacity`,i.svg){a.setAttribute(`data-mermaid-render`,`svg`);let e=document.createElement(`div`);e.setAttribute(`data-markdown`,`mermaid-viewport`);let n=document.createElement(`div`);if(n.setAttribute(`data-markdown`,`mermaid`),n.setAttribute(`data-md-original-svg`,i.svg),n.innerHTML=i.svg,e.appendChild(n),o.appendChild(e),t.mermaidControls.showPanZoomControls&&(s.appendChild(Z(`zoomIn`,t.labels.zoomInDiagram,`mermaid-zoom-in`)),s.appendChild(Z(`zoomOut`,t.labels.zoomOutDiagram,`mermaid-zoom-out`)),s.appendChild(Z(`fit`,t.labels.resetDiagramView,`mermaid-fit`))),t.mermaidControls.copy){let e=Z(`copy`,t.labels.copyDiagram,`mermaid-copy`);e.setAttribute(`data-md-source`,r),s.appendChild(e)}if(t.mermaidControls.download){let e=Z(`download`,t.labels.downloadDiagram,`mermaid-download`);e.setAttribute(`data-md-svg`,`1`),s.appendChild(e)}}else{a.setAttribute(`data-mermaid-render`,`ascii`);let e=document.createElement(`pre`);if(e.setAttribute(`data-markdown`,`mermaid-ascii`),e.textContent=i.ascii||r,o.appendChild(e),t.mermaidControls.copy){let e=Z(`copy`,t.labels.copyDiagram,`mermaid-copy`);e.setAttribute(`data-md-source`,i.ascii||r),s.appendChild(e)}}a.appendChild(o),a.appendChild(s);let c=n.parentElement;c&&c.replaceChild(a,n)}},Rn=(e,t)=>{let n=e.querySelectorAll(`a[href]`);for(let e of Array.from(n)){if(e.getAttribute(`data-md-link-decorated`)===`true`||e.getAttribute(`data-openchamber-file-link`)===`true`)continue;let n=e.getAttribute(`href`)??``;if(!O(n))continue;e.setAttribute(`data-md-link-decorated`,`true`);let r=D(n);if(r){let t=document.createElement(`span`);t.className=`mr-1 inline-flex size-[18px] items-center justify-center rounded border border-[var(--border)] bg-[var(--interactive-hover)] align-middle`;let n=document.createElement(`img`);n.setAttribute(`data-md-link-favicon`,`true`),n.src=r,n.alt=``,n.setAttribute(`aria-hidden`,`true`),n.loading=`lazy`,n.decoding=`async`,n.className=`size-3.5 rounded-sm`,n.addEventListener(`error`,()=>t.remove(),{once:!0}),t.appendChild(n),e.parentNode?.insertBefore(t,e)}if(t.onPreviewLoopback&&E(n)){let r=document.createElement(`button`);r.type=`button`,r.className=`ml-1 align-middle ${bn}`,r.setAttribute(`data-md-action`,`preview-loopback`),r.setAttribute(`data-md-url`,n),r.setAttribute(`title`,t.labels.previewTitle),r.setAttribute(`aria-label`,t.labels.previewLabel),xn(r,yn.download),e.parentNode?.insertBefore(r,e.nextSibling)}}},zn=`img:not([data-md-link-favicon="true"])`,Bn=`[data-md-image-presentation="true"]`,Vn=`data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="576" height="324" viewBox="0 0 576 324"%3E%3C/svg%3E`,Hn=[`block`,`max-w-full`,`rounded-xl`,`border`,`border-border/80`,`bg-[var(--surface-muted)]`,`transition-colors`,`focus-visible:outline`,`focus-visible:outline-2`,`focus-visible:outline-offset-2`,`focus-visible:outline-[var(--interactive-focus-ring)]`],Un=[`cursor-pointer`,`hover:bg-interactive-hover/60`],Wn=[`aspect-video`,`h-auto`,`w-full`,`max-w-xl`,`object-contain`],Gn=e=>{let t=e.parentElement;if(t?.matches(Bn))return t;let n=document.createElement(`span`);n.setAttribute(`data-md-image-presentation`,`true`),n.className=`relative my-4 block w-fit max-w-full`;let r=document.createElement(`span`);r.setAttribute(`data-md-image-placeholder-visual`,`true`),r.setAttribute(`aria-hidden`,`true`),r.className=`pointer-events-none absolute inset-0 flex items-center justify-center text-muted-foreground`;let i=document.createElement(`span`);i.className=`relative flex size-14 items-center justify-center rounded-2xl border border-border/80 bg-[var(--surface-elevated)] shadow-sm`,xn(i,yn.image);let a=document.createElement(`span`);a.setAttribute(`data-md-image-download-badge`,`true`),a.className=`absolute -right-1.5 -bottom-1.5 flex size-6 items-center justify-center rounded-full border border-border bg-[var(--surface-elevated)] text-foreground shadow-sm`,xn(a,yn.imageDownload);let o=document.createElement(`span`);return o.setAttribute(`data-md-image-loading-badge`,`true`),o.className=`absolute -right-1.5 -bottom-1.5 hidden size-6 items-center justify-center rounded-full border border-border bg-[var(--surface-elevated)] text-foreground shadow-sm`,xn(o,yn.imageLoading),i.appendChild(a),i.appendChild(o),r.appendChild(i),t?.replaceChild(n,e),n.appendChild(e),n.appendChild(r),n},Kn=e=>{e.src=Vn,e.setAttribute(`data-md-placeholder-source`,Vn),e.setAttribute(`data-md-image-state`,`placeholder`),e.classList.add(...Wn)},qn=e=>{e.removeAttribute(`data-md-image-state`),e.removeAttribute(`data-md-placeholder-source`),e.removeAttribute(`aria-busy`),e.classList.remove(...Wn)},Jn=(e,t)=>{if(!t.imagePreviewEnabled)return;let n=e.querySelectorAll(zn);for(let e of Array.from(n)){let n=e.getAttribute(`data-md-image-source`)??e.getAttribute(`src`)??``,r=_(n,t.imageEffectiveDirectory);x(r)&&(e.classList.add(...Hn,...Un),e.setAttribute(`role`,`button`),e.setAttribute(`tabindex`,`0`),e.setAttribute(`data-md-image-source`,n),Gn(e),Kn(e))}},Yn=(e,t)=>{Pn(e),Ln(e,t),Fn(e,t),In(e),Rn(e,t),Jn(e,t),U(e)},Xn=(e,t,n)=>{let r=new Blob([t],{type:n}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=e,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)},Zn=(e,t)=>{let n=e=>{let n=e.target;if(!(n instanceof Element))return;let r=n.closest(`[data-md-action]`);if(!r)return;let i=r.getAttribute(`data-md-action`)??``;if(i===`copy-code`){let e=r.closest(`[data-component="markdown-code"]`)?.querySelector(`code`)?.textContent??``;e&&p(e).then(()=>Nn(r,t.labels.copied,`copy`,t.labels.copy));return}if(i===`toggle-code-wrap`){e.preventDefault(),t.onToggleCodeBlockLineWrap?.();return}if(i===`mermaid-copy`){let e=r.getAttribute(`data-md-source`)??``;e&&p(e).then(()=>Nn(r,t.labels.copied,`copy`,t.labels.copyDiagram));return}if(i===`mermaid-zoom-in`||i===`mermaid-zoom-out`||i===`mermaid-fit`){e.preventDefault();let t=dn(r.closest(`[data-markdown="mermaid-block"]`));i===`mermaid-zoom-in`?t?.zoomIn():i===`mermaid-zoom-out`?t?.zoomOut():t?.fit();return}if(i===`mermaid-download`){let e=r.closest(`[data-markdown="mermaid-block"]`)?.querySelector(`[data-markdown="mermaid"]`),t=e?.getAttribute(`data-md-original-svg`)??e?.innerHTML??``;t&&Xn(`diagram.svg`,t,`image/svg+xml;charset=utf-8`);return}if(i===`preview-loopback`){e.preventDefault();let n=r.getAttribute(`data-md-url`)??``;n&&t.onPreviewLoopback?.(n);return}};return e.addEventListener(`click`,n),()=>e.removeEventListener(`click`,n)},Q=i(),Qn=()=>{let e=(0,ve.c)(4),t=g(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=y(!1),e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=y(!0),e[1]=i):i=e[1];let a=i,o;return e[2]===t?.currentTheme?o=e[3]:(o=t?.currentTheme??(typeof window<`u`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?a:r),e[2]=t?.currentTheme,e[3]=o),o},$n=e=>{let t=(0,ve.c)(2),{containerRef:n,enabled:r}=e,i;t[0]===r?i=t[1]:(i=e=>{if(r===!1||e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;let t=e.target;if(!(t instanceof Element)||t.closest($))return;let n=t.closest(`a[href]`);if(!(n instanceof HTMLAnchorElement)||n.getAttribute(`data-openchamber-file-link`)===`true`)return;let i=n.getAttribute(`href`)??``;O(i)&&(e.preventDefault(),e.stopPropagation(),T(i))},t[0]=r,t[1]=i);let a=l(i);u(`click`,a,n)},$=`img:not([data-md-link-favicon="true"])`,er=e=>e.getAttribute(`data-md-image-source`)??e.getAttribute(`src`)??``,tr=({containerRef:e,effectiveDirectory:n,onShowPopup:r})=>{let i=W.useRef(null);i.current??=t();let a=i.current,o=!!r,s=l(e=>r?.(e)),c=W.useRef(()=>{}),u=W.useRef(new Map),d=W.useRef(null),f=W.useMemo(()=>e=>c.current(e),[]);return W.useLayoutEffect(()=>{let t=u.current;if(d.current!==null&&(clearTimeout(d.current),d.current=null),c.current=()=>{},!o){for(let[e,n]of t)n.controller?.abort(),n.objectUrl&&C(n.objectUrl),t.delete(e);return}let r=e.current;if(!r)return;let i=e=>{let t=Array.from(r.querySelectorAll($));if(t.indexOf(e)<0)return;let n=t.map(e=>({url:er(e),filename:e.alt||er(e)||void 0})).filter(e=>e.url),i=er(e),a=n.findIndex(e=>e.url===i),o=e.alt||i;s({open:!0,title:o,content:``,metadata:{tool:`image-preview`,filename:o},image:{url:i,filename:o,gallery:n,index:Math.max(0,a)}})},l=e=>{let n=t.get(e);n&&(n.controller?.abort(),n.objectUrl&&C(n.objectUrl),t.delete(e))},f=e=>{let t=er(e),r=_(t,n);if(x(r))return`${a}\n${n}\n${t}`},p=e=>{let n=f(e);if(!n){l(e);return}let r=t.get(e);if(r?.key===n)return r;l(e);let i={key:n};return t.set(e,i),i},m=(e,i)=>{if(i.controller||i.objectUrl||!r.contains(e))return;let a=er(e),o=_(a,n);if(!x(o)){l(e);return}let s=new AbortController;i.controller=s,e.setAttribute(`data-md-image-state`,`loading`),e.setAttribute(`aria-busy`,`true`),S(o.path,s.signal).then(n=>{let r=t.get(e);if(!r||r!==i||r.controller!==s||s.signal.aborted){C(n);return}r.controller=void 0,r.objectUrl=n,qn(e),e.setAttribute(`data-md-image-state`,`loaded`),e.src=n}).catch(()=>{let n=t.get(e);n===i&&(n.controller=void 0,e.removeAttribute(`aria-busy`),e.setAttribute(`data-md-image-state`,`placeholder`))})};c.current=e=>{for(let[n,r]of t)(!e.contains(n)||f(n)!==r.key)&&l(n);for(let t of Array.from(e.querySelectorAll($))){let e=p(t);e&&!e.objectUrl&&m(t,e)}},c.current(r);let h=e=>{let t=p(e);if(t&&!t.objectUrl){m(e,t);return}i(e)},g=e=>{let t=er(e);t&&v({sourceUrl:t,displayUrl:e.currentSrc||e.src||void 0,filename:e.alt||t,effectiveDirectory:n})},y=j(),b=e=>er(e)||e.src||`markdown-image`,w=e=>{let t=e.target;if(!(t instanceof Element))return;let n=t.closest($);if(n){if(y.consumeClick(b(n))){e.preventDefault(),e.stopPropagation();return}e.preventDefault(),e.stopPropagation(),h(n)}},ee=e=>{if(e.key!==`Enter`&&e.key!==` `)return;let t=e.target;!(t instanceof HTMLImageElement)||!t.matches($)||(e.preventDefault(),e.stopPropagation(),h(t))},T=e=>{if(e.pointerType===`mouse`&&e.button!==0)return;let t=e.target;if(!(t instanceof Element))return;let n=t.closest($);n&&y.start({pointerId:e.pointerId,key:b(n),clientX:e.clientX,clientY:e.clientY,onTrigger:()=>g(n)})},E=e=>{y.move(e.pointerId,e.clientX,e.clientY)},D=e=>{y.end(e.pointerId)},O=e=>{y.cancel(e.pointerId)},te=e=>{let t=e.target;if(!(t instanceof Element))return;let n=t.closest($);n&&(e.preventDefault(),e.stopPropagation(),y.openFromContextMenu(b(n),()=>g(n)))};return r.addEventListener(`click`,w),r.addEventListener(`keydown`,ee),r.addEventListener(`pointerdown`,T),r.addEventListener(`pointermove`,E),r.addEventListener(`pointerup`,D),r.addEventListener(`pointercancel`,O),r.addEventListener(`contextmenu`,te),()=>{c.current=()=>{},y.reset(),r.removeEventListener(`click`,w),r.removeEventListener(`keydown`,ee),r.removeEventListener(`pointerdown`,T),r.removeEventListener(`pointermove`,E),r.removeEventListener(`pointerup`,D),r.removeEventListener(`pointercancel`,O),r.removeEventListener(`contextmenu`,te),d.current=setTimeout(()=>{d.current=null;for(let e of Array.from(t.keys()))r.contains(e)&&Kn(e),l(e)},0)}},[e,n,o,a]),{reconcileMarkdownImageResources:f,transportIdentity:a}},nr={download:!0,copy:!0,showPanZoomControls:!0},rr=!0,ir=e=>{let t=e.match(/^(?:\uFEFF)?(---|\+\+\+)[^\S\r\n]*\r?\n[\s\S]*?\r?\n\1[^\S\r\n]*(?:\r?\n|$)/);return t?e.slice(t[0].length):e},ar=160,or=e=>{let t=(0,ve.c)(8),{containerRef:n,effectiveDirectory:r,editor:i,preferRuntimeEditor:a,onShowPopup:o,enabled:s}=e,c=W.useRef(null),l,u;t[0]!==n||t[1]!==i||t[2]!==r||t[3]!==s||t[4]!==o||t[5]!==a?(l=()=>{let e=n.current;if(!e)return;let t=!1,l=m(),u=he(),d=s,f=Er,p=()=>{let t=e.querySelectorAll(H);for(let e of Array.from(t))f(e)};if(!d){p();return}let h=e=>{let n=e===void 0?0:e;if(c.current!==null&&typeof window<`u`&&window.clearTimeout(c.current),typeof window>`u`){g();return}c.current=window.setTimeout(()=>{c.current=null,window.requestAnimationFrame(()=>{t||g()})},n)},g=()=>{let n=e.querySelectorAll(`[data-markdown="inline-code"], a, ${pe}`),i=0;for(let a of Array.from(n)){let n=me(a),o=fe(n,r);if(!o){f(a);continue}if(i>=u){f(a);continue}i+=1,(a.getAttribute(`data-openchamber-file-link`)!==`true`||a.getAttribute(`data-openchamber-file-path`)!==o.resolvedPath)&&ge(o.resolvedPath,r).then(n=>{if(t||!e.contains(a))return;let i=me(a),s=fe(i,r);if(!(!s||s.resolvedPath!==o.resolvedPath)){if(!ue(s.resolvedPath,n,l)){f(a);return}a.setAttribute(`data-openchamber-file-link`,`true`),a.setAttribute(`data-openchamber-file-ref`,i),a.setAttribute(`data-openchamber-file-path`,s.resolvedPath),a.setAttribute(`data-openchamber-file-binary`,String(n.isBinary)),a.setAttribute(`title`,_e),a.tagName.toLowerCase()!==`a`&&(a.setAttribute(`role`,`button`),a.setAttribute(`tabindex`,`0`))}})}},_=e=>le(e,{effectiveDirectory:r,editor:i,preferRuntimeEditor:a,onShowPopup:o}),v=e=>{let t=e.target;if(!(t instanceof Element)||t.closest($))return;let n=t.closest(H);n instanceof HTMLElement&&(e.preventDefault(),e.stopPropagation(),_(n))},y=e=>{if(e.key!==`Enter`&&e.key!==` `)return;let t=e.target;!(t instanceof HTMLElement)||t.getAttribute(`data-openchamber-file-link`)!==`true`||(e.preventDefault(),e.stopPropagation(),_(t))};h(ar);let b=new MutationObserver(()=>{h(ar)});return b.observe(e,{childList:!0,subtree:!0}),e.addEventListener(`click`,v),e.addEventListener(`keydown`,y),()=>{t=!0,c.current!==null&&typeof window<`u`&&window.clearTimeout(c.current),c.current=null,b.disconnect(),e.removeEventListener(`click`,v),e.removeEventListener(`keydown`,y)}},u=[n,i,r,o,a,s],t[0]=n,t[1]=i,t[2]=r,t[3]=s,t[4]=o,t[5]=a,t[6]=l,t[7]=u):(l=t[6],u=t[7]),W.useEffect(l,u)},sr=({containerRef:e,onShowPopup:t,enableFullscreen:n,enablePanZoom:r,allowMermaidWheelEvents:i})=>{let a=l(e=>t?.(e)),o=!!t,s=l(t=>{if(!n||!o)return;let r=e.current;if(!r)return;let i=t.target;if(!(i instanceof Element)||i.closest(`button, a, [role="button"]`))return;let s=i.closest(Xt);if(!s)return;if(s instanceof HTMLElement&&s.hasAttribute(`data-mermaid-suppress-click`)){s.removeAttribute(`data-mermaid-suppress-click`);return}let c=Array.from(r.querySelectorAll(Xt)).indexOf(s);if(c<0)return;let l=s instanceof HTMLElement?s.getAttribute(`data-md-source`):null;if(!l||l.trim().length===0)return;let u=`Diagram ${c+1}`;a({open:!0,title:u,content:``,metadata:{tool:`mermaid-preview`,filename:u},mermaid:{url:`data:text/plain;charset=utf-8,${encodeURIComponent(l)}`,source:l,filename:u}})}),c=l(e=>{if(i||r)return;let t=e.target;t instanceof Element&&t.closest(`[data-markdown="mermaid-block"]`)&&e.stopPropagation()});u(`click`,s,e),W.useEffect(()=>{let t=e.current;if(t)return t.addEventListener(`wheel`,c,{capture:!0,passive:!0}),()=>{t.removeEventListener(`wheel`,c,!0)}},[e])},cr=24,lr=1,ur=12,dr=/[\s.,!?;:)\]]/,fr=(e,t)=>{let n=e<=12?2:e<=48?4:e<=96?8:Math.min(24,Math.ceil(e/8));return Math.max(1,Math.round(t/cr*n))},pr=(e,t)=>fr(e,t)*(1e3/t),mr=(e,t,n)=>{let r=Math.min(e.length,t+n);for(let t=r;t<Math.min(e.length,r+8);t+=1)if(dr.test(e[t]??``))return t+1;return r},hr=(e,t,n)=>{let[r,i]=W.useState(()=>t?0:e.length),a=W.useRef(r),o=W.useRef(0),s=W.useRef(null);return a.current=r,W.useEffect(()=>{if(!t||typeof window>`u`){o.current=0,s.current=null,i(e.length);return}a.current>e.length&&(a.current=e.length,o.current=0,i(e.length));let r=null,c=t=>{let l=Math.min(a.current,e.length);if(l>=e.length){r=null,s.current=null;return}let u=s.current;if(u===null){s.current=t,r=window.requestAnimationFrame(c);return}let d=Math.min(t-u,100);s.current=t,o.current+=pr(e.length-l,n)*(d/1e3);let f=Math.min(ur,Math.floor(o.current));if(f>=lr){o.current-=f;let t=mr(e,l,f);a.current=t,i(t)}r=window.requestAnimationFrame(c)};return a.current<e.length&&(r=window.requestAnimationFrame(c)),()=>{r!==null&&window.cancelAnimationFrame(r)}},[e,t,n]),t?e.slice(0,Math.min(r,e.length)):e},gr=new M({maxEntries:100,maxBytes:8388608}),_r=(e,t)=>{let n=gr.get(e);if(n)return n;let r=t(),i=((r.svg?.length??0)+(r.ascii?.length??0))*2;return gr.set(e,r,e.length*2+i),r},vr=e=>({bg:e.colors.surface.elevated,fg:e.colors.surface.foreground,line:e.colors.interactive.border,accent:e.colors.primary.base,muted:e.colors.surface.mutedForeground,surface:e.colors.surface.muted,border:e.colors.interactive.border,transparent:!0,font:`system-ui, sans-serif`}),yr=(e,r,i,a=nr,o=t(),s=``,c=!1)=>{let{t:u}=f(),d=W.useMemo(()=>({copy:u(`markdownRenderer.code.actions.copyTitle`),copied:u(`markdownRenderer.code.actions.copiedTitle`),enableCodeWrap:u(`markdownRenderer.code.actions.enableWrapTitle`),disableCodeWrap:u(`markdownRenderer.code.actions.disableWrapTitle`),copyDiagram:u(`markdownRenderer.mermaid.actions.copySourceTitle`),downloadDiagram:u(`markdownRenderer.mermaid.actions.downloadSvgTitle`),zoomInDiagram:u(`markdownRenderer.mermaid.actions.zoomInTitle`),zoomOutDiagram:u(`markdownRenderer.mermaid.actions.zoomOutTitle`),resetDiagramView:u(`markdownRenderer.mermaid.actions.resetViewTitle`),previewLabel:u(`terminalView.preview.open`),previewTitle:u(`terminalView.preview.openTitle`)}),[u]),p=n(e=>e.codeBlockLineWrap),m=n(e=>e.setCodeBlockLineWrap),h=l(()=>{m(!n.getState().codeBlockLineWrap)});return W.useMemo(()=>{let t=vr(e),l=n.getState().mermaidRenderingMode,u=e.metadata?.id??`theme`;return{labels:d,mermaidControls:a,codeBlockLineWrap:p,deferCodeLineNumberSync:r,onToggleCodeBlockLineWrap:h,renderMermaid:e=>_r(`${u}:${l}:${e}`,()=>{try{return l===`ascii`?{ascii:R(e)}:{svg:L(e,t)}}catch{return{}}}),onPreviewLoopback:i,imageTransportIdentity:o,imageEffectiveDirectory:s,imagePreviewEnabled:c}},[e,d,a,p,r,i,o,s,c])},br=({containerRef:e,text:t,streaming:n,cacheKey:r,syntaxVars:i,ctx:a,reconcileMarkdownImageResources:o,onRichContentReady:s})=>{W.useEffect(()=>{w()},[]);let c=W.useRef(null),u=l(()=>{s?.()}),f=l(()=>{let t=e.current;if(t){if(!c.current){if(!Zt(t))return;c.current=vn(t);return}c.current.refresh()}});W.useLayoutEffect(()=>{let r=e.current,i=r?.querySelector(`[data-markdown-content]`)??r;if(i&&t&&i.childNodes.length===0){for(let e of Mt(t)){let t=document.createElement(`div`);t.setAttribute(`data-md-block`,``),t.style.display=`contents`,t.innerHTML=e,Yn(t,a),i.appendChild(t)}o(i),n||u()}},[e,a,o,n,t]),W.useEffect(()=>()=>{c.current?.cleanup(),c.current=null},[]),W.useEffect(()=>{let i=e.current;if(!i)return;let s=i.querySelector(`[data-markdown-content]`)??i,c=!0,l=new AbortController,d=()=>{},p=()=>{},m=()=>{if(!c||n||l.signal.aborted)return;s.replaceChildren();let e=document.createElement(`div`);e.setAttribute(`data-md-block`,``),e.setAttribute(`data-md-render-fallback`,`text`),e.style.display=`contents`;let r=document.createElement(`span`);r.style.whiteSpace=`pre-wrap`,r.textContent=t,e.appendChild(r),s.appendChild(e),o(s),u()},h=e=>{if(!c)return;let t=Array.from(s.children);e.forEach((e,n)=>{let r=t[n];if(r||(r=document.createElement(`div`),r.setAttribute(`data-md-block`,``),r.style.display=`contents`,s.appendChild(r)),r.getAttribute(`data-md-id`)===e.id)return;let i=document.createElement(`div`);i.innerHTML=e.html,Yn(i,a);let o=Zt(r),c=Zt(i);I(r,i,{childrenOnly:!0,onBeforeElUpdated:(e,t)=>{if(Ee(e,t))return!1;if(de(e,t),e instanceof HTMLImageElement&&t instanceof HTMLImageElement){let n=e.getAttribute(`data-md-image-source`);if(n&&n===t.getAttribute(`data-md-image-source`)){let n=e.getAttribute(`src`);n===null?t.removeAttribute(`src`):t.setAttribute(`src`,n),t.className=e.className;for(let n of[`data-md-image-state`,`data-md-placeholder-source`,`aria-busy`]){let r=e.getAttribute(n);r===null?t.removeAttribute(n):t.setAttribute(n,r)}}}return!e.isEqualNode(t)}}),r.setAttribute(`data-md-id`,e.id),(o||c||Zt(r))&&f()});let n=Zt(s),r=!1;for(let n=t.length-1;n>=e.length;--n){let e=t[n];e&&Zt(e)&&(r=!0),e?.remove()}(r||t.length>e.length&&n)&&f(),o(s),a.deferCodeLineNumberSync||Mn(s,a.codeBlockLineWrap,a.labels),Ae(s,F,{signal:l.signal,priority:`visible`}),u()},g=e=>{try{h(e)}catch{m()}},_=()=>{zt(t,n,r,l.signal).then(e=>{if(c){if(n){g(e);return}p=k(()=>g(e),{priority:`visible`})}}).catch(m)};return n?_():d=k(_,{priority:`visible`}),()=>{c=!1,l.abort(),d(),p()}},[e,t,n,r,a,o]),W.useEffect(()=>{let t=e.current;if(t)return Zn(t,a)},[e,a]),W.useEffect(()=>{let t=e.current,n=t?.querySelector(`[data-markdown-content]`)??t;if(n)for(let[e,t]of Object.entries(i))n.style.setProperty(e,t)},[e,i]),W.useEffect(()=>{let t=e.current,n=t?.querySelector(`[data-markdown-content]`)??t;n&&(a.deferCodeLineNumberSync||Mn(n,a.codeBlockLineWrap,a.labels))},[e,a.codeBlockLineWrap,a.deferCodeLineNumberSync,a.labels]);let p=W.useRef(null),m=l(()=>{let t=e.current,n=t?.querySelector(`[data-markdown-content]`)??t;n&&(p.current!==null&&window.cancelAnimationFrame(p.current),p.current=window.requestAnimationFrame(()=>{p.current=null,An(n)}))});d(e,m),W.useEffect(()=>()=>{p.current!==null&&window.cancelAnimationFrame(p.current)},[])},xr=e=>e===`tool`?`markdown-content markdown-tool`:e===`reasoning`?`markdown-content markdown-reasoning`:`markdown-content leading-relaxed`,Sr=e=>{let t=(0,ve.c)(4),[n,r]=W.useState(e),i=W.useRef(e),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{i.current||(i.current=!0,r(!0))},t[0]=a):a=t[0];let o=l(a),s;return t[1]!==o||t[2]!==n?(s=[n,o],t[1]=o,t[2]=n,t[3]=s):s=t[3],s},Cr=(e,t,n)=>{let r=W.useRef(n);r.current=n;let i=W.useRef(t);i.current=t;let a=l(e=>{if(!r.current)return;let t=e[0];if(!t)return;let n=t.borderBoxSize?.[0],a=n?n.blockSize:t.contentRect.height,o=n?n.inlineSize:t.contentRect.width;N(i.current,a,o)});d(e,a)},wr=W.memo(e=>{let t=(0,ve.c)(52),{content:r,part:i,messageId:a,isAnimated:s,skipFadeIn:c,className:u,isStreaming:d,disableStreamAnimation:f,variant:p,onShowPopup:m,enableFileReferences:g}=e,_=s===void 0||s,v=c!==void 0&&c,y=d!==void 0&&d,x=f!==void 0&&f,S=p===void 0?`assistant`:p,C=g===void 0||g,w=Qn(),{editor:T,runtime:E}=ee(),D=W.useRef(null),O=te()??``,ne=n(Dr),k;t[0]!==O||t[1]!==ne?(k=e=>{O&&ne(O,e)},t[0]=O,t[1]=ne,t[2]=k):k=t[2];let re=l(k),A=y&&!x,j;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(j=ae(o()),t[3]=j):j=t[3];let M=hr(r,A,j.markdownPaceMs),[N,P]=Sr(A),F;t[4]===m?F=t[5]:(F={containerRef:D,onShowPopup:m,enableFullscreen:rr,enablePanZoom:nr.showPanZoomControls},t[4]=m,t[5]=F),sr(F);let ce=C&&!y,I;t[6]!==T||t[7]!==O||t[8]!==m||t[9]!==E.isVSCode||t[10]!==ce?(I={containerRef:D,effectiveDirectory:O,editor:T,preferRuntimeEditor:E.isVSCode,onShowPopup:m,enabled:ce},t[6]=T,t[7]=O,t[8]=m,t[9]=E.isVSCode,t[10]=ce,t[11]=I):I=t[11],or(I);let L;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(L={containerRef:D},t[12]=L):L=t[12],$n(L);let R;t[13]!==O||t[14]!==m?(R={containerRef:D,effectiveDirectory:O,onShowPopup:m},t[13]=O,t[14]=m,t[15]=R):R=t[15];let{reconcileMarkdownImageResources:z,transportIdentity:B}=tr(R),V;t[16]===w?V=t[17]:(V=b(w),t[16]=w,t[17]=V);let le=V,ue=yr(w,A,O?re:void 0,nr,B,O,!!m),H=`markdown-${i?.id?`part-${i.id}`:`message-${a}`}`,de;t[18]!==H||t[19]!==ue||t[20]!==A||t[21]!==M||t[22]!==z||t[23]!==P||t[24]!==le?(de={containerRef:D,text:M,streaming:A,cacheKey:H,syntaxVars:le,ctx:ue,reconcileMarkdownImageResources:z,onRichContentReady:P},t[18]=H,t[19]=ue,t[20]=A,t[21]=M,t[22]=z,t[23]=P,t[24]=le,t[25]=de):de=t[25],br(de);let fe;t[26]!==r||t[27]!==S?(fe=se(r,S),t[26]=r,t[27]=S,t[28]=fe):fe=t[28],Cr(D,fe,N&&!A);let pe=!N||void 0,U;t[29]===u?U=t[30]:(U=h(`relative break-words w-full min-w-0`,u),t[29]=u,t[30]=U);let me=N?`true`:`false`,he=N?`ready`:`pending`,ge;t[31]!==M||t[32]!==N||t[33]!==S?(ge=!N&&(0,Q.jsx)(`div`,{className:h(xr(S),`pointer-events-none absolute inset-0 overflow-hidden`),children:(0,Q.jsx)(oe,{content:M})}),t[31]=M,t[32]=N,t[33]=S,t[34]=ge):ge=t[34];let _e=!N||void 0,G;t[35]!==N||t[36]!==S?(G=h(xr(S),!N&&`invisible`),t[35]=N,t[36]=S,t[37]=G):G=t[37];let K;t[38]!==_e||t[39]!==G?(K=(0,Q.jsx)(`div`,{"aria-hidden":_e,className:G,"data-markdown-content":!0}),t[38]=_e,t[39]=G,t[40]=K):K=t[40];let ye;t[41]!==pe||t[42]!==U||t[43]!==me||t[44]!==he||t[45]!==ge||t[46]!==K?(ye=(0,Q.jsxs)(`div`,{"aria-busy":pe,className:U,"data-markdown-ready":me,"data-markdown-hydration":he,ref:D,children:[ge,K]}),t[41]=pe,t[42]=U,t[43]=me,t[44]=he,t[45]=ge,t[46]=K,t[47]=ye):ye=t[47];let be=ye;if(_){let e;return t[48]!==H||t[49]!==be||t[50]!==v?(e=(0,Q.jsx)(ie,{skipAnimation:v,children:be},H),t[48]=H,t[49]=be,t[50]=v,t[51]=e):e=t[51],e}return be},(e,t)=>e.content===t.content&&e.isStreaming===t.isStreaming&&e.disableStreamAnimation===t.disableStreamAnimation&&e.variant===t.variant&&e.isAnimated===t.isAnimated&&e.skipFadeIn===t.skipFadeIn&&e.className===t.className&&e.messageId===t.messageId&&e.onShowPopup===t.onShowPopup&&e.enableFileReferences===t.enableFileReferences&&e.part?.id===t.part?.id),Tr=W.memo(e=>{let t=(0,ve.c)(46),{content:n,className:r,variant:i,disableLinkSafety:a,stripFrontmatter:o,onShowPopup:s,mermaidControls:c,allowMermaidWheelEvents:l,enableFileReferences:u}=e,d=i===void 0?`assistant`:i,f=o!==void 0&&o,p=c===void 0?nr:c,m=l!==void 0&&l,g=u===void 0||u,{editor:_,runtime:v}=ee(),y=Qn(),x=W.useRef(null),[S,C]=Sr(!1),w=te()??``,T;t[0]!==n||t[1]!==f?(T=f?ir(n):n,t[0]=n,t[1]=f,t[2]=T):T=t[2];let E=T,D;t[3]!==m||t[4]!==p.showPanZoomControls||t[5]!==s?(D={containerRef:x,onShowPopup:s,enableFullscreen:rr,enablePanZoom:p.showPanZoomControls,allowMermaidWheelEvents:m},t[3]=m,t[4]=p.showPanZoomControls,t[5]=s,t[6]=D):D=t[6],sr(D);let O;t[7]!==_||t[8]!==w||t[9]!==g||t[10]!==s||t[11]!==v.isVSCode?(O={containerRef:x,effectiveDirectory:w,editor:_,preferRuntimeEditor:v.isVSCode,onShowPopup:s,enabled:g},t[7]=_,t[8]=w,t[9]=g,t[10]=s,t[11]=v.isVSCode,t[12]=O):O=t[12],or(O);let ne=!a,k;t[13]===ne?k=t[14]:(k={containerRef:x,enabled:ne},t[13]=ne,t[14]=k),$n(k);let re;t[15]!==w||t[16]!==s?(re={containerRef:x,effectiveDirectory:w,onShowPopup:s},t[15]=w,t[16]=s,t[17]=re):re=t[17];let{reconcileMarkdownImageResources:ie,transportIdentity:A}=tr(re),ae;t[18]===y?ae=t[19]:(ae=b(y),t[18]=y,t[19]=ae);let j=ae,M=yr(y,!1,void 0,p,A,w,!!s),N=`simple:${d}`,se;t[20]!==M||t[21]!==ie||t[22]!==E||t[23]!==C||t[24]!==j||t[25]!==N?(se={containerRef:x,text:E,streaming:!1,cacheKey:N,syntaxVars:j,ctx:M,reconcileMarkdownImageResources:ie,onRichContentReady:C},t[20]=M,t[21]=ie,t[22]=E,t[23]=C,t[24]=j,t[25]=N,t[26]=se):se=t[26],br(se);let P=!S||void 0,F;t[27]===r?F=t[28]:(F=h(`relative break-words w-full min-w-0`,r),t[27]=r,t[28]=F);let ce=S?`true`:`false`,I=S?`ready`:`pending`,L;t[29]!==E||t[30]!==S||t[31]!==d?(L=!S&&(0,Q.jsx)(`div`,{className:h(xr(d),`pointer-events-none absolute inset-0 overflow-hidden`),children:(0,Q.jsx)(oe,{content:E})}),t[29]=E,t[30]=S,t[31]=d,t[32]=L):L=t[32];let R=!S||void 0,z;t[33]!==S||t[34]!==d?(z=h(xr(d),!S&&`invisible`),t[33]=S,t[34]=d,t[35]=z):z=t[35];let B;t[36]!==R||t[37]!==z?(B=(0,Q.jsx)(`div`,{"aria-hidden":R,className:z,"data-markdown-content":!0}),t[36]=R,t[37]=z,t[38]=B):B=t[38];let V;return t[39]!==P||t[40]!==F||t[41]!==ce||t[42]!==I||t[43]!==L||t[44]!==B?(V=(0,Q.jsxs)(`div`,{"aria-busy":P,className:F,"data-markdown-ready":ce,"data-markdown-hydration":I,ref:x,children:[L,B]}),t[39]=P,t[40]=F,t[41]=ce,t[42]=I,t[43]=L,t[44]=B,t[45]=V):V=t[45],V},(e,t)=>{let n=e.mermaidControls??nr,r=t.mermaidControls??nr;return e.content===t.content&&e.variant===t.variant&&e.className===t.className&&e.disableLinkSafety===t.disableLinkSafety&&e.stripFrontmatter===t.stripFrontmatter&&e.onShowPopup===t.onShowPopup&&n.download===r.download&&n.copy===r.copy&&n.showPanZoomControls===r.showPanZoomControls&&e.allowMermaidWheelEvents===t.allowMermaidWheelEvents&&e.enableFileReferences===t.enableFileReferences});function Er(e){e.removeAttribute(`data-openchamber-file-link`),e.removeAttribute(`data-openchamber-file-ref`),e.removeAttribute(`data-openchamber-file-path`),e.removeAttribute(`data-openchamber-file-binary`),e.getAttribute(`title`)===`Open file`&&e.removeAttribute(`title`),e.tagName.toLowerCase()!==`a`&&(e.removeAttribute(`role`),e.removeAttribute(`tabindex`))}function Dr(e){return e.openContextPreview}export{wr as MarkdownRenderer,Tr as SimpleMarkdownRenderer};
@@ -1 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{nt as t,rt as n}from"./vendor-base-ui-CnHfUmDN.js";import{n as r}from"./vendor-react-DLPElpoQ.js";import{a as i,i as a,n as o,r as s,t as c}from"./vendor-markstream-react-C3K8YH0d.js";import{n as l,r as u,u as d}from"./vendor-reactuses-core-DDoDDyM9.js";import{Oi as f}from"./useMobileNavigationStore-wmyBBtul.js";import{t as p}from"./utils-BiK3tBGM.js";import{t as m}from"./useThemeSystem-DMzWVJaW.js";import{n as h}from"./useRuntimeAPIs-DSLXJybW.js";import{a as g,r as _}from"./url-Pk6tQ1EZ.js";import{n as v}from"./useEffectiveDirectory-jX6SNwiF.js";import{r as y,t as b}from"./markdownHeightCache-CvUyZT4q.js";import{a as x,c as S,d as C,h as w,i as T,o as E,p as D,r as O,s as k,t as A}from"./fileReferenceActions-BJJtX_S5.js";var j=e(n(),1),M=`img:not([data-md-link-favicon="true"])`,N=e=>e.getAttribute(`data-md-image-source`)??e.getAttribute(`src`)??``,P=(e,t)=>{if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;let n=e.target;if(!(n instanceof Element))return;let r=n.closest(M);if(r instanceof HTMLImageElement&&t.onShowPopup){let n=e.currentTarget;if(!(n instanceof HTMLElement))return;let i=Array.from(n.querySelectorAll(M)).map(e=>({url:N(e),filename:e.alt||N(e)||void 0})).filter(e=>e.url),a=N(r),o=i.findIndex(e=>e.url===a);if(!a)return;e.preventDefault(),e.stopPropagation(),t.onShowPopup({open:!0,title:r.alt||a,content:``,image:{url:a,filename:r.alt||a,gallery:i,index:o>=0?o:0}});return}if(t.fileReference){let r=n.closest(C);if(r instanceof HTMLElement){e.preventDefault(),e.stopPropagation(),x(r,t.fileReference);return}}let i=n.closest(`a[href]`);if(!(i instanceof HTMLAnchorElement))return;let a=i.getAttribute(`href`)??``;_(a)&&(e.preventDefault(),e.stopPropagation(),g(a))},F=(e,t)=>{if(e.key!==`Enter`&&e.key!==` `||!t.fileReference)return;let n=e.target;if(!(n instanceof Element))return;let r=n.closest(C);!(r instanceof HTMLElement)||r.getAttribute(`data-openchamber-file-link`)!==`true`||(e.preventDefault(),e.stopPropagation(),x(r,t.fileReference))},I=r(),L=(e,t)=>{let n=t>=2?e.slice(t-2,t):``;return(t>=1?e.charAt(t-1):``)===`:`||n===`:/`},R=e=>{if(!e.includes(`/`)||!e.includes(`.`))return[{kind:`text`,value:e}];w.lastIndex=0;let t=[],n=0,r=w.exec(e);for(;r;){let i=r[0];if(!i||L(e,r.index)||!D(i)){r=w.exec(e);continue}r.index>n&&t.push({kind:`text`,value:e.slice(n,r.index)}),t.push({kind:`path`,value:i}),n=r.index+i.length,r=w.exec(e)}return n===0?[{kind:`text`,value:e}]:(n<e.length&&t.push({kind:`text`,value:e.slice(n)}),t)},z=t(),B=j.createContext({enabled:!1,insideLink:!1,isMobileSurface:!1,effectiveDirectory:``,preferRuntimeEditor:!1,slots:{used:0,limit:0}}),V=!1;V||(V=!0,i({text:W,inline_code:G,link:K}));var H=e=>{let t=(0,I.c)(11),{enabled:n,effectiveDirectory:r,editor:i,preferRuntimeEditor:a,onShowPopup:o,content:s,children:c}=e,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=f(),t[0]=l):l=t[0];let u;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(u={used:0,limit:O()},t[1]=u):u=t[1];let d;t[2]!==i||t[3]!==r||t[4]!==n||t[5]!==o||t[6]!==a?(d={enabled:n,insideLink:!1,isMobileSurface:l,effectiveDirectory:r,editor:i,preferRuntimeEditor:a,onShowPopup:o,slots:u},t[2]=i,t[3]=r,t[4]=n,t[5]=o,t[6]=a,t[7]=d):d=t[7];let p=d,m;return t[8]!==c||t[9]!==p?(m=(0,z.jsx)(B.Provider,{value:p,children:c}),t[8]=c,t[9]=p,t[10]=m):m=t[10],m},U=({raw:e,children:t})=>{let n=j.useContext(B),r=T(e,n.effectiveDirectory),i=j.useRef(!1);n.enabled&&r&&!i.current&&n.slots.used<n.slots.limit&&(n.slots.used+=1,i.current=!0);let[a,o]=j.useState(r?E(r.resolvedPath)??null:null),s=r?.resolvedPath;if(j.useEffect(()=>{if(!n.enabled||!s||!i.current)return;let e=!1;return k(s,n.effectiveDirectory).then(t=>{e||o(t)}),()=>{e=!0}},[n.enabled,n.effectiveDirectory,s]),!r)return t??e;let c=!!(i.current&&a&&S(r.resolvedPath,a,n.isMobileSurface));return(0,z.jsx)(`span`,{"data-openchamber-block-path-token":`true`,...c?{"data-openchamber-file-link":`true`,"data-openchamber-file-ref":e,"data-openchamber-file-path":r.resolvedPath,"data-openchamber-file-binary":String(a?.isBinary===!0),title:A,...t?{}:{role:`button`,tabIndex:0}}:{},children:t??e})};function W(e){let t=(0,I.c)(12),n=j.useContext(B),r=e.node.content??``;if(!n.enabled||n.insideLink){let n;return t[0]===e?n=t[1]:(n=(0,z.jsx)(s,{...e}),t[0]=e,t[1]=n),n}let i,a;if(t[2]!==r||t[3]!==e){a=Symbol.for(`react.early_return_sentinel`);bb0:{let n=R(r);if(n.length===1&&n[0]?.kind!==`path`){let n;t[6]===e?n=t[7]:(n=(0,z.jsx)(s,{...e}),t[6]=e,t[7]=n),a=n;break bb0}let o;t[8]===e?o=t[9]:(o=(t,n)=>t.kind===`path`?(0,z.jsx)(U,{raw:t.value},`path-${n}-${t.value}`):(0,z.jsx)(s,{...e,node:{...e.node,content:t.value}},`text-${n}`),t[8]=e,t[9]=o),i=n.map(o)}t[2]=r,t[3]=e,t[4]=i,t[5]=a}else i=t[4],a=t[5];if(a!==Symbol.for(`react.early_return_sentinel`))return a;let o;return t[10]===i?o=t[11]:(o=(0,z.jsx)(z.Fragment,{children:i}),t[10]=i,t[11]=o),o}function G(e){let t=(0,I.c)(7),n=j.useContext(B),r=e.node.code??``;if(!n.enabled||!D(r)){let n;return t[0]===e?n=t[1]:(n=(0,z.jsx)(a,{...e}),t[0]=e,t[1]=n),n}let i;t[2]===r?i=t[3]:(i=(0,z.jsx)(U,{raw:r}),t[2]=r,t[3]=i);let o;return t[4]!==e||t[5]!==i?(o=(0,z.jsx)(a,{...e,children:i}),t[4]=e,t[5]=i,t[6]=o):o=t[6],o}function K(e){let t=(0,I.c)(12),n=j.useContext(B),r=e.node.href??``,i;t[0]!==n.enabled||t[1]!==r?(i=n.enabled&&D(r),t[0]=n.enabled,t[1]=r,t[2]=i):i=t[2];let a=i,s;t[3]===n?s=t[4]:(s={...n,insideLink:!0},t[3]=n,t[4]=s);let c;t[5]!==a||t[6]!==r||t[7]!==e?(c=a?(0,z.jsx)(U,{raw:r,children:(0,z.jsx)(o,{...e})}):(0,z.jsx)(o,{...e}),t[5]=a,t[6]=r,t[7]=e,t[8]=c):c=t[8];let l;return t[9]!==s||t[10]!==c?(l=(0,z.jsx)(B.Provider,{value:s,children:c}),t[9]=s,t[10]=c,t[11]=l):l=t[11],l}var q={maxLiveNodes:0,liveNodeBuffer:0,batchRendering:!1,deferNodesUntilVisible:!1,viewportPriority:!1,smoothStreaming:!1,typewriter:!1,fade:!1},J=e=>e===`tool`?`markdown-content markdown-tool oc-markstream-host`:e===`reasoning`?`markdown-content markdown-reasoning oc-markstream-host`:`markdown-content leading-relaxed oc-markstream-host`,Y={overflow:`wrap`},X=j.memo(({content:e,part:t,messageId:n,className:r,isStreaming:i=!1,variant:a=`assistant`,onShowPopup:o,enableFileReferences:s=!0})=>{let f=m()?.currentTheme.metadata.variant===`dark`,{editor:g,runtime:_}=h(),x=v()??``,S=j.useRef(null),C=t?.id?`oc-ms-${t.id}`:`oc-ms-${n}`,w=b(e,`markstream:${a}`),T=!i,E=s&&!i,D=E?{effectiveDirectory:x,editor:g,preferRuntimeEditor:_.isVSCode,onShowPopup:o}:void 0,O=j.useRef(T);O.current=T;let k=j.useRef(w);k.current=w;let A=l(e=>{if(!O.current)return;let t=e[0];if(!t)return;let n=t.borderBoxSize?.[0],r=n?n.blockSize:t.contentRect.height,i=n?n.inlineSize:t.contentRect.width;y(k.current,r,i)});d(S,A);let M=l(e=>{P(e,{onShowPopup:o,fileReference:D})}),N=l(e=>{F(e,{fileReference:D})});return u(`click`,M,S),u(`keydown`,N,S),(0,z.jsx)(`div`,{ref:S,className:p(`relative break-words w-full min-w-0`,J(a),r),"data-markdown-ready":`true`,"data-markdown-hydration":`ready`,"data-oc-markdown-engine":`markstream`,"data-oc-markstream-virtual":`off`,children:(0,z.jsx)(H,{enabled:E,effectiveDirectory:x,editor:g,preferRuntimeEditor:_.isVSCode,onShowPopup:o,content:e,children:(0,z.jsx)(c,{content:e,customId:C,final:!i,isDark:f,codeBlockOptions:Y,codeBlockStream:i,...q})})})},(e,t)=>e.content===t.content&&e.isStreaming===t.isStreaming&&e.disableStreamAnimation===t.disableStreamAnimation&&e.variant===t.variant&&e.isAnimated===t.isAnimated&&e.skipFadeIn===t.skipFadeIn&&e.className===t.className&&e.messageId===t.messageId&&e.onShowPopup===t.onShowPopup&&e.enableFileReferences===t.enableFileReferences&&e.part?.id===t.part?.id);export{X as MarkstreamRenderer};
@@ -1 +0,0 @@
1
- import{t as e}from"./useUIStore-CuaA8-Hp.js";import{$t as t,Jt as n,Xt as r,Yt as i,in as a,kn as o}from"./persistence-DdUac14I.js";import{o as s,r as c,s as l}from"./toolHelpers-DEvVP9U0.js";import{a as u,i as d,o as f,r as p,t as ee}from"./path-utils-jGozTg9d.js";import{t as m}from"./outsideFileGrants-DnplRxr-.js";var h=new Set([`dockerfile`,`makefile`,`readme`,`license`,`.env`,`.gitignore`,`.npmrc`]),g=Array.from(h).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),_=e=>u(e),v=e=>p(e),y=e=>{if(!e||e.startsWith(`--`)||e.includes(`://`)||/[<>]/.test(e)||/\s{2,}/.test(e))return!1;let t=_(e),n=t.split(`/`).filter(Boolean).pop()??t;if(!n||n===`.`||n===`..`)return!1;let r=n.toLowerCase();return h.has(r)||r.startsWith(`.`)&&r.length>1?!0:!t.includes(`/`)&&/^\d+\.\d+$/.test(n)?!1:/\.[A-Za-z0-9_-]{1,16}$/.test(n)},b=e=>{let t=(e||``).trim();return t?((t.startsWith("`")&&t.endsWith("`")||t.startsWith(`"`)&&t.endsWith(`"`)||t.startsWith(`'`)&&t.endsWith(`'`))&&(t=t.slice(1,-1).trim()),t=t.replace(/[.,;!?]+$/g,``),t.endsWith(`)`)&&!t.includes(`(`)&&(t=t.slice(0,-1)),t.endsWith(`]`)&&!t.includes(`[`)&&(t=t.slice(0,-1)),t):``},x=e=>{let t=b(e);if(!t)return``;let n=t.indexOf(`;`);n>=0&&(t=t.slice(0,n)),t=t.replace(/#.*$/,``);let r=t.match(/^(.*\.[A-Za-z0-9_-]{1,16}):.*$/);r&&(t=r[1]??t);let i=g.length>0?t.match(RegExp(`^(.*(?:/|^)(${g})):.*$`,`i`)):null;return i&&(t=i[1]??t),b(t)},S=e=>{let t=b(e);if(!t)return null;let n=t.indexOf(`;`),r=n>=0?b(t.slice(0,n)):t;if(!r)return null;let i=r.match(/^(.*?):(\d+)-(\d+)$/);if(i){let e=x(i[1]??``),t=Number.parseInt(i[2]??``,10),n=Number.parseInt(i[3]??``,10);return!e||!Number.isFinite(t)||!Number.isFinite(n)||n<t?null:{path:e,line:t,endLine:n}}let a=r.match(/^(.*)#L(\d+)(?:C(\d+))?$/i);if(a){let e=x(a[1]??``),t=Number.parseInt(a[2]??``,10),n=a[3]?Number.parseInt(a[3],10):void 0;return!e||!Number.isFinite(t)?null:{path:e,line:t,column:Number.isFinite(n??NaN)?n:void 0}}let o=r.match(/^(.*?):(\d+)(?::(\d+))?$/);if(o){let e=x(o[1]??``),t=Number.parseInt(o[2]??``,10),n=o[3]?Number.parseInt(o[3],10):void 0;return!e||!Number.isFinite(t)?null:{path:e,line:t,column:Number.isFinite(n??NaN)?n:void 0}}let s=x(r);return s?{path:s}:null},C=/(?:[A-Za-z]:[\\/])?[\w.\-/@+]*[\w\-/@+]\.[A-Za-z0-9]{1,8}(?::\d+(?:-\d+)?(?::\d+)?)?/g,w=`(?:(?:[0-9][\\w.@+\\- 一-鿿]*|[一-鿿][\\w.@+\\- 一-鿿]*)|[\\w.@+\\-一-鿿]+)`,T=RegExp(`(?:[A-Za-z]:[\\\\/]|\\.{1,2}\\/|\\/)?(?:${w}\\/)+${w}\\.[A-Za-z0-9]{1,8}(?::\\d+(?:-\\d+)?(?::\\d+)?)?`,`g`),E=`data-openchamber-block-path-token`,D=`[${E}]`,O=`data-openchamber-file-link`,k=`[${O}="true"]`,A=[O,`data-openchamber-file-ref`,`data-openchamber-file-path`,`data-openchamber-file-binary`,`title`,`role`,`tabindex`],j=`data-openchamber-block-paths-scanned`,M=`data-openchamber-paragraph-paths-scanned`,N=`pre, code, a, script, style, button, [${O}], ${D}`,P=2e5,F=e=>{let t=S(e);return t?y(t.path):!1},I=(e,t)=>{let n=0;for(let r of e){let e=n+r.data.length;if(t<=e)return{node:r,offset:Math.max(0,t-n)};n=e}let r=e.at(-1);return r?{node:r,offset:r.data.length}:null},L=e=>{let t=e.querySelectorAll(`pre code`);if(t.length===0)return;let n=e.ownerDocument;if(n)for(let e of Array.from(t)){if(e.getAttribute(j)===`true`)continue;if((e.textContent??``).length>P){e.setAttribute(j,`true`);continue}let t=n.createTreeWalker(e,NodeFilter.SHOW_TEXT),r=[],i=t.nextNode();for(;i;)r.push(i),i=t.nextNode();let a=e.textContent??``;if(!a.includes(`.`)){e.setAttribute(j,`true`);continue}C.lastIndex=0;let o=[],s=C.exec(a);for(;s;){let e=s[0];e&&F(e)&&o.push({start:s.index,end:s.index+e.length,raw:e}),s=C.exec(a)}for(let{start:e,end:t,raw:i}of o.reverse()){let a=I(r,e),o=I(r,t);if(!a||!o)continue;let s=n.createRange();s.setStart(a.node,a.offset),s.setEnd(o.node,o.offset);let c=n.createElement(`span`);c.setAttribute(E,`true`),c.textContent=i,s.deleteContents(),s.insertNode(c)}e.setAttribute(j,`true`)}},te=e=>{let t=e.ownerDocument;if(!t)return;let n=e.querySelectorAll(`p, li, blockquote, h1, h2, h3, h4, h5, h6, td, th`);if(n.length!==0)for(let e of Array.from(n)){if(e.getAttribute(M)===`true`)continue;if(e.closest(N)){e.setAttribute(M,`true`);continue}let n=t.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode:e=>{let t=e.parentElement;return!t||t.closest(N)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),r=[],i=n.nextNode();for(;i;)r.push(i),i=n.nextNode();if(r.length===0){e.setAttribute(M,`true`);continue}let a=r.map(e=>e.data).join(``);if(!a.includes(`/`)||!a.includes(`.`)){e.setAttribute(M,`true`);continue}T.lastIndex=0;let o=[],s=T.exec(a);for(;s;){let e=s[0];if(!e){s=T.exec(a);continue}let t=s.index>=2?a.slice(s.index-2,s.index):``;if((s.index>=1?a.charAt(s.index-1):``)===`:`||t===`:/`){s=T.exec(a);continue}F(e)&&o.push({start:s.index,end:s.index+e.length,raw:e}),s=T.exec(a)}for(let{start:e,end:n,raw:i}of o.reverse()){let a=I(r,e),o=I(r,n);if(!a||!o)continue;let s=t.createRange();s.setStart(a.node,a.offset),s.setEnd(o.node,o.offset);let c=t.createElement(`span`);c.setAttribute(E,`true`),c.textContent=i,s.deleteContents(),s.insertNode(c)}e.setAttribute(M,`true`)}},ne=e=>{L(e),te(e)},re=(e,t)=>{if(e.getAttribute(`data-openchamber-file-link`)!==`true`)return;let n=(e.getAttribute(`data-openchamber-file-ref`)||e.textContent||``).trim(),r=(t.textContent||``).trim();if(!(!n||n!==r))for(let n of A){let r=e.getAttribute(n);r===null?t.removeAttribute(n):t.setAttribute(n,r)}},R=`Open file`,z=4,B=1e3,V=200,H=80,U=40,W=new Map,G=new Map,K=0,q=[],J=()=>t()?V:B,Y=()=>t()?U:H,X=(e,t)=>{G.set(e,t)},ie=()=>{let e=W.keys().next().value;typeof e==`string`&&(W.delete(e),G.delete(e))},Z=(e,t)=>{let n=J();for(;W.size>=n;)ie();W.set(e,t)},ae=e=>{let t=_(e);if(t)return G.get(t)},Q=e=>{if(e.tagName.toLowerCase()===`a`){let t=e.getAttribute(`href`)?.trim();if(t&&F(t))return t}return(e.textContent||``).trim()},$=(e,t)=>{let n=S(e);if(!n||!y(n.path))return null;let r=v(n.path)?_(n.path):f(t,n.path);return r?{...n,resolvedPath:r}:null},oe=e=>{let t=_(e);if(!t)return Promise.resolve({exists:!1,isBinary:!1});let n=W.get(t);if(n)return W.delete(t),W.set(t,n),n;let r=new Promise(e=>{let n=()=>{K+=1,o(`/api/fs/stat?path=${encodeURIComponent(t)}&optional=true`,{method:`GET`,cache:`no-store`}).then(async n=>{if(!n.ok){let n={exists:!1,isBinary:!1};X(t,n),e(n);return}let r=await n.json().catch(()=>null),i={exists:r?.exists!==!1,isBinary:r?.isBinary===!0};X(t,i),e(i)}).catch(()=>{let n={exists:!1,isBinary:!1};X(t,n),e(n)}).finally(()=>{K=Math.max(0,K-1),q.shift()?.()})};if(K<z){n();return}q.push(n)});return Z(t,r),r},se=(e,t)=>{if(!(r()&&i()&&!d(e,t)))return oe(e);let a=_(e);if(!a)return Promise.resolve({exists:!1,isBinary:!1});let o=W.get(a);if(o)return W.delete(a),W.set(a,o),o;let s=n(e).then(e=>{let t={exists:!0,isBinary:e===!0};return X(a,t),t});return Z(a,s),s},ce=(e,t,n)=>!(!t.exists||n&&t.isBinary&&!l(e)&&!s(e)),le=(e,t)=>e||ee(e,t),ue=async(t,n,r)=>{let i=$(t,r.effectiveDirectory);if(!i)return;let o=i.resolvedPath.toLowerCase().endsWith(`.app`);if((n||o)&&!l(i.resolvedPath)&&!s(i.resolvedPath)&&await a(i.resolvedPath))return;if(l(i.resolvedPath)&&r.onShowPopup){let e=i.resolvedPath.split(`/`).filter(Boolean).pop()??i.resolvedPath;r.onShowPopup({open:!0,title:e,content:``,metadata:{tool:`image-preview`,filename:e,mime:c(i.resolvedPath)},image:{url:i.resolvedPath,filename:e,mimeType:c(i.resolvedPath)}});return}let u=le(r.effectiveDirectory,i.resolvedPath),f=s(i.resolvedPath);if(r.preferRuntimeEditor&&r.editor&&!f){r.editor.openFile(i.resolvedPath,Number.isFinite(i.line??NaN)?Math.max(1,Math.trunc(i.line)):void 0,Number.isFinite(i.column??NaN)?Math.max(1,Math.trunc(i.column)):void 0);return}d(i.resolvedPath,r.effectiveDirectory)||await m(i.resolvedPath,r.effectiveDirectory);let p=e.getState();if(f){p.openContextFile(u,i.resolvedPath,{viewerMode:`preview`});return}if(Number.isFinite(i.line??NaN)){p.openContextFileAtLine(u,i.resolvedPath,Math.max(1,Math.trunc(i.line)),Number.isFinite(i.column??NaN)?Math.max(1,Math.trunc(i.column)):1);return}p.openContextFile(u,i.resolvedPath)},de=async(e,t)=>{await ue(e.getAttribute(`data-openchamber-file-ref`)||Q(e),e.getAttribute(`data-openchamber-file-binary`)===`true`,t)};export{de as a,ce as c,k as d,re as f,T as h,$ as i,D as l,ne as m,Q as n,ae as o,F as p,Y as r,se as s,R as t,O as u};
@@ -1 +0,0 @@
1
- import{i as e}from"./markdownHeightCache-CvUyZT4q.js";var t=`/assets/markdown-shiki.worker-woF2hOAN.js`,n=class{#e;#t;#n=new Map;constructor(t){this.#e=new e({maxEntries:t.maxEntries,maxBytes:t.maxBytes}),this.#t=t.weigh}get size(){return this.#e.size}get inFlightSize(){return this.#n.size}peek(e){return this.#e.get(e)}run(e,t,n){let r=this.#e.get(e);if(r!==void 0)return Promise.resolve(r);if(n?.aborted)return Promise.resolve(null);let i=this.#n.get(e)??this.#r(e,t);return i.waiters+=1,this.#i(e,i,n)}clear(){this.#e.clear()}#r(e,t){let n=new AbortController,r={controller:n,waiters:0,promise:Promise.resolve(null)},i=t=>(this.#n.get(e)===r&&this.#n.delete(e),t!==null&&this.#e.set(e,t,this.#t(t)+e.length*2),t);return r.promise=t(n.signal).then(i,()=>i(null)),this.#n.set(e,r),r}#i(e,t,n){return new Promise(r=>{let i=!1,a=e=>{i||(i=!0,n?.removeEventListener(`abort`,o),r(e))},o=()=>{i||(--t.waiters,t.waiters<=0&&this.#n.get(e)===t&&(this.#n.delete(e),t.controller.abort()),a(null))};n?.addEventListener(`abort`,o,{once:!0}),t.promise.then(a,()=>a(null))})}},r=`\0`,i=(e,t)=>`${e}${r}${t}`,a=(e,t,n)=>`${e}${r}${t}${r}${n}`,o=e=>e.length*2,s=e=>{let t=e.length*8;for(let n of e)t+=n.length*2;return t},c=e=>{let t=e.length*8;for(let n of e){t+=n.length*32;for(let e of n)t+=e[1].length*2}return t},l,u=0,d=new Map,f=new Set,p=(e,t)=>{let n=d.get(e);n&&(d.delete(e),n.signal&&n.onAbort&&n.signal.removeEventListener(`abort`,n.onAbort),n.resolve(t))},m=()=>{for(let e of Array.from(d.keys()))p(e,null);f.clear(),l?.terminate(),l=void 0},h=()=>{if(l)return l;if(!(typeof window>`u`||typeof Worker>`u`)){try{l=new Worker(t,{type:`module`})}catch(e){console.error(`Failed to create Shiki worker:`,e);return}return l.onmessage=e=>{p(e.data.id,e.data)},l.onerror=m,l.onmessageerror=m,l.postMessage({type:`init`}),l}},g=(e,t)=>{if(t?.signal?.aborted)return Promise.resolve(null);let n=h();if(!n)return Promise.resolve(null);let r=++u,i=t?.priority??`visible`;return new Promise(a=>{let o=t?.signal,s=()=>{if(d.has(r)){p(r,null);try{n.postMessage({type:`cancel`,id:r})}catch{}}};if(d.set(r,{resolve:a,signal:o,onAbort:s}),o?.addEventListener(`abort`,s,{once:!0}),o?.aborted){s();return}try{n.postMessage(e(r,i))}catch{p(r,null)}})},_=new n({maxEntries:192,maxBytes:12582912,weigh:o}),v=new n({maxEntries:96,maxBytes:8388608,weigh:s}),y=new n({maxEntries:96,maxBytes:8388608,weigh:c}),b=(e,t,n)=>_.run(i(t,e),async r=>{let i=await g((n,r)=>({type:`highlight`,id:n,code:e,lang:t,priority:r}),{...n,signal:r});return i?.type===`highlight`?i.html:null},n?.signal),x=(e,t,n)=>v.run(i(t,e),async r=>{let i=await g((n,r)=>({type:`highlightLines`,id:n,code:e,lang:t,priority:r}),{...n,signal:r});return i?.type===`highlightLines`?i.lines:null},n?.signal),S=new n({maxEntries:64,maxBytes:8388608,weigh:e=>e.reduce((e,t)=>e+(t.id.length+t.html.length)*2,0)}),C=(e,t,n,r)=>`${+!!t}:${+!!n}:${r}:${e}`,w=e=>{let t=e.blocks&&e.blocks.length>0?e.blocks.map(e=>`${e.mode}:${+!!e.highlight}:${e.src}`).join(`\0`):e.text??``;return S.run(C(t,e.streaming,e.highlight!==!1,e.highlightLineLimit),async t=>{let n=await g((t,n)=>({type:`parse`,id:t,streaming:e.streaming,highlight:e.highlight!==!1,highlightLineLimit:e.highlightLineLimit,priority:n,...e.blocks&&e.blocks.length>0?{blocks:e.blocks}:{text:e.text??``}}),{...e,signal:t});return n?.type===`parse`?n.blocks:null},e.signal)},T=(e,t,n,r,i)=>y.run(a(n,t,e),async a=>{let o=!f.has(n),s=await g((i,a)=>({type:`highlightTokens`,id:i,code:e,lang:t,themeName:n,priority:a,...o?{theme:r}:{}}),{...i,signal:a});return s?.type===`highlightTokens`?(f.add(n),s.lines):null},i?.signal);export{w as i,x as n,T as r,b as t};
@@ -1 +0,0 @@
1
- var e=class{#e;#t;#n=new Map;#r=0;constructor(e){this.#e=Math.max(0,Math.floor(e.maxEntries)),this.#t=Math.max(0,Math.floor(e.maxBytes))}get size(){return this.#n.size}get byteSize(){return this.#r}get(e){let t=this.#n.get(e);if(t)return this.#n.delete(e),this.#n.set(e,t),t.value}set(e,t,n){let r=this.#n.get(e);r&&(this.#r-=r.bytes,this.#n.delete(e));let i=Math.max(0,Math.ceil(n));this.#e===0||i>this.#t||(this.#n.set(e,{value:t,bytes:i}),this.#r+=i,this.#i())}clear(){this.#n.clear(),this.#r=0}#i(){for(;this.#n.size>this.#e||this.#r>this.#t;){let e=this.#n.keys().next().value;if(e===void 0)break;let t=this.#n.get(e);this.#n.delete(e),t&&(this.#r-=t.bytes)}}},t=512,n=65536,r=96,i=null,a=new e({maxEntries:t,maxBytes:n}),o=e=>{let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(36)},s=(e,t)=>`${t}:${e.length}:${o(e)}`,c=(e,t,n)=>{if(!Number.isFinite(t)||!Number.isFinite(n)||t<=0||n<=0)return;let o=Math.round(n);i!==o&&(a.clear(),i=o),a.set(e,Math.round(t),r)},l=e=>a.get(e);export{e as i,l as n,c as r,s as t};