2 lines
47 KiB
JavaScript
2 lines
47 KiB
JavaScript
var e,t=Object.defineProperty,n=Object.defineProperties,a=Object.getOwnPropertyDescriptors,s=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,o=(e,n,a)=>n in e?t(e,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[n]=a,l=(e,t)=>{for(var n in t||(t={}))r.call(t,n)&&o(e,n,t[n]);if(s)for(var n of s(t))i.call(t,n)&&o(e,n,t[n]);return e};import{S as c,i as d,s as u,e as h,c as m,a as f,d as p,b as g,f as w,J as v,I as y,K as b,A as $,L as k,M as x,k as E,t as I,n as D,g as T,E as C,N as S,O as A,P as K,Q as O,R,T as j,U as L,h as N,V as _,W as B,X as M,x as V,r as P,u as G,w as U,Y as q,D as z,F as H,G as Z,H as Y,j as J,m as F,o as W,Z as X,v as Q,_ as ee,$ as te,a0 as ne,a1 as ae,a2 as se,a3 as re,a4 as ie,l as oe,a5 as le,a6 as ce,a7 as de}from"../chunks/vendor-1c68e392.js";import{c as ue,a as he,u as me,h as fe,b as pe,l as ge,g as we,d as ve,e as ye,f as be,V as $e,i as ke,j as xe,k as Ee,s as Ie,m as De}from"../chunks/util-3b608ca4.js";import{b as Te}from"../chunks/paths-45dac81d.js";import"../chunks/preload-helper-c90670b7.js";import"../chunks/loading-01b174cf.js";const Ce=e=>{e.languages.register({id:"mermaid"});const t=["requirement","functionalRequirement","interfaceRequirement","performanceRequirement","physicalRequirement","designConstraint"],s={flowchart:{typeKeywords:["flowchart","flowchart-v2","graph"],blockKeywords:["subgraph","end"],keywords:["TB","TD","BT","RL","LR","click","call","href","_self","_blank","_parent","_top","linkStyle","style","classDef","class","direction","interpolate"]},sequenceDiagram:{typeKeywords:["sequenceDiagram"],blockKeywords:["alt","par","and","loop","else","end","rect","opt","alt","rect"],keywords:["participant","as","Note","note","right of","left of","over","activate","deactivate","autonumber","title"]},classDiagram:{typeKeywords:["classDiagram","classDiagram-v2"],blockKeywords:["class"],keywords:["link","click","callback","call","href","cssClass","direction","TB","BT","RL","LR"]},stateDiagram:{typeKeywords:["stateDiagram","stateDiagram-v2"],blockKeywords:["state","note","end"],keywords:["state","as","hide empty description","direction","TB","BT","RL","LR"]},erDiagram:{typeKeywords:["erDiagram"],blockKeywords:[],keywords:[]},journey:{typeKeywords:["journey"],blockKeywords:["section"],keywords:["title"]},info:{typeKeywords:["info"],blockKeywords:[],keywords:["showInfo"]},gantt:{typeKeywords:["gantt"],blockKeywords:[],keywords:["title","dateFormat","axisFormat","todayMarker","section","excludes","inclusiveEndDates"]},requirementDiagram:{typeKeywords:["requirement","requirementDiagram"],blockKeywords:t.concat("element"),keywords:[]},gitGraph:{typeKeywords:["gitGraph"],blockKeywords:[],keywords:["commit","branch","merge","reset","checkout","LR","BT"]},pie:{typeKeywords:["pie"],blockKeywords:[],keywords:["title","showData"]}};var r;e.languages.setMonarchTokensProvider("mermaid",(r=l({},Object.entries(s).map((e=>Object.fromEntries(Object.entries(e[1]).map((t=>[e[0]+t[0][0].toUpperCase()+t[0].slice(1),t[1]]))))).reduce(((e,t)=>l(l({},e),t)),{})),n(r,a({tokenizer:{root:[[/%%(?=.*%%$)/,{token:"string",nextEmbedded:"json"}],[/%%$/,{token:"string",nextEmbedded:"@pop"}],[/^\s*gitGraph/m,"typeKeyword","gitGraph"],[/^\s*info/m,"typeKeyword","info"],[/^\s*pie/m,"typeKeyword","pie"],[/^\s*(flowchart|flowchart-v2|graph)/m,"typeKeyword","flowchart"],[/^\s*sequenceDiagram/,"typeKeyword","sequenceDiagram"],[/^\s*classDiagram(-v2)?/,"typeKeyword","classDiagram"],[/^\s*journey/,"typeKeyword","journey"],[/^\s*gantt/,"typeKeyword","gantt"],[/^\s*stateDiagram(-v2)?/,"typeKeyword","stateDiagram"],[/^\s*erDiagram/,"typeKeyword","erDiagram"],[/^\s*requirement(Diagram)?/,"typeKeyword","requirementDiagram"],[/%%.*(?<!%%)$/,"comment"]],gitGraph:[[/option(?=s)/,{token:"typeKeyword",next:"optionsGitGraph"}],[/(^\s*branch|reset|merge|checkout)(.*$)/,["keyword","variable"]],[/[a-zA-Z][\w$]*/,{cases:{"@gitGraphBlockKeywords":"typeKeyword","@gitGraphKeywords":"keyword"}}],[/%%.*(?<!%%)$/,"comment"],[/".*?"/,"string"],[/\^/,"delimiter.bracket"]],optionsGitGraph:[[/s$/,{token:"typeKeyword",nextEmbedded:"json",matchOnlyAtLineStart:!1}],["end",{token:"typeKeyword",next:"@pop",nextEmbedded:"@pop"}]],info:[[/[a-zA-Z][\w$]*/,{cases:{"@infoBlockKeywords":"typeKeyword","@infoKeywords":"keyword"}}]],pie:[[/(title)(.*$)/,["keyword","string"]],[/[a-zA-Z][\w$]*/,{cases:{"@pieBlockKeywords":"typeKeyword","@pieKeywords":"keyword"}}],[/".*?"/,"string"],[/\s*\d+/,"number"],[/:/,"delimiter.bracket"],[/%%.*(?<!%%)$/,"comment"]],flowchart:[[/[ox]?(--+|==+)[ox]/,"transition"],[/[a-zA-Z][\w$]*/,{cases:{"@flowchartBlockKeywords":"typeKeyword","@flowchartKeywords":"keyword","@default":"variable"}}],[/\|+.+?\|+/,"string"],[/\[+(\\.+?[\\/]|\/.+?[/\\])\]+/,"string"],[/[[>]+[^\]|[]+?\]+/,"string"],[/{+.+?}+/,"string"],[/\(+.+?\)+/,"string"],[/-\.+->?/,"transition"],[/(-[-.])([^->]+?)(-{3,}|-{2,}>|\.-+>)/,["transition","string","transition"]],[/(==+)([^=]+?)(={3,}|={2,}>)/,["transition","string","transition"]],[/<?(--+|==+)>|===+|---+/,"transition"],[/:::/,"transition"],[/[;&]/,"delimiter.bracket"],[/".*?"/,"string"],[/%%.*(?<!%%)$/,"comment"]],sequenceDiagram:[[/[a-zA-Z][\w$]*/,{cases:{"@sequenceDiagramBlockKeywords":"typeKeyword","@sequenceDiagramKeywords":"keyword","@default":"variable"}}],[/(--?>?>|--?[)x])[+-]?/,"transition"],[/(:)([^:\n]*?$)/,["delimiter.bracket","string"]],[/%%.*(?<!%%)$/,"comment"]],classDiagram:[[/(?!class\s)([a-zA-Z]+)(\s+[a-zA-Z]+)/,["type","variable"]],[/(\*|<\|?|o)?(--|\.\.)(\*|\|?>|o)?/,"transition"],[/^\s*class\s(?!.*\{)/,"keyword"],[/[a-zA-Z][\w$]*/,{cases:{"@classDiagramBlockKeywords":"typeKeyword","@classDiagramKeywords":"keyword","@default":"variable"}}],[/%%.*(?<!%%)$/,"comment"],[/(<<)(.+?)(>>)/,["delimiter.bracket","annotation","delimiter.bracket"]],[/".*?"/,"string"],[/:::/,"transition"],[/:|\+|-|#|~|\*\s*$|\$\s*$|\(|\)|{|}/,"delimiter.bracket"]],journey:[[/(title)(.*)/,["keyword","string"]],[/(section)(.*)/,["typeKeyword","string"]],[/[a-zA-Z][\w$]*/,{cases:{"@journeyBlockKeywords":"typeKeyword","@journeyKeywords":"keyword","@default":"variable"}}],[/(^\s*.+?)(:)(.*?)(:)(.*?)([,$])/,["string","delimiter.bracket","number","delimiter.bracket","variable","delimiter.bracket"]],[/,/,"delimiter.bracket"],[/(^\s*.+?)(:)([^:]*?)$/,["string","delimiter.bracket","variable"]],[/%%.*(?<!%%)$/,"comment"]],gantt:[[/(title)(.*)/,["keyword","string"]],[/(section)(.*)/,["typeKeyword","string"]],[/[a-zA-Z][\w$]*/,{cases:{"@ganttBlockKeywords":"typeKeyword","@ganttKeywords":"keyword"}}],[/(^\s*.*?)(:)/,["string","delimiter.bracket"]],[/%%.*(?<!%%)$/,"comment"],[/:/,"delimiter.bracket"]],stateDiagram:[[/note[^:]*$/,{token:"typeKeyword",next:"stateDiagramNote"}],["hide empty description","keyword"],[/^\s*state\s(?!.*\{)/,"keyword"],[/(<<)(fork|join|choice)(>>)/,"annotation"],[/(\[\[)(fork|join|choice)(]])/,["delimiter.bracket","annotation","delimiter.bracket"]],[/[a-zA-Z][\w$]*/,{cases:{"@stateDiagramBlockKeywords":"typeKeyword","@stateDiagramKeywords":"keyword","@default":"variable"}}],[/".*?"/,"string"],[/(:)([^:\n]*?$)/,["delimiter.bracket","string"]],[/{|}/,"delimiter.bracket"],[/%%.*(?<!%%)$/,"comment"],[/-->/,"transition"],[/\[.*?]/,"string"]],stateDiagramNote:[[/^\s*end note$/,{token:"typeKeyword",next:"@pop"}],[/.*/,"string"]],erDiagram:[[/[}|][o|](--|\.\.)[o|][{|]/,"transition"],[/".*?"/,"string"],[/(:)(.*?$)/,["delimiter.bracket","string"]],[/:|{|}/,"delimiter.bracket"],[/([a-zA-Z]+)(\s+[a-zA-Z]+)/,["type","variable"]],[/%%.*(?<!%%)$/,"comment"],[/[a-zA-Z_-][\w$]*/,"variable"]],requirementDiagram:[[/->|<-|-/,"transition"],[/(\d+\.)*\d+/,"number"],[/[a-zA-Z_-][\w$]*/,{cases:{"@requirementDiagramBlockKeywords":"typeKeyword","@default":"variable"}}],[/:|{|}|\//,"delimiter.bracket"],[/%%.*(?<!%%)$/,"comment"],[/".*?"/,"string"]]}})))),e.editor.defineTheme("mermaidTheme",{base:"vs",inherit:!1,rules:[{token:"typeKeyword",foreground:"9650c8",fontStyle:"bold"},{token:"keyword",foreground:"649696"},{token:"custom-error",foreground:"ff0000",fontStyle:"bold"},{token:"string",foreground:"AA8500"},{token:"transition",foreground:"008800",fontStyle:"bold"},{token:"delimiter.bracket",foreground:"000000",fontStyle:"bold"},{token:"annotation",foreground:"4b4b96"},{token:"number",foreground:"4b4b96"},{token:"comment",foreground:"888c89"},{token:"variable",foreground:"A22889"},{token:"type",foreground:"2BDEA8"}]}),e.languages.registerCompletionItemProvider("mermaid",{provideCompletionItems:()=>({suggestions:[{label:"loop",kind:e.languages.CompletionItemKind.Snippet,insertText:["loop ${1:Loop text}","\t$0","end"].join("\n"),insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"Sequence Diagram Loops"},{label:"alt",kind:e.languages.CompletionItemKind.Snippet,insertText:["alt ${1:Describing text}","\t$0","else","\t","end"].join("\n"),insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"Alternative Path"},{label:"opt",kind:e.languages.CompletionItemKind.Snippet,insertText:["opt ${1:Describing text}","\t$0","end"].join("\n"),insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"Optional Path"},{label:"par",kind:e.languages.CompletionItemKind.Snippet,insertText:["par ${1:[Action 1]}","\t$0","and ${2:[Action 2]}","\t","and ${3:[Action 3]}","\t","end"].join("\n"),insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"Parallel Actions"},{label:"rect",kind:e.languages.CompletionItemKind.Snippet,insertText:["rect ${1:rgb(0, 255, 0)}","\t$0","end"].join("\n"),insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"Background Color"},{label:"subgraph",kind:e.languages.CompletionItemKind.Snippet,insertText:["subgraph ${1:title}","\t$0","end"].join("\n"),insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"Subgraph"},{label:"class",kind:e.languages.CompletionItemKind.Snippet,insertText:["class ${1:className} {","\t$0","}"].join("\n"),insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"Class"},{label:"state",kind:e.languages.CompletionItemKind.Snippet,insertText:["state ${1:stateName} {","\t$0","}"].join("\n"),insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"State"},{label:"note",kind:e.languages.CompletionItemKind.Snippet,insertText:["note ${1:right of State1}","\t$0","end note"].join("\n"),insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"State"},{label:"section",kind:e.languages.CompletionItemKind.Snippet,insertText:["section ${1:Go to work}","\t$0"].join("\n"),insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"User-journey Section"},{label:"element",kind:e.languages.CompletionItemKind.Snippet,insertText:["element ${1:test_entity} {","\t$0","}"].join("\n"),insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"User-journey Section"},{label:"options",kind:e.languages.CompletionItemKind.Snippet,insertText:["options","{"," $0","}","end"].join("\n"),insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"Git Graph Options"},...t.map((t=>({label:t,kind:e.languages.CompletionItemKind.Snippet,insertText:[t+" ${1:test_req} {","\tid: 1","\ttext: the test text.","\trisk: high","\tverifyMethod: test","}"].join("\n"),insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:t.split(/(?=[A-Z])/).map((e=>e[0].toUpperCase()+e.slice(1))).join(" ")}))),...[...new Set(Object.values(s).map((e=>Object.entries(e).filter((e=>"annotations"!==e[0])).map((e=>e[1])))).flat(2))].map((t=>({label:t,kind:e.languages.CompletionItemKind.Keyword,insertText:t})))]})}),e.languages.setLanguageConfiguration("mermaid",{autoClosingPairs:[{open:"(",close:")"},{open:"{",close:"}"},{open:"[",close:"]"}],brackets:[["(",")"],["{","}"],["[","]"]]})};function Se(e){let t;return{c(){t=h("div"),this.h()},l(e){t=m(e,"DIV",{id:!0,class:!0}),f(t).forEach(p),this.h()},h(){g(t,"id","editor"),g(t,"class","overflow-hidden")},m(n,a){w(n,t,a),e[9](t)},p:v,i:v,o:v,d(n){n&&p(t),e[9](null)}}}function Ae(e,t,n){let a;y(e,ue,(e=>n(8,a=e)));var s=this&&this.__awaiter||function(e,t,n,a){return new(n||(n=Promise))((function(s,r){function i(e){try{l(a.next(e))}catch(t){r(t)}}function o(e){try{l(a.throw(e))}catch(t){r(t)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,o)}l((a=a.apply(e,t||[])).next())}))};let r,i,o=null,{text:l}=t,{language:c}=t,{editorOptions:d={value:l,language:c,minimap:{enabled:!1},theme:"mermaidTheme",overviewRulerLanes:0}}=t,{errorMarkers:u=[]}=t,h=l;const m=b();return $((()=>s(void 0,void 0,void 0,(function*(){try{n(6,i=monaco)}catch(e){yield s(void 0,void 0,void 0,(function*(){let e=0;for(;e++<10;)try{return void n(6,i=monaco)}catch(t){yield new Promise((e=>setTimeout(e,500)))}alert("Loading Monaco Editor failed. Please try refreshing the page.")}))}Ce(i),n(5,r=i.editor.create(o,d)),r.onDidChangeModelContent((()=>{n(1,l=r.getValue()),m("update",{text:l})}));return new ResizeObserver((e=>{r.layout({height:e[0].contentRect.height,width:e[0].contentRect.width})})).observe(o.parentElement),()=>{r.dispose()}})))),e.$$set=e=>{"text"in e&&n(1,l=e.text),"language"in e&&n(2,c=e.language),"editorOptions"in e&&n(3,d=e.editorOptions),"errorMarkers"in e&&n(4,u=e.errorMarkers)},e.$$.update=()=>{100&e.$$.dirty&&r&&(null==i||i.editor.setModelLanguage(r.getModel(),c)),498&e.$$.dirty&&(l!==h&&(a.updateEditor&&(null==r||r.setValue(l)),n(7,h=l)),r&&(null==i||i.editor.setModelMarkers(r.getModel(),"test",u)))},[o,l,c,d,u,r,i,h,a,function(e){k[e?"unshift":"push"]((()=>{o=e,n(0,o)}))}]}class Ke extends c{constructor(e){super(),d(this,e,Ae,Se,u,{text:1,language:2,editorOptions:3,errorMarkers:4})}}function Oe(e,t,n){const a=e.slice();return a[1]=t[n].title,a[2]=t[n].href,a[3]=t[n].icon,a}function Re(e){let t,n,a,s,r,i,o=e[1]+"",l=e[3]&&function(e){let t,n;return{c(){t=h("i"),this.h()},l(e){t=m(e,"I",{class:!0}),f(t).forEach(p),this.h()},h(){g(t,"class",n=e[3])},m(e,n){w(e,t,n)},p:v,d(e){e&&p(t)}}}(e);return{c(){t=h("li"),n=h("a"),l&&l.c(),a=E(),s=I(o),i=E(),this.h()},l(e){t=m(e,"LI",{});var r=f(t);n=m(r,"A",{class:!0,target:!0,href:!0});var c=f(n);l&&l.l(c),a=D(c),s=T(c,o),c.forEach(p),i=D(r),r.forEach(p),this.h()},h(){g(n,"class","nav-btn"),g(n,"target","_blank"),g(n,"href",r=e[2])},m(e,r){w(e,t,r),C(t,n),l&&l.m(n,null),C(n,a),C(n,s),C(t,i)},p(e,t){e[3]&&l.p(e,t)},d(e){e&&p(t),l&&l.d()}}}function je(e){let t,n,a,s,r,i,o,l,c,d,u,y,b,$,k,O,R,j,L,N,_=e[0],B=[];for(let h=0;h<_.length;h+=1)B[h]=Re(Oe(e,_,h));return{c(){t=h("header"),n=h("div"),a=h("a"),s=I("Mermaid"),r=h("span"),i=I("v"),o=I(x),l=I(" Live Editor"),c=E(),d=h("label"),u=S("svg"),y=S("title"),b=I("Menu"),$=S("path"),k=E(),O=h("input"),R=E(),j=h("div"),L=h("nav"),N=h("ul");for(let e=0;e<B.length;e+=1)B[e].c();this.h()},l(e){t=m(e,"HEADER",{class:!0});var h=f(t);n=m(h,"DIV",{class:!0});var g=f(n);a=m(g,"A",{href:!0});var w=f(a);s=T(w,"Mermaid"),r=m(w,"SPAN",{class:!0});var v=f(r);i=T(v,"v"),o=T(v,x),v.forEach(p),l=T(w," Live Editor"),w.forEach(p),g.forEach(p),c=D(h),d=m(h,"LABEL",{for:!0,class:!0});var E=f(d);u=A(E,"svg",{class:!0,xmlns:!0,width:!0,height:!0,viewBox:!0});var I=f(u);y=A(I,"title",{});var C=f(y);b=T(C,"Menu"),C.forEach(p),$=A(I,"path",{d:!0}),f($).forEach(p),I.forEach(p),E.forEach(p),k=D(h),O=m(h,"INPUT",{class:!0,type:!0,id:!0}),R=D(h),j=m(h,"DIV",{class:!0,id:!0});var S=f(j);L=m(S,"NAV",{});var K=f(L);N=m(K,"UL",{class:!0});var _=f(N);for(let t=0;t<B.length;t+=1)B[t].l(_);_.forEach(p),K.forEach(p),S.forEach(p),h.forEach(p),this.h()},h(){g(r,"class","text-xs font-thin"),g(a,"href","/"),g(n,"class","flex-1 flex justify-between items-center"),g($,"d","M0 3h20v2H0V3zm0 6h20v2H0V9zm0 6h20v2H0v-2z"),g(u,"class","fill-current "),g(u,"xmlns","http://www.w3.org/2000/svg"),g(u,"width","20"),g(u,"height","20"),g(u,"viewBox","0 0 20 20"),g(d,"for","menu-toggle"),g(d,"class","pointer-cursor lg:hidden block"),g(O,"class","hidden svelte-qevfgi"),g(O,"type","checkbox"),g(O,"id","menu-toggle"),g(N,"class","lg:flex items-center justify-between text-base pt-4 lg:pt-0"),g(j,"class","hidden lg:flex lg:items-center lg:w-auto w-full svelte-qevfgi"),g(j,"id","menu"),g(t,"class","p-2 bg-indigo-400 text-white font-bold flex flex-wrap items-center svelte-qevfgi")},m(e,h){w(e,t,h),C(t,n),C(n,a),C(a,s),C(a,r),C(r,i),C(r,o),C(a,l),C(t,c),C(t,d),C(d,u),C(u,y),C(y,b),C(u,$),C(t,k),C(t,O),C(t,R),C(t,j),C(j,L),C(L,N);for(let t=0;t<B.length;t+=1)B[t].m(N,null)},p(e,[t]){if(1&t){let n;for(_=e[0],n=0;n<_.length;n+=1){const a=Oe(e,_,n);B[n]?B[n].p(a,t):(B[n]=Re(a),B[n].c(),B[n].m(N,null))}for(;n<B.length;n+=1)B[n].d(1);B.length=_.length}},i:v,o:v,d(e){e&&p(t),K(B,e)}}}function Le(e){return[[{title:"Documentation",href:"https://mermaid-js.github.io/mermaid/#/n00b-gettingStarted"},{title:"Tutorial",href:"https://github.com/mermaid-js/mermaid/blob/develop/docs/Tutorials.md"},{title:"Mermaid",href:"https://github.com/mermaid-js/mermaid"},{title:"CLI",href:"https://github.com/mermaid-js/mermaid-cli"},{title:"",href:"https://github.com/mermaid-js/mermaid-live-editor",icon:"fab fa-github fa-lg"}]]}null==(e=he)||e.track("version",{mermaidVersion:x});class Ne extends c{constructor(e){super(),d(this,e,Le,je,u,{})}}function _e(e,t,n){const a=e.slice();return a[10]=t[n],a}function Be(e){let t;return{c(){t=h("i"),this.h()},l(e){t=m(e,"I",{class:!0}),f(t).forEach(p),this.h()},h(){g(t,"class","fas fa-chevron-right icon svelte-1qkpo3v"),O(t,"isOpen",e[0])},m(e,n){w(e,t,n)},p(e,n){1&n&&O(t,"isOpen",e[0])},d(e){e&&p(t)}}}function Me(e){let t,n,a,s=e[2],r=[];for(let i=0;i<s.length;i+=1)r[i]=Ve(_e(e,s,i));return{c(){t=h("ul");for(let e=0;e<r.length;e+=1)r[e].c();this.h()},l(e){t=m(e,"UL",{class:!0});var n=f(t);for(let t=0;t<r.length;t+=1)r[t].l(n);n.forEach(p),this.h()},h(){g(t,"class","flex flex-wrap flex-row")},m(e,n){w(e,t,n);for(let a=0;a<r.length;a+=1)r[a].m(t,null);a=!0},p(e,n){if(52&n){let a;for(s=e[2],a=0;a<s.length;a+=1){const i=_e(e,s,a);r[a]?r[a].p(i,n):(r[a]=Ve(i),r[a].c(),r[a].m(t,null))}for(;a<r.length;a+=1)r[a].d(1);r.length=s.length}},i(e){a||(_((()=>{n||(n=B(t,M,{},!0)),n.run(1)})),a=!0)},o(e){n||(n=B(t,M,{},!1)),n.run(0),a=!1},d(e){e&&p(t),K(r,e),e&&n&&n.end()}}}function Ve(e){let t,n,a,s,r,i,o,l,c,d,u=e[10].title+"";function v(){return e[8](e[10])}return{c(){t=h("li"),n=h("div"),a=h("i"),r=E(),i=I(u),l=E(),this.h()},l(e){t=m(e,"LI",{class:!0});var s=f(t);n=m(s,"DIV",{class:!0});var o=f(n);a=m(o,"I",{class:!0}),f(a).forEach(p),r=D(o),i=T(o,u),o.forEach(p),l=D(s),s.forEach(p),this.h()},h(){g(a,"class",s=R(e[10].icon)+" svelte-1qkpo3v"),g(n,"class",o="text cursor-pointer font-semibold min-w-16 w-auto px-2 py-1 -mb-4 rounded-t block leading-normal "+(e[4]===e[10].id?"text-indigo-500 bg-white border-white":"text-white bg-indigo-500 border-indigo-500 hover:bg-indigo-600")),g(t,"class","mr-2 last:mr-0 w-28 h-6 flex-auto text-center")},m(e,s){w(e,t,s),C(t,n),C(n,a),C(n,r),C(n,i),C(t,l),c||(d=j(n,"click",L(v)),c=!0)},p(t,r){e=t,4&r&&s!==(s=R(e[10].icon)+" svelte-1qkpo3v")&&g(a,"class",s),4&r&&u!==(u=e[10].title+"")&&N(i,u),20&r&&o!==(o="text cursor-pointer font-semibold min-w-16 w-auto px-2 py-1 -mb-4 rounded-t block leading-normal "+(e[4]===e[10].id?"text-indigo-500 bg-white border-white":"text-white bg-indigo-500 border-indigo-500 hover:bg-indigo-600"))&&g(n,"class",o)},d(e){e&&p(t),c=!1,d()}}}function Pe(e){let t,n,a,s,r,i,o,l,c=e[1]&&Be(e),d=e[0]&&e[2]&&Me(e);return{c(){t=h("div"),n=h("span"),c&&c.c(),a=E(),s=I(e[3]),r=E(),d&&d.c(),this.h()},l(i){t=m(i,"DIV",{class:!0});var o=f(t);n=m(o,"SPAN",{class:!0});var l=f(n);c&&c.l(l),a=D(l),s=T(l,e[3]),l.forEach(p),r=D(o),d&&d.l(o),o.forEach(p),this.h()},h(){g(n,"class","text-white mr-2 font-semibold"),g(t,"class","flex cursor-default")},m(u,h){w(u,t,h),C(t,n),c&&c.m(n,null),C(n,a),C(n,s),C(t,r),d&&d.m(t,null),i=!0,o||(l=j(n,"click",L(e[7])),o=!0)},p(e,[r]){e[1]?c?c.p(e,r):(c=Be(e),c.c(),c.m(n,a)):c&&(c.d(1),c=null),(!i||8&r)&&N(s,e[3]),e[0]&&e[2]?d?(d.p(e,r),5&r&&V(d,1)):(d=Me(e),d.c(),V(d,1),d.m(t,null)):d&&(P(),G(d,1,1,(()=>{d=null})),U())},i(e){i||(V(d),i=!0)},o(e){G(d),i=!1},d(e){e&&p(t),c&&c.d(),d&&d.d(),o=!1,l()}}}function Ge(e,t,n){let a;var s;let{isCloseable:r=!0}=t,{tabs:i=[]}=t,{title:o}=t,{isOpen:l=!1}=t;const c=b(),d=e=>{n(4,a=e.id),c("select",e)};return e.$$set=e=>{"isCloseable"in e&&n(1,r=e.isCloseable),"tabs"in e&&n(2,i=e.tabs),"title"in e&&n(3,o=e.title),"isOpen"in e&&n(0,l=e.isOpen)},e.$$.update=()=>{68&e.$$.dirty&&n(4,a=null===n(6,s=i[0])||void 0===s?void 0:s.id)},[l,r,i,o,a,d,s,()=>n(0,l=!l),e=>d(e)]}class Ue extends c{constructor(e){super(),d(this,e,Ge,Pe,u,{isCloseable:1,tabs:2,title:3,isOpen:0})}}const qe=e=>({}),ze=e=>({});function He(e){let t,n,a;const s=e[5].default,r=z(s,e,e[4],null);return{c(){t=h("div"),r&&r.c(),this.h()},l(e){t=m(e,"DIV",{class:!0});var n=f(t);r&&r.l(n),n.forEach(p),this.h()},h(){g(t,"class","flex-grow overflow-auto")},m(e,n){w(e,t,n),r&&r.m(t,null),a=!0},p(e,t){r&&r.p&&(!a||16&t)&&H(r,s,e,e[4],a?Y(s,e[4],t,null):Z(e[4]),null)},i(e){a||(V(r,e),_((()=>{n||(n=B(t,ee,{},!0)),n.run(1)})),a=!0)},o(e){G(r,e),n||(n=B(t,ee,{},!1)),n.run(0),a=!1},d(e){e&&p(t),r&&r.d(e),e&&n&&n.end()}}}function Ze(e){let t,n,a,s,r,i,o,l,c,d,u;function v(t){e[6](t)}let y={tabs:e[2],title:e[3],isCloseable:e[1]};void 0!==e[0]&&(y.isOpen=e[0]),s=new Ue({props:y}),k.push((()=>q(s,"isOpen",v))),s.$on("select",e[7]);const b=e[5].actions,$=z(b,e,e[4],ze);let x=e[0]&&He(e);return{c(){t=h("div"),n=h("div"),a=h("div"),J(s.$$.fragment),i=E(),o=h("div"),$&&$.c(),l=E(),x&&x.c(),this.h()},l(e){t=m(e,"DIV",{class:!0});var r=f(t);n=m(r,"DIV",{class:!0});var c=f(n);a=m(c,"DIV",{class:!0});var d=f(a);F(s.$$.fragment,d),i=D(d),o=m(d,"DIV",{class:!0});var u=f(o);$&&$.l(u),u.forEach(p),d.forEach(p),c.forEach(p),l=D(r),x&&x.l(r),r.forEach(p),this.h()},h(){g(o,"class","flex gap-x-4 items-center text-white"),g(a,"class","flex justify-between"),g(n,"class","bg-indigo-400 border-gray-400 p-2 flex-none cursor-pointer"),g(t,"class","bg-white rounded overflow-hidden shadow m-2 flex-grow flex flex-col")},m(r,h){w(r,t,h),C(t,n),C(n,a),W(s,a,null),C(a,i),C(a,o),$&&$.m(o,null),C(t,l),x&&x.m(t,null),c=!0,d||(u=j(n,"click",e[8]),d=!0)},p(e,[n]){const a={};4&n&&(a.tabs=e[2]),8&n&&(a.title=e[3]),2&n&&(a.isCloseable=e[1]),!r&&1&n&&(r=!0,a.isOpen=e[0],X((()=>r=!1))),s.$set(a),$&&$.p&&(!c||16&n)&&H($,b,e,e[4],c?Y(b,e[4],n,qe):Z(e[4]),ze),e[0]?x?(x.p(e,n),1&n&&V(x,1)):(x=He(e),x.c(),V(x,1),x.m(t,null)):x&&(P(),G(x,1,1,(()=>{x=null})),U())},i(e){c||(V(s.$$.fragment,e),V($,e),V(x),c=!0)},o(e){G(s.$$.fragment,e),G($,e),G(x),c=!1},d(e){e&&p(t),Q(s),$&&$.d(e),x&&x.d(),d=!1,u()}}}function Ye(e,t,n){let{$$slots:a={},$$scope:s}=t,{isCloseable:r=!0}=t,{isOpen:i=!0}=t,{tabs:o=[]}=t,{title:l}=t;return e.$$set=e=>{"isCloseable"in e&&n(1,r=e.isCloseable),"isOpen"in e&&n(0,i=e.isOpen),"tabs"in e&&n(2,o=e.tabs),"title"in e&&n(3,l=e.title),"$$scope"in e&&n(4,s=e.$$scope)},e.$$.update=()=>{3&e.$$.dirty&&n(0,i=!r||i)},[i,r,o,l,s,a,function(e){i=e,n(0,i),n(1,r)},function(t){te.call(this,e,t)},()=>n(0,i=!i)]}class Je extends c{constructor(e){super(),d(this,e,Ye,Ze,u,{isCloseable:1,isOpen:0,tabs:2,title:3})}}function Fe(e,t,n){const a=e.slice();return a[3]=t[n],a}function We(e){let t,n,a,s,r=e[3]+"";function i(){return e[2](e[3])}return{c(){t=h("button"),n=I(r),this.h()},l(e){t=m(e,"BUTTON",{class:!0});var a=f(t);n=T(a,r),a.forEach(p),this.h()},h(){g(t,"class","action-btn")},m(e,r){w(e,t,r),C(t,n),a||(s=j(t,"click",i),a=!0)},p(t,n){e=t},d(e){e&&p(t),a=!1,s()}}}function Xe(e){let t,n=Object.keys(e[0]),a=[];for(let s=0;s<n.length;s+=1)a[s]=We(Fe(e,n,s));return{c(){t=h("div");for(let e=0;e<a.length;e+=1)a[e].c();this.h()},l(e){t=m(e,"DIV",{class:!0});var n=f(t);for(let t=0;t<a.length;t+=1)a[t].l(n);n.forEach(p),this.h()},h(){g(t,"class","flex gap-2 flex-wrap p-2")},m(e,n){w(e,t,n);for(let s=0;s<a.length;s+=1)a[s].m(t,null)},p(e,s){if(3&s){let r;for(n=Object.keys(e[0]),r=0;r<n.length;r+=1){const i=Fe(e,n,r);a[r]?a[r].p(i,s):(a[r]=We(i),a[r].c(),a[r].m(t,null))}for(;r<a.length;r+=1)a[r].d(1);a.length=n.length}},d(e){e&&p(t),K(a,e)}}}function Qe(e){let t,n;return t=new Je({props:{title:"Sample Diagrams",isOpen:!1,$$slots:{default:[Xe]},$$scope:{ctx:e}}}),{c(){J(t.$$.fragment)},l(e){F(t.$$.fragment,e)},m(e,a){W(t,e,a),n=!0},p(e,[n]){const a={};64&n&&(a.$$scope={dirty:n,ctx:e}),t.$set(a)},i(e){n||(V(t.$$.fragment,e),n=!0)},o(e){G(t.$$.fragment,e),n=!1},d(e){Q(t,e)}}}function et(e){const t={"Flow Chart":"graph TD\n A[Christmas] --\x3e|Get money| B(Go shopping)\n B --\x3e C{Let me think}\n C --\x3e|One| D[Laptop]\n C --\x3e|Two| E[iPhone]\n C --\x3e|Three| F[fa:fa-car Car]","Sequence Diagram":"sequenceDiagram\n Alice->>+John: Hello John, how are you?\n Alice->>+John: John, can you hear me?\n John--\x3e>-Alice: Hi Alice, I can hear you!\n John--\x3e>-Alice: I feel great!\n ","Class Diagram":"classDiagram\n Animal <|-- Duck\n Animal <|-- Fish\n Animal <|-- Zebra\n Animal : +int age\n Animal : +String gender\n Animal: +isMammal()\n Animal: +mate()\n class Duck{\n +String beakColor\n +swim()\n +quack()\n }\n class Fish{\n -int sizeInFeet\n -canEat()\n }\n class Zebra{\n +bool is_wild\n +run()\n }\n ","State Diagram":"stateDiagram-v2\n [*] --\x3e Still\n Still --\x3e [*]\n Still --\x3e Moving\n Moving --\x3e Still\n Moving --\x3e Crash\n Crash --\x3e [*]\n ","Gantt Chart":"gantt\n title A Gantt Diagram\n dateFormat YYYY-MM-DD\n section Section\n A task :a1, 2014-01-01, 30d\n Another task :after a1 , 20d\n section Another\n Task in sec :2014-01-12 , 12d\n another task : 24d\n ","Pie Chart":'pie title Pets adopted by volunteers\n "Dogs" : 386\n "Cats" : 85\n "Rats" : 15\n ',"ER Diagram":'erDiagram\n CUSTOMER }|..|{ DELIVERY-ADDRESS : has\n CUSTOMER ||--o{ ORDER : places\n CUSTOMER ||--o{ INVOICE : "liable for"\n DELIVERY-ADDRESS ||--o{ ORDER : receives\n INVOICE ||--|{ ORDER : covers\n ORDER ||--|{ ORDER-ITEM : includes\n PRODUCT-CATEGORY ||--|{ PRODUCT : contains\n PRODUCT ||--o{ ORDER-ITEM : "ordered in"\n ',"Git Graph":'gitGraph:\noptions\n{\n "nodeSpacing": 150,\n "nodeRadius": 10\n}\nend\ncommit\nbranch newbranch\ncheckout newbranch\ncommit\ncommit\ncheckout master\ncommit\ncommit\nmerge newbranch\n\n ',"User Journey":" journey\n title My working day\n section Go to work\n Make tea: 5: Me\n Go upstairs: 3: Me\n Do work: 1: Me, Cat\n section Go home\n Go downstairs: 5: Me\n Sit down: 3: Me\n "},n=e=>{me(t[e],!0,!0)};return[t,n,e=>n(e)]}class tt extends c{constructor(e){super(),d(this,e,et,Qe,u,{})}}function nt(e){let t,n,a;return{c(){t=h("input"),this.h()},l(e){t=m(e,"INPUT",{id:!0,type:!0,min:!0,max:!0}),this.h()},h(){g(t,"id","height"),g(t,"type","number"),g(t,"min","3"),g(t,"max","10000")},m(s,r){w(s,t,r),ae(t,e[5]),n||(a=j(t,"input",e[16]),n=!0)},p(e,n){32&n&&se(t.value)!==e[5]&&ae(t,e[5])},d(e){e&&p(t),n=!1,a()}}}function at(e){let t,n,a,s,r,i,o,l,c,d,u,y,b,$,k,x,S,A,K,O,R,L,N,_,B,M,V,P,G,U,q,z,H,Z,Y,J,F,W,X,Q,ee,te,ne,se,ie,oe,le,ce,de,ue,he,me,fe,pe=e[6](),ge=pe&&function(e){let t,n,a,s,r;return{c(){t=h("button"),n=h("i"),a=I(" Copy Image to clipboard"),this.h()},l(e){t=m(e,"BUTTON",{class:!0});var s=f(t);n=m(s,"I",{class:!0}),f(n).forEach(p),a=T(s," Copy Image to clipboard"),s.forEach(p),this.h()},h(){g(n,"class","far fa-copy"),g(t,"class","action-btn w-full")},m(i,o){w(i,t,o),C(t,n),C(t,a),s||(r=j(t,"click",e[7]),s=!0)},p:v,d(e){e&&p(t),s=!1,r()}}}(e),we="auto"!==e[4]&&nt(e);return{c(){t=h("div"),ge&&ge.c(),n=E(),a=h("button"),s=h("i"),r=I(" PNG"),i=E(),o=h("button"),l=h("i"),c=I(" SVG"),d=E(),u=h("button"),y=h("a"),b=h("i"),$=I(" PNG"),k=E(),x=h("button"),S=h("a"),A=h("i"),K=I(" SVG"),O=E(),R=h("div"),L=I("PNG size\n\t\t\t"),N=h("input"),_=E(),B=h("label"),M=I("Auto"),V=E(),P=h("input"),G=E(),U=h("label"),q=I("Width"),z=E(),H=h("input"),Z=E(),Y=h("label"),J=I("Height"),F=E(),we&&we.c(),W=E(),X=h("div"),Q=h("input"),ee=E(),te=h("label"),ne=h("button"),se=I("Copy Markdown"),ie=E(),oe=h("div"),le=h("input"),ce=E(),de=h("label"),ue=h("button"),he=I("Load Gist"),this.h()},l(e){t=m(e,"DIV",{class:!0});var h=f(t);ge&&ge.l(h),n=D(h),a=m(h,"BUTTON",{class:!0});var g=f(a);s=m(g,"I",{class:!0}),f(s).forEach(p),r=T(g," PNG"),g.forEach(p),i=D(h),o=m(h,"BUTTON",{class:!0});var w=f(o);l=m(w,"I",{class:!0}),f(l).forEach(p),c=T(w," SVG"),w.forEach(p),d=D(h),u=m(h,"BUTTON",{class:!0});var v=f(u);y=m(v,"A",{target:!0,href:!0});var E=f(y);b=m(E,"I",{class:!0}),f(b).forEach(p),$=T(E," PNG"),E.forEach(p),v.forEach(p),k=D(h),x=m(h,"BUTTON",{class:!0});var I=f(x);S=m(I,"A",{target:!0,href:!0});var C=f(S);A=m(C,"I",{class:!0}),f(A).forEach(p),K=T(C," SVG"),C.forEach(p),I.forEach(p),O=D(h),R=m(h,"DIV",{class:!0});var j=f(R);L=T(j,"PNG size\n\t\t\t"),N=m(j,"INPUT",{type:!0,id:!0}),_=D(j),B=m(j,"LABEL",{for:!0});var ae=f(B);M=T(ae,"Auto"),ae.forEach(p),V=D(j),P=m(j,"INPUT",{type:!0,id:!0}),G=D(j),U=m(j,"LABEL",{for:!0});var re=f(U);q=T(re,"Width"),re.forEach(p),z=D(j),H=m(j,"INPUT",{type:!0,id:!0}),Z=D(j),Y=m(j,"LABEL",{for:!0});var me=f(Y);J=T(me,"Height"),me.forEach(p),F=D(j),we&&we.l(j),j.forEach(p),W=D(h),X=m(h,"DIV",{class:!0});var fe=f(X);Q=m(fe,"INPUT",{class:!0,id:!0,type:!0}),ee=D(fe),te=m(fe,"LABEL",{for:!0});var pe=f(te);ne=m(pe,"BUTTON",{class:!0});var ve=f(ne);se=T(ve,"Copy Markdown"),ve.forEach(p),pe.forEach(p),fe.forEach(p),ie=D(h),oe=m(h,"DIV",{class:!0});var ye=f(oe);le=m(ye,"INPUT",{class:!0,id:!0,type:!0,placeholder:!0}),ce=D(ye),de=m(ye,"LABEL",{for:!0});var be=f(de);ue=m(be,"BUTTON",{class:!0});var $e=f(ue);he=T($e,"Load Gist"),$e.forEach(p),be.forEach(p),ye.forEach(p),h.forEach(p),this.h()},h(){g(s,"class","fas fa-download"),g(a,"class","action-btn flex-auto"),g(l,"class","fas fa-download"),g(o,"class","action-btn flex-auto"),g(b,"class","fas fa-external-link-alt"),g(y,"target","_blank"),g(y,"href",e[1]),g(u,"class","action-btn flex-auto"),g(A,"class","fas fa-external-link-alt"),g(S,"target","_blank"),g(S,"href",e[2]),g(x,"class","action-btn flex-auto"),g(N,"type","radio"),N.__value="auto",N.value=N.__value,g(N,"id","autosize"),e[13][0].push(N),g(B,"for","autosize"),g(P,"type","radio"),P.__value="width",P.value=P.__value,g(P,"id","width-active"),e[13][0].push(P),g(U,"for","width"),g(H,"type","radio"),H.__value="height",H.value=H.__value,g(H,"id","height-active"),e[13][0].push(H),g(Y,"for","height"),g(R,"class","flex gap-2 items-center"),g(Q,"class","input"),g(Q,"id","markdown"),g(Q,"type","text"),Q.value=e[3],g(ne,"class","btn text-white flex-auto"),g(te,"for","markdown"),g(X,"class","w-full flex gap-2 items-center"),g(le,"class","input"),g(le,"id","gist"),g(le,"type","text"),g(le,"placeholder","Enter Gist URL"),g(ue,"class","btn text-white flex-auto"),g(de,"for","gist"),g(oe,"class","w-full flex gap-2 items-center"),g(t,"class","flex flex-wrap gap-2 m-2")},m(h,m){w(h,t,m),ge&&ge.m(t,null),C(t,n),C(t,a),C(a,s),C(a,r),C(t,i),C(t,o),C(o,l),C(o,c),C(t,d),C(t,u),C(u,y),C(y,b),C(y,$),C(t,k),C(t,x),C(x,S),C(S,A),C(S,K),C(t,O),C(t,R),C(R,L),C(R,N),N.checked=N.__value===e[4],C(R,_),C(R,B),C(B,M),C(R,V),C(R,P),P.checked=P.__value===e[4],C(R,G),C(R,U),C(U,q),C(R,z),C(R,H),H.checked=H.__value===e[4],C(R,Z),C(R,Y),C(Y,J),C(R,F),we&&we.m(R,null),C(t,W),C(t,X),C(X,Q),C(X,ee),C(X,te),C(te,ne),C(ne,se),C(t,ie),C(t,oe),C(oe,le),ae(le,e[0]),C(oe,ce),C(oe,de),C(de,ue),C(ue,he),me||(fe=[j(a,"click",e[8]),j(o,"click",e[9]),j(N,"change",e[12]),j(P,"change",e[14]),j(H,"change",e[15]),j(Q,"click",e[10]),j(ne,"click",e[10]),j(le,"input",e[17]),j(ue,"click",e[11])],me=!0)},p(e,t){pe&&ge.p(e,t),2&t&&g(y,"href",e[1]),4&t&&g(S,"href",e[2]),16&t&&(N.checked=N.__value===e[4]),16&t&&(P.checked=P.__value===e[4]),16&t&&(H.checked=H.__value===e[4]),"auto"!==e[4]?we?we.p(e,t):(we=nt(e),we.c(),we.m(R,null)):we&&(we.d(1),we=null),8&t&&Q.value!==e[3]&&(Q.value=e[3]),1&t&&le.value!==e[0]&&ae(le,e[0])},d(n){n&&p(t),ge&&ge.d(),e[13][0].splice(e[13][0].indexOf(N),1),e[13][0].splice(e[13][0].indexOf(P),1),e[13][0].splice(e[13][0].indexOf(H),1),we&&we.d(),me=!1,re(fe)}}}function st(e){let t,n;return t=new Je({props:{title:"Actions",isOpen:!1,$$slots:{default:[at]},$$scope:{ctx:e}}}),{c(){J(t.$$.fragment)},l(e){F(t.$$.fragment,e)},m(e,a){W(t,e,a),n=!0},p(e,[n]){const a={};8388671&n&&(a.$$scope={dirty:n,ctx:e}),t.$set(a)},i(e){n||(V(t.$$.fragment,e),n=!0)},o(e){G(t.$$.fragment,e),n=!1},d(e){Q(t,e)}}}function rt(e,t,n){const a=(e,t,n)=>{null==e||e.setAttribute("height",`${n}px`),null==e||e.setAttribute("width",`${t}px`),e||(e=document.querySelector("#container svg"));const a=e.outerHTML.replaceAll("<br>","<br/>").replaceAll(/<img([^>]*)>/g,((e,t)=>`<img ${t} />`));return ne(a)},s=(e,t)=>{const n=document.createElement("canvas"),s=document.querySelector("#container svg"),r=s.getBoundingClientRect();if(n.width=r.width,n.height=r.height,"width"===h){const e=r.height/r.width;n.width=m,n.height=m*e}else if("height"===h){const e=r.width/r.height;n.width=m*e,n.height=m}const i=n.getContext("2d");i.fillStyle="white",i.fillRect(0,0,n.width,n.height);const o=new Image;o.onload=t(i,o),o.src=`data:image/svg+xml;base64,${a(s,n.width,n.height)}`,e.stopPropagation(),e.preventDefault()},r=(e,t)=>{const n=document.createElement("a");n.download=e,n.href=t,n.click(),n.remove()},i=(e,t)=>()=>{const{canvas:n}=e;e.drawImage(t,0,0,n.width,n.height),r(`mermaid-diagram-${ie().format("YYYYMMDDHHmmss")}.png`,n.toDataURL("image/png").replace("image/png","image/octet-stream"))},o=(e,t)=>()=>{const{canvas:n}=e;e.drawImage(t,0,0,n.width,n.height),n.toBlob((e=>{try{navigator.clipboard.write([new ClipboardItem({[e.type]:e})])}catch(t){console.error(t)}}))};let l="";ue.subscribe((e=>{var t;"gist"===(null===(t=e.loader)||void 0===t?void 0:t.type)&&n(0,l=e.loader.config.url)}));let c,d,u,h="auto",m=1080;ue.subscribe((e=>{const t=JSON.parse(JSON.stringify(e));"string"==typeof t.mermaid&&(t.mermaid=JSON.parse(t.mermaid));const a=ne(JSON.stringify(t),!0);n(1,c=`https://mermaid.ink/img/${a}`),n(2,d=`https://mermaid.ink/svg/${a}`),n(3,u=`[](${window.location.protocol}//${window.location.host}${window.location.pathname}#${window.location.hash})`)}));return[l,c,d,u,h,m,()=>Object.prototype.hasOwnProperty.call(window,"ClipboardItem"),e=>{s(e,o)},e=>{s(e,i)},()=>{r(`mermaid-diagram-${ie().format("YYYYMMDDHHmmss")}.svg`,`data:image/svg+xml;base64,${a()}`)},()=>{document.getElementById("markdown").select(),document.execCommand("Copy")},()=>{l||alert("Please enter a Gist URL first"),window.location.href=`${window.location.pathname}?gist=${l}`},function(){h=this.__value,n(4,h)},[[]],function(){h=this.__value,n(4,h)},function(){h=this.__value,n(4,h)},function(){m=se(this.value),n(5,m)},function(){l=this.value,n(0,l)}]}class it extends c{constructor(e){super(),d(this,e,rt,st,u,{})}}function ot(e,t,n){const a=e.slice();return a[15]=t[n].state,a[16]=t[n].time,a[17]=t[n].name,a[18]=t[n].url,a[19]=t[n].type,a}function lt(e){let t,n,a,s,r,i;return{c(){t=h("div"),n=I("No items in History"),a=h("br"),s=I("\n\t\t\t\tClick the Save button to save current state and restore it later."),r=h("br"),i=I("\n\t\t\t\tTimeline will automatically be saved every minute."),this.h()},l(e){t=m(e,"DIV",{class:!0});var o=f(t);n=T(o,"No items in History"),a=m(o,"BR",{}),s=T(o,"\n\t\t\t\tClick the Save button to save current state and restore it later."),r=m(o,"BR",{}),i=T(o,"\n\t\t\t\tTimeline will automatically be saved every minute."),o.forEach(p),this.h()},h(){g(t,"class","m-2 text-gray-600")},m(e,o){w(e,t,o),C(t,n),C(t,a),C(t,s),C(t,r),C(t,i)},p:v,d(e){e&&p(t)}}}function ct(e){let t,n=e[3],a=[];for(let s=0;s<n.length;s+=1)a[s]=mt(ot(e,n,s));return{c(){for(let e=0;e<a.length;e+=1)a[e].c();t=oe()},l(e){for(let t=0;t<a.length;t+=1)a[t].l(e);t=oe()},m(e,n){for(let t=0;t<a.length;t+=1)a[t].m(e,n);w(e,t,n)},p(e,s){if(456&s){let r;for(n=e[3],r=0;r<n.length;r+=1){const i=ot(e,n,r);a[r]?a[r].p(i,s):(a[r]=mt(i),a[r].c(),a[r].m(t.parentNode,t))}for(;r<a.length;r+=1)a[r].d(1);a.length=n.length}},d(e){K(a,e),e&&p(t)}}}function dt(e){let t,n,a=e[17]+"";return{c(){t=h("span"),n=I(a)},l(e){t=m(e,"SPAN",{});var s=f(t);n=T(s,a),s.forEach(p)},m(e,a){w(e,t,a),C(t,n)},p(e,t){8&t&&a!==(a=e[17]+"")&&N(n,a)},d(e){e&&p(t)}}}function ut(e){let t,n,a,s=e[17]+"";return{c(){t=h("a"),n=I(s),this.h()},l(e){t=m(e,"A",{href:!0,target:!0,title:!0,class:!0});var a=f(t);n=T(a,s),a.forEach(p),this.h()},h(){g(t,"href",a=e[18]),g(t,"target","_blank"),g(t,"title","Open revision in new tab"),g(t,"class","hover:underline text-blue-500")},m(e,a){w(e,t,a),C(t,n)},p(e,r){8&r&&s!==(s=e[17]+"")&&N(n,s),8&r&&a!==(a=e[18])&&g(t,"href",a)},d(e){e&&p(t)}}}function ht(e){let t,n,a,s,r;function i(){return e[12](e[16])}return{c(){t=h("button"),n=h("i"),a=I(" Delete"),this.h()},l(e){t=m(e,"BUTTON",{class:!0});var s=f(t);n=m(s,"I",{class:!0}),f(n).forEach(p),a=T(s," Delete"),s.forEach(p),this.h()},h(){g(n,"class","fas fa-trash-alt"),g(t,"class","rounded px-2 w-24 bg-red-200 hover:bg-red-300")},m(e,o){w(e,t,o),C(t,n),C(t,a),s||(r=j(t,"click",i),s=!0)},p(t,n){e=t},d(e){e&&p(t),s=!1,r()}}}function mt(e){let t,n,a,s,r,i,o,l,c,d,u,v,y,b,$,k,x=e[8](e[16])+"";function S(e,t){return e[18]?ut:dt}let A=S(e),K=A(e);function O(){return e[11](e[15])}let R="loader"!==e[19]&&ht(e);return{c(){t=h("li"),n=h("div"),a=h("div"),s=h("div"),K.c(),r=E(),i=h("span"),o=I(x),l=E(),c=h("div"),d=h("button"),u=h("i"),v=I(" Restore"),y=E(),R&&R.c(),b=E(),this.h()},l(e){t=m(e,"LI",{class:!0});var h=f(t);n=m(h,"DIV",{class:!0});var g=f(n);a=m(g,"DIV",{class:!0});var w=f(a);s=m(w,"DIV",{class:!0});var $=f(s);K.l($),r=D($),i=m($,"SPAN",{class:!0});var k=f(i);o=T(k,x),k.forEach(p),$.forEach(p),w.forEach(p),l=D(g),c=m(g,"DIV",{class:!0});var E=f(c);d=m(E,"BUTTON",{class:!0});var I=f(d);u=m(I,"I",{class:!0}),f(u).forEach(p),v=T(I," Restore"),I.forEach(p),y=D(E),R&&R.l(E),E.forEach(p),g.forEach(p),b=D(h),h.forEach(p),this.h()},h(){g(i,"class","text-gray-400 text-sm"),g(s,"class","flex flex-col"),g(a,"class","flex-1"),g(u,"class","fas fa-undo"),g(d,"class","rounded px-2 w-24 bg-green-200 hover:bg-green-300"),g(c,"class","flex gap-2 content-center"),g(n,"class","flex"),g(t,"class","rounded p-2 shadow flex-col")},m(e,h){w(e,t,h),C(t,n),C(n,a),C(a,s),K.m(s,null),C(s,r),C(s,i),C(i,o),C(n,l),C(n,c),C(c,d),C(d,u),C(d,v),C(c,y),R&&R.m(c,null),C(t,b),$||(k=j(d,"click",O),$=!0)},p(t,n){A===(A=S(e=t))&&K?K.p(e,n):(K.d(1),K=A(e),K&&(K.c(),K.m(s,r))),8&n&&x!==(x=e[8](e[16])+"")&&N(o,x),"loader"!==e[19]?R?R.p(e,n):(R=ht(e),R.c(),R.m(c,null)):R&&(R.d(1),R=null)},d(e){e&&p(t),K.d(),R&&R.d(),$=!1,k()}}}function ft(e){let t;function n(e,t){return e[3].length>0?ct:lt}let a=n(e),s=a(e);return{c(){t=h("ul"),s.c(),this.h()},l(e){t=m(e,"UL",{class:!0,id:!0});var n=f(t);s.l(n),n.forEach(p),this.h()},h(){g(t,"class","p-2 space-y-2 overflow-auto h-56"),g(t,"id","historyList")},m(e,n){w(e,t,n),s.m(t,null)},p(e,r){a===(a=n(e))&&s?s.p(e,r):(s.d(1),s=a(e),s&&(s.c(),s.m(t,null)))},d(e){e&&p(t),s.d()}}}function pt(e){let t,n,a,s;return{c(){t=h("button"),n=h("i"),this.h()},l(e){t=m(e,"BUTTON",{id:!0,class:!0,title:!0});var a=f(t);n=m(a,"I",{class:!0}),f(n).forEach(p),a.forEach(p),this.h()},h(){g(n,"class","fas fa-trash-alt"),g(t,"id","clearHistory"),g(t,"class","btn text-red-400"),g(t,"title","Delete all saved states")},m(r,i){w(r,t,i),C(t,n),a||(s=j(t,"click",L(e[10])),a=!0)},p:v,d(e){e&&p(t),a=!1,s()}}}function gt(e){let t,n,a,s,r,i,o="loader"!==e[2]&&pt(e);return{c(){t=h("div"),n=h("button"),a=h("i"),s=E(),o&&o.c(),this.h()},l(e){t=m(e,"DIV",{slot:!0});var r=f(t);n=m(r,"BUTTON",{id:!0,class:!0,title:!0});var i=f(n);a=m(i,"I",{class:!0}),f(a).forEach(p),i.forEach(p),s=D(r),o&&o.l(r),r.forEach(p),this.h()},h(){g(a,"class","far fa-save"),g(n,"id","saveHistory"),g(n,"class","btn"),g(n,"title","Save current state"),g(t,"slot","actions")},m(l,c){w(l,t,c),C(t,n),C(n,a),C(t,s),o&&o.m(t,null),r||(i=j(n,"click",L(e[9])),r=!0)},p(e,n){"loader"!==e[2]?o?o.p(e,n):(o=pt(e),o.c(),o.m(t,null)):o&&(o.d(1),o=null)},d(e){e&&p(t),o&&o.d(),r=!1,i()}}}function wt(e){let t,n,a;function s(t){e[13](t)}let r={tabs:e[0],title:"History",$$slots:{actions:[gt],default:[ft]},$$scope:{ctx:e}};return void 0!==e[1]&&(r.isOpen=e[1]),t=new Je({props:r}),k.push((()=>q(t,"isOpen",s))),t.$on("select",e[4]),{c(){J(t.$$.fragment)},l(e){F(t.$$.fragment,e)},m(e,n){W(t,e,n),a=!0},p(e,[a]){const s={};1&a&&(s.tabs=e[0]),4194316&a&&(s.$$scope={dirty:a,ctx:e}),!n&&2&a&&(n=!0,s.isOpen=e[1],X((()=>n=!1))),t.$set(s)},i(e){a||(V(t.$$.fragment,e),a=!0)},o(e){G(t.$$.fragment,e),a=!1},d(e){Q(t,e)}}}function vt(e,t,n){let a,s,r;y(e,ue,(e=>n(14,a=e))),y(e,fe,(e=>n(2,s=e))),y(e,pe,(e=>n(3,r=e)));let i=[{id:"manual",title:"Saved",icon:"far fa-bookmark"},{id:"auto",title:"Timeline",icon:"fas fa-history"}];const o=(e=!1)=>{const t=we();ve(e)!==t?ye({state:a,time:Date.now(),type:e?"auto":"manual"}):e||alert("State already saved.")},l=e=>{(e||confirm("Clear all saved items?"))&&be(e)},c=e=>{ue.set(Object.assign(Object.assign({},e),{updateEditor:!0,updateDiagram:!0}))};$((()=>{fe.set("manual"),setInterval((()=>{o(!0)}),6e4)})),ge.subscribe((e=>{e.length>0&&2===i.length&&(n(0,i=[{id:"loader",title:"Revisions",icon:"fab fa-git-alt"},...i]),fe.set("loader"))}));let d=!0;return[i,d,s,r,e=>{fe.set(e.detail.id)},o,l,c,e=>{const t=new Date(e);return`${new Date(t).toLocaleString()} (${ie(t).fromNow()})`},()=>o(),()=>l(),e=>c(e),e=>l(e),function(e){d=e,n(1,d)}]}class yt extends c{constructor(e){super(),d(this,e,vt,wt,u,{})}}function bt(e){let t,n,a;function s(t){e[10](t)}let r={language:e[2],errorMarkers:e[3]};return void 0!==e[1]&&(r.text=e[1]),t=new Ke({props:r}),k.push((()=>q(t,"text",s))),t.$on("update",e[6]),{c(){J(t.$$.fragment)},l(e){F(t.$$.fragment,e)},m(e,n){W(t,e,n),a=!0},p(e,a){const s={};4&a&&(s.language=e[2]),8&a&&(s.errorMarkers=e[3]),!n&&2&a&&(n=!0,s.text=e[1],X((()=>n=!1))),t.$set(s)},i(e){a||(V(t.$$.fragment,e),a=!0)},o(e){G(t.$$.fragment,e),a=!1},d(e){Q(t,e)}}}function $t(e){let t,n,a,s;return{c(){t=h("button"),n=h("i"),this.h()},l(e){t=m(e,"BUTTON",{class:!0,title:!0,"data-cy":!0});var a=f(t);n=m(a,"I",{class:!0}),f(n).forEach(p),a.forEach(p),this.h()},h(){g(n,"class","fas fa-sync"),g(t,"class","bg-indigo-500 hover:bg-indigo-700 rounded px-4 mx-2"),g(t,"title","Sync Diagram"),g(t,"data-cy","sync")},m(e,r){w(e,t,r),C(t,n),a||(s=j(t,"click",Ie),a=!0)},p:v,d(e){e&&p(t),a=!1,s()}}}function kt(e){let t,n,a,s,r,i,o,l=!e[0].autoSync&&$t();return{c(){t=h("div"),l&&l.c(),n=E(),a=h("label"),s=h("input"),r=I("\n\t\t\t\t\t\tAuto sync"),this.h()},l(e){t=m(e,"DIV",{slot:!0});var i=f(t);l&&l.l(i),n=D(i),a=m(i,"LABEL",{for:!0,style:!0});var o=f(a);s=m(o,"INPUT",{type:!0,id:!0}),r=T(o,"\n\t\t\t\t\t\tAuto sync"),o.forEach(p),i.forEach(p),this.h()},h(){g(s,"type","checkbox"),g(s,"id","autoSync"),g(a,"for","autoSync"),le(a,"white-space","nowrap"),le(a,"overflow","hidden"),le(a,"text-overflow","ellipsis"),g(t,"slot","actions")},m(c,d){w(c,t,d),l&&l.m(t,null),C(t,n),C(t,a),C(a,s),s.checked=e[0].autoSync,C(a,r),i||(o=j(s,"change",e[9]),i=!0)},p(e,a){e[0].autoSync?l&&(l.d(1),l=null):l?l.p(e,a):(l=$t(),l.c(),l.m(t,n)),1&a&&(s.checked=e[0].autoSync)},d(e){e&&p(t),l&&l.d(),i=!1,o()}}}function xt(e){let t,n,a;return n=new $e({}),{c(){t=h("div"),J(n.$$.fragment),this.h()},l(e){t=m(e,"DIV",{class:!0});var a=f(t);F(n.$$.fragment,a),a.forEach(p),this.h()},h(){g(t,"class","flex-1 overflow-auto")},m(e,s){w(e,t,s),W(n,t,null),a=!0},i(e){a||(V(n.$$.fragment,e),a=!0)},o(e){G(n.$$.fragment,e),a=!1},d(e){e&&p(t),Q(n)}}}function Et(e){let t,n,a,s,r;return{c(){t=h("button"),n=h("i"),a=I(" View"),this.h()},l(e){t=m(e,"BUTTON",{slot:!0,class:!0,title:!0});var s=f(t);n=m(s,"I",{class:!0}),f(n).forEach(p),a=T(s," View"),s.forEach(p),this.h()},h(){g(n,"class","far fa-eye"),g(t,"slot","actions"),g(t,"class","btn"),g(t,"title","View diagram in new page")},m(i,o){w(i,t,o),C(t,n),C(t,a),s||(r=j(t,"click",L(e[11])),s=!0)},p:v,d(e){e&&p(t),s=!1,r()}}}function It(e){let t,n,a,s,r,i,o,l,c,d,u,v,y,b,$,k,x,S,A,K,O,R;return n=new Ne({}),i=new Je({props:{tabs:e[5],isCloseable:!1,title:"Mermaid",$$slots:{actions:[kt],default:[bt]},$$scope:{ctx:e}}}),i.$on("select",e[4]),c=new tt({}),u=new yt({}),y=new it({}),S=new Je({props:{title:"Diagram",isCloseable:!1,$$slots:{actions:[Et],default:[xt]},$$scope:{ctx:e}}}),{c(){t=h("div"),J(n.$$.fragment),a=E(),s=h("div"),r=h("div"),J(i.$$.fragment),o=E(),l=h("div"),J(c.$$.fragment),d=E(),J(u.$$.fragment),v=E(),J(y.$$.fragment),b=E(),$=h("div"),k=E(),x=h("div"),J(S.$$.fragment),A=E(),K=h("div"),O=I("Code editing not supported on mobile. Please use a desktop browser."),this.h()},l(e){t=m(e,"DIV",{class:!0});var h=f(t);F(n.$$.fragment,h),a=D(h),s=m(h,"DIV",{class:!0});var g=f(s);r=m(g,"DIV",{class:!0,id:!0,style:!0});var w=f(r);F(i.$$.fragment,w),o=D(w),l=m(w,"DIV",{class:!0});var E=f(l);F(c.$$.fragment,E),d=D(E),F(u.$$.fragment,E),v=D(E),F(y.$$.fragment,E),E.forEach(p),w.forEach(p),b=D(g),$=m(g,"DIV",{id:!0,class:!0}),f($).forEach(p),k=D(g),x=m(g,"DIV",{class:!0});var I=f(x);F(S.$$.fragment,I),A=D(I),K=m(I,"DIV",{class:!0});var C=f(K);O=T(C,"Code editing not supported on mobile. Please use a desktop browser."),C.forEach(p),I.forEach(p),g.forEach(p),h.forEach(p),this.h()},h(){g(l,"class","-mt-2"),g(r,"class","hidden md:flex flex-col"),g(r,"id","editorPane"),le(r,"width","40%"),g($,"id","resizeHandler"),g($,"class","svelte-ub8fux"),g(K,"class","md:hidden bg-white rounded shadow p-2 mx-2"),g(x,"class","flex-1 flex flex-col overflow-hidden"),g(s,"class","flex-1 flex overflow-hidden"),g(t,"class","h-full flex flex-col overflow-hidden bg-gray-100")},m(e,h){w(e,t,h),W(n,t,null),C(t,a),C(t,s),C(s,r),W(i,r,null),C(r,o),C(r,l),W(c,l,null),C(l,d),W(u,l,null),C(l,v),W(y,l,null),C(s,b),C(s,$),C(s,k),C(s,x),W(S,x,null),C(x,A),C(x,K),C(K,O),R=!0},p(e,[t]){const n={};131087&t&&(n.$$scope={dirty:t,ctx:e}),i.$set(n);const a={};131072&t&&(a.$$scope={dirty:t,ctx:e}),S.$set(a)},i(e){R||(V(n.$$.fragment,e),V(i.$$.fragment,e),V(c.$$.fragment,e),V(u.$$.fragment,e),V(y.$$.fragment,e),V(S.$$.fragment,e),R=!0)},o(e){G(n.$$.fragment,e),G(i.$$.fragment,e),G(c.$$.fragment,e),G(u.$$.fragment,e),G(y.$$.fragment,e),G(S.$$.fragment,e),R=!1},d(e){e&&p(t),Q(n),Q(i),Q(c),Q(u),Q(y),Q(S)}}}function Dt(e,t,n){let a,s;y(e,ke,(e=>n(12,a=e))),y(e,ue,(e=>n(0,s=e)));var r=this&&this.__awaiter||function(e,t,n,a){return new(n||(n=Promise))((function(s,r){function i(e){try{l(a.next(e))}catch(t){r(t)}}function o(e){try{l(a.throw(e))}catch(t){r(t)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,o)}l((a=a.apply(e,t||[])).next())}))};let i="code";const o={code:"mermaid",config:"json"};let l="",c="mermaid",d=[];ue.subscribe((e=>{e.updateEditor&&n(1,l="code"===i?e.code:e.mermaid)}));const u=()=>{window.open(`${Te}/view#${a}`,"_blank").focus()};$((()=>r(void 0,void 0,void 0,(function*(){yield Ee();const e=document.getElementById("resizeHandler"),t=document.getElementById("editorPane"),n=e=>{const n=e.pageX-t.getBoundingClientRect().left;n>50&&(t.style.width=`${n}px`)},a=()=>{window.removeEventListener("mousemove",n)};e.addEventListener("mousedown",(e=>{e.preventDefault(),window.addEventListener("mousemove",n),window.addEventListener("mouseup",a)}))}))));return e.$$.update=()=>{256&e.$$.dirty&&n(2,c=o[i]),257&e.$$.dirty&&n(1,l="code"===i?s.code:s.mermaid)},[s,l,c,d,e=>{ce(ue,s.updateEditor=!0,s),n(8,i=e.detail.id)},[{id:"code",title:"Code",icon:"fas fa-code"},{id:"config",title:"Config",icon:"fas fa-cogs"}],e=>{try{"code"===i?(a=e.detail.text,de.exports.parse(a),me(a,!1)):(t=e.detail.text,JSON.parse(t),De(t,!1)),xe.set(void 0),n(3,d=[])}catch(s){if(xe.set(s),s.hash){const e={severity:8,startLineNumber:s.hash.loc.first_line,startColumn:s.hash.loc.first_column,endLineNumber:s.hash.loc.last_line,endColumn:s.hash.loc.last_column+1,message:s.str};d.push(e),n(3,d=d.filter((t=>t.startLineNumber>=e.startLineNumber&&t.startColumn>=e.startColumn)))}console.error(s)}var t,a},u,i,function(){s.autoSync=this.checked,ue.set(s)},function(e){l=e,n(1,l),n(8,i),n(0,s)},()=>u()]}class Tt extends c{constructor(e){super(),d(this,e,Dt,It,u,{})}}export{Tt as default};
|