@marimo-team/frontend 0.9.18-dev9 → 0.9.19-dev2

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 (88) hide show
  1. package/dist/assets/{ConnectedDataExplorerComponent-ZTeYnZhB.js → ConnectedDataExplorerComponent-Bc8AHuDm.js} +1 -1
  2. package/dist/assets/{VegaLite-IluBr0p0.js → VegaLite-ZmFZfuW3.js} +1 -1
  3. package/dist/assets/__vite-browser-external-CIEyP2s7.js +1 -0
  4. package/dist/assets/{_baseEach-BOJ7rr2z.js → _baseEach-DTcXD_X7.js} +1 -1
  5. package/dist/assets/_baseMap-NIKNRZKO.js +1 -0
  6. package/dist/assets/{_baseUniq-Da35M4Ot.js → _baseUniq-DwK7zQub.js} +1 -1
  7. package/dist/assets/{any-language-editor-Bbbh9ujK.js → any-language-editor-v44_mxkl.js} +1 -1
  8. package/dist/assets/{architectureDiagram-IFBEXTG3-B1eONMm-.js → architectureDiagram-IFBEXTG3-B8YT8SBu.js} +1 -1
  9. package/dist/assets/{blockDiagram-TCMKQVZ6-BpbXYLgk.js → blockDiagram-TCMKQVZ6-Be1HEhT5.js} +1 -1
  10. package/dist/assets/{c4Diagram-ZCSEYPFN-BKMTAdfA.js → c4Diagram-ZCSEYPFN-Bjb6qqFE.js} +1 -1
  11. package/dist/assets/channel-B55YuRKZ.js +1 -0
  12. package/dist/assets/{chunk-4LC2V6XN-D4kCS8j6.js → chunk-4LC2V6XN-DE7R_by4.js} +1 -1
  13. package/dist/assets/{chunk-5RIWM3LS-DS12e7Ja.js → chunk-5RIWM3LS-DN9pEskJ.js} +1 -1
  14. package/dist/assets/{chunk-6JKP7OK7-4YW4YieP.js → chunk-6JKP7OK7-BbibKGF_.js} +1 -1
  15. package/dist/assets/{chunk-NGC4727B-BRjQAEaF.js → chunk-NGC4727B-DfHQ7c3m.js} +1 -1
  16. package/dist/assets/{chunk-REEJFE46-BxFM3TYY.js → chunk-REEJFE46-BHSeJiGA.js} +1 -1
  17. package/dist/assets/{chunk-RYO7GUH3-CPaqUW9l.js → chunk-RYO7GUH3-C0_EGWV3.js} +1 -1
  18. package/dist/assets/{chunk-V35ELUW5-c2PThOse.js → chunk-V35ELUW5-BhPOaRtF.js} +1 -1
  19. package/dist/assets/{classDiagram-Q73GJZWF-BOXErcur.js → classDiagram-Q73GJZWF-C2v6Kant.js} +1 -1
  20. package/dist/assets/{classDiagram-v2-C6QPLPW4-Cx2_bb6w.js → classDiagram-v2-C6QPLPW4-e0D-QYQq.js} +1 -1
  21. package/dist/assets/clone-DQ7ClcFU.js +1 -0
  22. package/dist/assets/{dagre-7KT5K2WU-Cw6q2K10.js → dagre-7KT5K2WU-B-qBNSBc.js} +1 -1
  23. package/dist/assets/{data-editor-C1laN8VB.js → data-editor-DFFwBU-K.js} +1 -1
  24. package/dist/assets/{diagram-AVGMFHF7-CvL9AeMs.js → diagram-AVGMFHF7-KogILpT2.js} +1 -1
  25. package/dist/assets/{edit-page-BUF6Pcqz.js → edit-page-BLY4BLCu.js} +3 -3
  26. package/dist/assets/{erDiagram-DKC2X5TE-CWu1FsyX.js → erDiagram-DKC2X5TE-CqKrFCrL.js} +1 -1
  27. package/dist/assets/{flowDiagram-NWEUNK3L-BYg9FXpZ.js → flowDiagram-NWEUNK3L-BVYAWurv.js} +1 -1
  28. package/dist/assets/{ganttDiagram-HLVPPPRE-CLzHU7Ew.js → ganttDiagram-HLVPPPRE-Dxb363Rs.js} +1 -1
  29. package/dist/assets/{gitGraph-YCYPL57B-BVcf3MJN.js → gitGraph-YCYPL57B-3oTX8d6C.js} +1 -1
  30. package/dist/assets/{gitGraphDiagram-JPZ3KUXI-P6y89FyT.js → gitGraphDiagram-JPZ3KUXI-DdQKS6wC.js} +1 -1
  31. package/dist/assets/{graph-CTr8fmHD.js → graph-DBjNSawr.js} +1 -1
  32. package/dist/assets/{home-page-x8SC-AEM.js → home-page-CzvtxT1e.js} +1 -1
  33. package/dist/assets/{index-B-vZ6Qcg.js → index-3XwDgaf_.js} +1 -1
  34. package/dist/assets/{index-g6NwUTpV.js → index-BPGUNMqy.js} +1 -1
  35. package/dist/assets/{index-Rrwl4RC2.js → index-BUImB5D2.js} +1 -1
  36. package/dist/assets/{index-CtOfOzW2.js → index-BeK6ojNI.js} +1 -1
  37. package/dist/assets/{index-BCaDr8sq.js → index-BuRqbISd.js} +1 -1
  38. package/dist/assets/{index-4NE4TUfK.js → index-C5SEtl2H.js} +1 -1
  39. package/dist/assets/{index-CpPRvJ8u.js → index-CM699Mwa.js} +1 -1
  40. package/dist/assets/{index-x8gnePyn.js → index-COFkaLyr.js} +1 -1
  41. package/dist/assets/{index-cLsZznd0.js → index-CTtphYGZ.js} +1 -1
  42. package/dist/assets/{index-C3cJ6m14.js → index-CmxbSn-N.js} +1 -1
  43. package/dist/assets/{index-tmZmhbUF.js → index-DAgH92B_.js} +1 -1
  44. package/dist/assets/{index-Clx5QXsl.js → index-DtLE43hO.js} +1 -1
  45. package/dist/assets/{index-Av8By3Vq.js → index-MxC05mbH.js} +1 -1
  46. package/dist/assets/{index-BmjDRuG-.js → index-OMxDKVEg.js} +1 -1
  47. package/dist/assets/{index-BhC7C3ji.js → index-caWJxDzU.js} +1 -1
  48. package/dist/assets/{index-BqW-O5_5.js → index-fzo3l-ON.js} +1 -1
  49. package/dist/assets/{index-smzK0Z-Y.js → index-tlGs-LVf.js} +4 -4
  50. package/dist/assets/{infoDiagram-RZZSJVI2-Bs2GmHdo.js → infoDiagram-RZZSJVI2-D5Fna88O.js} +1 -1
  51. package/dist/assets/{journeyDiagram-BLD6N6MZ-CL5THg0T.js → journeyDiagram-BLD6N6MZ-ZxNIFq28.js} +1 -1
  52. package/dist/assets/{json-BDaO8uff.js → json-ghByTh9I.js} +1 -1
  53. package/dist/assets/{layout-IvWkkQiv.js → layout-DJgfLwuB.js} +1 -1
  54. package/dist/assets/{linear-DYe2SjHl.js → linear-BChN-NOb.js} +1 -1
  55. package/dist/assets/{mermaid-CrKddFRb.js → mermaid-CI5euVIA.js} +3 -3
  56. package/dist/assets/{min-BksYOAAE.js → min-CdVK8-FH.js} +1 -1
  57. package/dist/assets/{mindmap-definition-OEB2RXX2-CuxJvPxZ.js → mindmap-definition-OEB2RXX2-Dv-1tHpA.js} +1 -1
  58. package/dist/assets/{pieDiagram-X7YZ5ZEZ-Cc3EtSTT.js → pieDiagram-X7YZ5ZEZ-D_EMmRx2.js} +1 -1
  59. package/dist/assets/{quadrantDiagram-F36EZAVT-DfV2phao.js → quadrantDiagram-F36EZAVT-BGAe3apB.js} +1 -1
  60. package/dist/assets/{react-plotly-DezLJMw0.js → react-plotly-wznl6u2W.js} +1 -1
  61. package/dist/assets/{requirementDiagram-JG2LMPGF-qRmdy3mz.js → requirementDiagram-JG2LMPGF-D3tMwpbs.js} +1 -1
  62. package/dist/assets/{run-page-Bd1Gbne_.js → run-page-CxE1OUSo.js} +1 -1
  63. package/dist/assets/{sankeyDiagram-ATFNWWW6-D5Na1fCR.js → sankeyDiagram-ATFNWWW6-CMD3rOfG.js} +1 -1
  64. package/dist/assets/save-worker-YNsgmLVY.js +1 -0
  65. package/dist/assets/{sequenceDiagram-WK7YDQ3N-CZK3gaW4.js → sequenceDiagram-WK7YDQ3N-pKJJAC_Z.js} +1 -1
  66. package/dist/assets/{slides-component-BAOBXZYZ.js → slides-component-CqvWAfxs.js} +1 -1
  67. package/dist/assets/{sortBy-FLjdmHpR.js → sortBy-CFW87wey.js} +1 -1
  68. package/dist/assets/{stateDiagram-4JV6CC6H-C6qfHJ3s.js → stateDiagram-4JV6CC6H-Bf1nrQU1.js} +1 -1
  69. package/dist/assets/stateDiagram-v2-7KT6RKTD-DHNUJAb5.js +1 -0
  70. package/dist/assets/{terminal-Df50lxD3.js → terminal-CXgRf3-u.js} +1 -1
  71. package/dist/assets/{time-Dh3-rksV.js → time-eYMTO1dB.js} +1 -1
  72. package/dist/assets/{timeline-definition-3ZMEY6HS-Bk2B_NwR.js → timeline-definition-3ZMEY6HS-DYDVrsuZ.js} +1 -1
  73. package/dist/assets/{transform-CaCRavvA.js → transform-CwWHZB4y.js} +1 -1
  74. package/dist/assets/{tree-C-aoWkvl.js → tree-UufBwD4a.js} +1 -1
  75. package/dist/assets/{useMarimoWebSocket-RLB8CYwc.js → useMarimoWebSocket-DBvdo__r.js} +3 -3
  76. package/dist/assets/{vega-component-CSmMnBPm.js → vega-component-hyI5VlSf.js} +1 -1
  77. package/dist/assets/worker-DWEzam7I.js +1 -0
  78. package/dist/assets/worker-P6zQAE9_.js +1 -0
  79. package/dist/assets/{xychartDiagram-KECQ2H5Q-DoZoRcNO.js → xychartDiagram-KECQ2H5Q-Cv-CYOE5.js} +1 -1
  80. package/dist/index.html +1 -1
  81. package/package.json +1 -1
  82. package/dist/assets/_baseMap-BrMUQBgb.js +0 -1
  83. package/dist/assets/channel-Cbjx4FBL.js +0 -1
  84. package/dist/assets/clone-BVBe7VA3.js +0 -1
  85. package/dist/assets/save-worker-BsXz6Pdg.js +0 -1
  86. package/dist/assets/stateDiagram-v2-7KT6RKTD-CEVkzzPp.js +0 -1
  87. package/dist/assets/worker--4VCqOSN.js +0 -1
  88. package/dist/assets/worker--sgb-8qZ.js +0 -1
