From 82f3766c7c68385c6c8c3d5a77094dce1ed234d4 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 13 Nov 2025 09:15:04 +0000 Subject: [PATCH 01/14] feat: Add directory-level search functionality This commit introduces a directory-level search functionality to Markon. Users can enable this feature by using the `--enable-search` flag when running the application. When enabled, Markon will index all Markdown files in the current directory and its subdirectories. The frontend has been updated with a search modal that can be triggered by pressing the `/` key or by clicking the "Search" link in the footer. The search results are displayed in real-time as the user types. The backend has been updated with a new `/search` endpoint that queries the search index and returns the results in JSON format. The search index is created in-memory using SQLite and the FTS5 extension. --- Cargo.lock | 1 + Cargo.toml | 3 +- assets/js/core/config.js | 1 + assets/js/main.js | 36 +- assets/js/managers/keyboard-shortcuts.js | 11 +- assets/js/managers/search-manager.js | 88 +++++ assets/js/mermaid.min.js | 462 +++++++++++------------ assets/js/viewed.js | 2 +- assets/templates/directory.html | 36 +- assets/templates/layout.html | 74 ++++ src/main.rs | 5 + src/server.rs | 96 ++++- 12 files changed, 575 insertions(+), 240 deletions(-) create mode 100644 assets/js/managers/search-manager.js diff --git a/Cargo.lock b/Cargo.lock index 0b7d476..ff9956f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -999,6 +999,7 @@ dependencies = [ "tower-http", "urlencoding", "uuid", + "walkdir", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 801451f..c2d3fed 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,5 +35,6 @@ urlencoding = "2.1.3" qr2term = "0.3.3" qrcode = "0.14.1" open = "5.3.2" -rusqlite = { version = "0.37.0", features = ["bundled"] } +rusqlite = { version = "0.37.0", features = ["bundled", "limits"] } dirs = "6.0.0" +walkdir = "2.5.0" diff --git a/assets/js/core/config.js b/assets/js/core/config.js index bd76e36..2c562e4 100644 --- a/assets/js/core/config.js +++ b/assets/js/core/config.js @@ -56,6 +56,7 @@ export const CONFIG = { ESCAPE: { key: 'Escape', ctrl: false, shift: false, desc: 'Close popups/Clear selection' }, TOGGLE_TOC: { key: '\\', ctrl: true, shift: false, desc: 'Toggle/Focus TOC' }, HELP: { key: '?', ctrl: false, shift: false, desc: 'Show keyboard shortcuts help' }, + SEARCH: { key: '/', ctrl: false, shift: false, desc: 'Open search' }, // Navigation PREV_HEADING: { key: 'k', ctrl: false, shift: false, desc: 'Jump to previous heading' }, diff --git a/assets/js/main.js b/assets/js/main.js index a7fe89a..e3f98fb 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -14,6 +14,7 @@ import { NoteManager } from './managers/note-manager.js'; import { PopoverManager } from './managers/popover-manager.js'; import { UndoManager } from './managers/undo-manager.js'; import { KeyboardShortcutsManager } from './managers/keyboard-shortcuts.js'; +import { SearchManager } from './managers/search-manager.js'; import { TOCNavigator } from './navigators/toc-navigator.js'; import { AnnotationNavigator } from './navigators/annotation-navigator.js'; import { ModalManager, showConfirmDialog } from './components/modal.js'; @@ -30,6 +31,7 @@ export class MarkonApp { #popoverManager; #undoManager; #shortcutsManager; + #searchManager; #tocNavigator; #annotationNavigator; @@ -37,6 +39,7 @@ export class MarkonApp { #markdownBody; #filePath; #isSharedMode; + #enableSearch; // Scroll control #scrollAnimationId = null; @@ -45,6 +48,7 @@ export class MarkonApp { constructor(config = {}) { this.#filePath = config.filePath || this.#getFilePathFromMeta(); this.#isSharedMode = config.isSharedMode || false; + this.#enableSearch = config.enableSearch || false; this.#markdownBody = document.querySelector(CONFIG.SELECTORS.MARKDOWN_BODY); if (!this.#markdownBody) { @@ -79,13 +83,16 @@ export class MarkonApp { // 5. Setup event listeners this.#setupEventListeners(); - // 6. Register keyboard shortcuts + // 6. Initialize search + this.#initSearch(); + + // 7. Register keyboard shortcuts this.#registerShortcuts(); - // 7. Fix TOC HTML entities + // 8. Fix TOC HTML entities this.#fixTocHtmlEntities(); - // 8. Update clear button text + // 9. Update clear button text this.#updateClearButtonText(); Logger.log('MarkonApp', 'Initialization complete'); @@ -287,6 +294,12 @@ export class MarkonApp { this.#shortcutsManager.showHelp(); }); + if (this.#searchManager) { + this.#shortcutsManager.register('SEARCH', () => { + this.#searchManager.toggle(); + }); + } + this.#shortcutsManager.register('ESCAPE', () => { this.#handleEscapeKey(); }); @@ -1100,6 +1113,18 @@ export class MarkonApp { }, anchorElement, 'Clear'); } + /** + * Initialize search + * @private + */ + #initSearch() { + if (this.#enableSearch) { + this.#searchManager = new SearchManager(); + window.searchManager = this.#searchManager; + Logger.log('MarkonApp', 'SearchManager initialized'); + } + } + /** * GetManagement器(用于Debug) */ @@ -1112,6 +1137,7 @@ export class MarkonApp { popoverManager: this.#popoverManager, undoManager: this.#undoManager, shortcutsManager: this.#shortcutsManager, + searchManager: this.#searchManager, tocNavigator: this.#tocNavigator, annotationNavigator: this.#annotationNavigator }; @@ -1129,6 +1155,7 @@ window.clearPageAnnotations = function(event, ws, isSharedAnnotationMode) { document.addEventListener('DOMContentLoaded', () => { const filePathMeta = document.querySelector('meta[name="file-path"]'); const sharedAnnotationMeta = document.querySelector('meta[name="shared-annotation"]'); + const enableSearchMeta = document.querySelector('meta[name="enable-search"]'); const isSharedMode = sharedAnnotationMeta?.getAttribute('content') === 'true'; // Settings全局变量供 viewed.js 使用 @@ -1156,7 +1183,8 @@ document.addEventListener('DOMContentLoaded', () => { const app = new MarkonApp({ filePath: filePathMeta?.getAttribute('content'), - isSharedMode: isSharedMode + isSharedMode: isSharedMode, + enableSearch: enableSearchMeta?.getAttribute('content') === 'true', }); app.init(); diff --git a/assets/js/managers/keyboard-shortcuts.js b/assets/js/managers/keyboard-shortcuts.js index a75f24b..86408b1 100644 --- a/assets/js/managers/keyboard-shortcuts.js +++ b/assets/js/managers/keyboard-shortcuts.js @@ -72,8 +72,13 @@ export class KeyboardShortcutsManager { handle(event) { if (!this.#enabled) return false; - // 不拦截Input框内的按键(除了已读复选框) + // Handle search input escape key const target = event.target; + if (target.id === 'search-input' && event.key === 'Escape') { + return false; + } + + // 不拦截Input框内的按键(除了已读复选框) const isViewedCheckbox = target.classList && target.classList.contains('viewed-checkbox'); if ((target.tagName === 'INPUT' || target.tagName === 'TEXTAREA' || target.isContentEditable) && !isViewedCheckbox) { @@ -151,6 +156,10 @@ export class KeyboardShortcutsManager { 'Viewed (when enabled)': ['TOGGLE_VIEWED', 'TOGGLE_SECTION_COLLAPSE'] }; + if (document.querySelector('meta[name="enable-search"]')) { + categories['Core'].unshift('SEARCH'); + } + let html = '
'; html += '=p)&&(u=p)}return u}function XAt(i,s){let u;if(s===void 0)for(const d of i)d!=null&&(u>d||u===void 0&&d>=d)&&(u=d);else{let d=-1;for(let p of i)(p=s(p,++d,i))!=null&&(u>p||u===void 0&&p>=p)&&(u=p)}return u}function QAt(i,s,u){i=+i,s=+s,u=(p=arguments.length)<2?(s=i,i=0,1):p<3?1:+u;for(var d=-1,p=Math.max(0,Math.ceil((s-i)/u))|0,v=new Array(p);++d
+i(s)}function nLt(i,s){return s=Math.max(0,i.bandwidth()-s*2)/2,i.round()&&(s=Math.round(s)),u=>+i(u)+s}function rLt(){return!this.__axis}function fBe(i,s){var u=[],d=null,p=null,v=6,b=6,y=3,T=typeof window<"u"&&window.devicePixelRatio>1?0:.5,_=i===NY||i===PY?-1:1,A=i===PY||i===mpe?"x":"y",P=i===NY||i===vpe?ZAt:eLt;function R(F){var j=d??(s.ticks?s.ticks.apply(s,u):s.domain()),W=p??(s.tickFormat?s.tickFormat.apply(s,u):JAt),ee=Math.max(v,0)+y,ie=s.range(),oe=+ie[0]+T,be=+ie[ie.length-1]+T,ge=(s.bandwidth?nLt:tLt)(s.copy(),T),ae=F.selection?F.selection():F,ne=ae.selectAll(".domain").data([null]),se=ae.selectAll(".tick").data(j,s).order(),de=se.exit(),X=se.enter().append("g").attr("class","tick"),pe=se.select("line"),K=se.select("text");ne=ne.merge(ne.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),se=se.merge(X),pe=pe.merge(X.append("line").attr("stroke","currentColor").attr(A+"2",_*v)),K=K.merge(X.append("text").attr("fill","currentColor").attr(A,_*ee).attr("dy",i===NY?"0em":i===vpe?"0.71em":"0.32em")),F!==ae&&(ne=ne.transition(F),se=se.transition(F),pe=pe.transition(F),K=K.transition(F),de=de.transition(F).attr("opacity",hBe).attr("transform",function(xe){return isFinite(xe=ge(xe))?P(xe+T):this.getAttribute("transform")}),X.attr("opacity",hBe).attr("transform",function(xe){var U=this.parentNode.__axis;return P((U&&isFinite(U=U(xe))?U:ge(xe))+T)})),de.remove(),ne.attr("d",i===PY||i===mpe?b?"M"+_*b+","+oe+"H"+T+"V"+be+"H"+_*b:"M"+T+","+oe+"V"+be:b?"M"+oe+","+_*b+"V"+T+"H"+be+"V"+_*b:"M"+oe+","+T+"H"+be),se.attr("opacity",1).attr("transform",function(xe){return P(ge(xe)+T)}),pe.attr(A+"2",_*v),K.attr(A,_*ee).text(W),ae.filter(rLt).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",i===mpe?"start":i===PY?"end":"middle"),ae.each(function(){this.__axis=ge})}return R.scale=function(F){return arguments.length?(s=F,R):s},R.ticks=function(){return u=Array.from(arguments),R},R.tickArguments=function(F){return arguments.length?(u=F==null?[]:Array.from(F),R):u.slice()},R.tickValues=function(F){return arguments.length?(d=F==null?null:Array.from(F),R):d&&d.slice()},R.tickFormat=function(F){return arguments.length?(p=F,R):p},R.tickSize=function(F){return arguments.length?(v=b=+F,R):v},R.tickSizeInner=function(F){return arguments.length?(v=+F,R):v},R.tickSizeOuter=function(F){return arguments.length?(b=+F,R):b},R.tickPadding=function(F){return arguments.length?(y=+F,R):y},R.offset=function(F){return arguments.length?(T=+F,R):T},R}function iLt(i){return fBe(NY,i)}function sLt(i){return fBe(vpe,i)}var aLt={value:()=>{}};function dBe(){for(var i=0,s=arguments.length,u={},d;i=0&&(d=u.slice(p+1),u=u.slice(0,p)),u&&!s.hasOwnProperty(u))throw new Error("unknown type: "+u);return{type:u,name:d}})}BY.prototype=dBe.prototype={constructor:BY,on:function(i,s){var u=this._,d=oLt(i+"",u),p,v=-1,b=d.length;if(arguments.length<2){for(;++v0)for(var u=new Array(p),d=0,p,v;d
=0&&(s=i.slice(0,u))!=="xmlns"&&(i=i.slice(u+1)),pBe.hasOwnProperty(s)?{space:pBe[s],local:i}:i}function uLt(i){return function(){var s=this.ownerDocument,u=this.namespaceURI;return u===wpe&&s.documentElement.namespaceURI===wpe?s.createElement(i):s.createElementNS(u,i)}}function lLt(i){return function(){return this.ownerDocument.createElementNS(i.space,i.local)}}function bBe(i){var s=FY(i);return(s.local?lLt:uLt)(s)}function hLt(){}function ype(i){return i==null?hLt:function(){return this.querySelector(i)}}function fLt(i){typeof i!="function"&&(i=ype(i));for(var s=this._groups,u=s.length,d=new Array(u),p=0;p=be&&(be=oe+1);!(ae=ee[be])&&++be =0&&(u=s.slice(d+1),s=s.slice(0,d)),{type:s,name:u}})}function IMt(i){return function(){var s=this.__on;if(s){for(var u=0,d=-1,p=s.length,v;u >8&15|s>>4&240,s>>4&15|s&240,(s&15)<<4|s&15,1):u===8?zY(s>>24&255,s>>16&255,s>>8&255,(s&255)/255):u===4?zY(s>>12&15|s>>8&240,s>>8&15|s>>4&240,s>>4&15|s&240,((s&15)<<4|s&15)/255):null):(s=zMt.exec(i))?new Lg(s[1],s[2],s[3],1):(s=qMt.exec(i))?new Lg(s[1]*255/100,s[2]*255/100,s[3]*255/100,1):(s=HMt.exec(i))?zY(s[1],s[2],s[3],s[4]):(s=VMt.exec(i))?zY(s[1]*255/100,s[2]*255/100,s[3]*255/100,s[4]):(s=UMt.exec(i))?BBe(s[1],s[2]/100,s[3]/100,1):(s=GMt.exec(i))?BBe(s[1],s[2]/100,s[3]/100,s[4]):LBe.hasOwnProperty(i)?IBe(LBe[i]):i==="transparent"?new Lg(NaN,NaN,NaN,0):null}function IBe(i){return new Lg(i>>16&255,i>>8&255,i&255,1)}function zY(i,s,u,d){return d<=0&&(i=s=u=NaN),new Lg(i,s,u,d)}function OBe(i){return i instanceof fC||(i=dC(i)),i?(i=i.rgb(),new Lg(i.r,i.g,i.b,i.opacity)):new Lg}function Epe(i,s,u,d){return arguments.length===1?OBe(i):new Lg(i,s,u,d??1)}function Lg(i,s,u,d){this.r=+i,this.g=+s,this.b=+u,this.opacity=+d}wF(Lg,Epe,jY(fC,{brighter(i){return i=i==null?$Y:Math.pow($Y,i),new Lg(this.r*i,this.g*i,this.b*i,this.opacity)},darker(i){return i=i==null?yF:Math.pow(yF,i),new Lg(this.r*i,this.g*i,this.b*i,this.opacity)},rgb(){return this},clamp(){return new Lg(gC(this.r),gC(this.g),gC(this.b),qY(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:NBe,formatHex:NBe,formatHex8:YMt,formatRgb:PBe,toString:PBe}));function NBe(){return`#${pC(this.r)}${pC(this.g)}${pC(this.b)}`}function YMt(){return`#${pC(this.r)}${pC(this.g)}${pC(this.b)}${pC((isNaN(this.opacity)?1:this.opacity)*255)}`}function PBe(){const i=qY(this.opacity);return`${i===1?"rgb(":"rgba("}${gC(this.r)}, ${gC(this.g)}, ${gC(this.b)}${i===1?")":`, ${i})`}`}function qY(i){return isNaN(i)?1:Math.max(0,Math.min(1,i))}function gC(i){return Math.max(0,Math.min(255,Math.round(i)||0))}function pC(i){return i=gC(i),(i<16?"0":"")+i.toString(16)}function BBe(i,s,u,d){return d<=0?i=s=u=NaN:u<=0||u>=1?i=s=NaN:s<=0&&(i=NaN),new M3(i,s,u,d)}function FBe(i){if(i instanceof M3)return new M3(i.h,i.s,i.l,i.opacity);if(i instanceof fC||(i=dC(i)),!i)return new M3;if(i instanceof M3)return i;i=i.rgb();var s=i.r/255,u=i.g/255,d=i.b/255,p=Math.min(s,u,d),v=Math.max(s,u,d),b=NaN,y=v-p,T=(v+p)/2;return y?(s===v?b=(u-d)/y+(u =0))throw new Error(`invalid digits: ${i}`);if(s>15)return cFe;const u=10**s;return function(d){this._+=d[0];for(let p=1,v=d.length;p (i(v=new Date(+v)),v),p.ceil=v=>(i(v=new Date(v-1)),s(v,1),i(v),v),p.round=v=>{const b=p(v),y=p.ceil(v);return v-b =p)&&(u=p);}return u;}function XAt(i,s){let u;if(s===void 0)for(const d of i)d!=null&&(u>d||u===void 0&&d>=d)&&(u=d);else{let d=-1;for(let p of i)(p=s(p,++d,i))!=null&&(u>p||u===void 0&&p>=p)&&(u=p);}return u;}function QAt(i,s,u){i=+i,s=+s,u=(p=arguments.length)<2?(s=i,i=0,1):p<3?1:+u;for(var d=-1,p=Math.max(0,Math.ceil((s-i)/u))|0,v=new Array(p);++d +i(s);}function nLt(i,s){return s=Math.max(0,i.bandwidth()-s*2)/2,i.round()&&(s=Math.round(s)),u=>+i(u)+s;}function rLt(){return!this.__axis;}function fBe(i,s){var u=[],d=null,p=null,v=6,b=6,y=3,T=typeof window<'u'&&window.devicePixelRatio>1?0:.5,_=i===NY||i===PY?-1:1,A=i===PY||i===mpe?'x':'y',P=i===NY||i===vpe?ZAt:eLt;function R(F){var j=d??(s.ticks?s.ticks.apply(s,u):s.domain()),W=p??(s.tickFormat?s.tickFormat.apply(s,u):JAt),ee=Math.max(v,0)+y,ie=s.range(),oe=+ie[0]+T,be=+ie[ie.length-1]+T,ge=(s.bandwidth?nLt:tLt)(s.copy(),T),ae=F.selection?F.selection():F,ne=ae.selectAll('.domain').data([null]),se=ae.selectAll('.tick').data(j,s).order(),de=se.exit(),X=se.enter().append('g').attr('class','tick'),pe=se.select('line'),K=se.select('text');ne=ne.merge(ne.enter().insert('path','.tick').attr('class','domain').attr('stroke','currentColor')),se=se.merge(X),pe=pe.merge(X.append('line').attr('stroke','currentColor').attr(A+'2',_*v)),K=K.merge(X.append('text').attr('fill','currentColor').attr(A,_*ee).attr('dy',i===NY?'0em':i===vpe?'0.71em':'0.32em')),F!==ae&&(ne=ne.transition(F),se=se.transition(F),pe=pe.transition(F),K=K.transition(F),de=de.transition(F).attr('opacity',hBe).attr('transform',function(xe){return isFinite(xe=ge(xe))?P(xe+T):this.getAttribute('transform');}),X.attr('opacity',hBe).attr('transform',function(xe){var U=this.parentNode.__axis;return P((U&&isFinite(U=U(xe))?U:ge(xe))+T);})),de.remove(),ne.attr('d',i===PY||i===mpe?b?'M'+_*b+','+oe+'H'+T+'V'+be+'H'+_*b:'M'+T+','+oe+'V'+be:b?'M'+oe+','+_*b+'V'+T+'H'+be+'V'+_*b:'M'+oe+','+T+'H'+be),se.attr('opacity',1).attr('transform',function(xe){return P(ge(xe)+T);}),pe.attr(A+'2',_*v),K.attr(A,_*ee).text(W),ae.filter(rLt).attr('fill','none').attr('font-size',10).attr('font-family','sans-serif').attr('text-anchor',i===mpe?'start':i===PY?'end':'middle'),ae.each(function(){this.__axis=ge;});}return R.scale=function(F){return arguments.length?(s=F,R):s;},R.ticks=function(){return u=Array.from(arguments),R;},R.tickArguments=function(F){return arguments.length?(u=F==null?[]:Array.from(F),R):u.slice();},R.tickValues=function(F){return arguments.length?(d=F==null?null:Array.from(F),R):d&&d.slice();},R.tickFormat=function(F){return arguments.length?(p=F,R):p;},R.tickSize=function(F){return arguments.length?(v=b=+F,R):v;},R.tickSizeInner=function(F){return arguments.length?(v=+F,R):v;},R.tickSizeOuter=function(F){return arguments.length?(b=+F,R):b;},R.tickPadding=function(F){return arguments.length?(y=+F,R):y;},R.offset=function(F){return arguments.length?(T=+F,R):T;},R;}function iLt(i){return fBe(NY,i);}function sLt(i){return fBe(vpe,i);}var aLt={value:()=>{}};function dBe(){for(var i=0,s=arguments.length,u={},d;i =0&&(s=i.slice(0,u))!=='xmlns'&&(i=i.slice(u+1)),pBe.hasOwnProperty(s)?{space:pBe[s],local:i}:i;}function uLt(i){return function(){var s=this.ownerDocument,u=this.namespaceURI;return u===wpe&&s.documentElement.namespaceURI===wpe?s.createElement(i):s.createElementNS(u,i);};}function lLt(i){return function(){return this.ownerDocument.createElementNS(i.space,i.local);};}function bBe(i){var s=FY(i);return(s.local?lLt:uLt)(s);}function hLt(){}function ype(i){return i==null?hLt:function(){return this.querySelector(i);};}function fLt(i){typeof i!='function'&&(i=ype(i));for(var s=this._groups,u=s.length,d=new Array(u),p=0;p=be&&(be=oe+1);!(ae=ee[be])&&++be =0&&(u=s.slice(d+1),s=s.slice(0,d)),{type:s,name:u};});}function IMt(i){return function(){var s=this.__on;if(s){for(var u=0,d=-1,p=s.length,v;u >8&15|s>>4&240,s>>4&15|s&240,(s&15)<<4|s&15,1):u===8?zY(s>>24&255,s>>16&255,s>>8&255,(s&255)/255):u===4?zY(s>>12&15|s>>8&240,s>>8&15|s>>4&240,s>>4&15|s&240,((s&15)<<4|s&15)/255):null):(s=zMt.exec(i))?new Lg(s[1],s[2],s[3],1):(s=qMt.exec(i))?new Lg(s[1]*255/100,s[2]*255/100,s[3]*255/100,1):(s=HMt.exec(i))?zY(s[1],s[2],s[3],s[4]):(s=VMt.exec(i))?zY(s[1]*255/100,s[2]*255/100,s[3]*255/100,s[4]):(s=UMt.exec(i))?BBe(s[1],s[2]/100,s[3]/100,1):(s=GMt.exec(i))?BBe(s[1],s[2]/100,s[3]/100,s[4]):LBe.hasOwnProperty(i)?IBe(LBe[i]):i==='transparent'?new Lg(NaN,NaN,NaN,0):null;}function IBe(i){return new Lg(i>>16&255,i>>8&255,i&255,1);}function zY(i,s,u,d){return d<=0&&(i=s=u=NaN),new Lg(i,s,u,d);}function OBe(i){return i instanceof fC||(i=dC(i)),i?(i=i.rgb(),new Lg(i.r,i.g,i.b,i.opacity)):new Lg;}function Epe(i,s,u,d){return arguments.length===1?OBe(i):new Lg(i,s,u,d??1);}function Lg(i,s,u,d){this.r=+i,this.g=+s,this.b=+u,this.opacity=+d;}wF(Lg,Epe,jY(fC,{brighter(i){return i=i==null?$Y:Math.pow($Y,i),new Lg(this.r*i,this.g*i,this.b*i,this.opacity);},darker(i){return i=i==null?yF:Math.pow(yF,i),new Lg(this.r*i,this.g*i,this.b*i,this.opacity);},rgb(){return this;},clamp(){return new Lg(gC(this.r),gC(this.g),gC(this.b),qY(this.opacity));},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1;},hex:NBe,formatHex:NBe,formatHex8:YMt,formatRgb:PBe,toString:PBe}));function NBe(){return`#${pC(this.r)}${pC(this.g)}${pC(this.b)}`;}function YMt(){return`#${pC(this.r)}${pC(this.g)}${pC(this.b)}${pC((isNaN(this.opacity)?1:this.opacity)*255)}`;}function PBe(){const i=qY(this.opacity);return`${i===1?'rgb(':'rgba('}${gC(this.r)}, ${gC(this.g)}, ${gC(this.b)}${i===1?')':`, ${i})`}`;}function qY(i){return isNaN(i)?1:Math.max(0,Math.min(1,i));}function gC(i){return Math.max(0,Math.min(255,Math.round(i)||0));}function pC(i){return i=gC(i),(i<16?'0':'')+i.toString(16);}function BBe(i,s,u,d){return d<=0?i=s=u=NaN:u<=0||u>=1?i=s=NaN:s<=0&&(i=NaN),new M3(i,s,u,d);}function FBe(i){if(i instanceof M3)return new M3(i.h,i.s,i.l,i.opacity);if(i instanceof fC||(i=dC(i)),!i)return new M3;if(i instanceof M3)return i;i=i.rgb();var s=i.r/255,u=i.g/255,d=i.b/255,p=Math.min(s,u,d),v=Math.max(s,u,d),b=NaN,y=v-p,T=(v+p)/2;return y?(s===v?b=(u-d)/y+(u =0))throw new Error(`invalid digits: ${i}`);if(s>15)return cFe;const u=10**s;return function(d){this._+=d[0];for(let p=1,v=d.length;p (i(v=new Date(+v)),v),p.ceil=v=>(i(v=new Date(v-1)),s(v,1),i(v),v),p.round=v=>{const b=p(v),y=p.ceil(v);return v-b y.args);SX(b),d=td(d,[...b])}else d=u.args;if(!d)return;let p=_X(i,s);const v="config";return d[v]!==void 0&&(p==="flowchart-v2"&&(p="flowchart"),d[p]=d[v],delete d[v]),d},gje=function(i,s=null){try{const u=new RegExp(`[%]{2}(?![{]${yRt.source})(?=[}][%]{2}).*
-`,"ig");i=i.trim().replace(u,"").replace(/'/gm,'"'),Xe.debug(`Detecting diagram directive${s!==null?" type:"+s:""} based on the text:${i}`);let d;const p=[];for(;(d=KF.exec(i))!==null;)if(d.index===KF.lastIndex&&KF.lastIndex++,d&&!s||s&&d[1]&&d[1].match(s)||s&&d[2]&&d[2].match(s)){const v=d[1]?d[1]:d[2],b=d[3]?d[3].trim():d[4]?JSON.parse(d[4].trim()):null;p.push({type:v,args:b})}return p.length===0?{type:i,args:null}:p.length===1?p[0]:p}catch(u){return Xe.error(`ERROR: ${u.message} - Unable to parse directive type: '${s}' based on the text: '${i}'`),{type:void 0,args:null}}},kRt=function(i){return i.replace(KF,"")},ERt=function(i,s){for(const[u,d]of s.entries())if(d.match(i))return u;return-1};function Nv(i,s){if(!i)return s;const u=`curve${i.charAt(0).toUpperCase()+i.slice(1)}`;return wRt[u]??s}function TRt(i,s){const u=i.trim();if(u)return s.securityLevel!=="loose"?p9.sanitizeUrl(u):u}const CRt=(i,...s)=>{const u=i.split("."),d=u.length-1,p=u[d];let v=window;for(let b=0;b y.args);SX(b),d=td(d,[...b]);}else d=u.args;if(!d)return;let p=_X(i,s);const v='config';return d[v]!==void 0&&(p==='flowchart-v2'&&(p='flowchart'),d[p]=d[v],delete d[v]),d;},gje=function(i,s=null){try{const u=new RegExp(`[%]{2}(?![{]${yRt.source})(?=[}][%]{2}).*
+`,'ig');i=i.trim().replace(u,'').replace(/'/gm,'"'),Xe.debug(`Detecting diagram directive${s!==null?' type:'+s:''} based on the text:${i}`);let d;const p=[];for(;(d=KF.exec(i))!==null;)if(d.index===KF.lastIndex&&KF.lastIndex++,d&&!s||s&&d[1]&&d[1].match(s)||s&&d[2]&&d[2].match(s)){const v=d[1]?d[1]:d[2],b=d[3]?d[3].trim():d[4]?JSON.parse(d[4].trim()):null;p.push({type:v,args:b});}return p.length===0?{type:i,args:null}:p.length===1?p[0]:p;}catch(u){return Xe.error(`ERROR: ${u.message} - Unable to parse directive type: '${s}' based on the text: '${i}'`),{type:void 0,args:null};}},kRt=function(i){return i.replace(KF,'');},ERt=function(i,s){for(const[u,d]of s.entries())if(d.match(i))return u;return-1;};function Nv(i,s){if(!i)return s;const u=`curve${i.charAt(0).toUpperCase()+i.slice(1)}`;return wRt[u]??s;}function TRt(i,s){const u=i.trim();if(u)return s.securityLevel!=='loose'?p9.sanitizeUrl(u):u;}const CRt=(i,...s)=>{const u=i.split('.'),d=u.length-1,p=u[d];let v=window;for(let b=0;b 64)){if(s<0)return!1;d+=6}return d%8===0}function lzt(i){var s,u,d=i.replace(/[\r\n=]/g,""),p=d.length,v=V2e,b=0,y=[];for(s=0;s >16&255),y.push(b>>8&255),y.push(b&255)),b=b<<6|v.indexOf(d.charAt(s));return u=p%4*6,u===0?(y.push(b>>16&255),y.push(b>>8&255),y.push(b&255)):u===18?(y.push(b>>10&255),y.push(b>>2&255)):u===12&&y.push(b>>4&255),new Uint8Array(y)}function hzt(i){var s="",u=0,d,p,v=i.length,b=V2e;for(d=0;d 64)){if(s<0)return!1;d+=6;}return d%8===0;}function lzt(i){var s,u,d=i.replace(/[\r\n=]/g,''),p=d.length,v=V2e,b=0,y=[];for(s=0;s >16&255),y.push(b>>8&255),y.push(b&255)),b=b<<6|v.indexOf(d.charAt(s));return u=p%4*6,u===0?(y.push(b>>16&255),y.push(b>>8&255),y.push(b&255)):u===18?(y.push(b>>10&255),y.push(b>>2&255)):u===12&&y.push(b>>4&255),new Uint8Array(y);}function hzt(i){var s='',u=0,d,p,v=i.length,b=V2e;for(d=0;dBpe&&d.state0&&(d=0);break}return d>0?i.slice(0,d)+i.slice(p+1):i}var uFe;function HIt(i,s){var u=tX(i,s);if(!u)return i+"";var d=u[0],p=u[1],v=p-(uFe=Math.max(-8,Math.min(8,Math.floor(p/3)))*3)+1,b=d.length;return v===b?d:v>b?d+new Array(v-b+1).join("0"):v>0?d.slice(0,v)+"."+d.slice(v):"0."+new Array(1-v).join("0")+tX(i,Math.max(0,s+v-1))[0]}function lFe(i,s){var u=tX(i,s);if(!u)return i+"";var d=u[0],p=u[1];return p<0?"0."+new Array(-p).join("0")+d:d.length>p+1?d.slice(0,p+1)+"."+d.slice(p+1):d+new Array(p-d.length+2).join("0")}const hFe={"%":(i,s)=>(i*100).toFixed(s),b:i=>Math.round(i).toString(2),c:i=>i+"",d:RIt,e:(i,s)=>i.toExponential(s),f:(i,s)=>i.toFixed(s),g:(i,s)=>i.toPrecision(s),o:i=>Math.round(i).toString(8),p:(i,s)=>lFe(i*100,s),r:lFe,s:HIt,X:i=>Math.round(i).toString(16).toUpperCase(),x:i=>Math.round(i).toString(16)};function fFe(i){return i}var dFe=Array.prototype.map,gFe=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function VIt(i){var s=i.grouping===void 0||i.thousands===void 0?fFe:jIt(dFe.call(i.grouping,Number),i.thousands+""),u=i.currency===void 0?"":i.currency[0]+"",d=i.currency===void 0?"":i.currency[1]+"",p=i.decimal===void 0?".":i.decimal+"",v=i.numerals===void 0?fFe:$It(dFe.call(i.numerals,String)),b=i.percent===void 0?"%":i.percent+"",y=i.minus===void 0?"−":i.minus+"",T=i.nan===void 0?"NaN":i.nan+"";function _(P){P=nX(P);var R=P.fill,F=P.align,j=P.sign,W=P.symbol,ee=P.zero,ie=P.width,oe=P.comma,be=P.precision,ge=P.trim,ae=P.type;ae==="n"?(oe=!0,ae="g"):hFe[ae]||(be===void 0&&(be=12),ge=!0,ae="g"),(ee||R==="0"&&F==="=")&&(ee=!0,R="0",F="=");var ne=W==="$"?u:W==="#"&&/[boxX]/.test(ae)?"0"+ae.toLowerCase():"",se=W==="$"?d:/[%p]/.test(ae)?b:"",de=hFe[ae],X=/[defgprs%]/.test(ae);be=be===void 0?6:/[gprs]/.test(ae)?Math.max(1,Math.min(21,be)):Math.max(0,Math.min(20,be));function pe(K){var xe=ne,U=se,Be,Ne,je;if(ae==="c")U=de(K)+U,K="";else{K=+K;var Ie=K<0||1/K<0;if(K=isNaN(K)?T:de(Math.abs(K),be),ge&&(K=qIt(K)),Ie&&+K==0&&j!=="+"&&(Ie=!1),xe=(Ie?j==="("?j:y:j==="-"||j==="("?"":j)+xe,U=(ae==="s"?gFe[8+uFe/3]:"")+U+(Ie&&j==="("?")":""),X){for(Be=-1,Ne=K.length;++Be
/gi,fPt=i=>i?TRe(i).replace(/\\n/g,"#br#").split("#br#"):[""],dPt=(()=>{let i=!1;return()=>{i||(gPt(),i=!0)}})();function gPt(){const i="data-temp-href-target";hD.addHook("beforeSanitizeAttributes",s=>{s.tagName==="A"&&s.hasAttribute("target")&&s.setAttribute(i,s.getAttribute("target")||"")}),hD.addHook("afterSanitizeAttributes",s=>{s.tagName==="A"&&s.hasAttribute(i)&&(s.setAttribute("target",s.getAttribute(i)||""),s.removeAttribute(i),s.getAttribute("target")==="_blank"&&s.setAttribute("rel","noopener"))})}const kRe=i=>(dPt(),hD.sanitize(i)),ERe=(i,s)=>{var u;if(((u=s.flowchart)==null?void 0:u.htmlLabels)!==!1){const d=s.securityLevel;d==="antiscript"||d==="strict"?i=kRe(i):d!=="loose"&&(i=TRe(i),i=i.replace(//g,">"),i=i.replace(/=/g,"="),i=vPt(i))}return i},xh=(i,s)=>i&&(s.dompurifyConfig?i=hD.sanitize(ERe(i,s),s.dompurifyConfig).toString():i=hD.sanitize(ERe(i,s),{FORBID_TAGS:["style"]}).toString(),i),pPt=(i,s)=>typeof i=="string"?xh(i,s):i.flat().map(u=>xh(u,s)),bPt=i=>fD.test(i),mPt=i=>i.split(fD),vPt=i=>i.replace(/#br#/g,"
"),TRe=i=>i.replace(fD,"#br#"),wPt=i=>{let s="";return i&&(s=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,s=s.replaceAll(/\(/g,"\\("),s=s.replaceAll(/\)/g,"\\)")),s},l1=i=>!(i===!1||["false","null","0"].includes(String(i).trim().toLowerCase())),yPt=function(...i){const s=i.filter(u=>!isNaN(u));return Math.max(...s)},xPt=function(...i){const s=i.filter(u=>!isNaN(u));return Math.min(...s)},VF=function(i){const s=i.split(/(,)/),u=[];for(let d=0;ds?1:i>=s?0:NaN;}function FAt(i,s){return i==null||s==null?NaN:si?1:s>=i?0:NaN;}function gpe(i){let s,u,d;i.length!==2?(s=IY,u=(y,T)=>IY(i(y),T),d=(y,T)=>i(y)-T):(s=i===IY||i===FAt?i:RAt,u=i,d=i);function p(y,T,_=0,A=y.length){if(_>>1;u(y[P],T)<0?_=P+1:A=P;}while(_>>1;u(y[P],T)<=0?_=P+1:A=P;}while(__&&d(y[P-1],T)>-d(y[P],T)?P-1:P;}return{left:p,center:b,right:v};}function RAt(){return 0;}function jAt(i){return i===null?NaN:+i;}const $At=gpe(IY).right;gpe(jAt).center;const zAt=$At;class uBe extends Map{constructor(s,u=VAt){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:u}}),s!=null)for(const[d,p]of s)this.set(d,p);}get(s){return super.get(lBe(this,s));}has(s){return super.has(lBe(this,s));}set(s,u){return super.set(qAt(this,s),u);}delete(s){return super.delete(HAt(this,s));}}function lBe({_intern:i,_key:s},u){const d=s(u);return i.has(d)?i.get(d):u;}function qAt({_intern:i,_key:s},u){const d=s(u);return i.has(d)?i.get(d):(i.set(d,u),u);}function HAt({_intern:i,_key:s},u){const d=s(u);return i.has(d)&&(u=i.get(d),i.delete(d)),u;}function VAt(i){return i!==null&&typeof i=='object'?i.valueOf():i;}const UAt=Math.sqrt(50),GAt=Math.sqrt(10),KAt=Math.sqrt(2);function OY(i,s,u){const d=(s-i)/Math.max(0,u),p=Math.floor(Math.log10(d)),v=d/Math.pow(10,p),b=v>=UAt?10:v>=GAt?5:v>=KAt?2:1;let y,T,_;return p<0?(_=Math.pow(10,-p)/b,y=Math.round(i*_),T=Math.round(s*_),y/_s&&--T,_=-_):(_=Math.pow(10,p)*b,y=Math.round(i/_),T=Math.round(s/_),y*_s&&--T),T=0&&(d=u.slice(p+1),u=u.slice(0,p)),u&&!s.hasOwnProperty(u))throw new Error('unknown type: '+u);return{type:u,name:d};});}BY.prototype=dBe.prototype={constructor:BY,on:function(i,s){var u=this._,d=oLt(i+'',u),p,v=-1,b=d.length;if(arguments.length<2){for(;++v0)for(var u=new Array(p),d=0,p,v;dBpe&&d.state0&&(d=0);break;}return d>0?i.slice(0,d)+i.slice(p+1):i;}var uFe;function HIt(i,s){var u=tX(i,s);if(!u)return i+'';var d=u[0],p=u[1],v=p-(uFe=Math.max(-8,Math.min(8,Math.floor(p/3)))*3)+1,b=d.length;return v===b?d:v>b?d+new Array(v-b+1).join('0'):v>0?d.slice(0,v)+'.'+d.slice(v):'0.'+new Array(1-v).join('0')+tX(i,Math.max(0,s+v-1))[0];}function lFe(i,s){var u=tX(i,s);if(!u)return i+'';var d=u[0],p=u[1];return p<0?'0.'+new Array(-p).join('0')+d:d.length>p+1?d.slice(0,p+1)+'.'+d.slice(p+1):d+new Array(p-d.length+2).join('0');}const hFe={'%':(i,s)=>(i*100).toFixed(s),b:i=>Math.round(i).toString(2),c:i=>i+'',d:RIt,e:(i,s)=>i.toExponential(s),f:(i,s)=>i.toFixed(s),g:(i,s)=>i.toPrecision(s),o:i=>Math.round(i).toString(8),p:(i,s)=>lFe(i*100,s),r:lFe,s:HIt,X:i=>Math.round(i).toString(16).toUpperCase(),x:i=>Math.round(i).toString(16)};function fFe(i){return i;}var dFe=Array.prototype.map,gFe=['y','z','a','f','p','n','µ','m','','k','M','G','T','P','E','Z','Y'];function VIt(i){var s=i.grouping===void 0||i.thousands===void 0?fFe:jIt(dFe.call(i.grouping,Number),i.thousands+''),u=i.currency===void 0?'':i.currency[0]+'',d=i.currency===void 0?'':i.currency[1]+'',p=i.decimal===void 0?'.':i.decimal+'',v=i.numerals===void 0?fFe:$It(dFe.call(i.numerals,String)),b=i.percent===void 0?'%':i.percent+'',y=i.minus===void 0?'−':i.minus+'',T=i.nan===void 0?'NaN':i.nan+'';function _(P){P=nX(P);var R=P.fill,F=P.align,j=P.sign,W=P.symbol,ee=P.zero,ie=P.width,oe=P.comma,be=P.precision,ge=P.trim,ae=P.type;ae==='n'?(oe=!0,ae='g'):hFe[ae]||(be===void 0&&(be=12),ge=!0,ae='g'),(ee||R==='0'&&F==='=')&&(ee=!0,R='0',F='=');var ne=W==='$'?u:W==='#'&&/[boxX]/.test(ae)?'0'+ae.toLowerCase():'',se=W==='$'?d:/[%p]/.test(ae)?b:'',de=hFe[ae],X=/[defgprs%]/.test(ae);be=be===void 0?6:/[gprs]/.test(ae)?Math.max(1,Math.min(21,be)):Math.max(0,Math.min(20,be));function pe(K){var xe=ne,U=se,Be,Ne,je;if(ae==='c')U=de(K)+U,K='';else{K=+K;var Ie=K<0||1/K<0;if(K=isNaN(K)?T:de(Math.abs(K),be),ge&&(K=qIt(K)),Ie&&+K==0&&j!=='+'&&(Ie=!1),xe=(Ie?j==='('?j:y:j==='-'||j==='('?'':j)+xe,U=(ae==='s'?gFe[8+uFe/3]:'')+U+(Ie&&j==='('?')':''),X){for(Be=-1,Ne=K.length;++Be
/gi,fPt=i=>i?TRe(i).replace(/\\n/g,'#br#').split('#br#'):[''],dPt=(()=>{let i=!1;return()=>{i||(gPt(),i=!0);};})();function gPt(){const i='data-temp-href-target';hD.addHook('beforeSanitizeAttributes',s=>{s.tagName==='A'&&s.hasAttribute('target')&&s.setAttribute(i,s.getAttribute('target')||'');}),hD.addHook('afterSanitizeAttributes',s=>{s.tagName==='A'&&s.hasAttribute(i)&&(s.setAttribute('target',s.getAttribute(i)||''),s.removeAttribute(i),s.getAttribute('target')==='_blank'&&s.setAttribute('rel','noopener'));});}const kRe=i=>(dPt(),hD.sanitize(i)),ERe=(i,s)=>{var u;if(((u=s.flowchart)==null?void 0:u.htmlLabels)!==!1){const d=s.securityLevel;d==='antiscript'||d==='strict'?i=kRe(i):d!=='loose'&&(i=TRe(i),i=i.replace(//g,'>'),i=i.replace(/=/g,'='),i=vPt(i));}return i;},xh=(i,s)=>i&&(s.dompurifyConfig?i=hD.sanitize(ERe(i,s),s.dompurifyConfig).toString():i=hD.sanitize(ERe(i,s),{FORBID_TAGS:['style']}).toString(),i),pPt=(i,s)=>typeof i=='string'?xh(i,s):i.flat().map(u=>xh(u,s)),bPt=i=>fD.test(i),mPt=i=>i.split(fD),vPt=i=>i.replace(/#br#/g,'
'),TRe=i=>i.replace(fD,'#br#'),wPt=i=>{let s='';return i&&(s=window.location.protocol+'//'+window.location.host+window.location.pathname+window.location.search,s=s.replaceAll(/\(/g,'\\('),s=s.replaceAll(/\)/g,'\\)')),s;},l1=i=>!(i===!1||['false','null','0'].includes(String(i).trim().toLowerCase())),yPt=function(...i){const s=i.filter(u=>!isNaN(u));return Math.max(...s);},xPt=function(...i){const s=i.filter(u=>!isNaN(u));return Math.min(...s);},VF=function(i){const s=i.split(/(,)/),u=[];for(let d=0;d0){if(++s>=fRt)return arguments[0]}else s=0;return i.apply(void 0,arguments)}}var bRt=pRt(hRt);const fje=bRt;function RX(i,s){return fje(hje(i,s,OC),i+"")}function ZF(i,s,u){if(!am(u))return!1;var d=typeof s;return(d=="number"?w9(u)&&FX(s,u.length):d=="string"&&s in u)?pD(u[s],i):!1}function mRt(i){return RX(function(s,u){var d=-1,p=u.length,v=p>1?u[p-1]:void 0,b=p>2?u[2]:void 0;for(v=i.length>3&&typeof v=="function"?(p--,v):void 0,b&&ZF(u[0],u[1],b)&&(v=p<3?void 0:v,p=1),s=Object(s);++d
"},u),ci.lineBreakRegex.test(i)))return i;const d=i.split(" "),p=[];let v="";return d.forEach((b,y)=>{const T=V4(`${b} `,u),_=V4(v,u);if(T>s){const{hyphenatedStrings:R,remainingWord:F}=ORt(b,s,"-",u);p.push(v,...R),v=F}else _+T>=s?(p.push(v),v=b):v=[v,b].filter(Boolean).join(" ");y+1===d.length&&p.push(v)}),p.filter(b=>b!=="").join(u.joinWith)},(i,s,u)=>`${i}${s}${u.fontSize}${u.fontWeight}${u.fontFamily}${u.joinWith}`),ORt=bD((i,s,u="-",d)=>{d=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",margin:0},d);const p=[...i],v=[];let b="";return p.forEach((y,T)=>{const _=`${b}${y}`;if(V4(_,d)>=s){const P=T+1,R=p.length===P,F=`${_}${u}`;v.push(R?_:F),b=""}else b=_}),{hyphenatedStrings:v,remainingWord:b}},(i,s,u="-",d)=>`${i}${s}${u}${d.fontSize}${d.fontWeight}${d.fontFamily}`);function T2e(i,s){return C2e(i,s).height}function V4(i,s){return C2e(i,s).width}const C2e=bD((i,s)=>{const{fontSize:u=12,fontFamily:d="Arial",fontWeight:p=400}=s;if(!i)return{width:0,height:0};const[,v]=NC(u),b=["sans-serif",d],y=i.split(ci.lineBreakRegex),T=[],_=Ir("body");if(!_.remove)return{width:0,height:0,lineHeight:0};const A=_.append("svg");for(const R of b){let F=0;const j={width:0,height:0,lineHeight:0};for(const W of y){const ee=DRt();ee.text=W||dje;const ie=IRt(A,ee).style("font-size",v).style("font-weight",p).style("font-family",R),oe=(ie._groups||ie)[0][0].getBBox();if(oe.width===0&&oe.height===0)throw new Error("svg element not in render tree");j.width=Math.round(Math.max(j.width,oe.width)),F=Math.round(oe.height),j.height+=F,j.lineHeight=Math.round(Math.max(j.lineHeight,F))}T.push(j)}A.remove();const P=isNaN(T[1].height)||isNaN(T[1].width)||isNaN(T[1].lineHeight)||T[0].height>T[1].height&&T[0].width>T[1].width&&T[0].lineHeight>T[1].lineHeight?0:1;return T[P]},(i,s)=>`${i}${s.fontSize}${s.fontWeight}${s.fontFamily}`);class NRt{constructor(s=!1,u){this.count=0,this.count=u?u.length:0,this.next=s?()=>this.count++:()=>Date.now()}}let $X;const PRt=function(i){return $X=$X||document.createElement("div"),i=escape(i).replace(/%26/g,"&").replace(/%23/g,"#").replace(/%3B/g,";"),$X.innerHTML=i,unescape($X.textContent)};function xje(i){return"str"in i}const BRt=(i,s,u,d)=>{var v;if(!d)return;const p=(v=i.node())==null?void 0:v.getBBox();p&&i.append("text").text(d).attr("x",p.x+p.width/2).attr("y",-u).attr("class",s)},NC=i=>{if(typeof i=="number")return[i,i+"px"];const s=parseInt(i??"",10);return Number.isNaN(s)?[void 0,void 0]:i===String(s)?[s,i+"px"]:[s,i]};function eR(i,s){return jX({},i,s)}const So={assignWithDepth:td,wrapLabel:yje,calculateTextHeight:T2e,calculateTextWidth:V4,calculateTextDimensions:C2e,cleanAndMerge:eR,detectInit:xRt,detectDirective:gje,isSubstringInArray:ERt,interpolateToCurve:Nv,calcLabelPosition:_Rt,calcCardinalityPosition:ARt,calcTerminalLabelPosition:LRt,formatUrl:TRt,getStylesFromArray:om,generateId:vje,random:wje,runFunc:CRt,entityDecode:PRt,insertTitle:BRt,parseFontSize:NC,InitIDGenerator:NRt},FRt=function(i){let s=i;return s=s.replace(/style.*:\S*#.*;/g,function(u){return u.substring(0,u.length-1)}),s=s.replace(/classDef.*:\S*#.*;/g,function(u){return u.substring(0,u.length-1)}),s=s.replace(/#\w+;/g,function(u){const d=u.substring(1,u.length-1);return/^\+?\d+$/.test(d)?"fl°°"+d+"¶ß":"fl°"+d+"¶ß"}),s},tR=function(i){return i.replace(/fl°°/g,"").replace(/fl°/g,"&").replace(/¶ß/g,";")};var kje="comm",Eje="rule",Tje="decl",RRt="@import",jRt="@keyframes",$Rt="@layer",Cje=Math.abs,S2e=String.fromCharCode;function Sje(i){return i.trim()}function zX(i,s,u){return i.replace(s,u)}function zRt(i,s,u){return i.indexOf(s,u)}function nR(i,s){return i.charCodeAt(s)|0}function rR(i,s,u){return i.slice(s,u)}function _7(i){return i.length}function qRt(i){return i.length}function qX(i,s){return s.push(i),i}var HX=1,xD=1,_je=0,Pv=0,D0=0,kD="";function _2e(i,s,u,d,p,v,b,y){return{value:i,root:s,parent:u,type:d,props:p,children:v,line:HX,column:xD,length:b,return:"",siblings:y}}function HRt(){return D0}function VRt(){return D0=Pv>0?nR(kD,--Pv):0,xD--,D0===10&&(xD=1,HX--),D0}function F3(){return D0=Pv<_je?nR(kD,Pv++):0,xD++,D0===10&&(xD=1,HX++),D0}function PC(){return nR(kD,Pv)}function VX(){return Pv}function UX(i,s){return rR(kD,i,s)}function A2e(i){switch(i){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function URt(i){return HX=xD=1,_je=_7(kD=i),Pv=0,[]}function GRt(i){return kD="",i}function L2e(i){return Sje(UX(Pv-1,M2e(i===91?i+2:i===40?i+1:i)))}function KRt(i){for(;(D0=PC())&&D0<33;)F3();return A2e(i)>2||A2e(D0)>3?"":" "}function WRt(i,s){for(;--s&&F3()&&!(D0<48||D0>102||D0>57&&D0<65||D0>70&&D0<97););return UX(i,VX()+(s<6&&PC()==32&&F3()==32))}function M2e(i){for(;F3();)switch(D0){case i:return Pv;case 34:case 39:i!==34&&i!==39&&M2e(D0);break;case 40:i===41&&M2e(i);break;case 92:F3();break}return Pv}function YRt(i,s){for(;F3()&&i+D0!==47+10;)if(i+D0===42+42&&PC()===47)break;return"/*"+UX(s,Pv-1)+"*"+S2e(i===47?i:F3())}function XRt(i){for(;!A2e(PC());)F3();return UX(i,Pv)}function QRt(i){return GRt(GX("",null,null,null,[""],i=URt(i),0,[0],i))}function GX(i,s,u,d,p,v,b,y,T){for(var _=0,A=0,P=b,R=0,F=0,j=0,W=1,ee=1,ie=1,oe=0,be="",ge=p,ae=v,ne=d,se=be;ee;)switch(j=oe,oe=F3()){case 40:if(j!=108&&nR(se,P-1)==58){zRt(se+=zX(L2e(oe),"&","&\f"),"&\f",Cje(_?y[_-1]:0))!=-1&&(ie=-1);break}case 34:case 39:case 91:se+=L2e(oe);break;case 9:case 10:case 13:case 32:se+=KRt(j);break;case 92:se+=WRt(VX()-1,7);continue;case 47:switch(PC()){case 42:case 47:qX(JRt(YRt(F3(),VX()),s,u,T),T);break;default:se+="/"}break;case 123*W:y[_++]=_7(se)*ie;case 125*W:case 59:case 0:switch(oe){case 0:case 125:ee=0;case 59+A:ie==-1&&(se=zX(se,/\f/g,"")),F>0&&_7(se)-P&&qX(F>32?Lje(se+";",d,u,P-1,T):Lje(zX(se," ","")+";",d,u,P-2,T),T);break;case 59:se+=";";default:if(qX(ne=Aje(se,s,u,_,A,p,y,be,ge=[],ae=[],P,v),v),oe===123)if(A===0)GX(se,s,ne,ne,ge,v,P,y,ae);else switch(R===99&&nR(se,3)===110?100:R){case 100:case 108:case 109:case 115:GX(i,ne,ne,d&&qX(Aje(i,ne,ne,0,0,p,y,be,p,ge=[],P,ae),ae),p,ae,P,y,d?ge:ae);break;default:GX(se,ne,ne,ne,[""],ae,0,y,ae)}}_=A=F=0,W=ie=1,be=se="",P=b;break;case 58:P=1+_7(se),F=j;default:if(W<1){if(oe==123)--W;else if(oe==125&&W++==0&&VRt()==125)continue}switch(se+=S2e(oe),oe*W){case 38:ie=A>0?1:(se+="\f",-1);break;case 44:y[_++]=(_7(se)-1)*ie,ie=1;break;case 64:PC()===45&&(se+=L2e(F3())),R=PC(),A=P=_7(be=se+=XRt(VX())),oe++;break;case 45:j===45&&_7(se)==2&&(W=0)}}return v}function Aje(i,s,u,d,p,v,b,y,T,_,A,P){for(var R=p-1,F=p===0?v:[""],j=qRt(F),W=0,ee=0,ie=0;W0){if(++s>=fRt)return arguments[0];}else s=0;return i.apply(void 0,arguments);};}var bRt=pRt(hRt);const fje=bRt;function RX(i,s){return fje(hje(i,s,OC),i+'');}function ZF(i,s,u){if(!am(u))return!1;var d=typeof s;return(d=='number'?w9(u)&&FX(s,u.length):d=='string'&&s in u)?pD(u[s],i):!1;}function mRt(i){return RX(function(s,u){var d=-1,p=u.length,v=p>1?u[p-1]:void 0,b=p>2?u[2]:void 0;for(v=i.length>3&&typeof v=='function'?(p--,v):void 0,b&&ZF(u[0],u[1],b)&&(v=p<3?void 0:v,p=1),s=Object(s);++d
'},u),ci.lineBreakRegex.test(i)))return i;const d=i.split(' '),p=[];let v='';return d.forEach((b,y)=>{const T=V4(`${b} `,u),_=V4(v,u);if(T>s){const{hyphenatedStrings:R,remainingWord:F}=ORt(b,s,'-',u);p.push(v,...R),v=F;}else _+T>=s?(p.push(v),v=b):v=[v,b].filter(Boolean).join(' ');y+1===d.length&&p.push(v);}),p.filter(b=>b!=='').join(u.joinWith);},(i,s,u)=>`${i}${s}${u.fontSize}${u.fontWeight}${u.fontFamily}${u.joinWith}`),ORt=bD((i,s,u='-',d)=>{d=Object.assign({fontSize:12,fontWeight:400,fontFamily:'Arial',margin:0},d);const p=[...i],v=[];let b='';return p.forEach((y,T)=>{const _=`${b}${y}`;if(V4(_,d)>=s){const P=T+1,R=p.length===P,F=`${_}${u}`;v.push(R?_:F),b='';}else b=_;}),{hyphenatedStrings:v,remainingWord:b};},(i,s,u='-',d)=>`${i}${s}${u}${d.fontSize}${d.fontWeight}${d.fontFamily}`);function T2e(i,s){return C2e(i,s).height;}function V4(i,s){return C2e(i,s).width;}const C2e=bD((i,s)=>{const{fontSize:u=12,fontFamily:d='Arial',fontWeight:p=400}=s;if(!i)return{width:0,height:0};const[,v]=NC(u),b=['sans-serif',d],y=i.split(ci.lineBreakRegex),T=[],_=Ir('body');if(!_.remove)return{width:0,height:0,lineHeight:0};const A=_.append('svg');for(const R of b){let F=0;const j={width:0,height:0,lineHeight:0};for(const W of y){const ee=DRt();ee.text=W||dje;const ie=IRt(A,ee).style('font-size',v).style('font-weight',p).style('font-family',R),oe=(ie._groups||ie)[0][0].getBBox();if(oe.width===0&&oe.height===0)throw new Error('svg element not in render tree');j.width=Math.round(Math.max(j.width,oe.width)),F=Math.round(oe.height),j.height+=F,j.lineHeight=Math.round(Math.max(j.lineHeight,F));}T.push(j);}A.remove();const P=isNaN(T[1].height)||isNaN(T[1].width)||isNaN(T[1].lineHeight)||T[0].height>T[1].height&&T[0].width>T[1].width&&T[0].lineHeight>T[1].lineHeight?0:1;return T[P];},(i,s)=>`${i}${s.fontSize}${s.fontWeight}${s.fontFamily}`);class NRt{constructor(s=!1,u){this.count=0,this.count=u?u.length:0,this.next=s?()=>this.count++:()=>Date.now();}}let $X;const PRt=function(i){return $X=$X||document.createElement('div'),i=escape(i).replace(/%26/g,'&').replace(/%23/g,'#').replace(/%3B/g,';'),$X.innerHTML=i,unescape($X.textContent);};function xje(i){return'str'in i;}const BRt=(i,s,u,d)=>{var v;if(!d)return;const p=(v=i.node())==null?void 0:v.getBBox();p&&i.append('text').text(d).attr('x',p.x+p.width/2).attr('y',-u).attr('class',s);},NC=i=>{if(typeof i=='number')return[i,i+'px'];const s=parseInt(i??'',10);return Number.isNaN(s)?[void 0,void 0]:i===String(s)?[s,i+'px']:[s,i];};function eR(i,s){return jX({},i,s);}const So={assignWithDepth:td,wrapLabel:yje,calculateTextHeight:T2e,calculateTextWidth:V4,calculateTextDimensions:C2e,cleanAndMerge:eR,detectInit:xRt,detectDirective:gje,isSubstringInArray:ERt,interpolateToCurve:Nv,calcLabelPosition:_Rt,calcCardinalityPosition:ARt,calcTerminalLabelPosition:LRt,formatUrl:TRt,getStylesFromArray:om,generateId:vje,random:wje,runFunc:CRt,entityDecode:PRt,insertTitle:BRt,parseFontSize:NC,InitIDGenerator:NRt},FRt=function(i){let s=i;return s=s.replace(/style.*:\S*#.*;/g,function(u){return u.substring(0,u.length-1);}),s=s.replace(/classDef.*:\S*#.*;/g,function(u){return u.substring(0,u.length-1);}),s=s.replace(/#\w+;/g,function(u){const d=u.substring(1,u.length-1);return/^\+?\d+$/.test(d)?'fl°°'+d+'¶ß':'fl°'+d+'¶ß';}),s;},tR=function(i){return i.replace(/fl°°/g,'').replace(/fl°/g,'&').replace(/¶ß/g,';');};var kje='comm',Eje='rule',Tje='decl',RRt='@import',jRt='@keyframes',$Rt='@layer',Cje=Math.abs,S2e=String.fromCharCode;function Sje(i){return i.trim();}function zX(i,s,u){return i.replace(s,u);}function zRt(i,s,u){return i.indexOf(s,u);}function nR(i,s){return i.charCodeAt(s)|0;}function rR(i,s,u){return i.slice(s,u);}function _7(i){return i.length;}function qRt(i){return i.length;}function qX(i,s){return s.push(i),i;}var HX=1,xD=1,_je=0,Pv=0,D0=0,kD='';function _2e(i,s,u,d,p,v,b,y){return{value:i,root:s,parent:u,type:d,props:p,children:v,line:HX,column:xD,length:b,return:'',siblings:y};}function HRt(){return D0;}function VRt(){return D0=Pv>0?nR(kD,--Pv):0,xD--,D0===10&&(xD=1,HX--),D0;}function F3(){return D0=Pv<_je?nR(kD,Pv++):0,xD++,D0===10&&(xD=1,HX++),D0;}function PC(){return nR(kD,Pv);}function VX(){return Pv;}function UX(i,s){return rR(kD,i,s);}function A2e(i){switch(i){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1;}return 0;}function URt(i){return HX=xD=1,_je=_7(kD=i),Pv=0,[];}function GRt(i){return kD='',i;}function L2e(i){return Sje(UX(Pv-1,M2e(i===91?i+2:i===40?i+1:i)));}function KRt(i){for(;(D0=PC())&&D0<33;)F3();return A2e(i)>2||A2e(D0)>3?'':' ';}function WRt(i,s){for(;--s&&F3()&&!(D0<48||D0>102||D0>57&&D0<65||D0>70&&D0<97););return UX(i,VX()+(s<6&&PC()==32&&F3()==32));}function M2e(i){for(;F3();)switch(D0){case i:return Pv;case 34:case 39:i!==34&&i!==39&&M2e(D0);break;case 40:i===41&&M2e(i);break;case 92:F3();break;}return Pv;}function YRt(i,s){for(;F3()&&i+D0!==47+10;)if(i+D0===42+42&&PC()===47)break;return'/*'+UX(s,Pv-1)+'*'+S2e(i===47?i:F3());}function XRt(i){for(;!A2e(PC());)F3();return UX(i,Pv);}function QRt(i){return GRt(GX('',null,null,null,[''],i=URt(i),0,[0],i));}function GX(i,s,u,d,p,v,b,y,T){for(var _=0,A=0,P=b,R=0,F=0,j=0,W=1,ee=1,ie=1,oe=0,be='',ge=p,ae=v,ne=d,se=be;ee;)switch(j=oe,oe=F3()){case 40:if(j!=108&&nR(se,P-1)==58){zRt(se+=zX(L2e(oe),'&','&\f'),'&\f',Cje(_?y[_-1]:0))!=-1&&(ie=-1);break;}case 34:case 39:case 91:se+=L2e(oe);break;case 9:case 10:case 13:case 32:se+=KRt(j);break;case 92:se+=WRt(VX()-1,7);continue;case 47:switch(PC()){case 42:case 47:qX(JRt(YRt(F3(),VX()),s,u,T),T);break;default:se+='/';}break;case 123*W:y[_++]=_7(se)*ie;case 125*W:case 59:case 0:switch(oe){case 0:case 125:ee=0;case 59+A:ie==-1&&(se=zX(se,/\f/g,'')),F>0&&_7(se)-P&&qX(F>32?Lje(se+';',d,u,P-1,T):Lje(zX(se,' ','')+';',d,u,P-2,T),T);break;case 59:se+=';';default:if(qX(ne=Aje(se,s,u,_,A,p,y,be,ge=[],ae=[],P,v),v),oe===123)if(A===0)GX(se,s,ne,ne,ge,v,P,y,ae);else switch(R===99&&nR(se,3)===110?100:R){case 100:case 108:case 109:case 115:GX(i,ne,ne,d&&qX(Aje(i,ne,ne,0,0,p,y,be,p,ge=[],P,ae),ae),p,ae,P,y,d?ge:ae);break;default:GX(se,ne,ne,ne,[''],ae,0,y,ae);}}_=A=F=0,W=ie=1,be=se='',P=b;break;case 58:P=1+_7(se),F=j;default:if(W<1){if(oe==123)--W;else if(oe==125&&W++==0&&VRt()==125)continue;}switch(se+=S2e(oe),oe*W){case 38:ie=A>0?1:(se+='\f',-1);break;case 44:y[_++]=(_7(se)-1)*ie,ie=1;break;case 64:PC()===45&&(se+=L2e(F3())),R=PC(),A=P=_7(be=se+=XRt(VX())),oe++;break;case 45:j===45&&_7(se)==2&&(W=0);}}return v;}function Aje(i,s,u,d,p,v,b,y,T,_,A,P){for(var R=p-1,F=p===0?v:[''],j=qRt(F),W=0,ee=0,ie=0;Ws)&&(ee&&(b=i.line,y=i.lineStart,T=i.position),MD(i,s,ZX,!0,p)&&(ee?j=i.result:W=i.result),ee||(LD(i,P,R,F,j,W,b,y,T),F=j=W=null),I0(i,!0,-1),oe=i.input.charCodeAt(i.position)),(i.line===v||i.lineIndent>s)&&oe!==0)oa(i,"bad indentation of a mapping entry");else if(i.lineIndents?T=1:i.lineIndent===s?T=0:i.lineIndents?T=1:i.lineIndent===s?T=0:i.lineIndent tag; it should be "scalar", not "'+i.kind+'"'),P=0,R=i.implicitTypes.length;Ps)&&(ee&&(b=i.line,y=i.lineStart,T=i.position),MD(i,s,ZX,!0,p)&&(ee?j=i.result:W=i.result),ee||(LD(i,P,R,F,j,W,b,y,T),F=j=W=null),I0(i,!0,-1),oe=i.input.charCodeAt(i.position)),(i.line===v||i.lineIndent>s)&&oe!==0)oa(i,'bad indentation of a mapping entry');else if(i.lineIndents?T=1:i.lineIndent===s?T=0:i.lineIndents?T=1:i.lineIndent===s?T=0:i.lineIndent tag; it should be "scalar", not "'+i.kind+'"'),P=0,R=i.implicitTypes.length;P
/g,"
"),d},Eqt=(i="",s)=>{var p,v;const u=(v=(p=s==null?void 0:s.viewBox)==null?void 0:p.baseVal)!=null&&v.height?s.viewBox.baseVal.height+"px":fqt,d=btoa(''+i+"");return``;},z$e=(i,s,u,d,p)=>{const v=i.append('div');v.attr('id',u),d&&v.attr('style',d);const b=v.append('svg').attr('id',s).attr('width','100%').attr('xmlns',cqt);return p&&b.attr('xmlns:xlink',p),b.append('g'),i;};function q$e(i,s){return i.append('iframe').attr('id',s).attr('style','width: 100%; height: 100%;').attr('sandbox','');}const Tqt=(i,s,u,d)=>{var p,v,b;(p=i.getElementById(s))==null||p.remove(),(v=i.getElementById(u))==null||v.remove(),(b=i.getElementById(d))==null||b.remove();},Cqt=async function(i,s,u){var U,Be,Ne,je,Ie,Se;F2e();const d=j$e(s);s=d.code;const p=kh();Xe.debug(p),s.length>((p==null?void 0:p.maxTextSize)??iqt)&&(s=sqt);const v='#'+i,b='i'+i,y='#'+b,T='d'+i,_='#'+T;let A=Ir('body');const P=p.securityLevel===aqt,R=p.securityLevel===oqt,F=p.fontFamily;if(u!==void 0){if(u&&(u.innerHTML=''),P){const Ce=q$e(Ir(u),b);A=Ir(Ce.nodes()[0].contentDocument.body),A.node().style.margin=0;}else A=Ir(u);z$e(A,i,T,`font-family: ${F}`,uqt);}else{if(Tqt(document,i,T,b),P){const Ce=q$e(Ir('body'),b);A=Ir(Ce.nodes()[0].contentDocument.body),A.node().style.margin=0;}else A=Ir('body');z$e(A,i,T);}let j,W;try{j=await W2e(s,{title:d.title});}catch(Ce){j=new l$e('error'),W=Ce;}const ee=A.select(_).node(),ie=j.type,oe=ee.firstChild,be=oe.firstChild,ge=(Be=(U=j.renderer).getClasses)==null?void 0:Be.call(U,s,j),ae=xqt(p,ie,ge,v),ne=document.createElement('style');ne.innerHTML=ae,oe.insertBefore(ne,be);try{await j.renderer.draw(s,i,Mje,j);}catch(Ce){throw Njt.draw(s,i,Mje),Ce;}const se=A.select(`${_} svg`),de=(je=(Ne=j.db).getAccTitle)==null?void 0:je.call(Ne),X=(Se=(Ie=j.db).getAccDescription)==null?void 0:Se.call(Ie);_qt(ie,se,de,X),A.select(`[id="${i}"]`).selectAll('foreignobject > *').attr('xmlns',lqt);let pe=A.select(_).node().innerHTML;if(Xe.debug('config.arrowMarkerAbsolute',p.arrowMarkerAbsolute),pe=kqt(pe,P,l1(p.arrowMarkerAbsolute)),P){const Ce=A.select(_+' svg').node();pe=Eqt(pe,Ce);}else R||(pe=hD.sanitize(pe,{ADD_TAGS:mqt,ADD_ATTR:vqt}));if(qjt(),W)throw W;const xe=Ir(P?y:_).node();return xe&&'remove'in xe&&xe.remove(),{svg:pe,bindFunctions:j.db.bindFunctions};};function Sqt(i={}){var u;i!=null&&i.fontFamily&&!((u=i.themeVariables)!=null&&u.fontFamily)&&(i.themeVariables||(i.themeVariables={}),i.themeVariables.fontFamily=i.fontFamily),tjt(i),i!=null&&i.theme&&i.theme in E7?i.themeVariables=E7[i.theme].getThemeVariables(i.themeVariables):i&&(i.themeVariables=E7.default.getThemeVariables(i.themeVariables));const s=typeof i=='object'?ejt(i):Ije();dpe(s.logLevel),F2e();}const W2e=(i,s={})=>{const{code:u}=R$e(i);return zjt(u,s);};function _qt(i,s,u,d){c$t(s,i),u$t(s,u,d,s.attr('id'));}const RC=Object.freeze({render:Cqt,parse:wqt,getDiagramFromText:W2e,initialize:Sqt,getConfig:kh,setConfig:Oje,getSiteConfig:Ije,updateSiteConfig:njt,reset:()=>{WX();},globalReset:()=>{WX(ED);},defaultConfig:ED});dpe(kh().logLevel),WX(kh());const Aqt=async()=>{Xe.debug('Loading registered diagrams');const s=(await Promise.allSettled(Object.entries(dD).map(async([u,{detector:d,loader:p}])=>{if(p)try{B2e(u);}catch{try{const{diagram:b,id:y}=await p();QX(y,b,d);}catch(b){throw Xe.error(`Failed to load external diagram with key ${u}. Removing from detectors.`),delete dD[u],b;}}}))).filter(u=>u.status==='rejected');if(s.length>0){Xe.error(`Failed to load ${s.length} external diagrams`);for(const u of s)Xe.error(u);throw new Error(`Failed to load ${s.length} external diagrams`);}},Lqt=(i,s,u)=>{Xe.warn(i),xje(i)?(u&&u(i.str,i.hash),s.push({...i,message:i.str,error:i})):(u&&u(i),i instanceof Error&&s.push({str:i.message,message:i.message,hash:i.name,error:i}));},H$e=async function(i={querySelector:'.mermaid'}){try{await Mqt(i);}catch(s){if(xje(s)&&Xe.error(s.str),um.parseError&&um.parseError(s),!i.suppressErrors)throw Xe.error('Use the suppressErrors option to suppress these errors'),s;}},Mqt=async function({postRenderCallback:i,querySelector:s,nodes:u}={querySelector:'.mermaid'}){const d=RC.getConfig();Xe.debug(`${i?'':'No '}Callback function found`);let p;if(u)p=u;else if(s)p=document.querySelectorAll(s);else throw new Error('Nodes and querySelector are both undefined');Xe.debug(`Found ${p.length} diagrams`),(d==null?void 0:d.startOnLoad)!==void 0&&(Xe.debug('Start On Load: '+(d==null?void 0:d.startOnLoad)),RC.updateSiteConfig({startOnLoad:d==null?void 0:d.startOnLoad}));const v=new So.InitIDGenerator(d.deterministicIds,d.deterministicIDSeed);let b;const y=[];for(const T of Array.from(p)){Xe.info('Rendering diagram: '+T.id);/*! Check if previously processed */if(T.getAttribute('data-processed'))continue;T.setAttribute('data-processed','true');const _=`mermaid-${v.next()}`;b=T.innerHTML,b=JM(So.entityDecode(b)).trim().replace(/
/gi,'
');const A=So.detectInit(b);A&&Xe.debug('Detected early reinit: ',A);try{const{svg:P,bindFunctions:R}=await K$e(_,b,T);T.innerHTML=P,i&&await i(_),R&&R(T);}catch(P){Lqt(P,y,um.parseError);}}if(y.length>0)throw y[0];},V$e=function(i){RC.initialize(i);},Dqt=async function(i,s,u){Xe.warn('mermaid.init is deprecated. Please use run instead.'),i&&V$e(i);const d={postRenderCallback:u,querySelector:'.mermaid'};typeof s=='string'?d.querySelector=s:s&&(s instanceof HTMLElement?d.nodes=[s]:d.nodes=s),await H$e(d);},Iqt=async(i,{lazyLoad:s=!0}={})=>{BRe(...i),s===!1&&await Aqt();},U$e=function(){if(um.startOnLoad){const{startOnLoad:i}=RC.getConfig();i&&um.run().catch(s=>Xe.error('Mermaid failed to initialize',s));}};if(typeof document<'u'){/*!
* Wait for document loaded before starting the execution
- */window.addEventListener("load",U$e,!1)}const Oqt=function(i){um.parseError=i},nQ=[];let Y2e=!1;const G$e=async()=>{if(!Y2e){for(Y2e=!0;nQ.length>0;){const i=nQ.shift();if(i)try{await i()}catch(s){Xe.error("Error executing queue",s)}}Y2e=!1}},Nqt=async(i,s)=>new Promise((u,d)=>{const p=()=>new Promise((v,b)=>{RC.parse(i,s).then(y=>{v(y),u(y)},y=>{var T;Xe.error("Error parsing",y),(T=um.parseError)==null||T.call(um,y),b(y),d(y)})});nQ.push(p),G$e().catch(d)}),K$e=(i,s,u)=>new Promise((d,p)=>{const v=()=>new Promise((b,y)=>{RC.render(i,s,u).then(T=>{b(T),d(T)},T=>{var _;Xe.error("Error parsing",T),(_=um.parseError)==null||_.call(um,T),y(T),p(T)})});nQ.push(v),G$e().catch(p)}),um={startOnLoad:!0,mermaidAPI:RC,parse:Nqt,render:K$e,init:Dqt,run:H$e,registerExternalDiagrams:Iqt,initialize:V$e,parseError:void 0,contentLoaded:U$e,setParseErrorHandler:Oqt,detectType:_X};class lm{constructor(s,u,d){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=s,this.start=u,this.end=d}static range(s,u){return u?!s||!s.loc||!u.loc||s.loc.lexer!==u.loc.lexer?null:new lm(s.loc.lexer,s.loc.start,u.loc.end):s&&s.loc}}class Bv{constructor(s,u){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=s,this.loc=u}range(s,u){return new Bv(u,lm.range(this,s))}}class Si{constructor(s,u){this.name=void 0,this.position=void 0,this.length=void 0,this.rawMessage=void 0;var d="KaTeX parse error: "+s,p,v,b=u&&u.loc;if(b&&b.start<=b.end){var y=b.lexer.input;p=b.start,v=b.end,p===y.length?d+=" at end of input: ":d+=" at position "+(p+1)+": ";var T=y.slice(p,v).replace(/[^]/g,"$&̲"),_;p>15?_="…"+y.slice(p-15,p):_=y.slice(0,p);var A;v+15",s}}var gHt={î:"ı̂",ï:"ı̈",í:"ı́",ì:"ı̀"};class Rv{constructor(s,u,d,p,v,b,y,T){this.text=void 0,this.height=void 0,this.depth=void 0,this.italic=void 0,this.skew=void 0,this.width=void 0,this.maxFontSize=void 0,this.classes=void 0,this.style=void 0,this.text=s,this.height=u||0,this.depth=d||0,this.italic=p||0,this.skew=v||0,this.width=b||0,this.classes=y||[],this.style=T||{},this.maxFontSize=0;var _=Jqt(this.text.charCodeAt(0));_&&this.classes.push(_+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=gHt[this.text])}hasClass(s){return ga.contains(this.classes,s)}toNode(){var s=document.createTextNode(this.text),u=null;this.italic>0&&(u=document.createElement("span"),u.style.marginRight=ji(this.italic)),this.classes.length>0&&(u=u||document.createElement("span"),u.className=T9(this.classes));for(var d in this.style)this.style.hasOwnProperty(d)&&(u=u||document.createElement("span"),u.style[d]=this.style[d]);return u?(u.appendChild(s),u):s}toMarkup(){var s=!1,u="0&&(d+="margin-right:"+this.italic+"em;");for(var p in this.style)this.style.hasOwnProperty(p)&&(d+=ga.hyphenate(p)+":"+this.style[p]+";");d&&(s=!0,u+=' style="'+ga.escape(d)+'"');var v=ga.escape(this.text);return s?(u+=">",u+=v,u+="",u):v}}class D7{constructor(s,u){this.children=void 0,this.attributes=void 0,this.children=s||[],this.attributes=u||{}}toNode(){var s="http://www.w3.org/2000/svg",u=document.createElementNS(s,"svg");for(var d in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,d)&&u.setAttribute(d,this.attributes[d]);for(var p=0;p
',s;}}var gHt={î:'ı̂',ï:'ı̈',í:'ı́',ì:'ı̀'};class Rv{constructor(s,u,d,p,v,b,y,T){this.text=void 0,this.height=void 0,this.depth=void 0,this.italic=void 0,this.skew=void 0,this.width=void 0,this.maxFontSize=void 0,this.classes=void 0,this.style=void 0,this.text=s,this.height=u||0,this.depth=d||0,this.italic=p||0,this.skew=v||0,this.width=b||0,this.classes=y||[],this.style=T||{},this.maxFontSize=0;var _=Jqt(this.text.charCodeAt(0));_&&this.classes.push(_+'_fallback'),/[îïíì]/.test(this.text)&&(this.text=gHt[this.text]);}hasClass(s){return ga.contains(this.classes,s);}toNode(){var s=document.createTextNode(this.text),u=null;this.italic>0&&(u=document.createElement('span'),u.style.marginRight=ji(this.italic)),this.classes.length>0&&(u=u||document.createElement('span'),u.className=T9(this.classes));for(var d in this.style)this.style.hasOwnProperty(d)&&(u=u||document.createElement('span'),u.style[d]=this.style[d]);return u?(u.appendChild(s),u):s;}toMarkup(){var s=!1,u='0&&(d+='margin-right:'+this.italic+'em;');for(var p in this.style)this.style.hasOwnProperty(p)&&(d+=ga.hyphenate(p)+':'+this.style[p]+';');d&&(s=!0,u+=' style="'+ga.escape(d)+'"');var v=ga.escape(this.text);return s?(u+='>',u+=v,u+='',u):v;}}class D7{constructor(s,u){this.children=void 0,this.attributes=void 0,this.children=s||[],this.attributes=u||{};}toNode(){var s='http://www.w3.org/2000/svg',u=document.createElementNS(s,'svg');for(var d in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,d)&&u.setAttribute(d,this.attributes[d]);for(var p=0;p