@marimo-team/frontend 0.14.11-dev9 → 0.14.12-dev0
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.
- package/dist/assets/{ConnectedDataExplorerComponent-uXz93dNS.js → ConnectedDataExplorerComponent-B9BmPz9a.js} +3 -3
- package/dist/assets/{ImageComparisonComponent-BKnsl2Lw.js → ImageComparisonComponent-CNTqLdnf.js} +1 -1
- package/dist/assets/{VegaLite-BaImNNv3.js → VegaLite-DLKRDJvl.js} +8 -8
- package/dist/assets/_baseEach-BjDLzUwG.js +1 -0
- package/dist/assets/_baseMap-CuZ-LBtv.js +1 -0
- package/dist/assets/_baseUniq-DqHaT24V.js +1 -0
- package/dist/assets/{_createAggregator-UP8Yzte5.js → _createAggregator-C_WhAECr.js} +1 -1
- package/dist/assets/{any-language-editor-DRrR5rXm.js → any-language-editor-DrZjy7mH.js} +1 -1
- package/dist/assets/arc-ZB5pDULS.js +1 -0
- package/dist/assets/architectureDiagram-NQ2NVSRB-DqJfNlvg.js +36 -0
- package/dist/assets/blockDiagram-PHRCVELO-BMyZ52bP.js +122 -0
- package/dist/assets/{c4Diagram-VJAJSXHY-CUi9TQC0.js → c4Diagram-6F6E4RAY-DveKwcb7.js} +2 -2
- package/dist/assets/channel-LYGgdr1R.js +1 -0
- package/dist/assets/{chunk-4BMEZGHF-D2t_7m-l.js → chunk-353BL4L5-DBdJb07A.js} +1 -1
- package/dist/assets/{chunk-D6G4REZN-PEhYQ7FV.js → chunk-67H74DCK-DG8iWVJ-.js} +1 -1
- package/dist/assets/chunk-6OLS64BW-Dmt4rYEQ.js +220 -0
- package/dist/assets/{chunk-XZIHB7SX-DVug_9TW.js → chunk-AACKK3MU-CDOdA9eC.js} +1 -1
- package/dist/assets/chunk-BFAMUDN2-Cf6198RO.js +1 -0
- package/dist/assets/chunk-E2GYISFI-fSvIEcyU.js +15 -0
- package/dist/assets/{chunk-A2AXSNBT-eJyrTwta.js → chunk-QEP2MXWD-D6FP1cQC.js} +4 -3
- package/dist/assets/chunk-SKB7J2MH-B7Z1FsaJ.js +1 -0
- package/dist/assets/{circle-play-Do5wdxBG.js → circle-play-CBftacWk.js} +2 -2
- package/dist/assets/classDiagram-BGRH5UQR-BQbZmSV-.js +1 -0
- package/dist/assets/classDiagram-v2-O24JOBDK-BQbZmSV-.js +1 -0
- package/dist/assets/clone-DD3sG0_1.js +1 -0
- package/dist/assets/compile-mbjlQ5nn.js +10 -0
- package/dist/assets/dagre-FFZHY6LT-DX9cGWLP.js +4 -0
- package/dist/assets/data-grid-overlay-editor-C4fyHnn1.js +1 -0
- package/dist/assets/diagram-3EMPZRKU-BwXQu6c-.js +24 -0
- package/dist/assets/diagram-5UYTHUR4-BgOShMim.js +24 -0
- package/dist/assets/diagram-ZTM2IBQH-m55tqkSF.js +43 -0
- package/dist/assets/edit-page-BMW2Fhcz.js +148 -0
- package/dist/assets/{erDiagram-Q7BY3M3F-B6F7ju5f.js → erDiagram-R3QVA2FD-B8SQvwhp.js} +1 -1
- package/dist/assets/flowDiagram-PKI6S5ZS-BTbZVZp0.js +162 -0
- package/dist/assets/ganttDiagram-EK5VF46D-Dkuqvb7b.js +267 -0
- package/dist/assets/gitGraphDiagram-GW3U2K7C-BMQ8L_am.js +65 -0
- package/dist/assets/glide-data-editor-BKZWFNVv.js +132 -0
- package/dist/assets/glide-data-editor-DcmjcDkq.css +1 -0
- package/dist/assets/{graph-wIsv4ssO.js → graph-CFDemIXQ.js} +1 -1
- package/dist/assets/home-page-DUbYTF9g.js +9 -0
- package/dist/assets/index-1az6nvpO.js +1 -0
- package/dist/assets/{index-CNd6d_Hy.js → index-B0-K_sX8.js} +1 -1
- package/dist/assets/{index-C2wmC6fr.js → index-B9WlbtVk.js} +1 -1
- package/dist/assets/index-BEQfoZiP.js +1 -0
- package/dist/assets/{index-Cpkva4YR.js → index-BWEPJWCF.js} +1 -1
- package/dist/assets/index-CE3mbf8H.js +1 -0
- package/dist/assets/{index-qUTVxT1L.js → index-CH2sakSJ.js} +1 -1
- package/dist/assets/{index-RZfe2xwT.js → index-CRY746sV.js} +1 -1
- package/dist/assets/index-C_e9XjpS.js +1 -0
- package/dist/assets/{index-CwKyWSy1.js → index-CaHkXpUp.js} +1 -1
- package/dist/assets/index-CfvA7bvb.js +1 -0
- package/dist/assets/{index-BRhVM8bV.js → index-ChVO1Vdj.js} +1 -1
- package/dist/assets/index-CsdFJkJw.css +1 -0
- package/dist/assets/{index-DnFPJYjY.js → index-CylrdBnG.js} +1 -1
- package/dist/assets/index-D3Er-byj.js +1 -0
- package/dist/assets/{index-CAMhb73a.js → index-D_Dmmo5g.js} +1 -1
- package/dist/assets/{index-DNQQBv-I.js → index-Drq4Lpl3.js} +1 -1
- package/dist/assets/{index-BRUyjTC9.js → index-MUMVp22V.js} +1 -1
- package/dist/assets/{index-gobDTezl.js → index-NLK5-sPO.js} +1 -1
- package/dist/assets/index-_lj65MZR.js +507 -0
- package/dist/assets/{index-DGgaTWAE.js → index-d0CXXxee.js} +2 -2
- package/dist/assets/infoDiagram-RLU2ROGC-DAW5X38W.js +2 -0
- package/dist/assets/journeyDiagram-EWQZEKCU--6lJjuiM.js +139 -0
- package/dist/assets/{kanban-definition-NDS4AKOZ-CHQtWsik.js → kanban-definition-ILFWEQ3N-CXNPWHB8.js} +9 -8
- package/dist/assets/{layout-DkXQ4_M1.js → layout-Jgv95YSr.js} +1 -1
- package/dist/assets/linear-DtgEMbrz.js +1 -0
- package/dist/assets/links-Bjf-1I2i.js +17 -0
- package/dist/assets/loro_wasm_bg-bPYKkGLG.wasm +0 -0
- package/dist/assets/mermaid-DCMac0Ai.js +152 -0
- package/dist/assets/min-VDyC-auF.js +1 -0
- package/dist/assets/{mindmap-definition-ALO5MXBD-B1X_X_4_.js → mindmap-definition-CZNETY7S-BEd6cR16.js} +4 -4
- package/dist/assets/number-overlay-editor-C3hemckO.js +9 -0
- package/dist/assets/{pieDiagram-IB7DONF6-BgMOnu-h.js → pieDiagram-NIOCPIFQ-B-zGF99A.js} +1 -1
- package/dist/assets/{quadrantDiagram-7GDLP6J5-BjE1BJSG.js → quadrantDiagram-2OG54O6I-2tF9b_2b.js} +1 -1
- package/dist/assets/{react-plotly-Hgniu5d7.js → react-plotly-CdJaKwaj.js} +1 -1
- package/dist/assets/{requirementDiagram-KVF5MWMF-DAYTGE0Y.js → requirementDiagram-SO3GGRV7-DEa34SeY.js} +3 -3
- package/dist/assets/run-page-Bg1x8WTa.js +1 -0
- package/dist/assets/{sankeyDiagram-QLVOVGJD-Dskrs1np.js → sankeyDiagram-4UZDY2LN-DUIUN-K8.js} +4 -4
- package/dist/assets/save-worker-B8gk1S9x.js +1 -0
- package/dist/assets/sequenceDiagram-ZIKVLSP4-BZGddaB9.js +122 -0
- package/dist/assets/slides-component-C2uc6kmf.js +1 -0
- package/dist/assets/sortBy-Bob7dKSt.js +1 -0
- package/dist/assets/stateDiagram-XX37X6EN-DUi_goR8.js +1 -0
- package/dist/assets/stateDiagram-v2-GD6S3NHB-CdRNmgeb.js +1 -0
- package/dist/assets/storage-CTvz5ejZ.js +25 -0
- package/dist/assets/{terminal-BwkkP8Z5.js → terminal-BkOhnp-S.js} +1 -1
- package/dist/assets/{time-4AULYytW.js → time-BXb9z1yv.js} +1 -1
- package/dist/assets/timeline-definition-RI47OAVP-CTWn3WQu.js +61 -0
- package/dist/assets/tracing-Z4QREdu3.js +2 -0
- package/dist/assets/trash-BWRVB_br.js +6 -0
- package/dist/assets/treemap-FKARHQ26-AlpUch0p.js +126 -0
- package/dist/assets/vega-component-CX_u3Hhp.js +1 -0
- package/dist/assets/worker-BYA2ASe8.js +1 -0
- package/dist/assets/worker-Ch6cKXnI.js +1 -0
- package/dist/assets/xychartDiagram-H2YORKM3-D0JoLNE8.js +7 -0
- package/dist/index.html +4 -2
- package/package.json +45 -44
- package/dist/assets/_baseEach-_Aph8Tu3.js +0 -1
- package/dist/assets/_baseMap-DLvObhA2.js +0 -1
- package/dist/assets/_baseUniq-ydsgt4N4.js +0 -1
- package/dist/assets/arc-CfyY4LWz.js +0 -1
- package/dist/assets/architectureDiagram-IEHRJDOE-uFOQEO33.js +0 -36
- package/dist/assets/blockDiagram-JOT3LUYC-DEvMFeRP.js +0 -121
- package/dist/assets/channel-0q_RQ8BB.js +0 -1
- package/dist/assets/chunk-AEK57VVT-DBCcQUkl.js +0 -220
- package/dist/assets/chunk-RZ5BOZE2-Ww9F4D19.js +0 -1
- package/dist/assets/classDiagram-GIVACNV2-CtATtfTL.js +0 -1
- package/dist/assets/classDiagram-v2-COTLJTTW-CtATtfTL.js +0 -1
- package/dist/assets/clone-WlurXIwI.js +0 -1
- package/dist/assets/compile-CS53SapK.js +0 -10
- package/dist/assets/dagre-OKDRZEBW-BnZptSaW.js +0 -4
- package/dist/assets/data-editor-CkjuKdYe.js +0 -142
- package/dist/assets/diagram-SSKATNLV-B1pf0a7a.js +0 -43
- package/dist/assets/diagram-VNBRO52H-Dwersrui.js +0 -24
- package/dist/assets/edit-page-FmqkTE0k.js +0 -144
- package/dist/assets/flowDiagram-4HSFHLVR-BZFM8dwO.js +0 -161
- package/dist/assets/ganttDiagram-APWFNJXF-C5tnuAdQ.js +0 -257
- package/dist/assets/gitGraphDiagram-7IBYFJ6S-CfB_wvgD.js +0 -65
- package/dist/assets/home-page-C4EqZnZ_.js +0 -9
- package/dist/assets/index-8IZtaDUn.css +0 -1
- package/dist/assets/index-B6FmCnnO.js +0 -1
- package/dist/assets/index-Brn5h-MN.js +0 -501
- package/dist/assets/index-CUP2IjKA.js +0 -1
- package/dist/assets/index-D6dKte92.js +0 -1
- package/dist/assets/index-D8WfHeCN.js +0 -1
- package/dist/assets/index-bmSr8I3W.js +0 -1
- package/dist/assets/infoDiagram-PH2N3AL5-BOyAI4Oa.js +0 -2
- package/dist/assets/journeyDiagram-U35MCT3I-BmSDnsgn.js +0 -138
- package/dist/assets/linear-CKa6tYxf.js +0 -1
- package/dist/assets/loro_wasm_bg-DHBNbovs.wasm +0 -0
- package/dist/assets/mermaid-CKYMkzSc.js +0 -152
- package/dist/assets/min-DPzXE2V0.js +0 -1
- package/dist/assets/radar-MK3ICKWK-BGF1Bvyn.js +0 -126
- package/dist/assets/run-page-DH3oskJG.js +0 -1
- package/dist/assets/save-worker-DZnx0AG9.js +0 -1
- package/dist/assets/sequenceDiagram-X6HHIX6F-CjFOqeNr.js +0 -122
- package/dist/assets/shutdown-button-T9XyTVKT.js +0 -17
- package/dist/assets/slides-component-B5LFcBlv.js +0 -1
- package/dist/assets/sortBy-w86K0CWQ.js +0 -1
- package/dist/assets/stateDiagram-DGXRK772-CPPjYL76.js +0 -1
- package/dist/assets/stateDiagram-v2-YXO3MK2T-3iPgv_dT.js +0 -1
- package/dist/assets/storage-BSuExvg_.js +0 -27
- package/dist/assets/timeline-definition-BDJGKUSR-CAO3o0Eo.js +0 -61
- package/dist/assets/tracing-DV52BG1x.js +0 -2
- package/dist/assets/vega-component-DbwTp9Hj.js +0 -1
- package/dist/assets/worker-BbdB3qWL.js +0 -1
- package/dist/assets/worker-CnoOKJWk.js +0 -1
- package/dist/assets/xychartDiagram-VJFVF3MP-Q0piBnso.js +0 -7
- /package/dist/assets/{shutdown-button-C1rhMrxo.css → links-C1rhMrxo.css} +0 -0
- /package/dist/assets/{transform-DetRMEbJ.js → transform-CDNfLgV5.js} +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
import{aG as V,aH as G,a as E,aI as F,aJ as W,aK as D,j as g,E as $,V as C,W as j,aL as K,aM as I,aN as R,L as _,aO as L,aP as q,aQ as J,aR as Q,aS as B,a1 as U,aT as X}from"./index-_lj65MZR.js";import{M as y}from"./compile-mbjlQ5nn.js";import{a as Y}from"./VegaLite-DLKRDJvl.js";import"./time-BXb9z1yv.js";import"./timer-Bqd5yn_a.js";import"./linear-DtgEMbrz.js";import"./init-DLRA0X12.js";import"./range-CtcPcB_L.js";import"./zoom-COrs4lFh.js";import"./ordinal-DDUp3AbE.js";import"./colors-bszWmPJw.js";import"./step-BwsUM5iJ.js";import"./arc-ZB5pDULS.js";import"./index-BEQfoZiP.js";import"./index-CH2sakSJ.js";const T=new Set(["boxplot","errorband","errorbar"]),S={getMarkType(t){const e=typeof t=="string"?t:t.type;if(T.has(e))throw new Error("Not supported");return e},isInteractive(t){const e=typeof t=="string"?t:t.type;return!T.has(e)},makeClickable(t){const e=typeof t=="string"?t:t.type;return e in y?typeof t=="string"?{type:t,cursor:"pointer",tooltip:!0}:{...t,type:e,cursor:"pointer",tooltip:!0}:t},getOpacity:t=>typeof t=="string"?null:"opacity"in t&&typeof t.opacity=="number"?t.opacity:null},tt=new Set(["color","fill","fillOpacity","opacity","shape","size"]);function et(t,e,r,i){const m={and:r.map(d=>({param:d}))};if(t==="opacity"){const d=S.getOpacity(i)||1;return{...e,opacity:{condition:{test:m,value:d},value:d/5}}}return e}const w={point:t=>t==null?"select_point":`select_point_${t}`,interval:t=>t==null?"select_interval":`select_interval_${t}`,legendSelection:t=>`legend_selection_${t}`,HIGHLIGHT:"highlight",PAN_ZOOM:"pan_zoom",hasPoint:t=>t.some(e=>e.startsWith("select_point")),hasInterval:t=>t.some(e=>e.startsWith("select_interval")),hasLegend:t=>t.some(e=>e.startsWith("legend_selection")),hasPanZoom:t=>t.some(e=>e.startsWith("pan_zoom"))},P={highlight:()=>({name:w.HIGHLIGHT,select:{type:"point",on:"mouseover"}}),interval:(t,e)=>({name:w.interval(e),select:{type:"interval",encodings:Z(t),mark:{fill:"#669EFF",fillOpacity:.07,stroke:"#669EFF",strokeOpacity:.4},on:"[mousedown[!event.metaKey], mouseup] > mousemove[!event.metaKey]",translate:"[mousedown[!event.metaKey], mouseup] > mousemove[!event.metaKey]"}}),point:(t,e)=>({name:w.point(e),select:{type:"point",encodings:Z(t),on:"click[!event.metaKey]"}}),legend:t=>({name:w.legendSelection(t),select:{type:"point",fields:[t]},bind:"legend"}),panZoom:()=>({name:w.PAN_ZOOM,bind:"scales",select:{type:"interval",on:"[mousedown[event.metaKey], window:mouseup] > window:mousemove!",translate:"[mousedown[event.metaKey], window:mouseup] > window:mousemove!",zoom:"wheel![event.metaKey]"}})};function Z(t){switch(S.getMarkType(t.mark)){case y.image:case y.trail:return;case y.area:case y.arc:return["color"];case y.bar:{const e=function(r){var d,l;if(!r||!("mark"in r))return;const i=(d=r.encoding)==null?void 0:d.x,m=(l=r.encoding)==null?void 0:l.y;if(i&&"type"in i&&i.type==="nominal")return"vertical";if(m&&"type"in m&&m.type==="nominal"||i&&"aggregate"in i)return"horizontal";if(m&&"aggregate"in m)return"vertical"}(t);return e==="horizontal"?["y"]:e==="vertical"?["x"]:void 0}case y.circle:case y.geoshape:case y.line:case y.point:case y.rect:case y.rule:case y.square:case y.text:case y.tick:return["x","y"]}}function z(t){return"params"in t&&t.params&&t.params.length>0?t.params.filter(e=>e!=null&&"select"in e&&e.select!==void 0).map(e=>e.name):"layer"in t?[...new Set(t.layer.flatMap(z))]:[]}function at(t,e){var f,v;let{chartSelection:r=!0,fieldSelection:i=!0}=e;if(!r&&!i)return t;if(((f=t.params)==null?void 0:f.some(c=>c.bind==="legend"))&&(i=!1),((v=t.params)==null?void 0:v.some(c=>!c.bind))&&(r=!1),"vconcat"in t){const c=t.vconcat.map(o=>"mark"in o?O(o):o);return{...t,vconcat:c}}if("hconcat"in t){const c=t.hconcat.map(o=>"mark"in o?O(o):o);return{...t,hconcat:c}}if("layer"in t){const c=t.layer.map((o,p)=>{if(!("mark"in o))return o;let s=o;return s=A(s,r,p),s=O(s),p===0&&(s=H(s)),s});return{...t,layer:c}}if(!("mark"in t)||!S.isInteractive(t.mark))return t;let l=t;return l=function(c,o){if(o===!1)return c;let p=function(h){if(!h||!("encoding"in h))return[];const{encoding:b}=h;return b?Object.entries(b).flatMap(a=>{const[n,u]=a;return u&&tt.has(n)?"field"in u&&typeof u.field=="string"?[u.field]:"condition"in u&&u.condition&&typeof u.condition=="object"&&"field"in u.condition&&u.condition.field&&typeof u.condition.field=="string"?[u.condition.field]:[]:[]}):[]}(c);Array.isArray(o)&&(p=p.filter(h=>o.includes(h)));const s=p.map(h=>P.legend(h)),x=[...c.params||[],...s];return{...c,params:x}}(l,i),l=A(l,r,void 0),l=O(l),l=H(l),l}function A(t,e,r){if(e===!1)return t;let i;try{i=S.getMarkType(t.mark)}catch{return t}if(i==="geoshape")return t;const m=e===!0?function(f){switch(f){case"arc":case"area":return["point"];case"text":case"bar":default:return["point","interval"];case"line":return}}(i):[e];if(!m)return t;const d=m.map(f=>f==="interval"?P.interval(t,r):P.point(t,r)),l=[...t.params||[],...d];return{...t,params:l}}function H(t){let e;try{e=S.getMarkType(t.mark)}catch{}if(e==="geoshape")return t;const r=t.params||[];return r.some(i=>i.bind==="scales")?t:{...t,params:[...r,P.panZoom()]}}function O(t){const e="encoding"in t?t.encoding:void 0,r=t.params||[],i=r.map(m=>m.name);return r.length===0?t:S.isInteractive(t.mark)?{...t,mark:S.makeClickable(t.mark),encoding:et("opacity",e||{},i,t.mark)}:t}W("arrow",D);const nt=t=>{const e=E.c(11),{value:r,setValue:i,chartSelection:m,fieldSelection:d,spec:l}=t;let f,v;e[0]!==l?(f=async()=>async function(s){if(!s)return s;const x="datasets"in s?{...s.datasets}:{},h=async a=>{if(!a)return a;if("layer"in a){const k=await Promise.all(a.layer.map(h));a={...a,layer:k}}if("hconcat"in a){const k=await Promise.all(a.hconcat.map(h));a={...a,hconcat:k}}if("vconcat"in a){const k=await Promise.all(a.vconcat.map(h));a={...a,vconcat:k}}if("spec"in a&&(a={...a,spec:await h(a.spec)}),!a.data||!("url"in a.data))return a;let n;try{n=V(a.data.url)}catch{return a}const u=await G(n.href,a.data.format);return x[n.pathname]=u,{...a,data:{name:n.pathname}}},b=await h(s);return Object.keys(x).length===0?b:{...b,datasets:x}}(l),v=[l],e[0]=l,e[1]=f,e[2]=v):(f=e[1],v=e[2]);const{data:c,error:o}=F(f,v);if(o){let s;return e[3]!==o?(s=g.jsx($,{error:o}),e[3]=o,e[4]=s):s=e[4],s}if(!c)return null;let p;return e[5]!==m||e[6]!==d||e[7]!==c||e[8]!==i||e[9]!==r?(p=g.jsx(rt,{value:r,setValue:i,chartSelection:m,fieldSelection:d,spec:c}),e[5]=m,e[6]=d,e[7]=c,e[8]=i,e[9]=r,e[10]=p):p=e[10],p},rt=({value:t,setValue:e,chartSelection:r,fieldSelection:i,spec:m})=>{const{theme:d}=C(),l=j.useRef(void 0),[f,v]=j.useState(),c=K(m),o=j.useMemo(()=>at(function(n){return n.data&&"url"in n.data&&(n.data.url=V(n.data.url).href),n}(c),{chartSelection:r,fieldSelection:i}),[c,r,i]),p=j.useMemo(()=>z(o),[o]),s=I(n=>{e({...t,...n})}),x=K(p),h=j.useMemo(()=>x.reduce((n,u)=>(w.PAN_ZOOM===u||(n[u]=R((k,N)=>{_.debug("[Vega signal]",k,N);let M=L.mapValues(N,st);M=L.mapValues(M,ot),s({[k]:M})},100)),n),{}),[x,s]),b=I(n=>{_.error(n),_.debug(o),v(n)}),a=I(n=>{_.debug("[Vega view] created",n),l.current=n,v(void 0)});return g.jsxs(g.Fragment,{children:[f&&g.jsxs(q,{variant:"destructive",children:[g.jsx(J,{children:f.message}),g.jsx("div",{className:"text-md",children:f.stack})]}),g.jsxs("div",{className:"relative",onPointerDown:Q.stopPropagation(),children:[g.jsx(Y,{spec:o,theme:d==="dark"?"dark":void 0,actions:it,signalListeners:h,onError:b,onNewView:a}),(()=>{const n=[];return w.hasPoint(p)&&n.push(["Point selection","click to select a point; hold shift for multi-select"]),w.hasInterval(p)&&n.push(["Interval selection","click and drag to select an interval"]),w.hasLegend(p)&&n.push(["Legend selection","click to select a legend item; hold shift for multi-select"]),w.hasPanZoom(p)&&n.push(["Pan","hold the meta key and drag"],["Zoom","hold the meta key and scroll"]),n.length===0?null:g.jsx(U,{delayDuration:300,side:"left",content:g.jsx("div",{className:"text-xs flex flex-col",children:n.map((u,k)=>g.jsxs("div",{children:[g.jsxs("span",{className:"font-bold tracking-wide",children:[u[0],":"]})," ",u[1]]},k))}),children:g.jsx(X,{className:"absolute bottom-1 right-0 m-2 h-4 w-4 cursor-help text-muted-foreground hover:text-foreground"})})})()]})]})},it={source:!1,compiled:!1};function ot(t){return t instanceof Set?[...t]:t}function st(t){return Array.isArray(t)?t.map(e=>e instanceof Date&&B(e)?new Date(e).getTime():e):t}export{nt as default};
|
@@ -0,0 +1 @@
|
|
1
|
+
const e=1e3;function t(e,t){const a=e.map(e=>`"${e}"`).join(", ");return new Error(`This RPC instance cannot ${t} because the transport did not provide one or more of these methods: ${a}`)}function a(a={}){let r={};function n(e){r=e}let s,i={};function o(e){i.unregisterHandler&&i.unregisterHandler(),i=e,i.registerHandler?.(b)}function d(e){s="function"!=typeof e?(t,a)=>{const r=e[t];if(r)return r(a);const n=e._;if(!n)throw new Error(`The requested method has no handler: ${t}`);return n(t,a)}:e}const{maxRequestTime:c=e}=a;a.transport&&o(a.transport),a.requestHandler&&d(a.requestHandler),a._debugHooks&&n(a._debugHooks);let u=0;const l=new Map,p=new Map;function h(e,...a){const n=a[0];return new Promise((a,s)=>{if(!i.send)throw t(["send"],"make requests");const o=u<=1e10?++u:u=0,d={type:"request",id:o,method:e,params:n};l.set(o,{resolve:a,reject:s}),c!==1/0&&p.set(o,setTimeout(()=>{p.delete(o),s(new Error("RPC request timed out."))},c)),r.onSend?.(d),i.send(d)})}const m=new Proxy(h,{get:(e,t,a)=>t in e?Reflect.get(e,t,a):e=>h(t,e)}),f=m;function y(e,...a){const n=a[0];if(!i.send)throw t(["send"],"send messages");const s={type:"message",id:e,payload:n};r.onSend?.(s),i.send(s)}const g=new Proxy(y,{get:(e,t,a)=>t in e?Reflect.get(e,t,a):e=>y(t,e)}),_=g,v=new Map,w=new Set;async function b(e){if(r.onReceive?.(e),!("type"in e))throw new Error("Message does not contain a type.");if("request"===e.type){if(!i.send||!s)throw t(["send","requestHandler"],"handle requests");const{id:n,method:o,params:d}=e;let c;try{c={type:"response",id:n,success:!0,payload:await s(o,d)}}catch(a){if(!(a instanceof Error))throw a;c={type:"response",id:n,success:!1,error:a.message}}return r.onSend?.(c),void i.send(c)}if("response"===e.type){const t=p.get(e.id);null!=t&&clearTimeout(t);const{resolve:a,reject:r}=l.get(e.id)??{};return void(e.success?a?.(e.payload):r?.(new Error(e.error)))}if("message"===e.type){for(const a of w)a(e.id,e.payload);const t=v.get(e.id);if(!t)return;for(const a of t)a(e.payload);return}throw new Error(`Unexpected RPC message type: ${e.type}`)}return{setTransport:o,setRequestHandler:d,request:m,requestProxy:f,send:g,sendProxy:_,addMessageListener:function(e,a){if(!i.registerHandler)throw t(["registerHandler"],"register message listeners");"*"!==e?(v.has(e)||v.set(e,new Set),v.get(e)?.add(a)):w.add(a)},removeMessageListener:function(e,t){"*"!==e?(v.get(e)?.delete(t),0===v.get(e)?.size&&v.delete(e)):w.delete(t)},proxy:{send:_,request:f},_setDebugHooks:n}}const r="[transport-id]";function n(e,t={}){const{transportId:a,filter:n,remotePort:s}=t,i=e,o=s??e;let d;return{send(e){o.postMessage(function(e,t){const{transportId:a}=t;return null!=a?{[r]:a,data:e}:e}(e,{transportId:a}))},registerHandler(e){d=t=>{const s=t.data,[i,o]=function(e,t){const{transportId:a,filter:n}=t,s=n?.();if(null!=a&&null!=s)throw new Error("Cannot use both `transportId` and `filter` at the same time");let i=e;if(a){if(e[r]!==a)return[!0];i=e.data}return!1===s?[!0]:[!1,i]}(s,{transportId:a,filter:()=>n?.(t)});i||e(o)},i.addEventListener("message",d)},unregisterHandler(){d&&i.removeEventListener("message",d)}}}var s,i=Object.defineProperty,o=(e,t)=>i(e,"name",{value:t,configurable:!0}),d=(s=function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')},typeof require<"u"?require:typeof Proxy<"u"?new Proxy(s,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):s);function c(e){return!isNaN(parseFloat(e))&&isFinite(e)}function u(e){return e.charAt(0).toUpperCase()+e.substring(1)}function l(e){return function(){return this[e]}}o(c,"_isNumber"),o(u,"_capitalize"),o(l,"_getter");var p,h,m=["isConstructor","isEval","isNative","isToplevel"],f=["columnNumber","lineNumber"],y=["fileName","functionName","source"],g=m.concat(f,y,["args"],["evalOrigin"]);function _(e){if(e)for(var t=0;t<g.length;t++)void 0!==e[g[t]]&&this["set"+u(g[t])](e[g[t]])}for(o(_,"StackFrame"),_.prototype={getArgs:function(){return this.args},setArgs:function(e){if("[object Array]"!==Object.prototype.toString.call(e))throw new TypeError("Args must be an Array");this.args=e},getEvalOrigin:function(){return this.evalOrigin},setEvalOrigin:function(e){if(e instanceof _)this.evalOrigin=e;else{if(!(e instanceof Object))throw new TypeError("Eval Origin must be an Object or StackFrame");this.evalOrigin=new _(e)}},toString:function(){var e=this.getFileName()||"",t=this.getLineNumber()||"",a=this.getColumnNumber()||"",r=this.getFunctionName()||"";return this.getIsEval()?e?"[eval] ("+e+":"+t+":"+a+")":"[eval]:"+t+":"+a:r?r+" ("+e+":"+t+":"+a+")":e+":"+t+":"+a}},_.fromString=o(function(e){var t=e.indexOf("("),a=e.lastIndexOf(")"),r=e.substring(0,t),n=e.substring(t+1,a).split(","),s=e.substring(a+1);if(0===s.indexOf("@"))var i=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(s,""),o=i[1],d=i[2],c=i[3];return new _({functionName:r,args:n||void 0,fileName:o,lineNumber:d||void 0,columnNumber:c||void 0})},"StackFrame$$fromString"),p=0;p<m.length;p++)_.prototype["get"+u(m[p])]=l(m[p]),_.prototype["set"+u(m[p])]=function(e){return function(t){this[e]=!!t}}(m[p]);for(h=0;h<f.length;h++)_.prototype["get"+u(f[h])]=l(f[h]),_.prototype["set"+u(f[h])]=function(e){return function(t){if(!c(t))throw new TypeError(e+" must be a Number");this[e]=Number(t)}}(f[h]);for(v=0;v<y.length;v++)_.prototype["get"+u(y[v])]=l(y[v]),_.prototype["set"+u(y[v])]=function(e){return function(t){this[e]=String(t)}}(y[v]);var v,w=_;function b(){var e=/^\s*at .*(\S+:\d+|\(native\))/m,t=/^(eval@)?(\[native code])?$/;return{parse:o(function(t){if(t.stack&&t.stack.match(e))return this.parseV8OrIE(t);if(t.stack)return this.parseFFOrSafari(t);throw new Error("Cannot parse given Error object")},"ErrorStackParser$$parse"),extractLocation:o(function(e){if(-1===e.indexOf(":"))return[e];var t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));return[t[1],t[2]||void 0,t[3]||void 0]},"ErrorStackParser$$extractLocation"),parseV8OrIE:o(function(t){return t.stack.split("\n").filter(function(t){return!!t.match(e)},this).map(function(e){e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(,.*$)/g,""));var t=e.replace(/^\s+/,"").replace(/\(eval code/g,"(").replace(/^.*?\s+/,""),a=t.match(/ (\(.+\)$)/);t=a?t.replace(a[0],""):t;var r=this.extractLocation(a?a[1]:t),n=a&&t||void 0,s=["eval","<anonymous>"].indexOf(r[0])>-1?void 0:r[0];return new w({functionName:n,fileName:s,lineNumber:r[1],columnNumber:r[2],source:e})},this)},"ErrorStackParser$$parseV8OrIE"),parseFFOrSafari:o(function(e){return e.stack.split("\n").filter(function(e){return!e.match(t)},this).map(function(e){if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new w({functionName:e});var t=/((.*".+"[^@]*)?[^@]*)(?:@)/,a=e.match(t),r=a&&a[1]?a[1]:void 0,n=this.extractLocation(e.replace(t,""));return new w({functionName:r,fileName:n[0],lineNumber:n[1],columnNumber:n[2],source:e})},this)},"ErrorStackParser$$parseFFOrSafari")}}o(b,"ErrorStackParser");var k,x,S,O,T,E,N,j,P,C=new b,A="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node&&!process.browser,Z=A&&typeof module<"u"&&typeof module.exports<"u"&&typeof d<"u"&&typeof __dirname<"u",I=A&&!Z,R=typeof Deno<"u",$=!A&&!R,F=$&&"object"==typeof window&&"object"==typeof document&&"function"==typeof document.createElement&&"sessionStorage"in window&&"function"!=typeof importScripts,L=$&&"function"==typeof importScripts&&"object"==typeof self;async function M(){if(!A||(k=(await import("./__vite-browser-external-CIEyP2s7.js")).default,O=await import("./__vite-browser-external-CIEyP2s7.js"),T=await import("./__vite-browser-external-CIEyP2s7.js"),S=(await import("./__vite-browser-external-CIEyP2s7.js")).default,x=await import("./__vite-browser-external-CIEyP2s7.js"),N=x.sep,typeof d<"u"))return;let e={fs:O,crypto:await import("./__vite-browser-external-CIEyP2s7.js"),ws:await import("./__vite-browser-external-CIEyP2s7.js"),child_process:await import("./__vite-browser-external-CIEyP2s7.js")};globalThis.require=function(t){return e[t]}}function D(e,t){return x.resolve(t||".",e)}function z(e,t){return void 0===t&&(t=location),new URL(e,t).toString()}function q(e,t){return e.startsWith("file://")&&(e=e.slice(7)),e.includes("://")?{response:fetch(e)}:{binary:T.readFile(e).then(e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}}function U(e,t){let a=new URL(e,location);return{response:fetch(a,t?{integrity:t}:{})}}async function V(e,t){let{response:a,binary:r}=j(e,t);if(r)return r;let n=await a;if(!n.ok)throw new Error(`Failed to load '${e}': request failed.`);return new Uint8Array(await n.arrayBuffer())}if("object"==typeof navigator&&"string"==typeof navigator.userAgent&&-1==navigator.userAgent.indexOf("Chrome")&&navigator.userAgent.indexOf("Safari"),o(M,"initNodeModules"),o(D,"node_resolvePath"),o(z,"browser_resolvePath"),E=A?D:z,A||(N="/"),o(q,"node_getBinaryResponse"),o(U,"browser_getBinaryResponse"),j=A?q:U,o(V,"loadBinaryFile"),F)P=o(async e=>await import(e),"loadScript");else if(L)P=o(async e=>{try{globalThis.importScripts(e)}catch(ha){if(!(ha instanceof TypeError))throw ha;await import(e)}},"loadScript");else{if(!A)throw new Error("Cannot determine runtime environment");P=H}async function H(e){e.startsWith("file://")&&(e=e.slice(7)),e.includes("://")?S.runInThisContext(await(await fetch(e)).text()):await import(k.pathToFileURL(e).href)}async function W(e){if(A){await M();let t=await T.readFile(e,{encoding:"utf8"});return JSON.parse(t)}return await(await fetch(e)).json()}async function B(){if(Z)return __dirname;let e;try{throw new Error}catch(r){e=r}let t=C.parse(e)[0].fileName;if(A&&!t.startsWith("file://")&&(t=`file://${t}`),I){let e=await import("./__vite-browser-external-CIEyP2s7.js");return(await import("./__vite-browser-external-CIEyP2s7.js")).fileURLToPath(e.dirname(t))}let a=t.lastIndexOf(N);if(-1===a)throw new Error("Could not extract indexURL path from pyodide module location");return t.slice(0,a)}function K(e){let t=e.FS,a=e.FS.filesystems.MEMFS,r=e.PATH,n={DIR_MODE:16895,FILE_MODE:33279,mount:function(e){if(!e.opts.fileSystemHandle)throw new Error("opts.fileSystemHandle is required");return a.mount.apply(null,arguments)},syncfs:async(e,t,a)=>{try{let r=n.getLocalSet(e),s=await n.getRemoteSet(e),i=t?s:r,o=t?r:s;await n.reconcile(e,i,o),a(null)}catch(r){a(r)}},getLocalSet:e=>{let a=Object.create(null);function n(e){return"."!==e&&".."!==e}function s(e){return t=>r.join2(e,t)}o(n,"isRealDir"),o(s,"toAbsolute");let i=t.readdir(e.mountpoint).filter(n).map(s(e.mountpoint));for(;i.length;){let e=i.pop(),r=t.stat(e);t.isDir(r.mode)&&i.push.apply(i,t.readdir(e).filter(n).map(s(e))),a[e]={timestamp:r.mtime,mode:r.mode}}return{type:"local",entries:a}},getRemoteSet:async e=>{let t=Object.create(null),a=await J(e.opts.fileSystemHandle);for(let[s,i]of a)"."!==s&&(t[r.join2(e.mountpoint,s)]={timestamp:"file"===i.kind?new Date((await i.getFile()).lastModified):new Date,mode:"file"===i.kind?n.FILE_MODE:n.DIR_MODE});return{type:"remote",entries:t,handles:a}},loadLocalEntry:e=>{let r=t.lookupPath(e).node,n=t.stat(e);if(t.isDir(n.mode))return{timestamp:n.mtime,mode:n.mode};if(t.isFile(n.mode))return r.contents=a.getFileDataAsTypedArray(r),{timestamp:n.mtime,mode:n.mode,contents:r.contents};throw new Error("node type not supported")},storeLocalEntry:(e,a)=>{if(t.isDir(a.mode))t.mkdirTree(e,a.mode);else{if(!t.isFile(a.mode))throw new Error("node type not supported");t.writeFile(e,a.contents,{canOwn:!0})}t.chmod(e,a.mode),t.utime(e,a.timestamp,a.timestamp)},removeLocalEntry:e=>{var a=t.stat(e);t.isDir(a.mode)?t.rmdir(e):t.isFile(a.mode)&&t.unlink(e)},loadRemoteEntry:async e=>{if("file"===e.kind){let t=await e.getFile();return{contents:new Uint8Array(await t.arrayBuffer()),mode:n.FILE_MODE,timestamp:new Date(t.lastModified)}}if("directory"===e.kind)return{mode:n.DIR_MODE,timestamp:new Date};throw new Error("unknown kind: "+e.kind)},storeRemoteEntry:async(e,a,n)=>{let s=e.get(r.dirname(a)),i=t.isFile(n.mode)?await s.getFileHandle(r.basename(a),{create:!0}):await s.getDirectoryHandle(r.basename(a),{create:!0});if("file"===i.kind){let e=await i.createWritable();await e.write(n.contents),await e.close()}e.set(a,i)},removeRemoteEntry:async(e,t)=>{await e.get(r.dirname(t)).removeEntry(r.basename(t)),e.delete(t)},reconcile:async(e,a,s)=>{let i=0,o=[];Object.keys(a.entries).forEach(function(e){let r=a.entries[e],n=s.entries[e];(!n||t.isFile(r.mode)&&r.timestamp.getTime()>n.timestamp.getTime())&&(o.push(e),i++)}),o.sort();let d=[];if(Object.keys(s.entries).forEach(function(e){a.entries[e]||(d.push(e),i++)}),d.sort().reverse(),!i)return;let c="remote"===a.type?a.handles:s.handles;for(let t of o){let a=r.normalize(t.replace(e.mountpoint,"/")).substring(1);if("local"===s.type){let e=c.get(a),r=await n.loadRemoteEntry(e);n.storeLocalEntry(t,r)}else{let e=n.loadLocalEntry(t);await n.storeRemoteEntry(c,a,e)}}for(let t of d)if("local"===s.type)n.removeLocalEntry(t);else{let a=r.normalize(t.replace(e.mountpoint,"/")).substring(1);await n.removeRemoteEntry(c,a)}}};e.FS.filesystems.NATIVEFS_ASYNC=n}o(H,"nodeLoadScript"),o(W,"loadLockFile"),o(B,"calculateDirname"),o(K,"initializeNativeFS");var J=o(async e=>{let t=[];async function a(e){for await(let r of e.values())t.push(r),"directory"===r.kind&&await a(r)}o(a,"collect"),await a(e);let r=new Map;r.set(".",e);for(let n of t){let t=(await e.resolve(n)).join("/");r.set(t,n)}return r},"getFsHandles");function Y(e){let t={noImageDecoding:!0,noAudioDecoding:!0,noWasmDecoding:!1,preRun:te(e),quit(e,a){throw t.exited={status:e,toThrow:a},a},print:e.stdout,printErr:e.stderr,thisProgram:e._sysExecutable,arguments:e.args,API:{config:e},locateFile:t=>e.indexURL+t,instantiateWasm:ae(e.indexURL)};return t}function G(e){return function(t){try{t.FS.mkdirTree(e)}catch(a){console.error(`Error occurred while making a home directory '${e}':`),console.error(a),console.error("Using '/' for a home directory instead"),e="/"}t.FS.chdir(e)}}function X(e){return function(t){Object.assign(t.ENV,e)}}function Q(e){return e?[async t=>{t.addRunDependency("fsInitHook");try{await e(t.FS,{sitePackages:t.API.sitePackages})}finally{t.removeRunDependency("fsInitHook")}}]:[]}function ee(e){let t=V(e);return async e=>{let a=e._py_version_major(),r=e._py_version_minor();e.FS.mkdirTree("/lib"),e.API.sitePackages=`/lib/python${a}.${r}/site-packages`,e.FS.mkdirTree(e.API.sitePackages),e.addRunDependency("install-stdlib");try{let n=await t;e.FS.writeFile(`/lib/python${a}${r}.zip`,n)}catch(n){console.error("Error occurred while installing the standard library:"),console.error(n)}finally{e.removeRunDependency("install-stdlib")}}}function te(e){let t;return t=null!=e.stdLibURL?e.stdLibURL:e.indexURL+"python_stdlib.zip",[...Q(e.fsInit),ee(t),G(e.env.HOME),X(e.env),K]}function ae(e){if(typeof WasmOffsetConverter<"u")return;let{binary:t,response:a}=j(e+"pyodide.asm.wasm");return function(e,r){return async function(){try{let n;n=a?await WebAssembly.instantiateStreaming(a,e):await WebAssembly.instantiate(await t,e);let{instance:s,module:i}=n;r(s,i)}catch(n){console.warn("wasm instantiation failed!"),console.warn(n)}}(),{}}}o(Y,"createSettings"),o(G,"createHomeDirectory"),o(X,"setEnvironment"),o(Q,"callFsInitHook"),o(ee,"installStdlib"),o(te,"getFileSystemInitializationFuncs"),o(ae,"getInstantiateWasmFunc");var re="0.27.7";async function ne(e={}){var t,a;await M();let r=e.indexURL||await B();r=E(r),r.endsWith("/")||(r+="/"),e.indexURL=r;let n={fullStdLib:!1,jsglobals:globalThis,stdin:globalThis.prompt?globalThis.prompt:void 0,lockFileURL:r+"pyodide-lock.json",args:[],env:{},packageCacheDir:r,packages:[],enableRunUntilComplete:!0,checkAPIVersion:!0,BUILD_ID:"e94377f5ce7dcf67e0417b69a0016733c2cfb6b4622ee8c490a6f17eb58e863b"},s=Object.assign(n,e);(t=s.env).HOME??(t.HOME="/home/pyodide"),(a=s.env).PYTHONINSPECT??(a.PYTHONINSPECT="1");let i,o=Y(s),d=o.API;if(d.lockFilePromise=W(s.lockFileURL),"function"!=typeof _createPyodideModule){let e=`${s.indexURL}pyodide.asm.js`;await P(e)}if(e._loadSnapshot){let t=await e._loadSnapshot;i=ArrayBuffer.isView(t)?t:new Uint8Array(t),o.noInitialRun=!0,o.INITIAL_MEMORY=i.length}let c,u=await _createPyodideModule(o);if(o.exited)throw o.exited.toThrow;if(e.pyproxyToStringRepr&&d.setPyProxyToStringMethod(!0),d.version!==re&&s.checkAPIVersion)throw new Error(`Pyodide version does not match: '${re}' <==> '${d.version}'. If you updated the Pyodide version, make sure you also updated the 'indexURL' parameter passed to loadPyodide.`);u.locateFile=e=>{throw new Error("Didn't expect to load any more file_packager files!")},i&&(c=d.restoreSnapshot(i));let l=d.finalizeBootstrap(c,e._snapshotDeserializer);return d.sys.path.insert(0,""),l.version.includes("dev")||d.setCdnUrl(`https://cdn.jsdelivr.net/pyodide/v${l.version}/full/`),d._pyodide.set_excepthook(),await d.packageIndexReady,d.initializeStreams(s.stdin,s.stdout,s.stderr),l}o(ne,"loadPyodide");const se=()=>{},ie=(e,t)=>{const a=`[${e}]`;return{debug:(...e)=>t.debug(a,...e),log:(...e)=>t.log(a,...e),warn:(...e)=>t.warn(a,...e),error:(...e)=>t.error(a,...e),trace:(...e)=>t.trace(a,...e),get:a=>ie(`${e}.${a}`,t),disabled:(e=!0)=>e?de:t}},oe={debug:(...e)=>{},log:(...e)=>{console.log(...e)},warn:(...e)=>{console.warn(...e)},error:(...e)=>{console.error(...e)},trace:(...e)=>{console.trace(...e)},get:e=>ie(e,oe),disabled:(e=!0)=>e?de:oe},de={debug:()=>se,log:()=>se,warn:()=>se,error:()=>se,trace:()=>se,get:()=>de,disabled:()=>de};const ce="undefined"!=typeof window&&window.Logger||oe;var ue,le;!function(e){e.assertEqual=e=>{},e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const a of e)t[a]=a;return t},e.getValidEnumValues=t=>{const a=e.objectKeys(t).filter(e=>"number"!=typeof t[t[e]]),r={};for(const e of a)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.push(a);return t},e.find=(e,t)=>{for(const a of e)if(t(a))return a},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(ue||(ue={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(le||(le={}));const pe=ue.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),he=e=>{switch(typeof e){case"undefined":return pe.undefined;case"string":return pe.string;case"number":return Number.isNaN(e)?pe.nan:pe.number;case"boolean":return pe.boolean;case"function":return pe.function;case"bigint":return pe.bigint;case"symbol":return pe.symbol;case"object":return Array.isArray(e)?pe.array:null===e?pe.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?pe.promise:"undefined"!=typeof Map&&e instanceof Map?pe.map:"undefined"!=typeof Set&&e instanceof Set?pe.set:"undefined"!=typeof Date&&e instanceof Date?pe.date:pe.object;default:return pe.unknown}},me=ue.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class fe extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},a={_errors:[]},r=e=>{for(const n of e.issues)if("invalid_union"===n.code)n.unionErrors.map(r);else if("invalid_return_type"===n.code)r(n.returnTypeError);else if("invalid_arguments"===n.code)r(n.argumentsError);else if(0===n.path.length)a._errors.push(t(n));else{let e=a,r=0;for(;r<n.path.length;){const a=n.path[r];r===n.path.length-1?(e[a]=e[a]||{_errors:[]},e[a]._errors.push(t(n))):e[a]=e[a]||{_errors:[]},e=e[a],r++}}};return r(this),a}static assert(e){if(!(e instanceof fe))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ue.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},a=[];for(const r of this.issues)if(r.path.length>0){const a=r.path[0];t[a]=t[a]||[],t[a].push(e(r))}else a.push(e(r));return{formErrors:a,fieldErrors:t}}get formErrors(){return this.flatten()}}fe.create=e=>new fe(e);const ye=(e,t)=>{let a;switch(e.code){case me.invalid_type:a=e.received===pe.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case me.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(e.expected,ue.jsonStringifyReplacer)}`;break;case me.unrecognized_keys:a=`Unrecognized key(s) in object: ${ue.joinValues(e.keys,", ")}`;break;case me.invalid_union:a="Invalid input";break;case me.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${ue.joinValues(e.options)}`;break;case me.invalid_enum_value:a=`Invalid enum value. Expected ${ue.joinValues(e.options)}, received '${e.received}'`;break;case me.invalid_arguments:a="Invalid function arguments";break;case me.invalid_return_type:a="Invalid function return type";break;case me.invalid_date:a="Invalid date";break;case me.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(a=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(a=`${a} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?a=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?a=`Invalid input: must end with "${e.validation.endsWith}"`:ue.assertNever(e.validation):a="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case me.too_small:a="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type||"bigint"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case me.too_big:a="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case me.custom:a="Invalid input";break;case me.invalid_intersection_types:a="Intersection results could not be merged";break;case me.not_multiple_of:a=`Number must be a multiple of ${e.multipleOf}`;break;case me.not_finite:a="Number must be finite";break;default:a=t.defaultError,ue.assertNever(e)}return{message:a}};let ge=ye;function _e(e,t){const a=ge,r=(e=>{const{data:t,path:a,errorMaps:r,issueData:n}=e,s=[...a,...n.path||[]],i={...n,path:s};if(void 0!==n.message)return{...n,path:s,message:n.message};let o="";const d=r.filter(e=>!!e).slice().reverse();for(const c of d)o=c(i,{data:t,defaultError:o}).message;return{...n,path:s,message:o}})({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,a,a===ye?void 0:ye].filter(e=>!!e)});e.common.issues.push(r)}class ve{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const a=[];for(const r of t){if("aborted"===r.status)return we;"dirty"===r.status&&e.dirty(),a.push(r.value)}return{status:e.value,value:a}}static async mergeObjectAsync(e,t){const a=[];for(const r of t){const e=await r.key,t=await r.value;a.push({key:e,value:t})}return ve.mergeObjectSync(e,a)}static mergeObjectSync(e,t){const a={};for(const r of t){const{key:t,value:n}=r;if("aborted"===t.status)return we;if("aborted"===n.status)return we;"dirty"===t.status&&e.dirty(),"dirty"===n.status&&e.dirty(),"__proto__"===t.value||void 0===n.value&&!r.alwaysSet||(a[t.value]=n.value)}return{status:e.value,value:a}}}const we=Object.freeze({status:"aborted"}),be=e=>({status:"dirty",value:e}),ke=e=>({status:"valid",value:e}),xe=e=>"aborted"===e.status,Se=e=>"dirty"===e.status,Oe=e=>"valid"===e.status,Te=e=>"undefined"!=typeof Promise&&e instanceof Promise;var Ee;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:e?.message}(Ee||(Ee={}));class Ne{constructor(e,t,a,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=a,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const je=(e,t)=>{if(Oe(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new fe(e.common.issues);return this._error=t,this._error}}};function Pe(e){if(!e)return{};const{errorMap:t,invalid_type_error:a,required_error:r,description:n}=e;if(t&&(a||r))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:n};return{errorMap:(t,n)=>{const{message:s}=e;return"invalid_enum_value"===t.code?{message:s??n.defaultError}:void 0===n.data?{message:s??r??n.defaultError}:"invalid_type"!==t.code?{message:n.defaultError}:{message:s??a??n.defaultError}},description:n}}class Ce{get description(){return this._def.description}_getType(e){return he(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:he(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ve,ctx:{common:e.parent.common,data:e.data,parsedType:he(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Te(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const a=this.safeParse(e,t);if(a.success)return a.data;throw a.error}safeParse(e,t){const a={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:he(e)},r=this._parseSync({data:e,path:a.path,parent:a});return je(a,r)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:he(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:t});return Oe(a)?{value:a.value}:{issues:t.common.issues}}catch(a){a?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>Oe(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){const a=await this.safeParseAsync(e,t);if(a.success)return a.data;throw a.error}async safeParseAsync(e,t){const a={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:he(e)},r=this._parse({data:e,path:a.path,parent:a}),n=await(Te(r)?r:Promise.resolve(r));return je(a,n)}refine(e,t){const a=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,r)=>{const n=e(t),s=()=>r.addIssue({code:me.custom,...a(t)});return"undefined"!=typeof Promise&&n instanceof Promise?n.then(e=>!!e||(s(),!1)):!!n||(s(),!1)})}refinement(e,t){return this._refinement((a,r)=>!!e(a)||(r.addIssue("function"==typeof t?t(a,r):t),!1))}_refinement(e){return new Pt({schema:this,typeName:Mt.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return Ct.create(this,this._def)}nullable(){return At.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return mt.create(this)}promise(){return jt.create(this,this._def)}or(e){return gt.create([this,e],this._def)}and(e){return vt.create(this,e,this._def)}transform(e){return new Pt({...Pe(this._def),schema:this,typeName:Mt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Zt({...Pe(this._def),innerType:this,defaultValue:t,typeName:Mt.ZodDefault})}brand(){return new $t({typeName:Mt.ZodBranded,type:this,...Pe(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new It({...Pe(this._def),innerType:this,catchValue:t,typeName:Mt.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return Ft.create(this,e)}readonly(){return Lt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Ae=/^c[^\s-]{8,}$/i,Ze=/^[0-9a-z]+$/,Ie=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Re=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,$e=/^[a-z0-9_-]{21}$/i,Fe=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Le=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Me=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let De;const ze=/^(?:(?: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])$/,qe=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,Ue=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Ve=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,He=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,We=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Be="((\\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])))",Ke=new RegExp(`^${Be}$`);function Je(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`);return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function Ye(e){return new RegExp(`^${Je(e)}$`)}function Ge(e){let t=`${Be}T${Je(e)}`;const a=[];return a.push(e.local?"Z?":"Z"),e.offset&&a.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${a.join("|")})`,new RegExp(`^${t}$`)}function Xe(e,t){return!("v4"!==t&&t||!ze.test(e))||!("v6"!==t&&t||!Ue.test(e))}function Qe(e,t){if(!Fe.test(e))return!1;try{const[a]=e.split(".");if(!a)return!1;const r=a.replace(/-/g,"+").replace(/_/g,"/").padEnd(a.length+(4-a.length%4)%4,"="),n=JSON.parse(atob(r));return"object"==typeof n&&null!==n&&((!("typ"in n)||"JWT"===n?.typ)&&(!!n.alg&&(!t||n.alg===t)))}catch{return!1}}function et(e,t){return!("v4"!==t&&t||!qe.test(e))||!("v6"!==t&&t||!Ve.test(e))}class tt extends Ce{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==pe.string){const t=this._getOrReturnCtx(e);return _e(t,{code:me.invalid_type,expected:pe.string,received:t.parsedType}),we}const t=new ve;let a;for(const r of this._def.checks)if("min"===r.kind)e.data.length<r.value&&(a=this._getOrReturnCtx(e,a),_e(a,{code:me.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if("max"===r.kind)e.data.length>r.value&&(a=this._getOrReturnCtx(e,a),_e(a,{code:me.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if("length"===r.kind){const n=e.data.length>r.value,s=e.data.length<r.value;(n||s)&&(a=this._getOrReturnCtx(e,a),n?_e(a,{code:me.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):s&&_e(a,{code:me.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if("email"===r.kind)Me.test(e.data)||(a=this._getOrReturnCtx(e,a),_e(a,{validation:"email",code:me.invalid_string,message:r.message}),t.dirty());else if("emoji"===r.kind)De||(De=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),De.test(e.data)||(a=this._getOrReturnCtx(e,a),_e(a,{validation:"emoji",code:me.invalid_string,message:r.message}),t.dirty());else if("uuid"===r.kind)Re.test(e.data)||(a=this._getOrReturnCtx(e,a),_e(a,{validation:"uuid",code:me.invalid_string,message:r.message}),t.dirty());else if("nanoid"===r.kind)$e.test(e.data)||(a=this._getOrReturnCtx(e,a),_e(a,{validation:"nanoid",code:me.invalid_string,message:r.message}),t.dirty());else if("cuid"===r.kind)Ae.test(e.data)||(a=this._getOrReturnCtx(e,a),_e(a,{validation:"cuid",code:me.invalid_string,message:r.message}),t.dirty());else if("cuid2"===r.kind)Ze.test(e.data)||(a=this._getOrReturnCtx(e,a),_e(a,{validation:"cuid2",code:me.invalid_string,message:r.message}),t.dirty());else if("ulid"===r.kind)Ie.test(e.data)||(a=this._getOrReturnCtx(e,a),_e(a,{validation:"ulid",code:me.invalid_string,message:r.message}),t.dirty());else if("url"===r.kind)try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),_e(a,{validation:"url",code:me.invalid_string,message:r.message}),t.dirty()}else if("regex"===r.kind){r.regex.lastIndex=0;r.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),_e(a,{validation:"regex",code:me.invalid_string,message:r.message}),t.dirty())}else if("trim"===r.kind)e.data=e.data.trim();else if("includes"===r.kind)e.data.includes(r.value,r.position)||(a=this._getOrReturnCtx(e,a),_e(a,{code:me.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty());else if("toLowerCase"===r.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===r.kind)e.data=e.data.toUpperCase();else if("startsWith"===r.kind)e.data.startsWith(r.value)||(a=this._getOrReturnCtx(e,a),_e(a,{code:me.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty());else if("endsWith"===r.kind)e.data.endsWith(r.value)||(a=this._getOrReturnCtx(e,a),_e(a,{code:me.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty());else if("datetime"===r.kind){Ge(r).test(e.data)||(a=this._getOrReturnCtx(e,a),_e(a,{code:me.invalid_string,validation:"datetime",message:r.message}),t.dirty())}else if("date"===r.kind){Ke.test(e.data)||(a=this._getOrReturnCtx(e,a),_e(a,{code:me.invalid_string,validation:"date",message:r.message}),t.dirty())}else if("time"===r.kind){Ye(r).test(e.data)||(a=this._getOrReturnCtx(e,a),_e(a,{code:me.invalid_string,validation:"time",message:r.message}),t.dirty())}else"duration"===r.kind?Le.test(e.data)||(a=this._getOrReturnCtx(e,a),_e(a,{validation:"duration",code:me.invalid_string,message:r.message}),t.dirty()):"ip"===r.kind?Xe(e.data,r.version)||(a=this._getOrReturnCtx(e,a),_e(a,{validation:"ip",code:me.invalid_string,message:r.message}),t.dirty()):"jwt"===r.kind?Qe(e.data,r.alg)||(a=this._getOrReturnCtx(e,a),_e(a,{validation:"jwt",code:me.invalid_string,message:r.message}),t.dirty()):"cidr"===r.kind?et(e.data,r.version)||(a=this._getOrReturnCtx(e,a),_e(a,{validation:"cidr",code:me.invalid_string,message:r.message}),t.dirty()):"base64"===r.kind?He.test(e.data)||(a=this._getOrReturnCtx(e,a),_e(a,{validation:"base64",code:me.invalid_string,message:r.message}),t.dirty()):"base64url"===r.kind?We.test(e.data)||(a=this._getOrReturnCtx(e,a),_e(a,{validation:"base64url",code:me.invalid_string,message:r.message}),t.dirty()):ue.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,a){return this.refinement(t=>e.test(t),{validation:t,code:me.invalid_string,...Ee.errToObj(a)})}_addCheck(e){return new tt({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ee.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ee.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ee.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ee.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ee.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ee.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ee.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ee.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ee.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Ee.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Ee.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ee.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Ee.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===e?.precision?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Ee.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===e?.precision?null:e?.precision,...Ee.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Ee.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Ee.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...Ee.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Ee.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Ee.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Ee.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Ee.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Ee.errToObj(t)})}nonempty(e){return this.min(1,Ee.errToObj(e))}trim(){return new tt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new tt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new tt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function at(e,t){const a=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,n=a>r?a:r;return Number.parseInt(e.toFixed(n).replace(".",""))%Number.parseInt(t.toFixed(n).replace(".",""))/10**n}tt.create=e=>new tt({checks:[],typeName:Mt.ZodString,coerce:e?.coerce??!1,...Pe(e)});class rt extends Ce{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==pe.number){const t=this._getOrReturnCtx(e);return _e(t,{code:me.invalid_type,expected:pe.number,received:t.parsedType}),we}let t;const a=new ve;for(const r of this._def.checks)if("int"===r.kind)ue.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),_e(t,{code:me.invalid_type,expected:"integer",received:"float",message:r.message}),a.dirty());else if("min"===r.kind){(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),_e(t,{code:me.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),a.dirty())}else if("max"===r.kind){(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),_e(t,{code:me.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),a.dirty())}else"multipleOf"===r.kind?0!==at(e.data,r.value)&&(t=this._getOrReturnCtx(e,t),_e(t,{code:me.not_multiple_of,multipleOf:r.value,message:r.message}),a.dirty()):"finite"===r.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),_e(t,{code:me.not_finite,message:r.message}),a.dirty()):ue.assertNever(r);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ee.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ee.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ee.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ee.toString(t))}setLimit(e,t,a,r){return new rt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:Ee.toString(r)}]})}_addCheck(e){return new rt({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ee.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ee.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ee.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ee.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ee.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ee.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Ee.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ee.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ee.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&ue.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const a of this._def.checks){if("finite"===a.kind||"int"===a.kind||"multipleOf"===a.kind)return!0;"min"===a.kind?(null===t||a.value>t)&&(t=a.value):"max"===a.kind&&(null===e||a.value<e)&&(e=a.value)}return Number.isFinite(t)&&Number.isFinite(e)}}rt.create=e=>new rt({checks:[],typeName:Mt.ZodNumber,coerce:e?.coerce||!1,...Pe(e)});class nt extends Ce{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==pe.bigint)return this._getInvalidInput(e);let t;const a=new ve;for(const r of this._def.checks)if("min"===r.kind){(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),_e(t,{code:me.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),a.dirty())}else if("max"===r.kind){(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),_e(t,{code:me.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),a.dirty())}else"multipleOf"===r.kind?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),_e(t,{code:me.not_multiple_of,multipleOf:r.value,message:r.message}),a.dirty()):ue.assertNever(r);return{status:a.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return _e(t,{code:me.invalid_type,expected:pe.bigint,received:t.parsedType}),we}gte(e,t){return this.setLimit("min",e,!0,Ee.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ee.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ee.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ee.toString(t))}setLimit(e,t,a,r){return new nt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:Ee.toString(r)}]})}_addCheck(e){return new nt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ee.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ee.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ee.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ee.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ee.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}nt.create=e=>new nt({checks:[],typeName:Mt.ZodBigInt,coerce:e?.coerce??!1,...Pe(e)});class st extends Ce{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==pe.boolean){const t=this._getOrReturnCtx(e);return _e(t,{code:me.invalid_type,expected:pe.boolean,received:t.parsedType}),we}return ke(e.data)}}st.create=e=>new st({typeName:Mt.ZodBoolean,coerce:e?.coerce||!1,...Pe(e)});class it extends Ce{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==pe.date){const t=this._getOrReturnCtx(e);return _e(t,{code:me.invalid_type,expected:pe.date,received:t.parsedType}),we}if(Number.isNaN(e.data.getTime())){return _e(this._getOrReturnCtx(e),{code:me.invalid_date}),we}const t=new ve;let a;for(const r of this._def.checks)"min"===r.kind?e.data.getTime()<r.value&&(a=this._getOrReturnCtx(e,a),_e(a,{code:me.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),t.dirty()):"max"===r.kind?e.data.getTime()>r.value&&(a=this._getOrReturnCtx(e,a),_e(a,{code:me.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),t.dirty()):ue.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new it({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Ee.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Ee.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}it.create=e=>new it({checks:[],coerce:e?.coerce||!1,typeName:Mt.ZodDate,...Pe(e)});class ot extends Ce{_parse(e){if(this._getType(e)!==pe.symbol){const t=this._getOrReturnCtx(e);return _e(t,{code:me.invalid_type,expected:pe.symbol,received:t.parsedType}),we}return ke(e.data)}}ot.create=e=>new ot({typeName:Mt.ZodSymbol,...Pe(e)});class dt extends Ce{_parse(e){if(this._getType(e)!==pe.undefined){const t=this._getOrReturnCtx(e);return _e(t,{code:me.invalid_type,expected:pe.undefined,received:t.parsedType}),we}return ke(e.data)}}dt.create=e=>new dt({typeName:Mt.ZodUndefined,...Pe(e)});class ct extends Ce{_parse(e){if(this._getType(e)!==pe.null){const t=this._getOrReturnCtx(e);return _e(t,{code:me.invalid_type,expected:pe.null,received:t.parsedType}),we}return ke(e.data)}}ct.create=e=>new ct({typeName:Mt.ZodNull,...Pe(e)});class ut extends Ce{constructor(){super(...arguments),this._any=!0}_parse(e){return ke(e.data)}}ut.create=e=>new ut({typeName:Mt.ZodAny,...Pe(e)});class lt extends Ce{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ke(e.data)}}lt.create=e=>new lt({typeName:Mt.ZodUnknown,...Pe(e)});class pt extends Ce{_parse(e){const t=this._getOrReturnCtx(e);return _e(t,{code:me.invalid_type,expected:pe.never,received:t.parsedType}),we}}pt.create=e=>new pt({typeName:Mt.ZodNever,...Pe(e)});class ht extends Ce{_parse(e){if(this._getType(e)!==pe.undefined){const t=this._getOrReturnCtx(e);return _e(t,{code:me.invalid_type,expected:pe.void,received:t.parsedType}),we}return ke(e.data)}}ht.create=e=>new ht({typeName:Mt.ZodVoid,...Pe(e)});class mt extends Ce{_parse(e){const{ctx:t,status:a}=this._processInputParams(e),r=this._def;if(t.parsedType!==pe.array)return _e(t,{code:me.invalid_type,expected:pe.array,received:t.parsedType}),we;if(null!==r.exactLength){const e=t.data.length>r.exactLength.value,n=t.data.length<r.exactLength.value;(e||n)&&(_e(t,{code:e?me.too_big:me.too_small,minimum:n?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),a.dirty())}if(null!==r.minLength&&t.data.length<r.minLength.value&&(_e(t,{code:me.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),a.dirty()),null!==r.maxLength&&t.data.length>r.maxLength.value&&(_e(t,{code:me.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),a.dirty()),t.common.async)return Promise.all([...t.data].map((e,a)=>r.type._parseAsync(new Ne(t,e,t.path,a)))).then(e=>ve.mergeArray(a,e));const n=[...t.data].map((e,a)=>r.type._parseSync(new Ne(t,e,t.path,a)));return ve.mergeArray(a,n)}get element(){return this._def.type}min(e,t){return new mt({...this._def,minLength:{value:e,message:Ee.toString(t)}})}max(e,t){return new mt({...this._def,maxLength:{value:e,message:Ee.toString(t)}})}length(e,t){return new mt({...this._def,exactLength:{value:e,message:Ee.toString(t)}})}nonempty(e){return this.min(1,e)}}function ft(e){if(e instanceof yt){const t={};for(const a in e.shape){const r=e.shape[a];t[a]=Ct.create(ft(r))}return new yt({...e._def,shape:()=>t})}return e instanceof mt?new mt({...e._def,type:ft(e.element)}):e instanceof Ct?Ct.create(ft(e.unwrap())):e instanceof At?At.create(ft(e.unwrap())):e instanceof wt?wt.create(e.items.map(e=>ft(e))):e}mt.create=(e,t)=>new mt({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Mt.ZodArray,...Pe(t)});class yt extends Ce{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=ue.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==pe.object){const t=this._getOrReturnCtx(e);return _e(t,{code:me.invalid_type,expected:pe.object,received:t.parsedType}),we}const{status:t,ctx:a}=this._processInputParams(e),{shape:r,keys:n}=this._getCached(),s=[];if(!(this._def.catchall instanceof pt&&"strip"===this._def.unknownKeys))for(const o in a.data)n.includes(o)||s.push(o);const i=[];for(const o of n){const e=r[o],t=a.data[o];i.push({key:{status:"valid",value:o},value:e._parse(new Ne(a,t,a.path,o)),alwaysSet:o in a.data})}if(this._def.catchall instanceof pt){const e=this._def.unknownKeys;if("passthrough"===e)for(const t of s)i.push({key:{status:"valid",value:t},value:{status:"valid",value:a.data[t]}});else if("strict"===e)s.length>0&&(_e(a,{code:me.unrecognized_keys,keys:s}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of s){const r=a.data[t];i.push({key:{status:"valid",value:t},value:e._parse(new Ne(a,r,a.path,t)),alwaysSet:t in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const e=[];for(const t of i){const a=await t.key,r=await t.value;e.push({key:a,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>ve.mergeObjectSync(t,e)):ve.mergeObjectSync(t,i)}get shape(){return this._def.shape()}strict(e){return Ee.errToObj,new yt({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,a)=>{const r=this._def.errorMap?.(t,a).message??a.defaultError;return"unrecognized_keys"===t.code?{message:Ee.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new yt({...this._def,unknownKeys:"strip"})}passthrough(){return new yt({...this._def,unknownKeys:"passthrough"})}extend(e){return new yt({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new yt({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Mt.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new yt({...this._def,catchall:e})}pick(e){const t={};for(const a of ue.objectKeys(e))e[a]&&this.shape[a]&&(t[a]=this.shape[a]);return new yt({...this._def,shape:()=>t})}omit(e){const t={};for(const a of ue.objectKeys(this.shape))e[a]||(t[a]=this.shape[a]);return new yt({...this._def,shape:()=>t})}deepPartial(){return ft(this)}partial(e){const t={};for(const a of ue.objectKeys(this.shape)){const r=this.shape[a];e&&!e[a]?t[a]=r:t[a]=r.optional()}return new yt({...this._def,shape:()=>t})}required(e){const t={};for(const a of ue.objectKeys(this.shape))if(e&&!e[a])t[a]=this.shape[a];else{let e=this.shape[a];for(;e instanceof Ct;)e=e._def.innerType;t[a]=e}return new yt({...this._def,shape:()=>t})}keyof(){return Tt(ue.objectKeys(this.shape))}}yt.create=(e,t)=>new yt({shape:()=>e,unknownKeys:"strip",catchall:pt.create(),typeName:Mt.ZodObject,...Pe(t)}),yt.strictCreate=(e,t)=>new yt({shape:()=>e,unknownKeys:"strict",catchall:pt.create(),typeName:Mt.ZodObject,...Pe(t)}),yt.lazycreate=(e,t)=>new yt({shape:e,unknownKeys:"strip",catchall:pt.create(),typeName:Mt.ZodObject,...Pe(t)});class gt extends Ce{_parse(e){const{ctx:t}=this._processInputParams(e),a=this._def.options;if(t.common.async)return Promise.all(a.map(async e=>{const a={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}})).then(function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;const a=e.map(e=>new fe(e.ctx.common.issues));return _e(t,{code:me.invalid_union,unionErrors:a}),we});{let e;const r=[];for(const s of a){const a={...t,common:{...t.common,issues:[]},parent:null},n=s._parseSync({data:t.data,path:t.path,parent:a});if("valid"===n.status)return n;"dirty"!==n.status||e||(e={result:n,ctx:a}),a.common.issues.length&&r.push(a.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const n=r.map(e=>new fe(e));return _e(t,{code:me.invalid_union,unionErrors:n}),we}}get options(){return this._def.options}}function _t(e,t){const a=he(e),r=he(t);if(e===t)return{valid:!0,data:e};if(a===pe.object&&r===pe.object){const a=ue.objectKeys(t),r=ue.objectKeys(e).filter(e=>-1!==a.indexOf(e)),n={...e,...t};for(const s of r){const a=_t(e[s],t[s]);if(!a.valid)return{valid:!1};n[s]=a.data}return{valid:!0,data:n}}if(a===pe.array&&r===pe.array){if(e.length!==t.length)return{valid:!1};const a=[];for(let r=0;r<e.length;r++){const n=_t(e[r],t[r]);if(!n.valid)return{valid:!1};a.push(n.data)}return{valid:!0,data:a}}return a===pe.date&&r===pe.date&&+e===+t?{valid:!0,data:e}:{valid:!1}}gt.create=(e,t)=>new gt({options:e,typeName:Mt.ZodUnion,...Pe(t)});class vt extends Ce{_parse(e){const{status:t,ctx:a}=this._processInputParams(e),r=(e,r)=>{if(xe(e)||xe(r))return we;const n=_t(e.value,r.value);return n.valid?((Se(e)||Se(r))&&t.dirty(),{status:t.value,value:n.data}):(_e(a,{code:me.invalid_intersection_types}),we)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}}vt.create=(e,t,a)=>new vt({left:e,right:t,typeName:Mt.ZodIntersection,...Pe(a)});class wt extends Ce{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==pe.array)return _e(a,{code:me.invalid_type,expected:pe.array,received:a.parsedType}),we;if(a.data.length<this._def.items.length)return _e(a,{code:me.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),we;!this._def.rest&&a.data.length>this._def.items.length&&(_e(a,{code:me.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const r=[...a.data].map((e,t)=>{const r=this._def.items[t]||this._def.rest;return r?r._parse(new Ne(a,e,a.path,t)):null}).filter(e=>!!e);return a.common.async?Promise.all(r).then(e=>ve.mergeArray(t,e)):ve.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new wt({...this._def,rest:e})}}wt.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new wt({items:e,typeName:Mt.ZodTuple,rest:null,...Pe(t)})};class bt extends Ce{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==pe.object)return _e(a,{code:me.invalid_type,expected:pe.object,received:a.parsedType}),we;const r=[],n=this._def.keyType,s=this._def.valueType;for(const i in a.data)r.push({key:n._parse(new Ne(a,i,a.path,i)),value:s._parse(new Ne(a,a.data[i],a.path,i)),alwaysSet:i in a.data});return a.common.async?ve.mergeObjectAsync(t,r):ve.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,a){return new bt(t instanceof Ce?{keyType:e,valueType:t,typeName:Mt.ZodRecord,...Pe(a)}:{keyType:tt.create(),valueType:e,typeName:Mt.ZodRecord,...Pe(t)})}}class kt extends Ce{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==pe.map)return _e(a,{code:me.invalid_type,expected:pe.map,received:a.parsedType}),we;const r=this._def.keyType,n=this._def.valueType,s=[...a.data.entries()].map(([e,t],s)=>({key:r._parse(new Ne(a,e,a.path,[s,"key"])),value:n._parse(new Ne(a,t,a.path,[s,"value"]))}));if(a.common.async){const e=new Map;return Promise.resolve().then(async()=>{for(const a of s){const r=await a.key,n=await a.value;if("aborted"===r.status||"aborted"===n.status)return we;"dirty"!==r.status&&"dirty"!==n.status||t.dirty(),e.set(r.value,n.value)}return{status:t.value,value:e}})}{const e=new Map;for(const a of s){const r=a.key,n=a.value;if("aborted"===r.status||"aborted"===n.status)return we;"dirty"!==r.status&&"dirty"!==n.status||t.dirty(),e.set(r.value,n.value)}return{status:t.value,value:e}}}}kt.create=(e,t,a)=>new kt({valueType:t,keyType:e,typeName:Mt.ZodMap,...Pe(a)});class xt extends Ce{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==pe.set)return _e(a,{code:me.invalid_type,expected:pe.set,received:a.parsedType}),we;const r=this._def;null!==r.minSize&&a.data.size<r.minSize.value&&(_e(a,{code:me.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),null!==r.maxSize&&a.data.size>r.maxSize.value&&(_e(a,{code:me.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const n=this._def.valueType;function s(e){const a=new Set;for(const r of e){if("aborted"===r.status)return we;"dirty"===r.status&&t.dirty(),a.add(r.value)}return{status:t.value,value:a}}const i=[...a.data.values()].map((e,t)=>n._parse(new Ne(a,e,a.path,t)));return a.common.async?Promise.all(i).then(e=>s(e)):s(i)}min(e,t){return new xt({...this._def,minSize:{value:e,message:Ee.toString(t)}})}max(e,t){return new xt({...this._def,maxSize:{value:e,message:Ee.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}xt.create=(e,t)=>new xt({valueType:e,minSize:null,maxSize:null,typeName:Mt.ZodSet,...Pe(t)});class St extends Ce{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}St.create=(e,t)=>new St({getter:e,typeName:Mt.ZodLazy,...Pe(t)});class Ot extends Ce{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return _e(t,{received:t.data,code:me.invalid_literal,expected:this._def.value}),we}return{status:"valid",value:e.data}}get value(){return this._def.value}}function Tt(e,t){return new Et({values:e,typeName:Mt.ZodEnum,...Pe(t)})}Ot.create=(e,t)=>new Ot({value:e,typeName:Mt.ZodLiteral,...Pe(t)});class Et extends Ce{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),a=this._def.values;return _e(t,{expected:ue.joinValues(a),received:t.parsedType,code:me.invalid_type}),we}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),a=this._def.values;return _e(t,{received:t.data,code:me.invalid_enum_value,options:a}),we}return ke(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Et.create(e,{...this._def,...t})}exclude(e,t=this._def){return Et.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}Et.create=Tt;class Nt extends Ce{_parse(e){const t=ue.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(e);if(a.parsedType!==pe.string&&a.parsedType!==pe.number){const e=ue.objectValues(t);return _e(a,{expected:ue.joinValues(e),received:a.parsedType,code:me.invalid_type}),we}if(this._cache||(this._cache=new Set(ue.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=ue.objectValues(t);return _e(a,{received:a.data,code:me.invalid_enum_value,options:e}),we}return ke(e.data)}get enum(){return this._def.values}}Nt.create=(e,t)=>new Nt({values:e,typeName:Mt.ZodNativeEnum,...Pe(t)});class jt extends Ce{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==pe.promise&&!1===t.common.async)return _e(t,{code:me.invalid_type,expected:pe.promise,received:t.parsedType}),we;const a=t.parsedType===pe.promise?t.data:Promise.resolve(t.data);return ke(a.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}jt.create=(e,t)=>new jt({type:e,typeName:Mt.ZodPromise,...Pe(t)});class Pt extends Ce{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Mt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:a}=this._processInputParams(e),r=this._def.effect||null,n={addIssue:e=>{_e(a,e),e.fatal?t.abort():t.dirty()},get path(){return a.path}};if(n.addIssue=n.addIssue.bind(n),"preprocess"===r.type){const e=r.transform(a.data,n);if(a.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return we;const r=await this._def.schema._parseAsync({data:e,path:a.path,parent:a});return"aborted"===r.status?we:"dirty"===r.status||"dirty"===t.value?be(r.value):r});{if("aborted"===t.value)return we;const r=this._def.schema._parseSync({data:e,path:a.path,parent:a});return"aborted"===r.status?we:"dirty"===r.status||"dirty"===t.value?be(r.value):r}}if("refinement"===r.type){const e=e=>{const t=r.refinement(e,n);if(a.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===a.common.async){const r=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===r.status?we:("dirty"===r.status&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(a=>"aborted"===a.status?we:("dirty"===a.status&&t.dirty(),e(a.value).then(()=>({status:t.value,value:a.value}))))}if("transform"===r.type){if(!1===a.common.async){const e=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!Oe(e))return we;const s=r.transform(e.value,n);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(e=>Oe(e)?Promise.resolve(r.transform(e.value,n)).then(e=>({status:t.value,value:e})):we)}ue.assertNever(r)}}Pt.create=(e,t,a)=>new Pt({schema:e,typeName:Mt.ZodEffects,effect:t,...Pe(a)}),Pt.createWithPreprocess=(e,t,a)=>new Pt({schema:t,effect:{type:"preprocess",transform:e},typeName:Mt.ZodEffects,...Pe(a)});class Ct extends Ce{_parse(e){return this._getType(e)===pe.undefined?ke(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ct.create=(e,t)=>new Ct({innerType:e,typeName:Mt.ZodOptional,...Pe(t)});class At extends Ce{_parse(e){return this._getType(e)===pe.null?ke(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}At.create=(e,t)=>new At({innerType:e,typeName:Mt.ZodNullable,...Pe(t)});class Zt extends Ce{_parse(e){const{ctx:t}=this._processInputParams(e);let a=t.data;return t.parsedType===pe.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Zt.create=(e,t)=>new Zt({innerType:e,typeName:Mt.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...Pe(t)});class It extends Ce{_parse(e){const{ctx:t}=this._processInputParams(e),a={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return Te(r)?r.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new fe(a.common.issues)},input:a.data})})):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new fe(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}}It.create=(e,t)=>new It({innerType:e,typeName:Mt.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...Pe(t)});class Rt extends Ce{_parse(e){if(this._getType(e)!==pe.nan){const t=this._getOrReturnCtx(e);return _e(t,{code:me.invalid_type,expected:pe.nan,received:t.parsedType}),we}return{status:"valid",value:e.data}}}Rt.create=e=>new Rt({typeName:Mt.ZodNaN,...Pe(e)});class $t extends Ce{_parse(e){const{ctx:t}=this._processInputParams(e),a=t.data;return this._def.type._parse({data:a,path:t.path,parent:t})}unwrap(){return this._def.type}}class Ft extends Ce{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return"aborted"===e.status?we:"dirty"===e.status?(t.dirty(),be(e.value)):this._def.out._parseAsync({data:e.value,path:a.path,parent:a})})()}{const e=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===e.status?we:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:a.path,parent:a})}}static create(e,t){return new Ft({in:e,out:t,typeName:Mt.ZodPipeline})}}class Lt extends Ce{_parse(e){const t=this._def.innerType._parse(e),a=e=>(Oe(e)&&(e.value=Object.freeze(e.value)),e);return Te(t)?t.then(e=>a(e)):a(t)}unwrap(){return this._def.innerType}}var Mt;Lt.create=(e,t)=>new Lt({innerType:e,typeName:Mt.ZodReadonly,...Pe(t)}),function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(Mt||(Mt={}));const Dt=tt.create,zt=rt.create,qt=st.create;pt.create;const Ut=mt.create,Vt=yt.create,Ht=gt.create;vt.create,wt.create;const Wt=bt.create,Bt=Et.create;jt.create,Ct.create,At.create;const Kt=Vt({detail:Dt()}),Jt=Vt({error:Dt()});function Yt(e){if(!e)return"Unknown error";if(e instanceof Error){const t=Kt.safeParse(e.cause);return t.success?t.data.detail:function(e){const t=function(e){try{return JSON.parse(e)}catch{return e}}(e);if(!t)return e;const a=Kt.safeParse(t);if(a.success)return a.data.detail;const r=Jt.safeParse(t);if(r.success)return r.data.error;return e}(e.message)}if("object"==typeof e){const t=Kt.safeParse(e);if(t.success)return t.data.detail;const a=Jt.safeParse(e);if(a.success)return a.data.error}try{return JSON.stringify(e)}catch{return String(e)}}function Gt(e,t){if(!e)throw new Error(t)}const Xt=["normal","compact","medium","full","columns"],Qt=["auto","native","polars","lazy-polars","pandas"],ea=Vt({completion:Vt({activate_on_typing:qt().default(!0),copilot:Ht([qt(),Bt(["github","codeium","custom"])]).default(!1).transform(e=>!0===e?"github":e),codeium_api_key:Dt().nullish()}).passthrough().default({}),save:Vt({autosave:Bt(["off","after_delay"]).default("after_delay"),autosave_delay:zt().nonnegative().transform(e=>Math.max(e,1e3)).default(1e3),format_on_save:qt().default(!1)}).passthrough().default({}),formatting:Vt({line_length:zt().nonnegative().default(79).transform(e=>Math.min(e,1e3))}).passthrough().default({}),keymap:Vt({preset:Bt(["default","vim"]).default("default"),overrides:Wt(Dt()).default({})}).passthrough().default({}),runtime:Vt({auto_instantiate:qt().default(!0),on_cell_change:Bt(["lazy","autorun"]).default("autorun"),auto_reload:Bt(["off","lazy","autorun"]).default("off"),watcher_on_save:Bt(["lazy","autorun"]).default("lazy"),default_sql_output:Bt(Qt).default("auto")}).passthrough().default({}),display:Vt({theme:Bt(["light","dark","system"]).default("light"),code_editor_font_size:zt().nonnegative().default(14),cell_output:Bt(["above","below"]).default("above"),dataframes:Bt(["rich","plain"]).default("rich"),default_table_page_size:zt().default(10),default_table_max_columns:zt().default(50),default_width:Bt(Xt).default("medium").transform(e=>"normal"===e?"compact":e),reference_highlighting:qt().default(!1)}).passthrough().default({}),package_management:Vt({manager:Bt(["pip","uv","rye","poetry","pixi"]).default("pip")}).passthrough().default({manager:"pip"}),ai:Vt({rules:Dt().default(""),mode:Bt(["manual","ask"]).default("manual"),open_ai:Vt({api_key:Dt().optional(),base_url:Dt().optional(),model:Dt().optional()}).optional(),anthropic:Vt({api_key:Dt().optional()}).optional(),google:Vt({api_key:Dt().optional()}).optional(),bedrock:Vt({region_name:Dt().optional(),profile_name:Dt().optional(),aws_access_key_id:Dt().optional(),aws_secret_access_key:Dt().optional()}).optional()}).passthrough().default({}),experimental:Vt({markdown:qt().optional(),rtc:qt().optional()}).passthrough().default({}),server:Vt({}).passthrough().default({}),sharing:Vt({html:qt().optional(),wasm:qt().optional()}).passthrough().optional()}).passthrough().default({completion:{},save:{},formatting:{},keymap:{},runtime:{},display:{},experimental:{},server:{},ai:{rules:"",mode:"manual",open_ai:{}}}),ta=Dt(),aa=Bt(Qt).default("auto");Vt({width:Bt(Xt).default("medium").transform(e=>"normal"===e?"compact":e),app_title:ta.nullish(),css_file:Dt().nullish(),html_head_file:Dt().nullish(),auto_download:Ut(Bt(["html","markdown","ipynb"])).default([]),sql_output:aa}).default({width:"medium",auto_download:[]});const ra=e=>(new TextDecoder).decode(e);function na(e){return e.FS}const sa="notebook.py",ia="/marimo",oa=sa,da=e=>{const t=na(e);try{t.mkdirTree(ia)}catch{}t.chdir(ia)},ca=e=>{na(e).mount(e.FS.filesystems.IDBFS,{root:"."},ia)},ua=async e=>{await pa(e,!0)},la=e=>{const{pyodide:t,filename:a,code:r}=e,n=na(t);if(a&&a!==sa){const e=(e=>{try{return ra(n.readFile(e))}catch{return null}})(a);if(e)return{code:e,filename:a}}return n.writeFile(sa,r),{code:r,filename:sa}};function pa(e,t){return new Promise((a,r)=>{na(e).syncfs(t,e=>{e instanceof Error?r(e):a()})})}const ha=new class{spans=[];startSpan(e,t={}){const a={name:e,startTime:Date.now(),attributes:t,end:(e="ok")=>this.endSpan(a,e)};return this.spans.push(a),a}endSpan(e,t="ok"){e.endTime=Date.now(),e.status=t}getSpans(){return this.spans}wrap(e,t,a={}){const r=this.startSpan(t||e.name,a);try{const t=e();return this.endSpan(r),t}catch(n){throw this.endSpan(r,"error"),n}}wrapAsync(e,t,a={}){return async(...r)=>{const n=this.startSpan(t||e.name,a);try{const t=await e(...r);return this.endSpan(n),t}catch(s){throw this.endSpan(n,"error"),s}}}logSpans(){}};globalThis.t=ha;class ma{pyodide=null;get requirePyodide(){return Gt(this.pyodide,"Pyodide not loaded"),this.pyodide}async bootstrap(e){return await this.loadPyodideAndPackages(e)}async loadPyodideAndPackages(e){if(!ne)throw new Error("loadPyodide is not defined");const t=ha.startSpan("loadPyodide");try{const a=await ne({packages:["micropip","marimo-base","Markdown","pymdown-extensions","narwhals","packaging"],_makeSnapshot:false,lockFileURL:`https://wasm.marimo.app/pyodide-lock.json?v=${e.version}&pyodide=${e.pyodideVersion}`,indexURL:`https://cdn.jsdelivr.net/pyodide/${e.pyodideVersion}/full/`});return this.pyodide=a,t.end("ok"),a}catch(a){throw ce.error("Failed to load Pyodide",a),a}}async mountFilesystem(e){const t=ha.startSpan("mountFilesystem");return da(this.requirePyodide),ca(this.requirePyodide),await ua(this.requirePyodide),t.end("ok"),la({pyodide:this.requirePyodide,code:e.code,filename:e.filename})}async startSession(e){const{code:t,filename:a,onMessage:r,queryParameters:n,userConfig:s}=e;self.messenger={callback:r},self.query_params=n,self.user_config=s;const i=ha.startSpan("startSession.runPython"),o=a||oa,[d,c,u]=this.requirePyodide.runPython(`\n print("[py] Starting marimo...")\n import asyncio\n import js\n from marimo._pyodide.bootstrap import create_session, instantiate\n\n assert js.messenger, "messenger is not defined"\n assert js.query_params, "query_params is not defined"\n\n session, bridge = create_session(\n filename="${o}",\n query_params=js.query_params.to_py(),\n message_callback=js.messenger.callback,\n user_config=js.user_config.to_py(),\n )\n\n def init(auto_instantiate=True):\n instantiate(session, auto_instantiate)\n asyncio.create_task(session.start())\n\n # Find the packages to install\n with open("${o}", "r") as f:\n packages = session.find_packages(f.read())\n\n bridge, init, packages`);i.end();const l=new Set(u.toJs());return this.loadNotebookDeps(t,l).then(()=>c(s.runtime.auto_instantiate)),d}async loadNotebookDeps(e,t){const a=this.requirePyodide;e.includes("mo.sql")&&(e=`import sqlglot\n${e=`import duckdb\n${e=`import pandas\n${e}`}`}`).includes("polars")&&(e=`import pyarrow\n${e}`),e=`import pyodide_http\n${e=`import jedi\n${e=`import pygments\n${e=`import docutils\n${e}`}`}`}`;const r=[...t];let n=ha.startSpan("pyodide.loadPackage");await a.loadPackagesFromImports(e,{errorCallback:ce.error,messageCallback:ce.log}),n.end(),n=ha.startSpan("micropip.install");const s=r.filter(e=>!a.loadedPackages[e]);s.length>0&&await a.runPythonAsync(`\n import micropip\n import sys\n # Filter out builtins\n missing = [p for p in ${JSON.stringify(s)} if p not in sys.modules]\n if len(missing) > 0:\n print("Loading from micropip:", missing)\n await micropip.install(missing)\n `).catch(e=>{ce.error("Failed to load packages from micropip",e)}),n.end()}}class fa extends ma{async bootstrap(e){return await super.bootstrap(e)}async mountFilesystem(e){const{code:t,filename:a}=e;try{return da(this.requirePyodide),la({pyodide:this.requirePyodide,code:t,filename:a})}catch(r){ce.error(r)}return{code:t,filename:a}}async startSession(e){return super.startSession({queryParameters:{},code:e.code,filename:e.filename,onMessage:e.onMessage,userConfig:ea.parse({})})}}const ya=async function(){const e=self.name,t=function(e){return e.includes("dev"),`v${re}`}(e);try{self.controller=new fa,self.pyodide=await self.controller.bootstrap({version:e,pyodideVersion:t})}catch(a){ce.error("Error bootstrapping",a),wa.send.initializedError({error:Yt(a)})}}(),ga=new class{constructor(e){this.onMessage=e,this.buffer=[]}buffer;started=!1;push=e=>{this.started?this.onMessage(e):this.buffer.push(e)};start=()=>{this.started=!0,this.buffer.forEach(e=>this.onMessage(e)),this.buffer=[]}}(e=>{wa.send.kernelMessage({message:e})}),_a=new class{promise;resolve;reject;status="pending";constructor(){this.promise=new Promise((e,t)=>{this.reject=e=>{this.status="rejected",t(e)},this.resolve=t=>{this.status="resolved",e(t)}})}},va={startSession:async e=>{await ya;try{Gt(self.controller,"Controller not loaded");const t=await self.controller.mountFilesystem({code:e.code,filename:`app-${e.appId}.py`}),a=await self.controller.startSession({...t,onMessage:ga.push});_a.resolve(a),wa.send.initialized({})}catch(t){wa.send.initializedError({error:Yt(t)})}},loadPackages:async e=>{await ya,e.includes("mo.sql")&&(e=`import sqlglot\n${e=`import duckdb\n${e=`import pandas\n${e}`}`}`).includes("polars")&&(e=`import pyarrow\n${e}`),await self.pyodide.loadPackagesFromImports(e,{messageCallback:ce.log,errorCallback:ce.error})},bridge:async e=>{await ya;const{functionName:t,payload:a}=e,r=await _a.promise,n=null==a?null:"string"==typeof a?a:JSON.stringify(a),s=null==n?await r[t]():await r[t](n);return"string"==typeof s?JSON.parse(s):s}},wa=function(e){return a(e)}({transport:(ba={transportId:"marimo-transport"},n(self,ba)),requestHandler:va});var ba;wa.send("ready",{}),wa.addMessageListener("consumerReady",async()=>{await ya,ga.start()});
|
@@ -0,0 +1 @@
|
|
1
|
+
const e=1e3;function t(e,t){const n=e.map(e=>`"${e}"`).join(", ");return new Error(`This RPC instance cannot ${t} because the transport did not provide one or more of these methods: ${n}`)}function n(n={}){let r={};function s(e){r=e}let a,i={};function o(e){i.unregisterHandler&&i.unregisterHandler(),i=e,i.registerHandler?.(k)}function d(e){a="function"!=typeof e?(t,n)=>{const r=e[t];if(r)return r(n);const s=e._;if(!s)throw new Error(`The requested method has no handler: ${t}`);return s(t,n)}:e}const{maxRequestTime:c=e}=n;n.transport&&o(n.transport),n.requestHandler&&d(n.requestHandler),n._debugHooks&&s(n._debugHooks);let u=0;const l=new Map,p=new Map;function h(e,...n){const s=n[0];return new Promise((n,a)=>{if(!i.send)throw t(["send"],"make requests");const o=u<=1e10?++u:u=0,d={type:"request",id:o,method:e,params:s};l.set(o,{resolve:n,reject:a}),c!==1/0&&p.set(o,setTimeout(()=>{p.delete(o),a(new Error("RPC request timed out."))},c)),r.onSend?.(d),i.send(d)})}const m=new Proxy(h,{get:(e,t,n)=>t in e?Reflect.get(e,t,n):e=>h(t,e)}),f=m;function y(e,...n){const s=n[0];if(!i.send)throw t(["send"],"send messages");const a={type:"message",id:e,payload:s};r.onSend?.(a),i.send(a)}const g=new Proxy(y,{get:(e,t,n)=>t in e?Reflect.get(e,t,n):e=>y(t,e)}),_=g,v=new Map,w=new Set;async function k(e){if(r.onReceive?.(e),!("type"in e))throw new Error("Message does not contain a type.");if("request"===e.type){if(!i.send||!a)throw t(["send","requestHandler"],"handle requests");const{id:s,method:o,params:d}=e;let c;try{c={type:"response",id:s,success:!0,payload:await a(o,d)}}catch(n){if(!(n instanceof Error))throw n;c={type:"response",id:s,success:!1,error:n.message}}return r.onSend?.(c),void i.send(c)}if("response"===e.type){const t=p.get(e.id);null!=t&&clearTimeout(t);const{resolve:n,reject:r}=l.get(e.id)??{};return void(e.success?n?.(e.payload):r?.(new Error(e.error)))}if("message"===e.type){for(const n of w)n(e.id,e.payload);const t=v.get(e.id);if(!t)return;for(const n of t)n(e.payload);return}throw new Error(`Unexpected RPC message type: ${e.type}`)}return{setTransport:o,setRequestHandler:d,request:m,requestProxy:f,send:g,sendProxy:_,addMessageListener:function(e,n){if(!i.registerHandler)throw t(["registerHandler"],"register message listeners");"*"!==e?(v.has(e)||v.set(e,new Set),v.get(e)?.add(n)):w.add(n)},removeMessageListener:function(e,t){"*"!==e?(v.get(e)?.delete(t),0===v.get(e)?.size&&v.delete(e)):w.delete(t)},proxy:{send:_,request:f},_setDebugHooks:s}}const r="[transport-id]";function s(e,t={}){const{transportId:n,filter:s,remotePort:a}=t,i=e,o=a??e;let d;return{send(e){o.postMessage(function(e,t){const{transportId:n}=t;return null!=n?{[r]:n,data:e}:e}(e,{transportId:n}))},registerHandler(e){d=t=>{const a=t.data,[i,o]=function(e,t){const{transportId:n,filter:s}=t,a=s?.();if(null!=n&&null!=a)throw new Error("Cannot use both `transportId` and `filter` at the same time");let i=e;if(n){if(e[r]!==n)return[!0];i=e.data}return!1===a?[!0]:[!1,i]}(a,{transportId:n,filter:()=>s?.(t)});i||e(o)},i.addEventListener("message",d)},unregisterHandler(){d&&i.removeEventListener("message",d)}}}const a=()=>{},i=(e,t)=>{const n=`[${e}]`;return{debug:(...e)=>t.debug(n,...e),log:(...e)=>t.log(n,...e),warn:(...e)=>t.warn(n,...e),error:(...e)=>t.error(n,...e),trace:(...e)=>t.trace(n,...e),get:n=>i(`${e}.${n}`,t),disabled:(e=!0)=>e?d:t}},o={debug:(...e)=>{},log:(...e)=>{console.log(...e)},warn:(...e)=>{console.warn(...e)},error:(...e)=>{console.error(...e)},trace:(...e)=>{console.trace(...e)},get:e=>i(e,o),disabled:(e=!0)=>e?d:o},d={debug:()=>a,log:()=>a,warn:()=>a,error:()=>a,trace:()=>a,get:()=>d,disabled:()=>d};const c="undefined"!=typeof window&&window.Logger||o,u=e=>(new TextDecoder).decode(e);var l,p;!function(e){e.assertEqual=e=>{},e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},e.getValidEnumValues=t=>{const n=e.objectKeys(t).filter(e=>"number"!=typeof t[t[e]]),r={};for(const e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(const n of e)if(t(n))return n},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(l||(l={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(p||(p={}));const h=l.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),m=e=>{switch(typeof e){case"undefined":return h.undefined;case"string":return h.string;case"number":return Number.isNaN(e)?h.nan:h.number;case"boolean":return h.boolean;case"function":return h.function;case"bigint":return h.bigint;case"symbol":return h.symbol;case"object":return Array.isArray(e)?h.array:null===e?h.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?h.promise:"undefined"!=typeof Map&&e instanceof Map?h.map:"undefined"!=typeof Set&&e instanceof Set?h.set:"undefined"!=typeof Date&&e instanceof Date?h.date:h.object;default:return h.unknown}},f=l.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class y extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(const s of e.issues)if("invalid_union"===s.code)s.unionErrors.map(r);else if("invalid_return_type"===s.code)r(s.returnTypeError);else if("invalid_arguments"===s.code)r(s.argumentsError);else if(0===s.path.length)n._errors.push(t(s));else{let e=n,r=0;for(;r<s.path.length;){const n=s.path[r];r===s.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(s))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(e){if(!(e instanceof y))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,l.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},n=[];for(const r of this.issues)if(r.path.length>0){const n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}y.create=e=>new y(e);const g=(e,t)=>{let n;switch(e.code){case f.invalid_type:n=e.received===h.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case f.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,l.jsonStringifyReplacer)}`;break;case f.unrecognized_keys:n=`Unrecognized key(s) in object: ${l.joinValues(e.keys,", ")}`;break;case f.invalid_union:n="Invalid input";break;case f.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${l.joinValues(e.options)}`;break;case f.invalid_enum_value:n=`Invalid enum value. Expected ${l.joinValues(e.options)}, received '${e.received}'`;break;case f.invalid_arguments:n="Invalid function arguments";break;case f.invalid_return_type:n="Invalid function return type";break;case f.invalid_date:n="Invalid date";break;case f.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:l.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case f.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type||"bigint"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case f.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case f.custom:n="Invalid input";break;case f.invalid_intersection_types:n="Intersection results could not be merged";break;case f.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case f.not_finite:n="Number must be finite";break;default:n=t.defaultError,l.assertNever(e)}return{message:n}};let _=g;function v(e,t){const n=_,r=(e=>{const{data:t,path:n,errorMaps:r,issueData:s}=e,a=[...n,...s.path||[]],i={...s,path:a};if(void 0!==s.message)return{...s,path:a,message:s.message};let o="";const d=r.filter(e=>!!e).slice().reverse();for(const c of d)o=c(i,{data:t,defaultError:o}).message;return{...s,path:a,message:o}})({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===g?void 0:g].filter(e=>!!e)});e.common.issues.push(r)}class w{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const r of t){if("aborted"===r.status)return k;"dirty"===r.status&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const r of t){const e=await r.key,t=await r.value;n.push({key:e,value:t})}return w.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const r of t){const{key:t,value:s}=r;if("aborted"===t.status)return k;if("aborted"===s.status)return k;"dirty"===t.status&&e.dirty(),"dirty"===s.status&&e.dirty(),"__proto__"===t.value||void 0===s.value&&!r.alwaysSet||(n[t.value]=s.value)}return{status:e.value,value:n}}}const k=Object.freeze({status:"aborted"}),b=e=>({status:"dirty",value:e}),x=e=>({status:"valid",value:e}),S=e=>"aborted"===e.status,O=e=>"dirty"===e.status,T=e=>"valid"===e.status,E=e=>"undefined"!=typeof Promise&&e instanceof Promise;var N;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:e?.message}(N||(N={}));class P{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const j=(e,t)=>{if(T(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new y(e.common.issues);return this._error=t,this._error}}};function A(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:s}=e;if(t&&(n||r))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:s};return{errorMap:(t,s)=>{const{message:a}=e;return"invalid_enum_value"===t.code?{message:a??s.defaultError}:void 0===s.data?{message:a??r??s.defaultError}:"invalid_type"!==t.code?{message:s.defaultError}:{message:a??n??s.defaultError}},description:s}}class C{get description(){return this._def.description}_getType(e){return m(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:m(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new w,ctx:{common:e.parent.common,data:e.data,parsedType:m(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(E(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){const n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:m(e)},r=this._parseSync({data:e,path:n.path,parent:n});return j(n,r)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:m(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:t});return T(n)?{value:n.value}:{issues:t.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>T(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:m(e)},r=this._parse({data:e,path:n.path,parent:n}),s=await(E(r)?r:Promise.resolve(r));return j(n,s)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,r)=>{const s=e(t),a=()=>r.addIssue({code:f.custom,...n(t)});return"undefined"!=typeof Promise&&s instanceof Promise?s.then(e=>!!e||(a(),!1)):!!s||(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>!!e(n)||(r.addIssue("function"==typeof t?t(n,r):t),!1))}_refinement(e){return new je({schema:this,typeName:Me.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return Ae.create(this,this._def)}nullable(){return Ce.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return fe.create(this)}promise(){return Pe.create(this,this._def)}or(e){return _e.create([this,e],this._def)}and(e){return we.create(this,e,this._def)}transform(e){return new je({...A(this._def),schema:this,typeName:Me.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Ze({...A(this._def),innerType:this,defaultValue:t,typeName:Me.ZodDefault})}brand(){return new $e({typeName:Me.ZodBranded,type:this,...A(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Fe({...A(this._def),innerType:this,catchValue:t,typeName:Me.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return Re.create(this,e)}readonly(){return Le.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Z=/^c[^\s-]{8,}$/i,F=/^[0-9a-z]+$/,I=/^[0-9A-HJKMNP-TV-Z]{26}$/i,$=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,R=/^[a-z0-9_-]{21}$/i,L=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,M=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,D=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let z;const q=/^(?:(?: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])$/,U=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,V=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,H=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,B=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,W=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,K="((\\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])))",J=new RegExp(`^${K}$`);function Y(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`);return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function G(e){return new RegExp(`^${Y(e)}$`)}function X(e){let t=`${K}T${Y(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function Q(e,t){return!("v4"!==t&&t||!q.test(e))||!("v6"!==t&&t||!V.test(e))}function ee(e,t){if(!L.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return"object"==typeof s&&null!==s&&((!("typ"in s)||"JWT"===s?.typ)&&(!!s.alg&&(!t||s.alg===t)))}catch{return!1}}function te(e,t){return!("v4"!==t&&t||!U.test(e))||!("v6"!==t&&t||!H.test(e))}class ne extends C{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==h.string){const t=this._getOrReturnCtx(e);return v(t,{code:f.invalid_type,expected:h.string,received:t.parsedType}),k}const t=new w;let n;for(const r of this._def.checks)if("min"===r.kind)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),v(n,{code:f.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if("max"===r.kind)e.data.length>r.value&&(n=this._getOrReturnCtx(e,n),v(n,{code:f.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if("length"===r.kind){const s=e.data.length>r.value,a=e.data.length<r.value;(s||a)&&(n=this._getOrReturnCtx(e,n),s?v(n,{code:f.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):a&&v(n,{code:f.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if("email"===r.kind)D.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"email",code:f.invalid_string,message:r.message}),t.dirty());else if("emoji"===r.kind)z||(z=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),z.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"emoji",code:f.invalid_string,message:r.message}),t.dirty());else if("uuid"===r.kind)$.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"uuid",code:f.invalid_string,message:r.message}),t.dirty());else if("nanoid"===r.kind)R.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"nanoid",code:f.invalid_string,message:r.message}),t.dirty());else if("cuid"===r.kind)Z.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"cuid",code:f.invalid_string,message:r.message}),t.dirty());else if("cuid2"===r.kind)F.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"cuid2",code:f.invalid_string,message:r.message}),t.dirty());else if("ulid"===r.kind)I.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"ulid",code:f.invalid_string,message:r.message}),t.dirty());else if("url"===r.kind)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),v(n,{validation:"url",code:f.invalid_string,message:r.message}),t.dirty()}else if("regex"===r.kind){r.regex.lastIndex=0;r.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"regex",code:f.invalid_string,message:r.message}),t.dirty())}else if("trim"===r.kind)e.data=e.data.trim();else if("includes"===r.kind)e.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(e,n),v(n,{code:f.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty());else if("toLowerCase"===r.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===r.kind)e.data=e.data.toUpperCase();else if("startsWith"===r.kind)e.data.startsWith(r.value)||(n=this._getOrReturnCtx(e,n),v(n,{code:f.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty());else if("endsWith"===r.kind)e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),v(n,{code:f.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty());else if("datetime"===r.kind){X(r).test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{code:f.invalid_string,validation:"datetime",message:r.message}),t.dirty())}else if("date"===r.kind){J.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{code:f.invalid_string,validation:"date",message:r.message}),t.dirty())}else if("time"===r.kind){G(r).test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{code:f.invalid_string,validation:"time",message:r.message}),t.dirty())}else"duration"===r.kind?M.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"duration",code:f.invalid_string,message:r.message}),t.dirty()):"ip"===r.kind?Q(e.data,r.version)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"ip",code:f.invalid_string,message:r.message}),t.dirty()):"jwt"===r.kind?ee(e.data,r.alg)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"jwt",code:f.invalid_string,message:r.message}),t.dirty()):"cidr"===r.kind?te(e.data,r.version)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"cidr",code:f.invalid_string,message:r.message}),t.dirty()):"base64"===r.kind?B.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"base64",code:f.invalid_string,message:r.message}),t.dirty()):"base64url"===r.kind?W.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"base64url",code:f.invalid_string,message:r.message}),t.dirty()):l.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:f.invalid_string,...N.errToObj(n)})}_addCheck(e){return new ne({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...N.errToObj(e)})}url(e){return this._addCheck({kind:"url",...N.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...N.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...N.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...N.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...N.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...N.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...N.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...N.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...N.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...N.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...N.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...N.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===e?.precision?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...N.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===e?.precision?null:e?.precision,...N.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...N.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...N.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...N.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...N.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...N.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...N.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...N.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...N.errToObj(t)})}nonempty(e){return this.min(1,N.errToObj(e))}trim(){return new ne({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ne({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ne({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function re(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,s=n>r?n:r;return Number.parseInt(e.toFixed(s).replace(".",""))%Number.parseInt(t.toFixed(s).replace(".",""))/10**s}ne.create=e=>new ne({checks:[],typeName:Me.ZodString,coerce:e?.coerce??!1,...A(e)});class se extends C{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==h.number){const t=this._getOrReturnCtx(e);return v(t,{code:f.invalid_type,expected:h.number,received:t.parsedType}),k}let t;const n=new w;for(const r of this._def.checks)if("int"===r.kind)l.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),v(t,{code:f.invalid_type,expected:"integer",received:"float",message:r.message}),n.dirty());else if("min"===r.kind){(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),v(t,{code:f.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty())}else if("max"===r.kind){(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),v(t,{code:f.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty())}else"multipleOf"===r.kind?0!==re(e.data,r.value)&&(t=this._getOrReturnCtx(e,t),v(t,{code:f.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):"finite"===r.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),v(t,{code:f.not_finite,message:r.message}),n.dirty()):l.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,N.toString(t))}gt(e,t){return this.setLimit("min",e,!1,N.toString(t))}lte(e,t){return this.setLimit("max",e,!0,N.toString(t))}lt(e,t){return this.setLimit("max",e,!1,N.toString(t))}setLimit(e,t,n,r){return new se({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:N.toString(r)}]})}_addCheck(e){return new se({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:N.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:N.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:N.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:N.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:N.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:N.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:N.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:N.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:N.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&l.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}se.create=e=>new se({checks:[],typeName:Me.ZodNumber,coerce:e?.coerce||!1,...A(e)});class ae extends C{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==h.bigint)return this._getInvalidInput(e);let t;const n=new w;for(const r of this._def.checks)if("min"===r.kind){(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),v(t,{code:f.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty())}else if("max"===r.kind){(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),v(t,{code:f.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty())}else"multipleOf"===r.kind?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),v(t,{code:f.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):l.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return v(t,{code:f.invalid_type,expected:h.bigint,received:t.parsedType}),k}gte(e,t){return this.setLimit("min",e,!0,N.toString(t))}gt(e,t){return this.setLimit("min",e,!1,N.toString(t))}lte(e,t){return this.setLimit("max",e,!0,N.toString(t))}lt(e,t){return this.setLimit("max",e,!1,N.toString(t))}setLimit(e,t,n,r){return new ae({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:N.toString(r)}]})}_addCheck(e){return new ae({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:N.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:N.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:N.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:N.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:N.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}ae.create=e=>new ae({checks:[],typeName:Me.ZodBigInt,coerce:e?.coerce??!1,...A(e)});class ie extends C{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==h.boolean){const t=this._getOrReturnCtx(e);return v(t,{code:f.invalid_type,expected:h.boolean,received:t.parsedType}),k}return x(e.data)}}ie.create=e=>new ie({typeName:Me.ZodBoolean,coerce:e?.coerce||!1,...A(e)});class oe extends C{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==h.date){const t=this._getOrReturnCtx(e);return v(t,{code:f.invalid_type,expected:h.date,received:t.parsedType}),k}if(Number.isNaN(e.data.getTime())){return v(this._getOrReturnCtx(e),{code:f.invalid_date}),k}const t=new w;let n;for(const r of this._def.checks)"min"===r.kind?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),v(n,{code:f.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),t.dirty()):"max"===r.kind?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),v(n,{code:f.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),t.dirty()):l.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new oe({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:N.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:N.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}oe.create=e=>new oe({checks:[],coerce:e?.coerce||!1,typeName:Me.ZodDate,...A(e)});class de extends C{_parse(e){if(this._getType(e)!==h.symbol){const t=this._getOrReturnCtx(e);return v(t,{code:f.invalid_type,expected:h.symbol,received:t.parsedType}),k}return x(e.data)}}de.create=e=>new de({typeName:Me.ZodSymbol,...A(e)});class ce extends C{_parse(e){if(this._getType(e)!==h.undefined){const t=this._getOrReturnCtx(e);return v(t,{code:f.invalid_type,expected:h.undefined,received:t.parsedType}),k}return x(e.data)}}ce.create=e=>new ce({typeName:Me.ZodUndefined,...A(e)});class ue extends C{_parse(e){if(this._getType(e)!==h.null){const t=this._getOrReturnCtx(e);return v(t,{code:f.invalid_type,expected:h.null,received:t.parsedType}),k}return x(e.data)}}ue.create=e=>new ue({typeName:Me.ZodNull,...A(e)});class le extends C{constructor(){super(...arguments),this._any=!0}_parse(e){return x(e.data)}}le.create=e=>new le({typeName:Me.ZodAny,...A(e)});class pe extends C{constructor(){super(...arguments),this._unknown=!0}_parse(e){return x(e.data)}}pe.create=e=>new pe({typeName:Me.ZodUnknown,...A(e)});class he extends C{_parse(e){const t=this._getOrReturnCtx(e);return v(t,{code:f.invalid_type,expected:h.never,received:t.parsedType}),k}}he.create=e=>new he({typeName:Me.ZodNever,...A(e)});class me extends C{_parse(e){if(this._getType(e)!==h.undefined){const t=this._getOrReturnCtx(e);return v(t,{code:f.invalid_type,expected:h.void,received:t.parsedType}),k}return x(e.data)}}me.create=e=>new me({typeName:Me.ZodVoid,...A(e)});class fe extends C{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==h.array)return v(t,{code:f.invalid_type,expected:h.array,received:t.parsedType}),k;if(null!==r.exactLength){const e=t.data.length>r.exactLength.value,s=t.data.length<r.exactLength.value;(e||s)&&(v(t,{code:e?f.too_big:f.too_small,minimum:s?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(null!==r.minLength&&t.data.length<r.minLength.value&&(v(t,{code:f.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),null!==r.maxLength&&t.data.length>r.maxLength.value&&(v(t,{code:f.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new P(t,e,t.path,n)))).then(e=>w.mergeArray(n,e));const s=[...t.data].map((e,n)=>r.type._parseSync(new P(t,e,t.path,n)));return w.mergeArray(n,s)}get element(){return this._def.type}min(e,t){return new fe({...this._def,minLength:{value:e,message:N.toString(t)}})}max(e,t){return new fe({...this._def,maxLength:{value:e,message:N.toString(t)}})}length(e,t){return new fe({...this._def,exactLength:{value:e,message:N.toString(t)}})}nonempty(e){return this.min(1,e)}}function ye(e){if(e instanceof ge){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Ae.create(ye(r))}return new ge({...e._def,shape:()=>t})}return e instanceof fe?new fe({...e._def,type:ye(e.element)}):e instanceof Ae?Ae.create(ye(e.unwrap())):e instanceof Ce?Ce.create(ye(e.unwrap())):e instanceof ke?ke.create(e.items.map(e=>ye(e))):e}fe.create=(e,t)=>new fe({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Me.ZodArray,...A(t)});class ge extends C{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=l.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==h.object){const t=this._getOrReturnCtx(e);return v(t,{code:f.invalid_type,expected:h.object,received:t.parsedType}),k}const{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof he&&"strip"===this._def.unknownKeys))for(const o in n.data)s.includes(o)||a.push(o);const i=[];for(const o of s){const e=r[o],t=n.data[o];i.push({key:{status:"valid",value:o},value:e._parse(new P(n,t,n.path,o)),alwaysSet:o in n.data})}if(this._def.catchall instanceof he){const e=this._def.unknownKeys;if("passthrough"===e)for(const t of a)i.push({key:{status:"valid",value:t},value:{status:"valid",value:n.data[t]}});else if("strict"===e)a.length>0&&(v(n,{code:f.unrecognized_keys,keys:a}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of a){const r=n.data[t];i.push({key:{status:"valid",value:t},value:e._parse(new P(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const e=[];for(const t of i){const n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>w.mergeObjectSync(t,e)):w.mergeObjectSync(t,i)}get shape(){return this._def.shape()}strict(e){return N.errToObj,new ge({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{const r=this._def.errorMap?.(t,n).message??n.defaultError;return"unrecognized_keys"===t.code?{message:N.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new ge({...this._def,unknownKeys:"strip"})}passthrough(){return new ge({...this._def,unknownKeys:"passthrough"})}extend(e){return new ge({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ge({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Me.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ge({...this._def,catchall:e})}pick(e){const t={};for(const n of l.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new ge({...this._def,shape:()=>t})}omit(e){const t={};for(const n of l.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new ge({...this._def,shape:()=>t})}deepPartial(){return ye(this)}partial(e){const t={};for(const n of l.objectKeys(this.shape)){const r=this.shape[n];e&&!e[n]?t[n]=r:t[n]=r.optional()}return new ge({...this._def,shape:()=>t})}required(e){const t={};for(const n of l.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof Ae;)e=e._def.innerType;t[n]=e}return new ge({...this._def,shape:()=>t})}keyof(){return Te(l.objectKeys(this.shape))}}ge.create=(e,t)=>new ge({shape:()=>e,unknownKeys:"strip",catchall:he.create(),typeName:Me.ZodObject,...A(t)}),ge.strictCreate=(e,t)=>new ge({shape:()=>e,unknownKeys:"strict",catchall:he.create(),typeName:Me.ZodObject,...A(t)}),ge.lazycreate=(e,t)=>new ge({shape:e,unknownKeys:"strip",catchall:he.create(),typeName:Me.ZodObject,...A(t)});class _e extends C{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map(async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;const n=e.map(e=>new y(e.ctx.common.issues));return v(t,{code:f.invalid_union,unionErrors:n}),k});{let e;const r=[];for(const a of n){const n={...t,common:{...t.common,issues:[]},parent:null},s=a._parseSync({data:t.data,path:t.path,parent:n});if("valid"===s.status)return s;"dirty"!==s.status||e||(e={result:s,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const s=r.map(e=>new y(e));return v(t,{code:f.invalid_union,unionErrors:s}),k}}get options(){return this._def.options}}function ve(e,t){const n=m(e),r=m(t);if(e===t)return{valid:!0,data:e};if(n===h.object&&r===h.object){const n=l.objectKeys(t),r=l.objectKeys(e).filter(e=>-1!==n.indexOf(e)),s={...e,...t};for(const a of r){const n=ve(e[a],t[a]);if(!n.valid)return{valid:!1};s[a]=n.data}return{valid:!0,data:s}}if(n===h.array&&r===h.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let r=0;r<e.length;r++){const s=ve(e[r],t[r]);if(!s.valid)return{valid:!1};n.push(s.data)}return{valid:!0,data:n}}return n===h.date&&r===h.date&&+e===+t?{valid:!0,data:e}:{valid:!1}}_e.create=(e,t)=>new _e({options:e,typeName:Me.ZodUnion,...A(t)});class we extends C{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(S(e)||S(r))return k;const s=ve(e.value,r.value);return s.valid?((O(e)||O(r))&&t.dirty(),{status:t.value,value:s.data}):(v(n,{code:f.invalid_intersection_types}),k)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}we.create=(e,t,n)=>new we({left:e,right:t,typeName:Me.ZodIntersection,...A(n)});class ke extends C{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.array)return v(n,{code:f.invalid_type,expected:h.array,received:n.parsedType}),k;if(n.data.length<this._def.items.length)return v(n,{code:f.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),k;!this._def.rest&&n.data.length>this._def.items.length&&(v(n,{code:f.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const r=[...n.data].map((e,t)=>{const r=this._def.items[t]||this._def.rest;return r?r._parse(new P(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>w.mergeArray(t,e)):w.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new ke({...this._def,rest:e})}}ke.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ke({items:e,typeName:Me.ZodTuple,rest:null,...A(t)})};class be extends C{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.map)return v(n,{code:f.invalid_type,expected:h.map,received:n.parsedType}),k;const r=this._def.keyType,s=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new P(n,e,n.path,[a,"key"])),value:s._parse(new P(n,t,n.path,[a,"value"]))}));if(n.common.async){const e=new Map;return Promise.resolve().then(async()=>{for(const n of a){const r=await n.key,s=await n.value;if("aborted"===r.status||"aborted"===s.status)return k;"dirty"!==r.status&&"dirty"!==s.status||t.dirty(),e.set(r.value,s.value)}return{status:t.value,value:e}})}{const e=new Map;for(const n of a){const r=n.key,s=n.value;if("aborted"===r.status||"aborted"===s.status)return k;"dirty"!==r.status&&"dirty"!==s.status||t.dirty(),e.set(r.value,s.value)}return{status:t.value,value:e}}}}be.create=(e,t,n)=>new be({valueType:t,keyType:e,typeName:Me.ZodMap,...A(n)});class xe extends C{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.set)return v(n,{code:f.invalid_type,expected:h.set,received:n.parsedType}),k;const r=this._def;null!==r.minSize&&n.data.size<r.minSize.value&&(v(n,{code:f.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),null!==r.maxSize&&n.data.size>r.maxSize.value&&(v(n,{code:f.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const s=this._def.valueType;function a(e){const n=new Set;for(const r of e){if("aborted"===r.status)return k;"dirty"===r.status&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}const i=[...n.data.values()].map((e,t)=>s._parse(new P(n,e,n.path,t)));return n.common.async?Promise.all(i).then(e=>a(e)):a(i)}min(e,t){return new xe({...this._def,minSize:{value:e,message:N.toString(t)}})}max(e,t){return new xe({...this._def,maxSize:{value:e,message:N.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}xe.create=(e,t)=>new xe({valueType:e,minSize:null,maxSize:null,typeName:Me.ZodSet,...A(t)});class Se extends C{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Se.create=(e,t)=>new Se({getter:e,typeName:Me.ZodLazy,...A(t)});class Oe extends C{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return v(t,{received:t.data,code:f.invalid_literal,expected:this._def.value}),k}return{status:"valid",value:e.data}}get value(){return this._def.value}}function Te(e,t){return new Ee({values:e,typeName:Me.ZodEnum,...A(t)})}Oe.create=(e,t)=>new Oe({value:e,typeName:Me.ZodLiteral,...A(t)});class Ee extends C{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return v(t,{expected:l.joinValues(n),received:t.parsedType,code:f.invalid_type}),k}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return v(t,{received:t.data,code:f.invalid_enum_value,options:n}),k}return x(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Ee.create(e,{...this._def,...t})}exclude(e,t=this._def){return Ee.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}Ee.create=Te;class Ne extends C{_parse(e){const t=l.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==h.string&&n.parsedType!==h.number){const e=l.objectValues(t);return v(n,{expected:l.joinValues(e),received:n.parsedType,code:f.invalid_type}),k}if(this._cache||(this._cache=new Set(l.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=l.objectValues(t);return v(n,{received:n.data,code:f.invalid_enum_value,options:e}),k}return x(e.data)}get enum(){return this._def.values}}Ne.create=(e,t)=>new Ne({values:e,typeName:Me.ZodNativeEnum,...A(t)});class Pe extends C{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.promise&&!1===t.common.async)return v(t,{code:f.invalid_type,expected:h.promise,received:t.parsedType}),k;const n=t.parsedType===h.promise?t.data:Promise.resolve(t.data);return x(n.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Pe.create=(e,t)=>new Pe({type:e,typeName:Me.ZodPromise,...A(t)});class je extends C{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Me.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,s={addIssue:e=>{v(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),"preprocess"===r.type){const e=r.transform(n.data,s);if(n.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return k;const r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===r.status?k:"dirty"===r.status||"dirty"===t.value?b(r.value):r});{if("aborted"===t.value)return k;const r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===r.status?k:"dirty"===r.status||"dirty"===t.value?b(r.value):r}}if("refinement"===r.type){const e=e=>{const t=r.refinement(e,s);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===n.common.async){const r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===r.status?k:("dirty"===r.status&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>"aborted"===n.status?k:("dirty"===n.status&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if("transform"===r.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!T(e))return k;const a=r.transform(e.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>T(e)?Promise.resolve(r.transform(e.value,s)).then(e=>({status:t.value,value:e})):k)}l.assertNever(r)}}je.create=(e,t,n)=>new je({schema:e,typeName:Me.ZodEffects,effect:t,...A(n)}),je.createWithPreprocess=(e,t,n)=>new je({schema:t,effect:{type:"preprocess",transform:e},typeName:Me.ZodEffects,...A(n)});class Ae extends C{_parse(e){return this._getType(e)===h.undefined?x(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ae.create=(e,t)=>new Ae({innerType:e,typeName:Me.ZodOptional,...A(t)});class Ce extends C{_parse(e){return this._getType(e)===h.null?x(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ce.create=(e,t)=>new Ce({innerType:e,typeName:Me.ZodNullable,...A(t)});class Ze extends C{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===h.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Ze.create=(e,t)=>new Ze({innerType:e,typeName:Me.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...A(t)});class Fe extends C{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return E(r)?r.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new y(n.common.issues)},input:n.data})})):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new y(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Fe.create=(e,t)=>new Fe({innerType:e,typeName:Me.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...A(t)});class Ie extends C{_parse(e){if(this._getType(e)!==h.nan){const t=this._getOrReturnCtx(e);return v(t,{code:f.invalid_type,expected:h.nan,received:t.parsedType}),k}return{status:"valid",value:e.data}}}Ie.create=e=>new Ie({typeName:Me.ZodNaN,...A(e)});class $e extends C{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class Re extends C{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?k:"dirty"===e.status?(t.dirty(),b(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})()}{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?k:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new Re({in:e,out:t,typeName:Me.ZodPipeline})}}class Le extends C{_parse(e){const t=this._def.innerType._parse(e),n=e=>(T(e)&&(e.value=Object.freeze(e.value)),e);return E(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}}var Me;Le.create=(e,t)=>new Le({innerType:e,typeName:Me.ZodReadonly,...A(t)}),function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(Me||(Me={}));const De=ne.create;he.create,fe.create;const ze=ge.create;_e.create,we.create,ke.create,Ee.create,Pe.create,Ae.create,Ce.create;const qe=ze({detail:De()}),Ue=ze({error:De()});function Ve(e){if(!e)return"Unknown error";if(e instanceof Error){const t=qe.safeParse(e.cause);return t.success?t.data.detail:function(e){const t=function(e){try{return JSON.parse(e)}catch{return e}}(e);if(!t)return e;const n=qe.safeParse(t);if(n.success)return n.data.detail;const r=Ue.safeParse(t);if(r.success)return r.data.error;return e}(e.message)}if("object"==typeof e){const t=qe.safeParse(e);if(t.success)return t.data.detail;const n=Ue.safeParse(e);if(n.success)return n.data.error}try{return JSON.stringify(e)}catch{return String(e)}}function He(e,t){if(!e)throw new Error(t)}function Be(e){return e.FS}const We="notebook.py",Ke="/marimo",Je=We,Ye=e=>{const t=Be(e);try{t.mkdirTree(Ke)}catch{}t.chdir(Ke)},Ge=e=>{Be(e).mount(e.FS.filesystems.IDBFS,{root:"."},Ke)},Xe=async e=>{await tt(e,!0)},Qe=async e=>{await tt(e,!1)},et=e=>{const{pyodide:t,filename:n,code:r}=e,s=Be(t);if(n&&n!==We){const e=(e=>{try{return u(s.readFile(e))}catch{return null}})(n);if(e)return{code:e,filename:n}}return s.writeFile(We,r),{code:r,filename:We}};function tt(e,t){return new Promise((n,r)=>{Be(e).syncfs(t,e=>{e instanceof Error?r(e):n()})})}var nt,rt=Object.defineProperty,st=(e,t)=>rt(e,"name",{value:t,configurable:!0}),at=(nt=function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')},typeof require<"u"?require:typeof Proxy<"u"?new Proxy(nt,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):nt);function it(e){return!isNaN(parseFloat(e))&&isFinite(e)}function ot(e){return e.charAt(0).toUpperCase()+e.substring(1)}function dt(e){return function(){return this[e]}}st(it,"_isNumber"),st(ot,"_capitalize"),st(dt,"_getter");var ct,ut,lt=["isConstructor","isEval","isNative","isToplevel"],pt=["columnNumber","lineNumber"],ht=["fileName","functionName","source"],mt=lt.concat(pt,ht,["args"],["evalOrigin"]);function ft(e){if(e)for(var t=0;t<mt.length;t++)void 0!==e[mt[t]]&&this["set"+ot(mt[t])](e[mt[t]])}for(st(ft,"StackFrame"),ft.prototype={getArgs:function(){return this.args},setArgs:function(e){if("[object Array]"!==Object.prototype.toString.call(e))throw new TypeError("Args must be an Array");this.args=e},getEvalOrigin:function(){return this.evalOrigin},setEvalOrigin:function(e){if(e instanceof ft)this.evalOrigin=e;else{if(!(e instanceof Object))throw new TypeError("Eval Origin must be an Object or StackFrame");this.evalOrigin=new ft(e)}},toString:function(){var e=this.getFileName()||"",t=this.getLineNumber()||"",n=this.getColumnNumber()||"",r=this.getFunctionName()||"";return this.getIsEval()?e?"[eval] ("+e+":"+t+":"+n+")":"[eval]:"+t+":"+n:r?r+" ("+e+":"+t+":"+n+")":e+":"+t+":"+n}},ft.fromString=st(function(e){var t=e.indexOf("("),n=e.lastIndexOf(")"),r=e.substring(0,t),s=e.substring(t+1,n).split(","),a=e.substring(n+1);if(0===a.indexOf("@"))var i=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(a,""),o=i[1],d=i[2],c=i[3];return new ft({functionName:r,args:s||void 0,fileName:o,lineNumber:d||void 0,columnNumber:c||void 0})},"StackFrame$$fromString"),ct=0;ct<lt.length;ct++)ft.prototype["get"+ot(lt[ct])]=dt(lt[ct]),ft.prototype["set"+ot(lt[ct])]=function(e){return function(t){this[e]=!!t}}(lt[ct]);for(ut=0;ut<pt.length;ut++)ft.prototype["get"+ot(pt[ut])]=dt(pt[ut]),ft.prototype["set"+ot(pt[ut])]=function(e){return function(t){if(!it(t))throw new TypeError(e+" must be a Number");this[e]=Number(t)}}(pt[ut]);for(yt=0;yt<ht.length;yt++)ft.prototype["get"+ot(ht[yt])]=dt(ht[yt]),ft.prototype["set"+ot(ht[yt])]=function(e){return function(t){this[e]=String(t)}}(ht[yt]);var yt,gt=ft;function _t(){var e=/^\s*at .*(\S+:\d+|\(native\))/m,t=/^(eval@)?(\[native code])?$/;return{parse:st(function(t){if(t.stack&&t.stack.match(e))return this.parseV8OrIE(t);if(t.stack)return this.parseFFOrSafari(t);throw new Error("Cannot parse given Error object")},"ErrorStackParser$$parse"),extractLocation:st(function(e){if(-1===e.indexOf(":"))return[e];var t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));return[t[1],t[2]||void 0,t[3]||void 0]},"ErrorStackParser$$extractLocation"),parseV8OrIE:st(function(t){return t.stack.split("\n").filter(function(t){return!!t.match(e)},this).map(function(e){e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(,.*$)/g,""));var t=e.replace(/^\s+/,"").replace(/\(eval code/g,"(").replace(/^.*?\s+/,""),n=t.match(/ (\(.+\)$)/);t=n?t.replace(n[0],""):t;var r=this.extractLocation(n?n[1]:t),s=n&&t||void 0,a=["eval","<anonymous>"].indexOf(r[0])>-1?void 0:r[0];return new gt({functionName:s,fileName:a,lineNumber:r[1],columnNumber:r[2],source:e})},this)},"ErrorStackParser$$parseV8OrIE"),parseFFOrSafari:st(function(e){return e.stack.split("\n").filter(function(e){return!e.match(t)},this).map(function(e){if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new gt({functionName:e});var t=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=e.match(t),r=n&&n[1]?n[1]:void 0,s=this.extractLocation(e.replace(t,""));return new gt({functionName:r,fileName:s[0],lineNumber:s[1],columnNumber:s[2],source:e})},this)},"ErrorStackParser$$parseFFOrSafari")}}st(_t,"ErrorStackParser");var vt,wt,kt,bt,xt,St,Ot,Tt,Et,Nt=new _t,Pt="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node&&!process.browser,jt=Pt&&typeof module<"u"&&typeof module.exports<"u"&&typeof at<"u"&&typeof __dirname<"u",At=Pt&&!jt,Ct=typeof Deno<"u",Zt=!Pt&&!Ct,Ft=Zt&&"object"==typeof window&&"object"==typeof document&&"function"==typeof document.createElement&&"sessionStorage"in window&&"function"!=typeof importScripts,It=Zt&&"function"==typeof importScripts&&"object"==typeof self;async function $t(){if(!Pt||(vt=(await import("./__vite-browser-external-CIEyP2s7.js")).default,bt=await import("./__vite-browser-external-CIEyP2s7.js"),xt=await import("./__vite-browser-external-CIEyP2s7.js"),kt=(await import("./__vite-browser-external-CIEyP2s7.js")).default,wt=await import("./__vite-browser-external-CIEyP2s7.js"),Ot=wt.sep,typeof at<"u"))return;let e={fs:bt,crypto:await import("./__vite-browser-external-CIEyP2s7.js"),ws:await import("./__vite-browser-external-CIEyP2s7.js"),child_process:await import("./__vite-browser-external-CIEyP2s7.js")};globalThis.require=function(t){return e[t]}}function Rt(e,t){return wt.resolve(t||".",e)}function Lt(e,t){return void 0===t&&(t=location),new URL(e,t).toString()}function Mt(e,t){return e.startsWith("file://")&&(e=e.slice(7)),e.includes("://")?{response:fetch(e)}:{binary:xt.readFile(e).then(e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}}function Dt(e,t){let n=new URL(e,location);return{response:fetch(n,t?{integrity:t}:{})}}async function zt(e,t){let{response:n,binary:r}=Tt(e,t);if(r)return r;let s=await n;if(!s.ok)throw new Error(`Failed to load '${e}': request failed.`);return new Uint8Array(await s.arrayBuffer())}if("object"==typeof navigator&&"string"==typeof navigator.userAgent&&-1==navigator.userAgent.indexOf("Chrome")&&navigator.userAgent.indexOf("Safari"),st($t,"initNodeModules"),st(Rt,"node_resolvePath"),st(Lt,"browser_resolvePath"),St=Pt?Rt:Lt,Pt||(Ot="/"),st(Mt,"node_getBinaryResponse"),st(Dt,"browser_getBinaryResponse"),Tt=Pt?Mt:Dt,st(zt,"loadBinaryFile"),Ft)Et=st(async e=>await import(e),"loadScript");else if(It)Et=st(async e=>{try{globalThis.importScripts(e)}catch(nn){if(!(nn instanceof TypeError))throw nn;await import(e)}},"loadScript");else{if(!Pt)throw new Error("Cannot determine runtime environment");Et=qt}async function qt(e){e.startsWith("file://")&&(e=e.slice(7)),e.includes("://")?kt.runInThisContext(await(await fetch(e)).text()):await import(vt.pathToFileURL(e).href)}async function Ut(e){if(Pt){await $t();let t=await xt.readFile(e,{encoding:"utf8"});return JSON.parse(t)}return await(await fetch(e)).json()}async function Vt(){if(jt)return __dirname;let e;try{throw new Error}catch(r){e=r}let t=Nt.parse(e)[0].fileName;if(Pt&&!t.startsWith("file://")&&(t=`file://${t}`),At){let e=await import("./__vite-browser-external-CIEyP2s7.js");return(await import("./__vite-browser-external-CIEyP2s7.js")).fileURLToPath(e.dirname(t))}let n=t.lastIndexOf(Ot);if(-1===n)throw new Error("Could not extract indexURL path from pyodide module location");return t.slice(0,n)}function Ht(e){let t=e.FS,n=e.FS.filesystems.MEMFS,r=e.PATH,s={DIR_MODE:16895,FILE_MODE:33279,mount:function(e){if(!e.opts.fileSystemHandle)throw new Error("opts.fileSystemHandle is required");return n.mount.apply(null,arguments)},syncfs:async(e,t,n)=>{try{let r=s.getLocalSet(e),a=await s.getRemoteSet(e),i=t?a:r,o=t?r:a;await s.reconcile(e,i,o),n(null)}catch(r){n(r)}},getLocalSet:e=>{let n=Object.create(null);function s(e){return"."!==e&&".."!==e}function a(e){return t=>r.join2(e,t)}st(s,"isRealDir"),st(a,"toAbsolute");let i=t.readdir(e.mountpoint).filter(s).map(a(e.mountpoint));for(;i.length;){let e=i.pop(),r=t.stat(e);t.isDir(r.mode)&&i.push.apply(i,t.readdir(e).filter(s).map(a(e))),n[e]={timestamp:r.mtime,mode:r.mode}}return{type:"local",entries:n}},getRemoteSet:async e=>{let t=Object.create(null),n=await Bt(e.opts.fileSystemHandle);for(let[a,i]of n)"."!==a&&(t[r.join2(e.mountpoint,a)]={timestamp:"file"===i.kind?new Date((await i.getFile()).lastModified):new Date,mode:"file"===i.kind?s.FILE_MODE:s.DIR_MODE});return{type:"remote",entries:t,handles:n}},loadLocalEntry:e=>{let r=t.lookupPath(e).node,s=t.stat(e);if(t.isDir(s.mode))return{timestamp:s.mtime,mode:s.mode};if(t.isFile(s.mode))return r.contents=n.getFileDataAsTypedArray(r),{timestamp:s.mtime,mode:s.mode,contents:r.contents};throw new Error("node type not supported")},storeLocalEntry:(e,n)=>{if(t.isDir(n.mode))t.mkdirTree(e,n.mode);else{if(!t.isFile(n.mode))throw new Error("node type not supported");t.writeFile(e,n.contents,{canOwn:!0})}t.chmod(e,n.mode),t.utime(e,n.timestamp,n.timestamp)},removeLocalEntry:e=>{var n=t.stat(e);t.isDir(n.mode)?t.rmdir(e):t.isFile(n.mode)&&t.unlink(e)},loadRemoteEntry:async e=>{if("file"===e.kind){let t=await e.getFile();return{contents:new Uint8Array(await t.arrayBuffer()),mode:s.FILE_MODE,timestamp:new Date(t.lastModified)}}if("directory"===e.kind)return{mode:s.DIR_MODE,timestamp:new Date};throw new Error("unknown kind: "+e.kind)},storeRemoteEntry:async(e,n,s)=>{let a=e.get(r.dirname(n)),i=t.isFile(s.mode)?await a.getFileHandle(r.basename(n),{create:!0}):await a.getDirectoryHandle(r.basename(n),{create:!0});if("file"===i.kind){let e=await i.createWritable();await e.write(s.contents),await e.close()}e.set(n,i)},removeRemoteEntry:async(e,t)=>{await e.get(r.dirname(t)).removeEntry(r.basename(t)),e.delete(t)},reconcile:async(e,n,a)=>{let i=0,o=[];Object.keys(n.entries).forEach(function(e){let r=n.entries[e],s=a.entries[e];(!s||t.isFile(r.mode)&&r.timestamp.getTime()>s.timestamp.getTime())&&(o.push(e),i++)}),o.sort();let d=[];if(Object.keys(a.entries).forEach(function(e){n.entries[e]||(d.push(e),i++)}),d.sort().reverse(),!i)return;let c="remote"===n.type?n.handles:a.handles;for(let t of o){let n=r.normalize(t.replace(e.mountpoint,"/")).substring(1);if("local"===a.type){let e=c.get(n),r=await s.loadRemoteEntry(e);s.storeLocalEntry(t,r)}else{let e=s.loadLocalEntry(t);await s.storeRemoteEntry(c,n,e)}}for(let t of d)if("local"===a.type)s.removeLocalEntry(t);else{let n=r.normalize(t.replace(e.mountpoint,"/")).substring(1);await s.removeRemoteEntry(c,n)}}};e.FS.filesystems.NATIVEFS_ASYNC=s}st(qt,"nodeLoadScript"),st(Ut,"loadLockFile"),st(Vt,"calculateDirname"),st(Ht,"initializeNativeFS");var Bt=st(async e=>{let t=[];async function n(e){for await(let r of e.values())t.push(r),"directory"===r.kind&&await n(r)}st(n,"collect"),await n(e);let r=new Map;r.set(".",e);for(let s of t){let t=(await e.resolve(s)).join("/");r.set(t,s)}return r},"getFsHandles");function Wt(e){let t={noImageDecoding:!0,noAudioDecoding:!0,noWasmDecoding:!1,preRun:Xt(e),quit(e,n){throw t.exited={status:e,toThrow:n},n},print:e.stdout,printErr:e.stderr,thisProgram:e._sysExecutable,arguments:e.args,API:{config:e},locateFile:t=>e.indexURL+t,instantiateWasm:Qt(e.indexURL)};return t}function Kt(e){return function(t){try{t.FS.mkdirTree(e)}catch(n){console.error(`Error occurred while making a home directory '${e}':`),console.error(n),console.error("Using '/' for a home directory instead"),e="/"}t.FS.chdir(e)}}function Jt(e){return function(t){Object.assign(t.ENV,e)}}function Yt(e){return e?[async t=>{t.addRunDependency("fsInitHook");try{await e(t.FS,{sitePackages:t.API.sitePackages})}finally{t.removeRunDependency("fsInitHook")}}]:[]}function Gt(e){let t=zt(e);return async e=>{let n=e._py_version_major(),r=e._py_version_minor();e.FS.mkdirTree("/lib"),e.API.sitePackages=`/lib/python${n}.${r}/site-packages`,e.FS.mkdirTree(e.API.sitePackages),e.addRunDependency("install-stdlib");try{let s=await t;e.FS.writeFile(`/lib/python${n}${r}.zip`,s)}catch(s){console.error("Error occurred while installing the standard library:"),console.error(s)}finally{e.removeRunDependency("install-stdlib")}}}function Xt(e){let t;return t=null!=e.stdLibURL?e.stdLibURL:e.indexURL+"python_stdlib.zip",[...Yt(e.fsInit),Gt(t),Kt(e.env.HOME),Jt(e.env),Ht]}function Qt(e){if(typeof WasmOffsetConverter<"u")return;let{binary:t,response:n}=Tt(e+"pyodide.asm.wasm");return function(e,r){return async function(){try{let s;s=n?await WebAssembly.instantiateStreaming(n,e):await WebAssembly.instantiate(await t,e);let{instance:a,module:i}=s;r(a,i)}catch(s){console.warn("wasm instantiation failed!"),console.warn(s)}}(),{}}}st(Wt,"createSettings"),st(Kt,"createHomeDirectory"),st(Jt,"setEnvironment"),st(Yt,"callFsInitHook"),st(Gt,"installStdlib"),st(Xt,"getFileSystemInitializationFuncs"),st(Qt,"getInstantiateWasmFunc");var en="0.27.7";async function tn(e={}){var t,n;await $t();let r=e.indexURL||await Vt();r=St(r),r.endsWith("/")||(r+="/"),e.indexURL=r;let s={fullStdLib:!1,jsglobals:globalThis,stdin:globalThis.prompt?globalThis.prompt:void 0,lockFileURL:r+"pyodide-lock.json",args:[],env:{},packageCacheDir:r,packages:[],enableRunUntilComplete:!0,checkAPIVersion:!0,BUILD_ID:"e94377f5ce7dcf67e0417b69a0016733c2cfb6b4622ee8c490a6f17eb58e863b"},a=Object.assign(s,e);(t=a.env).HOME??(t.HOME="/home/pyodide"),(n=a.env).PYTHONINSPECT??(n.PYTHONINSPECT="1");let i,o=Wt(a),d=o.API;if(d.lockFilePromise=Ut(a.lockFileURL),"function"!=typeof _createPyodideModule){let e=`${a.indexURL}pyodide.asm.js`;await Et(e)}if(e._loadSnapshot){let t=await e._loadSnapshot;i=ArrayBuffer.isView(t)?t:new Uint8Array(t),o.noInitialRun=!0,o.INITIAL_MEMORY=i.length}let c,u=await _createPyodideModule(o);if(o.exited)throw o.exited.toThrow;if(e.pyproxyToStringRepr&&d.setPyProxyToStringMethod(!0),d.version!==en&&a.checkAPIVersion)throw new Error(`Pyodide version does not match: '${en}' <==> '${d.version}'. If you updated the Pyodide version, make sure you also updated the 'indexURL' parameter passed to loadPyodide.`);u.locateFile=e=>{throw new Error("Didn't expect to load any more file_packager files!")},i&&(c=d.restoreSnapshot(i));let l=d.finalizeBootstrap(c,e._snapshotDeserializer);return d.sys.path.insert(0,""),l.version.includes("dev")||d.setCdnUrl(`https://cdn.jsdelivr.net/pyodide/v${l.version}/full/`),d._pyodide.set_excepthook(),await d.packageIndexReady,d.initializeStreams(a.stdin,a.stdout,a.stderr),l}st(tn,"loadPyodide");const nn=new class{spans=[];startSpan(e,t={}){const n={name:e,startTime:Date.now(),attributes:t,end:(e="ok")=>this.endSpan(n,e)};return this.spans.push(n),n}endSpan(e,t="ok"){e.endTime=Date.now(),e.status=t}getSpans(){return this.spans}wrap(e,t,n={}){const r=this.startSpan(t||e.name,n);try{const t=e();return this.endSpan(r),t}catch(s){throw this.endSpan(r,"error"),s}}wrapAsync(e,t,n={}){return async(...r)=>{const s=this.startSpan(t||e.name,n);try{const t=await e(...r);return this.endSpan(s),t}catch(a){throw this.endSpan(s,"error"),a}}}logSpans(){}};globalThis.t=nn;class rn{pyodide=null;get requirePyodide(){return He(this.pyodide,"Pyodide not loaded"),this.pyodide}async bootstrap(e){return await this.loadPyodideAndPackages(e)}async loadPyodideAndPackages(e){if(!tn)throw new Error("loadPyodide is not defined");const t=nn.startSpan("loadPyodide");try{const n=await tn({packages:["micropip","marimo-base","Markdown","pymdown-extensions","narwhals","packaging"],_makeSnapshot:false,lockFileURL:`https://wasm.marimo.app/pyodide-lock.json?v=${e.version}&pyodide=${e.pyodideVersion}`,indexURL:`https://cdn.jsdelivr.net/pyodide/${e.pyodideVersion}/full/`});return this.pyodide=n,t.end("ok"),n}catch(n){throw c.error("Failed to load Pyodide",n),n}}async mountFilesystem(e){const t=nn.startSpan("mountFilesystem");return Ye(this.requirePyodide),Ge(this.requirePyodide),await Xe(this.requirePyodide),t.end("ok"),et({pyodide:this.requirePyodide,code:e.code,filename:e.filename})}async startSession(e){const{code:t,filename:n,onMessage:r,queryParameters:s,userConfig:a}=e;self.messenger={callback:r},self.query_params=s,self.user_config=a;const i=nn.startSpan("startSession.runPython"),o=n||Je,[d,c,u]=this.requirePyodide.runPython(`\n print("[py] Starting marimo...")\n import asyncio\n import js\n from marimo._pyodide.bootstrap import create_session, instantiate\n\n assert js.messenger, "messenger is not defined"\n assert js.query_params, "query_params is not defined"\n\n session, bridge = create_session(\n filename="${o}",\n query_params=js.query_params.to_py(),\n message_callback=js.messenger.callback,\n user_config=js.user_config.to_py(),\n )\n\n def init(auto_instantiate=True):\n instantiate(session, auto_instantiate)\n asyncio.create_task(session.start())\n\n # Find the packages to install\n with open("${o}", "r") as f:\n packages = session.find_packages(f.read())\n\n bridge, init, packages`);i.end();const l=new Set(u.toJs());return this.loadNotebookDeps(t,l).then(()=>c(a.runtime.auto_instantiate)),d}async loadNotebookDeps(e,t){const n=this.requirePyodide;e.includes("mo.sql")&&(e=`import sqlglot\n${e=`import duckdb\n${e=`import pandas\n${e}`}`}`).includes("polars")&&(e=`import pyarrow\n${e}`),e=`import pyodide_http\n${e=`import jedi\n${e=`import pygments\n${e=`import docutils\n${e}`}`}`}`;const r=[...t];let s=nn.startSpan("pyodide.loadPackage");await n.loadPackagesFromImports(e,{errorCallback:c.error,messageCallback:c.log}),s.end(),s=nn.startSpan("micropip.install");const a=r.filter(e=>!n.loadedPackages[e]);a.length>0&&await n.runPythonAsync(`\n import micropip\n import sys\n # Filter out builtins\n missing = [p for p in ${JSON.stringify(a)} if p not in sys.modules]\n if len(missing) > 0:\n print("Loading from micropip:", missing)\n await micropip.install(missing)\n `).catch(e=>{c.error("Failed to load packages from micropip",e)}),s.end()}}async function sn(e){try{return await import(`/wasm/controller.js?version=${e}`)}catch{return new rn}}const an=nn.startSpan("worker:init");const on=new class{constructor(e){this.onMessage=e,this.buffer=[]}buffer;started=!1;push=e=>{this.started?this.onMessage(e):this.buffer.push(e)};start=()=>{this.started=!0,this.buffer.forEach(e=>this.onMessage(e)),this.buffer=[]}}(e=>{ln.send.kernelMessage({message:e})}),dn=new class{promise;resolve;reject;status="pending";constructor(){this.promise=new Promise((e,t)=>{this.reject=e=>{this.status="rejected",t(e)},this.resolve=t=>{this.status="resolved",e(t)}})}};let cn=!1;const un={startSession:async e=>{if(await mn,cn)c.warn("Session already started");else{cn=!0;try{He(self.controller,"Controller not loaded"),await(self.controller.mountFilesystem?.({code:e.code,filename:e.filename}));const t=nn.wrapAsync(self.controller.startSession.bind(self.controller)),n=function(e){let t,n=!1;return function(...r){return n||(n=!0,t=e.apply(this,r)),t}}(()=>{ln.send.initializingMessage({message:"Initializing notebook..."}),ln.send.initialized({})});ln.send.initializingMessage({message:"Loading notebook and dependencies..."});const r=await t({code:e.code,filename:e.filename,queryParameters:e.queryParameters,userConfig:e.userConfig,onMessage:e=>{n(),on.push(e)}});dn.resolve(r),an.end("ok")}catch(t){ln.send.initializedError({error:Ve(t)}),an.end("error")}}},loadPackages:async e=>{const t=nn.startSpan("loadPackages");await mn,e.includes("mo.sql")&&(e=`import sqlglot\n${e=`import duckdb\n${e=`import pandas\n${e}`}`}`).includes("polars")&&(e=`import pyarrow\n${e}`),await self.pyodide.loadPackagesFromImports(e,{messageCallback:c.log,errorCallback:c.error}),t.end()},readFile:async e=>{const t=nn.startSpan("readFile");await mn;const n=u(self.pyodide.FS.readFile(e));return t.end(),n},setInterruptBuffer:async e=>{await mn,self.pyodide.setInterruptBuffer(e)},addPackage:async e=>{await mn;const{package:t}=e,n=t.split(" ").map(e=>e.trim()),r=await self.pyodide.runPythonAsync(`\n import micropip\n import json\n response = None\n try:\n await micropip.install(${JSON.stringify(n)})\n response = {"success": True}\n except Exception as e:\n response = {"success": False, "error": str(e)}\n json.dumps(response)\n `);return JSON.parse(r)},removePackage:async e=>{await mn;const{package:t}=e,n=await self.pyodide.runPythonAsync(`\n import micropip\n import json\n response = None\n try:\n micropip.uninstall("${t}")\n response = {"success": True}\n except Exception as e:\n response = {"success": False, "error": str(e)}\n json.dumps(response)\n `);return JSON.parse(n)},listPackages:async()=>{const e=nn.startSpan("listPackages");await mn;const t=await self.pyodide.runPythonAsync('\n import json\n import micropip\n\n packages = micropip.list()\n packages = [\n {"name": p.name, "version": p.version}\n for p in packages.values()\n ]\n json.dumps(sorted(packages, key=lambda pkg: pkg["name"]))\n ');return e.end(),{packages:JSON.parse(t)}},saveNotebook:async e=>{await mn;const t=self.pyodide.runPython("\n from marimo._pyodide.bootstrap import save_file\n save_file\n ");await t(JSON.stringify(e),Je)},bridge:async e=>{const t=nn.startSpan("bridge",{functionName:e.functionName});await mn;const{functionName:n,payload:r}=e;"format"===n&&await self.pyodide.runPythonAsync('\n import micropip\n\n try:\n import black\n except ModuleNotFoundError:\n await micropip.install("black")\n '),"export_markdown"===n&&await self.pyodide.runPythonAsync('\n import micropip\n\n try:\n import yaml\n except ModuleNotFoundError:\n await micropip.install("pyyaml")\n ');const s=await dn.promise,a=null==r?null:"string"==typeof r?r:JSON.stringify(r),i=null==a?await s[n]():await s[n](a);return hn.has(n)&&Qe(self.pyodide),t.end(),"string"==typeof i?JSON.parse(i):i}},ln=function(e){return n(e)}({transport:(pn={transportId:"marimo-transport"},s(self,pn)),requestHandler:un});var pn;ln.send("ready",{}),ln.addMessageListener("consumerReady",async()=>{await mn,on.start()});const hn=new Set(["save","save_app_config","rename_file","create_file_or_directory","delete_file_or_directory","move_file_or_directory","update_file"]);const mn=nn.wrapAsync(async function(){try{const e=self.name,t=function(e){return e.includes("dev"),`v${en}`}(e),n=await nn.wrapAsync(sn)(e);self.controller=n,ln.send.initializingMessage({message:"Loading marimo..."}),self.pyodide=await nn.wrapAsync(n.bootstrap.bind(n))({version:e,pyodideVersion:t})}catch(e){c.error("Error bootstrapping",e),ln.send.initializedError({error:Ve(e)})}})();
|
@@ -0,0 +1,7 @@
|
|
1
|
+
var G,j,Q,K,q,Z,J,tt,it,et;import{_ as a,s as hi,g as oi,q as It,p as ri,a as li,b as ci,l as $t,I as gi,d as ui,y as xi,F as ft,E as Bt,G as di,L as pi,h as fi,ab as mi}from"./mermaid-DCMac0Ai.js";import"./transform-CDNfLgV5.js";import{i as yi}from"./init-DLRA0X12.js";import{o as bi}from"./ordinal-DDUp3AbE.js";import{r as Ai}from"./range-CtcPcB_L.js";import{l as zt}from"./linear-DtgEMbrz.js";import{l as Ot}from"./step-BwsUM5iJ.js";import"./index-_lj65MZR.js";import"./timer-Bqd5yn_a.js";function mt(){var e,t,i=bi().unknown(void 0),s=i.domain,n=i.range,c=0,g=1,p=!1,d=0,_=0,L=.5;function S(){var y=s().length,E=g<c,D=E?g:c,P=E?c:g;e=(P-D)/Math.max(1,y-d+2*_),p&&(e=Math.floor(e)),D+=(P-D-e*(y-d))*L,t=e*(1-d),p&&(D=Math.round(D),t=Math.round(t));var M=Ai(y).map(function(f){return D+e*f});return n(E?M.reverse():M)}return delete i.unknown,i.domain=function(y){return arguments.length?(s(y),S()):s()},i.range=function(y){return arguments.length?([c,g]=y,c=+c,g=+g,S()):[c,g]},i.rangeRound=function(y){return[c,g]=y,c=+c,g=+g,p=!0,S()},i.bandwidth=function(){return t},i.step=function(){return e},i.round=function(y){return arguments.length?(p=!!y,S()):p},i.padding=function(y){return arguments.length?(d=Math.min(1,_=+y),S()):d},i.paddingInner=function(y){return arguments.length?(d=Math.min(1,y),S()):d},i.paddingOuter=function(y){return arguments.length?(_=+y,S()):_},i.align=function(y){return arguments.length?(L=Math.max(0,Math.min(1,y)),S()):L},i.copy=function(){return mt(s(),[c,g]).round(p).paddingInner(d).paddingOuter(_).align(L)},yi.apply(S(),arguments)}var yt=function(){var e=a(function(h,b,u,x){for(u=u||{},x=h.length;x--;u[h[x]]=b);return u},"o"),t=[1,10,12,14,16,18,19,21,23],i=[2,6],s=[1,3],n=[1,5],c=[1,6],g=[1,7],p=[1,5,10,12,14,16,18,19,21,23,34,35,36],d=[1,25],_=[1,26],L=[1,28],S=[1,29],y=[1,30],E=[1,31],D=[1,32],P=[1,33],M=[1,34],f=[1,35],k=[1,36],l=[1,37],z=[1,43],O=[1,42],Y=[1,47],F=[1,50],r=[1,10,12,14,16,18,19,21,23,34,35,36],v=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36],C=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36,41,42,43,44,45,46,47,48,49,50],T=[1,64],st={trace:a(function(){},"trace"),yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,commaSeparatedNumbers:25,SQUARE_BRACES_END:26,NUMBER_WITH_DECIMAL:27,COMMA:28,xAxisData:29,bandData:30,ARROW_DELIMITER:31,commaSeparatedTexts:32,yAxisData:33,NEWLINE:34,SEMI:35,EOF:36,alphaNum:37,STR:38,MD_STR:39,alphaNumToken:40,AMP:41,NUM:42,ALPHA:43,PLUS:44,EQUALS:45,MULT:46,DOT:47,BRKT:48,MINUS:49,UNDERSCORE:50,$accept:0,$end:1},terminals_:{2:"error",5:"XYCHART",8:"CHART_ORIENTATION",10:"title",12:"X_AXIS",14:"Y_AXIS",16:"LINE",18:"BAR",19:"acc_title",20:"acc_title_value",21:"acc_descr",22:"acc_descr_value",23:"acc_descr_multiline_value",24:"SQUARE_BRACES_START",26:"SQUARE_BRACES_END",27:"NUMBER_WITH_DECIMAL",28:"COMMA",31:"ARROW_DELIMITER",34:"NEWLINE",35:"SEMI",36:"EOF",38:"STR",39:"MD_STR",41:"AMP",42:"NUM",43:"ALPHA",44:"PLUS",45:"EQUALS",46:"MULT",47:"DOT",48:"BRKT",49:"MINUS",50:"UNDERSCORE"},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[13,1],[13,2],[13,1],[29,1],[29,3],[30,3],[32,3],[32,1],[15,1],[15,2],[15,1],[33,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[37,1],[37,2],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1]],performAction:a(function(h,b,u,x,w,o,nt){var m=o.length-1;switch(w){case 5:x.setOrientation(o[m]);break;case 9:x.setDiagramTitle(o[m].text.trim());break;case 12:x.setLineData({text:"",type:"text"},o[m]);break;case 13:x.setLineData(o[m-1],o[m]);break;case 14:x.setBarData({text:"",type:"text"},o[m]);break;case 15:x.setBarData(o[m-1],o[m]);break;case 16:this.$=o[m].trim(),x.setAccTitle(this.$);break;case 17:case 18:this.$=o[m].trim(),x.setAccDescription(this.$);break;case 19:case 27:this.$=o[m-1];break;case 20:this.$=[Number(o[m-2]),...o[m]];break;case 21:this.$=[Number(o[m])];break;case 22:x.setXAxisTitle(o[m]);break;case 23:x.setXAxisTitle(o[m-1]);break;case 24:x.setXAxisTitle({type:"text",text:""});break;case 25:x.setXAxisBand(o[m]);break;case 26:x.setXAxisRangeData(Number(o[m-2]),Number(o[m]));break;case 28:this.$=[o[m-2],...o[m]];break;case 29:this.$=[o[m]];break;case 30:x.setYAxisTitle(o[m]);break;case 31:x.setYAxisTitle(o[m-1]);break;case 32:x.setYAxisTitle({type:"text",text:""});break;case 33:x.setYAxisRangeData(Number(o[m-2]),Number(o[m]));break;case 37:case 38:this.$={text:o[m],type:"text"};break;case 39:this.$={text:o[m],type:"markdown"};break;case 40:this.$=o[m];break;case 41:this.$=o[m-1]+""+o[m]}},"anonymous"),table:[e(t,i,{3:1,4:2,7:4,5:s,34:n,35:c,36:g}),{1:[3]},e(t,i,{4:2,7:4,3:8,5:s,34:n,35:c,36:g}),e(t,i,{4:2,7:4,6:9,3:10,5:s,8:[1,11],34:n,35:c,36:g}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},e(p,[2,34]),e(p,[2,35]),e(p,[2,36]),{1:[2,1]},e(t,i,{4:2,7:4,3:21,5:s,34:n,35:c,36:g}),{1:[2,3]},e(p,[2,5]),e(t,[2,7],{4:22,34:n,35:c,36:g}),{11:23,37:24,38:d,39:_,40:27,41:L,42:S,43:y,44:E,45:D,46:P,47:M,48:f,49:k,50:l},{11:39,13:38,24:z,27:O,29:40,30:41,37:24,38:d,39:_,40:27,41:L,42:S,43:y,44:E,45:D,46:P,47:M,48:f,49:k,50:l},{11:45,15:44,27:Y,33:46,37:24,38:d,39:_,40:27,41:L,42:S,43:y,44:E,45:D,46:P,47:M,48:f,49:k,50:l},{11:49,17:48,24:F,37:24,38:d,39:_,40:27,41:L,42:S,43:y,44:E,45:D,46:P,47:M,48:f,49:k,50:l},{11:52,17:51,24:F,37:24,38:d,39:_,40:27,41:L,42:S,43:y,44:E,45:D,46:P,47:M,48:f,49:k,50:l},{20:[1,53]},{22:[1,54]},e(r,[2,18]),{1:[2,2]},e(r,[2,8]),e(r,[2,9]),e(v,[2,37],{40:55,41:L,42:S,43:y,44:E,45:D,46:P,47:M,48:f,49:k,50:l}),e(v,[2,38]),e(v,[2,39]),e(C,[2,40]),e(C,[2,42]),e(C,[2,43]),e(C,[2,44]),e(C,[2,45]),e(C,[2,46]),e(C,[2,47]),e(C,[2,48]),e(C,[2,49]),e(C,[2,50]),e(C,[2,51]),e(r,[2,10]),e(r,[2,22],{30:41,29:56,24:z,27:O}),e(r,[2,24]),e(r,[2,25]),{31:[1,57]},{11:59,32:58,37:24,38:d,39:_,40:27,41:L,42:S,43:y,44:E,45:D,46:P,47:M,48:f,49:k,50:l},e(r,[2,11]),e(r,[2,30],{33:60,27:Y}),e(r,[2,32]),{31:[1,61]},e(r,[2,12]),{17:62,24:F},{25:63,27:T},e(r,[2,14]),{17:65,24:F},e(r,[2,16]),e(r,[2,17]),e(C,[2,41]),e(r,[2,23]),{27:[1,66]},{26:[1,67]},{26:[2,29],28:[1,68]},e(r,[2,31]),{27:[1,69]},e(r,[2,13]),{26:[1,70]},{26:[2,21],28:[1,71]},e(r,[2,15]),e(r,[2,26]),e(r,[2,27]),{11:59,32:72,37:24,38:d,39:_,40:27,41:L,42:S,43:y,44:E,45:D,46:P,47:M,48:f,49:k,50:l},e(r,[2,33]),e(r,[2,19]),{25:73,27:T},{26:[2,28]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],72:[2,28],73:[2,20]},parseError:a(function(h,b){if(!b.recoverable){var u=new Error(h);throw u.hash=b,u}this.trace(h)},"parseError"),parse:a(function(h){var b=this,u=[0],x=[],w=[null],o=[],nt=this.table,m="",rt=0,Lt=0,ni=o.slice.call(arguments,1),R=Object.create(this.lexer),N={yy:{}};for(var dt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,dt)&&(N.yy[dt]=this.yy[dt]);R.setInput(h,N.yy),N.yy.lexer=R,N.yy.parser=this,R.yylloc===void 0&&(R.yylloc={});var pt=R.yylloc;o.push(pt);var ai=R.options&&R.options.ranges;function Pt(){var B;return typeof(B=x.pop()||R.lex()||1)!="number"&&(B instanceof Array&&(B=(x=B).pop()),B=b.symbols_[B]||B),B}typeof N.yy.parseError=="function"?this.parseError=N.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,a(function(B){u.length=u.length-2*B,w.length=w.length-B,o.length=o.length-B},"popStack"),a(Pt,"lex");for(var I,V,$,vt,lt,W,Et,ct,H={};;){if(V=u[u.length-1],this.defaultActions[V]?$=this.defaultActions[V]:(I==null&&(I=Pt()),$=nt[V]&&nt[V][I]),$===void 0||!$.length||!$[0]){var Mt="";for(lt in ct=[],nt[V])this.terminals_[lt]&<>2&&ct.push("'"+this.terminals_[lt]+"'");Mt=R.showPosition?"Parse error on line "+(rt+1)+`:
|
2
|
+
`+R.showPosition()+`
|
3
|
+
Expecting `+ct.join(", ")+", got '"+(this.terminals_[I]||I)+"'":"Parse error on line "+(rt+1)+": Unexpected "+(I==1?"end of input":"'"+(this.terminals_[I]||I)+"'"),this.parseError(Mt,{text:R.match,token:this.terminals_[I]||I,line:R.yylineno,loc:pt,expected:ct})}if($[0]instanceof Array&&$.length>1)throw new Error("Parse Error: multiple actions possible at state: "+V+", token: "+I);switch($[0]){case 1:u.push(I),w.push(R.yytext),o.push(R.yylloc),u.push($[1]),I=null,Lt=R.yyleng,m=R.yytext,rt=R.yylineno,pt=R.yylloc;break;case 2:if(W=this.productions_[$[1]][1],H.$=w[w.length-W],H._$={first_line:o[o.length-(W||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(W||1)].first_column,last_column:o[o.length-1].last_column},ai&&(H._$.range=[o[o.length-(W||1)].range[0],o[o.length-1].range[1]]),(vt=this.performAction.apply(H,[m,Lt,rt,N.yy,$[1],w,o].concat(ni)))!==void 0)return vt;W&&(u=u.slice(0,-1*W*2),w=w.slice(0,-1*W),o=o.slice(0,-1*W)),u.push(this.productions_[$[1]][0]),w.push(H.$),o.push(H._$),Et=nt[u[u.length-2]][u[u.length-1]],u.push(Et);break;case 3:return!0}}return!0},"parse")},ot=function(){return{EOF:1,parseError:a(function(h,b){if(!this.yy.parser)throw new Error(h);this.yy.parser.parseError(h,b)},"parseError"),setInput:a(function(h,b){return this.yy=b||this.yy||{},this._input=h,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:a(function(){var h=this._input[0];return this.yytext+=h,this.yyleng++,this.offset++,this.match+=h,this.matched+=h,h.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),h},"input"),unput:a(function(h){var b=h.length,u=h.split(/(?:\r\n?|\n)/g);this._input=h+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-b),this.offset-=b;var x=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),u.length-1&&(this.yylineno-=u.length-1);var w=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:u?(u.length===x.length?this.yylloc.first_column:0)+x[x.length-u.length].length-u[0].length:this.yylloc.first_column-b},this.options.ranges&&(this.yylloc.range=[w[0],w[0]+this.yyleng-b]),this.yyleng=this.yytext.length,this},"unput"),more:a(function(){return this._more=!0,this},"more"),reject:a(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
4
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:a(function(h){this.unput(this.match.slice(h))},"less"),pastInput:a(function(){var h=this.matched.substr(0,this.matched.length-this.match.length);return(h.length>20?"...":"")+h.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:a(function(){var h=this.match;return h.length<20&&(h+=this._input.substr(0,20-h.length)),(h.substr(0,20)+(h.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:a(function(){var h=this.pastInput(),b=new Array(h.length+1).join("-");return h+this.upcomingInput()+`
|
5
|
+
`+b+"^"},"showPosition"),test_match:a(function(h,b){var u,x,w;if(this.options.backtrack_lexer&&(w={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(w.yylloc.range=this.yylloc.range.slice(0))),(x=h[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=x.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:x?x[x.length-1].length-x[x.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+h[0].length},this.yytext+=h[0],this.match+=h[0],this.matches=h,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(h[0].length),this.matched+=h[0],u=this.performAction.call(this,this.yy,this,b,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),u)return u;if(this._backtrack){for(var o in w)this[o]=w[o];return!1}return!1},"test_match"),next:a(function(){if(this.done)return this.EOF;var h,b,u,x;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var w=this._currentRules(),o=0;o<w.length;o++)if((u=this._input.match(this.rules[w[o]]))&&(!b||u[0].length>b[0].length)){if(b=u,x=o,this.options.backtrack_lexer){if((h=this.test_match(u,w[o]))!==!1)return h;if(this._backtrack){b=!1;continue}return!1}if(!this.options.flex)break}return b?(h=this.test_match(b,w[x]))!==!1&&h:this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
|
6
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:a(function(){var h=this.next();return h||this.lex()},"lex"),begin:a(function(h){this.conditionStack.push(h)},"begin"),popState:a(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:a(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:a(function(h){return(h=this.conditionStack.length-1-Math.abs(h||0))>=0?this.conditionStack[h]:"INITIAL"},"topState"),pushState:a(function(h){this.begin(h)},"pushState"),stateStackSize:a(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:a(function(h,b,u,x){switch(u){case 0:case 1:case 5:case 43:break;case 2:case 3:return this.popState(),34;case 4:return 34;case 6:return 10;case 7:return this.pushState("acc_title"),19;case 8:return this.popState(),"acc_title_value";case 9:return this.pushState("acc_descr"),21;case 10:return this.popState(),"acc_descr_value";case 11:this.pushState("acc_descr_multiline");break;case 12:case 25:case 27:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:return 5;case 15:return 8;case 16:return this.pushState("axis_data"),"X_AXIS";case 17:return this.pushState("axis_data"),"Y_AXIS";case 18:return this.pushState("axis_band_data"),24;case 19:return 31;case 20:return this.pushState("data"),16;case 21:return this.pushState("data"),18;case 22:return this.pushState("data_inner"),24;case 23:return 27;case 24:return this.popState(),26;case 26:this.pushState("string");break;case 28:return"STR";case 29:return 24;case 30:return 26;case 31:return 43;case 32:return"COLON";case 33:return 44;case 34:return 28;case 35:return 45;case 36:return 46;case 37:return 48;case 38:return 50;case 39:return 47;case 40:return 41;case 41:return 49;case 42:return 42;case 44:return 35;case 45:return 36}},"anonymous"),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:(\r?\n))/i,/^(?:(\r?\n))/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:title\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:\{)/i,/^(?:[^\}]*)/i,/^(?:xychart-beta\b)/i,/^(?:(?:vertical|horizontal))/i,/^(?:x-axis\b)/i,/^(?:y-axis\b)/i,/^(?:\[)/i,/^(?:-->)/i,/^(?:line\b)/i,/^(?:bar\b)/i,/^(?:\[)/i,/^(?:[+-]?(?:\d+(?:\.\d+)?|\.\d+))/i,/^(?:\])/i,/^(?:(?:`\) \{ this\.pushState\(md_string\); \}\n<md_string>\(\?:\(\?!`"\)\.\)\+ \{ return MD_STR; \}\n<md_string>\(\?:`))/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:[A-Za-z]+)/i,/^(?::)/i,/^(?:\+)/i,/^(?:,)/i,/^(?:=)/i,/^(?:\*)/i,/^(?:#)/i,/^(?:[\_])/i,/^(?:\.)/i,/^(?:&)/i,/^(?:-)/i,/^(?:[0-9]+)/i,/^(?:\s+)/i,/^(?:;)/i,/^(?:$)/i],conditions:{data_inner:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,20,21,23,24,25,26,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],inclusive:!0},data:{rules:[0,1,3,4,5,6,7,9,11,14,15,16,17,20,21,22,25,26,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],inclusive:!0},axis_band_data:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,20,21,24,25,26,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],inclusive:!0},axis_data:{rules:[0,1,2,4,5,6,7,9,11,14,15,16,17,18,19,20,21,23,25,26,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],inclusive:!0},acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},title:{rules:[],inclusive:!1},md_string:{rules:[],inclusive:!1},string:{rules:[27,28],inclusive:!1},INITIAL:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,20,21,25,26,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],inclusive:!0}}}}();function X(){this.yy={}}return st.lexer=ot,a(X,"Parser"),X.prototype=st,st.Parser=X,new X}();yt.parser=yt;var wi=yt;function bt(e){return e.type==="bar"}function At(e){return e.type==="band"}function U(e){return e.type==="linear"}a(bt,"isBarPlot"),a(At,"isBandAxisData"),a(U,"isLinearAxisData");var Wt=(G=class{constructor(t){this.parentGroup=t}getMaxDimension(t,i){if(!this.parentGroup)return{width:t.reduce((c,g)=>Math.max(g.length,c),0)*i,height:i};const s={width:0,height:0},n=this.parentGroup.append("g").attr("visibility","hidden").attr("font-size",i);for(const c of t){const g=mi(n,1,c),p=g?g.width:c.length*i,d=g?g.height:i;s.width=Math.max(s.width,p),s.height=Math.max(s.height,d)}return n.remove(),s}},a(G,"TextDimensionCalculatorWithFont"),G),Ft=(j=class{constructor(t,i,s,n){this.axisConfig=t,this.title=i,this.textDimensionCalculator=s,this.axisThemeConfig=n,this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition="left",this.showTitle=!1,this.showLabel=!1,this.showTick=!1,this.showAxisLine=!1,this.outerPadding=0,this.titleTextHeight=0,this.labelTextHeight=0,this.range=[0,10],this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition="left"}setRange(t){this.range=t,this.axisPosition==="left"||this.axisPosition==="right"?this.boundingRect.height=t[1]-t[0]:this.boundingRect.width=t[1]-t[0],this.recalculateScale()}getRange(){return[this.range[0]+this.outerPadding,this.range[1]-this.outerPadding]}setAxisPosition(t){this.axisPosition=t,this.setRange(this.range)}getTickDistance(){const t=this.getRange();return Math.abs(t[0]-t[1])/this.getTickValues().length}getAxisOuterPadding(){return this.outerPadding}getLabelDimension(){return this.textDimensionCalculator.getMaxDimension(this.getTickValues().map(t=>t.toString()),this.axisConfig.labelFontSize)}recalculateOuterPaddingToDrawBar(){.7*this.getTickDistance()>2*this.outerPadding&&(this.outerPadding=Math.floor(.7*this.getTickDistance()/2)),this.recalculateScale()}calculateSpaceIfDrawnHorizontally(t){let i=t.height;if(this.axisConfig.showAxisLine&&i>this.axisConfig.axisLineWidth&&(i-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){const s=this.getLabelDimension(),n=.2*t.width;this.outerPadding=Math.min(s.width/2,n);const c=s.height+2*this.axisConfig.labelPadding;this.labelTextHeight=s.height,c<=i&&(i-=c,this.showLabel=!0)}if(this.axisConfig.showTick&&i>=this.axisConfig.tickLength&&(this.showTick=!0,i-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){const s=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),n=s.height+2*this.axisConfig.titlePadding;this.titleTextHeight=s.height,n<=i&&(i-=n,this.showTitle=!0)}this.boundingRect.width=t.width,this.boundingRect.height=t.height-i}calculateSpaceIfDrawnVertical(t){let i=t.width;if(this.axisConfig.showAxisLine&&i>this.axisConfig.axisLineWidth&&(i-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){const s=this.getLabelDimension(),n=.2*t.height;this.outerPadding=Math.min(s.height/2,n);const c=s.width+2*this.axisConfig.labelPadding;c<=i&&(i-=c,this.showLabel=!0)}if(this.axisConfig.showTick&&i>=this.axisConfig.tickLength&&(this.showTick=!0,i-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){const s=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),n=s.height+2*this.axisConfig.titlePadding;this.titleTextHeight=s.height,n<=i&&(i-=n,this.showTitle=!0)}this.boundingRect.width=t.width-i,this.boundingRect.height=t.height}calculateSpace(t){return this.axisPosition==="left"||this.axisPosition==="right"?this.calculateSpaceIfDrawnVertical(t):this.calculateSpaceIfDrawnHorizontally(t),this.recalculateScale(),{width:this.boundingRect.width,height:this.boundingRect.height}}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}getDrawableElementsForLeftAxis(){const t=[];if(this.showAxisLine){const i=this.boundingRect.x+this.boundingRect.width-this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["left-axis","axisl-line"],data:[{path:`M ${i},${this.boundingRect.y} L ${i},${this.boundingRect.y+this.boundingRect.height} `,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["left-axis","label"],data:this.getTickValues().map(i=>({text:i.toString(),x:this.boundingRect.x+this.boundingRect.width-(this.showLabel?this.axisConfig.labelPadding:0)-(this.showTick?this.axisConfig.tickLength:0)-(this.showAxisLine?this.axisConfig.axisLineWidth:0),y:this.getScaleValue(i),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"middle",horizontalPos:"right"}))}),this.showTick){const i=this.boundingRect.x+this.boundingRect.width-(this.showAxisLine?this.axisConfig.axisLineWidth:0);t.push({type:"path",groupTexts:["left-axis","ticks"],data:this.getTickValues().map(s=>({path:`M ${i},${this.getScaleValue(s)} L ${i-this.axisConfig.tickLength},${this.getScaleValue(s)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&t.push({type:"text",groupTexts:["left-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.axisConfig.titlePadding,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:270,verticalPos:"top",horizontalPos:"center"}]}),t}getDrawableElementsForBottomAxis(){const t=[];if(this.showAxisLine){const i=this.boundingRect.y+this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["bottom-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${i} L ${this.boundingRect.x+this.boundingRect.width},${i}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["bottom-axis","label"],data:this.getTickValues().map(i=>({text:i.toString(),x:this.getScaleValue(i),y:this.boundingRect.y+this.axisConfig.labelPadding+(this.showTick?this.axisConfig.tickLength:0)+(this.showAxisLine?this.axisConfig.axisLineWidth:0),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}))}),this.showTick){const i=this.boundingRect.y+(this.showAxisLine?this.axisConfig.axisLineWidth:0);t.push({type:"path",groupTexts:["bottom-axis","ticks"],data:this.getTickValues().map(s=>({path:`M ${this.getScaleValue(s)},${i} L ${this.getScaleValue(s)},${i+this.axisConfig.tickLength}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&t.push({type:"text",groupTexts:["bottom-axis","title"],data:[{text:this.title,x:this.range[0]+(this.range[1]-this.range[0])/2,y:this.boundingRect.y+this.boundingRect.height-this.axisConfig.titlePadding-this.titleTextHeight,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]}),t}getDrawableElementsForTopAxis(){const t=[];if(this.showAxisLine){const i=this.boundingRect.y+this.boundingRect.height-this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["top-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${i} L ${this.boundingRect.x+this.boundingRect.width},${i}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["top-axis","label"],data:this.getTickValues().map(i=>({text:i.toString(),x:this.getScaleValue(i),y:this.boundingRect.y+(this.showTitle?this.titleTextHeight+2*this.axisConfig.titlePadding:0)+this.axisConfig.labelPadding,fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}))}),this.showTick){const i=this.boundingRect.y;t.push({type:"path",groupTexts:["top-axis","ticks"],data:this.getTickValues().map(s=>({path:`M ${this.getScaleValue(s)},${i+this.boundingRect.height-(this.showAxisLine?this.axisConfig.axisLineWidth:0)} L ${this.getScaleValue(s)},${i+this.boundingRect.height-this.axisConfig.tickLength-(this.showAxisLine?this.axisConfig.axisLineWidth:0)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&t.push({type:"text",groupTexts:["top-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.axisConfig.titlePadding,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]}),t}getDrawableElements(){if(this.axisPosition==="left")return this.getDrawableElementsForLeftAxis();if(this.axisPosition==="right")throw Error("Drawing of right axis is not implemented");return this.axisPosition==="bottom"?this.getDrawableElementsForBottomAxis():this.axisPosition==="top"?this.getDrawableElementsForTopAxis():[]}},a(j,"BaseAxis"),j),Si=(Q=class extends Ft{constructor(t,i,s,n,c){super(t,n,c,i),this.categories=s,this.scale=mt().domain(this.categories).range(this.getRange())}setRange(t){super.setRange(t)}recalculateScale(){this.scale=mt().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(.5),$t.trace("BandAxis axis final categories, range: ",this.categories,this.getRange())}getTickValues(){return this.categories}getScaleValue(t){return this.scale(t)??this.getRange()[0]}},a(Q,"BandAxis"),Q),Ci=(K=class extends Ft{constructor(t,i,s,n,c){super(t,n,c,i),this.domain=s,this.scale=zt().domain(this.domain).range(this.getRange())}getTickValues(){return this.scale.ticks()}recalculateScale(){const t=[...this.domain];this.axisPosition==="left"&&t.reverse(),this.scale=zt().domain(t).range(this.getRange())}getScaleValue(t){return this.scale(t)}},a(K,"LinearAxis"),K);function wt(e,t,i,s){const n=new Wt(s);return At(e)?new Si(t,i,e.categories,e.title,n):new Ci(t,i,[e.min,e.max],e.title,n)}a(wt,"getAxis");var ki=(q=class{constructor(t,i,s,n){this.textDimensionCalculator=t,this.chartConfig=i,this.chartData=s,this.chartThemeConfig=n,this.boundingRect={x:0,y:0,width:0,height:0},this.showChartTitle=!1}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateSpace(t){const i=this.textDimensionCalculator.getMaxDimension([this.chartData.title],this.chartConfig.titleFontSize),s=Math.max(i.width,t.width),n=i.height+2*this.chartConfig.titlePadding;return i.width<=s&&i.height<=n&&this.chartConfig.showTitle&&this.chartData.title&&(this.boundingRect.width=s,this.boundingRect.height=n,this.showChartTitle=!0),{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){const t=[];return this.showChartTitle&&t.push({groupTexts:["chart-title"],type:"text",data:[{fontSize:this.chartConfig.titleFontSize,text:this.chartData.title,verticalPos:"middle",horizontalPos:"center",x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.chartThemeConfig.titleColor,rotation:0}]}),t}},a(q,"ChartTitle"),q);function Xt(e,t,i,s){const n=new Wt(s);return new ki(n,e,t,i)}a(Xt,"getChartTitleComponent");var _i=(Z=class{constructor(t,i,s,n,c){this.plotData=t,this.xAxis=i,this.yAxis=s,this.orientation=n,this.plotIndex=c}getDrawableElement(){const t=this.plotData.data.map(s=>[this.xAxis.getScaleValue(s[0]),this.yAxis.getScaleValue(s[1])]);let i;return i=this.orientation==="horizontal"?Ot().y(s=>s[0]).x(s=>s[1])(t):Ot().x(s=>s[0]).y(s=>s[1])(t),i?[{groupTexts:["plot",`line-plot-${this.plotIndex}`],type:"path",data:[{path:i,strokeFill:this.plotData.strokeFill,strokeWidth:this.plotData.strokeWidth}]}]:[]}},a(Z,"LinePlot"),Z),Ti=(J=class{constructor(t,i,s,n,c,g){this.barData=t,this.boundingRect=i,this.xAxis=s,this.yAxis=n,this.orientation=c,this.plotIndex=g}getDrawableElement(){const t=this.barData.data.map(n=>[this.xAxis.getScaleValue(n[0]),this.yAxis.getScaleValue(n[1])]),i=.95*Math.min(2*this.xAxis.getAxisOuterPadding(),this.xAxis.getTickDistance()),s=i/2;return this.orientation==="horizontal"?[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:t.map(n=>({x:this.boundingRect.x,y:n[0]-s,height:i,width:n[1]-this.boundingRect.x,fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]:[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:t.map(n=>({x:n[0]-s,y:n[1],width:i,height:this.boundingRect.y+this.boundingRect.height-n[1],fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]}},a(J,"BarPlot"),J),Ri=(tt=class{constructor(t,i,s){this.chartConfig=t,this.chartData=i,this.chartThemeConfig=s,this.boundingRect={x:0,y:0,width:0,height:0}}setAxes(t,i){this.xAxis=t,this.yAxis=i}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateSpace(t){return this.boundingRect.width=t.width,this.boundingRect.height=t.height,{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){if(!this.xAxis||!this.yAxis)throw Error("Axes must be passed to render Plots");const t=[];for(const[i,s]of this.chartData.plots.entries())switch(s.type){case"line":{const n=new _i(s,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,i);t.push(...n.getDrawableElement())}break;case"bar":{const n=new Ti(s,this.boundingRect,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,i);t.push(...n.getDrawableElement())}}return t}},a(tt,"BasePlot"),tt);function Nt(e,t,i){return new Ri(e,t,i)}a(Nt,"getPlotComponent");var Vt,Di=(it=class{constructor(t,i,s,n){this.chartConfig=t,this.chartData=i,this.componentStore={title:Xt(t,i,s,n),plot:Nt(t,i,s),xAxis:wt(i.xAxis,t.xAxis,{titleColor:s.xAxisTitleColor,labelColor:s.xAxisLabelColor,tickColor:s.xAxisTickColor,axisLineColor:s.xAxisLineColor},n),yAxis:wt(i.yAxis,t.yAxis,{titleColor:s.yAxisTitleColor,labelColor:s.yAxisLabelColor,tickColor:s.yAxisTickColor,axisLineColor:s.yAxisLineColor},n)}}calculateVerticalSpace(){let t=this.chartConfig.width,i=this.chartConfig.height,s=0,n=0,c=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),g=Math.floor(i*this.chartConfig.plotReservedSpacePercent/100),p=this.componentStore.plot.calculateSpace({width:c,height:g});t-=p.width,i-=p.height,p=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:i}),n=p.height,i-=p.height,this.componentStore.xAxis.setAxisPosition("bottom"),p=this.componentStore.xAxis.calculateSpace({width:t,height:i}),i-=p.height,this.componentStore.yAxis.setAxisPosition("left"),p=this.componentStore.yAxis.calculateSpace({width:t,height:i}),s=p.width,t-=p.width,t>0&&(c+=t,t=0),i>0&&(g+=i,i=0),this.componentStore.plot.calculateSpace({width:c,height:g}),this.componentStore.plot.setBoundingBoxXY({x:s,y:n}),this.componentStore.xAxis.setRange([s,s+c]),this.componentStore.xAxis.setBoundingBoxXY({x:s,y:n+g}),this.componentStore.yAxis.setRange([n,n+g]),this.componentStore.yAxis.setBoundingBoxXY({x:0,y:n}),this.chartData.plots.some(d=>bt(d))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateHorizontalSpace(){let t=this.chartConfig.width,i=this.chartConfig.height,s=0,n=0,c=0,g=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),p=Math.floor(i*this.chartConfig.plotReservedSpacePercent/100),d=this.componentStore.plot.calculateSpace({width:g,height:p});t-=d.width,i-=d.height,d=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:i}),s=d.height,i-=d.height,this.componentStore.xAxis.setAxisPosition("left"),d=this.componentStore.xAxis.calculateSpace({width:t,height:i}),t-=d.width,n=d.width,this.componentStore.yAxis.setAxisPosition("top"),d=this.componentStore.yAxis.calculateSpace({width:t,height:i}),i-=d.height,c=s+d.height,t>0&&(g+=t,t=0),i>0&&(p+=i,i=0),this.componentStore.plot.calculateSpace({width:g,height:p}),this.componentStore.plot.setBoundingBoxXY({x:n,y:c}),this.componentStore.yAxis.setRange([n,n+g]),this.componentStore.yAxis.setBoundingBoxXY({x:n,y:s}),this.componentStore.xAxis.setRange([c,c+p]),this.componentStore.xAxis.setBoundingBoxXY({x:0,y:c}),this.chartData.plots.some(_=>bt(_))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateSpace(){this.chartConfig.chartOrientation==="horizontal"?this.calculateHorizontalSpace():this.calculateVerticalSpace()}getDrawableElement(){this.calculateSpace();const t=[];this.componentStore.plot.setAxes(this.componentStore.xAxis,this.componentStore.yAxis);for(const i of Object.values(this.componentStore))t.push(...i.getDrawableElements());return t}},a(it,"Orchestrator"),it),Li=(et=class{static build(t,i,s,n){return new Di(t,i,s,n).getDrawableElement()}},a(et,"XYChartBuilder"),et),at=0,gt=_t(),ht=kt(),A=Yt(),St=ht.plotColorPalette.split(",").map(e=>e.trim()),ut=!1,Ct=!1;function kt(){const e=pi(),t=ft();return Bt(e.xyChart,t.themeVariables.xyChart)}function _t(){const e=ft();return Bt(di.xyChart,e.xyChart)}function Yt(){return{yAxis:{type:"linear",title:"",min:1/0,max:-1/0},xAxis:{type:"band",title:"",categories:[]},title:"",plots:[]}}function xt(e){const t=ft();return fi(e.trim(),t)}function Ht(e){Vt=e}function Ut(e){gt.chartOrientation=e==="horizontal"?"horizontal":"vertical"}function Gt(e){A.xAxis.title=xt(e.text)}function Tt(e,t){A.xAxis={type:"linear",title:A.xAxis.title,min:e,max:t},ut=!0}function jt(e){A.xAxis={type:"band",title:A.xAxis.title,categories:e.map(t=>xt(t.text))},ut=!0}function Qt(e){A.yAxis.title=xt(e.text)}function Kt(e,t){A.yAxis={type:"linear",title:A.yAxis.title,min:e,max:t},Ct=!0}function qt(e){const t=Math.min(...e),i=Math.max(...e),s=U(A.yAxis)?A.yAxis.min:1/0,n=U(A.yAxis)?A.yAxis.max:-1/0;A.yAxis={type:"linear",title:A.yAxis.title,min:Math.min(s,t),max:Math.max(n,i)}}function Rt(e){let t=[];if(e.length===0)return t;if(!ut){const i=U(A.xAxis)?A.xAxis.min:1/0,s=U(A.xAxis)?A.xAxis.max:-1/0;Tt(Math.min(i,1),Math.max(s,e.length))}if(Ct||qt(e),At(A.xAxis)&&(t=A.xAxis.categories.map((i,s)=>[i,e[s]])),U(A.xAxis)){const i=A.xAxis.min,s=A.xAxis.max,n=(s-i)/(e.length-1),c=[];for(let g=i;g<=s;g+=n)c.push(`${g}`);t=c.map((g,p)=>[g,e[p]])}return t}function Dt(e){return St[e===0?0:e%St.length]}function Zt(e,t){const i=Rt(t);A.plots.push({type:"line",strokeFill:Dt(at),strokeWidth:2,data:i}),at++}function Jt(e,t){const i=Rt(t);A.plots.push({type:"bar",fill:Dt(at),data:i}),at++}function ti(){if(A.plots.length===0)throw Error("No Plot to render, please provide a plot with some data");return A.title=It(),Li.build(gt,A,ht,Vt)}function ii(){return ht}function ei(){return gt}function si(){return A}a(kt,"getChartDefaultThemeConfig"),a(_t,"getChartDefaultConfig"),a(Yt,"getChartDefaultData"),a(xt,"textSanitizer"),a(Ht,"setTmpSVGG"),a(Ut,"setOrientation"),a(Gt,"setXAxisTitle"),a(Tt,"setXAxisRangeData"),a(jt,"setXAxisBand"),a(Qt,"setYAxisTitle"),a(Kt,"setYAxisRangeData"),a(qt,"setYAxisRangeFromPlotData"),a(Rt,"transformDataWithoutCategory"),a(Dt,"getPlotColorFromPalette"),a(Zt,"setLineData"),a(Jt,"setBarData"),a(ti,"getDrawableElem"),a(ii,"getChartThemeConfig"),a(ei,"getChartConfig"),a(si,"getXYChartData");var Pi={parser:wi,db:{getDrawableElem:ti,clear:a(function(){xi(),at=0,gt=_t(),A={yAxis:{type:"linear",title:"",min:1/0,max:-1/0},xAxis:{type:"band",title:"",categories:[]},title:"",plots:[]},ht=kt(),St=ht.plotColorPalette.split(",").map(e=>e.trim()),ut=!1,Ct=!1},"clear"),setAccTitle:ci,getAccTitle:li,setDiagramTitle:ri,getDiagramTitle:It,getAccDescription:oi,setAccDescription:hi,setOrientation:Ut,setXAxisTitle:Gt,setXAxisRangeData:Tt,setXAxisBand:jt,setYAxisTitle:Qt,setYAxisRangeData:Kt,setLineData:Zt,setBarData:Jt,setTmpSVGG:Ht,getChartThemeConfig:ii,getChartConfig:ei,getXYChartData:si},renderer:{draw:a((e,t,i,s)=>{const n=s.db,c=n.getChartThemeConfig(),g=n.getChartConfig(),p=n.getXYChartData().plots[0].data.map(f=>f[1]);function d(f){return f==="top"?"text-before-edge":"middle"}function _(f){return f==="left"?"start":f==="right"?"end":"middle"}function L(f){return`translate(${f.x}, ${f.y}) rotate(${f.rotation||0})`}a(d,"getDominantBaseLine"),a(_,"getTextAnchor"),a(L,"getTextTransformation"),$t.debug(`Rendering xychart chart
|
7
|
+
`+e);const S=gi(t),y=S.append("g").attr("class","main"),E=y.append("rect").attr("width",g.width).attr("height",g.height).attr("class","background");ui(S,g.height,g.width,!0),S.attr("viewBox",`0 0 ${g.width} ${g.height}`),E.attr("fill",c.backgroundColor),n.setTmpSVGG(S.append("g").attr("class","mermaid-tmp-group"));const D=n.getDrawableElem(),P={};function M(f){let k=y,l="";for(const[z]of f.entries()){let O=y;z>0&&P[l]&&(O=P[l]),l+=f[z],k=P[l],k||(k=P[l]=O.append("g").attr("class",f[z]))}return k}a(M,"getGroup");for(const f of D){if(f.data.length===0)continue;const k=M(f.groupTexts);switch(f.type){case"rect":if(k.selectAll("rect").data(f.data).enter().append("rect").attr("x",l=>l.x).attr("y",l=>l.y).attr("width",l=>l.width).attr("height",l=>l.height).attr("fill",l=>l.fill).attr("stroke",l=>l.strokeFill).attr("stroke-width",l=>l.strokeWidth),g.showDataLabel)if(g.chartOrientation==="horizontal"){let l=function(r,v){const{data:C,label:T}=r;return v*T.length*z<=C.width-10};a(l,"fitsHorizontally");const z=.7,O=f.data.map((r,v)=>({data:r,label:p[v].toString()})).filter(r=>r.data.width>0&&r.data.height>0),Y=O.map(r=>{const{data:v}=r;let C=.7*v.height;for(;!l(r,C)&&C>0;)C-=1;return C}),F=Math.floor(Math.min(...Y));k.selectAll("text").data(O).enter().append("text").attr("x",r=>r.data.x+r.data.width-10).attr("y",r=>r.data.y+r.data.height/2).attr("text-anchor","end").attr("dominant-baseline","middle").attr("fill","black").attr("font-size",`${F}px`).text(r=>r.label)}else{let l=function(r,v,C){const{data:T,label:st}=r,ot=v*st.length*.7,X=T.x+T.width/2,h=X+ot/2,b=X-ot/2>=T.x&&h<=T.x+T.width,u=T.y+C+v<=T.y+T.height;return b&&u};a(l,"fitsInBar");const z=10,O=f.data.map((r,v)=>({data:r,label:p[v].toString()})).filter(r=>r.data.width>0&&r.data.height>0),Y=O.map(r=>{const{data:v,label:C}=r;let T=v.width/(.7*C.length);for(;!l(r,T,z)&&T>0;)T-=1;return T}),F=Math.floor(Math.min(...Y));k.selectAll("text").data(O).enter().append("text").attr("x",r=>r.data.x+r.data.width/2).attr("y",r=>r.data.y+z).attr("text-anchor","middle").attr("dominant-baseline","hanging").attr("fill","black").attr("font-size",`${F}px`).text(r=>r.label)}break;case"text":k.selectAll("text").data(f.data).enter().append("text").attr("x",0).attr("y",0).attr("fill",l=>l.fill).attr("font-size",l=>l.fontSize).attr("dominant-baseline",l=>d(l.verticalPos)).attr("text-anchor",l=>_(l.horizontalPos)).attr("transform",l=>L(l)).text(l=>l.text);break;case"path":k.selectAll("path").data(f.data).enter().append("path").attr("d",l=>l.path).attr("fill",l=>l.fill?l.fill:"none").attr("stroke",l=>l.strokeFill).attr("stroke-width",l=>l.strokeWidth)}}},"draw")}};export{Pi as diagram};
|
package/dist/index.html
CHANGED
@@ -59,11 +59,13 @@
|
|
59
59
|
<marimo-server-token data-token="{{ server_token }}" hidden></marimo-server-token>
|
60
60
|
<!-- /TODO -->
|
61
61
|
<title>{{ title }}</title>
|
62
|
-
<script type="module" crossorigin src="./assets/index-
|
63
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
62
|
+
<script type="module" crossorigin src="./assets/index-_lj65MZR.js"></script>
|
63
|
+
<link rel="stylesheet" crossorigin href="./assets/index-CsdFJkJw.css">
|
64
64
|
</head>
|
65
65
|
<body>
|
66
66
|
<div id="root"></div>
|
67
|
+
<!-- This is a portal for the data editor to render in -->
|
68
|
+
<div id="portal" data-testid="glide-portal" style="position: fixed; left: 0; top: 0; z-index: 9999"></div>
|
67
69
|
<script data-marimo="true">
|
68
70
|
window.__MARIMO_MOUNT_CONFIG__ = '{{ mount_config }}';
|
69
71
|
</script>
|