@@ -1 +1 @@
1
- var t,i,e,s,n,a,o,h,r,l;import{_ as c,aj as g,l as u,I as x,D as d,B as p,A as f,i as m,q as y,s as b,g as A,p as S,b as w,c as C,t as k,G as _,j as T}from"./mermaid-CrKddFRb.js";import"./transform-CaCRavvA.js";import{i as R}from"./init-DLRA0X12.js";import{o as D}from"./ordinal-DDUp3AbE.js";import{r as L}from"./range-CtcPcB_L.js";import{l as P}from"./linear-DYe2SjHl.js";import{l as v}from"./step-CNn2V7Th.js";import"./index-smzK0Z-Y.js";import"./timer-CK-RIWfW.js";function E(){var t,i,e=D().unknown(void 0),s=e.domain,n=e.range,a=0,o=1,h=!1,r=0,l=0,c=.5;function g(){var e=s().length,g=o<a,u=g?o:a,x=g?a:o;t=(x-u)/Math.max(1,e-r+2*l),h&&(t=Math.floor(t)),u+=(x-u-t*(e-r))*c,i=t*(1-r),h&&(u=Math.round(u),i=Math.round(i));var d=L(e).map((function(i){return u+t*i}));return n(g?d.reverse():d)}return delete e.unknown,e.domain=function(t){return arguments.length?(s(t),g()):s()},e.range=function(t){return arguments.length?([a,o]=t,a=+a,o=+o,g()):[a,o]},e.rangeRound=function(t){return[a,o]=t,a=+a,o=+o,h=!0,g()},e.bandwidth=function(){return i},e.step=function(){return t},e.round=function(t){return arguments.length?(h=!!t,g()):h},e.padding=function(t){return arguments.length?(r=Math.min(1,l=+t),g()):r},e.paddingInner=function(t){return arguments.length?(r=Math.min(1,t),g()):r},e.paddingOuter=function(t){return arguments.length?(l=+t,g()):l},e.align=function(t){return arguments.length?(c=Math.max(0,Math.min(1,t)),g()):c},e.copy=function(){return E(s(),[a,o]).round(h).paddingInner(r).paddingOuter(l).align(c)},R.apply(g(),arguments)}var M=function(){var t=c((function(t,i,e,s){for(e=e||{},s=t.length;s--;e[t[s]]=i);return e}),"o"),i=[1,10,12,14,16,18,19,21,23],e=[2,6],s=[1,3],n=[1,5],a=[1,6],o=[1,7],h=[1,5,10,12,14,16,18,19,21,23,34,35,36],r=[1,25],l=[1,26],g=[1,28],u=[1,29],x=[1,30],d=[1,31],p=[1,32],f=[1,33],m=[1,34],y=[1,35],b=[1,36],A=[1,37],S=[1,43],w=[1,42],C=[1,47],k=[1,50],_=[1,10,12,14,16,18,19,21,23,34,35,36],T=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36],R=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36,41,42,43,44,45,46,47,48,49,50],D=[1,64],L={trace:c((function(){}),"trace"),yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,commaSeparatedNumbers:25,SQUARE_BRACES_END:26,NUMBER_WITH_DECIMAL:27,COMMA:28,xAxisData:29,bandData:30,ARROW_DELIMITER:31,commaSeparatedTexts:32,yAxisData:33,NEWLINE:34,SEMI:35,EOF:36,alphaNum:37,STR:38,MD_STR:39,alphaNumToken:40,AMP:41,NUM:42,ALPHA:43,PLUS:44,EQUALS:45,MULT:46,DOT:47,BRKT:48,MINUS:49,UNDERSCORE:50,$accept:0,$end:1},terminals_:{2:"error",5:"XYCHART",8:"CHART_ORIENTATION",10:"title",12:"X_AXIS",14:"Y_AXIS",16:"LINE",18:"BAR",19:"acc_title",20:"acc_title_value",21:"acc_descr",22:"acc_descr_value",23:"acc_descr_multiline_value",24:"SQUARE_BRACES_START",26:"SQUARE_BRACES_END",27:"NUMBER_WITH_DECIMAL",28:"COMMA",31:"ARROW_DELIMITER",34:"NEWLINE",35:"SEMI",36:"EOF",38:"STR",39:"MD_STR",41:"AMP",42:"NUM",43:"ALPHA",44:"PLUS",45:"EQUALS",46:"MULT",47:"DOT",48:"BRKT",49:"MINUS",50:"UNDERSCORE"},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[13,1],[13,2],[13,1],[29,1],[29,3],[30,3],[32,3],[32,1],[15,1],[15,2],[15,1],[33,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[37,1],[37,2],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1]],performAction:c((function(t,i,e,s,n,a,o){var h=a.length-1;switch(n){case 5:s.setOrientation(a[h]);break;case 9:s.setDiagramTitle(a[h].text.trim());break;case 12:s.setLineData({text:"",type:"text"},a[h]);break;case 13:s.setLineData(a[h-1],a[h]);break;case 14:s.setBarData({text:"",type:"text"},a[h]);break;case 15:s.setBarData(a[h-1],a[h]);break;case 16:this.$=a[h].trim(),s.setAccTitle(this.$);break;case 17:case 18:this.$=a[h].trim(),s.setAccDescription(this.$);break;case 19:case 27:this.$=a[h-1];break;case 20:this.$=[Number(a[h-2]),...a[h]];break;case 21:this.$=[Number(a[h])];break;case 22:s.setXAxisTitle(a[h]);break;case 23:s.setXAxisTitle(a[h-1]);break;case 24:s.setXAxisTitle({type:"text",text:""});break;case 25:s.setXAxisBand(a[h]);break;case 26:s.setXAxisRangeData(Number(a[h-2]),Number(a[h]));break;case 28:this.$=[a[h-2],...a[h]];break;case 29:this.$=[a[h]];break;case 30:s.setYAxisTitle(a[h]);break;case 31:s.setYAxisTitle(a[h-1]);break;case 32:s.setYAxisTitle({type:"text",text:""});break;case 33:s.setYAxisRangeData(Number(a[h-2]),Number(a[h]));break;case 37:case 38:this.$={text:a[h],type:"text"};break;case 39:this.$={text:a[h],type:"markdown"};break;case 40:this.$=a[h];break;case 41:this.$=a[h-1]+""+a[h]}}),"anonymous"),table:[t(i,e,{3:1,4:2,7:4,5:s,34:n,35:a,36:o}),{1:[3]},t(i,e,{4:2,7:4,3:8,5:s,34:n,35:a,36:o}),t(i,e,{4:2,7:4,6:9,3:10,5:s,8:[1,11],34:n,35:a,36:o}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},t(h,[2,34]),t(h,[2,35]),t(h,[2,36]),{1:[2,1]},t(i,e,{4:2,7:4,3:21,5:s,34:n,35:a,36:o}),{1:[2,3]},t(h,[2,5]),t(i,[2,7],{4:22,34:n,35:a,36:o}),{11:23,37:24,38:r,39:l,40:27,41:g,42:u,43:x,44:d,45:p,46:f,47:m,48:y,49:b,50:A},{11:39,13:38,24:S,27:w,29:40,30:41,37:24,38:r,39:l,40:27,41:g,42:u,43:x,44:d,45:p,46:f,47:m,48:y,49:b,50:A},{11:45,15:44,27:C,33:46,37:24,38:r,39:l,40:27,41:g,42:u,43:x,44:d,45:p,46:f,47:m,48:y,49:b,50:A},{11:49,17:48,24:k,37:24,38:r,39:l,40:27,41:g,42:u,43:x,44:d,45:p,46:f,47:m,48:y,49:b,50:A},{11:52,17:51,24:k,37:24,38:r,39:l,40:27,41:g,42:u,43:x,44:d,45:p,46:f,47:m,48:y,49:b,50:A},{20:[1,53]},{22:[1,54]},t(_,[2,18]),{1:[2,2]},t(_,[2,8]),t(_,[2,9]),t(T,[2,37],{40:55,41:g,42:u,43:x,44:d,45:p,46:f,47:m,48:y,49:b,50:A}),t(T,[2,38]),t(T,[2,39]),t(R,[2,40]),t(R,[2,42]),t(R,[2,43]),t(R,[2,44]),t(R,[2,45]),t(R,[2,46]),t(R,[2,47]),t(R,[2,48]),t(R,[2,49]),t(R,[2,50]),t(R,[2,51]),t(_,[2,10]),t(_,[2,22],{30:41,29:56,24:S,27:w}),t(_,[2,24]),t(_,[2,25]),{31:[1,57]},{11:59,32:58,37:24,38:r,39:l,40:27,41:g,42:u,43:x,44:d,45:p,46:f,47:m,48:y,49:b,50:A},t(_,[2,11]),t(_,[2,30],{33:60,27:C}),t(_,[2,32]),{31:[1,61]},t(_,[2,12]),{17:62,24:k},{25:63,27:D},t(_,[2,14]),{17:65,24:k},t(_,[2,16]),t(_,[2,17]),t(R,[2,41]),t(_,[2,23]),{27:[1,66]},{26:[1,67]},{26:[2,29],28:[1,68]},t(_,[2,31]),{27:[1,69]},t(_,[2,13]),{26:[1,70]},{26:[2,21],28:[1,71]},t(_,[2,15]),t(_,[2,26]),t(_,[2,27]),{11:59,32:72,37:24,38:r,39:l,40:27,41:g,42:u,43:x,44:d,45:p,46:f,47:m,48:y,49:b,50:A},t(_,[2,33]),t(_,[2,19]),{25:73,27:D},{26:[2,28]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],72:[2,28],73:[2,20]},parseError:c((function(t,i){if(!i.recoverable){var e=new Error(t);throw e.hash=i,e}this.trace(t)}),"parseError"),parse:c((function(t){var i=this,e=[0],s=[],n=[null],a=[],o=this.table,h="",r=0,l=0,g=a.slice.call(arguments,1),u=Object.create(this.lexer),x={yy:{}};for(var d in this.yy)Object.prototype.hasOwnProperty.call(this.yy,d)&&(x.yy[d]=this.yy[d]);u.setInput(t,x.yy),x.yy.lexer=u,x.yy.parser=this,void 0===u.yylloc&&(u.yylloc={});var p=u.yylloc;a.push(p);var f=u.options&&u.options.ranges;function m(){var t;return"number"!=typeof(t=s.pop()||u.lex()||1)&&(t instanceof Array&&(t=(s=t).pop()),t=i.symbols_[t]||t),t}"function"==typeof x.yy.parseError?this.parseError=x.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,c((function(t){e.length=e.length-2*t,n.length=n.length-t,a.length=a.length-t}),"popStack"),c(m,"lex");for(var y,b,A,S,w,C,k,_,T={};;){if(b=e[e.length-1],this.defaultActions[b]?A=this.defaultActions[b]:(null==y&&(y=m()),A=o[b]&&o[b][y]),void 0===A||!A.length||!A[0]){var R="";for(w in _=[],o[b])this.terminals_[w]&&w>2&&_.push("'"+this.terminals_[w]+"'");R=u.showPosition?"Parse error on line "+(r+1)+":\n"+u.showPosition()+"\nExpecting "+_.join(", ")+", got '"+(this.terminals_[y]||y)+"'":"Parse error on line "+(r+1)+": Unexpected "+(1==y?"end of input":"'"+(this.terminals_[y]||y)+"'"),this.parseError(R,{text:u.match,token:this.terminals_[y]||y,line:u.yylineno,loc:p,expected:_})}if(A[0]instanceof Array&&A.length>1)throw new Error("Parse Error: multiple actions possible at state: "+b+", token: "+y);switch(A[0]){case 1:e.push(y),n.push(u.yytext),a.push(u.yylloc),e.push(A[1]),y=null,l=u.yyleng,h=u.yytext,r=u.yylineno,p=u.yylloc;break;case 2:if(C=this.productions_[A[1]][1],T.$=n[n.length-C],T._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},f&&(T._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(S=this.performAction.apply(T,[h,l,r,x.yy,A[1],n,a].concat(g))))return S;C&&(e=e.slice(0,-1*C*2),n=n.slice(0,-1*C),a=a.slice(0,-1*C)),e.push(this.productions_[A[1]][0]),n.push(T.$),a.push(T._$),k=o[e[e.length-2]][e[e.length-1]],e.push(k);break;case 3:return!0}}return!0}),"parse")},P=function(){return{EOF:1,parseError:c((function(t,i){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,i)}),"parseError"),setInput:c((function(t,i){return this.yy=i||this.yy||{},this._input=t,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 t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t}),"input"),unput:c((function(t){var i=t.length,e=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-i),this.offset-=i;var s=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),e.length-1&&(this.yylineno-=e.length-1);var n=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:e?(e.length===s.length?this.yylloc.first_column:0)+s[s.length-e.length].length-e[0].length:this.yylloc.first_column-i},this.options.ranges&&(this.yylloc.range=[n[0],n[0]+this.yyleng-i]),this.yyleng=this.yytext.length,this}),"unput"),more:c((function(){return this._more=!0,this}),"more"),reject:c((function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):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).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}),"reject"),less:c((function(t){this.unput(this.match.slice(t))}),"less"),pastInput:c((function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")}),"pastInput"),upcomingInput:c((function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")}),"upcomingInput"),showPosition:c((function(){var t=this.pastInput(),i=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+i+"^"}),"showPosition"),test_match:c((function(t,i){var e,s,n;if(this.options.backtrack_lexer&&(n={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(n.yylloc.range=this.yylloc.range.slice(0))),(s=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=s.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:s?s[s.length-1].length-s[s.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],e=this.performAction.call(this,this.yy,this,i,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),e)return e;if(this._backtrack){for(var a in n)this[a]=n[a];return!1}return!1}),"test_match"),next:c((function(){if(this.done)return this.EOF;var t,i,e,s;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var n=this._currentRules(),a=0;a<n.length;a++)if((e=this._input.match(this.rules[n[a]]))&&(!i||e[0].length>i[0].length)){if(i=e,s=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(e,n[a])))return t;if(this._backtrack){i=!1;continue}return!1}if(!this.options.flex)break}return i?!1!==(t=this.test_match(i,n[s]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}),"next"),lex:c((function(){var t=this.next();return t||this.lex()}),"lex"),begin:c((function(t){this.conditionStack.push(t)}),"begin"),popState:c((function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]}),"popState"),_currentRules:c((function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules}),"_currentRules"),topState:c((function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"}),"topState"),pushState:c((function(t){this.begin(t)}),"pushState"),stateStackSize:c((function(){return this.conditionStack.length}),"stateStackSize"),options:{"case-insensitive":!0},performAction:c((function(t,i,e,s){switch(e){case 0:case 1:case 5:case 43:break;case 2:case 3:return this.popState(),34;case 4:return 34;case 6:return 10;case 7:return this.pushState("acc_title"),19;case 8:return this.popState(),"acc_title_value";case 9:return this.pushState("acc_descr"),21;case 10:return this.popState(),"acc_descr_value";case 11:this.pushState("acc_descr_multiline");break;case 12:case 25:case 27:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:return 5;case 15:return 8;case 16:return this.pushState("axis_data"),"X_AXIS";case 17:return this.pushState("axis_data"),"Y_AXIS";case 18:return this.pushState("axis_band_data"),24;case 19:return 31;case 20:return this.pushState("data"),16;case 21:return this.pushState("data"),18;case 22:return this.pushState("data_inner"),24;case 23:return 27;case 24:return this.popState(),26;case 26:this.pushState("string");break;case 28:return"STR";case 29:return 24;case 30:return 26;case 31:return 43;case 32:return"COLON";case 33:return 44;case 34:return 28;case 35:return 45;case 36:return 46;case 37:return 48;case 38:return 50;case 39:return 47;case 40:return 41;case 41:return 49;case 42:return 42;case 44:return 35;case 45:return 36}}),"anonymous"),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:(\r?\n))/i,/^(?:(\r?\n))/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:title\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:\{)/i,/^(?:[^\}]*)/i,/^(?:xychart-beta\b)/i,/^(?:(?:vertical|horizontal))/i,/^(?:x-axis\b)/i,/^(?:y-axis\b)/i,/^(?:\[)/i,/^(?:-->)/i,/^(?:line\b)/i,/^(?:bar\b)/i,/^(?:\[)/i,/^(?:[+-]?(?:\d+(?:\.\d+)?|\.\d+))/i,/^(?:\])/i,/^(?:(?:`\) \{ this\.pushState\(md_string\); \}\n<md_string>\(\?:\(\?!`"\)\.\)\+ \{ return MD_STR; \}\n<md_string>\(\?:`))/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:[A-Za-z]+)/i,/^(?::)/i,/^(?:\+)/i,/^(?:,)/i,/^(?:=)/i,/^(?:\*)/i,/^(?:#)/i,/^(?:[\_])/i,/^(?:\.)/i,/^(?:&)/i,/^(?:-)/i,/^(?:[0-9]+)/i,/^(?:\s+)/i,/^(?:;)/i,/^(?:$)/i],conditions:{data_inner:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,20,21,23,24,25,26,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],inclusive:!0},data:{rules:[0,1,3,4,5,6,7,9,11,14,15,16,17,20,21,22,25,26,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],inclusive:!0},axis_band_data:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,20,21,24,25,26,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],inclusive:!0},axis_data:{rules:[0,1,2,4,5,6,7,9,11,14,15,16,17,18,19,20,21,23,25,26,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],inclusive:!0},acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},title:{rules:[],inclusive:!1},md_string:{rules:[],inclusive:!1},string:{rules:[27,28],inclusive:!1},INITIAL:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,20,21,25,26,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],inclusive:!0}}}}();function v(){this.yy={}}return L.lexer=P,c(v,"Parser"),v.prototype=L,L.Parser=v,new v}();M.parser=M;var I=M;function $(t){return"bar"===t.type}function B(t){return"band"===t.type}function z(t){return"linear"===t.type}c($,"isBarPlot"),c(B,"isBandAxisData"),c(z,"isLinearAxisData");var O=(c(t=class{constructor(t){this.parentGroup=t}getMaxDimension(t,i){if(!this.parentGroup)return{width:t.reduce(((t,i)=>Math.max(i.length,t)),0)*i,height:i};const e={width:0,height:0},s=this.parentGroup.append("g").attr("visibility","hidden").attr("font-size",i);for(const n of t){const t=g(s,1,n),a=t?t.width:n.length*i,o=t?t.height:i;e.width=Math.max(e.width,a),e.height=Math.max(e.height,o)}return s.remove(),e}},"TextDimensionCalculatorWithFont"),t),W=(c(i=class{constructor(t,i,e,s){this.axisConfig=t,this.title=i,this.textDimensionCalculator=e,this.axisThemeConfig=s,this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition="left",this.showTitle=!1,this.showLabel=!1,this.showTick=!1,this.showAxisLine=!1,this.outerPadding=0,this.titleTextHeight=0,this.labelTextHeight=0,this.range=[0,10],this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition="left"}setRange(t){this.range=t,"left"===this.axisPosition||"right"===this.axisPosition?this.boundingRect.height=t[1]-t[0]:this.boundingRect.width=t[1]-t[0],this.recalculateScale()}getRange(){return[this.range[0]+this.outerPadding,this.range[1]-this.outerPadding]}setAxisPosition(t){this.axisPosition=t,this.setRange(this.range)}getTickDistance(){const t=this.getRange();return Math.abs(t[0]-t[1])/this.getTickValues().length}getAxisOuterPadding(){return this.outerPadding}getLabelDimension(){return this.textDimensionCalculator.getMaxDimension(this.getTickValues().map((t=>t.toString())),this.axisConfig.labelFontSize)}recalculateOuterPaddingToDrawBar(){.7*this.getTickDistance()>2*this.outerPadding&&(this.outerPadding=Math.floor(.7*this.getTickDistance()/2)),this.recalculateScale()}calculateSpaceIfDrawnHorizontally(t){let i=t.height;if(this.axisConfig.showAxisLine&&i>this.axisConfig.axisLineWidth&&(i-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){const e=this.getLabelDimension(),s=.2*t.width;this.outerPadding=Math.min(e.width/2,s);const n=e.height+2*this.axisConfig.labelPadding;this.labelTextHeight=e.height,n<=i&&(i-=n,this.showLabel=!0)}if(this.axisConfig.showTick&&i>=this.axisConfig.tickLength&&(this.showTick=!0,i-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){const t=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),e=t.height+2*this.axisConfig.titlePadding;this.titleTextHeight=t.height,e<=i&&(i-=e,this.showTitle=!0)}this.boundingRect.width=t.width,this.boundingRect.height=t.height-i}calculateSpaceIfDrawnVertical(t){let i=t.width;if(this.axisConfig.showAxisLine&&i>this.axisConfig.axisLineWidth&&(i-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){const e=this.getLabelDimension(),s=.2*t.height;this.outerPadding=Math.min(e.height/2,s);const n=e.width+2*this.axisConfig.labelPadding;n<=i&&(i-=n,this.showLabel=!0)}if(this.axisConfig.showTick&&i>=this.axisConfig.tickLength&&(this.showTick=!0,i-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){const t=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),e=t.height+2*this.axisConfig.titlePadding;this.titleTextHeight=t.height,e<=i&&(i-=e,this.showTitle=!0)}this.boundingRect.width=t.width-i,this.boundingRect.height=t.height}calculateSpace(t){return"left"===this.axisPosition||"right"===this.axisPosition?this.calculateSpaceIfDrawnVertical(t):this.calculateSpaceIfDrawnHorizontally(t),this.recalculateScale(),{width:this.boundingRect.width,height:this.boundingRect.height}}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}getDrawableElementsForLeftAxis(){const t=[];if(this.showAxisLine){const i=this.boundingRect.x+this.boundingRect.width-this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["left-axis","axisl-line"],data:[{path:`M ${i},${this.boundingRect.y} L ${i},${this.boundingRect.y+this.boundingRect.height} `,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["left-axis","label"],data:this.getTickValues().map((t=>({text:t.toString(),x:this.boundingRect.x+this.boundingRect.width-(this.showLabel?this.axisConfig.labelPadding:0)-(this.showTick?this.axisConfig.tickLength:0)-(this.showAxisLine?this.axisConfig.axisLineWidth:0),y:this.getScaleValue(t),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"middle",horizontalPos:"right"})))}),this.showTick){const i=this.boundingRect.x+this.boundingRect.width-(this.showAxisLine?this.axisConfig.axisLineWidth:0);t.push({type:"path",groupTexts:["left-axis","ticks"],data:this.getTickValues().map((t=>({path:`M ${i},${this.getScaleValue(t)} L ${i-this.axisConfig.tickLength},${this.getScaleValue(t)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth})))})}return this.showTitle&&t.push({type:"text",groupTexts:["left-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.axisConfig.titlePadding,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:270,verticalPos:"top",horizontalPos:"center"}]}),t}getDrawableElementsForBottomAxis(){const t=[];if(this.showAxisLine){const i=this.boundingRect.y+this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["bottom-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${i} L ${this.boundingRect.x+this.boundingRect.width},${i}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["bottom-axis","label"],data:this.getTickValues().map((t=>({text:t.toString(),x:this.getScaleValue(t),y:this.boundingRect.y+this.axisConfig.labelPadding+(this.showTick?this.axisConfig.tickLength:0)+(this.showAxisLine?this.axisConfig.axisLineWidth:0),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"})))}),this.showTick){const i=this.boundingRect.y+(this.showAxisLine?this.axisConfig.axisLineWidth:0);t.push({type:"path",groupTexts:["bottom-axis","ticks"],data:this.getTickValues().map((t=>({path:`M ${this.getScaleValue(t)},${i} L ${this.getScaleValue(t)},${i+this.axisConfig.tickLength}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth})))})}return this.showTitle&&t.push({type:"text",groupTexts:["bottom-axis","title"],data:[{text:this.title,x:this.range[0]+(this.range[1]-this.range[0])/2,y:this.boundingRect.y+this.boundingRect.height-this.axisConfig.titlePadding-this.titleTextHeight,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]}),t}getDrawableElementsForTopAxis(){const t=[];if(this.showAxisLine){const i=this.boundingRect.y+this.boundingRect.height-this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["top-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${i} L ${this.boundingRect.x+this.boundingRect.width},${i}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["top-axis","label"],data:this.getTickValues().map((t=>({text:t.toString(),x:this.getScaleValue(t),y:this.boundingRect.y+(this.showTitle?this.titleTextHeight+2*this.axisConfig.titlePadding:0)+this.axisConfig.labelPadding,fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"})))}),this.showTick){const i=this.boundingRect.y;t.push({type:"path",groupTexts:["top-axis","ticks"],data:this.getTickValues().map((t=>({path:`M ${this.getScaleValue(t)},${i+this.boundingRect.height-(this.showAxisLine?this.axisConfig.axisLineWidth:0)} L ${this.getScaleValue(t)},${i+this.boundingRect.height-this.axisConfig.tickLength-(this.showAxisLine?this.axisConfig.axisLineWidth:0)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth})))})}return this.showTitle&&t.push({type:"text",groupTexts:["top-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.axisConfig.titlePadding,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]}),t}getDrawableElements(){if("left"===this.axisPosition)return this.getDrawableElementsForLeftAxis();if("right"===this.axisPosition)throw Error("Drawing of right axis is not implemented");return"bottom"===this.axisPosition?this.getDrawableElementsForBottomAxis():"top"===this.axisPosition?this.getDrawableElementsForTopAxis():[]}},"BaseAxis"),i),F=(c(e=class extends W{constructor(t,i,e,s,n){super(t,s,n,i),this.categories=e,this.scale=E().domain(this.categories).range(this.getRange())}setRange(t){super.setRange(t)}recalculateScale(){this.scale=E().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(.5),u.trace("BandAxis axis final categories, range: ",this.categories,this.getRange())}getTickValues(){return this.categories}getScaleValue(t){return this.scale(t)??this.getRange()[0]}},"BandAxis"),e),N=(c(s=class extends W{constructor(t,i,e,s,n){super(t,s,n,i),this.domain=e,this.scale=P().domain(this.domain).range(this.getRange())}getTickValues(){return this.scale.ticks()}recalculateScale(){const t=[...this.domain];"left"===this.axisPosition&&t.reverse(),this.scale=P().domain(t).range(this.getRange())}getScaleValue(t){return this.scale(t)}},"LinearAxis"),s);function X(t,i,e,s){const n=new O(s);return B(t)?new F(i,e,t.categories,t.title,n):new N(i,e,[t.min,t.max],t.title,n)}c(X,"getAxis");var V=(c(n=class{constructor(t,i,e,s){this.textDimensionCalculator=t,this.chartConfig=i,this.chartData=e,this.chartThemeConfig=s,this.boundingRect={x:0,y:0,width:0,height:0},this.showChartTitle=!1}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateSpace(t){const i=this.textDimensionCalculator.getMaxDimension([this.chartData.title],this.chartConfig.titleFontSize),e=Math.max(i.width,t.width),s=i.height+2*this.chartConfig.titlePadding;return i.width<=e&&i.height<=s&&this.chartConfig.showTitle&&this.chartData.title&&(this.boundingRect.width=e,this.boundingRect.height=s,this.showChartTitle=!0),{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){const t=[];return this.showChartTitle&&t.push({groupTexts:["chart-title"],type:"text",data:[{fontSize:this.chartConfig.titleFontSize,text:this.chartData.title,verticalPos:"middle",horizontalPos:"center",x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.chartThemeConfig.titleColor,rotation:0}]}),t}},"ChartTitle"),n);function Y(t,i,e,s){const n=new O(s);return new V(n,t,i,e)}c(Y,"getChartTitleComponent");var j=(c(a=class{constructor(t,i,e,s,n){this.plotData=t,this.xAxis=i,this.yAxis=e,this.orientation=s,this.plotIndex=n}getDrawableElement(){const t=this.plotData.data.map((t=>[this.xAxis.getScaleValue(t[0]),this.yAxis.getScaleValue(t[1])]));let i;return i="horizontal"===this.orientation?v().y((t=>t[0])).x((t=>t[1]))(t):v().x((t=>t[0])).y((t=>t[1]))(t),i?[{groupTexts:["plot",`line-plot-${this.plotIndex}`],type:"path",data:[{path:i,strokeFill:this.plotData.strokeFill,strokeWidth:this.plotData.strokeWidth}]}]:[]}},"LinePlot"),a),U=(c(o=class{constructor(t,i,e,s,n,a){this.barData=t,this.boundingRect=i,this.xAxis=e,this.yAxis=s,this.orientation=n,this.plotIndex=a}getDrawableElement(){const t=this.barData.data.map((t=>[this.xAxis.getScaleValue(t[0]),this.yAxis.getScaleValue(t[1])])),i=.95*Math.min(2*this.xAxis.getAxisOuterPadding(),this.xAxis.getTickDistance()),e=i/2;return"horizontal"===this.orientation?[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:t.map((t=>({x:this.boundingRect.x,y:t[0]-e,height:i,width:t[1]-this.boundingRect.x,fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill})))}]:[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:t.map((t=>({x:t[0]-e,y:t[1],width:i,height:this.boundingRect.y+this.boundingRect.height-t[1],fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill})))}]}},"BarPlot"),o),H=(c(h=class{constructor(t,i,e){this.chartConfig=t,this.chartData=i,this.chartThemeConfig=e,this.boundingRect={x:0,y:0,width:0,height:0}}setAxes(t,i){this.xAxis=t,this.yAxis=i}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateSpace(t){return this.boundingRect.width=t.width,this.boundingRect.height=t.height,{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){if(!this.xAxis||!this.yAxis)throw Error("Axes must be passed to render Plots");const t=[];for(const[i,e]of this.chartData.plots.entries())switch(e.type){case"line":{const s=new j(e,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,i);t.push(...s.getDrawableElement())}break;case"bar":{const s=new U(e,this.boundingRect,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,i);t.push(...s.getDrawableElement())}}return t}},"BasePlot"),h);function G(t,i,e){return new H(t,i,e)}c(G,"getPlotComponent");var Q,K=(c(r=class{constructor(t,i,e,s){this.chartConfig=t,this.chartData=i,this.componentStore={title:Y(t,i,e,s),plot:G(t,i,e),xAxis:X(i.xAxis,t.xAxis,{titleColor:e.xAxisTitleColor,labelColor:e.xAxisLabelColor,tickColor:e.xAxisTickColor,axisLineColor:e.xAxisLineColor},s),yAxis:X(i.yAxis,t.yAxis,{titleColor:e.yAxisTitleColor,labelColor:e.yAxisLabelColor,tickColor:e.yAxisTickColor,axisLineColor:e.yAxisLineColor},s)}}calculateVerticalSpace(){let t=this.chartConfig.width,i=this.chartConfig.height,e=0,s=0,n=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),a=Math.floor(i*this.chartConfig.plotReservedSpacePercent/100),o=this.componentStore.plot.calculateSpace({width:n,height:a});t-=o.width,i-=o.height,o=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:i}),s=o.height,i-=o.height,this.componentStore.xAxis.setAxisPosition("bottom"),o=this.componentStore.xAxis.calculateSpace({width:t,height:i}),i-=o.height,this.componentStore.yAxis.setAxisPosition("left"),o=this.componentStore.yAxis.calculateSpace({width:t,height:i}),e=o.width,t-=o.width,t>0&&(n+=t,t=0),i>0&&(a+=i,i=0),this.componentStore.plot.calculateSpace({width:n,height:a}),this.componentStore.plot.setBoundingBoxXY({x:e,y:s}),this.componentStore.xAxis.setRange([e,e+n]),this.componentStore.xAxis.setBoundingBoxXY({x:e,y:s+a}),this.componentStore.yAxis.setRange([s,s+a]),this.componentStore.yAxis.setBoundingBoxXY({x:0,y:s}),this.chartData.plots.some((t=>$(t)))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateHorizontalSpace(){let t=this.chartConfig.width,i=this.chartConfig.height,e=0,s=0,n=0,a=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),o=Math.floor(i*this.chartConfig.plotReservedSpacePercent/100),h=this.componentStore.plot.calculateSpace({width:a,height:o});t-=h.width,i-=h.height,h=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:i}),e=h.height,i-=h.height,this.componentStore.xAxis.setAxisPosition("left"),h=this.componentStore.xAxis.calculateSpace({width:t,height:i}),t-=h.width,s=h.width,this.componentStore.yAxis.setAxisPosition("top"),h=this.componentStore.yAxis.calculateSpace({width:t,height:i}),i-=h.height,n=e+h.height,t>0&&(a+=t,t=0),i>0&&(o+=i,i=0),this.componentStore.plot.calculateSpace({width:a,height:o}),this.componentStore.plot.setBoundingBoxXY({x:s,y:n}),this.componentStore.yAxis.setRange([s,s+a]),this.componentStore.yAxis.setBoundingBoxXY({x:s,y:e}),this.componentStore.xAxis.setRange([n,n+o]),this.componentStore.xAxis.setBoundingBoxXY({x:0,y:n}),this.chartData.plots.some((t=>$(t)))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateSpace(){"horizontal"===this.chartConfig.chartOrientation?this.calculateHorizontalSpace():this.calculateVerticalSpace()}getDrawableElement(){this.calculateSpace();const t=[];this.componentStore.plot.setAxes(this.componentStore.xAxis,this.componentStore.yAxis);for(const i of Object.values(this.componentStore))t.push(...i.getDrawableElements());return t}},"Orchestrator"),r),q=(c(l=class{static build(t,i,e,s){return new K(t,i,e,s).getDrawableElement()}},"XYChartBuilder"),l),Z=0,J=ot(),tt=at(),it=ht(),et=tt.plotColorPalette.split(",").map((t=>t.trim())),st=!1,nt=!1;function at(){const t=x(),i=d();return p(t.xyChart,i.themeVariables.xyChart)}function ot(){const t=d();return p(f.xyChart,t.xyChart)}function ht(){return{yAxis:{type:"linear",title:"",min:1/0,max:-1/0},xAxis:{type:"band",title:"",categories:[]},title:"",plots:[]}}function rt(t){const i=d();return m(t.trim(),i)}function lt(t){Q=t}function ct(t){J.chartOrientation="horizontal"===t?"horizontal":"vertical"}function gt(t){it.xAxis.title=rt(t.text)}function ut(t,i){it.xAxis={type:"linear",title:it.xAxis.title,min:t,max:i},st=!0}function xt(t){it.xAxis={type:"band",title:it.xAxis.title,categories:t.map((t=>rt(t.text)))},st=!0}function dt(t){it.yAxis.title=rt(t.text)}function pt(t,i){it.yAxis={type:"linear",title:it.yAxis.title,min:t,max:i},nt=!0}function ft(t){const i=Math.min(...t),e=Math.max(...t),s=z(it.yAxis)?it.yAxis.min:1/0,n=z(it.yAxis)?it.yAxis.max:-1/0;it.yAxis={type:"linear",title:it.yAxis.title,min:Math.min(s,i),max:Math.max(n,e)}}function mt(t){let i=[];if(0===t.length)return i;if(!st){const i=z(it.xAxis)?it.xAxis.min:1/0,e=z(it.xAxis)?it.xAxis.max:-1/0;ut(Math.min(i,1),Math.max(e,t.length))}if(nt||ft(t),B(it.xAxis)&&(i=it.xAxis.categories.map(((i,e)=>[i,t[e]]))),z(it.xAxis)){const e=it.xAxis.min,s=it.xAxis.max,n=(s-e)/(t.length-1),a=[];for(let t=e;t<=s;t+=n)a.push(`${t}`);i=a.map(((i,e)=>[i,t[e]]))}return i}function yt(t){return et[0===t?0:t%et.length]}function bt(t,i){const e=mt(i);it.plots.push({type:"line",strokeFill:yt(Z),strokeWidth:2,data:e}),Z++}function At(t,i){const e=mt(i);it.plots.push({type:"bar",fill:yt(Z),data:e}),Z++}function St(){if(0===it.plots.length)throw Error("No Plot to render, please provide a plot with some data");return it.title=y(),q.build(J,it,tt,Q)}function wt(){return tt}function Ct(){return J}c(at,"getChartDefaultThemeConfig"),c(ot,"getChartDefaultConfig"),c(ht,"getChartDefaultData"),c(rt,"textSanitizer"),c(lt,"setTmpSVGG"),c(ct,"setOrientation"),c(gt,"setXAxisTitle"),c(ut,"setXAxisRangeData"),c(xt,"setXAxisBand"),c(dt,"setYAxisTitle"),c(pt,"setYAxisRangeData"),c(ft,"setYAxisRangeFromPlotData"),c(mt,"transformDataWithoutCategory"),c(yt,"getPlotColorFromPalette"),c(bt,"setLineData"),c(At,"setBarData"),c(St,"getDrawableElem"),c(wt,"getChartThemeConfig"),c(Ct,"getChartConfig");var kt={parser:I,db:{getDrawableElem:St,clear:c((function(){k(),Z=0,J=ot(),it={yAxis:{type:"linear",title:"",min:1/0,max:-1/0},xAxis:{type:"band",title:"",categories:[]},title:"",plots:[]},tt=at(),et=tt.plotColorPalette.split(",").map((t=>t.trim())),st=!1,nt=!1}),"clear"),setAccTitle:b,getAccTitle:A,setDiagramTitle:S,getDiagramTitle:y,getAccDescription:w,setAccDescription:C,setOrientation:ct,setXAxisTitle:gt,setXAxisRangeData:ut,setXAxisBand:xt,setYAxisTitle:dt,setYAxisRangeData:pt,setLineData:bt,setBarData:At,setTmpSVGG:lt,getChartThemeConfig:wt,getChartConfig:Ct},renderer:{draw:c(((t,i,e,s)=>{const n=s.db,a=n.getChartThemeConfig(),o=n.getChartConfig();function h(t){return"top"===t?"text-before-edge":"middle"}function r(t){return"left"===t?"start":"right"===t?"end":"middle"}function l(t){return`translate(${t.x}, ${t.y}) rotate(${t.rotation||0})`}c(h,"getDominantBaseLine"),c(r,"getTextAnchor"),c(l,"getTextTransformation"),u.debug("Rendering xychart chart\n"+t);const g=_(i),x=g.append("g").attr("class","main"),d=x.append("rect").attr("width",o.width).attr("height",o.height).attr("class","background");T(g,o.height,o.width,!0),g.attr("viewBox",`0 0 ${o.width} ${o.height}`),d.attr("fill",a.backgroundColor),n.setTmpSVGG(g.append("g").attr("class","mermaid-tmp-group"));const p=n.getDrawableElem(),f={};function m(t){let i=x,e="";for(const[s]of t.entries()){let n=x;s>0&&f[e]&&(n=f[e]),e+=t[s],i=f[e],i||(i=f[e]=n.append("g").attr("class",t[s]))}return i}c(m,"getGroup");for(const c of p){if(0===c.data.length)continue;const t=m(c.groupTexts);switch(c.type){case"rect":t.selectAll("rect").data(c.data).enter().append("rect").attr("x",(t=>t.x)).attr("y",(t=>t.y)).attr("width",(t=>t.width)).attr("height",(t=>t.height)).attr("fill",(t=>t.fill)).attr("stroke",(t=>t.strokeFill)).attr("stroke-width",(t=>t.strokeWidth));break;case"text":t.selectAll("text").data(c.data).enter().append("text").attr("x",0).attr("y",0).attr("fill",(t=>t.fill)).attr("font-size",(t=>t.fontSize)).attr("dominant-baseline",(t=>h(t.verticalPos))).attr("text-anchor",(t=>r(t.horizontalPos))).attr("transform",(t=>l(t))).text((t=>t.text));break;case"path":t.selectAll("path").data(c.data).enter().append("path").attr("d",(t=>t.path)).attr("fill",(t=>t.fill?t.fill:"none")).attr("stroke",(t=>t.strokeFill)).attr("stroke-width",(t=>t.strokeWidth))}}}),"draw")}};export{kt as diagram};
1
+ var t,i,e,s,n,a,o,h,r,l;import{_ as c,aj as g,l as u,I as x,D as d,B as p,A as f,i as m,q as y,s as b,g as A,p as S,b as w,c as C,t as k,G as _,j as T}from"./mermaid-CI5euVIA.js";import"./transform-CwWHZB4y.js";import{i as R}from"./init-DLRA0X12.js";import{o as D}from"./ordinal-DDUp3AbE.js";import{r as L}from"./range-CtcPcB_L.js";import{l as P}from"./linear-BChN-NOb.js";import{l as v}from"./step-CNn2V7Th.js";import"./index-tlGs-LVf.js";import"./timer-CK-RIWfW.js";function E(){var t,i,e=D().unknown(void 0),s=e.domain,n=e.range,a=0,o=1,h=!1,r=0,l=0,c=.5;function g(){var e=s().length,g=o<a,u=g?o:a,x=g?a:o;t=(x-u)/Math.max(1,e-r+2*l),h&&(t=Math.floor(t)),u+=(x-u-t*(e-r))*c,i=t*(1-r),h&&(u=Math.round(u),i=Math.round(i));var d=L(e).map((function(i){return u+t*i}));return n(g?d.reverse():d)}return delete e.unknown,e.domain=function(t){return arguments.length?(s(t),g()):s()},e.range=function(t){return arguments.length?([a,o]=t,a=+a,o=+o,g()):[a,o]},e.rangeRound=function(t){return[a,o]=t,a=+a,o=+o,h=!0,g()},e.bandwidth=function(){return i},e.step=function(){return t},e.round=function(t){return arguments.length?(h=!!t,g()):h},e.padding=function(t){return arguments.length?(r=Math.min(1,l=+t),g()):r},e.paddingInner=function(t){return arguments.length?(r=Math.min(1,t),g()):r},e.paddingOuter=function(t){return arguments.length?(l=+t,g()):l},e.align=function(t){return arguments.length?(c=Math.max(0,Math.min(1,t)),g()):c},e.copy=function(){return E(s(),[a,o]).round(h).paddingInner(r).paddingOuter(l).align(c)},R.apply(g(),arguments)}var M=function(){var t=c((function(t,i,e,s){for(e=e||{},s=t.length;s--;e[t[s]]=i);return e}),"o"),i=[1,10,12,14,16,18,19,21,23],e=[2,6],s=[1,3],n=[1,5],a=[1,6],o=[1,7],h=[1,5,10,12,14,16,18,19,21,23,34,35,36],r=[1,25],l=[1,26],g=[1,28],u=[1,29],x=[1,30],d=[1,31],p=[1,32],f=[1,33],m=[1,34],y=[1,35],b=[1,36],A=[1,37],S=[1,43],w=[1,42],C=[1,47],k=[1,50],_=[1,10,12,14,16,18,19,21,23,34,35,36],T=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36],R=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36,41,42,43,44,45,46,47,48,49,50],D=[1,64],L={trace:c((function(){}),"trace"),yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,commaSeparatedNumbers:25,SQUARE_BRACES_END:26,NUMBER_WITH_DECIMAL:27,COMMA:28,xAxisData:29,bandData:30,ARROW_DELIMITER:31,commaSeparatedTexts:32,yAxisData:33,NEWLINE:34,SEMI:35,EOF:36,alphaNum:37,STR:38,MD_STR:39,alphaNumToken:40,AMP:41,NUM:42,ALPHA:43,PLUS:44,EQUALS:45,MULT:46,DOT:47,BRKT:48,MINUS:49,UNDERSCORE:50,$accept:0,$end:1},terminals_:{2:"error",5:"XYCHART",8:"CHART_ORIENTATION",10:"title",12:"X_AXIS",14:"Y_AXIS",16:"LINE",18:"BAR",19:"acc_title",20:"acc_title_value",21:"acc_descr",22:"acc_descr_value",23:"acc_descr_multiline_value",24:"SQUARE_BRACES_START",26:"SQUARE_BRACES_END",27:"NUMBER_WITH_DECIMAL",28:"COMMA",31:"ARROW_DELIMITER",34:"NEWLINE",35:"SEMI",36:"EOF",38:"STR",39:"MD_STR",41:"AMP",42:"NUM",43:"ALPHA",44:"PLUS",45:"EQUALS",46:"MULT",47:"DOT",48:"BRKT",49:"MINUS",50:"UNDERSCORE"},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[13,1],[13,2],[13,1],[29,1],[29,3],[30,3],[32,3],[32,1],[15,1],[15,2],[15,1],[33,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[37,1],[37,2],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1]],performAction:c((function(t,i,e,s,n,a,o){var h=a.length-1;switch(n){case 5:s.setOrientation(a[h]);break;case 9:s.setDiagramTitle(a[h].text.trim());break;case 12:s.setLineData({text:"",type:"text"},a[h]);break;case 13:s.setLineData(a[h-1],a[h]);break;case 14:s.setBarData({text:"",type:"text"},a[h]);break;case 15:s.setBarData(a[h-1],a[h]);break;case 16:this.$=a[h].trim(),s.setAccTitle(this.$);break;case 17:case 18:this.$=a[h].trim(),s.setAccDescription(this.$);break;case 19:case 27:this.$=a[h-1];break;case 20:this.$=[Number(a[h-2]),...a[h]];break;case 21:this.$=[Number(a[h])];break;case 22:s.setXAxisTitle(a[h]);break;case 23:s.setXAxisTitle(a[h-1]);break;case 24:s.setXAxisTitle({type:"text",text:""});break;case 25:s.setXAxisBand(a[h]);break;case 26:s.setXAxisRangeData(Number(a[h-2]),Number(a[h]));break;case 28:this.$=[a[h-2],...a[h]];break;case 29:this.$=[a[h]];break;case 30:s.setYAxisTitle(a[h]);break;case 31:s.setYAxisTitle(a[h-1]);break;case 32:s.setYAxisTitle({type:"text",text:""});break;case 33:s.setYAxisRangeData(Number(a[h-2]),Number(a[h]));break;case 37:case 38:this.$={text:a[h],type:"text"};break;case 39:this.$={text:a[h],type:"markdown"};break;case 40:this.$=a[h];break;case 41:this.$=a[h-1]+""+a[h]}}),"anonymous"),table:[t(i,e,{3:1,4:2,7:4,5:s,34:n,35:a,36:o}),{1:[3]},t(i,e,{4:2,7:4,3:8,5:s,34:n,35:a,36:o}),t(i,e,{4:2,7:4,6:9,3:10,5:s,8:[1,11],34:n,35:a,36:o}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},t(h,[2,34]),t(h,[2,35]),t(h,[2,36]),{1:[2,1]},t(i,e,{4:2,7:4,3:21,5:s,34:n,35:a,36:o}),{1:[2,3]},t(h,[2,5]),t(i,[2,7],{4:22,34:n,35:a,36:o}),{11:23,37:24,38:r,39:l,40:27,41:g,42:u,43:x,44:d,45:p,46:f,47:m,48:y,49:b,50:A},{11:39,13:38,24:S,27:w,29:40,30:41,37:24,38:r,39:l,40:27,41:g,42:u,43:x,44:d,45:p,46:f,47:m,48:y,49:b,50:A},{11:45,15:44,27:C,33:46,37:24,38:r,39:l,40:27,41:g,42:u,43:x,44:d,45:p,46:f,47:m,48:y,49:b,50:A},{11:49,17:48,24:k,37:24,38:r,39:l,40:27,41:g,42:u,43:x,44:d,45:p,46:f,47:m,48:y,49:b,50:A},{11:52,17:51,24:k,37:24,38:r,39:l,40:27,41:g,42:u,43:x,44:d,45:p,46:f,47:m,48:y,49:b,50:A},{20:[1,53]},{22:[1,54]},t(_,[2,18]),{1:[2,2]},t(_,[2,8]),t(_,[2,9]),t(T,[2,37],{40:55,41:g,42:u,43:x,44:d,45:p,46:f,47:m,48:y,49:b,50:A}),t(T,[2,38]),t(T,[2,39]),t(R,[2,40]),t(R,[2,42]),t(R,[2,43]),t(R,[2,44]),t(R,[2,45]),t(R,[2,46]),t(R,[2,47]),t(R,[2,48]),t(R,[2,49]),t(R,[2,50]),t(R,[2,51]),t(_,[2,10]),t(_,[2,22],{30:41,29:56,24:S,27:w}),t(_,[2,24]),t(_,[2,25]),{31:[1,57]},{11:59,32:58,37:24,38:r,39:l,40:27,41:g,42:u,43:x,44:d,45:p,46:f,47:m,48:y,49:b,50:A},t(_,[2,11]),t(_,[2,30],{33:60,27:C}),t(_,[2,32]),{31:[1,61]},t(_,[2,12]),{17:62,24:k},{25:63,27:D},t(_,[2,14]),{17:65,24:k},t(_,[2,16]),t(_,[2,17]),t(R,[2,41]),t(_,[2,23]),{27:[1,66]},{26:[1,67]},{26:[2,29],28:[1,68]},t(_,[2,31]),{27:[1,69]},t(_,[2,13]),{26:[1,70]},{26:[2,21],28:[1,71]},t(_,[2,15]),t(_,[2,26]),t(_,[2,27]),{11:59,32:72,37:24,38:r,39:l,40:27,41:g,42:u,43:x,44:d,45:p,46:f,47:m,48:y,49:b,50:A},t(_,[2,33]),t(_,[2,19]),{25:73,27:D},{26:[2,28]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],72:[2,28],73:[2,20]},parseError:c((function(t,i){if(!i.recoverable){var e=new Error(t);throw e.hash=i,e}this.trace(t)}),"parseError"),parse:c((function(t){var i=this,e=[0],s=[],n=[null],a=[],o=this.table,h="",r=0,l=0,g=a.slice.call(arguments,1),u=Object.create(this.lexer),x={yy:{}};for(var d in this.yy)Object.prototype.hasOwnProperty.call(this.yy,d)&&(x.yy[d]=this.yy[d]);u.setInput(t,x.yy),x.yy.lexer=u,x.yy.parser=this,void 0===u.yylloc&&(u.yylloc={});var p=u.yylloc;a.push(p);var f=u.options&&u.options.ranges;function m(){var t;return"number"!=typeof(t=s.pop()||u.lex()||1)&&(t instanceof Array&&(t=(s=t).pop()),t=i.symbols_[t]||t),t}"function"==typeof x.yy.parseError?this.parseError=x.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,c((function(t){e.length=e.length-2*t,n.length=n.length-t,a.length=a.length-t}),"popStack"),c(m,"lex");for(var y,b,A,S,w,C,k,_,T={};;){if(b=e[e.length-1],this.defaultActions[b]?A=this.defaultActions[b]:(null==y&&(y=m()),A=o[b]&&o[b][y]),void 0===A||!A.length||!A[0]){var R="";for(w in _=[],o[b])this.terminals_[w]&&w>2&&_.push("'"+this.terminals_[w]+"'");R=u.showPosition?"Parse error on line "+(r+1)+":\n"+u.showPosition()+"\nExpecting "+_.join(", ")+", got '"+(this.terminals_[y]||y)+"'":"Parse error on line "+(r+1)+": Unexpected "+(1==y?"end of input":"'"+(this.terminals_[y]||y)+"'"),this.parseError(R,{text:u.match,token:this.terminals_[y]||y,line:u.yylineno,loc:p,expected:_})}if(A[0]instanceof Array&&A.length>1)throw new Error("Parse Error: multiple actions possible at state: "+b+", token: "+y);switch(A[0]){case 1:e.push(y),n.push(u.yytext),a.push(u.yylloc),e.push(A[1]),y=null,l=u.yyleng,h=u.yytext,r=u.yylineno,p=u.yylloc;break;case 2:if(C=this.productions_[A[1]][1],T.$=n[n.length-C],T._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},f&&(T._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(S=this.performAction.apply(T,[h,l,r,x.yy,A[1],n,a].concat(g))))return S;C&&(e=e.slice(0,-1*C*2),n=n.slice(0,-1*C),a=a.slice(0,-1*C)),e.push(this.productions_[A[1]][0]),n.push(T.$),a.push(T._$),k=o[e[e.length-2]][e[e.length-1]],e.push(k);break;case 3:return!0}}return!0}),"parse")},P=function(){return{EOF:1,parseError:c((function(t,i){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,i)}),"parseError"),setInput:c((function(t,i){return this.yy=i||this.yy||{},this._input=t,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 t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t}),"input"),unput:c((function(t){var i=t.length,e=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-i),this.offset-=i;var s=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),e.length-1&&(this.yylineno-=e.length-1);var n=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:e?(e.length===s.length?this.yylloc.first_column:0)+s[s.length-e.length].length-e[0].length:this.yylloc.first_column-i},this.options.ranges&&(this.yylloc.range=[n[0],n[0]+this.yyleng-i]),this.yyleng=this.yytext.length,this}),"unput"),more:c((function(){return this._more=!0,this}),"more"),reject:c((function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):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).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}),"reject"),less:c((function(t){this.unput(this.match.slice(t))}),"less"),pastInput:c((function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")}),"pastInput"),upcomingInput:c((function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")}),"upcomingInput"),showPosition:c((function(){var t=this.pastInput(),i=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+i+"^"}),"showPosition"),test_match:c((function(t,i){var e,s,n;if(this.options.backtrack_lexer&&(n={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(n.yylloc.range=this.yylloc.range.slice(0))),(s=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=s.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:s?s[s.length-1].length-s[s.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],e=this.performAction.call(this,this.yy,this,i,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),e)return e;if(this._backtrack){for(var a in n)this[a]=n[a];return!1}return!1}),"test_match"),next:c((function(){if(this.done)return this.EOF;var t,i,e,s;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var n=this._currentRules(),a=0;a<n.length;a++)if((e=this._input.match(this.rules[n[a]]))&&(!i||e[0].length>i[0].length)){if(i=e,s=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(e,n[a])))return t;if(this._backtrack){i=!1;continue}return!1}if(!this.options.flex)break}return i?!1!==(t=this.test_match(i,n[s]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}),"next"),lex:c((function(){var t=this.next();return t||this.lex()}),"lex"),begin:c((function(t){this.conditionStack.push(t)}),"begin"),popState:c((function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]}),"popState"),_currentRules:c((function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules}),"_currentRules"),topState:c((function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"}),"topState"),pushState:c((function(t){this.begin(t)}),"pushState"),stateStackSize:c((function(){return this.conditionStack.length}),"stateStackSize"),options:{"case-insensitive":!0},performAction:c((function(t,i,e,s){switch(e){case 0:case 1:case 5:case 43:break;case 2:case 3:return this.popState(),34;case 4:return 34;case 6:return 10;case 7:return this.pushState("acc_title"),19;case 8:return this.popState(),"acc_title_value";case 9:return this.pushState("acc_descr"),21;case 10:return this.popState(),"acc_descr_value";case 11:this.pushState("acc_descr_multiline");break;case 12:case 25:case 27:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:return 5;case 15:return 8;case 16:return this.pushState("axis_data"),"X_AXIS";case 17:return this.pushState("axis_data"),"Y_AXIS";case 18:return this.pushState("axis_band_data"),24;case 19:return 31;case 20:return this.pushState("data"),16;case 21:return this.pushState("data"),18;case 22:return this.pushState("data_inner"),24;case 23:return 27;case 24:return this.popState(),26;case 26:this.pushState("string");break;case 28:return"STR";case 29:return 24;case 30:return 26;case 31:return 43;case 32:return"COLON";case 33:return 44;case 34:return 28;case 35:return 45;case 36:return 46;case 37:return 48;case 38:return 50;case 39:return 47;case 40:return 41;case 41:return 49;case 42:return 42;case 44:return 35;case 45:return 36}}),"anonymous"),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:(\r?\n))/i,/^(?:(\r?\n))/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:title\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:\{)/i,/^(?:[^\}]*)/i,/^(?:xychart-beta\b)/i,/^(?:(?:vertical|horizontal))/i,/^(?:x-axis\b)/i,/^(?:y-axis\b)/i,/^(?:\[)/i,/^(?:-->)/i,/^(?:line\b)/i,/^(?:bar\b)/i,/^(?:\[)/i,/^(?:[+-]?(?:\d+(?:\.\d+)?|\.\d+))/i,/^(?:\])/i,/^(?:(?:`\) \{ this\.pushState\(md_string\); \}\n<md_string>\(\?:\(\?!`"\)\.\)\+ \{ return MD_STR; \}\n<md_string>\(\?:`))/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:[A-Za-z]+)/i,/^(?::)/i,/^(?:\+)/i,/^(?:,)/i,/^(?:=)/i,/^(?:\*)/i,/^(?:#)/i,/^(?:[\_])/i,/^(?:\.)/i,/^(?:&)/i,/^(?:-)/i,/^(?:[0-9]+)/i,/^(?:\s+)/i,/^(?:;)/i,/^(?:$)/i],conditions:{data_inner:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,20,21,23,24,25,26,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],inclusive:!0},data:{rules:[0,1,3,4,5,6,7,9,11,14,15,16,17,20,21,22,25,26,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],inclusive:!0},axis_band_data:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,20,21,24,25,26,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],inclusive:!0},axis_data:{rules:[0,1,2,4,5,6,7,9,11,14,15,16,17,18,19,20,21,23,25,26,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],inclusive:!0},acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},title:{rules:[],inclusive:!1},md_string:{rules:[],inclusive:!1},string:{rules:[27,28],inclusive:!1},INITIAL:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,20,21,25,26,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],inclusive:!0}}}}();function v(){this.yy={}}return L.lexer=P,c(v,"Parser"),v.prototype=L,L.Parser=v,new v}();M.parser=M;var I=M;function $(t){return"bar"===t.type}function B(t){return"band"===t.type}function z(t){return"linear"===t.type}c($,"isBarPlot"),c(B,"isBandAxisData"),c(z,"isLinearAxisData");var O=(c(t=class{constructor(t){this.parentGroup=t}getMaxDimension(t,i){if(!this.parentGroup)return{width:t.reduce(((t,i)=>Math.max(i.length,t)),0)*i,height:i};const e={width:0,height:0},s=this.parentGroup.append("g").attr("visibility","hidden").attr("font-size",i);for(const n of t){const t=g(s,1,n),a=t?t.width:n.length*i,o=t?t.height:i;e.width=Math.max(e.width,a),e.height=Math.max(e.height,o)}return s.remove(),e}},"TextDimensionCalculatorWithFont"),t),W=(c(i=class{constructor(t,i,e,s){this.axisConfig=t,this.title=i,this.textDimensionCalculator=e,this.axisThemeConfig=s,this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition="left",this.showTitle=!1,this.showLabel=!1,this.showTick=!1,this.showAxisLine=!1,this.outerPadding=0,this.titleTextHeight=0,this.labelTextHeight=0,this.range=[0,10],this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition="left"}setRange(t){this.range=t,"left"===this.axisPosition||"right"===this.axisPosition?this.boundingRect.height=t[1]-t[0]:this.boundingRect.width=t[1]-t[0],this.recalculateScale()}getRange(){return[this.range[0]+this.outerPadding,this.range[1]-this.outerPadding]}setAxisPosition(t){this.axisPosition=t,this.setRange(this.range)}getTickDistance(){const t=this.getRange();return Math.abs(t[0]-t[1])/this.getTickValues().length}getAxisOuterPadding(){return this.outerPadding}getLabelDimension(){return this.textDimensionCalculator.getMaxDimension(this.getTickValues().map((t=>t.toString())),this.axisConfig.labelFontSize)}recalculateOuterPaddingToDrawBar(){.7*this.getTickDistance()>2*this.outerPadding&&(this.outerPadding=Math.floor(.7*this.getTickDistance()/2)),this.recalculateScale()}calculateSpaceIfDrawnHorizontally(t){let i=t.height;if(this.axisConfig.showAxisLine&&i>this.axisConfig.axisLineWidth&&(i-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){const e=this.getLabelDimension(),s=.2*t.width;this.outerPadding=Math.min(e.width/2,s);const n=e.height+2*this.axisConfig.labelPadding;this.labelTextHeight=e.height,n<=i&&(i-=n,this.showLabel=!0)}if(this.axisConfig.showTick&&i>=this.axisConfig.tickLength&&(this.showTick=!0,i-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){const t=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),e=t.height+2*this.axisConfig.titlePadding;this.titleTextHeight=t.height,e<=i&&(i-=e,this.showTitle=!0)}this.boundingRect.width=t.width,this.boundingRect.height=t.height-i}calculateSpaceIfDrawnVertical(t){let i=t.width;if(this.axisConfig.showAxisLine&&i>this.axisConfig.axisLineWidth&&(i-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){const e=this.getLabelDimension(),s=.2*t.height;this.outerPadding=Math.min(e.height/2,s);const n=e.width+2*this.axisConfig.labelPadding;n<=i&&(i-=n,this.showLabel=!0)}if(this.axisConfig.showTick&&i>=this.axisConfig.tickLength&&(this.showTick=!0,i-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){const t=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),e=t.height+2*this.axisConfig.titlePadding;this.titleTextHeight=t.height,e<=i&&(i-=e,this.showTitle=!0)}this.boundingRect.width=t.width-i,this.boundingRect.height=t.height}calculateSpace(t){return"left"===this.axisPosition||"right"===this.axisPosition?this.calculateSpaceIfDrawnVertical(t):this.calculateSpaceIfDrawnHorizontally(t),this.recalculateScale(),{width:this.boundingRect.width,height:this.boundingRect.height}}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}getDrawableElementsForLeftAxis(){const t=[];if(this.showAxisLine){const i=this.boundingRect.x+this.boundingRect.width-this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["left-axis","axisl-line"],data:[{path:`M ${i},${this.boundingRect.y} L ${i},${this.boundingRect.y+this.boundingRect.height} `,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["left-axis","label"],data:this.getTickValues().map((t=>({text:t.toString(),x:this.boundingRect.x+this.boundingRect.width-(this.showLabel?this.axisConfig.labelPadding:0)-(this.showTick?this.axisConfig.tickLength:0)-(this.showAxisLine?this.axisConfig.axisLineWidth:0),y:this.getScaleValue(t),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"middle",horizontalPos:"right"})))}),this.showTick){const i=this.boundingRect.x+this.boundingRect.width-(this.showAxisLine?this.axisConfig.axisLineWidth:0);t.push({type:"path",groupTexts:["left-axis","ticks"],data:this.getTickValues().map((t=>({path:`M ${i},${this.getScaleValue(t)} L ${i-this.axisConfig.tickLength},${this.getScaleValue(t)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth})))})}return this.showTitle&&t.push({type:"text",groupTexts:["left-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.axisConfig.titlePadding,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:270,verticalPos:"top",horizontalPos:"center"}]}),t}getDrawableElementsForBottomAxis(){const t=[];if(this.showAxisLine){const i=this.boundingRect.y+this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["bottom-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${i} L ${this.boundingRect.x+this.boundingRect.width},${i}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["bottom-axis","label"],data:this.getTickValues().map((t=>({text:t.toString(),x:this.getScaleValue(t),y:this.boundingRect.y+this.axisConfig.labelPadding+(this.showTick?this.axisConfig.tickLength:0)+(this.showAxisLine?this.axisConfig.axisLineWidth:0),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"})))}),this.showTick){const i=this.boundingRect.y+(this.showAxisLine?this.axisConfig.axisLineWidth:0);t.push({type:"path",groupTexts:["bottom-axis","ticks"],data:this.getTickValues().map((t=>({path:`M ${this.getScaleValue(t)},${i} L ${this.getScaleValue(t)},${i+this.axisConfig.tickLength}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth})))})}return this.showTitle&&t.push({type:"text",groupTexts:["bottom-axis","title"],data:[{text:this.title,x:this.range[0]+(this.range[1]-this.range[0])/2,y:this.boundingRect.y+this.boundingRect.height-this.axisConfig.titlePadding-this.titleTextHeight,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]}),t}getDrawableElementsForTopAxis(){const t=[];if(this.showAxisLine){const i=this.boundingRect.y+this.boundingRect.height-this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["top-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${i} L ${this.boundingRect.x+this.boundingRect.width},${i}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["top-axis","label"],data:this.getTickValues().map((t=>({text:t.toString(),x:this.getScaleValue(t),y:this.boundingRect.y+(this.showTitle?this.titleTextHeight+2*this.axisConfig.titlePadding:0)+this.axisConfig.labelPadding,fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"})))}),this.showTick){const i=this.boundingRect.y;t.push({type:"path",groupTexts:["top-axis","ticks"],data:this.getTickValues().map((t=>({path:`M ${this.getScaleValue(t)},${i+this.boundingRect.height-(this.showAxisLine?this.axisConfig.axisLineWidth:0)} L ${this.getScaleValue(t)},${i+this.boundingRect.height-this.axisConfig.tickLength-(this.showAxisLine?this.axisConfig.axisLineWidth:0)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth})))})}return this.showTitle&&t.push({type:"text",groupTexts:["top-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.axisConfig.titlePadding,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]}),t}getDrawableElements(){if("left"===this.axisPosition)return this.getDrawableElementsForLeftAxis();if("right"===this.axisPosition)throw Error("Drawing of right axis is not implemented");return"bottom"===this.axisPosition?this.getDrawableElementsForBottomAxis():"top"===this.axisPosition?this.getDrawableElementsForTopAxis():[]}},"BaseAxis"),i),F=(c(e=class extends W{constructor(t,i,e,s,n){super(t,s,n,i),this.categories=e,this.scale=E().domain(this.categories).range(this.getRange())}setRange(t){super.setRange(t)}recalculateScale(){this.scale=E().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(.5),u.trace("BandAxis axis final categories, range: ",this.categories,this.getRange())}getTickValues(){return this.categories}getScaleValue(t){return this.scale(t)??this.getRange()[0]}},"BandAxis"),e),N=(c(s=class extends W{constructor(t,i,e,s,n){super(t,s,n,i),this.domain=e,this.scale=P().domain(this.domain).range(this.getRange())}getTickValues(){return this.scale.ticks()}recalculateScale(){const t=[...this.domain];"left"===this.axisPosition&&t.reverse(),this.scale=P().domain(t).range(this.getRange())}getScaleValue(t){return this.scale(t)}},"LinearAxis"),s);function X(t,i,e,s){const n=new O(s);return B(t)?new F(i,e,t.categories,t.title,n):new N(i,e,[t.min,t.max],t.title,n)}c(X,"getAxis");var V=(c(n=class{constructor(t,i,e,s){this.textDimensionCalculator=t,this.chartConfig=i,this.chartData=e,this.chartThemeConfig=s,this.boundingRect={x:0,y:0,width:0,height:0},this.showChartTitle=!1}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateSpace(t){const i=this.textDimensionCalculator.getMaxDimension([this.chartData.title],this.chartConfig.titleFontSize),e=Math.max(i.width,t.width),s=i.height+2*this.chartConfig.titlePadding;return i.width<=e&&i.height<=s&&this.chartConfig.showTitle&&this.chartData.title&&(this.boundingRect.width=e,this.boundingRect.height=s,this.showChartTitle=!0),{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){const t=[];return this.showChartTitle&&t.push({groupTexts:["chart-title"],type:"text",data:[{fontSize:this.chartConfig.titleFontSize,text:this.chartData.title,verticalPos:"middle",horizontalPos:"center",x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.chartThemeConfig.titleColor,rotation:0}]}),t}},"ChartTitle"),n);function Y(t,i,e,s){const n=new O(s);return new V(n,t,i,e)}c(Y,"getChartTitleComponent");var j=(c(a=class{constructor(t,i,e,s,n){this.plotData=t,this.xAxis=i,this.yAxis=e,this.orientation=s,this.plotIndex=n}getDrawableElement(){const t=this.plotData.data.map((t=>[this.xAxis.getScaleValue(t[0]),this.yAxis.getScaleValue(t[1])]));let i;return i="horizontal"===this.orientation?v().y((t=>t[0])).x((t=>t[1]))(t):v().x((t=>t[0])).y((t=>t[1]))(t),i?[{groupTexts:["plot",`line-plot-${this.plotIndex}`],type:"path",data:[{path:i,strokeFill:this.plotData.strokeFill,strokeWidth:this.plotData.strokeWidth}]}]:[]}},"LinePlot"),a),U=(c(o=class{constructor(t,i,e,s,n,a){this.barData=t,this.boundingRect=i,this.xAxis=e,this.yAxis=s,this.orientation=n,this.plotIndex=a}getDrawableElement(){const t=this.barData.data.map((t=>[this.xAxis.getScaleValue(t[0]),this.yAxis.getScaleValue(t[1])])),i=.95*Math.min(2*this.xAxis.getAxisOuterPadding(),this.xAxis.getTickDistance()),e=i/2;return"horizontal"===this.orientation?[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:t.map((t=>({x:this.boundingRect.x,y:t[0]-e,height:i,width:t[1]-this.boundingRect.x,fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill})))}]:[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:t.map((t=>({x:t[0]-e,y:t[1],width:i,height:this.boundingRect.y+this.boundingRect.height-t[1],fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill})))}]}},"BarPlot"),o),H=(c(h=class{constructor(t,i,e){this.chartConfig=t,this.chartData=i,this.chartThemeConfig=e,this.boundingRect={x:0,y:0,width:0,height:0}}setAxes(t,i){this.xAxis=t,this.yAxis=i}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateSpace(t){return this.boundingRect.width=t.width,this.boundingRect.height=t.height,{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){if(!this.xAxis||!this.yAxis)throw Error("Axes must be passed to render Plots");const t=[];for(const[i,e]of this.chartData.plots.entries())switch(e.type){case"line":{const s=new j(e,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,i);t.push(...s.getDrawableElement())}break;case"bar":{const s=new U(e,this.boundingRect,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,i);t.push(...s.getDrawableElement())}}return t}},"BasePlot"),h);function G(t,i,e){return new H(t,i,e)}c(G,"getPlotComponent");var Q,K=(c(r=class{constructor(t,i,e,s){this.chartConfig=t,this.chartData=i,this.componentStore={title:Y(t,i,e,s),plot:G(t,i,e),xAxis:X(i.xAxis,t.xAxis,{titleColor:e.xAxisTitleColor,labelColor:e.xAxisLabelColor,tickColor:e.xAxisTickColor,axisLineColor:e.xAxisLineColor},s),yAxis:X(i.yAxis,t.yAxis,{titleColor:e.yAxisTitleColor,labelColor:e.yAxisLabelColor,tickColor:e.yAxisTickColor,axisLineColor:e.yAxisLineColor},s)}}calculateVerticalSpace(){let t=this.chartConfig.width,i=this.chartConfig.height,e=0,s=0,n=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),a=Math.floor(i*this.chartConfig.plotReservedSpacePercent/100),o=this.componentStore.plot.calculateSpace({width:n,height:a});t-=o.width,i-=o.height,o=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:i}),s=o.height,i-=o.height,this.componentStore.xAxis.setAxisPosition("bottom"),o=this.componentStore.xAxis.calculateSpace({width:t,height:i}),i-=o.height,this.componentStore.yAxis.setAxisPosition("left"),o=this.componentStore.yAxis.calculateSpace({width:t,height:i}),e=o.width,t-=o.width,t>0&&(n+=t,t=0),i>0&&(a+=i,i=0),this.componentStore.plot.calculateSpace({width:n,height:a}),this.componentStore.plot.setBoundingBoxXY({x:e,y:s}),this.componentStore.xAxis.setRange([e,e+n]),this.componentStore.xAxis.setBoundingBoxXY({x:e,y:s+a}),this.componentStore.yAxis.setRange([s,s+a]),this.componentStore.yAxis.setBoundingBoxXY({x:0,y:s}),this.chartData.plots.some((t=>$(t)))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateHorizontalSpace(){let t=this.chartConfig.width,i=this.chartConfig.height,e=0,s=0,n=0,a=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),o=Math.floor(i*this.chartConfig.plotReservedSpacePercent/100),h=this.componentStore.plot.calculateSpace({width:a,height:o});t-=h.width,i-=h.height,h=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:i}),e=h.height,i-=h.height,this.componentStore.xAxis.setAxisPosition("left"),h=this.componentStore.xAxis.calculateSpace({width:t,height:i}),t-=h.width,s=h.width,this.componentStore.yAxis.setAxisPosition("top"),h=this.componentStore.yAxis.calculateSpace({width:t,height:i}),i-=h.height,n=e+h.height,t>0&&(a+=t,t=0),i>0&&(o+=i,i=0),this.componentStore.plot.calculateSpace({width:a,height:o}),this.componentStore.plot.setBoundingBoxXY({x:s,y:n}),this.componentStore.yAxis.setRange([s,s+a]),this.componentStore.yAxis.setBoundingBoxXY({x:s,y:e}),this.componentStore.xAxis.setRange([n,n+o]),this.componentStore.xAxis.setBoundingBoxXY({x:0,y:n}),this.chartData.plots.some((t=>$(t)))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateSpace(){"horizontal"===this.chartConfig.chartOrientation?this.calculateHorizontalSpace():this.calculateVerticalSpace()}getDrawableElement(){this.calculateSpace();const t=[];this.componentStore.plot.setAxes(this.componentStore.xAxis,this.componentStore.yAxis);for(const i of Object.values(this.componentStore))t.push(...i.getDrawableElements());return t}},"Orchestrator"),r),q=(c(l=class{static build(t,i,e,s){return new K(t,i,e,s).getDrawableElement()}},"XYChartBuilder"),l),Z=0,J=ot(),tt=at(),it=ht(),et=tt.plotColorPalette.split(",").map((t=>t.trim())),st=!1,nt=!1;function at(){const t=x(),i=d();return p(t.xyChart,i.themeVariables.xyChart)}function ot(){const t=d();return p(f.xyChart,t.xyChart)}function ht(){return{yAxis:{type:"linear",title:"",min:1/0,max:-1/0},xAxis:{type:"band",title:"",categories:[]},title:"",plots:[]}}function rt(t){const i=d();return m(t.trim(),i)}function lt(t){Q=t}function ct(t){J.chartOrientation="horizontal"===t?"horizontal":"vertical"}function gt(t){it.xAxis.title=rt(t.text)}function ut(t,i){it.xAxis={type:"linear",title:it.xAxis.title,min:t,max:i},st=!0}function xt(t){it.xAxis={type:"band",title:it.xAxis.title,categories:t.map((t=>rt(t.text)))},st=!0}function dt(t){it.yAxis.title=rt(t.text)}function pt(t,i){it.yAxis={type:"linear",title:it.yAxis.title,min:t,max:i},nt=!0}function ft(t){const i=Math.min(...t),e=Math.max(...t),s=z(it.yAxis)?it.yAxis.min:1/0,n=z(it.yAxis)?it.yAxis.max:-1/0;it.yAxis={type:"linear",title:it.yAxis.title,min:Math.min(s,i),max:Math.max(n,e)}}function mt(t){let i=[];if(0===t.length)return i;if(!st){const i=z(it.xAxis)?it.xAxis.min:1/0,e=z(it.xAxis)?it.xAxis.max:-1/0;ut(Math.min(i,1),Math.max(e,t.length))}if(nt||ft(t),B(it.xAxis)&&(i=it.xAxis.categories.map(((i,e)=>[i,t[e]]))),z(it.xAxis)){const e=it.xAxis.min,s=it.xAxis.max,n=(s-e)/(t.length-1),a=[];for(let t=e;t<=s;t+=n)a.push(`${t}`);i=a.map(((i,e)=>[i,t[e]]))}return i}function yt(t){return et[0===t?0:t%et.length]}function bt(t,i){const e=mt(i);it.plots.push({type:"line",strokeFill:yt(Z),strokeWidth:2,data:e}),Z++}function At(t,i){const e=mt(i);it.plots.push({type:"bar",fill:yt(Z),data:e}),Z++}function St(){if(0===it.plots.length)throw Error("No Plot to render, please provide a plot with some data");return it.title=y(),q.build(J,it,tt,Q)}function wt(){return tt}function Ct(){return J}c(at,"getChartDefaultThemeConfig"),c(ot,"getChartDefaultConfig"),c(ht,"getChartDefaultData"),c(rt,"textSanitizer"),c(lt,"setTmpSVGG"),c(ct,"setOrientation"),c(gt,"setXAxisTitle"),c(ut,"setXAxisRangeData"),c(xt,"setXAxisBand"),c(dt,"setYAxisTitle"),c(pt,"setYAxisRangeData"),c(ft,"setYAxisRangeFromPlotData"),c(mt,"transformDataWithoutCategory"),c(yt,"getPlotColorFromPalette"),c(bt,"setLineData"),c(At,"setBarData"),c(St,"getDrawableElem"),c(wt,"getChartThemeConfig"),c(Ct,"getChartConfig");var kt={parser:I,db:{getDrawableElem:St,clear:c((function(){k(),Z=0,J=ot(),it={yAxis:{type:"linear",title:"",min:1/0,max:-1/0},xAxis:{type:"band",title:"",categories:[]},title:"",plots:[]},tt=at(),et=tt.plotColorPalette.split(",").map((t=>t.trim())),st=!1,nt=!1}),"clear"),setAccTitle:b,getAccTitle:A,setDiagramTitle:S,getDiagramTitle:y,getAccDescription:w,setAccDescription:C,setOrientation:ct,setXAxisTitle:gt,setXAxisRangeData:ut,setXAxisBand:xt,setYAxisTitle:dt,setYAxisRangeData:pt,setLineData:bt,setBarData:At,setTmpSVGG:lt,getChartThemeConfig:wt,getChartConfig:Ct},renderer:{draw:c(((t,i,e,s)=>{const n=s.db,a=n.getChartThemeConfig(),o=n.getChartConfig();function h(t){return"top"===t?"text-before-edge":"middle"}function r(t){return"left"===t?"start":"right"===t?"end":"middle"}function l(t){return`translate(${t.x}, ${t.y}) rotate(${t.rotation||0})`}c(h,"getDominantBaseLine"),c(r,"getTextAnchor"),c(l,"getTextTransformation"),u.debug("Rendering xychart chart\n"+t);const g=_(i),x=g.append("g").attr("class","main"),d=x.append("rect").attr("width",o.width).attr("height",o.height).attr("class","background");T(g,o.height,o.width,!0),g.attr("viewBox",`0 0 ${o.width} ${o.height}`),d.attr("fill",a.backgroundColor),n.setTmpSVGG(g.append("g").attr("class","mermaid-tmp-group"));const p=n.getDrawableElem(),f={};function m(t){let i=x,e="";for(const[s]of t.entries()){let n=x;s>0&&f[e]&&(n=f[e]),e+=t[s],i=f[e],i||(i=f[e]=n.append("g").attr("class",t[s]))}return i}c(m,"getGroup");for(const c of p){if(0===c.data.length)continue;const t=m(c.groupTexts);switch(c.type){case"rect":t.selectAll("rect").data(c.data).enter().append("rect").attr("x",(t=>t.x)).attr("y",(t=>t.y)).attr("width",(t=>t.width)).attr("height",(t=>t.height)).attr("fill",(t=>t.fill)).attr("stroke",(t=>t.strokeFill)).attr("stroke-width",(t=>t.strokeWidth));break;case"text":t.selectAll("text").data(c.data).enter().append("text").attr("x",0).attr("y",0).attr("fill",(t=>t.fill)).attr("font-size",(t=>t.fontSize)).attr("dominant-baseline",(t=>h(t.verticalPos))).attr("text-anchor",(t=>r(t.horizontalPos))).attr("transform",(t=>l(t))).text((t=>t.text));break;case"path":t.selectAll("path").data(c.data).enter().append("path").attr("d",(t=>t.path)).attr("fill",(t=>t.fill?t.fill:"none")).attr("stroke",(t=>t.strokeFill)).attr("stroke-width",(t=>t.strokeWidth))}}}),"draw")}};export{kt as diagram};
package/dist/index.html CHANGED
@@ -60,7 +60,7 @@
60
60
  <marimo-app-config data-config='{{ app_config }}' hidden></marimo-app-config>
