@riligar/elysia-sqlite 1.6.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/README.md +52 -52
  2. package/package.json +1 -1
  3. package/src/index.js +198 -160
  4. package/src/ui/dist/assets/{_baseUniq-tp0gy_rC.js → _baseUniq-BMKkaOYG.js} +1 -1
  5. package/src/ui/dist/assets/{arc-CIKD5jh6.js → arc-DzwvCm0y.js} +1 -1
  6. package/src/ui/dist/assets/{architectureDiagram-VXUJARFQ-C-Zu1f5H.js → architectureDiagram-VXUJARFQ-CnkGS2CW.js} +1 -1
  7. package/src/ui/dist/assets/{blockDiagram-VD42YOAC-CwT44Fo1.js → blockDiagram-VD42YOAC-BAsWaVVt.js} +1 -1
  8. package/src/ui/dist/assets/{c4Diagram-YG6GDRKO-g1CkarVK.js → c4Diagram-YG6GDRKO-D3hSuEZw.js} +1 -1
  9. package/src/ui/dist/assets/channel-BDMhqIlJ.js +1 -0
  10. package/src/ui/dist/assets/{chunk-4BX2VUAB-BRSq_1my.js → chunk-4BX2VUAB-W3RfStVh.js} +1 -1
  11. package/src/ui/dist/assets/{chunk-55IACEB6-sJOVeCqP.js → chunk-55IACEB6-DNOq1VFt.js} +1 -1
  12. package/src/ui/dist/assets/{chunk-B4BG7PRW-CAJu4y9m.js → chunk-B4BG7PRW-BzO1OpN4.js} +1 -1
  13. package/src/ui/dist/assets/{chunk-DI55MBZ5-CqHNSLXG.js → chunk-DI55MBZ5-Y_GWh2zl.js} +1 -1
  14. package/src/ui/dist/assets/{chunk-FMBD7UC4-Cm8x3fGA.js → chunk-FMBD7UC4-Bi5H0CGx.js} +1 -1
  15. package/src/ui/dist/assets/{chunk-QN33PNHL-CXiOGhHB.js → chunk-QN33PNHL-Dtb7fGh4.js} +1 -1
  16. package/src/ui/dist/assets/{chunk-QZHKN3VN-Dac55Lwb.js → chunk-QZHKN3VN-ppMM_NQA.js} +1 -1
  17. package/src/ui/dist/assets/{chunk-TZMSLE5B-C2E0ascL.js → chunk-TZMSLE5B-BTmGFJO0.js} +1 -1
  18. package/src/ui/dist/assets/classDiagram-2ON5EDUG-BBbphcIu.js +1 -0
  19. package/src/ui/dist/assets/classDiagram-v2-WZHVMYZB-BBbphcIu.js +1 -0
  20. package/src/ui/dist/assets/clone-8HDXOICO.js +1 -0
  21. package/src/ui/dist/assets/{cose-bilkent-S5V4N54A-CJzZ2NKZ.js → cose-bilkent-S5V4N54A-DhSfb5hF.js} +1 -1
  22. package/src/ui/dist/assets/{dagre-6UL2VRFP-DqBYKK4u.js → dagre-6UL2VRFP-BeYsJtoG.js} +1 -1
  23. package/src/ui/dist/assets/{diagram-PSM6KHXK-Ud1GhyHV.js → diagram-PSM6KHXK-C-EWuuX_.js} +1 -1
  24. package/src/ui/dist/assets/{diagram-QEK2KX5R-C_PcM76a.js → diagram-QEK2KX5R-Bgl10GwF.js} +1 -1
  25. package/src/ui/dist/assets/{diagram-S2PKOQOG-Dxc59S6X.js → diagram-S2PKOQOG-BLljdZCM.js} +1 -1
  26. package/src/ui/dist/assets/{erDiagram-Q2GNP2WA-BM17VS0S.js → erDiagram-Q2GNP2WA-CjfXI2mB.js} +1 -1
  27. package/src/ui/dist/assets/{flowDiagram-NV44I4VS-DvifDv4F.js → flowDiagram-NV44I4VS-BILsxh5n.js} +1 -1
  28. package/src/ui/dist/assets/{ganttDiagram-JELNMOA3-BzdIaEbH.js → ganttDiagram-JELNMOA3-DpXhg3mE.js} +1 -1
  29. package/src/ui/dist/assets/{gitGraphDiagram-NY62KEGX-Df2I2D_a.js → gitGraphDiagram-NY62KEGX-DLD08RXZ.js} +1 -1
  30. package/src/ui/dist/assets/{graph-B581r9-3.js → graph-CavEq-OG.js} +1 -1
  31. package/src/ui/dist/assets/{index-BBKjGWlO.js → index-BG-h5MPT.js} +4 -4
  32. package/src/ui/dist/assets/{infoDiagram-WHAUD3N6-D7CJLVcM.js → infoDiagram-WHAUD3N6-cIe5ZWKq.js} +1 -1
  33. package/src/ui/dist/assets/{journeyDiagram-XKPGCS4Q-CX7LwWbu.js → journeyDiagram-XKPGCS4Q-CtJlkDMd.js} +1 -1
  34. package/src/ui/dist/assets/{kanban-definition-3W4ZIXB7-BIRhmBI5.js → kanban-definition-3W4ZIXB7-D5OeXcHJ.js} +1 -1
  35. package/src/ui/dist/assets/{layout-DC_20cjc.js → layout-BhMTPhmG.js} +1 -1
  36. package/src/ui/dist/assets/{linear-w2kfZjuH.js → linear-7JKJ0rc6.js} +1 -1
  37. package/src/ui/dist/assets/{min-DfeMYee7.js → min-DVfZQuXM.js} +1 -1
  38. package/src/ui/dist/assets/{mindmap-definition-VGOIOE7T-ooGmlDfN.js → mindmap-definition-VGOIOE7T-9WKTvEh6.js} +1 -1
  39. package/src/ui/dist/assets/{pieDiagram-ADFJNKIX-DIgElDn1.js → pieDiagram-ADFJNKIX-BhUn73AD.js} +1 -1
  40. package/src/ui/dist/assets/{quadrantDiagram-AYHSOK5B-Bpixm6gO.js → quadrantDiagram-AYHSOK5B-BZdz1yM3.js} +1 -1
  41. package/src/ui/dist/assets/{requirementDiagram-UZGBJVZJ-CTNj1gzp.js → requirementDiagram-UZGBJVZJ-Chqqws0m.js} +1 -1
  42. package/src/ui/dist/assets/{sankeyDiagram-TZEHDZUN-Bb0s_lf0.js → sankeyDiagram-TZEHDZUN-BOp8vVQ0.js} +1 -1
  43. package/src/ui/dist/assets/{sequenceDiagram-WL72ISMW-CMvbebl5.js → sequenceDiagram-WL72ISMW-DJ6x9fIe.js} +1 -1
  44. package/src/ui/dist/assets/{stateDiagram-FKZM4ZOC-VsagYS5z.js → stateDiagram-FKZM4ZOC-CL_VVFZQ.js} +1 -1
  45. package/src/ui/dist/assets/stateDiagram-v2-4FDKWEC3-vE8UUrO0.js +1 -0
  46. package/src/ui/dist/assets/{timeline-definition-IT6M3QCI-CD_E615Y.js → timeline-definition-IT6M3QCI-CTGuWGC8.js} +1 -1
  47. package/src/ui/dist/assets/{treemap-KMMF4GRG-Bmk930Gz.js → treemap-KMMF4GRG-DGWllLiC.js} +1 -1
  48. package/src/ui/dist/assets/{xychartDiagram-PRI3JC2R-CKe-Ew8V.js → xychartDiagram-PRI3JC2R-Drs9GbkQ.js} +1 -1
  49. package/src/ui/dist/index.html +1 -1
  50. package/src/ui/dist/assets/channel-1vrFD0pz.js +0 -1
  51. package/src/ui/dist/assets/classDiagram-2ON5EDUG-CZ5BrJQG.js +0 -1
  52. package/src/ui/dist/assets/classDiagram-v2-WZHVMYZB-CZ5BrJQG.js +0 -1
  53. package/src/ui/dist/assets/clone-B1UmMcxV.js +0 -1
  54. package/src/ui/dist/assets/stateDiagram-v2-4FDKWEC3-lzsfBFxI.js +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./dagre-6UL2VRFP-DqBYKK4u.js","./graph-B581r9-3.js","./_baseUniq-tp0gy_rC.js","./layout-DC_20cjc.js","./min-DfeMYee7.js","./clone-B1UmMcxV.js","./cose-bilkent-S5V4N54A-CJzZ2NKZ.js","./cytoscape.esm-BQaXIfA_.js","./c4Diagram-YG6GDRKO-g1CkarVK.js","./chunk-TZMSLE5B-C2E0ascL.js","./flowDiagram-NV44I4VS-DvifDv4F.js","./chunk-FMBD7UC4-Cm8x3fGA.js","./chunk-55IACEB6-sJOVeCqP.js","./chunk-QN33PNHL-CXiOGhHB.js","./channel-1vrFD0pz.js","./erDiagram-Q2GNP2WA-BM17VS0S.js","./gitGraphDiagram-NY62KEGX-Df2I2D_a.js","./chunk-4BX2VUAB-BRSq_1my.js","./chunk-QZHKN3VN-Dac55Lwb.js","./treemap-KMMF4GRG-Bmk930Gz.js","./ganttDiagram-JELNMOA3-BzdIaEbH.js","./linear-w2kfZjuH.js","./init-Gi6I4Gst.js","./defaultLocale-C4B-KCzX.js","./infoDiagram-WHAUD3N6-D7CJLVcM.js","./pieDiagram-ADFJNKIX-DIgElDn1.js","./arc-CIKD5jh6.js","./ordinal-Cboi1Yqb.js","./quadrantDiagram-AYHSOK5B-Bpixm6gO.js","./xychartDiagram-PRI3JC2R-CKe-Ew8V.js","./requirementDiagram-UZGBJVZJ-CTNj1gzp.js","./sequenceDiagram-WL72ISMW-CMvbebl5.js","./classDiagram-2ON5EDUG-CZ5BrJQG.js","./chunk-B4BG7PRW-CAJu4y9m.js","./classDiagram-v2-WZHVMYZB-CZ5BrJQG.js","./stateDiagram-FKZM4ZOC-VsagYS5z.js","./chunk-DI55MBZ5-CqHNSLXG.js","./stateDiagram-v2-4FDKWEC3-lzsfBFxI.js","./journeyDiagram-XKPGCS4Q-CX7LwWbu.js","./timeline-definition-IT6M3QCI-CD_E615Y.js","./mindmap-definition-VGOIOE7T-ooGmlDfN.js","./kanban-definition-3W4ZIXB7-BIRhmBI5.js","./sankeyDiagram-TZEHDZUN-Bb0s_lf0.js","./diagram-S2PKOQOG-Dxc59S6X.js","./diagram-QEK2KX5R-C_PcM76a.js","./blockDiagram-VD42YOAC-CwT44Fo1.js","./architectureDiagram-VXUJARFQ-C-Zu1f5H.js","./diagram-PSM6KHXK-Ud1GhyHV.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./dagre-6UL2VRFP-BeYsJtoG.js","./graph-CavEq-OG.js","./_baseUniq-BMKkaOYG.js","./layout-BhMTPhmG.js","./min-DVfZQuXM.js","./clone-8HDXOICO.js","./cose-bilkent-S5V4N54A-DhSfb5hF.js","./cytoscape.esm-BQaXIfA_.js","./c4Diagram-YG6GDRKO-D3hSuEZw.js","./chunk-TZMSLE5B-BTmGFJO0.js","./flowDiagram-NV44I4VS-BILsxh5n.js","./chunk-FMBD7UC4-Bi5H0CGx.js","./chunk-55IACEB6-DNOq1VFt.js","./chunk-QN33PNHL-Dtb7fGh4.js","./channel-BDMhqIlJ.js","./erDiagram-Q2GNP2WA-CjfXI2mB.js","./gitGraphDiagram-NY62KEGX-DLD08RXZ.js","./chunk-4BX2VUAB-W3RfStVh.js","./chunk-QZHKN3VN-ppMM_NQA.js","./treemap-KMMF4GRG-DGWllLiC.js","./ganttDiagram-JELNMOA3-DpXhg3mE.js","./linear-7JKJ0rc6.js","./init-Gi6I4Gst.js","./defaultLocale-C4B-KCzX.js","./infoDiagram-WHAUD3N6-cIe5ZWKq.js","./pieDiagram-ADFJNKIX-BhUn73AD.js","./arc-DzwvCm0y.js","./ordinal-Cboi1Yqb.js","./quadrantDiagram-AYHSOK5B-BZdz1yM3.js","./xychartDiagram-PRI3JC2R-Drs9GbkQ.js","./requirementDiagram-UZGBJVZJ-Chqqws0m.js","./sequenceDiagram-WL72ISMW-DJ6x9fIe.js","./classDiagram-2ON5EDUG-BBbphcIu.js","./chunk-B4BG7PRW-BzO1OpN4.js","./classDiagram-v2-WZHVMYZB-BBbphcIu.js","./stateDiagram-FKZM4ZOC-CL_VVFZQ.js","./chunk-DI55MBZ5-Y_GWh2zl.js","./stateDiagram-v2-4FDKWEC3-vE8UUrO0.js","./journeyDiagram-XKPGCS4Q-CtJlkDMd.js","./timeline-definition-IT6M3QCI-CTGuWGC8.js","./mindmap-definition-VGOIOE7T-9WKTvEh6.js","./kanban-definition-3W4ZIXB7-D5OeXcHJ.js","./sankeyDiagram-TZEHDZUN-BOp8vVQ0.js","./diagram-S2PKOQOG-BLljdZCM.js","./diagram-QEK2KX5R-Bgl10GwF.js","./blockDiagram-VD42YOAC-BAsWaVVt.js","./architectureDiagram-VXUJARFQ-CnkGS2CW.js","./diagram-PSM6KHXK-C-EWuuX_.js"])))=>i.map(i=>d[i]);
