collabmd 0.1.37 → 0.1.38
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.
- package/README.md +1 -0
- package/dist/client/assets/{drawio-editor-B65ntu5E.js → drawio-editor-BHI0pLby.js} +1 -1
- package/dist/client/assets/{drawioEditor-ChF0ZKUh.js → drawioEditor-DOaXwaY2.js} +2 -2
- package/dist/client/assets/{editor-session-YtGVwK3v.js → editor-session-BFsA-WRc.js} +1 -1
- package/dist/client/assets/{excalidraw-editor-Co4KOVfJ.js → excalidraw-editor-6pgH2kf5.js} +1 -1
- package/dist/client/assets/{excalidrawEditor-BT9hmN5y.js → excalidrawEditor-Ck9hgrTa.js} +2 -2
- package/dist/client/assets/{export-page-9MSUmliH.js → export-page-4M8Zo-AL.js} +1 -1
- package/dist/client/assets/{exportDocument-W3oYiIU3.js → exportDocument-mlXOym-R.js} +2 -2
- package/dist/client/assets/{index-D8NvI6X_.js → index-CCfHrm_9.js} +2 -2
- package/dist/client/assets/{main-CuQn72Cc.js → main-BQMPQ4CW.js} +5 -5
- package/dist/client/assets/preview-render-compiler-9SmLUP5V.js +1 -0
- package/dist/client/assets/{preview-render-compiler-BCaqHl2M.js → preview-render-compiler-IUtgIlOM.js} +1 -1
- package/dist/client/assets/{preview-render-worker-yfayDDfY.js → preview-render-worker-BwQ5sPy9.js} +1 -1
- package/dist/client/assets/runtime-config-BcUbZKho.js +1 -0
- package/dist/client/assets/{vault-api-client-CGLEvxZo.js → vault-api-client-BDKKvtOF.js} +1 -1
- package/dist/client/drawio-editor.html +1 -1
- package/dist/client/excalidraw-editor.html +1 -1
- package/dist/client/export-document.html +1 -1
- package/dist/client/index.html +1 -1
- package/docker-compose.yml +1 -0
- package/package.json +4 -4
- package/src/client/application/preview-render-compiler.js +12 -1
- package/src/client/application/preview-render-executor.js +4 -0
- package/src/client/application/preview-render-worker.js +2 -0
- package/src/client/application/preview-renderer.js +5 -2
- package/src/client/application/wiki-link-file-controller.js +7 -0
- package/src/client/bootstrap/collabmd-app-shell.js +2 -0
- package/src/client/domain/runtime-paths.js +1 -0
- package/src/server/config/env.js +1 -0
- package/src/server/infrastructure/http/create-static-handler.js +2 -0
- package/dist/client/assets/preview-render-compiler-kjMajWKn.js +0 -1
- package/dist/client/assets/runtime-config-Bf8nxVez.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./preview-render-compiler-IUtgIlOM.js";export{e as compilePreviewDocument};
|
|
@@ -32,4 +32,4 @@ import{a as e,i as t,t as n}from"./preview-render-profile-Bf6R7v4w.js";import{c
|
|
|
32
32
|
`:``}var Zn={dump:Xn};function Qn(e,t){return function(){throw Error(`Function yaml.`+e+` is removed in js-yaml 4. Use yaml.`+t+` instead, which is now safe by default.`)}}var $n={Type:y,Schema:ce,FAILSAFE_SCHEMA:fe,JSON_SCHEMA:Fe,CORE_SCHEMA:Ie,DEFAULT_SCHEMA:S,load:Gt.load,loadAll:Gt.loadAll,dump:Zn.dump,YAMLException:g,types:{binary:Ye,float:Pe,map:de,null:ge,pairs:it,set:ct,timestamp:He,bool:be,int:De,merge:We,omap:et,seq:ue,str:le},safeLoad:Qn(`safeLoad`,`load`),safeLoadAll:Qn(`safeLoadAll`,`loadAll`),safeDump:Qn(`safeDump`,`dump`)};function er(e=``){return String(e).includes(`\r
|
|
33
33
|
`)?`\r
|
|
34
34
|
`:`
|
|
35
|
-
`}function tr(e=``){return String(e).replace(/\r$/,``)}function nr(e=``){let t=String(e??``);if(!t.startsWith(`---`))return null;let n=er(t),r=t.split(/\r?\n/);if(tr(r[0])!==`---`)return null;let i=-1;for(let e=1;e<r.length;e+=1)if(tr(r[e])===`---`){i=e;break}if(i<0)return null;let a=r.slice(0,i+1).join(n),o=r.slice(1,i).join(n),s;try{s=$n.load(o||`{}`)}catch{return null}let c=i+1;return{bodyMarkdown:[...Array.from({length:c},()=>``),...r.slice(i+1)].join(n),data:s??{},endLine:c,rawFrontmatter:a,startLine:1}}function rr(e){return Object.prototype.toString.call(e)===`[object Object]`}function ir(e){return e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e instanceof Date}function ar(e){return e instanceof Date?e.toISOString():e==null?`null`:String(e)}function or(e){return $n.dump(e,{lineWidth:-1,noRefs:!0}).trim()}function sr(e){return ir(e)?`<span class="frontmatter-value-text">${a(ar(e))}</span>`:Array.isArray(e)&&e.every(e=>ir(e))?`<div class="frontmatter-value-list">${e.map(e=>`<span class="frontmatter-value-pill">${a(ar(e))}</span>`).join(``)}</div>`:`<pre class="frontmatter-value-code"><code>${a(or(e))}</code></pre>`}function cr(e){return rr(e)?Object.entries(e):[[`value`,e]]}function lr(e){return e.length===0?`No properties`:`${e.length} propert${e.length===1?`y`:`ies`} hidden`}function ur(e,{collapsed:t=!1,interactive:n=!1}={}){if(!e)return``;let r=cr(e.data),i=n&&t,o=` data-source-line="${e.startLine}" data-source-line-end="${e.endLine}"${n?` data-collapsed="${i?`true`:`false`}"`:``}`,s=`frontmatter-body-${e.startLine}-${e.endLine}`,c=r.length===0?`<div class="frontmatter-empty">No properties</div>`:``,l=r.map(([e,t])=>`<div class="frontmatter-property"><dt class="frontmatter-key">${a(e)}</dt><dd class="frontmatter-value">${sr(t)}</dd></div>`).join(``);return`<section class="frontmatter-block"${o}>${n?`<div class="frontmatter-header"><div class="frontmatter-label">Properties</div><button type="button" class="frontmatter-toggle" aria-controls="${s}" aria-expanded="${i?`false`:`true`}">${i?`Show`:`Hide`}</button></div>`:`<div class="frontmatter-label">Properties</div>`}${n?`<div class="frontmatter-summary"${i?``:` hidden`}>${a(lr(r))}</div>`:``}<div${` class="frontmatter-content"${n?` id="${s}"`:``}${i?` hidden`:``}`}><dl class="frontmatter-properties">${l}</dl>${c}</div></section>`}var dr=Object.freeze({".mp4":`video/mp4`,".ogg":`video/ogg`,".webm":`video/webm`}),fr=new Set([`youtube.com`,`www.youtube.com`,`m.youtube.com`,`youtu.be`,`www.youtu.be`,`youtube-nocookie.com`,`www.youtube-nocookie.com`]);function X(e,t,n,r,i,a){return e?.(t,n,r,i,a)??a.renderToken(t,n,r)}function Z(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)}function Q(e=``){return String(e).replace(/<->/g,`↔`).replace(/<=>/g,`⇔`).replace(/->/g,`→`).replace(/<-/g,`←`).replace(/=>/g,`⇒`)}function pr(e=``){return a(Q(e))}function mr(e=``){return String(e??``).trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``)||`section`}function hr(e=``,t=new Map){let n=String(e??``).trim()||`section`,r=t.get(n)??0;return t.set(n,r+1),r===0?n:`${n}-${r}`}function gr(e,t=[]){if(!e?.slug)return`section`;if(t.length<=1)return e.slug;for(let n=1;n<=e.parentSlugs.length;n+=1){let r=[...e.parentSlugs.slice(-n),e.slug].join(`-`);if(t.every(t=>t===e?!0:[...t.parentSlugs.slice(-n),t.slug].join(`-`)!==r))return r}return e.slug}function _r(e){let t=[],n=[];e.tokens.forEach((r,i)=>{if(r.type!==`heading_open`||r.attrGet(`id`))return;let a=Number.parseInt(r.tag.slice(1),10);if(!Number.isFinite(a)||a<1)return;n.length=Math.max(a-1,0);let o=e.tokens[i+1],s=mr(o?.type===`inline`?o.content:``);t.push({parentSlugs:n.filter(Boolean),slug:s,token:r}),n[a-1]=s});let r=new Map;t.forEach(e=>{let t=r.get(e.slug)??[];t.push(e),r.set(e.slug,t)});let i=new Map;t.forEach(e=>{let t=gr(e,r.get(e.slug)??[]);e.token.attrSet(`id`,hr(t,i))})}function vr(e=``){let t=String(e).split(/<br\s*\/?>/i);return t.length===1?pr(e):t.map(e=>pr(e)).join(`<br>`)}function yr({key:e,sourceAttributes:t,sourceHash:n,sourceText:r}){return`<div class="mermaid-shell diagram-preview-shell"${t} data-mermaid-key="${a(e)}" data-mermaid-source-hash="${a(n)}"><div class="mermaid-placeholder-card diagram-preview-placeholder-card"><div class="mermaid-placeholder-copy diagram-preview-placeholder-copy"><strong>Mermaid diagram</strong><span>Loads when visible</span></div><button type="button" class="mermaid-placeholder-btn diagram-preview-placeholder-btn" data-mermaid-key="${a(e)}">Render</button></div><pre class="mermaid-source" hidden>${a(r)}</pre></div>`}function br({embedKey:e,label:t,target:n}){return`<span class="mermaid-shell diagram-preview-shell" data-mermaid-key="${a(e)}" data-mermaid-target="${a(n)}" data-mermaid-label="${a(t)}"><span class="mermaid-placeholder-card diagram-preview-placeholder-card"><span class="mermaid-placeholder-copy diagram-preview-placeholder-copy"><strong>${a(t)}</strong><span>Loads when visible</span></span><button type="button" class="mermaid-placeholder-btn diagram-preview-placeholder-btn" data-mermaid-key="${a(e)}">Render</button></span><span class="mermaid-source" hidden></span></span>`}function xr({key:e,sourceAttributes:t,sourceHash:n,sourceText:r}){return`<div class="plantuml-shell diagram-preview-shell"${t} data-plantuml-key="${a(e)}" data-plantuml-source-hash="${a(n)}"><div class="plantuml-placeholder-card diagram-preview-placeholder-card"><div class="plantuml-placeholder-copy diagram-preview-placeholder-copy"><strong>PlantUML diagram</strong><span>Renders server-side when visible</span></div><button type="button" class="plantuml-placeholder-btn diagram-preview-placeholder-btn" data-plantuml-key="${a(e)}">Render</button></div><pre class="plantuml-source" hidden>${a(r)}</pre></div>`}function Sr({embedKey:e,label:t,target:n}){return`<span class="plantuml-shell diagram-preview-shell" data-plantuml-key="${a(e)}" data-plantuml-target="${a(n)}" data-plantuml-label="${a(t)}"><span class="plantuml-placeholder-card diagram-preview-placeholder-card"><span class="plantuml-placeholder-copy diagram-preview-placeholder-copy"><strong>${a(t)}</strong><span>Renders server-side when visible</span></span><button type="button" class="plantuml-placeholder-btn diagram-preview-placeholder-btn" data-plantuml-key="${a(e)}">Render</button></span><span class="plantuml-source" hidden></span></span>`}function Cr({embedKey:e,label:t,target:n}){return`<span class="excalidraw-embed-placeholder diagram-preview-shell" data-embed-key="${a(e)}" data-embed-target="${a(n)}" data-embed-label="${a(t)}"><span class="excalidraw-embed-placeholder-card diagram-preview-placeholder-card"><span class="excalidraw-embed-placeholder-copy diagram-preview-placeholder-copy"><strong>${a(t)}</strong><span>Loads when visible</span></span><button type="button" class="excalidraw-embed-placeholder-btn diagram-preview-placeholder-btn" data-embed-key="${a(e)}">Load diagram</button></span></span>`}function wr({embedKey:e,label:t,target:n}){return`<span class="drawio-embed-placeholder diagram-preview-shell" data-drawio-key="${a(e)}" data-drawio-target="${a(n)}" data-drawio-label="${a(t)}" data-drawio-mode="view"><span class="drawio-embed-placeholder-card diagram-preview-placeholder-card"><span class="drawio-embed-placeholder-copy diagram-preview-placeholder-copy"><strong>${a(t)}</strong><span>Loads when visible</span></span><button type="button" class="drawio-embed-placeholder-btn diagram-preview-placeholder-btn" data-drawio-key="${a(e)}">Load diagram</button></span></span>`}function Tr({key:e,sourceAttributes:t,sourceFilePath:n,sourceText:r,viewName:i=``}){let o=n?` data-base-source-path="${a(n)}"`:``,s=i?` data-base-view="${a(i)}"`:``;return`<div class="bases-embed-placeholder diagram-preview-shell"${t} data-base-key="${a(e)}" data-base-source="${a(r)}"${o}${s}><div class="diagram-preview-placeholder-card"><div class="diagram-preview-placeholder-copy"><strong>Base view</strong><span>Loads query results when preview renders</span></div></div></div>`}function Er({embedKey:e,label:t,target:n,viewName:r=``,sourceFilePath:i=``}){let o=i?` data-base-source-path="${a(i)}"`:``,s=r?` data-base-view="${a(r)}"`:``;return`<span class="bases-embed-placeholder diagram-preview-shell" data-base-key="${a(e)}" data-base-path="${a(n)}" data-base-label="${a(t)}"${s}${o}><span class="diagram-preview-placeholder-card"><span class="diagram-preview-placeholder-copy"><strong>${a(t)}</strong><span>Loads query results when preview renders</span></span></span></span>`}function Dr(e=``){let t=e.toLowerCase().match(/\.(mp4|ogg|webm)$/i);return t&&dr[`.${t[1].toLowerCase()}`]||null}function $(e=``){let t=String(e||``).trim();return/^[A-Za-z0-9_-]{11}$/.test(t)?t:null}function Or(e){let t=e.hostname.toLowerCase(),n=null;return t===`youtu.be`||t===`www.youtu.be`?n=$(e.pathname.split(`/`).filter(Boolean)[0]||``):(t.includes(`youtube`)||t.includes(`youtube-nocookie`))&&(e.pathname===`/watch`?n=$(e.searchParams.get(`v`)||``):e.pathname.startsWith(`/embed/`)&&(n=$(e.pathname.split(`/`).filter(Boolean)[1]||``))),n?`https://www.youtube-nocookie.com/embed/${n}`:null}function kr(e=``){let t;try{t=new URL(String(e||``).trim())}catch{return null}if(t.protocol!==`https:`)return null;let n=t.hostname.toLowerCase();if(fr.has(n)){let e=Or(t);return e?{embedUrl:e,type:`youtube`}:null}let r=Dr(t.pathname);return r?{mimeType:r,sourceUrl:t.toString(),type:`direct-video`}:null}function Ar({embedKey:e,kind:t,label:n,mimeType:r=``,originalUrl:i=``,source:o,url:s}){let c=t===`youtube`?`YouTube video`:`Video file`,l=r?` data-video-embed-mime-type="${a(r)}"`:``,u=i?` data-video-embed-original-url="${a(i)}"`:``;return`<span class="video-embed-placeholder video-embed-shell diagram-preview-shell" data-video-embed-key="${a(e)}" data-video-embed-kind="${a(t)}" data-video-embed-label="${a(n)}" data-video-embed-source="${a(o)}" data-video-embed-url="${a(s)}"${l}${u}><span class="video-embed-placeholder-card diagram-preview-placeholder-card"><span class="video-embed-placeholder-copy diagram-preview-placeholder-copy"><strong>${a(n)}</strong><span>${a(c)}</span></span></span></span>`}function jr(e,t){let n=e.attrGet(`src`)||``,r=kr(n);if(!r)return null;let i=Q(e.content||e.attrGet(`title`)||``),a=r.type===`youtube`?r.embedUrl:r.sourceUrl,o=t.get(a)??0;return t.set(a,o+1),Ar({embedKey:`video-${Z(a)}-${o}`,kind:r.type,label:i||`Embedded video`,mimeType:r.mimeType,originalUrl:n,source:a,url:r.type===`youtube`?r.embedUrl:r.sourceUrl})}function Mr(e=``){let t=String(e??``).trim();return!t||t.startsWith(`data:`)||t.startsWith(`blob:`)||t.startsWith(`#`)||t.startsWith(`//`)||/^[a-zA-Z][a-zA-Z\d+.-]*:/u.test(t)||t.startsWith(`/`)}function Nr(e=``,{attachmentApiPath:t,sourceFilePath:n}={}){if(!n||Mr(e))return null;let i=o(n,e);return!i||!r(i)?null:`${t}?path=${encodeURIComponent(i)}`}function Pr(e,t){let n=e.attrIndex(t);n>=0&&e.attrs.splice(n,1)}function Fr(e,{baseEmbedCounts:t,drawioEmbedCounts:n,excalidrawEmbedCounts:r,fileList:o,mermaidEmbedCounts:s,plantUmlEmbedCounts:c,sourceFilePath:l=``}){let u=/!\[\[([^\]|#]+\.(?:base|excalidraw|drawio|mmd|mermaid|puml|plantuml))(?:#([^\]|]+))?(?:\|([^\]]+))?\]\]|\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/gi,d=0,f=``,p;for(;(p=u.exec(e))!==null;){if(p.index>d&&(f+=vr(e.slice(d,p.index))),p[1]){let e=p[1].trim(),i=(p[2]||``).trim(),a=(p[3]||e).trim();if(/\.base$/i.test(e)){let n=t.get(`${e}#${i}`)??0;t.set(`${e}#${i}`,n+1),f+=Er({embedKey:`${e}#${i||`default`}#${n}`,label:Q(a.replace(/\.base$/i,``)),sourceFilePath:l,target:e,viewName:i})}else if(/\.excalidraw$/i.test(e)){let t=r.get(e)??0;r.set(e,t+1),f+=Cr({embedKey:`${e}#${t}`,label:Q(a.replace(/\.excalidraw$/i,``)),target:e})}else if(/\.drawio$/i.test(e)){let t=n.get(e)??0;n.set(e,t+1),f+=wr({embedKey:`${e}#${t}`,label:Q(a.replace(/\.drawio$/i,``)),target:e})}else if(/\.(?:mmd|mermaid)$/i.test(e)){let t=s.get(e)??0;s.set(e,t+1),f+=br({embedKey:`${e}#${t}`,label:Q(a.replace(/\.(?:mmd|mermaid)$/i,``)),target:e})}else{let t=c.get(e)??0;c.set(e,t+1),f+=Sr({embedKey:`${e}#${t}`,label:Q(a.replace(/\.(?:puml|plantuml)$/i,``)),target:e})}}else{let e=p[4].trim(),t=(p[5]||p[4]).trim(),n=i(e,o),r=n?`wiki-link`:`wiki-link wiki-link-new`,s=n?Q(t):`Create "${e}"`;f+=`<a class="${r}" href="#" data-wiki-target="${a(e)}" title="${a(s)}">${pr(t)}</a>`}d=u.lastIndex}return d<e.length&&(f+=vr(e.slice(d))),f}function Ir(n=[],{attachmentApiPath:r=`/api/attachment`,sourceFilePath:i=``}={}){let a=e({highlight(e,n){if(n===`mermaid`||n===`plantuml`||n===`puml`)return``;try{return n&&t.getLanguage(n)?t.highlight(e,{language:n}).value:t.highlightAuto(e).value}catch{return``}},html:!1,linkify:!0,typographer:!0});a.core.ruler.push(`collabmd-source-lines`,e=>{e.tokens.forEach(e=>{if(!e.map)return;let[t,n]=e.map,r=t+1,i=Math.max(n,t+1);(e.nesting===1||e.type===`fence`||e.type===`code_block`||e.type===`html_block`)&&(e.attrSet(`data-source-line`,String(r)),e.attrSet(`data-source-line-end`,String(i)))})}),a.core.ruler.push(`collabmd-heading-anchors`,e=>{_r(e)});let o=new Map,s=new Map,c=new Map,l=new Map,u=new Map,d=new Map,f=new Map,p=new Map,m=a.renderer.rules.fence,h=a.renderer.rules.image,g=a.renderer.rules.link_open,_=a.renderer.rules.table_open,v=a.renderer.rules.table_close;return a.renderer.rules.fence=(e,t,n,r,a)=>{let o=e[t],s=o.info?o.info.trim().toLowerCase():``,u=o.attrGet(`data-source-line`),f=o.attrGet(`data-source-line-end`),p=u?` data-source-line="${u}" data-source-line-end="${f}"`:``;if(s===`mermaid`){let e=Z(o.content),t=l.get(e)??0;return l.set(e,t+1),yr({key:`mermaid-${e}-${t}`,sourceAttributes:p,sourceHash:e,sourceText:o.content})}if(s===`plantuml`||s===`puml`){let e=Z(o.content),t=d.get(e)??0;return d.set(e,t+1),xr({key:`plantuml-${e}-${t}`,sourceAttributes:p,sourceHash:e,sourceText:o.content})}if(s===`base`){let e=Z(o.content),t=c.get(e)??0;return c.set(e,t+1),Tr({key:`base-${e}-${t}`,sourceAttributes:p,sourceFilePath:i,sourceText:o.content})}let h=X(m,e,t,n,r,a);return u?h.replace(/^<pre/,`<pre data-source-line="${u}" data-source-line-end="${f}"`):h},a.renderer.rules.list_item_open=(e,t,n,r,i)=>{let a=e[t+2]?.content??``;return(a.startsWith(`[ ] `)||a.startsWith(`[x] `)||a.startsWith(`[X] `))&&e[t].attrJoin(`class`,`task-list-item`),i.renderToken(e,t,n)},a.renderer.rules.text=(e,t)=>{let r=e[t].content;return r.startsWith(`[x] `)||r.startsWith(`[X] `)?`<input type="checkbox" checked data-task-checkbox="true"> ${Fr(r.slice(4),{baseEmbedCounts:c,drawioEmbedCounts:o,excalidrawEmbedCounts:s,fileList:n,mermaidEmbedCounts:u,plantUmlEmbedCounts:f,sourceFilePath:i})}`:r.startsWith(`[ ] `)?`<input type="checkbox" data-task-checkbox="true"> ${Fr(r.slice(4),{baseEmbedCounts:c,drawioEmbedCounts:o,excalidrawEmbedCounts:s,fileList:n,mermaidEmbedCounts:u,plantUmlEmbedCounts:f,sourceFilePath:i})}`:Fr(r,{baseEmbedCounts:c,drawioEmbedCounts:o,excalidrawEmbedCounts:s,fileList:n,mermaidEmbedCounts:u,plantUmlEmbedCounts:f,sourceFilePath:i})},a.renderer.rules.link_open=(e,t,n,r,i)=>(e[t].attrGet(`href`)||``).startsWith(`#`)?(Pr(e[t],`target`),Pr(e[t],`rel`),X(g,e,t,n,r,i)):(e[t].attrSet(`target`,`_blank`),e[t].attrSet(`rel`,`noopener noreferrer`),X(g,e,t,n,r,i)),a.renderer.rules.image=(e,t,n,a,o)=>{let s=e[t],c=Nr(s.attrGet(`src`)||``,{attachmentApiPath:r,sourceFilePath:i});return c&&s.attrSet(`src`,c),jr(s,p)||X(h,e,t,n,a,o)},a.renderer.rules.table_open=(e,t,n,r,i)=>`<div class="table-wrapper">${X(_,e,t,n,r,i)}`,a.renderer.rules.table_close=(e,t,n,r,i)=>`${X(v,e,t,n,r,i)}</div>`,a}function Lr({attachmentApiPath:e=`/api/attachment`,fileList:t=[],frontmatterCollapsed:r=!1,frontmatterInteractive:i=!1,markdownText:a=``,sourceFilePath:o=``}={}){let s=String(a),c=nr(s),l=Ir(t,{attachmentApiPath:e,sourceFilePath:o}),u=c?c.bodyMarkdown:s;return{html:`${ur(c,{collapsed:r,interactive:i})}${l.render(u)}`,stats:n(s)}}export{Lr as t};
|
|
35
|
+
`}function tr(e=``){return String(e).replace(/\r$/,``)}function nr(e=``){let t=String(e??``);if(!t.startsWith(`---`))return null;let n=er(t),r=t.split(/\r?\n/);if(tr(r[0])!==`---`)return null;let i=-1;for(let e=1;e<r.length;e+=1)if(tr(r[e])===`---`){i=e;break}if(i<0)return null;let a=r.slice(0,i+1).join(n),o=r.slice(1,i).join(n),s;try{s=$n.load(o||`{}`)}catch{return null}let c=i+1;return{bodyMarkdown:[...Array.from({length:c},()=>``),...r.slice(i+1)].join(n),data:s??{},endLine:c,rawFrontmatter:a,startLine:1}}function rr(e){return Object.prototype.toString.call(e)===`[object Object]`}function ir(e){return e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e instanceof Date}function ar(e){return e instanceof Date?e.toISOString():e==null?`null`:String(e)}function or(e){return $n.dump(e,{lineWidth:-1,noRefs:!0}).trim()}function sr(e){return ir(e)?`<span class="frontmatter-value-text">${a(ar(e))}</span>`:Array.isArray(e)&&e.every(e=>ir(e))?`<div class="frontmatter-value-list">${e.map(e=>`<span class="frontmatter-value-pill">${a(ar(e))}</span>`).join(``)}</div>`:`<pre class="frontmatter-value-code"><code>${a(or(e))}</code></pre>`}function cr(e){return rr(e)?Object.entries(e):[[`value`,e]]}function lr(e){return e.length===0?`No properties`:`${e.length} propert${e.length===1?`y`:`ies`} hidden`}function ur(e,{collapsed:t=!1,interactive:n=!1}={}){if(!e)return``;let r=cr(e.data),i=n&&t,o=` data-source-line="${e.startLine}" data-source-line-end="${e.endLine}"${n?` data-collapsed="${i?`true`:`false`}"`:``}`,s=`frontmatter-body-${e.startLine}-${e.endLine}`,c=r.length===0?`<div class="frontmatter-empty">No properties</div>`:``,l=r.map(([e,t])=>`<div class="frontmatter-property"><dt class="frontmatter-key">${a(e)}</dt><dd class="frontmatter-value">${sr(t)}</dd></div>`).join(``);return`<section class="frontmatter-block"${o}>${n?`<div class="frontmatter-header"><div class="frontmatter-label">Properties</div><button type="button" class="frontmatter-toggle" aria-controls="${s}" aria-expanded="${i?`false`:`true`}">${i?`Show`:`Hide`}</button></div>`:`<div class="frontmatter-label">Properties</div>`}${n?`<div class="frontmatter-summary"${i?``:` hidden`}>${a(lr(r))}</div>`:``}<div${` class="frontmatter-content"${n?` id="${s}"`:``}${i?` hidden`:``}`}><dl class="frontmatter-properties">${l}</dl>${c}</div></section>`}var dr=Object.freeze({".mp4":`video/mp4`,".ogg":`video/ogg`,".webm":`video/webm`}),fr=new Set([`youtube.com`,`www.youtube.com`,`m.youtube.com`,`youtu.be`,`www.youtu.be`,`youtube-nocookie.com`,`www.youtube-nocookie.com`]);function X(e,t,n,r,i,a){return e?.(t,n,r,i,a)??a.renderToken(t,n,r)}function Z(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)}function Q(e=``){return String(e).replace(/<->/g,`↔`).replace(/<=>/g,`⇔`).replace(/->/g,`→`).replace(/<-/g,`←`).replace(/=>/g,`⇒`)}function pr(e=``){return a(Q(e))}function mr(e=``){return String(e??``).trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``)||`section`}function hr(e=``,t=new Map){let n=String(e??``).trim()||`section`,r=t.get(n)??0;return t.set(n,r+1),r===0?n:`${n}-${r}`}function gr(e,t=[]){if(!e?.slug)return`section`;if(t.length<=1)return e.slug;for(let n=1;n<=e.parentSlugs.length;n+=1){let r=[...e.parentSlugs.slice(-n),e.slug].join(`-`);if(t.every(t=>t===e?!0:[...t.parentSlugs.slice(-n),t.slug].join(`-`)!==r))return r}return e.slug}function _r(e){let t=[],n=[];e.tokens.forEach((r,i)=>{if(r.type!==`heading_open`||r.attrGet(`id`))return;let a=Number.parseInt(r.tag.slice(1),10);if(!Number.isFinite(a)||a<1)return;n.length=Math.max(a-1,0);let o=e.tokens[i+1],s=mr(o?.type===`inline`?o.content:``);t.push({parentSlugs:n.filter(Boolean),slug:s,token:r}),n[a-1]=s});let r=new Map;t.forEach(e=>{let t=r.get(e.slug)??[];t.push(e),r.set(e.slug,t)});let i=new Map;t.forEach(e=>{let t=gr(e,r.get(e.slug)??[]);e.token.attrSet(`id`,hr(t,i))})}function vr(e=``){let t=String(e).split(/<br\s*\/?>/i);return t.length===1?pr(e):t.map(e=>pr(e)).join(`<br>`)}function yr({key:e,sourceAttributes:t,sourceHash:n,sourceText:r}){return`<div class="mermaid-shell diagram-preview-shell"${t} data-mermaid-key="${a(e)}" data-mermaid-source-hash="${a(n)}"><div class="mermaid-placeholder-card diagram-preview-placeholder-card"><div class="mermaid-placeholder-copy diagram-preview-placeholder-copy"><strong>Mermaid diagram</strong><span>Loads when visible</span></div><button type="button" class="mermaid-placeholder-btn diagram-preview-placeholder-btn" data-mermaid-key="${a(e)}">Render</button></div><pre class="mermaid-source" hidden>${a(r)}</pre></div>`}function br({embedKey:e,label:t,target:n}){return`<span class="mermaid-shell diagram-preview-shell" data-mermaid-key="${a(e)}" data-mermaid-target="${a(n)}" data-mermaid-label="${a(t)}"><span class="mermaid-placeholder-card diagram-preview-placeholder-card"><span class="mermaid-placeholder-copy diagram-preview-placeholder-copy"><strong>${a(t)}</strong><span>Loads when visible</span></span><button type="button" class="mermaid-placeholder-btn diagram-preview-placeholder-btn" data-mermaid-key="${a(e)}">Render</button></span><span class="mermaid-source" hidden></span></span>`}function xr({key:e,sourceAttributes:t,sourceHash:n,sourceText:r}){return`<div class="plantuml-shell diagram-preview-shell"${t} data-plantuml-key="${a(e)}" data-plantuml-source-hash="${a(n)}"><div class="plantuml-placeholder-card diagram-preview-placeholder-card"><div class="plantuml-placeholder-copy diagram-preview-placeholder-copy"><strong>PlantUML diagram</strong><span>Renders server-side when visible</span></div><button type="button" class="plantuml-placeholder-btn diagram-preview-placeholder-btn" data-plantuml-key="${a(e)}">Render</button></div><pre class="plantuml-source" hidden>${a(r)}</pre></div>`}function Sr({embedKey:e,label:t,target:n}){return`<span class="plantuml-shell diagram-preview-shell" data-plantuml-key="${a(e)}" data-plantuml-target="${a(n)}" data-plantuml-label="${a(t)}"><span class="plantuml-placeholder-card diagram-preview-placeholder-card"><span class="plantuml-placeholder-copy diagram-preview-placeholder-copy"><strong>${a(t)}</strong><span>Renders server-side when visible</span></span><button type="button" class="plantuml-placeholder-btn diagram-preview-placeholder-btn" data-plantuml-key="${a(e)}">Render</button></span><span class="plantuml-source" hidden></span></span>`}function Cr({embedKey:e,label:t,target:n}){return`<span class="excalidraw-embed-placeholder diagram-preview-shell" data-embed-key="${a(e)}" data-embed-target="${a(n)}" data-embed-label="${a(t)}"><span class="excalidraw-embed-placeholder-card diagram-preview-placeholder-card"><span class="excalidraw-embed-placeholder-copy diagram-preview-placeholder-copy"><strong>${a(t)}</strong><span>Loads when visible</span></span><button type="button" class="excalidraw-embed-placeholder-btn diagram-preview-placeholder-btn" data-embed-key="${a(e)}">Load diagram</button></span></span>`}function wr({embedKey:e,label:t,target:n}){return`<span class="drawio-embed-placeholder diagram-preview-shell" data-drawio-key="${a(e)}" data-drawio-target="${a(n)}" data-drawio-label="${a(t)}" data-drawio-mode="view"><span class="drawio-embed-placeholder-card diagram-preview-placeholder-card"><span class="drawio-embed-placeholder-copy diagram-preview-placeholder-copy"><strong>${a(t)}</strong><span>Loads when visible</span></span><button type="button" class="drawio-embed-placeholder-btn diagram-preview-placeholder-btn" data-drawio-key="${a(e)}">Load diagram</button></span></span>`}function Tr({key:e,sourceAttributes:t,sourceFilePath:n,sourceText:r,viewName:i=``}){let o=n?` data-base-source-path="${a(n)}"`:``,s=i?` data-base-view="${a(i)}"`:``;return`<div class="bases-embed-placeholder diagram-preview-shell"${t} data-base-key="${a(e)}" data-base-source="${a(r)}"${o}${s}><div class="diagram-preview-placeholder-card"><div class="diagram-preview-placeholder-copy"><strong>Base view</strong><span>Loads query results when preview renders</span></div></div></div>`}function Er({embedKey:e,label:t,target:n,viewName:r=``,sourceFilePath:i=``}){let o=i?` data-base-source-path="${a(i)}"`:``,s=r?` data-base-view="${a(r)}"`:``;return`<span class="bases-embed-placeholder diagram-preview-shell" data-base-key="${a(e)}" data-base-path="${a(n)}" data-base-label="${a(t)}"${s}${o}><span class="diagram-preview-placeholder-card"><span class="diagram-preview-placeholder-copy"><strong>${a(t)}</strong><span>Loads query results when preview renders</span></span></span></span>`}function Dr(e=``){let t=e.toLowerCase().match(/\.(mp4|ogg|webm)$/i);return t&&dr[`.${t[1].toLowerCase()}`]||null}function $(e=``){let t=String(e||``).trim();return/^[A-Za-z0-9_-]{11}$/.test(t)?t:null}function Or(e){let t=e.hostname.toLowerCase(),n=null;return t===`youtu.be`||t===`www.youtu.be`?n=$(e.pathname.split(`/`).filter(Boolean)[0]||``):(t.includes(`youtube`)||t.includes(`youtube-nocookie`))&&(e.pathname===`/watch`?n=$(e.searchParams.get(`v`)||``):e.pathname.startsWith(`/embed/`)&&(n=$(e.pathname.split(`/`).filter(Boolean)[1]||``))),n?`https://www.youtube-nocookie.com/embed/${n}`:null}function kr(e=``){let t;try{t=new URL(String(e||``).trim())}catch{return null}if(t.protocol!==`https:`)return null;let n=t.hostname.toLowerCase();if(fr.has(n)){let e=Or(t);return e?{embedUrl:e,type:`youtube`}:null}let r=Dr(t.pathname);return r?{mimeType:r,sourceUrl:t.toString(),type:`direct-video`}:null}function Ar({embedKey:e,kind:t,label:n,mimeType:r=``,originalUrl:i=``,source:o,url:s}){let c=t===`youtube`?`YouTube video`:`Video file`,l=r?` data-video-embed-mime-type="${a(r)}"`:``,u=i?` data-video-embed-original-url="${a(i)}"`:``;return`<span class="video-embed-placeholder video-embed-shell diagram-preview-shell" data-video-embed-key="${a(e)}" data-video-embed-kind="${a(t)}" data-video-embed-label="${a(n)}" data-video-embed-source="${a(o)}" data-video-embed-url="${a(s)}"${l}${u}><span class="video-embed-placeholder-card diagram-preview-placeholder-card"><span class="video-embed-placeholder-copy diagram-preview-placeholder-copy"><strong>${a(n)}</strong><span>${a(c)}</span></span></span></span>`}function jr(e,t){let n=e.attrGet(`src`)||``,r=kr(n);if(!r)return null;let i=Q(e.content||e.attrGet(`title`)||``),a=r.type===`youtube`?r.embedUrl:r.sourceUrl,o=t.get(a)??0;return t.set(a,o+1),Ar({embedKey:`video-${Z(a)}-${o}`,kind:r.type,label:i||`Embedded video`,mimeType:r.mimeType,originalUrl:n,source:a,url:r.type===`youtube`?r.embedUrl:r.sourceUrl})}function Mr(e=``){let t=String(e??``).trim();return!t||t.startsWith(`data:`)||t.startsWith(`blob:`)||t.startsWith(`#`)||t.startsWith(`//`)||/^[a-zA-Z][a-zA-Z\d+.-]*:/u.test(t)||t.startsWith(`/`)}function Nr(e=``,{attachmentApiPath:t,sourceFilePath:n}={}){if(!n||Mr(e))return null;let i=o(n,e);return!i||!r(i)?null:`${t}?path=${encodeURIComponent(i)}`}function Pr(e,t){let n=e.attrIndex(t);n>=0&&e.attrs.splice(n,1)}function Fr(e,{baseEmbedCounts:t,drawioEmbedCounts:n,excalidrawEmbedCounts:r,fileList:o,mermaidEmbedCounts:s,plantUmlEmbedCounts:c,sourceFilePath:l=``,wikiLinkAutoCreate:u=!0}){let d=/!\[\[([^\]|#]+\.(?:base|excalidraw|drawio|mmd|mermaid|puml|plantuml))(?:#([^\]|]+))?(?:\|([^\]]+))?\]\]|\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/gi,f=0,p=``,m;for(;(m=d.exec(e))!==null;){if(m.index>f&&(p+=vr(e.slice(f,m.index))),m[1]){let e=m[1].trim(),i=(m[2]||``).trim(),a=(m[3]||e).trim();if(/\.base$/i.test(e)){let n=t.get(`${e}#${i}`)??0;t.set(`${e}#${i}`,n+1),p+=Er({embedKey:`${e}#${i||`default`}#${n}`,label:Q(a.replace(/\.base$/i,``)),sourceFilePath:l,target:e,viewName:i})}else if(/\.excalidraw$/i.test(e)){let t=r.get(e)??0;r.set(e,t+1),p+=Cr({embedKey:`${e}#${t}`,label:Q(a.replace(/\.excalidraw$/i,``)),target:e})}else if(/\.drawio$/i.test(e)){let t=n.get(e)??0;n.set(e,t+1),p+=wr({embedKey:`${e}#${t}`,label:Q(a.replace(/\.drawio$/i,``)),target:e})}else if(/\.(?:mmd|mermaid)$/i.test(e)){let t=s.get(e)??0;s.set(e,t+1),p+=br({embedKey:`${e}#${t}`,label:Q(a.replace(/\.(?:mmd|mermaid)$/i,``)),target:e})}else{let t=c.get(e)??0;c.set(e,t+1),p+=Sr({embedKey:`${e}#${t}`,label:Q(a.replace(/\.(?:puml|plantuml)$/i,``)),target:e})}}else{let e=m[4].trim(),t=(m[5]||m[4]).trim(),n=i(e,o),r=n?`wiki-link`:`wiki-link wiki-link-new`,s=n?Q(t):u?`Create "${e}"`:`Missing "${e}"`;p+=`<a class="${r}" href="#" data-wiki-target="${a(e)}" title="${a(s)}">${pr(t)}</a>`}f=d.lastIndex}return f<e.length&&(p+=vr(e.slice(f))),p}function Ir(n=[],{attachmentApiPath:r=`/api/attachment`,sourceFilePath:i=``,wikiLinkAutoCreate:a=!0}={}){let o=e({highlight(e,n){if(n===`mermaid`||n===`plantuml`||n===`puml`)return``;try{return n&&t.getLanguage(n)?t.highlight(e,{language:n}).value:t.highlightAuto(e).value}catch{return``}},html:!1,linkify:!0,typographer:!0});o.core.ruler.push(`collabmd-source-lines`,e=>{e.tokens.forEach(e=>{if(!e.map)return;let[t,n]=e.map,r=t+1,i=Math.max(n,t+1);(e.nesting===1||e.type===`fence`||e.type===`code_block`||e.type===`html_block`)&&(e.attrSet(`data-source-line`,String(r)),e.attrSet(`data-source-line-end`,String(i)))})}),o.core.ruler.push(`collabmd-heading-anchors`,e=>{_r(e)});let s=new Map,c=new Map,l=new Map,u=new Map,d=new Map,f=new Map,p=new Map,m=new Map,h=o.renderer.rules.fence,g=o.renderer.rules.image,_=o.renderer.rules.link_open,v=o.renderer.rules.table_open,ee=o.renderer.rules.table_close;return o.renderer.rules.fence=(e,t,n,r,a)=>{let o=e[t],s=o.info?o.info.trim().toLowerCase():``,c=o.attrGet(`data-source-line`),d=o.attrGet(`data-source-line-end`),p=c?` data-source-line="${c}" data-source-line-end="${d}"`:``;if(s===`mermaid`){let e=Z(o.content),t=u.get(e)??0;return u.set(e,t+1),yr({key:`mermaid-${e}-${t}`,sourceAttributes:p,sourceHash:e,sourceText:o.content})}if(s===`plantuml`||s===`puml`){let e=Z(o.content),t=f.get(e)??0;return f.set(e,t+1),xr({key:`plantuml-${e}-${t}`,sourceAttributes:p,sourceHash:e,sourceText:o.content})}if(s===`base`){let e=Z(o.content),t=l.get(e)??0;return l.set(e,t+1),Tr({key:`base-${e}-${t}`,sourceAttributes:p,sourceFilePath:i,sourceText:o.content})}let m=X(h,e,t,n,r,a);return c?m.replace(/^<pre/,`<pre data-source-line="${c}" data-source-line-end="${d}"`):m},o.renderer.rules.list_item_open=(e,t,n,r,i)=>{let a=e[t+2]?.content??``;return(a.startsWith(`[ ] `)||a.startsWith(`[x] `)||a.startsWith(`[X] `))&&e[t].attrJoin(`class`,`task-list-item`),i.renderToken(e,t,n)},o.renderer.rules.text=(e,t)=>{let r=e[t].content;return r.startsWith(`[x] `)||r.startsWith(`[X] `)?`<input type="checkbox" checked data-task-checkbox="true"> ${Fr(r.slice(4),{baseEmbedCounts:l,drawioEmbedCounts:s,excalidrawEmbedCounts:c,fileList:n,mermaidEmbedCounts:d,plantUmlEmbedCounts:p,sourceFilePath:i,wikiLinkAutoCreate:a})}`:r.startsWith(`[ ] `)?`<input type="checkbox" data-task-checkbox="true"> ${Fr(r.slice(4),{baseEmbedCounts:l,drawioEmbedCounts:s,excalidrawEmbedCounts:c,fileList:n,mermaidEmbedCounts:d,plantUmlEmbedCounts:p,sourceFilePath:i,wikiLinkAutoCreate:a})}`:Fr(r,{baseEmbedCounts:l,drawioEmbedCounts:s,excalidrawEmbedCounts:c,fileList:n,mermaidEmbedCounts:d,plantUmlEmbedCounts:p,sourceFilePath:i,wikiLinkAutoCreate:a})},o.renderer.rules.link_open=(e,t,n,r,i)=>(e[t].attrGet(`href`)||``).startsWith(`#`)?(Pr(e[t],`target`),Pr(e[t],`rel`),X(_,e,t,n,r,i)):(e[t].attrSet(`target`,`_blank`),e[t].attrSet(`rel`,`noopener noreferrer`),X(_,e,t,n,r,i)),o.renderer.rules.image=(e,t,n,a,o)=>{let s=e[t],c=Nr(s.attrGet(`src`)||``,{attachmentApiPath:r,sourceFilePath:i});return c&&s.attrSet(`src`,c),jr(s,m)||X(g,e,t,n,a,o)},o.renderer.rules.table_open=(e,t,n,r,i)=>`<div class="table-wrapper">${X(v,e,t,n,r,i)}`,o.renderer.rules.table_close=(e,t,n,r,i)=>`${X(ee,e,t,n,r,i)}</div>`,o}function Lr({attachmentApiPath:e=`/api/attachment`,fileList:t=[],frontmatterCollapsed:r=!1,frontmatterInteractive:i=!1,markdownText:a=``,sourceFilePath:o=``,wikiLinkAutoCreate:s=!0}={}){let c=String(a),l=nr(c),u=Ir(t,{attachmentApiPath:e,sourceFilePath:o,wikiLinkAutoCreate:s}),d=l?l.bodyMarkdown:c;return{html:`${ur(l,{collapsed:r,interactive:i})}${u.render(d)}`,stats:n(c)}}export{Lr as t};
|
package/dist/client/assets/{preview-render-worker-yfayDDfY.js → preview-render-worker-BwQ5sPy9.js}
RENAMED
|
@@ -56,4 +56,4 @@ function cs(e){return e==null}function ls(e){return typeof e==`object`&&!!e}func
|
|
|
56
56
|
`:``}var Bu={dump:zu};function Vu(e,t){return function(){throw Error(`Function yaml.`+e+` is removed in js-yaml 4. Use yaml.`+t+` instead, which is now safe by default.`)}}var Hu={Type:Y,Schema:Ds,FAILSAFE_SCHEMA:js,JSON_SCHEMA:ec,CORE_SCHEMA:tc,DEFAULT_SCHEMA:kc,load:Dl.load,loadAll:Dl.loadAll,dump:Bu.dump,YAMLException:J,types:{binary:hc,float:$s,map:As,null:Fs,pairs:wc,set:Oc,timestamp:sc,bool:zs,int:Ks,merge:lc,omap:bc,seq:ks,str:Os},safeLoad:Vu(`safeLoad`,`load`),safeLoadAll:Vu(`safeLoadAll`,`loadAll`),safeDump:Vu(`safeDump`,`dump`)};function Uu(e=``){return String(e).includes(`\r
|
|
57
57
|
`)?`\r
|
|
58
58
|
`:`
|
|
59
|
-
`}function Wu(e=``){return String(e).replace(/\r$/,``)}function Gu(e=``){let t=String(e??``);if(!t.startsWith(`---`))return null;let n=Uu(t),r=t.split(/\r?\n/);if(Wu(r[0])!==`---`)return null;let i=-1;for(let e=1;e<r.length;e+=1)if(Wu(r[e])===`---`){i=e;break}if(i<0)return null;let a=r.slice(0,i+1).join(n),o=r.slice(1,i).join(n),s;try{s=Hu.load(o||`{}`)}catch{return null}let c=i+1;return{bodyMarkdown:[...Array.from({length:c},()=>``),...r.slice(i+1)].join(n),data:s??{},endLine:c,rawFrontmatter:a,startLine:1}}function Ku(e){return Object.prototype.toString.call(e)===`[object Object]`}function qu(e){return e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e instanceof Date}function Ju(e){return e instanceof Date?e.toISOString():e==null?`null`:String(e)}function Yu(e){return Hu.dump(e,{lineWidth:-1,noRefs:!0}).trim()}function Xu(e){return qu(e)?`<span class="frontmatter-value-text">${K(Ju(e))}</span>`:Array.isArray(e)&&e.every(e=>qu(e))?`<div class="frontmatter-value-list">${e.map(e=>`<span class="frontmatter-value-pill">${K(Ju(e))}</span>`).join(``)}</div>`:`<pre class="frontmatter-value-code"><code>${K(Yu(e))}</code></pre>`}function Zu(e){return Ku(e)?Object.entries(e):[[`value`,e]]}function Qu(e){return e.length===0?`No properties`:`${e.length} propert${e.length===1?`y`:`ies`} hidden`}function $u(e,{collapsed:t=!1,interactive:n=!1}={}){if(!e)return``;let r=Zu(e.data),i=n&&t,a=` data-source-line="${e.startLine}" data-source-line-end="${e.endLine}"${n?` data-collapsed="${i?`true`:`false`}"`:``}`,o=`frontmatter-body-${e.startLine}-${e.endLine}`,s=r.length===0?`<div class="frontmatter-empty">No properties</div>`:``,c=r.map(([e,t])=>`<div class="frontmatter-property"><dt class="frontmatter-key">${K(e)}</dt><dd class="frontmatter-value">${Xu(t)}</dd></div>`).join(``);return`<section class="frontmatter-block"${a}>${n?`<div class="frontmatter-header"><div class="frontmatter-label">Properties</div><button type="button" class="frontmatter-toggle" aria-controls="${o}" aria-expanded="${i?`false`:`true`}">${i?`Show`:`Hide`}</button></div>`:`<div class="frontmatter-label">Properties</div>`}${n?`<div class="frontmatter-summary"${i?``:` hidden`}>${K(Qu(r))}</div>`:``}<div${` class="frontmatter-content"${n?` id="${o}"`:``}${i?` hidden`:``}`}><dl class="frontmatter-properties">${c}</dl>${s}</div></section>`}function ed(e,t){return e.match(t)?.length??0}function td(e=``){let t=String(e),n=ed(t,/!\[\[[^\]]+\.(?:mmd|mermaid)(?:\|[^\]]+)?\]\]/gi),r=ed(t,/(^|\n)```(?:plantuml|puml)\b/gi),i=ed(t,/!\[\[[^\]]+\.(?:puml|plantuml)(?:\|[^\]]+)?\]\]/gi);return{chars:t.length,drawioEmbeds:ed(t,/!\[\[[^\]]+\.drawio(?:\|[^\]]+)?\]\]/gi),excalidrawEmbeds:ed(t,/!\[\[[^\]]+\.excalidraw(?:\|[^\]]+)?\]\]/gi),mermaidBlocks:ed(t,/(^|\n)```mermaid\b/gi)+n,plantumlBlocks:r+i}}let nd=Object.freeze({".mp4":`video/mp4`,".ogg":`video/ogg`,".webm":`video/webm`}),rd=new Set([`youtube.com`,`www.youtube.com`,`m.youtube.com`,`youtu.be`,`www.youtu.be`,`youtube-nocookie.com`,`www.youtube-nocookie.com`]);function id(e,t,n,r,i,a){return e?.(t,n,r,i,a)??a.renderToken(t,n,r)}function ad(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)}function od(e=``){return String(e).replace(/<->/g,`↔`).replace(/<=>/g,`⇔`).replace(/->/g,`→`).replace(/<-/g,`←`).replace(/=>/g,`⇒`)}function sd(e=``){return K(od(e))}function cd(e=``){return String(e??``).trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``)||`section`}function ld(e=``,t=new Map){let n=String(e??``).trim()||`section`,r=t.get(n)??0;return t.set(n,r+1),r===0?n:`${n}-${r}`}function ud(e,t=[]){if(!e?.slug)return`section`;if(t.length<=1)return e.slug;for(let n=1;n<=e.parentSlugs.length;n+=1){let r=[...e.parentSlugs.slice(-n),e.slug].join(`-`);if(t.every(t=>t===e?!0:[...t.parentSlugs.slice(-n),t.slug].join(`-`)!==r))return r}return e.slug}function dd(e){let t=[],n=[];e.tokens.forEach((r,i)=>{if(r.type!==`heading_open`||r.attrGet(`id`))return;let a=Number.parseInt(r.tag.slice(1),10);if(!Number.isFinite(a)||a<1)return;n.length=Math.max(a-1,0);let o=e.tokens[i+1],s=cd(o?.type===`inline`?o.content:``);t.push({parentSlugs:n.filter(Boolean),slug:s,token:r}),n[a-1]=s});let r=new Map;t.forEach(e=>{let t=r.get(e.slug)??[];t.push(e),r.set(e.slug,t)});let i=new Map;t.forEach(e=>{let t=ud(e,r.get(e.slug)??[]);e.token.attrSet(`id`,ld(t,i))})}function fd(e=``){let t=String(e).split(/<br\s*\/?>/i);return t.length===1?sd(e):t.map(e=>sd(e)).join(`<br>`)}function pd({key:e,sourceAttributes:t,sourceHash:n,sourceText:r}){return`<div class="mermaid-shell diagram-preview-shell"${t} data-mermaid-key="${K(e)}" data-mermaid-source-hash="${K(n)}"><div class="mermaid-placeholder-card diagram-preview-placeholder-card"><div class="mermaid-placeholder-copy diagram-preview-placeholder-copy"><strong>Mermaid diagram</strong><span>Loads when visible</span></div><button type="button" class="mermaid-placeholder-btn diagram-preview-placeholder-btn" data-mermaid-key="${K(e)}">Render</button></div><pre class="mermaid-source" hidden>${K(r)}</pre></div>`}function md({embedKey:e,label:t,target:n}){return`<span class="mermaid-shell diagram-preview-shell" data-mermaid-key="${K(e)}" data-mermaid-target="${K(n)}" data-mermaid-label="${K(t)}"><span class="mermaid-placeholder-card diagram-preview-placeholder-card"><span class="mermaid-placeholder-copy diagram-preview-placeholder-copy"><strong>${K(t)}</strong><span>Loads when visible</span></span><button type="button" class="mermaid-placeholder-btn diagram-preview-placeholder-btn" data-mermaid-key="${K(e)}">Render</button></span><span class="mermaid-source" hidden></span></span>`}function hd({key:e,sourceAttributes:t,sourceHash:n,sourceText:r}){return`<div class="plantuml-shell diagram-preview-shell"${t} data-plantuml-key="${K(e)}" data-plantuml-source-hash="${K(n)}"><div class="plantuml-placeholder-card diagram-preview-placeholder-card"><div class="plantuml-placeholder-copy diagram-preview-placeholder-copy"><strong>PlantUML diagram</strong><span>Renders server-side when visible</span></div><button type="button" class="plantuml-placeholder-btn diagram-preview-placeholder-btn" data-plantuml-key="${K(e)}">Render</button></div><pre class="plantuml-source" hidden>${K(r)}</pre></div>`}function gd({embedKey:e,label:t,target:n}){return`<span class="plantuml-shell diagram-preview-shell" data-plantuml-key="${K(e)}" data-plantuml-target="${K(n)}" data-plantuml-label="${K(t)}"><span class="plantuml-placeholder-card diagram-preview-placeholder-card"><span class="plantuml-placeholder-copy diagram-preview-placeholder-copy"><strong>${K(t)}</strong><span>Renders server-side when visible</span></span><button type="button" class="plantuml-placeholder-btn diagram-preview-placeholder-btn" data-plantuml-key="${K(e)}">Render</button></span><span class="plantuml-source" hidden></span></span>`}function _d({embedKey:e,label:t,target:n}){return`<span class="excalidraw-embed-placeholder diagram-preview-shell" data-embed-key="${K(e)}" data-embed-target="${K(n)}" data-embed-label="${K(t)}"><span class="excalidraw-embed-placeholder-card diagram-preview-placeholder-card"><span class="excalidraw-embed-placeholder-copy diagram-preview-placeholder-copy"><strong>${K(t)}</strong><span>Loads when visible</span></span><button type="button" class="excalidraw-embed-placeholder-btn diagram-preview-placeholder-btn" data-embed-key="${K(e)}">Load diagram</button></span></span>`}function vd({embedKey:e,label:t,target:n}){return`<span class="drawio-embed-placeholder diagram-preview-shell" data-drawio-key="${K(e)}" data-drawio-target="${K(n)}" data-drawio-label="${K(t)}" data-drawio-mode="view"><span class="drawio-embed-placeholder-card diagram-preview-placeholder-card"><span class="drawio-embed-placeholder-copy diagram-preview-placeholder-copy"><strong>${K(t)}</strong><span>Loads when visible</span></span><button type="button" class="drawio-embed-placeholder-btn diagram-preview-placeholder-btn" data-drawio-key="${K(e)}">Load diagram</button></span></span>`}function yd({key:e,sourceAttributes:t,sourceFilePath:n,sourceText:r,viewName:i=``}){let a=n?` data-base-source-path="${K(n)}"`:``,o=i?` data-base-view="${K(i)}"`:``;return`<div class="bases-embed-placeholder diagram-preview-shell"${t} data-base-key="${K(e)}" data-base-source="${K(r)}"${a}${o}><div class="diagram-preview-placeholder-card"><div class="diagram-preview-placeholder-copy"><strong>Base view</strong><span>Loads query results when preview renders</span></div></div></div>`}function bd({embedKey:e,label:t,target:n,viewName:r=``,sourceFilePath:i=``}){let a=i?` data-base-source-path="${K(i)}"`:``,o=r?` data-base-view="${K(r)}"`:``;return`<span class="bases-embed-placeholder diagram-preview-shell" data-base-key="${K(e)}" data-base-path="${K(n)}" data-base-label="${K(t)}"${o}${a}><span class="diagram-preview-placeholder-card"><span class="diagram-preview-placeholder-copy"><strong>${K(t)}</strong><span>Loads query results when preview renders</span></span></span></span>`}function xd(e=``){let t=e.toLowerCase().match(/\.(mp4|ogg|webm)$/i);return t&&nd[`.${t[1].toLowerCase()}`]||null}function Sd(e=``){let t=String(e||``).trim();return/^[A-Za-z0-9_-]{11}$/.test(t)?t:null}function Cd(e){let t=e.hostname.toLowerCase(),n=null;return t===`youtu.be`||t===`www.youtu.be`?n=Sd(e.pathname.split(`/`).filter(Boolean)[0]||``):(t.includes(`youtube`)||t.includes(`youtube-nocookie`))&&(e.pathname===`/watch`?n=Sd(e.searchParams.get(`v`)||``):e.pathname.startsWith(`/embed/`)&&(n=Sd(e.pathname.split(`/`).filter(Boolean)[1]||``))),n?`https://www.youtube-nocookie.com/embed/${n}`:null}function wd(e=``){let t;try{t=new URL(String(e||``).trim())}catch{return null}if(t.protocol!==`https:`)return null;let n=t.hostname.toLowerCase();if(rd.has(n)){let e=Cd(t);return e?{embedUrl:e,type:`youtube`}:null}let r=xd(t.pathname);return r?{mimeType:r,sourceUrl:t.toString(),type:`direct-video`}:null}function Td({embedKey:e,kind:t,label:n,mimeType:r=``,originalUrl:i=``,source:a,url:o}){let s=t===`youtube`?`YouTube video`:`Video file`,c=r?` data-video-embed-mime-type="${K(r)}"`:``,l=i?` data-video-embed-original-url="${K(i)}"`:``;return`<span class="video-embed-placeholder video-embed-shell diagram-preview-shell" data-video-embed-key="${K(e)}" data-video-embed-kind="${K(t)}" data-video-embed-label="${K(n)}" data-video-embed-source="${K(a)}" data-video-embed-url="${K(o)}"${c}${l}><span class="video-embed-placeholder-card diagram-preview-placeholder-card"><span class="video-embed-placeholder-copy diagram-preview-placeholder-copy"><strong>${K(n)}</strong><span>${K(s)}</span></span></span></span>`}function Ed(e,t){let n=e.attrGet(`src`)||``,r=wd(n);if(!r)return null;let i=od(e.content||e.attrGet(`title`)||``),a=r.type===`youtube`?r.embedUrl:r.sourceUrl,o=t.get(a)??0;return t.set(a,o+1),Td({embedKey:`video-${ad(a)}-${o}`,kind:r.type,label:i||`Embedded video`,mimeType:r.mimeType,originalUrl:n,source:a,url:r.type===`youtube`?r.embedUrl:r.sourceUrl})}function Dd(e=``){let t=String(e??``).trim();return!t||t.startsWith(`data:`)||t.startsWith(`blob:`)||t.startsWith(`#`)||t.startsWith(`//`)||/^[a-zA-Z][a-zA-Z\d+.-]*:/u.test(t)||t.startsWith(`/`)}function Od(e=``,{attachmentApiPath:t,sourceFilePath:n}={}){if(!n||Dd(e))return null;let r=ss(n,e);return!r||!ns(r)?null:`${t}?path=${encodeURIComponent(r)}`}function kd(e,t){let n=e.attrIndex(t);n>=0&&e.attrs.splice(n,1)}function Ad(e,{baseEmbedCounts:t,drawioEmbedCounts:n,excalidrawEmbedCounts:r,fileList:i,mermaidEmbedCounts:a,plantUmlEmbedCounts:o,sourceFilePath:s=``}){let c=/!\[\[([^\]|#]+\.(?:base|excalidraw|drawio|mmd|mermaid|puml|plantuml))(?:#([^\]|]+))?(?:\|([^\]]+))?\]\]|\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/gi,l=0,u=``,d;for(;(d=c.exec(e))!==null;){if(d.index>l&&(u+=fd(e.slice(l,d.index))),d[1]){let e=d[1].trim(),i=(d[2]||``).trim(),c=(d[3]||e).trim();if(/\.base$/i.test(e)){let n=t.get(`${e}#${i}`)??0;t.set(`${e}#${i}`,n+1),u+=bd({embedKey:`${e}#${i||`default`}#${n}`,label:od(c.replace(/\.base$/i,``)),sourceFilePath:s,target:e,viewName:i})}else if(/\.excalidraw$/i.test(e)){let t=r.get(e)??0;r.set(e,t+1),u+=_d({embedKey:`${e}#${t}`,label:od(c.replace(/\.excalidraw$/i,``)),target:e})}else if(/\.drawio$/i.test(e)){let t=n.get(e)??0;n.set(e,t+1),u+=vd({embedKey:`${e}#${t}`,label:od(c.replace(/\.drawio$/i,``)),target:e})}else if(/\.(?:mmd|mermaid)$/i.test(e)){let t=a.get(e)??0;a.set(e,t+1),u+=md({embedKey:`${e}#${t}`,label:od(c.replace(/\.(?:mmd|mermaid)$/i,``)),target:e})}else{let t=o.get(e)??0;o.set(e,t+1),u+=gd({embedKey:`${e}#${t}`,label:od(c.replace(/\.(?:puml|plantuml)$/i,``)),target:e})}}else{let e=d[4].trim(),t=(d[5]||d[4]).trim(),n=as(e,i),r=n?`wiki-link`:`wiki-link wiki-link-new`,a=n?od(t):`Create "${e}"`;u+=`<a class="${r}" href="#" data-wiki-target="${K(e)}" title="${K(a)}">${sd(t)}</a>`}l=c.lastIndex}return l<e.length&&(u+=fd(e.slice(l))),u}function jd(e=[],{attachmentApiPath:t=`/api/attachment`,sourceFilePath:n=``}={}){let r=G({highlight(e,t){if(t===`mermaid`||t===`plantuml`||t===`puml`)return``;try{return t&&Wo.getLanguage(t)?Wo.highlight(e,{language:t}).value:Wo.highlightAuto(e).value}catch{return``}},html:!1,linkify:!0,typographer:!0});r.core.ruler.push(`collabmd-source-lines`,e=>{e.tokens.forEach(e=>{if(!e.map)return;let[t,n]=e.map,r=t+1,i=Math.max(n,t+1);(e.nesting===1||e.type===`fence`||e.type===`code_block`||e.type===`html_block`)&&(e.attrSet(`data-source-line`,String(r)),e.attrSet(`data-source-line-end`,String(i)))})}),r.core.ruler.push(`collabmd-heading-anchors`,e=>{dd(e)});let i=new Map,a=new Map,o=new Map,s=new Map,c=new Map,l=new Map,u=new Map,d=new Map,f=r.renderer.rules.fence,p=r.renderer.rules.image,m=r.renderer.rules.link_open,h=r.renderer.rules.table_open,g=r.renderer.rules.table_close;return r.renderer.rules.fence=(e,t,r,i,a)=>{let c=e[t],u=c.info?c.info.trim().toLowerCase():``,d=c.attrGet(`data-source-line`),p=c.attrGet(`data-source-line-end`),m=d?` data-source-line="${d}" data-source-line-end="${p}"`:``;if(u===`mermaid`){let e=ad(c.content),t=s.get(e)??0;return s.set(e,t+1),pd({key:`mermaid-${e}-${t}`,sourceAttributes:m,sourceHash:e,sourceText:c.content})}if(u===`plantuml`||u===`puml`){let e=ad(c.content),t=l.get(e)??0;return l.set(e,t+1),hd({key:`plantuml-${e}-${t}`,sourceAttributes:m,sourceHash:e,sourceText:c.content})}if(u===`base`){let e=ad(c.content),t=o.get(e)??0;return o.set(e,t+1),yd({key:`base-${e}-${t}`,sourceAttributes:m,sourceFilePath:n,sourceText:c.content})}let h=id(f,e,t,r,i,a);return d?h.replace(/^<pre/,`<pre data-source-line="${d}" data-source-line-end="${p}"`):h},r.renderer.rules.list_item_open=(e,t,n,r,i)=>{let a=e[t+2]?.content??``;return(a.startsWith(`[ ] `)||a.startsWith(`[x] `)||a.startsWith(`[X] `))&&e[t].attrJoin(`class`,`task-list-item`),i.renderToken(e,t,n)},r.renderer.rules.text=(t,r)=>{let s=t[r].content;return s.startsWith(`[x] `)||s.startsWith(`[X] `)?`<input type="checkbox" checked data-task-checkbox="true"> ${Ad(s.slice(4),{baseEmbedCounts:o,drawioEmbedCounts:i,excalidrawEmbedCounts:a,fileList:e,mermaidEmbedCounts:c,plantUmlEmbedCounts:u,sourceFilePath:n})}`:s.startsWith(`[ ] `)?`<input type="checkbox" data-task-checkbox="true"> ${Ad(s.slice(4),{baseEmbedCounts:o,drawioEmbedCounts:i,excalidrawEmbedCounts:a,fileList:e,mermaidEmbedCounts:c,plantUmlEmbedCounts:u,sourceFilePath:n})}`:Ad(s,{baseEmbedCounts:o,drawioEmbedCounts:i,excalidrawEmbedCounts:a,fileList:e,mermaidEmbedCounts:c,plantUmlEmbedCounts:u,sourceFilePath:n})},r.renderer.rules.link_open=(e,t,n,r,i)=>(e[t].attrGet(`href`)||``).startsWith(`#`)?(kd(e[t],`target`),kd(e[t],`rel`),id(m,e,t,n,r,i)):(e[t].attrSet(`target`,`_blank`),e[t].attrSet(`rel`,`noopener noreferrer`),id(m,e,t,n,r,i)),r.renderer.rules.image=(e,r,i,a,o)=>{let s=e[r],c=Od(s.attrGet(`src`)||``,{attachmentApiPath:t,sourceFilePath:n});return c&&s.attrSet(`src`,c),Ed(s,d)||id(p,e,r,i,a,o)},r.renderer.rules.table_open=(e,t,n,r,i)=>`<div class="table-wrapper">${id(h,e,t,n,r,i)}`,r.renderer.rules.table_close=(e,t,n,r,i)=>`${id(g,e,t,n,r,i)}</div>`,r}function Md({attachmentApiPath:e=`/api/attachment`,fileList:t=[],frontmatterCollapsed:n=!1,frontmatterInteractive:r=!1,markdownText:i=``,sourceFilePath:a=``}={}){let o=String(i),s=Gu(o),c=jd(t,{attachmentApiPath:e,sourceFilePath:a}),l=s?s.bodyMarkdown:o;return{html:`${$u(s,{collapsed:n,interactive:r})}${c.render(l)}`,stats:td(o)}}self.onmessage=e=>{let{attachmentApiPath:t,fileList:n,frontmatterCollapsed:r,frontmatterInteractive:i,markdownText:a,renderVersion:o,sourceFilePath:s}=e.data??{};try{let e=Md({attachmentApiPath:t,fileList:n,frontmatterCollapsed:r,frontmatterInteractive:i,markdownText:a,sourceFilePath:s});self.postMessage({html:e.html,renderVersion:o,stats:e.stats})}catch(e){self.postMessage({error:e instanceof Error?e.message:String(e),renderVersion:o})}}})();
|
|
59
|
+
`}function Wu(e=``){return String(e).replace(/\r$/,``)}function Gu(e=``){let t=String(e??``);if(!t.startsWith(`---`))return null;let n=Uu(t),r=t.split(/\r?\n/);if(Wu(r[0])!==`---`)return null;let i=-1;for(let e=1;e<r.length;e+=1)if(Wu(r[e])===`---`){i=e;break}if(i<0)return null;let a=r.slice(0,i+1).join(n),o=r.slice(1,i).join(n),s;try{s=Hu.load(o||`{}`)}catch{return null}let c=i+1;return{bodyMarkdown:[...Array.from({length:c},()=>``),...r.slice(i+1)].join(n),data:s??{},endLine:c,rawFrontmatter:a,startLine:1}}function Ku(e){return Object.prototype.toString.call(e)===`[object Object]`}function qu(e){return e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e instanceof Date}function Ju(e){return e instanceof Date?e.toISOString():e==null?`null`:String(e)}function Yu(e){return Hu.dump(e,{lineWidth:-1,noRefs:!0}).trim()}function Xu(e){return qu(e)?`<span class="frontmatter-value-text">${K(Ju(e))}</span>`:Array.isArray(e)&&e.every(e=>qu(e))?`<div class="frontmatter-value-list">${e.map(e=>`<span class="frontmatter-value-pill">${K(Ju(e))}</span>`).join(``)}</div>`:`<pre class="frontmatter-value-code"><code>${K(Yu(e))}</code></pre>`}function Zu(e){return Ku(e)?Object.entries(e):[[`value`,e]]}function Qu(e){return e.length===0?`No properties`:`${e.length} propert${e.length===1?`y`:`ies`} hidden`}function $u(e,{collapsed:t=!1,interactive:n=!1}={}){if(!e)return``;let r=Zu(e.data),i=n&&t,a=` data-source-line="${e.startLine}" data-source-line-end="${e.endLine}"${n?` data-collapsed="${i?`true`:`false`}"`:``}`,o=`frontmatter-body-${e.startLine}-${e.endLine}`,s=r.length===0?`<div class="frontmatter-empty">No properties</div>`:``,c=r.map(([e,t])=>`<div class="frontmatter-property"><dt class="frontmatter-key">${K(e)}</dt><dd class="frontmatter-value">${Xu(t)}</dd></div>`).join(``);return`<section class="frontmatter-block"${a}>${n?`<div class="frontmatter-header"><div class="frontmatter-label">Properties</div><button type="button" class="frontmatter-toggle" aria-controls="${o}" aria-expanded="${i?`false`:`true`}">${i?`Show`:`Hide`}</button></div>`:`<div class="frontmatter-label">Properties</div>`}${n?`<div class="frontmatter-summary"${i?``:` hidden`}>${K(Qu(r))}</div>`:``}<div${` class="frontmatter-content"${n?` id="${o}"`:``}${i?` hidden`:``}`}><dl class="frontmatter-properties">${c}</dl>${s}</div></section>`}function ed(e,t){return e.match(t)?.length??0}function td(e=``){let t=String(e),n=ed(t,/!\[\[[^\]]+\.(?:mmd|mermaid)(?:\|[^\]]+)?\]\]/gi),r=ed(t,/(^|\n)```(?:plantuml|puml)\b/gi),i=ed(t,/!\[\[[^\]]+\.(?:puml|plantuml)(?:\|[^\]]+)?\]\]/gi);return{chars:t.length,drawioEmbeds:ed(t,/!\[\[[^\]]+\.drawio(?:\|[^\]]+)?\]\]/gi),excalidrawEmbeds:ed(t,/!\[\[[^\]]+\.excalidraw(?:\|[^\]]+)?\]\]/gi),mermaidBlocks:ed(t,/(^|\n)```mermaid\b/gi)+n,plantumlBlocks:r+i}}let nd=Object.freeze({".mp4":`video/mp4`,".ogg":`video/ogg`,".webm":`video/webm`}),rd=new Set([`youtube.com`,`www.youtube.com`,`m.youtube.com`,`youtu.be`,`www.youtu.be`,`youtube-nocookie.com`,`www.youtube-nocookie.com`]);function id(e,t,n,r,i,a){return e?.(t,n,r,i,a)??a.renderToken(t,n,r)}function ad(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)}function od(e=``){return String(e).replace(/<->/g,`↔`).replace(/<=>/g,`⇔`).replace(/->/g,`→`).replace(/<-/g,`←`).replace(/=>/g,`⇒`)}function sd(e=``){return K(od(e))}function cd(e=``){return String(e??``).trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``)||`section`}function ld(e=``,t=new Map){let n=String(e??``).trim()||`section`,r=t.get(n)??0;return t.set(n,r+1),r===0?n:`${n}-${r}`}function ud(e,t=[]){if(!e?.slug)return`section`;if(t.length<=1)return e.slug;for(let n=1;n<=e.parentSlugs.length;n+=1){let r=[...e.parentSlugs.slice(-n),e.slug].join(`-`);if(t.every(t=>t===e?!0:[...t.parentSlugs.slice(-n),t.slug].join(`-`)!==r))return r}return e.slug}function dd(e){let t=[],n=[];e.tokens.forEach((r,i)=>{if(r.type!==`heading_open`||r.attrGet(`id`))return;let a=Number.parseInt(r.tag.slice(1),10);if(!Number.isFinite(a)||a<1)return;n.length=Math.max(a-1,0);let o=e.tokens[i+1],s=cd(o?.type===`inline`?o.content:``);t.push({parentSlugs:n.filter(Boolean),slug:s,token:r}),n[a-1]=s});let r=new Map;t.forEach(e=>{let t=r.get(e.slug)??[];t.push(e),r.set(e.slug,t)});let i=new Map;t.forEach(e=>{let t=ud(e,r.get(e.slug)??[]);e.token.attrSet(`id`,ld(t,i))})}function fd(e=``){let t=String(e).split(/<br\s*\/?>/i);return t.length===1?sd(e):t.map(e=>sd(e)).join(`<br>`)}function pd({key:e,sourceAttributes:t,sourceHash:n,sourceText:r}){return`<div class="mermaid-shell diagram-preview-shell"${t} data-mermaid-key="${K(e)}" data-mermaid-source-hash="${K(n)}"><div class="mermaid-placeholder-card diagram-preview-placeholder-card"><div class="mermaid-placeholder-copy diagram-preview-placeholder-copy"><strong>Mermaid diagram</strong><span>Loads when visible</span></div><button type="button" class="mermaid-placeholder-btn diagram-preview-placeholder-btn" data-mermaid-key="${K(e)}">Render</button></div><pre class="mermaid-source" hidden>${K(r)}</pre></div>`}function md({embedKey:e,label:t,target:n}){return`<span class="mermaid-shell diagram-preview-shell" data-mermaid-key="${K(e)}" data-mermaid-target="${K(n)}" data-mermaid-label="${K(t)}"><span class="mermaid-placeholder-card diagram-preview-placeholder-card"><span class="mermaid-placeholder-copy diagram-preview-placeholder-copy"><strong>${K(t)}</strong><span>Loads when visible</span></span><button type="button" class="mermaid-placeholder-btn diagram-preview-placeholder-btn" data-mermaid-key="${K(e)}">Render</button></span><span class="mermaid-source" hidden></span></span>`}function hd({key:e,sourceAttributes:t,sourceHash:n,sourceText:r}){return`<div class="plantuml-shell diagram-preview-shell"${t} data-plantuml-key="${K(e)}" data-plantuml-source-hash="${K(n)}"><div class="plantuml-placeholder-card diagram-preview-placeholder-card"><div class="plantuml-placeholder-copy diagram-preview-placeholder-copy"><strong>PlantUML diagram</strong><span>Renders server-side when visible</span></div><button type="button" class="plantuml-placeholder-btn diagram-preview-placeholder-btn" data-plantuml-key="${K(e)}">Render</button></div><pre class="plantuml-source" hidden>${K(r)}</pre></div>`}function gd({embedKey:e,label:t,target:n}){return`<span class="plantuml-shell diagram-preview-shell" data-plantuml-key="${K(e)}" data-plantuml-target="${K(n)}" data-plantuml-label="${K(t)}"><span class="plantuml-placeholder-card diagram-preview-placeholder-card"><span class="plantuml-placeholder-copy diagram-preview-placeholder-copy"><strong>${K(t)}</strong><span>Renders server-side when visible</span></span><button type="button" class="plantuml-placeholder-btn diagram-preview-placeholder-btn" data-plantuml-key="${K(e)}">Render</button></span><span class="plantuml-source" hidden></span></span>`}function _d({embedKey:e,label:t,target:n}){return`<span class="excalidraw-embed-placeholder diagram-preview-shell" data-embed-key="${K(e)}" data-embed-target="${K(n)}" data-embed-label="${K(t)}"><span class="excalidraw-embed-placeholder-card diagram-preview-placeholder-card"><span class="excalidraw-embed-placeholder-copy diagram-preview-placeholder-copy"><strong>${K(t)}</strong><span>Loads when visible</span></span><button type="button" class="excalidraw-embed-placeholder-btn diagram-preview-placeholder-btn" data-embed-key="${K(e)}">Load diagram</button></span></span>`}function vd({embedKey:e,label:t,target:n}){return`<span class="drawio-embed-placeholder diagram-preview-shell" data-drawio-key="${K(e)}" data-drawio-target="${K(n)}" data-drawio-label="${K(t)}" data-drawio-mode="view"><span class="drawio-embed-placeholder-card diagram-preview-placeholder-card"><span class="drawio-embed-placeholder-copy diagram-preview-placeholder-copy"><strong>${K(t)}</strong><span>Loads when visible</span></span><button type="button" class="drawio-embed-placeholder-btn diagram-preview-placeholder-btn" data-drawio-key="${K(e)}">Load diagram</button></span></span>`}function yd({key:e,sourceAttributes:t,sourceFilePath:n,sourceText:r,viewName:i=``}){let a=n?` data-base-source-path="${K(n)}"`:``,o=i?` data-base-view="${K(i)}"`:``;return`<div class="bases-embed-placeholder diagram-preview-shell"${t} data-base-key="${K(e)}" data-base-source="${K(r)}"${a}${o}><div class="diagram-preview-placeholder-card"><div class="diagram-preview-placeholder-copy"><strong>Base view</strong><span>Loads query results when preview renders</span></div></div></div>`}function bd({embedKey:e,label:t,target:n,viewName:r=``,sourceFilePath:i=``}){let a=i?` data-base-source-path="${K(i)}"`:``,o=r?` data-base-view="${K(r)}"`:``;return`<span class="bases-embed-placeholder diagram-preview-shell" data-base-key="${K(e)}" data-base-path="${K(n)}" data-base-label="${K(t)}"${o}${a}><span class="diagram-preview-placeholder-card"><span class="diagram-preview-placeholder-copy"><strong>${K(t)}</strong><span>Loads query results when preview renders</span></span></span></span>`}function xd(e=``){let t=e.toLowerCase().match(/\.(mp4|ogg|webm)$/i);return t&&nd[`.${t[1].toLowerCase()}`]||null}function Sd(e=``){let t=String(e||``).trim();return/^[A-Za-z0-9_-]{11}$/.test(t)?t:null}function Cd(e){let t=e.hostname.toLowerCase(),n=null;return t===`youtu.be`||t===`www.youtu.be`?n=Sd(e.pathname.split(`/`).filter(Boolean)[0]||``):(t.includes(`youtube`)||t.includes(`youtube-nocookie`))&&(e.pathname===`/watch`?n=Sd(e.searchParams.get(`v`)||``):e.pathname.startsWith(`/embed/`)&&(n=Sd(e.pathname.split(`/`).filter(Boolean)[1]||``))),n?`https://www.youtube-nocookie.com/embed/${n}`:null}function wd(e=``){let t;try{t=new URL(String(e||``).trim())}catch{return null}if(t.protocol!==`https:`)return null;let n=t.hostname.toLowerCase();if(rd.has(n)){let e=Cd(t);return e?{embedUrl:e,type:`youtube`}:null}let r=xd(t.pathname);return r?{mimeType:r,sourceUrl:t.toString(),type:`direct-video`}:null}function Td({embedKey:e,kind:t,label:n,mimeType:r=``,originalUrl:i=``,source:a,url:o}){let s=t===`youtube`?`YouTube video`:`Video file`,c=r?` data-video-embed-mime-type="${K(r)}"`:``,l=i?` data-video-embed-original-url="${K(i)}"`:``;return`<span class="video-embed-placeholder video-embed-shell diagram-preview-shell" data-video-embed-key="${K(e)}" data-video-embed-kind="${K(t)}" data-video-embed-label="${K(n)}" data-video-embed-source="${K(a)}" data-video-embed-url="${K(o)}"${c}${l}><span class="video-embed-placeholder-card diagram-preview-placeholder-card"><span class="video-embed-placeholder-copy diagram-preview-placeholder-copy"><strong>${K(n)}</strong><span>${K(s)}</span></span></span></span>`}function Ed(e,t){let n=e.attrGet(`src`)||``,r=wd(n);if(!r)return null;let i=od(e.content||e.attrGet(`title`)||``),a=r.type===`youtube`?r.embedUrl:r.sourceUrl,o=t.get(a)??0;return t.set(a,o+1),Td({embedKey:`video-${ad(a)}-${o}`,kind:r.type,label:i||`Embedded video`,mimeType:r.mimeType,originalUrl:n,source:a,url:r.type===`youtube`?r.embedUrl:r.sourceUrl})}function Dd(e=``){let t=String(e??``).trim();return!t||t.startsWith(`data:`)||t.startsWith(`blob:`)||t.startsWith(`#`)||t.startsWith(`//`)||/^[a-zA-Z][a-zA-Z\d+.-]*:/u.test(t)||t.startsWith(`/`)}function Od(e=``,{attachmentApiPath:t,sourceFilePath:n}={}){if(!n||Dd(e))return null;let r=ss(n,e);return!r||!ns(r)?null:`${t}?path=${encodeURIComponent(r)}`}function kd(e,t){let n=e.attrIndex(t);n>=0&&e.attrs.splice(n,1)}function Ad(e,{baseEmbedCounts:t,drawioEmbedCounts:n,excalidrawEmbedCounts:r,fileList:i,mermaidEmbedCounts:a,plantUmlEmbedCounts:o,sourceFilePath:s=``,wikiLinkAutoCreate:c=!0}){let l=/!\[\[([^\]|#]+\.(?:base|excalidraw|drawio|mmd|mermaid|puml|plantuml))(?:#([^\]|]+))?(?:\|([^\]]+))?\]\]|\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/gi,u=0,d=``,f;for(;(f=l.exec(e))!==null;){if(f.index>u&&(d+=fd(e.slice(u,f.index))),f[1]){let e=f[1].trim(),i=(f[2]||``).trim(),c=(f[3]||e).trim();if(/\.base$/i.test(e)){let n=t.get(`${e}#${i}`)??0;t.set(`${e}#${i}`,n+1),d+=bd({embedKey:`${e}#${i||`default`}#${n}`,label:od(c.replace(/\.base$/i,``)),sourceFilePath:s,target:e,viewName:i})}else if(/\.excalidraw$/i.test(e)){let t=r.get(e)??0;r.set(e,t+1),d+=_d({embedKey:`${e}#${t}`,label:od(c.replace(/\.excalidraw$/i,``)),target:e})}else if(/\.drawio$/i.test(e)){let t=n.get(e)??0;n.set(e,t+1),d+=vd({embedKey:`${e}#${t}`,label:od(c.replace(/\.drawio$/i,``)),target:e})}else if(/\.(?:mmd|mermaid)$/i.test(e)){let t=a.get(e)??0;a.set(e,t+1),d+=md({embedKey:`${e}#${t}`,label:od(c.replace(/\.(?:mmd|mermaid)$/i,``)),target:e})}else{let t=o.get(e)??0;o.set(e,t+1),d+=gd({embedKey:`${e}#${t}`,label:od(c.replace(/\.(?:puml|plantuml)$/i,``)),target:e})}}else{let e=f[4].trim(),t=(f[5]||f[4]).trim(),n=as(e,i),r=n?`wiki-link`:`wiki-link wiki-link-new`,a=n?od(t):c?`Create "${e}"`:`Missing "${e}"`;d+=`<a class="${r}" href="#" data-wiki-target="${K(e)}" title="${K(a)}">${sd(t)}</a>`}u=l.lastIndex}return u<e.length&&(d+=fd(e.slice(u))),d}function jd(e=[],{attachmentApiPath:t=`/api/attachment`,sourceFilePath:n=``,wikiLinkAutoCreate:r=!0}={}){let i=G({highlight(e,t){if(t===`mermaid`||t===`plantuml`||t===`puml`)return``;try{return t&&Wo.getLanguage(t)?Wo.highlight(e,{language:t}).value:Wo.highlightAuto(e).value}catch{return``}},html:!1,linkify:!0,typographer:!0});i.core.ruler.push(`collabmd-source-lines`,e=>{e.tokens.forEach(e=>{if(!e.map)return;let[t,n]=e.map,r=t+1,i=Math.max(n,t+1);(e.nesting===1||e.type===`fence`||e.type===`code_block`||e.type===`html_block`)&&(e.attrSet(`data-source-line`,String(r)),e.attrSet(`data-source-line-end`,String(i)))})}),i.core.ruler.push(`collabmd-heading-anchors`,e=>{dd(e)});let a=new Map,o=new Map,s=new Map,c=new Map,l=new Map,u=new Map,d=new Map,f=new Map,p=i.renderer.rules.fence,m=i.renderer.rules.image,h=i.renderer.rules.link_open,g=i.renderer.rules.table_open,_=i.renderer.rules.table_close;return i.renderer.rules.fence=(e,t,r,i,a)=>{let o=e[t],l=o.info?o.info.trim().toLowerCase():``,d=o.attrGet(`data-source-line`),f=o.attrGet(`data-source-line-end`),m=d?` data-source-line="${d}" data-source-line-end="${f}"`:``;if(l===`mermaid`){let e=ad(o.content),t=c.get(e)??0;return c.set(e,t+1),pd({key:`mermaid-${e}-${t}`,sourceAttributes:m,sourceHash:e,sourceText:o.content})}if(l===`plantuml`||l===`puml`){let e=ad(o.content),t=u.get(e)??0;return u.set(e,t+1),hd({key:`plantuml-${e}-${t}`,sourceAttributes:m,sourceHash:e,sourceText:o.content})}if(l===`base`){let e=ad(o.content),t=s.get(e)??0;return s.set(e,t+1),yd({key:`base-${e}-${t}`,sourceAttributes:m,sourceFilePath:n,sourceText:o.content})}let h=id(p,e,t,r,i,a);return d?h.replace(/^<pre/,`<pre data-source-line="${d}" data-source-line-end="${f}"`):h},i.renderer.rules.list_item_open=(e,t,n,r,i)=>{let a=e[t+2]?.content??``;return(a.startsWith(`[ ] `)||a.startsWith(`[x] `)||a.startsWith(`[X] `))&&e[t].attrJoin(`class`,`task-list-item`),i.renderToken(e,t,n)},i.renderer.rules.text=(t,i)=>{let c=t[i].content;return c.startsWith(`[x] `)||c.startsWith(`[X] `)?`<input type="checkbox" checked data-task-checkbox="true"> ${Ad(c.slice(4),{baseEmbedCounts:s,drawioEmbedCounts:a,excalidrawEmbedCounts:o,fileList:e,mermaidEmbedCounts:l,plantUmlEmbedCounts:d,sourceFilePath:n,wikiLinkAutoCreate:r})}`:c.startsWith(`[ ] `)?`<input type="checkbox" data-task-checkbox="true"> ${Ad(c.slice(4),{baseEmbedCounts:s,drawioEmbedCounts:a,excalidrawEmbedCounts:o,fileList:e,mermaidEmbedCounts:l,plantUmlEmbedCounts:d,sourceFilePath:n,wikiLinkAutoCreate:r})}`:Ad(c,{baseEmbedCounts:s,drawioEmbedCounts:a,excalidrawEmbedCounts:o,fileList:e,mermaidEmbedCounts:l,plantUmlEmbedCounts:d,sourceFilePath:n,wikiLinkAutoCreate:r})},i.renderer.rules.link_open=(e,t,n,r,i)=>(e[t].attrGet(`href`)||``).startsWith(`#`)?(kd(e[t],`target`),kd(e[t],`rel`),id(h,e,t,n,r,i)):(e[t].attrSet(`target`,`_blank`),e[t].attrSet(`rel`,`noopener noreferrer`),id(h,e,t,n,r,i)),i.renderer.rules.image=(e,r,i,a,o)=>{let s=e[r],c=Od(s.attrGet(`src`)||``,{attachmentApiPath:t,sourceFilePath:n});return c&&s.attrSet(`src`,c),Ed(s,f)||id(m,e,r,i,a,o)},i.renderer.rules.table_open=(e,t,n,r,i)=>`<div class="table-wrapper">${id(g,e,t,n,r,i)}`,i.renderer.rules.table_close=(e,t,n,r,i)=>`${id(_,e,t,n,r,i)}</div>`,i}function Md({attachmentApiPath:e=`/api/attachment`,fileList:t=[],frontmatterCollapsed:n=!1,frontmatterInteractive:r=!1,markdownText:i=``,sourceFilePath:a=``,wikiLinkAutoCreate:o=!0}={}){let s=String(i),c=Gu(s),l=jd(t,{attachmentApiPath:e,sourceFilePath:a,wikiLinkAutoCreate:o}),u=c?c.bodyMarkdown:s;return{html:`${$u(c,{collapsed:n,interactive:r})}${l.render(u)}`,stats:td(s)}}self.onmessage=e=>{let{attachmentApiPath:t,fileList:n,frontmatterCollapsed:r,frontmatterInteractive:i,markdownText:a,renderVersion:o,sourceFilePath:s,wikiLinkAutoCreate:c}=e.data??{};try{let e=Md({attachmentApiPath:t,fileList:n,frontmatterCollapsed:r,frontmatterInteractive:i,markdownText:a,sourceFilePath:s,wikiLinkAutoCreate:c});self.postMessage({html:e.html,renderVersion:o,stats:e.stats})}catch(e){self.postMessage({error:e instanceof Error?e.message:String(e),renderVersion:o})}}})();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){return e.endsWith(`/`)?e.slice(0,-1):e}function t(n){let r=e(String(n??``).trim());if(!r||r===`/`)return``;if(/^[a-zA-Z][a-zA-Z\d+.-]*:/u.test(r))try{return t(new URL(r).pathname)}catch{return``}return r.startsWith(`/`)?r:`/${r}`}function n(t,n){let r=e(String(t??``).trim());return!r||r===`/`?n:r.startsWith(`/`)?r:`/${r}`}function r(e,n){let r=t(e),i=String(n??``).trim();return i?/^[a-zA-Z][a-zA-Z\d+.-]*:/u.test(i)||r&&(i===r||i.startsWith(`${r}/`))?i:i===`/`?r||`/`:i.startsWith(`/`)?r?`${r}${i}`:i:r?`${r}/${i}`:`/${i}`:r||`/`}function i(){let e={auth:{enabled:!1,implemented:!0,loginEndpoint:`/api/auth/oidc/login`,provider:``,requiresLogin:!1,sessionEndpoint:`/api/auth/session`,statusEndpoint:`/api/auth/status`,strategy:`none`},basePath:``,build:{id:``,packageVersion:``},drawioBaseUrl:`https://embed.diagrams.net`,environment:`development`,gitEnabled:!0,publicWsBaseUrl:``,wikiLinkAutoCreate:!0,wsBasePath:`/ws`,...window.__COLLABMD_CONFIG__??{}},i=t(e.basePath),a={enabled:!1,implemented:!0,loginEndpoint:`/api/auth/oidc/login`,provider:``,requiresLogin:!1,sessionEndpoint:`/api/auth/session`,statusEndpoint:`/api/auth/status`,strategy:`none`,...e.auth??{}},o={id:``,packageVersion:``,...e.build??{}};return{...e,auth:{...a,loginEndpoint:r(i,a.loginEndpoint),sessionEndpoint:r(i,a.sessionEndpoint),statusEndpoint:r(i,a.statusEndpoint)},basePath:i,build:o,wsBasePath:n(e.wsBasePath,`/ws`)}}function a(e=`/`,t=i()){return r(t.basePath,e)}function o(e=`/`,t=i()){return new URL(a(e,t),window.location.origin).toString()}function s(e=`/`,t=i()){let n=String(e??``).trim();return!n||n===`/`?a(`/api`,t):n.startsWith(`/api`)?a(n,t):a(`/api${n.startsWith(`/`)?n:`/${n}`}`,t)}function c(t=i()){let n=new URLSearchParams(window.location.search).get(`server`);return n?e(n):t.publicWsBaseUrl?e(t.publicWsBaseUrl):`${window.location.protocol===`https:`?`wss:`:`ws:`}//${window.location.host}${a(t.wsBasePath,t)}`}var l=Object.freeze({authError:`auth_error`,authPassword:`auth_password`,file:`file`,gitCommit:`git-commit`,gitDiff:`git-diff`,gitFileHistory:`git-file-history`,gitFilePreview:`git-file-preview`,gitHistory:`git-history`});function u(e=``){let t=String(e??``),n=t.startsWith(`#`)?t.slice(1):t;return new URLSearchParams(n)}function d(e=``){let t=String(e??``);return t.startsWith(`#`)?t.slice(1):t}function f(e=``){if(!d(e).trim().includes(`=`))return!1;let t=u(e);return Object.values(l).some(e=>t.has(e))}function p(e,{drawioMode:t=null,anchor:n=null}={}){let r=new URLSearchParams;return e&&r.set(l.file,e),t&&r.set(`drawio`,t),n&&r.set(`anchor`,String(n).trim()),r.toString()}function m(){return i()}function h(){return u(window.location.hash)}function g(e){return e===`staged`||e===`all`||e===`working-tree`?e:`all`}function _(){let e=h();if(e.has(l.gitFilePreview)){let t=e.get(l.gitFilePreview)||null;return{currentFilePath:e.get(`current`)||t,filePath:t,hash:e.get(`hash`)||null,type:`git-file-preview`}}if(e.has(l.gitFileHistory))return{filePath:e.get(l.gitFileHistory)||null,type:`git-file-history`};if(e.has(l.gitHistory))return{type:`git-history`};if(e.has(l.gitCommit))return{hash:e.get(l.gitCommit)||null,historyFilePath:e.get(`history`)||null,path:e.get(`path`)||null,type:`git-commit`};if(e.has(l.gitDiff)){let t=e.get(l.gitDiff)||null;return{filePath:t,scope:g(e.get(`scope`)||(t?`working-tree`:`all`)),type:`git-diff`}}return e.has(l.file)?{anchor:e.get(`anchor`)||null,drawioMode:e.get(`drawio`)||null,filePath:e.get(l.file),type:`file`}:{type:`empty`}}function v(e,{drawioMode:t=null,anchor:n=null}={}){window.location.hash=p(e,{drawioMode:t,anchor:n})}function y({filePath:e=null,scope:t=`all`}={}){let n=new URLSearchParams;n.set(`git-diff`,e??``),n.set(`scope`,g(t)),window.location.hash=n.toString()}function b({hash:e,path:t=null,historyFilePath:n=null}={}){let r=String(e??``).trim(),i=new URLSearchParams;i.set(`git-commit`,r),n&&i.set(`history`,n),t&&i.set(`path`,t),window.location.hash=i.toString()}function x(){let e=new URLSearchParams;e.set(`git-history`,`1`),window.location.hash=e.toString()}function S({filePath:e}={}){let t=new URLSearchParams;t.set(`git-file-history`,e??``),window.location.hash=t.toString()}function C({hash:e,path:t,currentFilePath:n=null}={}){let r=String(e??``).trim(),i=new URLSearchParams;i.set(`git-file-preview`,t??``),n&&i.set(`current`,n),i.set(`hash`,r),window.location.hash=i.toString()}export{y as a,x as c,s as d,a as f,b as i,p as l,c as m,m as n,S as o,o as p,v as r,C as s,_ as t,f as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as e,n as t}from"./runtime-config-Bf8nxVez.js";var n={enabled:!1,implemented:!0,loginEndpoint:`/api/auth/oidc/login`,passwordLabel:`Password`,provider:``,requiresLogin:!1,sessionEndpoint:`/api/auth/session`,statusEndpoint:`/api/auth/status`,strategy:`none`,submitLabel:`Continue`},r=`data:image/png;base64,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`;function i(){return{...n,...t().auth??{}}}function a(){let e=window.location.hash.startsWith(`#`)?window.location.hash.slice(1):window.location.hash;return new URLSearchParams(e)}function o(){return a().get(`auth_password`)||``}function s(){let e=a();if(!e.has(`auth_password`))return;e.delete(`auth_password`);let t=e.toString(),n=`${window.location.pathname}${window.location.search}${t?`#${t}`:``}`;window.history.replaceState(null,``,n)}function c(e){let t=a(),n=t.get(e)||``;if(!n)return``;t.delete(e);let r=t.toString(),i=`${window.location.pathname}${window.location.search}${r?`#${r}`:``}`;return window.history.replaceState(null,``,i),n}function l(){return`${window.location.pathname}${window.location.search}${window.location.hash}`}async function u(e){let t=await fetch(e.statusEndpoint,{headers:{Accept:`application/json`}}),n=await t.json().catch(()=>({}));if(!t.ok)throw Error(n.error||`Failed to read auth status`);return n}function d(e){let t=e?.auth??{};if(t.strategy!==`oidc`||t.provider!==`google`)return;let n=String(e?.user?.name??``).trim();if(n)try{window.localStorage.setItem(`collabmd-user-name`,n)}catch{}}async function f(e,t){let n=await fetch(e.sessionEndpoint,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({password:t})}),r=await n.json().catch(()=>({}));if(!n.ok)throw Error(r.error||`Authentication failed`);return r}function p(){let e=document.createElement(`div`);e.className=`auth-gate-overlay`;let t=document.createElement(`section`);return t.className=`auth-gate-card`,e.append(t),{card:t,overlay:e}}function m(){let e=document.createElement(`span`);e.className=`auth-gate-button__icon`,e.setAttribute(`aria-hidden`,`true`);let t=document.createElement(`img`);return t.alt=``,t.decoding=`async`,t.height=20,t.loading=`eager`,t.src=r,t.width=20,e.append(t),e}function h(e,t,{errorMessage:n=``}){e.replaceChildren();let r=document.createElement(`h1`);r.textContent=`Authentication required`;let i=document.createElement(`p`);i.textContent=`Sign in with Google to join this session.`;let a=document.createElement(`div`);a.className=`auth-gate-actions`;let o=document.createElement(`button`);o.className=`ui-button ui-button--secondary auth-gate-button auth-gate-button--google`,o.type=`button`,o.append(m(),document.createTextNode(t.submitLabel||`Continue with Google`));let s=document.createElement(`div`);s.className=`auth-gate-error`,s.textContent=n,a.append(o),e.append(r,i,s,a),o.addEventListener(`click`,()=>{let e=new URL(t.loginEndpoint,window.location.origin);e.searchParams.set(`returnTo`,l()),window.location.assign(e.toString())})}function g(e,{title:t,body:n,secondaryActionLabel:r=``,onSecondaryAction:i=null}){e.replaceChildren();let a=document.createElement(`h1`);a.textContent=t;let o=document.createElement(`p`);if(o.textContent=n,e.append(a,o),r&&typeof i==`function`){let t=document.createElement(`button`);t.className=`ui-button ui-button--secondary auth-gate-secondary-button`,t.type=`button`,t.textContent=r,t.addEventListener(`click`,()=>{i()}),e.append(t)}}function _(e,t,{onSubmit:n}){e.replaceChildren();let r=document.createElement(`h1`);r.textContent=`Authentication required`;let i=document.createElement(`p`);i.textContent=`Enter the host password to join this shared session.`;let a=document.createElement(`form`);a.className=`auth-gate-form`;let o=document.createElement(`label`);o.className=`auth-gate-label`,o.textContent=t.passwordLabel;let s=document.createElement(`input`);s.className=`ui-input auth-gate-input`,s.type=`password`,s.name=`password`,s.autocomplete=`current-password`,s.required=!0;let c=document.createElement(`div`);c.className=`auth-gate-error`;let l=document.createElement(`div`);l.className=`auth-gate-actions`;let u=document.createElement(`button`);u.className=`ui-button ui-button--primary auth-gate-button`,u.type=`submit`,u.textContent=t.submitLabel,l.append(u),o.append(s),a.append(r,i,o,c,l),e.append(a),a.addEventListener(`submit`,e=>{e.preventDefault();let t=s.value;s.disabled=!0,u.disabled=!0,c.textContent=``,n(t).catch(e=>{c.textContent=e instanceof Error?e.message:`Authentication failed`,s.disabled=!1,u.disabled=!1,s.select(),s.focus()})}),queueMicrotask(()=>{s.focus()})}async function v(){let e=i();if(!e.enabled||e.strategy===`none`)return{authenticated:!0,auth:e};let{card:t,overlay:n}=p();document.body.append(n);let r=c(`auth_error`);return new Promise(i=>{let a=(t=null)=>{s(),d(t),n.remove(),i({authenticated:!0,auth:t?.auth??e,user:t?.user??null})};(async()=>{g(t,{body:`Checking access to this session…`,title:`CollabMD`});try{let t=await u(e);if(t.authenticated){a(t);return}}catch(e){g(t,{body:e instanceof Error?`${e.message} Refresh the page and try again.`:`Failed to contact the auth service. Refresh the page and try again.`,title:`Cannot verify access`});return}if(e.strategy===`password`){let n=o();if(n)try{s(),await f(e,n),a();return}catch{}_(t,e,{onSubmit:async t=>{await f(e,t),a()}});return}if(e.strategy===`oidc`){h(t,e,{errorMessage:r}),r=``;return}g(t,{body:`This authentication strategy is not available.`,title:`Authentication unavailable`})})()})}function y(e){return!e||e.repeat||!e.metaKey&&!e.ctrlKey||e.shiftKey||e.altKey?!1:String(e.key??``).toLowerCase()===`k`||e.code===`KeyK`}function b(e){return encodeURIComponent(String(e??``))}function x(e){return String(e??``).replace(/\/+$/u,``).split(`/`).filter(Boolean).pop()||``}function S(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,document.body.appendChild(r),r.click(),r.remove(),window.setTimeout(()=>URL.revokeObjectURL(n),0)}function C(e=``,t=`download`){let n=String(e).match(/filename\*=UTF-8''([^;]+)/iu);if(n)try{return decodeURIComponent(n[1])}catch{return t}return String(e).match(/filename="([^"]+)"/iu)?.[1]||t}function w(e,t={}){let n={...t};return e&&(n[`X-CollabMD-Request-Id`]=String(e)),n}async function T(e,t){let n=await e.json().catch(()=>({}));if(!e.ok||n.ok===!1){let r=Error(n.error||t);throw r.status=e.status,r.body=n,r}return n}async function E(e,{fallbackError:t,fallbackFileName:n}={}){let r=await fetch(e);if(!r.ok){let e=await r.json().catch(()=>({}));throw Error(e.error||t)}return S(await r.blob(),C(r.headers.get(`content-disposition`)||``,n)),r}var D=new class{async readTree(){return T(await fetch(e(`/files`)),`Failed to load file tree`)}async readFile(t){return T(await fetch(e(`/file?path=${encodeURIComponent(t)}`)),`Failed to read file`)}async queryBase({activeFilePath:t=``,path:n=``,search:r=``,source:i=null,sourcePath:a=``,view:o=``}={}){return T(await fetch(e(`/base/query`),{body:JSON.stringify({activeFilePath:t,path:n,search:r,source:i,sourcePath:a,view:o}),headers:{"Content-Type":`application/json`},method:`POST`}),`Failed to query base`)}async exportBaseCsv({activeFilePath:t=``,path:n=``,search:r=``,source:i=null,sourcePath:a=``,view:o=``}={}){let s=await fetch(e(`/base/export`),{body:JSON.stringify({activeFilePath:t,path:n,search:r,source:i,sourcePath:a,view:o}),headers:{"Content-Type":`application/json`},method:`POST`});if(!s.ok){let e=await s.json().catch(()=>({}));throw Error(e.error||`Failed to export base CSV`)}return{blob:await s.blob(),contentDisposition:s.headers.get(`content-disposition`)||``}}async queryBasePropertyValues({activeFilePath:t=``,path:n=``,propertyId:r=``,query:i=``,source:a=null,sourcePath:o=``,view:s=``}={}){return T(await fetch(e(`/base/property-values`),{body:JSON.stringify({activeFilePath:t,path:n,propertyId:r,query:i,source:a,sourcePath:o,view:s}),headers:{"Content-Type":`application/json`},method:`POST`}),`Failed to load base property values`)}async transformBase({activeFilePath:t=``,mutation:n=null,path:r=``,source:i=null,sourcePath:a=``,view:o=``}={}){return T(await fetch(e(`/base/transform`),{body:JSON.stringify({activeFilePath:t,mutation:n,path:r,source:i,sourcePath:a,view:o}),headers:{"Content-Type":`application/json`},method:`POST`}),`Failed to transform base`)}async createFile({content:t,path:n,requestId:r=null}){return T(await fetch(e(`/file`),{body:JSON.stringify({content:t,path:n}),headers:w(r,{"Content-Type":`application/json`}),method:`POST`}),`Failed to create file`)}async writeFile({content:t,path:n,requestId:r=null}){return T(await fetch(e(`/file`),{body:JSON.stringify({content:t,path:n}),headers:w(r,{"Content-Type":`application/json`}),method:`PUT`}),`Failed to write file`)}async renameFile({oldPath:t,newPath:n,requestId:r=null}){return T(await fetch(e(`/file`),{body:JSON.stringify({newPath:n,oldPath:t}),headers:w(r,{"Content-Type":`application/json`}),method:`PATCH`}),`Failed to rename file`)}async deleteFile(t,{requestId:n=null}={}){return T(await fetch(e(`/file?path=${encodeURIComponent(t)}`),{headers:n?w(n):void 0,method:`DELETE`}),`Failed to delete file`)}async createDirectory(t,{requestId:n=null}={}){return T(await fetch(e(`/directory`),{body:JSON.stringify({path:t}),headers:w(n,{"Content-Type":`application/json`}),method:`POST`}),`Failed to create folder`)}async renameDirectory({oldPath:t,newPath:n,requestId:r=null}){return T(await fetch(e(`/directory`),{body:JSON.stringify({newPath:n,oldPath:t}),headers:w(r,{"Content-Type":`application/json`}),method:`PATCH`}),`Failed to rename folder`)}async deleteDirectory(t,{recursive:n=!1,requestId:r=null}={}){let i=new URLSearchParams({path:String(t??``)});return n&&i.set(`recursive`,`1`),T(await fetch(e(`/directory?${i.toString()}`),{headers:r?w(r):void 0,method:`DELETE`}),`Failed to delete folder`)}async uploadImageAttachment({file:t,fileName:n=``,sourcePath:r}){return T(await fetch(e(`/attachments`),{body:t,headers:{"Content-Type":t?.type||`application/octet-stream`,"X-CollabMD-File-Name":b(n),"X-CollabMD-Source-Path":b(r)},method:`POST`}),`Failed to upload image`)}async downloadFile(t){let n=x(t)||`download`;return E(e(`/download/file?path=${encodeURIComponent(t)}`),{fallbackError:`Failed to download file`,fallbackFileName:n})}async downloadDirectory(t){let n=x(t)||`vault`;return E(e(`/download/directory?path=${encodeURIComponent(t)}`),{fallbackError:`Failed to download folder`,fallbackFileName:`${n}.zip`})}};export{y as n,v as r,D as t};
|
|
1
|
+
import{d as e,n as t}from"./runtime-config-BcUbZKho.js";var n={enabled:!1,implemented:!0,loginEndpoint:`/api/auth/oidc/login`,passwordLabel:`Password`,provider:``,requiresLogin:!1,sessionEndpoint:`/api/auth/session`,statusEndpoint:`/api/auth/status`,strategy:`none`,submitLabel:`Continue`},r=`data:image/png;base64,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`;function i(){return{...n,...t().auth??{}}}function a(){let e=window.location.hash.startsWith(`#`)?window.location.hash.slice(1):window.location.hash;return new URLSearchParams(e)}function o(){return a().get(`auth_password`)||``}function s(){let e=a();if(!e.has(`auth_password`))return;e.delete(`auth_password`);let t=e.toString(),n=`${window.location.pathname}${window.location.search}${t?`#${t}`:``}`;window.history.replaceState(null,``,n)}function c(e){let t=a(),n=t.get(e)||``;if(!n)return``;t.delete(e);let r=t.toString(),i=`${window.location.pathname}${window.location.search}${r?`#${r}`:``}`;return window.history.replaceState(null,``,i),n}function l(){return`${window.location.pathname}${window.location.search}${window.location.hash}`}async function u(e){let t=await fetch(e.statusEndpoint,{headers:{Accept:`application/json`}}),n=await t.json().catch(()=>({}));if(!t.ok)throw Error(n.error||`Failed to read auth status`);return n}function d(e){let t=e?.auth??{};if(t.strategy!==`oidc`||t.provider!==`google`)return;let n=String(e?.user?.name??``).trim();if(n)try{window.localStorage.setItem(`collabmd-user-name`,n)}catch{}}async function f(e,t){let n=await fetch(e.sessionEndpoint,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({password:t})}),r=await n.json().catch(()=>({}));if(!n.ok)throw Error(r.error||`Authentication failed`);return r}function p(){let e=document.createElement(`div`);e.className=`auth-gate-overlay`;let t=document.createElement(`section`);return t.className=`auth-gate-card`,e.append(t),{card:t,overlay:e}}function m(){let e=document.createElement(`span`);e.className=`auth-gate-button__icon`,e.setAttribute(`aria-hidden`,`true`);let t=document.createElement(`img`);return t.alt=``,t.decoding=`async`,t.height=20,t.loading=`eager`,t.src=r,t.width=20,e.append(t),e}function h(e,t,{errorMessage:n=``}){e.replaceChildren();let r=document.createElement(`h1`);r.textContent=`Authentication required`;let i=document.createElement(`p`);i.textContent=`Sign in with Google to join this session.`;let a=document.createElement(`div`);a.className=`auth-gate-actions`;let o=document.createElement(`button`);o.className=`ui-button ui-button--secondary auth-gate-button auth-gate-button--google`,o.type=`button`,o.append(m(),document.createTextNode(t.submitLabel||`Continue with Google`));let s=document.createElement(`div`);s.className=`auth-gate-error`,s.textContent=n,a.append(o),e.append(r,i,s,a),o.addEventListener(`click`,()=>{let e=new URL(t.loginEndpoint,window.location.origin);e.searchParams.set(`returnTo`,l()),window.location.assign(e.toString())})}function g(e,{title:t,body:n,secondaryActionLabel:r=``,onSecondaryAction:i=null}){e.replaceChildren();let a=document.createElement(`h1`);a.textContent=t;let o=document.createElement(`p`);if(o.textContent=n,e.append(a,o),r&&typeof i==`function`){let t=document.createElement(`button`);t.className=`ui-button ui-button--secondary auth-gate-secondary-button`,t.type=`button`,t.textContent=r,t.addEventListener(`click`,()=>{i()}),e.append(t)}}function _(e,t,{onSubmit:n}){e.replaceChildren();let r=document.createElement(`h1`);r.textContent=`Authentication required`;let i=document.createElement(`p`);i.textContent=`Enter the host password to join this shared session.`;let a=document.createElement(`form`);a.className=`auth-gate-form`;let o=document.createElement(`label`);o.className=`auth-gate-label`,o.textContent=t.passwordLabel;let s=document.createElement(`input`);s.className=`ui-input auth-gate-input`,s.type=`password`,s.name=`password`,s.autocomplete=`current-password`,s.required=!0;let c=document.createElement(`div`);c.className=`auth-gate-error`;let l=document.createElement(`div`);l.className=`auth-gate-actions`;let u=document.createElement(`button`);u.className=`ui-button ui-button--primary auth-gate-button`,u.type=`submit`,u.textContent=t.submitLabel,l.append(u),o.append(s),a.append(r,i,o,c,l),e.append(a),a.addEventListener(`submit`,e=>{e.preventDefault();let t=s.value;s.disabled=!0,u.disabled=!0,c.textContent=``,n(t).catch(e=>{c.textContent=e instanceof Error?e.message:`Authentication failed`,s.disabled=!1,u.disabled=!1,s.select(),s.focus()})}),queueMicrotask(()=>{s.focus()})}async function v(){let e=i();if(!e.enabled||e.strategy===`none`)return{authenticated:!0,auth:e};let{card:t,overlay:n}=p();document.body.append(n);let r=c(`auth_error`);return new Promise(i=>{let a=(t=null)=>{s(),d(t),n.remove(),i({authenticated:!0,auth:t?.auth??e,user:t?.user??null})};(async()=>{g(t,{body:`Checking access to this session…`,title:`CollabMD`});try{let t=await u(e);if(t.authenticated){a(t);return}}catch(e){g(t,{body:e instanceof Error?`${e.message} Refresh the page and try again.`:`Failed to contact the auth service. Refresh the page and try again.`,title:`Cannot verify access`});return}if(e.strategy===`password`){let n=o();if(n)try{s(),await f(e,n),a();return}catch{}_(t,e,{onSubmit:async t=>{await f(e,t),a()}});return}if(e.strategy===`oidc`){h(t,e,{errorMessage:r}),r=``;return}g(t,{body:`This authentication strategy is not available.`,title:`Authentication unavailable`})})()})}function y(e){return!e||e.repeat||!e.metaKey&&!e.ctrlKey||e.shiftKey||e.altKey?!1:String(e.key??``).toLowerCase()===`k`||e.code===`KeyK`}function b(e){return encodeURIComponent(String(e??``))}function x(e){return String(e??``).replace(/\/+$/u,``).split(`/`).filter(Boolean).pop()||``}function S(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,document.body.appendChild(r),r.click(),r.remove(),window.setTimeout(()=>URL.revokeObjectURL(n),0)}function C(e=``,t=`download`){let n=String(e).match(/filename\*=UTF-8''([^;]+)/iu);if(n)try{return decodeURIComponent(n[1])}catch{return t}return String(e).match(/filename="([^"]+)"/iu)?.[1]||t}function w(e,t={}){let n={...t};return e&&(n[`X-CollabMD-Request-Id`]=String(e)),n}async function T(e,t){let n=await e.json().catch(()=>({}));if(!e.ok||n.ok===!1){let r=Error(n.error||t);throw r.status=e.status,r.body=n,r}return n}async function E(e,{fallbackError:t,fallbackFileName:n}={}){let r=await fetch(e);if(!r.ok){let e=await r.json().catch(()=>({}));throw Error(e.error||t)}return S(await r.blob(),C(r.headers.get(`content-disposition`)||``,n)),r}var D=new class{async readTree(){return T(await fetch(e(`/files`)),`Failed to load file tree`)}async readFile(t){return T(await fetch(e(`/file?path=${encodeURIComponent(t)}`)),`Failed to read file`)}async queryBase({activeFilePath:t=``,path:n=``,search:r=``,source:i=null,sourcePath:a=``,view:o=``}={}){return T(await fetch(e(`/base/query`),{body:JSON.stringify({activeFilePath:t,path:n,search:r,source:i,sourcePath:a,view:o}),headers:{"Content-Type":`application/json`},method:`POST`}),`Failed to query base`)}async exportBaseCsv({activeFilePath:t=``,path:n=``,search:r=``,source:i=null,sourcePath:a=``,view:o=``}={}){let s=await fetch(e(`/base/export`),{body:JSON.stringify({activeFilePath:t,path:n,search:r,source:i,sourcePath:a,view:o}),headers:{"Content-Type":`application/json`},method:`POST`});if(!s.ok){let e=await s.json().catch(()=>({}));throw Error(e.error||`Failed to export base CSV`)}return{blob:await s.blob(),contentDisposition:s.headers.get(`content-disposition`)||``}}async queryBasePropertyValues({activeFilePath:t=``,path:n=``,propertyId:r=``,query:i=``,source:a=null,sourcePath:o=``,view:s=``}={}){return T(await fetch(e(`/base/property-values`),{body:JSON.stringify({activeFilePath:t,path:n,propertyId:r,query:i,source:a,sourcePath:o,view:s}),headers:{"Content-Type":`application/json`},method:`POST`}),`Failed to load base property values`)}async transformBase({activeFilePath:t=``,mutation:n=null,path:r=``,source:i=null,sourcePath:a=``,view:o=``}={}){return T(await fetch(e(`/base/transform`),{body:JSON.stringify({activeFilePath:t,mutation:n,path:r,source:i,sourcePath:a,view:o}),headers:{"Content-Type":`application/json`},method:`POST`}),`Failed to transform base`)}async createFile({content:t,path:n,requestId:r=null}){return T(await fetch(e(`/file`),{body:JSON.stringify({content:t,path:n}),headers:w(r,{"Content-Type":`application/json`}),method:`POST`}),`Failed to create file`)}async writeFile({content:t,path:n,requestId:r=null}){return T(await fetch(e(`/file`),{body:JSON.stringify({content:t,path:n}),headers:w(r,{"Content-Type":`application/json`}),method:`PUT`}),`Failed to write file`)}async renameFile({oldPath:t,newPath:n,requestId:r=null}){return T(await fetch(e(`/file`),{body:JSON.stringify({newPath:n,oldPath:t}),headers:w(r,{"Content-Type":`application/json`}),method:`PATCH`}),`Failed to rename file`)}async deleteFile(t,{requestId:n=null}={}){return T(await fetch(e(`/file?path=${encodeURIComponent(t)}`),{headers:n?w(n):void 0,method:`DELETE`}),`Failed to delete file`)}async createDirectory(t,{requestId:n=null}={}){return T(await fetch(e(`/directory`),{body:JSON.stringify({path:t}),headers:w(n,{"Content-Type":`application/json`}),method:`POST`}),`Failed to create folder`)}async renameDirectory({oldPath:t,newPath:n,requestId:r=null}){return T(await fetch(e(`/directory`),{body:JSON.stringify({newPath:n,oldPath:t}),headers:w(r,{"Content-Type":`application/json`}),method:`PATCH`}),`Failed to rename folder`)}async deleteDirectory(t,{recursive:n=!1,requestId:r=null}={}){let i=new URLSearchParams({path:String(t??``)});return n&&i.set(`recursive`,`1`),T(await fetch(e(`/directory?${i.toString()}`),{headers:r?w(r):void 0,method:`DELETE`}),`Failed to delete folder`)}async uploadImageAttachment({file:t,fileName:n=``,sourcePath:r}){return T(await fetch(e(`/attachments`),{body:t,headers:{"Content-Type":t?.type||`application/octet-stream`,"X-CollabMD-File-Name":b(n),"X-CollabMD-Source-Path":b(r)},method:`POST`}),`Failed to upload image`)}async downloadFile(t){let n=x(t)||`download`;return E(e(`/download/file?path=${encodeURIComponent(t)}`),{fallbackError:`Failed to download file`,fallbackFileName:n})}async downloadDirectory(t){let n=x(t)||`vault`;return E(e(`/download/directory?path=${encodeURIComponent(t)}`),{fallbackError:`Failed to download folder`,fallbackFileName:`${n}.zip`})}};export{y as n,v as r,D as t};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8">
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>draw.io — CollabMD</title>
|
|
7
|
-
<script type="module" crossorigin src="./assets/drawioEditor-
|
|
7
|
+
<script type="module" crossorigin src="./assets/drawioEditor-DOaXwaY2.js"></script>
|
|
8
8
|
<link rel="modulepreload" crossorigin href="./assets/runtime-config-loader-_D2KZKn-.js">
|
|
9
9
|
<link rel="modulepreload" crossorigin href="./assets/preload-helper-Bo9GmnuQ.js">
|
|
10
10
|
</head>
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8">
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>Excalidraw — CollabMD</title>
|
|
7
|
-
<script type="module" crossorigin src="./assets/excalidrawEditor-
|
|
7
|
+
<script type="module" crossorigin src="./assets/excalidrawEditor-Ck9hgrTa.js"></script>
|
|
8
8
|
<link rel="modulepreload" crossorigin href="./assets/runtime-config-loader-_D2KZKn-.js">
|
|
9
9
|
<link rel="modulepreload" crossorigin href="./assets/preload-helper-Bo9GmnuQ.js">
|
|
10
10
|
</head>
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8">
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>CollabMD Export</title>
|
|
7
|
-
<script type="module" crossorigin src="./assets/exportDocument-
|
|
7
|
+
<script type="module" crossorigin src="./assets/exportDocument-mlXOym-R.js"></script>
|
|
8
8
|
<link rel="modulepreload" crossorigin href="./assets/runtime-config-loader-_D2KZKn-.js">
|
|
9
9
|
<link rel="modulepreload" crossorigin href="./assets/preload-helper-Bo9GmnuQ.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="./assets/base-h1uscjTi.js">
|
package/dist/client/index.html
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
document.documentElement.setAttribute('data-initial-file-requested', 'true');
|
|
16
16
|
}
|
|
17
17
|
</script>
|
|
18
|
-
<script type="module" crossorigin src="./assets/index-
|
|
18
|
+
<script type="module" crossorigin src="./assets/index-CCfHrm_9.js"></script>
|
|
19
19
|
<link rel="modulepreload" crossorigin href="./assets/runtime-config-loader-_D2KZKn-.js">
|
|
20
20
|
<link rel="modulepreload" crossorigin href="./assets/preload-helper-Bo9GmnuQ.js">
|
|
21
21
|
<link rel="modulepreload" crossorigin href="./assets/base-h1uscjTi.js">
|
package/docker-compose.yml
CHANGED
|
@@ -19,6 +19,7 @@ services:
|
|
|
19
19
|
BASE_PATH: ${BASE_PATH:-}
|
|
20
20
|
PUBLIC_WS_BASE_URL: ${PUBLIC_WS_BASE_URL:-}
|
|
21
21
|
PLANTUML_SERVER_URL: http://plantuml:8080
|
|
22
|
+
COLLABMD_WIKI_LINK_AUTO_CREATE: ${COLLABMD_WIKI_LINK_AUTO_CREATE:-true}
|
|
22
23
|
COLLABMD_VAULT_DIR: ${COLLABMD_VAULT_DIR:-/data}
|
|
23
24
|
COLLABMD_GIT_REPO_URL: ${COLLABMD_GIT_REPO_URL:-}
|
|
24
25
|
COLLABMD_GIT_SSH_PRIVATE_KEY_FILE: ${COLLABMD_GIT_SSH_PRIVATE_KEY_FILE:-}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "collabmd",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.38",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Collaborative markdown vault — like Obsidian, but online. Serve any directory of markdown files for realtime collaborative editing.",
|
|
6
6
|
"repository": {
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"lit-html": "^3.3.2",
|
|
85
85
|
"markdown-it": "^14.1.1",
|
|
86
86
|
"mermaid": "^11.14.0",
|
|
87
|
-
"openid-client": "^6.8.
|
|
87
|
+
"openid-client": "^6.8.4",
|
|
88
88
|
"react": "^19.2.5",
|
|
89
89
|
"react-dom": "^19.2.5",
|
|
90
90
|
"sharp": "^0.34.5",
|
|
@@ -104,8 +104,8 @@
|
|
|
104
104
|
"@playwright/test": "^1.59.1",
|
|
105
105
|
"@vitest/browser": "^4.1.5",
|
|
106
106
|
"@vitest/browser-playwright": "^4.1.5",
|
|
107
|
-
"eslint": "^10.
|
|
108
|
-
"globals": "^17.
|
|
107
|
+
"eslint": "^10.3.0",
|
|
108
|
+
"globals": "^17.6.0",
|
|
109
109
|
"vite": "^8.0.10",
|
|
110
110
|
"vitest": "^4.1.5"
|
|
111
111
|
}
|
|
@@ -344,6 +344,7 @@ function renderInlineWikiText(content, {
|
|
|
344
344
|
mermaidEmbedCounts,
|
|
345
345
|
plantUmlEmbedCounts,
|
|
346
346
|
sourceFilePath = '',
|
|
347
|
+
wikiLinkAutoCreate = true,
|
|
347
348
|
}) {
|
|
348
349
|
const regex = /!\[\[([^\]|#]+\.(?:base|excalidraw|drawio|mmd|mermaid|puml|plantuml))(?:#([^\]|]+))?(?:\|([^\]]+))?\]\]|\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/gi;
|
|
349
350
|
let lastIndex = 0;
|
|
@@ -408,7 +409,11 @@ function renderInlineWikiText(content, {
|
|
|
408
409
|
const display = (match[5] || match[4]).trim();
|
|
409
410
|
const resolved = resolveWikiTarget(target, fileList);
|
|
410
411
|
const classes = resolved ? 'wiki-link' : 'wiki-link wiki-link-new';
|
|
411
|
-
const title = resolved
|
|
412
|
+
const title = resolved
|
|
413
|
+
? normalizePreviewTypography(display)
|
|
414
|
+
: wikiLinkAutoCreate
|
|
415
|
+
? `Create "${target}"`
|
|
416
|
+
: `Missing "${target}"`;
|
|
412
417
|
html += `<a class="${classes}" href="#" data-wiki-target="${escapeHtml(target)}" title="${escapeHtml(title)}">${escapePreviewText(display)}</a>`;
|
|
413
418
|
}
|
|
414
419
|
|
|
@@ -425,6 +430,7 @@ function renderInlineWikiText(content, {
|
|
|
425
430
|
function createMarkdownRenderer(fileList = [], {
|
|
426
431
|
attachmentApiPath = '/api/attachment',
|
|
427
432
|
sourceFilePath = '',
|
|
433
|
+
wikiLinkAutoCreate = true,
|
|
428
434
|
} = {}) {
|
|
429
435
|
const markdown = markdownIt({
|
|
430
436
|
highlight(source, language) {
|
|
@@ -562,6 +568,7 @@ function createMarkdownRenderer(fileList = [], {
|
|
|
562
568
|
mermaidEmbedCounts,
|
|
563
569
|
plantUmlEmbedCounts,
|
|
564
570
|
sourceFilePath,
|
|
571
|
+
wikiLinkAutoCreate,
|
|
565
572
|
})}`;
|
|
566
573
|
}
|
|
567
574
|
|
|
@@ -574,6 +581,7 @@ function createMarkdownRenderer(fileList = [], {
|
|
|
574
581
|
mermaidEmbedCounts,
|
|
575
582
|
plantUmlEmbedCounts,
|
|
576
583
|
sourceFilePath,
|
|
584
|
+
wikiLinkAutoCreate,
|
|
577
585
|
})}`;
|
|
578
586
|
}
|
|
579
587
|
|
|
@@ -585,6 +593,7 @@ function createMarkdownRenderer(fileList = [], {
|
|
|
585
593
|
mermaidEmbedCounts,
|
|
586
594
|
plantUmlEmbedCounts,
|
|
587
595
|
sourceFilePath,
|
|
596
|
+
wikiLinkAutoCreate,
|
|
588
597
|
});
|
|
589
598
|
};
|
|
590
599
|
|
|
@@ -637,12 +646,14 @@ export function compilePreviewDocument({
|
|
|
637
646
|
frontmatterInteractive = false,
|
|
638
647
|
markdownText = '',
|
|
639
648
|
sourceFilePath = '',
|
|
649
|
+
wikiLinkAutoCreate = true,
|
|
640
650
|
} = {}) {
|
|
641
651
|
const normalizedMarkdown = String(markdownText);
|
|
642
652
|
const frontmatter = extractYamlFrontmatter(normalizedMarkdown);
|
|
643
653
|
const renderer = createMarkdownRenderer(fileList, {
|
|
644
654
|
attachmentApiPath,
|
|
645
655
|
sourceFilePath,
|
|
656
|
+
wikiLinkAutoCreate,
|
|
646
657
|
});
|
|
647
658
|
const renderedMarkdown = frontmatter ? frontmatter.bodyMarkdown : normalizedMarkdown;
|
|
648
659
|
const frontmatterHtml = renderFrontmatterBlock(frontmatter, {
|
|
@@ -16,6 +16,7 @@ export class PreviewRenderExecutor {
|
|
|
16
16
|
createWorkerFn = createPreviewWorker,
|
|
17
17
|
getFileList,
|
|
18
18
|
getSourceFilePath = null,
|
|
19
|
+
getWikiLinkAutoCreate = null,
|
|
19
20
|
idleTimeoutMs = IDLE_RENDER_TIMEOUT_MS,
|
|
20
21
|
requestIdleRenderFn = requestIdleRender,
|
|
21
22
|
} = {}) {
|
|
@@ -25,6 +26,7 @@ export class PreviewRenderExecutor {
|
|
|
25
26
|
this.createWorkerFn = createWorkerFn;
|
|
26
27
|
this.getFileList = getFileList;
|
|
27
28
|
this.getSourceFilePath = getSourceFilePath;
|
|
29
|
+
this.getWikiLinkAutoCreate = getWikiLinkAutoCreate;
|
|
28
30
|
this.idleTimeoutMs = idleTimeoutMs;
|
|
29
31
|
this.requestIdleRenderFn = requestIdleRenderFn;
|
|
30
32
|
this.worker = null;
|
|
@@ -119,6 +121,7 @@ export class PreviewRenderExecutor {
|
|
|
119
121
|
markdownText,
|
|
120
122
|
renderVersion,
|
|
121
123
|
sourceFilePath: this.getSourceFilePath?.() ?? '',
|
|
124
|
+
wikiLinkAutoCreate: this.getWikiLinkAutoCreate?.() ?? true,
|
|
122
125
|
});
|
|
123
126
|
});
|
|
124
127
|
}
|
|
@@ -131,6 +134,7 @@ export class PreviewRenderExecutor {
|
|
|
131
134
|
frontmatterInteractive,
|
|
132
135
|
markdownText,
|
|
133
136
|
sourceFilePath: this.getSourceFilePath?.() ?? '',
|
|
137
|
+
wikiLinkAutoCreate: this.getWikiLinkAutoCreate?.() ?? true,
|
|
134
138
|
});
|
|
135
139
|
}
|
|
136
140
|
|
|
@@ -9,6 +9,7 @@ self.onmessage = (event) => {
|
|
|
9
9
|
markdownText,
|
|
10
10
|
renderVersion,
|
|
11
11
|
sourceFilePath,
|
|
12
|
+
wikiLinkAutoCreate,
|
|
12
13
|
} = event.data ?? {};
|
|
13
14
|
|
|
14
15
|
try {
|
|
@@ -19,6 +20,7 @@ self.onmessage = (event) => {
|
|
|
19
20
|
frontmatterInteractive,
|
|
20
21
|
markdownText,
|
|
21
22
|
sourceFilePath,
|
|
23
|
+
wikiLinkAutoCreate,
|
|
22
24
|
});
|
|
23
25
|
self.postMessage({
|
|
24
26
|
html: result.html,
|
|
@@ -10,8 +10,9 @@ export class PreviewRenderer {
|
|
|
10
10
|
constructor({
|
|
11
11
|
getContent,
|
|
12
12
|
getFileList,
|
|
13
|
-
loadFileSource = null,
|
|
14
13
|
getSourceFilePath,
|
|
14
|
+
getWikiLinkAutoCreate = null,
|
|
15
|
+
loadFileSource = null,
|
|
15
16
|
onAfterRenderCommit,
|
|
16
17
|
onBeforeRenderCommit,
|
|
17
18
|
onPreviewLayoutChange,
|
|
@@ -24,8 +25,9 @@ export class PreviewRenderer {
|
|
|
24
25
|
}) {
|
|
25
26
|
this.getContent = getContent;
|
|
26
27
|
this.getFileList = getFileList;
|
|
27
|
-
this.loadFileSource = loadFileSource;
|
|
28
28
|
this.getSourceFilePath = getSourceFilePath;
|
|
29
|
+
this.getWikiLinkAutoCreate = getWikiLinkAutoCreate;
|
|
30
|
+
this.loadFileSource = loadFileSource;
|
|
29
31
|
this.onAfterRenderCommit = onAfterRenderCommit;
|
|
30
32
|
this.onBeforeRenderCommit = onBeforeRenderCommit;
|
|
31
33
|
this.onPreviewLayoutChange = onPreviewLayoutChange;
|
|
@@ -96,6 +98,7 @@ export class PreviewRenderer {
|
|
|
96
98
|
attachmentApiPath: resolveApiUrl('/attachment'),
|
|
97
99
|
getFileList: () => this.getFileList?.() ?? [],
|
|
98
100
|
getSourceFilePath: () => this.getSourceFilePath?.() ?? '',
|
|
101
|
+
getWikiLinkAutoCreate: () => this.getWikiLinkAutoCreate?.() ?? true,
|
|
99
102
|
idleTimeoutMs: IDLE_RENDER_TIMEOUT_MS,
|
|
100
103
|
});
|
|
101
104
|
|
|
@@ -8,12 +8,14 @@ export class WikiLinkFileController {
|
|
|
8
8
|
refreshExplorer,
|
|
9
9
|
toastController,
|
|
10
10
|
vaultApiClient,
|
|
11
|
+
wikiLinkAutoCreate = true,
|
|
11
12
|
}) {
|
|
12
13
|
this.getFileList = getFileList;
|
|
13
14
|
this.navigation = navigation;
|
|
14
15
|
this.refreshExplorer = refreshExplorer;
|
|
15
16
|
this.toastController = toastController;
|
|
16
17
|
this.vaultApiClient = vaultApiClient;
|
|
18
|
+
this.wikiLinkAutoCreate = wikiLinkAutoCreate;
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
handleWikiLinkClick(target) {
|
|
@@ -24,6 +26,11 @@ export class WikiLinkFileController {
|
|
|
24
26
|
return;
|
|
25
27
|
}
|
|
26
28
|
|
|
29
|
+
if (!this.wikiLinkAutoCreate) {
|
|
30
|
+
this.toastController.show('Wiki-link target does not exist');
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
27
34
|
const normalizedPath = this.normalizeNewWikiFilePath(target);
|
|
28
35
|
if (!normalizedPath) {
|
|
29
36
|
this.toastController.show('Cannot create an empty wiki-link target');
|
|
@@ -337,6 +337,7 @@ export class CollabMdAppShell {
|
|
|
337
337
|
this.previewRenderer = new PreviewRenderer({
|
|
338
338
|
getContent: () => this.getPreviewSource(),
|
|
339
339
|
getFileList: () => this.fileExplorer.flatDocumentFiles,
|
|
340
|
+
getWikiLinkAutoCreate: () => this.runtimeConfig.wikiLinkAutoCreate !== false,
|
|
340
341
|
loadFileSource: async (filePath) => {
|
|
341
342
|
const payload = await this.vaultApiClient.readFile(filePath);
|
|
342
343
|
return String(payload?.content ?? '');
|
|
@@ -474,6 +475,7 @@ export class CollabMdAppShell {
|
|
|
474
475
|
refreshExplorer: () => this.fileExplorer.refresh(),
|
|
475
476
|
toastController: this.toastController,
|
|
476
477
|
vaultApiClient: this.vaultApiClient,
|
|
478
|
+
wikiLinkAutoCreate: this.runtimeConfig.wikiLinkAutoCreate !== false,
|
|
477
479
|
});
|
|
478
480
|
this.gitDiffView = new GitDiffViewController({
|
|
479
481
|
gitApiClient: this.gitApiClient,
|
package/src/server/config/env.js
CHANGED
|
@@ -334,6 +334,7 @@ export function loadConfig(overrides = {}) {
|
|
|
334
334
|
vaultDir,
|
|
335
335
|
publicWsBaseUrl: process.env.PUBLIC_WS_BASE_URL || '',
|
|
336
336
|
testWsRoomHydrateDelayMs: parsePositiveInt(process.env.TEST_WS_ROOM_HYDRATE_DELAY_MS, 0),
|
|
337
|
+
wikiLinkAutoCreate: process.env.COLLABMD_WIKI_LINK_AUTO_CREATE !== 'false',
|
|
337
338
|
wsHeartbeatIntervalMs: parsePositiveInt(process.env.WS_HEARTBEAT_INTERVAL_MS, 30_000),
|
|
338
339
|
wsRoomIdleGraceMs: parsePositiveInt(process.env.WS_ROOM_IDLE_GRACE_MS, 60_000),
|
|
339
340
|
wsBasePath: normalizeWsBasePath(process.env.WS_BASE_PATH || '/ws'),
|
|
@@ -51,6 +51,7 @@ function buildRuntimeConfig({
|
|
|
51
51
|
gitEnabled,
|
|
52
52
|
nodeEnv,
|
|
53
53
|
publicWsBaseUrl,
|
|
54
|
+
wikiLinkAutoCreate,
|
|
54
55
|
wsBasePath,
|
|
55
56
|
}) {
|
|
56
57
|
return `window.__COLLABMD_CONFIG__ = ${JSON.stringify({
|
|
@@ -61,6 +62,7 @@ function buildRuntimeConfig({
|
|
|
61
62
|
environment: nodeEnv,
|
|
62
63
|
gitEnabled,
|
|
63
64
|
publicWsBaseUrl,
|
|
65
|
+
wikiLinkAutoCreate,
|
|
64
66
|
wsBasePath,
|
|
65
67
|
})};\n`;
|
|
66
68
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./preview-render-compiler-BCaqHl2M.js";export{e as compilePreviewDocument};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function e(e){return e.endsWith(`/`)?e.slice(0,-1):e}function t(n){let r=e(String(n??``).trim());if(!r||r===`/`)return``;if(/^[a-zA-Z][a-zA-Z\d+.-]*:/u.test(r))try{return t(new URL(r).pathname)}catch{return``}return r.startsWith(`/`)?r:`/${r}`}function n(t,n){let r=e(String(t??``).trim());return!r||r===`/`?n:r.startsWith(`/`)?r:`/${r}`}function r(e,n){let r=t(e),i=String(n??``).trim();return i?/^[a-zA-Z][a-zA-Z\d+.-]*:/u.test(i)||r&&(i===r||i.startsWith(`${r}/`))?i:i===`/`?r||`/`:i.startsWith(`/`)?r?`${r}${i}`:i:r?`${r}/${i}`:`/${i}`:r||`/`}function i(){let e={auth:{enabled:!1,implemented:!0,loginEndpoint:`/api/auth/oidc/login`,provider:``,requiresLogin:!1,sessionEndpoint:`/api/auth/session`,statusEndpoint:`/api/auth/status`,strategy:`none`},basePath:``,build:{id:``,packageVersion:``},drawioBaseUrl:`https://embed.diagrams.net`,environment:`development`,gitEnabled:!0,publicWsBaseUrl:``,wsBasePath:`/ws`,...window.__COLLABMD_CONFIG__??{}},i=t(e.basePath),a={enabled:!1,implemented:!0,loginEndpoint:`/api/auth/oidc/login`,provider:``,requiresLogin:!1,sessionEndpoint:`/api/auth/session`,statusEndpoint:`/api/auth/status`,strategy:`none`,...e.auth??{}},o={id:``,packageVersion:``,...e.build??{}};return{...e,auth:{...a,loginEndpoint:r(i,a.loginEndpoint),sessionEndpoint:r(i,a.sessionEndpoint),statusEndpoint:r(i,a.statusEndpoint)},basePath:i,build:o,wsBasePath:n(e.wsBasePath,`/ws`)}}function a(e=`/`,t=i()){return r(t.basePath,e)}function o(e=`/`,t=i()){return new URL(a(e,t),window.location.origin).toString()}function s(e=`/`,t=i()){let n=String(e??``).trim();return!n||n===`/`?a(`/api`,t):n.startsWith(`/api`)?a(n,t):a(`/api${n.startsWith(`/`)?n:`/${n}`}`,t)}function c(t=i()){let n=new URLSearchParams(window.location.search).get(`server`);return n?e(n):t.publicWsBaseUrl?e(t.publicWsBaseUrl):`${window.location.protocol===`https:`?`wss:`:`ws:`}//${window.location.host}${a(t.wsBasePath,t)}`}var l=Object.freeze({authError:`auth_error`,authPassword:`auth_password`,file:`file`,gitCommit:`git-commit`,gitDiff:`git-diff`,gitFileHistory:`git-file-history`,gitFilePreview:`git-file-preview`,gitHistory:`git-history`});function u(e=``){let t=String(e??``),n=t.startsWith(`#`)?t.slice(1):t;return new URLSearchParams(n)}function d(e=``){let t=String(e??``);return t.startsWith(`#`)?t.slice(1):t}function f(e=``){if(!d(e).trim().includes(`=`))return!1;let t=u(e);return Object.values(l).some(e=>t.has(e))}function p(e,{drawioMode:t=null,anchor:n=null}={}){let r=new URLSearchParams;return e&&r.set(l.file,e),t&&r.set(`drawio`,t),n&&r.set(`anchor`,String(n).trim()),r.toString()}function m(){return i()}function h(){return u(window.location.hash)}function g(e){return e===`staged`||e===`all`||e===`working-tree`?e:`all`}function _(){let e=h();if(e.has(l.gitFilePreview)){let t=e.get(l.gitFilePreview)||null;return{currentFilePath:e.get(`current`)||t,filePath:t,hash:e.get(`hash`)||null,type:`git-file-preview`}}if(e.has(l.gitFileHistory))return{filePath:e.get(l.gitFileHistory)||null,type:`git-file-history`};if(e.has(l.gitHistory))return{type:`git-history`};if(e.has(l.gitCommit))return{hash:e.get(l.gitCommit)||null,historyFilePath:e.get(`history`)||null,path:e.get(`path`)||null,type:`git-commit`};if(e.has(l.gitDiff)){let t=e.get(l.gitDiff)||null;return{filePath:t,scope:g(e.get(`scope`)||(t?`working-tree`:`all`)),type:`git-diff`}}return e.has(l.file)?{anchor:e.get(`anchor`)||null,drawioMode:e.get(`drawio`)||null,filePath:e.get(l.file),type:`file`}:{type:`empty`}}function v(e,{drawioMode:t=null,anchor:n=null}={}){window.location.hash=p(e,{drawioMode:t,anchor:n})}function y({filePath:e=null,scope:t=`all`}={}){let n=new URLSearchParams;n.set(`git-diff`,e??``),n.set(`scope`,g(t)),window.location.hash=n.toString()}function b({hash:e,path:t=null,historyFilePath:n=null}={}){let r=String(e??``).trim(),i=new URLSearchParams;i.set(`git-commit`,r),n&&i.set(`history`,n),t&&i.set(`path`,t),window.location.hash=i.toString()}function x(){let e=new URLSearchParams;e.set(`git-history`,`1`),window.location.hash=e.toString()}function S({filePath:e}={}){let t=new URLSearchParams;t.set(`git-file-history`,e??``),window.location.hash=t.toString()}function C({hash:e,path:t,currentFilePath:n=null}={}){let r=String(e??``).trim(),i=new URLSearchParams;i.set(`git-file-preview`,t??``),n&&i.set(`current`,n),i.set(`hash`,r),window.location.hash=i.toString()}export{y as a,x as c,s as d,a as f,b as i,p as l,c as m,m as n,S as o,o as p,v as r,C as s,_ as t,f as u};
|