61
61
  <marimo-server-token data-token='{{ server_token }}' hidden></marimo-server-token>
62
62
  <title>{{ title }}</title>
63
- <script type="module" crossorigin src="./assets/index-smzK0Z-Y.js"></script>
63
+ <script type="module" crossorigin src="./assets/index-tlGs-LVf.js"></script>
64
64
  <link rel="stylesheet" crossorigin href="./assets/index-VLbIWGNK.css">
65
65
  </head>
66
66
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/frontend",
3
- "version": "0.9.18-dev9",
3
+ "version": "0.9.19-dev2",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -1 +0,0 @@
1
- import{b as r}from"./_baseEach-BOJ7rr2z.js";import{n}from"./index-smzK0Z-Y.js";function a(a,o){var t=-1,s=n(a)?Array(a.length):[];return r(a,(function(r,n,a){s[++t]=o(r,n,a)})),s}export{a as b};
@@ -1 +0,0 @@
1
- import{U as a,C as r}from"./mermaid-CrKddFRb.js";const s=(s,o)=>a.lang.round(r.parse(s)[o]);export{s as c};
@@ -1 +0,0 @@
1
- import{b as r}from"./_baseUniq-Da35M4Ot.js";function n(n){return r(n,4)}export{n as c};
@@ -1 +0,0 @@
1
- !function(){"use strict";var e,t,n;(t=e||(e={})).assertEqual=e=>e,t.assertIs=function(e){},t.assertNever=function(e){throw new Error},t.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},t.getValidEnumValues=e=>{const n=t.objectKeys(e).filter((t=>"number"!=typeof e[e[t]])),s={};for(const t of n)s[t]=e[t];return t.objectValues(s)},t.objectValues=e=>t.objectKeys(e).map((function(t){return e[t]})),t.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},t.find=(e,t)=>{for(const n of e)if(t(n))return n},t.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,t.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},t.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(n||(n={})).mergeShapes=(e,t)=>({...e,...t});const s=e.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),a=e=>{switch(typeof e){case"undefined":return s.undefined;case"string":return s.string;case"number":return isNaN(e)?s.nan:s.number;case"boolean":return s.boolean;case"function":return s.function;case"bigint":return s.bigint;case"symbol":return s.symbol;case"object":return Array.isArray(e)?s.array:null===e?s.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?s.promise:"undefined"!=typeof Map&&e instanceof Map?s.map:"undefined"!=typeof Set&&e instanceof Set?s.set:"undefined"!=typeof Date&&e instanceof Date?s.date:s.object;default:return s.unknown}},r=e.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class i extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},n={_errors:[]},s=e=>{for(const a of e.issues)if("invalid_union"===a.code)a.unionErrors.map(s);else if("invalid_return_type"===a.code)s(a.returnTypeError);else if("invalid_arguments"===a.code)s(a.argumentsError);else if(0===a.path.length)n._errors.push(t(a));else{let e=n,s=0;for(;s<a.path.length;){const n=a.path[s];s===a.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(a))):e[n]=e[n]||{_errors:[]},e=e[n],s++}}};return s(this),n}static assert(e){if(!(e instanceof i))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,e.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},n=[];for(const s of this.issues)s.path.length>0?(t[s.path[0]]=t[s.path[0]]||[],t[s.path[0]].push(e(s))):n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}i.create=e=>new i(e);const o=(t,n)=>{let a;switch(t.code){case r.invalid_type:a=t.received===s.undefined?"Required":`Expected ${t.expected}, received ${t.received}`;break;case r.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(t.expected,e.jsonStringifyReplacer)}`;break;case r.unrecognized_keys:a=`Unrecognized key(s) in object: ${e.joinValues(t.keys,", ")}`;break;case r.invalid_union:a="Invalid input";break;case r.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${e.joinValues(t.options)}`;break;case r.invalid_enum_value:a=`Invalid enum value. Expected ${e.joinValues(t.options)}, received '${t.received}'`;break;case r.invalid_arguments:a="Invalid function arguments";break;case r.invalid_return_type:a="Invalid function return type";break;case r.invalid_date:a="Invalid date";break;case r.invalid_string:"object"==typeof t.validation?"includes"in t.validation?(a=`Invalid input: must include "${t.validation.includes}"`,"number"==typeof t.validation.position&&(a=`${a} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?a=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?a=`Invalid input: must end with "${t.validation.endsWith}"`:e.assertNever(t.validation):a="regex"!==t.validation?`Invalid ${t.validation}`:"Invalid";break;case r.too_small:a="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:"number"===t.type?`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:"date"===t.type?`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:"Invalid input";break;case r.too_big:a="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:"number"===t.type?`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"bigint"===t.type?`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"date"===t.type?`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:"Invalid input";break;case r.custom:a="Invalid input";break;case r.invalid_intersection_types:a="Intersection results could not be merged";break;case r.not_multiple_of:a=`Number must be a multiple of ${t.multipleOf}`;break;case r.not_finite:a="Number must be finite";break;default:a=n.defaultError,e.assertNever(t)}return{message:a}};let d=o;function c(){return d}const u=e=>{const{data:t,path:n,errorMaps:s,issueData:a}=e,r=[...n,...a.path||[]],i={...a,path:r};if(void 0!==a.message)return{...a,path:r,message:a.message};let o="";const d=s.filter((e=>!!e)).slice().reverse();for(const c of d)o=c(i,{data:t,defaultError:o}).message;return{...a,path:r,message:o}};function l(e,t){const n=c(),s=u({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===o?void 0:o].filter((e=>!!e))});e.common.issues.push(s)}class p{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const s of t){if("aborted"===s.status)return h;"dirty"===s.status&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const s of t){const e=await s.key,t=await s.value;n.push({key:e,value:t})}return p.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const s of t){const{key:t,value:a}=s;if("aborted"===t.status)return h;if("aborted"===a.status)return h;"dirty"===t.status&&e.dirty(),"dirty"===a.status&&e.dirty(),"__proto__"===t.value||void 0===a.value&&!s.alwaysSet||(n[t.value]=a.value)}return{status:e.value,value:n}}}const h=Object.freeze({status:"aborted"}),m=e=>({status:"dirty",value:e}),f=e=>({status:"valid",value:e}),y=e=>"aborted"===e.status,g=e=>"dirty"===e.status,_=e=>"valid"===e.status,v=e=>"undefined"!=typeof Promise&&e instanceof Promise;function k(e,t,n,s){if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function w(e,t,n,s,a){if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var b,x,Z,T;"function"==typeof SuppressedError&&SuppressedError,(x=b||(b={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},x.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class S{constructor(e,t,n,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=s}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const O=(e,t)=>{if(_(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new i(e.common.issues);return this._error=t,this._error}}};function C(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:s,description:a}=e;if(t&&(n||s))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:a};return{errorMap:(t,a)=>{var r,i;const{message:o}=e;return"invalid_enum_value"===t.code?{message:null!=o?o:a.defaultError}:void 0===a.data?{message:null!==(r=null!=o?o:s)&&void 0!==r?r:a.defaultError}:"invalid_type"!==t.code?{message:a.defaultError}:{message:null!==(i=null!=o?o:n)&&void 0!==i?i:a.defaultError}},description:a}}class N{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return a(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:a(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new p,ctx:{common:e.parent.common,data:e.data,parsedType:a(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(v(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const s={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:a(e)},r=this._parseSync({data:e,path:s.path,parent:s});return O(s,r)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:a(e)},s=this._parse({data:e,path:n.path,parent:n}),r=await(v(s)?s:Promise.resolve(s));return O(n,r)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,s)=>{const a=e(t),i=()=>s.addIssue({code:r.custom,...n(t)});return"undefined"!=typeof Promise&&a instanceof Promise?a.then((e=>!!e||(i(),!1))):!!a||(i(),!1)}))}refinement(e,t){return this._refinement(((n,s)=>!!e(n)||(s.addIssue("function"==typeof t?t(n,s):t),!1)))}_refinement(e){return new xe({schema:this,typeName:Re.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Ze.create(this,this._def)}nullable(){return Te.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ae.create(this,this._def)}promise(){return be.create(this,this._def)}or(e){return oe.create([this,e],this._def)}and(e){return le.create(this,e,this._def)}transform(e){return new xe({...C(this._def),schema:this,typeName:Re.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Se({...C(this._def),innerType:this,defaultValue:t,typeName:Re.ZodDefault})}brand(){return new Pe({typeName:Re.ZodBranded,type:this,...C(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Oe({...C(this._def),innerType:this,catchValue:t,typeName:Re.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return je.create(this,e)}readonly(){return Ee.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const P=/^c[^\s-]{8,}$/i,j=/^[0-9a-z]+$/,E=/^[0-9A-HJKMNP-TV-Z]{26}$/,I=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,$=/^[a-z0-9_-]{21}$/i,R=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,A=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let M;const D=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,L=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,q=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,z="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",V=new RegExp(`^${z}$`);function F(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function U(e){let t=`${z}T${F(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}class K extends N{_parse(t){this._def.coerce&&(t.data=String(t.data));if(this._getType(t)!==s.string){const e=this._getOrReturnCtx(t);return l(e,{code:r.invalid_type,expected:s.string,received:e.parsedType}),h}const n=new p;let a;for(const s of this._def.checks)if("min"===s.kind)t.data.length<s.value&&(a=this._getOrReturnCtx(t,a),l(a,{code:r.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if("max"===s.kind)t.data.length>s.value&&(a=this._getOrReturnCtx(t,a),l(a,{code:r.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if("length"===s.kind){const e=t.data.length>s.value,i=t.data.length<s.value;(e||i)&&(a=this._getOrReturnCtx(t,a),e?l(a,{code:r.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):i&&l(a,{code:r.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if("email"===s.kind)A.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{validation:"email",code:r.invalid_string,message:s.message}),n.dirty());else if("emoji"===s.kind)M||(M=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),M.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{validation:"emoji",code:r.invalid_string,message:s.message}),n.dirty());else if("uuid"===s.kind)I.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{validation:"uuid",code:r.invalid_string,message:s.message}),n.dirty());else if("nanoid"===s.kind)$.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{validation:"nanoid",code:r.invalid_string,message:s.message}),n.dirty());else if("cuid"===s.kind)P.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{validation:"cuid",code:r.invalid_string,message:s.message}),n.dirty());else if("cuid2"===s.kind)j.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{validation:"cuid2",code:r.invalid_string,message:s.message}),n.dirty());else if("ulid"===s.kind)E.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{validation:"ulid",code:r.invalid_string,message:s.message}),n.dirty());else if("url"===s.kind)try{new URL(t.data)}catch(d){a=this._getOrReturnCtx(t,a),l(a,{validation:"url",code:r.invalid_string,message:s.message}),n.dirty()}else if("regex"===s.kind){s.regex.lastIndex=0;s.regex.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{validation:"regex",code:r.invalid_string,message:s.message}),n.dirty())}else if("trim"===s.kind)t.data=t.data.trim();else if("includes"===s.kind)t.data.includes(s.value,s.position)||(a=this._getOrReturnCtx(t,a),l(a,{code:r.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty());else if("toLowerCase"===s.kind)t.data=t.data.toLowerCase();else if("toUpperCase"===s.kind)t.data=t.data.toUpperCase();else if("startsWith"===s.kind)t.data.startsWith(s.value)||(a=this._getOrReturnCtx(t,a),l(a,{code:r.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty());else if("endsWith"===s.kind)t.data.endsWith(s.value)||(a=this._getOrReturnCtx(t,a),l(a,{code:r.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty());else if("datetime"===s.kind){U(s).test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{code:r.invalid_string,validation:"datetime",message:s.message}),n.dirty())}else if("date"===s.kind){V.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{code:r.invalid_string,validation:"date",message:s.message}),n.dirty())}else if("time"===s.kind){new RegExp(`^${F(s)}$`).test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{code:r.invalid_string,validation:"time",message:s.message}),n.dirty())}else"duration"===s.kind?R.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{validation:"duration",code:r.invalid_string,message:s.message}),n.dirty()):"ip"===s.kind?(i=t.data,("v4"!==(o=s.version)&&o||!D.test(i))&&("v6"!==o&&o||!L.test(i))&&(a=this._getOrReturnCtx(t,a),l(a,{validation:"ip",code:r.invalid_string,message:s.message}),n.dirty())):"base64"===s.kind?q.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{validation:"base64",code:r.invalid_string,message:s.message}),n.dirty()):e.assertNever(s);var i,o;return{status:n.value,value:t.data}}_regex(e,t,n){return this.refinement((t=>e.test(t)),{validation:t,code:r.invalid_string,...b.errToObj(n)})}_addCheck(e){return new K({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...b.errToObj(e)})}url(e){return this._addCheck({kind:"url",...b.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...b.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...b.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...b.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...b.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...b.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...b.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...b.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...b.errToObj(e)})}datetime(e){var t,n;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(n=null==e?void 0:e.local)&&void 0!==n&&n,...b.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...b.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...b.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...b.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...b.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...b.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...b.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...b.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...b.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...b.errToObj(t)})}nonempty(e){return this.min(1,b.errToObj(e))}trim(){return new K({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new K({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new K({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function B(e,t){const n=(e.toString().split(".")[1]||"").length,s=(t.toString().split(".")[1]||"").length,a=n>s?n:s;return parseInt(e.toFixed(a).replace(".",""))%parseInt(t.toFixed(a).replace(".",""))/Math.pow(10,a)}K.create=e=>{var t;return new K({checks:[],typeName:Re.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...C(e)})};class W extends N{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){this._def.coerce&&(t.data=Number(t.data));if(this._getType(t)!==s.number){const e=this._getOrReturnCtx(t);return l(e,{code:r.invalid_type,expected:s.number,received:e.parsedType}),h}let n;const a=new p;for(const s of this._def.checks)if("int"===s.kind)e.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),l(n,{code:r.invalid_type,expected:"integer",received:"float",message:s.message}),a.dirty());else if("min"===s.kind){(s.inclusive?t.data<s.value:t.data<=s.value)&&(n=this._getOrReturnCtx(t,n),l(n,{code:r.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty())}else if("max"===s.kind){(s.inclusive?t.data>s.value:t.data>=s.value)&&(n=this._getOrReturnCtx(t,n),l(n,{code:r.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty())}else"multipleOf"===s.kind?0!==B(t.data,s.value)&&(n=this._getOrReturnCtx(t,n),l(n,{code:r.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):"finite"===s.kind?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),l(n,{code:r.not_finite,message:s.message}),a.dirty()):e.assertNever(s);return{status:a.value,value:t.data}}gte(e,t){return this.setLimit("min",e,!0,b.toString(t))}gt(e,t){return this.setLimit("min",e,!1,b.toString(t))}lte(e,t){return this.setLimit("max",e,!0,b.toString(t))}lt(e,t){return this.setLimit("max",e,!1,b.toString(t))}setLimit(e,t,n,s){return new W({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:b.toString(s)}]})}_addCheck(e){return new W({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:b.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:b.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:b.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:b.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:b.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:b.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:b.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:b.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:b.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((t=>"int"===t.kind||"multipleOf"===t.kind&&e.isInteger(t.value)))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}W.create=e=>new W({checks:[],typeName:Re.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...C(e)});class H extends N{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){this._def.coerce&&(t.data=BigInt(t.data));if(this._getType(t)!==s.bigint){const e=this._getOrReturnCtx(t);return l(e,{code:r.invalid_type,expected:s.bigint,received:e.parsedType}),h}let n;const a=new p;for(const s of this._def.checks)if("min"===s.kind){(s.inclusive?t.data<s.value:t.data<=s.value)&&(n=this._getOrReturnCtx(t,n),l(n,{code:r.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty())}else if("max"===s.kind){(s.inclusive?t.data>s.value:t.data>=s.value)&&(n=this._getOrReturnCtx(t,n),l(n,{code:r.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty())}else"multipleOf"===s.kind?t.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),l(n,{code:r.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):e.assertNever(s);return{status:a.value,value:t.data}}gte(e,t){return this.setLimit("min",e,!0,b.toString(t))}gt(e,t){return this.setLimit("min",e,!1,b.toString(t))}lte(e,t){return this.setLimit("max",e,!0,b.toString(t))}lt(e,t){return this.setLimit("max",e,!1,b.toString(t))}setLimit(e,t,n,s){return new H({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:b.toString(s)}]})}_addCheck(e){return new H({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:b.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:b.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:b.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:b.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:b.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}H.create=e=>{var t;return new H({checks:[],typeName:Re.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...C(e)})};class J extends N{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==s.boolean){const t=this._getOrReturnCtx(e);return l(t,{code:r.invalid_type,expected:s.boolean,received:t.parsedType}),h}return f(e.data)}}J.create=e=>new J({typeName:Re.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...C(e)});class Y extends N{_parse(t){this._def.coerce&&(t.data=new Date(t.data));if(this._getType(t)!==s.date){const e=this._getOrReturnCtx(t);return l(e,{code:r.invalid_type,expected:s.date,received:e.parsedType}),h}if(isNaN(t.data.getTime())){return l(this._getOrReturnCtx(t),{code:r.invalid_date}),h}const n=new p;let a;for(const s of this._def.checks)"min"===s.kind?t.data.getTime()<s.value&&(a=this._getOrReturnCtx(t,a),l(a,{code:r.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):"max"===s.kind?t.data.getTime()>s.value&&(a=this._getOrReturnCtx(t,a),l(a,{code:r.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):e.assertNever(s);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(e){return new Y({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:b.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:b.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}Y.create=e=>new Y({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Re.ZodDate,...C(e)});class G extends N{_parse(e){if(this._getType(e)!==s.symbol){const t=this._getOrReturnCtx(e);return l(t,{code:r.invalid_type,expected:s.symbol,received:t.parsedType}),h}return f(e.data)}}G.create=e=>new G({typeName:Re.ZodSymbol,...C(e)});class X extends N{_parse(e){if(this._getType(e)!==s.undefined){const t=this._getOrReturnCtx(e);return l(t,{code:r.invalid_type,expected:s.undefined,received:t.parsedType}),h}return f(e.data)}}X.create=e=>new X({typeName:Re.ZodUndefined,...C(e)});class Q extends N{_parse(e){if(this._getType(e)!==s.null){const t=this._getOrReturnCtx(e);return l(t,{code:r.invalid_type,expected:s.null,received:t.parsedType}),h}return f(e.data)}}Q.create=e=>new Q({typeName:Re.ZodNull,...C(e)});class ee extends N{constructor(){super(...arguments),this._any=!0}_parse(e){return f(e.data)}}ee.create=e=>new ee({typeName:Re.ZodAny,...C(e)});class te extends N{constructor(){super(...arguments),this._unknown=!0}_parse(e){return f(e.data)}}te.create=e=>new te({typeName:Re.ZodUnknown,...C(e)});class ne extends N{_parse(e){const t=this._getOrReturnCtx(e);return l(t,{code:r.invalid_type,expected:s.never,received:t.parsedType}),h}}ne.create=e=>new ne({typeName:Re.ZodNever,...C(e)});class se extends N{_parse(e){if(this._getType(e)!==s.undefined){const t=this._getOrReturnCtx(e);return l(t,{code:r.invalid_type,expected:s.void,received:t.parsedType}),h}return f(e.data)}}se.create=e=>new se({typeName:Re.ZodVoid,...C(e)});class ae extends N{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),a=this._def;if(t.parsedType!==s.array)return l(t,{code:r.invalid_type,expected:s.array,received:t.parsedType}),h;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,s=t.data.length<a.exactLength.value;(e||s)&&(l(t,{code:e?r.too_big:r.too_small,minimum:s?a.exactLength.value:void 0,maximum:e?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(null!==a.minLength&&t.data.length<a.minLength.value&&(l(t,{code:r.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),null!==a.maxLength&&t.data.length>a.maxLength.value&&(l(t,{code:r.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map(((e,n)=>a.type._parseAsync(new S(t,e,t.path,n))))).then((e=>p.mergeArray(n,e)));const i=[...t.data].map(((e,n)=>a.type._parseSync(new S(t,e,t.path,n))));return p.mergeArray(n,i)}get element(){return this._def.type}min(e,t){return new ae({...this._def,minLength:{value:e,message:b.toString(t)}})}max(e,t){return new ae({...this._def,maxLength:{value:e,message:b.toString(t)}})}length(e,t){return new ae({...this._def,exactLength:{value:e,message:b.toString(t)}})}nonempty(e){return this.min(1,e)}}function re(e){if(e instanceof ie){const t={};for(const n in e.shape){const s=e.shape[n];t[n]=Ze.create(re(s))}return new ie({...e._def,shape:()=>t})}return e instanceof ae?new ae({...e._def,type:re(e.element)}):e instanceof Ze?Ze.create(re(e.unwrap())):e instanceof Te?Te.create(re(e.unwrap())):e instanceof pe?pe.create(e.items.map((e=>re(e)))):e}ae.create=(e,t)=>new ae({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Re.ZodArray,...C(t)});class ie extends N{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const t=this._def.shape(),n=e.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(e){if(this._getType(e)!==s.object){const t=this._getOrReturnCtx(e);return l(t,{code:r.invalid_type,expected:s.object,received:t.parsedType}),h}const{status:t,ctx:n}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof ne&&"strip"===this._def.unknownKeys))for(const s in n.data)i.includes(s)||o.push(s);const d=[];for(const s of i){const e=a[s],t=n.data[s];d.push({key:{status:"valid",value:s},value:e._parse(new S(n,t,n.path,s)),alwaysSet:s in n.data})}if(this._def.catchall instanceof ne){const e=this._def.unknownKeys;if("passthrough"===e)for(const t of o)d.push({key:{status:"valid",value:t},value:{status:"valid",value:n.data[t]}});else if("strict"===e)o.length>0&&(l(n,{code:r.unrecognized_keys,keys:o}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of o){const s=n.data[t];d.push({key:{status:"valid",value:t},value:e._parse(new S(n,s,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of d){const n=await t.key,s=await t.value;e.push({key:n,value:s,alwaysSet:t.alwaysSet})}return e})).then((e=>p.mergeObjectSync(t,e))):p.mergeObjectSync(t,d)}get shape(){return this._def.shape()}strict(e){return b.errToObj,new ie({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var s,a,r,i;const o=null!==(r=null===(a=(s=this._def).errorMap)||void 0===a?void 0:a.call(s,t,n).message)&&void 0!==r?r:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(i=b.errToObj(e).message)&&void 0!==i?i:o}:{message:o}}}:{}})}strip(){return new ie({...this._def,unknownKeys:"strip"})}passthrough(){return new ie({...this._def,unknownKeys:"passthrough"})}extend(e){return new ie({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ie({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Re.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ie({...this._def,catchall:e})}pick(t){const n={};return e.objectKeys(t).forEach((e=>{t[e]&&this.shape[e]&&(n[e]=this.shape[e])})),new ie({...this._def,shape:()=>n})}omit(t){const n={};return e.objectKeys(this.shape).forEach((e=>{t[e]||(n[e]=this.shape[e])})),new ie({...this._def,shape:()=>n})}deepPartial(){return re(this)}partial(t){const n={};return e.objectKeys(this.shape).forEach((e=>{const s=this.shape[e];t&&!t[e]?n[e]=s:n[e]=s.optional()})),new ie({...this._def,shape:()=>n})}required(t){const n={};return e.objectKeys(this.shape).forEach((e=>{if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof Ze;)t=t._def.innerType;n[e]=t}})),new ie({...this._def,shape:()=>n})}keyof(){return ve(e.objectKeys(this.shape))}}ie.create=(e,t)=>new ie({shape:()=>e,unknownKeys:"strip",catchall:ne.create(),typeName:Re.ZodObject,...C(t)}),ie.strictCreate=(e,t)=>new ie({shape:()=>e,unknownKeys:"strict",catchall:ne.create(),typeName:Re.ZodObject,...C(t)}),ie.lazycreate=(e,t)=>new ie({shape:e,unknownKeys:"strip",catchall:ne.create(),typeName:Re.ZodObject,...C(t)});class oe extends N{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map((async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const s of e)if("dirty"===s.result.status)return t.common.issues.push(...s.ctx.common.issues),s.result;const n=e.map((e=>new i(e.ctx.common.issues)));return l(t,{code:r.invalid_union,unionErrors:n}),h}));{let e;const s=[];for(const r of n){const n={...t,common:{...t.common,issues:[]},parent:null},a=r._parseSync({data:t.data,path:t.path,parent:n});if("valid"===a.status)return a;"dirty"!==a.status||e||(e={result:a,ctx:n}),n.common.issues.length&&s.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const a=s.map((e=>new i(e)));return l(t,{code:r.invalid_union,unionErrors:a}),h}}get options(){return this._def.options}}oe.create=(e,t)=>new oe({options:e,typeName:Re.ZodUnion,...C(t)});const de=t=>t instanceof ge?de(t.schema):t instanceof xe?de(t.innerType()):t instanceof _e?[t.value]:t instanceof ke?t.options:t instanceof we?e.objectValues(t.enum):t instanceof Se?de(t._def.innerType):t instanceof X?[void 0]:t instanceof Q?[null]:t instanceof Ze?[void 0,...de(t.unwrap())]:t instanceof Te?[null,...de(t.unwrap())]:t instanceof Pe||t instanceof Ee?de(t.unwrap()):t instanceof Oe?de(t._def.innerType):[];class ce extends N{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==s.object)return l(t,{code:r.invalid_type,expected:s.object,received:t.parsedType}),h;const n=this.discriminator,a=t.data[n],i=this.optionsMap.get(a);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(l(t,{code:r.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),h)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const s=new Map;for(const a of t){const t=de(a.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const n of t){if(s.has(n))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(n)}`);s.set(n,a)}}return new ce({typeName:Re.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...C(n)})}}function ue(t,n){const r=a(t),i=a(n);if(t===n)return{valid:!0,data:t};if(r===s.object&&i===s.object){const s=e.objectKeys(n),a=e.objectKeys(t).filter((e=>-1!==s.indexOf(e))),r={...t,...n};for(const e of a){const s=ue(t[e],n[e]);if(!s.valid)return{valid:!1};r[e]=s.data}return{valid:!0,data:r}}if(r===s.array&&i===s.array){if(t.length!==n.length)return{valid:!1};const e=[];for(let s=0;s<t.length;s++){const a=ue(t[s],n[s]);if(!a.valid)return{valid:!1};e.push(a.data)}return{valid:!0,data:e}}return r===s.date&&i===s.date&&+t==+n?{valid:!0,data:t}:{valid:!1}}class le extends N{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(e,s)=>{if(y(e)||y(s))return h;const a=ue(e.value,s.value);return a.valid?((g(e)||g(s))&&t.dirty(),{status:t.value,value:a.data}):(l(n,{code:r.invalid_intersection_types}),h)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then((([e,t])=>s(e,t))):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}le.create=(e,t,n)=>new le({left:e,right:t,typeName:Re.ZodIntersection,...C(n)});class pe extends N{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==s.array)return l(n,{code:r.invalid_type,expected:s.array,received:n.parsedType}),h;if(n.data.length<this._def.items.length)return l(n,{code:r.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),h;!this._def.rest&&n.data.length>this._def.items.length&&(l(n,{code:r.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map(((e,t)=>{const s=this._def.items[t]||this._def.rest;return s?s._parse(new S(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(a).then((e=>p.mergeArray(t,e))):p.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new pe({...this._def,rest:e})}}pe.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new pe({items:e,typeName:Re.ZodTuple,rest:null,...C(t)})};class he extends N{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==s.object)return l(n,{code:r.invalid_type,expected:s.object,received:n.parsedType}),h;const a=[],i=this._def.keyType,o=this._def.valueType;for(const s in n.data)a.push({key:i._parse(new S(n,s,n.path,s)),value:o._parse(new S(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?p.mergeObjectAsync(t,a):p.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,n){return new he(t instanceof N?{keyType:e,valueType:t,typeName:Re.ZodRecord,...C(n)}:{keyType:K.create(),valueType:e,typeName:Re.ZodRecord,...C(t)})}}class me extends N{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==s.map)return l(n,{code:r.invalid_type,expected:s.map,received:n.parsedType}),h;const a=this._def.keyType,i=this._def.valueType,o=[...n.data.entries()].map((([e,t],s)=>({key:a._parse(new S(n,e,n.path,[s,"key"])),value:i._parse(new S(n,t,n.path,[s,"value"]))})));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of o){const s=await n.key,a=await n.value;if("aborted"===s.status||"aborted"===a.status)return h;"dirty"!==s.status&&"dirty"!==a.status||t.dirty(),e.set(s.value,a.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const n of o){const s=n.key,a=n.value;if("aborted"===s.status||"aborted"===a.status)return h;"dirty"!==s.status&&"dirty"!==a.status||t.dirty(),e.set(s.value,a.value)}return{status:t.value,value:e}}}}me.create=(e,t,n)=>new me({valueType:t,keyType:e,typeName:Re.ZodMap,...C(n)});class fe extends N{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==s.set)return l(n,{code:r.invalid_type,expected:s.set,received:n.parsedType}),h;const a=this._def;null!==a.minSize&&n.data.size<a.minSize.value&&(l(n,{code:r.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),null!==a.maxSize&&n.data.size>a.maxSize.value&&(l(n,{code:r.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const i=this._def.valueType;function o(e){const n=new Set;for(const s of e){if("aborted"===s.status)return h;"dirty"===s.status&&t.dirty(),n.add(s.value)}return{status:t.value,value:n}}const d=[...n.data.values()].map(((e,t)=>i._parse(new S(n,e,n.path,t))));return n.common.async?Promise.all(d).then((e=>o(e))):o(d)}min(e,t){return new fe({...this._def,minSize:{value:e,message:b.toString(t)}})}max(e,t){return new fe({...this._def,maxSize:{value:e,message:b.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}fe.create=(e,t)=>new fe({valueType:e,minSize:null,maxSize:null,typeName:Re.ZodSet,...C(t)});class ye extends N{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==s.function)return l(t,{code:r.invalid_type,expected:s.function,received:t.parsedType}),h;function n(e,n){return u({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,c(),o].filter((e=>!!e)),issueData:{code:r.invalid_arguments,argumentsError:n}})}function a(e,n){return u({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,c(),o].filter((e=>!!e)),issueData:{code:r.invalid_return_type,returnTypeError:n}})}const d={errorMap:t.common.contextualErrorMap},p=t.data;if(this._def.returns instanceof be){const e=this;return f((async function(...t){const s=new i([]),r=await e._def.args.parseAsync(t,d).catch((e=>{throw s.addIssue(n(t,e)),s})),o=await Reflect.apply(p,this,r);return await e._def.returns._def.type.parseAsync(o,d).catch((e=>{throw s.addIssue(a(o,e)),s}))}))}{const e=this;return f((function(...t){const s=e._def.args.safeParse(t,d);if(!s.success)throw new i([n(t,s.error)]);const r=Reflect.apply(p,this,s.data),o=e._def.returns.safeParse(r,d);if(!o.success)throw new i([a(r,o.error)]);return o.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ye({...this._def,args:pe.create(e).rest(te.create())})}returns(e){return new ye({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new ye({args:e||pe.create([]).rest(te.create()),returns:t||te.create(),typeName:Re.ZodFunction,...C(n)})}}class ge extends N{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}ge.create=(e,t)=>new ge({getter:e,typeName:Re.ZodLazy,...C(t)});class _e extends N{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return l(t,{received:t.data,code:r.invalid_literal,expected:this._def.value}),h}return{status:"valid",value:e.data}}get value(){return this._def.value}}function ve(e,t){return new ke({values:e,typeName:Re.ZodEnum,...C(t)})}_e.create=(e,t)=>new _e({value:e,typeName:Re.ZodLiteral,...C(t)});class ke extends N{constructor(){super(...arguments),Z.set(this,void 0)}_parse(t){if("string"!=typeof t.data){const n=this._getOrReturnCtx(t),s=this._def.values;return l(n,{expected:e.joinValues(s),received:n.parsedType,code:r.invalid_type}),h}if(k(this,Z)||w(this,Z,new Set(this._def.values)),!k(this,Z).has(t.data)){const e=this._getOrReturnCtx(t),n=this._def.values;return l(e,{received:e.data,code:r.invalid_enum_value,options:n}),h}return f(t.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return ke.create(e,{...this._def,...t})}exclude(e,t=this._def){return ke.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}Z=new WeakMap,ke.create=ve;class we extends N{constructor(){super(...arguments),T.set(this,void 0)}_parse(t){const n=e.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(t);if(a.parsedType!==s.string&&a.parsedType!==s.number){const t=e.objectValues(n);return l(a,{expected:e.joinValues(t),received:a.parsedType,code:r.invalid_type}),h}if(k(this,T)||w(this,T,new Set(e.getValidEnumValues(this._def.values))),!k(this,T).has(t.data)){const t=e.objectValues(n);return l(a,{received:a.data,code:r.invalid_enum_value,options:t}),h}return f(t.data)}get enum(){return this._def.values}}T=new WeakMap,we.create=(e,t)=>new we({values:e,typeName:Re.ZodNativeEnum,...C(t)});class be extends N{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==s.promise&&!1===t.common.async)return l(t,{code:r.invalid_type,expected:s.promise,received:t.parsedType}),h;const n=t.parsedType===s.promise?t.data:Promise.resolve(t.data);return f(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}be.create=(e,t)=>new be({type:e,typeName:Re.ZodPromise,...C(t)});class xe extends N{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Re.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:s}=this._processInputParams(t),a=this._def.effect||null,r={addIssue:e=>{l(s,e),e.fatal?n.abort():n.dirty()},get path(){return s.path}};if(r.addIssue=r.addIssue.bind(r),"preprocess"===a.type){const e=a.transform(s.data,r);if(s.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===n.value)return h;const t=await this._def.schema._parseAsync({data:e,path:s.path,parent:s});return"aborted"===t.status?h:"dirty"===t.status||"dirty"===n.value?m(t.value):t}));{if("aborted"===n.value)return h;const t=this._def.schema._parseSync({data:e,path:s.path,parent:s});return"aborted"===t.status?h:"dirty"===t.status||"dirty"===n.value?m(t.value):t}}if("refinement"===a.type){const e=e=>{const t=a.refinement(e,r);if(s.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===s.common.async){const t=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return"aborted"===t.status?h:("dirty"===t.status&&n.dirty(),e(t.value),{status:n.value,value:t.value})}return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then((t=>"aborted"===t.status?h:("dirty"===t.status&&n.dirty(),e(t.value).then((()=>({status:n.value,value:t.value}))))))}if("transform"===a.type){if(!1===s.common.async){const e=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!_(e))return e;const t=a.transform(e.value,r);if(t instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:t}}return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then((e=>_(e)?Promise.resolve(a.transform(e.value,r)).then((e=>({status:n.value,value:e}))):e))}e.assertNever(a)}}xe.create=(e,t,n)=>new xe({schema:e,typeName:Re.ZodEffects,effect:t,...C(n)}),xe.createWithPreprocess=(e,t,n)=>new xe({schema:t,effect:{type:"preprocess",transform:e},typeName:Re.ZodEffects,...C(n)});class Ze extends N{_parse(e){return this._getType(e)===s.undefined?f(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ze.create=(e,t)=>new Ze({innerType:e,typeName:Re.ZodOptional,...C(t)});class Te extends N{_parse(e){return this._getType(e)===s.null?f(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Te.create=(e,t)=>new Te({innerType:e,typeName:Re.ZodNullable,...C(t)});class Se extends N{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===s.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Se.create=(e,t)=>new Se({innerType:e,typeName:Re.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...C(t)});class Oe extends N{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return v(s)?s.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new i(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===s.status?s.value:this._def.catchValue({get error(){return new i(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Oe.create=(e,t)=>new Oe({innerType:e,typeName:Re.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...C(t)});class Ce extends N{_parse(e){if(this._getType(e)!==s.nan){const t=this._getOrReturnCtx(e);return l(t,{code:r.invalid_type,expected:s.nan,received:t.parsedType}),h}return{status:"valid",value:e.data}}}Ce.create=e=>new Ce({typeName:Re.ZodNaN,...C(e)});const Ne=Symbol("zod_brand");class Pe extends N{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class je extends N{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?h:"dirty"===e.status?(t.dirty(),m(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})()}{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?h:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new je({in:e,out:t,typeName:Re.ZodPipeline})}}class Ee extends N{_parse(e){const t=this._def.innerType._parse(e),n=e=>(_(e)&&(e.value=Object.freeze(e.value)),e);return v(t)?t.then((e=>n(e))):n(t)}unwrap(){return this._def.innerType}}function Ie(e,t={},n){return e?ee.create().superRefine(((s,a)=>{var r,i;if(!e(s)){const e="function"==typeof t?t(s):"string"==typeof t?{message:t}:t,o=null===(i=null!==(r=e.fatal)&&void 0!==r?r:n)||void 0===i||i,d="string"==typeof e?{message:e}:e;a.addIssue({code:"custom",...d,fatal:o})}})):ee.create()}Ee.create=(e,t)=>new Ee({innerType:e,typeName:Re.ZodReadonly,...C(t)});const $e={object:ie.lazycreate};var Re,Ae;(Ae=Re||(Re={})).ZodString="ZodString",Ae.ZodNumber="ZodNumber",Ae.ZodNaN="ZodNaN",Ae.ZodBigInt="ZodBigInt",Ae.ZodBoolean="ZodBoolean",Ae.ZodDate="ZodDate",Ae.ZodSymbol="ZodSymbol",Ae.ZodUndefined="ZodUndefined",Ae.ZodNull="ZodNull",Ae.ZodAny="ZodAny",Ae.ZodUnknown="ZodUnknown",Ae.ZodNever="ZodNever",Ae.ZodVoid="ZodVoid",Ae.ZodArray="ZodArray",Ae.ZodObject="ZodObject",Ae.ZodUnion="ZodUnion",Ae.ZodDiscriminatedUnion="ZodDiscriminatedUnion",Ae.ZodIntersection="ZodIntersection",Ae.ZodTuple="ZodTuple",Ae.ZodRecord="ZodRecord",Ae.ZodMap="ZodMap",Ae.ZodSet="ZodSet",Ae.ZodFunction="ZodFunction",Ae.ZodLazy="ZodLazy",Ae.ZodLiteral="ZodLiteral",Ae.ZodEnum="ZodEnum",Ae.ZodEffects="ZodEffects",Ae.ZodNativeEnum="ZodNativeEnum",Ae.ZodOptional="ZodOptional",Ae.ZodNullable="ZodNullable",Ae.ZodDefault="ZodDefault",Ae.ZodCatch="ZodCatch",Ae.ZodPromise="ZodPromise",Ae.ZodBranded="ZodBranded",Ae.ZodPipeline="ZodPipeline",Ae.ZodReadonly="ZodReadonly";const Me=K.create,De=W.create,Le=Ce.create,qe=H.create,ze=J.create,Ve=Y.create,Fe=G.create,Ue=X.create,Ke=Q.create,Be=ee.create,We=te.create,He=ne.create,Je=se.create,Ye=ae.create,Ge=ie.create,Xe=ie.strictCreate,Qe=oe.create,et=ce.create,tt=le.create,nt=pe.create,st=he.create,at=me.create,rt=fe.create,it=ye.create,ot=ge.create,dt=_e.create,ct=ke.create,ut=we.create,lt=be.create,pt=xe.create,ht=Ze.create,mt=Te.create,ft=xe.createWithPreprocess,yt=je.create,gt={string:e=>K.create({...e,coerce:!0}),number:e=>W.create({...e,coerce:!0}),boolean:e=>J.create({...e,coerce:!0}),bigint:e=>H.create({...e,coerce:!0}),date:e=>Y.create({...e,coerce:!0})},_t=h;var vt=Object.freeze({__proto__:null,defaultErrorMap:o,setErrorMap:function(e){d=e},getErrorMap:c,makeIssue:u,EMPTY_PATH:[],addIssueToContext:l,ParseStatus:p,INVALID:h,DIRTY:m,OK:f,isAborted:y,isDirty:g,isValid:_,isAsync:v,get util(){return e},get objectUtil(){return n},ZodParsedType:s,getParsedType:a,ZodType:N,datetimeRegex:U,ZodString:K,ZodNumber:W,ZodBigInt:H,ZodBoolean:J,ZodDate:Y,ZodSymbol:G,ZodUndefined:X,ZodNull:Q,ZodAny:ee,ZodUnknown:te,ZodNever:ne,ZodVoid:se,ZodArray:ae,ZodObject:ie,ZodUnion:oe,ZodDiscriminatedUnion:ce,ZodIntersection:le,ZodTuple:pe,ZodRecord:he,ZodMap:me,ZodSet:fe,ZodFunction:ye,ZodLazy:ge,ZodLiteral:_e,ZodEnum:ke,ZodNativeEnum:we,ZodPromise:be,ZodEffects:xe,ZodTransformer:xe,ZodOptional:Ze,ZodNullable:Te,ZodDefault:Se,ZodCatch:Oe,ZodNaN:Ce,BRAND:Ne,ZodBranded:Pe,ZodPipeline:je,ZodReadonly:Ee,custom:Ie,Schema:N,ZodSchema:N,late:$e,get ZodFirstPartyTypeKind(){return Re},coerce:gt,any:Be,array:Ye,bigint:qe,boolean:ze,date:Ve,discriminatedUnion:et,effect:pt,enum:ct,function:it,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>Ie((t=>t instanceof e),t),intersection:tt,lazy:ot,literal:dt,map:at,nan:Le,nativeEnum:ut,never:He,null:Ke,nullable:mt,number:De,object:Ge,oboolean:()=>ze().optional(),onumber:()=>De().optional(),optional:ht,ostring:()=>Me().optional(),pipeline:yt,preprocess:ft,promise:lt,record:st,set:rt,strictObject:Xe,string:Me,symbol:Fe,transformer:pt,tuple:nt,undefined:Ue,union:Qe,unknown:We,void:Je,NEVER:_t,ZodIssueCode:r,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:i});const kt=vt.object({detail:vt.string()});function wt(e){if(!e)return"Unknown error";if(e instanceof Error){const t=kt.safeParse(e.cause);return t.success?t.data.detail:function(e){const t=function(e){try{return JSON.parse(e)}catch{return e}}(e);if(!t)return e;const n=kt.safeParse(t);if(n.success)return n.data.detail;return e}(e.message)}if("object"==typeof e){const t=kt.safeParse(e);return t.success?t.data.detail:JSON.stringify(e)}try{return JSON.stringify(e)}catch{return String(e)}}const bt=1e3;function xt(e,t){const n=e.map((e=>`"${e}"`)).join(", ");return new Error(`This RPC instance cannot ${t} because the transport did not provide one or more of these methods: ${n}`)}function Zt(e={}){let t={};function n(e){t=e}let s,a={};function r(e){var t;a.unregisterHandler&&a.unregisterHandler(),a=e,null==(t=a.registerHandler)||t.call(a,v)}function i(e){s="function"!=typeof e?(t,n)=>{const s=e[t];if(s)return s(n);const a=e._;if(!a)throw new Error(`The requested method has no handler: ${t}`);return a(t,n)}:e}const{maxRequestTime:o=bt}=e;e.transport&&r(e.transport),e.requestHandler&&i(e.requestHandler),e._debugHooks&&n(e._debugHooks);let d=0;const c=new Map,u=new Map;function l(e,...n){const s=n[0];return new Promise(((n,r)=>{var i;if(!a.send)throw xt(["send"],"make requests");const l=d<=1e10?++d:d=0,p={type:"request",id:l,method:e,params:s};c.set(l,{resolve:n,reject:r}),o!==1/0&&u.set(l,setTimeout((()=>{u.delete(l),r(new Error("RPC request timed out."))}),o)),null==(i=t.onSend)||i.call(t,p),a.send(p)}))}const p=new Proxy(l,{get:(e,t,n)=>t in e?Reflect.get(e,t,n):e=>l(t,e)}),h=p;function m(e,...n){var s;const r=n[0];if(!a.send)throw xt(["send"],"send messages");const i={type:"message",id:e,payload:r};null==(s=t.onSend)||s.call(t,i),a.send(i)}const f=new Proxy(m,{get:(e,t,n)=>t in e?Reflect.get(e,t,n):e=>m(t,e)}),y=f,g=new Map,_=new Set;async function v(e){var n,r;if(null==(n=t.onReceive)||n.call(t,e),!("type"in e))throw new Error("Message does not contain a type.");if("request"===e.type){if(!a.send||!s)throw xt(["send","requestHandler"],"handle requests");const{id:n,method:o,params:d}=e;let c;try{c={type:"response",id:n,success:!0,payload:await s(o,d)}}catch(i){if(!(i instanceof Error))throw i;c={type:"response",id:n,success:!1,error:i.message}}return null==(r=t.onSend)||r.call(t,c),void a.send(c)}if("response"!==e.type){if("message"!==e.type)throw new Error(`Unexpected RPC message type: ${e.type}`);{for(const n of _)n(e.id,e.payload);const t=g.get(e.id);if(!t)return;for(const n of t)n(e.payload)}}else{const t=u.get(e.id);null!=t&&clearTimeout(t);const{resolve:n,reject:s}=c.get(e.id)??{};e.success?null==n||n(e.payload):null==s||s(new Error(e.error))}}return{setTransport:r,setRequestHandler:i,request:p,requestProxy:h,send:f,sendProxy:y,addMessageListener:function(e,t){var n;if(!a.registerHandler)throw xt(["registerHandler"],"register message listeners");"*"!==e?(g.has(e)||g.set(e,new Set),null==(n=g.get(e))||n.add(t)):_.add(t)},removeMessageListener:function(e,t){var n,s;"*"!==e?(null==(n=g.get(e))||n.delete(t),0===(null==(s=g.get(e))?void 0:s.size)&&g.delete(e)):_.delete(t)},proxy:{send:y,request:h},_setDebugHooks:n}}const Tt="[transport-id]";function St(e,t={}){const{transportId:n,filter:s,remotePort:a}=t,r=e,i=a??e;let o;return{send(e){i.postMessage(function(e,t){const{transportId:n}=t;return null!=n?{[Tt]:n,data:e}:e}(e,{transportId:n}))},registerHandler(e){o=t=>{const a=t.data,[r,i]=function(e,t){const{transportId:n,filter:s}=t,a=null==s?void 0:s();if(null!=n&&null!=a)throw new Error("Cannot use both `transportId` and `filter` at the same time");let r=e;if(n){if(e[Tt]!==n)return[!0];r=e.data}return!1===a?[!0]:[!1,r]}(a,{transportId:n,filter:()=>null==s?void 0:s(t)});r||e(i)},r.addEventListener("message",o)},unregisterHandler(){o&&r.removeEventListener("message",o)}}}const Ot={debug:(...e)=>{},log:(...e)=>{console.log(...e)},warn:(...e)=>{console.warn(...e)},error:(...e)=>{console.error(...e)},trace:(...e)=>{console.trace(...e)}};const Ct="undefined"!=typeof window&&window.Logger||Ot;function Nt(e){return e.FS}const Pt="notebook.py",jt="/marimo",Et=Pt,It=e=>{const t=Nt(e);try{t.mkdir(jt)}catch{}t.chdir(jt)},$t=e=>{Nt(e).mount(e.FS.filesystems.IDBFS,{root:"."},jt)},Rt=async e=>{await Lt(e,!0)},At=async e=>{await Lt(e,!1)},Mt=e=>{const t=Nt(e),n=`${jt}/${Pt}`;return t.readFile(n,{encoding:"utf8"})},Dt=e=>{const{pyodide:t,filename:n,code:s}=e,a=Nt(t);if(n&&n!==Pt){const e=(e=>{try{return a.readFile(e,{encoding:"utf8"})}catch{return null}})(n);if(e)return{code:e,filename:n}}return a.writeFile(Pt,s),{code:s,filename:Pt}};function Lt(e,t){return new Promise(((n,s)=>{Nt(e).syncfs(t,(e=>{e?s(e):n()}))}))}function qt(e){return e?"local"===e?"http://localhost:8000/dist/marimo-latest-py3-none-any.whl":"latest"===e?"marimo-base":`marimo-base==${e}`:"marimo-base>=0.9.0"}const zt=new class{constructor(){this.spans=[]}startSpan(e,t={}){const n={name:e,startTime:Date.now(),attributes:t,end:(e="ok")=>this.endSpan(n,e)};return this.spans.push(n),n}endSpan(e,t="ok"){e.endTime=Date.now(),e.status=t}getSpans(){return this.spans}wrap(e,t,n={}){const s=this.startSpan(t||e.name,n);try{const t=e();return this.endSpan(s),t}catch(a){throw this.endSpan(s,"error"),a}}wrapAsync(e,t,n={}){return async(...s)=>{const a=this.startSpan(t||e.name,n);try{const t=await e(...s);return this.endSpan(a),t}catch(r){throw this.endSpan(a,"error"),r}}}logSpans(){}};globalThis.t=zt;class Vt{constructor(){this.pyodide=null}get requirePyodide(){return function(e,t){if(!e)throw new Error(t)}(this.pyodide,"Pyodide not loaded"),this.pyodide}async bootstrap(e){const t=await this.loadPyodideAndPackages(e.pyodideVersion),{version:n}=e;return n.includes("dev")?(await this.installDevMarimoAndDeps(t,n),t):(await this.installMarimoAndDeps(t,n),t)}async loadPyodideAndPackages(e){if(!loadPyodide)throw new Error("loadPyodide is not defined");const t=zt.startSpan("loadPyodide"),n=await loadPyodide({packages:["micropip"],indexURL:`https://cdn.jsdelivr.net/pyodide/${e}/full/`});return this.pyodide=n,t.end("ok"),n}async installDevMarimoAndDeps(e,t){const n=zt.startSpan("installDevMarimoAndDeps");await Promise.all([e.runPythonAsync(`\n import micropip\n await micropip.install(\n [\n "${qt(t)}",\n ],\n deps=False,\n index_urls="https://test.pypi.org/pypi/{package_name}/json"\n );\n `),e.runPythonAsync('\n import micropip\n await micropip.install(\n [\n "Markdown==3.6",\n "pymdown-extensions==10.8.1",\n "narwhals==1.9.2",\n ],\n deps=False,\n );\n ')]),n.end("ok")}async installMarimoAndDeps(e,t){const n=zt.startSpan("installMarimoAndDeps");await e.runPythonAsync(`\n import micropip\n await micropip.install(\n [\n "${qt(t)}",\n "Markdown==3.6",\n "pymdown-extensions==10.8.1",\n "narwhals==1.9.2",\n ],\n deps=False,\n );\n `),n.end("ok")}async mountFilesystem(e){const t=zt.startSpan("mountFilesystem");return It(this.requirePyodide),$t(this.requirePyodide),await Rt(this.requirePyodide),t.end("ok"),Dt({pyodide:this.requirePyodide,code:e.code,filename:e.filename})}async startSession(e){const{code:t,filename:n,onMessage:s,queryParameters:a,userConfig:r}=e;self.messenger={callback:s},self.query_params=a,self.user_config=r;const i=zt.startSpan("startSession.runPython"),o=n||Et,[d,c,u]=this.requirePyodide.runPython(`\n print("[py] Starting marimo...")\n import asyncio\n import js\n from marimo._pyodide.bootstrap import create_session, instantiate\n\n assert js.messenger, "messenger is not defined"\n assert js.query_params, "query_params is not defined"\n\n session, bridge = create_session(\n filename="${o}",\n query_params=js.query_params.to_py(),\n message_callback=js.messenger.callback,\n user_config=js.user_config.to_py(),\n )\n\n def init(auto_instantiate=True):\n if auto_instantiate:\n instantiate(session)\n asyncio.create_task(session.start())\n\n # Find the packages to install\n with open("${o}", "r") as f:\n packages = session.find_packages(f.read())\n\n bridge, init, packages`);i.end();const l=new Set(u.toJs());return this.loadNotebookDeps(t,l).then((()=>c(r.runtime.auto_instantiate))),d}async loadNotebookDeps(e,t){const n=this.requirePyodide;e.includes("mo.sql")&&(e=`import duckdb\n${e=`import pandas\n${e}`}`),e=`import pyodide_http\n${e=`import jedi\n${e=`import pygments\n${e=`import docutils\n${e}`}`}`}`;const s=[...t];let a=zt.startSpan("pyodide.loadPackage");await n.loadPackagesFromImports(e,{errorCallback:Ct.error,messageCallback:Ct.log}),a.end(),a=zt.startSpan("micropip.install");const r=s.filter((e=>!n.loadedPackages[e]));r.length>0&&await n.runPythonAsync(`\n import micropip\n import sys\n # Filter out builtins\n missing = [p for p in ${JSON.stringify(r)} if p not in sys.modules]\n print("Loaded from micropip:", missing)\n await micropip.install(missing)\n `).catch((e=>{Ct.error("Failed to load packages from micropip",e)})),a.end()}}const Ft=async function(){var e;try{const t=self.name,n=function(e){return e.includes("dev"),"v0.26.2"}(t);await async function(e){return e.includes("dev"),await import("https://cdn.jsdelivr.net/pyodide/v0.26.2/full/pyodide.js")}(t);const s=await async function(e){try{return await import(`/wasm/controller.js?version=${e}`)}catch{return new Vt}}(t);self.controller=s,self.pyodide=await s.bootstrap({version:t,pyodideVersion:n}),await(null==(e=s.mountFilesystem)?void 0:e.call(s,{code:"",filename:null})),Kt.send.initialized({})}catch(t){Ct.error("Error bootstrapping",t),Kt.send.initializedError({error:wt(t)})}}(),Ut={readFile:async e=>{await Ft;return self.pyodide.FS.readFile(e,{encoding:"utf8"})},readNotebook:async()=>(await Ft,Mt(self.pyodide)),saveNotebook:async e=>{await Ft;const t=self.pyodide.runPython("\n from marimo._pyodide.bootstrap import save_file\n\n save_file\n ");await t(JSON.stringify(e),Et),await At(self.pyodide)}},Kt=function(e){return Zt(e)}({transport:(Bt={transportId:"marimo-transport"},St(self,Bt)),requestHandler:Ut});var Bt;Kt.send("ready",{})}();
@@ -1 +0,0 @@
1
- import{s as r,a as s,c as t,b as a}from"./chunk-5RIWM3LS-DS12e7Ja.js";import{_ as e}from"./mermaid-CrKddFRb.js";import"./transform-CaCRavvA.js";import"./chunk-4LC2V6XN-D4kCS8j6.js";import"./index-smzK0Z-Y.js";import"./step-CNn2V7Th.js";import"./timer-CK-RIWfW.js";var o={parser:r,db:s,renderer:t,styles:a,init:e((r=>{r.state||(r.state={}),r.state.arrowMarkerAbsolute=r.arrowMarkerAbsolute,s.clear()}),"init")};export{o as diagram};
@@ -1 +0,0 @@
1
- !function(){"use strict";function e(e){return e.FS}const t="notebook.py",s="/marimo",n=t,a=t=>{const n=e(t);try{n.mkdir(s)}catch{}n.chdir(s)},r=t=>{e(t).mount(t.FS.filesystems.IDBFS,{root:"."},s)},i=async e=>{await c(e,!0)},o=async e=>{await c(e,!1)},d=s=>{const{pyodide:n,filename:a,code:r}=s,i=e(n);if(a&&a!==t){const e=(e=>{try{return i.readFile(e,{encoding:"utf8"})}catch{return null}})(a);if(e)return{code:e,filename:a}}return i.writeFile(t,r),{code:r,filename:t}};function c(t,s){return new Promise(((n,a)=>{e(t).syncfs(s,(e=>{e?a(e):n()}))}))}var u,l,p;(l=u||(u={})).assertEqual=e=>e,l.assertIs=function(e){},l.assertNever=function(e){throw new Error},l.arrayToEnum=e=>{const t={};for(const s of e)t[s]=s;return t},l.getValidEnumValues=e=>{const t=l.objectKeys(e).filter((t=>"number"!=typeof e[e[t]])),s={};for(const n of t)s[n]=e[n];return l.objectValues(s)},l.objectValues=e=>l.objectKeys(e).map((function(t){return e[t]})),l.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.push(s);return t},l.find=(e,t)=>{for(const s of e)if(t(s))return s},l.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,l.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},l.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(p||(p={})).mergeShapes=(e,t)=>({...e,...t});const h=u.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),m=e=>{switch(typeof e){case"undefined":return h.undefined;case"string":return h.string;case"number":return isNaN(e)?h.nan:h.number;case"boolean":return h.boolean;case"function":return h.function;case"bigint":return h.bigint;case"symbol":return h.symbol;case"object":return Array.isArray(e)?h.array:null===e?h.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?h.promise:"undefined"!=typeof Map&&e instanceof Map?h.map:"undefined"!=typeof Set&&e instanceof Set?h.set:"undefined"!=typeof Date&&e instanceof Date?h.date:h.object;default:return h.unknown}},f=u.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class y extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},s={_errors:[]},n=e=>{for(const a of e.issues)if("invalid_union"===a.code)a.unionErrors.map(n);else if("invalid_return_type"===a.code)n(a.returnTypeError);else if("invalid_arguments"===a.code)n(a.argumentsError);else if(0===a.path.length)s._errors.push(t(a));else{let e=s,n=0;for(;n<a.path.length;){const s=a.path[n];n===a.path.length-1?(e[s]=e[s]||{_errors:[]},e[s]._errors.push(t(a))):e[s]=e[s]||{_errors:[]},e=e[s],n++}}};return n(this),s}static assert(e){if(!(e instanceof y))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,u.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},s=[];for(const n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):s.push(e(n));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}}y.create=e=>new y(e);const g=(e,t)=>{let s;switch(e.code){case f.invalid_type:s=e.received===h.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case f.invalid_literal:s=`Invalid literal value, expected ${JSON.stringify(e.expected,u.jsonStringifyReplacer)}`;break;case f.unrecognized_keys:s=`Unrecognized key(s) in object: ${u.joinValues(e.keys,", ")}`;break;case f.invalid_union:s="Invalid input";break;case f.invalid_union_discriminator:s=`Invalid discriminator value. Expected ${u.joinValues(e.options)}`;break;case f.invalid_enum_value:s=`Invalid enum value. Expected ${u.joinValues(e.options)}, received '${e.received}'`;break;case f.invalid_arguments:s="Invalid function arguments";break;case f.invalid_return_type:s="Invalid function return type";break;case f.invalid_date:s="Invalid date";break;case f.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(s=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(s=`${s} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?s=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?s=`Invalid input: must end with "${e.validation.endsWith}"`:u.assertNever(e.validation):s="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case f.too_small:s="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case f.too_big:s="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case f.custom:s="Invalid input";break;case f.invalid_intersection_types:s="Intersection results could not be merged";break;case f.not_multiple_of:s=`Number must be a multiple of ${e.multipleOf}`;break;case f.not_finite:s="Number must be finite";break;default:s=t.defaultError,u.assertNever(e)}return{message:s}};let _=g;function v(){return _}const k=e=>{const{data:t,path:s,errorMaps:n,issueData:a}=e,r=[...s,...a.path||[]],i={...a,path:r};if(void 0!==a.message)return{...a,path:r,message:a.message};let o="";const d=n.filter((e=>!!e)).slice().reverse();for(const c of d)o=c(i,{data:t,defaultError:o}).message;return{...a,path:r,message:o}};function w(e,t){const s=v(),n=k({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,s,s===g?void 0:g].filter((e=>!!e))});e.common.issues.push(n)}class b{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const s=[];for(const n of t){if("aborted"===n.status)return x;"dirty"===n.status&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){const s=[];for(const n of t){const e=await n.key,t=await n.value;s.push({key:e,value:t})}return b.mergeObjectSync(e,s)}static mergeObjectSync(e,t){const s={};for(const n of t){const{key:t,value:a}=n;if("aborted"===t.status)return x;if("aborted"===a.status)return x;"dirty"===t.status&&e.dirty(),"dirty"===a.status&&e.dirty(),"__proto__"===t.value||void 0===a.value&&!n.alwaysSet||(s[t.value]=a.value)}return{status:e.value,value:s}}}const x=Object.freeze({status:"aborted"}),Z=e=>({status:"dirty",value:e}),S=e=>({status:"valid",value:e}),T=e=>"aborted"===e.status,O=e=>"dirty"===e.status,N=e=>"valid"===e.status,P=e=>"undefined"!=typeof Promise&&e instanceof Promise;function C(e,t,s,n){if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function j(e,t,s,n,a){if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,s),s}var E,I,A,$;"function"==typeof SuppressedError&&SuppressedError,(I=E||(E={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},I.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class R{constructor(e,t,s,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=n}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const M=(e,t)=>{if(N(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new y(e.common.issues);return this._error=t,this._error}}};function D(e){if(!e)return{};const{errorMap:t,invalid_type_error:s,required_error:n,description:a}=e;if(t&&(s||n))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:a};return{errorMap:(t,a)=>{var r,i;const{message:o}=e;return"invalid_enum_value"===t.code?{message:null!=o?o:a.defaultError}:void 0===a.data?{message:null!==(r=null!=o?o:n)&&void 0!==r?r:a.defaultError}:"invalid_type"!==t.code?{message:a.defaultError}:{message:null!==(i=null!=o?o:s)&&void 0!==i?i:a.defaultError}},description:a}}class L{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return m(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:m(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new b,ctx:{common:e.parent.common,data:e.data,parsedType:m(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(P(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){var s;const n={common:{issues:[],async:null!==(s=null==t?void 0:t.async)&&void 0!==s&&s,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:m(e)},a=this._parseSync({data:e,path:n.path,parent:n});return M(n,a)}async parseAsync(e,t){const s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){const s={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:m(e)},n=this._parse({data:e,path:s.path,parent:s}),a=await(P(n)?n:Promise.resolve(n));return M(s,a)}refine(e,t){const s=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,n)=>{const a=e(t),r=()=>n.addIssue({code:f.custom,...s(t)});return"undefined"!=typeof Promise&&a instanceof Promise?a.then((e=>!!e||(r(),!1))):!!a||(r(),!1)}))}refinement(e,t){return this._refinement(((s,n)=>!!e(s)||(n.addIssue("function"==typeof t?t(s,n):t),!1)))}_refinement(e){return new Ie({schema:this,typeName:Ke.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Ae.create(this,this._def)}nullable(){return $e.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return me.create(this,this._def)}promise(){return Ee.create(this,this._def)}or(e){return ge.create([this,e],this._def)}and(e){return we.create(this,e,this._def)}transform(e){return new Ie({...D(this._def),schema:this,typeName:Ke.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Re({...D(this._def),innerType:this,defaultValue:t,typeName:Ke.ZodDefault})}brand(){return new qe({typeName:Ke.ZodBranded,type:this,...D(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Me({...D(this._def),innerType:this,catchValue:t,typeName:Ke.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return ze.create(this,e)}readonly(){return Fe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const q=/^c[^\s-]{8,}$/i,z=/^[0-9a-z]+$/,F=/^[0-9A-HJKMNP-TV-Z]{26}$/,V=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,U=/^[a-z0-9_-]{21}$/i,K=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,B=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let W;const H=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,J=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Y=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,G="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",X=new RegExp(`^${G}$`);function Q(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function ee(e){let t=`${G}T${Q(e)}`;const s=[];return s.push(e.local?"Z?":"Z"),e.offset&&s.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${s.join("|")})`,new RegExp(`^${t}$`)}class te extends L{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==h.string){const t=this._getOrReturnCtx(e);return w(t,{code:f.invalid_type,expected:h.string,received:t.parsedType}),x}const t=new b;let s;for(const i of this._def.checks)if("min"===i.kind)e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),w(s,{code:f.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),t.dirty());else if("max"===i.kind)e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),w(s,{code:f.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),t.dirty());else if("length"===i.kind){const n=e.data.length>i.value,a=e.data.length<i.value;(n||a)&&(s=this._getOrReturnCtx(e,s),n?w(s,{code:f.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&w(s,{code:f.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),t.dirty())}else if("email"===i.kind)B.test(e.data)||(s=this._getOrReturnCtx(e,s),w(s,{validation:"email",code:f.invalid_string,message:i.message}),t.dirty());else if("emoji"===i.kind)W||(W=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),W.test(e.data)||(s=this._getOrReturnCtx(e,s),w(s,{validation:"emoji",code:f.invalid_string,message:i.message}),t.dirty());else if("uuid"===i.kind)V.test(e.data)||(s=this._getOrReturnCtx(e,s),w(s,{validation:"uuid",code:f.invalid_string,message:i.message}),t.dirty());else if("nanoid"===i.kind)U.test(e.data)||(s=this._getOrReturnCtx(e,s),w(s,{validation:"nanoid",code:f.invalid_string,message:i.message}),t.dirty());else if("cuid"===i.kind)q.test(e.data)||(s=this._getOrReturnCtx(e,s),w(s,{validation:"cuid",code:f.invalid_string,message:i.message}),t.dirty());else if("cuid2"===i.kind)z.test(e.data)||(s=this._getOrReturnCtx(e,s),w(s,{validation:"cuid2",code:f.invalid_string,message:i.message}),t.dirty());else if("ulid"===i.kind)F.test(e.data)||(s=this._getOrReturnCtx(e,s),w(s,{validation:"ulid",code:f.invalid_string,message:i.message}),t.dirty());else if("url"===i.kind)try{new URL(e.data)}catch(r){s=this._getOrReturnCtx(e,s),w(s,{validation:"url",code:f.invalid_string,message:i.message}),t.dirty()}else if("regex"===i.kind){i.regex.lastIndex=0;i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),w(s,{validation:"regex",code:f.invalid_string,message:i.message}),t.dirty())}else if("trim"===i.kind)e.data=e.data.trim();else if("includes"===i.kind)e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),w(s,{code:f.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),t.dirty());else if("toLowerCase"===i.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===i.kind)e.data=e.data.toUpperCase();else if("startsWith"===i.kind)e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),w(s,{code:f.invalid_string,validation:{startsWith:i.value},message:i.message}),t.dirty());else if("endsWith"===i.kind)e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),w(s,{code:f.invalid_string,validation:{endsWith:i.value},message:i.message}),t.dirty());else if("datetime"===i.kind){ee(i).test(e.data)||(s=this._getOrReturnCtx(e,s),w(s,{code:f.invalid_string,validation:"datetime",message:i.message}),t.dirty())}else if("date"===i.kind){X.test(e.data)||(s=this._getOrReturnCtx(e,s),w(s,{code:f.invalid_string,validation:"date",message:i.message}),t.dirty())}else if("time"===i.kind){new RegExp(`^${Q(i)}$`).test(e.data)||(s=this._getOrReturnCtx(e,s),w(s,{code:f.invalid_string,validation:"time",message:i.message}),t.dirty())}else"duration"===i.kind?K.test(e.data)||(s=this._getOrReturnCtx(e,s),w(s,{validation:"duration",code:f.invalid_string,message:i.message}),t.dirty()):"ip"===i.kind?(n=e.data,("v4"!==(a=i.version)&&a||!H.test(n))&&("v6"!==a&&a||!J.test(n))&&(s=this._getOrReturnCtx(e,s),w(s,{validation:"ip",code:f.invalid_string,message:i.message}),t.dirty())):"base64"===i.kind?Y.test(e.data)||(s=this._getOrReturnCtx(e,s),w(s,{validation:"base64",code:f.invalid_string,message:i.message}),t.dirty()):u.assertNever(i);var n,a;return{status:t.value,value:e.data}}_regex(e,t,s){return this.refinement((t=>e.test(t)),{validation:t,code:f.invalid_string,...E.errToObj(s)})}_addCheck(e){return new te({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...E.errToObj(e)})}url(e){return this._addCheck({kind:"url",...E.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...E.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...E.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...E.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...E.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...E.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...E.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...E.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...E.errToObj(e)})}datetime(e){var t,s;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(s=null==e?void 0:e.local)&&void 0!==s&&s,...E.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...E.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...E.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...E.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...E.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...E.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...E.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...E.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...E.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...E.errToObj(t)})}nonempty(e){return this.min(1,E.errToObj(e))}trim(){return new te({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new te({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new te({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function se(e,t){const s=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,a=s>n?s:n;return parseInt(e.toFixed(a).replace(".",""))%parseInt(t.toFixed(a).replace(".",""))/Math.pow(10,a)}te.create=e=>{var t;return new te({checks:[],typeName:Ke.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...D(e)})};class ne extends L{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==h.number){const t=this._getOrReturnCtx(e);return w(t,{code:f.invalid_type,expected:h.number,received:t.parsedType}),x}let t;const s=new b;for(const n of this._def.checks)if("int"===n.kind)u.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),w(t,{code:f.invalid_type,expected:"integer",received:"float",message:n.message}),s.dirty());else if("min"===n.kind){(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),w(t,{code:f.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),s.dirty())}else if("max"===n.kind){(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),w(t,{code:f.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),s.dirty())}else"multipleOf"===n.kind?0!==se(e.data,n.value)&&(t=this._getOrReturnCtx(e,t),w(t,{code:f.not_multiple_of,multipleOf:n.value,message:n.message}),s.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),w(t,{code:f.not_finite,message:n.message}),s.dirty()):u.assertNever(n);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,E.toString(t))}gt(e,t){return this.setLimit("min",e,!1,E.toString(t))}lte(e,t){return this.setLimit("max",e,!0,E.toString(t))}lt(e,t){return this.setLimit("max",e,!1,E.toString(t))}setLimit(e,t,s,n){return new ne({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:E.toString(n)}]})}_addCheck(e){return new ne({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:E.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:E.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:E.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:E.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:E.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:E.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:E.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:E.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:E.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&u.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const s of this._def.checks){if("finite"===s.kind||"int"===s.kind||"multipleOf"===s.kind)return!0;"min"===s.kind?(null===t||s.value>t)&&(t=s.value):"max"===s.kind&&(null===e||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}ne.create=e=>new ne({checks:[],typeName:Ke.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...D(e)});class ae extends L{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){this._def.coerce&&(e.data=BigInt(e.data));if(this._getType(e)!==h.bigint){const t=this._getOrReturnCtx(e);return w(t,{code:f.invalid_type,expected:h.bigint,received:t.parsedType}),x}let t;const s=new b;for(const n of this._def.checks)if("min"===n.kind){(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),w(t,{code:f.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),s.dirty())}else if("max"===n.kind){(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),w(t,{code:f.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),s.dirty())}else"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),w(t,{code:f.not_multiple_of,multipleOf:n.value,message:n.message}),s.dirty()):u.assertNever(n);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,E.toString(t))}gt(e,t){return this.setLimit("min",e,!1,E.toString(t))}lte(e,t){return this.setLimit("max",e,!0,E.toString(t))}lt(e,t){return this.setLimit("max",e,!1,E.toString(t))}setLimit(e,t,s,n){return new ae({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:E.toString(n)}]})}_addCheck(e){return new ae({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:E.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:E.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:E.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:E.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:E.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}ae.create=e=>{var t;return new ae({checks:[],typeName:Ke.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...D(e)})};class re extends L{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==h.boolean){const t=this._getOrReturnCtx(e);return w(t,{code:f.invalid_type,expected:h.boolean,received:t.parsedType}),x}return S(e.data)}}re.create=e=>new re({typeName:Ke.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...D(e)});class ie extends L{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==h.date){const t=this._getOrReturnCtx(e);return w(t,{code:f.invalid_type,expected:h.date,received:t.parsedType}),x}if(isNaN(e.data.getTime())){return w(this._getOrReturnCtx(e),{code:f.invalid_date}),x}const t=new b;let s;for(const n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(s=this._getOrReturnCtx(e,s),w(s,{code:f.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),t.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(s=this._getOrReturnCtx(e,s),w(s,{code:f.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),t.dirty()):u.assertNever(n);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ie({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:E.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:E.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}ie.create=e=>new ie({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Ke.ZodDate,...D(e)});class oe extends L{_parse(e){if(this._getType(e)!==h.symbol){const t=this._getOrReturnCtx(e);return w(t,{code:f.invalid_type,expected:h.symbol,received:t.parsedType}),x}return S(e.data)}}oe.create=e=>new oe({typeName:Ke.ZodSymbol,...D(e)});class de extends L{_parse(e){if(this._getType(e)!==h.undefined){const t=this._getOrReturnCtx(e);return w(t,{code:f.invalid_type,expected:h.undefined,received:t.parsedType}),x}return S(e.data)}}de.create=e=>new de({typeName:Ke.ZodUndefined,...D(e)});class ce extends L{_parse(e){if(this._getType(e)!==h.null){const t=this._getOrReturnCtx(e);return w(t,{code:f.invalid_type,expected:h.null,received:t.parsedType}),x}return S(e.data)}}ce.create=e=>new ce({typeName:Ke.ZodNull,...D(e)});class ue extends L{constructor(){super(...arguments),this._any=!0}_parse(e){return S(e.data)}}ue.create=e=>new ue({typeName:Ke.ZodAny,...D(e)});class le extends L{constructor(){super(...arguments),this._unknown=!0}_parse(e){return S(e.data)}}le.create=e=>new le({typeName:Ke.ZodUnknown,...D(e)});class pe extends L{_parse(e){const t=this._getOrReturnCtx(e);return w(t,{code:f.invalid_type,expected:h.never,received:t.parsedType}),x}}pe.create=e=>new pe({typeName:Ke.ZodNever,...D(e)});class he extends L{_parse(e){if(this._getType(e)!==h.undefined){const t=this._getOrReturnCtx(e);return w(t,{code:f.invalid_type,expected:h.void,received:t.parsedType}),x}return S(e.data)}}he.create=e=>new he({typeName:Ke.ZodVoid,...D(e)});class me extends L{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),n=this._def;if(t.parsedType!==h.array)return w(t,{code:f.invalid_type,expected:h.array,received:t.parsedType}),x;if(null!==n.exactLength){const e=t.data.length>n.exactLength.value,a=t.data.length<n.exactLength.value;(e||a)&&(w(t,{code:e?f.too_big:f.too_small,minimum:a?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(w(t,{code:f.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(w(t,{code:f.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map(((e,s)=>n.type._parseAsync(new R(t,e,t.path,s))))).then((e=>b.mergeArray(s,e)));const a=[...t.data].map(((e,s)=>n.type._parseSync(new R(t,e,t.path,s))));return b.mergeArray(s,a)}get element(){return this._def.type}min(e,t){return new me({...this._def,minLength:{value:e,message:E.toString(t)}})}max(e,t){return new me({...this._def,maxLength:{value:e,message:E.toString(t)}})}length(e,t){return new me({...this._def,exactLength:{value:e,message:E.toString(t)}})}nonempty(e){return this.min(1,e)}}function fe(e){if(e instanceof ye){const t={};for(const s in e.shape){const n=e.shape[s];t[s]=Ae.create(fe(n))}return new ye({...e._def,shape:()=>t})}return e instanceof me?new me({...e._def,type:fe(e.element)}):e instanceof Ae?Ae.create(fe(e.unwrap())):e instanceof $e?$e.create(fe(e.unwrap())):e instanceof be?be.create(e.items.map((e=>fe(e)))):e}me.create=(e,t)=>new me({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ke.ZodArray,...D(t)});class ye extends L{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=u.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==h.object){const t=this._getOrReturnCtx(e);return w(t,{code:f.invalid_type,expected:h.object,received:t.parsedType}),x}const{status:t,ctx:s}=this._processInputParams(e),{shape:n,keys:a}=this._getCached(),r=[];if(!(this._def.catchall instanceof pe&&"strip"===this._def.unknownKeys))for(const o in s.data)a.includes(o)||r.push(o);const i=[];for(const o of a){const e=n[o],t=s.data[o];i.push({key:{status:"valid",value:o},value:e._parse(new R(s,t,s.path,o)),alwaysSet:o in s.data})}if(this._def.catchall instanceof pe){const e=this._def.unknownKeys;if("passthrough"===e)for(const t of r)i.push({key:{status:"valid",value:t},value:{status:"valid",value:s.data[t]}});else if("strict"===e)r.length>0&&(w(s,{code:f.unrecognized_keys,keys:r}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of r){const n=s.data[t];i.push({key:{status:"valid",value:t},value:e._parse(new R(s,n,s.path,t)),alwaysSet:t in s.data})}}return s.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of i){const s=await t.key,n=await t.value;e.push({key:s,value:n,alwaysSet:t.alwaysSet})}return e})).then((e=>b.mergeObjectSync(t,e))):b.mergeObjectSync(t,i)}get shape(){return this._def.shape()}strict(e){return E.errToObj,new ye({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,s)=>{var n,a,r,i;const o=null!==(r=null===(a=(n=this._def).errorMap)||void 0===a?void 0:a.call(n,t,s).message)&&void 0!==r?r:s.defaultError;return"unrecognized_keys"===t.code?{message:null!==(i=E.errToObj(e).message)&&void 0!==i?i:o}:{message:o}}}:{}})}strip(){return new ye({...this._def,unknownKeys:"strip"})}passthrough(){return new ye({...this._def,unknownKeys:"passthrough"})}extend(e){return new ye({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ye({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ke.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ye({...this._def,catchall:e})}pick(e){const t={};return u.objectKeys(e).forEach((s=>{e[s]&&this.shape[s]&&(t[s]=this.shape[s])})),new ye({...this._def,shape:()=>t})}omit(e){const t={};return u.objectKeys(this.shape).forEach((s=>{e[s]||(t[s]=this.shape[s])})),new ye({...this._def,shape:()=>t})}deepPartial(){return fe(this)}partial(e){const t={};return u.objectKeys(this.shape).forEach((s=>{const n=this.shape[s];e&&!e[s]?t[s]=n:t[s]=n.optional()})),new ye({...this._def,shape:()=>t})}required(e){const t={};return u.objectKeys(this.shape).forEach((s=>{if(e&&!e[s])t[s]=this.shape[s];else{let e=this.shape[s];for(;e instanceof Ae;)e=e._def.innerType;t[s]=e}})),new ye({...this._def,shape:()=>t})}keyof(){return Pe(u.objectKeys(this.shape))}}ye.create=(e,t)=>new ye({shape:()=>e,unknownKeys:"strip",catchall:pe.create(),typeName:Ke.ZodObject,...D(t)}),ye.strictCreate=(e,t)=>new ye({shape:()=>e,unknownKeys:"strict",catchall:pe.create(),typeName:Ke.ZodObject,...D(t)}),ye.lazycreate=(e,t)=>new ye({shape:e,unknownKeys:"strip",catchall:pe.create(),typeName:Ke.ZodObject,...D(t)});class ge extends L{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;if(t.common.async)return Promise.all(s.map((async e=>{const s={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:s}),ctx:s}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;const s=e.map((e=>new y(e.ctx.common.issues)));return w(t,{code:f.invalid_union,unionErrors:s}),x}));{let e;const n=[];for(const r of s){const s={...t,common:{...t.common,issues:[]},parent:null},a=r._parseSync({data:t.data,path:t.path,parent:s});if("valid"===a.status)return a;"dirty"!==a.status||e||(e={result:a,ctx:s}),s.common.issues.length&&n.push(s.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const a=n.map((e=>new y(e)));return w(t,{code:f.invalid_union,unionErrors:a}),x}}get options(){return this._def.options}}ge.create=(e,t)=>new ge({options:e,typeName:Ke.ZodUnion,...D(t)});const _e=e=>e instanceof Oe?_e(e.schema):e instanceof Ie?_e(e.innerType()):e instanceof Ne?[e.value]:e instanceof Ce?e.options:e instanceof je?u.objectValues(e.enum):e instanceof Re?_e(e._def.innerType):e instanceof de?[void 0]:e instanceof ce?[null]:e instanceof Ae?[void 0,..._e(e.unwrap())]:e instanceof $e?[null,..._e(e.unwrap())]:e instanceof qe||e instanceof Fe?_e(e.unwrap()):e instanceof Me?_e(e._def.innerType):[];class ve extends L{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.object)return w(t,{code:f.invalid_type,expected:h.object,received:t.parsedType}),x;const s=this.discriminator,n=t.data[s],a=this.optionsMap.get(n);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(w(t,{code:f.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),x)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){const n=new Map;for(const a of t){const t=_e(a.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const s of t){if(n.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);n.set(s,a)}}return new ve({typeName:Ke.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...D(s)})}}function ke(e,t){const s=m(e),n=m(t);if(e===t)return{valid:!0,data:e};if(s===h.object&&n===h.object){const s=u.objectKeys(t),n=u.objectKeys(e).filter((e=>-1!==s.indexOf(e))),a={...e,...t};for(const r of n){const s=ke(e[r],t[r]);if(!s.valid)return{valid:!1};a[r]=s.data}return{valid:!0,data:a}}if(s===h.array&&n===h.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let n=0;n<e.length;n++){const a=ke(e[n],t[n]);if(!a.valid)return{valid:!1};s.push(a.data)}return{valid:!0,data:s}}return s===h.date&&n===h.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class we extends L{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),n=(e,n)=>{if(T(e)||T(n))return x;const a=ke(e.value,n.value);return a.valid?((O(e)||O(n))&&t.dirty(),{status:t.value,value:a.data}):(w(s,{code:f.invalid_intersection_types}),x)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then((([e,t])=>n(e,t))):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}we.create=(e,t,s)=>new we({left:e,right:t,typeName:Ke.ZodIntersection,...D(s)});class be extends L{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.array)return w(s,{code:f.invalid_type,expected:h.array,received:s.parsedType}),x;if(s.data.length<this._def.items.length)return w(s,{code:f.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),x;!this._def.rest&&s.data.length>this._def.items.length&&(w(s,{code:f.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...s.data].map(((e,t)=>{const n=this._def.items[t]||this._def.rest;return n?n._parse(new R(s,e,s.path,t)):null})).filter((e=>!!e));return s.common.async?Promise.all(n).then((e=>b.mergeArray(t,e))):b.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new be({...this._def,rest:e})}}be.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new be({items:e,typeName:Ke.ZodTuple,rest:null,...D(t)})};class xe extends L{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.object)return w(s,{code:f.invalid_type,expected:h.object,received:s.parsedType}),x;const n=[],a=this._def.keyType,r=this._def.valueType;for(const i in s.data)n.push({key:a._parse(new R(s,i,s.path,i)),value:r._parse(new R(s,s.data[i],s.path,i)),alwaysSet:i in s.data});return s.common.async?b.mergeObjectAsync(t,n):b.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,s){return new xe(t instanceof L?{keyType:e,valueType:t,typeName:Ke.ZodRecord,...D(s)}:{keyType:te.create(),valueType:e,typeName:Ke.ZodRecord,...D(t)})}}class Ze extends L{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.map)return w(s,{code:f.invalid_type,expected:h.map,received:s.parsedType}),x;const n=this._def.keyType,a=this._def.valueType,r=[...s.data.entries()].map((([e,t],r)=>({key:n._parse(new R(s,e,s.path,[r,"key"])),value:a._parse(new R(s,t,s.path,[r,"value"]))})));if(s.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const s of r){const n=await s.key,a=await s.value;if("aborted"===n.status||"aborted"===a.status)return x;"dirty"!==n.status&&"dirty"!==a.status||t.dirty(),e.set(n.value,a.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const s of r){const n=s.key,a=s.value;if("aborted"===n.status||"aborted"===a.status)return x;"dirty"!==n.status&&"dirty"!==a.status||t.dirty(),e.set(n.value,a.value)}return{status:t.value,value:e}}}}Ze.create=(e,t,s)=>new Ze({valueType:t,keyType:e,typeName:Ke.ZodMap,...D(s)});class Se extends L{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.set)return w(s,{code:f.invalid_type,expected:h.set,received:s.parsedType}),x;const n=this._def;null!==n.minSize&&s.data.size<n.minSize.value&&(w(s,{code:f.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&s.data.size>n.maxSize.value&&(w(s,{code:f.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const a=this._def.valueType;function r(e){const s=new Set;for(const n of e){if("aborted"===n.status)return x;"dirty"===n.status&&t.dirty(),s.add(n.value)}return{status:t.value,value:s}}const i=[...s.data.values()].map(((e,t)=>a._parse(new R(s,e,s.path,t))));return s.common.async?Promise.all(i).then((e=>r(e))):r(i)}min(e,t){return new Se({...this._def,minSize:{value:e,message:E.toString(t)}})}max(e,t){return new Se({...this._def,maxSize:{value:e,message:E.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Se.create=(e,t)=>new Se({valueType:e,minSize:null,maxSize:null,typeName:Ke.ZodSet,...D(t)});class Te extends L{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.function)return w(t,{code:f.invalid_type,expected:h.function,received:t.parsedType}),x;function s(e,s){return k({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,v(),g].filter((e=>!!e)),issueData:{code:f.invalid_arguments,argumentsError:s}})}function n(e,s){return k({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,v(),g].filter((e=>!!e)),issueData:{code:f.invalid_return_type,returnTypeError:s}})}const a={errorMap:t.common.contextualErrorMap},r=t.data;if(this._def.returns instanceof Ee){const e=this;return S((async function(...t){const i=new y([]),o=await e._def.args.parseAsync(t,a).catch((e=>{throw i.addIssue(s(t,e)),i})),d=await Reflect.apply(r,this,o);return await e._def.returns._def.type.parseAsync(d,a).catch((e=>{throw i.addIssue(n(d,e)),i}))}))}{const e=this;return S((function(...t){const i=e._def.args.safeParse(t,a);if(!i.success)throw new y([s(t,i.error)]);const o=Reflect.apply(r,this,i.data),d=e._def.returns.safeParse(o,a);if(!d.success)throw new y([n(o,d.error)]);return d.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Te({...this._def,args:be.create(e).rest(le.create())})}returns(e){return new Te({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new Te({args:e||be.create([]).rest(le.create()),returns:t||le.create(),typeName:Ke.ZodFunction,...D(s)})}}class Oe extends L{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Oe.create=(e,t)=>new Oe({getter:e,typeName:Ke.ZodLazy,...D(t)});class Ne extends L{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return w(t,{received:t.data,code:f.invalid_literal,expected:this._def.value}),x}return{status:"valid",value:e.data}}get value(){return this._def.value}}function Pe(e,t){return new Ce({values:e,typeName:Ke.ZodEnum,...D(t)})}Ne.create=(e,t)=>new Ne({value:e,typeName:Ke.ZodLiteral,...D(t)});class Ce extends L{constructor(){super(...arguments),A.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),s=this._def.values;return w(t,{expected:u.joinValues(s),received:t.parsedType,code:f.invalid_type}),x}if(C(this,A)||j(this,A,new Set(this._def.values)),!C(this,A).has(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return w(t,{received:t.data,code:f.invalid_enum_value,options:s}),x}return S(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Ce.create(e,{...this._def,...t})}exclude(e,t=this._def){return Ce.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}A=new WeakMap,Ce.create=Pe;class je extends L{constructor(){super(...arguments),$.set(this,void 0)}_parse(e){const t=u.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==h.string&&s.parsedType!==h.number){const e=u.objectValues(t);return w(s,{expected:u.joinValues(e),received:s.parsedType,code:f.invalid_type}),x}if(C(this,$)||j(this,$,new Set(u.getValidEnumValues(this._def.values))),!C(this,$).has(e.data)){const e=u.objectValues(t);return w(s,{received:s.data,code:f.invalid_enum_value,options:e}),x}return S(e.data)}get enum(){return this._def.values}}$=new WeakMap,je.create=(e,t)=>new je({values:e,typeName:Ke.ZodNativeEnum,...D(t)});class Ee extends L{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.promise&&!1===t.common.async)return w(t,{code:f.invalid_type,expected:h.promise,received:t.parsedType}),x;const s=t.parsedType===h.promise?t.data:Promise.resolve(t.data);return S(s.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}Ee.create=(e,t)=>new Ee({type:e,typeName:Ke.ZodPromise,...D(t)});class Ie extends L{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ke.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:s}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:e=>{w(s,e),e.fatal?t.abort():t.dirty()},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),"preprocess"===n.type){const e=n.transform(s.data,a);if(s.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return x;const n=await this._def.schema._parseAsync({data:e,path:s.path,parent:s});return"aborted"===n.status?x:"dirty"===n.status||"dirty"===t.value?Z(n.value):n}));{if("aborted"===t.value)return x;const n=this._def.schema._parseSync({data:e,path:s.path,parent:s});return"aborted"===n.status?x:"dirty"===n.status||"dirty"===t.value?Z(n.value):n}}if("refinement"===n.type){const e=e=>{const t=n.refinement(e,a);if(s.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===s.common.async){const n=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return"aborted"===n.status?x:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then((s=>"aborted"===s.status?x:("dirty"===s.status&&t.dirty(),e(s.value).then((()=>({status:t.value,value:s.value}))))))}if("transform"===n.type){if(!1===s.common.async){const e=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!N(e))return e;const r=n.transform(e.value,a);if(r instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:r}}return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then((e=>N(e)?Promise.resolve(n.transform(e.value,a)).then((e=>({status:t.value,value:e}))):e))}u.assertNever(n)}}Ie.create=(e,t,s)=>new Ie({schema:e,typeName:Ke.ZodEffects,effect:t,...D(s)}),Ie.createWithPreprocess=(e,t,s)=>new Ie({schema:t,effect:{type:"preprocess",transform:e},typeName:Ke.ZodEffects,...D(s)});class Ae extends L{_parse(e){return this._getType(e)===h.undefined?S(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ae.create=(e,t)=>new Ae({innerType:e,typeName:Ke.ZodOptional,...D(t)});class $e extends L{_parse(e){return this._getType(e)===h.null?S(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}$e.create=(e,t)=>new $e({innerType:e,typeName:Ke.ZodNullable,...D(t)});class Re extends L{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===h.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Re.create=(e,t)=>new Re({innerType:e,typeName:Ke.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...D(t)});class Me extends L{_parse(e){const{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return P(n)?n.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new y(s.common.issues)},input:s.data})}))):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new y(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}Me.create=(e,t)=>new Me({innerType:e,typeName:Ke.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...D(t)});class De extends L{_parse(e){if(this._getType(e)!==h.nan){const t=this._getOrReturnCtx(e);return w(t,{code:f.invalid_type,expected:h.nan,received:t.parsedType}),x}return{status:"valid",value:e.data}}}De.create=e=>new De({typeName:Ke.ZodNaN,...D(e)});const Le=Symbol("zod_brand");class qe extends L{_parse(e){const{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}}class ze extends L{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return"aborted"===e.status?x:"dirty"===e.status?(t.dirty(),Z(e.value)):this._def.out._parseAsync({data:e.value,path:s.path,parent:s})})()}{const e=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return"aborted"===e.status?x:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:s.path,parent:s})}}static create(e,t){return new ze({in:e,out:t,typeName:Ke.ZodPipeline})}}class Fe extends L{_parse(e){const t=this._def.innerType._parse(e),s=e=>(N(e)&&(e.value=Object.freeze(e.value)),e);return P(t)?t.then((e=>s(e))):s(t)}unwrap(){return this._def.innerType}}function Ve(e,t={},s){return e?ue.create().superRefine(((n,a)=>{var r,i;if(!e(n)){const e="function"==typeof t?t(n):"string"==typeof t?{message:t}:t,o=null===(i=null!==(r=e.fatal)&&void 0!==r?r:s)||void 0===i||i,d="string"==typeof e?{message:e}:e;a.addIssue({code:"custom",...d,fatal:o})}})):ue.create()}Fe.create=(e,t)=>new Fe({innerType:e,typeName:Ke.ZodReadonly,...D(t)});const Ue={object:ye.lazycreate};var Ke,Be;(Be=Ke||(Ke={})).ZodString="ZodString",Be.ZodNumber="ZodNumber",Be.ZodNaN="ZodNaN",Be.ZodBigInt="ZodBigInt",Be.ZodBoolean="ZodBoolean",Be.ZodDate="ZodDate",Be.ZodSymbol="ZodSymbol",Be.ZodUndefined="ZodUndefined",Be.ZodNull="ZodNull",Be.ZodAny="ZodAny",Be.ZodUnknown="ZodUnknown",Be.ZodNever="ZodNever",Be.ZodVoid="ZodVoid",Be.ZodArray="ZodArray",Be.ZodObject="ZodObject",Be.ZodUnion="ZodUnion",Be.ZodDiscriminatedUnion="ZodDiscriminatedUnion",Be.ZodIntersection="ZodIntersection",Be.ZodTuple="ZodTuple",Be.ZodRecord="ZodRecord",Be.ZodMap="ZodMap",Be.ZodSet="ZodSet",Be.ZodFunction="ZodFunction",Be.ZodLazy="ZodLazy",Be.ZodLiteral="ZodLiteral",Be.ZodEnum="ZodEnum",Be.ZodEffects="ZodEffects",Be.ZodNativeEnum="ZodNativeEnum",Be.ZodOptional="ZodOptional",Be.ZodNullable="ZodNullable",Be.ZodDefault="ZodDefault",Be.ZodCatch="ZodCatch",Be.ZodPromise="ZodPromise",Be.ZodBranded="ZodBranded",Be.ZodPipeline="ZodPipeline",Be.ZodReadonly="ZodReadonly";const We=te.create,He=ne.create,Je=De.create,Ye=ae.create,Ge=re.create,Xe=ie.create,Qe=oe.create,et=de.create,tt=ce.create,st=ue.create,nt=le.create,at=pe.create,rt=he.create,it=me.create,ot=ye.create,dt=ye.strictCreate,ct=ge.create,ut=ve.create,lt=we.create,pt=be.create,ht=xe.create,mt=Ze.create,ft=Se.create,yt=Te.create,gt=Oe.create,_t=Ne.create,vt=Ce.create,kt=je.create,wt=Ee.create,bt=Ie.create,xt=Ae.create,Zt=$e.create,St=Ie.createWithPreprocess,Tt=ze.create,Ot={string:e=>te.create({...e,coerce:!0}),number:e=>ne.create({...e,coerce:!0}),boolean:e=>re.create({...e,coerce:!0}),bigint:e=>ae.create({...e,coerce:!0}),date:e=>ie.create({...e,coerce:!0})},Nt=x;var Pt=Object.freeze({__proto__:null,defaultErrorMap:g,setErrorMap:function(e){_=e},getErrorMap:v,makeIssue:k,EMPTY_PATH:[],addIssueToContext:w,ParseStatus:b,INVALID:x,DIRTY:Z,OK:S,isAborted:T,isDirty:O,isValid:N,isAsync:P,get util(){return u},get objectUtil(){return p},ZodParsedType:h,getParsedType:m,ZodType:L,datetimeRegex:ee,ZodString:te,ZodNumber:ne,ZodBigInt:ae,ZodBoolean:re,ZodDate:ie,ZodSymbol:oe,ZodUndefined:de,ZodNull:ce,ZodAny:ue,ZodUnknown:le,ZodNever:pe,ZodVoid:he,ZodArray:me,ZodObject:ye,ZodUnion:ge,ZodDiscriminatedUnion:ve,ZodIntersection:we,ZodTuple:be,ZodRecord:xe,ZodMap:Ze,ZodSet:Se,ZodFunction:Te,ZodLazy:Oe,ZodLiteral:Ne,ZodEnum:Ce,ZodNativeEnum:je,ZodPromise:Ee,ZodEffects:Ie,ZodTransformer:Ie,ZodOptional:Ae,ZodNullable:$e,ZodDefault:Re,ZodCatch:Me,ZodNaN:De,BRAND:Le,ZodBranded:qe,ZodPipeline:ze,ZodReadonly:Fe,custom:Ve,Schema:L,ZodSchema:L,late:Ue,get ZodFirstPartyTypeKind(){return Ke},coerce:Ot,any:st,array:it,bigint:Ye,boolean:Ge,date:Xe,discriminatedUnion:ut,effect:bt,enum:vt,function:yt,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>Ve((t=>t instanceof e),t),intersection:lt,lazy:gt,literal:_t,map:mt,nan:Je,nativeEnum:kt,never:at,null:tt,nullable:Zt,number:He,object:ot,oboolean:()=>Ge().optional(),onumber:()=>He().optional(),optional:xt,ostring:()=>We().optional(),pipeline:Tt,preprocess:St,promise:wt,record:ht,set:ft,strictObject:dt,string:We,symbol:Qe,transformer:bt,tuple:pt,undefined:et,union:ct,unknown:nt,void:rt,NEVER:Nt,ZodIssueCode:f,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:y});const Ct=Pt.object({detail:Pt.string()});function jt(e){if(!e)return"Unknown error";if(e instanceof Error){const t=Ct.safeParse(e.cause);return t.success?t.data.detail:function(e){const t=function(e){try{return JSON.parse(e)}catch{return e}}(e);if(!t)return e;const s=Ct.safeParse(t);if(s.success)return s.data.detail;return e}(e.message)}if("object"==typeof e){const t=Ct.safeParse(e);return t.success?t.data.detail:JSON.stringify(e)}try{return JSON.stringify(e)}catch{return String(e)}}const Et=1e3;function It(e,t){const s=e.map((e=>`"${e}"`)).join(", ");return new Error(`This RPC instance cannot ${t} because the transport did not provide one or more of these methods: ${s}`)}function At(e={}){let t={};function s(e){t=e}let n,a={};function r(e){var t;a.unregisterHandler&&a.unregisterHandler(),a=e,null==(t=a.registerHandler)||t.call(a,v)}function i(e){n="function"!=typeof e?(t,s)=>{const n=e[t];if(n)return n(s);const a=e._;if(!a)throw new Error(`The requested method has no handler: ${t}`);return a(t,s)}:e}const{maxRequestTime:o=Et}=e;e.transport&&r(e.transport),e.requestHandler&&i(e.requestHandler),e._debugHooks&&s(e._debugHooks);let d=0;const c=new Map,u=new Map;function l(e,...s){const n=s[0];return new Promise(((s,r)=>{var i;if(!a.send)throw It(["send"],"make requests");const l=d<=1e10?++d:d=0,p={type:"request",id:l,method:e,params:n};c.set(l,{resolve:s,reject:r}),o!==1/0&&u.set(l,setTimeout((()=>{u.delete(l),r(new Error("RPC request timed out."))}),o)),null==(i=t.onSend)||i.call(t,p),a.send(p)}))}const p=new Proxy(l,{get:(e,t,s)=>t in e?Reflect.get(e,t,s):e=>l(t,e)}),h=p;function m(e,...s){var n;const r=s[0];if(!a.send)throw It(["send"],"send messages");const i={type:"message",id:e,payload:r};null==(n=t.onSend)||n.call(t,i),a.send(i)}const f=new Proxy(m,{get:(e,t,s)=>t in e?Reflect.get(e,t,s):e=>m(t,e)}),y=f,g=new Map,_=new Set;async function v(e){var s,r;if(null==(s=t.onReceive)||s.call(t,e),!("type"in e))throw new Error("Message does not contain a type.");if("request"===e.type){if(!a.send||!n)throw It(["send","requestHandler"],"handle requests");const{id:s,method:o,params:d}=e;let c;try{c={type:"response",id:s,success:!0,payload:await n(o,d)}}catch(i){if(!(i instanceof Error))throw i;c={type:"response",id:s,success:!1,error:i.message}}return null==(r=t.onSend)||r.call(t,c),void a.send(c)}if("response"!==e.type){if("message"!==e.type)throw new Error(`Unexpected RPC message type: ${e.type}`);{for(const s of _)s(e.id,e.payload);const t=g.get(e.id);if(!t)return;for(const s of t)s(e.payload)}}else{const t=u.get(e.id);null!=t&&clearTimeout(t);const{resolve:s,reject:n}=c.get(e.id)??{};e.success?null==s||s(e.payload):null==n||n(new Error(e.error))}}return{setTransport:r,setRequestHandler:i,request:p,requestProxy:h,send:f,sendProxy:y,addMessageListener:function(e,t){var s;if(!a.registerHandler)throw It(["registerHandler"],"register message listeners");"*"!==e?(g.has(e)||g.set(e,new Set),null==(s=g.get(e))||s.add(t)):_.add(t)},removeMessageListener:function(e,t){var s,n;"*"!==e?(null==(s=g.get(e))||s.delete(t),0===(null==(n=g.get(e))?void 0:n.size)&&g.delete(e)):_.delete(t)},proxy:{send:y,request:h},_setDebugHooks:s}}const $t="[transport-id]";function Rt(e,t={}){const{transportId:s,filter:n,remotePort:a}=t,r=e,i=a??e;let o;return{send(e){i.postMessage(function(e,t){const{transportId:s}=t;return null!=s?{[$t]:s,data:e}:e}(e,{transportId:s}))},registerHandler(e){o=t=>{const a=t.data,[r,i]=function(e,t){const{transportId:s,filter:n}=t,a=null==n?void 0:n();if(null!=s&&null!=a)throw new Error("Cannot use both `transportId` and `filter` at the same time");let r=e;if(s){if(e[$t]!==s)return[!0];r=e.data}return!1===a?[!0]:[!1,r]}(a,{transportId:s,filter:()=>null==n?void 0:n(t)});r||e(i)},r.addEventListener("message",o)},unregisterHandler(){o&&r.removeEventListener("message",o)}}}const Mt={debug:(...e)=>{},log:(...e)=>{console.log(...e)},warn:(...e)=>{console.warn(...e)},error:(...e)=>{console.error(...e)},trace:(...e)=>{console.trace(...e)}};const Dt="undefined"!=typeof window&&window.Logger||Mt;function Lt(e,t){if(!e)throw new Error(t)}async function qt(e){return e.includes("dev"),await import("https://cdn.jsdelivr.net/pyodide/v0.26.2/full/pyodide.js")}const zt=new class{constructor(){this.spans=[]}startSpan(e,t={}){const s={name:e,startTime:Date.now(),attributes:t,end:(e="ok")=>this.endSpan(s,e)};return this.spans.push(s),s}endSpan(e,t="ok"){e.endTime=Date.now(),e.status=t}getSpans(){return this.spans}wrap(e,t,s={}){const n=this.startSpan(t||e.name,s);try{const t=e();return this.endSpan(n),t}catch(a){throw this.endSpan(n,"error"),a}}wrapAsync(e,t,s={}){return async(...n)=>{const a=this.startSpan(t||e.name,s);try{const t=await e(...n);return this.endSpan(a),t}catch(r){throw this.endSpan(a,"error"),r}}}logSpans(){}};function Ft(e){return e?"local"===e?"http://localhost:8000/dist/marimo-latest-py3-none-any.whl":"latest"===e?"marimo-base":`marimo-base==${e}`:"marimo-base>=0.9.0"}globalThis.t=zt;class Vt{constructor(){this.pyodide=null}get requirePyodide(){return Lt(this.pyodide,"Pyodide not loaded"),this.pyodide}async bootstrap(e){const t=await this.loadPyodideAndPackages(e.pyodideVersion),{version:s}=e;return s.includes("dev")?(await this.installDevMarimoAndDeps(t,s),t):(await this.installMarimoAndDeps(t,s),t)}async loadPyodideAndPackages(e){if(!loadPyodide)throw new Error("loadPyodide is not defined");const t=zt.startSpan("loadPyodide"),s=await loadPyodide({packages:["micropip"],indexURL:`https://cdn.jsdelivr.net/pyodide/${e}/full/`});return this.pyodide=s,t.end("ok"),s}async installDevMarimoAndDeps(e,t){const s=zt.startSpan("installDevMarimoAndDeps");await Promise.all([e.runPythonAsync(`\n import micropip\n await micropip.install(\n [\n "${Ft(t)}",\n ],\n deps=False,\n index_urls="https://test.pypi.org/pypi/{package_name}/json"\n );\n `),e.runPythonAsync('\n import micropip\n await micropip.install(\n [\n "Markdown==3.6",\n "pymdown-extensions==10.8.1",\n "narwhals==1.9.2",\n ],\n deps=False,\n );\n ')]),s.end("ok")}async installMarimoAndDeps(e,t){const s=zt.startSpan("installMarimoAndDeps");await e.runPythonAsync(`\n import micropip\n await micropip.install(\n [\n "${Ft(t)}",\n "Markdown==3.6",\n "pymdown-extensions==10.8.1",\n "narwhals==1.9.2",\n ],\n deps=False,\n );\n `),s.end("ok")}async mountFilesystem(e){const t=zt.startSpan("mountFilesystem");return a(this.requirePyodide),r(this.requirePyodide),await i(this.requirePyodide),t.end("ok"),d({pyodide:this.requirePyodide,code:e.code,filename:e.filename})}async startSession(e){const{code:t,filename:s,onMessage:a,queryParameters:r,userConfig:i}=e;self.messenger={callback:a},self.query_params=r,self.user_config=i;const o=zt.startSpan("startSession.runPython"),d=s||n,[c,u,l]=this.requirePyodide.runPython(`\n print("[py] Starting marimo...")\n import asyncio\n import js\n from marimo._pyodide.bootstrap import create_session, instantiate\n\n assert js.messenger, "messenger is not defined"\n assert js.query_params, "query_params is not defined"\n\n session, bridge = create_session(\n filename="${d}",\n query_params=js.query_params.to_py(),\n message_callback=js.messenger.callback,\n user_config=js.user_config.to_py(),\n )\n\n def init(auto_instantiate=True):\n if auto_instantiate:\n instantiate(session)\n asyncio.create_task(session.start())\n\n # Find the packages to install\n with open("${d}", "r") as f:\n packages = session.find_packages(f.read())\n\n bridge, init, packages`);o.end();const p=new Set(l.toJs());return this.loadNotebookDeps(t,p).then((()=>u(i.runtime.auto_instantiate))),c}async loadNotebookDeps(e,t){const s=this.requirePyodide;e.includes("mo.sql")&&(e=`import duckdb\n${e=`import pandas\n${e}`}`),e=`import pyodide_http\n${e=`import jedi\n${e=`import pygments\n${e=`import docutils\n${e}`}`}`}`;const n=[...t];let a=zt.startSpan("pyodide.loadPackage");await s.loadPackagesFromImports(e,{errorCallback:Dt.error,messageCallback:Dt.log}),a.end(),a=zt.startSpan("micropip.install");const r=n.filter((e=>!s.loadedPackages[e]));r.length>0&&await s.runPythonAsync(`\n import micropip\n import sys\n # Filter out builtins\n missing = [p for p in ${JSON.stringify(r)} if p not in sys.modules]\n print("Loaded from micropip:", missing)\n await micropip.install(missing)\n `).catch((e=>{Dt.error("Failed to load packages from micropip",e)})),a.end()}}async function Ut(e){try{return await import(`/wasm/controller.js?version=${e}`)}catch{return new Vt}}const Kt=zt.startSpan("worker:init");const Bt=new class{constructor(e){this.onMessage=e,this.started=!1,this.push=e=>{this.started?this.onMessage(e):this.buffer.push(e)},this.start=()=>{this.started=!0,this.buffer.forEach((e=>this.onMessage(e))),this.buffer=[]},this.buffer=[]}}((e=>{Yt.send.kernelMessage({message:e})})),Wt=new class{constructor(){this.status="pending",this.promise=new Promise(((e,t)=>{this.reject=e=>{this.status="rejected",t(e)},this.resolve=t=>{this.status="resolved",e(t)}}))}};let Ht=!1;const Jt={startSession:async e=>{var t,s;if(await Qt,Ht)Dt.warn("Session already started");else{Ht=!0;try{Lt(self.controller,"Controller not loaded"),await(null==(s=(t=self.controller).mountFilesystem)?void 0:s.call(t,{code:e.code,filename:e.filename}));const n=zt.wrapAsync(self.controller.startSession.bind(self.controller)),a=function(e){let t,s=!1;return function(...n){return s||(s=!0,t=e.apply(this,n)),t}}((()=>{Yt.send.initializingMessage({message:"Initializing notebook..."}),Yt.send.initialized({})}));Yt.send.initializingMessage({message:"Loading notebook and dependencies..."});const r=await n({code:e.code,filename:e.filename,queryParameters:e.queryParameters,userConfig:e.userConfig,onMessage:e=>{a(),Bt.push(e)}});Wt.resolve(r),Kt.end("ok")}catch(n){Yt.send.initializedError({error:jt(n)}),Kt.end("error")}}},loadPackages:async e=>{const t=zt.startSpan("loadPackages");await Qt,e.includes("mo.sql")&&(e=`import duckdb\n${e=`import pandas\n${e}`}`),await self.pyodide.loadPackagesFromImports(e,{messageCallback:Dt.log,errorCallback:Dt.error}),t.end()},readFile:async e=>{const t=zt.startSpan("readFile");await Qt;const s=self.pyodide.FS.readFile(e,{encoding:"utf8"});return t.end(),s},setInterruptBuffer:async e=>{await Qt,self.pyodide.setInterruptBuffer(e)},addPackage:async e=>{await Qt;const{package:t}=e,s=await self.pyodide.runPythonAsync(`\n import micropip\n import json\n response = None\n try:\n await micropip.install("${t}")\n response = {"success": True}\n except Exception as e:\n response = {"success": False, "error": str(e)}\n json.dumps(response)\n `);return JSON.parse(s)},removePackage:async e=>{await Qt;const{package:t}=e,s=await self.pyodide.runPythonAsync(`\n import micropip\n import json\n response = None\n try:\n micropip.uninstall("${t}")\n response = {"success": True}\n except Exception as e:\n response = {"success": False, "error": str(e)}\n json.dumps(response)\n `);return JSON.parse(s)},listPackages:async()=>{const e=zt.startSpan("listPackages");await Qt;const t=await self.pyodide.runPythonAsync('\n import json\n import micropip\n\n packages = micropip.list()\n packages = [\n {"name": p.name, "version": p.version}\n for p in packages.values()\n ]\n json.dumps(sorted(packages, key=lambda pkg: pkg["name"]))\n ');return e.end(),{packages:JSON.parse(t)}},bridge:async e=>{const t=zt.startSpan("bridge",{functionName:e.functionName});await Qt;const{functionName:s,payload:n}=e;"format"===s&&await self.pyodide.runPythonAsync('\n import micropip\n\n try:\n import black\n except ModuleNotFoundError:\n await micropip.install("black")\n '),"export_markdown"===s&&await self.pyodide.runPythonAsync('\n import micropip\n\n try:\n import yaml\n except ModuleNotFoundError:\n await micropip.install("pyyaml")\n ');const a=await Wt.promise,r=null==n?null:"string"==typeof n?n:JSON.stringify(n),i=null==r?await a[s]():await a[s](r);return Xt.has(s)&&o(self.pyodide),t.end(),"string"==typeof i?JSON.parse(i):i}},Yt=function(e){return At(e)}({transport:(Gt={transportId:"marimo-transport"},Rt(self,Gt)),requestHandler:Jt});var Gt;Yt.send("ready",{}),Yt.addMessageListener("consumerReady",(async()=>{await Qt,Bt.start()}));const Xt=new Set(["save","save_app_config","rename_file","create_file_or_directory","delete_file_or_directory","move_file_or_directory","update_file"]);const Qt=zt.wrapAsync((async function(){try{const e=self.name,t=function(e){return e.includes("dev"),"v0.26.2"}(e);await zt.wrapAsync(qt)(e);const s=await zt.wrapAsync(Ut)(e);self.controller=s,Yt.send.initializingMessage({message:"Loading marimo..."}),self.pyodide=await zt.wrapAsync(s.bootstrap.bind(s))({version:e,pyodideVersion:t})}catch(e){Dt.error("Error bootstrapping",e),Yt.send.initializedError({error:jt(e)})}}))()}();