sparkforensics-server 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/index.js +147 -0
  2. package/lib/static-files.js +50 -0
  3. package/package.json +28 -0
  4. package/public/assets/AutoscalingChurn-CP5OjN6v.js +1 -0
  5. package/public/assets/CacheUtilization-BjyawXL6.js +1 -0
  6. package/public/assets/CachingOpportunity-DV2ABG2G.js +1 -0
  7. package/public/assets/ConfigAudit-DMiBhAoG.js +1 -0
  8. package/public/assets/CoreUsageArea-CGYIgPnt.js +1 -0
  9. package/public/assets/Dashboard-D1_IrWRs.js +12 -0
  10. package/public/assets/ExecutorTimeline-DkaAGqQT.js +1 -0
  11. package/public/assets/Failures-Crngoicu.js +1 -0
  12. package/public/assets/GcPressure-CFXm4BnA.js +1 -0
  13. package/public/assets/IncompleteRun-BWEJTb13.js +1 -0
  14. package/public/assets/JobFailures-BmjxCA-h.js +1 -0
  15. package/public/assets/MemoryUtilization-Bu2uQJbd.js +1 -0
  16. package/public/assets/PlanExplorer-DKUwF0uz.js +1 -0
  17. package/public/assets/PlanGraphRoute-BjPSugIG.js +1 -0
  18. package/public/assets/ShuffleIO--Rur3neu.js +1 -0
  19. package/public/assets/Spill-DIMpt8c2.js +1 -0
  20. package/public/assets/TaskSkew-BDr1DbeI.js +1 -0
  21. package/public/assets/charts-vendor-NMqKV0H4.js +59 -0
  22. package/public/assets/index-4id52G-A.js +9 -0
  23. package/public/assets/index-D9kwVYIO.css +1 -0
  24. package/public/assets/parser-worker-00O9WEQC.js +65 -0
  25. package/public/assets/plan-graph-vendor-BnuhLJ6X.css +1 -0
  26. package/public/assets/plan-graph-vendor-vZQHG2EJ.js +7 -0
  27. package/public/assets/react-vendor-u4pyvC5Y.js +9 -0
  28. package/public/assets/useRecentFiles-46iBU9zJ.js +5 -0
  29. package/public/docs/404.html +26 -0
  30. package/public/docs/assets/app.Bxy4_HVA.js +1 -0
  31. package/public/docs/assets/chunks/@localSearchIndexroot.DclgKtlT.js +1 -0
  32. package/public/docs/assets/chunks/VPLocalSearchBox.L5jNOIR3.js +9 -0
  33. package/public/docs/assets/chunks/framework.CNDaxUod.js +20 -0
  34. package/public/docs/assets/chunks/theme.CoT6y5bf.js +2 -0
  35. package/public/docs/assets/contributor-guide_architecture_board-widgets.md.BtjoE_1k.js +1 -0
  36. package/public/docs/assets/contributor-guide_architecture_board-widgets.md.BtjoE_1k.lean.js +1 -0
  37. package/public/docs/assets/contributor-guide_architecture_detector-contract.md.DQyCHQNM.js +1 -0
  38. package/public/docs/assets/contributor-guide_architecture_detector-contract.md.DQyCHQNM.lean.js +1 -0
  39. package/public/docs/assets/contributor-guide_architecture_drill-down.md.BKfyDQck.js +1 -0
  40. package/public/docs/assets/contributor-guide_architecture_drill-down.md.BKfyDQck.lean.js +1 -0
  41. package/public/docs/assets/contributor-guide_architecture_impact-estimation.md.CzlXOnCq.js +1 -0
  42. package/public/docs/assets/contributor-guide_architecture_impact-estimation.md.CzlXOnCq.lean.js +1 -0
  43. package/public/docs/assets/contributor-guide_architecture_index.md.94lNbF-4.js +1 -0
  44. package/public/docs/assets/contributor-guide_architecture_index.md.94lNbF-4.lean.js +1 -0
  45. package/public/docs/assets/contributor-guide_architecture_overview.md.mQFlN66o.js +1 -0
  46. package/public/docs/assets/contributor-guide_architecture_overview.md.mQFlN66o.lean.js +1 -0
  47. package/public/docs/assets/contributor-guide_architecture_state-and-history.md.DaqttKgQ.js +1 -0
  48. package/public/docs/assets/contributor-guide_architecture_state-and-history.md.DaqttKgQ.lean.js +1 -0
  49. package/public/docs/assets/contributor-guide_architecture_widget-rendering.md.Bk6Iyj9S.js +1 -0
  50. package/public/docs/assets/contributor-guide_architecture_widget-rendering.md.Bk6Iyj9S.lean.js +1 -0
  51. package/public/docs/assets/contributor-guide_architecture_worker-protocol.md.BaS_L10g.js +6 -0
  52. package/public/docs/assets/contributor-guide_architecture_worker-protocol.md.BaS_L10g.lean.js +1 -0
  53. package/public/docs/assets/contributor-guide_contributing.md.C-lKs70I.js +1 -0
  54. package/public/docs/assets/contributor-guide_contributing.md.C-lKs70I.lean.js +1 -0
  55. package/public/docs/assets/contributor-guide_development-setup.md.CpUMVtIK.js +12 -0
  56. package/public/docs/assets/contributor-guide_development-setup.md.CpUMVtIK.lean.js +1 -0
  57. package/public/docs/assets/contributor-guide_testing.md.C0q-BJfl.js +1 -0
  58. package/public/docs/assets/contributor-guide_testing.md.C0q-BJfl.lean.js +1 -0
  59. package/public/docs/assets/index.md.CETnDZzR.js +1 -0
  60. package/public/docs/assets/index.md.CETnDZzR.lean.js +1 -0
  61. package/public/docs/assets/inter-italic-cyrillic-ext.r48I6akx.woff2 +0 -0
  62. package/public/docs/assets/inter-italic-cyrillic.By2_1cv3.woff2 +0 -0
  63. package/public/docs/assets/inter-italic-greek-ext.1u6EdAuj.woff2 +0 -0
  64. package/public/docs/assets/inter-italic-greek.DJ8dCoTZ.woff2 +0 -0
  65. package/public/docs/assets/inter-italic-latin-ext.CN1xVJS-.woff2 +0 -0
  66. package/public/docs/assets/inter-italic-latin.C2AdPX0b.woff2 +0 -0
  67. package/public/docs/assets/inter-italic-vietnamese.BSbpV94h.woff2 +0 -0
  68. package/public/docs/assets/inter-roman-cyrillic-ext.BBPuwvHQ.woff2 +0 -0
  69. package/public/docs/assets/inter-roman-cyrillic.C5lxZ8CY.woff2 +0 -0
  70. package/public/docs/assets/inter-roman-greek-ext.CqjqNYQ-.woff2 +0 -0
  71. package/public/docs/assets/inter-roman-greek.BBVDIX6e.woff2 +0 -0
  72. package/public/docs/assets/inter-roman-latin-ext.4ZJIpNVo.woff2 +0 -0
  73. package/public/docs/assets/inter-roman-latin.Di8DUHzh.woff2 +0 -0
  74. package/public/docs/assets/inter-roman-vietnamese.BjW4sHH5.woff2 +0 -0
  75. package/public/docs/assets/style.D2mY0HUs.css +1 -0
  76. package/public/docs/assets/user-guide_getting-started.md.BJdD7a7_.js +3 -0
  77. package/public/docs/assets/user-guide_getting-started.md.BJdD7a7_.lean.js +1 -0
  78. package/public/docs/assets/user-guide_mcp-tools.md.DwYI1d6C.js +95 -0
  79. package/public/docs/assets/user-guide_mcp-tools.md.DwYI1d6C.lean.js +1 -0
  80. package/public/docs/assets/user-guide_run-comparison.md.5-oaOfTu.js +1 -0
  81. package/public/docs/assets/user-guide_run-comparison.md.5-oaOfTu.lean.js +1 -0
  82. package/public/docs/assets/user-guide_understanding-findings.md.CK2WZ0Tf.js +1 -0
  83. package/public/docs/assets/user-guide_understanding-findings.md.CK2WZ0Tf.lean.js +1 -0
  84. package/public/docs/contributor-guide/architecture/board-widgets.html +29 -0
  85. package/public/docs/contributor-guide/architecture/detector-contract.html +29 -0
  86. package/public/docs/contributor-guide/architecture/drill-down.html +29 -0
  87. package/public/docs/contributor-guide/architecture/impact-estimation.html +29 -0
  88. package/public/docs/contributor-guide/architecture/index.html +29 -0
  89. package/public/docs/contributor-guide/architecture/overview.html +29 -0
  90. package/public/docs/contributor-guide/architecture/state-and-history.html +29 -0
  91. package/public/docs/contributor-guide/architecture/widget-rendering.html +29 -0
  92. package/public/docs/contributor-guide/architecture/worker-protocol.html +34 -0
  93. package/public/docs/contributor-guide/contributing.html +29 -0
  94. package/public/docs/contributor-guide/development-setup.html +40 -0
  95. package/public/docs/contributor-guide/testing.html +29 -0
  96. package/public/docs/favicon.svg +4 -0
  97. package/public/docs/hashmap.json +1 -0
  98. package/public/docs/index.html +29 -0
  99. package/public/docs/user-guide/getting-started.html +31 -0
  100. package/public/docs/user-guide/mcp-tools.html +123 -0
  101. package/public/docs/user-guide/run-comparison.html +29 -0
  102. package/public/docs/user-guide/understanding-findings.html +29 -0
  103. package/public/docs/vp-icons.css +0 -0
  104. package/public/favicon.svg +4 -0
  105. package/public/index.html +36 -0
  106. package/public/vendor/spark-doc/anchors.json +205 -0
  107. package/public/vendor/spark-doc/index.html +4202 -0
  108. package/public/vendor/spark-doc/landing.html +418 -0
  109. package/public/vendor/spark-doc/meta.html +970 -0
  110. package/vendor-core/analyzer.js +167 -0
  111. package/vendor-core/assert-never.js +3 -0
  112. package/vendor-core/cli/budgets.js +203 -0
  113. package/vendor-core/cli/collect-run.js +107 -0
  114. package/vendor-core/core-count.js +68 -0
  115. package/vendor-core/core-locality-ratio.js +54 -0
  116. package/vendor-core/core-time-series.js +92 -0
  117. package/vendor-core/core-usage-locality.js +70 -0
  118. package/vendor-core/detectors.js +1989 -0
  119. package/vendor-core/docs-config.js +72 -0
  120. package/vendor-core/docs-site-config.js +23 -0
  121. package/vendor-core/efficiency-model.js +62 -0
  122. package/vendor-core/etl-phases.js +28 -0
  123. package/vendor-core/event-handlers.js +906 -0
  124. package/vendor-core/event-schemas.js +405 -0
  125. package/vendor-core/evidence-availability.js +121 -0
  126. package/vendor-core/evidence-report.js +459 -0
  127. package/vendor-core/finding-action-label.js +97 -0
  128. package/vendor-core/finding-filter-predicate.js +38 -0
  129. package/vendor-core/format-utils.js +167 -0
  130. package/vendor-core/impact-band.js +50 -0
  131. package/vendor-core/impact-estimator.js +428 -0
  132. package/vendor-core/ingest.js +139 -0
  133. package/vendor-core/job-groups.js +30 -0
  134. package/vendor-core/load-vendored.js +24 -0
  135. package/vendor-core/lz4-block.js +135 -0
  136. package/vendor-core/mcp-error.js +3 -0
  137. package/vendor-core/mcp-server-factory.js +115 -0
  138. package/vendor-core/mcp-tools.js +331 -0
  139. package/vendor-core/model-assembler.js +76 -0
  140. package/vendor-core/occupancy.js +202 -0
  141. package/vendor-core/parser-worker.js +249 -0
  142. package/vendor-core/plan-dot.js +25 -0
  143. package/vendor-core/plan-duration-attribution.js +185 -0
  144. package/vendor-core/plan-graph-model.js +171 -0
  145. package/vendor-core/plan-node-detail.js +159 -0
  146. package/vendor-core/plan-summary.js +233 -0
  147. package/vendor-core/plan-tree-walk.js +29 -0
  148. package/vendor-core/proxy.js +157 -0
  149. package/vendor-core/recommendation-rollup.js +197 -0
  150. package/vendor-core/redact.js +175 -0
  151. package/vendor-core/rolling-log-reassembly.js +52 -0
  152. package/vendor-core/run-aggregates.js +44 -0
  153. package/vendor-core/run-comparison.js +458 -0
  154. package/vendor-core/scaling-sim.js +73 -0
  155. package/vendor-core/session-snapshot.js +79 -0
  156. package/vendor-core/shs-fetch.js +196 -0
  157. package/vendor-core/shs-load.js +121 -0
  158. package/vendor-core/shs-request.js +101 -0
  159. package/vendor-core/shs-schemas.js +13 -0
  160. package/vendor-core/snappy-block.js +140 -0
  161. package/vendor-core/stage-quantiles.js +199 -0
  162. package/vendor-core/threshold-summary.js +35 -0
  163. package/vendor-core/types.js +286 -0
  164. package/vendor-core/vendor/fflate.js +2695 -0
  165. package/vendor-core/vendor/fzstd.js +768 -0
  166. package/vendor-core/wall-clock.js +36 -0
  167. package/vendor-core/wasted-core-hours.js +68 -0