2
2
  var fR=Object.defineProperty;var pR=(t,e,r)=>e in t?fR(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var ke=(t,e,r)=>pR(t,typeof e!="symbol"?e+"":e,r);function gR(t,e){for(var r=0;r<e.length;r++){const n=e[r];if(typeof n!="string"&&!Array.isArray(n)){for(const i in n)if(i!=="default"&&!(i in t)){const o=Object.getOwnPropertyDescriptor(n,i);o&&Object.defineProperty(t,i,o.get?o:{enumerable:!0,get:()=>n[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function r(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(i){if(i.ep)return;i.ep=!0;const o=r(i);fetch(i.href,o)}})();function Ff(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Cm={exports:{}},Lc={},Sm={exports:{}},ie={};/**
3
3
  * @license React
4
4
  * react.production.min.js
@@ -324,8 +324,8 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
324
324
  node : x:${t.x} y:${t.y} w:${t.width} h:${t.height}`);const n=t.x,i=t.y,o=Math.abs(n-r.x),a=t.width/2;let l=r.x<e.x?a-o:a+o;const u=t.height/2,h=Math.abs(e.y-r.y),d=Math.abs(e.x-r.x);if(Math.abs(i-e.y)*a>Math.abs(n-e.x)*u){let f=r.y<e.y?e.y-u-i:i-u-e.y;l=d*f/h;const g={x:r.x<e.x?r.x+l:r.x-d+l,y:r.y<e.y?r.y+h-f:r.y-h+f};return l===0&&(g.x=e.x,g.y=e.y),d===0&&(g.x=e.x),h===0&&(g.y=e.y),at.debug(`abc89 top/bottom calc, Q ${h}, q ${f}, R ${d}, r ${l}`,g),g}else{r.x<e.x?l=e.x-a-n:l=n-a-e.x;let f=h*l/d,g=r.x<e.x?r.x+d-l:r.x-d+l,m=r.y<e.y?r.y+f:r.y-f;return at.debug(`sides calc abc89, Q ${h}, q ${f}, R ${d}, r ${l}`,{_x:g,_y:m}),l===0&&(g=e.x,m=e.y),d===0&&(g=e.x),h===0&&(m=e.y),{x:g,y:m}}},"intersection"),nS=T((t,e)=>{at.warn("abc88 cutPathAtIntersect",t,e);let r=[],n=t[0],i=!1;return t.forEach(o=>{if(at.info("abc88 checking point",o,e),!DY(e,o)&&!i){const a=IY(e,n,o);at.debug("abc88 inside",o,n,a),at.debug("abc88 intersection",a,e);let l=!1;r.forEach(u=>{l=l||u.x===a.x&&u.y===a.y}),r.some(u=>u.x===a.x&&u.y===a.y)?at.warn("abc88 no intersect",a,r):r.push(a),i=!0}else at.warn("abc88 outside",o,n),n=o,i||r.push(o)}),at.debug("returning points",r),r},"cutPathAtIntersect");function LM(t){const e=[],r=[];for(let n=1;n<t.length-1;n++){const i=t[n-1],o=t[n],a=t[n+1];(i.x===o.x&&o.y===a.y&&Math.abs(o.x-a.x)>5&&Math.abs(o.y-i.y)>5||i.y===o.y&&o.x===a.x&&Math.abs(o.x-i.x)>5&&Math.abs(o.y-a.y)>5)&&(e.push(o),r.push(n))}return{cornerPoints:e,cornerPointPositions:r}}T(LM,"extractCornerPoints");var iS=T(function(t,e,r){const n=e.x-t.x,i=e.y-t.y,o=Math.sqrt(n*n+i*i),a=r/o;return{x:e.x-a*n,y:e.y-a*i}},"findAdjacentPoint"),jY=T(function(t){const{cornerPointPositions:e}=LM(t),r=[];for(let n=0;n<t.length;n++)if(e.includes(n)){const i=t[n-1],o=t[n+1],a=t[n],l=iS(i,a,5),u=iS(o,a,5),h=u.x-l.x,d=u.y-l.y;r.push(l);const f=Math.sqrt(2)*2;let g={x:a.x,y:a.y};if(Math.abs(o.x-i.x)>10&&Math.abs(o.y-i.y)>=10){at.debug("Corner point fixing",Math.abs(o.x-i.x),Math.abs(o.y-i.y));const m=5;a.x===l.x?g={x:h<0?l.x-m+f:l.x+m-f,y:d<0?l.y-f:l.y+f}:g={x:h<0?l.x-f:l.x+f,y:d<0?l.y-m+f:l.y+m-f}}else at.debug("Corner point skipping fixing",Math.abs(o.x-i.x),Math.abs(o.y-i.y));r.push(g,u)}else r.push(t[n]);return r},"fixCorners"),zY=T((t,e,r)=>{const n=t-e-r,i=2,o=2,a=i+o,l=Math.floor(n/a),u=Array(l).fill(`${i} ${o}`).join(" ");return`0 ${e} ${u} ${r}`},"generateDashArray"),WY=T(function(t,e,r,n,i,o,a,l=!1){var W;const{handDrawnSeed:u}=me();let h=e.points,d=!1;const f=i;var g=o;const m=[];for(const I in e.cssCompiledStyles)s$(I)||m.push(e.cssCompiledStyles[I]);at.debug("UIO intersect check",e.points,g.x,f.x),g.intersect&&f.intersect&&!l&&(h=h.slice(1,e.points.length-1),h.unshift(f.intersect(h[0])),at.debug("Last point UIO",e.start,"-->",e.end,h[h.length-1],g,g.intersect(h[h.length-1])),h.push(g.intersect(h[h.length-1])));const v=btoa(JSON.stringify(h));e.toCluster&&(at.info("to cluster abc88",r.get(e.toCluster)),h=nS(e.points,r.get(e.toCluster).node),d=!0),e.fromCluster&&(at.debug("from cluster abc88",r.get(e.fromCluster),JSON.stringify(h,null,2)),h=nS(h.reverse(),r.get(e.fromCluster).node).reverse(),d=!0);let x=h.filter(I=>!Number.isNaN(I.y));x=jY(x);let w=Rd;switch(w=hf,e.curve){case"linear":w=hf;break;case"basis":w=Rd;break;case"cardinal":w=uE;break;case"bumpX":w=oE;break;case"bumpY":w=sE;break;case"catmullRom":w=dE;break;case"monotoneX":w=vE;break;case"monotoneY":w=xE;break;case"natural":w=wE;break;case"step":w=CE;break;case"stepAfter":w=kE;break;case"stepBefore":w=SE;break;default:w=Rd}const{x:S,y:k}=jW(e),E=S7().x(S).y(k).curve(w);let L;switch(e.thickness){case"normal":L="edge-thickness-normal";break;case"thick":L="edge-thickness-thick";break;case"invisible":L="edge-thickness-invisible";break;default:L="edge-thickness-normal"}switch(e.pattern){case"solid":L+=" edge-pattern-solid";break;case"dotted":L+=" edge-pattern-dotted";break;case"dashed":L+=" edge-pattern-dashed";break;default:L+=" edge-pattern-solid"}let A,M=e.curve==="rounded"?MM(AM(x,e),5):E(x);const B=Array.isArray(e.style)?e.style:[e.style];let D=B.find(I=>I==null?void 0:I.startsWith("stroke:")),q=!1;if(e.look==="handDrawn"){const I=Pt.svg(t);Object.assign([],x);const O=I.path(M,{roughness:.3,seed:u});L+=" transition",A=ce(O).select("path").attr("id",e.id).attr("class"," "+L+(e.classes?" "+e.classes:"")).attr("style",B?B.reduce((P,z)=>P+";"+z,""):"");let F=A.attr("d");A.attr("d",F),t.node().appendChild(A.node())}else{const I=m.join(";"),O=B?B.reduce((ot,yt)=>ot+yt+";",""):"";let F="";e.animate&&(F=" edge-animation-fast"),e.animation&&(F=" edge-animation-"+e.animation);const P=(I?I+";"+O+";":O)+";"+(B?B.reduce((ot,yt)=>ot+";"+yt,""):"");A=t.append("path").attr("d",M).attr("id",e.id).attr("class"," "+L+(e.classes?" "+e.classes:"")+(F??"")).attr("style",P),D=(W=P.match(/stroke:([^;]+)/))==null?void 0:W[1],q=e.animate===!0||!!e.animation||I.includes("animation");const z=A.node(),X=typeof z.getTotalLength=="function"?z.getTotalLength():0,N=bC[e.arrowTypeStart]||0,Z=bC[e.arrowTypeEnd]||0;if(e.look==="neo"&&!q){const yt=`stroke-dasharray: ${e.pattern==="dotted"||e.pattern==="dashed"?zY(X,N,Z):`0 ${N} ${X-N-Z} ${Z}`}; stroke-dashoffset: 0;`;A.attr("style",yt+A.attr("style"))}}A.attr("data-edge",!0),A.attr("data-et","edge"),A.attr("data-id",e.id),A.attr("data-points",v),e.showPoints&&x.forEach(I=>{t.append("circle").style("stroke","red").style("fill","red").attr("r",1).attr("cx",I.x).attr("cy",I.y)});let U="";(me().flowchart.arrowMarkerAbsolute||me().state.arrowMarkerAbsolute)&&(U=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,U=U.replace(/\(/g,"\\(").replace(/\)/g,"\\)")),at.info("arrowTypeStart",e.arrowTypeStart),at.info("arrowTypeEnd",e.arrowTypeEnd),BY(A,e,U,a,n,D);const H=Math.floor(h.length/2),K=h[H];gi.isLabelCoordinateInPath(K,A.attr("d"))||(d=!0);let V={};return d&&(V.updatedPath=h),V.originalPath=e.points,V},"insertEdge");function MM(t,e){if(t.length<2)return"";let r="";const n=t.length,i=1e-5;for(let o=0;o<n;o++){const a=t[o],l=t[o-1],u=t[o+1];if(o===0)r+=`M${a.x},${a.y}`;else if(o===n-1)r+=`L${a.x},${a.y}`;else{const h=a.x-l.x,d=a.y-l.y,f=u.x-a.x,g=u.y-a.y,m=Math.hypot(h,d),v=Math.hypot(f,g);if(m<i||v<i){r+=`L${a.x},${a.y}`;continue}const x=h/m,w=d/m,S=f/v,k=g/v,E=x*S+w*k,L=Math.max(-1,Math.min(1,E)),A=Math.acos(L);if(A<i||Math.abs(Math.PI-A)<i){r+=`L${a.x},${a.y}`;continue}const M=Math.min(e/Math.sin(A/2),m/2,v/2),B=a.x-x*M,D=a.y-w*M,q=a.x+S*M,U=a.y+k*M;r+=`L${B},${D}`,r+=`Q${a.x},${a.y} ${q},${U}`}}return r}T(MM,"generateRoundedPath");function E0(t,e){if(!t||!e)return{angle:0,deltaX:0,deltaY:0};const r=e.x-t.x,n=e.y-t.y;return{angle:Math.atan2(n,r),deltaX:r,deltaY:n}}T(E0,"calculateDeltaAndAngle");function AM(t,e){const r=t.map(i=>({...i}));if(t.length>=2&&Dr[e.arrowTypeStart]){const i=Dr[e.arrowTypeStart],o=t[0],a=t[1],{angle:l}=E0(o,a),u=i*Math.cos(l),h=i*Math.sin(l);r[0].x=o.x+u,r[0].y=o.y+h}const n=t.length;if(n>=2&&Dr[e.arrowTypeEnd]){const i=Dr[e.arrowTypeEnd],o=t[n-1],a=t[n-2],{angle:l}=E0(a,o),u=i*Math.cos(l),h=i*Math.sin(l);r[n-1].x=o.x-u,r[n-1].y=o.y-h}return r}T(AM,"applyMarkerOffsetsToPoints");var HY=T((t,e,r,n)=>{e.forEach(i=>{oG[i](t,r,n)})},"insertMarkers"),qY=T((t,e,r)=>{at.trace("Making markers for ",r),t.append("defs").append("marker").attr("id",r+"_"+e+"-extensionStart").attr("class","marker extension "+e).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 1,7 L18,13 V 1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-extensionEnd").attr("class","marker extension "+e).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z")},"extension"),VY=T((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-compositionStart").attr("class","marker composition "+e).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-compositionEnd").attr("class","marker composition "+e).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"composition"),UY=T((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-aggregationStart").attr("class","marker aggregation "+e).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-aggregationEnd").attr("class","marker aggregation "+e).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"aggregation"),YY=T((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-dependencyStart").attr("class","marker dependency "+e).attr("refX",6).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-dependencyEnd").attr("class","marker dependency "+e).attr("refX",13).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"dependency"),GY=T((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-lollipopStart").attr("class","marker lollipop "+e).attr("refX",13).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),t.append("defs").append("marker").attr("id",r+"_"+e+"-lollipopEnd").attr("class","marker lollipop "+e).attr("refX",1).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6)},"lollipop"),XY=T((t,e,r)=>{t.append("marker").attr("id",r+"_"+e+"-pointEnd").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refX",5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-pointStart").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refX",4.5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 5 L 10 10 L 10 0 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"point"),KY=T((t,e,r)=>{t.append("marker").attr("id",r+"_"+e+"-circleEnd").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refX",11).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-circleStart").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refX",-1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"circle"),QY=T((t,e,r)=>{t.append("marker").attr("id",r+"_"+e+"-crossEnd").attr("class","marker cross "+e).attr("viewBox","0 0 11 11").attr("refX",12).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-crossStart").attr("class","marker cross "+e).attr("viewBox","0 0 11 11").attr("refX",-1).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0")},"cross"),ZY=T((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","userSpaceOnUse").attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"barb"),JY=T((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-onlyOneStart").attr("class","marker onlyOne "+e).attr("refX",0).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("d","M9,0 L9,18 M15,0 L15,18"),t.append("defs").append("marker").attr("id",r+"_"+e+"-onlyOneEnd").attr("class","marker onlyOne "+e).attr("refX",18).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("d","M3,0 L3,18 M9,0 L9,18")},"only_one"),tG=T((t,e,r)=>{const n=t.append("defs").append("marker").attr("id",r+"_"+e+"-zeroOrOneStart").attr("class","marker zeroOrOne "+e).attr("refX",0).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto");n.append("circle").attr("fill","white").attr("cx",21).attr("cy",9).attr("r",6),n.append("path").attr("d","M9,0 L9,18");const i=t.append("defs").append("marker").attr("id",r+"_"+e+"-zeroOrOneEnd").attr("class","marker zeroOrOne "+e).attr("refX",30).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto");i.append("circle").attr("fill","white").attr("cx",9).attr("cy",9).attr("r",6),i.append("path").attr("d","M21,0 L21,18")},"zero_or_one"),eG=T((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-oneOrMoreStart").attr("class","marker oneOrMore "+e).attr("refX",18).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("d","M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27"),t.append("defs").append("marker").attr("id",r+"_"+e+"-oneOrMoreEnd").attr("class","marker oneOrMore "+e).attr("refX",27).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("d","M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18")},"one_or_more"),rG=T((t,e,r)=>{const n=t.append("defs").append("marker").attr("id",r+"_"+e+"-zeroOrMoreStart").attr("class","marker zeroOrMore "+e).attr("refX",18).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto");n.append("circle").attr("fill","white").attr("cx",48).attr("cy",18).attr("r",6),n.append("path").attr("d","M0,18 Q18,0 36,18 Q18,36 0,18");const i=t.append("defs").append("marker").attr("id",r+"_"+e+"-zeroOrMoreEnd").attr("class","marker zeroOrMore "+e).attr("refX",39).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto");i.append("circle").attr("fill","white").attr("cx",9).attr("cy",18).attr("r",6),i.append("path").attr("d","M21,18 Q39,0 57,18 Q39,36 21,18")},"zero_or_more"),nG=T((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-requirement_arrowEnd").attr("refX",20).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("path").attr("d",`M0,0
325
325
  L20,10
326
326
  M20,10
327
- L0,20`)},"requirement_arrow"),iG=T((t,e,r)=>{const n=t.append("defs").append("marker").attr("id",r+"_"+e+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");n.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),n.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),n.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),oG={extension:qY,composition:VY,aggregation:UY,dependency:YY,lollipop:GY,point:XY,circle:KY,cross:QY,barb:ZY,only_one:JY,zero_or_one:tG,one_or_more:eG,zero_or_more:rG,requirement_arrow:nG,requirement_contains:iG},sG=HY,aG={common:Hl,getConfig:Wr,insertCluster:gY,insertEdge:WY,insertEdgeLabel:OY,insertMarkers:sG,insertNode:$M,interpolateToCurve:Nx,labelHelper:Gt,log:at,positionEdgeLabel:FY},_u={},RM=T(t=>{for(const e of t)_u[e.name]=e},"registerLayoutLoaders"),lG=T(()=>{RM([{name:"dagre",loader:T(async()=>await ve(()=>import("./dagre-6UL2VRFP-DqBYKK4u.js"),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url),"loader")},{name:"cose-bilkent",loader:T(async()=>await ve(()=>import("./cose-bilkent-S5V4N54A-CJzZ2NKZ.js"),__vite__mapDeps([6,7]),import.meta.url),"loader")}])},"registerDefaultLayoutLoaders");lG();var uJ=T(async(t,e)=>{if(!(t.layoutAlgorithm in _u))throw new Error(`Unknown layout algorithm: ${t.layoutAlgorithm}`);const r=_u[t.layoutAlgorithm];return(await r.loader()).render(t,e,aG,{algorithm:r.algorithm})},"render"),hJ=T((t="",{fallback:e="dagre"}={})=>{if(t in _u)return t;if(e in _u)return at.warn(`Layout algorithm ${t} is not registered. Using ${e} as fallback.`),e;throw new Error(`Both layout algorithms ${t} and ${e} are not registered.`)},"getRegisteredLayoutAlgorithm"),PM="comm",BM="rule",NM="decl",cG="@import",uG="@namespace",hG="@keyframes",dG="@layer",OM=Math.abs,e1=String.fromCharCode;function FM(t){return t.trim()}function Fd(t,e,r){return t.replace(e,r)}function fG(t,e,r){return t.indexOf(e,r)}function dl(t,e){return t.charCodeAt(e)|0}function Rl(t,e,r){return t.slice(e,r)}function Fi(t){return t.length}function pG(t){return t.length}function yd(t,e){return e.push(t),t}var jp=1,Pl=1,DM=0,Qn=0,or=0,Gl="";function r1(t,e,r,n,i,o,a,l){return{value:t,root:e,parent:r,type:n,props:i,children:o,line:jp,column:Pl,length:a,return:"",siblings:l}}function gG(){return or}function mG(){return or=Qn>0?dl(Gl,--Qn):0,Pl--,or===10&&(Pl=1,jp--),or}function bi(){return or=Qn<DM?dl(Gl,Qn++):0,Pl++,or===10&&(Pl=1,jp++),or}function is(){return dl(Gl,Qn)}function Dd(){return Qn}function zp(t,e){return Rl(Gl,t,e)}function Tu(t){switch(t){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 yG(t){return jp=Pl=1,DM=Fi(Gl=t),Qn=0,[]}function vG(t){return Gl="",t}function py(t){return FM(zp(Qn-1,$0(t===91?t+2:t===40?t+1:t)))}function xG(t){for(;(or=is())&&or<33;)bi();return Tu(t)>2||Tu(or)>3?"":" "}function bG(t,e){for(;--e&&bi()&&!(or<48||or>102||or>57&&or<65||or>70&&or<97););return zp(t,Dd()+(e<6&&is()==32&&bi()==32))}function $0(t){for(;bi();)switch(or){case t:return Qn;case 34:case 39:t!==34&&t!==39&&$0(or);break;case 40:t===41&&$0(t);break;case 92:bi();break}return Qn}function wG(t,e){for(;bi()&&t+or!==57;)if(t+or===84&&is()===47)break;return"/*"+zp(e,Qn-1)+"*"+e1(t===47?t:bi())}function CG(t){for(;!Tu(is());)bi();return zp(t,Qn)}function SG(t){return vG(Id("",null,null,null,[""],t=yG(t),0,[0],t))}function Id(t,e,r,n,i,o,a,l,u){for(var h=0,d=0,f=a,g=0,m=0,v=0,x=1,w=1,S=1,k=0,E="",L=i,A=o,M=n,B=E;w;)switch(v=k,k=bi()){case 40:if(v!=108&&dl(B,f-1)==58){fG(B+=Fd(py(k),"&","&\f"),"&\f",OM(h?l[h-1]:0))!=-1&&(S=-1);break}case 34:case 39:case 91:B+=py(k);break;case 9:case 10:case 13:case 32:B+=xG(v);break;case 92:B+=bG(Dd()-1,7);continue;case 47:switch(is()){case 42:case 47:yd(kG(wG(bi(),Dd()),e,r,u),u),(Tu(v||1)==5||Tu(is()||1)==5)&&Fi(B)&&Rl(B,-1,void 0)!==" "&&(B+=" ");break;default:B+="/"}break;case 123*x:l[h++]=Fi(B)*S;case 125*x:case 59:case 0:switch(k){case 0:case 125:w=0;case 59+d:S==-1&&(B=Fd(B,/\f/g,"")),m>0&&(Fi(B)-f||x===0&&v===47)&&yd(m>32?sS(B+";",n,r,f-1,u):sS(Fd(B," ","")+";",n,r,f-2,u),u);break;case 59:B+=";";default:if(yd(M=oS(B,e,r,h,d,i,l,E,L=[],A=[],f,o),o),k===123)if(d===0)Id(B,e,M,M,L,o,f,l,A);else{switch(g){case 99:if(dl(B,3)===110)break;case 108:if(dl(B,2)===97)break;default:d=0;case 100:case 109:case 115:}d?Id(t,M,M,n&&yd(oS(t,M,M,0,0,i,l,E,i,L=[],f,A),A),i,A,f,l,n?L:A):Id(B,M,M,M,[""],A,0,l,A)}}h=d=m=0,x=S=1,E=B="",f=a;break;case 58:f=1+Fi(B),m=v;default:if(x<1){if(k==123)--x;else if(k==125&&x++==0&&mG()==125)continue}switch(B+=e1(k),k*x){case 38:S=d>0?1:(B+="\f",-1);break;case 44:l[h++]=(Fi(B)-1)*S,S=1;break;case 64:is()===45&&(B+=py(bi())),g=is(),d=f=Fi(E=B+=CG(Dd())),k++;break;case 45:v===45&&Fi(B)==2&&(x=0)}}return o}function oS(t,e,r,n,i,o,a,l,u,h,d,f){for(var g=i-1,m=i===0?o:[""],v=pG(m),x=0,w=0,S=0;x<n;++x)for(var k=0,E=Rl(t,g+1,g=OM(w=a[x])),L=t;k<v;++k)(L=FM(w>0?m[k]+" "+E:Fd(E,/&\f/g,m[k])))&&(u[S++]=L);return r1(t,e,r,i===0?BM:l,u,h,d,f)}function kG(t,e,r,n){return r1(t,e,r,PM,e1(gG()),Rl(t,2,-2),0,n)}function sS(t,e,r,n,i){return r1(t,e,r,NM,Rl(t,0,n),Rl(t,n+1,-1),n,i)}function L0(t,e){for(var r="",n=0;n<t.length;n++)r+=e(t[n],n,t,e)||"";return r}function _G(t,e,r,n){switch(t.type){case dG:if(t.children.length)break;case cG:case uG:case NM:return t.return=t.return||t.value;case PM:return"";case hG:return t.return=t.value+"{"+L0(t.children,n)+"}";case BM:if(!Fi(t.value=t.props.join(",")))return""}return Fi(r=L0(t.children,n))?t.return=t.value+"{"+r+"}":""}var TG=u$(Object.keys,Object),EG=Object.prototype,$G=EG.hasOwnProperty;function LG(t){if(!Mp(t))return TG(t);var e=[];for(var r in Object(t))$G.call(t,r)&&r!="constructor"&&e.push(r);return e}var M0=ma(Ki,"DataView"),A0=ma(Ki,"Promise"),R0=ma(Ki,"Set"),P0=ma(Ki,"WeakMap"),aS="[object Map]",MG="[object Object]",lS="[object Promise]",cS="[object Set]",uS="[object WeakMap]",hS="[object DataView]",AG=ga(M0),RG=ga(Su),PG=ga(A0),BG=ga(R0),NG=ga(P0),js=Vl;(M0&&js(new M0(new ArrayBuffer(1)))!=hS||Su&&js(new Su)!=aS||A0&&js(A0.resolve())!=lS||R0&&js(new R0)!=cS||P0&&js(new P0)!=uS)&&(js=function(t){var e=Vl(t),r=e==MG?t.constructor:void 0,n=r?ga(r):"";if(n)switch(n){case AG:return hS;case RG:return aS;case PG:return lS;case BG:return cS;case NG:return uS}return e});var OG="[object Map]",FG="[object Set]",DG=Object.prototype,IG=DG.hasOwnProperty;function dS(t){if(t==null)return!0;if(Ap(t)&&(kf(t)||typeof t=="string"||typeof t.splice=="function"||Px(t)||Bx(t)||Sf(t)))return!t.length;var e=js(t);if(e==OG||e==FG)return!t.size;if(Mp(t))return!LG(t).length;for(var r in t)if(IG.call(t,r))return!1;return!0}var IM="c4",jG=T(t=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(t),"detector"),zG=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./c4Diagram-YG6GDRKO-g1CkarVK.js");return{diagram:e}},__vite__mapDeps([8,9]),import.meta.url);return{id:IM,diagram:t}},"loader"),WG={id:IM,detector:jG,loader:zG},HG=WG,jM="flowchart",qG=T((t,e)=>{var r,n;return((r=e==null?void 0:e.flowchart)==null?void 0:r.defaultRenderer)==="dagre-wrapper"||((n=e==null?void 0:e.flowchart)==null?void 0:n.defaultRenderer)==="elk"?!1:/^\s*graph/.test(t)},"detector"),VG=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./flowDiagram-NV44I4VS-DvifDv4F.js");return{diagram:e}},__vite__mapDeps([10,11,12,13,14]),import.meta.url);return{id:jM,diagram:t}},"loader"),UG={id:jM,detector:qG,loader:VG},YG=UG,zM="flowchart-v2",GG=T((t,e)=>{var r,n,i;return((r=e==null?void 0:e.flowchart)==null?void 0:r.defaultRenderer)==="dagre-d3"?!1:(((n=e==null?void 0:e.flowchart)==null?void 0:n.defaultRenderer)==="elk"&&(e.layout="elk"),/^\s*graph/.test(t)&&((i=e==null?void 0:e.flowchart)==null?void 0:i.defaultRenderer)==="dagre-wrapper"?!0:/^\s*flowchart/.test(t))},"detector"),XG=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./flowDiagram-NV44I4VS-DvifDv4F.js");return{diagram:e}},__vite__mapDeps([10,11,12,13,14]),import.meta.url);return{id:zM,diagram:t}},"loader"),KG={id:zM,detector:GG,loader:XG},QG=KG,WM="er",ZG=T(t=>/^\s*erDiagram/.test(t),"detector"),JG=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./erDiagram-Q2GNP2WA-BM17VS0S.js");return{diagram:e}},__vite__mapDeps([15,12,13,14]),import.meta.url);return{id:WM,diagram:t}},"loader"),tX={id:WM,detector:ZG,loader:JG},eX=tX,HM="gitGraph",rX=T(t=>/^\s*gitGraph/.test(t),"detector"),nX=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./gitGraphDiagram-NY62KEGX-Df2I2D_a.js");return{diagram:e}},__vite__mapDeps([16,17,18,19,4,2]),import.meta.url);return{id:HM,diagram:t}},"loader"),iX={id:HM,detector:rX,loader:nX},oX=iX,qM="gantt",sX=T(t=>/^\s*gantt/.test(t),"detector"),aX=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./ganttDiagram-JELNMOA3-BzdIaEbH.js");return{diagram:e}},__vite__mapDeps([20,21,22,23]),import.meta.url);return{id:qM,diagram:t}},"loader"),lX={id:qM,detector:sX,loader:aX},cX=lX,VM="info",uX=T(t=>/^\s*info/.test(t),"detector"),hX=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./infoDiagram-WHAUD3N6-D7CJLVcM.js");return{diagram:e}},__vite__mapDeps([24,19,4,2]),import.meta.url);return{id:VM,diagram:t}},"loader"),dX={id:VM,detector:uX,loader:hX},UM="pie",fX=T(t=>/^\s*pie/.test(t),"detector"),pX=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./pieDiagram-ADFJNKIX-DIgElDn1.js");return{diagram:e}},__vite__mapDeps([25,17,19,4,2,26,27,22]),import.meta.url);return{id:UM,diagram:t}},"loader"),gX={id:UM,detector:fX,loader:pX},YM="quadrantChart",mX=T(t=>/^\s*quadrantChart/.test(t),"detector"),yX=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./quadrantDiagram-AYHSOK5B-Bpixm6gO.js");return{diagram:e}},__vite__mapDeps([28,21,22,23]),import.meta.url);return{id:YM,diagram:t}},"loader"),vX={id:YM,detector:mX,loader:yX},xX=vX,GM="xychart",bX=T(t=>/^\s*xychart(-beta)?/.test(t),"detector"),wX=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./xychartDiagram-PRI3JC2R-CKe-Ew8V.js");return{diagram:e}},__vite__mapDeps([29,22,27,21,23]),import.meta.url);return{id:GM,diagram:t}},"loader"),CX={id:GM,detector:bX,loader:wX},SX=CX,XM="requirement",kX=T(t=>/^\s*requirement(Diagram)?/.test(t),"detector"),_X=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./requirementDiagram-UZGBJVZJ-CTNj1gzp.js");return{diagram:e}},__vite__mapDeps([30,12,13]),import.meta.url);return{id:XM,diagram:t}},"loader"),TX={id:XM,detector:kX,loader:_X},EX=TX,KM="sequence",$X=T(t=>/^\s*sequenceDiagram/.test(t),"detector"),LX=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./sequenceDiagram-WL72ISMW-CMvbebl5.js");return{diagram:e}},__vite__mapDeps([31,9,18]),import.meta.url);return{id:KM,diagram:t}},"loader"),MX={id:KM,detector:$X,loader:LX},AX=MX,QM="class",RX=T((t,e)=>{var r;return((r=e==null?void 0:e.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*classDiagram/.test(t)},"detector"),PX=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./classDiagram-2ON5EDUG-CZ5BrJQG.js");return{diagram:e}},__vite__mapDeps([32,33,11,12,13]),import.meta.url);return{id:QM,diagram:t}},"loader"),BX={id:QM,detector:RX,loader:PX},NX=BX,ZM="classDiagram",OX=T((t,e)=>{var r;return/^\s*classDiagram/.test(t)&&((r=e==null?void 0:e.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(t)},"detector"),FX=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./classDiagram-v2-WZHVMYZB-CZ5BrJQG.js");return{diagram:e}},__vite__mapDeps([34,33,11,12,13]),import.meta.url);return{id:ZM,diagram:t}},"loader"),DX={id:ZM,detector:OX,loader:FX},IX=DX,JM="state",jX=T((t,e)=>{var r;return((r=e==null?void 0:e.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(t)},"detector"),zX=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./stateDiagram-FKZM4ZOC-VsagYS5z.js");return{diagram:e}},__vite__mapDeps([35,36,12,13,1,2,3,4]),import.meta.url);return{id:JM,diagram:t}},"loader"),WX={id:JM,detector:jX,loader:zX},HX=WX,tA="stateDiagram",qX=T((t,e)=>{var r;return!!(/^\s*stateDiagram-v2/.test(t)||/^\s*stateDiagram/.test(t)&&((r=e==null?void 0:e.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper")},"detector"),VX=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./stateDiagram-v2-4FDKWEC3-lzsfBFxI.js");return{diagram:e}},__vite__mapDeps([37,36,12,13]),import.meta.url);return{id:tA,diagram:t}},"loader"),UX={id:tA,detector:qX,loader:VX},YX=UX,eA="journey",GX=T(t=>/^\s*journey/.test(t),"detector"),XX=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./journeyDiagram-XKPGCS4Q-CX7LwWbu.js");return{diagram:e}},__vite__mapDeps([38,9,11,26]),import.meta.url);return{id:eA,diagram:t}},"loader"),KX={id:eA,detector:GX,loader:XX},QX=KX,ZX=T((t,e,r)=>{at.debug(`rendering svg for syntax error
328
- `);const n=R7(e),i=n.append("g");n.attr("viewBox","0 0 2412 512"),$T(n,100,512,!0),i.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),i.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),i.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),i.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),i.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),i.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),i.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),i.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${r}`)},"draw"),rA={draw:ZX},JX=rA,tK={db:{},renderer:rA,parser:{parse:T(()=>{},"parse")}},eK=tK,nA="flowchart-elk",rK=T((t,e={})=>{var r;return/^\s*flowchart-elk/.test(t)||/^\s*(flowchart|graph)/.test(t)&&((r=e==null?void 0:e.flowchart)==null?void 0:r.defaultRenderer)==="elk"?(e.layout="elk",!0):!1},"detector"),nK=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./flowDiagram-NV44I4VS-DvifDv4F.js");return{diagram:e}},__vite__mapDeps([10,11,12,13,14]),import.meta.url);return{id:nA,diagram:t}},"loader"),iK={id:nA,detector:rK,loader:nK},oK=iK,iA="timeline",sK=T(t=>/^\s*timeline/.test(t),"detector"),aK=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./timeline-definition-IT6M3QCI-CD_E615Y.js");return{diagram:e}},__vite__mapDeps([39,26]),import.meta.url);return{id:iA,diagram:t}},"loader"),lK={id:iA,detector:sK,loader:aK},cK=lK,oA="mindmap",uK=T(t=>/^\s*mindmap/.test(t),"detector"),hK=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./mindmap-definition-VGOIOE7T-ooGmlDfN.js");return{diagram:e}},__vite__mapDeps([40,12,13]),import.meta.url);return{id:oA,diagram:t}},"loader"),dK={id:oA,detector:uK,loader:hK},fK=dK,sA="kanban",pK=T(t=>/^\s*kanban/.test(t),"detector"),gK=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./kanban-definition-3W4ZIXB7-BIRhmBI5.js");return{diagram:e}},__vite__mapDeps([41,11]),import.meta.url);return{id:sA,diagram:t}},"loader"),mK={id:sA,detector:pK,loader:gK},yK=mK,aA="sankey",vK=T(t=>/^\s*sankey(-beta)?/.test(t),"detector"),xK=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./sankeyDiagram-TZEHDZUN-Bb0s_lf0.js");return{diagram:e}},__vite__mapDeps([42,27,22]),import.meta.url);return{id:aA,diagram:t}},"loader"),bK={id:aA,detector:vK,loader:xK},wK=bK,lA="packet",CK=T(t=>/^\s*packet(-beta)?/.test(t),"detector"),SK=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./diagram-S2PKOQOG-Dxc59S6X.js");return{diagram:e}},__vite__mapDeps([43,17,19,4,2]),import.meta.url);return{id:lA,diagram:t}},"loader"),kK={id:lA,detector:CK,loader:SK},cA="radar",_K=T(t=>/^\s*radar-beta/.test(t),"detector"),TK=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./diagram-QEK2KX5R-C_PcM76a.js");return{diagram:e}},__vite__mapDeps([44,17,19,4,2]),import.meta.url);return{id:cA,diagram:t}},"loader"),EK={id:cA,detector:_K,loader:TK},uA="block",$K=T(t=>/^\s*block(-beta)?/.test(t),"detector"),LK=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./blockDiagram-VD42YOAC-CwT44Fo1.js");return{diagram:e}},__vite__mapDeps([45,11,5,1,2,14]),import.meta.url);return{id:uA,diagram:t}},"loader"),MK={id:uA,detector:$K,loader:LK},AK=MK,hA="architecture",RK=T(t=>/^\s*architecture/.test(t),"detector"),PK=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./architectureDiagram-VXUJARFQ-C-Zu1f5H.js");return{diagram:e}},__vite__mapDeps([46,17,19,4,2,7]),import.meta.url);return{id:hA,diagram:t}},"loader"),BK={id:hA,detector:RK,loader:PK},NK=BK,dA="treemap",OK=T(t=>/^\s*treemap/.test(t),"detector"),FK=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./diagram-PSM6KHXK-Ud1GhyHV.js");return{diagram:e}},__vite__mapDeps([47,13,17,19,4,2,23,27,22]),import.meta.url);return{id:dA,diagram:t}},"loader"),DK={id:dA,detector:OK,loader:FK},fS=!1,Wp=T(()=>{fS||(fS=!0,nf("error",eK,t=>t.toLowerCase().trim()==="error"),nf("---",{db:{clear:T(()=>{},"clear")},styles:{},renderer:{draw:T(()=>{},"draw")},parser:{parse:T(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:T(()=>null,"init")},t=>t.toLowerCase().trimStart().startsWith("---")),jy(oK,fK,NK),jy(HG,yK,IX,NX,eX,cX,dX,gX,EX,AX,QG,YG,cK,oX,YX,HX,QX,xX,wK,kK,SX,AK,EK,DK))},"addDiagrams"),IK=T(async()=>{at.debug("Loading registered diagrams");const e=(await Promise.allSettled(Object.entries(na).map(async([r,{detector:n,loader:i}])=>{if(i)try{qy(r)}catch{try{const{diagram:o,id:a}=await i();nf(a,o,n)}catch(o){throw at.error(`Failed to load external diagram with key ${r}. Removing from detectors.`),delete na[r],o}}}))).filter(r=>r.status==="rejected");if(e.length>0){at.error(`Failed to load ${e.length} external diagrams`);for(const r of e)at.error(r);throw new Error(`Failed to load ${e.length} external diagrams`)}},"loadRegisteredDiagrams"),jK="graphics-document document";function fA(t,e){t.attr("role",jK),e!==""&&t.attr("aria-roledescription",e)}T(fA,"setA11yDiagramInfo");function pA(t,e,r,n){if(t.insert!==void 0){if(r){const i=`chart-desc-${n}`;t.attr("aria-describedby",i),t.insert("desc",":first-child").attr("id",i).text(r)}if(e){const i=`chart-title-${n}`;t.attr("aria-labelledby",i),t.insert("title",":first-child").attr("id",i).text(e)}}}T(pA,"addSVGa11yTitleDescription");var ta,B0=(ta=class{constructor(e,r,n,i,o){this.type=e,this.text=r,this.db=n,this.parser=i,this.renderer=o}static async fromText(e,r={}){var h,d;const n=Wr(),i=ix(e,n);e=DV(e)+`
327
+ L0,20`)},"requirement_arrow"),iG=T((t,e,r)=>{const n=t.append("defs").append("marker").attr("id",r+"_"+e+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");n.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),n.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),n.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),oG={extension:qY,composition:VY,aggregation:UY,dependency:YY,lollipop:GY,point:XY,circle:KY,cross:QY,barb:ZY,only_one:JY,zero_or_one:tG,one_or_more:eG,zero_or_more:rG,requirement_arrow:nG,requirement_contains:iG},sG=HY,aG={common:Hl,getConfig:Wr,insertCluster:gY,insertEdge:WY,insertEdgeLabel:OY,insertMarkers:sG,insertNode:$M,interpolateToCurve:Nx,labelHelper:Gt,log:at,positionEdgeLabel:FY},_u={},RM=T(t=>{for(const e of t)_u[e.name]=e},"registerLayoutLoaders"),lG=T(()=>{RM([{name:"dagre",loader:T(async()=>await ve(()=>import("./dagre-6UL2VRFP-BeYsJtoG.js"),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url),"loader")},{name:"cose-bilkent",loader:T(async()=>await ve(()=>import("./cose-bilkent-S5V4N54A-DhSfb5hF.js"),__vite__mapDeps([6,7]),import.meta.url),"loader")}])},"registerDefaultLayoutLoaders");lG();var uJ=T(async(t,e)=>{if(!(t.layoutAlgorithm in _u))throw new Error(`Unknown layout algorithm: ${t.layoutAlgorithm}`);const r=_u[t.layoutAlgorithm];return(await r.loader()).render(t,e,aG,{algorithm:r.algorithm})},"render"),hJ=T((t="",{fallback:e="dagre"}={})=>{if(t in _u)return t;if(e in _u)return at.warn(`Layout algorithm ${t} is not registered. Using ${e} as fallback.`),e;throw new Error(`Both layout algorithms ${t} and ${e} are not registered.`)},"getRegisteredLayoutAlgorithm"),PM="comm",BM="rule",NM="decl",cG="@import",uG="@namespace",hG="@keyframes",dG="@layer",OM=Math.abs,e1=String.fromCharCode;function FM(t){return t.trim()}function Fd(t,e,r){return t.replace(e,r)}function fG(t,e,r){return t.indexOf(e,r)}function dl(t,e){return t.charCodeAt(e)|0}function Rl(t,e,r){return t.slice(e,r)}function Fi(t){return t.length}function pG(t){return t.length}function yd(t,e){return e.push(t),t}var jp=1,Pl=1,DM=0,Qn=0,or=0,Gl="";function r1(t,e,r,n,i,o,a,l){return{value:t,root:e,parent:r,type:n,props:i,children:o,line:jp,column:Pl,length:a,return:"",siblings:l}}function gG(){return or}function mG(){return or=Qn>0?dl(Gl,--Qn):0,Pl--,or===10&&(Pl=1,jp--),or}function bi(){return or=Qn<DM?dl(Gl,Qn++):0,Pl++,or===10&&(Pl=1,jp++),or}function is(){return dl(Gl,Qn)}function Dd(){return Qn}function zp(t,e){return Rl(Gl,t,e)}function Tu(t){switch(t){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 yG(t){return jp=Pl=1,DM=Fi(Gl=t),Qn=0,[]}function vG(t){return Gl="",t}function py(t){return FM(zp(Qn-1,$0(t===91?t+2:t===40?t+1:t)))}function xG(t){for(;(or=is())&&or<33;)bi();return Tu(t)>2||Tu(or)>3?"":" "}function bG(t,e){for(;--e&&bi()&&!(or<48||or>102||or>57&&or<65||or>70&&or<97););return zp(t,Dd()+(e<6&&is()==32&&bi()==32))}function $0(t){for(;bi();)switch(or){case t:return Qn;case 34:case 39:t!==34&&t!==39&&$0(or);break;case 40:t===41&&$0(t);break;case 92:bi();break}return Qn}function wG(t,e){for(;bi()&&t+or!==57;)if(t+or===84&&is()===47)break;return"/*"+zp(e,Qn-1)+"*"+e1(t===47?t:bi())}function CG(t){for(;!Tu(is());)bi();return zp(t,Qn)}function SG(t){return vG(Id("",null,null,null,[""],t=yG(t),0,[0],t))}function Id(t,e,r,n,i,o,a,l,u){for(var h=0,d=0,f=a,g=0,m=0,v=0,x=1,w=1,S=1,k=0,E="",L=i,A=o,M=n,B=E;w;)switch(v=k,k=bi()){case 40:if(v!=108&&dl(B,f-1)==58){fG(B+=Fd(py(k),"&","&\f"),"&\f",OM(h?l[h-1]:0))!=-1&&(S=-1);break}case 34:case 39:case 91:B+=py(k);break;case 9:case 10:case 13:case 32:B+=xG(v);break;case 92:B+=bG(Dd()-1,7);continue;case 47:switch(is()){case 42:case 47:yd(kG(wG(bi(),Dd()),e,r,u),u),(Tu(v||1)==5||Tu(is()||1)==5)&&Fi(B)&&Rl(B,-1,void 0)!==" "&&(B+=" ");break;default:B+="/"}break;case 123*x:l[h++]=Fi(B)*S;case 125*x:case 59:case 0:switch(k){case 0:case 125:w=0;case 59+d:S==-1&&(B=Fd(B,/\f/g,"")),m>0&&(Fi(B)-f||x===0&&v===47)&&yd(m>32?sS(B+";",n,r,f-1,u):sS(Fd(B," ","")+";",n,r,f-2,u),u);break;case 59:B+=";";default:if(yd(M=oS(B,e,r,h,d,i,l,E,L=[],A=[],f,o),o),k===123)if(d===0)Id(B,e,M,M,L,o,f,l,A);else{switch(g){case 99:if(dl(B,3)===110)break;case 108:if(dl(B,2)===97)break;default:d=0;case 100:case 109:case 115:}d?Id(t,M,M,n&&yd(oS(t,M,M,0,0,i,l,E,i,L=[],f,A),A),i,A,f,l,n?L:A):Id(B,M,M,M,[""],A,0,l,A)}}h=d=m=0,x=S=1,E=B="",f=a;break;case 58:f=1+Fi(B),m=v;default:if(x<1){if(k==123)--x;else if(k==125&&x++==0&&mG()==125)continue}switch(B+=e1(k),k*x){case 38:S=d>0?1:(B+="\f",-1);break;case 44:l[h++]=(Fi(B)-1)*S,S=1;break;case 64:is()===45&&(B+=py(bi())),g=is(),d=f=Fi(E=B+=CG(Dd())),k++;break;case 45:v===45&&Fi(B)==2&&(x=0)}}return o}function oS(t,e,r,n,i,o,a,l,u,h,d,f){for(var g=i-1,m=i===0?o:[""],v=pG(m),x=0,w=0,S=0;x<n;++x)for(var k=0,E=Rl(t,g+1,g=OM(w=a[x])),L=t;k<v;++k)(L=FM(w>0?m[k]+" "+E:Fd(E,/&\f/g,m[k])))&&(u[S++]=L);return r1(t,e,r,i===0?BM:l,u,h,d,f)}function kG(t,e,r,n){return r1(t,e,r,PM,e1(gG()),Rl(t,2,-2),0,n)}function sS(t,e,r,n,i){return r1(t,e,r,NM,Rl(t,0,n),Rl(t,n+1,-1),n,i)}function L0(t,e){for(var r="",n=0;n<t.length;n++)r+=e(t[n],n,t,e)||"";return r}function _G(t,e,r,n){switch(t.type){case dG:if(t.children.length)break;case cG:case uG:case NM:return t.return=t.return||t.value;case PM:return"";case hG:return t.return=t.value+"{"+L0(t.children,n)+"}";case BM:if(!Fi(t.value=t.props.join(",")))return""}return Fi(r=L0(t.children,n))?t.return=t.value+"{"+r+"}":""}var TG=u$(Object.keys,Object),EG=Object.prototype,$G=EG.hasOwnProperty;function LG(t){if(!Mp(t))return TG(t);var e=[];for(var r in Object(t))$G.call(t,r)&&r!="constructor"&&e.push(r);return e}var M0=ma(Ki,"DataView"),A0=ma(Ki,"Promise"),R0=ma(Ki,"Set"),P0=ma(Ki,"WeakMap"),aS="[object Map]",MG="[object Object]",lS="[object Promise]",cS="[object Set]",uS="[object WeakMap]",hS="[object DataView]",AG=ga(M0),RG=ga(Su),PG=ga(A0),BG=ga(R0),NG=ga(P0),js=Vl;(M0&&js(new M0(new ArrayBuffer(1)))!=hS||Su&&js(new Su)!=aS||A0&&js(A0.resolve())!=lS||R0&&js(new R0)!=cS||P0&&js(new P0)!=uS)&&(js=function(t){var e=Vl(t),r=e==MG?t.constructor:void 0,n=r?ga(r):"";if(n)switch(n){case AG:return hS;case RG:return aS;case PG:return lS;case BG:return cS;case NG:return uS}return e});var OG="[object Map]",FG="[object Set]",DG=Object.prototype,IG=DG.hasOwnProperty;function dS(t){if(t==null)return!0;if(Ap(t)&&(kf(t)||typeof t=="string"||typeof t.splice=="function"||Px(t)||Bx(t)||Sf(t)))return!t.length;var e=js(t);if(e==OG||e==FG)return!t.size;if(Mp(t))return!LG(t).length;for(var r in t)if(IG.call(t,r))return!1;return!0}var IM="c4",jG=T(t=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(t),"detector"),zG=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./c4Diagram-YG6GDRKO-D3hSuEZw.js");return{diagram:e}},__vite__mapDeps([8,9]),import.meta.url);return{id:IM,diagram:t}},"loader"),WG={id:IM,detector:jG,loader:zG},HG=WG,jM="flowchart",qG=T((t,e)=>{var r,n;return((r=e==null?void 0:e.flowchart)==null?void 0:r.defaultRenderer)==="dagre-wrapper"||((n=e==null?void 0:e.flowchart)==null?void 0:n.defaultRenderer)==="elk"?!1:/^\s*graph/.test(t)},"detector"),VG=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./flowDiagram-NV44I4VS-BILsxh5n.js");return{diagram:e}},__vite__mapDeps([10,11,12,13,14]),import.meta.url);return{id:jM,diagram:t}},"loader"),UG={id:jM,detector:qG,loader:VG},YG=UG,zM="flowchart-v2",GG=T((t,e)=>{var r,n,i;return((r=e==null?void 0:e.flowchart)==null?void 0:r.defaultRenderer)==="dagre-d3"?!1:(((n=e==null?void 0:e.flowchart)==null?void 0:n.defaultRenderer)==="elk"&&(e.layout="elk"),/^\s*graph/.test(t)&&((i=e==null?void 0:e.flowchart)==null?void 0:i.defaultRenderer)==="dagre-wrapper"?!0:/^\s*flowchart/.test(t))},"detector"),XG=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./flowDiagram-NV44I4VS-BILsxh5n.js");return{diagram:e}},__vite__mapDeps([10,11,12,13,14]),import.meta.url);return{id:zM,diagram:t}},"loader"),KG={id:zM,detector:GG,loader:XG},QG=KG,WM="er",ZG=T(t=>/^\s*erDiagram/.test(t),"detector"),JG=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./erDiagram-Q2GNP2WA-CjfXI2mB.js");return{diagram:e}},__vite__mapDeps([15,12,13,14]),import.meta.url);return{id:WM,diagram:t}},"loader"),tX={id:WM,detector:ZG,loader:JG},eX=tX,HM="gitGraph",rX=T(t=>/^\s*gitGraph/.test(t),"detector"),nX=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./gitGraphDiagram-NY62KEGX-DLD08RXZ.js");return{diagram:e}},__vite__mapDeps([16,17,18,19,4,2]),import.meta.url);return{id:HM,diagram:t}},"loader"),iX={id:HM,detector:rX,loader:nX},oX=iX,qM="gantt",sX=T(t=>/^\s*gantt/.test(t),"detector"),aX=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./ganttDiagram-JELNMOA3-DpXhg3mE.js");return{diagram:e}},__vite__mapDeps([20,21,22,23]),import.meta.url);return{id:qM,diagram:t}},"loader"),lX={id:qM,detector:sX,loader:aX},cX=lX,VM="info",uX=T(t=>/^\s*info/.test(t),"detector"),hX=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./infoDiagram-WHAUD3N6-cIe5ZWKq.js");return{diagram:e}},__vite__mapDeps([24,19,4,2]),import.meta.url);return{id:VM,diagram:t}},"loader"),dX={id:VM,detector:uX,loader:hX},UM="pie",fX=T(t=>/^\s*pie/.test(t),"detector"),pX=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./pieDiagram-ADFJNKIX-BhUn73AD.js");return{diagram:e}},__vite__mapDeps([25,17,19,4,2,26,27,22]),import.meta.url);return{id:UM,diagram:t}},"loader"),gX={id:UM,detector:fX,loader:pX},YM="quadrantChart",mX=T(t=>/^\s*quadrantChart/.test(t),"detector"),yX=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./quadrantDiagram-AYHSOK5B-BZdz1yM3.js");return{diagram:e}},__vite__mapDeps([28,21,22,23]),import.meta.url);return{id:YM,diagram:t}},"loader"),vX={id:YM,detector:mX,loader:yX},xX=vX,GM="xychart",bX=T(t=>/^\s*xychart(-beta)?/.test(t),"detector"),wX=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./xychartDiagram-PRI3JC2R-Drs9GbkQ.js");return{diagram:e}},__vite__mapDeps([29,22,27,21,23]),import.meta.url);return{id:GM,diagram:t}},"loader"),CX={id:GM,detector:bX,loader:wX},SX=CX,XM="requirement",kX=T(t=>/^\s*requirement(Diagram)?/.test(t),"detector"),_X=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./requirementDiagram-UZGBJVZJ-Chqqws0m.js");return{diagram:e}},__vite__mapDeps([30,12,13]),import.meta.url);return{id:XM,diagram:t}},"loader"),TX={id:XM,detector:kX,loader:_X},EX=TX,KM="sequence",$X=T(t=>/^\s*sequenceDiagram/.test(t),"detector"),LX=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./sequenceDiagram-WL72ISMW-DJ6x9fIe.js");return{diagram:e}},__vite__mapDeps([31,9,18]),import.meta.url);return{id:KM,diagram:t}},"loader"),MX={id:KM,detector:$X,loader:LX},AX=MX,QM="class",RX=T((t,e)=>{var r;return((r=e==null?void 0:e.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*classDiagram/.test(t)},"detector"),PX=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./classDiagram-2ON5EDUG-BBbphcIu.js");return{diagram:e}},__vite__mapDeps([32,33,11,12,13]),import.meta.url);return{id:QM,diagram:t}},"loader"),BX={id:QM,detector:RX,loader:PX},NX=BX,ZM="classDiagram",OX=T((t,e)=>{var r;return/^\s*classDiagram/.test(t)&&((r=e==null?void 0:e.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(t)},"detector"),FX=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./classDiagram-v2-WZHVMYZB-BBbphcIu.js");return{diagram:e}},__vite__mapDeps([34,33,11,12,13]),import.meta.url);return{id:ZM,diagram:t}},"loader"),DX={id:ZM,detector:OX,loader:FX},IX=DX,JM="state",jX=T((t,e)=>{var r;return((r=e==null?void 0:e.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(t)},"detector"),zX=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./stateDiagram-FKZM4ZOC-CL_VVFZQ.js");return{diagram:e}},__vite__mapDeps([35,36,12,13,1,2,3,4]),import.meta.url);return{id:JM,diagram:t}},"loader"),WX={id:JM,detector:jX,loader:zX},HX=WX,tA="stateDiagram",qX=T((t,e)=>{var r;return!!(/^\s*stateDiagram-v2/.test(t)||/^\s*stateDiagram/.test(t)&&((r=e==null?void 0:e.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper")},"detector"),VX=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./stateDiagram-v2-4FDKWEC3-vE8UUrO0.js");return{diagram:e}},__vite__mapDeps([37,36,12,13]),import.meta.url);return{id:tA,diagram:t}},"loader"),UX={id:tA,detector:qX,loader:VX},YX=UX,eA="journey",GX=T(t=>/^\s*journey/.test(t),"detector"),XX=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./journeyDiagram-XKPGCS4Q-CtJlkDMd.js");return{diagram:e}},__vite__mapDeps([38,9,11,26]),import.meta.url);return{id:eA,diagram:t}},"loader"),KX={id:eA,detector:GX,loader:XX},QX=KX,ZX=T((t,e,r)=>{at.debug(`rendering svg for syntax error
328
+ `);const n=R7(e),i=n.append("g");n.attr("viewBox","0 0 2412 512"),$T(n,100,512,!0),i.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),i.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),i.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),i.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),i.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),i.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),i.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),i.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${r}`)},"draw"),rA={draw:ZX},JX=rA,tK={db:{},renderer:rA,parser:{parse:T(()=>{},"parse")}},eK=tK,nA="flowchart-elk",rK=T((t,e={})=>{var r;return/^\s*flowchart-elk/.test(t)||/^\s*(flowchart|graph)/.test(t)&&((r=e==null?void 0:e.flowchart)==null?void 0:r.defaultRenderer)==="elk"?(e.layout="elk",!0):!1},"detector"),nK=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./flowDiagram-NV44I4VS-BILsxh5n.js");return{diagram:e}},__vite__mapDeps([10,11,12,13,14]),import.meta.url);return{id:nA,diagram:t}},"loader"),iK={id:nA,detector:rK,loader:nK},oK=iK,iA="timeline",sK=T(t=>/^\s*timeline/.test(t),"detector"),aK=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./timeline-definition-IT6M3QCI-CTGuWGC8.js");return{diagram:e}},__vite__mapDeps([39,26]),import.meta.url);return{id:iA,diagram:t}},"loader"),lK={id:iA,detector:sK,loader:aK},cK=lK,oA="mindmap",uK=T(t=>/^\s*mindmap/.test(t),"detector"),hK=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./mindmap-definition-VGOIOE7T-9WKTvEh6.js");return{diagram:e}},__vite__mapDeps([40,12,13]),import.meta.url);return{id:oA,diagram:t}},"loader"),dK={id:oA,detector:uK,loader:hK},fK=dK,sA="kanban",pK=T(t=>/^\s*kanban/.test(t),"detector"),gK=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./kanban-definition-3W4ZIXB7-D5OeXcHJ.js");return{diagram:e}},__vite__mapDeps([41,11]),import.meta.url);return{id:sA,diagram:t}},"loader"),mK={id:sA,detector:pK,loader:gK},yK=mK,aA="sankey",vK=T(t=>/^\s*sankey(-beta)?/.test(t),"detector"),xK=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./sankeyDiagram-TZEHDZUN-BOp8vVQ0.js");return{diagram:e}},__vite__mapDeps([42,27,22]),import.meta.url);return{id:aA,diagram:t}},"loader"),bK={id:aA,detector:vK,loader:xK},wK=bK,lA="packet",CK=T(t=>/^\s*packet(-beta)?/.test(t),"detector"),SK=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./diagram-S2PKOQOG-BLljdZCM.js");return{diagram:e}},__vite__mapDeps([43,17,19,4,2]),import.meta.url);return{id:lA,diagram:t}},"loader"),kK={id:lA,detector:CK,loader:SK},cA="radar",_K=T(t=>/^\s*radar-beta/.test(t),"detector"),TK=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./diagram-QEK2KX5R-Bgl10GwF.js");return{diagram:e}},__vite__mapDeps([44,17,19,4,2]),import.meta.url);return{id:cA,diagram:t}},"loader"),EK={id:cA,detector:_K,loader:TK},uA="block",$K=T(t=>/^\s*block(-beta)?/.test(t),"detector"),LK=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./blockDiagram-VD42YOAC-BAsWaVVt.js");return{diagram:e}},__vite__mapDeps([45,11,5,1,2,14]),import.meta.url);return{id:uA,diagram:t}},"loader"),MK={id:uA,detector:$K,loader:LK},AK=MK,hA="architecture",RK=T(t=>/^\s*architecture/.test(t),"detector"),PK=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./architectureDiagram-VXUJARFQ-CnkGS2CW.js");return{diagram:e}},__vite__mapDeps([46,17,19,4,2,7]),import.meta.url);return{id:hA,diagram:t}},"loader"),BK={id:hA,detector:RK,loader:PK},NK=BK,dA="treemap",OK=T(t=>/^\s*treemap/.test(t),"detector"),FK=T(async()=>{const{diagram:t}=await ve(async()=>{const{diagram:e}=await import("./diagram-PSM6KHXK-C-EWuuX_.js");return{diagram:e}},__vite__mapDeps([47,13,17,19,4,2,23,27,22]),import.meta.url);return{id:dA,diagram:t}},"loader"),DK={id:dA,detector:OK,loader:FK},fS=!1,Wp=T(()=>{fS||(fS=!0,nf("error",eK,t=>t.toLowerCase().trim()==="error"),nf("---",{db:{clear:T(()=>{},"clear")},styles:{},renderer:{draw:T(()=>{},"draw")},parser:{parse:T(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:T(()=>null,"init")},t=>t.toLowerCase().trimStart().startsWith("---")),jy(oK,fK,NK),jy(HG,yK,IX,NX,eX,cX,dX,gX,EX,AX,QG,YG,cK,oX,YX,HX,QX,xX,wK,kK,SX,AK,EK,DK))},"addDiagrams"),IK=T(async()=>{at.debug("Loading registered diagrams");const e=(await Promise.allSettled(Object.entries(na).map(async([r,{detector:n,loader:i}])=>{if(i)try{qy(r)}catch{try{const{diagram:o,id:a}=await i();nf(a,o,n)}catch(o){throw at.error(`Failed to load external diagram with key ${r}. Removing from detectors.`),delete na[r],o}}}))).filter(r=>r.status==="rejected");if(e.length>0){at.error(`Failed to load ${e.length} external diagrams`);for(const r of e)at.error(r);throw new Error(`Failed to load ${e.length} external diagrams`)}},"loadRegisteredDiagrams"),jK="graphics-document document";function fA(t,e){t.attr("role",jK),e!==""&&t.attr("aria-roledescription",e)}T(fA,"setA11yDiagramInfo");function pA(t,e,r,n){if(t.insert!==void 0){if(r){const i=`chart-desc-${n}`;t.attr("aria-describedby",i),t.insert("desc",":first-child").attr("id",i).text(r)}if(e){const i=`chart-title-${n}`;t.attr("aria-labelledby",i),t.insert("title",":first-child").attr("id",i).text(e)}}}T(pA,"addSVGa11yTitleDescription");var ta,B0=(ta=class{constructor(e,r,n,i,o){this.type=e,this.text=r,this.db=n,this.parser=i,this.renderer=o}static async fromText(e,r={}){var h,d;const n=Wr(),i=ix(e,n);e=DV(e)+`
329
329
  `;try{qy(i)}catch{const f=lj(i);if(!f)throw new mT(`Diagram ${i} not found.`);const{id:g,diagram:m}=await f();nf(g,m)}const{db:o,parser:a,renderer:l,init:u}=qy(i);return a.parser&&(a.parser.yy=o),(h=o.clear)==null||h.call(o),u==null||u(n),r.title&&((d=o.setDiagramTitle)==null||d.call(o,r.title)),await a.parse(e),new ta(i,e,o,a,l)}async render(e,r){await this.renderer.draw(this.text,e,r,this)}getParser(){return this.parser}getType(){return this.type}},T(ta,"Diagram"),ta),pS=[],zK=T(()=>{pS.forEach(t=>{t()}),pS=[]},"attachFunctions"),WK=T(t=>t.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function gA(t){const e=t.match(gT);if(!e)return{text:t,metadata:{}};let r=IW(e[1],{schema:DW})??{};r=typeof r=="object"&&!Array.isArray(r)?r:{};const n={};return r.displayMode&&(n.displayMode=r.displayMode.toString()),r.title&&(n.title=r.title.toString()),r.config&&(n.config=r.config),{text:t.slice(e[0].length),metadata:n}}T(gA,"extractFrontMatter");var HK=T(t=>t.replace(/\r\n?/g,`
330
330
  `).replace(/<(\w+)([^>]*)>/g,(e,r,n)=>"<"+r+n.replace(/="([^"]*)"/g,"='$1'")+">"),"cleanupText"),qK=T(t=>{const{text:e,metadata:r}=gA(t),{displayMode:n,title:i,config:o={}}=r;return n&&(o.gantt||(o.gantt={}),o.gantt.displayMode=n),{title:i,config:o,text:e}},"processFrontmatter"),VK=T(t=>{const e=gi.detectInit(t)??{},r=gi.detectDirective(t,"wrap");return Array.isArray(r)?e.wrap=r.some(({type:n})=>n==="wrap"):(r==null?void 0:r.type)==="wrap"&&(e.wrap=!0),{text:_V(t),directive:e}},"processDirectives");function n1(t){const e=HK(t),r=qK(e),n=VK(r.text),i=jx(r.config,n.directive);return t=WK(n.text),{code:t,title:r.title,config:i}}T(n1,"preprocessDiagram");function mA(t){const e=new TextEncoder().encode(t),r=Array.from(e,n=>String.fromCodePoint(n)).join("");return btoa(r)}T(mA,"toBase64");var UK=5e4,YK="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",GK="sandbox",XK="loose",KK="http://www.w3.org/2000/svg",QK="http://www.w3.org/1999/xlink",ZK="http://www.w3.org/1999/xhtml",JK="100%",tQ="100%",eQ="border:0;margin:0;",rQ="margin:0",nQ="allow-top-navigation-by-user-activation allow-popups",iQ='The "iframe" tag is not supported by your browser.',oQ=["foreignobject"],sQ=["dominant-baseline"];function i1(t){const e=n1(t);return ef(),kj(e.config??{}),e}T(i1,"processAndSetConfigs");async function yA(t,e){Wp();try{const{code:r,config:n}=i1(t);return{diagramType:(await xA(r)).type,config:n}}catch(r){if(e!=null&&e.suppressErrors)return!1;throw r}}T(yA,"parse");var gS=T((t,e,r=[])=>`
331
331
  .${t} ${e} { ${r.join(" !important; ")} !important; }`,"cssImportantStyles"),aQ=T((t,e=new Map)=>{var n;let r="";if(t.themeCSS!==void 0&&(r+=`
@@ -516,7 +516,7 @@ ${t.themeCSS}`),t.fontFamily!==void 0&&(r+=`
516
516
  * This source code is licensed under the MIT license.
517
517
  * See the LICENSE file in the root directory of this source tree.
518
518
  */const yZ=[["path",{d:"M8.243 7.34l-6.38 .925l-.113 .023a1 1 0 0 0 -.44 1.684l4.622 4.499l-1.09 6.355l-.013 .11a1 1 0 0 0 1.464 .944l5.706 -3l5.693 3l.1 .046a1 1 0 0 0 1.352 -1.1l-1.091 -6.355l4.624 -4.5l.078 -.085a1 1 0 0 0 -.633 -1.62l-6.38 -.926l-2.852 -5.78a1 1 0 0 0 -1.794 0l-2.853 5.78z",key:"svg-0"}]],vZ=ue("filled","star-filled","StarFilled",yZ);function xZ(t,e=[]){const[r,n]=$.useState(""),[i,o]=$.useState({}),[a,l]=$.useState({}),u=(d,f,g)=>{const m=String(d).toLowerCase(),v=String(g).toLowerCase(),x=Number(d),w=Number(g);switch(f){case"=":return m===v;case"!=":return m!==v;case"contains":return m.includes(v);case"not_contains":return!m.includes(v);case">":return!isNaN(x)&&!isNaN(w)&&x>w;case"<":return!isNaN(x)&&!isNaN(w)&&x<w;case">=":return!isNaN(x)&&!isNaN(w)&&x>=w;case"<=":return!isNaN(x)&&!isNaN(w)&&x<=w;default:return m.includes(v)}};return{filteredItems:$.useMemo(()=>t?t.filter(d=>{if(r.trim()){const v=r.toLowerCase();if(!(e.length>0?e:Object.keys(d)).some(S=>{const k=d[S];return k&&String(k).toLowerCase().includes(v)}))return!1}const f=Object.keys(i);if(f.length===0)return!0;const g={};for(const v of f){const w=i[v].split(",").map(k=>k.trim());let S=!1;for(const k of w){let E="=",L=k;const A=k.match(/^([=!><]+|contains|not_contains)\s*(.*)$/);A&&(E=A[1],L=A[2]);const M=d[v];if(M!==void 0&&u(M,E,L)){S=!0;break}}g[v]=S}let m=g[f[0]];for(let v=1;v<f.length;v++)(a[f[v-1]]||"AND")==="OR"?m=m||g[f[v]]:m=m&&g[f[v]];return m}):[],[t,r,i,a,e]),data:{query:r,activeFilters:i,logicalOperators:a},setData:{setQuery:n,setActiveFilters:o,setLogicalOperators:l}}}function bZ({data:{query:t,activeFilters:e,logicalOperators:r},setData:{setQuery:n,setActiveFilters:i,setLogicalOperators:o},filterOptions:a={}}){const[l,u]=$.useState(!1),[h,d]=$.useState(null),[f,g]=$.useState(null),[m,v]=$.useState(null),x=OS(()=>{u(!1),d(null),g(null),v(null)}),w=["=","!=",">","<",">=","<=","contains","not_contains"],S=()=>h==="key"?Object.keys(a):h==="operator"?w:h==="value"&&f?Array.isArray(a[f])&&a[f].length>0?a[f]:[]:[],k=B=>{if(h==="key")g(B),d("operator");else if(h==="operator")v(B),d("value");else if(h==="value"&&f&&m){const D=`${m} ${B}`;i(q=>{const U=q[f],H=U?`${U},${D}`:D;return{...q,[f]:H}}),E()}},E=()=>{u(!1),d(null),g(null),v(null)},L=B=>{i(D=>{const q={...D};return delete q[B],q})},A=()=>{i({}),n("")},M=Object.keys(e).length>0;return b.jsxs(Je,{gap:"xs",children:[b.jsxs("div",{style:{position:"relative"},ref:x,children:[b.jsx(Bn,{placeholder:"Search or filter...",leftSection:b.jsx(jd,{size:14}),rightSection:t.trim()||M?b.jsx(Dn,{size:"xs",color:"gray",radius:"sm",variant:"subtle",onClick:A,children:b.jsx(zd,{size:12})}):null,size:"sm",radius:"md",value:t,onChange:B=>n(B.currentTarget.value),onFocus:()=>{l||(d("key"),u(!0))},styles:{input:{border:"1px solid #E5E5E5","&:focus":{borderColor:"#9CA3AF"}}}}),l&&h&&b.jsx(Ir,{shadow:"sm",p:"sm",radius:"md",withBorder:!0,style:{position:"absolute",top:"100%",left:0,right:0,zIndex:1e3,marginTop:4},children:b.jsxs(Je,{gap:8,children:[b.jsxs(jt,{size:"xs",fw:600,c:"dimmed",tt:"uppercase",children:[h==="key"&&"Filter by column",h==="operator"&&`Operator for ${f}`,h==="value"&&`Value for ${f} ${m}`]}),b.jsxs(Zt,{gap:6,wrap:"wrap",children:[S().map((B,D)=>b.jsx(ip,{onClick:()=>k(B),variant:"light",checked:!1,size:"xs",radius:"md",styles:{label:{cursor:"pointer"}},children:B},D)),h==="value"&&b.jsx(Bn,{placeholder:"Type value...",size:"xs",radius:"md",autoFocus:!0,style:{flex:1,minWidth:120},onKeyDown:B=>{B.key==="Enter"&&(B.preventDefault(),B.stopPropagation(),k(B.currentTarget.value))}})]})]})})]}),M&&b.jsxs(Zt,{gap:6,wrap:"wrap",align:"center",children:[Object.entries(e).map(([B,D],q,U)=>{const H=D.split(",").map(V=>V.trim()),K=q===U.length-1;return b.jsxs(Zt,{gap:4,align:"center",children:[b.jsx(Zt,{gap:2,children:H.map((V,W)=>b.jsxs(as,{size:"md",radius:"md",variant:"outline",color:"gray",pr:4,rightSection:b.jsx(zd,{size:12,style:{cursor:"pointer"},onClick:()=>{const I=H.filter((O,F)=>F!==W);I.length===0?L(B):i(O=>({...O,[B]:I.join(",")}))}}),styles:{root:{textTransform:"none",fontWeight:500}},children:[b.jsx(jt,{span:!0,c:"dimmed",size:"xs",children:B})," ",V]},`${B}-${W}`))}),!K&&b.jsx(_e,{size:"xs",variant:"subtle",color:"gray",onClick:()=>{o(V=>({...V,[B]:V[B]==="OR"?"AND":"OR"}))},title:"Toggle AND/OR",fw:700,px:4,h:"auto",py:2,c:"dimmed",styles:{label:{fontSize:"10px"}},children:r[B]||"AND"})]},B)}),b.jsx(Dn,{size:"sm",variant:"subtle",color:"red",onClick:A,title:"Clear all",children:b.jsx(zd,{size:14})})]})]})}function yy({data:t=[],columns:e,filename:r="export",size:n="xs",variant:i="default",compact:o=!1}){const a=()=>e!=null&&e.length?e.map(f=>typeof f=="string"?f:f.name):t.length>0?Object.keys(t[0]):[],l=()=>{if(t.length===0)return;const f=a(),g=[f.join(","),...t.map(m=>f.map(v=>`"${String(m[v]??"").replace(/"/g,'""')}"`).join(","))].join(`
519
- `);h(`${r}.csv`,g,"text/csv")},u=()=>{if(t.length===0)return;const f=JSON.stringify(t,null,2);h(`${r}.json`,f,"application/json")},h=(f,g,m)=>{const v=new Blob([g],{type:m}),x=URL.createObjectURL(v),w=document.createElement("a");w.href=x,w.download=f,w.click(),URL.revokeObjectURL(x)},d=o?"compact-xs":n;return b.jsxs(je,{shadow:"md",width:160,children:[b.jsx(je.Target,{children:b.jsx(_e,{size:d,variant:i,color:"dark",leftSection:b.jsx(NQ,{size:14}),disabled:t.length===0,children:"Export"})}),b.jsxs(je.Dropdown,{children:[b.jsx(je.Label,{children:"Export as"}),b.jsx(je.Item,{leftSection:b.jsx(FQ,{size:16}),onClick:l,children:"CSV"}),b.jsx(je.Item,{leftSection:b.jsx(zQ,{size:16}),onClick:u,children:"JSON"})]})]})}function wZ({onConfirm:t,holdDuration:e=3e3,icon:r=$A,color:n="red",size:i="md",tooltip:o="Segure para confirmar",confirmingTooltip:a="Segurando...",...l}){const[u,h]=$.useState(0),[d,f]=$.useState(!1),g=$.useRef(null),m=$.useRef(null),v=$.useCallback(()=>{l.disabled||l.loading||(f(!0),m.current=Date.now(),g.current=setInterval(()=>{const w=Date.now()-m.current,S=Math.min(w/e*100,100);h(S),S>=100&&(clearInterval(g.current),f(!1),h(0),t==null||t())},50))},[e,t,l.disabled,l.loading]),x=$.useCallback(()=>{g.current&&(clearInterval(g.current),g.current=null),f(!1),h(0)},[]);return $.useEffect(()=>()=>{g.current&&clearInterval(g.current)},[]),b.jsx(Co,{label:d?a:o,withArrow:!0,children:b.jsxs(st,{style:{position:"relative",display:"inline-flex",verticalAlign:"middle"},children:[d&&b.jsx(Qv,{size:i==="sm"?28:i==="md"?34:42,thickness:2,sections:[{value:u,color:n}],style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",pointerEvents:"none"}}),b.jsx(Dn,{variant:"subtle",color:n,size:i,onMouseDown:v,onMouseUp:x,onMouseLeave:x,onTouchStart:v,onTouchEnd:x,style:{opacity:d?.7:1,transition:"opacity 0.2s",...l.style},...l,children:l.loading?b.jsx(Pn,{size:12,color:n}):b.jsx(r,{size:i==="sm"?14:i==="md"?18:22})})]})})}function CZ({onDelete:t,timerSeconds:e=3,children:r,loading:n,disabled:i,variant:o="light",color:a="red",leftSection:l=b.jsx($A,{size:14}),...u}){const[h,d]=$.useState(!1),[f,g]=$.useState(e),m=$.useRef(null),v=$.useRef(null),x=()=>{n||i||(d(!0),g(e),m.current=setTimeout(()=>{S()},e*1e3),v.current=setInterval(()=>{g(k=>{const E=k-1;return E<=0?(clearInterval(v.current),0):E})},1e3))},w=()=>{d(!1),g(e),m.current&&clearTimeout(m.current),v.current&&clearInterval(v.current)},S=async()=>{w(),t&&await t()};return $.useEffect(()=>()=>w(),[]),b.jsx(Co,{label:"Mantenha pressionado até a contagem terminar para confirmar a exclusão",withArrow:!0,multiline:!0,w:220,children:b.jsx(_e,{variant:o,color:h?"orange":a,leftSection:l,onMouseDown:x,onMouseUp:w,onMouseLeave:w,onTouchStart:x,onTouchEnd:w,disabled:n||i,style:{transition:"all 0.2s ease",transform:h?"scale(0.98)":"scale(1)",...u.style},...u,children:h?`Excluindo em ${f}s...`:r||"Segure para Excluir"})})}function LA({onDelete:t,timerSeconds:e=3,type:r="button",...n}){return r==="icon"?b.jsx(wZ,{onConfirm:t,holdDuration:e*1e3,...n}):b.jsx(CZ,{onDelete:t,timerSeconds:e,...n})}function SZ({onConfigured:t}){const[e,r]=$.useState("admin"),[n,i]=$.useState(""),[o,a]=$.useState(!1),l=async u=>{if(u.preventDefault(),!n){Jt.show({title:"Error",message:"Password is required",color:"red"});return}a(!0);try{const d=await(await fetch("/sqlite/api/setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,password:n})})).json();d.success?(Jt.show({title:"Welcome!",message:"System configured successfully",color:"green"}),t()):Jt.show({title:"Error",message:d.error,color:"red"})}catch{Jt.show({title:"Error",message:"Failed to connect to server",color:"red"})}a(!1)};return b.jsx(st,{style:{height:"100vh",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"#FBFAF8"},children:b.jsxs(op,{size:420,children:[b.jsxs(Je,{align:"center",mb:"xl",children:[b.jsx(mo,{size:60,radius:"md",color:"dark",children:b.jsx(Of,{size:34})}),b.jsx(go,{order:1,fw:700,children:"Welcome to SQLite"}),b.jsx(jt,{c:"dimmed",size:"sm",ta:"center",children:"Set up your administrator credentials to start managing your database."})]}),b.jsx(Ir,{withBorder:!0,shadow:"md",p:30,radius:"md",children:b.jsx("form",{onSubmit:l,children:b.jsxs(Je,{children:[b.jsx(Bn,{label:"Administrator Username",placeholder:"admin",required:!0,value:e,onChange:u=>r(u.target.value)}),b.jsx(fp,{label:"Password",placeholder:"Choose a strong password",required:!0,value:n,onChange:u=>i(u.target.value)}),b.jsx(Zt,{mt:"lg",justify:"flex-end",children:b.jsx(_e,{type:"submit",color:"dark",fullWidth:!0,loading:o,leftSection:b.jsx(aZ,{size:18}),children:"Save and Start"})})]})})}),b.jsx(jt,{c:"dimmed",size:"xs",ta:"center",mt:"xl",children:"This configuration will be saved in sqlite-admin-config.json"})]})})}function kZ({onLogin:t}){const[e,r]=$.useState(""),[n,i]=$.useState(""),[o,a]=$.useState(""),[l,u]=$.useState(!1),[h,d]=$.useState(!1),f=async g=>{g.preventDefault(),d(!0);try{const v=await(await fetch("/sqlite/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,password:n,totpCode:o})})).json();v.success?t():v.code==="2FA_REQUIRED"?(u(!0),Jt.show({title:"Authentication Required",message:"Please enter your 2FA code",color:"blue",icon:b.jsx(O0,{size:16})})):Jt.show({title:"Login Failed",message:v.error||"Invalid credentials",color:"red"})}catch{Jt.show({title:"Error",message:"Failed to connect to server",color:"red"})}d(!1)};return b.jsx(st,{style:{height:"100vh",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"#FBFAF8"},children:b.jsxs(op,{size:420,children:[b.jsxs(Je,{align:"center",mb:"xl",children:[b.jsx(mo,{size:60,radius:"md",color:"dark",children:b.jsx(Of,{size:34})}),b.jsx(go,{order:1,fw:700,children:"SQLite Login"})]}),b.jsx(Ir,{withBorder:!0,shadow:"md",p:30,radius:"md",children:b.jsx("form",{onSubmit:f,children:b.jsxs(Je,{children:[b.jsx(Bn,{label:"Username",placeholder:"Your username",required:!0,value:e,onChange:g=>r(g.target.value),disabled:l}),b.jsx(fp,{label:"Password",placeholder:"Your password",required:!0,value:n,onChange:g=>i(g.target.value),disabled:l}),l&&b.jsx(Bn,{label:"Authenticator Code (2FA)",placeholder:"000 000",required:!0,autoFocus:!0,value:o,onChange:g=>a(g.target.value),leftSection:b.jsx(O0,{size:16}),maxLength:6}),b.jsx(Zt,{mt:"lg",children:b.jsx(_e,{type:"submit",color:"dark",fullWidth:!0,loading:h,leftSection:b.jsx(UQ,{size:18}),children:l?"Verify & Login":"Login"})}),l&&b.jsx(jt,{size:"xs",c:"dimmed",ta:"center",style:{cursor:"pointer"},onClick:()=>{u(!1),a("")},children:"Cancel"})]})})})]})})}function _Z({opened:t,onClose:e}){const[r,n]=$.useState(null),[i,o]=$.useState(!0),[a,l]=$.useState(0),[u,h]=$.useState(null),[d,f]=$.useState(""),[g,m]=$.useState(!1);$.useEffect(()=>{t&&v()},[t]);const v=async()=>{o(!0);try{const E=await(await fetch("/sqlite/auth/status")).json();n(E)}catch{Jt.show({title:"Error",message:"Failed to load status",color:"red"})}o(!1)},x=async()=>{l(1);try{const E=await(await fetch("/sqlite/api/totp/generate",{method:"POST"})).json();E.success?(h(E),l(2)):(Jt.show({title:"Error",message:"Failed to generate QR",color:"red"}),l(0))}catch{l(0)}},w=async()=>{if(d){m(!0);try{(await(await fetch("/sqlite/api/totp/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({secret:u.secret,code:d})})).json()).success?(Jt.show({title:"Success",message:"2FA Enabled!",color:"green"}),l(0),v()):Jt.show({title:"Error",message:"Invalid code",color:"red"})}catch{Jt.show({title:"Error",message:"Request failed",color:"red"})}m(!1)}},S=async()=>{const k=prompt("Enter your 2FA code to confirm disabling:");if(k)try{const L=await(await fetch("/sqlite/api/totp/disable",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:k})})).json();L.success?(Jt.show({title:"Success",message:"2FA Disabled",color:"gray"}),v()):Jt.show({title:"Error",message:L.error||"Failed to disable",color:"red"})}catch{Jt.show({title:"Error",message:"Request failed",color:"red"})}};return b.jsx(Mr,{opened:t,onClose:e,title:"Security Settings",size:"lg",children:i?b.jsx(Je,{align:"center",py:"xl",children:b.jsx(Pn,{})}):b.jsxs(Je,{children:[b.jsxs(Zt,{justify:"space-between",align:"flex-start",children:[b.jsxs(Zt,{children:[b.jsx(mo,{size:"xl",radius:"md",color:r!=null&&r.totpEnabled?"green":"gray",variant:"light",children:b.jsx(O0,{size:28})}),b.jsxs("div",{children:[b.jsx(jt,{fw:600,children:"Two-Factor Authentication (2FA)"}),b.jsx(jt,{size:"sm",c:"dimmed",children:r!=null&&r.totpEnabled?"Your account is secured with 2FA.":"Add an extra layer of security to your account."})]})]}),r!=null&&r.totpEnabled?b.jsx(_e,{color:"red",variant:"subtle",onClick:S,children:"Disable"}):a===0&&b.jsx(_e,{color:"dark",onClick:x,children:"Enable 2FA"})]}),a===2&&u&&b.jsx(Ir,{withBorder:!0,p:"md",radius:"md",bg:"gray.0",children:b.jsxs(Je,{align:"center",children:[b.jsx(jt,{fw:600,children:"1. Scan QR Code"}),b.jsx(jt,{size:"sm",c:"dimmed",ta:"center",children:"Use your authenticator app (Google Authenticator, Authy, etc.) to scan this code."}),b.jsx("div",{style:{background:"white",padding:"10px",borderRadius:"8px"},children:b.jsx(jv,{src:u.qrCode,w:180,h:180})}),b.jsxs(Zt,{gap:"xs",children:[b.jsxs(jt,{size:"xs",c:"dimmed",children:["Secret: ",u.secret]}),b.jsx(A_,{value:u.secret,children:({copied:k,copy:E})=>b.jsx(Dn,{variant:"subtle",color:k?"green":"gray",onClick:E,size:"xs",children:k?b.jsx(TA,{size:12}):b.jsx(AQ,{size:12})})})]}),b.jsx(jt,{fw:600,mt:"md",children:"2. Verify Code"}),b.jsxs(Zt,{align:"flex-start",children:[b.jsx(Bn,{placeholder:"000 000",value:d,onChange:k=>f(k.target.value),maxLength:6,w:140}),b.jsx(_e,{onClick:w,loading:g,color:"dark",children:"Verify"})]}),b.jsx(_e,{variant:"subtle",size:"xs",color:"gray",onClick:()=>l(0),children:"Cancel"})]})})]})})}const TZ=({tables:t,favorites:e,currentTable:r,onSelectTable:n})=>b.jsx(Si,{style:{flex:1},children:b.jsxs(Je,{gap:0,children:[b.jsx(jt,{size:"xs",fw:500,c:"#91918E",px:"xs",mb:4,mt:"xs",style:{textTransform:"uppercase",fontSize:"11px",letterSpacing:"0.03em"},children:"Favorites"}),e.map(i=>b.jsx(Di,{label:i,leftSection:b.jsx(ol,{size:16}),active:r===i,onClick:()=>n(i),style:{borderRadius:6}},i)),e.length===0&&b.jsx(jt,{size:"xs",c:"dimmed",px:"sm",py:2,fs:"italic",children:"No favorites"}),b.jsx(jt,{size:"xs",fw:500,c:"#91918E",px:"xs",mb:4,mt:"lg",style:{textTransform:"uppercase",fontSize:"11px",letterSpacing:"0.03em"},children:"Tables"}),t.filter(i=>!e.includes(i.name)).map(i=>b.jsx(Di,{label:i.name,leftSection:b.jsx(ol,{size:16}),active:r===i.name,onClick:()=>n(i.name),style:{borderRadius:6}},i.name))]})}),EZ=({table:t,id:e,label:r,API:n})=>{const[i,o]=$.useState(null),[a,l]=$.useState(!1),[u,h]=$.useState(!1),d=async()=>{if(!u){l(!0);try{const g=await(await fetch(`${n}/query`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sql:`SELECT * FROM ${t} WHERE rowid = ${e} LIMIT 1`})})).json();g.success&&g.rows&&g.rows.length>0&&o(g.rows[0])}catch(f){console.error(f)}l(!1),h(!0)}};return b.jsxs(Qs,{width:280,shadow:"md",openDelay:300,onOpen:d,children:[b.jsx(Qs.Target,{children:b.jsxs(Zt,{gap:6,wrap:"nowrap",style:{cursor:"pointer"},children:[b.jsx(as,{variant:"outline",color:"gray",size:"sm",leftSection:b.jsx(F0,{size:10}),styles:{label:{fontWeight:500}},children:e}),r&&b.jsx(jt,{size:"xs",c:"dimmed",lineClamp:1,children:r})]})}),b.jsx(Qs.Dropdown,{children:a?b.jsx(cl,{p:"sm",children:b.jsx(Pn,{size:"xs",type:"dots"})}):i?b.jsxs(Je,{gap:"xs",children:[b.jsxs(Zt,{justify:"space-between",children:[b.jsx(jt,{size:"xs",fw:700,c:"dimmed",tt:"uppercase",children:t}),b.jsxs(as,{size:"xs",variant:"light",children:["ID: ",e]})]}),b.jsx(jt,{size:"sm",fw:600,lineClamp:2,children:r||"Record"}),b.jsx(Hs,{}),b.jsx(Je,{gap:4,children:Object.entries(i).filter(([f])=>f!=="id"&&!f.toLowerCase().includes("id")).slice(0,3).map(([f,g])=>b.jsxs(Zt,{justify:"space-between",align:"flex-start",wrap:"nowrap",children:[b.jsxs(jt,{size:"xs",c:"dimmed",style:{minWidth:60},children:[f,":"]}),b.jsx(jt,{size:"xs",lineClamp:1,style:{textAlign:"right"},children:String(g)})]},f))})]}):b.jsx(jt,{size:"xs",c:"dimmed",children:"No preview available"})})]})},$Z=({row:t,col:e,pk:r,isEditing:n,onStartEdit:i,onUpdate:o,onCancelEdit:a,fkMap:l,API:u,currentTable:h,getTagColor:d,isTagColumn:f})=>{const g=t[e.name],m=t[r],v=e.pk===1,x=!!e.fk,[w,S]=$.useState([]),[k,E]=$.useState(!1);return $.useEffect(()=>{n&&x&&(E(!0),fetch(`${u}/table/${h}/fk-options?refTable=${e.fk.table}&refColumn=${e.fk.column}`).then(L=>L.json()).then(L=>{L.success&&S(L.options.map(A=>({value:String(A.value),label:`${A.label} (ID: ${A.value})`}))),E(!1)}).catch(()=>E(!1)))},[n,x,u,h,e.fk]),n?x?b.jsx(Zs,{size:"xs",autoFocus:!0,searchable:!0,data:w,defaultValue:g===null?null:String(g),placeholder:k?"Loading...":`Select ${e.fk.table}`,onChange:L=>{o(m,e.name,L)},onBlur:a,styles:{input:{minHeight:"28px",height:"28px"}},onKeyDownCapture:L=>{L.key==="Escape"&&(L.preventDefault(),L.stopPropagation(),a())}}):b.jsx(Bn,{size:"xs",autoFocus:!0,defaultValue:g===null?"":String(g),onBlur:L=>o(m,e.name,L.target.value),onKeyDown:L=>{L.key==="Enter"?o(m,e.name,L.target.value):L.key==="Escape"&&a()},styles:{input:{minHeight:"28px",height:"28px",padding:"0 8px"}}}):g===null?b.jsx(jt,{c:"dimmed",fs:"italic",size:"sm",onClick:()=>!v&&i(m,e.name),style:{cursor:v?"default":"text"},children:"null"}):x?b.jsx("div",{onClick:L=>{L.stopPropagation(),i(m,e.name)},children:b.jsx(EZ,{table:e.fk.table,id:g,label:l[`${e.fk.table}:${g}`],API:u})}):f(e.name)?b.jsx(as,{color:d(g),variant:"light",onClick:()=>i(m,e.name),style:{cursor:"pointer"},children:g}):b.jsx(jt,{size:"sm",onClick:()=>!v&&i(m,e.name),style:{cursor:v?"default":"text",padding:"4px 0",borderRadius:"4px"},className:v?"":"editable-cell",children:String(g)})},LZ=({columns:t,rows:e,pk:r,selectedRows:n,onSelectRow:i,onSelectAll:o,onSort:a,sort:l,sortDir:u,getColumnIcon:h,onDeleteRecord:d,editingCell:f,onStartEdit:g,onUpdateCell:m,onCancelEdit:v,fkMap:x,API:w,currentTable:S,getTagColor:k,isTagColumn:E})=>b.jsx(Si,{children:b.jsxs(zt,{striped:!1,highlightOnHover:!0,withTableBorder:!1,verticalSpacing:"xs",children:[b.jsx(zt.Thead,{children:b.jsxs(zt.Tr,{children:[b.jsx(zt.Th,{w:40,style:{borderBottom:"1px solid #eee"},children:b.jsx(ra,{checked:n.size===e.length&&e.length>0,indeterminate:n.size>0&&n.size<e.length,onChange:L=>o(L.target.checked)})}),t.map(L=>b.jsx(zt.Th,{onClick:()=>a(L.name),style:{cursor:"pointer",borderBottom:"1px solid #eee"},children:b.jsxs(Zt,{gap:4,wrap:"nowrap",children:[h(L.type,L.name),b.jsx(jt,{size:"xs",fw:500,c:"dimmed",children:L.name}),l===L.name&&b.jsx(jt,{size:"xs",c:"dimmed",children:u==="ASC"?"↑":"↓"})]})},L.name)),b.jsx(zt.Th,{w:50,style:{borderBottom:"1px solid #eee"}})]})}),b.jsx(zt.Tbody,{children:e.map(L=>b.jsxs(zt.Tr,{bg:n.has(String(L[r]))?"gray.0":void 0,children:[b.jsx(zt.Td,{children:b.jsx(ra,{checked:n.has(String(L[r])),onChange:A=>i(String(L[r]),A.target.checked)})}),t.map(A=>b.jsx(zt.Td,{children:b.jsx($Z,{row:L,col:A,pk:r,isEditing:(f==null?void 0:f.rowPk)===L[r]&&(f==null?void 0:f.column)===A.name,onStartEdit:g,onUpdate:m,onCancelEdit:v,fkMap:x,API:w,currentTable:S,getTagColor:k,isTagColumn:E})},A.name)),b.jsx(zt.Td,{children:b.jsx(LA,{type:"icon",onDelete:()=>d(L[r]),size:"sm",variant:"subtle",color:"red"})})]},L[r]))})]})}),MZ=({page:t,total:e,limit:r=50,onPageChange:n})=>{const i=Math.ceil(e/r);return b.jsxs(Zt,{justify:"flex-end",gap:"xs",mt:"xs",children:[b.jsxs(jt,{size:"xs",c:"dimmed",children:["Page ",t," of ",i," (",e," records)"]}),b.jsx(Dn,{variant:"default",size:"sm",disabled:t<=1,onClick:()=>n(t-1),children:b.jsx(_Q,{size:14})}),b.jsx(Dn,{variant:"default",size:"sm",disabled:t>=i,onClick:()=>n(t+1),children:b.jsx(EQ,{size:14})})]})},tn="/sqlite/api",AZ=(t,e)=>{const r=(t||"").toUpperCase(),n=(e||"").toLowerCase();return n.includes("email")?b.jsx(vS,{size:14}):n.includes("date")||n.includes("time")?b.jsx(CQ,{size:14}):r.includes("INT")||r.includes("REAL")||r.includes("FLOAT")?b.jsx(IQ,{size:14}):r.includes("BOOL")?b.jsx(TA,{size:14}):b.jsx(vS,{size:14})},SS=["gray"],RZ=t=>{if(!t)return"gray";const e=String(t).split("").reduce((r,n)=>r+n.charCodeAt(0),0);return SS[e%SS.length]},PZ=t=>{const e=(t||"").toLowerCase();return e.includes("status")||e.includes("categoria")||e.includes("category")||e==="cor"},BZ=({opened:t,onClose:e,columns:r,currentTable:n,onSuccess:i})=>{const[o,a]=$.useState({}),[l,u]=$.useState({}),[h,d]=$.useState({}),[f,g]=$.useState(!1);$.useEffect(()=>{t&&(a({}),r.filter(k=>k.pk!==1&&k.fk).forEach(k=>{m(k)}))},[t,r]);const m=async S=>{if(S.fk){d(k=>({...k,[S.name]:!0}));try{const E=await(await fetch(`${tn}/table/${n}/fk-options?refTable=${S.fk.table}&refColumn=${S.fk.column}`)).json();E.success&&u(L=>({...L,[S.name]:E.options.map(A=>({value:String(A.value),label:`${A.label} (ID: ${A.value})`}))}))}catch(k){console.error("Error loading FK options:",k)}d(k=>({...k,[S.name]:!1}))}},v=(S,k)=>{a(E=>({...E,[S]:k}))},x=async()=>{g(!0);try{const k=await(await fetch(`${tn}/table/${n}/insert`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)})).json();k.success?(Jt.show({title:"Success",message:"Record created!",color:"green"}),i()):Jt.show({title:"Error",message:k.error,color:"red"})}catch{Jt.show({title:"Error",message:"Failed to save",color:"red"})}g(!1)},w=S=>{const k=!!S.fk,E=S.notnull===1,L=`${S.name}${E?" *":""}`;if(k){const A=l[S.name]||[],M=h[S.name];return b.jsx(Zs,{label:L,placeholder:M?"Loading...":`Select ${S.fk.table}`,data:A,value:o[S.name]||null,onChange:B=>v(S.name,B),searchable:!0,clearable:!0,disabled:M,leftSection:b.jsx(EA,{size:14})},S.name)}return b.jsx(Bn,{label:L,placeholder:S.type||"TEXT",value:o[S.name]||"",onChange:A=>v(S.name,A.target.value)},S.name)};return b.jsx(Mr,{opened:t,onClose:e,title:"New Record",children:b.jsxs(Je,{children:[r.filter(S=>S.pk!==1).map(S=>w(S)),b.jsxs(Zt,{justify:"flex-end",children:[b.jsx(_e,{variant:"subtle",onClick:e,color:"gray",children:"Cancel"}),b.jsx(_e,{color:"dark",onClick:x,loading:f,children:"Save"})]})]})})};function NZ(){var Lt,xe,re,Ae;const{colorScheme:t,toggleColorScheme:e}=NB(),r=t==="dark",[n,i]=$.useState(null),[o,{open:a,close:l}]=uo(!1),u=async()=>{try{const mt=await(await fetch("/sqlite/auth/status")).json();i(mt)}catch(rt){console.error("Failed to check auth status",rt)}};$.useEffect(()=>{u()},[]);const h=async()=>{try{await fetch("/sqlite/auth/logout",{method:"POST"}),i({...n,authenticated:!1,user:null}),Jt.show({title:"Logged out",message:"You have been successfully logged out",color:"gray"})}catch{Jt.show({title:"Error",message:"Failed to logout",color:"red"})}},[d,f]=$.useState([]),[g,m]=$.useState(null),[v,x]=$.useState([]),[w,S]=$.useState([]),[k,E]=$.useState(!1),[L,A]=$.useState(1),[M,B]=$.useState(0),[D,q]=$.useState(null),[U,H]=$.useState("ASC"),[K,V]=$.useState(new Set),[W,I]=$.useState(""),[O,F]=$.useState(!1),[P,z]=$.useState(""),[X,N]=$.useState(""),[Z,ot]=$.useState(!1),[yt,dt]=$.useState(null),[lt,gt]=$.useState({});$.useEffect(()=>{(async()=>{if(!w.length||!v.length)return;const mt=v.filter($t=>$t.fk);if(mt.length===0)return;const bt={...lt};let Et=!1;for(const $t of mt){const ne=new Set;if(w.forEach(ae=>{const Gr=ae[$t.name];Gr!=null&&!bt[`${$t.fk.table}:${Gr}`]&&ne.add(Gr)}),ne.size>0)try{const Gr=await(await fetch(`${tn}/resolve-fk`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({table:$t.fk.table,idColumn:$t.fk.column,ids:Array.from(ne)})})).json();Gr.success&&(Object.entries(Gr.values).forEach(([Xr,Cs])=>{bt[`${$t.fk.table}:${Xr}`]=Cs}),Et=!0)}catch(ae){console.error("Failed to resolve FKs",ae)}}Et&&gt(bt)})()},[w,v]);const[xt,St]=Rm({key:"sqlite-favorites",defaultValue:[]}),[Tt,ee]=Rm({key:"sqlite-history",defaultValue:[]}),[Ee,pe]=Rm({key:"sqlite-recents",defaultValue:[]}),[Oe,{open:Ue,close:xr}]=uo(!1),[sr,{open:ar,close:$e}]=uo(!1),[le,{open:we,close:ze}]=uo(!1),[nr,{open:Ke,close:We}]=uo(!1),[lr,{open:He,close:Qe}]=uo(!1),[Fe,{toggle:Ye}]=uo(!1),[Ce,{open:Qi,close:ei}]=uo(!1),[jn,ge]=$.useState(""),[Me,br]=$.useState(""),[ri,Rr]=$.useState(0),[_r,cr]=$.useState([]),[ni,Ti]=$.useState("csv"),Ei=()=>{z(""),N(""),S([]),x([]),Fe&&Ye()},xa=[{label:"Run SQL",icon:vd,action:()=>{Ei(),F(!0),Qe()}},{label:"View ER Diagram",icon:my,action:()=>{dn(),Qe()}},{label:"Toggle Theme",icon:r?CS:xS,action:()=>{e(),Qe()}}],Se=d.filter(rt=>rt.name.toLowerCase().includes(Me.toLowerCase())),cn=xa.filter(rt=>rt.label.toLowerCase().includes(Me.toLowerCase())),Zi=[...Se.slice(0,8).map(rt=>({type:"table",name:rt.name})),...cn.map(rt=>({type:"action",label:rt.label,action:rt.action}))],bs=rt=>{if(rt.key==="ArrowDown")rt.preventDefault(),Rr(mt=>Math.min(mt+1,Zi.length-1));else if(rt.key==="ArrowUp")rt.preventDefault(),Rr(mt=>Math.max(mt-1,0));else if(rt.key==="Enter"&&Zi.length>0){rt.preventDefault();const mt=Zi[ri];mt.type==="table"?(ii(mt.name),br(""),Rr(0),Qe()):(mt.action(),Rr(0))}};WP([["mod+k",()=>{br(""),Rr(0),He()}],["escape",()=>{Qe(),br(""),Rr(0)}]]),$.useEffect(()=>{n!=null&&n.authenticated&&Yr()},[n==null?void 0:n.authenticated]);const Yr=async()=>{try{const mt=await(await fetch(`${tn}/tables`)).json();if(mt.tables){const bt=await Promise.all(mt.tables.map(async Et=>{try{const ne=await(await fetch(`${tn}/table/${Et}/count`)).json();return{name:Et,count:ne.count||0}}catch{return{name:Et,count:"?"}}}));f(bt)}}catch{Jt.show({title:"Erro",message:"Erro ao carregar tabelas",color:"red"})}},ii=async rt=>{m(rt),A(1),q(null),V(new Set),I(""),I(""),F(!1),cr([]),Ei(),pe(mt=>{const bt=mt.filter(Et=>Et!==rt);return[rt,...bt].slice(0,5)});try{const bt=await(await fetch(`${tn}/table/${rt}`)).json();x(bt.columns||[])}catch{x([])}un(rt),gt({})},un=async(rt=g)=>{if(!rt)return;E(!0);const mt=(L-1)*50;let bt=`SELECT * FROM ${rt}`;const Et=[];if(_r.forEach($t=>{$t.column&&$t.value&&($t.operator==="LIKE"?Et.push(`${$t.column} LIKE '%${$t.value}%'`):Et.push(`${$t.column} ${$t.operator} '${$t.value}'`))}),W){const $t=v.filter(ne=>{var ae;return(ae=ne.type)==null?void 0:ae.toUpperCase().includes("TEXT")});if($t.length>0){const ne=$t.map(ae=>`${ae.name} LIKE '%${W}%'`).join(" OR ");Et.push(`(${ne})`)}}Et.length>0&&(bt+=` WHERE ${Et.join(" AND ")}`),D&&(bt+=` ORDER BY ${D} ${U}`),bt+=` LIMIT 50 OFFSET ${mt}`;try{const[$t,ne]=await Promise.all([fetch(`${tn}/query`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sql:bt})}),fetch(`${tn}/table/${rt}/count`)]),ae=await $t.json(),Gr=await ne.json();ae.success?(S(ae.rows||[]),B(Gr.count||0)):Jt.show({title:"Erro",message:ae.error,color:"red"})}catch{Jt.show({title:"Erro",message:"Erro ao carregar dados",color:"red"})}E(!1)};$.useEffect(()=>{g&&!O&&un()},[L,D,U,_r,W]);const Xl=rt=>{xt.includes(rt)?St(xt.filter(mt=>mt!==rt)):St([...xt,rt])},ur=async()=>{var mt;if(!P.trim())return;E(!0);const rt=[{sql:P,timestamp:Date.now()},...Tt.filter(bt=>bt.sql!==P)].slice(0,20);ee(rt);try{const Et=await(await fetch(`${tn}/query`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sql:P})})).json();Et.success?Et.rows?(S(Et.rows),x(((mt=Et.columns)==null?void 0:mt.map($t=>({name:$t,type:"TEXT"})))||[]),B(Et.rows.length)):(Jt.show({title:"Sucesso",message:Et.message,color:"green"}),Yr()):Jt.show({title:"Erro",message:Et.error,color:"red"})}catch{Jt.show({title:"Erro",message:"Erro ao executar query",color:"red"})}E(!1)},hn=async rt=>{var bt,Et;const mt=((bt=v.find($t=>$t.pk===1))==null?void 0:bt.name)||((Et=v[0])==null?void 0:Et.name);try{const ne=await(await fetch(`${tn}/table/${g}/delete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({column:mt,value:rt})})).json();ne.success?(Jt.show({title:"Sucesso",message:"Excluído!",color:"green"}),un(),Yr()):Jt.show({title:"Erro",message:ne.error,color:"red"})}catch{Jt.show({title:"Erro",message:"Erro ao excluir",color:"red"})}},Ji=async()=>{var mt,bt;const rt=((mt=v.find(Et=>Et.pk===1))==null?void 0:mt.name)||((bt=v[0])==null?void 0:bt.name);for(const Et of K)await fetch(`${tn}/table/${g}/delete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({column:rt,value:Et})});V(new Set),Jt.show({title:"Sucesso",message:"Excluídos!",color:"green"}),un(),Yr()},Po=async()=>{var mt,bt;let rt=w;if(K.size>0){const Et=((mt=v.find($t=>$t.pk===1))==null?void 0:mt.name)||((bt=v[0])==null?void 0:bt.name);rt=w.filter($t=>K.has(String($t[Et])))}if(ni==="csv"){const Et=Object.keys(rt[0]||{}),$t=[Et.join(","),...rt.map(ne=>Et.map(ae=>`"${String(ne[ae]||"").replace(/"/g,'""')}"`).join(","))].join(`
519
+ `);h(`${r}.csv`,g,"text/csv")},u=()=>{if(t.length===0)return;const f=JSON.stringify(t,null,2);h(`${r}.json`,f,"application/json")},h=(f,g,m)=>{const v=new Blob([g],{type:m}),x=URL.createObjectURL(v),w=document.createElement("a");w.href=x,w.download=f,w.click(),URL.revokeObjectURL(x)},d=o?"compact-xs":n;return b.jsxs(je,{shadow:"md",width:160,children:[b.jsx(je.Target,{children:b.jsx(_e,{size:d,variant:i,color:"dark",leftSection:b.jsx(NQ,{size:14}),disabled:t.length===0,children:"Export"})}),b.jsxs(je.Dropdown,{children:[b.jsx(je.Label,{children:"Export as"}),b.jsx(je.Item,{leftSection:b.jsx(FQ,{size:16}),onClick:l,children:"CSV"}),b.jsx(je.Item,{leftSection:b.jsx(zQ,{size:16}),onClick:u,children:"JSON"})]})]})}function wZ({onConfirm:t,holdDuration:e=3e3,icon:r=$A,color:n="red",size:i="md",tooltip:o="Segure para confirmar",confirmingTooltip:a="Segurando...",...l}){const[u,h]=$.useState(0),[d,f]=$.useState(!1),g=$.useRef(null),m=$.useRef(null),v=$.useCallback(()=>{l.disabled||l.loading||(f(!0),m.current=Date.now(),g.current=setInterval(()=>{const w=Date.now()-m.current,S=Math.min(w/e*100,100);h(S),S>=100&&(clearInterval(g.current),f(!1),h(0),t==null||t())},50))},[e,t,l.disabled,l.loading]),x=$.useCallback(()=>{g.current&&(clearInterval(g.current),g.current=null),f(!1),h(0)},[]);return $.useEffect(()=>()=>{g.current&&clearInterval(g.current)},[]),b.jsx(Co,{label:d?a:o,withArrow:!0,children:b.jsxs(st,{style:{position:"relative",display:"inline-flex",verticalAlign:"middle"},children:[d&&b.jsx(Qv,{size:i==="sm"?28:i==="md"?34:42,thickness:2,sections:[{value:u,color:n}],style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",pointerEvents:"none"}}),b.jsx(Dn,{variant:"subtle",color:n,size:i,onMouseDown:v,onMouseUp:x,onMouseLeave:x,onTouchStart:v,onTouchEnd:x,style:{opacity:d?.7:1,transition:"opacity 0.2s",...l.style},...l,children:l.loading?b.jsx(Pn,{size:12,color:n}):b.jsx(r,{size:i==="sm"?14:i==="md"?18:22})})]})})}function CZ({onDelete:t,timerSeconds:e=3,children:r,loading:n,disabled:i,variant:o="light",color:a="red",leftSection:l=b.jsx($A,{size:14}),...u}){const[h,d]=$.useState(!1),[f,g]=$.useState(e),m=$.useRef(null),v=$.useRef(null),x=()=>{n||i||(d(!0),g(e),m.current=setTimeout(()=>{S()},e*1e3),v.current=setInterval(()=>{g(k=>{const E=k-1;return E<=0?(clearInterval(v.current),0):E})},1e3))},w=()=>{d(!1),g(e),m.current&&clearTimeout(m.current),v.current&&clearInterval(v.current)},S=async()=>{w(),t&&await t()};return $.useEffect(()=>()=>w(),[]),b.jsx(Co,{label:"Mantenha pressionado até a contagem terminar para confirmar a exclusão",withArrow:!0,multiline:!0,w:220,children:b.jsx(_e,{variant:o,color:h?"orange":a,leftSection:l,onMouseDown:x,onMouseUp:w,onMouseLeave:w,onTouchStart:x,onTouchEnd:w,disabled:n||i,style:{transition:"all 0.2s ease",transform:h?"scale(0.98)":"scale(1)",...u.style},...u,children:h?`Excluindo em ${f}s...`:r||"Segure para Excluir"})})}function LA({onDelete:t,timerSeconds:e=3,type:r="button",...n}){return r==="icon"?b.jsx(wZ,{onConfirm:t,holdDuration:e*1e3,...n}):b.jsx(CZ,{onDelete:t,timerSeconds:e,...n})}function SZ({onConfigured:t}){const[e,r]=$.useState("admin"),[n,i]=$.useState(""),[o,a]=$.useState(!1),l=async u=>{if(u.preventDefault(),!n){Jt.show({title:"Error",message:"Password is required",color:"red"});return}a(!0);try{const d=await(await fetch("/sqlite/api/setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,password:n})})).json();d.success?(Jt.show({title:"Welcome!",message:"System configured successfully",color:"green"}),t()):Jt.show({title:"Error",message:d.error,color:"red"})}catch{Jt.show({title:"Error",message:"Failed to connect to server",color:"red"})}a(!1)};return b.jsx(st,{style:{height:"100vh",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"#FBFAF8"},children:b.jsxs(op,{size:420,children:[b.jsxs(Je,{align:"center",mb:"xl",children:[b.jsx(mo,{size:60,radius:"md",color:"dark",children:b.jsx(Of,{size:34})}),b.jsx(go,{order:1,fw:700,children:"Welcome to SQLite"}),b.jsx(jt,{c:"dimmed",size:"sm",ta:"center",children:"Set up your administrator credentials to start managing your database."})]}),b.jsx(Ir,{withBorder:!0,shadow:"md",p:30,radius:"md",children:b.jsx("form",{onSubmit:l,children:b.jsxs(Je,{children:[b.jsx(Bn,{label:"Administrator Username",placeholder:"admin",required:!0,value:e,onChange:u=>r(u.target.value)}),b.jsx(fp,{label:"Password",placeholder:"Choose a strong password",required:!0,value:n,onChange:u=>i(u.target.value)}),b.jsx(Zt,{mt:"lg",justify:"flex-end",children:b.jsx(_e,{type:"submit",color:"dark",fullWidth:!0,loading:o,leftSection:b.jsx(aZ,{size:18}),children:"Save and Start"})})]})})}),b.jsx(jt,{c:"dimmed",size:"xs",ta:"center",mt:"xl",children:"This configuration will be saved in sqlite-config.json"})]})})}function kZ({onLogin:t}){const[e,r]=$.useState(""),[n,i]=$.useState(""),[o,a]=$.useState(""),[l,u]=$.useState(!1),[h,d]=$.useState(!1),f=async g=>{g.preventDefault(),d(!0);try{const v=await(await fetch("/sqlite/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,password:n,totpCode:o})})).json();v.success?t():v.code==="2FA_REQUIRED"?(u(!0),Jt.show({title:"Authentication Required",message:"Please enter your 2FA code",color:"blue",icon:b.jsx(O0,{size:16})})):Jt.show({title:"Login Failed",message:v.error||"Invalid credentials",color:"red"})}catch{Jt.show({title:"Error",message:"Failed to connect to server",color:"red"})}d(!1)};return b.jsx(st,{style:{height:"100vh",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"#FBFAF8"},children:b.jsxs(op,{size:420,children:[b.jsxs(Je,{align:"center",mb:"xl",children:[b.jsx(mo,{size:60,radius:"md",color:"dark",children:b.jsx(Of,{size:34})}),b.jsx(go,{order:1,fw:700,children:"SQLite Login"})]}),b.jsx(Ir,{withBorder:!0,shadow:"md",p:30,radius:"md",children:b.jsx("form",{onSubmit:f,children:b.jsxs(Je,{children:[b.jsx(Bn,{label:"Username",placeholder:"Your username",required:!0,value:e,onChange:g=>r(g.target.value),disabled:l}),b.jsx(fp,{label:"Password",placeholder:"Your password",required:!0,value:n,onChange:g=>i(g.target.value),disabled:l}),l&&b.jsx(Bn,{label:"Authenticator Code (2FA)",placeholder:"000 000",required:!0,autoFocus:!0,value:o,onChange:g=>a(g.target.value),leftSection:b.jsx(O0,{size:16}),maxLength:6}),b.jsx(Zt,{mt:"lg",children:b.jsx(_e,{type:"submit",color:"dark",fullWidth:!0,loading:h,leftSection:b.jsx(UQ,{size:18}),children:l?"Verify & Login":"Login"})}),l&&b.jsx(jt,{size:"xs",c:"dimmed",ta:"center",style:{cursor:"pointer"},onClick:()=>{u(!1),a("")},children:"Cancel"})]})})})]})})}function _Z({opened:t,onClose:e}){const[r,n]=$.useState(null),[i,o]=$.useState(!0),[a,l]=$.useState(0),[u,h]=$.useState(null),[d,f]=$.useState(""),[g,m]=$.useState(!1);$.useEffect(()=>{t&&v()},[t]);const v=async()=>{o(!0);try{const E=await(await fetch("/sqlite/auth/status")).json();n(E)}catch{Jt.show({title:"Error",message:"Failed to load status",color:"red"})}o(!1)},x=async()=>{l(1);try{const E=await(await fetch("/sqlite/api/totp/generate",{method:"POST"})).json();E.success?(h(E),l(2)):(Jt.show({title:"Error",message:"Failed to generate QR",color:"red"}),l(0))}catch{l(0)}},w=async()=>{if(d){m(!0);try{(await(await fetch("/sqlite/api/totp/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({secret:u.secret,code:d})})).json()).success?(Jt.show({title:"Success",message:"2FA Enabled!",color:"green"}),l(0),v()):Jt.show({title:"Error",message:"Invalid code",color:"red"})}catch{Jt.show({title:"Error",message:"Request failed",color:"red"})}m(!1)}},S=async()=>{const k=prompt("Enter your 2FA code to confirm disabling:");if(k)try{const L=await(await fetch("/sqlite/api/totp/disable",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:k})})).json();L.success?(Jt.show({title:"Success",message:"2FA Disabled",color:"gray"}),v()):Jt.show({title:"Error",message:L.error||"Failed to disable",color:"red"})}catch{Jt.show({title:"Error",message:"Request failed",color:"red"})}};return b.jsx(Mr,{opened:t,onClose:e,title:"Security Settings",size:"lg",children:i?b.jsx(Je,{align:"center",py:"xl",children:b.jsx(Pn,{})}):b.jsxs(Je,{children:[b.jsxs(Zt,{justify:"space-between",align:"flex-start",children:[b.jsxs(Zt,{children:[b.jsx(mo,{size:"xl",radius:"md",color:r!=null&&r.totpEnabled?"green":"gray",variant:"light",children:b.jsx(O0,{size:28})}),b.jsxs("div",{children:[b.jsx(jt,{fw:600,children:"Two-Factor Authentication (2FA)"}),b.jsx(jt,{size:"sm",c:"dimmed",children:r!=null&&r.totpEnabled?"Your account is secured with 2FA.":"Add an extra layer of security to your account."})]})]}),r!=null&&r.totpEnabled?b.jsx(_e,{color:"red",variant:"subtle",onClick:S,children:"Disable"}):a===0&&b.jsx(_e,{color:"dark",onClick:x,children:"Enable 2FA"})]}),a===2&&u&&b.jsx(Ir,{withBorder:!0,p:"md",radius:"md",bg:"gray.0",children:b.jsxs(Je,{align:"center",children:[b.jsx(jt,{fw:600,children:"1. Scan QR Code"}),b.jsx(jt,{size:"sm",c:"dimmed",ta:"center",children:"Use your authenticator app (Google Authenticator, Authy, etc.) to scan this code."}),b.jsx("div",{style:{background:"white",padding:"10px",borderRadius:"8px"},children:b.jsx(jv,{src:u.qrCode,w:180,h:180})}),b.jsxs(Zt,{gap:"xs",children:[b.jsxs(jt,{size:"xs",c:"dimmed",children:["Secret: ",u.secret]}),b.jsx(A_,{value:u.secret,children:({copied:k,copy:E})=>b.jsx(Dn,{variant:"subtle",color:k?"green":"gray",onClick:E,size:"xs",children:k?b.jsx(TA,{size:12}):b.jsx(AQ,{size:12})})})]}),b.jsx(jt,{fw:600,mt:"md",children:"2. Verify Code"}),b.jsxs(Zt,{align:"flex-start",children:[b.jsx(Bn,{placeholder:"000 000",value:d,onChange:k=>f(k.target.value),maxLength:6,w:140}),b.jsx(_e,{onClick:w,loading:g,color:"dark",children:"Verify"})]}),b.jsx(_e,{variant:"subtle",size:"xs",color:"gray",onClick:()=>l(0),children:"Cancel"})]})})]})})}const TZ=({tables:t,favorites:e,currentTable:r,onSelectTable:n})=>b.jsx(Si,{style:{flex:1},children:b.jsxs(Je,{gap:0,children:[b.jsx(jt,{size:"xs",fw:500,c:"#91918E",px:"xs",mb:4,mt:"xs",style:{textTransform:"uppercase",fontSize:"11px",letterSpacing:"0.03em"},children:"Favorites"}),e.map(i=>b.jsx(Di,{label:i,leftSection:b.jsx(ol,{size:16}),active:r===i,onClick:()=>n(i),style:{borderRadius:6}},i)),e.length===0&&b.jsx(jt,{size:"xs",c:"dimmed",px:"sm",py:2,fs:"italic",children:"No favorites"}),b.jsx(jt,{size:"xs",fw:500,c:"#91918E",px:"xs",mb:4,mt:"lg",style:{textTransform:"uppercase",fontSize:"11px",letterSpacing:"0.03em"},children:"Tables"}),t.filter(i=>!e.includes(i.name)).map(i=>b.jsx(Di,{label:i.name,leftSection:b.jsx(ol,{size:16}),active:r===i.name,onClick:()=>n(i.name),style:{borderRadius:6}},i.name))]})}),EZ=({table:t,id:e,label:r,API:n})=>{const[i,o]=$.useState(null),[a,l]=$.useState(!1),[u,h]=$.useState(!1),d=async()=>{if(!u){l(!0);try{const g=await(await fetch(`${n}/query`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sql:`SELECT * FROM ${t} WHERE rowid = ${e} LIMIT 1`})})).json();g.success&&g.rows&&g.rows.length>0&&o(g.rows[0])}catch(f){console.error(f)}l(!1),h(!0)}};return b.jsxs(Qs,{width:280,shadow:"md",openDelay:300,onOpen:d,children:[b.jsx(Qs.Target,{children:b.jsxs(Zt,{gap:6,wrap:"nowrap",style:{cursor:"pointer"},children:[b.jsx(as,{variant:"outline",color:"gray",size:"sm",leftSection:b.jsx(F0,{size:10}),styles:{label:{fontWeight:500}},children:e}),r&&b.jsx(jt,{size:"xs",c:"dimmed",lineClamp:1,children:r})]})}),b.jsx(Qs.Dropdown,{children:a?b.jsx(cl,{p:"sm",children:b.jsx(Pn,{size:"xs",type:"dots"})}):i?b.jsxs(Je,{gap:"xs",children:[b.jsxs(Zt,{justify:"space-between",children:[b.jsx(jt,{size:"xs",fw:700,c:"dimmed",tt:"uppercase",children:t}),b.jsxs(as,{size:"xs",variant:"light",children:["ID: ",e]})]}),b.jsx(jt,{size:"sm",fw:600,lineClamp:2,children:r||"Record"}),b.jsx(Hs,{}),b.jsx(Je,{gap:4,children:Object.entries(i).filter(([f])=>f!=="id"&&!f.toLowerCase().includes("id")).slice(0,3).map(([f,g])=>b.jsxs(Zt,{justify:"space-between",align:"flex-start",wrap:"nowrap",children:[b.jsxs(jt,{size:"xs",c:"dimmed",style:{minWidth:60},children:[f,":"]}),b.jsx(jt,{size:"xs",lineClamp:1,style:{textAlign:"right"},children:String(g)})]},f))})]}):b.jsx(jt,{size:"xs",c:"dimmed",children:"No preview available"})})]})},$Z=({row:t,col:e,pk:r,isEditing:n,onStartEdit:i,onUpdate:o,onCancelEdit:a,fkMap:l,API:u,currentTable:h,getTagColor:d,isTagColumn:f})=>{const g=t[e.name],m=t[r],v=e.pk===1,x=!!e.fk,[w,S]=$.useState([]),[k,E]=$.useState(!1);return $.useEffect(()=>{n&&x&&(E(!0),fetch(`${u}/table/${h}/fk-options?refTable=${e.fk.table}&refColumn=${e.fk.column}`).then(L=>L.json()).then(L=>{L.success&&S(L.options.map(A=>({value:String(A.value),label:`${A.label} (ID: ${A.value})`}))),E(!1)}).catch(()=>E(!1)))},[n,x,u,h,e.fk]),n?x?b.jsx(Zs,{size:"xs",autoFocus:!0,searchable:!0,data:w,defaultValue:g===null?null:String(g),placeholder:k?"Loading...":`Select ${e.fk.table}`,onChange:L=>{o(m,e.name,L)},onBlur:a,styles:{input:{minHeight:"28px",height:"28px"}},onKeyDownCapture:L=>{L.key==="Escape"&&(L.preventDefault(),L.stopPropagation(),a())}}):b.jsx(Bn,{size:"xs",autoFocus:!0,defaultValue:g===null?"":String(g),onBlur:L=>o(m,e.name,L.target.value),onKeyDown:L=>{L.key==="Enter"?o(m,e.name,L.target.value):L.key==="Escape"&&a()},styles:{input:{minHeight:"28px",height:"28px",padding:"0 8px"}}}):g===null?b.jsx(jt,{c:"dimmed",fs:"italic",size:"sm",onClick:()=>!v&&i(m,e.name),style:{cursor:v?"default":"text"},children:"null"}):x?b.jsx("div",{onClick:L=>{L.stopPropagation(),i(m,e.name)},children:b.jsx(EZ,{table:e.fk.table,id:g,label:l[`${e.fk.table}:${g}`],API:u})}):f(e.name)?b.jsx(as,{color:d(g),variant:"light",onClick:()=>i(m,e.name),style:{cursor:"pointer"},children:g}):b.jsx(jt,{size:"sm",onClick:()=>!v&&i(m,e.name),style:{cursor:v?"default":"text",padding:"4px 0",borderRadius:"4px"},className:v?"":"editable-cell",children:String(g)})},LZ=({columns:t,rows:e,pk:r,selectedRows:n,onSelectRow:i,onSelectAll:o,onSort:a,sort:l,sortDir:u,getColumnIcon:h,onDeleteRecord:d,editingCell:f,onStartEdit:g,onUpdateCell:m,onCancelEdit:v,fkMap:x,API:w,currentTable:S,getTagColor:k,isTagColumn:E})=>b.jsx(Si,{children:b.jsxs(zt,{striped:!1,highlightOnHover:!0,withTableBorder:!1,verticalSpacing:"xs",children:[b.jsx(zt.Thead,{children:b.jsxs(zt.Tr,{children:[b.jsx(zt.Th,{w:40,style:{borderBottom:"1px solid #eee"},children:b.jsx(ra,{checked:n.size===e.length&&e.length>0,indeterminate:n.size>0&&n.size<e.length,onChange:L=>o(L.target.checked)})}),t.map(L=>b.jsx(zt.Th,{onClick:()=>a(L.name),style:{cursor:"pointer",borderBottom:"1px solid #eee"},children:b.jsxs(Zt,{gap:4,wrap:"nowrap",children:[h(L.type,L.name),b.jsx(jt,{size:"xs",fw:500,c:"dimmed",children:L.name}),l===L.name&&b.jsx(jt,{size:"xs",c:"dimmed",children:u==="ASC"?"↑":"↓"})]})},L.name)),b.jsx(zt.Th,{w:50,style:{borderBottom:"1px solid #eee"}})]})}),b.jsx(zt.Tbody,{children:e.map(L=>b.jsxs(zt.Tr,{bg:n.has(String(L[r]))?"gray.0":void 0,children:[b.jsx(zt.Td,{children:b.jsx(ra,{checked:n.has(String(L[r])),onChange:A=>i(String(L[r]),A.target.checked)})}),t.map(A=>b.jsx(zt.Td,{children:b.jsx($Z,{row:L,col:A,pk:r,isEditing:(f==null?void 0:f.rowPk)===L[r]&&(f==null?void 0:f.column)===A.name,onStartEdit:g,onUpdate:m,onCancelEdit:v,fkMap:x,API:w,currentTable:S,getTagColor:k,isTagColumn:E})},A.name)),b.jsx(zt.Td,{children:b.jsx(LA,{type:"icon",onDelete:()=>d(L[r]),size:"sm",variant:"subtle",color:"red"})})]},L[r]))})]})}),MZ=({page:t,total:e,limit:r=50,onPageChange:n})=>{const i=Math.ceil(e/r);return b.jsxs(Zt,{justify:"flex-end",gap:"xs",mt:"xs",children:[b.jsxs(jt,{size:"xs",c:"dimmed",children:["Page ",t," of ",i," (",e," records)"]}),b.jsx(Dn,{variant:"default",size:"sm",disabled:t<=1,onClick:()=>n(t-1),children:b.jsx(_Q,{size:14})}),b.jsx(Dn,{variant:"default",size:"sm",disabled:t>=i,onClick:()=>n(t+1),children:b.jsx(EQ,{size:14})})]})},tn="/sqlite/api",AZ=(t,e)=>{const r=(t||"").toUpperCase(),n=(e||"").toLowerCase();return n.includes("email")?b.jsx(vS,{size:14}):n.includes("date")||n.includes("time")?b.jsx(CQ,{size:14}):r.includes("INT")||r.includes("REAL")||r.includes("FLOAT")?b.jsx(IQ,{size:14}):r.includes("BOOL")?b.jsx(TA,{size:14}):b.jsx(vS,{size:14})},SS=["gray"],RZ=t=>{if(!t)return"gray";const e=String(t).split("").reduce((r,n)=>r+n.charCodeAt(0),0);return SS[e%SS.length]},PZ=t=>{const e=(t||"").toLowerCase();return e.includes("status")||e.includes("categoria")||e.includes("category")||e==="cor"},BZ=({opened:t,onClose:e,columns:r,currentTable:n,onSuccess:i})=>{const[o,a]=$.useState({}),[l,u]=$.useState({}),[h,d]=$.useState({}),[f,g]=$.useState(!1);$.useEffect(()=>{t&&(a({}),r.filter(k=>k.pk!==1&&k.fk).forEach(k=>{m(k)}))},[t,r]);const m=async S=>{if(S.fk){d(k=>({...k,[S.name]:!0}));try{const E=await(await fetch(`${tn}/table/${n}/fk-options?refTable=${S.fk.table}&refColumn=${S.fk.column}`)).json();E.success&&u(L=>({...L,[S.name]:E.options.map(A=>({value:String(A.value),label:`${A.label} (ID: ${A.value})`}))}))}catch(k){console.error("Error loading FK options:",k)}d(k=>({...k,[S.name]:!1}))}},v=(S,k)=>{a(E=>({...E,[S]:k}))},x=async()=>{g(!0);try{const k=await(await fetch(`${tn}/table/${n}/insert`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)})).json();k.success?(Jt.show({title:"Success",message:"Record created!",color:"green"}),i()):Jt.show({title:"Error",message:k.error,color:"red"})}catch{Jt.show({title:"Error",message:"Failed to save",color:"red"})}g(!1)},w=S=>{const k=!!S.fk,E=S.notnull===1,L=`${S.name}${E?" *":""}`;if(k){const A=l[S.name]||[],M=h[S.name];return b.jsx(Zs,{label:L,placeholder:M?"Loading...":`Select ${S.fk.table}`,data:A,value:o[S.name]||null,onChange:B=>v(S.name,B),searchable:!0,clearable:!0,disabled:M,leftSection:b.jsx(EA,{size:14})},S.name)}return b.jsx(Bn,{label:L,placeholder:S.type||"TEXT",value:o[S.name]||"",onChange:A=>v(S.name,A.target.value)},S.name)};return b.jsx(Mr,{opened:t,onClose:e,title:"New Record",children:b.jsxs(Je,{children:[r.filter(S=>S.pk!==1).map(S=>w(S)),b.jsxs(Zt,{justify:"flex-end",children:[b.jsx(_e,{variant:"subtle",onClick:e,color:"gray",children:"Cancel"}),b.jsx(_e,{color:"dark",onClick:x,loading:f,children:"Save"})]})]})})};function NZ(){var Lt,xe,re,Ae;const{colorScheme:t,toggleColorScheme:e}=NB(),r=t==="dark",[n,i]=$.useState(null),[o,{open:a,close:l}]=uo(!1),u=async()=>{try{const mt=await(await fetch("/sqlite/auth/status")).json();i(mt)}catch(rt){console.error("Failed to check auth status",rt)}};$.useEffect(()=>{u()},[]);const h=async()=>{try{await fetch("/sqlite/auth/logout",{method:"POST"}),i({...n,authenticated:!1,user:null}),Jt.show({title:"Logged out",message:"You have been successfully logged out",color:"gray"})}catch{Jt.show({title:"Error",message:"Failed to logout",color:"red"})}},[d,f]=$.useState([]),[g,m]=$.useState(null),[v,x]=$.useState([]),[w,S]=$.useState([]),[k,E]=$.useState(!1),[L,A]=$.useState(1),[M,B]=$.useState(0),[D,q]=$.useState(null),[U,H]=$.useState("ASC"),[K,V]=$.useState(new Set),[W,I]=$.useState(""),[O,F]=$.useState(!1),[P,z]=$.useState(""),[X,N]=$.useState(""),[Z,ot]=$.useState(!1),[yt,dt]=$.useState(null),[lt,gt]=$.useState({});$.useEffect(()=>{(async()=>{if(!w.length||!v.length)return;const mt=v.filter($t=>$t.fk);if(mt.length===0)return;const bt={...lt};let Et=!1;for(const $t of mt){const ne=new Set;if(w.forEach(ae=>{const Gr=ae[$t.name];Gr!=null&&!bt[`${$t.fk.table}:${Gr}`]&&ne.add(Gr)}),ne.size>0)try{const Gr=await(await fetch(`${tn}/resolve-fk`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({table:$t.fk.table,idColumn:$t.fk.column,ids:Array.from(ne)})})).json();Gr.success&&(Object.entries(Gr.values).forEach(([Xr,Cs])=>{bt[`${$t.fk.table}:${Xr}`]=Cs}),Et=!0)}catch(ae){console.error("Failed to resolve FKs",ae)}}Et&&gt(bt)})()},[w,v]);const[xt,St]=Rm({key:"sqlite-favorites",defaultValue:[]}),[Tt,ee]=Rm({key:"sqlite-history",defaultValue:[]}),[Ee,pe]=Rm({key:"sqlite-recents",defaultValue:[]}),[Oe,{open:Ue,close:xr}]=uo(!1),[sr,{open:ar,close:$e}]=uo(!1),[le,{open:we,close:ze}]=uo(!1),[nr,{open:Ke,close:We}]=uo(!1),[lr,{open:He,close:Qe}]=uo(!1),[Fe,{toggle:Ye}]=uo(!1),[Ce,{open:Qi,close:ei}]=uo(!1),[jn,ge]=$.useState(""),[Me,br]=$.useState(""),[ri,Rr]=$.useState(0),[_r,cr]=$.useState([]),[ni,Ti]=$.useState("csv"),Ei=()=>{z(""),N(""),S([]),x([]),Fe&&Ye()},xa=[{label:"Run SQL",icon:vd,action:()=>{Ei(),F(!0),Qe()}},{label:"View ER Diagram",icon:my,action:()=>{dn(),Qe()}},{label:"Toggle Theme",icon:r?CS:xS,action:()=>{e(),Qe()}}],Se=d.filter(rt=>rt.name.toLowerCase().includes(Me.toLowerCase())),cn=xa.filter(rt=>rt.label.toLowerCase().includes(Me.toLowerCase())),Zi=[...Se.slice(0,8).map(rt=>({type:"table",name:rt.name})),...cn.map(rt=>({type:"action",label:rt.label,action:rt.action}))],bs=rt=>{if(rt.key==="ArrowDown")rt.preventDefault(),Rr(mt=>Math.min(mt+1,Zi.length-1));else if(rt.key==="ArrowUp")rt.preventDefault(),Rr(mt=>Math.max(mt-1,0));else if(rt.key==="Enter"&&Zi.length>0){rt.preventDefault();const mt=Zi[ri];mt.type==="table"?(ii(mt.name),br(""),Rr(0),Qe()):(mt.action(),Rr(0))}};WP([["mod+k",()=>{br(""),Rr(0),He()}],["escape",()=>{Qe(),br(""),Rr(0)}]]),$.useEffect(()=>{n!=null&&n.authenticated&&Yr()},[n==null?void 0:n.authenticated]);const Yr=async()=>{try{const mt=await(await fetch(`${tn}/tables`)).json();if(mt.tables){const bt=await Promise.all(mt.tables.map(async Et=>{try{const ne=await(await fetch(`${tn}/table/${Et}/count`)).json();return{name:Et,count:ne.count||0}}catch{return{name:Et,count:"?"}}}));f(bt)}}catch{Jt.show({title:"Erro",message:"Erro ao carregar tabelas",color:"red"})}},ii=async rt=>{m(rt),A(1),q(null),V(new Set),I(""),I(""),F(!1),cr([]),Ei(),pe(mt=>{const bt=mt.filter(Et=>Et!==rt);return[rt,...bt].slice(0,5)});try{const bt=await(await fetch(`${tn}/table/${rt}`)).json();x(bt.columns||[])}catch{x([])}un(rt),gt({})},un=async(rt=g)=>{if(!rt)return;E(!0);const mt=(L-1)*50;let bt=`SELECT * FROM ${rt}`;const Et=[];if(_r.forEach($t=>{$t.column&&$t.value&&($t.operator==="LIKE"?Et.push(`${$t.column} LIKE '%${$t.value}%'`):Et.push(`${$t.column} ${$t.operator} '${$t.value}'`))}),W){const $t=v.filter(ne=>{var ae;return(ae=ne.type)==null?void 0:ae.toUpperCase().includes("TEXT")});if($t.length>0){const ne=$t.map(ae=>`${ae.name} LIKE '%${W}%'`).join(" OR ");Et.push(`(${ne})`)}}Et.length>0&&(bt+=` WHERE ${Et.join(" AND ")}`),D&&(bt+=` ORDER BY ${D} ${U}`),bt+=` LIMIT 50 OFFSET ${mt}`;try{const[$t,ne]=await Promise.all([fetch(`${tn}/query`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sql:bt})}),fetch(`${tn}/table/${rt}/count`)]),ae=await $t.json(),Gr=await ne.json();ae.success?(S(ae.rows||[]),B(Gr.count||0)):Jt.show({title:"Erro",message:ae.error,color:"red"})}catch{Jt.show({title:"Erro",message:"Erro ao carregar dados",color:"red"})}E(!1)};$.useEffect(()=>{g&&!O&&un()},[L,D,U,_r,W]);const Xl=rt=>{xt.includes(rt)?St(xt.filter(mt=>mt!==rt)):St([...xt,rt])},ur=async()=>{var mt;if(!P.trim())return;E(!0);const rt=[{sql:P,timestamp:Date.now()},...Tt.filter(bt=>bt.sql!==P)].slice(0,20);ee(rt);try{const Et=await(await fetch(`${tn}/query`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sql:P})})).json();Et.success?Et.rows?(S(Et.rows),x(((mt=Et.columns)==null?void 0:mt.map($t=>({name:$t,type:"TEXT"})))||[]),B(Et.rows.length)):(Jt.show({title:"Sucesso",message:Et.message,color:"green"}),Yr()):Jt.show({title:"Erro",message:Et.error,color:"red"})}catch{Jt.show({title:"Erro",message:"Erro ao executar query",color:"red"})}E(!1)},hn=async rt=>{var bt,Et;const mt=((bt=v.find($t=>$t.pk===1))==null?void 0:bt.name)||((Et=v[0])==null?void 0:Et.name);try{const ne=await(await fetch(`${tn}/table/${g}/delete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({column:mt,value:rt})})).json();ne.success?(Jt.show({title:"Sucesso",message:"Excluído!",color:"green"}),un(),Yr()):Jt.show({title:"Erro",message:ne.error,color:"red"})}catch{Jt.show({title:"Erro",message:"Erro ao excluir",color:"red"})}},Ji=async()=>{var mt,bt;const rt=((mt=v.find(Et=>Et.pk===1))==null?void 0:mt.name)||((bt=v[0])==null?void 0:bt.name);for(const Et of K)await fetch(`${tn}/table/${g}/delete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({column:rt,value:Et})});V(new Set),Jt.show({title:"Sucesso",message:"Excluídos!",color:"green"}),un(),Yr()},Po=async()=>{var mt,bt;let rt=w;if(K.size>0){const Et=((mt=v.find($t=>$t.pk===1))==null?void 0:mt.name)||((bt=v[0])==null?void 0:bt.name);rt=w.filter($t=>K.has(String($t[Et])))}if(ni==="csv"){const Et=Object.keys(rt[0]||{}),$t=[Et.join(","),...rt.map(ne=>Et.map(ae=>`"${String(ne[ae]||"").replace(/"/g,'""')}"`).join(","))].join(`
520
520
  `);Bo(`${g}.csv`,$t,"text/csv")}else Bo(`${g}.json`,JSON.stringify(rt,null,2),"application/json");We()},Bo=(rt,mt,bt)=>{const Et=new Blob([mt],{type:bt}),$t=URL.createObjectURL(Et),ne=document.createElement("a");ne.href=$t,ne.download=rt,ne.click(),URL.revokeObjectURL($t),We()},ba=async()=>{if(X.trim()){ot(!0);try{const mt=await(await fetch(`${tn}/ai/sql`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:X})})).json();mt.success?(z(mt.sql),Jt.show({title:"AI",message:"SQL Gerado!",color:"blue",icon:b.jsx(wS,{size:16})})):Jt.show({title:"Erro AI",message:mt.error,color:"red"})}catch{Jt.show({title:"Erro",message:"Erro ao consultar AI",color:"red"})}ot(!1)}},En=async(rt,mt,bt)=>{var $t,ne;const Et=(($t=v.find(ae=>ae.pk===1))==null?void 0:$t.name)||((ne=v[0])==null?void 0:ne.name);try{const Gr=await(await fetch(`${tn}/table/${g}/update`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({column:mt,value:bt,pkColumn:Et,pkValue:rt})})).json();Gr.success?(S(Xr=>Xr.map(Cs=>String(Cs[Et])===String(rt)?{...Cs,[mt]:bt}:Cs)),Jt.show({title:"Salvo",message:`${mt} atualizado`,color:"green"})):Jt.show({title:"Erro",message:Gr.error,color:"red"})}catch{Jt.show({title:"Erro",message:"Erro ao atualizar",color:"red"})}dt(null)},dn=async()=>{try{const mt=await(await fetch(`${tn}/meta/schema`)).json();if(mt.success){let bt=`erDiagram
521
521
  `;mt.schema.forEach($t=>{bt+=` ${$t.name} {
522
522
  `,$t.columns.forEach(ne=>{const ae=ne.type||"TEXT",Gr=ne.pk?"PK":ne.fk?"FK":"";bt+=` ${ae} ${ne.name} ${Gr}
@@ -1,2 +1,2 @@
1
- import{_ as e,l as s,H as n,e as i,I as p}from"./index-BBKjGWlO.js";import{p as g}from"./treemap-KMMF4GRG-Bmk930Gz.js";import"./min-DfeMYee7.js";import"./_baseUniq-tp0gy_rC.js";var v={parse:e(async r=>{const a=await g("info",r);s.debug(a)},"parse")},d={version:p.version+""},m=e(()=>d.version,"getVersion"),c={getVersion:m},l=e((r,a,o)=>{s.debug(`rendering info diagram
1
+ import{_ as e,l as s,H as n,e as i,I as p}from"./index-BG-h5MPT.js";import{p as g}from"./treemap-KMMF4GRG-DGWllLiC.js";import"./min-DVfZQuXM.js";import"./_baseUniq-BMKkaOYG.js";var v={parse:e(async r=>{const a=await g("info",r);s.debug(a)},"parse")},d={version:p.version+""},m=e(()=>d.version,"getVersion"),c={getVersion:m},l=e((r,a,o)=>{s.debug(`rendering info diagram
2
2
  `+r);const t=n(a);i(t,100,400,!0),t.append("g").append("text").attr("x",100).attr("y",40).attr("class","version").attr("font-size",32).style("text-anchor","middle").text(`v${o}`)},"draw"),f={draw:l},y={parser:v,db:c,renderer:f};export{y as diagram};
@@ -1,4 +1,4 @@
1
- import{a as gt,g as lt,f as mt,d as xt}from"./chunk-TZMSLE5B-C2E0ascL.js";import{g as kt}from"./chunk-FMBD7UC4-Cm8x3fGA.js";import{_ as n,g as _t,s as vt,a as bt,b as wt,q as Tt,p as St,c as R,d as X,e as $t,y as Mt}from"./index-BBKjGWlO.js";import{d as et}from"./arc-CIKD5jh6.js";var U=(function(){var t=n(function(h,i,a,l){for(a=a||{},l=h.length;l--;a[h[l]]=i);return a},"o"),e=[6,8,10,11,12,14,16,17,18],s=[1,9],c=[1,10],r=[1,11],f=[1,12],u=[1,13],y=[1,14],g={trace:n(function(){},"trace"),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:n(function(i,a,l,d,p,o,b){var k=o.length-1;switch(p){case 1:return o[k-1];case 2:this.$=[];break;case 3:o[k-1].push(o[k]),this.$=o[k-1];break;case 4:case 5:this.$=o[k];break;case 6:case 7:this.$=[];break;case 8:d.setDiagramTitle(o[k].substr(6)),this.$=o[k].substr(6);break;case 9:this.$=o[k].trim(),d.setAccTitle(this.$);break;case 10:case 11:this.$=o[k].trim(),d.setAccDescription(this.$);break;case 12:d.addSection(o[k].substr(8)),this.$=o[k].substr(8);break;case 13:d.addTask(o[k-1],o[k]),this.$="task";break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:s,12:c,14:r,16:f,17:u,18:y},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:15,11:s,12:c,14:r,16:f,17:u,18:y},t(e,[2,5]),t(e,[2,6]),t(e,[2,8]),{13:[1,16]},{15:[1,17]},t(e,[2,11]),t(e,[2,12]),{19:[1,18]},t(e,[2,4]),t(e,[2,9]),t(e,[2,10]),t(e,[2,13])],defaultActions:{},parseError:n(function(i,a){if(a.recoverable)this.trace(i);else{var l=new Error(i);throw l.hash=a,l}},"parseError"),parse:n(function(i){var a=this,l=[0],d=[],p=[null],o=[],b=this.table,k="",C=0,K=0,dt=2,Q=1,yt=o.slice.call(arguments,1),_=Object.create(this.lexer),I={yy:{}};for(var O in this.yy)Object.prototype.hasOwnProperty.call(this.yy,O)&&(I.yy[O]=this.yy[O]);_.setInput(i,I.yy),I.yy.lexer=_,I.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var Y=_.yylloc;o.push(Y);var ft=_.options&&_.options.ranges;typeof I.yy.parseError=="function"?this.parseError=I.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pt(w){l.length=l.length-2*w,p.length=p.length-w,o.length=o.length-w}n(pt,"popStack");function D(){var w;return w=d.pop()||_.lex()||Q,typeof w!="number"&&(w instanceof Array&&(d=w,w=d.pop()),w=a.symbols_[w]||w),w}n(D,"lex");for(var v,A,T,q,F={},N,M,tt,z;;){if(A=l[l.length-1],this.defaultActions[A]?T=this.defaultActions[A]:((v===null||typeof v>"u")&&(v=D()),T=b[A]&&b[A][v]),typeof T>"u"||!T.length||!T[0]){var H="";z=[];for(N in b[A])this.terminals_[N]&&N>dt&&z.push("'"+this.terminals_[N]+"'");_.showPosition?H="Parse error on line "+(C+1)+`:
1
+ import{a as gt,g as lt,f as mt,d as xt}from"./chunk-TZMSLE5B-BTmGFJO0.js";import{g as kt}from"./chunk-FMBD7UC4-Bi5H0CGx.js";import{_ as n,g as _t,s as vt,a as bt,b as wt,q as Tt,p as St,c as R,d as X,e as $t,y as Mt}from"./index-BG-h5MPT.js";import{d as et}from"./arc-DzwvCm0y.js";var U=(function(){var t=n(function(h,i,a,l){for(a=a||{},l=h.length;l--;a[h[l]]=i);return a},"o"),e=[6,8,10,11,12,14,16,17,18],s=[1,9],c=[1,10],r=[1,11],f=[1,12],u=[1,13],y=[1,14],g={trace:n(function(){},"trace"),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:n(function(i,a,l,d,p,o,b){var k=o.length-1;switch(p){case 1:return o[k-1];case 2:this.$=[];break;case 3:o[k-1].push(o[k]),this.$=o[k-1];break;case 4:case 5:this.$=o[k];break;case 6:case 7:this.$=[];break;case 8:d.setDiagramTitle(o[k].substr(6)),this.$=o[k].substr(6);break;case 9:this.$=o[k].trim(),d.setAccTitle(this.$);break;case 10:case 11:this.$=o[k].trim(),d.setAccDescription(this.$);break;case 12:d.addSection(o[k].substr(8)),this.$=o[k].substr(8);break;case 13:d.addTask(o[k-1],o[k]),this.$="task";break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:s,12:c,14:r,16:f,17:u,18:y},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:15,11:s,12:c,14:r,16:f,17:u,18:y},t(e,[2,5]),t(e,[2,6]),t(e,[2,8]),{13:[1,16]},{15:[1,17]},t(e,[2,11]),t(e,[2,12]),{19:[1,18]},t(e,[2,4]),t(e,[2,9]),t(e,[2,10]),t(e,[2,13])],defaultActions:{},parseError:n(function(i,a){if(a.recoverable)this.trace(i);else{var l=new Error(i);throw l.hash=a,l}},"parseError"),parse:n(function(i){var a=this,l=[0],d=[],p=[null],o=[],b=this.table,k="",C=0,K=0,dt=2,Q=1,yt=o.slice.call(arguments,1),_=Object.create(this.lexer),I={yy:{}};for(var O in this.yy)Object.prototype.hasOwnProperty.call(this.yy,O)&&(I.yy[O]=this.yy[O]);_.setInput(i,I.yy),I.yy.lexer=_,I.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var Y=_.yylloc;o.push(Y);var ft=_.options&&_.options.ranges;typeof I.yy.parseError=="function"?this.parseError=I.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pt(w){l.length=l.length-2*w,p.length=p.length-w,o.length=o.length-w}n(pt,"popStack");function D(){var w;return w=d.pop()||_.lex()||Q,typeof w!="number"&&(w instanceof Array&&(d=w,w=d.pop()),w=a.symbols_[w]||w),w}n(D,"lex");for(var v,A,T,q,F={},N,M,tt,z;;){if(A=l[l.length-1],this.defaultActions[A]?T=this.defaultActions[A]:((v===null||typeof v>"u")&&(v=D()),T=b[A]&&b[A][v]),typeof T>"u"||!T.length||!T[0]){var H="";z=[];for(N in b[A])this.terminals_[N]&&N>dt&&z.push("'"+this.terminals_[N]+"'");_.showPosition?H="Parse error on line "+(C+1)+`:
2
2
  `+_.showPosition()+`
3
3
  Expecting `+z.join(", ")+", got '"+(this.terminals_[v]||v)+"'":H="Parse error on line "+(C+1)+": Unexpected "+(v==Q?"end of input":"'"+(this.terminals_[v]||v)+"'"),this.parseError(H,{text:_.match,token:this.terminals_[v]||v,line:_.yylineno,loc:Y,expected:z})}if(T[0]instanceof Array&&T.length>1)throw new Error("Parse Error: multiple actions possible at state: "+A+", token: "+v);switch(T[0]){case 1:l.push(v),p.push(_.yytext),o.push(_.yylloc),l.push(T[1]),v=null,K=_.yyleng,k=_.yytext,C=_.yylineno,Y=_.yylloc;break;case 2:if(M=this.productions_[T[1]][1],F.$=p[p.length-M],F._$={first_line:o[o.length-(M||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(M||1)].first_column,last_column:o[o.length-1].last_column},ft&&(F._$.range=[o[o.length-(M||1)].range[0],o[o.length-1].range[1]]),q=this.performAction.apply(F,[k,K,C,I.yy,T[1],p,o].concat(yt)),typeof q<"u")return q;M&&(l=l.slice(0,-1*M*2),p=p.slice(0,-1*M),o=o.slice(0,-1*M)),l.push(this.productions_[T[1]][0]),p.push(F.$),o.push(F._$),tt=b[l[l.length-2]][l[l.length-1]],l.push(tt);break;case 3:return!0}}return!0},"parse")},m=(function(){var h={EOF:1,parseError:n(function(a,l){if(this.yy.parser)this.yy.parser.parseError(a,l);else throw new Error(a)},"parseError"),setInput:n(function(i,a){return this.yy=a||this.yy||{},this._input=i,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:n(function(){var i=this._input[0];this.yytext+=i,this.yyleng++,this.offset++,this.match+=i,this.matched+=i;var a=i.match(/(?:\r\n?|\n).*/g);return a?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),i},"input"),unput:n(function(i){var a=i.length,l=i.split(/(?:\r\n?|\n)/g);this._input=i+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-a),this.offset-=a;var d=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),l.length-1&&(this.yylineno-=l.length-1);var p=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:l?(l.length===d.length?this.yylloc.first_column:0)+d[d.length-l.length].length-l[0].length:this.yylloc.first_column-a},this.options.ranges&&(this.yylloc.range=[p[0],p[0]+this.yyleng-a]),this.yyleng=this.yytext.length,this},"unput"),more:n(function(){return this._more=!0,this},"more"),reject:n(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:n(function(i){this.unput(this.match.slice(i))},"less"),pastInput:n(function(){var i=this.matched.substr(0,this.matched.length-this.match.length);return(i.length>20?"...":"")+i.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:n(function(){var i=this.match;return i.length<20&&(i+=this._input.substr(0,20-i.length)),(i.substr(0,20)+(i.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:n(function(){var i=this.pastInput(),a=new Array(i.length+1).join("-");return i+this.upcomingInput()+`
@@ -1,4 +1,4 @@
1
- import{_ as c,l as te,c as W,H as fe,af as ye,ag as be,ah as me,V as _e,F as K,i as G,t as Ee,J as ke,W as Se,X as le,Y as ce}from"./index-BBKjGWlO.js";import{g as Ne}from"./chunk-FMBD7UC4-Cm8x3fGA.js";var $=(function(){var t=c(function(_,s,n,a){for(n=n||{},a=_.length;a--;n[_[a]]=s);return n},"o"),g=[1,4],d=[1,13],r=[1,12],p=[1,15],E=[1,16],f=[1,20],h=[1,19],L=[6,7,8],C=[1,26],w=[1,24],N=[1,25],i=[6,7,11],H=[1,31],x=[6,7,11,24],P=[1,6,13,16,17,20,23],M=[1,35],U=[1,36],A=[1,6,7,11,13,16,17,20,23],j=[1,38],V={trace:c(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,KANBAN:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,shapeData:15,ICON:16,CLASS:17,nodeWithId:18,nodeWithoutId:19,NODE_DSTART:20,NODE_DESCR:21,NODE_DEND:22,NODE_ID:23,SHAPE_DATA:24,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"KANBAN",11:"EOF",13:"SPACELIST",16:"ICON",17:"CLASS",20:"NODE_DSTART",21:"NODE_DESCR",22:"NODE_DEND",23:"NODE_ID",24:"SHAPE_DATA"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,3],[12,2],[12,2],[12,2],[12,1],[12,2],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[19,3],[18,1],[18,4],[15,2],[15,1]],performAction:c(function(s,n,a,o,u,e,B){var l=e.length-1;switch(u){case 6:case 7:return o;case 8:o.getLogger().trace("Stop NL ");break;case 9:o.getLogger().trace("Stop EOF ");break;case 11:o.getLogger().trace("Stop NL2 ");break;case 12:o.getLogger().trace("Stop EOF2 ");break;case 15:o.getLogger().info("Node: ",e[l-1].id),o.addNode(e[l-2].length,e[l-1].id,e[l-1].descr,e[l-1].type,e[l]);break;case 16:o.getLogger().info("Node: ",e[l].id),o.addNode(e[l-1].length,e[l].id,e[l].descr,e[l].type);break;case 17:o.getLogger().trace("Icon: ",e[l]),o.decorateNode({icon:e[l]});break;case 18:case 23:o.decorateNode({class:e[l]});break;case 19:o.getLogger().trace("SPACELIST");break;case 20:o.getLogger().trace("Node: ",e[l-1].id),o.addNode(0,e[l-1].id,e[l-1].descr,e[l-1].type,e[l]);break;case 21:o.getLogger().trace("Node: ",e[l].id),o.addNode(0,e[l].id,e[l].descr,e[l].type);break;case 22:o.decorateNode({icon:e[l]});break;case 27:o.getLogger().trace("node found ..",e[l-2]),this.$={id:e[l-1],descr:e[l-1],type:o.getType(e[l-2],e[l])};break;case 28:this.$={id:e[l],descr:e[l],type:0};break;case 29:o.getLogger().trace("node found ..",e[l-3]),this.$={id:e[l-3],descr:e[l-1],type:o.getType(e[l-2],e[l])};break;case 30:this.$=e[l-1]+e[l];break;case 31:this.$=e[l];break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:g},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:g},{6:d,7:[1,10],9:9,12:11,13:r,14:14,16:p,17:E,18:17,19:18,20:f,23:h},t(L,[2,3]),{1:[2,2]},t(L,[2,4]),t(L,[2,5]),{1:[2,6],6:d,12:21,13:r,14:14,16:p,17:E,18:17,19:18,20:f,23:h},{6:d,9:22,12:11,13:r,14:14,16:p,17:E,18:17,19:18,20:f,23:h},{6:C,7:w,10:23,11:N},t(i,[2,24],{18:17,19:18,14:27,16:[1,28],17:[1,29],20:f,23:h}),t(i,[2,19]),t(i,[2,21],{15:30,24:H}),t(i,[2,22]),t(i,[2,23]),t(x,[2,25]),t(x,[2,26]),t(x,[2,28],{20:[1,32]}),{21:[1,33]},{6:C,7:w,10:34,11:N},{1:[2,7],6:d,12:21,13:r,14:14,16:p,17:E,18:17,19:18,20:f,23:h},t(P,[2,14],{7:M,11:U}),t(A,[2,8]),t(A,[2,9]),t(A,[2,10]),t(i,[2,16],{15:37,24:H}),t(i,[2,17]),t(i,[2,18]),t(i,[2,20],{24:j}),t(x,[2,31]),{21:[1,39]},{22:[1,40]},t(P,[2,13],{7:M,11:U}),t(A,[2,11]),t(A,[2,12]),t(i,[2,15],{24:j}),t(x,[2,30]),{22:[1,41]},t(x,[2,27]),t(x,[2,29])],defaultActions:{2:[2,1],6:[2,2]},parseError:c(function(s,n){if(n.recoverable)this.trace(s);else{var a=new Error(s);throw a.hash=n,a}},"parseError"),parse:c(function(s){var n=this,a=[0],o=[],u=[null],e=[],B=this.table,l="",z=0,ie=0,ue=2,re=1,ge=e.slice.call(arguments,1),b=Object.create(this.lexer),T={yy:{}};for(var J in this.yy)Object.prototype.hasOwnProperty.call(this.yy,J)&&(T.yy[J]=this.yy[J]);b.setInput(s,T.yy),T.yy.lexer=b,T.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var q=b.yylloc;e.push(q);var de=b.options&&b.options.ranges;typeof T.yy.parseError=="function"?this.parseError=T.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pe(S){a.length=a.length-2*S,u.length=u.length-S,e.length=e.length-S}c(pe,"popStack");function ae(){var S;return S=o.pop()||b.lex()||re,typeof S!="number"&&(S instanceof Array&&(o=S,S=o.pop()),S=n.symbols_[S]||S),S}c(ae,"lex");for(var k,R,v,Q,F={},X,I,oe,Y;;){if(R=a[a.length-1],this.defaultActions[R]?v=this.defaultActions[R]:((k===null||typeof k>"u")&&(k=ae()),v=B[R]&&B[R][k]),typeof v>"u"||!v.length||!v[0]){var Z="";Y=[];for(X in B[R])this.terminals_[X]&&X>ue&&Y.push("'"+this.terminals_[X]+"'");b.showPosition?Z="Parse error on line "+(z+1)+`:
1
+ import{_ as c,l as te,c as W,H as fe,af as ye,ag as be,ah as me,V as _e,F as K,i as G,t as Ee,J as ke,W as Se,X as le,Y as ce}from"./index-BG-h5MPT.js";import{g as Ne}from"./chunk-FMBD7UC4-Bi5H0CGx.js";var $=(function(){var t=c(function(_,s,n,a){for(n=n||{},a=_.length;a--;n[_[a]]=s);return n},"o"),g=[1,4],d=[1,13],r=[1,12],p=[1,15],E=[1,16],f=[1,20],h=[1,19],L=[6,7,8],C=[1,26],w=[1,24],N=[1,25],i=[6,7,11],H=[1,31],x=[6,7,11,24],P=[1,6,13,16,17,20,23],M=[1,35],U=[1,36],A=[1,6,7,11,13,16,17,20,23],j=[1,38],V={trace:c(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,KANBAN:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,shapeData:15,ICON:16,CLASS:17,nodeWithId:18,nodeWithoutId:19,NODE_DSTART:20,NODE_DESCR:21,NODE_DEND:22,NODE_ID:23,SHAPE_DATA:24,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"KANBAN",11:"EOF",13:"SPACELIST",16:"ICON",17:"CLASS",20:"NODE_DSTART",21:"NODE_DESCR",22:"NODE_DEND",23:"NODE_ID",24:"SHAPE_DATA"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,3],[12,2],[12,2],[12,2],[12,1],[12,2],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[19,3],[18,1],[18,4],[15,2],[15,1]],performAction:c(function(s,n,a,o,u,e,B){var l=e.length-1;switch(u){case 6:case 7:return o;case 8:o.getLogger().trace("Stop NL ");break;case 9:o.getLogger().trace("Stop EOF ");break;case 11:o.getLogger().trace("Stop NL2 ");break;case 12:o.getLogger().trace("Stop EOF2 ");break;case 15:o.getLogger().info("Node: ",e[l-1].id),o.addNode(e[l-2].length,e[l-1].id,e[l-1].descr,e[l-1].type,e[l]);break;case 16:o.getLogger().info("Node: ",e[l].id),o.addNode(e[l-1].length,e[l].id,e[l].descr,e[l].type);break;case 17:o.getLogger().trace("Icon: ",e[l]),o.decorateNode({icon:e[l]});break;case 18:case 23:o.decorateNode({class:e[l]});break;case 19:o.getLogger().trace("SPACELIST");break;case 20:o.getLogger().trace("Node: ",e[l-1].id),o.addNode(0,e[l-1].id,e[l-1].descr,e[l-1].type,e[l]);break;case 21:o.getLogger().trace("Node: ",e[l].id),o.addNode(0,e[l].id,e[l].descr,e[l].type);break;case 22:o.decorateNode({icon:e[l]});break;case 27:o.getLogger().trace("node found ..",e[l-2]),this.$={id:e[l-1],descr:e[l-1],type:o.getType(e[l-2],e[l])};break;case 28:this.$={id:e[l],descr:e[l],type:0};break;case 29:o.getLogger().trace("node found ..",e[l-3]),this.$={id:e[l-3],descr:e[l-1],type:o.getType(e[l-2],e[l])};break;case 30:this.$=e[l-1]+e[l];break;case 31:this.$=e[l];break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:g},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:g},{6:d,7:[1,10],9:9,12:11,13:r,14:14,16:p,17:E,18:17,19:18,20:f,23:h},t(L,[2,3]),{1:[2,2]},t(L,[2,4]),t(L,[2,5]),{1:[2,6],6:d,12:21,13:r,14:14,16:p,17:E,18:17,19:18,20:f,23:h},{6:d,9:22,12:11,13:r,14:14,16:p,17:E,18:17,19:18,20:f,23:h},{6:C,7:w,10:23,11:N},t(i,[2,24],{18:17,19:18,14:27,16:[1,28],17:[1,29],20:f,23:h}),t(i,[2,19]),t(i,[2,21],{15:30,24:H}),t(i,[2,22]),t(i,[2,23]),t(x,[2,25]),t(x,[2,26]),t(x,[2,28],{20:[1,32]}),{21:[1,33]},{6:C,7:w,10:34,11:N},{1:[2,7],6:d,12:21,13:r,14:14,16:p,17:E,18:17,19:18,20:f,23:h},t(P,[2,14],{7:M,11:U}),t(A,[2,8]),t(A,[2,9]),t(A,[2,10]),t(i,[2,16],{15:37,24:H}),t(i,[2,17]),t(i,[2,18]),t(i,[2,20],{24:j}),t(x,[2,31]),{21:[1,39]},{22:[1,40]},t(P,[2,13],{7:M,11:U}),t(A,[2,11]),t(A,[2,12]),t(i,[2,15],{24:j}),t(x,[2,30]),{22:[1,41]},t(x,[2,27]),t(x,[2,29])],defaultActions:{2:[2,1],6:[2,2]},parseError:c(function(s,n){if(n.recoverable)this.trace(s);else{var a=new Error(s);throw a.hash=n,a}},"parseError"),parse:c(function(s){var n=this,a=[0],o=[],u=[null],e=[],B=this.table,l="",z=0,ie=0,ue=2,re=1,ge=e.slice.call(arguments,1),b=Object.create(this.lexer),T={yy:{}};for(var J in this.yy)Object.prototype.hasOwnProperty.call(this.yy,J)&&(T.yy[J]=this.yy[J]);b.setInput(s,T.yy),T.yy.lexer=b,T.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var q=b.yylloc;e.push(q);var de=b.options&&b.options.ranges;typeof T.yy.parseError=="function"?this.parseError=T.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pe(S){a.length=a.length-2*S,u.length=u.length-S,e.length=e.length-S}c(pe,"popStack");function ae(){var S;return S=o.pop()||b.lex()||re,typeof S!="number"&&(S instanceof Array&&(o=S,S=o.pop()),S=n.symbols_[S]||S),S}c(ae,"lex");for(var k,R,v,Q,F={},X,I,oe,Y;;){if(R=a[a.length-1],this.defaultActions[R]?v=this.defaultActions[R]:((k===null||typeof k>"u")&&(k=ae()),v=B[R]&&B[R][k]),typeof v>"u"||!v.length||!v[0]){var Z="";Y=[];for(X in B[R])this.terminals_[X]&&X>ue&&Y.push("'"+this.terminals_[X]+"'");b.showPosition?Z="Parse error on line "+(z+1)+`:
2
2
  `+b.showPosition()+`
3
3
  Expecting `+Y.join(", ")+", got '"+(this.terminals_[k]||k)+"'":Z="Parse error on line "+(z+1)+": Unexpected "+(k==re?"end of input":"'"+(this.terminals_[k]||k)+"'"),this.parseError(Z,{text:b.match,token:this.terminals_[k]||k,line:b.yylineno,loc:q,expected:Y})}if(v[0]instanceof Array&&v.length>1)throw new Error("Parse Error: multiple actions possible at state: "+R+", token: "+k);switch(v[0]){case 1:a.push(k),u.push(b.yytext),e.push(b.yylloc),a.push(v[1]),k=null,ie=b.yyleng,l=b.yytext,z=b.yylineno,q=b.yylloc;break;case 2:if(I=this.productions_[v[1]][1],F.$=u[u.length-I],F._$={first_line:e[e.length-(I||1)].first_line,last_line:e[e.length-1].last_line,first_column:e[e.length-(I||1)].first_column,last_column:e[e.length-1].last_column},de&&(F._$.range=[e[e.length-(I||1)].range[0],e[e.length-1].range[1]]),Q=this.performAction.apply(F,[l,ie,z,T.yy,v[1],u,e].concat(ge)),typeof Q<"u")return Q;I&&(a=a.slice(0,-1*I*2),u=u.slice(0,-1*I),e=e.slice(0,-1*I)),a.push(this.productions_[v[1]][0]),u.push(F.$),e.push(F._$),oe=B[a[a.length-2]][a[a.length-1]],a.push(oe);break;case 3:return!0}}return!0},"parse")},m=(function(){var _={EOF:1,parseError:c(function(n,a){if(this.yy.parser)this.yy.parser.parseError(n,a);else throw new Error(n)},"parseError"),setInput:c(function(s,n){return this.yy=n||this.yy||{},this._input=s,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:c(function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var n=s.match(/(?:\r\n?|\n).*/g);return n?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:c(function(s){var n=s.length,a=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var o=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),a.length-1&&(this.yylineno-=a.length-1);var u=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:a?(a.length===o.length?this.yylloc.first_column:0)+o[o.length-a.length].length-a[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[u[0],u[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},"unput"),more:c(function(){return this._more=!0,this},"more"),reject:c(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:c(function(s){this.unput(this.match.slice(s))},"less"),pastInput:c(function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:c(function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:c(function(){var s=this.pastInput(),n=new Array(s.length+1).join("-");return s+this.upcomingInput()+`