@@ -0,0 +1,65 @@
1
+ var q=Uint8Array,Ze=Uint16Array,vr=Int32Array,_n=new q([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),yn=new q([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),_r=new q([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Sn=function(e,t){for(var n=new Ze(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var o=new vr(n[30]),r=1;r<30;++r)for(var i=n[r];i<n[r+1];++i)o[i]=i-n[r]<<5|r;return{b:n,r:o}},kn=Sn(_n,2),wn=kn.b,yr=kn.r;wn[28]=258,yr[258]=28;var Sr=Sn(yn,0),kr=Sr.b,yt=new Ze(32768);for(var A=0;A<32768;++A){var ve=(A&43690)>>1|(A&21845)<<1;ve=(ve&52428)>>2|(ve&13107)<<2,ve=(ve&61680)>>4|(ve&3855)<<4,yt[A]=((ve&65280)>>8|(ve&255)<<8)>>1}var je=(function(e,t,n){for(var r=e.length,o=0,i=new Ze(t);o<r;++o)e[o]&&++i[e[o]-1];var s=new Ze(t);for(o=1;o<t;++o)s[o]=s[o-1]+i[o-1]<<1;var a;if(n){a=new Ze(1<<t);var u=15-t;for(o=0;o<r;++o)if(e[o])for(var c=o<<4|e[o],f=t-e[o],l=s[e[o]-1]++<<f,p=l|(1<<f)-1;l<=p;++l)a[yt[l]>>u]=c}else for(a=new Ze(r),o=0;o<r;++o)e[o]&&(a[o]=yt[s[e[o]-1]++]>>15-e[o]);return a}),Je=new q(288);for(var A=0;A<144;++A)Je[A]=8;for(var A=144;A<256;++A)Je[A]=9;for(var A=256;A<280;++A)Je[A]=7;for(var A=280;A<288;++A)Je[A]=8;var zn=new q(32);for(var A=0;A<32;++A)zn[A]=5;var wr=je(Je,9,1),zr=je(zn,5,1),pt=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},ie=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},ht=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},bn=function(e){return(e+7)/8|0},xe=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new q(e.subarray(t,n))},br=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],K=function(e,t,n){var r=new Error(t||br[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,K),!n)throw r;return r},En=function(e,t,n,r){var o=e.length,i=r?r.length:0;if(!o||t.f&&!t.l)return n||new q(0);var s=!n,a=s||t.i!=2,u=t.i;s&&(n=new q(o*3));var c=function(me){var ge=n.length;if(me>ge){var Ge=new q(Math.max(ge*2,me));Ge.set(n),n=Ge}},f=t.f||0,l=t.p||0,p=t.b||0,h=t.l,m=t.d,S=t.m,v=t.n,R=o*8;do{if(!h){f=ie(e,l,1);var N=ie(e,l+1,3);if(l+=3,N)if(N==1)h=wr,m=zr,S=9,v=5;else if(N==2){var k=ie(e,l,31)+257,j=ie(e,l+10,15)+4,V=k+ie(e,l+5,31)+1;l+=14;for(var W=new q(V),J=new q(19),O=0;O<j;++O)J[_r[O]]=ie(e,l+O*3,7);l+=j*3;for(var H=pt(J),X=(1<<H)-1,Z=je(J,H,1),O=0;O<V;){var b=Z[ie(e,l,X)];l+=b&15;var w=b>>4;if(w<16)W[O++]=w;else{var U=0,re=0;for(w==16?(re=3+ie(e,l,3),l+=2,U=W[O-1]):w==17?(re=3+ie(e,l,7),l+=3):w==18&&(re=11+ie(e,l,127),l+=7);re--;)W[O++]=U}}var ae=W.subarray(0,k),_=W.subarray(k);S=pt(ae),v=pt(_),h=je(ae,S,1),m=je(_,v,1)}else K(1);else{var w=bn(l)+4,I=e[w-4]|e[w-3]<<8,z=w+I;if(z>o){u&&K(0);break}a&&c(p+I),n.set(e.subarray(w,z),p),t.b=p+=I,t.p=l=z*8,t.f=f;continue}if(l>R){u&&K(0);break}}a&&c(p+131072);for(var T=(1<<S)-1,qe=(1<<v)-1,ke=l;;ke=l){var U=h[ht(e,l)&T],ue=U>>4;if(l+=U&15,l>R){u&&K(0);break}if(U||K(2),ue<256)n[p++]=ue;else if(ue==256){ke=l,h=null;break}else{var De=ue-254;if(ue>264){var O=ue-257,he=_n[O];De=ie(e,l,(1<<he)-1)+wn[O],l+=he}var Te=m[ht(e,l)&qe],oe=Te>>4;Te||K(3),l+=Te&15;var _=kr[oe];if(oe>3){var he=yn[oe];_+=ht(e,l)&(1<<he)-1,l+=he}if(l>R){u&&K(0);break}a&&c(p+131072);var de=p+De;if(p<_){var we=i-_,$e=Math.min(_,de);for(we+p<0&&K(3);p<$e;++p)n[p]=r[we+p]}for(;p<de;++p)n[p]=n[p-_]}}t.l=h,t.p=ke,t.b=p,t.f=f,h&&(f=1,t.m=S,t.d=m,t.n=v)}while(!f);return p!=n.length&&s?xe(n,0,p):n.subarray(0,p)},Er=new q(0),ce=function(e,t){return e[t]|e[t+1]<<8},te=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},dt=function(e,t){return te(e,t)+te(e,t+4)*4294967296},Ir=function(e){(e[0]!=31||e[1]!=139||e[2]!=8)&&K(6,"invalid gzip data");var t=e[3],n=10;t&4&&(n+=(e[10]|e[11]<<8)+2);for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!e[n++]);return n+(t&2)},He=(function(){function e(t,n){typeof t=="function"&&(n=t,t={}),this.ondata=n;var r=t&&t.dictionary&&t.dictionary.subarray(-32768);this.s={i:0,b:r?r.length:0},this.o=new q(32768),this.p=new q(0),r&&this.o.set(r)}return e.prototype.e=function(t){if(this.ondata||K(5),this.d&&K(4),!this.p.length)this.p=t;else if(t.length){var n=new q(this.p.length+t.length);n.set(this.p),n.set(t,this.p.length),this.p=n}},e.prototype.c=function(t){this.s.i=+(this.d=t||!1);var n=this.s.b,r=En(this.p,this.s,this.o);this.ondata(xe(r,n,this.s.b),this.d),this.o=xe(r,this.s.b-32768),this.s.b=this.o.length,this.p=xe(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(t,n){this.e(t),this.c(n)},e})();function Tr(e,t){return En(e,{i:2},t&&t.out,t&&t.dictionary)}var In=(function(){function e(t,n){this.v=1,this.r=0,He.call(this,t,n)}return e.prototype.push=function(t,n){if(He.prototype.e.call(this,t),this.r+=t.length,this.v){var r=this.p.subarray(this.v-1),o=r.length>3?Ir(r):4;if(o>r.length){if(!n)return}else this.v>1&&this.onmember&&this.onmember(this.r-r.length);this.p=r.subarray(o),this.v=0}He.prototype.c.call(this,0),this.s.f&&!this.s.l?(this.v=bn(this.s.p)+9,this.s={i:0},this.o=new q(0),this.push(new q(0),n)):n&&He.prototype.c.call(this,n)},e})(),St=typeof TextDecoder<"u"&&new TextDecoder,$r=0;try{St.decode(Er,{stream:!0}),$r=1}catch{}var Zr=function(e){for(var t="",n=0;;){var r=e[n++],o=(r>127)+(r>223)+(r>239);if(n+o>e.length)return{s:t,r:xe(e,n-1)};o?o==3?(r=((r&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):o&1?t+=String.fromCharCode((r&31)<<6|e[n++]&63):t+=String.fromCharCode((r&15)<<12|(e[n++]&63)<<6|e[n++]&63):t+=String.fromCharCode(r)}};function Pr(e,t){if(t){for(var n="",r=0;r<e.length;r+=16384)n+=String.fromCharCode.apply(null,e.subarray(r,r+16384));return n}else{if(St)return St.decode(e);var o=Zr(e),i=o.s,n=o.r;return n.length&&K(8),i}}var xr=function(e,t){return t+30+ce(e,t+26)+ce(e,t+28)},Or=function(e,t,n){var r=ce(e,t+28),o=ce(e,t+30),i=Pr(e.subarray(t+46,t+46+r),!(ce(e,t+8)&2048)),s=t+46+r,a=Ar(e,s,o,n,te(e,t+20),te(e,t+24),te(e,t+42)),u=a[0],c=a[1],f=a[2];return[ce(e,t+10),u,c,i,s+o+ce(e,t+32),f]},Ar=function(e,t,n,r,o,i,s){var a=o==4294967295,u=i==4294967295,c=s==4294967295,f=t+n,l=a+u+c;if(r&&l){for(;t+4<f;t+=4+ce(e,t+2))if(ce(e,t)==1)return[a?dt(e,t+4+8*u):o,u?dt(e,t+4):i,c?dt(e,t+4+8*(u+a)):s,1];r<2&&K(13)}return[o,i,s,0]};function Mr(e,t){for(var n={},r=e.length-22;te(e,r)!=101010256;--r)(!r||e.length-r>65558)&&K(13);var o=ce(e,r+8);if(!o)return{};var i=te(e,r+16),s=te(e,r-20)==117853008;if(s){var a=te(e,r-12);s=te(e,a)==101075792,s&&(o=te(e,a+32),i=te(e,a+48))}for(var u=0;u<o;++u){var c=Or(e,i,s),f=c[0],l=c[1],p=c[2],h=c[3],m=c[4],S=c[5],v=xr(e,S);i=m,f?f==8?n[h]=Tr(e.subarray(v,v+l),{out:new q(p)}):K(14,"unknown compression type "+f):n[h]=xe(e,v,v+l)}return n}const Rr=[76,90,52,66,108,111,99,107];function Nt(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function Nr(e,t){const n=new Uint8Array(t);let r=0,o=0;const i=e.length;for(;r<i;){const s=e[r++];let a=s>>4;if(a===15){let l;do l=e[r++],a+=l;while(l===255)}if(n.set(e.subarray(r,r+a),o),r+=a,o+=a,r>=i)break;const u=e[r]|e[r+1]<<8;r+=2;let c=s&15;if(c===15){let l;do l=e[r++],c+=l;while(l===255)}c+=4;let f=o-u;for(let l=0;l<c;l++)n[o++]=n[f++]}return n}function Tn(e){let t=new Uint8Array(0);return{push(n){if(t.length===0)t=n;else if(n.length){const o=new Uint8Array(t.length+n.length);o.set(t),o.set(n,t.length),t=o}let r=0;for(;t.length-r>=21;){for(let f=0;f<8;f++)if(t[r+f]!==Rr[f])throw new Error(`Not a Spark LZ4Block stream: bad magic at offset ${r}.`);const o=t[r+8]&240,i=Nt(t,r+9),s=Nt(t,r+13),a=r+21;if(t.length-a<i)break;const u=t.subarray(a,a+i);let c;if(o===16)c=u;else if(o===32)c=Nr(u,s);else throw new Error(`Unknown LZ4Block method 0x${o.toString(16)} at offset ${r}.`);if(c.length!==s)throw new Error(`LZ4Block length mismatch at offset ${r}: expected ${s}, got ${c.length}.`);e(c),r=a+i}t=r>0?t.slice(r):t},end(){if(t.length!==0)throw new Error(`Trailing ${t.length} undecoded bytes in LZ4Block stream.`)}}}var Dr=ArrayBuffer,F=Uint8Array,et=Uint16Array,Cr=Int16Array,it=Int32Array,mt=function(e,t,n){if(F.prototype.slice)return F.prototype.slice.call(e,t,n);(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length);var r=new F(n-t);return r.set(e.subarray(t,n)),r},tt=function(e,t,n,r){if(F.prototype.fill)return F.prototype.fill.call(e,t,n,r);for((n==null||n<0)&&(n=0),(r==null||r>e.length)&&(r=e.length);n<r;++n)e[n]=t;return e},Lr=function(e,t,n,r){if(F.prototype.copyWithin)return F.prototype.copyWithin.call(e,t,n,r);for((n==null||n<0)&&(n=0),(r==null||r>e.length)&&(r=e.length);n<r;)e[t++]=e[n++]},jr=["invalid zstd data","window size too large (>2046MB)","invalid block type","FSE accuracy too high","match distance too far back","unexpected EOF"],D=function(e,t,n){var r=new Error(t||jr[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,D),!n)throw r;return r},Dt=function(e,t,n){for(var r=0,o=0;r<n;++r)o|=e[t++]<<(r<<3);return o},Ur=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},Fr=function(e,t){var n=e[0]|e[1]<<8|e[2]<<16;if(n==3126568&&e[3]==253){var r=e[4],o=r>>5&1,i=r>>2&1,s=r&3,a=r>>6;r&8&&D(0);var u=6-o,c=s==3?4:s,f=Dt(e,u,c);u+=c;var l=a?1<<a:o,p=Dt(e,u,l)+(a==1&&256),h=p;if(!o){var m=1<<10+(e[5]>>3);h=m+(m>>3)*(e[5]&7)}h>2145386496&&D(1);var S=new F(h+12);return S[0]=1,S[4]=4,S[8]=8,{b:u+l,y:0,l:0,d:f,w:t&&t!=1?t:S.subarray(12),e:h,o:new it(S.buffer,0,3),u:p,c:i,m:Math.min(131072,h)}}else if((n>>4|e[3]<<20)==25481893)return Ur(e,4)+8;D(0)},ze=function(e){for(var t=0;1<<t<=e;++t);return t-1},Ve=function(e,t,n){var r=(t<<3)+4,o=(e[t]&15)+5;o>n&&D(3);for(var i=1<<o,s=i,a=-1,u=-1,c=-1,f=i,l=new Dr(512+(i<<2)),p=new Cr(l,0,256),h=new et(l,0,256),m=new et(l,512,i),S=512+(i<<1),v=new F(l,S,i),R=new F(l,S+i);a<255&&s>0;){var N=ze(s+1),w=r>>3,I=(1<<N+1)-1,z=(e[w]|e[w+1]<<8|e[w+2]<<16)>>(r&7)&I,k=(1<<N)-1,j=I-s-1,V=z&k;if(V<j?(r+=N,z=V):(r+=N+1,z>k&&(z-=j)),p[++a]=--z,z==-1?(s+=z,v[--f]=a):s-=z,!z)do{var W=r>>3;u=(e[W]|e[W+1]<<8)>>(r&7)&3,r+=2,a+=u}while(u==3)}(a>255||s)&&D(0);for(var J=0,O=(i>>1)+(i>>3)+3,H=i-1,X=0;X<=a;++X){var Z=p[X];if(Z<1){h[X]=-Z;continue}for(c=0;c<Z;++c){v[J]=X;do J=J+O&H;while(J>=f)}}for(J&&D(0),c=0;c<i;++c){var b=h[v[c]]++,U=R[c]=o-ze(b);m[c]=(b<<U)-i}return[r+7>>3,{b:o,s:v,n:R,t:m}]},Br=function(e,t){var n=0,r=-1,o=new F(292),i=e[t],s=o.subarray(0,256),a=o.subarray(256,268),u=new et(o.buffer,268);if(i<128){var c=Ve(e,t+1,6),f=c[0],l=c[1];t+=i;var p=f<<3,h=e[t];h||D(0);for(var m=0,S=0,v=l.b,R=v,N=(++t<<3)-8+ze(h);N-=v,!(N<p);){var w=N>>3;if(m+=(e[w]|e[w+1]<<8)>>(N&7)&(1<<v)-1,s[++r]=l.s[m],N-=R,N<p)break;w=N>>3,S+=(e[w]|e[w+1]<<8)>>(N&7)&(1<<R)-1,s[++r]=l.s[S],v=l.n[m],m=l.t[m],R=l.n[S],S=l.t[S]}++r>255&&D(0)}else{for(r=i-127;n<r;n+=2){var I=e[++t];s[n]=I>>4,s[n+1]=I&15}++t}var z=0;for(n=0;n<r;++n){var k=s[n];k>11&&D(0),z+=k&&1<<k-1}var j=ze(z)+1,V=1<<j,W=V-z;for(W&W-1&&D(0),s[r++]=ze(W)+1,n=0;n<r;++n){var k=s[n];++a[s[n]=k&&j+1-k]}var J=new F(V<<1),O=J.subarray(0,V),H=J.subarray(V);for(u[j]=0,n=j;n>0;--n){var X=u[n];tt(H,n,X,u[n-1]=X+a[n]*(1<<j-n))}for(u[0]!=V&&D(0),n=0;n<r;++n){var Z=s[n];if(Z){var b=u[Z];tt(O,n,b,u[Z]=b+(1<<j-Z))}}return[t,{n:H,b:j,s:O}]},Jr=Ve(new F([81,16,99,140,49,198,24,99,12,33,196,24,99,102,102,134,70,146,4]),0,6)[1],Vr=Ve(new F([33,20,196,24,99,140,33,132,16,66,8,33,132,16,66,8,33,68,68,68,68,68,68,68,68,36,9]),0,6)[1],Wr=Ve(new F([32,132,16,66,102,70,68,68,68,68,36,73,2]),0,5)[1],$n=function(e,t){for(var n=e.length,r=new it(n),o=0;o<n;++o)r[o]=t,t+=1<<e[o];return r},kt=new F(new it([0,0,0,0,16843009,50528770,134678020,202050057,269422093]).buffer,0,36),qr=$n(kt,0),wt=new F(new it([0,0,0,0,0,0,0,0,16843009,50528770,117769220,185207048,252579084,16]).buffer,0,53),Gr=$n(wt,3),Ce=function(e,t,n){var r=e.length,o=t.length,i=e[r-1],s=(1<<n.b)-1,a=-n.b;i||D(0);for(var u=0,c=n.b,f=(r<<3)-8+ze(i)-c,l=-1;f>a&&l<o;){var p=f>>3,h=(e[p]|e[p+1]<<8|e[p+2]<<16)>>(f&7);u=(u<<c|h)&s,t[++l]=n.s[u],f-=c=n.n[u]}(f!=a||l+1!=o)&&D(0)},Hr=function(e,t,n){var r=6,o=t.length,i=o+3>>2,s=i<<1,a=i+s;Ce(e.subarray(r,r+=e[0]|e[1]<<8),t.subarray(0,i),n),Ce(e.subarray(r,r+=e[2]|e[3]<<8),t.subarray(i,s),n),Ce(e.subarray(r,r+=e[4]|e[5]<<8),t.subarray(s,a),n),Ce(e.subarray(r),t.subarray(a),n)},Kr=function(e,t,n){var r,o=t.b,i=e[o],s=i>>1&3;t.l=i&1;var a=i>>3|e[o+1]<<5|e[o+2]<<13,u=(o+=3)+a;if(s==1)return o>=e.length?void 0:(t.b=o+1,tt(new F(a),e[o]));if(!(u>e.length)){if(s==0)return t.b=u,mt(e,o,u);if(s==2){var c=e[o],f=c&3,l=c>>2&3,p=c>>4,h=0,m=0;f<2?l&1?p|=e[++o]<<4|(l&2&&e[++o]<<12):p=c>>3:(m=l,l<2?(p|=(e[++o]&63)<<4,h=e[o]>>6|e[++o]<<2):l==2?(p|=e[++o]<<4|(e[++o]&3)<<12,h=e[o]>>2|e[++o]<<6):(p|=e[++o]<<4|(e[++o]&63)<<12,h=e[o]>>6|e[++o]<<2|e[++o]<<10)),++o;var S=new F(t.m),v=S.length-p;if(f==0)S.set(e.subarray(o,o+=p),v);else if(f==1)tt(S,e[o++],v);else{var R=t.h;if(f==2){var N=Br(e,o);h+=o-(o=N[0]),t.h=R=N[1]}else R||D(0);(m?Hr:Ce)(e.subarray(o,o+=h),S.subarray(v),R)}var w=e[o++];if(w){w==255?w=(e[o++]|e[o++]<<8)+32512:w>127&&(w=w-128<<8|e[o++]);var I=e[o++];I&3&&D(0);for(var z=[Vr,Wr,Jr],k=2;k>-1;--k){var j=I>>(k<<1)+2&3;if(j==1){var V=new F([0,0,e[o++]]);z[k]={s:V.subarray(2,3),n:V.subarray(0,1),t:new et(V.buffer,0,1),b:0}}else j==2?(r=Ve(e,o,9-(k&1)),o=r[0],z[k]=r[1]):j==3&&(t.t||D(0),z[k]=t.t[k])}var W=t.t=z,J=W[0],O=W[1],H=W[2],X=e[u-1];X||D(0);var Z=(u<<3)-8+ze(X)-H.b,b=Z>>3,U=0,re=(e[b]|e[b+1]<<8)>>(Z&7)&(1<<H.b)-1;b=(Z-=O.b)>>3;var ae=(e[b]|e[b+1]<<8)>>(Z&7)&(1<<O.b)-1;b=(Z-=J.b)>>3;var _=(e[b]|e[b+1]<<8)>>(Z&7)&(1<<J.b)-1;for(++w;--w;){var T=H.s[re],qe=H.n[re],ke=J.s[_],ue=J.n[_],De=O.s[ae],he=O.n[ae];b=(Z-=De)>>3;var Te=1<<De,oe=Te+((e[b]|e[b+1]<<8|e[b+2]<<16|e[b+3]<<24)>>>(Z&7)&Te-1);b=(Z-=wt[ke])>>3;var de=Gr[ke]+((e[b]|e[b+1]<<8|e[b+2]<<16)>>(Z&7)&(1<<wt[ke])-1);b=(Z-=kt[T])>>3;var we=qr[T]+((e[b]|e[b+1]<<8|e[b+2]<<16)>>(Z&7)&(1<<kt[T])-1);if(b=(Z-=qe)>>3,re=H.t[re]+((e[b]|e[b+1]<<8)>>(Z&7)&(1<<qe)-1),b=(Z-=ue)>>3,_=J.t[_]+((e[b]|e[b+1]<<8)>>(Z&7)&(1<<ue)-1),b=(Z-=he)>>3,ae=O.t[ae]+((e[b]|e[b+1]<<8)>>(Z&7)&(1<<he)-1),oe>3)t.o[2]=t.o[1],t.o[1]=t.o[0],t.o[0]=oe-=3;else{var $e=oe-(we!=0);$e?(oe=$e==3?t.o[0]-1:t.o[$e],$e>1&&(t.o[2]=t.o[1]),t.o[1]=t.o[0],t.o[0]=oe):oe=t.o[0]}for(var k=0;k<we;++k)S[U+k]=S[v+k];U+=we,v+=we;var me=U-oe;if(me<0){var ge=-me,Ge=t.e+me;ge>de&&(ge=de);for(var k=0;k<ge;++k)S[U+k]=t.w[Ge+k];U+=ge,de-=ge,me=0}for(var k=0;k<de;++k)S[U+k]=S[me+k];U+=de}if(U!=v)for(;v<S.length;)S[U++]=S[v++];else U=S.length;S=mt(S,0,U)}else{var k;v&&(S=mt(S,v))}return t.b=u,S}D(2)}},Ct=function(e,t){if(e.length==1)return e[0];for(var n=new F(t),r=0,o=0;r<e.length;++r){var i=e[r];n.set(i,o),o+=i.length}return n},Zn=(function(){function e(t){this.ondata=t,this.c=[],this.l=0,this.z=0}return e.prototype.push=function(t,n){e:for(;;){if(typeof this.s=="number"){var r=Math.min(t.length,this.s);t=t.subarray(r),this.s-=r}var o=t.length,i=o+this.l;if(!this.s){if(n){if(!i){this.ondata(new F(0),!0);return}i<5&&D(5)}else if(i<18){this.c.push(t),this.l=i;return}if(this.l&&(this.c.push(t),t=Ct(this.c,i),this.c=[],this.l=0),typeof(this.s=Fr(t))=="number")continue e}if(typeof this.s!="number"){if(i<(this.z||3)){n&&D(5),this.c.push(t),this.l=i;return}if(this.l&&(this.c.push(t),t=Ct(this.c,i),this.c=[],this.l=0),!this.z&&i<(this.z=t[this.s.b]&2?4:3+(t[this.s.b]>>3|t[this.s.b+1]<<5|t[this.s.b+2]<<13))){n&&D(5),this.c.push(t),this.l=i;return}else this.z=0;for(;;){var s=Kr(t,this.s);if(s)this.ondata(s,!1),Lr(this.s.w,0,s.length),this.s.w.set(s,this.s.w.length-s.length);else{n&&D(5);var a=t.subarray(this.s.b);this.s.b=0,this.c.push(a),this.l+=a.length;return}if(this.s.l){t=t.subarray(this.s.b),this.s=this.s.c*4;continue e}}}else n&&D(5);return}},e})();const Yr=[130,83,78,65,80,80,89,0],Lt=16;function Xr(e,t){let n=0,r=0,o=t;for(;;){const i=e[o++];if(n|=(i&127)<<r,(i&128)===0)break;r+=7}return{value:n>>>0,next:o}}function Qr(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function eo(e,t){for(let n=0;n<8;n++)if(e[t+n]!==Yr[n])throw new Error(`Not a Spark SnappyCodec stream: bad magic at offset ${t}.`)}function to(e){const{value:t,next:n}=Xr(e,0),r=new Uint8Array(t);let o=n,i=0;const s=e.length;for(;o<s;){const a=e[o],u=a&3;if(u===0){const c=a>>2;let f,l;if(c<60)f=c+1,l=1;else{const p=c-59;let h=0;for(let m=0;m<p;m++)h|=e[o+1+m]<<8*m;f=(h>>>0)+1,l=1+p}r.set(e.subarray(o+l,o+l+f),i),o+=l+f,i+=f}else if(u===1){const c=(a>>2&7)+4,f=(a&224)<<3|e[o+1];let l=i-f;for(let p=0;p<c;p++)r[i++]=r[l++];o+=2}else if(u===2){const c=(a>>2)+1,f=e[o+1]|e[o+2]<<8;let l=i-f;for(let p=0;p<c;p++)r[i++]=r[l++];o+=3}else{const c=(a>>2)+1,f=(e[o+1]|e[o+2]<<8|e[o+3]<<16|e[o+4]<<24)>>>0;let l=i-f;for(let p=0;p<c;p++)r[i++]=r[l++];o+=5}}return r}function Pn(e){let t=new Uint8Array(0),n=!1;return{push(r){if(t.length===0)t=r;else if(r.length){const i=new Uint8Array(t.length+r.length);i.set(t),i.set(r,t.length),t=i}let o=0;if(!n){if(t.length<Lt)return;eo(t,0),o=Lt,n=!0}for(;t.length-o>=4;){const i=Qr(t,o),s=o+4;if(t.length-s<i)break;const a=t.subarray(s,s+i);e(to(a)),o=s+i}t=o>0?t.slice(o):t},end(){if(t.length!==0)throw new Error(`Trailing ${t.length} undecoded bytes in Snappy stream.`)}}}var jt;const no=Object.freeze({status:"aborted"});function d(e,t,n){function r(a,u){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:u,constr:s,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,u);const c=s.prototype,f=Object.keys(c);for(let l=0;l<f.length;l++){const p=f[l];p in a||(a[p]=c[p].bind(a))}}const o=n?.Parent??Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function s(a){var u;const c=n?.Parent?new i:this;r(c,a),(u=c._zod).deferred??(u.deferred=[]);for(const f of c._zod.deferred)f();return c}return Object.defineProperty(s,"init",{value:r}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>n?.Parent&&a instanceof n.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}class Oe extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class xn extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}(jt=globalThis).__zod_globalConfig??(jt.__zod_globalConfig={});const It=globalThis.__zod_globalConfig;function le(e){return It}function On(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function zt(e,t){return typeof t=="bigint"?t.toString():t}function st(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Tt(e){return e==null}function $t(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function ro(e,t){const n=e/t,r=Math.round(n),o=Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r)<o?0:n-r}const Ut=Symbol("evaluating");function P(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Ut)return r===void 0&&(r=Ut,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Ie(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ye(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Ft(e){return JSON.stringify(e)}function oo(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const An="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ue(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const io=st(()=>{if(It.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Ae(e){if(Ue(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(Ue(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Mn(e){return Ae(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const so=new Set(["string","number","symbol"]);function Me(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Se(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function g(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function ao(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const co={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function uo(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i=ye(e._zod.def,{get shape(){const s={};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(s[a]=n.shape[a])}return Ie(this,"shape",s),s},checks:[]});return Se(e,i)}function lo(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=ye(e._zod.def,{get shape(){const s={...e._zod.def.shape};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete s[a]}return Ie(this,"shape",s),s},checks:[]});return Se(e,i)}function fo(e,t){if(!Ae(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const i=e._zod.def.shape;for(const s in t)if(Object.getOwnPropertyDescriptor(i,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=ye(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return Ie(this,"shape",i),i}});return Se(e,o)}function po(e,t){if(!Ae(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=ye(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return Ie(this,"shape",r),r}});return Se(e,n)}function ho(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n=ye(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return Ie(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Se(e,n)}function mo(e,t,n){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const s=ye(t._zod.def,{get shape(){const a=t._zod.def.shape,u={...a};if(n)for(const c in n){if(!(c in a))throw new Error(`Unrecognized key: "${c}"`);n[c]&&(u[c]=e?new e({type:"optional",innerType:a[c]}):a[c])}else for(const c in a)u[c]=e?new e({type:"optional",innerType:a[c]}):a[c];return Ie(this,"shape",u),u},checks:[]});return Se(t,s)}function go(e,t,n){const r=ye(t._zod.def,{get shape(){const o=t._zod.def.shape,i={...o};if(n)for(const s in n){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(i[s]=new e({type:"nonoptional",innerType:o[s]}))}else for(const s in o)i[s]=new e({type:"nonoptional",innerType:o[s]});return Ie(this,"shape",i),i}});return Se(t,r)}function Pe(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function vo(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function _e(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Ke(e){return typeof e=="string"?e:e?.message}function fe(e,t,n){const r=e.message?e.message:Ke(e.inst?._zod.def?.error?.(e))??Ke(t?.error?.(e))??Ke(n.customError?.(e))??Ke(n.localeError?.(e))??"Invalid input",{inst:o,continue:i,input:s,...a}=e;return a.path??(a.path=[]),a.message=r,t?.reportInput&&(a.input=s),a}function Zt(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Fe(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const Rn=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,zt,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Nn=d("$ZodError",Rn),Dn=d("$ZodError",Rn,{Parent:Error});function _o(e,t=n=>n.message){const n={},r=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}function yo(e,t=n=>n.message){const n={_errors:[]},r=(o,i=[])=>{for(const s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>r({issues:a},[...i,...s.path]));else if(s.code==="invalid_key")r({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")r({issues:s.issues},[...i,...s.path]);else{const a=[...i,...s.path];if(a.length===0)n._errors.push(t(s));else{let u=n,c=0;for(;c<a.length;){const f=a[c];c===a.length-1?(u[f]=u[f]||{_errors:[]},u[f]._errors.push(t(s))):u[f]=u[f]||{_errors:[]},u=u[f],c++}}}};return r(e),n}const Pt=e=>(t,n,r,o)=>{const i=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw new Oe;if(s.issues.length){const a=new(o?.Err??e)(s.issues.map(u=>fe(u,i,le())));throw An(a,o?.callee),a}return s.value},xt=e=>async(t,n,r,o)=>{const i=r?{...r,async:!0}:{async:!0};let s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){const a=new(o?.Err??e)(s.issues.map(u=>fe(u,i,le())));throw An(a,o?.callee),a}return s.value},at=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new Oe;return i.issues.length?{success:!1,error:new(e??Nn)(i.issues.map(s=>fe(s,o,le())))}:{success:!0,data:i.value}},So=at(Dn),ct=e=>async(t,n,r)=>{const o=r?{...r,async:!0}:{async:!0};let i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(s=>fe(s,o,le())))}:{success:!0,data:i.value}},ko=ct(Dn),wo=e=>(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return Pt(e)(t,n,o)},zo=e=>(t,n,r)=>Pt(e)(t,n,r),bo=e=>async(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return xt(e)(t,n,o)},Eo=e=>async(t,n,r)=>xt(e)(t,n,r),Io=e=>(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return at(e)(t,n,o)},To=e=>(t,n,r)=>at(e)(t,n,r),$o=e=>async(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return ct(e)(t,n,o)},Zo=e=>async(t,n,r)=>ct(e)(t,n,r),Po=/^[cC][0-9a-z]{6,}$/,xo=/^[0-9a-z]+$/,Oo=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ao=/^[0-9a-vA-V]{20}$/,Mo=/^[A-Za-z0-9]{27}$/,Ro=/^[a-zA-Z0-9_-]{21}$/,No=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Do=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Bt=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Co=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Lo="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function jo(){return new RegExp(Lo,"u")}const Uo=/^(?:(?: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])$/,Fo=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Bo=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,Jo=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Vo=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Cn=/^[A-Za-z0-9_-]*$/,Wo=/^https?$/,qo=/^\+[1-9]\d{6,14}$/,Ln="(?:(?:\\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])))",Go=new RegExp(`^${Ln}$`);function jn(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Ho(e){return new RegExp(`^${jn(e)}$`)}function Ko(e){const t=jn({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${Ln}T(?:${r})$`)}const Yo=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Xo=/^-?\d+$/,Un=/^-?\d+(?:\.\d+)?$/,Qo=/^(?:true|false)$/i,ei=/^null$/i,ti=/^[^A-Z]*$/,ni=/^[^a-z]*$/,ee=d("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Fn={number:"number",bigint:"bigint",object:"date"},Bn=d("$ZodCheckLessThan",(e,t)=>{ee.init(e,t);const n=Fn[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,i=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Jn=d("$ZodCheckGreaterThan",(e,t)=>{ee.init(e,t);const n=Fn[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,i=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ri=d("$ZodCheckMultipleOf",(e,t)=>{ee.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):ro(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),oi=d("$ZodCheckNumberFormat",(e,t)=>{ee.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[o,i]=co[t.format];e._zod.onattach.push(s=>{const a=s._zod.bag;a.format=t.format,a.minimum=o,a.maximum=i,n&&(a.pattern=Xo)}),e._zod.check=s=>{const a=s.value;if(n){if(!Number.isInteger(a)){s.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}a<o&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>i&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),ii=d("$ZodCheckMaxLength",(e,t)=>{var n;ee.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Tt(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const o=r.value;if(o.length<=t.maximum)return;const s=Zt(o);r.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),si=d("$ZodCheckMinLength",(e,t)=>{var n;ee.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Tt(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const o=r.value;if(o.length>=t.minimum)return;const s=Zt(o);r.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),ai=d("$ZodCheckLengthEquals",(e,t)=>{var n;ee.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Tt(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{const o=r.value,i=o.length;if(i===t.length)return;const s=Zt(o),a=i>t.length;r.issues.push({origin:s,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),ut=d("$ZodCheckStringFormat",(e,t)=>{var n,r;ee.init(e,t),e._zod.onattach.push(o=>{const i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),ci=d("$ZodCheckRegex",(e,t)=>{ut.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),ui=d("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=ti),ut.init(e,t)}),li=d("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=ni),ut.init(e,t)}),fi=d("$ZodCheckIncludes",(e,t)=>{ee.init(e,t);const n=Me(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{const i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),pi=d("$ZodCheckStartsWith",(e,t)=>{ee.init(e,t);const n=new RegExp(`^${Me(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),hi=d("$ZodCheckEndsWith",(e,t)=>{ee.init(e,t);const n=new RegExp(`.*${Me(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),di=d("$ZodCheckOverwrite",(e,t)=>{ee.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class mi{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
2
+ `).filter(s=>s),o=Math.min(...r.map(s=>s.length-s.trimStart().length)),i=r.map(s=>s.slice(o)).map(s=>" ".repeat(this.indent*2)+s);for(const s of i)this.content.push(s)}compile(){const t=Function,n=this?.args,o=[...(this?.content??[""]).map(i=>` ${i}`)];return new t(...n,o.join(`
3
+ `))}}const gi={major:4,minor:4,patch:3},x=d("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=gi;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const o of r)for(const i of o._zod.onattach)i(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const o=(s,a,u)=>{let c=Pe(s),f;for(const l of a){if(l._zod.def.when){if(vo(s)||!l._zod.def.when(s))continue}else if(c)continue;const p=s.issues.length,h=l._zod.check(s);if(h instanceof Promise&&u?.async===!1)throw new Oe;if(f||h instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await h,s.issues.length!==p&&(c||(c=Pe(s,p)))});else{if(s.issues.length===p)continue;c||(c=Pe(s,p))}}return f?f.then(()=>s):s},i=(s,a,u)=>{if(Pe(s))return s.aborted=!0,s;const c=o(a,r,u);if(c instanceof Promise){if(u.async===!1)throw new Oe;return c.then(f=>e._zod.parse(f,u))}return e._zod.parse(c,u)};e._zod.run=(s,a)=>{if(a.skipChecks)return e._zod.parse(s,a);if(a.direction==="backward"){const c=e._zod.parse({value:s.value,issues:[]},{...a,skipChecks:!0});return c instanceof Promise?c.then(f=>i(f,s,a)):i(c,s,a)}const u=e._zod.parse(s,a);if(u instanceof Promise){if(a.async===!1)throw new Oe;return u.then(c=>o(c,r,a))}return o(u,r,a)}}P(e,"~standard",()=>({validate:o=>{try{const i=So(e,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return ko(e,o).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}))}),Ot=d("$ZodString",(e,t)=>{x.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Yo(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),C=d("$ZodStringFormat",(e,t)=>{ut.init(e,t),Ot.init(e,t)}),vi=d("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Do),C.init(e,t)}),_i=d("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Bt(r))}else t.pattern??(t.pattern=Bt());C.init(e,t)}),yi=d("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Co),C.init(e,t)}),Si=d("$ZodURL",(e,t)=>{C.init(e,t),e._zod.check=n=>{try{const r=n.value.trim();if(!t.normalize&&t.protocol?.source===Wo.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}const o=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=o.href:n.value=r;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),ki=d("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=jo()),C.init(e,t)}),wi=d("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Ro),C.init(e,t)}),zi=d("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Po),C.init(e,t)}),bi=d("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=xo),C.init(e,t)}),Ei=d("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Oo),C.init(e,t)}),Ii=d("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Ao),C.init(e,t)}),Ti=d("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Mo),C.init(e,t)}),$i=d("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Ko(t)),C.init(e,t)}),Zi=d("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Go),C.init(e,t)}),Pi=d("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Ho(t)),C.init(e,t)}),xi=d("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=No),C.init(e,t)}),Oi=d("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Uo),C.init(e,t),e._zod.bag.format="ipv4"}),Ai=d("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Fo),C.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),Mi=d("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Bo),C.init(e,t)}),Ri=d("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Jo),C.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[o,i]=r;if(!i)throw new Error;const s=Number(i);if(`${s}`!==i)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${o}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function Vn(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Ni=d("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Vo),C.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{Vn(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function Di(e){if(!Cn.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Vn(n)}const Ci=d("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Cn),C.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{Di(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Li=d("$ZodE164",(e,t)=>{t.pattern??(t.pattern=qo),C.init(e,t)});function ji(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const Ui=d("$ZodJWT",(e,t)=>{C.init(e,t),e._zod.check=n=>{ji(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Wn=d("$ZodNumber",(e,t)=>{x.init(e,t),e._zod.pattern=e._zod.bag.pattern??Un,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;const i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),n}}),Fi=d("$ZodNumberFormat",(e,t)=>{oi.init(e,t),Wn.init(e,t)}),Bi=d("$ZodBoolean",(e,t)=>{x.init(e,t),e._zod.pattern=Qo,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}const o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),Ji=d("$ZodNull",(e,t)=>{x.init(e,t),e._zod.pattern=ei,e._zod.values=new Set([null]),e._zod.parse=(n,r)=>{const o=n.value;return o===null||n.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),n}}),Vi=d("$ZodUnknown",(e,t)=>{x.init(e,t),e._zod.parse=n=>n}),Wi=d("$ZodNever",(e,t)=>{x.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Jt(e,t,n){e.issues.length&&t.issues.push(..._e(n,e.issues)),t.value[n]=e.value}const qi=d("$ZodArray",(e,t)=>{x.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const i=[];for(let s=0;s<o.length;s++){const a=o[s],u=t.element._zod.run({value:a,issues:[]},r);u instanceof Promise?i.push(u.then(c=>Jt(c,n,s))):Jt(u,n,s)}return i.length?Promise.all(i).then(()=>n):n}});function nt(e,t,n,r,o,i){const s=n in r;if(e.issues.length){if(o&&i&&!s)return;t.issues.push(..._e(n,e.issues))}if(!s&&!o){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}e.value===void 0?s&&(t.value[n]=void 0):t.value[n]=e.value}function qn(e){const t=Object.keys(e.shape);for(const r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const n=ao(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Gn(e,t,n,r,o,i){const s=[],a=o.keySet,u=o.catchall._zod,c=u.def.type,f=u.optin==="optional",l=u.optout==="optional";for(const p in t){if(p==="__proto__"||a.has(p))continue;if(c==="never"){s.push(p);continue}const h=u.run({value:t[p],issues:[]},r);h instanceof Promise?e.push(h.then(m=>nt(m,n,p,t,f,l))):nt(h,n,p,t,f,l)}return s.length&&n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i}),e.length?Promise.all(e).then(()=>n):n}const Gi=d("$ZodObject",(e,t)=>{if(x.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const a=t.shape;Object.defineProperty(t,"shape",{get:()=>{const u={...a};return Object.defineProperty(t,"shape",{value:u}),u}})}const r=st(()=>qn(t));P(e._zod,"propValues",()=>{const a=t.shape,u={};for(const c in a){const f=a[c]._zod;if(f.values){u[c]??(u[c]=new Set);for(const l of f.values)u[c].add(l)}}return u});const o=Ue,i=t.catchall;let s;e._zod.parse=(a,u)=>{s??(s=r.value);const c=a.value;if(!o(c))return a.issues.push({expected:"object",code:"invalid_type",input:c,inst:e}),a;a.value={};const f=[],l=s.shape;for(const p of s.keys){const h=l[p],m=h._zod.optin==="optional",S=h._zod.optout==="optional",v=h._zod.run({value:c[p],issues:[]},u);v instanceof Promise?f.push(v.then(R=>nt(R,a,p,c,m,S))):nt(v,a,p,c,m,S)}return i?Gn(f,c,a,u,r.value,e):f.length?Promise.all(f).then(()=>a):a}}),Hi=d("$ZodObjectJIT",(e,t)=>{Gi.init(e,t);const n=e._zod.parse,r=st(()=>qn(t)),o=p=>{const h=new mi(["shape","payload","ctx"]),m=r.value,S=w=>{const I=Ft(w);return`shape[${I}]._zod.run({ value: input[${I}], issues: [] }, ctx)`};h.write("const input = payload.value;");const v=Object.create(null);let R=0;for(const w of m.keys)v[w]=`key_${R++}`;h.write("const newResult = {};");for(const w of m.keys){const I=v[w],z=Ft(w),k=p[w],j=k?._zod?.optin==="optional",V=k?._zod?.optout==="optional";h.write(`const ${I} = ${S(w)};`),j&&V?h.write(`
4
+ if (${I}.issues.length) {
5
+ if (${z} in input) {
6
+ payload.issues = payload.issues.concat(${I}.issues.map(iss => ({
7
+ ...iss,
8
+ path: iss.path ? [${z}, ...iss.path] : [${z}]
9
+ })));
10
+ }
11
+ }
12
+
13
+ if (${I}.value === undefined) {
14
+ if (${z} in input) {
15
+ newResult[${z}] = undefined;
16
+ }
17
+ } else {
18
+ newResult[${z}] = ${I}.value;
19
+ }
20
+
21
+ `):j?h.write(`
22
+ if (${I}.issues.length) {
23
+ payload.issues = payload.issues.concat(${I}.issues.map(iss => ({
24
+ ...iss,
25
+ path: iss.path ? [${z}, ...iss.path] : [${z}]
26
+ })));
27
+ }
28
+
29
+ if (${I}.value === undefined) {
30
+ if (${z} in input) {
31
+ newResult[${z}] = undefined;
32
+ }
33
+ } else {
34
+ newResult[${z}] = ${I}.value;
35
+ }
36
+
37
+ `):h.write(`
38
+ const ${I}_present = ${z} in input;
39
+ if (${I}.issues.length) {
40
+ payload.issues = payload.issues.concat(${I}.issues.map(iss => ({
41
+ ...iss,
42
+ path: iss.path ? [${z}, ...iss.path] : [${z}]
43
+ })));
44
+ }
45
+ if (!${I}_present && !${I}.issues.length) {
46
+ payload.issues.push({
47
+ code: "invalid_type",
48
+ expected: "nonoptional",
49
+ input: undefined,
50
+ path: [${z}]
51
+ });
52
+ }
53
+
54
+ if (${I}_present) {
55
+ if (${I}.value === undefined) {
56
+ newResult[${z}] = undefined;
57
+ } else {
58
+ newResult[${z}] = ${I}.value;
59
+ }
60
+ }
61
+
62
+ `)}h.write("payload.value = newResult;"),h.write("return payload;");const N=h.compile();return(w,I)=>N(p,w,I)};let i;const s=Ue,a=!It.jitless,c=a&&io.value,f=t.catchall;let l;e._zod.parse=(p,h)=>{l??(l=r.value);const m=p.value;return s(m)?a&&c&&h?.async===!1&&h.jitless!==!0?(i||(i=o(t.shape)),p=i(p,h),f?Gn([],m,p,h,l,e):p):n(p,h):(p.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),p)}});function Vt(e,t,n,r){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const o=e.filter(i=>!Pe(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(s=>fe(s,r,le())))}),t)}const Hn=d("$ZodUnion",(e,t)=>{x.init(e,t),P(e._zod,"optin",()=>t.options.some(r=>r._zod.optin==="optional")?"optional":void 0),P(e._zod,"optout",()=>t.options.some(r=>r._zod.optout==="optional")?"optional":void 0),P(e._zod,"values",()=>{if(t.options.every(r=>r._zod.values))return new Set(t.options.flatMap(r=>Array.from(r._zod.values)))}),P(e._zod,"pattern",()=>{if(t.options.every(r=>r._zod.pattern)){const r=t.options.map(o=>o._zod.pattern);return new RegExp(`^(${r.map(o=>$t(o.source)).join("|")})$`)}});const n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(n)return n(r,o);let i=!1;const s=[];for(const a of t.options){const u=a._zod.run({value:r.value,issues:[]},o);if(u instanceof Promise)s.push(u),i=!0;else{if(u.issues.length===0)return u;s.push(u)}}return i?Promise.all(s).then(a=>Vt(a,r,e,o)):Vt(s,r,e,o)}}),Ki=d("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Hn.init(e,t);const n=e._zod.parse;P(e._zod,"propValues",()=>{const o={};for(const i of t.options){const s=i._zod.propValues;if(!s||Object.keys(s).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const[a,u]of Object.entries(s)){o[a]||(o[a]=new Set);for(const c of u)o[a].add(c)}}return o});const r=st(()=>{const o=t.options,i=new Map;for(const s of o){const a=s._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const u of a){if(i.has(u))throw new Error(`Duplicate discriminator value "${String(u)}"`);i.set(u,s)}}return i});e._zod.parse=(o,i)=>{const s=o.value;if(!Ue(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;const a=r.value.get(s?.[t.discriminator]);return a?a._zod.run(o,i):t.unionFallback||i.direction==="backward"?n(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(r.value.keys()),input:s,path:[t.discriminator],inst:e}),o)}}),Yi=d("$ZodIntersection",(e,t)=>{x.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,i=t.left._zod.run({value:o,issues:[]},r),s=t.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([u,c])=>Wt(n,u,c)):Wt(n,i,s)}});function bt(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Ae(e)&&Ae(t)){const n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),o={...e,...t};for(const i of r){const s=bt(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],i=t[r],s=bt(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[r,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Wt(e,t,n){const r=new Map;let o;for(const a of t.issues)if(a.code==="unrecognized_keys"){o??(o=a);for(const u of a.keys)r.has(u)||r.set(u,{}),r.get(u).l=!0}else e.issues.push(a);for(const a of n.issues)if(a.code==="unrecognized_keys")for(const u of a.keys)r.has(u)||r.set(u,{}),r.get(u).r=!0;else e.issues.push(a);const i=[...r].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(i.length&&o&&e.issues.push({...o,keys:i}),Pe(e))return e;const s=bt(t.value,n.value);if(!s.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}const Xi=d("$ZodTuple",(e,t)=>{x.init(e,t);const n=t.items;e._zod.parse=(r,o)=>{const i=r.value;if(!Array.isArray(i))return r.issues.push({input:i,inst:e,expected:"tuple",code:"invalid_type"}),r;r.value=[];const s=[],a=qt(n,"optin"),u=qt(n,"optout");if(!t.rest){if(i.length<a)return r.issues.push({code:"too_small",minimum:a,inclusive:!0,input:i,inst:e,origin:"array"}),r;i.length>n.length&&r.issues.push({code:"too_big",maximum:n.length,inclusive:!0,input:i,inst:e,origin:"array"})}const c=new Array(n.length);for(let f=0;f<n.length;f++){const l=n[f]._zod.run({value:i[f],issues:[]},o);l instanceof Promise?s.push(l.then(p=>{c[f]=p})):c[f]=l}if(t.rest){let f=n.length-1;const l=i.slice(n.length);for(const p of l){f++;const h=t.rest._zod.run({value:p,issues:[]},o);h instanceof Promise?s.push(h.then(m=>Gt(m,r,f))):Gt(h,r,f)}}return s.length?Promise.all(s).then(()=>Ht(c,r,n,i,u)):Ht(c,r,n,i,u)}});function qt(e,t){for(let n=e.length-1;n>=0;n--)if(e[n]._zod[t]!=="optional")return n+1;return 0}function Gt(e,t,n){e.issues.length&&t.issues.push(..._e(n,e.issues)),t.value[n]=e.value}function Ht(e,t,n,r,o){for(let i=0;i<n.length;i++){const s=e[i],a=i<r.length;if(s.issues.length){if(!a&&i>=o){t.value.length=i;break}t.issues.push(..._e(i,s.issues))}t.value[i]=s.value}for(let i=t.value.length-1;i>=r.length&&(n[i]._zod.optout==="optional"&&t.value[i]===void 0);i--)t.value.length=i;return t}const Qi=d("$ZodRecord",(e,t)=>{x.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Ae(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const i=[],s=t.keyType._zod.values;if(s){n.value={};const a=new Set;for(const c of s)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){a.add(typeof c=="number"?c.toString():c);const f=t.keyType._zod.run({value:c,issues:[]},r);if(f instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(f.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:f.issues.map(h=>fe(h,r,le())),input:c,path:[c],inst:e});continue}const l=f.value,p=t.valueType._zod.run({value:o[c],issues:[]},r);p instanceof Promise?i.push(p.then(h=>{h.issues.length&&n.issues.push(..._e(c,h.issues)),n.value[l]=h.value})):(p.issues.length&&n.issues.push(..._e(c,p.issues)),n.value[l]=p.value)}let u;for(const c in o)a.has(c)||(u=u??[],u.push(c));u&&u.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:u})}else{n.value={};for(const a of Reflect.ownKeys(o)){if(a==="__proto__"||!Object.prototype.propertyIsEnumerable.call(o,a))continue;let u=t.keyType._zod.run({value:a,issues:[]},r);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&Un.test(a)&&u.issues.length){const l=t.keyType._zod.run({value:Number(a),issues:[]},r);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");l.issues.length===0&&(u=l)}if(u.issues.length){t.mode==="loose"?n.value[a]=o[a]:n.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(l=>fe(l,r,le())),input:a,path:[a],inst:e});continue}const f=t.valueType._zod.run({value:o[a],issues:[]},r);f instanceof Promise?i.push(f.then(l=>{l.issues.length&&n.issues.push(..._e(a,l.issues)),n.value[u.value]=l.value})):(f.issues.length&&n.issues.push(..._e(a,f.issues)),n.value[u.value]=f.value)}}return i.length?Promise.all(i).then(()=>n):n}}),es=d("$ZodEnum",(e,t)=>{x.init(e,t);const n=On(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>so.has(typeof o)).map(o=>typeof o=="string"?Me(o):o.toString()).join("|")})$`),e._zod.parse=(o,i)=>{const s=o.value;return r.has(s)||o.issues.push({code:"invalid_value",values:n,input:s,inst:e}),o}}),ts=d("$ZodLiteral",(e,t)=>{if(x.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?Me(r):r?Me(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,o)=>{const i=r.value;return n.has(i)||r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}}),ns=d("$ZodTransform",(e,t)=>{x.init(e,t),e._zod.optin="optional",e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new xn(e.constructor.name);const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(n.value=s,n.fallback=!0,n));if(o instanceof Promise)throw new Oe;return n.value=o,n.fallback=!0,n}});function Kt(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const Kn=d("$ZodOptional",(e,t)=>{x.init(e,t),e._zod.optin="optional",e._zod.optout="optional",P(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),P(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${$t(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const o=n.value,i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(s=>Kt(s,o)):Kt(i,o)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),rs=d("$ZodExactOptional",(e,t)=>{Kn.init(e,t),P(e._zod,"values",()=>t.innerType._zod.values),P(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),os=d("$ZodNullable",(e,t)=>{x.init(e,t),P(e._zod,"optin",()=>t.innerType._zod.optin),P(e._zod,"optout",()=>t.innerType._zod.optout),P(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${$t(n.source)}|null)$`):void 0}),P(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),is=d("$ZodDefault",(e,t)=>{x.init(e,t),e._zod.optin="optional",P(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>Yt(i,t)):Yt(o,t)}});function Yt(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const ss=d("$ZodPrefault",(e,t)=>{x.init(e,t),e._zod.optin="optional",P(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),as=d("$ZodNonOptional",(e,t)=>{x.init(e,t),P(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>Xt(i,e)):Xt(o,e)}});function Xt(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const cs=d("$ZodCatch",(e,t)=>{x.init(e,t),e._zod.optin="optional",P(e._zod,"optout",()=>t.innerType._zod.optout),P(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>(n.value=i.value,i.issues.length&&(n.value=t.catchValue({...n,error:{issues:i.issues.map(s=>fe(s,r,le()))},input:n.value}),n.issues=[],n.fallback=!0),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(i=>fe(i,r,le()))},input:n.value}),n.issues=[],n.fallback=!0),n)}}),us=d("$ZodPipe",(e,t)=>{x.init(e,t),P(e._zod,"values",()=>t.in._zod.values),P(e._zod,"optin",()=>t.in._zod.optin),P(e._zod,"optout",()=>t.out._zod.optout),P(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const i=t.out._zod.run(n,r);return i instanceof Promise?i.then(s=>Ye(s,t.in,r)):Ye(i,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(i=>Ye(i,t.out,r)):Ye(o,t.out,r)}});function Ye(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}const ls=d("$ZodReadonly",(e,t)=>{x.init(e,t),P(e._zod,"propValues",()=>t.innerType._zod.propValues),P(e._zod,"values",()=>t.innerType._zod.values),P(e._zod,"optin",()=>t.innerType?._zod?.optin),P(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(Qt):Qt(o)}});function Qt(e){return e.value=Object.freeze(e.value),e}const fs=d("$ZodCustom",(e,t)=>{ee.init(e,t),x.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(i=>en(i,n,r,e));en(o,n,r,e)}});function en(e,t,n,r){if(!e){const o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(Fe(o))}}var tn;class ps{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const o={...r,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function hs(){return new ps}(tn=globalThis).__zod_globalRegistry??(tn.__zod_globalRegistry=hs());const Le=globalThis.__zod_globalRegistry;function ds(e,t){return new e({type:"string",...g(t)})}function ms(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...g(t)})}function nn(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...g(t)})}function gs(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...g(t)})}function vs(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...g(t)})}function _s(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...g(t)})}function ys(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...g(t)})}function Ss(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...g(t)})}function ks(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...g(t)})}function ws(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...g(t)})}function zs(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...g(t)})}function bs(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...g(t)})}function Es(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...g(t)})}function Is(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...g(t)})}function Ts(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...g(t)})}function $s(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...g(t)})}function Zs(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...g(t)})}function Ps(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...g(t)})}function xs(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...g(t)})}function Os(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...g(t)})}function As(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...g(t)})}function Ms(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...g(t)})}function Rs(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...g(t)})}function Ns(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...g(t)})}function Ds(e,t){return new e({type:"string",format:"date",check:"string_format",...g(t)})}function Cs(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...g(t)})}function Ls(e,t){return new e({type:"string",format:"duration",check:"string_format",...g(t)})}function js(e,t){return new e({type:"number",checks:[],...g(t)})}function Us(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...g(t)})}function Fs(e,t){return new e({type:"boolean",...g(t)})}function Bs(e,t){return new e({type:"null",...g(t)})}function Js(e){return new e({type:"unknown"})}function Vs(e,t){return new e({type:"never",...g(t)})}function rn(e,t){return new Bn({check:"less_than",...g(t),value:e,inclusive:!1})}function gt(e,t){return new Bn({check:"less_than",...g(t),value:e,inclusive:!0})}function on(e,t){return new Jn({check:"greater_than",...g(t),value:e,inclusive:!1})}function vt(e,t){return new Jn({check:"greater_than",...g(t),value:e,inclusive:!0})}function sn(e,t){return new ri({check:"multiple_of",...g(t),value:e})}function Yn(e,t){return new ii({check:"max_length",...g(t),maximum:e})}function rt(e,t){return new si({check:"min_length",...g(t),minimum:e})}function Xn(e,t){return new ai({check:"length_equals",...g(t),length:e})}function Ws(e,t){return new ci({check:"string_format",format:"regex",...g(t),pattern:e})}function qs(e){return new ui({check:"string_format",format:"lowercase",...g(e)})}function Gs(e){return new li({check:"string_format",format:"uppercase",...g(e)})}function Hs(e,t){return new fi({check:"string_format",format:"includes",...g(t),includes:e})}function Ks(e,t){return new pi({check:"string_format",format:"starts_with",...g(t),prefix:e})}function Ys(e,t){return new hi({check:"string_format",format:"ends_with",...g(t),suffix:e})}function Ne(e){return new di({check:"overwrite",tx:e})}function Xs(e){return Ne(t=>t.normalize(e))}function Qs(){return Ne(e=>e.trim())}function ea(){return Ne(e=>e.toLowerCase())}function ta(){return Ne(e=>e.toUpperCase())}function na(){return Ne(e=>oo(e))}function ra(e,t,n){return new e({type:"array",element:t,...g(n)})}function oa(e,t,n){return new e({type:"custom",check:"custom",fn:t,...g(n)})}function ia(e,t){const n=sa(r=>(r.addIssue=o=>{if(typeof o=="string")r.issues.push(Fe(o,r.value,n._zod.def));else{const i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=n),i.continue??(i.continue=!n._zod.def.abort),r.issues.push(Fe(i))}},e(r.value,r)),t);return n}function sa(e,t){const n=new ee({check:"custom",...g(t)});return n._zod.check=e,n}function Qn(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Le,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function B(e,t,n={path:[],schemaPath:[]}){var r;const o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema;const s={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,s);const a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{const f={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,f);else{const p=s.schema,h=t.processors[o.type];if(!h)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);h(e,t,p,f)}const l=e._zod.parent;l&&(s.ref||(s.ref=l),B(l,t,f),t.seen.get(l).isParent=!0)}const u=t.metadataRegistry.get(e);return u&&Object.assign(s.schema,u),t.io==="input"&&Q(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&"_prefault"in s.schema&&((r=s.schema).default??(r.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function er(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const s of e.seen.entries()){const a=e.metadataRegistry.get(s[0])?.id;if(a){const u=r.get(a);if(u&&u!==s[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(a,s[0])}}const o=s=>{const a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const l=e.external.registry.get(s[0])?.id,p=e.external.uri??(m=>m);if(l)return{ref:p(l)};const h=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=h,{defId:h,ref:`${p("__shared")}#/${a}/${h}`}}if(s[1]===n)return{ref:"#"};const c=`#/${a}/`,f=s[1].schema.id??`__schema${e.counter++}`;return{defId:f,ref:c+f}},i=s=>{if(s[1].schema.$ref)return;const a=s[1],{ref:u,defId:c}=o(s);a.def={...a.schema},c&&(a.defId=c);const f=a.schema;for(const l in f)delete f[l];f.$ref=u};if(e.cycles==="throw")for(const s of e.seen.entries()){const a=s[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
63
+
64
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const s of e.seen.entries()){const a=s[1];if(t===s[0]){i(s);continue}if(e.external){const c=e.external.registry.get(s[0])?.id;if(t!==s[0]&&c){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(a.cycle){i(s);continue}if(a.count>1&&e.reused==="ref"){i(s);continue}}}function tr(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=a=>{const u=e.seen.get(a);if(u.ref===null)return;const c=u.def??u.schema,f={...c},l=u.ref;if(u.ref=null,l){r(l);const h=e.seen.get(l),m=h.schema;if(m.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(m)):Object.assign(c,m),Object.assign(c,f),a._zod.parent===l)for(const v in c)v==="$ref"||v==="allOf"||v in f||delete c[v];if(m.$ref&&h.def)for(const v in c)v==="$ref"||v==="allOf"||v in h.def&&JSON.stringify(c[v])===JSON.stringify(h.def[v])&&delete c[v]}const p=a._zod.parent;if(p&&p!==l){r(p);const h=e.seen.get(p);if(h?.schema.$ref&&(c.$ref=h.schema.$ref,h.def))for(const m in c)m==="$ref"||m==="allOf"||m in h.def&&JSON.stringify(c[m])===JSON.stringify(h.def[m])&&delete c[m]}e.override({zodSchema:a,jsonSchema:c,path:u.path??[]})};for(const a of[...e.seen.entries()].reverse())r(a[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}Object.assign(o,n.def??n.schema);const i=e.metadataRegistry.get(t)?.id;i!==void 0&&o.id===i&&delete o.id;const s=e.external?.defs??{};for(const a of e.seen.entries()){const u=a[1];u.def&&u.defId&&(u.def.id===u.defId&&delete u.def.id,s[u.defId]=u.def)}e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?o.$defs=s:o.definitions=s);try{const a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:ot(t,"input",e.processors),output:ot(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Q(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Q(r.element,n);if(r.type==="set")return Q(r.valueType,n);if(r.type==="lazy")return Q(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return Q(r.innerType,n);if(r.type==="intersection")return Q(r.left,n)||Q(r.right,n);if(r.type==="record"||r.type==="map")return Q(r.keyType,n)||Q(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Q(r.in,n)||Q(r.out,n);if(r.type==="object"){for(const o in r.shape)if(Q(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(Q(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(Q(o,n))return!0;return!!(r.rest&&Q(r.rest,n))}return!1}const aa=(e,t={})=>n=>{const r=Qn({...n,processors:t});return B(e,r),er(r,e),tr(r,e)},ot=(e,t,n={})=>r=>{const{libraryOptions:o,target:i}=r??{},s=Qn({...o??{},target:i,io:t,processors:n});return B(e,s),er(s,e),tr(s,e)},ca={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},ua=(e,t,n,r)=>{const o=n;o.type="string";const{minimum:i,maximum:s,format:a,patterns:u,contentEncoding:c}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof s=="number"&&(o.maxLength=s),a&&(o.format=ca[a]??a,o.format===""&&delete o.format,a==="time"&&delete o.format),c&&(o.contentEncoding=c),u&&u.size>0){const f=[...u];f.length===1?o.pattern=f[0].source:f.length>1&&(o.allOf=[...f.map(l=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:l.source}))])}},la=(e,t,n,r)=>{const o=n,{minimum:i,maximum:s,format:a,multipleOf:u,exclusiveMaximum:c,exclusiveMinimum:f}=e._zod.bag;typeof a=="string"&&a.includes("int")?o.type="integer":o.type="number";const l=typeof f=="number"&&f>=(i??Number.NEGATIVE_INFINITY),p=typeof c=="number"&&c<=(s??Number.POSITIVE_INFINITY),h=t.target==="draft-04"||t.target==="openapi-3.0";l?h?(o.minimum=f,o.exclusiveMinimum=!0):o.exclusiveMinimum=f:typeof i=="number"&&(o.minimum=i),p?h?(o.maximum=c,o.exclusiveMaximum=!0):o.exclusiveMaximum=c:typeof s=="number"&&(o.maximum=s),typeof u=="number"&&(o.multipleOf=u)},fa=(e,t,n,r)=>{n.type="boolean"},pa=(e,t,n,r)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},ha=(e,t,n,r)=>{n.not={}},da=(e,t,n,r)=>{},ma=(e,t,n,r)=>{const o=e._zod.def,i=On(o.entries);i.every(s=>typeof s=="number")&&(n.type="number"),i.every(s=>typeof s=="string")&&(n.type="string"),n.enum=i},ga=(e,t,n,r)=>{const o=e._zod.def,i=[];for(const s of o.values)if(s===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof s=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(s))}else i.push(s);if(i.length!==0)if(i.length===1){const s=i[0];n.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[s]:n.const=s}else i.every(s=>typeof s=="number")&&(n.type="number"),i.every(s=>typeof s=="string")&&(n.type="string"),i.every(s=>typeof s=="boolean")&&(n.type="boolean"),i.every(s=>s===null)&&(n.type="null"),n.enum=i},va=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},_a=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},ya=(e,t,n,r)=>{const o=n,i=e._zod.def,{minimum:s,maximum:a}=e._zod.bag;typeof s=="number"&&(o.minItems=s),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=B(i.element,t,{...r,path:[...r.path,"items"]})},Sa=(e,t,n,r)=>{const o=n,i=e._zod.def;o.type="object",o.properties={};const s=i.shape;for(const c in s)o.properties[c]=B(s[c],t,{...r,path:[...r.path,"properties",c]});const a=new Set(Object.keys(s)),u=new Set([...a].filter(c=>{const f=i.shape[c]._zod;return t.io==="input"?f.optin===void 0:f.optout===void 0}));u.size>0&&(o.required=Array.from(u)),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=B(i.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},ka=(e,t,n,r)=>{const o=e._zod.def,i=o.inclusive===!1,s=o.options.map((a,u)=>B(a,t,{...r,path:[...r.path,i?"oneOf":"anyOf",u]}));i?n.oneOf=s:n.anyOf=s},wa=(e,t,n,r)=>{const o=e._zod.def,i=B(o.left,t,{...r,path:[...r.path,"allOf",0]}),s=B(o.right,t,{...r,path:[...r.path,"allOf",1]}),a=c=>"allOf"in c&&Object.keys(c).length===1,u=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];n.allOf=u},za=(e,t,n,r)=>{const o=n,i=e._zod.def;o.type="array";const s=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",u=i.items.map((p,h)=>B(p,t,{...r,path:[...r.path,s,h]})),c=i.rest?B(i.rest,t,{...r,path:[...r.path,a,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null;t.target==="draft-2020-12"?(o.prefixItems=u,c&&(o.items=c)):t.target==="openapi-3.0"?(o.items={anyOf:u},c&&o.items.anyOf.push(c),o.minItems=u.length,c||(o.maxItems=u.length)):(o.items=u,c&&(o.additionalItems=c));const{minimum:f,maximum:l}=e._zod.bag;typeof f=="number"&&(o.minItems=f),typeof l=="number"&&(o.maxItems=l)},ba=(e,t,n,r)=>{const o=n,i=e._zod.def;o.type="object";const s=i.keyType,u=s._zod.bag?.patterns;if(i.mode==="loose"&&u&&u.size>0){const f=B(i.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(const l of u)o.patternProperties[l.source]=f}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=B(i.keyType,t,{...r,path:[...r.path,"propertyNames"]})),o.additionalProperties=B(i.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const c=s._zod.values;if(c){const f=[...c].filter(l=>typeof l=="string"||typeof l=="number");f.length>0&&(o.required=f)}},Ea=(e,t,n,r)=>{const o=e._zod.def,i=B(o.innerType,t,r),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=o.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},Ia=(e,t,n,r)=>{const o=e._zod.def;B(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},Ta=(e,t,n,r)=>{const o=e._zod.def;B(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},$a=(e,t,n,r)=>{const o=e._zod.def;B(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},Za=(e,t,n,r)=>{const o=e._zod.def;B(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=s},Pa=(e,t,n,r)=>{const o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?o.out:o.in:o.out;B(s,t,r);const a=t.seen.get(e);a.ref=s},xa=(e,t,n,r)=>{const o=e._zod.def;B(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},nr=(e,t,n,r)=>{const o=e._zod.def;B(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},Oa=d("ZodISODateTime",(e,t)=>{$i.init(e,t),L.init(e,t)});function Aa(e){return Ns(Oa,e)}const Ma=d("ZodISODate",(e,t)=>{Zi.init(e,t),L.init(e,t)});function Ra(e){return Ds(Ma,e)}const Na=d("ZodISOTime",(e,t)=>{Pi.init(e,t),L.init(e,t)});function Da(e){return Cs(Na,e)}const Ca=d("ZodISODuration",(e,t)=>{xi.init(e,t),L.init(e,t)});function La(e){return Ls(Ca,e)}const ja=(e,t)=>{Nn.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>yo(e,n)},flatten:{value:n=>_o(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,zt,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,zt,2)}},isEmpty:{get(){return e.issues.length===0}}})},ne=d("ZodError",ja,{Parent:Error}),Ua=Pt(ne),Fa=xt(ne),Ba=at(ne),Ja=ct(ne),Va=wo(ne),Wa=zo(ne),qa=bo(ne),Ga=Eo(ne),Ha=Io(ne),Ka=To(ne),Ya=$o(ne),Xa=Zo(ne),an=new WeakMap;function We(e,t,n){const r=Object.getPrototypeOf(e);let o=an.get(r);if(o||(o=new Set,an.set(r,o)),!o.has(t)){o.add(t);for(const i in n){const s=n[i];Object.defineProperty(r,i,{configurable:!0,enumerable:!1,get(){const a=s.bind(this);return Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}const M=d("ZodType",(e,t)=>(x.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:ot(e,"input"),output:ot(e,"output")}}),e.toJSONSchema=aa(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(n,r)=>Ua(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>Ba(e,n,r),e.parseAsync=async(n,r)=>Fa(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>Ja(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>Va(e,n,r),e.decode=(n,r)=>Wa(e,n,r),e.encodeAsync=async(n,r)=>qa(e,n,r),e.decodeAsync=async(n,r)=>Ga(e,n,r),e.safeEncode=(n,r)=>Ha(e,n,r),e.safeDecode=(n,r)=>Ka(e,n,r),e.safeEncodeAsync=async(n,r)=>Ya(e,n,r),e.safeDecodeAsync=async(n,r)=>Xa(e,n,r),We(e,"ZodType",{check(...n){const r=this.def;return this.clone(ye(r,{checks:[...r.checks??[],...n.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,r){return Se(this,n,r)},brand(){return this},register(n,r){return n.add(this,r),this},refine(n,r){return this.check(Hc(n,r))},superRefine(n,r){return this.check(Kc(n,r))},overwrite(n){return this.check(Ne(n))},optional(){return fn(this)},exactOptional(){return Nc(this)},nullable(){return pn(this)},nullish(){return fn(pn(this))},nonoptional(n){return Fc(this,n)},array(){return pe(this)},or(n){return Ee([this,n])},and(n){return Zc(this,n)},transform(n){return hn(this,Mc(n))},default(n){return Lc(this,n)},prefault(n){return Uc(this,n)},catch(n){return Jc(this,n)},pipe(n){return hn(this,n)},readonly(){return qc(this)},describe(n){const r=this.clone();return Le.add(r,{description:n}),r},meta(...n){if(n.length===0)return Le.get(this);const r=this.clone();return Le.add(r,n[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(e,"description",{get(){return Le.get(e)?.description},configurable:!0}),e)),rr=d("_ZodString",(e,t)=>{Ot.init(e,t),M.init(e,t),e._zod.processJSONSchema=(r,o,i)=>ua(e,r,o);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,We(e,"_ZodString",{regex(...r){return this.check(Ws(...r))},includes(...r){return this.check(Hs(...r))},startsWith(...r){return this.check(Ks(...r))},endsWith(...r){return this.check(Ys(...r))},min(...r){return this.check(rt(...r))},max(...r){return this.check(Yn(...r))},length(...r){return this.check(Xn(...r))},nonempty(...r){return this.check(rt(1,...r))},lowercase(r){return this.check(qs(r))},uppercase(r){return this.check(Gs(r))},trim(){return this.check(Qs())},normalize(...r){return this.check(Xs(...r))},toLowerCase(){return this.check(ea())},toUpperCase(){return this.check(ta())},slugify(){return this.check(na())}})}),Qa=d("ZodString",(e,t)=>{Ot.init(e,t),rr.init(e,t),e.email=n=>e.check(ms(ec,n)),e.url=n=>e.check(Ss(tc,n)),e.jwt=n=>e.check(Rs(gc,n)),e.emoji=n=>e.check(ks(nc,n)),e.guid=n=>e.check(nn(cn,n)),e.uuid=n=>e.check(gs(Xe,n)),e.uuidv4=n=>e.check(vs(Xe,n)),e.uuidv6=n=>e.check(_s(Xe,n)),e.uuidv7=n=>e.check(ys(Xe,n)),e.nanoid=n=>e.check(ws(rc,n)),e.guid=n=>e.check(nn(cn,n)),e.cuid=n=>e.check(zs(oc,n)),e.cuid2=n=>e.check(bs(ic,n)),e.ulid=n=>e.check(Es(sc,n)),e.base64=n=>e.check(Os(hc,n)),e.base64url=n=>e.check(As(dc,n)),e.xid=n=>e.check(Is(ac,n)),e.ksuid=n=>e.check(Ts(cc,n)),e.ipv4=n=>e.check($s(uc,n)),e.ipv6=n=>e.check(Zs(lc,n)),e.cidrv4=n=>e.check(Ps(fc,n)),e.cidrv6=n=>e.check(xs(pc,n)),e.e164=n=>e.check(Ms(mc,n)),e.datetime=n=>e.check(Aa(n)),e.date=n=>e.check(Ra(n)),e.time=n=>e.check(Da(n)),e.duration=n=>e.check(La(n))});function E(e){return ds(Qa,e)}const L=d("ZodStringFormat",(e,t)=>{C.init(e,t),rr.init(e,t)}),ec=d("ZodEmail",(e,t)=>{yi.init(e,t),L.init(e,t)}),cn=d("ZodGUID",(e,t)=>{vi.init(e,t),L.init(e,t)}),Xe=d("ZodUUID",(e,t)=>{_i.init(e,t),L.init(e,t)}),tc=d("ZodURL",(e,t)=>{Si.init(e,t),L.init(e,t)}),nc=d("ZodEmoji",(e,t)=>{ki.init(e,t),L.init(e,t)}),rc=d("ZodNanoID",(e,t)=>{wi.init(e,t),L.init(e,t)}),oc=d("ZodCUID",(e,t)=>{zi.init(e,t),L.init(e,t)}),ic=d("ZodCUID2",(e,t)=>{bi.init(e,t),L.init(e,t)}),sc=d("ZodULID",(e,t)=>{Ei.init(e,t),L.init(e,t)}),ac=d("ZodXID",(e,t)=>{Ii.init(e,t),L.init(e,t)}),cc=d("ZodKSUID",(e,t)=>{Ti.init(e,t),L.init(e,t)}),uc=d("ZodIPv4",(e,t)=>{Oi.init(e,t),L.init(e,t)}),lc=d("ZodIPv6",(e,t)=>{Ai.init(e,t),L.init(e,t)}),fc=d("ZodCIDRv4",(e,t)=>{Mi.init(e,t),L.init(e,t)}),pc=d("ZodCIDRv6",(e,t)=>{Ri.init(e,t),L.init(e,t)}),hc=d("ZodBase64",(e,t)=>{Ni.init(e,t),L.init(e,t)}),dc=d("ZodBase64URL",(e,t)=>{Ci.init(e,t),L.init(e,t)}),mc=d("ZodE164",(e,t)=>{Li.init(e,t),L.init(e,t)}),gc=d("ZodJWT",(e,t)=>{Ui.init(e,t),L.init(e,t)}),or=d("ZodNumber",(e,t)=>{Wn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(r,o,i)=>la(e,r,o),We(e,"ZodNumber",{gt(r,o){return this.check(on(r,o))},gte(r,o){return this.check(vt(r,o))},min(r,o){return this.check(vt(r,o))},lt(r,o){return this.check(rn(r,o))},lte(r,o){return this.check(gt(r,o))},max(r,o){return this.check(gt(r,o))},int(r){return this.check(un(r))},safe(r){return this.check(un(r))},positive(r){return this.check(on(0,r))},nonnegative(r){return this.check(vt(0,r))},negative(r){return this.check(rn(0,r))},nonpositive(r){return this.check(gt(0,r))},multipleOf(r,o){return this.check(sn(r,o))},step(r,o){return this.check(sn(r,o))},finite(){return this}});const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function y(e){return js(or,e)}const vc=d("ZodNumberFormat",(e,t)=>{Fi.init(e,t),or.init(e,t)});function un(e){return Us(vc,e)}const _c=d("ZodBoolean",(e,t)=>{Bi.init(e,t),M.init(e,t),e._zod.processJSONSchema=(n,r,o)=>fa(e,n,r)});function be(e){return Fs(_c,e)}const yc=d("ZodNull",(e,t)=>{Ji.init(e,t),M.init(e,t),e._zod.processJSONSchema=(n,r,o)=>pa(e,n,r)});function Sc(e){return Bs(yc,e)}const kc=d("ZodUnknown",(e,t)=>{Vi.init(e,t),M.init(e,t),e._zod.processJSONSchema=(n,r,o)=>da()});function Be(){return Js(kc)}const wc=d("ZodNever",(e,t)=>{Wi.init(e,t),M.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ha(e,n,r)});function zc(e){return Vs(wc,e)}const bc=d("ZodArray",(e,t)=>{qi.init(e,t),M.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ya(e,n,r,o),e.element=t.element,We(e,"ZodArray",{min(n,r){return this.check(rt(n,r))},nonempty(n){return this.check(rt(1,n))},max(n,r){return this.check(Yn(n,r))},length(n,r){return this.check(Xn(n,r))},unwrap(){return this.element}})});function pe(e,t){return ra(bc,e,t)}const Ec=d("ZodObject",(e,t)=>{Hi.init(e,t),M.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Sa(e,n,r,o),P(e,"shape",()=>t.shape),We(e,"ZodObject",{keyof(){return xc(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:Be()})},loose(){return this.clone({...this._zod.def,catchall:Be()})},strict(){return this.clone({...this._zod.def,catchall:zc()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return fo(this,n)},safeExtend(n){return po(this,n)},merge(n){return ho(this,n)},pick(n){return uo(this,n)},omit(n){return lo(this,n)},partial(...n){return mo(ar,this,n[0])},required(...n){return go(cr,this,n[0])}})});function $(e,t){const n={type:"object",shape:e??{},...g(t)};return new Ec(n)}const ir=d("ZodUnion",(e,t)=>{Hn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ka(e,n,r,o),e.options=t.options});function Ee(e,t){return new ir({type:"union",options:e,...g(t)})}const Ic=d("ZodDiscriminatedUnion",(e,t)=>{ir.init(e,t),Ki.init(e,t)});function Tc(e,t,n){return new Ic({type:"union",options:t,discriminator:e,...g(n)})}const $c=d("ZodIntersection",(e,t)=>{Yi.init(e,t),M.init(e,t),e._zod.processJSONSchema=(n,r,o)=>wa(e,n,r,o)});function Zc(e,t){return new $c({type:"intersection",left:e,right:t})}const Pc=d("ZodTuple",(e,t)=>{Xi.init(e,t),M.init(e,t),e._zod.processJSONSchema=(n,r,o)=>za(e,n,r,o),e.rest=n=>e.clone({...e._zod.def,rest:n})});function sr(e,t,n){const r=t instanceof x,o=r?n:t,i=r?t:null;return new Pc({type:"tuple",items:e,rest:i,...g(o)})}const ln=d("ZodRecord",(e,t)=>{Qi.init(e,t),M.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ba(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function At(e,t,n){return!t||!t._zod?new ln({type:"record",keyType:E(),valueType:e,...g(t)}):new ln({type:"record",keyType:e,valueType:t,...g(n)})}const Et=d("ZodEnum",(e,t)=>{es.init(e,t),M.init(e,t),e._zod.processJSONSchema=(r,o,i)=>ma(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const i={};for(const s of r)if(n.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new Et({...t,checks:[],...g(o),entries:i})},e.exclude=(r,o)=>{const i={...t.entries};for(const s of r)if(n.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new Et({...t,checks:[],...g(o),entries:i})}});function xc(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Et({type:"enum",entries:n,...g(t)})}const Oc=d("ZodLiteral",(e,t)=>{ts.init(e,t),M.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ga(e,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Y(e,t){return new Oc({type:"literal",values:Array.isArray(e)?e:[e],...g(t)})}const Ac=d("ZodTransform",(e,t)=>{ns.init(e,t),M.init(e,t),e._zod.processJSONSchema=(n,r,o)=>_a(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new xn(e.constructor.name);n.addIssue=i=>{if(typeof i=="string")n.issues.push(Fe(i,n.value,t));else{const s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=e),n.issues.push(Fe(s))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n.fallback=!0,n)):(n.value=o,n.fallback=!0,n)}});function Mc(e){return new Ac({type:"transform",transform:e})}const ar=d("ZodOptional",(e,t)=>{Kn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(n,r,o)=>nr(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function fn(e){return new ar({type:"optional",innerType:e})}const Rc=d("ZodExactOptional",(e,t)=>{rs.init(e,t),M.init(e,t),e._zod.processJSONSchema=(n,r,o)=>nr(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Nc(e){return new Rc({type:"optional",innerType:e})}const Dc=d("ZodNullable",(e,t)=>{os.init(e,t),M.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ea(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function pn(e){return new Dc({type:"nullable",innerType:e})}const Cc=d("ZodDefault",(e,t)=>{is.init(e,t),M.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ta(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Lc(e,t){return new Cc({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Mn(t)}})}const jc=d("ZodPrefault",(e,t)=>{ss.init(e,t),M.init(e,t),e._zod.processJSONSchema=(n,r,o)=>$a(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Uc(e,t){return new jc({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Mn(t)}})}const cr=d("ZodNonOptional",(e,t)=>{as.init(e,t),M.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ia(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Fc(e,t){return new cr({type:"nonoptional",innerType:e,...g(t)})}const Bc=d("ZodCatch",(e,t)=>{cs.init(e,t),M.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Za(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Jc(e,t){return new Bc({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Vc=d("ZodPipe",(e,t)=>{us.init(e,t),M.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Pa(e,n,r,o),e.in=t.in,e.out=t.out});function hn(e,t){return new Vc({type:"pipe",in:e,out:t})}const Wc=d("ZodReadonly",(e,t)=>{ls.init(e,t),M.init(e,t),e._zod.processJSONSchema=(n,r,o)=>xa(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function qc(e){return new Wc({type:"readonly",innerType:e})}const Gc=d("ZodCustom",(e,t)=>{fs.init(e,t),M.init(e,t),e._zod.processJSONSchema=(n,r,o)=>va(e,n)});function Hc(e,t={}){return oa(Gc,e,t)}function Kc(e,t){return ia(e,t)}const Yc={custom:"custom"},Xc=$({name:E(),accumulatorId:y().optional(),value:Ee([E(),y()]).optional(),metricType:E().optional()}),dn=$({nodeName:E(),simpleString:E().optional(),metrics:pe(Xc).optional(),metadata:At(E(),Be()).optional(),children:pe(Be())}),mn=500;function Qc(e){const t=dn.parse(e),r=[{shallow:t,children:[],pendingRaw:[...t.children],depth:0}],o=new Map;for(;r.length>0;){const i=r[r.length-1];if(i.pendingRaw.length===0){r.pop();const c={...i.shallow,children:i.children},f=o.get(i);if(f){f.children.push(c);continue}return c}if(i.depth>mn)throw new Error(`sparkPlanInfo tree exceeds max depth of ${mn}`);const s=i.pendingRaw.shift(),a=dn.parse(s),u={shallow:a,children:[],pendingRaw:[...a.children],depth:i.depth+1};o.set(u,i),r.push(u)}throw new Error("unreachable: sparkPlanInfo tree stack exhausted without resolving root")}const ur=Be().nullable().optional().transform((e,t)=>{if(e==null)return null;try{return Qc(e)}catch(n){return t.addIssue({code:Yc.custom,message:n instanceof Error?n.message:String(n)}),no}}),eu=$({Event:Y("SparkListenerLogStart"),"Spark Version":E().optional()}),tu=$({Event:Y("SparkListenerApplicationStart"),"App ID":E().optional(),"App Name":E().optional(),Timestamp:y().optional(),"Spark Version":E().optional()}),gn=Ee([E(),y(),be()]),nu=$({Event:Y("SparkListenerEnvironmentUpdate"),"Spark Properties":Ee([At(E(),gn),pe(sr([E(),gn])),Sc()]).optional()}),ru=$({Event:Y("SparkListenerApplicationEnd"),Timestamp:y().optional()}),ou=$({Event:Y("SparkListenerExecutorAdded"),Timestamp:y(),"Executor ID":E(),"Executor Info":$({Host:E().optional(),"Total Cores":y().optional(),"Resource Profile Id":y().optional()}).optional(),"Resource Profile Id":y().optional()}),iu=$({Event:Y("SparkListenerExecutorRemoved"),Timestamp:y(),"Executor ID":E(),"Removed Reason":E().optional()}),su=$({Event:Y("SparkListenerJobStart"),"Job ID":y().optional(),"Submission Time":y().optional(),"Stage IDs":pe(y()).optional(),Properties:$({"spark.sql.execution.id":Ee([E(),y()]).optional()}).optional()}),au=$({Event:Y("SparkListenerJobEnd"),"Job ID":y(),"Completion Time":y().optional(),"Job Result":$({Result:E().optional(),Exception:$({Message:E().optional()}).optional()}).optional()}),cu=$({"RDD ID":y().optional(),Name:E().optional(),Callsite:E().optional(),"Storage Level":$({"Use Disk":be().optional(),"Use Memory":be().optional(),Deserialized:be().optional(),Replication:y().optional()}).optional(),"Number of Partitions":y().optional(),"Number of Cached Partitions":y().optional(),"Memory Size":y().optional(),"Disk Size":y().optional()}),uu=$({Event:Y("SparkListenerStageSubmitted"),"Stage Info":$({"Stage ID":y(),"Stage Name":E().optional(),Details:E().optional(),"Submission Time":y().optional(),"Parent IDs":pe(y()).optional(),"RDD Info":pe(cu).optional()})}),lu=$({Event:Y("SparkListenerStageCompleted"),"Stage Info":$({"Stage ID":y(),"Completion Time":y().optional(),"Failure Reason":E().optional()})}),fu=$({Event:Y("SparkListenerStageExecutorMetrics"),"Stage ID":y(),"Executor ID":E(),"Executor Metrics":At(E(),y()).optional()}),pu=1e4,hu=$({Event:Y("SparkListenerTaskEnd"),"Stage ID":y(),"Stage Attempt ID":y().optional(),"Task End Reason":$({Reason:E().optional()}).optional(),"Task Info":$({"Launch Time":y().optional(),"Finish Time":y().optional(),Failed:be().optional(),Killed:be().optional(),Speculative:be().optional(),Host:E().optional(),"Executor ID":E().optional(),Locality:E().optional(),Index:y().optional(),Accumulables:pe($({ID:y(),Update:Ee([E(),y()]).optional(),Value:Ee([E(),y()]).optional()})).max(pu).optional()}).optional(),"Task Metrics":$({"Peak Execution Memory":y().optional(),"JVM GC Time":y().optional(),"Memory Bytes Spilled":y().optional(),"Disk Bytes Spilled":y().optional(),"Executor Run Time":y().optional(),"Executor CPU Time":y().optional(),"Shuffle Read Metrics":$({"Remote Bytes Read":y().optional(),"Local Bytes Read":y().optional(),"Fetch Wait Time":y().optional()}).optional(),"Shuffle Write Metrics":$({"Shuffle Bytes Written":y().optional()}).optional(),"Input Metrics":$({"Bytes Read":y().optional()}).optional(),"Output Metrics":$({"Bytes Written":y().optional()}).optional()}).optional()}),du=$({Event:Y("org.apache.spark.sql.execution.ui.SparkListenerSQLExecutionStart"),executionId:y(),description:E().optional(),time:y(),physicalPlanDescription:E().optional(),sparkPlanInfo:ur}),mu=$({Event:Y("org.apache.spark.sql.execution.ui.SparkListenerSQLAdaptiveExecutionUpdate"),executionId:y(),physicalPlanDescription:E().optional(),sparkPlanInfo:ur}),gu=$({Event:Y("org.apache.spark.sql.execution.ui.SparkListenerSQLExecutionEnd"),executionId:y(),time:y()}),vu=$({Event:Y("org.apache.spark.sql.execution.ui.SparkListenerDriverAccumUpdates"),executionId:y(),accumUpdates:pe(sr([y(),y()]))}),lr=Tc("Event",[eu,tu,nu,ru,su,au,uu,lu,fu,hu,du,mu,gu,vu,ou,iu]);function _u(e){throw new Error(`Unreachable case: ${JSON.stringify(e)}`)}const lt=[{key:"DURATION",name:"duration",prop:"duration"},{key:"GC_TIME",name:"gcTime",prop:"gcTime"},{key:"MEM_SPILLED",name:"memorySpilled",prop:"memSpilled"},{key:"DISK_SPILLED",name:"diskSpilled",prop:"diskSpilled"},{key:"SHUFFLE_READ",name:"shuffleRead",prop:"shuffleRead"},{key:"SHUFFLE_WRITE",name:"shuffleWrite",prop:"shuffleWrite"},{key:"LAUNCH_TIME",name:"launchTime",prop:"launchTime"},{key:"FINISH_TIME",name:"finishTime",prop:"finishTime"}],yu=lt.length,G=Object.freeze({...Object.fromEntries(lt.map((e,t)=>[e.key,t])),STRIDE:yu}),Su=lt.map(e=>e.name),vn=lt.map(e=>e.prop);function ku(e,t,n){if(t.taskAttempts===null)return null;const r=t,o=[];let i=0,s=0,a=0;const u=new Map,c=new Map,f=new Map,l=new Map;let p=0;for(const _ of t.taskAttempts.values()){if(i++,_.failed&&(s++,_.reason&&f.set(_.reason,(f.get(_.reason)??0)+1)),_.speculative&&a++,_.host){let T=u.get(_.host);T||(T={taskCount:0,totalDuration:0},u.set(_.host,T)),T.taskCount++,T.totalDuration+=_.duration}if(_.executorId){let T=c.get(_.executorId);T||(T={taskCount:0,totalDuration:0,inputBytes:0,shuffleReadBytes:0,shuffleWriteBytes:0},c.set(_.executorId,T)),T.taskCount++,T.totalDuration+=_.duration,T.inputBytes+=_.inputBytes,T.shuffleReadBytes+=_.shuffleRead,T.shuffleWriteBytes+=_.shuffleWrite}_.locality&&l.set(_.locality,(l.get(_.locality)??0)+1),_.peakExecMem>p&&(p=_.peakExecMem),r.shuffleReadBytes+=_.shuffleRead,r.shuffleWriteBytes+=_.shuffleWrite,r.fetchWaitTime+=_.fetchWaitTime,r.memoryBytesSpilled+=_.memSpilled,r.diskBytesSpilled+=_.diskSpilled,r.jvmGCTime+=_.gcTime,r.executorRunTime+=_.executorRunTime,r.executorCpuTime+=_.executorCpuTime,r.inputBytes+=_.inputBytes,r.outputBytes+=_.outputBytes;for(let T=0;T<vn.length;T++)o.push(_[vn[T]])}t.taskCount=i,t.failedTasks=s,t.speculativeTasks=a,t.taskAttempts=null;const h=new Float64Array(o);n.taskStore.set(e,h);const{p50:m,p95:S,max:v}=wu(h),R=r.memoryBytesSpilled>0?zu(h):"unclassified",{p50:N,p95:w,max:I}=Qe(h,G.SHUFFLE_READ),{p50:z,p95:k,max:j}=Qe(h,G.MEM_SPILLED),{p50:V,p95:W,max:J}=Qe(h,G.DISK_SPILLED),O=4*m;let H=0;const X=h.length/G.STRIDE;if(m>0)for(let _=0;_<X;_++)h[_*G.STRIDE+G.DURATION]>O&&H++;const Z=[...u.entries()].map(([_,T])=>({host:_,taskCount:T.taskCount,totalDuration:T.totalDuration})),b=[...c.entries()].map(([_,T])=>({executorId:_,taskCount:T.taskCount,totalDuration:T.totalDuration,inputBytes:T.inputBytes,shuffleReadBytes:T.shuffleReadBytes,shuffleWriteBytes:T.shuffleWriteBytes})),U=[...f.entries()].map(([_,T])=>({reason:_,count:T})),re=[...l.entries()].map(([_,T])=>({locality:_,count:T})),ae={...t,hostStats:Z,executorStats:b,failureReasons:U,localityStats:re,stragglerCount:H,peakExecutionMemoryMax:p,taskDurationP50:m,taskDurationP95:S,taskDurationMax:v,shuffleReadP50:N,shuffleReadP95:w,shuffleReadMax:I,spillMemP50:z,spillMemP95:k,spillMemMax:j,spillDiskP50:V,spillDiskP95:W,spillDiskMax:J,gcPct:r.executorRunTime>0?r.jvmGCTime/r.executorRunTime*100:0,spillClassification:R,stageType:r.shuffleReadBytes>0?"REDUCE":"MAP"};return delete ae.taskAttempts,{type:"stage",data:ae}}function Qe(e,t){const n=e.length/G.STRIDE;if(n===0)return{p50:0,p95:0,max:0};const r=new Float64Array(n);for(let o=0;o<n;o++)r[o]=e[o*G.STRIDE+t];return r.sort(),{p50:r[Math.ceil(n*.5)-1],p95:r[Math.ceil(n*.95)-1],max:r[n-1]}}function wu(e){return Qe(e,G.DURATION)}function zu(e){const t=e.length/G.STRIDE;if(t===0)return"unclassified";let n=0;for(let o=0;o<t;o++)e[o*G.STRIDE+G.MEM_SPILLED]===0&&n++;const r=n/t;return r>=.8?"skew":r<.2?"volume":"unclassified"}function bu(e,t){const n=[];for(const{launch:i,finish:s}of e)s>i&&(n.push({t:i,delta:1}),n.push({t:s,delta:-1}));n.sort((i,s)=>i.t-s.t||i.delta-s.delta);const r=[];let o=0;for(let i=0;i<n.length;i++){const s=n[i];o+=s.delta;const a=n[i+1];if(!a||a.t===s.t)continue;const u=t!=null?Math.min(o,t):o;r.push({tStart:s.t,tEnd:a.t,busy:u})}return r}function Eu(e,{bucketBy:t="time",bucketWidthMs:n=1e3,hypotheticalCores:r=null}={}){const o=bu(e,r);if(t==="coreCount"){const u=[];for(const c of o)u[c.busy]=(u[c.busy]??0)+(c.tEnd-c.tStart);for(let c=0;c<u.length;c++)u[c]===void 0&&(u[c]=0);return{mode:"coreCount",histogram:u}}if(o.length===0)return{mode:"time",bucketWidthMs:n,startTime:null,endTime:null,buckets:[]};const i=o[0].tStart,s=o[o.length-1].tEnd,a=[];for(let u=i;u<s;u+=n){const c=u+n;let f=0;for(const l of o){const p=Math.max(l.tStart,u),h=Math.min(l.tEnd,c);h>p&&(f+=l.busy*(h-p))}a.push({tStart:u,tEnd:c,busyCoreMs:f,avgBusyCores:f/n})}return{mode:"time",bucketWidthMs:n,startTime:i,endTime:s,buckets:a}}function Iu(e){const t=[],n={};for(const[s,a]of e){const u=a.length/G.STRIDE;let c=0;for(let f=0;f<u;f++){const l=f*G.STRIDE,p=a[l+G.LAUNCH_TIME],h=a[l+G.FINISH_TIME];c+=a[l+G.DURATION],h>p&&t.push({launch:p,finish:h})}n[s]={totalTaskDurationSum:c,taskCount:u}}const{histogram:r}=Eu(t,{bucketBy:"coreCount"});let o=0;for(let s=0;s<r.length;s++)o+=s*r[s];const i=r.length>0?r.length-1:0;return{coreHistogram:r,busyCoreMs:o,peakConcurrentCores:i,perStage:n}}function Mt(){const e=new TextDecoder("utf-8");let t="";return{decode(n){const o=(t+e.decode(n,{stream:!0})).split(`
65
+ `);return t=o.pop()??"",o.filter(i=>i.length>0)},flush(){const n=t.trim();return t="",n?[n]:[]}}}function _t(){return{app:null,pendingSparkVersion:null,pendingConfig:null,pendingResources:null,stages:new Map,taskStore:new Map,sqlExecutions:new Map,stageToSqlExec:new Map,sqlExecStages:new Map,jobs:new Map,executors:{added:[],removed:[]},skippedLines:0,accumState:new Map,rddInfo:new Map,taskAccumStages:new Map,evidenceInputs:{environmentUpdates:0,applicationEnds:0,stageSubmissions:0,rddStorageSnapshots:0,sqlExecutions:0,resolvedSqlPlans:0,executorMetricRows:0,taskRecords:0}}}function Tu(e){if(Array.isArray(e)){const n={};for(const r of e)Array.isArray(r)&&r.length>=2&&(n[r[0]]=String(r[1]));return n}const t={};for(const[n,r]of Object.entries(e??{}))t[n]=String(r);return t}function $u(e){if(e==null)return null;const t=String(e).trim().toLowerCase().match(/^([\d.]+)\s*([kmgt]?)(b?)$/);if(!t)return null;const n=parseFloat(t[1]);if(!Number.isFinite(n))return null;switch(t[2]){case"k":return Math.round(n/1024);case"g":return Math.round(n*1024);case"t":return Math.round(n*1024*1024);case"m":return Math.round(n);default:return t[3]==="b"?Math.round(n/(1024*1024)):Math.round(n)}}function fr(e){const t=e??{},n=i=>{if(t[i]==null)return null;const s=parseInt(t[i],10);return Number.isFinite(s)?s:null},r=i=>t[i]!=null?$u(t[i]):null,o=i=>t[i]!=null?String(t[i]).toLowerCase()==="true":null;return{executor:{memory:t["spark.executor.memory"]??null,memoryMB:r("spark.executor.memory"),memoryOverhead:t["spark.executor.memoryOverhead"]??null,memoryOverheadMB:r("spark.executor.memoryOverhead"),cores:n("spark.executor.cores"),instances:n("spark.executor.instances")},driver:{memory:t["spark.driver.memory"]??null,memoryMB:r("spark.driver.memory"),memoryOverhead:t["spark.driver.memoryOverhead"]??null,memoryOverheadMB:r("spark.driver.memoryOverhead"),cores:n("spark.driver.cores")},dynamicAllocationEnabled:o("spark.dynamicAllocation.enabled"),shuffleServiceEnabled:o("spark.shuffle.service.enabled"),serializer:t["spark.serializer"]??null}}function Zu(e){const t=new Map;for(const[n,r]of e)t.set(n,{...r,stageIds:[...r.stageIds].sort((o,i)=>o-i)});return t}function Pu(e){return{...e.evidenceInputs}}function ft(e){const t=Pu(e);return e.app.evidenceInputs=t,{type:"app",data:{...e.app,rddInfo:Zu(e.rddInfo)}}}function xu(e,t){const n=e["Stage ID"],r=t.stages.get(n);if(!r||r.taskAttempts===null)return null;t.evidenceInputs.taskRecords++;const o=e["Task Info"]?.Accumulables??[];for(const R of o)t.taskAccumStages.has(R.ID)||t.taskAccumStages.set(R.ID,new Set),t.taskAccumStages.get(R.ID).add(n);const i=e["Task Info"]??{},s=e["Task Metrics"]??{},a=s["Shuffle Read Metrics"]??{},u=s["Shuffle Write Metrics"]??{},c=s["Input Metrics"]??{},f=s["Output Metrics"]??{},l=(i["Finish Time"]??0)-(i["Launch Time"]??0),p=!!(i.Failed||i.Killed),h={duration:l,failed:p,launchTime:i["Launch Time"]??0,finishTime:i["Finish Time"]??0,reason:e["Task End Reason"]?.Reason??null,speculative:i.Speculative===!0,host:i.Host??"",executorId:i["Executor ID"]??"",locality:i.Locality??null,peakExecMem:s["Peak Execution Memory"]??0,gcTime:s["JVM GC Time"]??0,memSpilled:s["Memory Bytes Spilled"]??0,diskSpilled:s["Disk Bytes Spilled"]??0,shuffleRead:(a["Remote Bytes Read"]??0)+(a["Local Bytes Read"]??0),shuffleWrite:u["Shuffle Bytes Written"]??0,fetchWaitTime:a["Fetch Wait Time"]??0,executorRunTime:s["Executor Run Time"]??0,executorCpuTime:s["Executor CPU Time"]??0,inputBytes:c["Bytes Read"]??0,outputBytes:f["Bytes Written"]??0},m=i.Index,S=m!=null?`${e["Stage Attempt ID"]??0}:${m}`:Symbol("no-index"),v=r.taskAttempts.get(S);return v?v.failed&&!h.failed?(v.speculative||h.speculative?(r.speculationWasteMs+=v.duration,r.speculationWastedAttempts++):(r.retryWasteMs+=v.duration,r.wastedAttempts++),r.taskAttempts.set(S,h)):v.speculative||h.speculative?(r.speculationWasteMs+=h.duration,r.speculationWastedAttempts++):(r.retryWasteMs+=h.duration,r.wastedAttempts++):r.taskAttempts.set(S,h),null}function Ou(e,t,n,r){const o=new WeakSet,i=new WeakMap;function s(c){const f=(c.metrics??[]).reduce((h,m)=>(m.accumulatorId!==void 0&&t.has(m.accumulatorId)&&h.push({name:m.name,value:t.get(m.accumulatorId),metricType:m.metricType}),h),[]),l=new Set;for(const h of c.metrics??[]){if(h.accumulatorId===void 0)continue;const m=n.get(h.accumulatorId);if(m)for(const S of m)r&&r.has(S)&&l.add(S)}const p={name:c.nodeName,detail:c.simpleString??"",metrics:f,children:[]};return l.size>0&&(p.stageIds=[...l].sort((h,m)=>h-m)),p}const a=[e],u=[];for(;a.length>0;){const c=a.pop();if(!o.has(c)){o.add(c),u.push(c);for(const f of c.children??[])o.has(f)||a.push(f)}}for(let c=u.length-1;c>=0;c--){const f=u[c],l=s(f);i.set(f,l);for(const p of f.children??[]){const h=i.get(p);h&&l.children.push(h)}}return i.get(e)}const Au={JVMHeapMemory:"jvmHeapMemory",JVMOffHeapMemory:"jvmOffHeapMemory",OnHeapExecutionMemory:"onHeapExecutionMemory",OffHeapExecutionMemory:"offHeapExecutionMemory",OnHeapStorageMemory:"onHeapStorageMemory",OffHeapStorageMemory:"offHeapStorageMemory",OnHeapUnifiedMemory:"onHeapUnifiedMemory",OffHeapUnifiedMemory:"offHeapUnifiedMemory",DirectPoolMemory:"directPoolMemory",MappedPoolMemory:"mappedPoolMemory",ProcessTreeJVMVMemory:"processTreeJVMVMemory",ProcessTreeJVMRSSMemory:"processTreeJVMRSSMemory",ProcessTreePythonVMemory:"processTreePythonVMemory",ProcessTreePythonRSSMemory:"processTreePythonRSSMemory",ProcessTreeOtherVMemory:"processTreeOtherVMemory",ProcessTreeOtherRSSMemory:"processTreeOtherRSSMemory",MinorGCCount:"minorGCCount",MinorGCTime:"minorGCTime",MajorGCCount:"majorGCCount",MajorGCTime:"majorGCTime",TotalGCTime:"totalGCTime",ConcurrentGCCount:"concurrentGCCount",ConcurrentGCTime:"concurrentGCTime"};function Mu(e,t){const n=t.pendingConfig??{};return t.app={id:e["App ID"],name:e["App Name"],startTime:e.Timestamp,endTime:null,sparkVersion:t.pendingSparkVersion??e["Spark Version"]??null,config:n,resources:t.pendingResources??fr(n),rddInfo:t.rddInfo},ft(t)}function Ru(e,t){t.evidenceInputs.environmentUpdates++;const n=Tu(e["Spark Properties"]),r=fr(n);return t.app?(t.app.config=n,t.app.resources=r,ft(t)):(t.pendingConfig=n,t.pendingResources=r,null)}function Nu(e,t){const n=e["Stage IDs"]??[],r=e.Properties?.["spark.sql.execution.id"],o=r!=null?parseInt(String(r),10):null;if(o!=null){t.sqlExecStages.has(o)||t.sqlExecStages.set(o,new Set);const s=t.sqlExecStages.get(o);for(const a of n)t.stageToSqlExec.set(a,o),s.add(a)}const i=e["Job ID"];return i!=null&&t.jobs.set(i,{id:i,submissionTime:e["Submission Time"]??null,stageIds:n,sqlExecutionId:o,result:null,succeeded:null,exception:null,completionTime:null}),null}function Du(e,t){const n=e["Job ID"],r=e["Job Result"]?.Result??null,o=e["Job Result"]?.Exception?.Message??null,i=t.jobs.get(n)??{id:n,submissionTime:null,stageIds:[],sqlExecutionId:null,result:null,succeeded:null,exception:null,completionTime:null};return i.result=r,i.succeeded=r==="JobSucceeded",i.exception=o,i.completionTime=e["Completion Time"]??null,t.jobs.set(n,i),{type:"job",data:{...i}}}function Cu(e,t){t.evidenceInputs.stageSubmissions++;const n=e["Stage Info"],r=n["Stage ID"];return t.stages.set(r,{id:r,name:n["Stage Name"]??"",details:n.Details??"",submittedAt:n["Submission Time"]??0,completedAt:0,taskCount:0,failedTasks:0,shuffleReadBytes:0,shuffleWriteBytes:0,fetchWaitTime:0,memoryBytesSpilled:0,diskBytesSpilled:0,jvmGCTime:0,executorRunTime:0,executorCpuTime:0,inputBytes:0,outputBytes:0,sqlExecutionId:t.stageToSqlExec.get(r)??null,parentIds:n["Parent IDs"]??[],hostStats:new Map,speculativeTasks:0,failureReasons:new Map,stageFailureReason:null,taskAttempts:new Map,retryWasteMs:0,wastedAttempts:0,speculationWasteMs:0,speculationWastedAttempts:0,executorMetrics:new Map}),Lu(n,r,t),null}function Lu(e,t,n){for(const r of e["RDD Info"]??[]){const o=r["RDD ID"];if(o==null)continue;n.evidenceInputs.rddStorageSnapshots++;const i=r["Storage Level"]??{},s=n.rddInfo.get(o),a=s?.stageIds??new Set;a.add(t),n.rddInfo.set(o,{id:o,name:r.Name??"",callsite:r.Callsite??"",storageLevel:{useDisk:i["Use Disk"]??!1,useMemory:i["Use Memory"]??!1,deserialized:i.Deserialized??!1,replication:i.Replication??1},numPartitions:r["Number of Partitions"]??0,numCachedPartitions:r["Number of Cached Partitions"]||s?.numCachedPartitions||0,memorySize:r["Memory Size"]||s?.memorySize||0,diskSize:r["Disk Size"]||s?.diskSize||0,stageIds:a})}}function ju(e,t){const n=t.stages.get(e["Stage ID"]);if(!n)return null;const r=e["Executor Metrics"]??{},o={};for(const[i,s]of Object.entries(Au))r[i]!=null&&(o[s]=r[i]);return Object.keys(o).length>0&&t.evidenceInputs.executorMetricRows++,n.executorMetrics.set(e["Executor ID"],o),null}function Uu(e,t){t.evidenceInputs.sqlExecutions++;const n=e.sparkPlanInfo??null,r={id:e.executionId,description:e.description??"",startTime:e.time,endTime:null,stageIds:[],physicalPlanDescription:e.physicalPlanDescription??"",sparkPlanInfo:n,hadAdaptiveUpdate:!1};return t.sqlExecutions.set(r.id,r),n!==null&&t.accumState.set(r.id,new Map),{type:"sql",data:r}}function Fu(e,t){const n=t.sqlExecutions.get(e.executionId);n&&(n.endTime=e.time);const r=n?.sparkPlanInfo??null;if(!r||!r.nodeName)return t.accumState.delete(e.executionId),n?{type:"sql",data:{...n}}:null;const o=t.accumState.get(e.executionId)??new Map,i=Ou(r,o,t.taskAccumStages,t.sqlExecStages.get(e.executionId));return t.accumState.delete(e.executionId),t.evidenceInputs.resolvedSqlPlans++,{type:"sqlPlan",data:{executionId:e.executionId,planTree:i}}}function Bu(e,t){const{executionId:n,accumUpdates:r}=e;if(!t.accumState.has(n))return null;const o=t.accumState.get(n);for(const[i,s]of r)o.set(i,(o.get(i)??0)+s);return null}function Ju(e,t){const n=t.sqlExecutions.get(e.executionId);return n?(e.sparkPlanInfo!=null&&(n.sparkPlanInfo=e.sparkPlanInfo),e.physicalPlanDescription!=null&&(n.physicalPlanDescription=e.physicalPlanDescription),n.hadAdaptiveUpdate=!0,{type:"sql",data:{...n}}):null}function Vu(e,t){const n={kind:"added",timestamp:e.Timestamp,executorId:e["Executor ID"],host:e["Executor Info"]?.Host??"",totalCores:e["Executor Info"]?.["Total Cores"]??0,resourceProfileId:e["Executor Info"]?.["Resource Profile Id"]??e["Resource Profile Id"]??null};return t.executors.added.push(n),{type:"executor",data:n}}function Wu(e,t){const n={kind:"removed",timestamp:e.Timestamp,executorId:e["Executor ID"],reason:e["Removed Reason"]??""};return t.executors.removed.push(n),{type:"executor",data:n}}function qu(e,t){switch(e.Event){case"SparkListenerLogStart":return t.pendingSparkVersion=e["Spark Version"]??null,null;case"SparkListenerApplicationStart":return Mu(e,t);case"SparkListenerEnvironmentUpdate":return Ru(e,t);case"SparkListenerApplicationEnd":return t.evidenceInputs.applicationEnds++,t.app?(t.app.endTime=e.Timestamp,ft(t)):null;case"SparkListenerJobStart":return Nu(e,t);case"SparkListenerJobEnd":return Du(e,t);case"SparkListenerStageSubmitted":return Cu(e,t);case"SparkListenerStageCompleted":{const n=e["Stage Info"],r=n["Stage ID"],o=t.stages.get(r);return o?(o.completedAt=n["Completion Time"]??0,o.stageFailureReason=n["Failure Reason"]??null,ku(r,o,t)):null}case"SparkListenerStageExecutorMetrics":return ju(e,t);case"SparkListenerTaskEnd":return xu(e,t);case"org.apache.spark.sql.execution.ui.SparkListenerSQLExecutionStart":return Uu(e,t);case"org.apache.spark.sql.execution.ui.SparkListenerSQLAdaptiveExecutionUpdate":return Ju(e,t);case"org.apache.spark.sql.execution.ui.SparkListenerSQLExecutionEnd":return Fu(e,t);case"org.apache.spark.sql.execution.ui.SparkListenerDriverAccumUpdates":return Bu(e,t);case"SparkListenerExecutorAdded":return Vu(e,t);case"SparkListenerExecutorRemoved":return Wu(e,t);default:return _u(e)}}const Gu=new Set(lr.options.map(e=>e.shape.Event.value));function Re(e,t,n){let r;try{r=JSON.parse(e)}catch{t.skippedLines++;return}const o=r?.Event;if(typeof o!="string"||!Gu.has(o))return;const i=lr.safeParse(r);if(!i.success){t.skippedLines++;return}let s;try{s=qu(i.data,t)}catch(a){console.error("processEvent threw for an already-validated event:",a),t.skippedLines++;return}s&&n(s)}function Hu(e){const t=new Map;for(const[n,r]of e.stages)r.executorMetrics instanceof Map&&r.executorMetrics.size>0&&t.set(n,r.executorMetrics);return t}function Rt(e,t,n){t({type:"progress",pct:1,linesProcessed:n}),t({type:"runAggregates",data:Iu(e.taskStore)}),t({type:"stageExecutorMetrics",data:Hu(e)}),t(ft(e)),t({type:"done",skippedLines:e.skippedLines}),e.accumState.clear()}const Ku=new Set(["local-server-unavailable","upstream-unreachable","application-not-found","access-or-upstream-failure","invalid-event-log"]);function Yu({baseUrl:e,appId:t,attemptId:n}){const r=[["baseUrl",e],["appId",t]];return n!==null&&r.push(["attemptId",n]),`/shs-proxy?${r.map(([o,i])=>`${o}=${encodeURIComponent(i)}`).join("&")}`}function Xu(e){return typeof e=="string"&&Ku.has(e)}const Qu=$({code:E()}).passthrough();function pr(e,t){const n=s=>s.match(/(\d+)|(\D+)/g)??[s],r=n(e),o=n(t),i=Math.max(r.length,o.length);for(let s=0;s<i;s++){const a=r[s]??"",u=o[s]??"";if(a===u)continue;const c=Number(a),f=Number(u);return!Number.isNaN(c)&&!Number.isNaN(f)?c-f:a<u?-1:1}return 0}function el(e){const n=e.filter(c=>!c.toLowerCase().startsWith("appstatus")).filter(c=>/^events_\d+_/.test(c)),r=c=>parseInt(c.match(/^events_(\d+)_/)[1],10),o=n.filter(c=>c.endsWith(".compact")).map(r),i=o.length>0?Math.max(...o):-1,a=n.filter(c=>{const f=r(c);return c.endsWith(".compact")?f===i:f>i}).sort(pr),u=a.map(r);for(let c=1;c<u.length;c++)if(u[c]!==u[c-1]+1)throw new Error(`Rolling event-log directory is missing file(s) between index ${u[c-1]} and ${u[c]}.`);return a}function hr(e){if(e.length>=2&&e[0]===31&&e[1]===139)return"gz";if(e.length>=4&&e[0]===40&&e[1]===181&&e[2]===47&&e[3]===253)return"zstd";const t=[76,90,52,66,108,111,99,107];if(e.length>=8&&t.every((r,o)=>e[o]===r))return"lz4";const n=[130,83,78,65,80,80,89,0];return e.length>=8&&n.every((r,o)=>e[o]===r)?"snappy":null}function tl(e,t,n){const r=hr(t);if(r==="lz4"||e.endsWith(".lz4")){const o=Tn(n);o.push(t),o.end()}else if(r==="gz"||e.endsWith(".gz"))new In(n).push(t,!0);else if(r==="zstd"||e.endsWith(".zstd")||e.endsWith(".zst"))new Zn(n).push(t,!0);else if(r==="snappy"||e.endsWith(".snappy")){const o=Pn(n);o.push(t),o.end()}else n(t)}function se(e,t){e({type:"error",source:"shs",code:t})}async function nl(e,t,{fetchImpl:n=fetch,emit:r=o=>self.postMessage(o)}={}){const o=Yu(e);let i;try{i=await n(o)}catch{se(r,"local-server-unavailable");return}if(i.status===404){se(r,"local-server-unavailable");return}if(!i.ok){let c="access-or-upstream-failure";try{const f=Qu.parse(await i.json());Xu(f.code)&&(c=f.code)}catch{}se(r,c);return}if(!i.body){se(r,"invalid-event-log");return}let s,a;try{a=Number(i.headers.get("content-length"))||null;const c=i.body.getReader(),f=[];let l=0;for(;;){const{done:h,value:m}=await c.read();if(h)break;f.push(m),l+=m.length,(!a||l<a)&&r({type:"progress",pct:a?l/a*.5:null,linesProcessed:0})}s=new Uint8Array(l);let p=0;for(const h of f)s.set(h,p),p+=h.length}catch{se(r,"local-server-unavailable");return}if((i.headers.get("content-type")||"").startsWith("text/html")){se(r,"local-server-unavailable");return}a&&r({type:"progress",pct:.5,linesProcessed:0}),rl(s,t,r)}function rl(e,t,n){let r;try{r=Mr(e)}catch{se(n,"invalid-event-log");return}const o=Object.keys(r),i=o.some(c=>/^events_\d+_/.test(c));let s;if(i)try{s=el(o)}catch{se(n,"invalid-event-log");return}else s=o.filter(c=>c.toLowerCase()!=="appstatus").sort(pr);if(s.length===0){se(n,"invalid-event-log");return}const a=Mt();let u=0;for(const c of s)try{tl(c,r[c],f=>{for(const l of a.decode(f))Re(l,t,n),u++,u%2e3===0&&n({type:"progress",pct:null,linesProcessed:u})})}catch{se(n,"invalid-event-log");return}for(const c of a.flush())Re(c,t,n);if(!t.app){se(n,"invalid-event-log");return}Rt(t,n,u)}const dr=512*1024,ol=100,mr=300;async function gr(e,t,n){const r=new Uint8Array(await e.slice(0,Math.min(8,e.size)).arrayBuffer()),o=hr(r);let i=0;const s=o==="gz"?new In(p=>t(p,i)):null,a=o==="lz4"?Tn(p=>t(p,i)):null,u=o==="zstd"?new Zn(p=>t(p,i)):null,c=o==="snappy"?Pn(p=>t(p,i)):null,f=Math.max(1,Math.min(n,Math.ceil(e.size/ol)));let l=0;for(;l<e.size;){const p=l,h=new Uint8Array(await e.slice(p,p+f).arrayBuffer());l+=f;const m=l>=e.size;i=p/e.size,s?s.push(h,m):a?a.push(h):u?u.push(h,m):c?c.push(h):t(h,i)}a&&a.end(),c&&c.end()}async function il(e,t,{emit:n=o=>self.postMessage(o),chunkSize:r=dr}={}){if(e.size===0){n({type:"error",message:"File is empty."});return}const o=Mt();let i=0;const s=(a,u)=>{for(const c of o.decode(a))Re(c,t,n),i++,i%mr===0&&n({type:"progress",pct:u??null,linesProcessed:i})};try{await gr(e,s,r)}catch(a){const u=a instanceof Error?a.message:String(a);n({type:"error",message:`Could not decompress "${e.name}": ${u}`});return}for(const a of o.flush())Re(a,t,n);if(!t.app){n({type:"error",message:"Not a Spark event log: SparkListenerApplicationStart not found."});return}Rt(t,n,i)}async function sl(e,t,{emit:n=o=>self.postMessage(o),chunkSize:r=dr}={}){if(e.length===0){n({type:"error",message:"Rolling event-log directory contained no event files."});return}const o=Mt();let i=0;const s=e.reduce((f,l)=>f+l.size,0);let a=0,u=0;const c=(f,l)=>{for(const p of o.decode(f))if(Re(p,t,n),i++,i%mr===0){const h=s>0?(a+(l??0)*u)/s:null;n({type:"progress",pct:h,linesProcessed:i})}};for(const f of e){u=f.size;try{await gr(f,c,r)}catch(l){const p=l instanceof Error?l.message:String(l);n({type:"error",message:`Could not decompress "${f.name}": ${p}`});return}a+=f.size}for(const f of o.flush())Re(f,t,n);if(!t.app){n({type:"error",message:"Not a Spark event log: SparkListenerApplicationStart not found."});return}Rt(t,n,i)}const al=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope;if(al){let e=null;self.onmessage=async({data:t})=>{if(t.type==="parse")e=_t(),await il(t.file,e);else if(t.type==="parseFromUrl")e=_t(),await nl(t.request,e);else if(t.type==="parseFiles")e=_t(),await sl(t.files,e);else if(t.type==="getTaskData"){const{stageId:n,reqId:r}=t,o=e?.taskStore.get(n)??new Float64Array(0);self.postMessage({type:"taskData",stageId:n,reqId:r,metrics:o.slice(),fieldNames:Su})}}}
@@ -0,0 +1 @@
1
+ .react-flow{direction:ltr;--xy-edge-stroke-default: #b1b1b7;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #555;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(255, 255, 255, .5);--xy-minimap-background-color-default: #fff;--xy-minimap-mask-background-color-default: rgba(240, 240, 240, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #e2e2e2;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: transparent;--xy-background-pattern-dots-color-default: #91919a;--xy-background-pattern-lines-color-default: #eee;--xy-background-pattern-cross-color-default: #e2e2e2;background-color:var(--xy-background-color, var(--xy-background-color-default));--xy-node-color-default: inherit;--xy-node-border-default: 1px solid #1a192b;--xy-node-background-color-default: #fff;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(0, 0, 0, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #1a192b;--xy-node-border-radius-default: 3px;--xy-handle-background-color-default: #1a192b;--xy-handle-border-color-default: #fff;--xy-selection-background-color-default: rgba(0, 89, 220, .08);--xy-selection-border-default: 1px dotted rgba(0, 89, 220, .8);--xy-controls-button-background-color-default: #fefefe;--xy-controls-button-background-color-hover-default: #f4f4f4;--xy-controls-button-color-default: inherit;--xy-controls-button-color-hover-default: inherit;--xy-controls-button-border-color-default: #eee;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #ffffff;--xy-edge-label-color-default: inherit;--xy-resize-background-color-default: #3367d9}.react-flow.dark{--xy-edge-stroke-default: #3e3e3e;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #727272;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(150, 150, 150, .25);--xy-minimap-background-color-default: #141414;--xy-minimap-mask-background-color-default: rgba(60, 60, 60, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #2b2b2b;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: #141414;--xy-background-pattern-dots-color-default: #555;--xy-background-pattern-lines-color-default: #333;--xy-background-pattern-cross-color-default: #333;--xy-node-color-default: #f8f8f8;--xy-node-border-default: 1px solid #3c3c3c;--xy-node-background-color-default: #1e1e1e;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(255, 255, 255, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #999;--xy-handle-background-color-default: #bebebe;--xy-handle-border-color-default: #1e1e1e;--xy-selection-background-color-default: rgba(200, 200, 220, .08);--xy-selection-border-default: 1px dotted rgba(200, 200, 220, .8);--xy-controls-button-background-color-default: #2b2b2b;--xy-controls-button-background-color-hover-default: #3e3e3e;--xy-controls-button-color-default: #f8f8f8;--xy-controls-button-color-hover-default: #fff;--xy-controls-button-border-color-default: #5b5b5b;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #141414;--xy-edge-label-color-default: #f8f8f8}.react-flow__background{background-color:var(--xy-background-color-props, var(--xy-background-color, var(--xy-background-color-default)));pointer-events:none;z-index:-1}.react-flow__container{position:absolute;width:100%;height:100%;top:0;left:0}.react-flow__pane{z-index:1;touch-action:none}.react-flow__pane.draggable{cursor:grab}.react-flow__pane.dragging{cursor:grabbing}.react-flow__pane.selection{cursor:pointer}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow__edge-path{stroke:var(--xy-edge-stroke, var(--xy-edge-stroke-default));stroke-width:var(--xy-edge-stroke-width, var(--xy-edge-stroke-width-default));fill:none}.react-flow__connection-path{stroke:var(--xy-connectionline-stroke, var(--xy-connectionline-stroke-default));stroke-width:var(--xy-connectionline-stroke-width, var(--xy-connectionline-stroke-width-default));fill:none}.react-flow .react-flow__edges{position:absolute}.react-flow .react-flow__edges svg{overflow:visible;position:absolute;pointer-events:none}.react-flow__edge{pointer-events:visibleStroke}.react-flow__edge.selectable{cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus,.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge.selectable:focus .react-flow__edge-path,.react-flow__edge.selectable:focus-visible .react-flow__edge-path{stroke:var(--xy-edge-stroke-selected, var(--xy-edge-stroke-selected-default))}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__arrowhead polyline{stroke:var(--xy-edge-stroke, var(--xy-edge-stroke-default))}.react-flow__arrowhead polyline.arrowclosed{fill:var(--xy-edge-stroke, var(--xy-edge-stroke-default))}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;animation:dashdraw .5s linear infinite}svg.react-flow__connectionline{z-index:1001;overflow:visible;position:absolute}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:default}.react-flow__node.selectable{cursor:pointer}.react-flow__node.draggable{cursor:grab;pointer-events:all}.react-flow__node.draggable.dragging{cursor:grabbing}.react-flow__nodesselection{z-index:3;transform-origin:left top;pointer-events:none}.react-flow__nodesselection-rect{position:absolute;pointer-events:all;cursor:grab}.react-flow__handle{position:absolute;pointer-events:none;min-width:5px;min-height:5px;width:6px;height:6px;background-color:var(--xy-handle-background-color, var(--xy-handle-background-color-default));border:1px solid var(--xy-handle-border-color, var(--xy-handle-border-color-default));border-radius:100%}.react-flow__handle.connectingfrom{pointer-events:all}.react-flow__handle.connectionindicator{pointer-events:all;cursor:crosshair}.react-flow__handle-bottom{top:auto;left:50%;bottom:0;transform:translate(-50%,50%)}.react-flow__handle-top{top:0;left:50%;transform:translate(-50%,-50%)}.react-flow__handle-left{top:50%;left:0;transform:translate(-50%,-50%)}.react-flow__handle-right{top:50%;right:0;transform:translate(50%,-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__pane.selection .react-flow__panel{pointer-events:none}.react-flow__panel{position:absolute;z-index:5;margin:15px}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.top.center,.react-flow__panel.bottom.center{left:50%;transform:translate(-15px) translate(-50%)}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.left.center,.react-flow__panel.right.center{top:50%;transform:translateY(-15px) translateY(-50%)}.react-flow__attribution{font-size:10px;background:var(--xy-attribution-background-color, var(--xy-attribution-background-color-default));padding:2px 3px;margin:0}.react-flow__attribution a{text-decoration:none;color:#999}@keyframes dashdraw{0%{stroke-dashoffset:10}}.react-flow__edgelabel-renderer{position:absolute;width:100%;height:100%;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;left:0;top:0}.react-flow__viewport-portal{position:absolute;width:100%;height:100%;left:0;top:0;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__minimap{background:var( --xy-minimap-background-color-props, var(--xy-minimap-background-color, var(--xy-minimap-background-color-default)) )}.react-flow__minimap-svg{display:block}.react-flow__minimap-mask{fill:var( --xy-minimap-mask-background-color-props, var(--xy-minimap-mask-background-color, var(--xy-minimap-mask-background-color-default)) );stroke:var( --xy-minimap-mask-stroke-color-props, var(--xy-minimap-mask-stroke-color, var(--xy-minimap-mask-stroke-color-default)) );stroke-width:var( --xy-minimap-mask-stroke-width-props, var(--xy-minimap-mask-stroke-width, var(--xy-minimap-mask-stroke-width-default)) )}.react-flow__minimap-node{fill:var( --xy-minimap-node-background-color-props, var(--xy-minimap-node-background-color, var(--xy-minimap-node-background-color-default)) );stroke:var( --xy-minimap-node-stroke-color-props, var(--xy-minimap-node-stroke-color, var(--xy-minimap-node-stroke-color-default)) );stroke-width:var( --xy-minimap-node-stroke-width-props, var(--xy-minimap-node-stroke-width, var(--xy-minimap-node-stroke-width-default)) )}.react-flow__background-pattern.dots{fill:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-dots-color-default)) )}.react-flow__background-pattern.lines{stroke:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-lines-color-default)) )}.react-flow__background-pattern.cross{stroke:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-cross-color-default)) )}.react-flow__controls{display:flex;flex-direction:column;box-shadow:var(--xy-controls-box-shadow, var(--xy-controls-box-shadow-default))}.react-flow__controls.horizontal{flex-direction:row}.react-flow__controls-button{display:flex;justify-content:center;align-items:center;height:26px;width:26px;padding:4px;border:none;background:var(--xy-controls-button-background-color, var(--xy-controls-button-background-color-default));border-bottom:1px solid var( --xy-controls-button-border-color-props, var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default)) );color:var( --xy-controls-button-color-props, var(--xy-controls-button-color, var(--xy-controls-button-color-default)) );cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__controls-button svg{width:100%;max-width:12px;max-height:12px;fill:currentColor}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus,.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-input,.react-flow__node-default,.react-flow__node-output,.react-flow__node-group{padding:10px;border-radius:var(--xy-node-border-radius, var(--xy-node-border-radius-default));width:150px;font-size:12px;color:var(--xy-node-color, var(--xy-node-color-default));text-align:center;border:var(--xy-node-border, var(--xy-node-border-default));background-color:var(--xy-node-background-color, var(--xy-node-background-color-default))}.react-flow__node-input.selectable:hover,.react-flow__node-default.selectable:hover,.react-flow__node-output.selectable:hover,.react-flow__node-group.selectable:hover{box-shadow:var(--xy-node-boxshadow-hover, var(--xy-node-boxshadow-hover-default))}.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible{box-shadow:var(--xy-node-boxshadow-selected, var(--xy-node-boxshadow-selected-default))}.react-flow__node-group{background-color:var(--xy-node-group-background-color, var(--xy-node-group-background-color-default))}.react-flow__nodesselection-rect,.react-flow__selection{background:var(--xy-selection-background-color, var(--xy-selection-background-color-default));border:var(--xy-selection-border, var(--xy-selection-border-default))}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible,.react-flow__selection:focus,.react-flow__selection:focus-visible{outline:none}.react-flow__controls-button:hover{background:var( --xy-controls-button-background-color-hover-props, var(--xy-controls-button-background-color-hover, var(--xy-controls-button-background-color-hover-default)) );color:var( --xy-controls-button-color-hover-props, var(--xy-controls-button-color-hover, var(--xy-controls-button-color-hover-default)) )}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__controls-button:last-child{border-bottom:none}.react-flow__controls.horizontal .react-flow__controls-button{border-bottom:none;border-right:1px solid var( --xy-controls-button-border-color-props, var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default)) )}.react-flow__controls.horizontal .react-flow__controls-button:last-child{border-right:none}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.top,.react-flow__resize-control.bottom{cursor:ns-resize}.react-flow__resize-control.top.left,.react-flow__resize-control.bottom.right{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{width:5px;height:5px;border:1px solid #fff;border-radius:1px;background-color:var(--xy-resize-background-color, var(--xy-resize-background-color-default));translate:-50% -50%}.react-flow__resize-control.handle.left{left:0;top:50%}.react-flow__resize-control.handle.right{left:100%;top:50%}.react-flow__resize-control.handle.top{left:50%;top:0}.react-flow__resize-control.handle.bottom{left:50%;top:100%}.react-flow__resize-control.handle.top.left,.react-flow__resize-control.handle.bottom.left{left:0}.react-flow__resize-control.handle.top.right,.react-flow__resize-control.handle.bottom.right{left:100%}.react-flow__resize-control.line{border-color:var(--xy-resize-background-color, var(--xy-resize-background-color-default));border-width:0;border-style:solid}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{width:1px;transform:translate(-50%);top:0;height:100%}.react-flow__resize-control.line.left{left:0;border-left-width:1px}.react-flow__resize-control.line.right{left:100%;border-right-width:1px}.react-flow__resize-control.line.top,.react-flow__resize-control.line.bottom{height:1px;transform:translateY(-50%);left:0;width:100%}.react-flow__resize-control.line.top{top:0;border-top-width:1px}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%}.react-flow__edge-textbg{fill:var(--xy-edge-label-background-color, var(--xy-edge-label-background-color-default))}.react-flow__edge-text{fill:var(--xy-edge-label-color, var(--xy-edge-label-color-default))}