@marimo-team/frontend 0.14.11-dev28 → 0.14.11-dev3
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-BTdbPOD1.js → ConnectedDataExplorerComponent-xhypXmHP.js} +3 -3
- package/dist/assets/{ImageComparisonComponent-DEptg5qG.js → ImageComparisonComponent-CuT2DiU_.js} +1 -1
- package/dist/assets/{VegaLite-ABd2OkS3.js → VegaLite-CZPBjYdL.js} +1 -1
- package/dist/assets/_baseEach-BCq1QunV.js +1 -0
- package/dist/assets/_baseMap-DIOkSXLh.js +1 -0
- package/dist/assets/_baseUniq-DsVx03Xh.js +1 -0
- package/dist/assets/{_createAggregator-swGR0-C3.js → _createAggregator-Ba81XR0f.js} +1 -1
- package/dist/assets/{any-language-editor-DX039oST.js → any-language-editor-D89ohP8-.js} +1 -1
- package/dist/assets/architectureDiagram-IEHRJDOE-Bqy8A1ty.js +36 -0
- package/dist/assets/blockDiagram-JOT3LUYC-DWGFz276.js +121 -0
- package/dist/assets/{c4Diagram-6F6E4RAY-D3H2wsaB.js → c4Diagram-VJAJSXHY-BaOdN25X.js} +2 -2
- package/dist/assets/channel-CkgsSbnI.js +1 -0
- package/dist/assets/{chunk-353BL4L5-8wrRDX4E.js → chunk-4BMEZGHF-CkjJnX2u.js} +1 -1
- package/dist/assets/{chunk-QEP2MXWD-DyrYL1_p.js → chunk-A2AXSNBT-a1s-o-2J.js} +3 -4
- package/dist/assets/chunk-AEK57VVT-AIgYDw2J.js +220 -0
- package/dist/assets/{chunk-67H74DCK-D77z8lmp.js → chunk-D6G4REZN-DWoFE-ph.js} +1 -1
- package/dist/assets/chunk-RZ5BOZE2-D_FFPG3U.js +1 -0
- package/dist/assets/{chunk-AACKK3MU-CVdHRrld.js → chunk-XZIHB7SX-EkhL4wJD.js} +1 -1
- package/dist/assets/{circle-play-N6D87sax.js → circle-play-BMHPESBW.js} +2 -2
- package/dist/assets/classDiagram-GIVACNV2-B0rECIpB.js +1 -0
- package/dist/assets/classDiagram-v2-COTLJTTW-B0rECIpB.js +1 -0
- package/dist/assets/clone-DnjbzbBr.js +1 -0
- package/dist/assets/compile-Damt1e16.js +10 -0
- package/dist/assets/dagre-OKDRZEBW-CGUb-yRu.js +4 -0
- package/dist/assets/{data-editor-C6QrKYpj.js → data-editor-bYstOkO_.js} +22 -22
- package/dist/assets/diagram-SSKATNLV-FwTyvSfY.js +43 -0
- package/dist/assets/diagram-VNBRO52H-3TqYsaSt.js +24 -0
- package/dist/assets/edit-page-DDga9Bn0.js +144 -0
- package/dist/assets/{erDiagram-R3QVA2FD-yV4TjwHy.js → erDiagram-Q7BY3M3F-CtRJc8Nz.js} +1 -1
- package/dist/assets/flowDiagram-4HSFHLVR-DjtJKD_Z.js +161 -0
- package/dist/assets/ganttDiagram-APWFNJXF-9Lh3_xwg.js +257 -0
- package/dist/assets/gitGraphDiagram-7IBYFJ6S-mSQBtVLg.js +65 -0
- package/dist/assets/{graph-CdvOQ44T.js → graph-IrIGy0Ij.js} +1 -1
- package/dist/assets/home-page-CNMiYKVV.js +9 -0
- package/dist/assets/{index-CY3ljPXz.js → index-2n_uhCrQ.js} +1 -1
- package/dist/assets/{index-CSPdg2ZU.js → index-35e8utiM.js} +1 -1
- package/dist/assets/{index-BShD1jQ7.js → index-5b7VjltT.js} +1 -1
- package/dist/assets/index-B-hr6ABS.css +1 -0
- package/dist/assets/index-BVP4ykSA.js +1 -0
- package/dist/assets/{index-DY5I-EkF.js → index-Ba21-oA7.js} +1 -1
- package/dist/assets/{index-_fQIRUec.js → index-Bfi4fmBc.js} +1 -1
- package/dist/assets/{index-ITfzJ14a.js → index-BsUs07E9.js} +1 -1
- package/dist/assets/{index-BWbnoj8Y.js → index-BzDF-7zA.js} +1 -1
- package/dist/assets/{index-CXiDuYZa.js → index-C3fEZ0Os.js} +1 -1
- package/dist/assets/{index-B4ldYgVb.js → index-CSsS2b0Z.js} +1 -1
- package/dist/assets/{index-BsfK2rIX.js → index-CUzcOfxz.js} +1 -1
- package/dist/assets/{index-BpaYOa_3.js → index-Cq15mGfX.js} +1 -1
- package/dist/assets/{index-OsMzp3iR.js → index-DEVx6k2J.js} +1 -1
- package/dist/assets/{index-Cr72MDh-.js → index-Dab8F8qD.js} +1 -1
- package/dist/assets/{index-BeeghgBe.js → index-DhdD-An0.js} +1 -1
- package/dist/assets/{index-ChgMImBk.js → index-Dyk-xt3p.js} +1 -1
- package/dist/assets/{index-lXvDXg2j.js → index-EbLetw4e.js} +1 -1
- package/dist/assets/{index-BV2rOIMY.js → index-JuXGMVhT.js} +1 -1
- package/dist/assets/index-txb0mb7R.js +500 -0
- package/dist/assets/infoDiagram-PH2N3AL5-Djntz0RO.js +2 -0
- package/dist/assets/journeyDiagram-U35MCT3I-CbytJqly.js +138 -0
- package/dist/assets/{kanban-definition-ILFWEQ3N-Bh2utVm3.js → kanban-definition-NDS4AKOZ-W6yBdwhF.js} +8 -9
- package/dist/assets/{layout-BlQLDmIm.js → layout-DlbUiVTi.js} +1 -1
- package/dist/assets/linear-Dj45uvUC.js +1 -0
- package/dist/assets/loro_wasm_bg-DHBNbovs.wasm +0 -0
- package/dist/assets/mermaid-CF64dWR7.js +152 -0
- package/dist/assets/min-Bi7qOXpu.js +1 -0
- package/dist/assets/{mindmap-definition-CZNETY7S-Chb5cYCH.js → mindmap-definition-ALO5MXBD-CEZNGiuh.js} +4 -4
- package/dist/assets/{pieDiagram-NIOCPIFQ-CXxsXKAZ.js → pieDiagram-IB7DONF6-Bmtf6Osx.js} +1 -1
- package/dist/assets/{quadrantDiagram-2OG54O6I-Dv05aGPQ.js → quadrantDiagram-7GDLP6J5-BJI493xo.js} +1 -1
- package/dist/assets/radar-MK3ICKWK-tcdT_E-c.js +126 -0
- package/dist/assets/{react-plotly-BJ-YqNTk.js → react-plotly-Cm8tbitC.js} +1 -1
- package/dist/assets/{requirementDiagram-SO3GGRV7-CTgwGyTs.js → requirementDiagram-KVF5MWMF-B0Dl_7g_.js} +3 -3
- package/dist/assets/run-page-D4giGLEq.js +1 -0
- package/dist/assets/{sankeyDiagram-4UZDY2LN-B0G7Ryx_.js → sankeyDiagram-QLVOVGJD-3MDzKxBN.js} +1 -1
- package/dist/assets/save-worker-DZnx0AG9.js +1 -0
- package/dist/assets/sequenceDiagram-X6HHIX6F-5W9llLvo.js +122 -0
- package/dist/assets/shutdown-button-s5kelj0_.js +17 -0
- package/dist/assets/slides-component-Bj1IZwWl.js +1 -0
- package/dist/assets/sortBy-YjMpBoem.js +1 -0
- package/dist/assets/stateDiagram-DGXRK772-CDmwph_l.js +1 -0
- package/dist/assets/stateDiagram-v2-YXO3MK2T-C-dFepoJ.js +1 -0
- package/dist/assets/storage-TQaz51Ul.js +27 -0
- package/dist/assets/{terminal-B4nePlR_.js → terminal-BoXScU3t.js} +1 -1
- package/dist/assets/{time-CQzEtHFf.js → time-uFdtyzoO.js} +1 -1
- package/dist/assets/timeline-definition-BDJGKUSR-Bc4KvRrH.js +61 -0
- package/dist/assets/tracing-C7fLEsxH.js +2 -0
- package/dist/assets/vega-component-DETxercC.js +1 -0
- package/dist/assets/worker-BbdB3qWL.js +1 -0
- package/dist/assets/worker-CnoOKJWk.js +1 -0
- package/dist/assets/xychartDiagram-VJFVF3MP-YgHFBUco.js +7 -0
- package/dist/index.html +2 -2
- package/package.json +42 -42
- package/dist/assets/_baseEach-B7w393co.js +0 -1
- package/dist/assets/_baseMap-BEnmL5hF.js +0 -1
- package/dist/assets/_baseUniq-Clg8U20K.js +0 -1
- package/dist/assets/architectureDiagram-NQ2NVSRB-Df1HpOgX.js +0 -36
- package/dist/assets/blockDiagram-PHRCVELO-DLvoV0ba.js +0 -122
- package/dist/assets/channel-B1OmbzL7.js +0 -1
- package/dist/assets/chunk-6OLS64BW-BZVop2we.js +0 -220
- package/dist/assets/chunk-BFAMUDN2-2HVFaFdI.js +0 -1
- package/dist/assets/chunk-E2GYISFI-Dk26f35F.js +0 -15
- package/dist/assets/chunk-SKB7J2MH-fh9z5QSq.js +0 -1
- package/dist/assets/classDiagram-BGRH5UQR-9_mHUN_P.js +0 -1
- package/dist/assets/classDiagram-v2-O24JOBDK-9_mHUN_P.js +0 -1
- package/dist/assets/clone-BeQslqCV.js +0 -1
- package/dist/assets/compile-g-v0TY_E.js +0 -10
- package/dist/assets/dagre-FFZHY6LT-_9IpXTtY.js +0 -4
- package/dist/assets/diagram-3EMPZRKU-Bnp38ERC.js +0 -24
- package/dist/assets/diagram-5UYTHUR4-Dp0H0lub.js +0 -24
- package/dist/assets/diagram-ZTM2IBQH-C2znpEUE.js +0 -43
- package/dist/assets/edit-page-BVPwH3qH.js +0 -144
- package/dist/assets/flowDiagram-PKI6S5ZS-3_ZJEv8v.js +0 -162
- package/dist/assets/ganttDiagram-EK5VF46D-CaKM8X9H.js +0 -267
- package/dist/assets/gitGraphDiagram-GW3U2K7C-BalmaQIN.js +0 -65
- package/dist/assets/home-page-DVels3WB.js +0 -9
- package/dist/assets/index-BEQfoZiP.js +0 -1
- package/dist/assets/index-BJy8-_8a.css +0 -1
- package/dist/assets/index-BtY7Jdn1.js +0 -503
- package/dist/assets/index-X3rQzUju.js +0 -1
- package/dist/assets/infoDiagram-RLU2ROGC-Ci_4zvlb.js +0 -2
- package/dist/assets/journeyDiagram-EWQZEKCU-D0OcyL17.js +0 -139
- package/dist/assets/linear-DjD5Vy0j.js +0 -1
- package/dist/assets/links-_JJm5AN2.js +0 -17
- package/dist/assets/loro_wasm_bg-bPYKkGLG.wasm +0 -0
- package/dist/assets/mermaid-BqsyvFzu.js +0 -152
- package/dist/assets/min-BLI9Q6Gu.js +0 -1
- package/dist/assets/run-page-Daf2t3oz.js +0 -1
- package/dist/assets/save-worker-B8gk1S9x.js +0 -1
- package/dist/assets/sequenceDiagram-ZIKVLSP4-xoDgXUuU.js +0 -122
- package/dist/assets/slides-component-DqyJs80b.js +0 -1
- package/dist/assets/sortBy-CaVkHHo_.js +0 -1
- package/dist/assets/stateDiagram-XX37X6EN-C8laQGlh.js +0 -1
- package/dist/assets/stateDiagram-v2-GD6S3NHB-CODADla5.js +0 -1
- package/dist/assets/storage-DgBSaJ-V.js +0 -25
- package/dist/assets/timeline-definition-RI47OAVP-COxxF99S.js +0 -61
- package/dist/assets/tracing-CisZiUH1.js +0 -2
- package/dist/assets/treemap-FKARHQ26-DFWMjIu3.js +0 -126
- package/dist/assets/vega-component-Brv67Rcr.js +0 -1
- package/dist/assets/worker-Ch6cKXnI.js +0 -1
- package/dist/assets/worker-VnlVW7Gg.js +0 -1
- package/dist/assets/xychartDiagram-H2YORKM3-CCT92xxI.js +0 -7
- /package/dist/assets/{links-C1rhMrxo.css → shutdown-button-C1rhMrxo.css} +0 -0
@@ -1,144 +0,0 @@
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./tracing-CisZiUH1.js","./index-BtY7Jdn1.js","./index-BJy8-_8a.css","./compile-g-v0TY_E.js","./time-CQzEtHFf.js","./timer-Bqd5yn_a.js","./linear-DjD5Vy0j.js","./init-DLRA0X12.js","./range-CtcPcB_L.js","./zoom-COrs4lFh.js","./ordinal-DDUp3AbE.js","./colors-bszWmPJw.js","./step-BwsUM5iJ.js","./arc-CfyY4LWz.js","./index-BEQfoZiP.js","./storage-DgBSaJ-V.js","./index-_fQIRUec.js","./index-DY5I-EkF.js","./index-BV2rOIMY.js","./index-CSPdg2ZU.js","./index-lXvDXg2j.js","./index-B4ldYgVb.js","./index-BsfK2rIX.js","./index-OsMzp3iR.js","./index-Cr72MDh-.js","./index-BWbnoj8Y.js","./index-ChgMImBk.js","./index-ITfzJ14a.js","./index-BeeghgBe.js","./apl-CXdQSnD-.js","./asciiarmor-D5V0T9Cu.js","./asterisk-B46aRdXb.js","./brainfuck-CtZaYBKt.js","./clike-BgBwzOhw.js","./cmake-DXn5xaP-.js","./cobol-stawOqaz.js","./coffeescript-BTDxI-eT.js","./commonlisp-vq6DHwts.js","./crystal-CRzZ78HM.js","./cypher-gJDei3ni.js","./d-BShv7fp-.js","./diff-UJJ5BM9S.js","./dockerfile-knGOOxt4.js","./simple-mode-C3vEBAcb.js","./dtd-DI9Herc-.js","./dylan-DkEP81N9.js","./ebnf-B-Df8AvO.js","./ecl-DPFc0Uaf.js","./eiffel-DR5c0IrL.js","./elm-DompmV0j.js","./erlang-BuqgqA5h.js","./factor-CFXhaUWb.js","./fcl-CVaBTCzQ.js","./forth-POgR1ypr.js","./fortran-DL7KluxX.js","./gas-bV0CklSb.js","./gherkin-B6X1vGSW.js","./groovy-DnIzCrpZ.js","./haskell-CLQs6EAM.js","./haxe-D25e-2l-.js","./http-BKJkqRj4.js","./idl-pcmmZuaN.js","./jinja2-DhgKlfW7.js","./julia-DjdwvFuI.js","./livescript-HO6ttBFx.js","./lua-8DXOpKDz.js","./mathematica-IIbmv7SK.js","./mbox-z_N2Mo3d.js","./mirc-DkvFAiy5.js","./modelica-DSrSSXCg.js","./mscgen-B2igx18G.js","./mumps-zvxmGV4l.js","./nginx-B4hAVlXN.js","./nsis-BvKfQ9lQ.js","./ntriples-BSwWqoLa.js","./octave-C4hdQ5Hf.js","./oz-qQq7irPq.js","./pascal-CafrKXZF.js","./perl-tdMlh9QA.js","./pig-CwGJVRC4.js","./powershell-D1ly3AHC.js","./properties-_nPj978X.js","./protobuf-B4y9do6W.js","./puppet-Bc-yJKzi.js","./q-B0kTJ4cI.js","./r-BA4EbLKE.js","./ruby-CR-u2WLS.js","./sas-Bqaci40L.js","./scheme-qjP0V5Ag.js","./shell-BLav31RL.js","./sieve-r025o_jW.js","./smalltalk-C7J3IyEP.js","./solr-78MBEUkU.js","./sparql-BRLJFz69.js","./spreadsheet-CGlWr0eM.js","./stylus-Bdo_Aemu.js","./swift-B_XXVlXX.js","./tcl-B2fODqDH.js","./textile-BuVhTOzU.js","./tiddlywiki-BgR6AEZu.js","./tiki-CI-ztowC.js","./toml-wcPdHu67.js","./troff-Ce85hlLp.js","./ttcn-BxnYHtq8.js","./turtle-BkSuIpt-.js","./vb-BHgjm0DN.js","./vbscript-Dawdd5GZ.js","./velocity-BdD_26Jv.js","./verilog-B4LBqg_1.js","./vhdl-CWWH2SUo.js","./webidl-CGwyPRYs.js","./xquery-CVDBqZPY.js","./yacas-I8QjZlxf.js","./z80-D8p3gKXp.js","./storage-De8XnUVS.css","./links-_JJm5AN2.js","./index-BpaYOa_3.js","./links-C1rhMrxo.css","./circle-play-N6D87sax.js","./_createAggregator-swGR0-C3.js","./_baseEach-B7w393co.js","./transform-DetRMEbJ.js","./sortBy-CaVkHHo_.js","./_baseMap-BEnmL5hF.js","./terminal-B4nePlR_.js","./terminal-WqMRJt5Z.css"])))=>i.map(i=>d[i]);
|
2
|
-
var xz=Object.defineProperty;var j3=Lt=>{throw TypeError(Lt)};var yz=(Lt,jt,fn)=>jt in Lt?xz(Lt,jt,{enumerable:!0,configurable:!0,writable:!0,value:fn}):Lt[jt]=fn;var ee=(Lt,jt,fn)=>yz(Lt,typeof jt!="symbol"?jt+"":jt,fn),wz=(Lt,jt,fn)=>jt.has(Lt)||j3("Cannot "+fn);var E3=(Lt,jt,fn)=>(wz(Lt,jt,"read from private field"),fn?fn.call(Lt):jt.get(Lt)),I3=(Lt,jt,fn)=>jt.has(Lt)?j3("Cannot add the same private member more than once"):jt instanceof WeakSet?jt.add(Lt):jt.set(Lt,fn);import{u as Oe,S as M,ij as vz,ik as kz,il as A3,im as Sz,io as Cz,ip as Nz,a as K,iq as jz,ir as Ir,is as Ez,it as tm,iu as T3,iv as Iz,iw as Az,ix as M3,iy as Jl,c as X,eF as Tz,as as dt,j as d,ai as Qn,ap as rr,ao as Es,aq as Is,bt as sr,X as Me,ar as _n,iz as Wi,an as ir,aT as Vn,at as qi,a5 as Te,a1 as Zt,dX as nm,eQ as As,iA as Mz,aO as Ke,aa as Tt,iB as Oz,eW as $n,iC as O3,iD as D3,iE as om,iF as R3,iG as Dz,L as St,dE as Kl,a_ as ar,iH as Xl,b0 as rm,aw as un,iI as Rz,a8 as Zl,iJ as Pz,iK as P3,eV as L3,$ as qt,b6 as F3,iL as z3,cG as sm,iM as Lz,dO as lt,iN as B3,dV as im,iO as Fz,iP as Ql,_ as Ue,be as Hn,iQ as ec,iR as tc,eL as Ts,iS as zz,iT as Gi,iU as Bz,eT as Uz,iV as U3,iW as V3,eo as am,iX as fo,iY as Ar,aY as nc,iZ as Vz,i_ as oc,i$ as $3,a6 as Tr,ec as H3,a7 as Yi,j0 as $z,j1 as lm,j2 as Mr,bv as Or,eM as Dr,ft as W3,gd as Rr,fI as Hz,bh as on,j3 as Wz,j4 as qz,gb as cm,aQ as rc,j5 as dm,j6 as Gz,j7 as q3,j8 as um,j9 as Yz,ja as Jz,jb as mo,jc as G3,gh as hm,jd as Ji,je as sc,et as yt,ev as Ms,jf as Ct,jg as qe,jh as ft,ji as fm,jj as Kz,jk as mm,jl as wt,jm as Y3,dy as ic,du as ac,dv as lc,dw as cc,dt as Ki,jn as Xz,fG as pm,b5 as kn,aK as Wn,fw as J3,fy as K3,fz as Zz,fE as Qz,fA as X3,jo as Z3,W as Ne,en as eB,aW as Pr,b3 as Lr,aX as Fr,b1 as Gt,eU as Sn,jp as Q3,fC as e4,jq as tB,jr as nB,fu as t4,fv as n4,js as Os,dx as o4,jt as r4,ju as oB,jv as rB,am as sB,al as iB,jw as gm,dB as aB,dD as _m,fh as dc,jx as uc,jy as hc,by as Cn,jz as lB,eP as Xi,fe as hn,bm as s4,dY as Bt,jA as cB,ei as dB,aj as bm,jB as Zi,jC as fc,jD as uB,jE as hB,jF as i4,jG as rn,aZ as fB,av as xm,gg as a4,ep as mc,jH as mB,gC as ym,bl as pc,jI as wm,ak as pB,jJ as gB,au as Qi,eG as l4,bp as _B,jK as bB,jL as c4,jM as xB,jN as yB,jO as wB,jP as vB,jQ as kB,dz as Fo,jR as SB,jS as gc,jT as Ds,o as zo,n as et,fX as Nn,jU as jn,jV as ct,jW as Rs,jX as Mt,gc as Yt,jY as vm,es as eo,jZ as CB,j_ as NB,bj as d4,bk as u4,j$ as h4,k0 as jB,gE as Ps,k1 as _c,bg as bc,gF as zr,eX as km,k2 as EB,k3 as IB,k4 as AB,k5 as TB,k6 as f4,k7 as ea,k8 as m4,k9 as MB,ka as p4,kb as g4,kc as OB,kd as _4,ke as b4,eY as xc,kf as DB,kg as x4,kh as ta,ki as na,kj as yc,kk as lr,kl as y4,km as Bo,kn as Ls,ko as Sm,kp as oa,kq as Fs,kr as Cm,ks as Nm,kt as w4,ku as wc,kv as RB,T as ra,kw as sa,kx as PB,dU as vc,ky as LB,kz as jm,kA as FB,kB as zB,kC as kc,e1 as BB,kD as Em,kE as zs,kF as Sc,kG as Bs,fW as qn,g5 as Uo,fT as v4,cr as k4,kH as Im,fF as S4,kI as Am,kJ as C4,kK as ia,kL as N4,kM as Cc,kN as Tm,kO as aa,kP as la,kQ as ca,kR as UB,fP as Nc,kS as jc,kT as Ec,eh as VB,fQ as $B,kU as HB,kV as WB,kW as qB,kX as GB,r as YB,kY as JB,kZ as KB,k_ as XB,f_ as ZB,k$ as cr,l0 as QB,l1 as j4,t as P,l2 as eU,l3 as tU,l4 as nU,l5 as oU,l6 as rU,l7 as sU,l8 as iU,l9 as aU,la as lU,lb as cU,lc as dU,ld as uU,le as hU,lf as fU,lg as mU,lh as pU,li as gU,lj as _U,lk as bU,ll as xU,lm as yU,ln as wU,lo as vU,lp as kU,lq as SU,lr as CU,ls as NU,lt as jU,lu as EU,lv as Mm,lw as Ic,lx as E4,ly as IU,lz as AU,lA as I4,lB as TU,lC as Us,lD as Gn,lE as MU,lF as OU,lG as DU,lH as RU,lI as PU,lJ as LU,lK as FU,lL as zU,lM as BU,lN as UU,lO as dr,lP as VU,lQ as $U,lR as HU,lS as WU,d_ as qU,lT as GU,lU as A4,e2 as YU,lV as Ac,lW as JU,lX as KU,lY as XU,lZ as ZU,Y as ur,l_ as Tc,l$ as QU,m0 as eV,m1 as T4,m2 as Om,gD as Vs,m3 as tV,m4 as nV,m5 as oV,m6 as rV,g3 as sV,bs as iV,a0 as Dm,m7 as M4,m8 as aV,m9 as lV,ma as Rm,mb as Pm,mc as cV,md as O4,me as D4,mf as Mc,fS as dV,ad as R4,dM as uV,mg as P4,fr as Nt,mh as da,mi as $s,mj as hV,mk as fV,ml as Lm,mm as mV,cq as Fm,mn as pV,V as hr,bi as L4,mo as gV,mp as _V,mq as Oc,mr as F4,dK as Dc,bu as z4,ms as bV,mt as xV,mu as B4,mv as yV,mw as wV,mx as U4,ae as zm,my as vV,bw as V4,mz as kV,eO as SV,mA as Vo,el as $4,mB as H4,eS as W4,fJ as Rc,mC as Bm,mD as q4,aV as Um,em as Pc,mE as G4,mF as CV,mG as NV,mH as jV,fq as EV,mI as IV,gu as AV,fx as TV,fB as Vm,gx as MV,br as Lc,mJ as OV,mK as Y4,mL as $m,mM as DV,mN as RV,mO as PV,mP as LV,mQ as J4,fj as Hm,dG as K4,mR as FV,mS as zV,mT as BV,aP as UV,mU as VV,mV as $V,mW as HV,mX as WV,ab as qV,mY as Fc,ac as GV,mZ as X4,ff as YV,m_ as Z4,af as Yn,fN as JV,m$ as KV,gs as XV,n0 as ZV,n1 as Q4,n2 as QV,n3 as Hs,n4 as e$,n5 as zc,n6 as t$,n7 as n$,z as eS,n8 as o$,dm as r$,n9 as ua,na as tS,nb as nS,nc as oS,nd as rS,ne as s$,C as sS,nf as i$,ng as a$,nh as l$,E as Br,f1 as iS,bf as c$,bd as d$,ni as u$,nj as h$,a3 as Bc,nk as f$,a4 as fr,dJ as aS,nl as Wm,nm as m$,dW as lS,nn as p$,no as cS,np as g$,nq as dS,nr as _$,ns as b$,nt as uS,nu as hS,nv as fS,fd as mS,nw as x$,nx as y$,ny as pS,nz as gS,nA as Uc,nB as _S,nC as bS,nD as w$,nE as xS,nF as v$,nG as k$,nH as yS,nI as S$,nJ as C$,nK as N$,nL as j$,nM as E$,nN as I$,dT as A$,nO as T$,nP as M$,g4 as qm,nQ as O$,nR as D$,nS as R$,nT as P$,nU as L$,nV as F$,nW as z$,nX as B$,nY as U$,nZ as V$,n_ as Gm,n$ as $$,fV as H$,o0 as W$,o1 as q$,o2 as G$,o3 as wS,o4 as Y$,a9 as J$,o5 as K$,a2 as X$,eI as Z$,gm as Q$,o6 as eH,o7 as tH,go as Ym,gk as Ws,gp as Ur,gl as Vr,gq as Jm,gr as Km,o8 as vS,gn as nH,o9 as kS,oa as oH,ob as SS,oc as mr,od as CS,gw as rH,oe as sH,of as iH,og as aH,oh as lH,oi as cH,oj as dH,ok as NS,ez as uH,ol as Xm,ax as Vc,om as jS,on as ES,az as IS,ay as hH,dS as fH,__tla as mH}from"./index-BtY7Jdn1.js";import{b as qs,A as pH,L as AS,g as gH,G as _H,o as TS,s as bH,k as xH,B as MS,a as yH,M as wH,Y as vH,c as bn,u as ha,C as kH,S as SH,K as CH,d as NH,i as jH,e as OS,f as EH,h as IH,j as fa,P as ma,l as DS,m as AH,n as TH,p as MH,q as OH,r as RS,t as Zm,T as DH}from"./links-_JJm5AN2.js";import{V as PS,d as Gs,I as Qm,N as LS,S as FS,e as zS,f as BS,L as US,g as VS,F as $S,M as RH,l as HS,h as PH,j as po,k as $c,m as Hc,i as LH,E as WS,n as FH,o as ep,p as zH,q as BH,s as UH,t as VH,v as $H,w as HH,x as WH,y as qH,a as GH,C as YH,R as qS,A as JH,b as KH,T as XH,z as ZH,B as QH,D as eW,G as tW,O as nW,c as oW,P as rW,__tla as sW}from"./storage-DgBSaJ-V.js";import{c as iW}from"./_createAggregator-swGR0-C3.js";import{s as to,i as pr,T as tp,a as np}from"./transform-DetRMEbJ.js";import{g as GS}from"./timer-Bqd5yn_a.js";import{i as aW}from"./zoom-COrs4lFh.js";import{s as pa}from"./sortBy-CaVkHHo_.js";let op,Wc,xn,qc,YS,ga,lW=Promise.all([(()=>{try{return mH}catch{}})(),(()=>{try{return sW}catch{}})()]).then(async()=>{var Yl,S3;var Lt=iW(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]});let jt,fn,rp,Gc,Ys,$r,sp,ip,ap,lp,_a,Yc,cp,ba,dp,Jc,up,hp,Kc,fp,mp,pp,xa,gp,Xc,_p,bp,xp,yp,wp,vp,Zc,kp,Qc,ed,Sp,Cp,Np,jp,Ep,ya,Ip,Ap,td,Tp,Mp,Op,nd,Dp,Rp,Pp,wa,od,rd,Lp,Fp,zp,Bp,Up,Vp,$p,Hp,Wp,sd,id,qp,Gp,Yp,va,En,In;jt=Oe("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),fn=Oe("arrow-right-to-line",[["path",{d:"M17 12H3",key:"8awo09"}],["path",{d:"m11 18 6-6-6-6",key:"8c2y43"}],["path",{d:"M21 5v14",key:"nzette"}]]),rp=Oe("arrow-right-from-line",[["path",{d:"M3 5v14",key:"1nt18q"}],["path",{d:"M21 12H7",key:"13ipq5"}],["path",{d:"m15 18 6-6-6-6",key:"6tx3qv"}]]),Gc=Oe("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),Ys=Oe("ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]),$r=Oe("between-horizontal-start",[["rect",{width:"13",height:"7",x:"8",y:"3",rx:"1",key:"pkso9a"}],["path",{d:"m2 9 3 3-3 3",key:"1agib5"}],["rect",{width:"13",height:"7",x:"8",y:"14",rx:"1",key:"1q5fc1"}]]),sp=Oe("chevrons-down",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]),ip=Oe("chevrons-up",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]),qc=Oe("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),ap=Oe("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),lp=Oe("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),_a=Oe("circle-plus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]),Yc=Oe("clipboard-copy",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]),cp=Oe("clipboard-paste",[["path",{d:"M11 14h10",key:"1w8e9d"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344",key:"1e62lh"}],["path",{d:"m17 18 4-4-4-4",key:"z2g111"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113",key:"bjbb7m"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]]),ba=Oe("cloud-download",[["path",{d:"M12 13v8l-4-4",key:"1f5nwf"}],["path",{d:"m12 21 4-4",key:"1lfcce"}],["path",{d:"M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284",key:"ui1hmy"}]]),dp=Oe("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]),Jc=Oe("command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]),up=Oe("copy-minus",[["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]),hp=Oe("diamond-plus",[["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z",key:"1ey20j"}],["path",{d:"M8 12h8",key:"1wcyev"}]]),Kc=Oe("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]),fp=Oe("eraser",[["path",{d:"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",key:"g5wo59"}],["path",{d:"m5.082 11.09 8.828 8.828",key:"1wx5vj"}]]),mp=Oe("fast-forward",[["polygon",{points:"13 19 22 12 13 5 13 19",key:"587y9g"}],["polygon",{points:"2 19 11 12 2 5 2 19",key:"3pweh0"}]]),pp=Oe("file-pen",[["path",{d:"M12.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v9.5",key:"1couwa"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]]),xa=Oe("file-plus-2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 15h6",key:"4e2qda"}],["path",{d:"M6 12v6",key:"1u72j0"}]]),gp=Oe("files",[["path",{d:"M20 7h-3a2 2 0 0 1-2-2V2",key:"x099mo"}],["path",{d:"M9 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7l4 4v10a2 2 0 0 1-2 2Z",key:"18t6ie"}],["path",{d:"M3 7.6v12.8A1.6 1.6 0 0 0 4.6 22h9.8",key:"1nja0z"}]]),Xc=Oe("folder-plus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),_p=Oe("folder-tree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]),bp=Oe("grip-vertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]),xp=Oe("hard-drive-download",[["path",{d:"M12 2v8",key:"1q4o3n"}],["path",{d:"m16 6-4 4-4-4",key:"6wukr"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",key:"w68u3i"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M10 18h.01",key:"h775k"}]]),yp=Oe("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]),wp=Oe("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]),vp=Oe("key-round",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]),Zc=Oe("key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]),kp=Oe("keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]),Qc=Oe("layout-template",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]),ed=Oe("list-tree",[["path",{d:"M21 12h-8",key:"1bmf0i"}],["path",{d:"M21 6H8",key:"1pqkrb"}],["path",{d:"M21 18h-8",key:"1tm79t"}],["path",{d:"M3 6v4c0 1.1.9 2 2 2h3",key:"1ywdgy"}],["path",{d:"M3 10v6c0 1.1.9 2 2 2h3",key:"2wc746"}]]),Sp=Oe("list",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]),Cp=Oe("map-pin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]),Np=Oe("memory-stick",[["path",{d:"M6 19v-3",key:"1nvgqn"}],["path",{d:"M10 19v-3",key:"iu8nkm"}],["path",{d:"M14 19v-3",key:"kcehxu"}],["path",{d:"M18 19v-3",key:"1vh91z"}],["path",{d:"M8 11V9",key:"63erz4"}],["path",{d:"M16 11V9",key:"fru6f3"}],["path",{d:"M12 11V9",key:"ha00sb"}],["path",{d:"M2 15h20",key:"16ne18"}],["path",{d:"M2 7a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v1.1a2 2 0 0 0 0 3.837V17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-5.1a2 2 0 0 0 0-3.837Z",key:"lhddv3"}]]),jp=Oe("message-circle-question-mark",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),Ep=Oe("microchip",[["path",{d:"M18 12h2",key:"quuxs7"}],["path",{d:"M18 16h2",key:"zsn3lv"}],["path",{d:"M18 20h2",key:"9x5y9y"}],["path",{d:"M18 4h2",key:"1luxfb"}],["path",{d:"M18 8h2",key:"nxqzg"}],["path",{d:"M4 12h2",key:"1ltxp0"}],["path",{d:"M4 16h2",key:"8a5zha"}],["path",{d:"M4 20h2",key:"27dk57"}],["path",{d:"M4 4h2",key:"10groj"}],["path",{d:"M4 8h2",key:"18vq6w"}],["path",{d:"M8 2a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2h-1.5c-.276 0-.494.227-.562.495a2 2 0 0 1-3.876 0C9.994 2.227 9.776 2 9.5 2z",key:"1681fp"}]]),ya=Oe("network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]),Ip=Oe("octagon-alert",[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]]),Ap=Oe("package-check",[["path",{d:"m16 16 2 2 4-4",key:"gfu2re"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]),td=Oe("package-x",[["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}],["path",{d:"m17 13 5 5m-5 0 5-5",key:"im3w4b"}]]),Tp=Oe("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Mp=Oe("party-popper",[["path",{d:"M5.8 11.3 2 22l10.7-3.79",key:"gwxi1d"}],["path",{d:"M4 3h.01",key:"1vcuye"}],["path",{d:"M22 8h.01",key:"1mrtc2"}],["path",{d:"M15 2h.01",key:"1cjtqr"}],["path",{d:"M22 20h.01",key:"1mrys2"}],["path",{d:"m22 2-2.24.75a2.9 2.9 0 0 0-1.96 3.12c.1.86-.57 1.63-1.45 1.63h-.38c-.86 0-1.6.6-1.76 1.44L14 10",key:"hbicv8"}],["path",{d:"m22 13-.82-.33c-.86-.34-1.82.2-1.98 1.11c-.11.7-.72 1.22-1.43 1.22H17",key:"1i94pl"}],["path",{d:"m11 2 .33.82c.34.86-.2 1.82-1.11 1.98C9.52 4.9 9 5.52 9 6.23V7",key:"1cofks"}],["path",{d:"M11 13c1.93 1.93 2.83 4.17 2 5-.83.83-3.07-.07-5-2-1.93-1.93-2.83-4.17-2-5 .83-.83 3.07.07 5 2Z",key:"4kbmks"}]]),Op=Oe("pen-line",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]),nd=Oe("presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]),Dp=Oe("regex",[["path",{d:"M17 3v10",key:"15fgeh"}],["path",{d:"m12.67 5.5 8.66 5",key:"1gpheq"}],["path",{d:"m12.67 10.5 8.66-5",key:"1dkfa6"}],["path",{d:"M9 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-2z",key:"swwfx4"}]]),Rp=Oe("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]),Pp=Oe("rows-3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]]),wa=Oe("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]),od=Oe("scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]),rd=Oe("scroll-text",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]),Lp=Oe("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),Fp=Oe("square-code",[["path",{d:"m10 9-3 3 3 3",key:"1oro0q"}],["path",{d:"m14 15 3-3-3-3",key:"bz13h7"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]),zp=Oe("square-dashed-bottom-code",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["path",{d:"M5 21a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2",key:"as5y1o"}],["path",{d:"M9 21h1",key:"15o7lz"}]]),Bp=Oe("square-equal",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 10h10",key:"1101jm"}],["path",{d:"M7 14h10",key:"1mhdw3"}]]),Up=Oe("square-m",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 16V8l4 4 4-4v8",key:"141u4e"}]]),Vp=Oe("square-play",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m9 8 6 4-6 4Z",key:"f1r3lt"}]]),$p=Oe("square-power",[["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M7.998 9.003a5 5 0 1 0 8-.005",key:"1pek45"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]),Hp=Oe("square-terminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]),Wp=Oe("text-cursor-input",[["path",{d:"M12 20h-1a2 2 0 0 1-2-2 2 2 0 0 1-2 2H6",key:"1528k5"}],["path",{d:"M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7",key:"13ksps"}],["path",{d:"M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1",key:"1n9rhb"}],["path",{d:"M6 4h1a2 2 0 0 1 2 2 2 2 0 0 1 2-2h1",key:"1mj8rg"}],["path",{d:"M9 6v12",key:"velyjx"}]]),sd=Oe("text-search",[["path",{d:"M21 6H3",key:"1jwq7v"}],["path",{d:"M10 12H3",key:"1ulcyk"}],["path",{d:"M10 18H3",key:"13769t"}],["circle",{cx:"17",cy:"15",r:"3",key:"1upz2a"}],["path",{d:"m21 19-1.9-1.9",key:"dwi7p8"}]]),id=Oe("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]),qp=Oe("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]),Gp=Oe("view",[["path",{d:"M21 17v2a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-2",key:"mrq65r"}],["path",{d:"M21 7V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2",key:"be3xqs"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0",key:"11ak4c"}]]),Yp=Oe("whole-word",[["circle",{cx:"7",cy:"12",r:"3",key:"12clwm"}],["path",{d:"M10 9v6",key:"17i7lo"}],["circle",{cx:"17",cy:"12",r:"3",key:"gl7c2s"}],["path",{d:"M14 7v8",key:"dl84cr"}],["path",{d:"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1",key:"lt2kga"}]]),va=Oe("workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]),En=Oe("zap-off",[["path",{d:"M10.513 4.856 13.12 2.17a.5.5 0 0 1 .86.46l-1.377 4.317",key:"193nxd"}],["path",{d:"M15.656 10H20a1 1 0 0 1 .78 1.63l-1.72 1.773",key:"27a7lr"}],["path",{d:"M16.273 16.273 10.88 21.83a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14H4a1 1 0 0 1-.78-1.63l4.507-4.643",key:"1e0qe9"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),In=Oe("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);const JS=M.createContext({}),KS=M.forwardRef(function(t,e){[t,e]=Cz(t,e,JS);let{toolbarProps:n}=function(s,i){const{"aria-label":a,"aria-labelledby":l,orientation:c="horizontal"}=s;let[u,h]=M.useState(!1);vz(()=>{var p;h(!(!i.current||!(!((p=i.current.parentElement)===null||p===void 0)&&p.closest('[role="toolbar"]'))))});const{direction:f}=kz(),m=f==="rtl"&&c==="horizontal";let _=Sz(i);const g=M.useRef(null);return{toolbarProps:{...A3(s,{labelable:!0}),role:u?"group":"toolbar","aria-orientation":c,"aria-label":a,"aria-labelledby":a==null?l:void 0,onKeyDownCapture:u?void 0:p=>{if(p.currentTarget.contains(p.target)){if(c==="horizontal"&&p.key==="ArrowRight"||c==="vertical"&&p.key==="ArrowDown")m?_.focusPrevious():_.focusNext();else{if(!(c==="horizontal"&&p.key==="ArrowLeft"||c==="vertical"&&p.key==="ArrowUp"))return p.key==="Tab"?(p.stopPropagation(),g.current=document.activeElement,void(p.shiftKey?_.focusFirst():_.focusLast())):void 0;m?_.focusNext():_.focusPrevious()}p.stopPropagation(),p.preventDefault()}},onFocusCapture:u?void 0:p=>{var b,x;g.current&&!p.currentTarget.contains(p.relatedTarget)&&(!((b=i.current)===null||b===void 0)&&b.contains(p.target))&&((x=g.current)===null||x===void 0||x.focus(),g.current=null)},onBlurCapture:u?void 0:p=>{p.currentTarget.contains(p.relatedTarget)||g.current||(g.current=p.target)}}}}(t,e),o=Nz({...t,values:{orientation:t.orientation||"horizontal"},defaultClassName:"react-aria-Toolbar"}),r=A3(t);return delete r.id,K.createElement("div",{...jz(n,r),...o,ref:e,slot:t.slot||void 0,"data-orientation":t.orientation||"horizontal"},o.children)});function ka(t,e){const n=+Ir(t)-+Ir(e);return n<0?-1:n>0?1:n}function XS(t,e){const n=Ir(t,e==null?void 0:e.in);return+function(o,r){const s=Ir(o,r==null?void 0:r.in);return s.setHours(23,59,59,999),s}(n,e)==+function(o,r){const s=Ir(o,r==null?void 0:r.in),i=s.getMonth();return s.setFullYear(s.getFullYear(),i+1,0),s.setHours(23,59,59,999),s}(n,e)}function ZS(t,e,n){const[o,r,s]=tm(n==null?void 0:n.in,t,t,e),i=ka(r,s),a=Math.abs(function(u,h,f){const[m,_]=tm(f==null?void 0:f.in,u,h);return 12*(m.getFullYear()-_.getFullYear())+(m.getMonth()-_.getMonth())}(r,s));if(a<1)return 0;r.getMonth()===1&&r.getDate()>27&&r.setDate(30),r.setMonth(r.getMonth()-i*a);let l=ka(r,s)===-i;XS(o)&&a===1&&ka(o,s)===1&&(l=!1);const c=i*(a-+l);return c===0?0:c}function QS(t,e,n){const o=function(r,s){return+Ir(r)-+Ir(s)}(t,e)/1e3;return(r=>{const s=(0,Math.trunc)(r);return s===0?0:s})(o)}function eC(t,e){return function(n,o,r){const s=Iz(),i=(r==null?void 0:r.locale)??s.locale??Az,a=ka(n,o);if(isNaN(a))throw new RangeError("Invalid time value");const l=Object.assign({},r,{addSuffix:r==null?void 0:r.addSuffix,comparison:a}),[c,u]=tm(r==null?void 0:r.in,...a>0?[o,n]:[n,o]),h=QS(u,c),f=(T3(u)-T3(c))/1e3,m=Math.round((h-f)/60);let _;if(m<2)return m===0?i.formatDistance("lessThanXMinutes",1,l):i.formatDistance("xMinutes",m,l);if(m<45)return i.formatDistance("xMinutes",m,l);if(m<90)return i.formatDistance("aboutXHours",1,l);if(m<M3){const g=Math.round(m/60);return i.formatDistance("aboutXHours",g,l)}if(m<2520)return i.formatDistance("xDays",1,l);if(m<Jl){const g=Math.round(m/M3);return i.formatDistance("xDays",g,l)}if(m<2*Jl)return _=Math.round(m/Jl),i.formatDistance("aboutXMonths",_,l);if(_=ZS(u,c),_<12){const g=Math.round(m/Jl);return i.formatDistance("xMonths",g,l)}{const g=_%12,p=Math.trunc(_/12);return g<3?i.formatDistance("aboutXYears",p,l):g<9?i.formatDistance("overXYears",p,l):i.formatDistance("almostXYears",p+1,l)}}(t,function(n){return Ez(n,Date.now())}(t),e)}const Sa="https://static.marimo.app",tC=t=>{const e=X.c(24),{onClose:n}=t,[o,r]=M.useState("");let s;s=Math.random().toString(36).slice(2,6);const i=`${o}-${s}`,a=`${Sa}/static/${i}`;let l,c,u,h,f,m,_,g,p,b,x;return e[0]!==n||e[1]!==i?(l=async y=>{y.preventDefault(),n();const v=await Tz({download:!1,includeCode:!0,files:PS.INSTANCE.filenames()}),C=dt({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${Sa}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:v,path:i})}).catch(()=>{C.dismiss(),dt({title:"Error uploading static page",description:d.jsxs("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",d.jsx("a",{href:Qn.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),C.dismiss(),dt({title:"Static page uploaded!",description:d.jsxs("div",{children:["The URL has been copied to your clipboard.",d.jsx("br",{}),"You can share it with anyone."]})})},e[0]=n,e[1]=i,e[2]=l):l=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(rr,{children:"Share static notebook"}),e[3]=c):c=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(u=d.jsxs(Es,{children:[c,d.jsxs(Is,{children:["You can publish a static, non-interactive version of this notebook to the public web. We will create a link for you that lives on"," ",d.jsx("a",{href:Sa,target:"_blank",children:Sa}),"."]})]}),e[4]=u):u=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(h=y=>{const v=y.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,"");r(v)},e[5]=h):h=e[5],e[6]!==o?(f=d.jsx(sr,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:h,required:!0,autoComplete:"off"}),e[6]=o,e[7]=f):f=e[7],e[8]!==a?(m=d.jsxs("div",{className:"font-semibold text-sm text-muted-foreground gap-2 flex flex-col",children:["Anyone will be able to access your notebook at this URL:",d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(nC,{text:a}),d.jsx("span",{className:"text-primary",children:a})]})]}),e[8]=a,e[9]=m):m=e[9],e[10]!==f||e[11]!==m?(_=d.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[f,m]}),e[10]=f,e[11]=m,e[12]=_):_=e[12],e[13]!==n?(g=d.jsx(Me,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),e[13]=n,e[14]=g):g=e[14],e[15]!==a?(p=d.jsx(Me,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await _n(a)},children:"Create"}),e[15]=a,e[16]=p):p=e[16],e[17]!==p||e[18]!==g?(b=d.jsxs(Wi,{children:[g,p]}),e[17]=p,e[18]=g,e[19]=b):b=e[19],e[20]!==b||e[21]!==l||e[22]!==_?(x=d.jsx(ir,{className:"w-fit",children:d.jsxs("form",{onSubmit:l,children:[u,_,b]})}),e[20]=b,e[21]=l,e[22]=_,e[23]=x):x=e[23],x},nC=t=>{const e=X.c(8),[n,o]=K.useState(!1);let r;e[0]!==t.text?(r=Vn.stopPropagation(async c=>{c.preventDefault(),await _n(t.text),o(!0),setTimeout(()=>o(!1),2e3)}),e[0]=t.text,e[1]=r):r=e[1];const s=r;let i,a,l;return e[2]===Symbol.for("react.memo_cache_sentinel")?(i=d.jsx(qi,{size:14,strokeWidth:1.5}),e[2]=i):i=e[2],e[3]!==s?(a=d.jsx(Me,{"data-testid":"copy-static-notebook-url-button",onClick:s,size:"xs",variant:"secondary",children:i}),e[3]=s,e[4]=a):a=e[4],e[5]!==n||e[6]!==a?(l=d.jsx(Te,{content:"Copied!",open:n,children:a}),e[5]=n,e[6]=a,e[7]=l):l=e[7],l};function Jp(){const t=X.c(2),e=Zt(nm);let n;return t[0]!==e?(n=()=>{const o=document.getElementsByClassName("output-area"),r=window.innerHeight||document.documentElement.clientHeight;let s=null;for(const i of Array.from(o)){const a=i.getBoundingClientRect();if(a.top>=0&&a.top<=r||a.bottom>=0&&a.bottom<=r){s=As.parse(i.parentNode.id);break}}e(i=>({mode:Mz(i.mode),cellAnchor:s})),requestAnimationFrame(()=>{var i;s!==null&&((i=document.getElementById(As.create(s)))==null||i.scrollIntoView())})},t[0]=e,t[1]=n):n=t[1],n}function ad(t){const e=X.c(3),n=ld();let o;return e[0]!==t||e[1]!==n?(o=()=>{t!==void 0&&n([t])},e[0]=t,e[1]=n,e[2]=o):o=e[2],Ke(o)}function Kp(){const t=X.c(2),e=ld();let n;return t[0]!==e?(n=()=>e(O3($n())),t[0]=e,t[1]=n):n=t[1],Ke(n)}function ld(){const t=X.c(2),{prepareForRun:e}=Tt();let n;return t[0]!==e?(n=async o=>{var a,l;if(o.length===0)return;const{cellHandles:r,cellData:s}=$n(),i=[];for(const c of o){const u=r[c],h=(a=u==null?void 0:u.current)==null?void 0:a.editorView;let f;h?(D3(h)!=="markdown"&&om(h),f=R3(h)):f=((l=s[c])==null?void 0:l.code)||"",i.push(f),e({cellId:c})}await Dz({cellIds:o,codes:i}).catch(oC)},t[0]=e,t[1]=n):n=t[1],Ke(n)}function oC(t){St.error(t)}const cd=[{type:"files",Icon:_p,tooltip:"View files",position:"sidebar"},{type:"variables",Icon:Kl,tooltip:"Explore variables",position:"sidebar"},{type:"datasources",Icon:ar,tooltip:"Explore data sources",position:"sidebar"},{type:"dependencies",Icon:ya,tooltip:"Explore dependencies",position:"sidebar"},{type:"packages",Icon:qs,tooltip:"Manage packages",position:"sidebar"},{type:"outline",Icon:rd,tooltip:"View outline",position:"sidebar"},{type:"chat",Icon:Xl,tooltip:"Chat with AI",position:"sidebar"},{type:"documentation",Icon:sd,tooltip:"View live docs",position:"sidebar"},{type:"logs",Icon:rm,tooltip:"Notebook logs",position:"sidebar"},{type:"tracing",Icon:pH,tooltip:"Tracing",position:"sidebar"},{type:"snippets",Icon:zp,tooltip:"Snippets",position:"sidebar"},{type:"secrets",Icon:vp,tooltip:"Secrets",hidden:un(),position:"sidebar"},{type:"scratchpad",Icon:Rz,tooltip:"Scratchpad",position:"sidebar"},{type:"errors",Icon:Zl,tooltip:"View errors",position:"footer"}];function rC(){const t=X.c(7);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],t[0]=e):e=t[0];const[n,o]=function(i,a){const l=X.c(11);let c;l[0]!==a?(c=new Pz(a),l[0]=a,l[1]=c):c=l[1];const u=c;let h;l[2]!==i||l[3]!==u?(h=()=>u.get(i),l[2]=i,l[3]=u,l[4]=h):h=l[4];const[f,m]=M.useState(h);let _;l[5]!==i||l[6]!==u?(_=b=>{m(b),u.set(i,b)},l[5]=i,l[6]=u,l[7]=_):_=l[7];const g=_;let p;return l[8]!==g||l[9]!==f?(p=[f,g],l[8]=g,l[9]=f,l[10]=p):p=l[10],p}("marimo:commands",e);let r,s;return t[1]!==n||t[2]!==o?(r=i=>{const a=(l=[i,...n],[...new Set(l)]);var l;o(a.slice(0,3))},t[1]=n,t[2]=o,t[3]=r):r=t[3],t[4]!==n||t[5]!==r?(s={recentCommands:n,addRecentCommand:r},t[4]=n,t[5]=r,t[6]=s):s=t[6],s}function Xp(t){return t.dropdown!==void 0}function Ca(t,e=""){return t.flatMap(n=>n.label?Xp(n)?Ca(n.dropdown,`${e+n.label} > `):{...n,label:e+n.label}:[])}const Js=t=>{const e=X.c(8),{children:n,layerTop:o}=t,r=o!==void 0&&o;let s;e[0]!==n?(s=K.Children.toArray(n),e[0]=n,e[1]=s):s=e[1];const[i,a]=s,l=`second-icon absolute ${r?"top-[-2px] left-[-2px]":"bottom-[-2px] right-[-2px]"} rounded-full`;let c,u;return e[2]!==a||e[3]!==l?(c=d.jsx("div",{className:l,children:a}),e[2]=a,e[3]=l,e[4]=c):c=e[4],e[5]!==i||e[6]!==c?(u=d.jsxs("div",{className:"multi-icon relative w-fit",children:[i,c]}),e[5]=i,e[6]=c,e[7]=u):u=e[7],u},Na=qt(null),sC=qt(!1),dd=F3("marimo:ai:chatState:v3",{chats:[],activeChatId:null}),iC=qt(t=>{const e=t(dd);return e.chats.find(n=>n.id===e.activeChatId)},(t,e,n)=>{e(dd,o=>({...o,activeChatId:n}))});function Zp(t){return t!==z3&&!!(t&&t.trim().length>0)}const ud=t=>{const e=X.c(7);let n,o;e[0]!==t?(n=a=>{var l;(a.ctrlKey||a.metaKey)&&a.key==="z"&&(a.preventDefault(),a.stopPropagation(),(l=t.onClick)==null||l.call(t,a))},e[0]=t,e[1]=n):n=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(o={capture:!0},e[2]=o):o=e[2],sm(window,"keydown",n,o);const r=t.children??"Undo";let s,i;return e[3]===Symbol.for("react.memo_cache_sentinel")?(s=d.jsx(Lz,{className:"ml-2",shortcut:"cmd-z"}),e[3]=s):s=e[3],e[4]!==r||e[5]!==t?(i=d.jsxs(Me,{"data-testid":"undo-button",size:"sm",variant:"outline",...t,children:[r," ",s]}),e[4]=r,e[5]=t,e[6]=i):i=e[6],i};function hd(){const t=X.c(3),{deleteCell:e,undoDeleteCell:n}=Tt();let o;return t[0]!==e||t[1]!==n?(o=r=>{var l;if(lt.get(B3))return;const{cellId:s}=r,i=lt.get(im),a=(((l=i.cellData[s])==null?void 0:l.code)??"").trim()==="";if(e({cellId:s}),Fz({cellId:s}).catch(()=>{n()}),!a){const{dismiss:c}=dt({title:"Cell deleted",description:"You can bring it back by clicking undo or through the command palette.",action:d.jsx(ud,{"data-testid":"undo-delete-button",onClick:()=>{n(),u()}})}),u=c}},t[0]=e,t[1]=n,t[2]=o):o=t[2],Ke(o)}function Qp(){const t=X.c(3),{splitCell:e,undoSplitCell:n}=Tt();let o;return t[0]!==e||t[1]!==n?(o=r=>{const s=Ql(r.cellId);if(!s)return;const i=R3(s);e(r);const{dismiss:a}=dt({title:"Cell split",action:d.jsx(ud,{"data-testid":"undo-split-button",size:"sm",variant:"outline",onClick:()=>{n({...r,snapshot:i}),l()},children:"Undo"})}),l=a},t[0]=e,t[1]=n,t[2]=o):o=t[2],Ke(o)}function fd(t){const e=X.c(49),{cell:n}=t,{createNewCell:o,updateCellConfig:r,updateCellName:s,moveCell:i,sendToTop:a,sendToBottom:l,addColumnBreakpoint:c,clearCellOutput:u}=Tt(),h=Qp(),f=ad(n==null?void 0:n.cellId),m=!Ue(B3),_=hd(),{openModal:g}=Hn(),p=Zt(Na),b=Ue(ec),x=Ue(tc),y=Ue(Ts),v=Ue(zz);if(!n||y){let E;return e[0]===Symbol.for("react.memo_cache_sentinel")?(E=[],e[0]=E):E=e[0],E}const{cellId:C,config:k,getEditorView:N,name:j,hasOutput:I,hasConsoleOutput:T,status:A}=n;let R;e[1]!==C||e[2]!==k.disabled||e[3]!==r?(R=async()=>{const E={disabled:!k.disabled};await Mr({configs:{[C]:E}}),r({cellId:C,config:E})},e[1]=C,e[2]=k.disabled,e[3]=r,e[4]=R):R=e[4];const z=R;let D;e[5]!==C||e[6]!==k.hide_code||e[7]!==N||e[8]!==r?(D=async()=>{const E={hide_code:!k.hide_code};await Mr({configs:{[C]:E}}),r({cellId:C,config:E});const W=N();W&&(E.hide_code?W.contentDOM.blur():W.focus())},e[5]=C,e[6]=k.hide_code,e[7]=N,e[8]=r,e[9]=D):D=e[9];const F=D;let B,U,O,S,$;return e[10]===Symbol.for("react.memo_cache_sentinel")?(B=d.jsx(Wp,{size:13,strokeWidth:1.5}),e[10]=B):B=e[10],e[11]!==C||e[12]!==j||e[13]!==g||e[14]!==s?(U=()=>{g(d.jsxs(ir,{children:[d.jsx(Es,{children:d.jsx(rr,{children:"Rename cell"})}),d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx(Or,{htmlFor:"cell-name",children:"Cell name"}),d.jsx(LS,{placeholder:"cell name",value:j,onKeyDown:E=>{E.key==="Enter"&&(E.preventDefault(),E.stopPropagation(),g(null))},onChange:E=>s({cellId:C,name:E})})]})]}))},e[11]=C,e[12]=j,e[13]=g,e[14]=s,e[15]=U):U=e[15],e[16]!==C||e[17]!==s?(O=E=>s({cellId:C,name:E}),e[16]=C,e[17]=s,e[18]=O):O=e[18],e[19]!==j||e[20]!==O?(S=d.jsx(LS,{placeholder:"cell name",value:j,onChange:O}),e[19]=j,e[20]=O,e[21]=S):S=e[21],e[22]!==c||e[23]!==b||e[24]!==v||e[25]!==x||e[26]!==m||e[27]!==C||e[28]!==u||e[29]!==k.disabled||e[30]!==k.hide_code||e[31]!==o||e[32]!==_||e[33]!==N||e[34]!==T||e[35]!==I||e[36]!==i||e[37]!==j||e[38]!==f||e[39]!==l||e[40]!==a||e[41]!==p||e[42]!==h||e[43]!==A||e[44]!==U||e[45]!==S||e[46]!==z||e[47]!==F?($=[[{icon:B,label:"Name",disableClick:!0,handle:dC,handleHeadless:U,rightElement:S},{icon:d.jsx(Gs,{size:13,strokeWidth:1.5}),label:"Run cell",hotkey:"cell.run",hidden:A==="running"||A==="queued"||A==="disabled-transitively"||k.disabled,handle:()=>f()},{icon:d.jsx(Gi,{size:13,strokeWidth:1.5}),label:"AI completion",hidden:!b,handle:()=>{p(E=>(E==null?void 0:E.cellId)===C?null:{cellId:C})},hotkey:"cell.aiCompletion"},{icon:d.jsx(od,{size:13,strokeWidth:1.5}),label:"Split cell",hotkey:"cell.splitCell",handle:()=>h({cellId:C})},{icon:d.jsx(Qm,{size:13,strokeWidth:1.5}),label:"Export output as PNG",hidden:!I,handle:()=>function(E){const W=document.getElementById(P3.create(E));W&&(W.classList.add("printing-output"),L3(W,"result.png").finally(()=>{W.classList.remove("printing-output")}))}(C)},{icon:d.jsx(Uz,{size:13,strokeWidth:1.5}),label:"Format cell",hotkey:"cell.format",handle:()=>{const E=N();E&&Bz({[C]:E})}},{icon:k.hide_code?d.jsx(U3,{size:13,strokeWidth:1.5}):d.jsx(V3,{size:13,strokeWidth:1.5}),label:k.hide_code?"Show code":"Hide code",handle:F,hotkey:"cell.hideCode"},{icon:k.disabled?d.jsx(En,{size:13,strokeWidth:1.5}):d.jsx(In,{size:13,strokeWidth:1.5}),label:"Reactive execution",rightElement:d.jsx(am,{"data-testid":"cell-disable-switch",checked:!k.disabled,size:"sm",onCheckedChange:z}),handle:z},{icon:d.jsx(Zl,{size:13,strokeWidth:1.5}),label:"Clear output",hidden:!(I||T),handle:()=>{u({cellId:C})}}],[{icon:d.jsx(nc,{}),label:"Convert to Markdown",hotkey:"cell.viewAsMarkdown",handle:()=>{const E=N();E&&(fo(x,o),Ar(E,"markdown",{keepCodeAsIs:!1}))}},{icon:d.jsx(ar,{size:13,strokeWidth:1.5}),label:"Convert to SQL",handle:()=>{const E=N();E&&(fo(x,o),Ar(E,"sql",{keepCodeAsIs:!1}))}},{icon:d.jsx(oc,{}),label:"Toggle as Python",handle:()=>{const E=N();E&&(fo(x,o),Vz(E,"python",{force:!0}))}}],[{icon:d.jsxs(Js,{children:[d.jsx(_a,{size:13,strokeWidth:1.5}),d.jsx($3,{size:8,strokeWidth:2})]}),label:"Create cell above",hotkey:"cell.createAbove",handle:()=>o({cellId:C,before:!0})},{icon:d.jsxs(Js,{children:[d.jsx(_a,{size:13,strokeWidth:1.5}),d.jsx(Tr,{size:8,strokeWidth:2})]}),label:"Create cell below",hotkey:"cell.createBelow",handle:()=>o({cellId:C,before:!1})},{icon:d.jsx($3,{size:13,strokeWidth:1.5}),label:"Move cell up",hotkey:"cell.moveUp",handle:()=>i({cellId:C,before:!0})},{icon:d.jsx(Tr,{size:13,strokeWidth:1.5}),label:"Move cell down",hotkey:"cell.moveDown",handle:()=>i({cellId:C,before:!1})},{icon:d.jsx(H3,{size:13,strokeWidth:1.5}),label:"Move cell left",hotkey:"cell.moveLeft",handle:()=>i({cellId:C,direction:"left"}),hidden:v!=="columns"},{icon:d.jsx(Yi,{size:13,strokeWidth:1.5}),label:"Move cell right",hotkey:"cell.moveRight",handle:()=>i({cellId:C,direction:"right"}),hidden:v!=="columns"},{icon:d.jsx(ip,{size:13,strokeWidth:1.5}),label:"Send to top",hotkey:"cell.sendToTop",handle:()=>a({cellId:C,scroll:!1})},{icon:d.jsx(sp,{size:13,strokeWidth:1.5}),label:"Send to bottom",hotkey:"cell.sendToBottom",handle:()=>l({cellId:C,scroll:!1})},{icon:d.jsx($z,{size:13,strokeWidth:1.5}),label:"Break into new column",hotkey:"cell.addColumnBreakpoint",hidden:v!=="columns",handle:()=>c({cellId:C})}],[{icon:d.jsx(AS,{size:13,strokeWidth:1.5}),label:"Copy link to cell",disabled:!Zp(j),tooltip:Zp(j)?void 0:"Only named cells can be linked to",handle:async()=>{await _n(function(E){const W=new URL(window.location.href);return W.hash=`scrollTo=${encodeURIComponent(E)}`,W.toString()}(j)),dt({description:"Link copied to clipboard"})}}],[{label:"Delete",hidden:!m,variant:"danger",icon:d.jsx(lm,{size:13,strokeWidth:1.5}),handle:()=>{_({cellId:C})}}]].map(lC).filter(aC),e[22]=c,e[23]=b,e[24]=v,e[25]=x,e[26]=m,e[27]=C,e[28]=u,e[29]=k.disabled,e[30]=k.hide_code,e[31]=o,e[32]=_,e[33]=N,e[34]=T,e[35]=I,e[36]=i,e[37]=j,e[38]=f,e[39]=l,e[40]=a,e[41]=p,e[42]=h,e[43]=A,e[44]=U,e[45]=S,e[46]=z,e[47]=F,e[48]=$):$=e[48],$}function aC(t){return t.length>0}function lC(t){return t.filter(cC)}function cC(t){return!t.hidden}function dC(t){t==null||t.stopPropagation(),t==null||t.preventDefault()}function uC(t){return!t.hidden}const md=qt(!1),eg=()=>{const t=X.c(37),[e,n]=on(md),o=Wz(),r=Ue(qz),s=Ue(cm);let i;t[0]!==r?(i={cell:r},t[0]=r,t[1]=i):i=t[1];let a=fd(i).flat();a=Ca(a);const l=function(){const O=X.c(61),[S,$]=Dr(),[E,W]=W3();let G;O[0]!==$?(G=async Q=>{await Rr({config:Q}).then(()=>{$(Q)})},O[0]=$,O[1]=G):G=O[1];const q=G;let Y;O[2]!==W?(Y=async Q=>{await Hz({config:Q}).then(()=>{W(Q)})},O[2]=W,O[3]=Y):Y=O[3];const te=Y;let oe;if(O[4]!==E||O[5]!==S||O[6]!==te||O[7]!==q){let Q,ue,me,ce,fe;O[9]!==E?(Q=Re=>Re!==E.width,O[9]=E,O[10]=Q):Q=O[10],O[11]!==E||O[12]!==te?(ue=Re=>({label:`App config > Set width=${Re}`,handle:()=>{te({...E,width:Re})}}),O[11]=E,O[12]=te,O[13]=ue):ue=O[13],O[14]!==S||O[15]!==q?(me={label:"Config > Set theme: dark",handle:()=>{q({...S,display:{...S.display,theme:"dark"}})}},O[14]=S,O[15]=q,O[16]=me):me=O[16],O[17]!==S||O[18]!==q?(ce={label:"Config > Set theme: light",handle:()=>{q({...S,display:{...S.display,theme:"light"}})}},O[17]=S,O[18]=q,O[19]=ce):ce=O[19],O[20]!==S||O[21]!==q?(fe={label:"Config > Set theme: system",handle:()=>{q({...S,display:{...S.display,theme:"system"}})}},O[20]=S,O[21]=q,O[22]=fe):fe=O[22];const de=S.keymap.preset==="vim";let ke,Se;O[23]!==S||O[24]!==q?(ke=()=>{q({...S,keymap:{...S.keymap,preset:"vim"}})},O[23]=S,O[24]=q,O[25]=ke):ke=O[25],O[26]!==de||O[27]!==ke?(Se={label:"Config > Switch keymap to VIM",hidden:de,handle:ke},O[26]=de,O[27]=ke,O[28]=Se):Se=O[28];const ie=S.keymap.preset==="default";let je,pe,Ae;O[29]!==S||O[30]!==q?(je=()=>{q({...S,keymap:{...S.keymap,preset:"default"}})},O[29]=S,O[30]=q,O[31]=je):je=O[31],O[32]!==ie||O[33]!==je?(pe={label:"Config > Switch keymap to default (current: VIM)",hidden:ie,handle:je},O[32]=ie,O[33]=je,O[34]=pe):pe=O[34],O[35]!==S||O[36]!==q?(Ae=()=>{q({...S,completion:{...S.completion,copilot:!1}})},O[35]=S,O[36]=q,O[37]=Ae):Ae=O[37];const ze=S.completion.copilot!=="github";let De,Ve;O[38]!==Ae||O[39]!==ze?(De={label:"Config > Disable GitHub Copilot",handle:Ae,hidden:ze},O[38]=Ae,O[39]=ze,O[40]=De):De=O[40],O[41]!==S||O[42]!==q?(Ve=()=>{q({...S,completion:{...S.completion,copilot:"github"}})},O[41]=S,O[42]=q,O[43]=Ve):Ve=O[43];const Pe=S.completion.copilot==="github";let rt;O[44]!==Ve||O[45]!==Pe?(rt={label:"Config > Enable GitHub Copilot",handle:Ve,hidden:Pe},O[44]=Ve,O[45]=Pe,O[46]=rt):rt=O[46];const Qe=!S.display.reference_highlighting;let tt,ne,ve,Ce;O[47]!==S||O[48]!==q?(tt=()=>{q({...S,display:{...S.display,reference_highlighting:!1}})},O[47]=S,O[48]=q,O[49]=tt):tt=O[49],O[50]!==Qe||O[51]!==tt?(ne={label:"Config > Disable reference highlighting",hidden:Qe,handle:tt},O[50]=Qe,O[51]=tt,O[52]=ne):ne=O[52],O[53]!==S||O[54]!==q?(ve=()=>{q({...S,display:{...S.display,reference_highlighting:!0}})},O[53]=S,O[54]=q,O[55]=ve):ve=O[55],O[56]!==S.display.reference_highlighting||O[57]!==ve?(Ce={label:"Config > Enable reference highlighting",hidden:S.display.reference_highlighting,handle:ve},O[56]=S.display.reference_highlighting,O[57]=ve,O[58]=Ce):Ce=O[58],oe=[...gH().filter(Q).map(ue),me,ce,fe,Se,pe,De,rt,ne,Ce],O[4]=E,O[5]=S,O[6]=te,O[7]=q,O[8]=oe}else oe=O[8];const se=oe;let Z;return O[59]!==se?(Z=se.filter(uC),O[59]=se,O[60]=Z):Z=O[60],Z}();let c=Ag();c=[...Ca(c),...Ca(l)];const u=c.filter(hC),h=rc.keyBy(u,fC),{recentCommands:f,addRecentCommand:m}=rC();let _;t[2]!==f?(_=new Set(f),t[2]=f,t[3]=_):_=t[3];const g=_;let p,b;t[4]!==s||t[5]!==n?(p=O=>{Jz(s.getHotkey("global.commandPalette").key)(O)&&(O.preventDefault(),n(mC))},t[4]=s,t[5]=n,t[6]=p):p=t[6],sm(document,"keydown",p),t[7]!==m||t[8]!==s||t[9]!==o||t[10]!==n?(b=(O,S)=>{const $=o[O];if(!$)return null;const E=s.getHotkey(O);return d.jsxs(mo,{disabled:S.disabled,onSelect:()=>{m(O),n(!1),requestAnimationFrame(()=>{$()})},value:E.name,children:[d.jsxs("span",{children:[E.name,S.tooltip&&d.jsx("span",{className:"ml-2",children:S.tooltip})]}),d.jsx(G3,{children:d.jsx(hm,{shortcut:E.key})})]},O)},t[7]=m,t[8]=s,t[9]=o,t[10]=n,t[11]=b):b=t[11];const x=b;let y;t[12]!==m||t[13]!==s||t[14]!==n?(y=(O,S,$,E)=>{const W=$===void 0?{}:$;return d.jsxs(mo,{disabled:W.disabled,onSelect:()=>{m(O),n(!1),requestAnimationFrame(()=>{S()})},value:O,children:[d.jsxs("span",{children:[O,W.tooltip&&d.jsxs("span",{className:"ml-2",children:["(",W.tooltip,")"]})]}),E&&d.jsx(G3,{children:d.jsx(hm,{shortcut:s.getHotkey(E).key})})]},O)},t[12]=m,t[13]=s,t[14]=n,t[15]=y):y=t[15];const v=y,C=Yz;let k;t[16]===Symbol.for("react.memo_cache_sentinel")?(k=d.jsx(Ji,{placeholder:"Type to search..."}),t[16]=k):k=t[16];const N=um;let j;t[17]===Symbol.for("react.memo_cache_sentinel")?(j=d.jsx(sc,{children:"No results found."}),t[17]=j):j=t[17];const I=f.length>0&&d.jsxs(d.Fragment,{children:[d.jsx(dm,{heading:"Recently Used",children:f.map(O=>{const S=h[O];return Gz(O)?x(O,{disabled:S==null?void 0:S.disabled,tooltip:S==null?void 0:S.tooltip}):S&&!Xp(S)?v(S.label,S.handleHeadless||S.handle,{disabled:S.disabled,tooltip:S.tooltip}):null})}),d.jsx(q3,{})]}),T=dm,A=s.iterate().map(O=>{if(g.has(O))return null;const S=h[O];return x(O,{disabled:S==null?void 0:S.disabled,tooltip:S==null?void 0:S.tooltip})}),R=u.map(O=>g.has(O.label)?null:v(O.label,O.handleHeadless||O.handle,{disabled:O.disabled,tooltip:O.tooltip}));let z;t[18]!==g||t[19]!==v?(z=O=>g.has(O.label)?null:v(`Cell > ${O.label}`,O.handleHeadless||O.handle,{disabled:O.disabled,tooltip:O.tooltip}),t[18]=g,t[19]=v,t[20]=z):z=t[20];const D=a.map(z);let F,B,U;return t[21]!==T||t[22]!==R||t[23]!==D||t[24]!==A?(F=d.jsxs(T,{heading:"Commands",children:[A,R,D]}),t[21]=T,t[22]=R,t[23]=D,t[24]=A,t[25]=F):F=t[25],t[26]!==N||t[27]!==F||t[28]!==j||t[29]!==I?(B=d.jsxs(N,{children:[j,I,F]}),t[26]=N,t[27]=F,t[28]=j,t[29]=I,t[30]=B):B=t[30],t[31]!==C||t[32]!==e||t[33]!==n||t[34]!==B||t[35]!==k?(U=d.jsxs(C,{open:e,onOpenChange:n,children:[k,B]}),t[31]=C,t[32]=e,t[33]=n,t[34]=B,t[35]=k,t[36]=U):U=t[36],U};function hC(t){return!t.hotkey}function fC(t){return t.label}function mC(t){return!t}function gr(){return ft().optional().describe(qe.of({label:"Password",inputType:"password",placeholder:"password",optionRegex:".*password.*"}))}function tg(){return ft().optional().describe(qe.of({label:"Token",inputType:"password",placeholder:"token",optionRegex:".*token.*"}))}function ja(){return ft().optional().describe(qe.of({label:"Warehouse Name",placeholder:"warehouse",optionRegex:".*warehouse.*"}))}function ng(){return ft().optional().describe(qe.of({label:"URI",optionRegex:".*uri.*"}))}function _r(){return ft().nonempty().describe(qe.of({label:"Host",placeholder:"localhost",optionRegex:".*host.*"}))}function go(){return ft().describe(qe.of({label:"Database",placeholder:"db name",optionRegex:".*database.*"}))}function br(){return ft().nonempty().describe(qe.of({label:"Username",placeholder:"username",optionRegex:".*username.*"}))}function xr(t){const e=Kz.string().describe(qe.of({label:"Port",inputType:"number",placeholder:t==null?void 0:t.toString()})).transform(Number).refine(n=>n>=0&&n<=65535,{message:"Port must be between 0 and 65535"});return t!==void 0?e.default(t.toString()):e}function og(){return Ms().default(!1).describe(qe.of({label:"Read Only"}))}const rg=yt({type:Ct("postgres"),host:_r(),port:xr(5432).optional(),database:go(),username:br(),password:gr(),ssl:Ms().default(!1).describe(qe.of({label:"Use SSL"}))}).describe(qe.of({direction:"two-columns"})),sg=yt({type:Ct("mysql"),host:_r(),port:xr(3306),database:go(),username:br(),password:gr(),ssl:Ms().default(!1).describe(qe.of({label:"Use SSL"}))}).describe(qe.of({direction:"two-columns"})),ig=yt({type:Ct("sqlite"),database:go().describe(qe.of({label:"Database Path"}))}).describe(qe.of({direction:"two-columns"})),ag=yt({type:Ct("duckdb"),database:go().describe(qe.of({label:"Database Path"})),read_only:og()}).describe(qe.of({direction:"two-columns"})),lg=yt({type:Ct("motherduck"),database:go().default("my_db").describe(qe.of({label:"Database Name"})),token:tg()}).describe(qe.of({direction:"two-columns"})),cg=yt({type:Ct("snowflake"),account:ft().nonempty().describe(qe.of({label:"Account",optionRegex:".*snowflake.*"})),warehouse:ft().optional().describe(qe.of({label:"Warehouse",optionRegex:".*snowflake.*"})),database:go(),schema:ft().optional().describe(qe.of({label:"Schema",optionRegex:".*snowflake.*"})),username:br(),password:gr(),role:ft().optional().describe(qe.of({label:"Role"}))}).describe(qe.of({direction:"two-columns"})),dg=yt({type:Ct("bigquery"),project:ft().nonempty().describe(qe.of({label:"Project ID",optionRegex:".*bigquery.*"})),dataset:ft().nonempty().describe(qe.of({label:"Dataset",optionRegex:".*bigquery.*"})),credentials_json:ft().describe(qe.of({label:"Credentials JSON",inputType:"textarea"}))}).describe(qe.of({direction:"two-columns"})),ug=yt({type:Ct("clickhouse_connect"),host:_r(),port:xr(8123).optional(),username:br(),password:gr(),secure:Ms().default(!1).describe(qe.of({label:"Use HTTPs"}))}).describe(qe.of({direction:"two-columns"})),hg=yt({type:Ct("timeplus"),host:_r().default("localhost"),port:xr(8123).optional(),username:br().default("default"),password:gr().default("")}).describe(qe.of({direction:"two-columns"})),fg=yt({type:Ct("chdb"),database:go().describe(qe.of({label:"Database Path"})),read_only:og()}).describe(qe.of({direction:"two-columns"})),mg=yt({type:Ct("trino"),host:_r(),port:xr(8080),database:go(),schema:ft().describe(qe.of({label:"Schema",placeholder:"schema name",optionRegex:".*schema.*"})).optional(),username:br(),password:gr(),async_support:Ms().default(!1).describe(qe.of({label:"Async Support"}))}).describe(qe.of({direction:"two-columns"})),pg=yt({type:Ct("iceberg"),name:ft().describe(qe.of({label:"Catalog Name"})),catalog:fm("type",[yt({type:Ct("REST"),warehouse:ja(),uri:ft().optional().describe(qe.of({label:"URI",placeholder:"https://",optionRegex:".*uri.*"})),token:tg()}),yt({type:Ct("SQL"),warehouse:ja(),uri:ft().optional().describe(qe.of({label:"URI",placeholder:"jdbc:iceberg://host:port/database",optionRegex:".*uri.*"}))}),yt({type:Ct("Hive"),warehouse:ja(),uri:ng()}),yt({type:Ct("Glue"),warehouse:ja(),uri:ng()}),yt({type:Ct("DynamoDB"),"dynamodb.profile-name":ft().optional().describe(qe.of({label:"Profile Name"})),"dynamodb.region":ft().optional().describe(qe.of({label:"Region"})),"dynamodb.access-key-id":ft().optional().describe(qe.of({label:"Access Key ID"})),"dynamodb.secret-access-key":ft().optional().describe(qe.of({label:"Secret Access Key",inputType:"password"})),"dynamodb.session-token":ft().optional().describe(qe.of({label:"Session Token",inputType:"password"}))})]).default({type:"REST"}).describe(qe.of({special:"tabs"}))}),gg=yt({type:Ct("datafusion"),sessionContext:Ms().optional().describe(qe.of({label:"Use Session Context"}))}),_g=yt({type:Ct("pyspark"),host:_r().optional(),port:xr().optional()}),bg=yt({type:Ct("redshift"),host:_r(),port:xr(5439),connectionType:fm("type",[yt({type:Ct("IAM credentials"),region:ft().describe(qe.of({label:"Region"})),aws_access_key_id:ft().nonempty().describe(qe.of({label:"AWS Access Key ID",inputType:"password",optionRegex:".*aws_access_key_id.*"})),aws_secret_access_key:ft().nonempty().describe(qe.of({label:"AWS Secret Access Key",inputType:"password",optionRegex:".*aws_secret_access_key.*"})),aws_session_token:ft().optional().describe(qe.of({label:"AWS Session Token",inputType:"password",optionRegex:".*aws_session_token.*"}))}),yt({type:Ct("DB credentials"),user:br(),password:gr()})]).default({type:"IAM credentials",aws_access_key_id:"",aws_secret_access_key:"",region:""}),database:go()}).describe(qe.of({direction:"two-columns"})),pC=fm("type",[rg,sg,ig,ag,lg,cg,dg,ug,hg,fg,mg,pg,gg,_g,bg]),pd="env:";function Ea(t){return typeof t=="string"&&t.startsWith(pd)}function gd(t){return`${pd}${t}`}const xg={sqlmodel:"SQLModel",sqlalchemy:"SQLAlchemy",duckdb:"DuckDB",clickhouse_connect:"ClickHouse Connect",chdb:"chDB",pyiceberg:"PyIceberg",ibis:"Ibis",motherduck:"MotherDuck",redshift:"Redshift"};class sn{constructor(e,n,o){this.connection=void 0,this.orm=void 0,this.secrets=void 0,this.connection=e,this.orm=n,this.secrets=o}get imports(){const e=new Set(this.generateImports());switch(this.orm){case"sqlalchemy":e.add("import sqlalchemy");break;case"sqlmodel":e.add("import sqlmodel");break;case"duckdb":e.add("import duckdb")}return e}}class gC{constructor(){this.secrets={}}get imports(){return Object.keys(this.secrets).length===0?new Set:new Set(["import os"])}print(e,n,o){if(e=(r=>`_${r}`)(e),Ea(n)){const r=n.replace(pd,""),s=o?`os.environ.get("${r}", "${o}")`:`os.environ.get("${r}")`;return this.secrets[e]=s,e}if(o!=null){const r=`os.environ.get("${n}", "${o}")`;return this.secrets[e]=r,e}return typeof n=="number"||typeof n=="number"?`${n}`:typeof n=="boolean"?Hr(n):n?`"${n}"`:""}printInFString(e,n,o){if(n===void 0)return"";if(typeof n=="number")return`${n}`;if(typeof n=="boolean")return Hr(n);const r=this.print(e,n,o);return r.startsWith('"')&&r.endsWith('"')?r.slice(1,-1):`{${r}}`}printPassword(e,n,o){const r=o?this.printInFString.bind(this):this.print.bind(this);return Ea(e)?r("password",e):r("password",n,e)}getSecrets(){return this.secrets}formatSecrets(){return Object.keys(this.secrets).length===0?"":Object.entries(this.secrets).map(([e,n])=>`${e} = ${n}`).join(`
|
3
|
-
`)}}class _C extends sn{generateImports(){return[]}generateConnectionCode(){const e=this.connection.ssl?", connect_args={'sslmode': 'require'}":"",n=this.secrets.printPassword(this.connection.password,"POSTGRES_PASSWORD",!0),o=this.secrets.printInFString("username",this.connection.username),r=this.secrets.printInFString("host",this.connection.host),s=this.secrets.printInFString("port",this.connection.port),i=this.secrets.printInFString("database",this.connection.database);return wt(`
|
4
|
-
DATABASE_URL = f"postgresql://${o}:${n}@${r}:${s}/${i}"
|
5
|
-
engine = ${this.orm}.create_engine(DATABASE_URL${e})
|
6
|
-
`)}}class bC extends sn{generateImports(){return[]}generateConnectionCode(){const e=this.connection.ssl?", connect_args={'ssl': {'ssl-mode': 'preferred'}}":"",n=this.secrets.printPassword(this.connection.password,"MYSQL_PASSWORD",!0),o=this.secrets.printInFString("database",this.connection.database),r=this.secrets.printInFString("username",this.connection.username),s=this.secrets.printInFString("host",this.connection.host),i=this.secrets.printInFString("port",this.connection.port);return wt(`
|
7
|
-
DATABASE_URL = f"mysql+pymysql://${r}:${n}@${s}:${i}/${o}"
|
8
|
-
engine = ${this.orm}.create_engine(DATABASE_URL${e})
|
9
|
-
`)}}class xC extends sn{generateImports(){return[]}generateConnectionCode(){const e=this.connection.database?this.secrets.printInFString("database",this.connection.database):"",n=e.startsWith("{")&&e.endsWith("}")?`DATABASE_URL = f"sqlite:///${e}"`:`DATABASE_URL = "sqlite:///${e}"`;return wt(`
|
10
|
-
${n}
|
11
|
-
engine = ${this.orm}.create_engine(DATABASE_URL)
|
12
|
-
`)}}class yC extends sn{generateImports(){return["from snowflake.sqlalchemy import URL"]}generateConnectionCode(){const e=this.secrets.printPassword(this.connection.password,"SNOWFLAKE_PASSWORD",!1),n={account:this.secrets.print("account",this.connection.account),user:this.secrets.print("user",this.connection.username),database:this.secrets.print("database",this.connection.database),warehouse:this.connection.warehouse?this.secrets.print("warehouse",this.connection.warehouse):void 0,schema:this.connection.schema?this.secrets.print("schema",this.connection.schema):void 0,role:this.connection.role?this.secrets.print("role",this.connection.role):void 0,password:e};return wt(`
|
13
|
-
engine = ${this.orm}.create_engine(
|
14
|
-
URL(
|
15
|
-
${Ia(n,o=>` ${o}`)},
|
16
|
-
)
|
17
|
-
)
|
18
|
-
`)}}class wC extends sn{generateImports(){return["import json"]}generateConnectionCode(){const e=this.secrets.printInFString("project",this.connection.project),n=this.secrets.printInFString("dataset",this.connection.dataset);return wt(`
|
19
|
-
credentials = json.loads("""${this.connection.credentials_json}""")
|
20
|
-
engine = ${this.orm}.create_engine(f"bigquery://${e}/${n}", credentials_info=credentials)
|
21
|
-
`)}}class vC extends sn{generateImports(){return[]}generateConnectionCode(){const e=this.secrets.printInFString("database",this.connection.database||":memory:");return wt(`
|
22
|
-
DATABASE_URL = "${e}"
|
23
|
-
engine = ${this.orm}.connect(DATABASE_URL, read_only=${Hr(this.connection.read_only)})
|
24
|
-
`)}}class kC extends sn{generateImports(){return[]}generateConnectionCode(){const e=this.secrets.printInFString("database",this.connection.database);if(!this.connection.token)return wt(`
|
25
|
-
conn = duckdb.connect("md:${e}")
|
26
|
-
`);const n=this.secrets.printPassword(this.connection.token,"MOTHERDUCK_TOKEN",!1);return wt(`
|
27
|
-
conn = duckdb.connect("md:${e}", config={"motherduck_token": ${n}})
|
28
|
-
`)}}class SC extends sn{generateImports(){return["import clickhouse_connect"]}generateConnectionCode(){const e=this.secrets.printPassword(this.connection.password,"CLICKHOUSE_PASSWORD",!1),n={host:this.secrets.print("host",this.connection.host),user:this.secrets.print("user",this.connection.username),secure:this.secrets.print("secure",this.connection.secure),port:this.connection.port?this.secrets.print("port",this.connection.port):void 0,password:this.connection.password?e:void 0};return wt(`
|
29
|
-
engine = ${this.orm}.get_client(
|
30
|
-
${Ia(n,o=>` ${o}`)},
|
31
|
-
)
|
32
|
-
`)}}class CC extends sn{generateImports(){return[]}generateConnectionCode(){const e=this.secrets.printPassword(this.connection.password,"TIMEPLUS_PASSWORD",!0),n=this.secrets.printInFString("username",this.connection.username),o=this.secrets.printInFString("host",this.connection.host),r=this.secrets.printInFString("port",this.connection.port);return wt(`
|
33
|
-
DATABASE_URL = f"timeplus://${n}:${e}@${o}:${r}"
|
34
|
-
engine = ${this.orm}.create_engine(DATABASE_URL)
|
35
|
-
`)}}class NC extends sn{generateImports(){return["import chdb"]}generateConnectionCode(){const e=this.secrets.print("database",this.connection.database)||'""';return wt(`
|
36
|
-
engine = ${this.orm}.connect(${e}, read_only=${Hr(this.connection.read_only)})
|
37
|
-
`)}}class jC extends sn{generateImports(){return this.connection.async_support?["import aiotrino"]:["import trino.sqlalchemy"]}generateConnectionCode(){const e=this.connection.async_support?"aiotrino":"trino",n=this.connection.schema?`/${this.connection.schema}`:"",o=this.secrets.printInFString("username",this.connection.username),r=this.secrets.printInFString("host",this.connection.host),s=this.secrets.printInFString("port",this.connection.port),i=this.secrets.printInFString("database",this.connection.database),a=this.secrets.printPassword(this.connection.password,"TRINO_PASSWORD",!0);return wt(`
|
38
|
-
engine = ${this.orm}.create_engine(f"${e}://${o}:${a}@${r}:${s}/${i}${n}")
|
39
|
-
`)}}class EC extends sn{generateImports(){switch(this.connection.catalog.type){case"REST":return["from pyiceberg.catalog.rest import RestCatalog"];case"SQL":return["from pyiceberg.catalog.sql import SqlCatalog"];case"Hive":return["from pyiceberg.catalog.hive import HiveCatalog"];case"Glue":return["from pyiceberg.catalog.glue import GlueCatalog"];case"DynamoDB":return["from pyiceberg.catalog.dynamodb import DynamoDBCatalog"];default:mm(this.connection.catalog)}}generateConnectionCode(){let e={...this.connection.catalog};e=Object.fromEntries(Object.entries(e).filter(([i,a])=>a!=null&&a!==""&&i!=="type"));for(const[i,a]of Object.entries(e))Ea(a)?e[i]=this.secrets.print(i,a):typeof a=="string"&&(e[i]=`"${a}"`);const n=(o=e,r=i=>` ${i}`,Object.entries(o).filter(([,i])=>i!=null&&i!=="").map(([i,a])=>{const l=`"${i}"`;return r(typeof a=="boolean"?`${l}: ${Hr(a)}`:`${l}: ${a}`)}).join(`,
|
40
|
-
`));var o,r;const s=`"${this.connection.name}"`;switch(this.connection.catalog.type){case"REST":return wt(`
|
41
|
-
catalog = RestCatalog(
|
42
|
-
${s},
|
43
|
-
**{
|
44
|
-
${n}
|
45
|
-
},
|
46
|
-
)
|
47
|
-
`);case"SQL":return wt(`
|
48
|
-
catalog = SqlCatalog(
|
49
|
-
${s},
|
50
|
-
**{
|
51
|
-
${n}
|
52
|
-
},
|
53
|
-
)
|
54
|
-
`);case"Hive":return wt(`
|
55
|
-
catalog = HiveCatalog(
|
56
|
-
${s},
|
57
|
-
**{
|
58
|
-
${n}
|
59
|
-
},
|
60
|
-
)
|
61
|
-
`);case"Glue":return wt(`
|
62
|
-
catalog = GlueCatalog(
|
63
|
-
${s},
|
64
|
-
**{
|
65
|
-
${n}
|
66
|
-
},
|
67
|
-
)
|
68
|
-
`);case"DynamoDB":return wt(`
|
69
|
-
catalog = DynamoDBCatalog(
|
70
|
-
${s},
|
71
|
-
**{
|
72
|
-
${n}
|
73
|
-
},
|
74
|
-
)
|
75
|
-
`);default:mm(this.connection.catalog)}}}class IC extends sn{generateImports(){return["import ibis","from datafusion import SessionContext"]}generateConnectionCode(){return this.connection.sessionContext?wt(`
|
76
|
-
ctx = SessionContext()
|
77
|
-
# Sample table
|
78
|
-
_ = ctx.from_pydict({"a": [1, 2, 3]}, "my_table")
|
79
|
-
|
80
|
-
con = ibis.datafusion.connect(ctx)
|
81
|
-
`):wt(`
|
82
|
-
con = ibis.datafusion.connect()
|
83
|
-
`)}}class AC extends sn{generateImports(){return["import ibis","from pyspark.sql import SparkSession"]}generateConnectionCode(){if(this.connection.host||this.connection.port){const e=this.secrets.printInFString("host",this.connection.host),n=this.secrets.printInFString("port",this.connection.port);return wt(`
|
84
|
-
session = SparkSession.builder.remote(f"sc://${e}:${n}").getOrCreate()
|
85
|
-
con = ibis.pyspark.connect(session)
|
86
|
-
`)}return wt(`
|
87
|
-
con = ibis.pyspark.connect()
|
88
|
-
`)}}class TC extends sn{generateImports(){return["import redshift_connector"]}generateConnectionCode(){const e=this.secrets.print("host",this.connection.host),n=this.secrets.print("port",this.connection.port),o=this.secrets.print("database",this.connection.database);if(this.connection.connectionType.type==="IAM credentials"){const a=this.secrets.print("aws_access_key_id",this.connection.connectionType.aws_access_key_id),l=this.secrets.print("aws_secret_access_key",this.connection.connectionType.aws_secret_access_key),c=this.connection.connectionType.aws_session_token?this.secrets.print("aws_session_token",this.connection.connectionType.aws_session_token):void 0,u={iam:!0,host:e,port:n,region:`"${this.connection.connectionType.region}"`,database:o,access_key_id:a,secret_access_key:l,...c&&{session_token:c}};return wt(`
|
89
|
-
con = redshift_connector.connect(
|
90
|
-
${Ia(u,h=>` ${h}`)},
|
91
|
-
)
|
92
|
-
`)}const r=this.connection.connectionType.user?this.secrets.print("user",this.connection.connectionType.user):void 0,s=this.connection.connectionType.password?this.secrets.printPassword(this.connection.connectionType.password,"REDSHIFT_PASSWORD",!1):void 0,i={host:e,port:n,database:o,...r&&{user:r},...s&&{password:s}};return wt(`
|
93
|
-
con = redshift_connector.connect(
|
94
|
-
${Ia(i,a=>` ${a}`)},
|
95
|
-
)
|
96
|
-
`)}}class MC{constructor(){this.secrets=new gC}createGenerator(e,n){switch(e.type){case"postgres":return new _C(e,n,this.secrets);case"mysql":return new bC(e,n,this.secrets);case"sqlite":return new xC(e,n,this.secrets);case"snowflake":return new yC(e,n,this.secrets);case"bigquery":return new wC(e,n,this.secrets);case"duckdb":return new vC(e,n,this.secrets);case"motherduck":return new kC(e,n,this.secrets);case"clickhouse_connect":return new SC(e,n,this.secrets);case"timeplus":return new CC(e,n,this.secrets);case"chdb":return new NC(e,n,this.secrets);case"trino":return new jC(e,n,this.secrets);case"iceberg":return new EC(e,n,this.secrets);case"datafusion":return new IC(e,n,this.secrets);case"pyspark":return new AC(e,n,this.secrets);case"redshift":return new TC(e,n,this.secrets);default:mm(e)}}}function Hr(t){return t.toString().charAt(0).toUpperCase()+t.toString().slice(1)}function Ia(t,e){return Object.entries(t).filter(([,n])=>n!=null&&n!=="").map(([n,o])=>e(typeof o=="boolean"?`${n}=${Hr(o)}`:`${n}=${o}`)).join(`,
|
97
|
-
`)}function yg(t){return t.sort((e,n)=>e.provider==="env"?1:n.provider==="env"?-1:0)}const wg=t=>{const e=X.c(42),{providerNames:n,onClose:o,onSuccess:r}=t,[s,i]=K.useState(""),[a,l]=K.useState(""),[c,u]=K.useState(n[0]);let h;e[0]!==s||e[1]!==c||e[2]!==r||e[3]!==a?(h=async U=>{if(U.preventDefault(),c)if(s&&a&&c)try{await Xz({key:s,value:a,provider:"dotenv",name:c}),dt({title:"Secret created",description:"The secret has been created successfully."}),r(s)}catch{dt({title:"Error",description:"Failed to create secret. Please try again.",variant:"danger"})}else dt({title:"Error",description:"Please fill in all fields.",variant:"danger"});else dt({title:"Error",description:"No location selected for the secret.",variant:"danger"})},e[0]=s,e[1]=c,e[2]=r,e[3]=a,e[4]=h):h=e[4];const f=h;let m,_,g,p,b,x,y,v,C,k,N,j,I,T,A,R;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=d.jsxs(Es,{children:[d.jsx(rr,{children:"Add Secret"}),d.jsx(Is,{children:"Add a new secret to your environment variables."})]}),e[5]=m):m=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(_=d.jsx(Or,{htmlFor:"key",children:"Key"}),e[6]=_):_=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(g=U=>{i(U.target.value.replaceAll(/\W/g,"_"))},e[7]=g):g=e[7],e[8]!==s?(p=d.jsxs("div",{className:"grid gap-2",children:[_,d.jsx(sr,{id:"key",value:s,onChange:g,placeholder:"MY_SECRET_KEY",required:!0})]}),e[8]=s,e[9]=p):p=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(b=d.jsx(Or,{htmlFor:"value",children:"Value"}),e[10]=b):b=e[10],e[11]===Symbol.for("react.memo_cache_sentinel")?(x=U=>l(U.target.value),e[11]=x):x=e[11],e[12]!==a?(y=d.jsx(sr,{id:"value",type:"text",value:a,onChange:x,required:!0,autoComplete:"off"}),e[12]=a,e[13]=y):y=e[13],e[14]===Symbol.for("react.memo_cache_sentinel")?(v=window.location.href.startsWith("http://")&&d.jsx(Y3,{children:"Note: You are sending this key over http."}),e[14]=v):v=e[14],e[15]!==y?(C=d.jsxs("div",{className:"grid gap-2",children:[b,y,v]}),e[15]=y,e[16]=C):C=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(k=d.jsx(Or,{htmlFor:"location",children:"Location"}),e[17]=k):k=e[17],e[18]!==n.length?(N=n.length===0&&d.jsx("p",{className:"text-sm text-muted-foreground",children:"No dotenv locations configured."}),e[18]=n.length,e[19]=N):N=e[19],e[20]!==c||e[21]!==n?(j=n.length>0&&d.jsxs(ic,{value:c,onValueChange:U=>u(U),children:[d.jsx(ac,{children:d.jsx(lc,{placeholder:"Select a provider"})}),d.jsx(cc,{children:n.map(OC)})]}),e[20]=c,e[21]=n,e[22]=j):j=e[22],e[23]===Symbol.for("react.memo_cache_sentinel")?(I=d.jsxs(Y3,{children:["You can configure the location by setting the"," ",d.jsx(pm,{href:"https://links.marimo.app/dotenv",children:"dotenv configuration"}),"."]}),e[23]=I):I=e[23],e[24]!==N||e[25]!==j?(T=d.jsxs("div",{className:"grid gap-2",children:[k,N,j,I]}),e[24]=N,e[25]=j,e[26]=T):T=e[26],e[27]!==C||e[28]!==T||e[29]!==p?(A=d.jsxs("div",{className:"grid gap-4 py-4",children:[p,C,T]}),e[27]=C,e[28]=T,e[29]=p,e[30]=A):A=e[30],e[31]!==o?(R=d.jsx(Me,{type:"button",variant:"outline",onClick:o,children:"Cancel"}),e[31]=o,e[32]=R):R=e[32];const z=!s||!a||!c;let D,F,B;return e[33]!==z?(D=d.jsx(Me,{type:"submit",disabled:z,children:"Add Secret"}),e[33]=z,e[34]=D):D=e[34],e[35]!==R||e[36]!==D?(F=d.jsxs(Wi,{children:[R,D]}),e[35]=R,e[36]=D,e[37]=F):F=e[37],e[38]!==f||e[39]!==A||e[40]!==F?(B=d.jsx(ir,{children:d.jsxs("form",{onSubmit:f,children:[m,A,F]})}),e[38]=f,e[39]=A,e[40]=F,e[41]=B):B=e[41],B};function OC(t){return d.jsx(Ki,{value:t,children:t},t)}const vg=M.createContext({providerNames:[],secretKeys:[],loading:!1,error:void 0,refreshSecrets:kn.NOOP}),DC=t=>{const e=X.c(14),{children:n}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],e[0]=o):o=e[0];const{data:r,isPending:s,error:i,refetch:a}=Wn(FC,o);let l,c,u,h;return e[1]!==(r==null?void 0:r.secretKeys)?(l=(r==null?void 0:r.secretKeys)||[],e[1]=r==null?void 0:r.secretKeys,e[2]=l):l=e[2],e[3]!==(r==null?void 0:r.providerNames)?(c=(r==null?void 0:r.providerNames)||[],e[3]=r==null?void 0:r.providerNames,e[4]=c):c=e[4],e[5]!==i||e[6]!==s||e[7]!==a||e[8]!==l||e[9]!==c?(u={secretKeys:l,providerNames:c,loading:s,error:i,refreshSecrets:a},e[5]=i,e[6]=s,e[7]=a,e[8]=l,e[9]=c,e[10]=u):u=e[10],e[11]!==n||e[12]!==u?(h=d.jsx(vg,{value:u,children:n}),e[11]=n,e[12]=u,e[13]=h):h=e[13],h};function RC(t){return t.provider!=="env"}function PC(t){return t.name}function LC(t){return t.keys}async function FC(){const t=await FS.request({}),e=yg(t.secrets).filter(RC).map(PC);return{secretKeys:t.secrets.flatMap(LC).sort(),providerNames:e}}const kg=[{name:"PostgreSQL",schema:rg,color:"#336791",logo:"postgres",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"MySQL",schema:sg,color:"#00758F",logo:"mysql",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"SQLite",schema:ig,color:"#003B57",logo:"sqlite",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"DuckDB",schema:ag,color:"#FFD700",logo:"duckdb",connectionLibraries:{libraries:["duckdb"],preferred:"duckdb"}},{name:"MotherDuck",schema:lg,color:"#ff9538",logo:"motherduck",connectionLibraries:{libraries:["duckdb"],preferred:"duckdb"}},{name:"Snowflake",schema:cg,color:"#29B5E8",logo:"snowflake",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"ClickHouse",schema:ug,color:"#2C2C1D",logo:"clickhouse",connectionLibraries:{libraries:["clickhouse_connect"],preferred:"clickhouse_connect"}},{name:"Timeplus",schema:hg,color:"#B83280",logo:"timeplus",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"BigQuery",schema:dg,color:"#4285F4",logo:"bigquery",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"ClickHouse Embedded",schema:fg,color:"#f2b611",logo:"clickhouse",connectionLibraries:{libraries:["chdb"],preferred:"chdb"}},{name:"Trino",schema:mg,color:"#d466b6",logo:"trino",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"DataFusion",schema:gg,color:"#202A37",logo:"datafusion",connectionLibraries:{libraries:["ibis"],preferred:"ibis"}},{name:"PySpark",schema:_g,color:"#1C5162",logo:"pyspark",connectionLibraries:{libraries:["ibis"],preferred:"ibis"}},{name:"Redshift",schema:bg,color:"#522BAE",logo:"redshift",connectionLibraries:{libraries:["redshift"],preferred:"redshift"}}],Sg=[{name:"Iceberg",schema:pg,color:"#000000",logo:"iceberg",connectionLibraries:{libraries:["pyiceberg"],preferred:"pyiceberg"}}],zC=t=>{const e=X.c(14),{onSelect:n}=t;let o;e[0]!==n?(o=h=>{const{name:f,schema:m,color:_,logo:g}=h;return d.jsxs("button",{type:"button",className:"py-3 flex flex-col items-center justify-center gap-1 transition-all hover:scale-105 hover:brightness-110 rounded shadow-smSolid hover:shadow-mdSolid",style:{backgroundColor:_},onClick:()=>n(m),children:[d.jsx(r4,{name:g,className:"w-8 h-8 text-white brightness-0 invert dark:invert"}),d.jsx("span",{className:"text-white font-medium text-lg",children:f})]},f)},e[0]=n,e[1]=o):o=e[1];const r=o;let s,i,a,l,c,u;return e[2]!==r?(s=kg.map(r),e[2]=r,e[3]=s):s=e[3],e[4]!==s?(i=d.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:s}),e[4]=s,e[5]=i):i=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(a=d.jsxs("h4",{className:"font-semibold text-muted-foreground text-lg flex items-center gap-4",children:["Data Catalogs",d.jsx("hr",{className:"flex-1"})]}),e[6]=a):a=e[6],e[7]!==r?(l=Sg.map(r),e[7]=r,e[8]=l):l=e[8],e[9]!==l?(c=d.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:l}),e[9]=l,e[10]=c):c=e[10],e[11]!==i||e[12]!==c?(u=d.jsxs(d.Fragment,{children:[i,a,c]}),e[11]=i,e[12]=c,e[13]=u):u=e[13],u},BC=[{isMatch:t=>{if(t instanceof Z3||t instanceof tB){const{optionRegex:e}=qe.parse(t._def.description||"");return!!e}return!1},Component:({schema:t,form:e,path:n})=>{const{secretKeys:o,providerNames:r,refreshSecrets:s}=M.use(vg),{openModal:i,closeModal:a}=Hn(),{label:l,description:c,optionRegex:u=""}=qe.parse(t._def.description||""),[h,f]=Lt(o,m=>new RegExp(u,"i").test(m));return d.jsx(J3,{control:e.control,name:n,render:({field:m})=>d.jsxs(K3,{children:[d.jsx(Zz,{children:l}),d.jsx(Qz,{children:c}),d.jsx(X3,{children:d.jsxs("div",{className:"flex gap-2",children:[t instanceof Z3?d.jsx(sr,{...m,value:m.value,onChange:m.onChange,className:Ne("flex-1")}):d.jsx(eB,{...m,value:m.value,onChange:m.onChange,className:"flex-1"}),d.jsxs(Pr,{children:[d.jsx(Lr,{asChild:!0,children:d.jsx(Me,{variant:"outline",size:"icon",className:Ne(Ea(m.value)&&"bg-accent"),children:d.jsx(Zc,{className:"h-3 w-3"})})}),d.jsxs(Fr,{align:"end",className:"max-h-60 overflow-y-auto",children:[d.jsxs(Gt,{onSelect:()=>{i(d.jsx(wg,{providerNames:r,onSuccess:_=>{s(),m.onChange(gd(_)),a()},onClose:a}))},children:[d.jsx(_a,{className:"mr-2 h-3.5 w-3.5"}),"Create a new secret"]}),h.length>0&&d.jsxs(d.Fragment,{children:[d.jsx(Sn,{}),d.jsx(Q3,{children:"Recommended"})]}),h.map(_=>d.jsx(Gt,{onSelect:()=>m.onChange(gd(_)),children:_},_)),f.length>0&&d.jsx(Sn,{}),f.map(_=>d.jsx(Gt,{onSelect:()=>m.onChange(gd(_)),children:_},_))]})]})]})}),d.jsx(e4,{})]})})}}],UC=t=>{var $;const e=X.c(49),{schema:n,onSubmit:o,onBack:r}=t;let s,i,a;e[0]!==n?(s=nB(n),e[0]=n,e[1]=s):s=e[1],e[2]!==n?(i=t4(n),e[2]=n,e[3]=i):i=e[3],e[4]!==s||e[5]!==i?(a={defaultValues:s,resolver:i,reValidateMode:"onChange"},e[4]=s,e[5]=i,e[6]=a):a=e[6];const l=n4(a),c=($=[...kg,...Sg].find(E=>E.schema===n))==null?void 0:$.connectionLibraries,[u,h]=M.useState((c==null?void 0:c.preferred)??"sqlalchemy"),{createNewCell:f}=Tt(),m=Os();let _;e[7]!==f||e[8]!==m?(_=E=>{f({code:E,before:!1,cellId:m??"__end__",skipIfCodeExists:!0})},e[7]=f,e[8]=m,e[9]=_):_=e[9];const g=_;let p;e[10]!==g||e[11]!==o||e[12]!==u?(p=E=>{g(function(W,G){if(!(G in xg))throw new Error(`Unsupported library: ${G}`);pC.parse(W);const q=new MC,Y=q.createGenerator(W,G),te=Y.generateConnectionCode(),oe=q.secrets,se=[...new Set([...oe.imports,...Y.imports])].sort();se.push("");const Z=oe.formatSecrets();return Z&&se.push(Z),se.push(te.trim()),se.join(`
|
98
|
-
`)}(E,u)),o()},e[10]=g,e[11]=o,e[12]=u,e[13]=p):p=e[13];const b=p;let x;e[14]!==l||e[15]!==b?(x=l.handleSubmit(b),e[14]=l,e[15]=b,e[16]=x):x=e[16];let y,v;e[17]===Symbol.for("react.memo_cache_sentinel")?(y=d.jsx(oB,{}),e[17]=y):y=e[17],e[18]!==l||e[19]!==n?(v=d.jsx(DC,{children:d.jsx(rB,{schema:n,form:l,renderers:BC,children:y})}),e[18]=l,e[19]=n,e[20]=v):v=e[20];let C;e[21]!==r?(C=d.jsx(Me,{type:"button",variant:"outline",onClick:r,children:"Back"}),e[21]=r,e[22]=C):C=e[22];const k=!l.formState.isValid;let N,j;e[23]!==k?(N=d.jsx(Me,{type:"submit",disabled:k,children:"Add"}),e[23]=k,e[24]=N):N=e[24],e[25]!==C||e[26]!==N?(j=d.jsxs("div",{className:"flex gap-2",children:[C,N]}),e[25]=C,e[26]=N,e[27]=j):j=e[27];const I=ic;let T,A;e[28]===Symbol.for("react.memo_cache_sentinel")?(T=E=>h(E),e[28]=T):T=e[28],e[29]===Symbol.for("react.memo_cache_sentinel")?(A=d.jsxs("div",{className:"flex flex-col gap-1 items-end",children:[d.jsx(ac,{children:d.jsx(lc,{placeholder:"Select a library"})}),d.jsx("span",{className:"text-xs text-muted-foreground",children:"Preferred connection library"})]}),e[29]=A):A=e[29];const R=cc,z=o4,D=c==null?void 0:c.libraries.map($C);let F,B,U,O,S;return e[30]!==z||e[31]!==D?(F=d.jsx(z,{children:D}),e[30]=z,e[31]=D,e[32]=F):F=e[32],e[33]!==R||e[34]!==F?(B=d.jsx(R,{children:F}),e[33]=R,e[34]=F,e[35]=B):B=e[35],e[36]!==I||e[37]!==u||e[38]!==T||e[39]!==A||e[40]!==B?(U=d.jsx("div",{children:d.jsxs(I,{value:u,onValueChange:T,children:[A,B]})}),e[36]=I,e[37]=u,e[38]=T,e[39]=A,e[40]=B,e[41]=U):U=e[41],e[42]!==j||e[43]!==U?(O=d.jsxs("div",{className:"flex gap-2 justify-between",children:[j,U]}),e[42]=j,e[43]=U,e[44]=O):O=e[44],e[45]!==O||e[46]!==x||e[47]!==v?(S=d.jsxs("form",{onSubmit:x,className:"space-y-4",children:[v,O]}),e[45]=O,e[46]=x,e[47]=v,e[48]=S):S=e[48],S},VC=t=>{const e=X.c(5),{onSubmit:n}=t,[o,r]=M.useState(null);if(!o){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=d.jsx(zC,{onSelect:r}),e[0]=a):a=e[0],a}let s,i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(s=()=>r(null),e[1]=s):s=e[1],e[2]!==n||e[3]!==o?(i=d.jsx(UC,{schema:o,onSubmit:n,onBack:s}),e[2]=n,e[3]=o,e[4]=i):i=e[4],i},Cg=t=>{const e=X.c(6),{children:n}=t,[o,r]=M.useState(!1);let s,i,a;return e[0]!==n?(s=d.jsx(sB,{asChild:!0,children:n}),e[0]=n,e[1]=s):s=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(i=d.jsx(Ng,{onClose:()=>r(!1)}),e[2]=i):i=e[2],e[3]!==o||e[4]!==s?(a=d.jsxs(iB,{open:o,onOpenChange:r,children:[s,i]}),e[3]=o,e[4]=s,e[5]=a):a=e[5],a},Ng=t=>{const e=X.c(4),{onClose:n}=t;let o,r,s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=d.jsx(rr,{children:"Add Connection"}),e[0]=o):o=e[0],e[1]===Symbol.for("react.memo_cache_sentinel")?(r=d.jsxs(Es,{className:"mb-4",children:[o,d.jsxs(Is,{children:["Connect to your database or data catalog to query data directly from your notebook. Learn more about how to connect to your database in our"," ",d.jsx(pm,{href:"https://docs.marimo.io/guides/working_with_data/sql/#connecting-to-a-custom-database",children:"docs."})]})]}),e[1]=r):r=e[1],e[2]!==n?(s=d.jsxs(ir,{className:"max-h-[75vh] overflow-y-auto",children:[r,d.jsx(VC,{onSubmit:()=>n()})]}),e[2]=n,e[3]=s):s=e[3],s};function $C(t){return d.jsx(Ki,{value:t,children:xg[t]},t)}const HC=()=>{const t=X.c(7),{selectedLayout:e}=zS(),{setLayoutView:n}=BS();if(un()&&!gm("wasm_layouts"))return null;let o,r,s,i;return t[0]!==n?(o=a=>n(a),t[0]=n,t[1]=o):o=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(r=d.jsx(ac,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:d.jsx(lc,{placeholder:"Select a view"})}),t[2]=r):r=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(s=d.jsx(cc,{children:d.jsxs(o4,{children:[d.jsx(aB,{children:"View as"}),US.map(qC)]})}),t[3]=s):s=t[3],t[4]!==e||t[5]!==o?(i=d.jsxs(ic,{"data-testid":"layout-select",value:e,onValueChange:o,children:[r,s]}),t[4]=e,t[5]=o,t[6]=i):i=t[6],i};function WC(t){const e=jg(t);return d.jsx(e,{className:"h-4 w-4"})}function jg(t){switch(t){case"vertical":return Sp;case"grid":return _H;case"slides":return nd;default:return dc(t),uc}}function Eg(t){return _m(t)}function qC(t){return d.jsx(Ki,{value:t,children:d.jsxs("div",{className:"flex items-center gap-1.5 leading-5",children:[WC(t),d.jsx("span",{children:Eg(t)})]})},t)}const GC=()=>{const t=X.c(2),{updateCellConfig:e}=Tt();let n;return t[0]!==e?(n=async()=>{const o=new Xi,r=$n(),s=r.cellIds.inOrderIds,i={};for(const l of s){if(r.cellData[l]===void 0)continue;const{code:c,config:u}=r.cellData[l];u.hide_code||o.isSupported(c)&&(i[l]={hide_code:!0})}const a=rc.entries(i);if(a.length!==0){await Mr({configs:i});for(const[l,c]of a)e({cellId:l,config:c})}},t[0]=e,t[1]=n):n=t[1],n};function Ig(){const t=X.c(3),{openConfirm:e}=Hn(),n=Zt(hn);let o;return t[0]!==e||t[1]!==n?(o=()=>{e({title:"Restart Kernel",description:"This will restart the Python kernel. You'll lose all data that's in memory. You will also lose any unsaved changes, so make sure to save your work before restarting.",variant:"destructive",confirmAction:d.jsx(s4,{onClick:async()=>{n({state:Bt.CLOSING}),await cB(),dB()},"aria-label":"Confirm Restart",children:"Restart"})})},t[0]=e,t[1]=n,t[2]=o):o=t[2],o}const Ks=t=>{t==null||t.preventDefault(),t==null||t.stopPropagation()};function Ag(){var E,W;const t=X.c(36),e=bm(),{openModal:n,closeModal:o}=Hn(),{toggleApplication:r}=Zi(),{selectedPanel:s}=fc(),[i]=on(nm),a=Ue(Ts),l=GC(),[c]=Dr(),{updateCellConfig:u,undoDeleteCell:h,clearAllCellOutputs:f,upsertSetupCell:m,collapseAllCells:_,expandAllCells:g}=Tt(),p=Ig(),b=Kp(),x=function(G){const q=X.c(4),{openPrompt:Y,closeModal:te}=Hn();let oe;return q[0]!==te||q[1]!==Y||q[2]!==G?(oe=()=>{if(!G)return null;const se=hc.guessDeliminator(G),Z=Cn.basename(G);Y({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${Z}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:Q=>{const ue=se.join(Cn.dirname(G),Q);lB({source:G,destination:ue}).then(()=>{te(),dt({title:"Notebook copied",description:"A copy of the notebook has been created."}),TS(ue)})}})},q[0]=te,q[1]=Y,q[2]=G,q[3]=oe):oe=q[3],oe}(e),y=Zt(md),v=Zt(bH),C=Zt(xH),k=Ue(uB),N=Ue(hB),j=Ue(i4),{selectedLayout:I}=zS(),{setLayoutView:T}=BS(),A=Jp(),R=((E=c.sharing)==null?void 0:E.html)??!0,z=((W=c.sharing)==null?void 0:W.wasm)??!0,D=_N;let F;t[0]===Symbol.for("react.memo_cache_sentinel")?(F=d.jsx(Lp,{size:14,strokeWidth:1.5}),t[0]=F):F=t[0];const B=!R&&!z;let U;t[1]===Symbol.for("react.memo_cache_sentinel")?(U=d.jsx(bB,{size:14,strokeWidth:1.5}),t[1]=U):U=t[1];const O=!R;let S,$;return t[2]!==o||t[3]!==n?(S=async()=>{n(d.jsx(tC,{onClose:o}))},t[2]=o,t[3]=n,t[4]=S):S=t[4],t[5]!==j||t[6]!==f||t[7]!==o||t[8]!==_||t[9]!==x||t[10]!==g||t[11]!==e||t[12]!==k||t[13]!==N||t[14]!==l||t[15]!==a||t[16]!==n||t[17]!==p||t[18]!==b||t[19]!==I||t[20]!==s||t[21]!==y||t[22]!==C||t[23]!==T||t[24]!==v||t[25]!==z||t[26]!==B||t[27]!==O||t[28]!==S||t[29]!==r||t[30]!==A||t[31]!==h||t[32]!==u||t[33]!==m||t[34]!==i.mode?($=[{icon:F,label:"Share",handle:Ks,hidden:B,dropdown:[{icon:U,label:"Publish HTML to web",hidden:O,handle:S},{icon:d.jsx(AS,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!z,handle:gN}]},{icon:d.jsx(xm,{size:14,strokeWidth:1.5}),label:"Download",handle:Ks,dropdown:[{icon:d.jsx($S,{size:14,strokeWidth:1.5}),label:"Download as HTML",handle:async()=>{e?await VS({filename:e,includeCode:!0}):dt({variant:"danger",title:"Error",description:"Notebooks must be named to be exported."})}},{icon:d.jsx($S,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{e?await VS({filename:e,includeCode:!1}):dt({variant:"danger",title:"Error",description:"Notebooks must be named to be exported."})}},{icon:d.jsx(nc,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:pN},{icon:d.jsx(dp,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:mN},{divider:!0,icon:d.jsx(Qm,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:i.mode!=="present",tooltip:i.mode==="present"?void 0:d.jsxs("span",{children:["Only available in app view. ",d.jsx("br",{}),"Toggle with: ",rn("global.hideCode",!1)]}),handle:fN},{icon:d.jsx(fB,{size:14,strokeWidth:1.5}),label:"Download as PDF",disabled:i.mode!=="present",tooltip:i.mode==="present"?void 0:d.jsxs("span",{children:["Only available in app view. ",d.jsx("br",{}),"Toggle with: ",rn("global.hideCode",!1)]}),handle:uN}]},{divider:!0,icon:d.jsx(Tp,{size:14,strokeWidth:1.5}),label:"Helper panel",handle:Ks,dropdown:cd.flatMap(G=>{const{type:q,Icon:Y,hidden:te}=G;return te?[]:{label:_m(q),rightElement:D(s===q),icon:d.jsx(Y,{size:14,strokeWidth:1.5}),handle:()=>r(q)}})},{icon:d.jsx(nd,{size:14,strokeWidth:1.5}),label:"Present as",handle:Ks,dropdown:[{icon:i.mode==="present"?d.jsx(a4,{size:14,strokeWidth:1.5}):d.jsx(Qc,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{A()}},...US.map((G,q)=>{const Y=jg(G);return{divider:q===0,label:Eg(G),icon:d.jsx(Y,{size:14,strokeWidth:1.5}),rightElement:d.jsx("div",{className:"w-8 flex justify-end",children:I===G&&d.jsx(mc,{size:14})}),handle:()=>{T(G),i.mode==="edit"&&A()}}})]},{icon:d.jsx(gp,{size:14,strokeWidth:1.5}),label:"Create notebook copy",hidden:!e||un(),handle:x},{icon:d.jsx(Yc,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!e,handle:dN},{icon:d.jsx(In,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!k||a,handle:async()=>{const G=$n(),q=mB(G),Y=rc.fromEntries(q.map(cN));await Mr({configs:Y});for(const te of q)u({cellId:te,config:{disabled:!1}})}},{icon:d.jsx(En,{size:14,strokeWidth:1.5}),label:"Disable all cells",hidden:!N||a,handle:async()=>{const G=$n(),q=O3(G),Y=rc.fromEntries(q.map(lN));await Mr({configs:Y});for(const te of q)u({cellId:te,config:{disabled:!0}})}},{icon:d.jsx(V3,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:l},{icon:d.jsx(lp,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:_},{icon:d.jsx(ap,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:g},{icon:d.jsx(hp,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{m({code:"# Initialization code that runs before all other cells"})}},{icon:d.jsx(Zl,{size:14,strokeWidth:1.5}),label:"Clear all outputs",handle:()=>{f()}},{icon:d.jsx(mp,{size:14,strokeWidth:1.5}),label:"Re-run all cells",hotkey:"global.runAll",handle:async()=>{b()}},{icon:d.jsx(id,{size:14,strokeWidth:1.5}),label:"Undo cell deletion",hidden:!j||a,handle:()=>{h()}},{icon:d.jsx(ar,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n(d.jsx(Ng,{onClose:o}))}},{divider:!0,icon:d.jsx(Jc,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>y(aN)},{icon:d.jsx(ym,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>v(iN)},{icon:d.jsx(kp,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>C(sN)},{icon:d.jsx(MS,{size:14,strokeWidth:1.5}),label:"Open documentation",handle:rN},{icon:d.jsx(pc,{size:14,strokeWidth:1.5}),label:"Resources",handle:Ks,dropdown:[{icon:d.jsx(MS,{size:14,strokeWidth:1.5}),label:"Documentation",handle:oN},{icon:d.jsx(yH,{size:14,strokeWidth:1.5}),label:"GitHub",handle:nN},{icon:d.jsx(wH,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:tN},{icon:d.jsx(vH,{size:14,strokeWidth:1.5}),label:"YouTube",handle:eN},{icon:d.jsx(rm,{size:14,strokeWidth:1.5}),label:"Changelog",handle:QC}]},{divider:!0,icon:d.jsx(wp,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:ZC},{icon:d.jsx(xa,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:XC},{icon:d.jsx($p,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:p}].filter(KC).map(YC),t[5]=j,t[6]=f,t[7]=o,t[8]=_,t[9]=x,t[10]=g,t[11]=e,t[12]=k,t[13]=N,t[14]=l,t[15]=a,t[16]=n,t[17]=p,t[18]=b,t[19]=I,t[20]=s,t[21]=y,t[22]=C,t[23]=T,t[24]=v,t[25]=z,t[26]=B,t[27]=O,t[28]=S,t[29]=r,t[30]=A,t[31]=h,t[32]=u,t[33]=m,t[34]=i.mode,t[35]=$):$=t[35],$}function YC(t){return t.dropdown?{...t,dropdown:t.dropdown.filter(JC)}:t}function JC(t){return!t.hidden}function KC(t){return!t.hidden}function XC(){const t=_B();window.open(t,"_blank")}function ZC(){const t=document.baseURI.split("?")[0];window.open(t,"_self")}function QC(){window.open(Qn.releasesPage,"_blank")}function eN(){window.open(Qn.youtube,"_blank")}function tN(){window.open(Qn.discordLink,"_blank")}function nN(){window.open(Qn.githubPage,"_blank")}function oN(){window.open(Qn.docsPage,"_blank")}function rN(){window.open(Qn.docsPage,"_blank")}function sN(t){return!t}function iN(t){return!t}function aN(t){return!t}function lN(t){return[t,{disabled:!0}]}function cN(t){return[t,{disabled:!1}]}async function dN(){const t=await wm();await _n(t.contents),dt({title:"Copied",description:"Code copied to clipboard."})}async function uN(){const t=new Event("export-beforeprint"),e=new Event("export-afterprint");window.dispatchEvent(t),setTimeout(hN,0),setTimeout(()=>window.dispatchEvent(e),0)}function hN(){return window.print()}async function fN(){const t=document.getElementById("App");t&&await L3(t,document.title)}async function mN(){const t=await wm();Qi(new Blob([t.contents],{type:"text/plain"}),l4.toPY(document.title))}async function pN(){const t=await gB({download:!1});Qi(new Blob([t],{type:"text/plain"}),l4.toMarkdown(document.title))}async function gN(){const t=await wm(),e=pB({code:t.contents});await _n(e),dt({title:"Copied",description:"Link copied to clipboard."})}function _N(t){return d.jsx("div",{className:"w-8 flex justify-end",children:t&&d.jsx(mc,{size:14})})}const bN=t=>{const e=X.c(28),{disabled:n,tooltip:o}=t,r=n!==void 0&&n,s=o===void 0?"Actions":o,i=Ag();let a,l,c;e[0]!==s?(a=d.jsx("div",{children:s}),e[0]=s,e[1]=a):a=e[1],e[2]!==r?(l=!r&&d.jsxs("div",{className:"text-xs text-muted-foreground font-medium pt-1 -mt-2 border-t border-border flex items-center gap-2",children:[d.jsx("span",{children:"Open command palette"}),rn("global.commandPalette",!1)]}),e[2]=r,e[3]=l):l=e[3],e[4]!==a||e[5]!==l?(c=d.jsxs("div",{className:"flex flex-col gap-2",children:[a,l]}),e[4]=a,e[5]=l,e[6]=c):c=e[6];const u=c,h=r?"disabled":"hint-green";let f,m,_;e[7]===Symbol.for("react.memo_cache_sentinel")?(f=d.jsx(RH,{strokeWidth:1.8}),e[7]=f):f=e[7],e[8]!==u?(m=d.jsx(Te,{content:u,children:f}),e[8]=u,e[9]=m):m=e[9],e[10]!==r||e[11]!==h||e[12]!==m?(_=d.jsx(bn,{"aria-label":"Config",shape:"circle",size:"small",className:"h-[27px] w-[27px]","data-testid":"notebook-menu-dropdown",disabled:r,color:h,children:m}),e[10]=r,e[11]=h,e[12]=m,e[13]=_):_=e[13];const g=_,p=xN;let b;e[14]===Symbol.for("react.memo_cache_sentinel")?(b=I=>{const T=d.jsx(Gt,{variant:I.variant,disabled:I.disabled,onSelect:A=>I.handle(A),"data-testid":`notebook-menu-dropdown-${I.label}`,children:p(I)},I.label);return I.tooltip?d.jsx(Te,{content:I.tooltip,side:"left",delayDuration:100,children:d.jsx("span",{children:T})},I.label):T},e[14]=b):b=e[14];const x=b;let y,v,C,k,N,j;if(e[15]!==g||e[16]!==r?(y=d.jsx(Lr,{asChild:!0,disabled:r,children:g}),e[15]=g,e[16]=r,e[17]=y):y=e[17],e[18]!==i){let I;e[20]===Symbol.for("react.memo_cache_sentinel")?(I=T=>T.hidden?null:T.dropdown?d.jsxs(xB,{children:[d.jsx(yB,{"data-testid":`notebook-menu-dropdown-${T.label}`,children:p(T)}),d.jsx(wB,{children:d.jsx(vB,{children:T.dropdown.map(A=>d.jsxs(K.Fragment,{children:[A.divider&&d.jsx(Sn,{}),x(A)]},A.label))})})]},T.label):d.jsxs(K.Fragment,{children:[T.divider&&d.jsx(Sn,{}),x(T)]},T.label),e[20]=I):I=e[20],v=i.map(I),e[18]=i,e[19]=v}else v=e[19];return e[21]===Symbol.for("react.memo_cache_sentinel")?(C=d.jsx(Sn,{}),e[21]=C):C=e[21],e[22]===Symbol.for("react.memo_cache_sentinel")?(k=d.jsx("div",{className:"flex-1 px-2 text-xs text-muted-foreground",children:d.jsxs("span",{children:["Version: ",c4()]})}),e[22]=k):k=e[22],e[23]!==v?(N=d.jsxs(Fr,{align:"end",className:"no-print w-[240px]",children:[v,C,k]}),e[23]=v,e[24]=N):N=e[24],e[25]!==y||e[26]!==N?(j=d.jsxs(Pr,{modal:!1,children:[y,N]}),e[25]=y,e[26]=N,e[27]=j):j=e[27],j};function xN(t){return d.jsxs(d.Fragment,{children:[t.icon&&d.jsx("span",{className:"flex-0 mr-2",children:t.icon}),d.jsx("span",{className:"flex-1",children:t.labelElement||t.label}),t.hotkey&&d.jsx(kB,{shortcut:t.hotkey,className:"ml-4"}),t.rightElement]})}function _d(t){return Fo("create"in t,'Expected query to have a "create" method'),t}const Qt=SB({findText:"",replaceText:"",caseSensitive:!1,wholeWord:!1,regexp:!1,isOpen:!1,currentView:void 0},(t,e)=>{if(e===void 0)return t;switch(e.type){case"setFind":return{...t,findText:e.find};case"setReplace":return{...t,replaceText:e.replace};case"setCaseSensitive":return{...t,caseSensitive:e.caseSensitive};case"setWholeWord":return{...t,wholeWord:e.wholeWord};case"setRegex":return{...t,regexp:e.regexp};case"setIsOpen":return{...t,isOpen:e.isOpen};case"setCurrentView":return{...t,currentView:{view:e.view,range:e.range}};case"clearCurrentView":return{...t,currentView:void 0}}});function Tg(t){if([...document.querySelectorAll('[role="dialog"][data-state="open"]')].some(e=>e instanceof HTMLElement&&e.childNodes.length>0))return!1;if(t){const e=t.state.selection.main,n=t.state.sliceDoc(e.from,e.to);n?(lt.set(Qt,{type:"setFind",find:n}),lt.set(Qt,{type:"setCurrentView",view:t,range:{from:e.from,to:e.to}})):lt.set(Qt,{type:"setCurrentView",view:t,range:{from:0,to:0}})}return lt.get(Qt).isOpen?(lt.set(Qt,{type:"setIsOpen",isOpen:!1}),requestAnimationFrame(()=>{lt.set(Qt,{type:"setIsOpen",isOpen:!0})}),!0):(lt.set(Qt,{type:"setIsOpen",isOpen:!0}),!0)}function yN(){return!!lt.get(Qt).isOpen&&(lt.set(Qt,{type:"setIsOpen",isOpen:!1}),!0)}function Aa(t){return()=>{const e=lt.get(Qt),n=new gc({search:e.findText,caseSensitive:e.caseSensitive,regexp:e.regexp,replace:e.replaceText,wholeWord:e.wholeWord});return!!n.valid&&t({query:_d(n).create(),search:n})}}const Mg=t=>Aa(({query:e})=>{const n=Ds(),o=lt.get(Qt).currentView||{view:n[0],range:{from:0,to:0}};let r=o.range.to;t==="prev"&&(n.reverse(),r=o.range.from);let s=n.indexOf(o.view);s<0&&(s=0);const i=[...n,...n].slice(s);for(const a of i){const l=t==="next"?e.nextMatch(a.state,0,r??0):e.prevMatch(a.state,r??a.state.doc.length,a.state.doc.length);if(!l){r=null,a.dispatch({selection:zo.single(0)});continue}const c=zo.single(l.from,l.to);return a.dispatch({selection:c,effects:[et.scrollIntoView(c.main,{y:"center"})],userEvent:"select.search"}),lt.set(Qt,{type:"setCurrentView",view:a,range:{from:l.from,to:l.to}}),l}return!1}),bd=Mg("next"),Og=Mg("prev"),wN=Aa(({query:t})=>{var o;const e=Ds(),n=[];for(const r of e){if(r.state.readOnly)continue;const s=(o=t.matchAll(r.state,1e9))==null?void 0:o.map(a=>{const{from:l,to:c}=a;return{from:l,to:c,insert:t.getReplacement(a)}});if(!s||s.length===0)continue;const i=r.state.doc.toString();n.push(()=>{r.dispatch({changes:[{from:0,to:r.state.doc.length,insert:i}],userEvent:"input.replace.all"})}),r.dispatch({changes:s,userEvent:"input.replace.all"})}return()=>{for(const r of n)r()}}),vN=Aa(({query:t})=>{const e=Ds(),n=lt.get(Qt).currentView||{view:e[0],range:{from:0}};let o=n.range.from,r=e.indexOf(n.view);r<0&&(r=0);const s=[...e,...e].slice(r);for(const i of s){const a=t.nextMatch(i.state,0,o??0);if(!a){o=null,i.dispatch({selection:zo.single(0)});continue}const l=i.state.toText(t.getReplacement(a));return i.dispatch({changes:[{from:a.from,to:a.to,insert:l}],userEvent:"input.replace"}),bd()}return!1}),kN=Aa(({query:t})=>{const e=Ds();let n=0;const o=new Map;for(const r of e){const s=t.matchAll(r.state,1e9)||[];for(const i of s){const{from:a,to:l}=i,c=o.get(r)||new Map;c.set(`${a}:${l}`,n++),o.set(r,c)}}return{count:n,position:o}}),xd=Mt.define();function Dg(){const t=Ds();for(const e of t)e.state.readOnly||e.dispatch({effects:xd.of(new gc({search:""}))})}const Ta=jn.define({create(){const t=lt.get(Qt);return _d(new gc({search:t.findText,caseSensitive:t.caseSensitive,regexp:t.regexp,replace:t.replaceText,wholeWord:t.wholeWord})).create()},update(t,e){for(const n of e.effects)n.is(xd)&&(t=_d(n.value).create());return t}}),SN=ct.mark({class:"cm-searchMatch"}),CN=ct.mark({class:"cm-searchMatch cm-searchMatch-selected"}),NN=Nn.fromClass(class{constructor(t){this.view=t,this.decorations=void 0,this.decorations=this.highlight(t.state.field(Ta))}update(t){const e=t.state.field(Ta);(e!==t.startState.field(Ta)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight(t){if(!t.spec.valid)return ct.none;const{view:e}=this,n=new Rs,o=e.visibleRanges,r=o.length;for(let s=0;s<r;s++){let{to:i}=o[s];const{from:a}=o[s];for(;s<r-1&&i>o[s+1].from-500;)i=o[++s].to;t.highlight(e.state,a,i,(l,c)=>{const u=e.state.selection.ranges.some(h=>h.from===l&&h.to===c);n.add(l,c,u?CN:SN)})}return n.finish()}},{decorations:t=>t.decorations}),jN=et.baseTheme({"&light .cm-searchMatch":{backgroundColor:"#99ff7780"},"&dark .cm-searchMatch":{backgroundColor:"#22bb0070"},"&light .cm-searchMatch-selected":{backgroundColor:"transparent"},"&dark .cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff88 !important"}}),EN=()=>{var Ve;const t=X.c(102),[e,n]=M.useState(!1),[o,r]=on(Qt),[s,i]=M.useState(),a=M.useRef(null),l=Ue(cm);let c,u;t[0]!==e||t[1]!==o.isOpen?(c=()=>(!e||!o.isOpen)&&Tg(),t[0]=e,t[1]=o.isOpen,t[2]=c):c=t[2],Yt("cell.findAndReplace",c),t[3]===Symbol.for("react.memo_cache_sentinel")?(u=()=>{const Pe=kN();i(Pe===!1?void 0:Pe)},t[3]=u):u=t[3];const h=u;let f,m,_,g;if(t[4]!==o.isOpen?(f=()=>{o.isOpen&&a.current&&(a.current.focus(),a.current.select())},m=[o.isOpen],t[4]=o.isOpen,t[5]=f,t[6]=m):(f=t[5],m=t[6]),M.useEffect(f,m),t[7]!==o.findText||t[8]!==o.isOpen?(_=()=>{if(o.isOpen){if(o.findText==="")return i(void 0),void Dg();h(),function(){const Pe=lt.get(Qt),rt=Ds();for(const Qe of rt)Qe.state.readOnly||Qe.dispatch({effects:xd.of(new gc({search:Pe.findText,caseSensitive:Pe.caseSensitive,regexp:Pe.regexp,replace:Pe.replaceText,wholeWord:Pe.wholeWord}))})}()}else Dg()},t[7]=o.findText,t[8]=o.isOpen,t[9]=_):_=t[9],t[10]!==o.caseSensitive||t[11]!==o.findText||t[12]!==o.isOpen||t[13]!==o.regexp||t[14]!==o.wholeWord?(g=[o.findText,o.isOpen,o.caseSensitive,o.regexp,o.wholeWord],t[10]=o.caseSensitive,t[11]=o.findText,t[12]=o.isOpen,t[13]=o.regexp,t[14]=o.wholeWord,t[15]=g):g=t[15],M.useEffect(_,g),!o.isOpen)return null;const p=o.currentView;let b;t[16]!==s||t[17]!==p?(b=p&&s?(Ve=s.position.get(p.view))==null?void 0:Ve.get(`${p.range.from}:${p.range.to}`):void 0,t[16]=s,t[17]=p,t[18]=b):b=t[18];const x=b;let y,v,C,k,N,j,I,T,A,R,z;t[19]===Symbol.for("react.memo_cache_sentinel")?(y=()=>n(!0),t[19]=y):y=t[19],t[20]===Symbol.for("react.memo_cache_sentinel")?(v=()=>n(!1),t[20]=v):v=t[20],t[21]!==r?(C=Pe=>{Pe.key==="Escape"&&r({type:"setIsOpen",isOpen:!1})},t[21]=r,t[22]=C):C=t[22],t[23]!==r?(k=()=>r({type:"setIsOpen",isOpen:!1}),t[23]=r,t[24]=k):k=t[24],t[25]===Symbol.for("react.memo_cache_sentinel")?(N=d.jsx(eo,{className:"w-4 h-4"}),t[25]=N):N=t[25],t[26]!==k?(j=d.jsx("div",{className:"absolute top-0 right-0",children:d.jsx(Me,{"data-testid":"close-find-replace-button",onClick:k,size:"xs",variant:"text",children:N})}),t[26]=k,t[27]=j):j=t[27],t[28]!==r?(I=Pe=>{r({type:"setFind",find:Pe.target.value})},t[28]=r,t[29]=I):I=t[29],t[30]!==o.findText||t[31]!==I?(T=d.jsx(sr,{ref:a,"data-testid":"find-input",value:o.findText,autoFocus:!0,className:"mr-2 mb-0",placeholder:"Find",onKeyDown:AN,onChange:I}),t[30]=o.findText,t[31]=I,t[32]=T):T=t[32],t[33]!==r?(A=Pe=>{r({type:"setReplace",replace:Pe.target.value})},t[33]=r,t[34]=A):A=t[34],t[35]!==o.replaceText||t[36]!==A?(R=d.jsx(sr,{"data-testid":"replace-input",value:o.replaceText,placeholder:"Replace",onChange:A}),t[35]=o.replaceText,t[36]=A,t[37]=R):R=t[37],t[38]!==T||t[39]!==R?(z=d.jsxs("div",{className:"flex flex-col flex-2 gap-2 w-[55%]",children:[T,R]}),t[38]=T,t[39]=R,t[40]=z):z=t[40];const D=o.caseSensitive?"on":"off";let F,B,U;t[41]!==r?(F=Pe=>r({type:"setCaseSensitive",caseSensitive:Pe}),t[41]=r,t[42]=F):F=t[42],t[43]===Symbol.for("react.memo_cache_sentinel")?(B=d.jsx(CB,{className:"w-4 h-4"}),t[43]=B):B=t[43],t[44]!==o.caseSensitive||t[45]!==D||t[46]!==F?(U=d.jsx(Te,{content:"Case Sensitive",children:d.jsx(vm,{size:"sm",pressed:o.caseSensitive,"data-state":D,onPressedChange:F,children:B})}),t[44]=o.caseSensitive,t[45]=D,t[46]=F,t[47]=U):U=t[47];const O=o.wholeWord?"on":"off";let S,$,E;t[48]!==r?(S=Pe=>r({type:"setWholeWord",wholeWord:Pe}),t[48]=r,t[49]=S):S=t[49],t[50]===Symbol.for("react.memo_cache_sentinel")?($=d.jsx(Yp,{className:"w-4 h-4"}),t[50]=$):$=t[50],t[51]!==o.wholeWord||t[52]!==O||t[53]!==S?(E=d.jsx(Te,{content:"Match Whole Word",children:d.jsx(vm,{size:"sm",pressed:o.wholeWord,"data-state":O,onPressedChange:S,children:$})}),t[51]=o.wholeWord,t[52]=O,t[53]=S,t[54]=E):E=t[54];const W=o.regexp?"on":"off";let G,q,Y,te,oe;t[55]!==r?(G=Pe=>r({type:"setRegex",regexp:Pe}),t[55]=r,t[56]=G):G=t[56],t[57]===Symbol.for("react.memo_cache_sentinel")?(q=d.jsx(Dp,{className:"w-4 h-4"}),t[57]=q):q=t[57],t[58]!==o.regexp||t[59]!==W||t[60]!==G?(Y=d.jsx(Te,{content:"Use Regular Expression",children:d.jsx(vm,{size:"sm",pressed:o.regexp,"data-state":W,onPressedChange:G,children:q})}),t[58]=o.regexp,t[59]=W,t[60]=G,t[61]=Y):Y=t[61],t[62]!==U||t[63]!==E||t[64]!==Y?(te=d.jsxs("div",{className:"flex items-center gap-[2px]",children:[U,E,Y]}),t[62]=U,t[63]=E,t[64]=Y,t[65]=te):te=t[65],t[66]===Symbol.for("react.memo_cache_sentinel")?(oe=()=>{vN()&&h()},t[66]=oe):oe=t[66];const se=o.findText==="";let Z,Q;t[67]!==se?(Z=d.jsx(Me,{"data-testid":"replace-next-button",size:"xs",variant:"outline",className:"h-6 text-xs",onClick:oe,disabled:se,children:"Replace Next"}),t[67]=se,t[68]=Z):Z=t[68],t[69]===Symbol.for("react.memo_cache_sentinel")?(Q=()=>{const Pe=wN();if(!Pe)return;h();const{dismiss:rt}=dt({title:"Replaced all occurrences",action:d.jsx(ud,{"data-testid":"undo-replace-all-button",onClick:()=>{Pe(),Qe()}})}),Qe=rt},t[69]=Q):Q=t[69];const ue=o.findText==="";let me,ce,fe,de,ke,Se,ie,je,pe,Ae,ze,De;return t[70]!==ue?(me=d.jsx(Me,{"data-testid":"replace-all-button",size:"xs",variant:"outline",className:"h-6 text-xs",onClick:Q,disabled:ue,children:"Replace All"}),t[70]=ue,t[71]=me):me=t[71],t[72]!==Z||t[73]!==me?(ce=d.jsxs("div",{className:"flex items-center gap-[2px]",children:[Z,me]}),t[72]=Z,t[73]=me,t[74]=ce):ce=t[74],t[75]!==te||t[76]!==ce?(fe=d.jsxs("div",{className:"flex flex-col gap-2",children:[te,ce]}),t[75]=te,t[76]=ce,t[77]=fe):fe=t[77],t[78]!==z||t[79]!==fe?(de=d.jsxs("div",{className:"flex items-center gap-3",children:[z,fe]}),t[78]=z,t[79]=fe,t[80]=de):de=t[80],t[81]===Symbol.for("react.memo_cache_sentinel")?(ke=d.jsx(Te,{content:"Find Previous",children:d.jsx(Me,{"data-testid":"find-prev-button",size:"xs",variant:"secondary",onClick:TN,children:d.jsx(jt,{className:"w-4 h-4"})})}),t[81]=ke):ke=t[81],t[82]===Symbol.for("react.memo_cache_sentinel")?(Se=d.jsx(Te,{content:"Find Next",children:d.jsx(Me,{"data-testid":"find-next-button",size:"xs",variant:"secondary",onClick:MN,children:d.jsx(Gc,{className:"w-4 h-4"})})}),t[82]=Se):Se=t[82],t[83]!==x||t[84]!==s?(ie=s!=null&&x==null&&d.jsxs("span",{className:"text-sm",children:[s.count," matches"]}),t[83]=x,t[84]=s,t[85]=ie):ie=t[85],t[86]!==x||t[87]!==s?(je=s!=null&&x!=null&&d.jsxs("span",{className:"text-sm",children:[x+1," of ",s.count]}),t[86]=x,t[87]=s,t[88]=je):je=t[88],t[89]!==ie||t[90]!==je?(pe=d.jsxs("div",{className:"flex items-center gap-2",children:[ke,Se,ie,je]}),t[89]=ie,t[90]=je,t[91]=pe):pe=t[91],t[92]!==l?(Ae=l.getHotkey("cell.findAndReplace"),t[92]=l,t[93]=Ae):Ae=t[93],t[94]!==Ae.key?(ze=d.jsxs("div",{className:"text-xs text-muted-foreground flex gap-1 mt-2",children:["Press"," ",d.jsx(hm,{shortcut:Ae.key})," ","again to open the native browser search."]}),t[94]=Ae.key,t[95]=ze):ze=t[95],t[96]!==j||t[97]!==de||t[98]!==pe||t[99]!==ze||t[100]!==C?(De=d.jsx(NB,{restoreFocus:!0,autoFocus:!0,children:d.jsxs("div",{onFocus:y,onClick:IN,onBlur:v,className:"fixed top-0 right-0 w-[500px] flex flex-col bg-[var(--sage-1)] p-4 z-50 mt-2 mr-3 rounded-md shadow-lg border gap-2 print:hidden",onKeyDown:C,children:[j,de,pe,ze]})}),t[96]=j,t[97]=de,t[98]=pe,t[99]=ze,t[100]=C,t[101]=De):De=t[101],De};function IN(t){t.stopPropagation(),t.preventDefault()}function AN(t){t.key==="Enter"&&(t.shiftKey?Og():bd())}function TN(){return Og()}function MN(){return bd()}const Rg=t=>{const e=X.c(38),{resetOnBlur:n,placeholderText:o,initialValue:r,flexibleWidth:s,onNameChange:i,className:a}=t,l=n!==void 0&&n,c=r===void 0?null:r,u=s!==void 0&&s,[h,f]=M.useState(c);let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=[],e[0]=m):m=e[0];const[_,g]=M.useState(m),[p,b]=M.useState(!1),x=M.useRef(null),y=M.useRef(!1);let v,C,k;e[1]!==c?(v=()=>{f(c)},C=[c],e[1]=c,e[2]=v,e[3]=C):(v=e[2],C=e[3]),M.useEffect(v,C),e[4]===Symbol.for("react.memo_cache_sentinel")?(k=()=>{b(!0)},e[4]=k):k=e[4];const N=k;let j;e[5]!==c||e[6]!==l?(j=Q=>{var ue;(ue=Q.relatedTarget)!=null&&ue.closest(".filename-input")||(b(!1),l&&f(c))},e[5]=c,e[6]=l,e[7]=j):j=e[7];const I=j;let T;e[8]!==h?(T=Cn.dirname(h||""),e[8]=h,e[9]=T):T=e[9];const A=T,R=Cn.basename(h||""),z=_.filter(Q=>Cn.basename(Q.path).startsWith(R));let D,F;e[10]!==A||e[11]!==p?(D=async()=>{if(!p)return void g([]);const Q=await h4({path:A});g(Q.files)},F=[A,p],e[10]=A,e[11]=p,e[12]=D,e[13]=F):(D=e[12],F=e[13]);const{isPending:B}=Wn(D,F),U=function(Q,ue,me){if(Q&&!Q.endsWith("/")&&((gm("markdown")?new Set(["py","md","markdown","qmd"]):new Set(["py"])).has(Cn.extension(Q))||(Q=Q.endsWith(".")?`${Q}py`:Q.endsWith(".p")?`${Q}y`:`${Q}.py`),!ue.some(ce=>ce.path===Q||Cn.basename(ce.path)===Q)&&!(me&&(me===Q||Cn.basename(me)===Q))))return Q}(h,_,c),O=(U||z.length>0)&&d.jsxs(um,{className:"font-mono",children:[!B&&d.jsx(sc,{children:"No files"}),U&&d.jsxs(mo,{variant:"success",className:"py-2 px-3",onSelect:()=>{var Q;U&&(y.current=!0,i(U),(Q=x.current)==null||Q.blur())},children:[d.jsx(pp,{className:"w-4 h-4 mr-2"})," ",d.jsxs("span",{className:"text-sm",children:[c?"Rename to: ":"Save as: ",d.jsx("span",{className:"font-medium text-sm",children:Cn.basename(U)})]})]},"_rename_"),z.map(Q=>{const ue=Q.isDirectory?"directory":d4(Q.path),me=u4[ue];return d.jsxs(mo,{variant:Q.isDirectory?"default":"muted",className:"py-2 px-3",onSelect:()=>{Q.isDirectory?f(`${Q.path}/`):f(Q.path)},children:[d.jsx(me,{className:"w-4 h-4 mr-2"})," ",Cn.basename(Q.path)]},Q.path)})]}),S=10*Math.max(20,(h==null?void 0:h.length)||(o==null?void 0:o.length)||0),$=p?h||"":c||"";let E,W,G;e[14]!==u||e[15]!==S?(E=u?{maxWidth:S}:void 0,e[14]=u,e[15]=S,e[16]=E):E=e[16],e[17]!==a?(W=Ne(a,"w-full px-4 py-1 my-1 h-9 font-mono text-foreground/60"),e[17]=a,e[18]=W):W=e[18],e[19]!==o||e[20]!==$||e[21]!==E||e[22]!==W?(G=d.jsx(jB,{children:d.jsx(Ji,{"data-testid":"dir-completion-input",tabIndex:-1,rootClassName:"border-none justify-center px-1",spellCheck:"false",value:$,onKeyDown:ON,icon:null,ref:x,onValueChange:f,placeholder:o,autoComplete:"off",style:E,className:W})}),e[19]=o,e[20]=$,e[21]=E,e[22]=W,e[23]=G):G=e[23];const q=O&&"group-focus-within:block";let Y,te,oe,se,Z;return e[24]!==q?(Y=Ne("p-0 w-full min-w-80 max-w-80vw hidden",q),e[24]=q,e[25]=Y):Y=e[25],e[26]!==O||e[27]!==Y?(te=d.jsx(Ps,{side:"bottom",className:Y,portal:!1,children:O}),e[26]=O,e[27]=Y,e[28]=te):te=e[28],e[29]!==G||e[30]!==te?(oe=d.jsxs(um,{children:[G,te]}),e[29]=G,e[30]=te,e[31]=oe):oe=e[31],e[32]!==I||e[33]!==oe?(se=d.jsx(_c,{onFocus:N,onBlur:I,shouldFilter:!1,id:"filename-input",className:"bg-transparent group filename-input",children:oe}),e[32]=I,e[33]=oe,e[34]=se):se=e[34],e[35]!==p||e[36]!==se?(Z=d.jsx(bc,{children:d.jsx(zr,{open:p,modal:!1,children:se})}),e[35]=p,e[36]=se,e[37]=Z):Z=e[37],Z};function ON(t){t.key==="Escape"&&t.currentTarget.blur()}const DN=t=>{const e=X.c(33),n=()=>{Qi(new Blob([o()],{type:"text/plain"}),`${t.proposedName}.json`)},o=Ke(LN);let r,s,i,a,l,c,u,h,f,m,_,g,p,b,x,y,v;return e[0]!==n||e[1]!==t?(r=C=>{C.preventDefault(),n(),t.closeModal()},e[0]=n,e[1]=t,e[2]=r):r=e[2],e[3]!==t?(s=C=>{C.key==="Escape"&&t.closeModal()},e[3]=t,e[4]=s):s=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(i=d.jsx(rr,{className:"text-accent-foreground mb-6",children:"Download unsaved changes?"}),e[5]=i):i=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(a={wordBreak:"break-word"},e[6]=a):a=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(l=d.jsx("p",{children:"This app has unsaved changes. To recover:"}),c={paddingBottom:"10px"},e[7]=l,e[8]=c):(l=e[7],c=e[8]),e[9]!==t.proposedName?(u=d.jsxs("li",{style:c,children:['Click the "Download" button. This will download a file called\xA0',d.jsxs("code",{children:[t.proposedName,".json"]}),". This file contains your code."]}),e[9]=t.proposedName,e[10]=u):u=e[10],e[11]===Symbol.for("react.memo_cache_sentinel")?(h={paddingBottom:"10px"},e[11]=h):h=e[11],e[12]===Symbol.for("react.memo_cache_sentinel")?(f={display:"block",padding:"10px"},e[12]=f):f=e[12],e[13]!==t.proposedName?(m=d.jsxs("code",{style:f,children:["marimo recover ",t.proposedName,".json ",">"," ",t.proposedName,".py"]}),e[13]=t.proposedName,e[14]=m):m=e[14],e[15]!==t.proposedName?(_=d.jsxs("code",{children:[t.proposedName,".py"]}),e[15]=t.proposedName,e[16]=_):_=e[16],e[17]!==_||e[18]!==m?(g=d.jsxs("li",{style:h,children:["In your terminal, type",m,"to overwrite ",_," with the recovered changes."]}),e[17]=_,e[18]=m,e[19]=g):g=e[19],e[20]!==g||e[21]!==u?(p=d.jsx(Is,{className:"markdown break-words",style:a,children:d.jsxs("div",{className:"prose dark:prose-invert",children:[l,d.jsxs("ol",{children:[u,g]})]})}),e[20]=g,e[21]=u,e[22]=p):p=e[22],e[23]!==t.closeModal?(b=d.jsx(Me,{"aria-label":"Cancel",variant:"secondary","data-testid":"cancel-recovery-button",onClick:t.closeModal,children:"Cancel"}),e[23]=t.closeModal,e[24]=b):b=e[24],e[25]===Symbol.for("react.memo_cache_sentinel")?(x=d.jsx(Me,{"data-testid":"download-recovery-button","aria-label":"Download",variant:"default",type:"submit",children:"Download"}),e[25]=x):x=e[25],e[26]!==b?(y=d.jsxs(Wi,{children:[b,x]}),e[26]=b,e[27]=y):y=e[27],e[28]!==r||e[29]!==s||e[30]!==p||e[31]!==y?(v=d.jsx(ir,{className:"w-fit",children:d.jsxs("form",{onSubmit:r,onKeyDown:s,children:[i,p,y]})}),e[28]=r,e[29]=s,e[30]=p,e[31]=y,e[32]=v):v=e[32],v},RN=t=>{const e=X.c(12),{filename:n,needsSave:o}=t,{openModal:r,closeModal:s}=Hn();let i;e[0]!==n?(i=n===null?"app":Cn.basename(n).split(".")[0],e[0]=n,e[1]=i):i=e[1];const a=i;let l;e[2]!==s||e[3]!==o||e[4]!==r||e[5]!==a?(l=()=>{o&&r(d.jsx(DN,{proposedName:a,closeModal:s}))},e[2]=s,e[3]=o,e[4]=r,e[5]=a,e[6]=l):l=e[6];const c=l;let u;Yt("global.save",c),e[7]===Symbol.for("react.memo_cache_sentinel")?(u=rn("global.save"),e[7]=u):u=e[7];const h=o?"yellow":"gray";let f,m;return e[8]===Symbol.for("react.memo_cache_sentinel")?(f=d.jsx(wa,{strokeWidth:1.5,size:18}),e[8]=f):f=e[8],e[9]!==c||e[10]!==h?(m=d.jsx(Te,{content:u,children:d.jsx(bn,{onClick:c,id:"save-button","aria-label":"Save",className:"rectangle",color:h,children:f})}),e[9]=c,e[10]=h,e[11]=m):m=e[11],m};function PN(t){return{id:t.id,name:t.name,code:t.code,code_hash:null,config:{column:0,...t.config}}}function LN(){const t=$n(),e=km(t),n={version:"1",metadata:{marimo_version:c4()},cells:e.map(PN)};return JSON.stringify(n,null,2)}const yd=5e3;async function FN(){await TB({download:!1})}async function zN(){await AB({download:!1,includeCode:!0,files:PS.INSTANCE.filenames()})}async function BN(){await IB({download:!1})}const wd=qt(void 0),Pg=qt(t=>{const e=t(wd);return function(n,o,r){if(!r)return!1;const{cellIds:s,cellData:i}=n,a=s.inOrderIds.map(h=>i[h]),l=a.map(h=>h.code),c=a.map(h=>h.config),u=a.map(h=>h.name);return!(f4(l,r.codes)&&f4(u,r.names)&&ea(c,r.configs)&&ea(o.selectedLayout,r.layout.selectedLayout)&&ea(o.layoutData,r.layout.layoutData))}(t(im),t(HS),e)});function UN(t){return JSON.stringify(t)}const VN=t=>{const e=X.c(15),{kioskMode:n}=t,o=bm(),r=Ue(Pg),s=Ue(hn).state===Bt.CLOSED,{saveOrNameNotebook:i,saveIfNotebookIsPersistent:a}=Lg();let l,c,u;e[0]!==n||e[1]!==a?(l={onSave:a,kioskMode:n},e[0]=n,e[1]=a,e[2]=l):l=e[2],function(p){const b=X.c(14),x=Ue(g4),y=xc(),[v]=on(hn),C=Ue(Pg);let k,N;if(b[0]!==y){const R=km(y);k=R.map(GN),N=R.map(qN),b[0]=y,b[1]=k,b[2]=N}else k=b[1],N=b[2];const j=N;let I;b[3]!==y?(I=p4(y),b[3]=y,b[4]=I):I=b[4];const T=I;let A;b[5]!==x||b[6]!==j||b[7]!==k||b[8]!==T||b[9]!==v||b[10]!==C||b[11]!==p.kioskMode||b[12]!==p.onSave?(A={onSave:p.onSave,needsSave:C,codes:k,cellConfigs:T,cellNames:j,connStatus:v,config:x,kioskMode:p.kioskMode},b[5]=x,b[6]=j,b[7]=k,b[8]=T,b[9]=v,b[10]=C,b[11]=p.kioskMode,b[12]=p.onSave,b[13]=A):A=b[13],function(R){const z=X.c(21),{codes:D,cellConfigs:F,config:B,connStatus:U,cellNames:O,needsSave:S,kioskMode:$,onSave:E}=R,W=M.useRef(null);let G;z[0]!==D?(G=D.join(":"),z[0]=D,z[1]=G):G=z[1];const q=G;let Y;z[2]!==F?(Y=F.map(UN).join(":"),z[2]=F,z[3]=Y):Y=z[3];const te=Y;let oe;z[4]!==O?(oe=O.join(":"),z[4]=O,z[5]=oe):oe=z[5];const se=oe;let Z,Q;z[6]!==B||z[7]!==U.state||z[8]!==$||z[9]!==S||z[10]!==E?(Z=()=>{if(!$)return B.autosave==="after_delay"&&(W.current!==null&&clearTimeout(W.current),S&&U.state===Bt.OPEN&&(W.current=setTimeout(E,B.autosave_delay))),()=>{W.current!==null&&clearTimeout(W.current)}},z[6]=B,z[7]=U.state,z[8]=$,z[9]=S,z[10]=E,z[11]=Z):Z=z[11],z[12]!==te||z[13]!==se||z[14]!==q||z[15]!==B||z[16]!==U.state||z[17]!==$||z[18]!==S||z[19]!==E?(Q=[q,te,se,B,U.state,E,$,S],z[12]=te,z[13]=se,z[14]=q,z[15]=B,z[16]=U.state,z[17]=$,z[18]=S,z[19]=E,z[20]=Q):Q=z[20],M.useEffect(Z,Q)}(A)}(l),function(){const p=X.c(6),b=Ue(EB),{state:x}=Ue(hn),y=b.auto_download.includes("markdown"),v=b.auto_download.includes("html"),C=b.auto_download.includes("ipynb"),k=!y||x!==Bt.OPEN,N=!v||x!==Bt.OPEN,j=!C||x!==Bt.OPEN;let I,T,A;p[0]!==k?(I={delayMs:yd,whenVisible:!0,disabled:k},p[0]=k,p[1]=I):I=p[1],ha(BN,I),p[2]!==N?(T={delayMs:yd,whenVisible:!0,disabled:N},p[2]=N,p[3]=T):T=p[3],ha(zN,T),p[4]!==j?(A={delayMs:yd,whenVisible:!0,disabled:j},p[4]=j,p[5]=A):A=p[5],ha(FN,A)}(),e[3]!==r?(c=p=>{if(r)return p.preventDefault(),p.returnValue="You have unsaved changes. Are you sure you want to leave?",p.returnValue},e[3]=r,e[4]=c):c=e[4],sm(window,"beforeunload",c),e[5]!==i?(u=p=>{p.preventDefault(),p.stopPropagation(),i()},e[5]=i,e[6]=u):u=e[6];const h=u;if(Yt("global.save",i),s){let p;return e[7]!==o||e[8]!==r?(p=d.jsx(RN,{filename:o,needsSave:r}),e[7]=o,e[8]=r,e[9]=p):p=e[9],p}let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=rn("global.save"),e[10]=f):f=e[10];const m=r?"yellow":"hint-green";let _,g;return e[11]===Symbol.for("react.memo_cache_sentinel")?(_=d.jsx(wa,{strokeWidth:1.5,size:18}),e[11]=_):_=e[11],e[12]!==h||e[13]!==m?(g=d.jsx(Te,{content:f,children:d.jsx(bn,{"data-testid":"save-button",id:"save-button",shape:"rectangle",color:m,onClick:h,children:_})}),e[12]=h,e[13]=m,e[14]=g):g=e[14],g};function Lg(){const t=X.c(19),{openModal:e,closeModal:n,openAlert:o}=Hn(),r=Zt(wd),s=m4(),i=MB();let a;t[0]!==o||t[1]!==r||t[2]!==i?(a=(p,b)=>{const x=$n(),y=km(x),v=y.map(WN),C=y.map(HN),k=y.map($N),N=p4(x),j=i.get(hn),I=i.get(g4),T=i.get(HS);i.get(Ts)||C.length!==0&&(j.state===Bt.OPEN?(St.log("saving to ",p),OB({cellIds:v,codes:C,names:k,filename:p,configs:N,layout:PH(),persist:!0}).then(()=>{b&&I.format_on_save&&_4(),r({names:k,codes:C,configs:N,layout:T})})):o("Failed to save notebook: not connected to a kernel."))},t[0]=o,t[1]=r,t[2]=i,t[3]=a):a=t[3];const l=Ke(a);let c;t[4]!==l||t[5]!==i?(c=p=>{const b=p!==void 0&&p,x=i.get(b4),y=i.get(hn);Fg(x)&&y.state===Bt.OPEN&&l(x,b)},t[4]=l,t[5]=i,t[6]=c):c=t[6];const u=Ke(c);let h;t[7]!==l||t[8]!==s?(h=p=>{s(p).then(b=>{b!==null&&l(b,!0)})},t[7]=l,t[8]=s,t[9]=h):h=t[9];const f=h;let m;t[10]!==n||t[11]!==f||t[12]!==e||t[13]!==u||t[14]!==i?(m=()=>{const p=i.get(b4),b=i.get(hn);u(!0),Fg(p)||b.state===Bt.CLOSED||e(d.jsx(YN,{onClose:n,onSave:f}))},t[10]=n,t[11]=f,t[12]=e,t[13]=u,t[14]=i,t[15]=m):m=t[15];const _=Ke(m);let g;return t[16]!==u||t[17]!==_?(g={saveOrNameNotebook:_,saveIfNotebookIsPersistent:u},t[16]=u,t[17]=_,t[18]=g):g=t[18],g}function $N(t){return t.name}function HN(t){return t.code}function WN(t){return t.id}function Fg(t){return t!==null&&!t.startsWith("/tmp")&&!t.startsWith("/var/folders")&&!t.includes("AppData\\Local\\Temp")}function qN(t){return t.name}function GN(t){return t.code}const YN=t=>{const e=X.c(17),{onClose:n,onSave:o}=t,[r,s]=M.useState();let i;e[0]!==n||e[1]!==o?(i=p=>{s(p),p.trim()&&(o(p),n())},e[0]=n,e[1]=o,e[2]=i):i=e[2];const a=i;let l,c,u,h;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=d.jsx(rr,{children:"Save notebook"}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(Or,{className:"text-md pt-6 px-1",children:"Save as"}),e[4]=c):c=e[4],e[5]!==a?(u=d.jsxs("div",{className:"flex flex-col",children:[c,d.jsx(Rg,{onNameChange:a,placeholderText:"filename",className:"missing-filename"})]}),e[5]=a,e[6]=u):u=e[6],e[7]!==n?(h=d.jsx(Me,{"data-testid":"cancel-save-dialog-button","aria-label":"Cancel",variant:"secondary",onClick:n,children:"Cancel"}),e[7]=n,e[8]=h):h=e[8];const f=!r;let m,_,g;return e[9]!==f?(m=d.jsx(Me,{"data-testid":"submit-save-dialog-button","aria-label":"Save",variant:"default",disabled:f,type:"submit",children:"Save"}),e[9]=f,e[10]=m):m=e[10],e[11]!==h||e[12]!==m?(_=d.jsxs(Wi,{children:[h,m]}),e[11]=h,e[12]=m,e[13]=_):_=e[13],e[14]!==u||e[15]!==_?(g=d.jsxs(ir,{children:[l,u,_]}),e[14]=u,e[15]=_,e[16]=g):g=e[16],g};function zg(t){const e=X.c(3),[n,o]=M.useState(!1);let r,s;return e[0]!==t?(r=()=>{if(!t)return;o(!1);const i=setTimeout(()=>{o(!0)},200);return()=>clearTimeout(i)},s=[t],e[0]=t,e[1]=r,e[2]=s):(r=e[1],s=e[2]),M.useEffect(r,s),t&&n}const Xs=t=>{const{children:e}=t;return Ue(Ts)?null:e},JN=t=>{const{children:e}=t;return Ue(Ts)?e:null},KN=()=>{const t=X.c(6),e=Zt(md);let n;t[0]!==e?(n=()=>e(XN),t[0]=e,t[1]=n):n=t[1];const o=n;let r,s,i;return t[2]===Symbol.for("react.memo_cache_sentinel")?(r=rn("global.commandPalette"),t[2]=r):r=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(s=d.jsx(Jc,{strokeWidth:1.5,size:18}),t[3]=s):s=t[3],t[4]!==o?(i=d.jsx(Te,{content:r,children:d.jsx(bn,{"data-testid":"command-palette-button",onClick:o,shape:"rectangle",color:"hint-green",children:s})}),t[4]=o,t[5]=i):i=t[5],i};function XN(t){return!t}const ZN=t=>{const e=X.c(47),{presenting:n,onTogglePresenting:o,onInterrupt:r,onRun:s,connectionState:i,running:a,appConfig:l}=t,c=l.width,u=Ue(i4),h=Ue(DB),{undoDeleteCell:f}=Tt(),m=i===Bt.CLOSED;let _,g=null;if(!m&&u){let S,$;e[0]===Symbol.for("react.memo_cache_sentinel")?(S=d.jsx(id,{size:16,strokeWidth:1.5}),e[0]=S):S=e[0],e[1]!==f?($=d.jsx(Te,{content:"Undo cell deletion",children:d.jsx(bn,{"data-testid":"undo-delete-cell",size:"medium",color:"hint-green",shape:"circle",onClick:f,children:S})}),e[1]=f,e[2]=$):$=e[2],g=$}e[3]!==i?(_=po(i),e[3]=i,e[4]=_):_=e[4];const p=_;let b;e[5]!==i||e[6]!==p?(b=p?$c(i):void 0,e[5]=i,e[6]=p,e[7]=b):b=e[7];const x=b;let y,v;e[8]!==n?(y=!n&&d.jsx(EN,{}),e[8]=n,e[9]=y):y=e[9],e[10]!==m||e[11]!==x||e[12]!==p||e[13]!==n?(v=!m&&d.jsxs("div",{className:tj,children:[n&&d.jsx(HC,{}),d.jsx(bN,{disabled:p,tooltip:x}),d.jsx(kH,{disabled:p,tooltip:x}),d.jsx(SH,{description:"This will terminate the Python kernel. You'll lose all data that's in memory.",disabled:p,tooltip:x})]}),e[10]=m,e[11]=x,e[12]=p,e[13]=n,e[14]=v):v=e[14];const C=c==="compact"&&"xl:flex-row items-end";let k,N,j,I,T,A,R,z,D,F,B,U,O;return e[15]!==C?(k=Ne(nj,C),e[15]=C,e[16]=k):k=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(N=d.jsx(Xs,{children:d.jsx(VN,{kioskMode:!1})}),e[17]=N):N=e[17],e[18]===Symbol.for("react.memo_cache_sentinel")?(j=rn("global.hideCode"),e[18]=j):j=e[18],e[19]!==n?(I=n?d.jsx(a4,{strokeWidth:1.5,size:18}):d.jsx(Qc,{strokeWidth:1.5,size:18}),e[19]=n,e[20]=I):I=e[20],e[21]!==o||e[22]!==I?(T=d.jsx(Te,{content:j,children:d.jsx(bn,{"data-testid":"hide-code-button",id:"preview-button",shape:"rectangle",color:"hint-green",onClick:o,children:I})}),e[21]=o,e[22]=I,e[23]=T):T=e[23],e[24]===Symbol.for("react.memo_cache_sentinel")?(A=d.jsx(KN,{}),R=d.jsx(CH,{}),z=d.jsx("div",{}),e[24]=A,e[25]=R,e[26]=z):(A=e[24],R=e[25],z=e[26]),e[27]!==m||e[28]!==r||e[29]!==a?(D=!m&&d.jsx(ej,{running:a,onInterrupt:r}),e[27]=m,e[28]=r,e[29]=a,e[30]=D):D=e[30],e[31]!==m||e[32]!==h||e[33]!==s?(F=!m&&d.jsx(QN,{needsRun:h,onRun:s}),e[31]=m,e[32]=h,e[33]=s,e[34]=F):F=e[34],e[35]!==D||e[36]!==F||e[37]!==g?(B=d.jsx(Xs,{children:d.jsxs("div",{className:"flex flex-col gap-2 items-center",children:[g,D,F]})}),e[35]=D,e[36]=F,e[37]=g,e[38]=B):B=e[38],e[39]!==T||e[40]!==B||e[41]!==k?(U=d.jsxs("div",{className:k,children:[N,T,A,R,z,B]}),e[39]=T,e[40]=B,e[41]=k,e[42]=U):U=e[42],e[43]!==U||e[44]!==y||e[45]!==v?(O=d.jsxs(d.Fragment,{children:[y,v,U]}),e[43]=U,e[44]=y,e[45]=v,e[46]=O):O=e[46],O},QN=t=>{const e=X.c(8),{needsRun:n,onRun:o}=t,r=Ue(x4);if(n){let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=rn("global.runStale"),e[0]=l):l=e[0];const c=r?o:void 0,u=!r;let h,f;return e[1]===Symbol.for("react.memo_cache_sentinel")?(h=d.jsx(Gs,{strokeWidth:1.5,size:16}),e[1]=h):h=e[1],e[2]!==c||e[3]!==u?(f=d.jsx(Te,{content:l,children:d.jsx(bn,{"data-testid":"run-button",size:"medium",color:"yellow",shape:"circle",onClick:c,disabled:u,children:h})}),e[2]=c,e[3]=u,e[4]=f):f=e[4],f}const s=!r;let i,a;return e[5]===Symbol.for("react.memo_cache_sentinel")?(i=d.jsx(Gs,{strokeWidth:1.5,size:16}),e[5]=i):i=e[5],e[6]!==s?(a=d.jsx(Te,{content:"Nothing to run",children:d.jsx(bn,{"data-testid":"run-button",className:"inactive-button",color:"disabled",size:"medium",shape:"circle",disabled:s,children:i})}),e[6]=s,e[7]=a):a=e[7],a},ej=t=>{const e=X.c(8),{running:n,onInterrupt:o}=t,r=zg(n);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=rn("global.interrupt"),e[0]=s):s=e[0];const i=!r&&"inactive-button active:shadow-xsSolid";let a;e[1]!==i?(a=Ne(i),e[1]=i,e[2]=a):a=e[2];const l=r?"yellow":"disabled",c=r?o:kn.NOOP;let u,h;return e[3]===Symbol.for("react.memo_cache_sentinel")?(u=d.jsx(uc,{strokeWidth:1.5,size:16}),e[3]=u):u=e[3],e[4]!==a||e[5]!==l||e[6]!==c?(h=d.jsx(Te,{content:s,children:d.jsx(bn,{className:a,"data-testid":"interrupt-button",size:"medium",color:l,shape:"circle",onClick:c,children:u})}),e[4]=a,e[5]=l,e[6]=c,e[7]=h):h=e[7],h},tj="absolute top-3 right-5 m-0 flex items-center space-x-3 min-h-[28px] no-print pointer-events-auto z-30 print:hidden",nj="absolute bottom-5 right-5 flex flex-col gap-2 items-center no-print pointer-events-auto z-30 print:hidden",oj=t=>{const e=X.c(7),{filename:n}=t,o=m4();let r;e[0]!==n?(r=n?Cn.basename(n):"untitled marimo notebook",e[0]=n,e[1]=r):r=e[1];const s=n===null?"missing-filename":"filename";let i;return e[2]!==n||e[3]!==o||e[4]!==r||e[5]!==s?(i=d.jsx(Rg,{placeholderText:r,initialValue:n,onNameChange:o,flexibleWidth:!0,resetOnBlur:!0,"data-testid":"filename-input",className:s}),e[2]=n,e[3]=o,e[4]=r,e[5]=s,e[6]=i):i=e[6],i},rj={display:"none"};function sj(t){let{id:e,value:n}=t;return K.createElement("div",{id:e,style:rj},n)}function ij(t){let{id:e,announcement:n,ariaLiveType:o="assertive"}=t;return K.createElement("div",{id:e,style:{position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":o,"aria-atomic":!0},n)}const Bg=M.createContext(null),aj={draggable:`
|
99
|
-
To pick up a draggable item, press the space bar.
|
100
|
-
While dragging, use the arrow keys to move the item.
|
101
|
-
Press space again to drop the item in its new position, or press escape to cancel.
|
102
|
-
`},lj={onDragStart(t){let{active:e}=t;return"Picked up draggable item "+e.id+"."},onDragOver(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was moved over droppable area "+n.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was dropped over droppable area "+n.id:"Draggable item "+e.id+" was dropped."},onDragCancel(t){let{active:e}=t;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function cj(t){let{announcements:e=lj,container:n,hiddenTextDescribedById:o,screenReaderInstructions:r=aj}=t;const{announce:s,announcement:i}=function(){const[h,f]=M.useState("");return{announce:M.useCallback(m=>{m!=null&&f(m)},[]),announcement:h}}(),a=ta("DndLiveRegion"),[l,c]=M.useState(!1);if(M.useEffect(()=>{c(!0)},[]),function(h){const f=M.useContext(Bg);M.useEffect(()=>{if(!f)throw new Error("useDndMonitor must be used within a children of <DndContext>");return f(h)},[h,f])}(M.useMemo(()=>({onDragStart(h){let{active:f}=h;s(e.onDragStart({active:f}))},onDragMove(h){let{active:f,over:m}=h;e.onDragMove&&s(e.onDragMove({active:f,over:m}))},onDragOver(h){let{active:f,over:m}=h;s(e.onDragOver({active:f,over:m}))},onDragEnd(h){let{active:f,over:m}=h;s(e.onDragEnd({active:f,over:m}))},onDragCancel(h){let{active:f,over:m}=h;s(e.onDragCancel({active:f,over:m}))}}),[s,e])),!l)return null;const u=K.createElement(K.Fragment,null,K.createElement(sj,{id:o,value:r.draggable}),K.createElement(ij,{id:a,announcement:i}));return n?ra.createPortal(u,n):u}var Ft;function Ma(){}function Ug(t,e){return M.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(Ft||(Ft={}));const Jn=Object.freeze({x:0,y:0});function vd(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function kd(t,e){let{data:{value:n}}=t,{data:{value:o}}=e;return n-o}function dj(t,e){let{data:{value:n}}=t,{data:{value:o}}=e;return o-n}function Sd(t){let{left:e,top:n,height:o,width:r}=t;return[{x:e,y:n},{x:e+r,y:n},{x:e,y:n+o},{x:e+r,y:n+o}]}function Cd(t,e){if(!t||t.length===0)return null;const[n]=t;return e?n[e]:n}function Vg(t,e,n){return e===void 0&&(e=t.left),n===void 0&&(n=t.top),{x:e+.5*t.width,y:n+.5*t.height}}const Nd=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:o}=t;const r=Vg(e,e.left,e.top),s=[];for(const i of o){const{id:a}=i,l=n.get(a);if(l){const c=vd(Vg(l),r);s.push({id:a,data:{droppableContainer:i,value:c}})}}return s.sort(kd)};function uj(t,e){const n=Math.max(e.top,t.top),o=Math.max(e.left,t.left),r=Math.min(e.left+e.width,t.left+t.width),s=Math.min(e.top+e.height,t.top+t.height),i=r-o,a=s-n;if(o<r&&n<s){const l=e.width*e.height,c=t.width*t.height,u=i*a;return Number((u/(l+c-u)).toFixed(4))}return 0}const $g=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:o}=t;const r=[];for(const s of o){const{id:i}=s,a=n.get(i);if(a){const l=uj(a,e);l>0&&r.push({id:i,data:{droppableContainer:s,value:l}})}}return r.sort(dj)};function hj(t,e){const{top:n,left:o,bottom:r,right:s}=e;return n<=t.y&&t.y<=r&&o<=t.x&&t.x<=s}function Hg(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:Jn}function fj(t){return function(e){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return o.reduce((s,i)=>({...s,top:s.top+t*i.y,bottom:s.bottom+t*i.y,left:s.left+t*i.x,right:s.right+t*i.x}),{...e})}}const mj=fj(1),pj={ignoreTransform:!1};function Wr(t,e){e===void 0&&(e=pj);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:c,transformOrigin:u}=Bo(t).getComputedStyle(t);c&&(n=function(h,f,m){const _=function(N){if(N.startsWith("matrix3d(")){const j=N.slice(9,-1).split(/, /);return{x:+j[12],y:+j[13],scaleX:+j[0],scaleY:+j[5]}}if(N.startsWith("matrix(")){const j=N.slice(7,-1).split(/, /);return{x:+j[4],y:+j[5],scaleX:+j[0],scaleY:+j[3]}}return null}(f);if(!_)return h;const{scaleX:g,scaleY:p,x:b,y:x}=_,y=h.left-b-(1-g)*parseFloat(m),v=h.top-x-(1-p)*parseFloat(m.slice(m.indexOf(" ")+1)),C=g?h.width/g:h.width,k=p?h.height/p:h.height;return{width:C,height:k,top:v,right:y+C,bottom:v+k,left:y}}(n,c,u))}const{top:o,left:r,width:s,height:i,bottom:a,right:l}=n;return{top:o,left:r,width:s,height:i,bottom:a,right:l}}function Wg(t){return Wr(t,{ignoreTransform:!0})}function Oa(t,e){const n=[];return t?function o(r){if(e!=null&&n.length>=e||!r)return n;if(w4(r)&&r.scrollingElement!=null&&!n.includes(r.scrollingElement))return n.push(r.scrollingElement),n;if(!wc(r)||RB(r)||n.includes(r))return n;const s=Bo(t).getComputedStyle(r);return r!==t&&function(i,a){a===void 0&&(a=Bo(i).getComputedStyle(i));const l=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(c=>{const u=a[c];return typeof u=="string"&&l.test(u)})}(r,s)&&n.push(r),function(i,a){return a===void 0&&(a=Bo(i).getComputedStyle(i)),a.position==="fixed"}(r,s)?n:o(r.parentNode)}(t):n}function qg(t){const[e]=Oa(t,1);return e??null}function jd(t){return Nm&&t?jm(t)?t:FB(t)?w4(t)||t===Ls(t).scrollingElement?window:wc(t)?t:null:null:null}function Gg(t){return jm(t)?t.scrollX:t.scrollLeft}function Yg(t){return jm(t)?t.scrollY:t.scrollTop}function Ed(t){return{x:Gg(t),y:Yg(t)}}var Ut;function Jg(t){return!(!Nm||!t)&&t===document.scrollingElement}function Kg(t){const e={x:0,y:0},n=Jg(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},o={x:t.scrollWidth-n.width,y:t.scrollHeight-n.height};return{isTop:t.scrollTop<=e.y,isLeft:t.scrollLeft<=e.x,isBottom:t.scrollTop>=o.y,isRight:t.scrollLeft>=o.x,maxScroll:o,minScroll:e}}(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Ut||(Ut={}));const gj={x:.2,y:.2};function _j(t,e,n,o,r){let{top:s,left:i,right:a,bottom:l}=n;o===void 0&&(o=10),r===void 0&&(r=gj);const{isTop:c,isBottom:u,isLeft:h,isRight:f}=Kg(t),m={x:0,y:0},_={x:0,y:0},g=e.height*r.y,p=e.width*r.x;return!c&&s<=e.top+g?(m.y=Ut.Backward,_.y=o*Math.abs((e.top+g-s)/g)):!u&&l>=e.bottom-g&&(m.y=Ut.Forward,_.y=o*Math.abs((e.bottom-g-l)/g)),!f&&a>=e.right-p?(m.x=Ut.Forward,_.x=o*Math.abs((e.right-p-a)/p)):!h&&i<=e.left+p&&(m.x=Ut.Backward,_.x=o*Math.abs((e.left+p-i)/p)),{direction:m,speed:_}}function bj(t){if(t===document.scrollingElement){const{innerWidth:s,innerHeight:i}=window;return{top:0,left:0,right:s,bottom:i,width:s,height:i}}const{top:e,left:n,right:o,bottom:r}=t.getBoundingClientRect();return{top:e,left:n,right:o,bottom:r,width:t.clientWidth,height:t.clientHeight}}function Xg(t){return t.reduce((e,n)=>Fs(e,Ed(n)),Jn)}const xj=[["x",["left","right"],function(t){return t.reduce((e,n)=>e+Gg(n),0)}],["y",["top","bottom"],function(t){return t.reduce((e,n)=>e+Yg(n),0)}]];class Id{constructor(e,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const o=Oa(n),r=Xg(o);this.rect={...e},this.width=e.width,this.height=e.height;for(const[s,i,a]of xj)for(const l of i)Object.defineProperty(this,l,{get:()=>{const c=a(o),u=r[s]-c;return this.rect[l]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Zs{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var o;return(o=this.target)==null?void 0:o.removeEventListener(...n)})},this.target=e}add(e,n,o){var r;(r=this.target)==null||r.addEventListener(e,n,o),this.listeners.push([e,n,o])}}function Ad(t,e){const n=Math.abs(t.x),o=Math.abs(t.y);return typeof e=="number"?Math.sqrt(n**2+o**2)>e:"x"in e&&"y"in e?n>e.x&&o>e.y:"x"in e?n>e.x:"y"in e&&o>e.y}var An,at;function Zg(t){t.preventDefault()}function yj(t){t.stopPropagation()}(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(An||(An={})),function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"}(at||(at={}));const Qg={start:[at.Space,at.Enter],cancel:[at.Esc],end:[at.Space,at.Enter,at.Tab]},wj=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case at.Right:return{...n,x:n.x+25};case at.Left:return{...n,x:n.x-25};case at.Down:return{...n,y:n.y+25};case at.Up:return{...n,y:n.y-25}}};class Td{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:n}}=e;this.props=e,this.listeners=new Zs(Ls(n)),this.windowListeners=new Zs(Bo(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(An.Resize,this.handleCancel),this.windowListeners.add(An.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(An.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,o=e.node.current;o&&function(r,s){if(s===void 0&&(s=Wr),!r)return;const{top:i,left:a,bottom:l,right:c}=s(r);qg(r)&&(l<=0||c<=0||i>=window.innerHeight||a>=window.innerWidth)&&r.scrollIntoView({block:"center",inline:"center"})}(o),n(Jn)}handleKeyDown(e){if(Sm(e)){const{active:n,context:o,options:r}=this.props,{keyboardCodes:s=Qg,coordinateGetter:i=wj,scrollBehavior:a="smooth"}=r,{code:l}=e;if(s.end.includes(l))return void this.handleEnd(e);if(s.cancel.includes(l))return void this.handleCancel(e);const{collisionRect:c}=o.current,u=c?{x:c.left,y:c.top}:Jn;this.referenceCoordinates||(this.referenceCoordinates=u);const h=i(e,{active:n,context:o.current,currentCoordinates:u});if(h){const f=oa(h,u),m={x:0,y:0},{scrollableAncestors:_}=o.current;for(const g of _){const p=e.code,{isTop:b,isRight:x,isLeft:y,isBottom:v,maxScroll:C,minScroll:k}=Kg(g),N=bj(g),j={x:Math.min(p===at.Right?N.right-N.width/2:N.right,Math.max(p===at.Right?N.left:N.left+N.width/2,h.x)),y:Math.min(p===at.Down?N.bottom-N.height/2:N.bottom,Math.max(p===at.Down?N.top:N.top+N.height/2,h.y))},I=p===at.Right&&!x||p===at.Left&&!y,T=p===at.Down&&!v||p===at.Up&&!b;if(I&&j.x!==h.x){const A=g.scrollLeft+f.x,R=p===at.Right&&A<=C.x||p===at.Left&&A>=k.x;if(R&&!f.y)return void g.scrollTo({left:A,behavior:a});m.x=R?g.scrollLeft-A:p===at.Right?g.scrollLeft-C.x:g.scrollLeft-k.x,m.x&&g.scrollBy({left:-m.x,behavior:a});break}if(T&&j.y!==h.y){const A=g.scrollTop+f.y,R=p===at.Down&&A<=C.y||p===at.Up&&A>=k.y;if(R&&!f.x)return void g.scrollTo({top:A,behavior:a});m.y=R?g.scrollTop-A:p===at.Down?g.scrollTop-C.y:g.scrollTop-k.y,m.y&&g.scrollBy({top:-m.y,behavior:a});break}}this.handleMove(e,Fs(oa(h,this.referenceCoordinates),m))}}}handleMove(e,n){const{onMove:o}=this.props;e.preventDefault(),o(n)}handleEnd(e){const{onEnd:n}=this.props;e.preventDefault(),this.detach(),n()}handleCancel(e){const{onCancel:n}=this.props;e.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function e1(t){return!!(t&&"distance"in t)}function t1(t){return!!(t&&"delay"in t)}Td.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:o=Qg,onActivation:r}=e,{active:s}=n;const{code:i}=t.nativeEvent;if(o.start.includes(i)){const a=s.activatorNode.current;return(!a||t.target===a)&&(t.preventDefault(),r==null||r({event:t.nativeEvent}),!0)}return!1}}];class Md{constructor(e,n,o){var r;o===void 0&&(o=function(a){const{EventTarget:l}=Bo(a);return a instanceof l?a:Ls(a)}(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=n;const{event:s}=e,{target:i}=s;this.props=e,this.events=n,this.document=Ls(i),this.documentListeners=new Zs(this.document),this.listeners=new Zs(o),this.windowListeners=new Zs(Bo(i)),this.initialCoordinates=(r=Cm(s))!=null?r:Jn,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:n,bypassActivationConstraint:o}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(An.Resize,this.handleCancel),this.windowListeners.add(An.DragStart,Zg),this.windowListeners.add(An.VisibilityChange,this.handleCancel),this.windowListeners.add(An.ContextMenu,Zg),this.documentListeners.add(An.Keydown,this.handleKeydown),n){if(o!=null&&o({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(t1(n))return this.timeoutId=setTimeout(this.handleStart,n.delay),void this.handlePending(n);if(e1(n))return void this.handlePending(n)}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,n){const{active:o,onPending:r}=this.props;r(o,e,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:e}=this,{onStart:n}=this.props;e&&(this.activated=!0,this.documentListeners.add(An.Click,yj,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(An.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:o,initialCoordinates:r,props:s}=this,{onMove:i,options:{activationConstraint:a}}=s;if(!r)return;const l=(n=Cm(e))!=null?n:Jn,c=oa(r,l);if(!o&&a){if(e1(a)){if(a.tolerance!=null&&Ad(c,a.tolerance))return this.handleCancel();if(Ad(c,a.distance))return this.handleStart()}return t1(a)&&Ad(c,a.tolerance)?this.handleCancel():void this.handlePending(a,c)}e.cancelable&&e.preventDefault(),i(l)}handleEnd(){const{onAbort:e,onEnd:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleCancel(){const{onAbort:e,onCancel:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleKeydown(e){e.code===at.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const vj={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Od extends Md{constructor(e){const{event:n}=e,o=Ls(n.target);super(e,vj,o)}}Od.activators=[{eventName:"onPointerDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:o}=e;return!(!n.isPrimary||n.button!==0)&&(o==null||o({event:n}),!0)}}];const kj={move:{name:"mousemove"},end:{name:"mouseup"}};var Dd;(function(t){t[t.RightClick=2]="RightClick"})(Dd||(Dd={})),(class extends Md{constructor(t){super(t,kj,Ls(t.event.target))}}).activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:o}=e;return n.button!==Dd.RightClick&&(o==null||o({event:n}),!0)}}];const Rd={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};var Qs,Da;function Sj(t){let{acceleration:e,activator:n=Qs.Pointer,canScroll:o,draggingRect:r,enabled:s,interval:i=5,order:a=Da.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:u,delta:h,threshold:f}=t;const m=function(k){let{delta:N,disabled:j}=k;const I=vc(N);return sa(T=>{if(j||!I||!T)return Cj;const A={x:Math.sign(N.x-I.x),y:Math.sign(N.y-I.y)};return{x:{[Ut.Backward]:T.x[Ut.Backward]||A.x===-1,[Ut.Forward]:T.x[Ut.Forward]||A.x===1},y:{[Ut.Backward]:T.y[Ut.Backward]||A.y===-1,[Ut.Forward]:T.y[Ut.Forward]||A.y===1}}},[j,N,I])}({delta:h,disabled:!s}),[_,g]=PB(),p=M.useRef({x:0,y:0}),b=M.useRef({x:0,y:0}),x=M.useMemo(()=>{switch(n){case Qs.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Qs.DraggableRect:return r}},[n,r,l]),y=M.useRef(null),v=M.useCallback(()=>{const k=y.current;if(!k)return;const N=p.current.x*b.current.x,j=p.current.y*b.current.y;k.scrollBy(N,j)},[]),C=M.useMemo(()=>a===Da.TreeOrder?[...c].reverse():c,[a,c]);M.useEffect(()=>{if(s&&c.length&&x){for(const k of C){if((o==null?void 0:o(k))===!1)continue;const N=c.indexOf(k),j=u[N];if(!j)continue;const{direction:I,speed:T}=_j(k,j,x,e,f);for(const A of["x","y"])m[A][I[A]]||(T[A]=0,I[A]=0);if(T.x>0||T.y>0)return g(),y.current=k,_(v,i),p.current=T,void(b.current=I)}p.current={x:0,y:0},b.current={x:0,y:0},g()}else g()},[e,v,o,g,s,i,JSON.stringify(x),JSON.stringify(m),_,c,C,u,JSON.stringify(f)])}(class extends Md{constructor(t){super(t,Rd)}static setup(){return window.addEventListener(Rd.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Rd.move.name,t)};function t(){}}}).activators=[{eventName:"onTouchStart",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:o}=e;const{touches:r}=n;return!(r.length>1)&&(o==null||o({event:n}),!0)}}],function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"}(Qs||(Qs={})),function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"}(Da||(Da={}));const Cj={x:{[Ut.Backward]:!1,[Ut.Forward]:!1},y:{[Ut.Backward]:!1,[Ut.Forward]:!1}};var ei,Pd;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(ei||(ei={})),function(t){t.Optimized="optimized"}(Pd||(Pd={}));const n1=new Map;function o1(t,e){return sa(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function Ra(t){let{callback:e,disabled:n}=t;const o=y4(e),r=M.useMemo(()=>{if(n||typeof window>"u"||window.ResizeObserver===void 0)return;const{ResizeObserver:s}=window;return new s(o)},[n]);return M.useEffect(()=>()=>r==null?void 0:r.disconnect(),[r]),r}function Nj(t){return new Id(Wr(t),t)}function r1(t,e,n){e===void 0&&(e=Nj);const[o,r]=M.useState(null);function s(){r(l=>{if(!t)return null;var c;if(t.isConnected===!1)return(c=l??n)!=null?c:null;const u=e(t);return JSON.stringify(l)===JSON.stringify(u)?l:u})}const i=function(l){let{callback:c,disabled:u}=l;const h=y4(c),f=M.useMemo(()=>{if(u||typeof window>"u"||window.MutationObserver===void 0)return;const{MutationObserver:m}=window;return new m(h)},[h,u]);return M.useEffect(()=>()=>f==null?void 0:f.disconnect(),[f]),f}({callback(l){if(t)for(const c of l){const{type:u,target:h}=c;if(u==="childList"&&h instanceof HTMLElement&&h.contains(t)){s();break}}}}),a=Ra({callback:s});return lr(()=>{s(),t?(a==null||a.observe(t),i==null||i.observe(document.body,{childList:!0,subtree:!0})):(a==null||a.disconnect(),i==null||i.disconnect())},[t]),o}const s1=[];function i1(t,e){e===void 0&&(e=[]);const n=M.useRef(null);return M.useEffect(()=>{n.current=null},e),M.useEffect(()=>{const o=t!==Jn;o&&!n.current&&(n.current=t),!o&&n.current&&(n.current=null)},[t]),n.current?oa(t,n.current):Jn}function a1(t){return M.useMemo(()=>t?function(e){const n=e.innerWidth,o=e.innerHeight;return{top:0,left:0,right:n,bottom:o,width:n,height:o}}(t):null,[t])}const l1=[];function jj(t){let{measure:e}=t;const[n,o]=M.useState(null),r=M.useCallback(c=>{for(const{target:u}of c)if(wc(u)){o(h=>{const f=e(u);return h?{...h,width:f.width,height:f.height}:f});break}},[e]),s=Ra({callback:r}),i=M.useCallback(c=>{const u=function(h){if(!h)return null;if(h.children.length>1)return h;const f=h.children[0];return wc(f)?f:h}(c);s==null||s.disconnect(),u&&(s==null||s.observe(u)),o(u?e(u):null)},[e,s]),[a,l]=yc(i);return M.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const Ej=[{sensor:Od,options:{}},{sensor:Td,options:{}}],Ij={current:{}},Pa={draggable:{measure:Wg},droppable:{measure:Wg,strategy:ei.WhileDragging,frequency:Pd.Optimized},dragOverlay:{measure:Wr}};class ti extends Map{get(e){var n;return e!=null&&(n=super.get(e))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:n}=e;return!n})}getNodeFor(e){var n,o;return(n=(o=this.get(e))==null?void 0:o.node.current)!=null?n:void 0}}const Aj={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new ti,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Ma},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Pa,measureDroppableContainers:Ma,windowRect:null,measuringScheduled:!1},Tj={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Ma,draggableNodes:new Map,over:null,measureDroppableContainers:Ma},La=M.createContext(Tj),c1=M.createContext(Aj);function Mj(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new ti}}}function Oj(t,e){switch(e.type){case Ft.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case Ft.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:e.coordinates.x-t.draggable.initialCoordinates.x,y:e.coordinates.y-t.draggable.initialCoordinates.y}}};case Ft.DragEnd:case Ft.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ft.RegisterDroppable:{const{element:n}=e,{id:o}=n,r=new ti(t.droppable.containers);return r.set(o,n),{...t,droppable:{...t.droppable,containers:r}}}case Ft.SetDroppableDisabled:{const{id:n,key:o,disabled:r}=e,s=t.droppable.containers.get(n);if(!s||o!==s.key)return t;const i=new ti(t.droppable.containers);return i.set(n,{...s,disabled:r}),{...t,droppable:{...t.droppable,containers:i}}}case Ft.UnregisterDroppable:{const{id:n,key:o}=e,r=t.droppable.containers.get(n);if(!r||o!==r.key)return t;const s=new ti(t.droppable.containers);return s.delete(n),{...t,droppable:{...t.droppable,containers:s}}}default:return t}}function Dj(t){let{disabled:e}=t;const{active:n,activatorEvent:o,draggableNodes:r}=M.useContext(La),s=vc(o),i=vc(n==null?void 0:n.id);return M.useEffect(()=>{if(!e&&!o&&s&&i!=null){if(!Sm(s)||document.activeElement===s.target)return;const a=r.get(i);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const u of[l.current,c.current]){if(!u)continue;const h=LB(u);if(h){h.focus();break}}})}},[o,e,r,i,s]),null}const d1=M.createContext({...Jn,scaleX:1,scaleY:1});var $o;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})($o||($o={}));const Rj=M.memo(function(t){var e,n,o,r;let{id:s,accessibility:i,autoScroll:a=!0,children:l,sensors:c=Ej,collisionDetection:u=$g,measuring:h,modifiers:f,...m}=t;const _=M.useReducer(Oj,void 0,Mj),[g,p]=_,[b,x]=function(){const[ae]=M.useState(()=>new Set),Ee=M.useCallback(Ie=>(ae.add(Ie),()=>ae.delete(Ie)),[ae]);return[M.useCallback(Ie=>{let{type:$e,event:Je}=Ie;ae.forEach(Le=>{var Ge;return(Ge=Le[$e])==null?void 0:Ge.call(Le,Je)})},[ae]),Ee]}(),[y,v]=M.useState($o.Uninitialized),C=y===$o.Initialized,{draggable:{active:k,nodes:N,translate:j},droppable:{containers:I}}=g,T=k!=null?N.get(k):null,A=M.useRef({initial:null,translated:null}),R=M.useMemo(()=>{var ae;return k!=null?{id:k,data:(ae=T==null?void 0:T.data)!=null?ae:Ij,rect:A}:null},[k,T]),z=M.useRef(null),[D,F]=M.useState(null),[B,U]=M.useState(null),O=na(m,Object.values(m)),S=ta("DndDescribedBy",s),$=M.useMemo(()=>I.getEnabled(),[I]),E=(W=h,M.useMemo(()=>({draggable:{...Pa.draggable,...W==null?void 0:W.draggable},droppable:{...Pa.droppable,...W==null?void 0:W.droppable},dragOverlay:{...Pa.dragOverlay,...W==null?void 0:W.dragOverlay}}),[W==null?void 0:W.draggable,W==null?void 0:W.droppable,W==null?void 0:W.dragOverlay]));var W;const{droppableRects:G,measureDroppableContainers:q,measuringScheduled:Y}=function(ae,Ee){let{dragging:Ie,dependencies:$e,config:Je}=Ee;const[Le,Ge]=M.useState(null),{frequency:st,measure:nt,strategy:it}=Je,Pt=M.useRef(ae),zt=function(){switch(it){case ei.Always:return!1;case ei.BeforeDragging:return Ie;default:return!Ie}}(),nn=na(zt),Wt=M.useCallback(function(ho){ho===void 0&&(ho=[]),nn.current||Ge(Lo=>Lo===null?ho:Lo.concat(ho.filter(Un=>!Lo.includes(Un))))},[nn]),Zn=M.useRef(null),Ns=sa(ho=>{if(zt&&!Ie)return n1;if(!ho||ho===n1||Pt.current!==ae||Le!=null){const Lo=new Map;for(let Un of ae){if(!Un)continue;if(Le&&Le.length>0&&!Le.includes(Un.id)&&Un.rect.current){Lo.set(Un.id,Un.rect.current);continue}const js=Un.node.current,Hi=js?new Id(nt(js),js):null;Un.rect.current=Hi,Hi&&Lo.set(Un.id,Hi)}return Lo}return ho},[ae,Le,Ie,zt,nt]);return M.useEffect(()=>{Pt.current=ae},[ae]),M.useEffect(()=>{zt||Wt()},[Ie,zt]),M.useEffect(()=>{Le&&Le.length>0&&Ge(null)},[JSON.stringify(Le)]),M.useEffect(()=>{zt||typeof st!="number"||Zn.current!==null||(Zn.current=setTimeout(()=>{Wt(),Zn.current=null},st))},[st,zt,Wt,...$e]),{droppableRects:Ns,measureDroppableContainers:Wt,measuringScheduled:Le!=null}}($,{dragging:C,dependencies:[j.x,j.y],config:E.droppable}),te=function(ae,Ee){const Ie=Ee!=null?ae.get(Ee):void 0,$e=Ie?Ie.node.current:null;return sa(Je=>{var Le;return Ee==null?null:(Le=$e??Je)!=null?Le:null},[$e,Ee])}(N,k),oe=M.useMemo(()=>B?Cm(B):null,[B]),se=function(){const ae=(D==null?void 0:D.autoScrollEnabled)===!1,Ee=typeof a=="object"?a.enabled===!1:a===!1,Ie=C&&!ae&&!Ee;return typeof a=="object"?{...a,enabled:Ie}:{enabled:Ie}}(),Z=function(ae,Ee){return o1(ae,Ee)}(te,E.draggable.measure);(function(ae){let{activeNode:Ee,measure:Ie,initialRect:$e,config:Je=!0}=ae;const Le=M.useRef(!1),{x:Ge,y:st}=typeof Je=="boolean"?{x:Je,y:Je}:Je;lr(()=>{if(!Ge&&!st||!Ee)return void(Le.current=!1);if(Le.current||!$e)return;const nt=Ee==null?void 0:Ee.node.current;if(!nt||nt.isConnected===!1)return;const it=Hg(Ie(nt),$e);if(Ge||(it.x=0),st||(it.y=0),Le.current=!0,Math.abs(it.x)>0||Math.abs(it.y)>0){const Pt=qg(nt);Pt&&Pt.scrollBy({top:it.y,left:it.x})}},[Ee,Ge,st,$e,Ie])})({activeNode:k!=null?N.get(k):null,config:se.layoutShiftCompensation,initialRect:Z,measure:E.draggable.measure});const Q=r1(te,E.draggable.measure,Z),ue=r1(te?te.parentElement:null),me=M.useRef({activatorEvent:null,active:null,activeNode:te,collisionRect:null,collisions:null,droppableRects:G,draggableNodes:N,draggingNode:null,draggingNodeRect:null,droppableContainers:I,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ce=I.getNodeFor((e=me.current.over)==null?void 0:e.id),fe=jj({measure:E.dragOverlay.measure}),de=(n=fe.nodeRef.current)!=null?n:te,ke=C?(o=fe.rect)!=null?o:Q:null,Se=!!(fe.nodeRef.current&&fe.rect),ie=Hg(je=Se?null:Q,o1(je));var je;const pe=a1(de?Bo(de):null),Ae=function(ae){const Ee=M.useRef(ae),Ie=sa($e=>ae?$e&&$e!==s1&&ae&&Ee.current&&ae.parentNode===Ee.current.parentNode?$e:Oa(ae):s1,[ae]);return M.useEffect(()=>{Ee.current=ae},[ae]),Ie}(C?ce??te:null),ze=function(ae,Ee){Ee===void 0&&(Ee=Wr);const[Ie]=ae,$e=a1(Ie?Bo(Ie):null),[Je,Le]=M.useState(l1);function Ge(){Le(()=>ae.length?ae.map(nt=>Jg(nt)?$e:new Id(Ee(nt),nt)):l1)}const st=Ra({callback:Ge});return lr(()=>{st==null||st.disconnect(),Ge(),ae.forEach(nt=>st==null?void 0:st.observe(nt))},[ae]),Je}(Ae),De=function(ae,Ee){let{transform:Ie,...$e}=Ee;return ae!=null&&ae.length?ae.reduce((Je,Le)=>Le({transform:Je,...$e}),Ie):Ie}(f,{transform:{x:j.x-ie.x,y:j.y-ie.y,scaleX:1,scaleY:1},activatorEvent:B,active:R,activeNodeRect:Q,containerNodeRect:ue,draggingNodeRect:ke,over:me.current.over,overlayNodeRect:fe.rect,scrollableAncestors:Ae,scrollableAncestorRects:ze,windowRect:pe}),Ve=oe?Fs(oe,j):null,Pe=function(ae){const[Ee,Ie]=M.useState(null),$e=M.useRef(ae),Je=M.useCallback(Le=>{const Ge=jd(Le.target);Ge&&Ie(st=>st?(st.set(Ge,Ed(Ge)),new Map(st)):null)},[]);return M.useEffect(()=>{const Le=$e.current;if(ae!==Le){Ge(Le);const st=ae.map(nt=>{const it=jd(nt);return it?(it.addEventListener("scroll",Je,{passive:!0}),[it,Ed(it)]):null}).filter(nt=>nt!=null);Ie(st.length?new Map(st):null),$e.current=ae}return()=>{Ge(ae),Ge(Le)};function Ge(st){st.forEach(nt=>{const it=jd(nt);it==null||it.removeEventListener("scroll",Je)})}},[Je,ae]),M.useMemo(()=>ae.length?Ee?Array.from(Ee.values()).reduce((Le,Ge)=>Fs(Le,Ge),Jn):Xg(ae):Jn,[ae,Ee])}(Ae),rt=i1(Pe),Qe=i1(Pe,[Q]),tt=Fs(De,rt),ne=ke?mj(ke,De):null,ve=R&&ne?u({active:R,collisionRect:ne,droppableRects:G,droppableContainers:$,pointerCoordinates:Ve}):null,Ce=Cd(ve,"id"),[Re,J]=M.useState(null),_e=function(ae,Ee,Ie){return{...ae,scaleX:Ee&&Ie?Ee.width/Ie.width:1,scaleY:Ee&&Ie?Ee.height/Ie.height:1}}(Se?De:Fs(De,Qe),(r=Re==null?void 0:Re.rect)!=null?r:null,Q),be=M.useRef(null),ge=M.useCallback((ae,Ee)=>{let{sensor:Ie,options:$e}=Ee;if(z.current==null)return;const Je=N.get(z.current);if(!Je)return;const Le=ae.nativeEvent,Ge=new Ie({active:z.current,activeNode:Je,event:Le,options:$e,context:me,onAbort(nt){if(!N.get(nt))return;const{onDragAbort:it}=O.current,Pt={id:nt};it==null||it(Pt),b({type:"onDragAbort",event:Pt})},onPending(nt,it,Pt,zt){if(!N.get(nt))return;const{onDragPending:nn}=O.current,Wt={id:nt,constraint:it,initialCoordinates:Pt,offset:zt};nn==null||nn(Wt),b({type:"onDragPending",event:Wt})},onStart(nt){const it=z.current;if(it==null)return;const Pt=N.get(it);if(!Pt)return;const{onDragStart:zt}=O.current,nn={activatorEvent:Le,active:{id:it,data:Pt.data,rect:A}};ra.unstable_batchedUpdates(()=>{zt==null||zt(nn),v($o.Initializing),p({type:Ft.DragStart,initialCoordinates:nt,active:it}),b({type:"onDragStart",event:nn}),F(be.current),U(Le)})},onMove(nt){p({type:Ft.DragMove,coordinates:nt})},onEnd:st(Ft.DragEnd),onCancel:st(Ft.DragCancel)});function st(nt){return async function(){const{active:it,collisions:Pt,over:zt,scrollAdjustedTranslate:nn}=me.current;let Wt=null;if(it&&nn){const{cancelDrop:Zn}=O.current;Wt={activatorEvent:Le,active:it,collisions:Pt,delta:nn,over:zt},nt===Ft.DragEnd&&typeof Zn=="function"&&await Promise.resolve(Zn(Wt))&&(nt=Ft.DragCancel)}z.current=null,ra.unstable_batchedUpdates(()=>{p({type:nt}),v($o.Uninitialized),J(null),F(null),U(null),be.current=null;const Zn=nt===Ft.DragEnd?"onDragEnd":"onDragCancel";if(Wt){const Ns=O.current[Zn];Ns==null||Ns(Wt),b({type:Zn,event:Wt})}})}}be.current=Ge},[N]),le=M.useCallback((ae,Ee)=>(Ie,$e)=>{const Je=Ie.nativeEvent,Le=N.get($e);if(z.current!==null||!Le||Je.dndKit||Je.defaultPrevented)return;const Ge={active:Le};ae(Ie,Ee.options,Ge)===!0&&(Je.dndKit={capturedBy:Ee.sensor},z.current=$e,ge(Ie,Ee))},[N,ge]),We=function(ae,Ee){return M.useMemo(()=>ae.reduce((Ie,$e)=>{const{sensor:Je}=$e;return[...Ie,...Je.activators.map(Le=>({eventName:Le.eventName,handler:Ee(Le.handler,$e)}))]},[]),[ae,Ee])}(c,le);(function(ae){M.useEffect(()=>{if(!Nm)return;const Ee=ae.map(Ie=>{let{sensor:$e}=Ie;return $e.setup==null?void 0:$e.setup()});return()=>{for(const Ie of Ee)Ie==null||Ie()}},ae.map(Ee=>{let{sensor:Ie}=Ee;return Ie}))})(c),lr(()=>{Q&&y===$o.Initializing&&v($o.Initialized)},[Q,y]),M.useEffect(()=>{const{onDragMove:ae}=O.current,{active:Ee,activatorEvent:Ie,collisions:$e,over:Je}=me.current;if(!Ee||!Ie)return;const Le={active:Ee,activatorEvent:Ie,collisions:$e,delta:{x:tt.x,y:tt.y},over:Je};ra.unstable_batchedUpdates(()=>{ae==null||ae(Le),b({type:"onDragMove",event:Le})})},[tt.x,tt.y]),M.useEffect(()=>{const{active:ae,activatorEvent:Ee,collisions:Ie,droppableContainers:$e,scrollAdjustedTranslate:Je}=me.current;if(!ae||z.current==null||!Ee||!Je)return;const{onDragOver:Le}=O.current,Ge=$e.get(Ce),st=Ge&&Ge.rect.current?{id:Ge.id,rect:Ge.rect.current,data:Ge.data,disabled:Ge.disabled}:null,nt={active:ae,activatorEvent:Ee,collisions:Ie,delta:{x:Je.x,y:Je.y},over:st};ra.unstable_batchedUpdates(()=>{J(st),Le==null||Le(nt),b({type:"onDragOver",event:nt})})},[Ce]),lr(()=>{me.current={activatorEvent:B,active:R,activeNode:te,collisionRect:ne,collisions:ve,droppableRects:G,draggableNodes:N,draggingNode:de,draggingNodeRect:ke,droppableContainers:I,over:Re,scrollableAncestors:Ae,scrollAdjustedTranslate:tt},A.current={initial:ke,translated:ne}},[R,te,ve,ne,N,de,ke,G,I,Re,Ae,tt]),Sj({...se,delta:j,draggingRect:ne,pointerCoordinates:Ve,scrollableAncestors:Ae,scrollableAncestorRects:ze});const Fe=M.useMemo(()=>({active:R,activeNode:te,activeNodeRect:Q,activatorEvent:B,collisions:ve,containerNodeRect:ue,dragOverlay:fe,draggableNodes:N,droppableContainers:I,droppableRects:G,over:Re,measureDroppableContainers:q,scrollableAncestors:Ae,scrollableAncestorRects:ze,measuringConfiguration:E,measuringScheduled:Y,windowRect:pe}),[R,te,Q,B,ve,ue,fe,N,I,G,Re,q,Ae,ze,E,Y,pe]),Xe=M.useMemo(()=>({activatorEvent:B,activators:We,active:R,activeNodeRect:Q,ariaDescribedById:{draggable:S},dispatch:p,draggableNodes:N,over:Re,measureDroppableContainers:q}),[B,We,R,Q,p,S,N,Re,q]);return K.createElement(Bg.Provider,{value:x},K.createElement(La.Provider,{value:Xe},K.createElement(c1.Provider,{value:Fe},K.createElement(d1.Provider,{value:_e},l)),K.createElement(Dj,{disabled:(i==null?void 0:i.restoreFocus)===!1})),K.createElement(cj,{...i,hiddenTextDescribedById:S}))}),Pj=M.createContext(null),u1="button";function Lj(t){let{id:e,data:n,disabled:o=!1,attributes:r}=t;const s=ta("Draggable"),{activators:i,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:u,draggableNodes:h,over:f}=M.useContext(La),{role:m=u1,roleDescription:_="draggable",tabIndex:g=0}=r??{},p=(l==null?void 0:l.id)===e,b=M.useContext(p?d1:Pj),[x,y]=yc(),[v,C]=yc(),k=function(j,I){return M.useMemo(()=>j.reduce((T,A)=>{let{eventName:R,handler:z}=A;return T[R]=D=>{z(D,I)},T},{}),[j,I])}(i,e),N=na(n);return lr(()=>(h.set(e,{id:e,key:s,node:x,activatorNode:v,data:N}),()=>{const j=h.get(e);j&&j.key===s&&h.delete(e)}),[h,e]),{active:l,activatorEvent:a,activeNodeRect:c,attributes:M.useMemo(()=>({role:m,tabIndex:g,"aria-disabled":o,"aria-pressed":!(!p||m!==u1)||void 0,"aria-roledescription":_,"aria-describedby":u.draggable}),[o,m,g,p,_,u.draggable]),isDragging:p,listeners:o?void 0:k,node:x,over:f,setNodeRef:y,setActivatorNodeRef:C,transform:b}}const Fj={timeout:25};function h1(t,e,n){const o=t.slice();return o.splice(n<0?o.length+n:n,0,o.splice(e,1)[0]),o}function zj(t,e){return t.reduce((n,o,r)=>{const s=e.get(o);return s&&(n[r]=s),n},Array(t.length))}function Fa(t){return t!==null&&t>=0}const za={scaleX:1,scaleY:1},Bj=t=>{var e;let{rects:n,activeNodeRect:o,activeIndex:r,overIndex:s,index:i}=t;const a=(e=n[r])!=null?e:o;if(!a)return null;const l=function(c,u,h){const f=c[u],m=c[u-1],_=c[u+1];return!f||!m&&!_?0:h<u?m?f.left-(m.left+m.width):_.left-(f.left+f.width):_?_.left-(f.left+f.width):f.left-(m.left+m.width)}(n,i,r);if(i===r){const c=n[s];return c?{x:r<s?c.left+c.width-(a.left+a.width):c.left-a.left,y:0,...za}:null}return i>r&&i<=s?{x:-a.width-l,y:0,...za}:i<r&&i>=s?{x:a.width+l,y:0,...za}:{x:0,y:0,...za}},f1=t=>{let{rects:e,activeIndex:n,overIndex:o,index:r}=t;const s=h1(e,o,n),i=e[r],a=s[r];return a&&i?{x:a.left-i.left,y:a.top-i.top,scaleX:a.width/i.width,scaleY:a.height/i.height}:null},Ba={scaleX:1,scaleY:1},Uj=t=>{var e;let{activeIndex:n,activeNodeRect:o,index:r,rects:s,overIndex:i}=t;const a=(e=s[n])!=null?e:o;if(!a)return null;if(r===n){const c=s[i];return c?{x:0,y:n<i?c.top+c.height-(a.top+a.height):c.top-a.top,...Ba}:null}const l=function(c,u,h){const f=c[u],m=c[u-1],_=c[u+1];return f?h<u?m?f.top-(m.top+m.height):_?_.top-(f.top+f.height):0:_?_.top-(f.top+f.height):m?f.top-(m.top+m.height):0:0}(s,r,n);return r>n&&r<=i?{x:0,y:-a.height-l,...Ba}:r<n&&r>=i?{x:0,y:a.height+l,...Ba}:{x:0,y:0,...Ba}},m1="Sortable",p1=K.createContext({activeIndex:-1,containerId:m1,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:f1,disabled:{draggable:!1,droppable:!1}});function g1(t){let{children:e,id:n,items:o,strategy:r=f1,disabled:s=!1}=t;const{active:i,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:u}=M.useContext(c1),h=ta(m1,n),f=a.rect!==null,m=M.useMemo(()=>o.map(k=>typeof k=="object"&&"id"in k?k.id:k),[o]),_=i!=null,g=i?m.indexOf(i.id):-1,p=c?m.indexOf(c.id):-1,b=M.useRef(m),x=!function(k,N){if(k===N)return!0;if(k.length!==N.length)return!1;for(let j=0;j<k.length;j++)if(k[j]!==N[j])return!1;return!0}(m,b.current),y=p!==-1&&g===-1||x,v=function(k){return typeof k=="boolean"?{draggable:k,droppable:k}:k}(s);lr(()=>{x&&_&&u(m)},[x,m,_,u]),M.useEffect(()=>{b.current=m},[m]);const C=M.useMemo(()=>({activeIndex:g,containerId:h,disabled:v,disableTransforms:y,items:m,overIndex:p,useDragOverlay:f,sortedRects:zj(m,l),strategy:r}),[g,h,v.draggable,v.droppable,y,m,p,l,f,r]);return K.createElement(p1.Provider,{value:C},e)}const Vj=t=>{let{id:e,items:n,activeIndex:o,overIndex:r}=t;return h1(n,o,r).indexOf(e)},$j=t=>{let{containerId:e,isSorting:n,wasDragging:o,index:r,items:s,newIndex:i,previousItems:a,previousContainerId:l,transition:c}=t;return!(!c||!o)&&(a===s||r!==i)&&(!!n||i!==r&&e===l)},Hj={duration:200,easing:"ease"},_1="transform",Wj=kc.Transition.toString({property:_1,duration:0,easing:"linear"}),qj={roleDescription:"sortable"};function b1(t){let{animateLayoutChanges:e=$j,attributes:n,disabled:o,data:r,getNewIndex:s=Vj,id:i,strategy:a,resizeObserverConfig:l,transition:c=Hj}=t;const{items:u,containerId:h,activeIndex:f,disabled:m,disableTransforms:_,sortedRects:g,overIndex:p,useDragOverlay:b,strategy:x}=M.useContext(p1),y=function(ce,fe){var de,ke;return typeof ce=="boolean"?{draggable:ce,droppable:!1}:{draggable:(de=ce==null?void 0:ce.draggable)!=null?de:fe.draggable,droppable:(ke=ce==null?void 0:ce.droppable)!=null?ke:fe.droppable}}(o,m),v=u.indexOf(i),C=M.useMemo(()=>({sortable:{containerId:h,index:v,items:u},...r}),[h,r,v,u]),k=M.useMemo(()=>u.slice(u.indexOf(i)),[u,i]),{rect:N,node:j,isOver:I,setNodeRef:T}=function(ce){let{data:fe,disabled:de=!1,id:ke,resizeObserverConfig:Se}=ce;const ie=ta("Droppable"),{active:je,dispatch:pe,over:Ae,measureDroppableContainers:ze}=M.useContext(La),De=M.useRef({disabled:de}),Ve=M.useRef(!1),Pe=M.useRef(null),rt=M.useRef(null),{disabled:Qe,updateMeasurementsFor:tt,timeout:ne}={...Fj,...Se},ve=na(tt??ke),Ce=Ra({callback:M.useCallback(()=>{Ve.current?(rt.current!=null&&clearTimeout(rt.current),rt.current=setTimeout(()=>{ze(Array.isArray(ve.current)?ve.current:[ve.current]),rt.current=null},ne)):Ve.current=!0},[ne]),disabled:Qe||!je}),Re=M.useCallback((ge,le)=>{Ce&&(le&&(Ce.unobserve(le),Ve.current=!1),ge&&Ce.observe(ge))},[Ce]),[J,_e]=yc(Re),be=na(fe);return M.useEffect(()=>{Ce&&J.current&&(Ce.disconnect(),Ve.current=!1,Ce.observe(J.current))},[J,Ce]),M.useEffect(()=>(pe({type:Ft.RegisterDroppable,element:{id:ke,key:ie,disabled:de,node:J,rect:Pe,data:be}}),()=>pe({type:Ft.UnregisterDroppable,key:ie,id:ke})),[ke]),M.useEffect(()=>{de!==De.current.disabled&&(pe({type:Ft.SetDroppableDisabled,id:ke,key:ie,disabled:de}),De.current.disabled=de)},[ke,ie,de,pe]),{active:je,rect:Pe,isOver:(Ae==null?void 0:Ae.id)===ke,node:J,over:Ae,setNodeRef:_e}}({id:i,data:C,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:k,...l}}),{active:A,activatorEvent:R,activeNodeRect:z,attributes:D,setNodeRef:F,listeners:B,isDragging:U,over:O,setActivatorNodeRef:S,transform:$}=Lj({id:i,data:C,attributes:{...qj,...n},disabled:y.draggable}),E=zB(T,F),W=!!A,G=W&&!_&&Fa(f)&&Fa(p),q=!b&&U,Y=q&&G?$:null,te=G?Y??(a??x)({rects:g,activeNodeRect:z,activeIndex:f,overIndex:p,index:v}):null,oe=Fa(f)&&Fa(p)?s({id:i,items:u,activeIndex:f,overIndex:p}):v,se=A==null?void 0:A.id,Z=M.useRef({activeId:se,items:u,newIndex:oe,containerId:h}),Q=u!==Z.current.items,ue=e({active:A,containerId:h,isDragging:U,isSorting:W,id:i,index:v,items:u,newIndex:Z.current.newIndex,previousItems:Z.current.items,previousContainerId:Z.current.containerId,transition:c,wasDragging:Z.current.activeId!=null}),me=function(ce){let{disabled:fe,index:de,node:ke,rect:Se}=ce;const[ie,je]=M.useState(null),pe=M.useRef(de);return lr(()=>{if(!fe&&de!==pe.current&&ke.current){const Ae=Se.current;if(Ae){const ze=Wr(ke.current,{ignoreTransform:!0}),De={x:Ae.left-ze.left,y:Ae.top-ze.top,scaleX:Ae.width/ze.width,scaleY:Ae.height/ze.height};(De.x||De.y)&&je(De)}}de!==pe.current&&(pe.current=de)},[fe,de,ke,Se]),M.useEffect(()=>{ie&&je(null)},[ie]),ie}({disabled:!ue,index:v,node:j,rect:N});return M.useEffect(()=>{W&&Z.current.newIndex!==oe&&(Z.current.newIndex=oe),h!==Z.current.containerId&&(Z.current.containerId=h),u!==Z.current.items&&(Z.current.items=u)},[W,oe,h,u]),M.useEffect(()=>{if(se===Z.current.activeId)return;if(se!=null&&Z.current.activeId==null)return void(Z.current.activeId=se);const ce=setTimeout(()=>{Z.current.activeId=se},50);return()=>clearTimeout(ce)},[se]),{active:A,activeIndex:f,attributes:D,data:C,rect:N,index:v,newIndex:oe,items:u,isOver:I,isSorting:W,isDragging:U,listeners:B,node:j,overIndex:p,over:O,setNodeRef:E,setActivatorNodeRef:S,setDroppableNodeRef:T,setDraggableNodeRef:F,transform:me??te,transition:function(){if(me||Q&&Z.current.newIndex===v)return Wj;if(!(q&&!Sm(R)||!c)&&(W||ue))return kc.Transition.toString({...c,property:_1})}()}}function Ua(t){if(!t)return!1;const e=t.data.current;return!!(e&&"sortable"in e&&typeof e.sortable=="object"&&"containerId"in e.sortable&&"items"in e.sortable&&"index"in e.sortable)}const Gj=[at.Down,at.Right,at.Up,at.Left],Yj=(t,e)=>{let{context:{active:n,collisionRect:o,droppableRects:r,droppableContainers:s,over:i,scrollableAncestors:a}}=e;if(Gj.includes(t.code)){if(t.preventDefault(),!n||!o)return;const l=[];s.getEnabled().forEach(h=>{if(!h||h!=null&&h.disabled)return;const f=r.get(h.id);if(f)switch(t.code){case at.Down:o.top<f.top&&l.push(h);break;case at.Up:o.top>f.top&&l.push(h);break;case at.Left:o.left>f.left&&l.push(h);break;case at.Right:o.left<f.left&&l.push(h)}});const c=(h=>{let{collisionRect:f,droppableRects:m,droppableContainers:_}=h;const g=Sd(f),p=[];for(const b of _){const{id:x}=b,y=m.get(x);if(y){const v=Sd(y),C=g.reduce((N,j,I)=>N+vd(v[I],j),0),k=Number((C/4).toFixed(4));p.push({id:x,data:{droppableContainer:b,value:k}})}}return p.sort(kd)})({collisionRect:o,droppableRects:r,droppableContainers:l});let u=Cd(c,"id");if(u===(i==null?void 0:i.id)&&c.length>1&&(u=c[1].id),u!=null){const h=s.get(n.id),f=s.get(u),m=f?r.get(f.id):null,_=f==null?void 0:f.node.current;if(_&&m&&h&&f){const g=Oa(_).some((v,C)=>a[C]!==v),p=x1(h,f),b=function(v,C){return!Ua(v)||!Ua(C)||!x1(v,C)?!1:v.data.current.sortable.index<C.data.current.sortable.index}(h,f),x=g||!p?{x:0,y:0}:{x:b?o.width-m.width:0,y:b?o.height-m.height:0},y={x:m.left,y:m.top};return x.x&&x.y?y:oa(y,x)}}}};function x1(t,e){return!(!Ua(t)||!Ua(e))&&t.data.current.sortable.containerId===e.data.current.sortable.containerId}const Jj=BB("rounded-full shadow-xsSolid border p-[5px] transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 [&>svg]:size-3 active:shadow-none bg-background",{variants:{variant:{default:"hover:bg-accent hover:text-accent-foreground",stale:"bg-[var(--yellow-3)] hover:bg-[var(--yellow-4)] text-[var(--yellow-11)]",green:"hover:bg-[var(--grass-2)] hover:text-[var(--grass-11)] hover:border-[var(--grass-7)],",disabled:"opacity-50 cursor-not-allowed",danger:"hover:bg-[var(--red-3)] hover:text-[var(--red-11)]"}},defaultVariants:{variant:"default"}}),ni=t=>{const e=X.c(21);let n,o,r,s,i;e[0]!==t?({children:n,tooltip:s,disabled:r,variant:i,...o}=t,e[0]=t,e[1]=n,e[2]=o,e[3]=r,e[4]=s,e[5]=i):(n=e[1],o=e[2],r=e[3],s=e[4],i=e[5]);const a=r!==void 0&&r;let l,c,u;e[6]!==a||e[7]!==o?(l=f=>{var m;a||((m=o.onClick)==null||m.call(o,f))},e[6]=a,e[7]=o,e[8]=l):l=e[8],e[9]!==o.className||e[10]!==i?(c=Ne(Jj({variant:i}),o.className),e[9]=o.className,e[10]=i,e[11]=c):c=e[11],e[12]!==n||e[13]!==a||e[14]!==o||e[15]!==l||e[16]!==c?(u=d.jsx("button",{disabled:a,...o,onClick:l,onMouseDown:Vn.preventFocus,className:c,children:n}),e[12]=n,e[13]=a,e[14]=o,e[15]=l,e[16]=c,e[17]=u):u=e[17];const h=u;if(s){let f;return e[18]!==h||e[19]!==s?(f=d.jsx(Te,{content:s,side:"top",delayDuration:200,usePortal:!1,children:h}),e[18]=h,e[19]=s,e[20]=f):f=e[20],f}return h},Kj=t=>{const e=X.c(5),{children:n,className:o}=t;let r,s;return e[0]!==o?(r=Ne("flex items-center gap-1 bg-background m-[2px] rounded-full",o),e[0]=o,e[1]=r):r=e[1],e[2]!==n||e[3]!==r?(s=d.jsx(KS,{className:r,children:n}),e[2]=n,e[3]=r,e[4]=s):s=e[4],s},Xj=t=>{const e=X.c(9),{connectionState:n,status:o}=t,r=zg(o==="running");let s,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=rn("global.interrupt"),e[0]=s):s=e[0],e[1]!==n||e[2]!==r?(i=po(n)||!r,e[1]=n,e[2]=r,e[3]=i):i=e[3];const a=r?Em:kn.NOOP,l=r?"stale":"disabled";let c,u;return e[4]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(uc,{strokeWidth:1.5}),e[4]=c):c=e[4],e[5]!==i||e[6]!==a||e[7]!==l?(u=d.jsx(ni,{tooltip:s,disabled:i,onClick:a,variant:l,"data-testid":"run-button",children:c}),e[5]=i,e[6]=a,e[7]=l,e[8]=u):u=e[8],u},qr={showInput:"Mod-l",acceptEdit:"Mod-y",rejectEdit:"Mod-u"},oi=zs.define({combine:t=>Sc(t,{onError:console.error,inputDebounceTime:300,keymaps:qr},{onError:(e,n)=>e&&n,inputDebounceTime:(e,n)=>e&&n,keymaps:(e,n)=>e&&n})}),yr=Mt.define(),wr=jn.define({create:()=>({show:!1,lineFrom:0,lineTo:0}),update(t,e){for(const n of e.effects)if(n.is(yr))return n.value;return t}}),ri=Mt.define(),si=Mt.define(),y1=jn.define({create:()=>({shouldFocus:!1,inputValue:""}),update(t,e){let n=t;for(const o of e.effects)o.is(ri)&&(n={...n,inputValue:o.value}),o.is(si)&&(n={...n,shouldFocus:o.value});return n}}),Va=Mt.define(),ii=jn.define({create:()=>null,update(t,e){for(const n of e.effects)if(n.is(Va))return n.value;return t}}),Gr=Mt.define(),w1=jn.define({create:()=>!1,update(t,e){for(const n of e.effects)if(n.is(Gr))return n.value;return t}}),v1=t=>{const{state:e}=t,n=e.selection.main;if(n.empty)return!1;const o=e.doc,r=o.lineAt(n.from),s=o.lineAt(n.to);if(e.sliceDoc(r.from,s.to).trim().length<1)return!1;const i=Math.max(1,Math.min(r.number,o.lines)),a=Math.max(1,Math.min(s.number,o.lines));return t.dispatch({effects:[yr.of({show:!0,lineFrom:i,lineTo:a}),si.of(!0),ri.of("")],selection:zo.cursor(r.from)}),!0},k1=t=>!!t.state.field(ii)&&(t.dispatch({effects:[Va.of(null),yr.of({show:!1,lineFrom:0,lineTo:0}),si.of(!1),ri.of(""),Gr.of(!1)]}),!0),S1=t=>{const e=t.state.field(ii);return!!e&&(t.dispatch({changes:{from:e.from,to:e.to,insert:e.oldCode},effects:[Va.of(null),yr.of({show:!1,lineFrom:0,lineTo:0}),si.of(!1),ri.of(""),Gr.of(!1)]}),!0)},Zj=et.baseTheme({".cm-ai-input-container":{display:"flex",flexDirection:"column",gap:"4px",width:"min(calc(100% + 7px), 500px)",padding:"5px 5px",margin:"0 -6px",backgroundColor:"light-dark(rgb(241, 243, 245), rgb(40, 40, 40))"},".cm-ai-input":{display:"block",width:"100%",padding:"3px 8px",border:"2px solid rgb(51, 154, 240)",borderRadius:"5px",fontSize:"12px"},".cm-ai-help-info-button":{fontSize:"10px",paddingLeft:"10px",height:"18px",color:"light-dark(rgb(109, 117, 125), rgb(170, 170, 170))",display:"block",marginRight:"auto"},".cm-ai-help-info-button:hover":{color:"light-dark(rgb(89, 97, 105), rgb(190, 190, 190))"},".cm-ai-generate-button":{background:"#0E639C",border:"none",padding:"2px 6px",color:"#ffffff",cursor:"pointer",font:"inherit",borderRadius:"4px","&:hover":{backgroundColor:"#1177bb"}},".cm-line.cm-ai-selection, .cm-line.cm-ai-selection.cm-active-line":{backgroundColor:"light-dark(color-mix(in srgb, rgb(223, 227, 232) 50%, transparent), color-mix(in srgb, rgb(50, 50, 50) 50%, transparent)) !important"},".cm-line:has(.cm-new-code-line)":{backgroundColor:"light-dark(color-mix(in srgb, rgb(183, 235, 143) 50%, transparent), color-mix(in srgb, rgb(40, 100, 40) 50%, transparent)) !important"},".cm-old-code-container":{backgroundColor:"light-dark(rgb(255, 205, 205), rgb(100, 40, 40))",position:"relative",display:"flex",paddingTop:"0",width:"100%",alignItems:"center"},".cm-code-button":{position:"absolute",right:"5px",top:"50%",transform:"translateY(-50%)",background:"none",border:"none",cursor:"pointer",fontSize:"16px"},".cm-floating-buttons":{fontFamily:"sans-serif",position:"absolute",top:"-20px",left:"5px",display:"flex"},".cm-floating-button":{fontFamily:"sans-serif",padding:"2px 5px",fontSize:"10px",cursor:"pointer",fontWeight:"700"},".cm-floating-accept":{backgroundColor:"light-dark(rgb(55, 125, 34), rgb(40, 80, 25))",borderTopLeftRadius:"5px",borderBottomLeftRadius:"5px",color:"white",filter:"brightness(90%)","&:hover":{filter:"brightness(100%)"}},".cm-floating-reject":{backgroundColor:"light-dark(rgb(220, 53, 69), rgb(180, 40, 50))",color:"white",borderTopRightRadius:"5px",borderBottomRightRadius:"5px",filter:"brightness(90%)","&:hover":{filter:"brightness(100%)"}},".hotkey":{display:"inline-block",padding:"0 4px",borderRadius:"3px",backgroundColor:"rgba(255, 255, 255, 0.1)",fontSize:"90%"},".cm-ai-loading-indicator":{fontStyle:"italic",fontSize:"10px",paddingLeft:"12px",color:"light-dark(rgb(109, 117, 125), rgb(170, 170, 170))",opacity:"0",transition:"opacity 0.3s ease-in-out","&::after":{content:'""',display:"inline-block",animation:"ellipsis-pulse 1.5s steps(4, end) infinite"},"&:not(:empty)":{opacity:"1"}},".cm-ai-input:disabled":{opacity:"0.5"},"@keyframes ellipsis-pulse":{"0%":{content:"'.'"},"25%":{content:"'..'"},"50%":{content:"'...'"},"75%":{content:"''"}},".cm-ai-loading-container":{display:"flex",alignItems:"center",padding:"0 8px"},".cm-ai-cancel-button":{padding:"2px 8px",fontSize:"10px",borderRadius:"4px",color:"light-dark(rgb(109, 117, 125), rgb(170, 170, 170))",cursor:"pointer","&:hover":{background:"light-dark(rgb(223, 227, 232), rgb(50, 50, 50))"}},".hidden":{display:"none"}}),Qj="\u2318",eE="\u229E Win",tE="Ctrl";function Ld(t){return t.replace("Mod",navigator.platform.startsWith("Mac")?Qj:navigator.platform.startsWith("Win")?eE:tE).replace("-"," ").toUpperCase()}function an(t,e){const n=document.createElement(t);return n.className=e,n}function nE(t){var r,s;const e=t.state.facet(oi),n={...qr,...e.keymaps},o=an("div","cm-ai-tooltip").appendChild(an("div","cm-ai-tooltip-button"));return o.innerHTML=`<span>Edit <span class="hotkey">${Ld(n.showInput)}</span></span>`,(r=o.querySelector("span"))==null||r.addEventListener("mousedown",i=>{i.stopPropagation()}),(s=o.querySelector("span"))==null||s.addEventListener("click",i=>{i.preventDefault(),v1(t)}),o}const oE=zs.define({combine:t=>Sc(t,{render:nE})}),rE=Nn.fromClass((S3=class{constructor(t){ee(this,"view");ee(this,"suppress");ee(this,"dom");ee(this,"mousedown",()=>{this.suppress=!0});ee(this,"mouseup",()=>{this.suppress=!1,this.display(this.view)});I3(this,Yl,t=>{var n;const e=t.state.selection.ranges.find(o=>!o.empty);if(e&&!this.suppress){const o=t.coordsAtPos(e.from);if(!o)return;this.dom.style.display="flex";const r=this.dom.getBoundingClientRect(),s=t.dom.getBoundingClientRect(),i=(n=t.dom.parentElement)==null?void 0:n.getBoundingClientRect(),a=s.width-r.width,l=Math.min(o.left,a);let c=o.top-r.height;c=i?Math.max(i.y,c):c,this.dom.style.left=`${l}px`,this.dom.style.top=`${c}px`,requestAnimationFrame(()=>{this.dom&&(this.dom.ariaHidden="false")})}else this.dom.style.display="none",this.dom.ariaHidden="true"});this.view=t;const e=t.state.facet(oE);this.suppress=!1,document.addEventListener("mousedown",this.mousedown),document.addEventListener("mouseup",this.mouseup);const n=e.render(t);t.dom.appendChild(n),this.dom=n}update(t){this.display(t.view)}docViewUpdate(t){this.display(t)}display(t){t.state.field(wr).show?this.dom.style.display="none":t.requestMeasure({read:E3(this,Yl)})}destroy(){document.removeEventListener("mousedown",this.mousedown),document.removeEventListener("mouseup",this.mouseup),this.dom.remove()}},Yl=new WeakMap,S3)),sE=et.baseTheme({".cm-ai-tooltip-button":{userSelect:"none",fontFamily:"system-ui, -apple-system, sans-serif",position:"fixed",display:"flex",boxSizing:"border-box",padding:"2px 6px",borderRadius:"4px",fontSize:"12px",backgroundColor:"#0E639C",color:"#ffffff",border:"1px solid transparent",boxShadow:"0 2px 4px rgba(0,0,0,0.1)",zIndex:"999",transition:"opacity 0.5s","&[aria-hidden='true']":{opacity:"0"},"&[aria-hidden='false']":{opacity:"1"},"& > span":{pointerEvents:"auto",cursor:"pointer",display:"inline-block",padding:"2px"},"&:hover":{backgroundColor:"#1177bb"}}});class iE extends Bs{constructor(n){super();ee(this,"oldCode");this.oldCode=n}toDOM(n){const o=an("div","cm-old-code-container");o.setAttribute("role","region"),o.setAttribute("aria-label","Previous code version");const r=an("div","cm-old-code cm-line");r.textContent=this.oldCode;const s=an("div","cm-floating-buttons"),i=n.state.facet(oi),a={...qr,...i.keymaps},l=an("button","cm-floating-button cm-floating-accept");l.innerHTML=`<span class="hotkey">${Ld(a.acceptEdit)}</span> Accept`,l.setAttribute("aria-label","Accept changes"),l.addEventListener("click",u=>{u.preventDefault(),u.stopPropagation(),n.focus(),k1(n)});const c=an("button","cm-floating-button cm-floating-reject");return c.innerHTML=`<span class="hotkey">${Ld(a.rejectEdit)}</span> Reject`,c.setAttribute("aria-label","Reject changes"),c.addEventListener("click",u=>{u.preventDefault(),u.stopPropagation(),n.focus(),S1(n)}),s.append(l,c),o.append(r,s),o}updateDOM(n,o){return!0}}class aE extends Bs{constructor(n){super();ee(this,"complete");ee(this,"abortController",null);ee(this,"dom",null);ee(this,"input",null);ee(this,"loadingContainer",null);ee(this,"helpInfo",null);ee(this,"inputContainer",null);ee(this,"form",null);ee(this,"view",null);ee(this,"onKeyDown",async n=>{n.key!=="Enter"||n.shiftKey?n.key==="Escape"&&this.onCancel():(n.preventDefault(),await this.handleSubmit())});ee(this,"onCancel",()=>{this.cleanup();const n=this.view;n&&(n.dispatch({effects:[yr.of({show:!1,lineFrom:0,lineTo:0}),Gr.of(!1)]}),n.focus())});ee(this,"handleSubmit",async n=>{var g;const o=this.view;if(!o)return;const r=o.state.facet(oi);n==null||n.stopPropagation();const s=o.state.field(wr),{input:i}=this;if(!i)return;const a=i.value.trim();if(!s.show||!a)return;const l=o.state.doc.line(s.lineFrom),c=o.state.doc.line(s.lineTo),u=l.from,h=c.to,f=o.state.sliceDoc(u,h),m=o.state.sliceDoc(0,u),_=o.state.sliceDoc(h);this.abortController=new AbortController,o.dispatch({effects:Gr.of(!0)}),this.toggleLoading(!0);try{const p=await this.complete({prompt:a,selection:f,codeBefore:m,codeAfter:_,editorView:o,signal:this.abortController.signal});if(!o.state.field(wr).show)return;if(!p||typeof p!="string")throw new Error("Invalid completion result");o.dispatch({changes:{from:u,to:h,insert:p},effects:[yr.of({show:!1,lineFrom:0,lineTo:0}),Va.of({from:u,to:u+p.length,oldCode:f,newCode:p}),Gr.of(!1)]})}catch(p){if(p instanceof DOMException&&p.name==="AbortError")return;(g=r.onError)==null||g.call(r,p)}finally{this.cleanup(),this.toggleLoading(!1),o.focus()}});this.complete=n}toDOM(n){if(this.dom)return this.dom;this.view=n;const o=n.state.field(y1),r=n.state.field(w1),s=an("div","cm-ai-input-container");this.inputContainer=s,this.dom=s;const i=an("form","cm-ai-input-form");this.form=i,i.setAttribute("role","search"),i.setAttribute("aria-label","AI editing instructions"),i.addEventListener("submit",p=>p.preventDefault());const a=an("input","cm-ai-input");this.input=a,i.append(a),a.placeholder="Editing instructions...",a.setAttribute("aria-label","AI editing instructions"),a.setAttribute("autocomplete","off"),a.setAttribute("spellcheck","true"),a.value=o.inputValue;const l=an("div","cm-ai-loading-container");this.loadingContainer=l;const c=an("div","cm-ai-loading-indicator");c.setAttribute("role","status"),c.setAttribute("aria-live","polite"),c.textContent="Generating";const u=an("button","cm-ai-cancel-button");u.textContent="Cancel",u.setAttribute("aria-label","Cancel code generation"),u.addEventListener("click",this.onCancel),l.append(u,c);const h=an("div","cm-ai-help-info");this.helpInfo=h;const f=h.appendChild(document.createElement("button"));f.className="cm-ai-help-info-button",f.textContent="Esc to close",f.addEventListener("click",this.onCancel);const m=an("button","cm-ai-generate-button");function _(p){h.replaceChildren(p?m:f)}m.textContent="\u23CE Generate",m.setAttribute("aria-label","Generate code"),m.addEventListener("click",this.handleSubmit),this.toggleLoading(r),o.shouldFocus&&requestAnimationFrame(()=>{a.value=o.inputValue,a.focus(),n.dispatch({effects:si.of(!1)})}),_(a.value),a.addEventListener("input",function(){n.dispatch({effects:ri.of(a.value)});const p=a.value.trim();p!==g&&(g=p,_(p))}),a.addEventListener("keydown",this.onKeyDown);let g="";return s}toggleLoading(n){var o;this.inputContainer&&this.form&&this.loadingContainer&&this.helpInfo&&((o=this.inputContainer)==null||o.replaceChildren(this.form,n?this.loadingContainer:this.helpInfo))}updateDOM(n,o){return this.dom=n,this.input=n.querySelector(".cm-ai-input"),!0}cleanup(){var n,o,r;(n=this.abortController)==null||n.abort(),this.abortController=null,(o=this.dom)==null||o.remove(),(r=this.input)==null||r.remove(),this.dom=null,this.input=null}destroy(){this.cleanup()}}function lE(t){if(!t.prompt)throw new Error("prompt function is required");return[oi.of(t),wr,y1,ii,w1,[rE,sE],Zj,qn.of([{key:qr.showInput,run:v1}]),Uo.highest([qn.of([{key:qr.acceptEdit,run:k1},{key:qr.rejectEdit,run:S1}])]),cE,dE,uE,hE]}const cE=et.updateListener.of(t=>{const e=t.state.field(wr);if(!e.show||!t.docChanged)return;let{lineFrom:n,lineTo:o}=e,r=!1;t.changes.iterChanges((s,i,a,l)=>{const c=t.state.doc.lineAt(s).number;if(c<n){const u=t.state.doc.lineAt(l).number-t.state.doc.lineAt(a).number;n+=u,o+=u,r=!0}else if(c<=o){const u=t.state.doc.lineAt(l).number-t.state.doc.lineAt(a).number;o+=u,r=!0}}),r&&t.view.dispatch({effects:[yr.of({show:!0,lineFrom:n,lineTo:o})]})}),dE=et.decorations.of(t=>{const e=t.state.field(ii);return e?ct.set([ct.mark({class:"cm-new-code-line"}).range(e.from,e.to)]):ct.none}),uE=et.decorations.compute([wr],t=>{const e=t.field(wr),n=t.facet(oi),o=[];if(e.show){const r=e.lineFrom,s=e.lineTo;for(let i=r;i<=s;i++){const a=t.doc.line(i).from;o.push(ct.line({class:"cm-ai-selection"}).range(a)),i===r&&o.push(ct.widget({widget:new aE(n.prompt),side:-1}).range(a))}}return ct.set(o)}),hE=jn.define({create:t=>ct.none,update(t,e){const n=e.state.field(ii);return n?ct.set([ct.widget({widget:new iE(n.oldCode),block:!0}).range(n.from)]):ct.none},provide:t=>et.decorations.from(t)}),$a=jn.define({create:()=>({suggestion:null}),update(t,e){const n=e.effects.find(o=>o.is(Ha));return e.docChanged||n||e.selection?n&&e.state.doc===n.value.doc?{suggestion:n.value.text}:{suggestion:null}:t}}),Ha=Mt.define();class fE extends Bs{constructor(n){super();ee(this,"suggestion");this.suggestion=n}toDOM(){const n=document.createElement("span");return n.style.opacity="0.4",n.className="cm-inline-suggestion",n.textContent=this.suggestion,n.setAttribute("role","suggestion"),n.setAttribute("aria-label",`Suggestion: ${this.suggestion}`),n}get lineBreaks(){return this.suggestion.split(`
|
103
|
-
`).length-1}}class mE{constructor(e){ee(this,"cache",new Map);ee(this,"timeout");this.timeout=e}get(e){const n=this.cache.get(e);return n?Date.now()-n.timestamp>this.timeout?(this.cache.delete(e),null):n.result:null}set(e,n){this.cache.set(e,{result:n,timestamp:Date.now()})}}const pE=(t,e)=>Nn.fromClass(class{constructor(){ee(this,"abortController",null);ee(this,"cache");this.cache=new mE(e.cacheTimeout??1e3)}async update(n){var i,a,l,c,u;if(!n.docChanged||((a=(i=e.events)==null?void 0:i.beforeSuggestionFetch)==null?void 0:a.call(i,n.view))===!1)return;(l=this.abortController)==null||l.abort(),this.abortController=new AbortController;const o=n.state.doc,r=o.toString(),s=this.cache.get(r);if(s)n.view.dispatch({effects:Ha.of({text:s,doc:o})});else try{const h=await t(n.state,this.abortController.signal);if(this.abortController.signal.aborted||((u=(c=e.events)==null?void 0:c.shouldShowSuggestion)==null?void 0:u.call(c,n.view,h))===!1)return;this.cache.set(r,h),n.view.dispatch({effects:Ha.of({text:h,doc:o})})}catch(h){h instanceof Error&&h.name!=="AbortError"&&console.error("Suggestion fetch error:",h)}}destroy(){var n;(n=this.abortController)==null||n.abort()}}),gE=Nn.fromClass(class{constructor(){ee(this,"decorations");this.decorations=ct.none}update(t){var n;const e=(n=t.state.field($a))==null?void 0:n.suggestion;this.decorations=e?function(o,r){const s=o.state.selection.main.head,i=[],a=ct.widget({widget:new fE(r),side:1});return i.push(a.range(s)),ct.set(i)}(t.view,e):ct.none}},{decorations:t=>t.decorations});function _E(t,e,n,o){return{...t.changeByRange(r=>{if(r===t.selection.main)return{changes:{from:n,to:o,insert:e},range:zo.cursor(n+e.length)};const s=o-n;return!r.empty||s&&t.sliceDoc(r.from-s,r.from)!==t.sliceDoc(n,o)?{range:r}:{changes:{from:r.from-s,to:r.from,insert:e},range:zo.cursor(r.from-s+e.length)}}),userEvent:"input.complete"}}const C1=t=>{var o,r,s;const e=(o=t.state.field($a))==null?void 0:o.suggestion;if(!e)return!1;const n=t.state.facet(Fd);return t.dispatch({effects:Ha.of({text:null,doc:t.state.doc})}),(s=(r=n.events)==null?void 0:r.onSuggestionRejected)==null||s.call(r,t,e),!0},bE=qn.of([{key:"Tab",run:t=>{var o,r,s;const e=(o=t.state.field($a))==null?void 0:o.suggestion;if(!e)return!1;const n=t.state.facet(Fd);return t.dispatch({..._E(t.state,e,t.state.selection.main.head,t.state.selection.main.head)}),(s=(r=n.events)==null?void 0:r.onSuggestionAccepted)==null||s.call(r,t,e),!0}},{key:"Escape",run:C1}]),Fd=zs.define({combine:t=>t.at(-1)});function N1(t){const{delay:e=500,includeKeymap:n=!0}=t,o=function(r,s,i){let a=()=>{};return(...l)=>(a(),new Promise((c,u)=>{const h=setTimeout(()=>c(r(...l)),s);a=()=>{clearTimeout(h),i!==void 0&&u(i)}}))}(t.fetchFn,e);return[$a,Fd.of(t),pE(o,t),gE,n?bE:[]]}const j1="packages-install-input",xE=["%alias","%cd","%clear","%debug","%env","%load","%load_ext","%lsmagic","%matplotlib","%pwd","%who_ls","%system","%%time","%%timeit","%%writefile","%%capture","%%html","%%latex"];let zd;function yE(){const t=async r=>{const s=lt.get(Am),i={...s,runtime:{...s.runtime,auto_reload:r}};await Rr({config:i}).then(()=>lt.set(Am,i))},e=()=>{requestAnimationFrame(()=>{const r=document.getElementById(j1);r&&r.focus()})},n=[{match:"!pip install",onMatch:()=>{lt.set(Im,r=>({...r,isSidebarOpen:!0,selectedPanel:"packages"})),e()},title:"Package Installation",description:d.jsxs(d.Fragment,{children:["The package manager sidebar has been opened.",d.jsx("br",{}),"Install packages directly from there instead."]})},{match:"!uv pip install",onMatch:()=>{lt.set(Im,r=>({...r,isSidebarOpen:!0,selectedPanel:"packages"})),e()},title:"Package Installation",description:d.jsxs(d.Fragment,{children:["The package manager sidebar has been opened.",d.jsx("br",{}),"Install packages directly from there instead."]})},{match:"!uv add",onMatch:()=>{lt.set(Im,r=>({...r,isSidebarOpen:!0,selectedPanel:"packages"})),e()},title:"Package Installation",description:d.jsxs(d.Fragment,{children:["The package manager sidebar has been opened.",d.jsx("br",{}),"Install packages directly from there instead."]})},{match:"%autoreload 2",onMatch:async()=>{await t("autorun")},title:"Module reload",description:d.jsxs(d.Fragment,{children:["Module reload mode set to ",d.jsx("b",{children:"autorun"})," - module changes will re-run the cells that import them."]})},{match:"%autoreload 1",onMatch:async()=>{await t("lazy")},title:"Module reload",description:d.jsxs(d.Fragment,{children:["Module reload mode set to ",d.jsx("b",{children:"lazy"})," - module changes will mark the cells that import them as stale."]})},{match:"%autoreload 0",onMatch:async()=>{await t("off")},title:"Module reload",description:d.jsx(d.Fragment,{children:"Module reload disabled - module changes will not be detected."})},{match:"!ls",onMatch:()=>{},title:"Listing files",description:d.jsxs(d.Fragment,{children:["Shell commands are not directly supported.",d.jsx("br",{}),"Use ",d.jsx("code",{children:"import subprocess; subprocess.run(['ls'])"})," instead."]})},...xE.map(r=>({match:r,onMatch:()=>{},title:d.jsx(S4,{className:"inline",children:r}),description:d.jsxs(d.Fragment,{children:["Magic commands are not supported in marimo. Read more about replacements in the"," ",d.jsx("a",{href:"https://docs.marimo.io/guides/coming_from/jupyter/#adapting-to-the-absence-of-magic-commands",target:"_blank",className:"text-link underline cursor-pointer",rel:"noopener noreferrer",children:"documentation"}),"."]})}))],o=new Map(n.map(r=>[r.match,r]));return et.updateListener.of(r=>{if(r.docChanged){const s=r.state.selection.main,i=r.state.doc,a=i.lineAt(s.head),l=i.sliceString(a.from,s.anchor).trim(),c=o.get(l);c&&(c.onMatch(),zd?zd.upsert({title:c.title,description:c.description}):zd=dt({title:c.title,description:c.description}))}})}function wE(){const t=C4.filter(e=>e.key!=="Escape");return Uo.highest(qn.of([...t,{key:"Escape",run:e=>{const n=om(e);return!ia(e)&&n}},{key:"Ctrl-y",run:e=>!!ia(e)&&N4(e)},{key:"Ctrl-n",run:e=>!!ia(e)&&Cc(!0)(e)},{key:"Ctrl-p",run:e=>!!ia(e)&&Cc(!1)(e)}]))}const Bd=Mt.define(),Ud=Mt.define(),Vd=Mt.define();function vt(t,e){if(!t)throw new Error(e)}function Wa(t){if(typeof t!="number")throw new Error("invalid int 32: "+typeof t);if(!Number.isInteger(t)||t>2147483647||t<-2147483648)throw new Error("invalid int 32: "+t)}function $d(t){if(typeof t!="number")throw new Error("invalid uint 32: "+typeof t);if(!Number.isInteger(t)||t>4294967295||t<0)throw new Error("invalid uint 32: "+t)}function E1(t){if(typeof t!="number")throw new Error("invalid float 32: "+typeof t);if(Number.isFinite(t)&&(t>3402823466385289e23||t<-3402823466385289e23))throw new Error("invalid float 32: "+t)}const I1=Symbol("@bufbuild/protobuf/enum-type");function vE(t){const e=t[I1];return vt(e,"missing enum type on enum object"),e}function A1(t,e,n,o){t[I1]=T1(e,n.map(r=>({no:r.no,name:r.name,localName:t[r.no]})))}function T1(t,e,n){const o=Object.create(null),r=Object.create(null),s=[];for(const i of e){const a=M1(i);s.push(a),o[i.name]=a,r[i.no]=a}return{typeName:t,values:s,findName:i=>o[i],findNumber:i=>r[i]}}function kE(t,e,n){const o={};for(const r of e){const s=M1(r);o[s.localName]=s.no,o[s.no]=s.localName}return A1(o,t,e),o}function M1(t){return"localName"in t?t:Object.assign(Object.assign({},t),{localName:t.name})}class Ot{equals(e){return this.getType().runtime.util.equals(this.getType(),this,e)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(e,n){const o=this.getType().runtime.bin,r=o.makeReadOptions(n);return o.readMessage(this,r.readerFactory(e),e.byteLength,r),this}fromJson(e,n){const o=this.getType(),r=o.runtime.json,s=r.makeReadOptions(n);return r.readMessage(o,e,s,this),this}fromJsonString(e,n){let o;try{o=JSON.parse(e)}catch(r){throw new Error(`cannot decode ${this.getType().typeName} from JSON: ${r instanceof Error?r.message:String(r)}`)}return this.fromJson(o,n)}toBinary(e){const n=this.getType().runtime.bin,o=n.makeWriteOptions(e),r=o.writerFactory();return n.writeMessage(this,r,o),r.finish()}toJson(e){const n=this.getType().runtime.json,o=n.makeWriteOptions(e);return n.writeMessage(this,o)}toJsonString(e){var n;const o=this.toJson(e);return JSON.stringify(o,null,(n=e==null?void 0:e.prettySpaces)!==null&&n!==void 0?n:0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}}function SE(){let t=0,e=0;for(let o=0;o<28;o+=7){let r=this.buf[this.pos++];if(t|=(127&r)<<o,!(128&r))return this.assertBounds(),[t,e]}let n=this.buf[this.pos++];if(t|=(15&n)<<28,e=(112&n)>>4,!(128&n))return this.assertBounds(),[t,e];for(let o=3;o<=31;o+=7){let r=this.buf[this.pos++];if(e|=(127&r)<<o,!(128&r))return this.assertBounds(),[t,e]}throw new Error("invalid varint")}function Hd(t,e,n){for(let s=0;s<28;s+=7){const i=t>>>s,a=!(!(i>>>7)&&e==0),l=255&(a?128|i:i);if(n.push(l),!a)return}const o=t>>>28&15|(7&e)<<4,r=!!(e>>3);if(n.push(255&(r?128|o:o)),r){for(let s=3;s<31;s+=7){const i=e>>>s,a=!!(i>>>7),l=255&(a?128|i:i);if(n.push(l),!a)return}n.push(e>>>31&1)}}const qa=4294967296;function O1(t){const e=t[0]==="-";e&&(t=t.slice(1));const n=1e6;let o=0,r=0;function s(i,a){const l=Number(t.slice(i,a));r*=n,o=o*n+l,o>=qa&&(r+=o/qa|0,o%=qa)}return s(-24,-18),s(-18,-12),s(-12,-6),s(-6),e?R1(o,r):Wd(o,r)}function D1(t,e){if({lo:t,hi:e}=function(l,c){return{lo:l>>>0,hi:c>>>0}}(t,e),e<=2097151)return String(qa*e+t);const n=16777215&(t>>>24|e<<8),o=e>>16&65535;let r=(16777215&t)+6777216*n+6710656*o,s=n+8147497*o,i=2*o;const a=1e7;return r>=a&&(s+=Math.floor(r/a),r%=a),s>=a&&(i+=Math.floor(s/a),s%=a),i.toString()+P1(s)+P1(r)}function Wd(t,e){return{lo:0|t,hi:0|e}}function R1(t,e){return e=~e,t?t=1+~t:e+=1,Wd(t,e)}const P1=t=>{const e=String(t);return"0000000".slice(e.length)+e};function L1(t,e){if(t>=0){for(;t>127;)e.push(127&t|128),t>>>=7;e.push(t)}else{for(let n=0;n<9;n++)e.push(127&t|128),t>>=7;e.push(1)}}function CE(){let t=this.buf[this.pos++],e=127&t;if(!(128&t))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(127&t)<<7,!(128&t))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(127&t)<<14,!(128&t))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(127&t)<<21,!(128&t))return this.assertBounds(),e;t=this.buf[this.pos++],e|=(15&t)<<28;for(let n=5;128&t&&n<10;n++)t=this.buf[this.pos++];if(128&t)throw new Error("invalid varint");return this.assertBounds(),e>>>0}var NE={};const bt=function(){const t=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof t.getBigInt64=="function"&&typeof t.getBigUint64=="function"&&typeof t.setBigInt64=="function"&&typeof t.setBigUint64=="function"&&(typeof process!="object"||NE.BUF_BIGINT_DISABLE!=="1")){const o=BigInt("-9223372036854775808"),r=BigInt("9223372036854775807"),s=BigInt("0"),i=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(a){const l=typeof a=="bigint"?a:BigInt(a);if(l>r||l<o)throw new Error(`int64 invalid: ${a}`);return l},uParse(a){const l=typeof a=="bigint"?a:BigInt(a);if(l>i||l<s)throw new Error(`uint64 invalid: ${a}`);return l},enc(a){return t.setBigInt64(0,this.parse(a),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},uEnc(a){return t.setBigInt64(0,this.uParse(a),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},dec:(a,l)=>(t.setInt32(0,a,!0),t.setInt32(4,l,!0),t.getBigInt64(0,!0)),uDec:(a,l)=>(t.setInt32(0,a,!0),t.setInt32(4,l,!0),t.getBigUint64(0,!0))}}const e=o=>vt(/^-?[0-9]+$/.test(o),`int64 invalid: ${o}`),n=o=>vt(/^[0-9]+$/.test(o),`uint64 invalid: ${o}`);return{zero:"0",supported:!1,parse:o=>(typeof o!="string"&&(o=o.toString()),e(o),o),uParse:o=>(typeof o!="string"&&(o=o.toString()),n(o),o),enc:o=>(typeof o!="string"&&(o=o.toString()),e(o),O1(o)),uEnc:o=>(typeof o!="string"&&(o=o.toString()),n(o),O1(o)),dec:(o,r)=>function(s,i){let a=Wd(s,i);const l=2147483648&a.hi;l&&(a=R1(a.lo,a.hi));const c=D1(a.lo,a.hi);return l?"-"+c:c}(o,r),uDec:(o,r)=>D1(o,r)}}();var he,Ho,Et;function Wo(t,e,n){if(e===n)return!0;if(t==he.BYTES){if(!(e instanceof Uint8Array&&n instanceof Uint8Array)||e.length!==n.length)return!1;for(let o=0;o<e.length;o++)if(e[o]!==n[o])return!1;return!0}switch(t){case he.UINT64:case he.FIXED64:case he.INT64:case he.SFIXED64:case he.SINT64:return e==n}return!1}function Yr(t,e){switch(t){case he.BOOL:return!1;case he.UINT64:case he.FIXED64:case he.INT64:case he.SFIXED64:case he.SINT64:return e==0?bt.zero:"0";case he.DOUBLE:case he.FLOAT:return 0;case he.BYTES:return new Uint8Array(0);case he.STRING:return"";default:return 0}}function F1(t,e){switch(t){case he.BOOL:return e===!1;case he.STRING:return e==="";case he.BYTES:return e instanceof Uint8Array&&!e.byteLength;default:return e==0}}(function(t){t[t.DOUBLE=1]="DOUBLE",t[t.FLOAT=2]="FLOAT",t[t.INT64=3]="INT64",t[t.UINT64=4]="UINT64",t[t.INT32=5]="INT32",t[t.FIXED64=6]="FIXED64",t[t.FIXED32=7]="FIXED32",t[t.BOOL=8]="BOOL",t[t.STRING=9]="STRING",t[t.BYTES=12]="BYTES",t[t.UINT32=13]="UINT32",t[t.SFIXED32=15]="SFIXED32",t[t.SFIXED64=16]="SFIXED64",t[t.SINT32=17]="SINT32",t[t.SINT64=18]="SINT64"})(he||(he={})),function(t){t[t.BIGINT=0]="BIGINT",t[t.STRING=1]="STRING"}(Ho||(Ho={})),function(t){t[t.Varint=0]="Varint",t[t.Bit64=1]="Bit64",t[t.LengthDelimited=2]="LengthDelimited",t[t.StartGroup=3]="StartGroup",t[t.EndGroup=4]="EndGroup",t[t.Bit32=5]="Bit32"}(Et||(Et={}));class jE{constructor(e){this.stack=[],this.textEncoder=e??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let r=0;r<this.chunks.length;r++)e+=this.chunks[r].length;let n=new Uint8Array(e),o=0;for(let r=0;r<this.chunks.length;r++)n.set(this.chunks[r],o),o+=this.chunks[r].length;return this.chunks=[],n}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),n=this.stack.pop();if(!n)throw new Error("invalid state, fork stack empty");return this.chunks=n.chunks,this.buf=n.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,n){return this.uint32((e<<3|n)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for($d(e);e>127;)this.buf.push(127&e|128),e>>>=7;return this.buf.push(e),this}int32(e){return Wa(e),L1(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let n=this.textEncoder.encode(e);return this.uint32(n.byteLength),this.raw(n)}float(e){E1(e);let n=new Uint8Array(4);return new DataView(n.buffer).setFloat32(0,e,!0),this.raw(n)}double(e){let n=new Uint8Array(8);return new DataView(n.buffer).setFloat64(0,e,!0),this.raw(n)}fixed32(e){$d(e);let n=new Uint8Array(4);return new DataView(n.buffer).setUint32(0,e,!0),this.raw(n)}sfixed32(e){Wa(e);let n=new Uint8Array(4);return new DataView(n.buffer).setInt32(0,e,!0),this.raw(n)}sint32(e){return Wa(e),L1(e=(e<<1^e>>31)>>>0,this.buf),this}sfixed64(e){let n=new Uint8Array(8),o=new DataView(n.buffer),r=bt.enc(e);return o.setInt32(0,r.lo,!0),o.setInt32(4,r.hi,!0),this.raw(n)}fixed64(e){let n=new Uint8Array(8),o=new DataView(n.buffer),r=bt.uEnc(e);return o.setInt32(0,r.lo,!0),o.setInt32(4,r.hi,!0),this.raw(n)}int64(e){let n=bt.enc(e);return Hd(n.lo,n.hi,this.buf),this}sint64(e){let n=bt.enc(e),o=n.hi>>31;return Hd(n.lo<<1^o,(n.hi<<1|n.lo>>>31)^o,this.buf),this}uint64(e){let n=bt.uEnc(e);return Hd(n.lo,n.hi,this.buf),this}}class EE{constructor(e,n){this.varint64=SE,this.uint32=CE,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=n??new TextDecoder}tag(){let e=this.uint32(),n=e>>>3,o=7&e;if(n<=0||o<0||o>5)throw new Error("illegal tag: field no "+n+" wire type "+o);return[n,o]}skip(e,n){let o=this.pos;switch(e){case Et.Varint:for(;128&this.buf[this.pos++];);break;case Et.Bit64:this.pos+=4;case Et.Bit32:this.pos+=4;break;case Et.LengthDelimited:let r=this.uint32();this.pos+=r;break;case Et.StartGroup:for(;;){const[s,i]=this.tag();if(i===Et.EndGroup){if(n!==void 0&&s!==n)throw new Error("invalid end group tag");break}this.skip(i,s)}break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(o,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return 0|this.uint32()}sint32(){let e=this.uint32();return e>>>1^-(1&e)}int64(){return bt.dec(...this.varint64())}uint64(){return bt.uDec(...this.varint64())}sint64(){let[e,n]=this.varint64(),o=-(1&e);return e=(e>>>1|(1&n)<<31)^o,n=n>>>1^o,bt.dec(e,n)}bool(){let[e,n]=this.varint64();return e!==0||n!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return bt.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return bt.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),n=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(n,n+e)}string(){return this.textDecoder.decode(this.bytes())}}function z1(t){const e=t.field.localName,n=Object.create(null);return n[e]=function(o){const r=o.field;if(r.repeated)return[];if(r.default!==void 0)return r.default;switch(r.kind){case"enum":return r.T.values[0].no;case"scalar":return Yr(r.T,r.L);case"message":const s=r.T,i=new s;return s.fieldWrapper?s.fieldWrapper.unwrapField(i):i;case"map":throw"map fields are not allowed to be extensions"}}(t),[n,()=>n[e]]}let _o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),Ga=[];for(let t=0;t<_o.length;t++)Ga[_o[t].charCodeAt(0)]=t;Ga[45]=_o.indexOf("+"),Ga[95]=_o.indexOf("/");const Ya={dec(t){let e=3*t.length/4;t[t.length-2]=="="?e-=2:t[t.length-1]=="="&&(e-=1);let n,o=new Uint8Array(e),r=0,s=0,i=0;for(let a=0;a<t.length;a++){if(n=Ga[t.charCodeAt(a)],n===void 0)switch(t[a]){case"=":s=0;case`
|
104
|
-
`:case"\r":case" ":case" ":continue;default:throw Error("invalid base64 string.")}switch(s){case 0:i=n,s=1;break;case 1:o[r++]=i<<2|(48&n)>>4,i=n,s=2;break;case 2:o[r++]=(15&i)<<4|(60&n)>>2,i=n,s=3;break;case 3:o[r++]=(3&i)<<6|n,s=0}}if(s==1)throw Error("invalid base64 string.");return o.subarray(0,r)},enc(t){let e,n="",o=0,r=0;for(let s=0;s<t.length;s++)switch(e=t[s],o){case 0:n+=_o[e>>2],r=(3&e)<<4,o=1;break;case 1:n+=_o[r|e>>4],r=(15&e)<<2,o=2;break;case 2:n+=_o[r|e>>6],n+=_o[63&e],o=0}return o&&(n+=_o[r],n+="=",o==1&&(n+="=")),n}};function IE(t,e,n){U1(e,t);const o=e.runtime.bin.makeReadOptions(n),r=function(a,l){if(!l.repeated&&(l.kind=="enum"||l.kind=="scalar")){for(let c=a.length-1;c>=0;--c)if(a[c].no==l.no)return[a[c]];return[]}return a.filter(c=>c.no===l.no)}(t.getType().runtime.bin.listUnknownFields(t),e.field),[s,i]=z1(e);for(const a of r)e.runtime.bin.readField(s,o.readerFactory(a.data),e.field,a.wireType,o);return i()}function AE(t,e,n,o){U1(e,t);const r=e.runtime.bin.makeReadOptions(o),s=e.runtime.bin.makeWriteOptions(o);if(B1(t,e)){const c=t.getType().runtime.bin.listUnknownFields(t).filter(u=>u.no!=e.field.no);t.getType().runtime.bin.discardUnknownFields(t);for(const u of c)t.getType().runtime.bin.onUnknownField(t,u.no,u.wireType,u.data)}const i=s.writerFactory();let a=e.field;a.opt||a.repeated||a.kind!="enum"&&a.kind!="scalar"||(a=Object.assign(Object.assign({},e.field),{opt:!0})),e.runtime.bin.writeField(a,n,i,s);const l=r.readerFactory(i.finish());for(;l.pos<l.len;){const[c,u]=l.tag(),h=l.skip(u,c);t.getType().runtime.bin.onUnknownField(t,c,u,h)}}function B1(t,e){const n=t.getType();return e.extendee.typeName===n.typeName&&!!n.runtime.bin.listUnknownFields(t).find(o=>o.no==e.field.no)}function U1(t,e){vt(t.extendee.typeName==e.getType().typeName,`extension ${t.typeName} can only be applied to message ${t.extendee.typeName}`)}function V1(t,e){const n=t.localName;if(t.repeated)return e[n].length>0;if(t.oneof)return e[t.oneof.localName].case===n;switch(t.kind){case"enum":case"scalar":return t.opt||t.req?e[n]!==void 0:t.kind=="enum"?e[n]!==t.T.values[0].no:!F1(t.T,e[n]);case"message":return e[n]!==void 0;case"map":return Object.keys(e[n]).length>0}}function $1(t,e){const n=t.localName,o=!t.opt&&!t.req;if(t.repeated)e[n]=[];else if(t.oneof)e[t.oneof.localName]={case:void 0};else switch(t.kind){case"map":e[n]={};break;case"enum":e[n]=o?t.T.values[0].no:void 0;break;case"scalar":e[n]=o?Yr(t.T,t.L):void 0;break;case"message":e[n]=void 0}}function vr(t,e){if(t===null||typeof t!="object"||!Object.getOwnPropertyNames(Ot.prototype).every(o=>o in t&&typeof t[o]=="function"))return!1;const n=t.getType();return n!==null&&typeof n=="function"&&"typeName"in n&&typeof n.typeName=="string"&&(e===void 0||n.typeName==e.typeName)}function H1(t,e){return vr(e)||!t.fieldWrapper?e:t.fieldWrapper.wrapField(e)}he.DOUBLE,he.FLOAT,he.INT64,he.UINT64,he.INT32,he.UINT32,he.BOOL,he.STRING,he.BYTES;const W1={ignoreUnknownFields:!1},q1={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function TE(t){return t?Object.assign(Object.assign({},W1),t):W1}function ME(t){return t?Object.assign(Object.assign({},q1),t):q1}const Ja=Symbol(),Ka=Symbol();function no(t){if(t===null)return"null";switch(typeof t){case"object":return Array.isArray(t)?"array":"object";case"string":return t.length>100?"string":`"${t.split('"').join('\\"')}"`;default:return String(t)}}function G1(t,e,n,o,r){let s=n.localName;if(n.repeated){if(vt(n.kind!="map"),e===null)return;if(!Array.isArray(e))throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: ${no(e)}`);const i=t[s];for(const a of e){if(a===null)throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: ${no(a)}`);switch(n.kind){case"message":i.push(n.T.fromJson(a,o));break;case"enum":const l=qd(n.T,a,o.ignoreUnknownFields,!0);l!==Ka&&i.push(l);break;case"scalar":try{i.push(ai(n.T,a,n.L,!0))}catch(c){let u=`cannot decode field ${r.typeName}.${n.name} from JSON: ${no(a)}`;throw c instanceof Error&&c.message.length>0&&(u+=`: ${c.message}`),new Error(u)}}}}else if(n.kind=="map"){if(e===null)return;if(typeof e!="object"||Array.isArray(e))throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: ${no(e)}`);const i=t[s];for(const[a,l]of Object.entries(e)){if(l===null)throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: map value null`);let c;try{c=OE(n.K,a)}catch(u){let h=`cannot decode map key for field ${r.typeName}.${n.name} from JSON: ${no(e)}`;throw u instanceof Error&&u.message.length>0&&(h+=`: ${u.message}`),new Error(h)}switch(n.V.kind){case"message":i[c]=n.V.T.fromJson(l,o);break;case"enum":const u=qd(n.V.T,l,o.ignoreUnknownFields,!0);u!==Ka&&(i[c]=u);break;case"scalar":try{i[c]=ai(n.V.T,l,Ho.BIGINT,!0)}catch(h){let f=`cannot decode map value for field ${r.typeName}.${n.name} from JSON: ${no(e)}`;throw h instanceof Error&&h.message.length>0&&(f+=`: ${h.message}`),new Error(f)}}}}else switch(n.oneof&&(t=t[n.oneof.localName]={case:s},s="value"),n.kind){case"message":const i=n.T;if(e===null&&i.typeName!="google.protobuf.Value")return;let a=t[s];vr(a)?a.fromJson(e,o):(t[s]=a=i.fromJson(e,o),i.fieldWrapper&&!n.oneof&&(t[s]=i.fieldWrapper.unwrapField(a)));break;case"enum":const l=qd(n.T,e,o.ignoreUnknownFields,!1);switch(l){case Ja:$1(n,t);break;case Ka:break;default:t[s]=l}break;case"scalar":try{const c=ai(n.T,e,n.L,!1);c===Ja?$1(n,t):t[s]=c}catch(c){let u=`cannot decode field ${r.typeName}.${n.name} from JSON: ${no(e)}`;throw c instanceof Error&&c.message.length>0&&(u+=`: ${c.message}`),new Error(u)}}}function OE(t,e){if(t===he.BOOL)switch(e){case"true":e=!0;break;case"false":e=!1}return ai(t,e,Ho.BIGINT,!0).toString()}function ai(t,e,n,o){if(e===null)return o?Yr(t,n):Ja;switch(t){case he.DOUBLE:case he.FLOAT:if(e==="NaN")return Number.NaN;if(e==="Infinity")return Number.POSITIVE_INFINITY;if(e==="-Infinity")return Number.NEGATIVE_INFINITY;if(e===""||typeof e=="string"&&e.trim().length!==e.length||typeof e!="string"&&typeof e!="number")break;const r=Number(e);if(Number.isNaN(r)||!Number.isFinite(r))break;return t==he.FLOAT&&E1(r),r;case he.INT32:case he.FIXED32:case he.SFIXED32:case he.SINT32:case he.UINT32:let s;if(typeof e=="number"?s=e:typeof e=="string"&&e.length>0&&e.trim().length===e.length&&(s=Number(e)),s===void 0)break;return t==he.UINT32||t==he.FIXED32?$d(s):Wa(s),s;case he.INT64:case he.SFIXED64:case he.SINT64:if(typeof e!="number"&&typeof e!="string")break;const i=bt.parse(e);return n?i.toString():i;case he.FIXED64:case he.UINT64:if(typeof e!="number"&&typeof e!="string")break;const a=bt.uParse(e);return n?a.toString():a;case he.BOOL:if(typeof e!="boolean")break;return e;case he.STRING:if(typeof e!="string")break;try{encodeURIComponent(e)}catch{throw new Error("invalid UTF8")}return e;case he.BYTES:if(e==="")return new Uint8Array(0);if(typeof e!="string")break;return Ya.dec(e)}throw new Error}function qd(t,e,n,o){if(e===null)return t.typeName=="google.protobuf.NullValue"?0:o?t.values[0].no:Ja;switch(typeof e){case"number":if(Number.isInteger(e))return e;break;case"string":const r=t.findName(e);if(r!==void 0)return r.no;if(n)return Ka}throw new Error(`cannot decode enum ${t.typeName} from JSON: ${no(e)}`)}function DE(t){return!(!t.repeated&&t.kind!="map")||!t.oneof&&t.kind!="message"&&!t.opt&&!t.req}function Y1(t,e,n){if(t.kind=="map"){vt(typeof e=="object"&&e!=null);const o={},r=Object.entries(e);switch(t.V.kind){case"scalar":for(const[i,a]of r)o[i.toString()]=Xa(t.V.T,a);break;case"message":for(const[i,a]of r)o[i.toString()]=a.toJson(n);break;case"enum":const s=t.V.T;for(const[i,a]of r)o[i.toString()]=Gd(s,a,n.enumAsInteger)}return n.emitDefaultValues||r.length>0?o:void 0}if(t.repeated){vt(Array.isArray(e));const o=[];switch(t.kind){case"scalar":for(let r=0;r<e.length;r++)o.push(Xa(t.T,e[r]));break;case"enum":for(let r=0;r<e.length;r++)o.push(Gd(t.T,e[r],n.enumAsInteger));break;case"message":for(let r=0;r<e.length;r++)o.push(e[r].toJson(n))}return n.emitDefaultValues||o.length>0?o:void 0}switch(t.kind){case"scalar":return Xa(t.T,e);case"enum":return Gd(t.T,e,n.enumAsInteger);case"message":return H1(t.T,e).toJson(n)}}function Gd(t,e,n){var o;if(vt(typeof e=="number"),t.typeName=="google.protobuf.NullValue")return null;if(n)return e;const r=t.findNumber(e);return(o=r==null?void 0:r.name)!==null&&o!==void 0?o:e}function Xa(t,e){switch(t){case he.INT32:case he.SFIXED32:case he.SINT32:case he.FIXED32:case he.UINT32:return vt(typeof e=="number"),e;case he.FLOAT:case he.DOUBLE:return vt(typeof e=="number"),Number.isNaN(e)?"NaN":e===Number.POSITIVE_INFINITY?"Infinity":e===Number.NEGATIVE_INFINITY?"-Infinity":e;case he.STRING:return vt(typeof e=="string"),e;case he.BOOL:return vt(typeof e=="boolean"),e;case he.UINT64:case he.FIXED64:case he.INT64:case he.SFIXED64:case he.SINT64:return vt(typeof e=="bigint"||typeof e=="string"||typeof e=="number"),e.toString();case he.BYTES:return vt(e instanceof Uint8Array),Ya.enc(e)}}const Jr=Symbol("@bufbuild/protobuf/unknown-fields"),J1={readUnknownFields:!0,readerFactory:t=>new EE(t)},K1={writeUnknownFields:!0,writerFactory:()=>new jE};function RE(t){return t?Object.assign(Object.assign({},J1),t):J1}function PE(t){return t?Object.assign(Object.assign({},K1),t):K1}function X1(t,e,n,o,r){let{repeated:s,localName:i}=n;switch(n.oneof&&((t=t[n.oneof.localName]).case!=i&&delete t.value,t.case=i,i="value"),n.kind){case"scalar":case"enum":const a=n.kind=="enum"?he.INT32:n.T;let l=Qa;if(n.kind=="scalar"&&n.L>0&&(l=LE),s){let f=t[i];if(o==Et.LengthDelimited&&a!=he.STRING&&a!=he.BYTES){let m=e.uint32()+e.pos;for(;e.pos<m;)f.push(l(e,a))}else f.push(l(e,a))}else t[i]=l(e,a);break;case"message":const c=n.T;s?t[i].push(Za(e,new c,r,n)):vr(t[i])?Za(e,t[i],r,n):(t[i]=Za(e,new c,r,n),!c.fieldWrapper||n.oneof||n.repeated||(t[i]=c.fieldWrapper.unwrapField(t[i])));break;case"map":let[u,h]=function(f,m,_){const g=m.uint32(),p=m.pos+g;let b,x;for(;m.pos<p;){const[y]=m.tag();switch(y){case 1:b=Qa(m,f.K);break;case 2:switch(f.V.kind){case"scalar":x=Qa(m,f.V.T);break;case"enum":x=m.int32();break;case"message":x=Za(m,new f.V.T,_,void 0)}}}if(b===void 0&&(b=Yr(f.K,Ho.BIGINT)),typeof b!="string"&&typeof b!="number"&&(b=b.toString()),x===void 0)switch(f.V.kind){case"scalar":x=Yr(f.V.T,Ho.BIGINT);break;case"enum":x=f.V.T.values[0].no;break;case"message":x=new f.V.T}return[b,x]}(n,e,r);t[i][u]=h}}function Za(t,e,n,o){const r=e.getType().runtime.bin,s=o==null?void 0:o.delimited;return r.readMessage(e,t,s?o.no:t.uint32(),n,s),e}function LE(t,e){const n=Qa(t,e);return typeof n=="bigint"?n.toString():n}function Qa(t,e){switch(e){case he.STRING:return t.string();case he.BOOL:return t.bool();case he.DOUBLE:return t.double();case he.FLOAT:return t.float();case he.INT32:return t.int32();case he.INT64:return t.int64();case he.UINT64:return t.uint64();case he.FIXED64:return t.fixed64();case he.BYTES:return t.bytes();case he.FIXED32:return t.fixed32();case he.SFIXED32:return t.sfixed32();case he.SFIXED64:return t.sfixed64();case he.SINT64:return t.sint64();case he.UINT32:return t.uint32();case he.SINT32:return t.sint32()}}function Z1(t,e,n,o){vt(e!==void 0);const r=t.repeated;switch(t.kind){case"scalar":case"enum":let s=t.kind=="enum"?he.INT32:t.T;if(r)if(vt(Array.isArray(e)),t.packed)(function(i,a,l,c){if(!c.length)return;i.tag(l,Et.LengthDelimited).fork();let[,u]=e_(a);for(let h=0;h<c.length;h++)i[u](c[h]);i.join()})(n,s,t.no,e);else for(const i of e)li(n,s,t.no,i);else li(n,s,t.no,e);break;case"message":if(r){vt(Array.isArray(e));for(const i of e)Q1(n,o,t,i)}else Q1(n,o,t,e);break;case"map":vt(typeof e=="object"&&e!=null);for(const[i,a]of Object.entries(e))FE(n,o,t,i,a)}}function FE(t,e,n,o,r){t.tag(n.no,Et.LengthDelimited),t.fork();let s=o;switch(n.K){case he.INT32:case he.FIXED32:case he.UINT32:case he.SFIXED32:case he.SINT32:s=Number.parseInt(o);break;case he.BOOL:vt(o=="true"||o=="false"),s=o=="true"}switch(li(t,n.K,1,s),n.V.kind){case"scalar":li(t,n.V.T,2,r);break;case"enum":li(t,he.INT32,2,r);break;case"message":vt(r!==void 0),t.tag(2,Et.LengthDelimited).bytes(r.toBinary(e))}t.join()}function Q1(t,e,n,o){const r=H1(n.T,o);n.delimited?t.tag(n.no,Et.StartGroup).raw(r.toBinary(e)).tag(n.no,Et.EndGroup):t.tag(n.no,Et.LengthDelimited).bytes(r.toBinary(e))}function li(t,e,n,o){vt(o!==void 0);let[r,s]=e_(e);t.tag(n,r)[s](o)}function e_(t){let e=Et.Varint;switch(t){case he.BYTES:case he.STRING:e=Et.LengthDelimited;break;case he.DOUBLE:case he.FIXED64:case he.SFIXED64:e=Et.Bit64;break;case he.FIXED32:case he.SFIXED32:case he.FLOAT:e=Et.Bit32}return[e,he[t].toLowerCase()]}function el(t){if(t===void 0)return t;if(vr(t))return t.clone();if(t instanceof Uint8Array){const e=new Uint8Array(t.byteLength);return e.set(t),e}return t}function ci(t){return t instanceof Uint8Array?t:new Uint8Array(t)}class zE{constructor(e,n){this._fields=e,this._normalizer=n}findJsonName(e){if(!this.jsonNames){const n={};for(const o of this.list())n[o.jsonName]=n[o.name]=o;this.jsonNames=n}return this.jsonNames[e]}find(e){if(!this.numbers){const n={};for(const o of this.list())n[o.no]=o;this.numbers=n}return this.numbers[e]}list(){return this.all||(this.all=this._normalizer(this._fields)),this.all}byNumber(){return this.numbersAsc||(this.numbersAsc=this.list().concat().sort((e,n)=>e.no-n.no)),this.numbersAsc}byMember(){if(!this.members){this.members=[];const e=this.members;let n;for(const o of this.list())o.oneof?o.oneof!==n&&(n=o.oneof,e.push(n)):e.push(o)}return this.members}}function t_(t,e){const n=n_(t);return e?n:HE($E(n))}const BE=n_;function n_(t){let e=!1;const n=[];for(let o=0;o<t.length;o++){let r=t.charAt(o);switch(r){case"_":e=!0;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n.push(r),e=!1;break;default:e&&(e=!1,r=r.toUpperCase()),n.push(r)}}return n.join("")}const UE=new Set(["constructor","toString","toJSON","valueOf"]),VE=new Set(["getType","clone","equals","fromBinary","fromJson","fromJsonString","toBinary","toJson","toJsonString","toObject"]),o_=t=>`${t}$`,$E=t=>VE.has(t)?o_(t):t,HE=t=>UE.has(t)?o_(t):t;class WE{constructor(e){this.kind="oneof",this.repeated=!1,this.packed=!1,this.opt=!1,this.req=!1,this.default=void 0,this.fields=[],this.name=e,this.localName=t_(e,!1)}addField(e){vt(e.oneof===this,`field ${e.name} not one of ${this.name}`),this.fields.push(e)}findField(e){if(!this._lookup){this._lookup=Object.create(null);for(let n=0;n<this.fields.length;n++)this._lookup[this.fields[n].localName]=this.fields[n]}return this._lookup[e]}}const we=(r_=t=>new zE(t,e=>function(n){var o,r,s,i,a,l;const c=[];let u;for(const h of typeof n=="function"?n():n){const f=h;if(f.localName=t_(h.name,h.oneof!==void 0),f.jsonName=(o=h.jsonName)!==null&&o!==void 0?o:BE(h.name),f.repeated=(r=h.repeated)!==null&&r!==void 0&&r,h.kind=="scalar"&&(f.L=(s=h.L)!==null&&s!==void 0?s:Ho.BIGINT),f.delimited=(i=h.delimited)!==null&&i!==void 0&&i,f.req=(a=h.req)!==null&&a!==void 0&&a,f.opt=(l=h.opt)!==null&&l!==void 0&&l,h.packed===void 0&&(f.packed=h.kind=="enum"||h.kind=="scalar"&&h.T!=he.BYTES&&h.T!=he.STRING),h.oneof!==void 0){const m=typeof h.oneof=="string"?h.oneof:h.oneof.name;u&&u.name==m||(u=new WE(m)),f.oneof=u,u.addField(f)}c.push(f)}return c}(e)),s_=t=>{for(const e of t.getType().fields.byMember()){if(e.opt)continue;const n=e.localName,o=t;if(e.repeated)o[n]=[];else switch(e.kind){case"oneof":o[n]={case:void 0};break;case"enum":o[n]=0;break;case"map":o[n]={};break;case"scalar":o[n]=Yr(e.T,e.L)}}},{syntax:"proto3",json:{makeReadOptions:TE,makeWriteOptions:ME,readMessage(t,e,n,o){if(e==null||Array.isArray(e)||typeof e!="object")throw new Error(`cannot decode message ${t.typeName} from JSON: ${no(e)}`);o=o??new t;const r=new Map,s=n.typeRegistry;for(const[i,a]of Object.entries(e)){const l=t.fields.findJsonName(i);if(l){if(l.oneof){if(a===null&&l.kind=="scalar")continue;const c=r.get(l.oneof);if(c!==void 0)throw new Error(`cannot decode message ${t.typeName} from JSON: multiple keys for oneof "${l.oneof.name}" present: "${c}", "${i}"`);r.set(l.oneof,i)}G1(o,a,l,n,t)}else{let c=!1;if(s!=null&&s.findExtension&&i.startsWith("[")&&i.endsWith("]")){const u=s.findExtension(i.substring(1,i.length-1));if(u&&u.extendee.typeName==t.typeName){c=!0;const[h,f]=z1(u);G1(h,a,u.field,n,u),AE(o,u,f(),n)}}if(!c&&!n.ignoreUnknownFields)throw new Error(`cannot decode message ${t.typeName} from JSON: key "${i}" is unknown`)}}return o},writeMessage(t,e){const n=t.getType(),o={};let r;try{for(r of n.fields.byNumber()){if(!V1(r,t)){if(r.req)throw"required field not set";if(!e.emitDefaultValues||!DE(r))continue}const i=Y1(r,r.oneof?t[r.oneof.localName].value:t[r.localName],e);i!==void 0&&(o[e.useProtoFieldName?r.name:r.jsonName]=i)}const s=e.typeRegistry;if(s!=null&&s.findExtensionFor)for(const i of n.runtime.bin.listUnknownFields(t)){const a=s.findExtensionFor(n.typeName,i.no);if(a&&B1(t,a)){const l=IE(t,a,e),c=Y1(a.field,l,e);c!==void 0&&(o[a.field.jsonName]=c)}}}catch(s){const i=r?`cannot encode field ${n.typeName}.${r.name} to JSON`:`cannot encode message ${n.typeName} to JSON`,a=s instanceof Error?s.message:String(s);throw new Error(i+(a.length>0?`: ${a}`:""))}return o},readScalar:(t,e,n)=>ai(t,e,n??Ho.BIGINT,!0),writeScalar(t,e,n){if(e!==void 0)return n||F1(t,e)?Xa(t,e):void 0},debug:no},bin:{makeReadOptions:RE,makeWriteOptions:PE,listUnknownFields(t){var e;return(e=t[Jr])!==null&&e!==void 0?e:[]},discardUnknownFields(t){delete t[Jr]},writeUnknownFields(t,e){const n=t[Jr];if(n)for(const o of n)e.tag(o.no,o.wireType).raw(o.data)},onUnknownField(t,e,n,o){const r=t;Array.isArray(r[Jr])||(r[Jr]=[]),r[Jr].push({no:e,wireType:n,data:o})},readMessage(t,e,n,o,r){const s=t.getType(),i=r?e.len:e.pos+n;let a,l;for(;e.pos<i&&([a,l]=e.tag(),r!==!0||l!=Et.EndGroup);){const c=s.fields.find(a);if(!c){const u=e.skip(l,a);o.readUnknownFields&&this.onUnknownField(t,a,l,u);continue}X1(t,e,c,l,o)}if(r&&(l!=Et.EndGroup||a!==n))throw new Error("invalid end group tag")},readField:X1,writeMessage(t,e,n){const o=t.getType();for(const r of o.fields.byNumber())if(V1(r,t))Z1(r,r.oneof?t[r.oneof.localName].value:t[r.localName],e,n);else if(r.req)throw new Error(`cannot encode field ${o.typeName}.${r.name} to binary: required field not set`);return n.writeUnknownFields&&this.writeUnknownFields(t,e),e},writeField(t,e,n,o){e!==void 0&&Z1(t,e,n,o)}},util:Object.assign(Object.assign({},{setEnumType:A1,initPartial(t,e){if(t===void 0)return;const n=e.getType();for(const o of n.fields.byMember()){const r=o.localName,s=e,i=t;if(i[r]!=null)switch(o.kind){case"oneof":const a=i[r].case;if(a===void 0)continue;const l=o.findField(a);let c=i[r].value;l&&l.kind=="message"&&!vr(c,l.T)?c=new l.T(c):l&&l.kind==="scalar"&&l.T===he.BYTES&&(c=ci(c)),s[r]={case:a,value:c};break;case"scalar":case"enum":let u=i[r];o.T===he.BYTES&&(u=o.repeated?u.map(ci):ci(u)),s[r]=u;break;case"map":switch(o.V.kind){case"scalar":case"enum":if(o.V.T===he.BYTES)for(const[m,_]of Object.entries(i[r]))s[r][m]=ci(_);else Object.assign(s[r],i[r]);break;case"message":const f=o.V.T;for(const m of Object.keys(i[r])){let _=i[r][m];f.fieldWrapper||(_=new f(_)),s[r][m]=_}}break;case"message":const h=o.T;if(o.repeated)s[r]=i[r].map(f=>vr(f,h)?f:new h(f));else{const f=i[r];h.fieldWrapper?h.typeName==="google.protobuf.BytesValue"?s[r]=ci(f):s[r]=f:s[r]=vr(f,h)?f:new h(f)}}}},equals:(t,e,n)=>e===n||!(!e||!n)&&t.fields.byMember().every(o=>{const r=e[o.localName],s=n[o.localName];if(o.repeated){if(r.length!==s.length)return!1;switch(o.kind){case"message":return r.every((i,a)=>o.T.equals(i,s[a]));case"scalar":return r.every((i,a)=>Wo(o.T,i,s[a]));case"enum":return r.every((i,a)=>Wo(he.INT32,i,s[a]))}throw new Error(`repeated cannot contain ${o.kind}`)}switch(o.kind){case"message":return o.T.equals(r,s);case"enum":return Wo(he.INT32,r,s);case"scalar":return Wo(o.T,r,s);case"oneof":if(r.case!==s.case)return!1;const i=o.findField(r.case);if(i===void 0)return!0;switch(i.kind){case"message":return i.T.equals(r.value,s.value);case"enum":return Wo(he.INT32,r.value,s.value);case"scalar":return Wo(i.T,r.value,s.value)}throw new Error(`oneof cannot contain ${i.kind}`);case"map":const a=Object.keys(r).concat(Object.keys(s));switch(o.V.kind){case"message":const l=o.V.T;return a.every(u=>l.equals(r[u],s[u]));case"enum":return a.every(u=>Wo(he.INT32,r[u],s[u]));case"scalar":const c=o.V.T;return a.every(u=>Wo(c,r[u],s[u]))}}}),clone(t){const e=t.getType(),n=new e,o=n;for(const r of e.fields.byMember()){const s=t[r.localName];let i;if(r.repeated)i=s.map(el);else if(r.kind=="map"){i=o[r.localName];for(const[a,l]of Object.entries(s))i[a]=el(l)}else i=r.kind=="oneof"?r.findField(s.case)?{case:s.case,value:el(s.value)}:{case:void 0}:el(s);o[r.localName]=i}for(const r of e.runtime.bin.listUnknownFields(t))e.runtime.bin.onUnknownField(o,r.no,r.wireType,r.data);return n}}),{newFieldList:r_,initFields:s_}),makeMessageType(t,e,n){return function(o,r,s,i){var a;const l=(a=i==null?void 0:i.localName)!==null&&a!==void 0?a:r.substring(r.lastIndexOf(".")+1),c={[l]:function(u){o.util.initFields(this),o.util.initPartial(u,this)}}[l];return Object.setPrototypeOf(c.prototype,new Ot),Object.assign(c,{runtime:o,typeName:r,fields:o.util.newFieldList(s),fromBinary:(u,h)=>new c().fromBinary(u,h),fromJson:(u,h)=>new c().fromJson(u,h),fromJsonString:(u,h)=>new c().fromJsonString(u,h),equals:(u,h)=>o.util.equals(c,u,h)}),c}(this,t,e,n)},makeEnum:kE,makeEnumType:T1,getEnumType:vE,makeExtension(t,e,n){return function(o,r,s,i){let a;return{typeName:r,extendee:s,get field(){if(!a){const l=typeof i=="function"?i():i;l.name=r.split(".").pop(),l.jsonName=`[${r}]`,a=o.util.newFieldList([l]).list()[0]}return a},runtime:o}}(this,t,e,n)}});var r_,s_,Tn,Yd,tl,di,nl,ui,qo;(function(t){t[t.Unary=0]="Unary",t[t.ServerStreaming=1]="ServerStreaming",t[t.ClientStreaming=2]="ClientStreaming",t[t.BiDiStreaming=3]="BiDiStreaming"})(Tn||(Tn={})),function(t){t[t.NoSideEffects=1]="NoSideEffects",t[t.Idempotent=2]="Idempotent"}(Yd||(Yd={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.JUPYTER_FORMAT=77]="JUPYTER_FORMAT"}(tl||(tl={})),we.util.setEnumType(tl,"exa.codeium_common_pb.ExperimentKey",[{no:0,name:"UNSPECIFIED"},{no:77,name:"JUPYTER_FORMAT"}]),function(t){t[t.CODEIUM=0]="CODEIUM"}(di||(di={})),we.util.setEnumType(di,"exa.codeium_common_pb.AuthSource",[{no:0,name:"AUTH_SOURCE_CODEIUM"}]),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.ENABLE_CODEIUM=1]="ENABLE_CODEIUM",t[t.DISABLE_CODEIUM=2]="DISABLE_CODEIUM",t[t.SHOW_PREVIOUS_COMPLETION=3]="SHOW_PREVIOUS_COMPLETION",t[t.SHOW_NEXT_COMPLETION=4]="SHOW_NEXT_COMPLETION"}(nl||(nl={})),we.util.setEnumType(nl,"exa.codeium_common_pb.EventType",[{no:0,name:"EVENT_TYPE_UNSPECIFIED"},{no:1,name:"EVENT_TYPE_ENABLE_CODEIUM"},{no:2,name:"EVENT_TYPE_DISABLE_CODEIUM"},{no:3,name:"EVENT_TYPE_SHOW_PREVIOUS_COMPLETION"},{no:4,name:"EVENT_TYPE_SHOW_NEXT_COMPLETION"}]),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TYPING_AS_SUGGESTED=1]="TYPING_AS_SUGGESTED",t[t.CACHE=2]="CACHE",t[t.NETWORK=3]="NETWORK"}(ui||(ui={})),we.util.setEnumType(ui,"exa.codeium_common_pb.CompletionSource",[{no:0,name:"COMPLETION_SOURCE_UNSPECIFIED"},{no:1,name:"COMPLETION_SOURCE_TYPING_AS_SUGGESTED"},{no:2,name:"COMPLETION_SOURCE_CACHE"},{no:3,name:"COMPLETION_SOURCE_NETWORK"}]),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.C=1]="C",t[t.CLOJURE=2]="CLOJURE",t[t.COFFEESCRIPT=3]="COFFEESCRIPT",t[t.CPP=4]="CPP",t[t.CSHARP=5]="CSHARP",t[t.CSS=6]="CSS",t[t.CUDACPP=7]="CUDACPP",t[t.DOCKERFILE=8]="DOCKERFILE",t[t.GO=9]="GO",t[t.GROOVY=10]="GROOVY",t[t.HANDLEBARS=11]="HANDLEBARS",t[t.HASKELL=12]="HASKELL",t[t.HCL=13]="HCL",t[t.HTML=14]="HTML",t[t.INI=15]="INI",t[t.JAVA=16]="JAVA",t[t.JAVASCRIPT=17]="JAVASCRIPT",t[t.JSON=18]="JSON",t[t.JULIA=19]="JULIA",t[t.KOTLIN=20]="KOTLIN",t[t.LATEX=21]="LATEX",t[t.LESS=22]="LESS",t[t.LUA=23]="LUA",t[t.MAKEFILE=24]="MAKEFILE",t[t.MARKDOWN=25]="MARKDOWN",t[t.OBJECTIVEC=26]="OBJECTIVEC",t[t.OBJECTIVECPP=27]="OBJECTIVECPP",t[t.PERL=28]="PERL",t[t.PHP=29]="PHP",t[t.PLAINTEXT=30]="PLAINTEXT",t[t.PROTOBUF=31]="PROTOBUF",t[t.PBTXT=32]="PBTXT",t[t.PYTHON=33]="PYTHON",t[t.R=34]="R",t[t.RUBY=35]="RUBY",t[t.RUST=36]="RUST",t[t.SASS=37]="SASS",t[t.SCALA=38]="SCALA",t[t.SCSS=39]="SCSS",t[t.SHELL=40]="SHELL",t[t.SQL=41]="SQL",t[t.STARLARK=42]="STARLARK",t[t.SWIFT=43]="SWIFT",t[t.TSX=44]="TSX",t[t.TYPESCRIPT=45]="TYPESCRIPT",t[t.VISUALBASIC=46]="VISUALBASIC",t[t.VUE=47]="VUE",t[t.XML=48]="XML",t[t.XSL=49]="XSL",t[t.YAML=50]="YAML",t[t.SVELTE=51]="SVELTE",t[t.TOML=52]="TOML",t[t.DART=53]="DART",t[t.RST=54]="RST",t[t.OCAML=55]="OCAML",t[t.CMAKE=56]="CMAKE",t[t.PASCAL=57]="PASCAL",t[t.ELIXIR=58]="ELIXIR",t[t.FSHARP=59]="FSHARP",t[t.LISP=60]="LISP",t[t.MATLAB=61]="MATLAB",t[t.POWERSHELL=62]="POWERSHELL",t[t.SOLIDITY=63]="SOLIDITY",t[t.ADA=64]="ADA",t[t.OCAML_INTERFACE=65]="OCAML_INTERFACE"}(qo||(qo={})),we.util.setEnumType(qo,"exa.codeium_common_pb.Language",[{no:0,name:"LANGUAGE_UNSPECIFIED"},{no:1,name:"LANGUAGE_C"},{no:2,name:"LANGUAGE_CLOJURE"},{no:3,name:"LANGUAGE_COFFEESCRIPT"},{no:4,name:"LANGUAGE_CPP"},{no:5,name:"LANGUAGE_CSHARP"},{no:6,name:"LANGUAGE_CSS"},{no:7,name:"LANGUAGE_CUDACPP"},{no:8,name:"LANGUAGE_DOCKERFILE"},{no:9,name:"LANGUAGE_GO"},{no:10,name:"LANGUAGE_GROOVY"},{no:11,name:"LANGUAGE_HANDLEBARS"},{no:12,name:"LANGUAGE_HASKELL"},{no:13,name:"LANGUAGE_HCL"},{no:14,name:"LANGUAGE_HTML"},{no:15,name:"LANGUAGE_INI"},{no:16,name:"LANGUAGE_JAVA"},{no:17,name:"LANGUAGE_JAVASCRIPT"},{no:18,name:"LANGUAGE_JSON"},{no:19,name:"LANGUAGE_JULIA"},{no:20,name:"LANGUAGE_KOTLIN"},{no:21,name:"LANGUAGE_LATEX"},{no:22,name:"LANGUAGE_LESS"},{no:23,name:"LANGUAGE_LUA"},{no:24,name:"LANGUAGE_MAKEFILE"},{no:25,name:"LANGUAGE_MARKDOWN"},{no:26,name:"LANGUAGE_OBJECTIVEC"},{no:27,name:"LANGUAGE_OBJECTIVECPP"},{no:28,name:"LANGUAGE_PERL"},{no:29,name:"LANGUAGE_PHP"},{no:30,name:"LANGUAGE_PLAINTEXT"},{no:31,name:"LANGUAGE_PROTOBUF"},{no:32,name:"LANGUAGE_PBTXT"},{no:33,name:"LANGUAGE_PYTHON"},{no:34,name:"LANGUAGE_R"},{no:35,name:"LANGUAGE_RUBY"},{no:36,name:"LANGUAGE_RUST"},{no:37,name:"LANGUAGE_SASS"},{no:38,name:"LANGUAGE_SCALA"},{no:39,name:"LANGUAGE_SCSS"},{no:40,name:"LANGUAGE_SHELL"},{no:41,name:"LANGUAGE_SQL"},{no:42,name:"LANGUAGE_STARLARK"},{no:43,name:"LANGUAGE_SWIFT"},{no:44,name:"LANGUAGE_TSX"},{no:45,name:"LANGUAGE_TYPESCRIPT"},{no:46,name:"LANGUAGE_VISUALBASIC"},{no:47,name:"LANGUAGE_VUE"},{no:48,name:"LANGUAGE_XML"},{no:49,name:"LANGUAGE_XSL"},{no:50,name:"LANGUAGE_YAML"},{no:51,name:"LANGUAGE_SVELTE"},{no:52,name:"LANGUAGE_TOML"},{no:53,name:"LANGUAGE_DART"},{no:54,name:"LANGUAGE_RST"},{no:55,name:"LANGUAGE_OCAML"},{no:56,name:"LANGUAGE_CMAKE"},{no:57,name:"LANGUAGE_PASCAL"},{no:58,name:"LANGUAGE_ELIXIR"},{no:59,name:"LANGUAGE_FSHARP"},{no:60,name:"LANGUAGE_LISP"},{no:61,name:"LANGUAGE_MATLAB"},{no:62,name:"LANGUAGE_POWERSHELL"},{no:63,name:"LANGUAGE_SOLIDITY"},{no:64,name:"LANGUAGE_ADA"},{no:65,name:"LANGUAGE_OCAML_INTERFACE"}]);const xo=class xo extends Ot{constructor(n){super();ee(this,"completionId","");ee(this,"text","");ee(this,"prefix","");ee(this,"stop","");ee(this,"score",0);ee(this,"tokens",[]);ee(this,"decodedTokens",[]);ee(this,"probabilities",[]);ee(this,"adjustedProbabilities",[]);ee(this,"generatedLength",bt.zero);we.util.initPartial(n,this)}static fromBinary(n,o){return new xo().fromBinary(n,o)}static fromJson(n,o){return new xo().fromJson(n,o)}static fromJsonString(n,o){return new xo().fromJsonString(n,o)}static equals(n,o){return we.util.equals(xo,n,o)}};ee(xo,"runtime",we),ee(xo,"typeName","exa.codeium_common_pb.Completion"),ee(xo,"fields",we.util.newFieldList(()=>[{no:1,name:"completion_id",kind:"scalar",T:9},{no:2,name:"text",kind:"scalar",T:9},{no:3,name:"prefix",kind:"scalar",T:9},{no:4,name:"stop",kind:"scalar",T:9},{no:5,name:"score",kind:"scalar",T:1},{no:6,name:"tokens",kind:"scalar",T:4,repeated:!0},{no:7,name:"decoded_tokens",kind:"scalar",T:9,repeated:!0},{no:8,name:"probabilities",kind:"scalar",T:1,repeated:!0},{no:9,name:"adjusted_probabilities",kind:"scalar",T:1,repeated:!0},{no:10,name:"generated_length",kind:"scalar",T:4}]));let Jd=xo;const yo=class yo extends Ot{constructor(n){super();ee(this,"ideName","");ee(this,"ideVersion","");ee(this,"extensionName","");ee(this,"extensionVersion","");ee(this,"apiKey","");ee(this,"locale","");ee(this,"sessionId","");ee(this,"requestId",bt.zero);ee(this,"userAgent","");ee(this,"url","");ee(this,"authSource",di.CODEIUM);we.util.initPartial(n,this)}static fromBinary(n,o){return new yo().fromBinary(n,o)}static fromJson(n,o){return new yo().fromJson(n,o)}static fromJsonString(n,o){return new yo().fromJsonString(n,o)}static equals(n,o){return we.util.equals(yo,n,o)}};ee(yo,"runtime",we),ee(yo,"typeName","exa.codeium_common_pb.Metadata"),ee(yo,"fields",we.util.newFieldList(()=>[{no:1,name:"ide_name",kind:"scalar",T:9},{no:7,name:"ide_version",kind:"scalar",T:9},{no:12,name:"extension_name",kind:"scalar",T:9},{no:2,name:"extension_version",kind:"scalar",T:9},{no:3,name:"api_key",kind:"scalar",T:9},{no:4,name:"locale",kind:"scalar",T:9},{no:10,name:"session_id",kind:"scalar",T:9},{no:9,name:"request_id",kind:"scalar",T:4},{no:13,name:"user_agent",kind:"scalar",T:9},{no:14,name:"url",kind:"scalar",T:9},{no:15,name:"auth_source",kind:"enum",T:we.getEnumType(di)}]));let ol=yo;const wo=class wo extends Ot{constructor(n){super();ee(this,"tabSize",bt.zero);ee(this,"insertSpaces",!1);we.util.initPartial(n,this)}static fromBinary(n,o){return new wo().fromBinary(n,o)}static fromJson(n,o){return new wo().fromJson(n,o)}static fromJsonString(n,o){return new wo().fromJsonString(n,o)}static equals(n,o){return we.util.equals(wo,n,o)}};ee(wo,"runtime",we),ee(wo,"typeName","exa.codeium_common_pb.EditorOptions"),ee(wo,"fields",we.util.newFieldList(()=>[{no:1,name:"tab_size",kind:"scalar",T:4},{no:2,name:"insert_spaces",kind:"scalar",T:8}]));let Kd=wo;we.util.newFieldList(()=>[{no:1,name:"event_type",kind:"enum",T:we.getEnumType(nl)},{no:2,name:"event_json",kind:"scalar",T:9},{no:3,name:"timestamp_unix_ms",kind:"scalar",T:3}]);class qE extends Bs{constructor(n,o){super();ee(this,"index");ee(this,"total");this.index=n,this.total=o}toDOM(){const n=document.createElement("span");n.setAttribute("aria-hidden","true"),n.className="cm-codeium-cycle";const o=n.appendChild(document.createElement("span"));o.className="cm-codeium-cycle-explanation",o.innerText=`${this.index+1}/${this.total}`;const r=n.appendChild(document.createElement("button"));return r.className="cm-codeium-cycle-key",r.innerText="\u2192 (Ctrl ])",r.dataset.action="codeium-cycle",n}ignoreEvent(){return!1}}const rl=zs.define({combine:t=>Sc(t,{language:qo.TYPESCRIPT,timeout:150,widgetClass:qE,alwaysOn:!0},{})}),i_=zs.define({combine:t=>Sc(t,{override:()=>[]},{})}),GE=ct.mark({class:"cm-ghostText"}),kr=jn.define({create:t=>null,update(t,e){var o;const n=e.state.facet(rl);for(const r of e.effects){if(r.is(Bd)){const{changeSpecs:s,index:i}=r.value,a=s[i].map(c=>GE.range(c.absoluteStartPos,c.absoluteEndPos)),l=(o=a.at(-1))==null?void 0:o.to;return{index:i,decorations:ct.set([...a,...l!==void 0&&s.length>1&&n.widgetClass?[ct.widget({widget:new n.widgetClass(i,s.length),side:1}).range(l)]:[]]),changeSpecs:s,reverseChangeSet:r.value.reverseChangeSet}}if(r.is(Ud)||r.is(Vd))return null}return t&&{...t,decorations:t.decorations.map(e.changes),reverseChangeSet:t.reverseChangeSet.map(e.changes)}},provide:t=>et.decorations.from(t,e=>(e==null?void 0:e.decorations)||ct.none)}),Kr=Tm.define(),sl=Tm.define();var pt;function Xd(t){const e=pt[t];return typeof e!="string"?t.toString():e[0].toLowerCase()+e.substring(1).replace(/[A-Z]/g,n=>"_"+n.toLowerCase())}let il;(function(t){t[t.Canceled=1]="Canceled",t[t.Unknown=2]="Unknown",t[t.InvalidArgument=3]="InvalidArgument",t[t.DeadlineExceeded=4]="DeadlineExceeded",t[t.NotFound=5]="NotFound",t[t.AlreadyExists=6]="AlreadyExists",t[t.PermissionDenied=7]="PermissionDenied",t[t.ResourceExhausted=8]="ResourceExhausted",t[t.FailedPrecondition=9]="FailedPrecondition",t[t.Aborted=10]="Aborted",t[t.OutOfRange=11]="OutOfRange",t[t.Unimplemented=12]="Unimplemented",t[t.Internal=13]="Internal",t[t.Unavailable=14]="Unavailable",t[t.DataLoss=15]="DataLoss",t[t.Unauthenticated=16]="Unauthenticated"})(pt||(pt={}));class Jt extends Error{constructor(e,n=pt.Unknown,o,r,s){super(function(i,a){return i.length?`[${Xd(a)}] ${i}`:`[${Xd(a)}]`}(e,n)),this.name="ConnectError",Object.setPrototypeOf(this,new.target.prototype),this.rawMessage=e,this.code=n,this.metadata=new Headers(o??{}),this.details=r??[],this.cause=s}static from(e,n=pt.Unknown){return e instanceof Jt?e:e instanceof Error?e.name=="AbortError"?new Jt(e.message,pt.Canceled):new Jt(e.message,n,void 0,void 0,e):new Jt(String(e),n,void 0,void 0,e)}static[Symbol.hasInstance](e){return e instanceof Error&&(Object.getPrototypeOf(e)===Jt.prototype||e.name==="ConnectError"&&"code"in e&&typeof e.code=="number"&&"metadata"in e&&"details"in e&&Array.isArray(e.details)&&"rawMessage"in e&&typeof e.rawMessage=="string"&&"cause"in e)}findDetails(e){const n="typeName"in e?{findMessage:r=>r===e.typeName?e:void 0}:e,o=[];for(const r of this.details){if("getType"in r){n.findMessage(r.getType().typeName)&&o.push(r);continue}const s=n.findMessage(r.type);if(s)try{o.push(s.fromBinary(r.value))}catch{}}return o}}var YE=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),e={},o("next"),o("throw"),o("return"),e[Symbol.asyncIterator]=function(){return this},e);function o(r){e[r]=t[r]&&function(s){return new Promise(function(i,a){(function(l,c,u,h){Promise.resolve(h).then(function(f){l({value:f,done:u})},c)})(i,a,(s=t[r](s)).done,s.value)})}}},hi=function(t){return this instanceof hi?(this.v=t,this):new hi(t)},JE=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,r=n.apply(t,e||[]),s=[];return o={},i("next"),i("throw"),i("return",function(h){return function(f){return Promise.resolve(f).then(h,c)}}),o[Symbol.asyncIterator]=function(){return this},o;function i(h,f){r[h]&&(o[h]=function(m){return new Promise(function(_,g){s.push([h,m,_,g])>1||a(h,m)})},f&&(o[h]=f(o[h])))}function a(h,f){try{(m=r[h](f)).value instanceof hi?Promise.resolve(m.value.v).then(l,c):u(s[0][2],m)}catch(_){u(s[0][3],_)}var m}function l(h){a("next",h)}function c(h){a("throw",h)}function u(h,f){h(f),s.shift(),s.length&&a(s[0][0],s[0][1])}},KE=function(t){var e,n;return e={},o("next"),o("throw",function(r){throw r}),o("return"),e[Symbol.iterator]=function(){return this},e;function o(r,s){e[r]=t[r]?function(i){return(n=!n)?{value:hi(t[r](i)),done:!1}:s?s(i):i}:s}},a_=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),e={},o("next"),o("throw"),o("return"),e[Symbol.asyncIterator]=function(){return this},e);function o(r){e[r]=t[r]&&function(s){return new Promise(function(i,a){(function(l,c,u,h){Promise.resolve(h).then(function(f){l({value:f,done:u})},c)})(i,a,(s=t[r](s)).done,s.value)})}}},Xr=function(t){return this instanceof Xr?(this.v=t,this):new Xr(t)},XE=function(t){var e,n;return e={},o("next"),o("throw",function(r){throw r}),o("return"),e[Symbol.iterator]=function(){return this},e;function o(r,s){e[r]=t[r]?function(i){return(n=!n)?{value:Xr(t[r](i)),done:!1}:s?s(i):i}:s}},ZE=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,r=n.apply(t,e||[]),s=[];return o={},i("next"),i("throw"),i("return",function(h){return function(f){return Promise.resolve(f).then(h,c)}}),o[Symbol.asyncIterator]=function(){return this},o;function i(h,f){r[h]&&(o[h]=function(m){return new Promise(function(_,g){s.push([h,m,_,g])>1||a(h,m)})},f&&(o[h]=f(o[h])))}function a(h,f){try{(m=r[h](f)).value instanceof Xr?Promise.resolve(m.value.v).then(l,c):u(s[0][2],m)}catch(_){u(s[0][3],_)}var m}function l(h){a("next",h)}function c(h){a("throw",h)}function u(h,f){h(f),s.shift(),s.length&&a(s[0][0],s[0][1])}};function l_(t,e){const n=function(){var o,r;return ZE(this,arguments,function*(){const s=yield Xr(t);(o=e==null?void 0:e.onHeader)===null||o===void 0||o.call(e,s.header),yield Xr(yield*XE(a_(s.message))),(r=e==null?void 0:e.onTrailer)===null||r===void 0||r.call(e,s.trailer)})}()[Symbol.asyncIterator]();return{[Symbol.asyncIterator]:()=>({next:()=>n.next()})}}function c_(t){if(!t.aborted)return;if(t.reason!==void 0)return t.reason;const e=new Error("This operation was aborted");return e.name="AbortError",e}function d_(){return{get(t){return t.id in this?this[t.id]:t.defaultValue},set(t,e){return this[t.id]=e,this},delete(t){return delete this[t.id],this}}}function u_(t,e,n){const o=typeof e=="string"?e:e.typeName,r=typeof n=="string"?n:n.name;return t.toString().replace(/\/?$/,`/${o}/${r}`)}function h_(t,e){return e instanceof t?e:new t(e)}function QE(t,e){function n(o){return o.done===!0?o:{done:o.done,value:h_(t,o.value)}}return{[Symbol.asyncIterator](){const o=e[Symbol.asyncIterator](),r={next:()=>o.next().then(n)};return o.throw!==void 0&&(r.throw=s=>o.throw(s).then(n)),o.return!==void 0&&(r.return=s=>o.return(s).then(n)),r}}}function f_(t,e){var n;return(n=e==null?void 0:e.concat().reverse().reduce((o,r)=>r(o),t))!==null&&n!==void 0?n:t}function m_(t){var e;const n=Object.assign({},t);return(e=n.ignoreUnknownFields)!==null&&e!==void 0||(n.ignoreUnknownFields=!0),n}function p_(t,e,n,o){const r=e?g_(t.I,o):__(t.I,n);return{parse:(e?g_(t.O,o):__(t.O,n)).parse,serialize:r.serialize}}function g_(t,e){return{parse(n){try{return t.fromBinary(n,e)}catch(o){const r=o instanceof Error?o.message:String(o);throw new Jt(`parse binary: ${r}`,pt.InvalidArgument)}},serialize(n){try{return n.toBinary(e)}catch(o){const r=o instanceof Error?o.message:String(o);throw new Jt(`serialize binary: ${r}`,pt.Internal)}}}}function __(t,e){var n,o;const r=(n=e==null?void 0:e.textEncoder)!==null&&n!==void 0?n:new TextEncoder,s=(o=e==null?void 0:e.textDecoder)!==null&&o!==void 0?o:new TextDecoder,i=m_(e);return{parse(a){try{const l=s.decode(a);return t.fromJsonString(l,i)}catch(l){throw Jt.from(l,pt.InvalidArgument)}},serialize(a){try{const l=a.toJsonString(i);return r.encode(l)}catch(l){throw Jt.from(l,pt.Internal)}}}}const e5=/^application\/(connect\+)?(?:(json)(?:; ?charset=utf-?8)?|(proto))$/i;function b_(t,e,n){if(e&&new Headers(e).forEach((i,a)=>n.metadata.append(a,i)),typeof t!="object"||t==null||Array.isArray(t)||!("code"in t)||typeof t.code!="string")throw n;const o=function(i){if(!il){il={};for(const a of Object.values(pt))typeof a!="string"&&(il[Xd(a)]=a)}return il[i]}(t.code);if(o===void 0)throw n;const r=t.message;if(r!=null&&typeof r!="string")throw n;const s=new Jt(r??"",o,e);if("details"in t&&Array.isArray(t.details))for(const i of t.details){if(i===null||typeof i!="object"||Array.isArray(i)||typeof i.type!="string"||typeof i.value!="string"||"debug"in i&&typeof i.debug!="object")throw n;try{s.details.push({type:i.type,value:Ya.dec(i.value),debug:i.debug})}catch{throw n}}return s}function t5(t){const e=new Jt("invalid end stream",pt.InvalidArgument);let n;try{n=JSON.parse(typeof t=="string"?t:new TextDecoder().decode(t))}catch{throw e}if(typeof n!="object"||n==null||Array.isArray(n))throw e;const o=new Headers;if("metadata"in n){if(typeof n.metadata!="object"||n.metadata==null||Array.isArray(n.metadata))throw e;for(const[r,s]of Object.entries(n.metadata)){if(!Array.isArray(s)||s.some(i=>typeof i!="string"))throw e;for(const i of s)o.append(r,i)}}return{metadata:o,error:"error"in n?b_(n.error,o,e):void 0}}const Zd="Content-Type",n5="Content-Length",x_="Content-Encoding",o5="Accept-Encoding",y_="Connect-Protocol-Version";function w_(t){const e=new Headers,n=new Headers;return t.forEach((o,r)=>{r.toLowerCase().startsWith("trailer-")?n.set(r.substring(8),o):e.set(r,o)}),[e,n]}function v_(t,e,n,o,r){const s=new Headers(o??{});return n!==void 0&&s.set("Connect-Timeout-Ms",`${n}`),s.set(Zd,t==Tn.Unary?e?"application/proto":"application/json":e?"application/connect+proto":"application/connect+json"),s.set(y_,"1"),s}function k_(t,e,n){const o=function(r){const s=r==null?void 0:r.match(e5);if(s)return{stream:!!s[1],binary:!!s[3]}}(n.get("Content-Type"));if(e!==200){const r=new Jt(`HTTP ${e}`,function(s){switch(s){case 400:return pt.InvalidArgument;case 401:return pt.Unauthenticated;case 403:return pt.PermissionDenied;case 404:return pt.Unimplemented;case 408:return pt.DeadlineExceeded;case 409:return pt.Aborted;case 412:return pt.FailedPrecondition;case 413:case 431:return pt.ResourceExhausted;case 415:return pt.Internal;case 429:case 502:case 503:case 504:return pt.Unavailable;default:return pt.Unknown}}(e),n);if(t==Tn.Unary&&o&&!o.binary)return{isUnaryError:!0,unaryError:r};throw r}return{isUnaryError:!1}}const r5="application/";function s5(t,e,n){let o="?connect=v1";const r=t.header.get(Zd);(r==null?void 0:r.indexOf(r5))===0&&(o+="&encoding="+encodeURIComponent(r.slice(12)));const s=t.header.get(x_);s!==null&&s!=="identity"&&(o+="&compression="+encodeURIComponent(s),n=!0),n&&(o+="&base64=1"),o+="&message="+function(l,c){return c?Ya.enc(l).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""):encodeURIComponent(new TextDecoder().decode(l))}(e,n);const i=t.url+o,a=new Headers(t.header);return[y_,Zd,n5,x_,o5].forEach(l=>a.delete(l)),Object.assign(Object.assign({},t),{init:Object.assign(Object.assign({},t.init),{method:"GET"}),url:i,header:a})}function S_(t){const{signal:e,cleanup:n}=function(r){const s=new AbortController,i=()=>{s.abort(new Jt("the operation timed out",pt.DeadlineExceeded))};let a;return r!==void 0&&(r<=0?i():a=setTimeout(i,r)),{signal:s.signal,cleanup:()=>clearTimeout(a)}}(t.timeoutMs),o=function(...r){const s=new AbortController,i=r.filter(l=>l!==void 0).concat(s.signal);for(const l of i){if(l.aborted){a.apply(l);break}l.addEventListener("abort",a)}function a(){s.signal.aborted||s.abort(c_(this));for(const l of i)l.removeEventListener("abort",a)}return s}(t.signal,e);return[o.signal,function(r){const s=Jt.from(e.aborted?c_(e):r);return o.abort(s),n(),Promise.reject(s)},function(){n(),o.abort()}]}var fi,Qd,mi;(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.INACTIVE=1]="INACTIVE",t[t.PROCESSING=2]="PROCESSING",t[t.SUCCESS=3]="SUCCESS",t[t.WARNING=4]="WARNING",t[t.ERROR=5]="ERROR"})(fi||(fi={})),we.util.setEnumType(fi,"exa.language_server_pb.CodeiumState",[{no:0,name:"CODEIUM_STATE_UNSPECIFIED"},{no:1,name:"CODEIUM_STATE_INACTIVE"},{no:2,name:"CODEIUM_STATE_PROCESSING"},{no:3,name:"CODEIUM_STATE_SUCCESS"},{no:4,name:"CODEIUM_STATE_WARNING"},{no:5,name:"CODEIUM_STATE_ERROR"}]),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.SINGLE=1]="SINGLE",t[t.MULTI=2]="MULTI"}(Qd||(Qd={})),we.util.setEnumType(Qd,"exa.language_server_pb.LineType",[{no:0,name:"LINE_TYPE_UNSPECIFIED"},{no:1,name:"LINE_TYPE_SINGLE"},{no:2,name:"LINE_TYPE_MULTI"}]),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.INLINE=1]="INLINE",t[t.BLOCK=2]="BLOCK",t[t.INLINE_MASK=3]="INLINE_MASK"}(mi||(mi={})),we.util.setEnumType(mi,"exa.language_server_pb.CompletionPartType",[{no:0,name:"COMPLETION_PART_TYPE_UNSPECIFIED"},{no:1,name:"COMPLETION_PART_TYPE_INLINE"},{no:2,name:"COMPLETION_PART_TYPE_BLOCK"},{no:3,name:"COMPLETION_PART_TYPE_INLINE_MASK"}]);const vo=class vo extends Ot{constructor(n){super();ee(this,"threshold",0);we.util.initPartial(n,this)}static fromBinary(n,o){return new vo().fromBinary(n,o)}static fromJson(n,o){return new vo().fromJson(n,o)}static fromJsonString(n,o){return new vo().fromJsonString(n,o)}static equals(n,o){return we.util.equals(vo,n,o)}};ee(vo,"runtime",we),ee(vo,"typeName","exa.language_server_pb.MultilineConfig"),ee(vo,"fields",we.util.newFieldList(()=>[{no:1,name:"threshold",kind:"scalar",T:2}]));let eu=vo;const ko=class ko extends Ot{constructor(n){super();ee(this,"metadata");ee(this,"document");ee(this,"editorOptions");ee(this,"otherDocuments",[]);ee(this,"experimentConfig");ee(this,"modelName","");ee(this,"multilineConfig");we.util.initPartial(n,this)}static fromBinary(n,o){return new ko().fromBinary(n,o)}static fromJson(n,o){return new ko().fromJson(n,o)}static fromJsonString(n,o){return new ko().fromJsonString(n,o)}static equals(n,o){return we.util.equals(ko,n,o)}};ee(ko,"runtime",we),ee(ko,"typeName","exa.language_server_pb.GetCompletionsRequest"),ee(ko,"fields",we.util.newFieldList(()=>[{no:1,name:"metadata",kind:"message",T:ol},{no:2,name:"document",kind:"message",T:al},{no:3,name:"editor_options",kind:"message",T:Kd},{no:5,name:"other_documents",kind:"message",T:al,repeated:!0},{no:7,name:"experiment_config",kind:"message",T:au},{no:10,name:"model_name",kind:"scalar",T:9},{no:13,name:"multiline_config",kind:"message",T:eu}]));let tu=ko;const So=class So extends Ot{constructor(n){super();ee(this,"state");ee(this,"completionItems",[]);we.util.initPartial(n,this)}static fromBinary(n,o){return new So().fromBinary(n,o)}static fromJson(n,o){return new So().fromJson(n,o)}static fromJsonString(n,o){return new So().fromJsonString(n,o)}static equals(n,o){return we.util.equals(So,n,o)}};ee(So,"runtime",we),ee(So,"typeName","exa.language_server_pb.GetCompletionsResponse"),ee(So,"fields",we.util.newFieldList(()=>[{no:1,name:"state",kind:"message",T:lu},{no:2,name:"completion_items",kind:"message",T:hu,repeated:!0}]));let nu=So;const Co=class Co extends Ot{constructor(n){super();ee(this,"metadata");ee(this,"completionId","");we.util.initPartial(n,this)}static fromBinary(n,o){return new Co().fromBinary(n,o)}static fromJson(n,o){return new Co().fromJson(n,o)}static fromJsonString(n,o){return new Co().fromJsonString(n,o)}static equals(n,o){return we.util.equals(Co,n,o)}};ee(Co,"runtime",we),ee(Co,"typeName","exa.language_server_pb.AcceptCompletionRequest"),ee(Co,"fields",we.util.newFieldList(()=>[{no:1,name:"metadata",kind:"message",T:ol},{no:2,name:"completion_id",kind:"scalar",T:9}]));let ou=Co;const No=class No extends Ot{constructor(e){super(),we.util.initPartial(e,this)}static fromBinary(e,n){return new No().fromBinary(e,n)}static fromJson(e,n){return new No().fromJson(e,n)}static fromJsonString(e,n){return new No().fromJsonString(e,n)}static equals(e,n){return we.util.equals(No,e,n)}};ee(No,"runtime",we),ee(No,"typeName","exa.language_server_pb.AcceptCompletionResponse"),ee(No,"fields",we.util.newFieldList(()=>[]));let ru=No;const jo=class jo extends Ot{constructor(e){super(),we.util.initPartial(e,this)}static fromBinary(e,n){return new jo().fromBinary(e,n)}static fromJson(e,n){return new jo().fromJson(e,n)}static fromJsonString(e,n){return new jo().fromJsonString(e,n)}static equals(e,n){return we.util.equals(jo,e,n)}};ee(jo,"runtime",we),ee(jo,"typeName","exa.language_server_pb.GetAuthTokenRequest"),ee(jo,"fields",we.util.newFieldList(()=>[]));let su=jo;const Eo=class Eo extends Ot{constructor(n){super();ee(this,"authToken","");ee(this,"uuid","");we.util.initPartial(n,this)}static fromBinary(n,o){return new Eo().fromBinary(n,o)}static fromJson(n,o){return new Eo().fromJson(n,o)}static fromJsonString(n,o){return new Eo().fromJsonString(n,o)}static equals(n,o){return we.util.equals(Eo,n,o)}};ee(Eo,"runtime",we),ee(Eo,"typeName","exa.language_server_pb.GetAuthTokenResponse"),ee(Eo,"fields",we.util.newFieldList(()=>[{no:1,name:"auth_token",kind:"scalar",T:9},{no:2,name:"uuid",kind:"scalar",T:9}]));let iu=Eo;const Io=class Io extends Ot{constructor(n){super();ee(this,"row",bt.zero);ee(this,"col",bt.zero);we.util.initPartial(n,this)}static fromBinary(n,o){return new Io().fromBinary(n,o)}static fromJson(n,o){return new Io().fromJson(n,o)}static fromJsonString(n,o){return new Io().fromJsonString(n,o)}static equals(n,o){return we.util.equals(Io,n,o)}};ee(Io,"runtime",we),ee(Io,"typeName","exa.language_server_pb.DocumentPosition"),ee(Io,"fields",we.util.newFieldList(()=>[{no:1,name:"row",kind:"scalar",T:4},{no:2,name:"col",kind:"scalar",T:4}]));let pi=Io;const Ao=class Ao extends Ot{constructor(n){super();ee(this,"absolutePath","");ee(this,"relativePath","");ee(this,"text","");ee(this,"editorLanguage","");ee(this,"language",qo.UNSPECIFIED);ee(this,"cursorOffset",bt.zero);ee(this,"cursorPosition");ee(this,"lineEnding","");we.util.initPartial(n,this)}static fromBinary(n,o){return new Ao().fromBinary(n,o)}static fromJson(n,o){return new Ao().fromJson(n,o)}static fromJsonString(n,o){return new Ao().fromJsonString(n,o)}static equals(n,o){return we.util.equals(Ao,n,o)}};ee(Ao,"runtime",we),ee(Ao,"typeName","exa.language_server_pb.Document"),ee(Ao,"fields",we.util.newFieldList(()=>[{no:1,name:"absolute_path",kind:"scalar",T:9},{no:2,name:"relative_path",kind:"scalar",T:9},{no:3,name:"text",kind:"scalar",T:9},{no:4,name:"editor_language",kind:"scalar",T:9},{no:5,name:"language",kind:"enum",T:we.getEnumType(qo)},{no:6,name:"cursor_offset",kind:"scalar",T:4},{no:8,name:"cursor_position",kind:"message",T:pi},{no:7,name:"line_ending",kind:"scalar",T:9}]));let al=Ao;const To=class To extends Ot{constructor(n){super();ee(this,"forceEnableExperiments",[]);we.util.initPartial(n,this)}static fromBinary(n,o){return new To().fromBinary(n,o)}static fromJson(n,o){return new To().fromJson(n,o)}static fromJsonString(n,o){return new To().fromJsonString(n,o)}static equals(n,o){return we.util.equals(To,n,o)}};ee(To,"runtime",we),ee(To,"typeName","exa.language_server_pb.ExperimentConfig"),ee(To,"fields",we.util.newFieldList(()=>[{no:1,name:"force_enable_experiments",kind:"enum",T:we.getEnumType(tl),repeated:!0}]));let au=To;const Mo=class Mo extends Ot{constructor(n){super();ee(this,"state",fi.UNSPECIFIED);ee(this,"message","");we.util.initPartial(n,this)}static fromBinary(n,o){return new Mo().fromBinary(n,o)}static fromJson(n,o){return new Mo().fromJson(n,o)}static fromJsonString(n,o){return new Mo().fromJsonString(n,o)}static equals(n,o){return we.util.equals(Mo,n,o)}};ee(Mo,"runtime",we),ee(Mo,"typeName","exa.language_server_pb.State"),ee(Mo,"fields",we.util.newFieldList(()=>[{no:1,name:"state",kind:"enum",T:we.getEnumType(fi)},{no:2,name:"message",kind:"scalar",T:9}]));let lu=Mo;const Oo=class Oo extends Ot{constructor(n){super();ee(this,"startOffset",bt.zero);ee(this,"endOffset",bt.zero);ee(this,"startPosition");ee(this,"endPosition");we.util.initPartial(n,this)}static fromBinary(n,o){return new Oo().fromBinary(n,o)}static fromJson(n,o){return new Oo().fromJson(n,o)}static fromJsonString(n,o){return new Oo().fromJsonString(n,o)}static equals(n,o){return we.util.equals(Oo,n,o)}};ee(Oo,"runtime",we),ee(Oo,"typeName","exa.language_server_pb.Range"),ee(Oo,"fields",we.util.newFieldList(()=>[{no:1,name:"start_offset",kind:"scalar",T:4},{no:2,name:"end_offset",kind:"scalar",T:4},{no:3,name:"start_position",kind:"message",T:pi},{no:4,name:"end_position",kind:"message",T:pi}]));let cu=Oo;const Do=class Do extends Ot{constructor(n){super();ee(this,"text","");ee(this,"deltaCursorOffset",bt.zero);we.util.initPartial(n,this)}static fromBinary(n,o){return new Do().fromBinary(n,o)}static fromJson(n,o){return new Do().fromJson(n,o)}static fromJsonString(n,o){return new Do().fromJsonString(n,o)}static equals(n,o){return we.util.equals(Do,n,o)}};ee(Do,"runtime",we),ee(Do,"typeName","exa.language_server_pb.Suffix"),ee(Do,"fields",we.util.newFieldList(()=>[{no:1,name:"text",kind:"scalar",T:9},{no:2,name:"delta_cursor_offset",kind:"scalar",T:3}]));let du=Do;const Ro=class Ro extends Ot{constructor(n){super();ee(this,"text","");ee(this,"offset",bt.zero);ee(this,"type",mi.UNSPECIFIED);ee(this,"prefix","");ee(this,"line",bt.zero);we.util.initPartial(n,this)}static fromBinary(n,o){return new Ro().fromBinary(n,o)}static fromJson(n,o){return new Ro().fromJson(n,o)}static fromJsonString(n,o){return new Ro().fromJsonString(n,o)}static equals(n,o){return we.util.equals(Ro,n,o)}};ee(Ro,"runtime",we),ee(Ro,"typeName","exa.language_server_pb.CompletionPart"),ee(Ro,"fields",we.util.newFieldList(()=>[{no:1,name:"text",kind:"scalar",T:9},{no:2,name:"offset",kind:"scalar",T:4},{no:3,name:"type",kind:"enum",T:we.getEnumType(mi)},{no:4,name:"prefix",kind:"scalar",T:9},{no:5,name:"line",kind:"scalar",T:4}]));let uu=Ro;const Po=class Po extends Ot{constructor(n){super();ee(this,"completion");ee(this,"suffix");ee(this,"range");ee(this,"source",ui.UNSPECIFIED);ee(this,"completionParts",[]);we.util.initPartial(n,this)}static fromBinary(n,o){return new Po().fromBinary(n,o)}static fromJson(n,o){return new Po().fromJson(n,o)}static fromJsonString(n,o){return new Po().fromJsonString(n,o)}static equals(n,o){return we.util.equals(Po,n,o)}};ee(Po,"runtime",we),ee(Po,"typeName","exa.language_server_pb.CompletionItem"),ee(Po,"fields",we.util.newFieldList(()=>[{no:1,name:"completion",kind:"message",T:Jd},{no:5,name:"suffix",kind:"message",T:du},{no:2,name:"range",kind:"message",T:cu},{no:3,name:"source",kind:"enum",T:we.getEnumType(ui)},{no:8,name:"completion_parts",kind:"message",T:uu,repeated:!0}]));let hu=Po;const i5={typeName:"exa.language_server_pb.LanguageServerService",methods:{getCompletions:{name:"GetCompletions",I:tu,O:nu,kind:Tn.Unary},acceptCompletion:{name:"AcceptCompletion",I:ou,O:ru,kind:Tn.Unary},getAuthToken:{name:"GetAuthToken",I:su,O:iu,kind:Tn.Unary}}};var gi=function(t){return this instanceof gi?(this.v=t,this):new gi(t)},a5=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,r=n.apply(t,e||[]),s=[];return o={},i("next"),i("throw"),i("return",function(h){return function(f){return Promise.resolve(f).then(h,c)}}),o[Symbol.asyncIterator]=function(){return this},o;function i(h,f){r[h]&&(o[h]=function(m){return new Promise(function(_,g){s.push([h,m,_,g])>1||a(h,m)})},f&&(o[h]=f(o[h])))}function a(h,f){try{(m=r[h](f)).value instanceof gi?Promise.resolve(m.value.v).then(l,c):u(s[0][2],m)}catch(_){u(s[0][3],_)}var m}function l(h){a("next",h)}function c(h){a("throw",h)}function u(h,f){h(f),s.shift(),s.length&&a(s[0][0],s[0][1])}};const l5=function(t){var e;(function(){try{new Headers}catch{throw new Error("connect-web requires the fetch API. Are you running on an old version of Node.js? Node.js is not supported in Connect for Web - please stay tuned for Connect for Node.")}})();const n=(e=t.useBinaryFormat)!==null&&e!==void 0&&e;return{async unary(o,r,s,i,a,l,c){var u;const{serialize:h,parse:f}=p_(r,n,t.jsonOptions,t.binaryOptions);return i=i===void 0?t.defaultTimeoutMs:i<=0?void 0:i,await function(m){const _=f_(m.next,m.interceptors),[g,p,b]=S_(m);return _(Object.assign(Object.assign({},m.req),{message:h_(m.req.method.I,m.req.message),signal:g})).then(x=>(b(),x),p)}({interceptors:t.interceptors,signal:s,timeoutMs:i,req:{stream:!1,service:o,method:r,url:u_(t.baseUrl,o,r),init:{method:"POST",credentials:(u=t.credentials)!==null&&u!==void 0?u:"same-origin",redirect:"error",mode:"cors"},header:v_(r.kind,n,i,a),contextValues:c??d_(),message:l},next:async m=>{var _;let g=null;t.useHttpGet===!0&&r.idempotency===Yd.NoSideEffects?m=s5(m,h(m.message),n):g=h(m.message);const p=(_=t.fetch)!==null&&_!==void 0?_:globalThis.fetch,b=await p(m.url,Object.assign(Object.assign({},m.init),{headers:m.header,signal:m.signal,body:g})),{isUnaryError:x,unaryError:y}=k_(r.kind,b.status,b.headers);if(x)throw b_(await b.json(),function(...k){const N=new Headers;for(const j of k)j.forEach((I,T)=>{N.append(T,I)});return N}(...w_(b.headers)),y);const[v,C]=w_(b.headers);return{stream:!1,service:o,method:r,header:v,message:n?f(new Uint8Array(await b.arrayBuffer())):r.O.fromJson(await b.json(),m_(t.jsonOptions)),trailer:C}}})},async stream(o,r,s,i,a,l,c){var u;const{serialize:h,parse:f}=p_(r,n,t.jsonOptions,t.binaryOptions);function m(g,p,b){return a5(this,arguments,function*(){const x=function(v){let C,k=new Uint8Array(0);function N(j){const I=new Uint8Array(k.length+j.length);I.set(k),I.set(j,k.length),k=I}return new ReadableStream({start(){C=v.getReader()},async pull(j){let I;for(;;){if(I===void 0&&k.byteLength>=5){let R=0;for(let z=1;z<5;z++)R=(R<<8)+k[z];I={flags:k[0],length:R}}if(I!==void 0&&k.byteLength>=I.length+5)break;const A=await C.read();if(A.done)break;N(A.value)}if(I===void 0)return k.byteLength==0?void j.close():void j.error(new Jt("premature end of stream",pt.DataLoss));const T=k.subarray(5,5+I.length);k=k.subarray(5+I.length),j.enqueue({flags:I.flags,data:T})}})}(g).getReader();let y=!1;for(;;){const v=yield gi(x.read());if(v.done)break;const{flags:C,data:k}=v.value;if(!(2&~C)){y=!0;const N=t5(k);if(N.error){const j=N.error;throw b.forEach((I,T)=>{j.metadata.append(T,I)}),j}N.metadata.forEach((j,I)=>p.set(I,j));continue}yield yield gi(f(k))}if(!y)throw"missing EndStreamResponse"})}async function _(g){if(r.kind!=Tn.ServerStreaming)throw"The fetch API does not support streaming request bodies";const p=await g[Symbol.asyncIterator]().next();if(p.done==1)throw"missing request message";return function(b,x){const y=new Uint8Array(x.length+5);y.set(x,5);const v=new DataView(y.buffer,y.byteOffset,y.byteLength);return v.setUint8(0,b),v.setUint32(1,x.length),y}(0,h(p.value))}return i=i===void 0?t.defaultTimeoutMs:i<=0?void 0:i,await function(g){const p=f_(g.next,g.interceptors),[b,x,y]=S_(g),v=Object.assign(Object.assign({},g.req),{message:QE(g.req.method.I,g.req.message),signal:b});let C=!1;return b.addEventListener("abort",function(){var k,N;const j=g.req.message[Symbol.asyncIterator]();C||(k=j.throw)===null||k===void 0||k.call(j,this.reason).catch(()=>{}),(N=j.return)===null||N===void 0||N.call(j).catch(()=>{})}),p(v).then(k=>Object.assign(Object.assign({},k),{message:{[Symbol.asyncIterator](){const N=k.message[Symbol.asyncIterator]();return{next:()=>N.next().then(j=>(j.done==1&&(C=!0,y()),j),x)}}}}),x)}({interceptors:t.interceptors,timeoutMs:i,signal:s,req:{stream:!0,service:o,method:r,url:u_(t.baseUrl,o,r),init:{method:"POST",credentials:(u=t.credentials)!==null&&u!==void 0?u:"same-origin",redirect:"error",mode:"cors"},header:v_(r.kind,n,i,a),contextValues:c??d_(),message:l},next:async g=>{var p;const b=(p=t.fetch)!==null&&p!==void 0?p:globalThis.fetch,x=await b(g.url,Object.assign(Object.assign({},g.init),{headers:g.header,signal:g.signal,body:await _(g.message)}));if(k_(r.kind,x.status,x.headers),x.body===null)throw"missing response body";const y=new Headers;return Object.assign(Object.assign({},g),{header:x.headers,trailer:y,message:m(x.body,y,x.headers)})}})}}}({baseUrl:"https://web-backend.codeium.com",useBinaryFormat:!0}),c5=function(t,e){return function(n,o){const r={};for(const[s,i]of Object.entries(n.methods)){const a=o(Object.assign(Object.assign({},i),{localName:s,service:n}));a!=null&&(r[s]=a)}return r}(t,n=>{switch(n.kind){case Tn.Unary:return function(o,r,s){return async function(i,a){var l,c;const u=await o.unary(r,s,a==null?void 0:a.signal,a==null?void 0:a.timeoutMs,a==null?void 0:a.headers,i,a==null?void 0:a.contextValues);return(l=a==null?void 0:a.onHeader)===null||l===void 0||l.call(a,u.header),(c=a==null?void 0:a.onTrailer)===null||c===void 0||c.call(a,u.trailer),u.message}}(e,t,n);case Tn.ServerStreaming:return function(o,r,s){return function(i,a){return l_(o.stream(r,s,a==null?void 0:a.signal,a==null?void 0:a.timeoutMs,a==null?void 0:a.headers,function(l){return JE(this,arguments,function*(){yield hi(yield*KE(YE(l)))})}([i]),a==null?void 0:a.contextValues),a)}}(e,t,n);case Tn.ClientStreaming:return function(o,r,s){return async function(i,a){var l,c,u,h,f,m;const _=await o.stream(r,s,a==null?void 0:a.signal,a==null?void 0:a.timeoutMs,a==null?void 0:a.headers,i,a==null?void 0:a.contextValues);let g;(f=a==null?void 0:a.onHeader)===null||f===void 0||f.call(a,_.header);try{for(var p,b=!0,x=a_(_.message);!(l=(p=await x.next()).done);b=!0)h=p.value,b=!1,g=h}catch(y){c={error:y}}finally{try{b||l||!(u=x.return)||await u.call(x)}finally{if(c)throw c.error}}if(!g)throw new Jt("protocol error: missing response message",pt.Internal);return(m=a==null?void 0:a.onTrailer)===null||m===void 0||m.call(a,_.trailer),g}}(e,t,n);case Tn.BiDiStreaming:return function(o,r,s){return function(i,a){return l_(o.stream(r,s,a==null?void 0:a.signal,a==null?void 0:a.timeoutMs,a==null?void 0:a.headers,i,a==null?void 0:a.contextValues),a)}}(e,t,n);default:return null}})}(i5,l5);let ll;try{ll=crypto.randomUUID()}catch{ll="10000000-1000-4000-8000-100000000000".replace(/[018]/g,t=>(+t^(crypto.getRandomValues(new Uint8Array(1))[0]??0)&15>>+t/4).toString(16))}async function d5(t,e){const n=t.state.facet(rl),{override:o}=t.state.facet(i_),r=await o(),s=t.state,i=s.selection.main.head,a=s.doc.toString();try{const l=await async function({text:_,cursorOffset:g,config:p,otherDocuments:b}){return await c5.getCompletions({metadata:{ideName:"web",ideVersion:"0.0.5",extensionName:"@valtown/codemirror-codeium",extensionVersion:"1.0.0",apiKey:p.apiKey,sessionId:ll,authSource:p.authSource},document:{text:_,cursorOffset:BigInt(g),language:p.language,editorLanguage:"typescript",lineEnding:`
|
105
|
-
`},editorOptions:{tabSize:2n,insertSpaces:!0},otherDocuments:b,multilineConfig:void 0},{headers:{Authorization:`Basic ${p.apiKey}-${ll}`}})}({text:a,cursorOffset:i,config:n,otherDocuments:r});if(!l||l.completionItems.length===0||e!==void 0&&i!==e||aa(t.state)==="active"||!t.hasFocus)return;const c=l.completionItems.map(_=>{let g=0;return _.completionParts.filter(p=>p.type!==3).map(p=>{const b=Number(p.offset),x=p.type===2?`
|
106
|
-
${p.text}`:p.text,y={absoluteStartPos:g+b,absoluteEndPos:g+b+x.length,from:b,to:b,insert:x};return g+=x.length,y})}),u=0,h=c.at(u);if(!h)return;const f=la.of(h,s.doc.length),m=f.invert(s.doc);t.dispatch({changes:f,effects:Bd.of({index:u,reverseChangeSet:m,changeSpecs:c}),annotations:[sl.of(null),Kr.of(null),ca.addToHistory.of(!1)]})}catch(l){console.warn("copilot completion failed",l),await new Promise(c=>setTimeout(c,300))}}function u5(){let t=null,e=0;return et.updateListener.of(n=>{const o=n.view.state.facet(rl);if(!o.alwaysOn||!function(s){return s.docChanged&&!s.transactions.some(i=>i.effects.some(a=>a.is(Ud)||a.is(Vd)))}(n)||(t&&clearTimeout(t),function(s){if(!s.view.hasFocus||s.state.field(kr)||aa(s.state)==="active")return!0;for(const i of s.transactions)if(i.annotation(Kr)!==void 0)return!0}(n)))return;const r=n.state.selection.main.head;o.shouldComplete&&!o.shouldComplete(new UB(n.view.state,r,!1))||(t=setTimeout(async()=>{r===e&&await d5(n.view,e)},o.timeout),e=r)})}function C_(t){var r;const e=t.state.field(kr);if(!e)return!1;const n=(r=e.reverseChangeSet)==null?void 0:r.invert(t.state.doc);t.dispatch({changes:e.reverseChangeSet,effects:Ud.of(null),annotations:[sl.of(null),Kr.of(null),ca.addToHistory.of(!1)]});let o=0;return n==null||n.iterChangedRanges((s,i,a,l)=>{o=l}),t.dispatch({changes:n,selection:zo.cursor(o),annotations:[Kr.of(null),ca.addToHistory.of(!0)]}),!0}const N_=t=>{const{state:e}=t,n=e.field(kr);if(!n)return!1;const{changeSpecs:o}=n;if(o.length<2)return!1;const r=(n.index+1)%o.length,s=o.at(r);if(!s)return!1;const i=n.reverseChangeSet.apply(e.doc),a=la.of(n.reverseChangeSet,e.doc.length).compose(la.of(s,i.length)),l=la.of(s,i.length).invert(i);return t.dispatch({changes:a,effects:Bd.of({index:r,reverseChangeSet:l,changeSpecs:o}),annotations:[sl.of(null),Kr.of(null),ca.addToHistory.of(!1)]}),!0};function fu(t){const e=t.state.field(kr);return!!e&&(t.dispatch({changes:e.reverseChangeSet,effects:Vd.of(null),annotations:[sl.of(null),Kr.of(null),ca.addToHistory.of(!1)]}),!1)}function h5(){return et.domEventHandlers({keydown:(t,e)=>(t.key!=="]"||!t.ctrlKey)&&t.key!=="Shift"&&t.key!=="Control"&&t.key!=="Alt"&&t.key!=="Meta"&&function(n,o){return!!n.state.field(kr)&&(o==="Tab"?C_(n):fu(n))}(e,t.key),mouseup(t,e){const n=t.target;return n.nodeName==="BUTTON"&&n.dataset.action==="codeium-cycle"?(N_(e),t.stopPropagation(),t.preventDefault(),!0):function(o){var a,l;let r=!1;const s=(a=o.state.selection.asSingle().ranges.at(0))==null?void 0:a.head,i=o.state.field(kr);return!(s===void 0||!i)&&((l=i.decorations)==null||l.between(s,s,()=>{r=!0}),r)}(e)?C_(e):fu(e)}})}const f5=new jc,mu=St.get("@github/copilot-language-server"),j_={delay:500,includeKeymap:!0,events:{shouldShowSuggestion:t=>t.hasFocus,beforeSuggestionFetch:t=>t.hasFocus}},m5=t=>{const e=[];return t.copilot==="codeium"&&t.codeium_api_key&&e.push(function(n){return[rl.of(n),kr,Uo.highest(qn.of([{key:"Ctrl-]",run:N_}])),Uo.highest(et.updateListener.of(o=>{o.focusChanged&&fu(o.view)})),Uo.high(h5()),u5()]}({apiKey:t.codeium_api_key,language:qo.PYTHON}),i_.of({override:async()=>[{text:Nc(""),language:qo.PYTHON,editorLanguage:"python"}]})),t.copilot==="github"&&e.push(N1({...j_,fetchFn:async n=>{if(!jH()||n.doc.length===0)return"";await new Promise(i=>setTimeout(i,20));const o=n.doc.toString(),r=function(i,a){const l=i.doc.toString(),c=a.split(`
|
107
|
-
`).length-l.split(`
|
108
|
-
`).length,u=function(h,f){const m=h.lineAt(f);return{line:m.number-1,character:f-m.from}}(i.doc,i.selection.main.head);return u.line+=c,{textDocument:{uri:`file://${EH}`,version:"replace_me"},position:u,context:{triggerKind:$B.InlineCompletionTriggerKind.Automatic},formattingOptions:{tabSize:i.tabSize,insertSpaces:!0}}}(n,Nc(o));return function(i,a,l){if(!i)return mu.debug("No response from copilot"),"";const c=Array.isArray(i)?i[0]:i.items[0];if(!c)return mu.debug("No response from copilot"),"";const{insertText:u,range:h}=c,f=String(u);if(!h)return mu.error("No range from copilot"),f;const m=h.start.character-a.character,_=m<0?f.slice(-m):f,g=l.doc.sliceString(l.selection.main.head,l.doc.length);for(let p=0;p<_.length;p++){const b=_.slice(p);if(g.startsWith(b))return _.slice(0,p)}return _}(await OS().getCompletion(r),r.position,n)}})),t.copilot==="custom"&&e.push(N1({...j_,fetchFn:async n=>{if(n.doc.length===0)return"";const o=n.doc.sliceString(0,n.selection.main.head),r=n.doc.sliceString(n.selection.main.head,n.doc.length);if(o.length===0)return"";const s=n.field(Ec).type;let i=await VB.post("/ai/inline_completion",{prefix:o,suffix:r,language:s});return o&&i.startsWith(o)&&(i=i.slice(o.length)),r&&i.endsWith(r)&&(i=i.slice(0,-r.length)),i}})),[...e,Uo.highest(qn.of([{key:"Escape",run:n=>{const o=C1(n);return!ia(n)&&o}}])),f5.of(NH())]};function p5(t){return[qn.of([{key:"Escape",preventDefault:!1,run:yN},{key:t.getHotkey("cell.selectNextOccurrence").key,preventDefault:!0,run:WB},{key:t.getHotkey("cell.findAndReplace").key,preventDefault:!0,run:Tg}]),HB(),NN,Ta,jN]}const g5=ct.mark({class:"underline"}),E_=Mt.define(),I_=Mt.define(),A_=Mt.define(),_5=jn.define({create:()=>ct.none,update(t,e){let n=t.map(e.changes);for(const o of e.effects)o.is(E_)?n=t.update({add:[g5.range(o.value.from,o.value.to)]}):o.is(I_)?n=t.update({add:[qB.range(o.value.from,o.value.to)]}):o.is(A_)&&(n=ct.none);return n},provide:t=>et.decorations.from(t)});class b5{constructor(e,n){this.view=void 0,this.commandClickMode=void 0,this.hoveredRange=void 0,this.onClick=void 0,this.keydown=o=>{o.key!=="Meta"&&o.key!=="Control"||(this.commandClickMode=!0,this.view.dom.addEventListener("mousemove",this.mousemove),this.view.dom.addEventListener("click",this.click))},this.keyup=o=>{o.key!=="Meta"&&o.key!=="Control"||this.exitCommandClickMode()},this.windowBlur=()=>{this.commandClickMode&&this.exitCommandClickMode()},this.mousemove=o=>{if(!o.metaKey&&!o.ctrlKey)return void this.exitCommandClickMode();if(!this.commandClickMode)return void this.clearUnderline();const r=this.view.posAtCoords({x:o.clientX,y:o.clientY});if(r==null)return void this.clearUnderline();const s=this.view.state.field(GB,!1),i=s==null?void 0:s.ranges.find(l=>r>=l.from&&r<=l.to);if(i){const{from:l,to:c}=i;return this.hoveredRange&&this.hoveredRange.from===l&&this.hoveredRange.to===c?void 0:(this.clearUnderline(),this.hoveredRange={from:l,to:c,position:r},void this.view.dispatch({effects:I_.of(this.hoveredRange)}))}const a=YB(this.view.state).cursorAt(r);if(a.name==="VariableName"){const{from:l,to:c}=a;if(this.hoveredRange&&this.hoveredRange.from===l&&this.hoveredRange.to===c)return;this.clearUnderline(),this.hoveredRange={from:l,to:c,position:r},this.view.dispatch({effects:E_.of(this.hoveredRange)})}else this.clearUnderline()},this.click=o=>{if(this.hoveredRange){const r=this.view.state.doc.sliceString(this.hoveredRange.from,this.hoveredRange.to);o.preventDefault(),o.stopPropagation(),this.onClick(this.view,r),this.view.dispatch({selection:{head:this.hoveredRange.position,anchor:this.hoveredRange.position}})}},this.view=e,this.commandClickMode=!1,this.hoveredRange=null,this.onClick=n,window.addEventListener("keydown",this.keydown),window.addEventListener("keyup",this.keyup),window.addEventListener("blur",this.windowBlur),window.addEventListener("mouseleave",this.windowBlur)}update(e){}destroy(){window.removeEventListener("keydown",this.keydown),window.removeEventListener("keyup",this.keyup),window.removeEventListener("blur",this.windowBlur),window.removeEventListener("mouseleave",this.windowBlur),this.view.dom.removeEventListener("mousemove",this.mousemove),this.view.dom.removeEventListener("click",this.click)}exitCommandClickMode(){this.commandClickMode=!1,this.view.dom.removeEventListener("mousemove",this.mousemove),this.view.dom.removeEventListener("click",this.click),this.clearUnderline()}clearUnderline(){this.hoveredRange&&(this.view.dispatch({effects:A_.of(null)}),this.hoveredRange=null)}}function x5(){return[et.domEventHandlers({paste:(t,e)=>{var r;const n=(r=t.clipboardData)==null?void 0:r.getData("text/plain");if(!(n!=null&&n.includes("@app.cell")))return!1;const o=function(s){if(!s.includes("@app.cell"))return[];const i=[],a=s.split(`
|
109
|
-
`);let l=[],c=!1,u=0,h=!1,f=!1,m=0;const _=/\(/g,g=/\)/g,p=new Set(["@"]);function b(y){return(y.match(_)||[]).length-(y.match(g)||[]).length}function x(){if(l.length!==0){for(;l.length>0&&l[l.length-1].trim().startsWith("return");)l.pop();l.some(y=>y.trim()!=="")&&i.push(function(y){const v=y.split(`
|
110
|
-
`);if(v.length===0)return"";const C=v.filter(j=>j.trim().length>0);if(C.length===0)return"";const k=/^\s*/,N=Math.min(...C.map(j=>{var I;return((I=j.match(k))==null?void 0:I[0].length)??Number.POSITIVE_INFINITY}));return N===0?y.trim():v.map(j=>j.slice(N)).join(`
|
111
|
-
`).trim()}(l.join(`
|
112
|
-
`))),l=[]}}for(const y of a){const v=y.trim();(v||c)&&(v.startsWith("@app.cell")?(x(),c=!0,u=1):u>0?(v.startsWith("def")&&v.includes("(")&&!v.includes("):")&&(h=!0,m=b(v)),u--):h?(m+=b(v),m===0&&(h=!1)):c&&(p.has(v[0])||v.startsWith("if __name__")?(x(),c=v.startsWith("@")):v.startsWith("return")?v.includes("(")&&!v.endsWith(")")&&(f=!0,m=b(v)):f?(m+=b(v),m===0&&(f=!1)):l.push(y)))}return x(),i}(n);return o.length===0?!1:(e.state.facet(ZB).createManyBelow(o),!0)}})]}const T_=Mt.define(),M_=new jc,pu="marimo-connecting-indicator";function O_(t,e){const n=function(){let o=document.getElementById(pu);return o||(o=document.createElement("div"),o.id=pu,o.textContent="Connecting\u2026",o.style.position="fixed",o.style.zIndex="9999",o.style.background="#222",o.style.color="#fff",o.style.padding="2px 8px",o.style.borderRadius="6px",o.style.fontSize="0.9em",o.style.boxShadow="0 2px 8px rgba(0,0,0,0.15)",o.style.pointerEvents="none",o.style.display="none",document.body.append(o)),o}();n.style.left=`${t}px`,n.style.top=`${e}px`,n.style.display="block",n.textContent="Connecting\u2026"}function gu(){const t=document.getElementById(pu);t&&(t.style.display="none")}let _u=null;function y5(t){const e=()=>t.get(hn).state;let n=!Hc(e());const o=Nn.define(r=>{let s=!1;const i=r.dom;function a(){(function(){const h=r.state.selection.main,f=r.coordsAtPos(h.head);f?O_(f.left+2,f.bottom+2):O_(window.innerWidth/2,.1*window.innerHeight),_u&&window.clearTimeout(_u),_u=window.setTimeout(gu,1500)})()}function l(){s||(i.addEventListener("keydown",a,{capture:!0}),i.addEventListener("paste",a,{capture:!0}),s=!0)}function c(){s&&(i.removeEventListener("keydown",a,{capture:!0}),i.removeEventListener("paste",a,{capture:!0}),s=!1)}const u=t.sub(hn,()=>{t.get(hn).state===Bt.CONNECTING?l():(c(),gu())});return LH(e())&&l(),{destroy(){c(),u(),gu()}}});return[M_.of(cr.readOnly.of(n)),cr.transactionExtender.of(r=>{for(const s of r.effects)if(s.is(T_)){const i=s.value;if(i!==n)return n=i,{effects:M_.reconfigure(cr.readOnly.of(i))}}return null}),Nn.define(r=>{const s=t.sub(hn,()=>{const i=t.get(hn),a=!Hc(i.state);r.dispatch({effects:T_.of(a)})});return{destroy(){s()}}}),o]}const Vt=({variant:t,settings:e,styles:n})=>{const o=et.theme({"&":{backgroundColor:e.background,color:e.foreground},".cm-content":{caretColor:e.caret},".cm-cursor, .cm-dropCursor":{borderLeftColor:e.caret},"&.cm-focused .cm-selectionBackgroundm .cm-selectionBackground, .cm-content ::selection":{backgroundColor:e.selection},".cm-activeLine":{backgroundColor:e.lineHighlight},".cm-gutters":{backgroundColor:e.gutterBackground,color:e.gutterForeground},".cm-activeLineGutter":{backgroundColor:e.lineHighlight}},{dark:t==="dark"}),r=QB.define(n);return[o,j4(r)]};Vt({variant:"dark",settings:{background:"#200020",foreground:"#D0D0FF",caret:"#7070FF",selection:"#80000080",gutterBackground:"#200020",gutterForeground:"#C080C0",lineHighlight:"#80000040"},styles:[{tag:P.comment,color:"#404080"},{tag:[P.string,P.regexp],color:"#999999"},{tag:P.number,color:"#7090B0"},{tag:[P.bool,P.null],color:"#8080A0"},{tag:[P.punctuation,P.derefOperator],color:"#805080"},{tag:P.keyword,color:"#60B0FF"},{tag:P.definitionKeyword,color:"#B0FFF0"},{tag:P.moduleKeyword,color:"#60B0FF"},{tag:P.operator,color:"#A0A0FF"},{tag:[P.variableName,P.self],color:"#008080"},{tag:P.operatorKeyword,color:"#A0A0FF"},{tag:P.controlKeyword,color:"#80A0FF"},{tag:P.className,color:"#70E080"},{tag:[P.function(P.propertyName),P.propertyName],color:"#50A0A0"},{tag:P.tagName,color:"#009090"},{tag:P.modifier,color:"#B0FFF0"},{tag:[P.squareBracket,P.attributeName],color:"#D0D0FF"}]}),Vt({variant:"light",settings:{background:"#fcfcfc",foreground:"#5c6166",caret:"#ffaa33",selection:"#036dd626",gutterBackground:"#fcfcfc",gutterForeground:"#8a919966",lineHighlight:"#8a91991a"},styles:[{tag:P.comment,color:"#787b8099"},{tag:P.string,color:"#86b300"},{tag:P.regexp,color:"#4cbf99"},{tag:[P.number,P.bool,P.null],color:"#ffaa33"},{tag:P.variableName,color:"#5c6166"},{tag:[P.definitionKeyword,P.modifier],color:"#fa8d3e"},{tag:[P.keyword,P.special(P.brace)],color:"#fa8d3e"},{tag:P.operator,color:"#ed9366"},{tag:P.separator,color:"#5c6166b3"},{tag:P.punctuation,color:"#5c6166"},{tag:[P.definition(P.propertyName),P.function(P.variableName)],color:"#f2ae49"},{tag:[P.className,P.definition(P.typeName)],color:"#22a4e6"},{tag:[P.tagName,P.typeName,P.self,P.labelName],color:"#55b4d4"},{tag:P.angleBracket,color:"#55b4d480"},{tag:P.attributeName,color:"#f2ae49"}]}),Vt({variant:"dark",settings:{background:"#15191EFA",foreground:"#EEF2F7",caret:"#C4C4C4",selection:"#90B2D557",gutterBackground:"#15191EFA",gutterForeground:"#aaaaaa95",lineHighlight:"#57575712"},styles:[{tag:P.comment,color:"#6E6E6E"},{tag:[P.string,P.regexp,P.special(P.brace)],color:"#5C81B3"},{tag:P.number,color:"#C1E1B8"},{tag:P.bool,color:"#53667D"},{tag:[P.definitionKeyword,P.modifier,P.function(P.propertyName)],color:"#A3D295",fontWeight:"bold"},{tag:[P.keyword,P.moduleKeyword,P.operatorKeyword,P.operator],color:"#697A8E",fontWeight:"bold"},{tag:[P.variableName,P.attributeName],color:"#708E67"},{tag:[P.function(P.variableName),P.definition(P.propertyName),P.derefOperator],color:"#fff"},{tag:P.tagName,color:"#A3D295"}]}),Vt({variant:"dark",settings:{background:"#2e241d",foreground:"#BAAE9E",caret:"#A7A7A7",selection:"#DDF0FF33",gutterBackground:"#28211C",gutterForeground:"#BAAE9E90",lineHighlight:"#FFFFFF08"},styles:[{tag:P.comment,color:"#666666"},{tag:[P.string,P.special(P.brace)],color:"#54BE0D"},{tag:P.regexp,color:"#E9C062"},{tag:P.number,color:"#CF6A4C"},{tag:[P.keyword,P.operator],color:"#5EA6EA"},{tag:P.variableName,color:"#7587A6"},{tag:[P.definitionKeyword,P.modifier],color:"#F9EE98"},{tag:[P.propertyName,P.function(P.variableName)],color:"#937121"},{tag:[P.typeName,P.angleBracket,P.tagName],color:"#9B859D"}]}),Vt({variant:"dark",settings:{background:"#3b2627",foreground:"#E6E1C4",caret:"#E6E1C4",selection:"#16120E",gutterBackground:"#3b2627",gutterForeground:"#E6E1C490",lineHighlight:"#1F1611"},styles:[{tag:P.comment,color:"#6B4E32"},{tag:[P.keyword,P.operator,P.derefOperator],color:"#EF5D32"},{tag:P.className,color:"#EFAC32",fontWeight:"bold"},{tag:[P.typeName,P.propertyName,P.function(P.variableName),P.definition(P.variableName)],color:"#EFAC32"},{tag:P.definition(P.typeName),color:"#EFAC32",fontWeight:"bold"},{tag:P.labelName,color:"#EFAC32",fontWeight:"bold"},{tag:[P.number,P.bool],color:"#6C99BB"},{tag:[P.variableName,P.self],color:"#7DAF9C"},{tag:[P.string,P.special(P.brace),P.regexp],color:"#D9D762"},{tag:[P.angleBracket,P.tagName,P.attributeName],color:"#EFCB43"}]}),Vt({variant:"dark",settings:{background:"#000205",foreground:"#FFFFFF",caret:"#E60065",selection:"#E60C6559",gutterBackground:"#000205",gutterForeground:"#ffffff90",lineHighlight:"#4DD7FC1A"},styles:[{tag:P.comment,color:"#404040"},{tag:[P.string,P.special(P.brace),P.regexp],color:"#00D8FF"},{tag:P.number,color:"#E62286"},{tag:[P.variableName,P.attributeName,P.self],color:"#E62286",fontWeight:"bold"},{tag:P.function(P.variableName),color:"#fff",fontWeight:"bold"}]}),Vt({variant:"light",settings:{background:"#fff",foreground:"#000",caret:"#000",selection:"#BDD5FC",gutterBackground:"#fff",gutterForeground:"#00000070",lineHighlight:"#FFFBD1"},styles:[{tag:P.comment,color:"#BCC8BA"},{tag:[P.string,P.special(P.brace),P.regexp],color:"#5D90CD"},{tag:[P.number,P.bool,P.null],color:"#46A609"},{tag:P.keyword,color:"#AF956F"},{tag:[P.definitionKeyword,P.modifier],color:"#C52727"},{tag:[P.angleBracket,P.tagName,P.attributeName],color:"#606060"},{tag:P.self,color:"#000"}]}),Vt({variant:"dark",settings:{background:"#00254b",foreground:"#FFFFFF",caret:"#FFFFFF",selection:"#B36539BF",gutterBackground:"#00254b",gutterForeground:"#FFFFFF70",lineHighlight:"#00000059"},styles:[{tag:P.comment,color:"#0088FF"},{tag:P.string,color:"#3AD900"},{tag:P.regexp,color:"#80FFC2"},{tag:[P.number,P.bool,P.null],color:"#FF628C"},{tag:[P.definitionKeyword,P.modifier],color:"#FFEE80"},{tag:P.variableName,color:"#CCCCCC"},{tag:P.self,color:"#FF80E1"},{tag:[P.className,P.definition(P.propertyName),P.function(P.variableName),P.definition(P.typeName),P.labelName],color:"#FFDD00"},{tag:[P.keyword,P.operator],color:"#FF9D00"},{tag:[P.propertyName,P.typeName],color:"#80FFBB"},{tag:P.special(P.brace),color:"#EDEF7D"},{tag:P.attributeName,color:"#9EFFFF"},{tag:P.derefOperator,color:"#fff"}]}),Vt({variant:"dark",settings:{background:"#060521",foreground:"#E0E0E0",caret:"#FFFFFFA6",selection:"#122BBB",gutterBackground:"#060521",gutterForeground:"#E0E0E090",lineHighlight:"#FFFFFF0F"},styles:[{tag:P.comment,color:"#AEAEAE"},{tag:[P.string,P.special(P.brace),P.regexp],color:"#8DFF8E"},{tag:[P.className,P.definition(P.propertyName),P.function(P.variableName),P.function(P.definition(P.variableName)),P.definition(P.typeName)],color:"#A3EBFF"},{tag:[P.number,P.bool,P.null],color:"#62E9BD"},{tag:[P.keyword,P.operator],color:"#2BF1DC"},{tag:[P.definitionKeyword,P.modifier],color:"#F8FBB1"},{tag:[P.variableName,P.self],color:"#B683CA"},{tag:[P.angleBracket,P.tagName,P.typeName,P.propertyName],color:"#60A4F1"},{tag:P.derefOperator,color:"#E0E0E0"},{tag:P.attributeName,color:"#7BACCA"}]}),Vt({variant:"dark",settings:{background:"#2d2f3f",foreground:"#f8f8f2",caret:"#f8f8f0",selection:"#44475a",gutterBackground:"#282a36",gutterForeground:"rgb(144, 145, 148)",lineHighlight:"#44475a"},styles:[{tag:P.comment,color:"#6272a4"},{tag:[P.string,P.special(P.brace)],color:"#f1fa8c"},{tag:[P.number,P.self,P.bool,P.null],color:"#bd93f9"},{tag:[P.keyword,P.operator],color:"#ff79c6"},{tag:[P.definitionKeyword,P.typeName],color:"#8be9fd"},{tag:P.definition(P.typeName),color:"#f8f8f2"},{tag:[P.className,P.definition(P.propertyName),P.function(P.variableName),P.attributeName],color:"#50fa7b"}]}),Vt({variant:"light",settings:{background:"#FFFFFF",foreground:"#000000",caret:"#000000",selection:"#80C7FF",gutterBackground:"#FFFFFF",gutterForeground:"#00000070",lineHighlight:"#C1E2F8"},styles:[{tag:P.comment,color:"#AAAAAA"},{tag:[P.keyword,P.operator,P.typeName,P.tagName,P.propertyName],color:"#2F6F9F",fontWeight:"bold"},{tag:[P.attributeName,P.definition(P.propertyName)],color:"#4F9FD0"},{tag:[P.className,P.string,P.special(P.brace)],color:"#CF4F5F"},{tag:P.number,color:"#CF4F5F",fontWeight:"bold"},{tag:P.variableName,fontWeight:"bold"}]}),Vt({variant:"light",settings:{background:"#f2f1f8",foreground:"#0c006b",caret:"#5c49e9",selection:"#d5d1f2",gutterBackground:"#f2f1f8",gutterForeground:"#0c006b70",lineHighlight:"#e1def3"},styles:[{tag:P.comment,color:"#9995b7"},{tag:P.keyword,color:"#ff5792",fontWeight:"bold"},{tag:[P.definitionKeyword,P.modifier],color:"#ff5792"},{tag:[P.className,P.tagName,P.definition(P.typeName)],color:"#0094f0"},{tag:[P.number,P.bool,P.null,P.special(P.brace)],color:"#5842ff"},{tag:[P.definition(P.propertyName),P.function(P.variableName)],color:"#0095a8"},{tag:P.typeName,color:"#b3694d"},{tag:[P.propertyName,P.variableName],color:"#fa8900"},{tag:P.operator,color:"#ff5792"},{tag:P.self,color:"#e64100"},{tag:[P.string,P.regexp],color:"#00b368"},{tag:[P.paren,P.bracket],color:"#0431fa"},{tag:P.labelName,color:"#00bdd6"},{tag:P.attributeName,color:"#e64100"},{tag:P.angleBracket,color:"#9995b7"}]}),Vt({variant:"light",settings:{background:"#faf4ed",foreground:"#575279",caret:"#575279",selection:"#6e6a8614",gutterBackground:"#faf4ed",gutterForeground:"#57527970",lineHighlight:"#6e6a860d"},styles:[{tag:P.comment,color:"#9893a5"},{tag:[P.bool,P.null],color:"#286983"},{tag:P.number,color:"#d7827e"},{tag:P.className,color:"#d7827e"},{tag:[P.angleBracket,P.tagName,P.typeName],color:"#56949f"},{tag:P.attributeName,color:"#907aa9"},{tag:P.punctuation,color:"#797593"},{tag:[P.keyword,P.modifier],color:"#286983"},{tag:[P.string,P.regexp],color:"#ea9d34"},{tag:P.variableName,color:"#d7827e"}]}),Vt({variant:"light",settings:{background:"#FFFFFF",foreground:"#000000",caret:"#000000",selection:"#FFFD0054",gutterBackground:"#FFFFFF",gutterForeground:"#00000070",lineHighlight:"#00000008"},styles:[{tag:P.comment,color:"#CFCFCF"},{tag:[P.number,P.bool,P.null],color:"#E66C29"},{tag:[P.className,P.definition(P.propertyName),P.function(P.variableName),P.labelName,P.definition(P.typeName)],color:"#2EB43B"},{tag:P.keyword,color:"#D8B229"},{tag:P.operator,color:"#4EA44E",fontWeight:"bold"},{tag:[P.definitionKeyword,P.modifier],color:"#925A47"},{tag:P.string,color:"#704D3D"},{tag:P.typeName,color:"#2F8996"},{tag:[P.variableName,P.propertyName],color:"#77ACB0"},{tag:P.self,color:"#77ACB0",fontWeight:"bold"},{tag:P.regexp,color:"#E3965E"},{tag:[P.tagName,P.angleBracket],color:"#BAA827"},{tag:P.attributeName,color:"#B06520"},{tag:P.derefOperator,color:"#000"}]}),Vt({variant:"light",settings:{background:"#fef7e5",foreground:"#586E75",caret:"#000000",selection:"#073642",gutterBackground:"#fef7e5",gutterForeground:"#586E7580",lineHighlight:"#EEE8D5"},styles:[{tag:P.comment,color:"#93A1A1"},{tag:P.string,color:"#2AA198"},{tag:P.regexp,color:"#D30102"},{tag:P.number,color:"#D33682"},{tag:P.variableName,color:"#268BD2"},{tag:[P.keyword,P.operator,P.punctuation],color:"#859900"},{tag:[P.definitionKeyword,P.modifier],color:"#073642",fontWeight:"bold"},{tag:[P.className,P.self,P.definition(P.propertyName)],color:"#268BD2"},{tag:P.function(P.variableName),color:"#268BD2"},{tag:[P.bool,P.null],color:"#B58900"},{tag:P.tagName,color:"#268BD2",fontWeight:"bold"},{tag:P.angleBracket,color:"#93A1A1"},{tag:P.attributeName,color:"#93A1A1"},{tag:P.typeName,color:"#859900"}]}),Vt({variant:"light",settings:{background:"#FFFFFF",foreground:"#4D4D4C",caret:"#AEAFAD",selection:"#D6D6D6",gutterBackground:"#FFFFFF",gutterForeground:"#4D4D4C80",lineHighlight:"#EFEFEF"},styles:[{tag:P.comment,color:"#8E908C"},{tag:[P.variableName,P.self,P.propertyName,P.attributeName,P.regexp],color:"#C82829"},{tag:[P.number,P.bool,P.null],color:"#F5871F"},{tag:[P.className,P.typeName,P.definition(P.typeName)],color:"#C99E00"},{tag:[P.string,P.special(P.brace)],color:"#718C00"},{tag:P.operator,color:"#3E999F"},{tag:[P.definition(P.propertyName),P.function(P.variableName)],color:"#4271AE"},{tag:P.keyword,color:"#8959A8"},{tag:P.derefOperator,color:"#4D4D4C"}]});const w5=[Vt({variant:"dark",settings:{background:"#282c34",foreground:"#abb2bf",caret:"#528bff",selection:"#3E4451",lineHighlight:"#2c313c",gutterBackground:"var(--color-background)",gutterForeground:"var(--gray-10)"},styles:[{tag:P.comment,color:"#5c6370"},{tag:P.variableName,color:"#abb2bf"},{tag:[P.string,P.special(P.brace)],color:"#98c379"},{tag:P.number,color:"#d19a66"},{tag:P.bool,color:"#d19a66"},{tag:P.null,color:"#d19a66"},{tag:P.keyword,color:"#c678dd",fontWeight:500},{tag:P.className,color:"#61afef"},{tag:P.definition(P.typeName),color:"#61afef"},{tag:P.typeName,color:"#56b6c2"},{tag:P.angleBracket,color:"#abb2bf"},{tag:P.tagName,color:"#e06c75"},{tag:P.attributeName,color:"#d19a66"},{tag:P.operator,color:"#56b6c2",fontWeight:500},{tag:[P.function(P.variableName)],color:"#61afef"},{tag:[P.propertyName],color:"#e5c07b"}]}),et.theme({".mo-cm-reactive-reference":{fontWeight:"400",color:"#2a7aa5",borderBottom:"2px solid #bad3de"},".mo-cm-reactive-reference-hover":{cursor:"pointer",borderBottomWidth:"3px",borderBottomColor:"#4a90a5"}})],v5=[Vt({variant:"light",settings:{background:"#ffffff",foreground:"#000000",caret:"#000000",selection:"#d7d4f0",lineHighlight:"#cceeff44",gutterBackground:"var(--color-background)",gutterForeground:"var(--gray-10)"},styles:[{tag:P.comment,color:"#708090"},{tag:P.variableName,color:"#000000"},{tag:[P.string,P.special(P.brace)],color:"#a11"},{tag:P.number,color:"#164"},{tag:P.bool,color:"#219"},{tag:P.null,color:"#219"},{tag:P.keyword,color:"#708",fontWeight:500},{tag:P.className,color:"#00f"},{tag:P.definition(P.typeName),color:"#00f"},{tag:P.typeName,color:"#085"},{tag:P.angleBracket,color:"#000000"},{tag:P.tagName,color:"#170"},{tag:P.attributeName,color:"#00c"},{tag:P.operator,color:"#a2f",fontWeight:500},{tag:[P.function(P.variableName)],color:"#00c"},{tag:[P.propertyName],color:"#05a"}]}),et.theme({".mo-cm-reactive-reference":{fontWeight:"400",color:"#005f87",borderBottom:"2px solid #bad3de"},".mo-cm-reactive-reference-hover":{cursor:"pointer",borderBottomWidth:"3px"}})];function D_(t){const{showPlaceholder:e,enableAI:n}=t;return e?"marimo-import":n?"ai":"none"}const k5=t=>{const{cellId:e,keymapConfig:n,hotkeys:o,enableAI:r,cellActions:s,completionConfig:i,lspConfig:a,diagnosticsConfig:l,displayConfig:c}=t,u=D_(t);return[IH(n,o),[et.domEventHandlers({drop:(f,m)=>{var p,b;const _=(p=f.dataTransfer)==null?void 0:p.files[0];if(_!=null&&_.type.startsWith("text/"))return f.preventDefault(),KB(m,_),!0;if(_!=null&&_.type.startsWith("image/"))return f.preventDefault(),XB(m,_),!0;const g=(b=f.dataTransfer)==null?void 0:b.getData("text/plain");if(g){f.preventDefault();const x=m.posAtCoords({x:f.clientX,y:f.clientY});return x!==null&&m.dispatch({changes:{from:x,to:x,insert:g},scrollIntoView:!0}),!0}return!1},dragover:f=>{f.preventDefault()}})],x5(),yE(),eU(i,o,u,a,l),tU(e,o,s),S5(t),[_5,(h=(f,m)=>{JB(f,m)},Nn.define(f=>new b5(f,h))),et.baseTheme({".underline":{textDecoration:"underline",cursor:"pointer",color:"var(--link)"}})],l!=null&&l.enabled?nU():[],r&&gm("inline_ai_tooltip")?lE({prompt:f=>async function(m){var v,C;const _=`
|
113
|
-
${m.codeBefore}
|
114
|
-
<rewrite_this>
|
115
|
-
${m.selection}
|
116
|
-
</rewrite_this>
|
117
|
-
${m.codeAfter}
|
118
|
-
`.trim(),g=v4();await k4();const p=await fetch(g.getAiURL("completion").toString(),{method:"POST",headers:g.headers(),body:JSON.stringify({prompt:m.prompt,code:_,selectedText:m.selection,includeOtherCode:"",language:m.language})}),b=((v=m.selection.match(/^\s*/))==null?void 0:v[0])||"",x=(C=p.body)==null?void 0:C.getReader();if(!x)throw new Error("Failed to get response reader");let y="";for(;;){const{done:k,value:N}=await x.read();if(k)break;y+=new TextDecoder().decode(N)}return y.startsWith(b)||(y=b+y),y}({prompt:f.prompt,selection:f.selection,codeBefore:f.codeBefore,codeAfter:f.codeAfter,language:D3(f.editorView)})}):[],y5(lt),oU(e,c.reference_highlighting??!1)];var h},S5=t=>{const{theme:e,hotkeys:n,completionConfig:o,cellId:r,lspConfig:s,diagnosticsConfig:i}=t,a=D_(t);return[et.lineWrapping,rU(),sU(),iU(),aU(),lU(),cU(),dU(),uU({position:"fixed",parent:document.querySelector("#App")??void 0}),hU(),e==="dark"?w5:v5,fU(s),m5(o),mU(),pU(),wE(),Uo.high(qn.of(wU)),gU(),_U(),bU.of(" "),j4(vU,{fallback:!0}),qn.of(kU),xU({placeholderType:a,completionConfig:o,hotkeys:n,cellId:r,lspConfig:{...s,diagnostics:i}}),yU.of(SU()),cr.allowMultipleSelections.of(!0),p5(n),qn.of([{key:"Tab",run:l=>N4(l)||(c=>{const{from:u,to:h}=c.state.selection.main;if(u!==h)return!1;const f=c.state.doc.lineAt(h);return f.text.slice(0,h-f.from).trim()!==""&&EU(c)})(l)||CU(l),preventDefault:!0},{key:n.getHotkey("completion.moveDown").key,run:l=>aa(l.state)!==null&&(Cc(!0)(l),!0),preventDefault:!0},{key:n.getHotkey("completion.moveUp").key,run:l=>aa(l.state)!==null&&(Cc(!1)(l),!0),preventDefault:!0}]),qn.of([...NU,jU])]},C5={width:void 0,height:void 0};function R_(t,e,n){return t[e]?Array.isArray(t[e])?t[e][0][n]:t[e][n]:e==="contentBoxSize"?t.contentRect[n==="inlineSize"?"width":"height"]:void 0}function P_(t){const e=t.current;if(e===null)throw new ReferenceError("Attempting to dereference null object.");return e}let L_,F_,z_,B_;L_=new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3,hour12:!0}),F_=new Intl.DateTimeFormat("en-US",{month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3,hour12:!0}),z_=t=>{const e=X.c(79),{editing:n,status:o,disabled:r,staleInputs:s,edited:i,interrupted:a,elapsedTime:l,runStartTimestamp:c,lastRunStartTimestamp:u,uninstantiated:h}=t;if(!n)return null;const f=c??u;let m;e[0]!==f?(m=f?d.jsx(B_,{lastRanTime:f}):null,e[0]=f,e[1]=m):m=e[1];const _=m;if(r&&o==="running")return St.error("CellStatusComponent: disabled and running"),null;if(r&&s){let g,p,b,x;return e[2]===Symbol.for("react.memo_cache_sentinel")?(g=d.jsx("span",{children:"This cell is stale, but it's disabled and can't be run"}),e[2]=g):g=e[2],e[3]!==_?(p=d.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[3]=_,e[4]=p):p=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(b=d.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"stale",children:d.jsxs(Js,{children:[d.jsx(Ys,{className:"h-5 w-5",strokeWidth:1.5}),d.jsx(Ic,{className:"h-3 w-3",strokeWidth:2.5})]})}),e[5]=b):b=e[5],e[6]!==p?(x=d.jsx(Te,{content:p,usePortal:!0,children:b}),e[6]=p,e[7]=x):x=e[7],x}if(r){let g,p,b,x;return e[8]===Symbol.for("react.memo_cache_sentinel")?(g=d.jsx("span",{children:"This cell is disabled"}),e[8]=g):g=e[8],e[9]!==_?(p=d.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[9]=_,e[10]=p):p=e[10],e[11]===Symbol.for("react.memo_cache_sentinel")?(b=d.jsx("div",{className:"cell-status-icon cell-status-disabled","data-testid":"cell-status","data-status":"disabled",children:d.jsx(Ys,{className:"h-5 w-5",strokeWidth:1.5})}),e[11]=b):b=e[11],e[12]!==p?(x=d.jsx(Te,{content:p,usePortal:!0,children:b}),e[12]=p,e[13]=x):x=e[13],x}if(!s&&o==="disabled-transitively"){let g,p,b,x;return e[14]===Symbol.for("react.memo_cache_sentinel")?(g=d.jsx("span",{children:"An ancestor of this cell is disabled, so it can't be run"}),e[14]=g):g=e[14],e[15]!==_?(p=d.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[15]=_,e[16]=p):p=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(b=d.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"disabled-transitively",children:d.jsxs(Js,{layerTop:!0,children:[d.jsx(va,{className:"h-5 w-5",strokeWidth:1.5}),d.jsx(Ys,{className:"h-3 w-3",strokeWidth:2.5})]})}),e[17]=b):b=e[17],e[18]!==p?(x=d.jsx(Te,{content:p,usePortal:!0,children:b}),e[18]=p,e[19]=x):x=e[19],x}if(s&&o==="disabled-transitively"){let g,p,b,x;return e[20]===Symbol.for("react.memo_cache_sentinel")?(g=d.jsx("span",{children:"This cell is stale, but an ancestor is disabled so it can't be run"}),e[20]=g):g=e[20],e[21]!==_?(p=d.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[21]=_,e[22]=p):p=e[22],e[23]===Symbol.for("react.memo_cache_sentinel")?(b=d.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"stale",children:d.jsxs(Js,{children:[d.jsx(Ic,{className:"h-5 w-5",strokeWidth:1}),d.jsx(Ys,{className:"h-3 w-3",strokeWidth:2.5})]})}),e[23]=b):b=e[23],e[24]!==p?(x=d.jsx(Te,{content:p,usePortal:!0,children:b}),e[24]=p,e[25]=x):x=e[25],x}if(o==="running"){let g,p,b,x,y;return e[26]===Symbol.for("react.memo_cache_sentinel")?(g=d.jsx("span",{children:"This cell is running"}),e[26]=g):g=e[26],e[27]!==_?(p=d.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[27]=_,e[28]=p):p=e[28],e[29]!==c?(b=Mm.fromSeconds(c)||Mm.now(),e[29]=c,e[30]=b):b=e[30],e[31]!==b?(x=d.jsx("div",{className:"cell-status-icon elapsed-time running","data-testid":"cell-status","data-status":"running",children:d.jsx(N5,{startTime:b})}),e[31]=b,e[32]=x):x=e[32],e[33]!==p||e[34]!==x?(y=d.jsx(Te,{content:p,usePortal:!0,children:x}),e[33]=p,e[34]=x,e[35]=y):y=e[35],y}if(o==="queued"){let g,p,b,x;return e[36]===Symbol.for("react.memo_cache_sentinel")?(g=d.jsx("span",{children:"This cell is queued to run"}),e[36]=g):g=e[36],e[37]!==_?(p=d.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[37]=_,e[38]=p):p=e[38],e[39]===Symbol.for("react.memo_cache_sentinel")?(b=d.jsx("div",{className:"cell-status-icon cell-status-queued","data-testid":"cell-status","data-status":"queued",children:d.jsx(WS,{className:"h-5 w-5",strokeWidth:1.5})}),e[39]=b):b=e[39],e[40]!==p?(x=d.jsx(Te,{content:p,usePortal:!0,children:b}),e[40]=p,e[41]=x):x=e[41],x}if(i||a||s||h){let g;e[42]!==l?(g=ga(l),e[42]=l,e[43]=g):g=e[43];const p=g;let b;e[44]!==l||e[45]!==p?(b=l?d.jsx(Wc,{elapsedTime:p}):null,e[44]=l,e[45]=p,e[46]=b):b=e[46];const x=b;let y,v,C,k,N,j="";if(h)y="This cell has not yet been run";else if(a){let I;y="This cell was interrupted when it was last run",e[47]!==x?(I=d.jsxs("span",{children:["This cell ran for ",x," before being interrupted"]}),e[47]=x,e[48]=I):I=e[48],j=I}else if(i){let I;y="This cell has been modified since it was last run",e[49]!==x?(I=d.jsxs("span",{children:["This cell took ",x," to run"]}),e[49]=x,e[50]=I):I=e[50],j=I}else{let I;y="This cell has not been run with the latest inputs",e[51]!==x?(I=d.jsxs("span",{children:["This cell took ",x," to run"]}),e[51]=x,e[52]=I):I=e[52],j=I}return e[53]===Symbol.for("react.memo_cache_sentinel")?(v=d.jsx("div",{className:"cell-status-stale","data-testid":"cell-status","data-status":"outdated",children:d.jsx(Ic,{className:"h-5 w-5",strokeWidth:1.5})}),e[53]=v):v=e[53],e[54]!==y?(C=d.jsx(Te,{content:y,usePortal:!0,children:v}),e[54]=y,e[55]=C):C=e[55],e[56]!==l||e[57]!==p||e[58]!==_||e[59]!==j?(k=l&&d.jsx(Te,{content:d.jsxs("div",{className:"flex flex-col gap-1",children:[j,_]}),usePortal:!0,children:d.jsx("div",{className:"elapsed-time hover-action","data-testid":"cell-status","data-status":"outdated",children:d.jsx("span",{children:p})})}),e[56]=l,e[57]=p,e[58]=_,e[59]=j,e[60]=k):k=e[60],e[61]!==C||e[62]!==k?(N=d.jsxs("div",{className:"cell-status-icon flex items-center gap-2",children:[C,k]}),e[61]=C,e[62]=k,e[63]=N):N=e[63],N}if(l!==null){let g;e[64]!==l?(g=ga(l),e[64]=l,e[65]=g):g=e[65];const p=g;let b;e[66]!==l||e[67]!==p?(b=l?d.jsx(Wc,{elapsedTime:p}):null,e[66]=l,e[67]=p,e[68]=b):b=e[68];const x=b;let y,v,C,k;return e[69]!==x?(y=d.jsxs("span",{children:["This cell took ",x," to run"]}),e[69]=x,e[70]=y):y=e[70],e[71]!==_||e[72]!==y?(v=d.jsxs("div",{className:"flex flex-col gap-1",children:[y,_]}),e[71]=_,e[72]=y,e[73]=v):v=e[73],e[74]!==p?(C=d.jsx("div",{className:"cell-status-icon elapsed-time hover-action","data-testid":"cell-status","data-status":"idle",children:d.jsx("span",{children:p})}),e[74]=p,e[75]=C):C=e[75],e[76]!==v||e[77]!==C?(k=d.jsx(Te,{content:v,usePortal:!0,children:C}),e[76]=v,e[77]=C,e[78]=k):k=e[78],k}return null},Wc=t=>{const e=X.c(2);let n;return e[0]!==t.elapsedTime?(n=d.jsx("span",{className:"tracking-wide font-semibold",children:t.elapsedTime}),e[0]=t.elapsedTime,e[1]=n):n=e[1],n},B_=t=>{const e=X.c(18),n=1e3*t.lastRanTime;let o,r,s,i,a,l,c,u,h;if(e[0]!==n){const f=new Date(n),m=new Date,_=f.toDateString()===m.toDateString()?L_:F_;i="Ran at",a=" ",l=d.jsx("strong",{className:"tracking-wide font-semibold",children:_.format(f)}),c=" ",o="text-muted-foreground",r="(",s=eC(f),e[0]=n,e[1]=o,e[2]=r,e[3]=s,e[4]=i,e[5]=a,e[6]=l,e[7]=c}else o=e[1],r=e[2],s=e[3],i=e[4],a=e[5],l=e[6],c=e[7];return e[8]!==o||e[9]!==r||e[10]!==s?(u=d.jsxs("span",{className:o,children:[r,s," ago)"]}),e[8]=o,e[9]=r,e[10]=s,e[11]=u):u=e[11],e[12]!==i||e[13]!==a||e[14]!==l||e[15]!==c||e[16]!==u?(h=d.jsxs("span",{children:[i,a,l,c,u]}),e[12]=i,e[13]=a,e[14]=l,e[15]=c,e[16]=u,e[17]=h):h=e[17],h},ga=function(t){if(t===null)return"";const e=t,n=e/1e3;return n>=60?`${Math.floor(n/60)}m${Math.floor(n%60)}s`:n>=1?`${n.toFixed(2).toString()}s`:`${e.toFixed(0).toString()}ms`};const N5=t=>{const e=X.c(6);let n;e[0]!==t.startTime?(n=t.startTime.toMilliseconds(),e[0]=t.startTime,e[1]=n):n=e[1];const o=function(i){const a=M.useRef(i),[l,c]=M.useState(i);return M.useEffect(()=>{const u=setInterval(()=>{c(Mm.now().toMilliseconds())},17);return()=>clearInterval(u)},[]),l-a.current}(n);let r,s;return e[2]!==o?(r=ga(o),e[2]=o,e[3]=r):r=e[3],e[4]!==r?(s=d.jsx("span",{children:r}),e[4]=r,e[5]=s):s=e[5],s};var bu="ContextMenu",[j5,cW]=I4(bu,[E4]),ln=E4(),[E5,U_]=j5(bu),V_=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:o,dir:r,modal:s=!0}=t,[i,a]=M.useState(!1),l=ln(e),c=dr(o),u=M.useCallback(h=>{a(h),c(h)},[c]);return d.jsx(E5,{scope:e,open:i,onOpenChange:u,modal:s,children:d.jsx(VU,{...l,dir:r,open:i,onOpenChange:u,modal:s,children:n})})};V_.displayName=bu;var $_="ContextMenuTrigger",H_=M.forwardRef((t,e)=>{const{__scopeContextMenu:n,disabled:o=!1,...r}=t,s=U_($_,n),i=ln(n),a=M.useRef({x:0,y:0}),l=M.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...a.current})}),c=M.useRef(0),u=M.useCallback(()=>window.clearTimeout(c.current),[]),h=f=>{a.current={x:f.clientX,y:f.clientY},s.onOpenChange(!0)};return M.useEffect(()=>u,[u]),M.useEffect(()=>{o&&u()},[o,u]),d.jsxs(d.Fragment,{children:[d.jsx(TU,{...i,virtualRef:l}),d.jsx(Us.span,{"data-state":s.open?"open":"closed","data-disabled":o?"":void 0,...r,ref:e,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:o?t.onContextMenu:Gn(t.onContextMenu,f=>{u(),h(f),f.preventDefault()}),onPointerDown:o?t.onPointerDown:Gn(t.onPointerDown,cl(f=>{u(),c.current=window.setTimeout(()=>h(f),700)})),onPointerMove:o?t.onPointerMove:Gn(t.onPointerMove,cl(u)),onPointerCancel:o?t.onPointerCancel:Gn(t.onPointerCancel,cl(u)),onPointerUp:o?t.onPointerUp:Gn(t.onPointerUp,cl(u))})]})});H_.displayName=$_;var W_=t=>{const{__scopeContextMenu:e,...n}=t,o=ln(e);return d.jsx($U,{...o,...n})};W_.displayName="ContextMenuPortal";var q_="ContextMenuContent",G_=M.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=U_(q_,n),s=ln(n),i=M.useRef(!1);return d.jsx(MU,{...s,...o,ref:e,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:a=>{var l;(l=t.onCloseAutoFocus)==null||l.call(t,a),!a.defaultPrevented&&i.current&&a.preventDefault(),i.current=!1},onInteractOutside:a=>{var l;(l=t.onInteractOutside)==null||l.call(t,a),a.defaultPrevented||r.modal||(i.current=!0)},style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});G_.displayName=q_,M.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=ln(n);return d.jsx(OU,{...r,...o,ref:e})}).displayName="ContextMenuGroup";var Y_=M.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=ln(n);return d.jsx(DU,{...r,...o,ref:e})});Y_.displayName="ContextMenuLabel";var J_=M.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=ln(n);return d.jsx(AU,{...r,...o,ref:e})});J_.displayName="ContextMenuItem";var K_=M.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=ln(n);return d.jsx(RU,{...r,...o,ref:e})});K_.displayName="ContextMenuCheckboxItem",M.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=ln(n);return d.jsx(PU,{...r,...o,ref:e})}).displayName="ContextMenuRadioGroup";var X_=M.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=ln(n);return d.jsx(LU,{...r,...o,ref:e})});X_.displayName="ContextMenuRadioItem";var Z_=M.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=ln(n);return d.jsx(FU,{...r,...o,ref:e})});Z_.displayName="ContextMenuItemIndicator";var Q_=M.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=ln(n);return d.jsx(IU,{...r,...o,ref:e})});Q_.displayName="ContextMenuSeparator",M.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=ln(n);return d.jsx(zU,{...r,...o,ref:e})}).displayName="ContextMenuArrow";var e0=M.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=ln(n);return d.jsx(BU,{...r,...o,ref:e})});e0.displayName="ContextMenuSubTrigger";var t0=M.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=ln(n);return d.jsx(UU,{...r,...o,ref:e,style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});function cl(t){return e=>e.pointerType!=="mouse"?t(e):void 0}t0.displayName="ContextMenuSubContent";var n0=G_,o0=Y_,r0=J_,s0=K_,i0=X_,a0=Z_,l0=Q_,c0=e0,d0=t0;const u0=V_,h0=H_,I5=qU(W_);M.forwardRef((t,e)=>{const n=X.c(14);let o,r,s,i,a,l,c;return n[0]!==t?({className:r,inset:s,children:o,...i}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=i):(o=n[1],r=n[2],s=n[3],i=n[4]),n[5]!==r||n[6]!==s?(a=GU({className:r,inset:s}),n[5]=r,n[6]=s,n[7]=a):a=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(l=d.jsx(KU,{className:"ml-auto h-4 w-4"}),n[8]=l):l=n[8],n[9]!==o||n[10]!==i||n[11]!==e||n[12]!==a?(c=d.jsxs(c0,{ref:e,className:a,...i,children:[o,l]}),n[9]=o,n[10]=i,n[11]=e,n[12]=a,n[13]=c):c=n[13],c}).displayName=c0.displayName;const f0="data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2";M.forwardRef((t,e)=>{const n=X.c(9);let o,r,s,i;return n[0]!==t?({className:o,...r}=t,n[0]=t,n[1]=o,n[2]=r):(o=n[1],r=n[2]),n[3]!==o?(s=Ne(A4({subcontent:!0}),f0,o),n[3]=o,n[4]=s):s=n[4],n[5]!==r||n[6]!==e||n[7]!==s?(i=d.jsx(d0,{ref:e,className:s,...r}),n[5]=r,n[6]=e,n[7]=s,n[8]=i):i=n[8],i}).displayName=d0.displayName;const xu=M.forwardRef((t,e)=>{const n=X.c(15);let o,r,s;n[0]!==t?({className:o,scrollable:s,...r}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]);const i=s===void 0||s;let a;n[4]!==o||n[5]!==i?(a=Ne(A4(),f0,i&&"overflow-auto",o),n[4]=o,n[5]=i,n[6]=a):a=n[6];const l=i?"calc(var(--radix-context-menu-content-available-height) - 30px)":void 0;let c,u;return n[7]!==r.style||n[8]!==l?(c={...r.style,maxHeight:l},n[7]=r.style,n[8]=l,n[9]=c):c=n[9],n[10]!==r||n[11]!==e||n[12]!==a||n[13]!==c?(u=d.jsx(I5,{children:d.jsx(YU,{children:d.jsx(n0,{ref:e,className:a,style:c,...r})})}),n[10]=r,n[11]=e,n[12]=a,n[13]=c,n[14]=u):u=n[14],u});xu.displayName=n0.displayName;const _i=M.forwardRef((t,e)=>{const n=X.c(13);let o,r,s,i,a,l;return n[0]!==t?({className:o,inset:r,variant:i,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=i):(o=n[1],r=n[2],s=n[3],i=n[4]),n[5]!==o||n[6]!==r||n[7]!==i?(a=WU({className:o,inset:r,variant:i}),n[5]=o,n[6]=r,n[7]=i,n[8]=a):a=n[8],n[9]!==s||n[10]!==e||n[11]!==a?(l=d.jsx(r0,{ref:e,className:a,...s}),n[9]=s,n[10]=e,n[11]=a,n[12]=l):l=n[12],l});_i.displayName=r0.displayName,M.forwardRef((t,e)=>{const n=X.c(15);let o,r,s,i,a,l,c,u;return n[0]!==t?({className:s,children:r,checked:o,...i}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=i):(o=n[1],r=n[2],s=n[3],i=n[4]),n[5]!==s?(a=Ac({className:s}),n[5]=s,n[6]=a):a=n[6],n[7]===Symbol.for("react.memo_cache_sentinel")?(l=Ac(),n[7]=l):l=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx("span",{className:l,children:d.jsx(a0,{children:d.jsx(XU,{className:"h-4 w-4"})})}),n[8]=c):c=n[8],n[9]!==o||n[10]!==r||n[11]!==i||n[12]!==e||n[13]!==a?(u=d.jsxs(s0,{ref:e,className:a,checked:o,...i,children:[c,r]}),n[9]=o,n[10]=r,n[11]=i,n[12]=e,n[13]=a,n[14]=u):u=n[14],u}).displayName=s0.displayName,M.forwardRef((t,e)=>{const n=X.c(13);let o,r,s,i,a,l,c;return n[0]!==t?({className:r,children:o,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]),n[4]!==r?(i=Ac({className:r}),n[4]=r,n[5]=i):i=n[5],n[6]===Symbol.for("react.memo_cache_sentinel")?(a=Ac(),n[6]=a):a=n[6],n[7]===Symbol.for("react.memo_cache_sentinel")?(l=d.jsx("span",{className:a,children:d.jsx(a0,{children:d.jsx(ZU,{className:"h-4 w-4 fill-current"})})}),n[7]=l):l=n[7],n[8]!==o||n[9]!==s||n[10]!==e||n[11]!==i?(c=d.jsxs(i0,{ref:e,className:i,...s,children:[l,o]}),n[8]=o,n[9]=s,n[10]=e,n[11]=i,n[12]=c):c=n[12],c}).displayName=i0.displayName,M.forwardRef((t,e)=>{const n=X.c(11);let o,r,s,i,a;return n[0]!==t?({className:o,inset:r,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]),n[4]!==o||n[5]!==r?(i=JU({className:o,inset:r}),n[4]=o,n[5]=r,n[6]=i):i=n[6],n[7]!==s||n[8]!==e||n[9]!==i?(a=d.jsx(o0,{ref:e,className:i,...s}),n[7]=s,n[8]=e,n[9]=i,n[10]=a):a=n[10],a}).displayName=o0.displayName;const m0=M.forwardRef((t,e)=>{const n=X.c(9);let o,r,s,i;return n[0]!==t?({className:o,...r}=t,n[0]=t,n[1]=o,n[2]=r):(o=n[1],r=n[2]),n[3]!==o?(s=Ne(HU({className:o})),n[3]=o,n[4]=s):s=n[4],n[5]!==r||n[6]!==e||n[7]!==s?(i=d.jsx(l0,{ref:e,className:s,...r}),n[5]=r,n[6]=e,n[7]=s,n[8]=i):i=n[8],i});m0.displayName=l0.displayName;const p0=t=>{const e=X.c(20),{connectionState:n,onClick:o,tooltipContent:r}=t;let s;e[0]!==n||e[1]!==r?(s=$c(n)||r,e[0]=n,e[1]=r,e[2]=s):s=e[2];const i=s;let a;e[3]!==i||e[4]!==n?(a=po(n)?i:d.jsxs("div",{className:"flex flex-col gap-4",children:[d.jsx("div",{children:i}),d.jsx("div",{className:"text-xs text-muted-foreground font-medium pt-1 -mt-2 border-t border-border",children:"Right-click for cell types"})]}),e[3]=i,e[4]=n,e[5]=a):a=e[5];const l=a;let c,u,h,f,m,_;return e[6]!==o?(c=()=>o==null?void 0:o({code:""}),e[6]=o,e[7]=c):c=e[7],e[8]!==n?(u=Ne("shoulder-button hover-action",po(n)&&" inactive-button"),e[8]=n,e[9]=u):u=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(h=d.jsx(ur,{strokeWidth:1.8}),e[10]=h):h=e[10],e[11]!==c||e[12]!==u?(f=d.jsx(bn,{onClick:c,className:u,onMouseDown:Vn.preventFocus,shape:"circle",size:"small",color:"hint-green","data-testid":"create-cell-button",children:h}),e[11]=c,e[12]=u,e[13]=f):f=e[13],e[14]!==l||e[15]!==f?(m=d.jsx(Te,{content:l,children:f}),e[14]=l,e[15]=f,e[16]=m):m=e[16],e[17]!==o||e[18]!==m?(_=d.jsx(A5,{onClick:o,children:m}),e[17]=o,e[18]=m,e[19]=_):_=e[19],_},A5=t=>{const e=X.c(26),{children:n,onClick:o}=t,{createNewCell:r}=Tt();if(!o)return n;let s,i,a,l,c,u,h,f,m,_,g,p;return e[0]!==n?(s=d.jsx(h0,{children:n}),e[0]=n,e[1]=s):s=e[1],e[2]!==o?(i=b=>{b.stopPropagation(),o({code:""})},e[2]=o,e[3]=i):i=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(a=d.jsx("div",{className:"mr-3 text-muted-foreground",children:d.jsx(oc,{})}),e[4]=a):a=e[4],e[5]!==i?(l=d.jsxs(_i,{onSelect:i,children:[a,"Python cell"]},"python"),e[5]=i,e[6]=l):l=e[6],e[7]!==r||e[8]!==o?(c=b=>{b.stopPropagation(),fo(!0,r),o({code:new Xi().defaultCode})},e[7]=r,e[8]=o,e[9]=c):c=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(u=d.jsx("div",{className:"mr-3 text-muted-foreground",children:d.jsx(nc,{})}),e[10]=u):u=e[10],e[11]!==c?(h=d.jsxs(_i,{onSelect:c,children:[u,"Markdown cell"]},"markdown"),e[11]=c,e[12]=h):h=e[12],e[13]!==r||e[14]!==o?(f=b=>{b.stopPropagation(),fo(!0,r),o({code:new Tc().defaultCode})},e[13]=r,e[14]=o,e[15]=f):f=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(m=d.jsx("div",{className:"mr-3 text-muted-foreground",children:d.jsx(ar,{size:13,strokeWidth:1.5})}),e[16]=m):m=e[16],e[17]!==f?(_=d.jsxs(_i,{onSelect:f,children:[m,"SQL cell"]},"sql"),e[17]=f,e[18]=_):_=e[18],e[19]!==l||e[20]!==h||e[21]!==_?(g=d.jsxs(xu,{children:[l,h,_]}),e[19]=l,e[20]=h,e[21]=_,e[22]=g):g=e[22],e[23]!==s||e[24]!==g?(p=d.jsxs(u0,{children:[s,g]}),e[23]=s,e[24]=g,e[25]=p):p=e[25],p},g0=K.memo(K.forwardRef((t,e)=>{const n=X.c(34);let o,r,s;n[0]!==t?({children:o,showTooltip:s,...r}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]);const i=s===void 0||s,[a,l]=M.useState(!1);let c;n[4]!==r?(c={cell:r},n[4]=r,n[5]=c):c=n[5];const u=fd(c),h=eV();let f,m,_,g,p,b;if(n[6]===Symbol.for("react.memo_cache_sentinel")?(f=()=>({toggle:()=>l(T5)}),n[6]=f):f=n[6],M.useImperativeHandle(e,f),n[7]===Symbol.for("react.memo_cache_sentinel")?(m=d.jsx(Ji,{placeholder:"Search actions...",className:"h-6 m-1"}),n[7]=m):m=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(_=d.jsx(sc,{children:"No results"}),n[8]=_):_=n[8],n[9]!==u){let j;n[11]!==u.length?(j=(I,T)=>d.jsxs(M.Fragment,{children:[d.jsx(dm,{children:I.map(A=>{let R=d.jsxs("div",{className:"flex items-center flex-1",children:[A.icon&&d.jsx("div",{className:"mr-2 w-5 text-muted-foreground",children:A.icon}),d.jsx("div",{className:"flex-1",children:A.label}),d.jsxs("div",{className:"flex-shrink-0 text-sm",children:[A.hotkey&&T4(A.hotkey),A.rightElement]})]});return A.tooltip&&(R=d.jsx(Te,{content:A.tooltip,delayDuration:100,children:R})),d.jsx(mo,{className:Ne(A.disabled&&"!opacity-50"),onSelect:()=>{A.disableClick||A.disabled||(A.handle(),l(!1))},variant:A.variant,children:R},A.label)})},T),T<u.length-1&&d.jsx(q3,{})]},T),n[11]=u.length,n[12]=j):j=n[12],g=u.map(j),n[9]=u,n[10]=g}else g=n[10];n[13]!==g?(p=d.jsxs(_c,{children:[m,d.jsxs(Om,{children:[_,g]})]}),n[13]=g,n[14]=p):p=n[14],n[15]!==h||n[16]!==p?(b=d.jsx(Ps,{className:"w-[300px] p-0 pt-1 overflow-auto",scrollable:!0,...h,children:p}),n[15]=h,n[16]=p,n[17]=b):b=n[17];const x=b;if(!i){let j,I;return n[18]!==o?(j=d.jsx(Vs,{asChild:!0,children:o}),n[18]=o,n[19]=j):j=n[19],n[20]!==x||n[21]!==a||n[22]!==j?(I=d.jsxs(zr,{open:a,onOpenChange:l,children:[j,x]}),n[20]=x,n[21]=a,n[22]=j,n[23]=I):I=n[23],I}let y;n[24]===Symbol.for("react.memo_cache_sentinel")?(y=d.jsx(tV,{tabIndex:-1,children:rn("cell.cellActions")}),n[24]=y):y=n[24];const v=!a&&y;let C,k,N;return n[25]!==o?(C=d.jsx(nV,{children:d.jsx(Vs,{className:"flex",children:o})}),n[25]=o,n[26]=C):C=n[26],n[27]!==v||n[28]!==C?(k=d.jsxs(oV,{delayDuration:200,disableHoverableContent:!0,children:[v,C]}),n[27]=v,n[28]=C,n[29]=k):k=n[29],n[30]!==x||n[31]!==a||n[32]!==k?(N=d.jsxs(zr,{open:a,onOpenChange:l,children:[k,x]}),n[30]=x,n[31]=a,n[32]=k,n[33]=N):N=n[33],N})),_0=K.memo(t=>{const e=X.c(5),{children:n,cellId:o}=t;let r,s;e[0]!==o?(s=QU(o),e[0]=o,e[1]=s):s=e[1],r=s;const i=Ue(r);if(!i)return null;let a;return e[2]!==n||e[3]!==i?(a=d.jsx(g0,{showTooltip:!1,...i,children:n}),e[2]=n,e[3]=i,e[4]=a):a=e[4],a});function T5(t){return!t}_0.displayName="ConnectionCellActionsDropdown";const b0=t=>{const e=X.c(32);let n,o,r;e[0]!==t?({children:n,...o}=t,e[0]=t,e[1]=n,e[2]=o):(n=e[1],o=e[2]),e[3]!==o?(r={cell:o},e[3]=o,e[4]=r):r=e[4];const s=fd(r),[i,a]=K.useState(),l=!!i;let c,u,h,f,m,_,g,p,b,x;if(e[5]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(qi,{size:13,strokeWidth:1.5}),e[5]=c):c=e[5],e[6]!==o?(u=async()=>{var C;if((C=window.getSelection())==null?void 0:C.toString())return void document.execCommand("copy");const v=document.getElementById(P3.create(o.cellId));v?await _n(v.textContent??""):St.warn("cell-context-menu: output not found")},e[6]=o,e[7]=u):u=e[7],e[8]!==s||e[9]!==n||e[10]!==i||e[11]!==o||e[12]!==l||e[13]!==u){const y=[{label:"Copy",hidden:l,icon:c,handle:u},{label:"Cut",hidden:!!i,icon:d.jsx(od,{size:13,strokeWidth:1.5}),handle:M5},{label:"Paste",hidden:!!i,icon:d.jsx(cp,{size:13,strokeWidth:1.5}),handle:async()=>{const{getEditorView:k}=o,N=k();if(N)try{const j=await navigator.clipboard.readText();if(j){const{from:I,to:T}=N.state.selection.main,A=N.state.update({changes:{from:I,to:T,insert:j}});N.dispatch(A)}}catch(j){const I=j;St.error("Failed to paste from clipboard",I),rV({command:"paste"})}}},{label:"Copy image",hidden:!i,icon:d.jsx(Yc,{size:13,strokeWidth:1.5}),handle:async()=>{if(i){const k=await fetch(i.src),N=await k.blob(),j=new ClipboardItem({[N.type]:N});await navigator.clipboard.write([j]).then(O5).catch(D5)}}},{icon:d.jsx(Qm,{size:13,strokeWidth:1.5}),label:"Download image",hidden:!i,handle:()=>{if(i){const k=document.createElement("a");k.download="image.png",k.href=i.src,k.click()}}},{label:"Go to Definition",icon:d.jsx(iV,{size:13,strokeWidth:1.5}),handle:()=>{const{getEditorView:k}=o,N=k();N&&sV(N)}}],v=[y,...s];let C;f=u0,e[20]===Symbol.for("react.memo_cache_sentinel")?(C=k=>{k.target instanceof HTMLImageElement?a(k.target):a(void 0)},e[20]=C):C=e[20],e[21]!==n?(p=d.jsx(h0,{onContextMenu:C,asChild:!0,children:n}),e[21]=n,e[22]=p):p=e[22],h=xu,m="w-[300px]",_=!0,g=v.map((k,N)=>d.jsxs(M.Fragment,{children:[k.map(R5),N<v.length-1&&d.jsx(m0,{})]},N)),e[8]=s,e[9]=n,e[10]=i,e[11]=o,e[12]=l,e[13]=u,e[14]=h,e[15]=f,e[16]=m,e[17]=_,e[18]=g,e[19]=p}else h=e[14],f=e[15],m=e[16],_=e[17],g=e[18],p=e[19];return e[23]!==h||e[24]!==m||e[25]!==_||e[26]!==g?(b=d.jsx(h,{className:m,scrollable:_,children:g}),e[23]=h,e[24]=m,e[25]=_,e[26]=g,e[27]=b):b=e[27],e[28]!==f||e[29]!==p||e[30]!==b?(x=d.jsxs(f,{children:[p,b]}),e[28]=f,e[29]=p,e[30]=b,e[31]=x):x=e[31],x};function M5(){document.execCommand("cut")}function O5(){dt({title:"Copied image to clipboard"})}function D5(t){dt({title:"Failed to copy image to clipboard. Try downloading instead.",description:t.message}),St.error("Failed to copy image to clipboard",t)}function R5(t){if(t.hidden)return null;let e=d.jsxs("div",{className:"flex items-center flex-1",children:[t.icon&&d.jsx("div",{className:"mr-2 w-5 text-muted-foreground",children:t.icon}),d.jsx("div",{className:"flex-1",children:t.label}),d.jsxs("div",{className:"flex-shrink-0 text-sm",children:[t.hotkey&&T4(t.hotkey),t.rightElement]})]});return t.tooltip&&(e=d.jsx(Te,{delayDuration:100,content:t.tooltip,children:e})),d.jsx(_i,{className:t.disabled?"!opacity-50":"",onSelect:n=>{t.disableClick||t.disabled||t.handle(n)},variant:t.variant,children:e},t.label)}const P5=""+new URL("loro_wasm_bg-bPYKkGLG.wasm",import.meta.url).href;let w;function yu(t){w=t}const xt=new Array(128).fill(void 0);function xe(t){return xt[t]}xt.push(void 0,null,!0,!1);let He=0,dl=null;function Zr(){return dl!==null&&dl.byteLength!==0||(dl=new Uint8Array(w.memory.buffer)),dl}let ul=new(typeof TextEncoder>"u"?(0,module.require)("util").TextEncoder:TextEncoder)("utf-8");const L5=typeof ul.encodeInto=="function"?function(t,e){return ul.encodeInto(t,e)}:function(t,e){const n=ul.encode(t);return e.set(n),{read:t.length,written:n.length}};function ht(t,e,n){if(n===void 0){const a=ul.encode(t),l=e(a.length,1)>>>0;return Zr().subarray(l,l+a.length).set(a),He=a.length,l}let o=t.length,r=e(o,1)>>>0;const s=Zr();let i=0;for(;i<o;i++){const a=t.charCodeAt(i);if(a>127)break;s[r+i]=a}if(i!==o){i!==0&&(t=t.slice(i)),r=n(r,o,o=i+3*t.length,1)>>>0;const a=Zr().subarray(r+i,r+o);i+=L5(t,a).written,r=n(r,o,i,1)>>>0}return He=i,r}let Qr=null;function L(){return(Qr===null||Qr.buffer.detached===!0||Qr.buffer.detached===void 0&&Qr.buffer!==w.memory.buffer)&&(Qr=new DataView(w.memory.buffer)),Qr}let bi=xt.length;function re(t){bi===xt.length&&xt.push(xt.length+1);const e=bi;return bi=xt[e],xt[e]=t,e}function Kt(t,e){try{return t.apply(this,e)}catch(n){w.__wbindgen_export_2(re(n))}}let x0=new(typeof TextDecoder>"u"?(0,module.require)("util").TextDecoder:TextDecoder)("utf-8",{ignoreBOM:!0,fatal:!0});function It(t,e){return t>>>=0,x0.decode(Zr().subarray(t,t+e))}function H(t){const e=xe(t);return function(n){n<132||(xt[n]=bi,bi=n)}(t),e}function Mn(t){return t==null}x0.decode();const y0=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>{w.__wbindgen_export_4.get(t.dtor)(t.a,t.b)});function w0(t,e,n,o){const r={a:t,b:e,cnt:1,dtor:n},s=(...i)=>{r.cnt++;const a=r.a;r.a=0;try{return o(a,r.b,...i)}finally{--r.cnt===0?(w.__wbindgen_export_4.get(r.dtor)(a,r.b),y0.unregister(r)):r.a=a}};return s.original=r,y0.register(s,r,r),s}function wu(t){const e=typeof t;if(e=="number"||e=="boolean"||t==null)return`${t}`;if(e=="string")return`"${t}"`;if(e=="symbol"){const r=t.description;return r==null?"Symbol":`Symbol(${r})`}if(e=="function"){const r=t.name;return typeof r=="string"&&r.length>0?`Function(${r})`:"Function"}if(Array.isArray(t)){const r=t.length;let s="[";r>0&&(s+=wu(t[0]));for(let i=1;i<r;i++)s+=", "+wu(t[i]);return s+="]",s}const n=/\[object ([^\]]+)\]/.exec(toString.call(t));let o;if(!(n&&n.length>1))return toString.call(t);if(o=n[1],o=="Object")try{return"Object("+JSON.stringify(t)+")"}catch{return"Object"}return t instanceof Error?`${t.name}: ${t.message}
|
119
|
-
${t.stack}`:o}function oo(t,e){return t>>>=0,Zr().subarray(t/1,t/1+e)}function Go(t,e){const n=e(1*t.length,1)>>>0;return Zr().set(t,n/1),He=t.length,n}function On(t,e){t>>>=0;const n=L(),o=[];for(let r=t;r<t+4*e;r+=4)o.push(H(n.getUint32(r,!0)));return o}function yn(t,e){const n=e(4*t.length,4)>>>0,o=L();for(let r=0;r<t.length;r++)o.setUint32(n+4*r,re(t[r]),!0);return He=t.length,n}let Xt=128;function mn(t){if(Xt==1)throw new Error("out of js stack");return xt[--Xt]=t,Xt}function es(t,e){if(!(t instanceof e))throw new Error(`expected instance of ${e.name}`)}function F5(t,e,n){w.__wbindgen_export_5(t,e,re(n))}function z5(t,e){w.__wbindgen_export_6(t,e)}const v0=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_awarenesswasm_free(t>>>0,1));class k0{__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,v0.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_awarenesswasm_free(e,0)}constructor(e,n){const o=w.awarenesswasm_new(re(e),n);return this.__wbg_ptr=o>>>0,v0.register(this,this.__wbg_ptr,this),this}encode(e){try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.awarenesswasm_encode(s,this.__wbg_ptr,re(e));var n=L().getInt32(s+0,!0),o=L().getInt32(s+4,!0),r=oo(n,o).slice();return w.__wbindgen_export_3(n,1*o,1),r}finally{w.__wbindgen_add_to_stack_pointer(16)}}encodeAll(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.awarenesswasm_encodeAll(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=oo(e,n).slice();return w.__wbindgen_export_3(e,1*n,1),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}apply(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=Go(e,w.__wbindgen_export_0),i=He;w.awarenesswasm_apply(r,this.__wbg_ptr,s,i);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}setLocalState(e){w.awarenesswasm_setLocalState(this.__wbg_ptr,re(e))}peer(){return H(w.awarenesswasm_peer(this.__wbg_ptr))}getAllStates(){return H(w.awarenesswasm_getAllStates(this.__wbg_ptr))}getState(e){return H(w.awarenesswasm_getState(this.__wbg_ptr,re(e)))}getTimestamp(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.awarenesswasm_getTimestamp(r,this.__wbg_ptr,re(e));var n=L().getInt32(r+0,!0),o=L().getFloat64(r+8,!0);return n===0?void 0:o}finally{w.__wbindgen_add_to_stack_pointer(16)}}removeOutdated(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.awarenesswasm_removeOutdated(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=On(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}length(){return w.awarenesswasm_length(this.__wbg_ptr)}isEmpty(){return w.awarenesswasm_isEmpty(this.__wbg_ptr)!==0}peers(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.awarenesswasm_peers(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=On(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}}const S0=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_changemodifier_free(t>>>0,1));class ts{static __wrap(e){e>>>=0;const n=Object.create(ts.prototype);return n.__wbg_ptr=e,S0.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,S0.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_changemodifier_free(e,0)}setMessage(e){const n=ht(e,w.__wbindgen_export_0,w.__wbindgen_export_1),o=He,r=w.changemodifier_setMessage(this.__wbg_ptr,n,o);return ts.__wrap(r)}setTimestamp(e){const n=w.changemodifier_setTimestamp(this.__wbg_ptr,e);return ts.__wrap(n)}}const C0=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_cursor_free(t>>>0,1));class Kn{static __wrap(e){e>>>=0;const n=Object.create(Kn.prototype);return n.__wbg_ptr=e,C0.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,C0.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_cursor_free(e,0)}containerId(){return H(w.cursor_containerId(this.__wbg_ptr))}pos(){return H(w.cursor_pos(this.__wbg_ptr))}side(){return H(w.cursor_side(this.__wbg_ptr))}encode(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.cursor_encode(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=oo(e,n).slice();return w.__wbindgen_export_3(e,1*n,1),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}static decode(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=Go(e,w.__wbindgen_export_0),i=He;w.cursor_decode(r,s,i);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return Kn.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}kind(){return H(w.cursor_kind(this.__wbg_ptr))}}const N0=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_ephemeralstorewasm_free(t>>>0,1)),vu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_lorocounter_free(t>>>0,1));class xi{static __wrap(e){e>>>=0;const n=Object.create(xi.prototype);return n.__wbg_ptr=e,vu.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,vu.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_lorocounter_free(e,0)}constructor(){const e=w.lorocounter_new();return this.__wbg_ptr=e>>>0,vu.register(this,this.__wbg_ptr,this),this}kind(){return H(w.lorocounter_kind(this.__wbg_ptr))}get id(){return H(w.lorocounter_id(this.__wbg_ptr))}increment(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorocounter_increment(o,this.__wbg_ptr,e);var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}decrement(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorocounter_decrement(o,this.__wbg_ptr,e);var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get value(){return w.lorocounter_value(this.__wbg_ptr)}subscribe(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorocounter_subscribe(r,this.__wbg_ptr,re(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}parent(){return H(w.lorocounter_parent(this.__wbg_ptr))}isAttached(){return w.lorocounter_isAttached(this.__wbg_ptr)!==0}getAttached(){return H(w.lorocounter_getAttached(this.__wbg_ptr))}getShallowValue(){return w.lorocounter_getShallowValue(this.__wbg_ptr)}}const ku=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_lorodoc_free(t>>>0,1));class bo{static __wrap(e){e>>>=0;const n=Object.create(bo.prototype);return n.__wbg_ptr=e,ku.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,ku.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_lorodoc_free(e,0)}constructor(){const e=w.lorodoc_new();return this.__wbg_ptr=e>>>0,ku.register(this,this.__wbg_ptr,this),this}setDetachedEditing(e){w.lorodoc_setDetachedEditing(this.__wbg_ptr,e)}isDetachedEditingEnabled(){return w.lorodoc_isDetachedEditingEnabled(this.__wbg_ptr)!==0}setRecordTimestamp(e){w.lorodoc_setRecordTimestamp(this.__wbg_ptr,e)}setChangeMergeInterval(e){w.lorodoc_setChangeMergeInterval(this.__wbg_ptr,e)}configTextStyle(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_configTextStyle(o,this.__wbg_ptr,re(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}configDefaultTextStyle(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_configDefaultTextStyle(o,this.__wbg_ptr,re(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}static fromSnapshot(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=Go(e,w.__wbindgen_export_0),i=He;w.lorodoc_fromSnapshot(r,s,i);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return bo.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}attach(){w.lorodoc_attach(this.__wbg_ptr)}isDetached(){return w.lorodoc_isDetached(this.__wbg_ptr)!==0}detach(){w.lorodoc_detach(this.__wbg_ptr)}fork(){const e=w.lorodoc_fork(this.__wbg_ptr);return bo.__wrap(e)}forkAt(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=yn(e,w.__wbindgen_export_0),i=He;w.lorodoc_forkAt(r,this.__wbg_ptr,s,i);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return bo.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}checkoutToLatest(){try{const n=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_checkoutToLatest(n,this.__wbg_ptr);var e=L().getInt32(n+0,!0);if(L().getInt32(n+4,!0))throw H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}travelChangeAncestors(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=yn(e,w.__wbindgen_export_0),i=He;w.lorodoc_travelChangeAncestors(r,this.__wbg_ptr,s,i,re(n));var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}findIdSpansBetween(e,n){try{const s=w.__wbindgen_add_to_stack_pointer(-16),i=yn(e,w.__wbindgen_export_0),a=He,l=yn(n,w.__wbindgen_export_0),c=He;w.lorodoc_findIdSpansBetween(s,this.__wbg_ptr,i,a,l,c);var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);if(L().getInt32(s+8,!0))throw H(r);return H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}checkout(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16),r=yn(e,w.__wbindgen_export_0),s=He;w.lorodoc_checkout(o,this.__wbg_ptr,r,s);var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get peerId(){const e=w.lorodoc_peerId(this.__wbg_ptr);return BigInt.asUintN(64,e)}get peerIdStr(){return H(w.lorodoc_peerIdStr(this.__wbg_ptr))}setPeerId(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_setPeerId(o,this.__wbg_ptr,re(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}commit(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_commit(o,this.__wbg_ptr,Mn(e)?0:re(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getPendingTxnLength(){return w.lorodoc_getPendingTxnLength(this.__wbg_ptr)>>>0}getText(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getText(r,this.__wbg_ptr,mn(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return Jo.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16),xt[Xt++]=void 0}}getMap(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getMap(r,this.__wbg_ptr,mn(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return Yo.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16),xt[Xt++]=void 0}}getList(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getList(r,this.__wbg_ptr,mn(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return yi.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16),xt[Xt++]=void 0}}getMovableList(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getMovableList(r,this.__wbg_ptr,mn(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return wi.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16),xt[Xt++]=void 0}}getCounter(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getCounter(r,this.__wbg_ptr,mn(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return xi.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16),xt[Xt++]=void 0}}getTree(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getTree(r,this.__wbg_ptr,mn(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return vi.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16),xt[Xt++]=void 0}}hasContainer(e){return w.lorodoc_hasContainer(this.__wbg_ptr,re(e))!==0}getContainerById(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getContainerById(r,this.__wbg_ptr,re(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}setNextCommitMessage(e){const n=ht(e,w.__wbindgen_export_0,w.__wbindgen_export_1),o=He;w.lorodoc_setNextCommitMessage(this.__wbg_ptr,n,o)}setNextCommitOrigin(e){const n=ht(e,w.__wbindgen_export_0,w.__wbindgen_export_1),o=He;w.lorodoc_setNextCommitOrigin(this.__wbg_ptr,n,o)}setNextCommitTimestamp(e){w.lorodoc_setNextCommitTimestamp(this.__wbg_ptr,e)}setNextCommitOptions(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_setNextCommitOptions(o,this.__wbg_ptr,re(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}clearNextCommitOptions(){w.lorodoc_clearNextCommitOptions(this.__wbg_ptr)}getDeepValueWithID(){return H(w.lorodoc_getDeepValueWithID(this.__wbg_ptr))}getPathToContainer(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getPathToContainer(r,this.__wbg_ptr,re(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}JSONPath(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=ht(e,w.__wbindgen_export_0,w.__wbindgen_export_1),i=He;w.lorodoc_JSONPath(r,this.__wbg_ptr,s,i);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}version(){const e=w.lorodoc_version(this.__wbg_ptr);return Dn.__wrap(e)}shallowSinceVV(){const e=w.lorodoc_shallowSinceVV(this.__wbg_ptr);return Dn.__wrap(e)}isShallow(){return w.lorodoc_isShallow(this.__wbg_ptr)!==0}shallowSinceFrontiers(){return H(w.lorodoc_shallowSinceFrontiers(this.__wbg_ptr))}oplogVersion(){const e=w.lorodoc_oplogVersion(this.__wbg_ptr);return Dn.__wrap(e)}frontiers(){return H(w.lorodoc_frontiers(this.__wbg_ptr))}oplogFrontiers(){return H(w.lorodoc_oplogFrontiers(this.__wbg_ptr))}cmpWithFrontiers(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=yn(e,w.__wbindgen_export_0),i=He;w.lorodoc_cmpWithFrontiers(r,this.__wbg_ptr,s,i);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return n}finally{w.__wbindgen_add_to_stack_pointer(16)}}cmpFrontiers(e,n){try{const s=w.__wbindgen_add_to_stack_pointer(-16),i=yn(e,w.__wbindgen_export_0),a=He,l=yn(n,w.__wbindgen_export_0),c=He;w.lorodoc_cmpFrontiers(s,this.__wbg_ptr,i,a,l,c);var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);if(L().getInt32(s+8,!0))throw H(r);return H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}exportSnapshot(){try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_exportSnapshot(s,this.__wbg_ptr);var e=L().getInt32(s+0,!0),n=L().getInt32(s+4,!0),o=L().getInt32(s+8,!0);if(L().getInt32(s+12,!0))throw H(o);var r=oo(e,n).slice();return w.__wbindgen_export_3(e,1*n,1),r}finally{w.__wbindgen_add_to_stack_pointer(16)}}exportFrom(e){try{const i=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_exportFrom(i,this.__wbg_ptr,re(e));var n=L().getInt32(i+0,!0),o=L().getInt32(i+4,!0),r=L().getInt32(i+8,!0);if(L().getInt32(i+12,!0))throw H(r);var s=oo(n,o).slice();return w.__wbindgen_export_3(n,1*o,1),s}finally{w.__wbindgen_add_to_stack_pointer(16)}}export(e){try{const i=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_export(i,this.__wbg_ptr,re(e));var n=L().getInt32(i+0,!0),o=L().getInt32(i+4,!0),r=L().getInt32(i+8,!0);if(L().getInt32(i+12,!0))throw H(r);var s=oo(n,o).slice();return w.__wbindgen_export_3(n,1*o,1),s}finally{w.__wbindgen_add_to_stack_pointer(16)}}exportJsonUpdates(e,n,o){try{const i=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_exportJsonUpdates(i,this.__wbg_ptr,re(e),re(n),Mn(o)?16777215:o?1:0);var r=L().getInt32(i+0,!0),s=L().getInt32(i+4,!0);if(L().getInt32(i+8,!0))throw H(s);return H(r)}finally{w.__wbindgen_add_to_stack_pointer(16)}}exportJsonInIdSpan(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_exportJsonInIdSpan(r,this.__wbg_ptr,re(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}importJsonUpdates(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_importJsonUpdates(r,this.__wbg_ptr,re(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}import(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=Go(e,w.__wbindgen_export_0),i=He;w.lorodoc_import(r,this.__wbg_ptr,s,i);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}importUpdateBatch(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_importBatch(r,this.__wbg_ptr,re(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}importBatch(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_importBatch(r,this.__wbg_ptr,re(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getShallowValue(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getShallowValue(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}toJSON(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_toJSON(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}subscribe(e){return H(w.lorodoc_subscribe(this.__wbg_ptr,re(e)))}subscribeLocalUpdates(e){return H(w.lorodoc_subscribeLocalUpdates(this.__wbg_ptr,re(e)))}debugHistory(){w.lorodoc_debugHistory(this.__wbg_ptr)}changeCount(){return w.lorodoc_changeCount(this.__wbg_ptr)>>>0}opCount(){return w.lorodoc_opCount(this.__wbg_ptr)>>>0}getAllChanges(){return H(w.lorodoc_getAllChanges(this.__wbg_ptr))}getChangeAt(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getChangeAt(r,this.__wbg_ptr,re(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getChangeAtLamport(e,n){try{const s=w.__wbindgen_add_to_stack_pointer(-16),i=ht(e,w.__wbindgen_export_0,w.__wbindgen_export_1),a=He;w.lorodoc_getChangeAtLamport(s,this.__wbg_ptr,i,a,n);var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);if(L().getInt32(s+8,!0))throw H(r);return H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getOpsInChange(e){try{const i=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getOpsInChange(i,this.__wbg_ptr,re(e));var n=L().getInt32(i+0,!0),o=L().getInt32(i+4,!0),r=L().getInt32(i+8,!0);if(L().getInt32(i+12,!0))throw H(r);var s=On(n,o).slice();return w.__wbindgen_export_3(n,4*o,4),s}finally{w.__wbindgen_add_to_stack_pointer(16)}}frontiersToVV(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=yn(e,w.__wbindgen_export_0),i=He;w.lorodoc_frontiersToVV(r,this.__wbg_ptr,s,i);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return Dn.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}vvToFrontiers(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);es(e,Dn),w.lorodoc_vvToFrontiers(r,this.__wbg_ptr,e.__wbg_ptr);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getByPath(e){const n=ht(e,w.__wbindgen_export_0,w.__wbindgen_export_1),o=He;return H(w.lorodoc_getByPath(this.__wbg_ptr,n,o))}getCursorPos(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);es(e,Kn),w.lorodoc_getCursorPos(r,this.__wbg_ptr,e.__wbg_ptr);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getChangedContainersIn(e,n){try{const a=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getChangedContainersIn(a,this.__wbg_ptr,re(e),n);var o=L().getInt32(a+0,!0),r=L().getInt32(a+4,!0),s=L().getInt32(a+8,!0);if(L().getInt32(a+12,!0))throw H(s);var i=On(o,r).slice();return w.__wbindgen_export_3(o,4*r,4),i}finally{w.__wbindgen_add_to_stack_pointer(16)}}revertTo(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16),r=yn(e,w.__wbindgen_export_0),s=He;w.lorodoc_revertTo(o,this.__wbg_ptr,r,s);var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}applyDiff(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_applyDiff(o,this.__wbg_ptr,re(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}diff(e,n,o){try{const i=w.__wbindgen_add_to_stack_pointer(-16),a=yn(e,w.__wbindgen_export_0),l=He,c=yn(n,w.__wbindgen_export_0),u=He;w.lorodoc_diff(i,this.__wbg_ptr,a,l,c,u,Mn(o)?16777215:o?1:0);var r=L().getInt32(i+0,!0),s=L().getInt32(i+4,!0);if(L().getInt32(i+8,!0))throw H(s);return H(r)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getUncommittedOpsAsJson(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getUncommittedOpsAsJson(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}subscribeFirstCommitFromPeer(e){return H(w.lorodoc_subscribeFirstCommitFromPeer(this.__wbg_ptr,re(e)))}subscribePreCommit(e){return H(w.lorodoc_subscribePreCommit(this.__wbg_ptr,re(e)))}deleteRootContainer(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_deleteRootContainer(o,this.__wbg_ptr,re(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}setHideEmptyRootContainers(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_setHideEmptyRootContainers(o,this.__wbg_ptr,e);var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}}const Su=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_lorolist_free(t>>>0,1));class yi{static __wrap(e){e>>>=0;const n=Object.create(yi.prototype);return n.__wbg_ptr=e,Su.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Su.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_lorolist_free(e,0)}constructor(){const e=w.lorolist_new();return this.__wbg_ptr=e>>>0,Su.register(this,this.__wbg_ptr,this),this}kind(){return H(w.lorolist_kind(this.__wbg_ptr))}insert(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_insert(r,this.__wbg_ptr,e,re(n));var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}delete(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_delete(r,this.__wbg_ptr,e,n);var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get(e){return H(w.lorolist_get(this.__wbg_ptr,e))}get id(){return H(w.lorolist_id(this.__wbg_ptr))}toArray(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_toArray(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=On(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}toJSON(){return H(w.lorolist_toJSON(this.__wbg_ptr))}insertContainer(e,n){try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_insertContainer(s,this.__wbg_ptr,e,re(n));var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);if(L().getInt32(s+8,!0))throw H(r);return H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}pushContainer(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_pushContainer(r,this.__wbg_ptr,re(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}subscribe(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_subscribe(r,this.__wbg_ptr,re(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get length(){return w.lorolist_length(this.__wbg_ptr)>>>0}parent(){return H(w.lorolist_parent(this.__wbg_ptr))}isAttached(){return w.lorolist_isAttached(this.__wbg_ptr)!==0}getAttached(){return H(w.lorolist_getAttached(this.__wbg_ptr))}getCursor(e,n){const o=w.lorolist_getCursor(this.__wbg_ptr,e,re(n));return o===0?void 0:Kn.__wrap(o)}push(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_push(o,this.__wbg_ptr,re(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}pop(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_pop(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}clear(){try{const n=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_clear(n,this.__wbg_ptr);var e=L().getInt32(n+0,!0);if(L().getInt32(n+4,!0))throw H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getIdAt(e){return H(w.lorolist_getIdAt(this.__wbg_ptr,e))}isDeleted(){return w.lorolist_isDeleted(this.__wbg_ptr)!==0}getShallowValue(){return H(w.lorolist_getShallowValue(this.__wbg_ptr))}}const Cu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_loromap_free(t>>>0,1));class Yo{static __wrap(e){e>>>=0;const n=Object.create(Yo.prototype);return n.__wbg_ptr=e,Cu.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Cu.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_loromap_free(e,0)}constructor(){const e=w.loromap_new();return this.__wbg_ptr=e>>>0,Cu.register(this,this.__wbg_ptr,this),this}kind(){return H(w.loromap_kind(this.__wbg_ptr))}set(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=ht(e,w.__wbindgen_export_0,w.__wbindgen_export_1),i=He;w.loromap_set(r,this.__wbg_ptr,s,i,re(n));var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}delete(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16),r=ht(e,w.__wbindgen_export_0,w.__wbindgen_export_1),s=He;w.loromap_delete(o,this.__wbg_ptr,r,s);var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get(e){const n=ht(e,w.__wbindgen_export_0,w.__wbindgen_export_1),o=He;return H(w.loromap_get(this.__wbg_ptr,n,o))}getOrCreateContainer(e,n){try{const s=w.__wbindgen_add_to_stack_pointer(-16),i=ht(e,w.__wbindgen_export_0,w.__wbindgen_export_1),a=He;w.loromap_getOrCreateContainer(s,this.__wbg_ptr,i,a,re(n));var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);if(L().getInt32(s+8,!0))throw H(r);return H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}keys(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromap_keys(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=On(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}values(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromap_values(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=On(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}entries(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromap_entries(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=On(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}get id(){return H(w.loromap_id(this.__wbg_ptr))}toJSON(){return H(w.loromap_toJSON(this.__wbg_ptr))}setContainer(e,n){try{const s=w.__wbindgen_add_to_stack_pointer(-16),i=ht(e,w.__wbindgen_export_0,w.__wbindgen_export_1),a=He;w.loromap_setContainer(s,this.__wbg_ptr,i,a,re(n));var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);if(L().getInt32(s+8,!0))throw H(r);return H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}subscribe(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromap_subscribe(r,this.__wbg_ptr,re(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get size(){return w.loromap_size(this.__wbg_ptr)>>>0}parent(){return H(w.loromap_parent(this.__wbg_ptr))}isAttached(){return w.loromap_isAttached(this.__wbg_ptr)!==0}getAttached(){return H(w.loromap_getAttached(this.__wbg_ptr))}clear(){try{const n=w.__wbindgen_add_to_stack_pointer(-16);w.loromap_clear(n,this.__wbg_ptr);var e=L().getInt32(n+0,!0);if(L().getInt32(n+4,!0))throw H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getLastEditor(e){const n=ht(e,w.__wbindgen_export_0,w.__wbindgen_export_1),o=He;return H(w.loromap_getLastEditor(this.__wbg_ptr,n,o))}isDeleted(){return w.loromap_isDeleted(this.__wbg_ptr)!==0}getShallowValue(){return H(w.loromap_getShallowValue(this.__wbg_ptr))}}const Nu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_loromovablelist_free(t>>>0,1));class wi{static __wrap(e){e>>>=0;const n=Object.create(wi.prototype);return n.__wbg_ptr=e,Nu.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Nu.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_loromovablelist_free(e,0)}constructor(){const e=w.loromovablelist_new();return this.__wbg_ptr=e>>>0,Nu.register(this,this.__wbg_ptr,this),this}kind(){return H(w.loromovablelist_kind(this.__wbg_ptr))}insert(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_insert(r,this.__wbg_ptr,e,re(n));var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}delete(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_delete(r,this.__wbg_ptr,e,n);var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get(e){return H(w.loromovablelist_get(this.__wbg_ptr,e))}get id(){return H(w.loromovablelist_id(this.__wbg_ptr))}toArray(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_toArray(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=On(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}toJSON(){return H(w.loromovablelist_toJSON(this.__wbg_ptr))}insertContainer(e,n){try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_insertContainer(s,this.__wbg_ptr,e,re(n));var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);if(L().getInt32(s+8,!0))throw H(r);return H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}pushContainer(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_pushContainer(r,this.__wbg_ptr,re(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}subscribe(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_subscribe(r,this.__wbg_ptr,re(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get length(){return w.loromovablelist_length(this.__wbg_ptr)>>>0}parent(){return H(w.loromovablelist_parent(this.__wbg_ptr))}isAttached(){return w.loromovablelist_isAttached(this.__wbg_ptr)!==0}getAttached(){return H(w.loromovablelist_getAttached(this.__wbg_ptr))}getCursor(e,n){const o=w.loromovablelist_getCursor(this.__wbg_ptr,e,re(n));return o===0?void 0:Kn.__wrap(o)}move(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_move(r,this.__wbg_ptr,e,n);var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}set(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_set(r,this.__wbg_ptr,e,re(n));var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}setContainer(e,n){try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_setContainer(s,this.__wbg_ptr,e,re(n));var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);if(L().getInt32(s+8,!0))throw H(r);return H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}push(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_push(o,this.__wbg_ptr,re(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}pop(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_pop(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}clear(){try{const n=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_clear(n,this.__wbg_ptr);var e=L().getInt32(n+0,!0);if(L().getInt32(n+4,!0))throw H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getCreatorAt(e){return H(w.loromovablelist_getCreatorAt(this.__wbg_ptr,e))}getLastMoverAt(e){return H(w.loromovablelist_getLastMoverAt(this.__wbg_ptr,e))}getLastEditorAt(e){return H(w.loromovablelist_getLastEditorAt(this.__wbg_ptr,e))}isDeleted(){return w.loromovablelist_isDeleted(this.__wbg_ptr)!==0}getShallowValue(){return H(w.loromovablelist_getShallowValue(this.__wbg_ptr))}}const ju=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_lorotext_free(t>>>0,1));class Jo{static __wrap(e){e>>>=0;const n=Object.create(Jo.prototype);return n.__wbg_ptr=e,ju.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,ju.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_lorotext_free(e,0)}constructor(){const e=w.lorotext_new();return this.__wbg_ptr=e>>>0,ju.register(this,this.__wbg_ptr,this),this}kind(){return H(w.lorotext_kind(this.__wbg_ptr))}iter(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_iter(o,this.__wbg_ptr,re(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}update(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=ht(e,w.__wbindgen_export_0,w.__wbindgen_export_1),i=He;w.lorotext_update(r,this.__wbg_ptr,s,i,re(n));var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}updateByLine(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=ht(e,w.__wbindgen_export_0,w.__wbindgen_export_1),i=He;w.lorotext_updateByLine(r,this.__wbg_ptr,s,i,re(n));var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}insert(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=ht(n,w.__wbindgen_export_0,w.__wbindgen_export_1),i=He;w.lorotext_insert(r,this.__wbg_ptr,e,s,i);var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}slice(e,n){let o,r;try{const h=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_slice(h,this.__wbg_ptr,e,n);var s=L().getInt32(h+0,!0),i=L().getInt32(h+4,!0),a=L().getInt32(h+8,!0),l=L().getInt32(h+12,!0),c=s,u=i;if(l)throw c=0,u=0,H(a);return o=c,r=u,It(c,u)}finally{w.__wbindgen_add_to_stack_pointer(16),w.__wbindgen_export_3(o,r,1)}}charAt(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_charAt(r,this.__wbg_ptr,e);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return String.fromCodePoint(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}splice(e,n,o){let r,s;try{const f=w.__wbindgen_add_to_stack_pointer(-16),m=ht(o,w.__wbindgen_export_0,w.__wbindgen_export_1),_=He;w.lorotext_splice(f,this.__wbg_ptr,e,n,m,_);var i=L().getInt32(f+0,!0),a=L().getInt32(f+4,!0),l=L().getInt32(f+8,!0),c=L().getInt32(f+12,!0),u=i,h=a;if(c)throw u=0,h=0,H(l);return r=u,s=h,It(u,h)}finally{w.__wbindgen_add_to_stack_pointer(16),w.__wbindgen_export_3(r,s,1)}}insertUtf8(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=ht(n,w.__wbindgen_export_0,w.__wbindgen_export_1),i=He;w.lorotext_insertUtf8(r,this.__wbg_ptr,e,s,i);var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}delete(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_delete(r,this.__wbg_ptr,e,n);var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}deleteUtf8(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_deleteUtf8(r,this.__wbg_ptr,e,n);var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}mark(e,n,o){try{const s=w.__wbindgen_add_to_stack_pointer(-16),i=ht(n,w.__wbindgen_export_0,w.__wbindgen_export_1),a=He;w.lorotext_mark(s,this.__wbg_ptr,re(e),i,a,re(o));var r=L().getInt32(s+0,!0);if(L().getInt32(s+4,!0))throw H(r)}finally{w.__wbindgen_add_to_stack_pointer(16)}}unmark(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=ht(n,w.__wbindgen_export_0,w.__wbindgen_export_1),i=He;w.lorotext_unmark(r,this.__wbg_ptr,re(e),s,i);var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}toString(){let e,n;try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_toString(s,this.__wbg_ptr);var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);return e=o,n=r,It(o,r)}finally{w.__wbindgen_add_to_stack_pointer(16),w.__wbindgen_export_3(e,n,1)}}toDelta(){return H(w.lorotext_toDelta(this.__wbg_ptr))}get id(){return H(w.lorotext_id(this.__wbg_ptr))}get length(){return w.lorotext_length(this.__wbg_ptr)>>>0}subscribe(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_subscribe(r,this.__wbg_ptr,re(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}applyDelta(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_applyDelta(o,this.__wbg_ptr,re(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}parent(){return H(w.lorotext_parent(this.__wbg_ptr))}isAttached(){return w.lorotext_isAttached(this.__wbg_ptr)!==0}getAttached(){return H(w.lorotext_getAttached(this.__wbg_ptr))}getCursor(e,n){const o=w.lorotext_getCursor(this.__wbg_ptr,e,re(n));return o===0?void 0:Kn.__wrap(o)}push(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16),r=ht(e,w.__wbindgen_export_0,w.__wbindgen_export_1),s=He;w.lorotext_push(o,this.__wbg_ptr,r,s);var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getEditorOf(e){return H(w.lorotext_getEditorOf(this.__wbg_ptr,e))}isDeleted(){return w.lorotext_isDeleted(this.__wbg_ptr)!==0}getShallowValue(){let e,n;try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_getShallowValue(s,this.__wbg_ptr);var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);return e=o,n=r,It(o,r)}finally{w.__wbindgen_add_to_stack_pointer(16),w.__wbindgen_export_3(e,n,1)}}toJSON(){return H(w.lorotext_toJSON(this.__wbg_ptr))}}const Eu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_lorotree_free(t>>>0,1));class vi{static __wrap(e){e>>>=0;const n=Object.create(vi.prototype);return n.__wbg_ptr=e,Eu.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Eu.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_lorotree_free(e,0)}constructor(){const e=w.lorotree_new();return this.__wbg_ptr=e>>>0,Eu.register(this,this.__wbg_ptr,this),this}kind(){return H(w.lorotree_kind(this.__wbg_ptr))}createNode(e,n){try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_createNode(s,this.__wbg_ptr,mn(e),Mn(n)?4294967297:n>>>0);var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);if(L().getInt32(s+8,!0))throw H(r);return ro.__wrap(o)}finally{w.__wbindgen_add_to_stack_pointer(16),xt[Xt++]=void 0}}move(e,n,o){try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_move(s,this.__wbg_ptr,mn(e),mn(n),Mn(o)?4294967297:o>>>0);var r=L().getInt32(s+0,!0);if(L().getInt32(s+4,!0))throw H(r)}finally{w.__wbindgen_add_to_stack_pointer(16),xt[Xt++]=void 0,xt[Xt++]=void 0}}delete(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_delete(o,this.__wbg_ptr,mn(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16),xt[Xt++]=void 0}}getNodeByID(e){try{const n=w.lorotree_getNodeByID(this.__wbg_ptr,mn(e));return n===0?void 0:ro.__wrap(n)}finally{xt[Xt++]=void 0}}get id(){return H(w.lorotree_id(this.__wbg_ptr))}has(e){try{return w.lorotree_has(this.__wbg_ptr,mn(e))!==0}finally{xt[Xt++]=void 0}}isNodeDeleted(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_isNodeDeleted(r,this.__wbg_ptr,mn(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return n!==0}finally{w.__wbindgen_add_to_stack_pointer(16),xt[Xt++]=void 0}}toArray(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_toArray(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getNodes(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_getNodes(r,this.__wbg_ptr,re(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}toJSON(){return H(w.lorotree_toJSON(this.__wbg_ptr))}nodes(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_nodes(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=On(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}roots(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_roots(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=On(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}subscribe(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_subscribe(r,this.__wbg_ptr,re(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}parent(){return H(w.lorotree_parent(this.__wbg_ptr))}isAttached(){return w.lorotree_isAttached(this.__wbg_ptr)!==0}getAttached(){return H(w.lorotree_getAttached(this.__wbg_ptr))}enableFractionalIndex(e){w.lorotree_enableFractionalIndex(this.__wbg_ptr,e)}disableFractionalIndex(){w.lorotree_disableFractionalIndex(this.__wbg_ptr)}isFractionalIndexEnabled(){return w.lorotree_isFractionalIndexEnabled(this.__wbg_ptr)!==0}isDeleted(){return w.lorotree_isDeleted(this.__wbg_ptr)!==0}getShallowValue(){return H(w.lorotree_getShallowValue(this.__wbg_ptr))}}const j0=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_lorotreenode_free(t>>>0,1));class ro{static __wrap(e){e>>>=0;const n=Object.create(ro.prototype);return n.__wbg_ptr=e,j0.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,j0.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_lorotreenode_free(e,0)}__getClassname(){let e,n;try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode___getClassname(s,this.__wbg_ptr);var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);return e=o,n=r,It(o,r)}finally{w.__wbindgen_add_to_stack_pointer(16),w.__wbindgen_export_3(e,n,1)}}get id(){return H(w.lorotreenode_id(this.__wbg_ptr))}createNode(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode_createNode(r,this.__wbg_ptr,Mn(e)?4294967297:e>>>0);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return ro.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}move(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode_move(r,this.__wbg_ptr,mn(e),Mn(n)?4294967297:n>>>0);var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16),xt[Xt++]=void 0}}moveAfter(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);es(e,ro),w.lorotreenode_moveAfter(o,this.__wbg_ptr,e.__wbg_ptr);var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}moveBefore(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);es(e,ro),w.lorotreenode_moveBefore(o,this.__wbg_ptr,e.__wbg_ptr);var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}index(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode_index(o,this.__wbg_ptr);var e=L().getFloat64(o+0,!0),n=L().getInt32(o+8,!0);if(L().getInt32(o+12,!0))throw H(n);return e===4294967297?void 0:e}finally{w.__wbindgen_add_to_stack_pointer(16)}}fractionalIndex(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode_fractionalIndex(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get data(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode_data(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return Yo.__wrap(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}toJSON(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode_toJSON(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}parent(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode_parent(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return e===0?void 0:ro.__wrap(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}children(){return H(w.lorotreenode_children(this.__wbg_ptr))}isDeleted(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode_isDeleted(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return e!==0}finally{w.__wbindgen_add_to_stack_pointer(16)}}getLastMoveId(){return H(w.lorotreenode_getLastMoveId(this.__wbg_ptr))}creationId(){return H(w.lorotreenode_creationId(this.__wbg_ptr))}creator(){return H(w.lorotreenode_creator(this.__wbg_ptr))}}const E0=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_undomanager_free(t>>>0,1)),Iu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_versionvector_free(t>>>0,1));class Dn{static __wrap(e){e>>>=0;const n=Object.create(Dn.prototype);return n.__wbg_ptr=e,Iu.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Iu.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_versionvector_free(e,0)}constructor(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.versionvector_new(r,re(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return this.__wbg_ptr=n>>>0,Iu.register(this,this.__wbg_ptr,this),this}finally{w.__wbindgen_add_to_stack_pointer(16)}}static parseJSON(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.versionvector_parseJSON(r,re(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return Dn.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}toJSON(){return H(w.versionvector_toJSON(this.__wbg_ptr))}encode(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.versionvector_encode(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=oo(e,n).slice();return w.__wbindgen_export_3(e,1*n,1),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}static decode(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=Go(e,w.__wbindgen_export_0),i=He;w.versionvector_decode(r,s,i);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return Dn.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.versionvector_get(r,this.__wbg_ptr,re(e));var n=L().getFloat64(r+0,!0),o=L().getInt32(r+8,!0);if(L().getInt32(r+12,!0))throw H(o);return n===4294967297?void 0:n}finally{w.__wbindgen_add_to_stack_pointer(16)}}compare(e){es(e,Dn);const n=w.versionvector_compare(this.__wbg_ptr,e.__wbg_ptr);return n===4294967297?void 0:n}setEnd(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.versionvector_setEnd(o,this.__wbg_ptr,re(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}setLast(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.versionvector_setLast(o,this.__wbg_ptr,re(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}remove(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.versionvector_remove(o,this.__wbg_ptr,re(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}length(){return w.versionvector_length(this.__wbg_ptr)>>>0}}function I0(t,e){const n=ht(String(xe(e)),w.__wbindgen_export_0,w.__wbindgen_export_1),o=He;L().setInt32(t+4,o,!0),L().setInt32(t+0,n,!0)}function A0(){return Kt(function(t,e,n){return re(Reflect.apply(xe(t),xe(e),xe(n)))},arguments)}function T0(t){return re(xe(t).buffer)}function M0(){return Kt(function(t,e){return re(xe(t).call(xe(e)))},arguments)}function O0(){return Kt(function(t,e,n){return re(xe(t).call(xe(e),xe(n)))},arguments)}function D0(){return Kt(function(t,e,n,o,r){return re(xe(t).call(xe(e),xe(n),xe(o),xe(r)))},arguments)}function R0(){return Kt(function(t,e,n,o){return re(xe(t).call(xe(e),xe(n),xe(o)))},arguments)}function P0(t){return re(ts.__wrap(t))}function L0(t){return re(xe(t).crypto)}function F0(t){return re(Kn.__wrap(t))}function z0(t){return xe(t).done}function B0(t){return re(xe(t).entries())}function U0(t){return re(Object.entries(xe(t)))}function V0(t,e){let n,o;try{n=t,o=e,console.error(It(t,e))}finally{w.__wbindgen_export_3(n,o,1)}}function $0(t,e){console.error(It(t,e))}function H0(t){return re(Array.from(xe(t)))}function W0(){return Kt(function(t,e){xe(t).getRandomValues(xe(e))},arguments)}function q0(t,e){return re(xe(t)[e>>>0])}function G0(){return Kt(function(t,e){return re(Reflect.get(xe(t),xe(e)))},arguments)}function Y0(t,e){return xe(t)[e>>>0]}function J0(t,e){return re(xe(t)[xe(e)])}function K0(){return Kt(function(){return re(globalThis.globalThis)},arguments)}function X0(){return Kt(function(){return re(global.global)},arguments)}function Z0(t){let e;try{e=xe(t)instanceof ArrayBuffer}catch{e=!1}return e}function Q0(t){let e;try{e=xe(t)instanceof Map}catch{e=!1}return e}function eb(t){let e;try{e=xe(t)instanceof Object}catch{e=!1}return e}function tb(t){let e;try{e=xe(t)instanceof Uint8Array}catch{e=!1}return e}function nb(t){return Array.isArray(xe(t))}function ob(t){return Number.isSafeInteger(xe(t))}function rb(){return re(Symbol.iterator)}function sb(t){return xe(t).length}function ib(t){return xe(t).length}function ab(t,e,n,o,r,s,i,a){let l,c;try{l=t,c=e,console.log(It(t,e),It(n,o),It(r,s),It(i,a))}finally{w.__wbindgen_export_3(l,c,1)}}function lb(t,e){console.log(It(t,e))}function cb(t,e){let n,o;try{n=t,o=e,console.log(It(t,e))}finally{w.__wbindgen_export_3(n,o,1)}}function db(t){return re(xi.__wrap(t))}function ub(t){return re(yi.__wrap(t))}function hb(t){return re(Yo.__wrap(t))}function fb(t){return re(wi.__wrap(t))}function mb(t){return re(Jo.__wrap(t))}function pb(t){return re(vi.__wrap(t))}function gb(t){return re(ro.__wrap(t))}function _b(t,e){performance.mark(It(t,e))}function bb(){return Kt(function(t,e,n,o){let r,s,i,a;try{r=t,s=e,i=n,a=o,performance.measure(It(t,e),It(n,o))}finally{w.__wbindgen_export_3(r,s,1),w.__wbindgen_export_3(i,a,1)}},arguments)}function xb(t){return re(xe(t).msCrypto)}function yb(){return re(new Map)}function wb(t){return re(new Uint8Array(xe(t)))}function vb(){return re(new Object)}function kb(){return re(new Error)}function Sb(){return re(new Array)}function Cb(t,e){return re(new Function(It(t,e)))}function Nb(t,e,n){return re(new Uint8Array(xe(t),e>>>0,n>>>0))}function jb(t){return re(new Uint8Array(t>>>0))}function Eb(t){return re(new Array(t>>>0))}function Ib(t){return re(xe(t).next)}function Ab(){return Kt(function(t){return re(xe(t).next())},arguments)}function Tb(t){return re(xe(t).node)}function Mb(){return Date.now()}function Ob(){return Kt(function(t){return re(Reflect.ownKeys(xe(t)))},arguments)}function Db(t){return re(xe(t).process)}function Rb(t,e){return xe(t).push(xe(e))}function Pb(){return Kt(function(t,e){xe(t).randomFillSync(H(e))},arguments)}function Lb(){return Kt(function(){return re(module.require)},arguments)}function Fb(t){return re(Promise.resolve(xe(t)))}function zb(){return Kt(function(){return re(self.self)},arguments)}function Bb(){return Kt(function(t,e,n){return Reflect.set(xe(t),xe(e),xe(n))},arguments)}function Ub(t,e,n){return re(xe(t).set(xe(e),xe(n)))}function Vb(t,e,n){xe(t)[H(e)]=H(n)}function $b(t,e,n){xe(t).set(xe(e),n>>>0)}function Hb(t,e,n){xe(t)[e>>>0]=H(n)}function Wb(t,e,n){xe(t)[e>>>0]=n}function qb(t,e){const n=ht(xe(e).stack,w.__wbindgen_export_0,w.__wbindgen_export_1),o=He;L().setInt32(t+4,o,!0),L().setInt32(t+0,n,!0)}function Gb(t,e,n){return re(xe(t).subarray(e>>>0,n>>>0))}function Yb(t,e){return re(xe(t).then(xe(e)))}function Jb(t){return re(xe(t).value)}function Kb(t){return re(xe(t).versions)}function Xb(t){return re(Dn.__wrap(t))}function Zb(){return Kt(function(){return re(window.window)},arguments)}function Qb(t){return+xe(t)}function ex(t){return re(t)}function tx(t){return re(BigInt.asUintN(64,t))}function nx(t,e){const n=xe(e),o=typeof n=="bigint"?n:void 0;L().setBigInt64(t+8,Mn(o)?BigInt(0):o,!0),L().setInt32(t+0,!Mn(o),!0)}function ox(t){const e=xe(t);return typeof e=="boolean"?e?1:0:2}function rx(t){const e=H(t).original;return e.cnt--==1?(e.a=0,!0):!1}function sx(t,e,n){return re(w0(t,e,8,F5))}function ix(t,e,n){return re(w0(t,e,10,z5))}function ax(t,e){const n=ht(wu(xe(e)),w.__wbindgen_export_0,w.__wbindgen_export_1),o=He;L().setInt32(t+4,o,!0),L().setInt32(t+0,n,!0)}function lx(t,e){return re(new Error(It(t,e)))}function cx(t,e){return xe(t)in xe(e)}function dx(t){return Array.isArray(xe(t))}function ux(t){return typeof xe(t)=="bigint"}function hx(t){return!xe(t)}function fx(t){return typeof xe(t)=="function"}function mx(t){return xe(t)===null}function px(t){const e=xe(t);return typeof e=="object"&&e!==null}function gx(t){return typeof xe(t)=="string"}function _x(t){return xe(t)===void 0}function bx(t,e){return xe(t)===xe(e)}function xx(t,e){return xe(t)==xe(e)}function yx(){return re(w.memory)}function wx(t,e){const n=xe(e),o=typeof n=="number"?n:void 0;L().setFloat64(t+8,Mn(o)?0:o,!0),L().setInt32(t+0,!Mn(o),!0)}function vx(t){return re(t)}function kx(t){return re(xe(t))}function Sx(t){H(t)}function Cx(t){throw H(t)}function Nx(t,e){const n=xe(e),o=typeof n=="string"?n:void 0;var r=Mn(o)?0:ht(o,w.__wbindgen_export_0,w.__wbindgen_export_1),s=He;L().setInt32(t+4,s,!0),L().setInt32(t+0,r,!0)}function jx(t,e){return re(It(t,e))}function Ex(t,e){throw new Error(It(t,e))}function Ix(t){return re(typeof xe(t))}const B5=Object.freeze(Object.defineProperty({__proto__:null,AwarenessWasm:k0,ChangeModifier:ts,Cursor:Kn,EphemeralStoreWasm:class{__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,N0.unregister(this),t}free(){const t=this.__destroy_into_raw();w.__wbg_ephemeralstorewasm_free(t,0)}constructor(t){const e=w.ephemeralstorewasm_new(t);return this.__wbg_ptr=e>>>0,N0.register(this,this.__wbg_ptr,this),this}set(t,e){const n=ht(t,w.__wbindgen_export_0,w.__wbindgen_export_1),o=He;w.ephemeralstorewasm_set(this.__wbg_ptr,n,o,re(e))}delete(t){const e=ht(t,w.__wbindgen_export_0,w.__wbindgen_export_1),n=He;w.ephemeralstorewasm_delete(this.__wbg_ptr,e,n)}get(t){const e=ht(t,w.__wbindgen_export_0,w.__wbindgen_export_1),n=He;return H(w.ephemeralstorewasm_get(this.__wbg_ptr,e,n))}getAllStates(){return H(w.ephemeralstorewasm_getAllStates(this.__wbg_ptr))}subscribeLocalUpdates(t){return H(w.ephemeralstorewasm_subscribeLocalUpdates(this.__wbg_ptr,re(t)))}subscribe(t){return H(w.ephemeralstorewasm_subscribe(this.__wbg_ptr,re(t)))}encode(t){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=ht(t,w.__wbindgen_export_0,w.__wbindgen_export_1),i=He;w.ephemeralstorewasm_encode(r,this.__wbg_ptr,s,i);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=oo(e,n).slice();return w.__wbindgen_export_3(e,1*n,1),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}encodeAll(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.ephemeralstorewasm_encodeAll(o,this.__wbg_ptr);var t=L().getInt32(o+0,!0),e=L().getInt32(o+4,!0),n=oo(t,e).slice();return w.__wbindgen_export_3(t,1*e,1),n}finally{w.__wbindgen_add_to_stack_pointer(16)}}apply(t){const e=Go(t,w.__wbindgen_export_0),n=He;w.ephemeralstorewasm_apply(this.__wbg_ptr,e,n)}removeOutdated(){w.ephemeralstorewasm_removeOutdated(this.__wbg_ptr)}isEmpty(){return w.ephemeralstorewasm_isEmpty(this.__wbg_ptr)!==0}keys(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.ephemeralstorewasm_keys(o,this.__wbg_ptr);var t=L().getInt32(o+0,!0),e=L().getInt32(o+4,!0),n=On(t,e).slice();return w.__wbindgen_export_3(t,4*e,4),n}finally{w.__wbindgen_add_to_stack_pointer(16)}}},LORO_VERSION:function(){let t,e;try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.LORO_VERSION(r);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);return t=n,e=o,It(n,o)}finally{w.__wbindgen_add_to_stack_pointer(16),w.__wbindgen_export_3(t,e,1)}},LoroCounter:xi,LoroDoc:bo,LoroList:yi,LoroMap:Yo,LoroMovableList:wi,LoroText:Jo,LoroTree:vi,LoroTreeNode:ro,UndoManager:class{__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,E0.unregister(this),t}free(){const t=this.__destroy_into_raw();w.__wbg_undomanager_free(t,0)}constructor(t,e){es(t,bo);const n=w.undomanager_new(t.__wbg_ptr,re(e));return this.__wbg_ptr=n>>>0,E0.register(this,this.__wbg_ptr,this),this}undo(){try{const n=w.__wbindgen_add_to_stack_pointer(-16);w.undomanager_undo(n,this.__wbg_ptr);var t=L().getInt32(n+0,!0),e=L().getInt32(n+4,!0);if(L().getInt32(n+8,!0))throw H(e);return t!==0}finally{w.__wbindgen_add_to_stack_pointer(16)}}redo(){try{const n=w.__wbindgen_add_to_stack_pointer(-16);w.undomanager_redo(n,this.__wbg_ptr);var t=L().getInt32(n+0,!0),e=L().getInt32(n+4,!0);if(L().getInt32(n+8,!0))throw H(e);return t!==0}finally{w.__wbindgen_add_to_stack_pointer(16)}}groupStart(){try{const e=w.__wbindgen_add_to_stack_pointer(-16);w.undomanager_groupStart(e,this.__wbg_ptr);var t=L().getInt32(e+0,!0);if(L().getInt32(e+4,!0))throw H(t)}finally{w.__wbindgen_add_to_stack_pointer(16)}}groupEnd(){w.undomanager_groupEnd(this.__wbg_ptr)}canUndo(){return w.undomanager_canUndo(this.__wbg_ptr)!==0}canRedo(){return w.undomanager_canRedo(this.__wbg_ptr)!==0}setMaxUndoSteps(t){w.undomanager_setMaxUndoSteps(this.__wbg_ptr,t)}setMergeInterval(t){w.undomanager_setMergeInterval(this.__wbg_ptr,t)}addExcludeOriginPrefix(t){const e=ht(t,w.__wbindgen_export_0,w.__wbindgen_export_1),n=He;w.undomanager_addExcludeOriginPrefix(this.__wbg_ptr,e,n)}setOnPush(t){w.undomanager_setOnPush(this.__wbg_ptr,re(t))}setOnPop(t){w.undomanager_setOnPop(this.__wbg_ptr,re(t))}clear(){w.undomanager_clear(this.__wbg_ptr)}},VersionVector:Dn,__wbg_String_8f0eb39a4a4c2f66:I0,__wbg_apply_9bb7fe8fff013a3f:A0,__wbg_buffer_ef9774282e5dab94:T0,__wbg_call_0ad083564791763a:M0,__wbg_call_a34b6b4765f27be0:O0,__wbg_call_d00953b926be4879:D0,__wbg_call_efe5a4db7065d1a2:R0,__wbg_changemodifier_new:P0,__wbg_crypto_ed58b8e10a292839:L0,__wbg_cursor_new:F0,__wbg_done_f4c254830a095eaf:z0,__wbg_entries_4dce6361e3ba6fbc:B0,__wbg_entries_83beb641792ccb9c:U0,__wbg_error_7534b8e9a36f1ab4:V0,__wbg_error_9912f7d6d7835a4b:$0,__wbg_from_3aa0fcaa8eef0104:H0,__wbg_getRandomValues_bcb4912f16000dc4:W0,__wbg_get_0c3cc364764a0b98:q0,__wbg_get_b996a12be035ef4f:G0,__wbg_getindex_a471648b3037c750:Y0,__wbg_getwithrefkey_1dc361bd10053bfe:J0,__wbg_globalThis_6b4d52a0b6aaeaea:K0,__wbg_global_49324ce12193de77:X0,__wbg_instanceof_ArrayBuffer_ff40e55b5978e215:Z0,__wbg_instanceof_Map_0f3f3653f757ced1:Q0,__wbg_instanceof_Object_9108547bac1f91b1:eb,__wbg_instanceof_Uint8Array_db97368f94b1373f:tb,__wbg_isArray_8738f1062fa88586:nb,__wbg_isSafeInteger_a1b3e0811faecf2f:ob,__wbg_iterator_c0c688f37fa815e6:rb,__wbg_length_12246a78d2f65d3a:sb,__wbg_length_c24da17096edfe57:ib,__wbg_log_0cc1b7768397bcfe:ab,__wbg_log_0fd6c49475c7bece:lb,__wbg_log_cb9e190acc5753fb:cb,__wbg_lorocounter_new:db,__wbg_lorolist_new:ub,__wbg_loromap_new:hb,__wbg_loromovablelist_new:fb,__wbg_lorotext_new:mb,__wbg_lorotree_new:pb,__wbg_lorotreenode_new:gb,__wbg_mark_7438147ce31e9d4b:_b,__wbg_measure_fb7825c11612c823:bb,__wbg_msCrypto_0a36e2ec3a343d26:xb,__wbg_new_518e2184725aa711:yb,__wbg_new_59845962d1127937:wb,__wbg_new_67abf4a77618ee3e:vb,__wbg_new_8a6f238a6ece86ea:kb,__wbg_new_e2d07398d7689006:Sb,__wbg_newnoargs_a136448eeb7d48ac:Cb,__wbg_newwithbyteoffsetandlength_84908302a4c137cf:Nb,__wbg_newwithlength_4c216eaaf23f2f9a:jb,__wbg_newwithlength_88b49de1eb24d63e:Eb,__wbg_next_928df8c15fc0c9b0:Ib,__wbg_next_9dc0926f351c7090:Ab,__wbg_node_02999533c4ea02e3:Tb,__wbg_now_439b66158bc4f246:Mb,__wbg_ownKeys_b16312a839a4152c:Ob,__wbg_process_5c1d670bc53614b8:Db,__wbg_push_e7d7247e69dad3ee:Rb,__wbg_randomFillSync_ab2cfe79ebbf2740:Pb,__wbg_require_79b1e9274cde3c87:Lb,__wbg_resolve_267ff08e7e1d2ce4:Fb,__wbg_self_cca3ca60d61220f4:zb,__wbg_set_1b50d2de855a9d50:Bb,__wbg_set_393f510a6b7e9da5:Ub,__wbg_set_3f1d0b984ed272ed:Vb,__wbg_set_5deee49b10b2b780:$b,__wbg_set_93ba9407b5476ec6:Hb,__wbg_set_wasm:yu,__wbg_setindex_e0b7b31bfc87ba3f:Wb,__wbg_stack_0ed75d68575b0f3c:qb,__wbg_subarray_2dc34705c0dc7cdb:Gb,__wbg_then_84907e7a6730461e:Yb,__wbg_value_51f8a88d4a1805fb:Jb,__wbg_versions_c71aa1626a93e0a1:Kb,__wbg_versionvector_new:Xb,__wbg_window_2aba046d3fc4ad7c:Zb,__wbindgen_as_number:Qb,__wbindgen_bigint_from_i64:ex,__wbindgen_bigint_from_u64:tx,__wbindgen_bigint_get_as_i64:nx,__wbindgen_boolean_get:ox,__wbindgen_cb_drop:rx,__wbindgen_closure_wrapper563:sx,__wbindgen_closure_wrapper566:ix,__wbindgen_debug_string:ax,__wbindgen_error_new:lx,__wbindgen_in:cx,__wbindgen_is_array:dx,__wbindgen_is_bigint:ux,__wbindgen_is_falsy:hx,__wbindgen_is_function:fx,__wbindgen_is_null:mx,__wbindgen_is_object:px,__wbindgen_is_string:gx,__wbindgen_is_undefined:_x,__wbindgen_jsval_eq:bx,__wbindgen_jsval_loose_eq:xx,__wbindgen_memory:yx,__wbindgen_number_get:wx,__wbindgen_number_new:vx,__wbindgen_object_clone_ref:kx,__wbindgen_object_drop_ref:Sx,__wbindgen_rethrow:Cx,__wbindgen_string_get:Nx,__wbindgen_string_new:jx,__wbindgen_throw:Ex,__wbindgen_typeof:Ix,decodeFrontiers:function(t){try{const o=w.__wbindgen_add_to_stack_pointer(-16),r=Go(t,w.__wbindgen_export_0),s=He;w.decodeFrontiers(o,r,s);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}},decodeImportBlobMeta:function(t,e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=Go(t,w.__wbindgen_export_0),i=He;w.decodeImportBlobMeta(r,s,i,e);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}},encodeFrontiers:function(t){try{const s=w.__wbindgen_add_to_stack_pointer(-16),i=yn(t,w.__wbindgen_export_0),a=He;w.encodeFrontiers(s,i,a);var e=L().getInt32(s+0,!0),n=L().getInt32(s+4,!0),o=L().getInt32(s+8,!0);if(L().getInt32(s+12,!0))throw H(o);var r=oo(e,n).slice();return w.__wbindgen_export_3(e,1*n,1),r}finally{w.__wbindgen_add_to_stack_pointer(16)}},redactJsonUpdates:function(t,e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.redactJsonUpdates(r,re(t),re(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}},run:function(){w.run()},setDebug:function(){w.setDebug()}},Symbol.toStringTag,{value:"Module"}));URL=globalThis.URL;const V=await(async(t={},e)=>{let n;if(e.startsWith("data:")){const o=e.replace(/^data:.*?base64,/,"");let r;if(typeof Buffer=="function"&&typeof Buffer.from=="function")r=Buffer.from(o,"base64");else{if(typeof atob!="function")throw new Error("Cannot decode base64-encoded data URL");{const s=atob(o);r=new Uint8Array(s.length);for(let i=0;i<s.length;i++)r[i]=s.charCodeAt(i)}}n=await WebAssembly.instantiate(r,t)}else{const o=await fetch(e),r=o.headers.get("Content-Type")||"";if("instantiateStreaming"in WebAssembly&&r.startsWith("application/wasm"))n=await WebAssembly.instantiateStreaming(o,t);else{const s=await o.arrayBuffer();n=await WebAssembly.instantiate(s,t)}}return n.instance.exports})({"./loro_wasm_bg.js":{__wbindgen_object_drop_ref:Sx,__wbg_lorocounter_new:db,__wbg_cursor_new:F0,__wbg_lorotext_new:mb,__wbg_loromovablelist_new:fb,__wbg_lorotreenode_new:gb,__wbg_lorotree_new:pb,__wbg_lorolist_new:ub,__wbg_loromap_new:hb,__wbg_versionvector_new:Xb,__wbg_changemodifier_new:P0,__wbindgen_is_function:fx,__wbindgen_string_new:jx,__wbindgen_boolean_get:ox,__wbindgen_error_new:lx,__wbindgen_object_clone_ref:kx,__wbindgen_string_get:Nx,__wbindgen_is_undefined:_x,__wbindgen_in:cx,__wbindgen_is_bigint:ux,__wbindgen_number_get:wx,__wbindgen_bigint_from_i64:ex,__wbindgen_jsval_eq:bx,__wbindgen_is_object:px,__wbindgen_bigint_from_u64:tx,__wbindgen_cb_drop:rx,__wbindgen_as_number:Qb,__wbindgen_is_string:gx,__wbindgen_is_null:mx,__wbindgen_number_new:vx,__wbindgen_is_array:dx,__wbindgen_typeof:Ix,__wbg_error_9912f7d6d7835a4b:$0,__wbg_log_0fd6c49475c7bece:lb,__wbindgen_is_falsy:hx,__wbg_log_cb9e190acc5753fb:cb,__wbg_log_0cc1b7768397bcfe:ab,__wbg_mark_7438147ce31e9d4b:_b,__wbg_measure_fb7825c11612c823:bb,__wbg_new_8a6f238a6ece86ea:kb,__wbg_stack_0ed75d68575b0f3c:qb,__wbg_error_7534b8e9a36f1ab4:V0,__wbindgen_jsval_loose_eq:xx,__wbg_String_8f0eb39a4a4c2f66:I0,__wbg_getwithrefkey_1dc361bd10053bfe:J0,__wbg_set_3f1d0b984ed272ed:Vb,__wbg_now_439b66158bc4f246:Mb,__wbg_crypto_ed58b8e10a292839:L0,__wbg_process_5c1d670bc53614b8:Db,__wbg_versions_c71aa1626a93e0a1:Kb,__wbg_node_02999533c4ea02e3:Tb,__wbg_require_79b1e9274cde3c87:Lb,__wbg_msCrypto_0a36e2ec3a343d26:xb,__wbg_randomFillSync_ab2cfe79ebbf2740:Pb,__wbg_getRandomValues_bcb4912f16000dc4:W0,__wbg_self_cca3ca60d61220f4:zb,__wbg_window_2aba046d3fc4ad7c:Zb,__wbg_globalThis_6b4d52a0b6aaeaea:K0,__wbg_global_49324ce12193de77:X0,__wbg_newnoargs_a136448eeb7d48ac:Cb,__wbg_call_0ad083564791763a:M0,__wbg_get_0c3cc364764a0b98:q0,__wbg_length_12246a78d2f65d3a:sb,__wbg_new_e2d07398d7689006:Sb,__wbg_new_518e2184725aa711:yb,__wbg_next_928df8c15fc0c9b0:Ib,__wbg_next_9dc0926f351c7090:Ab,__wbg_done_f4c254830a095eaf:z0,__wbg_value_51f8a88d4a1805fb:Jb,__wbg_iterator_c0c688f37fa815e6:rb,__wbg_get_b996a12be035ef4f:G0,__wbg_new_67abf4a77618ee3e:vb,__wbg_newwithlength_88b49de1eb24d63e:Eb,__wbg_set_93ba9407b5476ec6:Hb,__wbg_from_3aa0fcaa8eef0104:H0,__wbg_isArray_8738f1062fa88586:nb,__wbg_push_e7d7247e69dad3ee:Rb,__wbg_instanceof_ArrayBuffer_ff40e55b5978e215:Z0,__wbg_call_a34b6b4765f27be0:O0,__wbg_call_efe5a4db7065d1a2:R0,__wbg_call_d00953b926be4879:D0,__wbg_instanceof_Map_0f3f3653f757ced1:Q0,__wbg_set_393f510a6b7e9da5:Ub,__wbg_entries_4dce6361e3ba6fbc:B0,__wbg_isSafeInteger_a1b3e0811faecf2f:ob,__wbg_instanceof_Object_9108547bac1f91b1:eb,__wbg_entries_83beb641792ccb9c:U0,__wbg_apply_9bb7fe8fff013a3f:A0,__wbg_ownKeys_b16312a839a4152c:Ob,__wbg_set_1b50d2de855a9d50:Bb,__wbg_buffer_ef9774282e5dab94:T0,__wbg_resolve_267ff08e7e1d2ce4:Fb,__wbg_then_84907e7a6730461e:Yb,__wbg_newwithbyteoffsetandlength_84908302a4c137cf:Nb,__wbg_new_59845962d1127937:wb,__wbg_set_5deee49b10b2b780:$b,__wbg_length_c24da17096edfe57:ib,__wbg_instanceof_Uint8Array_db97368f94b1373f:tb,__wbg_newwithlength_4c216eaaf23f2f9a:jb,__wbg_subarray_2dc34705c0dc7cdb:Gb,__wbg_getindex_a471648b3037c750:Y0,__wbg_setindex_e0b7b31bfc87ba3f:Wb,__wbindgen_bigint_get_as_i64:nx,__wbindgen_debug_string:ax,__wbindgen_throw:Ex,__wbindgen_rethrow:Cx,__wbindgen_memory:yx,__wbindgen_closure_wrapper563:sx,__wbindgen_closure_wrapper566:ix}},P5),U5=V.memory,V5=V.__wbg_lorocounter_free,$5=V.lorocounter_new,H5=V.lorocounter_kind,W5=V.lorocounter_id,q5=V.lorocounter_increment,G5=V.lorocounter_decrement,Y5=V.lorocounter_value,J5=V.lorocounter_subscribe,K5=V.lorocounter_parent,X5=V.lorocounter_isAttached,Z5=V.lorocounter_getAttached,Q5=V.lorocounter_getShallowValue,e6=V.__wbg_awarenesswasm_free,t6=V.awarenesswasm_new,n6=V.awarenesswasm_encode,o6=V.awarenesswasm_encodeAll,r6=V.awarenesswasm_apply,s6=V.awarenesswasm_setLocalState,i6=V.awarenesswasm_peer,a6=V.awarenesswasm_getAllStates,l6=V.awarenesswasm_getState,c6=V.awarenesswasm_getTimestamp,d6=V.awarenesswasm_removeOutdated,u6=V.awarenesswasm_length,h6=V.awarenesswasm_isEmpty,f6=V.awarenesswasm_peers,m6=V.__wbg_ephemeralstorewasm_free,p6=V.ephemeralstorewasm_new,g6=V.ephemeralstorewasm_set,_6=V.ephemeralstorewasm_delete,b6=V.ephemeralstorewasm_get,x6=V.ephemeralstorewasm_getAllStates,y6=V.ephemeralstorewasm_subscribeLocalUpdates,w6=V.ephemeralstorewasm_subscribe,v6=V.ephemeralstorewasm_encode,k6=V.ephemeralstorewasm_encodeAll,S6=V.ephemeralstorewasm_apply,C6=V.ephemeralstorewasm_removeOutdated,N6=V.ephemeralstorewasm_isEmpty,j6=V.ephemeralstorewasm_keys,E6=V.LORO_VERSION,I6=V.run,A6=V.encodeFrontiers,T6=V.decodeFrontiers,M6=V.setDebug,O6=V.__wbg_lorodoc_free,D6=V.lorodoc_new,R6=V.lorodoc_setDetachedEditing,P6=V.lorodoc_isDetachedEditingEnabled,L6=V.lorodoc_setRecordTimestamp,F6=V.lorodoc_setChangeMergeInterval,z6=V.lorodoc_configTextStyle,B6=V.lorodoc_configDefaultTextStyle,U6=V.lorodoc_fromSnapshot,V6=V.lorodoc_attach,$6=V.lorodoc_isDetached,H6=V.lorodoc_detach,W6=V.lorodoc_fork,q6=V.lorodoc_forkAt,G6=V.lorodoc_checkoutToLatest,Y6=V.lorodoc_travelChangeAncestors,J6=V.lorodoc_findIdSpansBetween,K6=V.lorodoc_checkout,X6=V.lorodoc_peerId,Z6=V.lorodoc_peerIdStr,Q6=V.lorodoc_setPeerId,eI=V.lorodoc_commit,tI=V.lorodoc_getPendingTxnLength,nI=V.lorodoc_getText,oI=V.lorodoc_getMap,rI=V.lorodoc_getList,sI=V.lorodoc_getMovableList,iI=V.lorodoc_getCounter,aI=V.lorodoc_getTree,lI=V.lorodoc_hasContainer,cI=V.lorodoc_getContainerById,dI=V.lorodoc_setNextCommitMessage,uI=V.lorodoc_setNextCommitOrigin,hI=V.lorodoc_setNextCommitTimestamp,fI=V.lorodoc_setNextCommitOptions,mI=V.lorodoc_clearNextCommitOptions,pI=V.lorodoc_getDeepValueWithID,gI=V.lorodoc_getPathToContainer,_I=V.lorodoc_JSONPath,bI=V.lorodoc_version,xI=V.lorodoc_shallowSinceVV,yI=V.lorodoc_isShallow,wI=V.lorodoc_shallowSinceFrontiers,vI=V.lorodoc_oplogVersion,kI=V.lorodoc_frontiers,SI=V.lorodoc_oplogFrontiers,CI=V.lorodoc_cmpWithFrontiers,NI=V.lorodoc_cmpFrontiers,jI=V.lorodoc_exportSnapshot,EI=V.lorodoc_exportFrom,II=V.lorodoc_export,AI=V.lorodoc_exportJsonUpdates,TI=V.lorodoc_exportJsonInIdSpan,MI=V.lorodoc_importJsonUpdates,OI=V.lorodoc_import,DI=V.lorodoc_importBatch,RI=V.lorodoc_getShallowValue,PI=V.lorodoc_toJSON,LI=V.lorodoc_subscribe,FI=V.lorodoc_subscribeLocalUpdates,zI=V.lorodoc_debugHistory,BI=V.lorodoc_changeCount,UI=V.lorodoc_opCount,VI=V.lorodoc_getAllChanges,$I=V.lorodoc_getChangeAt,HI=V.lorodoc_getChangeAtLamport,WI=V.lorodoc_getOpsInChange,qI=V.lorodoc_frontiersToVV,GI=V.lorodoc_vvToFrontiers,YI=V.lorodoc_getByPath,JI=V.lorodoc_getCursorPos,KI=V.lorodoc_getChangedContainersIn,XI=V.lorodoc_revertTo,ZI=V.lorodoc_applyDiff,QI=V.lorodoc_diff,e8=V.lorodoc_getUncommittedOpsAsJson,t8=V.lorodoc_subscribeFirstCommitFromPeer,n8=V.lorodoc_subscribePreCommit,o8=V.lorodoc_deleteRootContainer,r8=V.lorodoc_setHideEmptyRootContainers,s8=V.__wbg_lorotext_free,i8=V.lorotext_new,a8=V.lorotext_kind,l8=V.lorotext_iter,c8=V.lorotext_update,d8=V.lorotext_updateByLine,u8=V.lorotext_insert,h8=V.lorotext_slice,f8=V.lorotext_charAt,m8=V.lorotext_splice,p8=V.lorotext_insertUtf8,g8=V.lorotext_delete,_8=V.lorotext_deleteUtf8,b8=V.lorotext_mark,x8=V.lorotext_unmark,y8=V.lorotext_toString,w8=V.lorotext_toDelta,v8=V.lorotext_id,k8=V.lorotext_length,S8=V.lorotext_subscribe,C8=V.lorotext_applyDelta,N8=V.lorotext_parent,j8=V.lorotext_isAttached,E8=V.lorotext_getAttached,I8=V.lorotext_getCursor,A8=V.lorotext_push,T8=V.lorotext_getEditorOf,M8=V.lorotext_isDeleted,O8=V.lorotext_getShallowValue,D8=V.lorotext_toJSON,R8=V.__wbg_loromap_free,P8=V.loromap_new,L8=V.loromap_kind,F8=V.loromap_set,z8=V.loromap_delete,B8=V.loromap_get,U8=V.loromap_getOrCreateContainer,V8=V.loromap_keys,$8=V.loromap_values,H8=V.loromap_entries,W8=V.loromap_id,q8=V.loromap_toJSON,G8=V.loromap_setContainer,Y8=V.loromap_subscribe,J8=V.loromap_size,K8=V.loromap_parent,X8=V.loromap_isAttached,Z8=V.loromap_getAttached,Q8=V.loromap_clear,eA=V.loromap_getLastEditor,tA=V.loromap_isDeleted,nA=V.loromap_getShallowValue,oA=V.__wbg_lorolist_free,rA=V.lorolist_new,sA=V.lorolist_kind,iA=V.lorolist_insert,aA=V.lorolist_delete,lA=V.lorolist_get,cA=V.lorolist_id,dA=V.lorolist_toArray,uA=V.lorolist_toJSON,hA=V.lorolist_insertContainer,fA=V.lorolist_pushContainer,mA=V.lorolist_subscribe,pA=V.lorolist_length,gA=V.lorolist_parent,_A=V.lorolist_isAttached,bA=V.lorolist_getAttached,xA=V.lorolist_getCursor,yA=V.lorolist_push,wA=V.lorolist_pop,vA=V.lorolist_clear,kA=V.lorolist_getIdAt,SA=V.lorolist_isDeleted,CA=V.lorolist_getShallowValue,NA=V.loromovablelist_new,jA=V.loromovablelist_kind,EA=V.loromovablelist_insert,IA=V.loromovablelist_delete,AA=V.loromovablelist_get,TA=V.loromovablelist_id,MA=V.loromovablelist_toArray,OA=V.loromovablelist_toJSON,DA=V.loromovablelist_insertContainer,RA=V.loromovablelist_pushContainer,PA=V.loromovablelist_subscribe,LA=V.loromovablelist_length,FA=V.loromovablelist_parent,zA=V.loromovablelist_isAttached,BA=V.loromovablelist_getAttached,UA=V.loromovablelist_getCursor,VA=V.loromovablelist_move,$A=V.loromovablelist_set,HA=V.loromovablelist_setContainer,WA=V.loromovablelist_push,qA=V.loromovablelist_pop,GA=V.loromovablelist_clear,YA=V.loromovablelist_getCreatorAt,JA=V.loromovablelist_getLastMoverAt,KA=V.loromovablelist_getLastEditorAt,XA=V.loromovablelist_isDeleted,ZA=V.loromovablelist_getShallowValue,QA=V.__wbg_lorotree_free,eT=V.lorotreenode___getClassname,tT=V.__wbg_lorotreenode_free,nT=V.lorotreenode_id,oT=V.lorotreenode_createNode,rT=V.lorotreenode_move,sT=V.lorotreenode_moveAfter,iT=V.lorotreenode_moveBefore,aT=V.lorotreenode_index,lT=V.lorotreenode_fractionalIndex,cT=V.lorotreenode_data,dT=V.lorotreenode_toJSON,uT=V.lorotreenode_parent,hT=V.lorotreenode_children,fT=V.lorotreenode_isDeleted,mT=V.lorotreenode_getLastMoveId,pT=V.lorotreenode_creationId,gT=V.lorotreenode_creator,_T=V.lorotree_new,bT=V.lorotree_kind,xT=V.lorotree_createNode,yT=V.lorotree_move,wT=V.lorotree_delete,vT=V.lorotree_getNodeByID,kT=V.lorotree_id,ST=V.lorotree_has,CT=V.lorotree_isNodeDeleted,NT=V.lorotree_toArray,jT=V.lorotree_getNodes,ET=V.lorotree_toJSON,IT=V.lorotree_nodes,AT=V.lorotree_roots,TT=V.lorotree_subscribe,MT=V.lorotree_parent,OT=V.lorotree_isAttached,DT=V.lorotree_getAttached,RT=V.lorotree_enableFractionalIndex,PT=V.lorotree_disableFractionalIndex,LT=V.lorotree_isFractionalIndexEnabled,FT=V.lorotree_isDeleted,zT=V.lorotree_getShallowValue,BT=V.__wbg_cursor_free,UT=V.cursor_containerId,VT=V.cursor_pos,$T=V.cursor_side,HT=V.cursor_encode,WT=V.cursor_decode,qT=V.cursor_kind,GT=V.__wbg_undomanager_free,YT=V.undomanager_new,JT=V.undomanager_undo,KT=V.undomanager_redo,XT=V.undomanager_groupStart,ZT=V.undomanager_groupEnd,QT=V.undomanager_canUndo,e7=V.undomanager_canRedo,t7=V.undomanager_setMaxUndoSteps,n7=V.undomanager_setMergeInterval,o7=V.undomanager_addExcludeOriginPrefix,r7=V.undomanager_setOnPush,s7=V.undomanager_setOnPop,i7=V.undomanager_clear,a7=V.__wbg_versionvector_free,l7=V.versionvector_new,c7=V.versionvector_parseJSON,d7=V.versionvector_toJSON,u7=V.versionvector_encode,h7=V.versionvector_decode,f7=V.versionvector_get,m7=V.versionvector_compare,p7=V.versionvector_setEnd,g7=V.versionvector_setLast,_7=V.versionvector_remove,b7=V.versionvector_length,x7=V.decodeImportBlobMeta,y7=V.__wbg_changemodifier_free,w7=V.changemodifier_setMessage,v7=V.changemodifier_setTimestamp,k7=V.redactJsonUpdates,S7=V.lorodoc_importUpdateBatch,C7=V.__wbg_loromovablelist_free,N7=V.__wbindgen_export_0,j7=V.__wbindgen_export_1,E7=V.__wbindgen_export_2,I7=V.__wbindgen_export_3,A7=V.__wbindgen_export_4,T7=V.__wbindgen_add_to_stack_pointer,M7=V.__wbindgen_export_5,O7=V.__wbindgen_export_6,Au=V.__wbindgen_start,Ax=Object.freeze(Object.defineProperty({__proto__:null,LORO_VERSION:E6,__wbg_awarenesswasm_free:e6,__wbg_changemodifier_free:y7,__wbg_cursor_free:BT,__wbg_ephemeralstorewasm_free:m6,__wbg_lorocounter_free:V5,__wbg_lorodoc_free:O6,__wbg_lorolist_free:oA,__wbg_loromap_free:R8,__wbg_loromovablelist_free:C7,__wbg_lorotext_free:s8,__wbg_lorotree_free:QA,__wbg_lorotreenode_free:tT,__wbg_undomanager_free:GT,__wbg_versionvector_free:a7,__wbindgen_add_to_stack_pointer:T7,__wbindgen_export_0:N7,__wbindgen_export_1:j7,__wbindgen_export_2:E7,__wbindgen_export_3:I7,__wbindgen_export_4:A7,__wbindgen_export_5:M7,__wbindgen_export_6:O7,__wbindgen_start:Au,awarenesswasm_apply:r6,awarenesswasm_encode:n6,awarenesswasm_encodeAll:o6,awarenesswasm_getAllStates:a6,awarenesswasm_getState:l6,awarenesswasm_getTimestamp:c6,awarenesswasm_isEmpty:h6,awarenesswasm_length:u6,awarenesswasm_new:t6,awarenesswasm_peer:i6,awarenesswasm_peers:f6,awarenesswasm_removeOutdated:d6,awarenesswasm_setLocalState:s6,changemodifier_setMessage:w7,changemodifier_setTimestamp:v7,cursor_containerId:UT,cursor_decode:WT,cursor_encode:HT,cursor_kind:qT,cursor_pos:VT,cursor_side:$T,decodeFrontiers:T6,decodeImportBlobMeta:x7,encodeFrontiers:A6,ephemeralstorewasm_apply:S6,ephemeralstorewasm_delete:_6,ephemeralstorewasm_encode:v6,ephemeralstorewasm_encodeAll:k6,ephemeralstorewasm_get:b6,ephemeralstorewasm_getAllStates:x6,ephemeralstorewasm_isEmpty:N6,ephemeralstorewasm_keys:j6,ephemeralstorewasm_new:p6,ephemeralstorewasm_removeOutdated:C6,ephemeralstorewasm_set:g6,ephemeralstorewasm_subscribe:w6,ephemeralstorewasm_subscribeLocalUpdates:y6,lorocounter_decrement:G5,lorocounter_getAttached:Z5,lorocounter_getShallowValue:Q5,lorocounter_id:W5,lorocounter_increment:q5,lorocounter_isAttached:X5,lorocounter_kind:H5,lorocounter_new:$5,lorocounter_parent:K5,lorocounter_subscribe:J5,lorocounter_value:Y5,lorodoc_JSONPath:_I,lorodoc_applyDiff:ZI,lorodoc_attach:V6,lorodoc_changeCount:BI,lorodoc_checkout:K6,lorodoc_checkoutToLatest:G6,lorodoc_clearNextCommitOptions:mI,lorodoc_cmpFrontiers:NI,lorodoc_cmpWithFrontiers:CI,lorodoc_commit:eI,lorodoc_configDefaultTextStyle:B6,lorodoc_configTextStyle:z6,lorodoc_debugHistory:zI,lorodoc_deleteRootContainer:o8,lorodoc_detach:H6,lorodoc_diff:QI,lorodoc_export:II,lorodoc_exportFrom:EI,lorodoc_exportJsonInIdSpan:TI,lorodoc_exportJsonUpdates:AI,lorodoc_exportSnapshot:jI,lorodoc_findIdSpansBetween:J6,lorodoc_fork:W6,lorodoc_forkAt:q6,lorodoc_fromSnapshot:U6,lorodoc_frontiers:kI,lorodoc_frontiersToVV:qI,lorodoc_getAllChanges:VI,lorodoc_getByPath:YI,lorodoc_getChangeAt:$I,lorodoc_getChangeAtLamport:HI,lorodoc_getChangedContainersIn:KI,lorodoc_getContainerById:cI,lorodoc_getCounter:iI,lorodoc_getCursorPos:JI,lorodoc_getDeepValueWithID:pI,lorodoc_getList:rI,lorodoc_getMap:oI,lorodoc_getMovableList:sI,lorodoc_getOpsInChange:WI,lorodoc_getPathToContainer:gI,lorodoc_getPendingTxnLength:tI,lorodoc_getShallowValue:RI,lorodoc_getText:nI,lorodoc_getTree:aI,lorodoc_getUncommittedOpsAsJson:e8,lorodoc_hasContainer:lI,lorodoc_import:OI,lorodoc_importBatch:DI,lorodoc_importJsonUpdates:MI,lorodoc_importUpdateBatch:S7,lorodoc_isDetached:$6,lorodoc_isDetachedEditingEnabled:P6,lorodoc_isShallow:yI,lorodoc_new:D6,lorodoc_opCount:UI,lorodoc_oplogFrontiers:SI,lorodoc_oplogVersion:vI,lorodoc_peerId:X6,lorodoc_peerIdStr:Z6,lorodoc_revertTo:XI,lorodoc_setChangeMergeInterval:F6,lorodoc_setDetachedEditing:R6,lorodoc_setHideEmptyRootContainers:r8,lorodoc_setNextCommitMessage:dI,lorodoc_setNextCommitOptions:fI,lorodoc_setNextCommitOrigin:uI,lorodoc_setNextCommitTimestamp:hI,lorodoc_setPeerId:Q6,lorodoc_setRecordTimestamp:L6,lorodoc_shallowSinceFrontiers:wI,lorodoc_shallowSinceVV:xI,lorodoc_subscribe:LI,lorodoc_subscribeFirstCommitFromPeer:t8,lorodoc_subscribeLocalUpdates:FI,lorodoc_subscribePreCommit:n8,lorodoc_toJSON:PI,lorodoc_travelChangeAncestors:Y6,lorodoc_version:bI,lorodoc_vvToFrontiers:GI,lorolist_clear:vA,lorolist_delete:aA,lorolist_get:lA,lorolist_getAttached:bA,lorolist_getCursor:xA,lorolist_getIdAt:kA,lorolist_getShallowValue:CA,lorolist_id:cA,lorolist_insert:iA,lorolist_insertContainer:hA,lorolist_isAttached:_A,lorolist_isDeleted:SA,lorolist_kind:sA,lorolist_length:pA,lorolist_new:rA,lorolist_parent:gA,lorolist_pop:wA,lorolist_push:yA,lorolist_pushContainer:fA,lorolist_subscribe:mA,lorolist_toArray:dA,lorolist_toJSON:uA,loromap_clear:Q8,loromap_delete:z8,loromap_entries:H8,loromap_get:B8,loromap_getAttached:Z8,loromap_getLastEditor:eA,loromap_getOrCreateContainer:U8,loromap_getShallowValue:nA,loromap_id:W8,loromap_isAttached:X8,loromap_isDeleted:tA,loromap_keys:V8,loromap_kind:L8,loromap_new:P8,loromap_parent:K8,loromap_set:F8,loromap_setContainer:G8,loromap_size:J8,loromap_subscribe:Y8,loromap_toJSON:q8,loromap_values:$8,loromovablelist_clear:GA,loromovablelist_delete:IA,loromovablelist_get:AA,loromovablelist_getAttached:BA,loromovablelist_getCreatorAt:YA,loromovablelist_getCursor:UA,loromovablelist_getLastEditorAt:KA,loromovablelist_getLastMoverAt:JA,loromovablelist_getShallowValue:ZA,loromovablelist_id:TA,loromovablelist_insert:EA,loromovablelist_insertContainer:DA,loromovablelist_isAttached:zA,loromovablelist_isDeleted:XA,loromovablelist_kind:jA,loromovablelist_length:LA,loromovablelist_move:VA,loromovablelist_new:NA,loromovablelist_parent:FA,loromovablelist_pop:qA,loromovablelist_push:WA,loromovablelist_pushContainer:RA,loromovablelist_set:$A,loromovablelist_setContainer:HA,loromovablelist_subscribe:PA,loromovablelist_toArray:MA,loromovablelist_toJSON:OA,lorotext_applyDelta:C8,lorotext_charAt:f8,lorotext_delete:g8,lorotext_deleteUtf8:_8,lorotext_getAttached:E8,lorotext_getCursor:I8,lorotext_getEditorOf:T8,lorotext_getShallowValue:O8,lorotext_id:v8,lorotext_insert:u8,lorotext_insertUtf8:p8,lorotext_isAttached:j8,lorotext_isDeleted:M8,lorotext_iter:l8,lorotext_kind:a8,lorotext_length:k8,lorotext_mark:b8,lorotext_new:i8,lorotext_parent:N8,lorotext_push:A8,lorotext_slice:h8,lorotext_splice:m8,lorotext_subscribe:S8,lorotext_toDelta:w8,lorotext_toJSON:D8,lorotext_toString:y8,lorotext_unmark:x8,lorotext_update:c8,lorotext_updateByLine:d8,lorotree_createNode:xT,lorotree_delete:wT,lorotree_disableFractionalIndex:PT,lorotree_enableFractionalIndex:RT,lorotree_getAttached:DT,lorotree_getNodeByID:vT,lorotree_getNodes:jT,lorotree_getShallowValue:zT,lorotree_has:ST,lorotree_id:kT,lorotree_isAttached:OT,lorotree_isDeleted:FT,lorotree_isFractionalIndexEnabled:LT,lorotree_isNodeDeleted:CT,lorotree_kind:bT,lorotree_move:yT,lorotree_new:_T,lorotree_nodes:IT,lorotree_parent:MT,lorotree_roots:AT,lorotree_subscribe:TT,lorotree_toArray:NT,lorotree_toJSON:ET,lorotreenode___getClassname:eT,lorotreenode_children:hT,lorotreenode_createNode:oT,lorotreenode_creationId:pT,lorotreenode_creator:gT,lorotreenode_data:cT,lorotreenode_fractionalIndex:lT,lorotreenode_getLastMoveId:mT,lorotreenode_id:nT,lorotreenode_index:aT,lorotreenode_isDeleted:fT,lorotreenode_move:rT,lorotreenode_moveAfter:sT,lorotreenode_moveBefore:iT,lorotreenode_parent:uT,lorotreenode_toJSON:dT,memory:U5,redactJsonUpdates:k7,run:I6,setDebug:M6,undomanager_addExcludeOriginPrefix:o7,undomanager_canRedo:e7,undomanager_canUndo:QT,undomanager_clear:i7,undomanager_groupEnd:ZT,undomanager_groupStart:XT,undomanager_new:YT,undomanager_redo:KT,undomanager_setMaxUndoSteps:t7,undomanager_setMergeInterval:n7,undomanager_setOnPop:s7,undomanager_setOnPush:r7,undomanager_undo:JT,versionvector_compare:m7,versionvector_decode:h7,versionvector_encode:u7,versionvector_get:f7,versionvector_length:b7,versionvector_new:l7,versionvector_parseJSON:c7,versionvector_remove:_7,versionvector_setEnd:p7,versionvector_setLast:g7,versionvector_toJSON:d7},Symbol.toStringTag,{value:"Module"}));if(Au)yu(Ax),Au();else{const t=await Dm(()=>Promise.resolve().then(()=>Ax),void 0,import.meta.url);yu(new WebAssembly.Instance(t.default,{"./loro_wasm_bg.js":B5}).exports)}const D7=["Map","Text","List","Tree","MovableList","Counter"];function Tx(t){if(typeof t!="object"||t==null)return!1;const e=Object.getPrototypeOf(t);return e!=null&&typeof e=="object"&&typeof e.kind=="function"&&D7.includes(t.kind())}bo.prototype.toJsonWithReplacer=function(t){const e=new Set,n=this,o=(i,a)=>{if(typeof a=="string"&&a.startsWith("cid:")&&!e.has(a)){e.add(a);const c=n.getContainerById(a);if(c==null)throw new Error(`ContainerID not found: ${a}`);const u=t(i,c);if(u===c){const h=c.getShallowValue();return typeof h=="object"?r(h):h}if(Tx(u))throw new Error("Using new container is not allowed in toJsonWithReplacer");return typeof u=="object"&&u!=null?r(u):u}if(typeof a=="object"&&a!=null)return r(a);const l=t(i,a);if(Tx(l))throw new Error("Using new container is not allowed in toJsonWithReplacer");return l},r=i=>{if(Array.isArray(i))return i.map((l,c)=>o(c,l)).filter(l=>l!==void 0);const a={};for(const[l,c]of Object.entries(i)){const u=o(l,c);u!==void 0&&(a[l]=u)}return a},s=n.getShallowValue();return r(s)};const R7=et.baseTheme({".loro-cursor":{position:"absolute",width:"2px",display:"inline-block",height:"1.2em"},".loro-cursor::before":{position:"absolute",top:"1.3em",left:"0",content:"var(--rtc-name)",padding:"2px 6px",fontSize:"12px",borderRadius:"3px",whiteSpace:"nowrap",userSelect:"none",backgroundColor:"inherit",opacity:"0.7"},".loro-selection":{opacity:"0.5"}}),ki=Mt.define(),Tu=jn.define({create:()=>({remoteCursors:new Map,isCheckout:!1}),update(t,e){for(const n of e.effects)if(n.is(ki))switch(n.value.type){case"update":{const{peer:o,user:r,cursor:s}=n.value;t.remoteCursors.set(o,{uid:o,cursor:s,user:r});break}case"delete":t.remoteCursors.delete(n.value.peer);break;case"checkout":t.isCheckout=n.value.checkout}return t}}),Mx=t=>{const e=t.transactions.flatMap(n=>n.effects).filter(n=>n.is(ki));return t.docChanged||t.viewportChanged||e.length>0};class hl{constructor(e,n,o,r,s){this.left=e,this.top=n,this.height=o,this.name=r,this.colorClassName=s}draw(){const e=document.createElement("div");return this.adjust(e),e}update(e){return this.adjust(e),!0}adjust(e){e.style.left=`${this.left}px`,e.style.top=`${this.top}px`,e.style.height=`${this.height}px`,e.className=`loro-cursor ${this.colorClassName}`,e.style.setProperty("--rtc-name",`"${this.name}"`)}eq(e){return this.left===e.left&&this.top===e.top&&this.height===e.height&&this.name===e.name}static createCursor(e,n,o,r){const s=hl.calculateAbsoluteCursorPosition(n,e);if(!s)return[];const i=e.scrollDOM.getBoundingClientRect(),a=(e.textDirection===lV.LTR?i.left:i.right-e.scrollDOM.clientWidth)-e.scrollDOM.scrollLeft,l=i.top-e.scrollDOM.scrollTop;return[new hl(s.left-a,s.top-l,s.bottom-s.top,o,r)]}static calculateAbsoluteCursorPosition(e,n){const o=Math.max(0,Math.min(n.state.doc.length,e.anchor));return n.coordsAtPos(o,e.assoc||1)}}const P7=(t,e,n,o)=>{const r=[],{updated:s,added:i}=n;for(const a of[...s,...i]){const l=Ox(t,e,a,o);l&&r.push(l)}return r},Ox=(t,e,n,o)=>{const r=e.getAllStates()[n];if(!r||n===t.peerIdStr||r.scopeId!==o)return;if(r.type==="delete")return ki.of({type:"delete",peer:r.uid,scopeId:r.scopeId});const s=Kn.decode(r.cursor.anchor),i=t.getCursorPos(s).offset;let a=i;if(r.cursor.head){const l=Kn.decode(r.cursor.head);a=t.getCursorPos(l).offset}return ki.of({type:"update",peer:r.uid,scopeId:r.scopeId,cursor:{anchor:i,head:a},user:r.user})};class L7{constructor(e,n,o,r,s,i,a){this.view=e,this.doc=n,this.user=o,this.awareness=r,this.getTextFromDoc=s,this.scopeId=i,this.getUserId=a,this.sub=void 0,this.sub=this.doc.subscribe(l=>{if(l.by==="local"){const c=[];for(const u of this.awareness.peers()){const h=Ox(this.doc,this.awareness,u,this.scopeId);h&&c.push(h)}this.view.dispatch({effects:c})}else l.by==="checkout"&&this.view.dispatch({effects:[ki.of({type:"checkout",checkout:this.doc.isDetached()})]})})}update(e){if(!e.selectionSet&&!e.focusChanged&&!e.docChanged)return;const n=e.state.selection.main;if(this.view.hasFocus&&!this.doc.isDetached()){const o=z7(this.doc,this.getTextFromDoc,n.anchor,n.head);this.awareness.setLocalState({type:"update",uid:this.getUserId?this.getUserId():this.doc.peerIdStr,scopeId:this.scopeId,cursor:o,user:this.user})}else this.awareness.setLocalState({type:"delete",uid:this.getUserId?this.getUserId():this.doc.peerIdStr,scopeId:this.scopeId})}destroy(){var e;(e=this.sub)==null||e.call(this),this.awareness.setLocalState({type:"delete",uid:this.getUserId?this.getUserId():this.doc.peerIdStr,scopeId:this.scopeId})}}class F7{constructor(e,n,o,r){this.view=e,this.doc=n,this.awareness=o,this.scopeId=r,this._awarenessListener=void 0;const s=async(i,a)=>{a!=="local"&&this.view.dispatch({effects:P7(this.doc,this.awareness,i,this.scopeId)})};this._awarenessListener=s,this.awareness.addListener(s)}destroy(){this._awarenessListener&&this.awareness.removeListener(this._awarenessListener)}}const z7=(t,e,n,o)=>{var i,a;n===o&&(o=void 0);const r=(i=e(t).getCursor(n))==null?void 0:i.encode();if(!r)throw new Error("cursor head not found");let s;return o!==void 0&&(s=(a=e(t).getCursor(o))==null?void 0:a.encode()),{anchor:r,head:s}},fl=["bg-[var(--amber-6)]","bg-[var(--blue-6)]","bg-[var(--crimson-6)]","bg-[var(--cyan-6)]","bg-[var(--grass-6)]","bg-[var(--gray-6)]","bg-[var(--green-6)]","bg-[var(--lime-6)]","bg-[var(--orange-6)]","bg-[var(--purple-6)]","bg-[var(--red-6)]","bg-[var(--sage-6)]","bg-[var(--sky-6)]","bg-[var(--slate-6)]"],B7=(t,e,n)=>Nn.define(o=>new U7(o,t,e,n)),ns=Tm.define();class U7{constructor(e,n,o,r){this.view=e,this.doc=n,this.docPath=o,this.getTextFromDoc=r,this.sub=void 0,this.isInitDispatch=!1,this.onRemoteUpdate=s=>{if(s.by!=="local")if(s.by!=="checkout"){if(s.by==="import"){const i=[];let a=0;for(const{diff:l,path:c}of s.events){if(c.join("/")!==this.docPath.join("/")||l.type!=="text")continue;const u=l.diff;for(const h of u)h.insert?i.push({from:a,to:a,insert:h.insert}):h.delete?(i.push({from:a,to:a+h.delete}),a+=h.delete):h.retain!=null&&(a+=h.retain);i.length>0&&this.view.dispatch({changes:i,annotations:[ns.of(this)]})}}}else this.view.dispatch({changes:[{from:0,to:this.view.state.doc.length,insert:this.getTextFromDoc(this.doc).toString()}],annotations:[ns.of(this)]})},this.sub=n.subscribe(this.onRemoteUpdate),Promise.resolve().then(()=>{this.isInitDispatch=!0;const s=this.view.state.doc.toString(),i=this.getTextFromDoc(this.doc);s!==i.toString()&&e.dispatch({changes:[{from:0,to:this.view.state.doc.length,insert:i.toString()}]})})}update(e){if(this.isInitDispatch)return void(this.isInitDispatch=!1);if(!e.docChanged||e.transactions.length>0&&(e.transactions[0].annotation(ns)===this||e.transactions[0].annotation(ns)==="undo"))return;let n=0;e.changes.iterChanges((o,r,s,i,a)=>{const l=a.sliceString(0,a.length,`
|
120
|
-
`);o!==r&&this.getTextFromDoc(this.doc).delete(o+n,r-o),l.length>0&&this.getTextFromDoc(this.doc).insert(o+n,l),n+=l.length-(r-o)}),this.doc.commit()}destroy(){var e;(e=this.sub)==null||e.call(this),this.sub=void 0}}const cn=St.get("rtc"),Dx=cn.get("awareness").disabled(),Mu="awareness:",os=qt(void 0),$t=new bo,ml=new class{constructor(t,e=3e4){this.listeners=new Set,this.inner=new k0(t,e),this.peer=t,this.timeout=e}apply(t,e="remote"){const{updated:n,added:o}=this.inner.apply(t);this.listeners.forEach(r=>{r({updated:n,added:o,removed:[]},e)}),this.startTimerIfNotEmpty()}setLocalState(t){const e=this.inner.getState(this.peer)==null;this.inner.setLocalState(t),e?this.listeners.forEach(n=>{n({updated:[],added:[this.inner.peer()],removed:[]},"local")}):this.listeners.forEach(n=>{n({updated:[this.inner.peer()],added:[],removed:[]},"local")}),this.startTimerIfNotEmpty()}getLocalState(){return this.inner.getState(this.peer)}getAllStates(){return this.inner.getAllStates()}encode(t){return this.inner.encode(t)}encodeAll(){return this.inner.encodeAll()}addListener(t){this.listeners.add(t)}removeListener(t){this.listeners.delete(t)}peers(){return this.inner.peers()}destroy(){clearInterval(this.timer),this.listeners.clear()}startTimerIfNotEmpty(){this.inner.isEmpty()||this.timer!=null||(this.timer=setInterval(()=>{const t=this.inner.removeOutdated();t.length>0&&this.listeners.forEach(e=>{e({updated:[],added:[],removed:t},"timeout")}),this.inner.isEmpty()&&(clearInterval(this.timer),this.timer=void 0)},this.timeout/2))}}($t.peerIdStr),Ou=dV(()=>{cn.debug("creating websocket");const t=v4().getWsSyncURL(R4()).toString(),e=new FH(t,void 0,{maxRetries:10,debug:!1,startClosed:!0,connectionTimeout:1e4});return Promise.resolve().then(async()=>{await k4(),uV()==="edit"&&e.reconnect()}),e.addEventListener("message",async n=>{const o=n.data,r=await o.arrayBuffer(),s=new Uint8Array(r);if(function(i,a){return new TextDecoder().decode(i.slice(0,a.length))===a}(s,Mu)){const i=function(a,l){return a.slice(l.length)}(s,Mu);return ml.apply(i),void Dx.debug("applied awareness update")}$t.import(s),cn.debug("imported doc change. new doc:",$t.toJSON()),lt.get(os)!==$t&<.set(os,$t)}),e.addEventListener("open",()=>{cn.debug("websocket open")}),e.addEventListener("close",n=>{cn.warn("websocket close",n),lt.get(os)===$t&<.set(os,void 0)}),e});function Du(t,e,n=""){if(un())return{extension:[],code:n};const o=$t.getByPath(`codes/${t}`)!==void 0,r=$t.getMap("codes").getOrCreateContainer(t,new Jo);o||(cn.log("initializing code for new cell",n),r.insert(0,n));const s={get name(){return lt.get(P4)||"Anonymous"},get colorClassName(){return(i=>{if(typeof i=="string"){let a=0;for(let l=0;l<i.length;l++)a=(a<<5)-a+i.charCodeAt(l),a=Math.trunc(a);return fl[Math.abs(a)%fl.length]}return fl[i%fl.length]})(this.name)}};return{code:n.toString(),extension:[V7(t),$7(t),H7($t,ml,s,()=>r,t),B7($t,["codes",t],()=>r)]}}function V7(t){const e=(o,r)=>{const s=o.state.field(Ec).type,i=r.toString();i&&i!==s&&(cn.debug(`[incoming] setting language type: ${s} -> ${i}`),Ar(o,i,{keepCodeAsIs:!0}))},n=(o,r)=>{const s=o.state.field(Pm),i=r.toJSON();ea(s,i)||o.dispatch({effects:[O4.of(i)],annotations:[ns.of(!0)]})};return Nn.define(o=>{let r;return Promise.resolve().then(()=>{const s=$t.getByPath(`languages/${t}`);if(!s)return void cn.error("no language container found for cell",t);Fo(s instanceof Jo,"language type is not a LoroText");const i=$t.getByPath(`language_metadata/${t}`);i?(Fo(i instanceof Yo,"language metadata is not a LoroMap"),e(o,s),n(o,i),r=$t.subscribe(a=>{if(a.origin==="local")return;const l=a.events.some(u=>u.target===s.id),c=a.events.some(u=>u.target===i.id);l&&e(o,s),c&&n(o,i)})):cn.error("no language metadata container found for cell",t)}),{destroy(){r()}}})}function $7(t){const e=$t.getMap("languages").getOrCreateContainer(t,new Jo),n=$t.getMap("language_metadata").getOrCreateContainer(t,new Yo);return et.updateListener.of(o=>{const r=e.toString()!=="";if(!o.docChanged&&r)return;if(!r){const i=Rm(o.state).type;Ar(o.view,i),cn.debug("no initial language, setting default to",i),e.delete(0,e.length),e.insert(0,i),cn.debug("no initial language metadata, setting default to",o.state.field(Pm));const a=o.state.field(Pm);for(const l of Object.keys(a))n.set(l,a[l]);return void $t.commit()}let s=!1;for(const i of o.transactions)if(!i.annotation(ns)){for(const a of i.effects)if(a.is(cV)&&e.toString()!==a.value.type&&(cn.debug(`[outgoing] language change: ${e} -> ${a.value.type}`),e.delete(0,e.length),e.insert(0,a.value.type),s=!0),a.is(O4)||a.is(D4)){const l=a.value;a.is(D4)?(cn.debug("[outgoing] setting language metadata: ",l),n.clear()):cn.debug("[outgoing] updating language metadata: ",l);for(const c of Object.keys(l))n.set(c,l[c]);s=!0}}s&&$t.commit()})}function H7(t,e,n,o,r,s){const i=`loro:cell:${r}`;return[Tu,M4({above:!0,class:"loro-cursor-layer",update:Mx,markers:a=>{const{remoteCursors:l,isCheckout:c}=a.state.field(Tu);return c?[]:[...l.values()].flatMap(u=>{var f,m;const h=zo.cursor(u.cursor.anchor);return hl.createCursor(a,h,((f=u.user)==null?void 0:f.name)||"unknown",((m=u.user)==null?void 0:m.colorClassName)||"")})}}),M4({above:!1,class:"loro-selection-layer",update:Mx,markers:a=>{const{remoteCursors:l,isCheckout:c}=a.state.field(Tu);return c?[]:[...l.entries()].filter(([,u])=>u.cursor.head!==void 0&&u.cursor.anchor!==u.cursor.head).flatMap(([,u])=>{var f;const h=zo.range(u.cursor.anchor,u.cursor.head);return aV.forRange(a,`loro-selection ${((f=u.user)==null?void 0:f.colorClassName)||""}`,h)})}}),Nn.define(a=>new L7(a,t,n,e,o,i,s)),Nn.define(a=>new F7(a,t,e,i)),R7]}function pl(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}Mc()&&Ou(),$t.subscribeLocalUpdates(t=>{cn.debug("local update, sending to server"),Ou().send(t)}),ml.addListener((t,e)=>{const n=[...t.added,...t.removed,...t.updated];e==="local"&&(Dx.debug("awareness changes",n),Ou().send(function(o,r){const s=new TextEncoder().encode(o);return new Uint8Array([...s,...r])}(Mu,ml.encode(n))))});var Rx={modified:{doc:""},original:{doc:""}},Px=M.createContext(Rx);function W7(t,e){return Nt({},t,e,{modified:Nt({},t.modified,e.modified),original:Nt({},t.original,e.original)})}var Ru=()=>M.useContext(Px),q7=t=>{var{children:e,theme:n}=t,[o,r]=M.useReducer(W7,Nt({},Rx,{theme:n}));return M.useEffect(()=>r({theme:n}),[n]),d.jsx(Px.Provider,{value:Nt({},o,{dispatch:r}),children:e})},G7=["extensions","value","selection","onChange"],Lx=t=>{var{extensions:e=[],value:n,selection:o,onChange:r}=t,s=da(t,G7),{theme:i,dispatch:a}=Ru(),l=$s(Nt({},s,{theme:i}));return M.useEffect(()=>a({original:{doc:n,selection:o,extensions:[...l,...e]},originalExtension:{onChange:r,option:s,extension:[e]}}),[t]),null};Lx.displayName="CodeMirrorMerge.Original";var Y7=["extensions","value","selection","onChange"],Fx=t=>{var{extensions:e=[],value:n,selection:o,onChange:r}=t,s=da(t,Y7),{theme:i,dispatch:a}=Ru(),l=$s(Nt({},s,{theme:i}));return M.useEffect(()=>{a({modified:{doc:n,selection:o,extensions:[...l,...e]},modifiedExtension:{onChange:r,option:s,extension:[e]}})},[t]),null};Fx.displayName="CodeMirrorMerge.Modified";class At{constructor(e,n,o,r){this.fromA=e,this.toA=n,this.fromB=o,this.toB=r}offset(e,n){return new At(this.fromA+e,this.toA+e,this.fromB+n,this.toB+n)}}function Sr(t,e,n,o,r,s){if(t==o)return[];let i=Fu(t,e,n,o,r,s),a=zu(t,e+i,n,o,r+i,s),l=(n-=a)-(e+=i),c=(s-=a)-(r+=i);if(!l||!c)return[new At(e,n,r,s)];if(l>c){let h=t.slice(e,n).indexOf(o.slice(r,s));if(h>-1)return[new At(e,e+h,r,r),new At(e+h+c,n,s,s)]}else if(c>l){let h=o.slice(r,s).indexOf(t.slice(e,n));if(h>-1)return[new At(e,e,r,r+h),new At(n,n,r+h+l,s)]}if(l==1||c==1)return[new At(e,n,r,s)];let u=Ux(t,e,n,o,r,s);if(u){let[h,f,m]=u;return Sr(t,e,h,o,r,f).concat(Sr(t,h+m,n,o,f+m,s))}return function(h,f,m,_,g,p){let b=m-f,x=p-g;if(Si<1e9&&Math.min(b,x)>16*Si)return Math.min(b,x)>64*Si?[new At(f,m,g,p)]:Vx(h,f,m,_,g,p);let y=Math.ceil((b+x)/2);Pu.reset(y),Lu.reset(y);let v=(j,I)=>h.charCodeAt(f+j)==_.charCodeAt(g+I),C=(j,I)=>h.charCodeAt(m-j-1)==_.charCodeAt(p-I-1),k=(b-x)%2!=0?Lu:null,N=k?null:Pu;for(let j=0;j<y;j++){if(j>Si)return Vx(h,f,m,_,g,p);let I=Pu.advance(j,b,x,y,k,!1,v)||Lu.advance(j,b,x,y,N,!0,C);if(I)return J7(h,f,m,f+I[0],_,g,p,g+I[1])}return[new At(f,m,g,p)]}(t,e,n,o,r,s)}let Si=1e9;class zx{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let n=0;n<this.len;n++)this.vec[n]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,n,o,r,s,i,a){for(let l=-e+this.start;l<=e-this.end;l+=2){let c=r+l,u=l==-e||l!=e&&this.vec[c-1]<this.vec[c+1]?this.vec[c+1]:this.vec[c-1]+1,h=u-l;for(;u<n&&h<o&&a(u,h);)u++,h++;if(this.vec[c]=u,u>n)this.end+=2;else if(h>o)this.start+=2;else if(s){let f=r+(n-o)-l;if(f>=0&&f<this.len&&s.vec[f]!=-1){if(i){let m=s.vec[f];if(m>=n-u)return[m,r+m-f]}else if(u>=n-s.vec[f])return[u,h]}}}return null}}const Pu=new zx,Lu=new zx;function J7(t,e,n,o,r,s,i,a){let l=!1;return rs(t,o)||++o!=n||(l=!0),rs(r,a)||++a!=i||(l=!0),l?[new At(e,n,s,i)]:Sr(t,e,o,r,s,a).concat(Sr(t,o,n,r,a,i))}function Bx(t,e){let n=1,o=Math.min(t,e);for(;n<o;)n<<=1;return n}function Fu(t,e,n,o,r,s){if(e==n||e==s||t.charCodeAt(e)!=o.charCodeAt(r))return 0;let i=Bx(n-e,s-r);for(let a=e,l=r;;){let c=a+i,u=l+i;if(c>n||u>s||t.slice(a,c)!=o.slice(l,u)){if(i==1)return a-e-(rs(t,a)?0:1);i>>=1}else{if(c==n||u==s)return c-e;a=c,l=u}}}function zu(t,e,n,o,r,s){if(e==n||r==s||t.charCodeAt(n-1)!=o.charCodeAt(s-1))return 0;let i=Bx(n-e,s-r);for(let a=n,l=s;;){let c=a-i,u=l-i;if(c<e||u<r||t.slice(c,a)!=o.slice(u,l)){if(i==1)return n-a-(rs(t,a)?0:1);i>>=1}else{if(c==e||u==r)return n-c;a=c,l=u}}}function Bu(t,e,n,o,r,s,i,a){let l=o.slice(r,s),c=null;for(;;){if(c||i<a)return c;for(let u=e+i;;){rs(t,u)||u++;let h=u+i;if(rs(t,h)||(h+=h==u+1?1:-1),h>=n)break;let f=t.slice(u,h),m=-1;for(;(m=l.indexOf(f,m+1))!=-1;){let _=Fu(t,h,n,o,r+m+f.length,s),g=zu(t,e,u,o,r,r+m),p=f.length+_+g;(!c||c[2]<p)&&(c=[u-g,r+m-g,p])}u=h}if(a<0)return c;i>>=1}}function Ux(t,e,n,o,r,s){let i=n-e,a=s-r;if(i<a){let l=Ux(o,r,s,t,e,n);return l&&[l[1],l[0],l[2]]}return i<4||2*a<i?null:Bu(t,e,n,o,r,s,Math.floor(i/4),-1)}function Vx(t,e,n,o,r,s){let i,a=n-e,l=s-r;if(a<l){let f=Bu(o,r,s,t,e,n,Math.floor(a/6),50);i=f&&[f[1],f[0],f[2]]}else i=Bu(t,e,n,o,r,s,Math.floor(l/6),50);if(!i)return[new At(e,n,r,s)];let[c,u,h]=i;return Sr(t,e,c,o,r,u).concat(Sr(t,c+h,n,o,u+h,s))}function $x(t,e){for(let n=1;n<t.length;n++){let o=t[n-1],r=t[n];o.toA>r.fromA-e&&o.toB>r.fromB-e&&(t[n-1]=new At(o.fromA,r.toA,o.fromB,r.toB),t.splice(n--,1))}}let Cr;try{Cr=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch{}function Hx(t){return t>48&&t<58||t>64&&t<91||t>96&&t<123}function Wx(t,e){if(e==t.length)return 0;let n=t.charCodeAt(e);return n<192?Hx(n)?1:0:Cr?Jx(n)&&e!=t.length-1?Cr.test(t.slice(e,e+2))?2:0:Cr.test(String.fromCharCode(n))?1:0:0}function qx(t,e){if(!e)return 0;let n=t.charCodeAt(e-1);return n<192?Hx(n)?1:0:Cr?Kx(n)&&e!=1?Cr.test(t.slice(e-2,e))?2:0:Cr.test(String.fromCharCode(n))?1:0:0}function Gx(t,e,n){if(e==t.length||!qx(t,e))return e;for(let o=e,r=e+n;;){let s=Wx(t,o);if(!s)return o;if(o+=s,o>r)return e}}function Yx(t,e,n){if(!e||!Wx(t,e))return e;for(let o=e,r=e-n;;){let s=qx(t,o);if(!s)return o;if(o-=s,o<r)return e}}function K7(t,e,n){for(let o=e,r=e-n;;){let s=o?t.charCodeAt(o-1):10;if(s==10)return o;if(o--,o<r||s!=32&&s!=9)return e}}const Jx=t=>t>=55296&&t<=56319,Kx=t=>t>=56320&&t<=57343;function rs(t,e){return!e||e==t.length||!Jx(t.charCodeAt(e-1))||!Kx(t.charCodeAt(e))}function X7(t,e,n){var o;return Si=((o=n==null?void 0:n.scanLimit)!==null&&o!==void 0?o:1e9)>>1,function(r,s,i){for(;;){$x(i,1);let a=!1;for(let l=0;l<i.length;l++){let c,u,h=i[l];(c=Fu(r,h.fromA,h.toA,s,h.fromB,h.toB))&&(h=i[l]=new At(h.fromA+c,h.toA,h.fromB+c,h.toB)),(u=zu(r,h.fromA,h.toA,s,h.fromB,h.toB))&&(h=i[l]=new At(h.fromA,h.toA-u,h.fromB,h.toB-u));let f=h.toA-h.fromA,m=h.toB-h.fromB;if(f&&m)continue;let _=h.fromA-(l?i[l-1].toA:0),g=(l<i.length-1?i[l+1].fromA:r.length)-h.toA;if(!_||!g)continue;let p=f?r.slice(h.fromA,h.toA):s.slice(h.fromB,h.toB);_<=p.length&&r.slice(h.fromA-_,h.fromA)==p.slice(p.length-_)?(i[l]=new At(h.fromA-_,h.toA-_,h.fromB-_,h.toB-_),a=!0):g<=p.length&&r.slice(h.toA,h.toA+g)==p.slice(0,g)&&(i[l]=new At(h.fromA+g,h.toA+g,h.fromB+g,h.toB+g),a=!0)}if(!a)break}return i}(t,e,Sr(t,0,t.length,e,0,e.length))}function Xx(t,e,n){return function(o,r,s){for(let i=0,a=0;a<o.length;a++){let l=o[a],c=l.toA-l.fromA,u=l.toB-l.fromB;if(c&&u||c>3||u>3){let h=a==o.length-1?r.length:o[a+1].fromA,f=l.fromA-i,m=h-l.toA,_=Yx(r,l.fromA,Math.min(f,5)),g=Gx(r,l.toA,Math.min(m,5)),p=l.fromA-_,b=g-l.toA;if(!c||!u){let x,y,v=Math.max(c,u),[C,k,N]=c?[r,l.fromA,l.toA]:[s,l.fromB,l.toB];p&&b?(v>p&&r.slice(_,l.fromA)==C.slice(N-p,N)?(l=o[a]=new At(_,_+c,l.fromB-p,l.toB-p),_=l.fromA,g=Gx(r,l.toA,Math.min(h-l.toA,5))):v>b&&r.slice(l.toA,g)==C.slice(k,k+b)&&(l=o[a]=new At(g-c,g,l.fromB+b,l.toB+b),g=l.toA,_=Yx(r,l.fromA,Math.min(l.fromA-i,5))),p=l.fromA-_,b=g-l.toA):p||b||!(y=l.fromA-(x=K7(r,l.fromA,f)))||r.slice(x,l.fromA)!=C.slice(N-y,N)||(l=o[a]=new At(x,x+c,l.fromB-y,l.toB-y))}(p||b)&&(l=o[a]=new At(l.fromA-p,l.toA+b,l.fromB-p,l.toB+b)),i=l.toA}}return $x(o,3),o}(X7(t,e,n),t,e)}const so=zs.define({combine:t=>t[0]}),Uu=Mt.define(),ss=jn.define({create:t=>null,update(t,e){for(let n of e.effects)n.is(Uu)&&(t=n.value);return t}});class is{constructor(e,n,o,r,s){this.changes=e,this.fromA=n,this.toA=o,this.fromB=r,this.toB=s}offset(e,n){return e||n?new is(this.changes,this.fromA+e,this.toA+e,this.fromB+n,this.toB+n):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(e,n,o){return ey(Xx(e.toString(),n.toString(),o),e,n,0,0)}static updateA(e,n,o,r,s){return oy(ny(e,r,!0,o.length),e,n,o,s)}static updateB(e,n,o,r,s){return oy(ny(e,r,!1,n.length),e,n,o,s)}}function Zx(t,e,n,o){let r=n.lineAt(t),s=o.lineAt(e);return r.to==t&&s.to==e&&t<n.length&&e<o.length?[t+1,e+1]:[r.from,s.from]}function Qx(t,e,n,o){let r=n.lineAt(t),s=o.lineAt(e);return r.from==t&&s.from==e?[t,e]:[r.to+1,s.to+1]}function ey(t,e,n,o,r){let s=[];for(let i=0;i<t.length;i++){let a=t[i],[l,c]=Zx(a.fromA+o,a.fromB+r,e,n),[u,h]=Qx(a.toA+o,a.toB+r,e,n),f=[a.offset(-l+o,-c+r)];for(;i<t.length-1;){let m=t[i+1],[_,g]=Zx(m.fromA+o,m.fromB+r,e,n);if(_>u+1&&g>h+1)break;f.push(m.offset(-l+o,-c+r)),[u,h]=Qx(m.toA+o,m.toB+r,e,n),i++}s.push(new is(f,l,Math.max(l,u),c,Math.max(c,h)))}return s}const gl=1e3;function ty(t,e,n,o){let r=0,s=t.length;for(;;){if(r==s){let u=0,h=0;r&&({toA:u,toB:h}=t[r-1]);let f=e-(n?u:h);return[u+f,h+f]}let i=r+s>>1,a=t[i],[l,c]=n?[a.fromA,a.toA]:[a.fromB,a.toB];if(l>e)s=i;else{if(!(c<=e))return o?[a.fromA,a.fromB]:[a.toA,a.toB];r=i+1}}}function ny(t,e,n,o){let r=[];return e.iterChangedRanges((s,i,a,l)=>{let c=0,u=n?e.length:o,h=0,f=n?o:e.length;s>gl&&([c,h]=ty(t,s-gl,n,!0)),i<e.length-gl&&([u,f]=ty(t,i+gl,n,!1));let m,_=l-a-(i-s),[g,p]=n?[_,0]:[0,_];r.length&&(m=r[r.length-1]).toA>=c?r[r.length-1]={fromA:m.fromA,fromB:m.fromB,toA:u,toB:f,diffA:m.diffA+g,diffB:m.diffB+p}:r.push({fromA:c,toA:u,fromB:h,toB:f,diffA:g,diffB:p})}),r}function oy(t,e,n,o,r){if(!t.length)return e;let s=0,i=0,a=0,l=[];for(let c of t){let u=c.fromA+i,h=c.toA+i+c.diffA,f=c.fromB+a,m=c.toB+a+c.diffB;for(;s<e.length;){let _=e[s];if(_.toA+i<=u&&_.toB+a<=f)l.push(_.offset(i,a));else if(_.fromA+i>h)break;s++}for(let _ of ey(Xx(n.sliceString(u,h),o.sliceString(f,m),r),n,o,u,f))l.push(_);for(i+=c.diffA,a+=c.diffB;s<e.length;){let _=e[s];if(_.fromA>h+i&&_.fromB>m+a)break;s++}}for(;s<e.length;)l.push(e[s++].offset(i,a));return l}const ry=Nn.fromClass(class{constructor(t){({deco:this.deco,gutter:this.gutter}=ay(t))}update(t){var e,n;(t.docChanged||t.viewportChanged||(e=t.startState,n=t.state,e.field(ss,!1)!=n.field(ss,!1))||function(o,r){return o.facet(so)!=r.facet(so)}(t.startState,t.state))&&({deco:this.deco,gutter:this.gutter}=ay(t.view))}},{decorations:t=>t.deco}),_l=Uo.low(fV({class:"cm-changeGutter",markers:t=>{var e;return((e=t.plugin(ry))===null||e===void 0?void 0:e.gutter)||Lm.empty}})),sy=ct.line({class:"cm-changedLine"}),Z7=ct.mark({class:"cm-changedText"}),Q7=ct.mark({tagName:"ins",class:"cm-insertedLine"}),eM=ct.mark({tagName:"del",class:"cm-deletedLine"}),iy=new class extends mV{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function tM(t,e,n,o,r,s){let i=n?t.fromA:t.fromB,a=n?t.toA:t.toB,l=0;if(i!=a){r.add(i,i,sy),r.add(i,a,n?eM:Q7),s&&s.add(i,i,iy);for(let c=e.iterRange(i,a-1),u=i;!c.next().done;){if(c.lineBreak){u++,r.add(u,u,sy),s&&s.add(u,u,iy);continue}let h=u+c.value.length;if(o)for(;l<t.changes.length;){let f=t.changes[l],m=i+(n?f.fromA:f.fromB),_=i+(n?f.toA:f.toB),g=Math.max(u,m),p=Math.min(h,_);if(g<p&&r.add(g,p,Z7),!(_<h))break;l++}u=h}}}function ay(t){let e=t.state.field(ss),{side:n,highlightChanges:o,markGutter:r}=t.state.facet(so),s=n=="a",i=new Rs,a=r?new Rs:null,{from:l,to:c}=t.viewport;for(let u of e){if((s?u.fromA:u.fromB)>=c)break;(s?u.toA:u.toB)>l&&tM(u,t.state.doc,s,o,i,a)}return{deco:i.finish(),gutter:a&&a.finish()}}class bl extends Bs{constructor(e){super(),this.height=e}eq(e){return this.height==e.height}toDOM(){let e=document.createElement("div");return e.className="cm-mergeSpacer",e.style.height=this.height+"px",e}updateDOM(e){return e.style.height=this.height+"px",!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}const xl=Mt.define({map:(t,e)=>t.map(e)}),Ci=jn.define({create:()=>ct.none,update:(t,e)=>{for(let n of e.effects)if(n.is(xl))return n.value;return t.map(e.changes)},provide:t=>et.decorations.from(t)}),Vu=.01,$u=Mt.define({map:(t,e)=>e.mapPos(t)});class nM extends Bs{constructor(e){super(),this.lines=e}eq(e){return this.lines==e.lines}toDOM(e){let n=document.createElement("div");return n.className="cm-collapsedLines",n.textContent="\u299A "+e.state.phrase("$ unchanged lines",this.lines)+" \u299A",n.addEventListener("click",o=>{let r=e.posAtDOM(o.target);e.dispatch({effects:$u.of(r)});let{side:s,sibling:i}=e.state.facet(so);i&&i().dispatch({effects:$u.of(oM(r,e.state.field(ss),s=="a"))})}),n}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}}function oM(t,e,n){let o=0,r=0;for(let s=0;;s++){let i=s<e.length?e[s]:null;if(!i||(n?i.fromA:i.fromB)>=t)return r+(t-o);[o,r]=n?[i.toA,i.toB]:[i.toB,i.toA]}}const rM=jn.define({create:t=>ct.none,update(t,e){t=t.map(e.changes);for(let n of e.effects)n.is($u)&&(t=t.update({filter:o=>o!=n.value}));return t},provide:t=>et.decorations.from(t)});function ly({margin:t=3,minSize:e=4}){return rM.init(n=>function(o,r,s){let i=new Rs,a=o.facet(so).side=="a",l=o.field(ss),c=1;for(let u=0;;u++){let h=u<l.length?l[u]:null,f=u?c+r:1,m=h?o.doc.lineAt(a?h.fromA:h.fromB).number-1-r:o.doc.lines,_=m-f+1;if(_>=s&&i.add(o.doc.line(f).from,o.doc.line(m).to,ct.replace({widget:new nM(_),block:!0})),!h)break;c=o.doc.lineAt(Math.min(o.doc.length,a?h.toA:h.toB)).number}return i.finish()}(n,t,e))}const sM=et.styleModule.of(new hV({".cm-mergeView":{overflowY:"auto"},".cm-mergeViewEditors":{display:"flex",alignItems:"stretch"},".cm-mergeViewEditor":{flexGrow:1,flexBasis:0,overflow:"hidden"},".cm-merge-revert":{width:"1.6em",flexGrow:0,flexShrink:0,position:"relative"},".cm-merge-revert button":{position:"absolute",display:"block",width:"100%",boxSizing:"border-box",textAlign:"center",background:"none",border:"none",font:"inherit",cursor:"pointer"}})),iM=et.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:"auto !important",overflowY:"visible !important"},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:"rgba(160, 128, 100, .08)"},"&.cm-merge-b .cm-changedLine":{backgroundColor:"rgba(100, 160, 128, .08)"},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat"},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat"},"&light.cm-merge-b .cm-changedText":{background:"linear-gradient(#22bb2266, #22bb2266) bottom/100% 2px no-repeat"},"&dark.cm-merge-b .cm-changedText":{background:"linear-gradient(#88ff8866, #88ff8866) bottom/100% 2px no-repeat"},".cm-insertedLine, .cm-deletedLine":{textDecoration:"none"},".cm-deletedChunk":{paddingLeft:"6px","& .cm-chunkButtons":{position:"absolute",insetInlineEnd:"5px"},"& button":{border:"none",cursor:"pointer",color:"white",margin:"0 2px",borderRadius:"3px","&[name=accept]":{background:"#2a2"},"&[name=reject]":{background:"#d43"}}},".cm-collapsedLines":{padding:"5px 5px 5px 10px",cursor:"pointer"},"&light .cm-collapsedLines":{color:"#444",background:"linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)"},"&dark .cm-collapsedLines":{color:"#ddd",background:"linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)"},".cm-changeGutter":{width:"3px",paddingLeft:"1px"},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:"#e43"},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:"#fa9"},"&light.cm-merge-b .cm-changedLineGutter":{background:"#2b2"},"&dark.cm-merge-b .cm-changedLineGutter":{background:"#8f8"}}),cy=new jc,yl=new jc;class dy{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig;let n=[Uo.low(ry),iM,sM,Ci,et.updateListener.of(h=>{this.measuring<0&&(h.heightChanged||h.viewportChanged)&&!h.transactions.some(f=>f.effects.some(m=>m.is(xl)))&&this.measure()})],o=[so.of({side:"a",sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&o.push(_l);let r=cr.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],et.editorAttributes.of({class:"cm-merge-a"}),yl.of(o),n]}),s=[so.of({side:"b",sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&s.push(_l);let i=cr.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],et.editorAttributes.of({class:"cm-merge-b"}),yl.of(s),n]});this.chunks=is.build(r.doc,i.doc,this.diffConf);let a=[ss.init(()=>this.chunks),cy.of(e.collapseUnchanged?ly(e.collapseUnchanged):[])];r=r.update({effects:Mt.appendConfig.of(a)}).state,i=i.update({effects:Mt.appendConfig.of(a)}).state,this.dom=document.createElement("div"),this.dom.className="cm-mergeView",this.editorDOM=this.dom.appendChild(document.createElement("div")),this.editorDOM.className="cm-mergeViewEditors";let l=e.orientation||"a-b",c=document.createElement("div");c.className="cm-mergeViewEditor";let u=document.createElement("div");u.className="cm-mergeViewEditor",this.editorDOM.appendChild(l=="a-b"?c:u),this.editorDOM.appendChild(l=="a-b"?u:c),this.a=new et({state:r,parent:c,root:e.root,dispatchTransactions:h=>this.dispatch(h,this.a)}),this.b=new et({state:i,parent:u,root:e.root,dispatchTransactions:h=>this.dispatch(h,this.b)}),this.setupRevertControls(!!e.revertControls,e.revertControls=="b-to-a",e.renderRevertControl),e.parent&&e.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(e,n){if(e.some(o=>o.docChanged)){let o=e[e.length-1],r=e.reduce((i,a)=>i.compose(a.changes),la.empty(e[0].startState.doc.length));this.chunks=n==this.a?is.updateA(this.chunks,o.newDoc,this.b.state.doc,r,this.diffConf):is.updateB(this.chunks,this.a.state.doc,o.newDoc,r,this.diffConf),n.update([...e,o.state.update({effects:Uu.of(this.chunks)})]);let s=n==this.a?this.b:this.a;s.update([s.state.update({effects:Uu.of(this.chunks)})]),this.scheduleMeasure()}else n.update(e)}reconfigure(e){if("diffConfig"in e&&(this.diffConf=e.diffConfig),"orientation"in e){let s=e.orientation!="b-a";if(s!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let i=this.a.dom.parentNode,a=this.b.dom.parentNode;i.remove(),a.remove(),this.editorDOM.insertBefore(s?i:a,this.editorDOM.firstChild),this.editorDOM.appendChild(s?a:i),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent="")}}if("revertControls"in e||"renderRevertControl"in e){let s=!!this.revertDOM,i=this.revertToA,a=this.renderRevert;"revertControls"in e&&(s=!!e.revertControls,i=e.revertControls=="b-to-a"),"renderRevertControl"in e&&(a=e.renderRevertControl),this.setupRevertControls(s,i,a)}let n="highlightChanges"in e,o="gutter"in e,r="collapseUnchanged"in e;if(n||o||r){let s=[],i=[];if(n||o){let a=this.a.state.facet(so),l=o?e.gutter!==!1:a.markGutter,c=n?e.highlightChanges!==!1:a.highlightChanges;s.push(yl.reconfigure([so.of({side:"a",sibling:()=>this.b,highlightChanges:c,markGutter:l}),l?_l:[]])),i.push(yl.reconfigure([so.of({side:"b",sibling:()=>this.a,highlightChanges:c,markGutter:l}),l?_l:[]]))}if(r){let a=cy.reconfigure(e.collapseUnchanged?ly(e.collapseUnchanged):[]);s.push(a),i.push(a)}this.a.dispatch({effects:s}),this.b.dispatch({effects:i})}this.scheduleMeasure()}setupRevertControls(e,n,o){this.revertToA=n,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=o,!e&&this.revertDOM?(this.revertDOM.remove(),this.revertDOM=null):e&&!this.revertDOM?(this.revertDOM=this.editorDOM.insertBefore(document.createElement("div"),this.editorDOM.firstChild.nextSibling),this.revertDOM.addEventListener("mousedown",r=>this.revertClicked(r)),this.revertDOM.className="cm-merge-revert"):this.revertDOM&&(this.revertDOM.textContent="")}scheduleMeasure(){if(this.measuring<0){let e=this.dom.ownerDocument.defaultView||window;this.measuring=e.requestAnimationFrame(()=>{this.measuring=-1,this.measure()})}}measure(){(function(e,n,o){let r=new Rs,s=new Rs,i=e.state.field(Ci).iter(),a=n.state.field(Ci).iter(),l=0,c=0,u=0,h=0;for(let g=0;;g++){let p=g<o.length?o[g]:null;if(l<(p?p.fromA:e.state.doc.length)){let b=e.lineBlockAt(l).top+u-(n.lineBlockAt(c).top+h);b<-.01?(u-=b,r.add(l,l,ct.widget({widget:new bl(-b),block:!0,side:-1}))):b>Vu&&(h+=b,s.add(c,c,ct.widget({widget:new bl(b),block:!0,side:-1})))}if(!p)break;for(l=p.toA,c=p.toB;i.value&&i.from<l;)u-=i.value.spec.widget.height,i.next();for(;a.value&&a.from<c;)h-=a.value.spec.widget.height,a.next()}for(;i.value;)u-=i.value.spec.widget.height,i.next();for(;a.value;)h-=a.value.spec.widget.height,a.next();let f=e.contentHeight+u-(n.contentHeight+h);f<Vu?r.add(e.state.doc.length,e.state.doc.length,ct.widget({widget:new bl(-f),block:!0,side:1})):f>Vu&&s.add(n.state.doc.length,n.state.doc.length,ct.widget({widget:new bl(f),block:!0,side:1}));let m=r.finish(),_=s.finish();Lm.eq([m],[e.state.field(Ci)])||e.dispatch({effects:xl.of(m)}),Lm.eq([_],[n.state.field(Ci)])||n.dispatch({effects:xl.of(_)})})(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let e=this.revertDOM,n=e.firstChild,o=this.a.viewport,r=this.b.viewport;for(let s=0;s<this.chunks.length;s++){let i=this.chunks[s];if(i.fromA>o.to||i.fromB>r.to)break;if(i.fromA<o.from||i.fromB<r.from)continue;let a=this.a.lineBlockAt(i.fromA).top+"px";for(;n&&+n.dataset.chunk<s;)n=uy(n);n&&n.dataset.chunk==String(s)?(n.style.top!=a&&(n.style.top=a),n=n.nextSibling):e.insertBefore(this.renderRevertButton(a,s),n)}for(;n;)n=uy(n)}renderRevertButton(e,n){let o;if(this.renderRevert)o=this.renderRevert();else{o=document.createElement("button");let r=this.a.state.phrase("Revert this chunk");o.setAttribute("aria-label",r),o.setAttribute("title",r),o.textContent=this.revertToLeft?"\u21DC":"\u21DD"}return o.style.top=e,o.setAttribute("data-chunk",String(n)),o}revertClicked(e){let n,o=e.target;for(;o&&o.parentNode!=this.revertDOM;)o=o.parentNode;if(o&&(n=this.chunks[o.dataset.chunk])){let[r,s,i,a,l,c]=this.revertToA?[this.b,this.a,n.fromB,n.toB,n.fromA,n.toA]:[this.a,this.b,n.fromA,n.toA,n.fromB,n.toB],u=r.state.sliceDoc(i,Math.max(i,a-1));i!=a&&c<=s.state.doc.length&&(u+=r.state.lineBreak),s.dispatch({changes:{from:l,to:Math.min(s.state.doc.length,c),insert:u},userEvent:"revert"}),e.preventDefault()}}destroy(){this.a.destroy(),this.b.destroy(),this.measuring>-1&&(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring),this.dom.remove()}}function uy(t){let e=t.nextSibling;return t.remove(),e}var aM=["className","children","orientation","revertControls","highlightChanges","gutter","collapseUnchanged","destroyRerender","renderRevertControl","diffConfig","root"],lM=["modified","modifiedExtension","original","originalExtension","theme","dispatch"],hy=K.forwardRef((t,e)=>{var{className:n,children:o,orientation:r,revertControls:s,highlightChanges:i,gutter:a,collapseUnchanged:l,destroyRerender:c=!0,renderRevertControl:u,diffConfig:h,root:f}=t,m=da(t,aM),_=Ru(),{modified:g,modifiedExtension:p,original:b,originalExtension:x,theme:y,dispatch:v}=_,C=da(_,lM),k=M.useRef(null),N=M.useRef(),j={orientation:r,revertControls:s,highlightChanges:i,gutter:a,collapseUnchanged:l,renderRevertControl:u,diffConfig:h,root:f};M.useImperativeHandle(e,()=>({container:k.current,view:N.current,modified:g,original:b,config:Nt({a:b,b:g,parent:k.current},j)}),[k,N,g,b,j]);var I=et.updateListener.of(A=>{if(A.docChanged&&typeof(x==null?void 0:x.onChange)=="function"){var R=A.state.doc.toString();x==null||x.onChange(R,A)}}),T=et.updateListener.of(A=>{if(A.docChanged&&typeof(p==null?void 0:p.onChange)=="function"){var R=A.state.doc.toString();p==null||p.onChange(R,A)}});return M.useEffect(()=>{!N.current&&k.current&&x&&p&&(N.current=new dy(Nt({a:Nt({},b,{extensions:[...(x==null?void 0:x.extension)||[],...$s(Nt({},x==null?void 0:x.option,{theme:y})),I]}),b:Nt({},g,{extensions:[...(p==null?void 0:p.extension)||[],...$s(Nt({},p==null?void 0:p.option,{theme:y})),T]}),parent:k.current},j)),v({view:N.current}))},[N,k,x,p]),M.useEffect(()=>{if(b&&b.doc&&N.current){var A,R,z=(A=N.current)==null?void 0:A.a.state.doc.toString();z!==b.doc&&((R=N.current)==null||R.a.dispatch({changes:{from:0,to:z.length,insert:b.doc||""}}))}if(g&&g.doc&&N.current){var D,F,B=(D=N.current)==null?void 0:D.b.state.doc.toString();B!==g.doc&&((F=N.current)==null||F.b.dispatch({changes:{from:0,to:B.length,insert:g.doc||""}}))}if(c&&N.current){var U=N.current.a.state.selection.ranges[0].from,O=N.current.b.state.selection.ranges[0].from;N.current.destroy(),N.current=new dy(Nt({a:Nt({},b,{extensions:[...(x==null?void 0:x.extension)||[],...$s(Nt({},x==null?void 0:x.option,{theme:y}))]}),b:Nt({},g,{extensions:[...(p==null?void 0:p.extension)||[],...$s(Nt({},p==null?void 0:p.option,{theme:y}))]}),parent:k.current},j)),U&&(N.current.a.focus(),N.current.a.dispatch({selection:{anchor:U,head:U}})),O&&(N.current.b.focus(),N.current.b.dispatch({selection:{anchor:O,head:O}}))}},[N,y,k.current,b,g,x,p,c]),M.useEffect(()=>()=>N.current&&N.current.destroy(),[]),M.useEffect(()=>{if(N.current){var A={};C.orientation!==r&&(A.orientation=r),C.revertControls!==s&&(A.revertControls=s),C.highlightChanges!==i&&(A.highlightChanges=i),C.gutter!==a&&(A.gutter=a),C.collapseUnchanged!==l&&(A.collapseUnchanged=l),C.renderRevertControl!==u&&(A.collapseUnchanged=l),Object.keys(A).length&&v&&N.current&&(N.current.reconfigure(Nt({},A)),v(Nt({},A)))}},[v,N,r,s,i,a,l,u]),d.jsx("div",Nt({ref:k,className:"cm-merge-theme"+(n?" "+n:"")},m,{children:o}))});hy.displayName="CodeMirrorMerge.Internal";var cM=["theme"],as=K.forwardRef((t,e)=>{var{theme:n}=t,o=da(t,cM);return d.jsx(q7,{theme:n,children:d.jsx(hy,Nt({},o,{ref:e}))})});as.Original=Lx,as.Modified=Fx,as.displayName="CodeMirrorMerge";const dM=as.Original,uM=as.Modified,fy=[gV(),et.lineWrapping],hM=t=>{const e=X.c(42),{className:n,onChange:o,initialPrompt:r,currentLanguageAdapter:s,currentCode:i,declineChange:a,acceptChange:l,enabled:c,children:u}=t;let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={},e[0]=h):h=e[0];const[f,m]=M.useState(h),[_,g]=on(sC),p=Fm(),{completion:b,input:x,stop:y,isLoading:v,setCompletion:C,setInput:k,handleSubmit:N}=pV({api:p.getAiURL("completion").toString(),headers:p.headers(),initialInput:r,streamProtocol:"text",experimental_throttle:100,body:{...f,includeOtherCode:_?Nc(i):"",code:i,language:s},onError:fM,onFinish:(q,Y)=>{j(Y.trimEnd())}}),j=C,I=K.useRef(null);let T,A,R,z;e[1]!==c?(T=()=>{var Y;const q=I.current;c&&q&&(requestAnimationFrame(()=>{var te;(te=q.view)==null||te.focus()}),_V((Y=I.current)==null?void 0:Y.view))},A=[c],e[1]=c,e[2]=T,e[3]=A):(T=e[2],A=e[3]),M.useEffect(T,A),e[4]!==c||e[5]!==r||e[6]!==k?(R=()=>{c&&k(r||"")},z=[c,r,k],e[4]=c,e[5]=r,e[6]=k,e[7]=R,e[8]=z):(R=e[7],z=e[8]),M.useEffect(R,z);const{theme:D}=hr();let F;e[9]!==n?(F=Ne("flex flex-col w-full rounded-[inherit]",n),e[9]=n,e[10]=F):F=e[10];const B=c&&"max-h-[400px] min-h-11 visible",U=!c&&"max-h-0 min-h-0 invisible";let O,S,$,E;e[11]!==B||e[12]!==U?(O=Ne("flex items-center gap-2 border-b px-3 transition-all rounded-[inherit] rounded-b-none duration-300",B,U),e[11]=B,e[12]=U,e[13]=O):O=e[13],e[14]!==l||e[15]!==b||e[16]!==a||e[17]!==c||e[18]!==N||e[19]!==_||e[20]!==x||e[21]!==v||e[22]!==j||e[23]!==g||e[24]!==k||e[25]!==y||e[26]!==D?(S=c&&d.jsxs(d.Fragment,{children:[d.jsx(Gi,{className:"text-[var(--blue-10)] flex-shrink-0",size:16}),d.jsx(Oc,{inputRef:I,theme:D,onClose:()=>{a(),j("")},value:x,onChange:q=>{k(q),m(F4({input:q}))},onSubmit:()=>{v||N()}}),v&&d.jsxs(Me,{"data-testid":"stop-completion-button",variant:"text",size:"xs",className:"mb-0",onClick:y,children:[d.jsx(Dc,{className:"animate-spin mr-1",size:14}),"Stop"]}),!v&&b&&d.jsx(Me,{"data-testid":"accept-completion-button",variant:"text",size:"xs",className:"mb-0",disabled:v,onClick:()=>{l(b),j("")},children:d.jsx("span",{className:"text-[var(--grass-11)] opacity-100",children:"Accept"})}),d.jsx("div",{className:"h-full w-px bg-border mx-2"}),d.jsx(Te,{content:"Include code from other cells",children:d.jsxs("div",{className:"flex flex-row items-start gap-1 overflow-hidden",children:[d.jsx(z4,{"data-testid":"include-other-cells-checkbox",id:"include-other-cells",checked:_,onCheckedChange:q=>g(!!q)}),d.jsx(Or,{htmlFor:"include-other-cells",className:"text-muted-foreground text-xs whitespace-nowrap ellipsis",children:"Include all code"})]})}),d.jsx(Me,{"data-testid":"decline-completion-button",variant:"text",size:"icon",disabled:v,onClick:()=>{y(),a(),j("")},children:d.jsx(eo,{className:"text-[var(--red-10)]",size:16})})]}),e[14]=l,e[15]=b,e[16]=a,e[17]=c,e[18]=N,e[19]=_,e[20]=x,e[21]=v,e[22]=j,e[23]=g,e[24]=k,e[25]=y,e[26]=D,e[27]=S):S=e[27],e[28]!==O||e[29]!==S?($=d.jsx("div",{className:O,children:S}),e[28]=O,e[29]=S,e[30]=$):$=e[30],e[31]!==b||e[32]!==i||e[33]!==c||e[34]!==o||e[35]!==D?(E=b&&c&&d.jsxs(as,{className:"cm",theme:D,children:[d.jsx(dM,{onChange:o,value:i,extensions:fy}),d.jsx(uM,{value:b,editable:!1,readOnly:!0,extensions:fy})]}),e[31]=b,e[32]=i,e[33]=c,e[34]=o,e[35]=D,e[36]=E):E=e[36];const W=(!b||!c)&&u;let G;return e[37]!==$||e[38]!==E||e[39]!==W||e[40]!==F?(G=d.jsxs("div",{className:F,children:[$,E,W]}),e[37]=$,e[38]=E,e[39]=W,e[40]=F,e[41]=G):G=e[41],G};function fM(t){dt({title:"Completion failed",description:L4(t)})}const mM=t=>{const e=X.c(24),{editorView:n,code:o,currentLanguageAdapter:r,onAfterToggle:s}=t;let i,a;e[0]!==o?(a=new Xi().isSupported(o)||o.trim()==="",e[0]=o,e[1]=a):a=e[1],i=a;const l=i;let c,u;e[2]!==o?(u=new Tc().isSupported(o)||o.trim()==="",e[2]=o,e[3]=u):u=e[3],c=u;const h=c&&r==="python";let f,m;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=d.jsx(ar,{color:"var(--sky-11)",strokeWidth:2.5,className:"w-4 h-4"}),e[4]=f):f=e[4],e[5]!==r||e[6]!==n||e[7]!==s||e[8]!==h?(m=d.jsx(Hu,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:h,icon:f,toType:"sql",displayName:"SQL",onAfterToggle:s}),e[5]=r,e[6]=n,e[7]=s,e[8]=h,e[9]=m):m=e[9];const _=l&&r==="python";let g,p,b,x,y;return e[10]===Symbol.for("react.memo_cache_sentinel")?(g=d.jsx(nc,{fill:"var(--sky-11)",color:"black",className:"w-4 h-4"}),e[10]=g):g=e[10],e[11]!==r||e[12]!==n||e[13]!==s||e[14]!==_?(p=d.jsx(Hu,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:_,icon:g,toType:"markdown",displayName:"Markdown",onAfterToggle:s}),e[11]=r,e[12]=n,e[13]=s,e[14]=_,e[15]=p):p=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(b=d.jsx(oc,{fill:"var(--sky-11)",color:"black",className:"w-4 h-4"}),e[16]=b):b=e[16],e[17]!==r||e[18]!==n?(x=d.jsx(Hu,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:!0,icon:b,toType:"python",displayName:"Python",onAfterToggle:kn.NOOP}),e[17]=r,e[18]=n,e[19]=x):x=e[19],e[20]!==p||e[21]!==x||e[22]!==m?(y=d.jsxs("div",{className:"absolute right-3 top-2 z-20 flex hover-action gap-1",children:[m,p,x]}),e[20]=p,e[21]=x,e[22]=m,e[23]=y):y=e[23],y},Hu=t=>{const e=X.c(10),{editorView:n,currentLanguageAdapter:o,canSwitchToLanguage:r,icon:s,toType:i,displayName:a,onAfterToggle:l}=t;let c;e[0]!==n||e[1]!==l||e[2]!==i?(c=()=>{n&&(Ar(n,i),l())},e[0]=n,e[1]=l,e[2]=i,e[3]=c):c=e[3];const u=c;if(!r||o===i)return null;const h=`View as ${a}`;let f,m;return e[4]!==u||e[5]!==s?(f=d.jsx(Me,{"data-testid":"language-toggle-button",variant:"text",size:"xs",className:"opacity-80 px-1",onClick:u,children:s}),e[4]=u,e[5]=s,e[6]=f):f=e[6],e[7]!==h||e[8]!==f?(m=d.jsx(Te,{content:h,children:f}),e[7]=h,e[8]=f,e[9]=m):m=e[9],m},my=({theme:t,showPlaceholder:e,id:n,config:o,code:r,status:s,serializedEditorState:i,setEditorView:a,runCell:l,userConfig:c,editorViewRef:u,editorViewParentRef:h,hidden:f,hasOutput:m,temporarilyShowCode:_,languageAdapter:g,setLanguageAdapter:p,showLanguageToggles:b=!0})=>{var q;const[x,y]=on(Na),v=bV(),C=hd(),{saveOrNameNotebook:k}=Lg(),N=s==="running"||s==="queued",j=Tt(),I=Qp(),T=g==="markdown",A=Ke(()=>!N&&(C({cellId:n}),!0)),R=Ke(()=>!N&&(l(),!0)),z=Ke(()=>{const Y=!o.hide_code;return Mr({configs:{[n]:{hide_code:Y}}}),j.updateCellConfig({cellId:n,config:{hide_code:Y}}),Y}),D=Ue(tc),F=Ke(()=>{fo(D,j.createNewCell)}),B=xV(c),U=M.useMemo(()=>{const Y=k5({cellId:n,showPlaceholder:e,enableAI:B,cellActions:{...j,afterToggleMarkdown:F,onRun:R,deleteCell:A,saveNotebook:k,createManyBelow:te=>{for(const oe of[...te].reverse())j.createNewCell({code:oe,before:!1,cellId:n,skipIfCodeExists:!0})},splitCell:I,toggleHideCode:z,aiCellCompletion:()=>{let te=!1;return y(oe=>(oe==null?void 0:oe.cellId)===n?(te=!0,null):{cellId:n}),te}},completionConfig:c.completion,keymapConfig:c.keymap,lspConfig:c.language_servers,theme:t,hotkeys:new B4(c.keymap.overrides??{}),diagnosticsConfig:c.diagnostics,displayConfig:c.display});return Y.push(Nn.define(te=>{const oe=te.state.field(Ec);return p(oe.type),{update(se){const Z=se.state.field(Ec);p(Z.type)}}}),et.updateListener.of(te=>{te.selectionSet&&te.state.selection.ranges.some(oe=>oe.from!==oe.to)&&_({focus:!1})})),Y},[n,c.keymap,c.completion,c.language_servers,c.diagnostics,B,t,e,j,I,z,A,R,y,F,p,_,k]),O=Mc(),S=Ke(()=>{if(O){const te=Du(n,0,r);U.push(te.extension),r=te.code}const Y=new et({state:cr.create({doc:r,extensions:U})});a(Y),O||Ar(Y,Rm(Y.state).type)}),$=Ke(()=>{if(Fo(u.current!==null,"Editor view is not initialized"),O){const Y=Du(n);U.push(Y.extension)}u.current.dispatch({effects:[Mt.reconfigure.of([U]),yV(u.current,c.completion,new B4(c.keymap.overrides??{}),{...c.language_servers,diagnostics:c.diagnostics})]})}),E=Ke(()=>{if(Fo(i,"Editor view is not initialized"),O){const te=Du(n,0,r);U.push(te.extension),r=te.code}const Y=new et({state:cr.fromJSON(i,{doc:r,extensions:U},{history:wV})});O||Ar(Y,Rm(Y.state).type),a(Y),j.clearSerializedEditorState({cellId:n})});M.useEffect(()=>{i===null?u.current===null?S():$():E(),u.current!==null&&h&&h.current!==null&&h.current.replaceChildren(u.current.dom)},[S,$,E,u,h,i,U]),M.useEffect(()=>{const Y=u.current;return()=>{Y==null||Y.destroy()}},[u]);const W=f&&!T||f&&T&&!m;let G="";return T&&f&&m?G="h-0 overflow-hidden":f&&(G="opacity-20 h-8 [&>div.cm-editor]:h-full [&>div.cm-editor]:overflow-hidden"),d.jsx(hM,{enabled:(x==null?void 0:x.cellId)===n,initialPrompt:x==null?void 0:x.initialPrompt,currentCode:((q=u.current)==null?void 0:q.state.doc.toString())??r,currentLanguageAdapter:g,declineChange:Ke(()=>{var Y;y(null),(Y=u.current)==null||Y.focus()}),onChange:Ke(Y=>{var te;(te=u.current)==null||te.dispatch({changes:{from:0,to:u.current.state.doc.length,insert:Y}})}),acceptChange:Ke(Y=>{var te,oe;(te=u.current)==null||te.dispatch({changes:{from:0,to:u.current.state.doc.length,insert:Y}}),(oe=u.current)==null||oe.focus(),y(null)}),children:d.jsxs("div",{className:"relative w-full",onFocus:()=>v(n),children:[W&&d.jsx(U4,{tooltip:"Edit code",className:"absolute inset-0 z-10",onClick:_}),d.jsx(py,{className:G,editorView:u.current,ref:h}),!f&&b&&d.jsx("div",{className:"absolute top-1 right-5",children:d.jsx(mM,{code:r,editorView:u.current,currentLanguageAdapter:g,onAfterToggle:F})})]})})},py=K.forwardRef((t,e)=>{const n=X.c(10),{className:o,editorView:r}=t,s=M.useRef(null);let i,a,l,c,u;return n[0]!==r?(i=()=>{r!==null&&s.current!==null&&s.current.children.length===0&&s.current.append(r.dom)},a=[r,s],n[0]=r,n[1]=i,n[2]=a):(i=n[1],a=n[2]),M.useEffect(i,a),n[3]!==o?(l=Ne("cm mathjax_ignore",o),n[3]=o,n[4]=l):l=n[4],n[5]!==e?(c=h=>{e?pl(e,s)(h):pl(s)(h)},n[5]=e,n[6]=c):c=n[6],n[7]!==l||n[8]!==c?(u=d.jsx("div",{className:l,ref:c,"data-testid":"cell-editor"}),n[7]=l,n[8]=c,n[9]=u):u=n[9],u});py.displayName="CellCodeMirrorEditor";const Wu=Mc()?function(t){const e=n=>{const o=X.c(5),r=Ue(hn),[s,i]=on(os);if(r.state===Bt.CONNECTING||s===void 0){let l,c;return o[0]===Symbol.for("react.memo_cache_sentinel")?(l=d.jsx("span",{children:"Waiting for real-time collaboration connection..."}),o[0]=l):l=o[0],o[1]!==i?(c=d.jsx("div",{className:"flex h-full w-full items-baseline p-4",children:d.jsxs(zm,{milliseconds:1e3,fallback:null,children:[l,d.jsx(Me,{variant:"link",onClick:()=>{i("disabled")},children:"Turn off real-time collaboration"})]})}),o[1]=i,o[2]=c):c=o[2],c}let a;return o[3]!==n?(a=d.jsx(t,{...n}),o[3]=n,o[4]=a):a=o[4],a};return e.displayName=`WithWaitUntilConnected(${t.displayName})`,e}(M.memo(my)):M.memo(my),pM=t=>{const e=X.c(10);let n,o,r,s;return e[0]!==t.left?(n=d.jsx("div",{className:"flex-1 flex item-center gap-2",children:t.left}),e[0]=t.left,e[1]=n):n=e[1],e[2]!==t.center?(o=d.jsx("div",{className:"flex-1 flex item-center gap-2 justify-center",children:t.center}),e[2]=t.center,e[3]=o):o=e[3],e[4]!==t.right?(r=d.jsx("div",{className:"flex-1 flex item-center gap-2 justify-end",children:t.right}),e[4]=t.right,e[5]=r):r=e[5],e[6]!==n||e[7]!==o||e[8]!==r?(s=d.jsxs("div",{className:"flex items-center gap-2 w-full px-3",children:[n,o,r]}),e[6]=n,e[7]=o,e[8]=r,e[9]=s):s=e[9],s},gM=t=>{const e=X.c(8);if(!t.canCollapse&&!t.isCollapsed)return null;const n=t.isCollapsed?"Expand":"Collapse";let o,r,s;return e[0]!==t.isCollapsed?(o=d.jsx("span",{children:d.jsx(_M,{isCollapsed:t.isCollapsed})}),e[0]=t.isCollapsed,e[1]=o):o=e[1],e[2]!==n||e[3]!==o?(r=d.jsx(Te,{content:n,children:o}),e[2]=n,e[3]=o,e[4]=r):r=e[4],e[5]!==t.onClick||e[6]!==r?(s=d.jsx(Me,{variant:"text",size:"icon",onClick:t.onClick,children:r}),e[5]=t.onClick,e[6]=r,e[7]=s):s=e[7],s},_M=t=>{const e=X.c(2),{isCollapsed:n}=t;let o;return e[0]!==n?(o=n?d.jsx(Yi,{className:"w-5 h-5 flex-shrink-0"}):d.jsx(Tr,{className:"w-5 h-5 flex-shrink-0"}),e[0]=n,e[1]=o):o=e[1],o},gy=M.memo(t=>{const e=X.c(24),{onClick:n,count:o,cellId:r}=t,s=xc();let i;e[0]!==r||e[1]!==s?(i=vV(s,r),e[0]=r,e[1]=s,e[2]=i):i=e[2];const a=i;let l,c;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=Ne("flex items-center justify-between w-[calc(100%-2rem)] h-9 bg-muted rounded-b mx-4 opacity-80 hover:opacity-100 cursor-pointer"),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(kV,{className:"w-4 h-4 flex-shrink-0"}),e[4]=c):c=e[4];const u=o===1?"cell":"cells";let h,f,m,_,g,p,b;return e[5]!==o||e[6]!==u?(h=d.jsxs(d.Fragment,{children:[c,d.jsxs("span",{className:"text-sm text-gray-500",children:[o," ",u," collapsed"]})]}),e[5]=o,e[6]=u,e[7]=h):h=e[7],e[8]!==a.errored?(f=a.errored&&d.jsx(Te,{content:"Has errors",delayDuration:100,children:d.jsx(Ip,{className:"w-4 h-4 flex-shrink-0 text-destructive"})}),e[8]=a.errored,e[9]=f):f=e[9],e[10]!==a.stale?(m=a.stale&&d.jsx(Te,{content:"Has stale cells",delayDuration:100,children:d.jsx(V4,{className:"w-4 h-4 flex-shrink-0 text-[var(--yellow-11)]"})}),e[10]=a.stale,e[11]=m):m=e[11],e[12]!==a.runningOrQueued?(_=a.runningOrQueued&&d.jsx(Te,{content:"Running",delayDuration:100,children:d.jsx(Dc,{className:"w-4 h-4 flex-shrink-0 animate-spin"})}),e[12]=a.runningOrQueued,e[13]=_):_=e[13],e[14]!==f||e[15]!==m||e[16]!==_?(g=d.jsxs(d.Fragment,{children:[f,m,_]}),e[14]=f,e[15]=m,e[16]=_,e[17]=g):g=e[17],e[18]!==h||e[19]!==g?(p=d.jsx(pM,{center:h,right:g}),e[18]=h,e[19]=g,e[20]=p):p=e[20],e[21]!==n||e[22]!==p?(b=d.jsx("div",{onClick:n,className:l,children:p}),e[21]=n,e[22]=p,e[23]=b):b=e[23],b});gy.displayName="CollapsedCellBanner";const _y=t=>{const e=X.c(31),{status:n,connectionState:o,onClick:r}=t,s=n==="running"||n==="queued";let i,a,l,c,u,h,f,m,_,g,p,b,x,y;if(e[0]!==o||e[1]!==s||e[2]!==r||e[3]!==n){const v=po(o);let C;if(v){let k;e[14]!==o?(k=$c(o),e[14]=o,e[15]=k):k=e[15],C=k}else C=n==="running"?"A cell can't be deleted when it's running":n==="queued"?"A cell can't be deleted when it's queued to run":"Delete";a=Te,_=C,g=!1,i=Me,l="ghost",c="icon",u=r,h="delete-button",f=Vn.preventFocus,m=Ne("hover:bg-transparent text-destructive/60 hover:text-destructive",(v||s)&&"inactive-button"),e[0]=o,e[1]=s,e[2]=r,e[3]=n,e[4]=i,e[5]=a,e[6]=l,e[7]=c,e[8]=u,e[9]=h,e[10]=f,e[11]=m,e[12]=_,e[13]=g}else i=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=e[9],f=e[10],m=e[11],_=e[12],g=e[13];return e[16]===Symbol.for("react.memo_cache_sentinel")?(p={boxShadow:"none"},b=d.jsx(lm,{size:14}),e[16]=p,e[17]=b):(p=e[16],b=e[17]),e[18]!==i||e[19]!==l||e[20]!==c||e[21]!==u||e[22]!==h||e[23]!==f||e[24]!==m?(x=d.jsx(i,{variant:l,size:c,onClick:u,"data-testid":h,onMouseDown:f,className:m,style:p,children:b}),e[18]=i,e[19]=l,e[20]=c,e[21]=u,e[22]=h,e[23]=f,e[24]=m,e[25]=x):x=e[25],e[26]!==a||e[27]!==x||e[28]!==_||e[29]!==g?(y=d.jsx(a,{content:_,usePortal:g,children:x}),e[26]=a,e[27]=x,e[28]=_,e[29]=g,e[30]=y):y=e[30],y},bM=t=>{const e=X.c(27),{onClick:n,connectionState:o,needsRun:r,status:s,config:i,edited:a}=t,l=s==="disabled-transitively",c=s==="running"||s==="queued";let u,h;e[0]!==l||e[1]!==i.disabled||e[2]!==o||e[3]!==a||e[4]!==c||e[5]!==r?(u=po(o)||c||!i.disabled&&l&&!a,h=function(p,b,x,y){return po(p)?"disabled":b&&!x?"stale":x||y?"disabled":"green"}(o,r,c,u),e[0]=l,e[1]=i.disabled,e[2]=o,e[3]=a,e[4]=c,e[5]=r,e[6]=u,e[7]=h):(u=e[6],h=e[7]);const f=h;if(i.disabled){let p,b;return e[8]===Symbol.for("react.memo_cache_sentinel")?(p=d.jsx(xp,{}),e[8]=p):p=e[8],e[9]!==u||e[10]!==n||e[11]!==f?(b=d.jsx(ni,{tooltip:"Add code to notebook",disabled:u,onClick:n,variant:f,"data-testid":"run-button",children:p}),e[9]=u,e[10]=n,e[11]=f,e[12]=b):b=e[12],b}if(!i.disabled&&l&&!a){let p,b;return e[13]===Symbol.for("react.memo_cache_sentinel")?(p=d.jsx(Gs,{strokeWidth:1.2}),e[13]=p):p=e[13],e[14]!==u||e[15]!==n||e[16]!==f?(b=d.jsx(ni,{disabled:u,tooltip:"This cell can't be run because it has a disabled ancestor",onClick:n,variant:f,"data-testid":"run-button",children:p}),e[14]=u,e[15]=n,e[16]=f,e[17]=b):b=e[17],b}let m,_,g;if(po(o)){let p;e[18]!==o?(p=$c(o),e[18]=o,e[19]=p):p=e[19],m=p}else if(s==="queued")m="This cell is already queued to run";else if(s==="running")m="This cell is already running.";else{let p;e[20]===Symbol.for("react.memo_cache_sentinel")?(p=rn("cell.run"),e[20]=p):p=e[20],m=p}return e[21]===Symbol.for("react.memo_cache_sentinel")?(_=d.jsx(Gs,{strokeWidth:1.2}),e[21]=_):_=e[21],e[22]!==u||e[23]!==n||e[24]!==m||e[25]!==f?(g=d.jsx(ni,{tooltip:m,disabled:u,onClick:n,variant:f,"data-testid":"run-button",children:_}),e[22]=u,e[23]=n,e[24]=m,e[25]=f,e[26]=g):g=e[26],g},by=K.createContext(null),xy=M.memo(()=>M.use(by));xy.displayName="DragHandle";const yy=K.forwardRef((t,e)=>{const n=X.c(21);let o,r,s,i,a;n[0]!==t?({cellId:r,canMoveX:o,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]),n[4]!==r?(i=r.toString(),n[4]=r,n[5]=i):i=n[5],n[6]!==i?(a={id:i},n[6]=i,n[7]=a):a=n[7];const{attributes:l,listeners:c,setNodeRef:u,transform:h,transition:f,isDragging:m}=b1(a);let _;n[8]!==h?(_=function(x){return!x||x.x===0&&x.y===0&&x.scaleX===1&&x.scaleY===1}(h)?null:h,n[8]=h,n[9]=_):_=n[9];const g=_,p=g==null?void 0:f;let b;return n[10]!==l||n[11]!==o||n[12]!==r||n[13]!==m||n[14]!==c||n[15]!==s||n[16]!==e||n[17]!==u||n[18]!==g||n[19]!==p?(b=d.jsx(wy,{ref:e,cellId:r,canMoveX:o,...s,attributes:l,listeners:c,setNodeRef:u,transform:g,transition:p,isDragging:m}),n[10]=l,n[11]=o,n[12]=r,n[13]=m,n[14]=c,n[15]=s,n[16]=e,n[17]=u,n[18]=g,n[19]=p,n[20]=b):b=n[20],b});yy.displayName="SortableCell";const wy=K.forwardRef((t,e)=>{const n=X.c(37);let o,r,s,i,a,l,c,u,h,f;if(n[0]!==t){const{cellId:I,canMoveX:T,children:A,attributes:R,listeners:z,setNodeRef:D,transform:F,transition:B,isDragging:U,...O}=t;r=T,s=A,o=R,a=z,c=D,u=F,h=B,i=U,l=O,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=i,n[5]=a,n[6]=l,n[7]=c,n[8]=u,n[9]=h}else o=n[1],r=n[2],s=n[3],i=n[4],a=n[5],l=n[6],c=n[7],u=n[8],h=n[9];n[10]!==r||n[11]!==u?(f=u?kc.Transform.toString({x:r?u.x:0,y:u.y,scaleX:1,scaleY:1}):void 0,n[10]=r,n[11]=u,n[12]=f):f=n[12];const m=i?2:void 0;let _;n[13]!==f||n[14]!==m||n[15]!==h?(_={transform:f,transition:h,zIndex:m,position:"relative"},n[13]=f,n[14]=m,n[15]=h,n[16]=_):_=n[16];const g=_;let p,b;n[17]===Symbol.for("react.memo_cache_sentinel")?(p=d.jsx(bp,{strokeWidth:1,size:20}),n[17]=p):p=n[17],n[18]!==o||n[19]!==a?(b=d.jsx("div",{...o,...a,onMouseDown:Vn.preventFocus,"data-testid":"drag-button",className:"py-[1px] cursor-grab opacity-50 hover:opacity-100 hover-action hover:bg-muted rounded border border-transparent hover:border-border active:bg-accent",children:p}),n[18]=o,n[19]=a,n[20]=b):b=n[20];const x=b,y=!!u;let v;n[21]!==e||n[22]!==c?(v=I=>{pl(e,c)(I)},n[21]=e,n[22]=c,n[23]=v):v=n[23];const C=y&&"is-moving";let k,N,j;return n[24]!==l.className||n[25]!==C?(k=Ne(l.className,C,"outline-offset-4 outline-primary/40 rounded-lg"),n[24]=l.className,n[25]=C,n[26]=k):k=n[26],n[27]!==s||n[28]!==x?(N=d.jsx(by.Provider,{value:x,children:s}),n[27]=s,n[28]=x,n[29]=N):N=n[29],n[30]!==i||n[31]!==l||n[32]!==g||n[33]!==v||n[34]!==k||n[35]!==N?(j=d.jsx("div",{tabIndex:-1,ref:v,...l,"data-is-dragging":i,className:k,style:g,children:N}),n[30]=i,n[31]=l,n[32]=g,n[33]=v,n[34]=k,n[35]=N,n[36]=j):j=n[36],j});function vy(t,e){const n=X.c(9);let o;n[0]!==t.current||n[1]!==e?(o=l=>{t.current===null||t.current.contains(l.relatedTarget)||e.current===null||om(e.current)},n[0]=t.current,n[1]=e,n[2]=o):o=n[2];const r=Ke(o);let s;n[3]!==t.current||n[4]!==e?(s=l=>{if(t.current===document.activeElement&&e.current!==null&&aa(e.current.state)==="active"){for(const c of C4)if(l.key===c.key&&c.run){c.run(e.current),l.preventDefault(),l.stopPropagation();break}e.current.focus()}},n[3]=t.current,n[4]=e,n[5]=s):s=n[5];const i=Ke(s);let a;return n[6]!==r||n[7]!==i?(a={closeCompletionHandler:r,resumeCompletionHandler:i},n[6]=r,n[7]=i,n[8]=a):a=n[8],a}function ky(t,e,n,o,r,s,i,a,l){const c=X.c(51);let u,h,f,m,_,g,p,b,x,y,v,C,k,N,j,I;c[0]!==o||c[1]!==e||c[2]!==n?(u=()=>{n(),o.moveToNextCell({cellId:e,before:!1})},h=()=>{n(),o.moveToNextCell({cellId:e,before:!0})},c[0]=o,c[1]=e,c[2]=n,c[3]=u,c[4]=h):(u=c[3],h=c[4]),c[5]!==o||c[6]!==e?(f=()=>o.createNewCell({cellId:e,before:!0}),m=()=>o.createNewCell({cellId:e,before:!1}),_=()=>o.moveCell({cellId:e,before:!0}),g=()=>o.moveCell({cellId:e,before:!1}),c[5]=o,c[6]=e,c[7]=f,c[8]=m,c[9]=_,c[10]=g):(f=c[7],m=c[8],_=c[9],g=c[10]),c[11]!==o||c[12]!==r||c[13]!==e?(p=()=>r?o.moveCell({cellId:e,direction:"left"}):void 0,b=()=>r?o.moveCell({cellId:e,direction:"right"}):void 0,c[11]=o,c[12]=r,c[13]=e,c[14]=p,c[15]=b):(p=c[14],b=c[15]),c[16]!==o||c[17]!==s||c[18]!==e||c[19]!==(t==null?void 0:t.current)||c[20]!==i?(x=()=>{var A,R,z;const T=!s.hide_code;Mr({configs:{[e]:{hide_code:T}}}),o.updateCellConfig({cellId:e,config:{hide_code:T}}),T?((A=i.current)==null||A.contentDOM.blur(),(R=t==null?void 0:t.current)==null||R.focus()):(z=i.current)==null||z.focus()},c[16]=o,c[17]=s,c[18]=e,c[19]=t==null?void 0:t.current,c[20]=i,c[21]=x):x=c[21],c[22]!==o||c[23]!==e?(k=()=>o.moveToNextCell({cellId:e,before:!1,noCreate:!0}),y=()=>o.moveToNextCell({cellId:e,before:!0,noCreate:!0}),v=()=>o.sendToBottom({cellId:e}),C=()=>o.sendToTop({cellId:e}),c[22]=o,c[23]=e,c[24]=y,c[25]=v,c[26]=C,c[27]=k):(y=c[24],v=c[25],C=c[26],k=c[27]),c[28]!==e||c[29]!==i||c[30]!==a?(N=()=>{let T=!1;a(A=>(A==null?void 0:A.cellId)===e?(T=!0,null):{cellId:e}),T&&P_(i).focus()},c[28]=e,c[29]=i,c[30]=a,c[31]=N):N=c[31],c[32]!==l?(j=()=>{var T;(T=l.current)==null||T.toggle()},c[32]=l,c[33]=j):j=c[33],c[34]!==n||c[35]!==u||c[36]!==h||c[37]!==y||c[38]!==v||c[39]!==C||c[40]!==N||c[41]!==j||c[42]!==f||c[43]!==m||c[44]!==_||c[45]!==g||c[46]!==p||c[47]!==b||c[48]!==x||c[49]!==k?(I={"cell.run":n,"cell.runAndNewBelow":u,"cell.runAndNewAbove":h,"cell.createAbove":f,"cell.createBelow":m,"cell.moveUp":_,"cell.moveDown":g,"cell.moveLeft":p,"cell.moveRight":b,"cell.hideCode":x,"cell.focusDown":k,"cell.focusUp":y,"cell.sendToBottom":v,"cell.sendToTop":C,"cell.aiCompletion":N,"cell.cellActions":j},c[34]=n,c[35]=u,c[36]=h,c[37]=y,c[38]=v,c[39]=C,c[40]=N,c[41]=j,c[42]=f,c[43]=m,c[44]=_,c[45]=g,c[46]=p,c[47]=b,c[48]=x,c[49]=k,c[50]=I):I=c[50],NV(t,I)}function Sy(t,e,n,o,r,s){const i=X.c(16);let a,l,c,u,h;i[0]!==n||i[1]!==e?(a=f=>(!f||!Vn.fromInput(f))&&(n.moveToNextCell({cellId:e,before:!1,noCreate:!0}),!0),l=f=>(!f||!Vn.fromInput(f))&&(n.moveToNextCell({cellId:e,before:!0,noCreate:!0}),!0),i[0]=n,i[1]=e,i[2]=a,i[3]=l):(a=i[2],l=i[3]),i[4]!==o?(c=()=>(o(),!1),i[4]=o,i[5]=c):c=i[5],i[6]!==n||i[7]!==e||i[8]!==s||i[9]!==r.keymap.preset?(u=r.keymap.preset!=="vim"||s?{}:{j:f=>(!f||!Vn.fromInput(f))&&(n.moveToNextCell({cellId:e,before:!1,noCreate:!0}),!0),k:f=>(!f||!Vn.fromInput(f))&&(n.moveToNextCell({cellId:e,before:!0,noCreate:!0}),!0)},i[6]=n,i[7]=e,i[8]=s,i[9]=r.keymap.preset,i[10]=u):u=i[10],i[11]!==a||i[12]!==l||i[13]!==c||i[14]!==u?(h={ArrowDown:a,ArrowUp:l,Enter:c,...u},i[11]=a,i[12]=l,i[13]=c,i[14]=u,i[15]=h):h=i[15],jV(t,h)}wy.displayName="SortableCellInternal";const Cy=M.forwardRef((t,e)=>{const n=X.c(14),{id:o,output:r,interrupted:s,errored:i,stopped:a,name:l,outputStale:c,outputLoading:u}=t;let h;n[0]===Symbol.for("react.memo_cache_sentinel")?(h=Rc("marimo-cell","hover-actions-parent z-10",{published:!0}),n[0]=h):h=n[0];const f=h;let m;n[1]!==o?(m=As.create(o),n[1]=o,n[2]=m):m=n[2];const _=m,g=W4(r==null?void 0:r.mimetype);if(i||s||a||g)return null;let p,b;return n[3]!==o||n[4]!==r||n[5]!==u||n[6]!==c?(p=d.jsx(Pc,{allowExpand:!1,forceExpand:!0,output:r,className:"output-area",cellId:o,stale:c,loading:u}),n[3]=o,n[4]=r,n[5]=u,n[6]=c,n[7]=p):p=n[7],n[8]!==_||n[9]!==o||n[10]!==l||n[11]!==e||n[12]!==p?(b=d.jsx("div",{tabIndex:-1,id:_,ref:e,className:f,"data-cell-id":o,"data-cell-name":l,children:p}),n[8]=_,n[9]=o,n[10]=l,n[11]=e,n[12]=p,n[13]=b):b=n[13],b});Cy.displayName="ReadonlyCellComponent";const xM=({theme:t,showPlaceholder:e,id:n,code:o,output:r,consoleOutputs:s,status:i,runStartTimestamp:a,lastRunStartTimestamp:l,runElapsedTimeMs:c,edited:u,interrupted:h,errored:f,stopped:m,staleInputs:_,serializedEditorState:g,serialization:p,debuggerActive:b,connectionState:x,canDelete:y,actions:v,deleteCell:C,userConfig:k,outline:N,isCollapsed:j,collapseCount:I,config:T,canMoveX:A,name:R,editorView:z,setEditorView:D,outputStale:F})=>{const B=M.useRef(null),U=M.useRef(null),O=M.useRef(null),S=M.useRef(null),$=Zt(Na),E=ad(n),[W,G]=M.useState(),q=T.disabled||i==="disabled-transitively",Y=q4({executionTime:c,status:i,errored:f,interrupted:h,stopped:m}),te=u||h||_&&!q,oe=$4(i),se=(i==="queued"||u||_)&&!h,Z=M.useCallback(()=>z.current,[z]),{closeCompletionHandler:Q,resumeCompletionHandler:ue}=vy(B,z),{isCellCodeShown:me,isMarkdown:ce,isMarkdownCodeHidden:fe,temporarilyShowCode:de,showHiddenMarkdownCode:ke}=function(J,_e,be,ge){const le=X.c(13),[We,Fe]=M.useState(!1),Xe=!J.hide_code||We,ae=_e==="markdown",Ee=ae&&!Xe;let Ie;le[0]!==be||le[1]!==ge||le[2]!==Xe?(Ie=st=>{var zt,nn;if(Xe)return;const nt=(st==null?void 0:st.focus)??!0;Fe(!0),nt&&((zt=be.current)==null||zt.focus());const it=(nn=ge.current)==null?void 0:nn.parentElement;if(!it)return void St.error("Cell: No parent element found for editor view");const Pt=()=>{requestAnimationFrame(()=>{var Wt;it.contains(document.activeElement)||(Fe(!1),(Wt=be.current)==null||Wt.dom.blur(),it.removeEventListener("focusout",Pt))})};it.addEventListener("focusout",Pt)},le[0]=be,le[1]=ge,le[2]=Xe,le[3]=Ie):Ie=le[3];const $e=Ke(Ie);let Je;le[4]!==Ee||le[5]!==$e?(Je=()=>{Ee&&$e({focus:!0})},le[4]=Ee,le[5]=$e,le[6]=Je):Je=le[6];const Le=Ke(Je);let Ge;return le[7]!==Xe||le[8]!==ae||le[9]!==Ee||le[10]!==Le||le[11]!==$e?(Ge={isCellCodeShown:Xe,isMarkdown:ae,isMarkdownCodeHidden:Ee,temporarilyShowCode:$e,showHiddenMarkdownCode:Le},le[7]=Xe,le[8]=ae,le[9]=Ee,le[10]=Le,le[11]=$e,le[12]=Ge):Ge=le[12],Ge}(T,W,z,O);ky(B,n,E,v,A,T,z,$,U),Sy(B,n,v,ke,k,me);const Se=CV(N),ie=!H4(r),je=s.length>0,pe=k.display.cell_output,Ae=ie&&pe==="above",ze=ie&&pe==="below",[De,Ve]=M.useState(!1),[Pe,rt]=M.useState(!1);(function(J){const{ref:_e,box:be="content-box",skip:ge}=J,le=M.useRef({...C5}),We=M.useRef(void 0);We.current=J.onResize,M.useEffect(()=>{if(!_e.current||ge||typeof window>"u"||!("ResizeObserver"in window))return;const Fe=new ResizeObserver(([Xe])=>{const ae=be==="border-box"?"borderBoxSize":be==="device-pixel-content-box"?"devicePixelContentBoxSize":"contentBoxSize",Ee=R_(Xe,ae,"inlineSize"),Ie=R_(Xe,ae,"blockSize");if(le.current.width!==Ee||le.current.height!==Ie){const $e={width:Ee,height:Ie};le.current.width=Ee,le.current.height=Ie,We.current&&We.current($e)}});return Fe.observe(_e.current,{box:be}),()=>{Fe.disconnect()}},[be,_e,ge])})({ref:S,skip:!ce,onResize:J=>{const _e=J.height&&J.height<68,be=fe&&(_e||pe==="below");Ve(be),Se&&be?rt(!0):Pe&&rt(!1)}});const Qe=J=>d.jsx(U4,{tooltip:"Edit markdown",className:Ne("z-20 relative",J),onClick:de}),tt=ie&&d.jsxs("div",{className:"relative",onDoubleClick:ke,children:[d.jsx("div",{className:"absolute top-5 -left-8 z-10 print:hidden",children:d.jsx(gM,{isCollapsed:j,onClick:()=>{j?v.expandCell({cellId:n}):v.collapseCell({cellId:n})},canCollapse:Se})}),fe&&ze&&Qe("top-3"),d.jsx(Pc,{allowExpand:!0,forceExpand:fe,output:r,className:"output-area",cellId:n,stale:F,loading:oe}),fe&&Ae&&Qe("bottom-3")]}),ne=Rc("marimo-cell","hover-actions-parent z-10",{interactive:!0,"needs-run":te,"has-error":f,stopped:m,disabled:T.disabled,stale:i==="disabled-transitively",borderless:fe&&ie}),ve=As.create(n),Ce=Ke(J=>{$({cellId:n,initialPrompt:J.prompt})}),Re=!(!p||p.toLowerCase()!=="valid");return d.jsx(Bm,{children:d.jsx(b0,{cellId:n,config:T,status:i,getEditorView:Z,hasOutput:ie,hasConsoleOutput:je,name:R,children:d.jsxs(yy,{tabIndex:-1,ref:B,"data-status":i,onBlur:Q,onKeyDown:ue,cellId:n,canMoveX:A,title:T.disabled?"This cell is disabled":i==="disabled-transitively"?"This cell has a disabled ancestor":void 0,children:[d.jsxs("div",{className:ne,id:ve,ref:S,"data-cell-id":n,"data-cell-name":R,children:[pe==="above"&&tt,d.jsxs("div",{className:Ne("tray"),"data-hidden":fe,children:[d.jsx("div",{className:"absolute right-2 -top-4 z-10",children:d.jsx(jy,{edited:u,connectionState:x,status:i,cellConfig:T,needsRun:te,hasOutput:ie,hasConsoleOutput:je,cellActionDropdownRef:U,cellId:n,name:R,getEditorView:Z,onRun:E})}),d.jsx(yM,{cellId:n,className:Ne(fe&&Ae&&"-top-7",fe&&ze&&"-bottom-8",fe&&Pe&&"-left-[3.8rem]"),connectionState:x,actions:v}),d.jsx(Wu,{theme:t,showPlaceholder:e,id:n,code:o,config:T,status:i,serializedEditorState:g,runCell:E,setEditorView:D,userConfig:k,editorViewRef:z,editorViewParentRef:O,hidden:!me,hasOutput:ie,temporarilyShowCode:de,languageAdapter:W,setLanguageAdapter:G}),d.jsx(Ny,{className:Ne(fe&&pe==="below"&&"top-14"),edited:u,status:i,isCellStatusInline:De,uninstantiated:Y,disabled:T.disabled,runElapsedTimeMs:c,runStartTimestamp:a,lastRunStartTimestamp:l,staleInputs:_,interrupted:h}),d.jsx("div",{className:"shoulder-bottom hover-action",children:y&&me&&d.jsx(_y,{connectionState:x,status:i,onClick:()=>{oe||po(x)||C({cellId:n})}})})]}),pe==="below"&&tt,p&&d.jsxs("a",{href:"https://links.marimo.app/reusable-definitions",target:"_blank",className:"hover:underline py-1 px-2 flex items-center justify-end gap-2 last:rounded-b",rel:"noopener",children:[Re&&d.jsx("span",{className:"text-muted-foreground text-xs font-bold",children:"reusable"}),d.jsx(Te,{content:d.jsx("span",{className:"max-w-16 text-xs",children:Re?"This function or class can be imported into other Python notebooks or modules.":d.jsxs(d.Fragment,{children:["This definition can't be reused in other Python modules:",d.jsx("br",{}),d.jsx("br",{}),d.jsx("pre",{children:p}),d.jsx("br",{}),"Click this icon to learn more."]})}),children:Re&&d.jsx(Kl,{size:16,strokeWidth:1.5,className:"rounded-lg text-muted-foreground"})||d.jsx(Um,{size:16,strokeWidth:1.5,className:"rounded-lg text-muted-foreground"})})]}),d.jsx(ep,{consoleOutputs:s,stale:se,cellName:p?"_":R,onRefactorWithAI:Ce,onClear:()=>{v.clearCellConsoleOutput({cellId:n})},onSubmitDebugger:(J,_e)=>{v.setStdinResponse({cellId:n,response:J,outputIndex:_e}),G4({text:J})},cellId:n,debuggerActive:b})]}),j&&d.jsx(gy,{onClick:()=>v.expandCell({cellId:n}),count:I,cellId:n})]})})})},Ny=t=>{const e=X.c(19),{className:n,disabled:o,edited:r,interrupted:s,isCellStatusInline:i,lastRunStartTimestamp:a,runElapsedTimeMs:l,runStartTimestamp:c,staleInputs:u,status:h,uninstantiated:f}=t,m=o!==void 0&&o;let _;e[0]!==m||e[1]!==r||e[2]!==s||e[3]!==a||e[4]!==l||e[5]!==c||e[6]!==u||e[7]!==h||e[8]!==f?(_=d.jsx(z_,{status:h,staleInputs:u,interrupted:s,editing:!0,edited:r,disabled:m,elapsedTime:l,runStartTimestamp:c,uninstantiated:f,lastRunStartTimestamp:a}),e[0]=m,e[1]=r,e[2]=s,e[3]=a,e[4]=l,e[5]=c,e[6]=u,e[7]=h,e[8]=f,e[9]=_):_=e[9];const g=_;let p;e[10]!==n?(p=Ne("shoulder-right z-20",n),e[10]=n,e[11]=p):p=e[11];const b=!i&&g;let x;e[12]===Symbol.for("react.memo_cache_sentinel")?(x=d.jsx(xy,{}),e[12]=x):x=e[12];const y=i&&g;let v,C;return e[13]!==y?(v=d.jsxs("div",{className:"flex gap-2 items-end",children:[x,y]}),e[13]=y,e[14]=v):v=e[14],e[15]!==p||e[16]!==b||e[17]!==v?(C=d.jsxs("div",{className:p,children:[b,v]}),e[15]=p,e[16]=b,e[17]=v,e[18]=C):C=e[18],C},yM=t=>{const e=X.c(21),{className:n,connectionState:o,actions:r,cellId:s}=t;let i;e[0]!==r||e[1]!==s?(i=v=>{const C=v===void 0?{}:v;return r.createNewCell({cellId:s,before:!1,...C})},e[0]=r,e[1]=s,e[2]=i):i=e[2];const a=Ke(i);let l;e[3]!==r||e[4]!==s?(l=v=>{const C=v===void 0?{}:v;return r.createNewCell({cellId:s,before:!0,...C})},e[3]=r,e[4]=s,e[5]=l):l=e[5];const c=Ke(l),u=Hc(o);let h,f;e[6]!==n?(h=Ne("absolute flex flex-col gap-[2px] justify-center h-full left-[-34px] z-20",n),e[6]=n,e[7]=h):h=e[7],e[8]===Symbol.for("react.memo_cache_sentinel")?(f=rn("cell.createAbove"),e[8]=f):f=e[8];const m=u?c:void 0;let _,g,p;e[9]!==o||e[10]!==m?(_=d.jsx(p0,{tooltipContent:f,connectionState:o,onClick:m}),e[9]=o,e[10]=m,e[11]=_):_=e[11],e[12]===Symbol.for("react.memo_cache_sentinel")?(g=d.jsx("div",{className:"flex-1"}),e[12]=g):g=e[12],e[13]===Symbol.for("react.memo_cache_sentinel")?(p=rn("cell.createBelow"),e[13]=p):p=e[13];const b=u?a:void 0;let x,y;return e[14]!==o||e[15]!==b?(x=d.jsx(p0,{tooltipContent:p,connectionState:o,onClick:b}),e[14]=o,e[15]=b,e[16]=x):x=e[16],e[17]!==h||e[18]!==_||e[19]!==x?(y=d.jsxs("div",{className:h,children:[_,g,x]}),e[17]=h,e[18]=_,e[19]=x,e[20]=y):y=e[20],y},jy=t=>{const e=X.c(27),{edited:n,connectionState:o,status:r,cellConfig:s,needsRun:i,hasOutput:a,hasConsoleOutput:l,onRun:c,cellActionDropdownRef:u,cellId:h,getEditorView:f,name:m,includeCellActions:_}=t,g=_===void 0||_,p=Hc(o),b=!i&&"hover-action";let x;e[0]!==b?(x=Ne(b),e[0]=b,e[1]=x):x=e[1];const y=p?c:kn.NOOP;let v,C,k,N;return e[2]!==s||e[3]!==o||e[4]!==n||e[5]!==i||e[6]!==r||e[7]!==y?(v=d.jsx(bM,{edited:n,onClick:y,connectionState:o,status:r,config:s,needsRun:i}),e[2]=s,e[3]=o,e[4]=n,e[5]=i,e[6]=r,e[7]=y,e[8]=v):v=e[8],e[9]!==o||e[10]!==r?(C=d.jsx(Xj,{status:r,connectionState:o}),e[9]=o,e[10]=r,e[11]=C):C=e[11],e[12]!==u||e[13]!==s||e[14]!==h||e[15]!==f||e[16]!==l||e[17]!==a||e[18]!==g||e[19]!==m||e[20]!==r?(k=g&&d.jsx(g0,{ref:u,cellId:h,status:r,getEditorView:f,name:m,config:s,hasOutput:a,hasConsoleOutput:l,children:d.jsx(ni,{variant:"green",tooltip:null,"data-testid":"cell-actions-button",children:d.jsx(WS,{strokeWidth:1.5})})}),e[12]=u,e[13]=s,e[14]=h,e[15]=f,e[16]=l,e[17]=a,e[18]=g,e[19]=m,e[20]=r,e[21]=k):k=e[21],e[22]!==x||e[23]!==v||e[24]!==C||e[25]!==k?(N=d.jsxs(Kj,{className:x,children:[v,C,k]}),e[22]=x,e[23]=v,e[24]=C,e[25]=k,e[26]=N):N=e[26],N},wM=({theme:t,showPlaceholder:e,id:n,code:o,output:r,consoleOutputs:s,status:i,runStartTimestamp:a,lastRunStartTimestamp:l,runElapsedTimeMs:c,edited:u,interrupted:h,errored:f,stopped:m,staleInputs:_,serializedEditorState:g,debuggerActive:p,connectionState:b,canDelete:x,actions:y,deleteCell:v,userConfig:C,config:k,canMoveX:N,name:j,editorView:I,setEditorView:T})=>{const A=M.useRef(null),R=M.useRef(null),z=M.useRef(null),D=Zt(Na),F=ad(n),B=k.disabled||i==="disabled-transitively",U=q4({executionTime:c,status:i,errored:f,interrupted:h,stopped:m}),O=u||h||_&&!B,S=i==="running"||i==="queued",$=(i==="queued"||u||_)&&!h,E=M.useCallback(()=>I.current,[I]),{closeCompletionHandler:W,resumeCompletionHandler:G}=vy(A,I);ky(A,n,F,y,N,k,I,D,R),Sy(A,n,y,kn.NOOP,C,!0);const q=!H4(r),Y=s.length>0,te=W4(r==null?void 0:r.mimetype),oe=Rc("marimo-cell","hover-actions-parent z-10 border shadow-sm","!border-[var(--blue-5)] !rounded-sm",{"needs-run":O,"has-error":f,stopped:m}),se=As.create(n),Z=Ke(Q=>{D({cellId:n,initialPrompt:Q.prompt})});return d.jsx(Bm,{children:d.jsx(b0,{cellId:n,config:k,status:i,getEditorView:E,hasOutput:q,hasConsoleOutput:Y,name:j,children:d.jsxs("div",{className:oe,"data-status":i,id:se,ref:A,onBlur:W,onKeyDown:G,title:k.disabled?"This cell is disabled":i==="disabled-transitively"?"This cell has a disabled ancestor":void 0,"data-cell-id":n,"data-cell-name":j,"data-setup-cell":!0,children:[d.jsxs("div",{className:Ne("tray"),"data-hidden":!1,children:[d.jsx("div",{className:"absolute right-2 -top-4 z-10",children:d.jsx(jy,{edited:u,connectionState:b,status:i,cellConfig:k,needsRun:O,hasOutput:q,hasConsoleOutput:Y,cellActionDropdownRef:R,cellId:n,name:j,getEditorView:E,onRun:F,includeCellActions:!1})}),d.jsx(Wu,{theme:t,showPlaceholder:e,id:n,code:o,config:k,status:i,serializedEditorState:g,runCell:F,setEditorView:T,userConfig:C,editorViewRef:I,editorViewParentRef:z,hidden:!1,hasOutput:q,temporarilyShowCode:kn.NOOP,languageAdapter:"python",setLanguageAdapter:kn.NOOP,showLanguageToggles:!1}),d.jsx(Ny,{edited:u,status:i,isCellStatusInline:!1,uninstantiated:U,disabled:k.disabled,runElapsedTimeMs:c,runStartTimestamp:a,lastRunStartTimestamp:l,staleInputs:_,interrupted:h}),d.jsx("div",{className:"shoulder-bottom hover-action",children:x&&d.jsx(_y,{connectionState:b,status:i,onClick:()=>{S||po(b)||v({cellId:n})}})})]}),d.jsxs("div",{className:"py-1 px-2 flex justify-end gap-2 last:rounded-b",children:[d.jsx("span",{className:"text-muted-foreground text-xs font-bold",children:"setup cell"}),d.jsx(Te,{content:d.jsxs("span",{className:"max-w-16",children:["This ",d.jsx("b",{children:"setup cell"})," is guaranteed to run before all other cells. Include ",d.jsx("br",{}),"initialization or imports and constants required by top-level functions."]}),children:d.jsx(Um,{size:16,strokeWidth:1.5,className:"rounded-lg text-muted-foreground"})})]}),te&&d.jsx(Pc,{allowExpand:!0,forceExpand:!0,output:r,className:"output-area",cellId:n,stale:!1,loading:S}),d.jsx(ep,{consoleOutputs:s,stale:$,cellName:"_",onRefactorWithAI:Z,onClear:()=>{y.clearCellConsoleOutput({cellId:n})},onSubmitDebugger:(Q,ue)=>{y.setStdinResponse({cellId:n,response:Q,outputIndex:ue}),G4({text:Q})},cellId:n,debuggerActive:p})]})})})},Ey=M.memo(M.forwardRef((t,e)=>{const{status:n,output:o,runStartTimestamp:r,interrupted:s,staleInputs:i,edited:a,id:l,mode:c}=t;St.debug("Rendering Cell",l);const u=M.useRef(null);M.useImperativeHandle(e,()=>({get editorView(){return P_(u)},get editorViewOrNull(){return u.current}}),[u]);const h=SV({status:n,output:o,runStartTimestamp:r,interrupted:s,staleInputs:i},a),f=$4(n);return l===Vo?d.jsx(wM,{...t,editorView:u,setEditorView:m=>{u.current=m},outputStale:h}):c==="edit"?d.jsx(xM,{...t,editorView:u,setEditorView:m=>{u.current=m},outputStale:h}):d.jsx(Cy,{...t,outputStale:h,outputLoading:f})})),vM=(t,e)=>function(n,o){const r=/^(\d+)\.(\d+)\.(\d+)(?:-([\w.-]+))?(?:\+([\w.-]+))?$/,s=i=>{const a=i.match(r);if(!a)return null;const[,l,c,u,h]=a;return{major:Number.parseInt(l,10),minor:Number.parseInt(c,10),patch:Number.parseInt(u,10),preRelease:h||""}};try{const i=s(n),a=s(o);return i&&a?i.major!==a.major?i.major-a.major:i.minor!==a.minor?i.minor-a.minor:i.patch!==a.patch?i.patch-a.patch:i.preRelease===""&&a.preRelease!==""?1:i.preRelease!==""&&a.preRelease===""?-1:i.preRelease.localeCompare(a.preRelease):n.localeCompare(o,void 0,{numeric:!0,sensitivity:"base"})}catch{return n.localeCompare(o,void 0,{numeric:!0,sensitivity:"base"})}}(e,t),Iy=new class{constructor(t){this.ttl=void 0,this.cache=new Map,this.ttl=t.ttl}cleanupExpiredEntries(){const t=Date.now();for(const[e,n]of this.cache.entries())t-n.timestamp>this.ttl&&this.cache.delete(e)}get(t){this.cleanupExpiredEntries();const e=this.cache.get(t);if(e){if(!(Date.now()-e.timestamp>this.ttl))return e.data;this.cache.delete(t)}}set(t,e){this.cache.set(t,{data:e,timestamp:Date.now()})}clear(){this.cache.clear()}}({ttl:3e5}),kM=yt({info:yt({provides_extra:ft().array().nullable()}),releases:EV(ft(),IV())});function Ay(t){const e=X.c(5);let n;e[0]!==t?(n=function(i){return i.replaceAll(/\[.*]/g,"").trim()}(t),e[0]=t,e[1]=n):n=e[1];const o=n;let r,s;return e[2]!==o?(r=async()=>{const i=Iy.get(o);if(i)return i;const a=await fetch(`https://pypi.org/pypi/${o}/json`,{method:"GET"});if(!a.ok)throw new Error(`HTTP ${a.status}: ${a.statusText}`);const l=kM.transform(SM).parse(await a.json());return Iy.set(o,l),l},s=[o],e[2]=o,e[3]=r,e[4]=s):(r=e[3],s=e[4]),Wn(r,s)}function SM(t){return{versions:Object.keys(t.releases).toSorted(vM),extras:t.info.provides_extra??[]}}function Ty(t){const e=t.match(/^([^[]+)(?:\[([^\]]+)])?$/);if(!e)return{name:t,extras:[]};const[,n,o]=e;return{name:n,extras:o?o.split(",").map(r=>r.trim()):[]}}const CM=()=>{const t=X.c(70),{packageAlert:e}=zH(),{clearPackageAlert:n}=BH(),[o]=Dr();let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={},t[0]=r):r=t[0];const[s,i]=M.useState(r);let a;t[1]===Symbol.for("react.memo_cache_sentinel")?(a={},t[1]=a):a=t[1];const[l,c]=M.useState(a);if(e===null)return null;const u=o.package_management.manager!=="pixi";if(UH(e)){let h,f,m,_,g,p,b,x,y,v;if(t[2]===Symbol.for("react.memo_cache_sentinel")?(h=d.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[d.jsx(td,{className:"w-5 h-5 inline-block mr-2"}),"Missing packages"]}),t[2]=h):h=t[2],t[3]!==n||t[4]!==e.id?(f=()=>n(e.id),t[3]=n,t[4]=e.id,t[5]=f):f=t[5],t[6]===Symbol.for("react.memo_cache_sentinel")?(m=d.jsx(eo,{className:"w-5 h-5"}),t[6]=m):m=t[6],t[7]!==f?(_=d.jsxs("div",{className:"flex justify-between",children:[h,d.jsx(Me,{variant:"text","data-testid":"remove-banner-button",size:"icon",onClick:f,children:m})]}),t[7]=f,t[8]=_):_=t[8],t[9]===Symbol.for("react.memo_cache_sentinel")?(g=d.jsx("p",{children:"The following packages were not found:"}),t[9]=g):g=t[9],t[10]!==s||t[11]!==u||t[12]!==e.packages||t[13]!==l){let C;t[15]!==s||t[16]!==u||t[17]!==l?(C=(k,N)=>{const j=Ty(k),I=l[k]||j.extras;return d.jsxs("li",{className:"flex items-center gap-2 font-mono text-sm",children:[d.jsx(qs,{size:"1rem"}),d.jsx(IM,{packageName:j.name,selectedExtras:I,onExtrasChange:T=>c(A=>({...A,[k]:T}))}),u&&d.jsx(AM,{value:s[k]??"latest",onChange:T=>i(A=>({...A,[k]:T})),packageName:j.name})]},N)},t[15]=s,t[16]=u,t[17]=l,t[18]=C):C=t[18],p=e.packages.map(C),t[10]=s,t[11]=u,t[12]=e.packages,t[13]=l,t[14]=p}else p=t[14];return t[19]!==p?(b=d.jsxs("div",{children:[g,d.jsx("ul",{className:"list-disc ml-4 mt-1",children:p})]}),t[19]=p,t[20]=b):b=t[20],t[21]!==n||t[22]!==s||t[23]!==e.id||t[24]!==e.isolated||t[25]!==e.packages||t[26]!==l||t[27]!==o.package_management.manager?(x=d.jsx("div",{className:"ml-auto flex flex-row items-baseline",children:e.isolated?d.jsxs(d.Fragment,{children:[d.jsx(jM,{manager:o.package_management.manager,packages:e.packages.map(C=>{const k=Ty(C),N=l[C]||k.extras;return function(j,I){return I.length===0?j:`${j}[${I.join(",")}]`}(k.name,N)}),versions:s,clearPackageAlert:()=>n(e.id)}),!un()&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"px-2 text-sm",children:"with"})," ",d.jsx(EM,{})]})]}):d.jsxs("p",{children:["If you set up a"," ",d.jsx(pm,{href:"https://docs.python.org/3/tutorial/venv.html#creating-virtual-environments",children:"virtual environment"}),", marimo can install these packages for you."]})}),t[21]=n,t[22]=s,t[23]=e.id,t[24]=e.isolated,t[25]=e.packages,t[26]=l,t[27]=o.package_management.manager,t[28]=x):x=t[28],t[29]!==b||t[30]!==x?(y=d.jsxs("div",{className:"flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",children:[b,x]}),t[29]=b,t[30]=x,t[31]=y):y=t[31],t[32]!==y||t[33]!==_?(v=d.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-12 min-w-[400px] z-[200] opacity-95",children:d.jsxs(Lc,{kind:"danger",className:"flex flex-col rounded py-3 px-5 animate-in slide-in-from-left",children:[_,y]})}),t[32]=y,t[33]=_,t[34]=v):v=t[34],v}if(VH(e)){let h;t[35]!==e.packages?(h=function(D){const F=new Set(Object.values(D)),B=F.has("queued")||F.has("installing")?"installing":F.has("failed")?"failed":"installed";return B==="installing"?{status:"installing",title:"Installing packages",titleIcon:d.jsx(ba,{className:"w-5 h-5 inline-block mr-2"}),description:"Installing packages:"}:B==="installed"?{status:"installed",title:"All packages installed!",titleIcon:d.jsx(Ap,{className:"w-5 h-5 inline-block mr-2"}),description:"Installed packages:"}:{status:"failed",title:"Some packages failed to install",titleIcon:d.jsx(td,{className:"w-5 h-5 inline-block mr-2"}),description:"See terminal for error logs."}}(e.packages),t[35]=e.packages,t[36]=h):h=t[36];const{status:f,title:m,titleIcon:_,description:g}=h;f==="installed"&&setTimeout(()=>n(e.id),1e4);const p=f==="failed"?"danger":"info";let b,x,y,v,C;t[37]!==m||t[38]!==_?(b=d.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[_,m]}),t[37]=m,t[38]=_,t[39]=b):b=t[39],t[40]!==n||t[41]!==e.id?(x=()=>n(e.id),t[40]=n,t[41]=e.id,t[42]=x):x=t[42],t[43]===Symbol.for("react.memo_cache_sentinel")?(y=d.jsx(eo,{className:"w-5 h-5"}),t[43]=y):y=t[43],t[44]!==x?(v=d.jsx(Me,{variant:"text","data-testid":"remove-banner-button",size:"icon",onClick:x,children:y}),t[44]=x,t[45]=v):v=t[45],t[46]!==b||t[47]!==v?(C=d.jsxs("div",{className:"flex justify-between",children:[b,v]}),t[46]=b,t[47]=v,t[48]=C):C=t[48];const k=f==="installed"&&"text-accent-foreground";let N,j,I,T,A,R,z;if(t[49]!==k?(N=Ne("flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",k),t[49]=k,t[50]=N):N=t[50],t[51]!==g?(j=d.jsx("p",{children:g}),t[51]=g,t[52]=j):j=t[52],t[53]!==e.packages||t[54]!==f){let D;t[56]!==f?(D=(F,B)=>{const[U,O]=F;return d.jsxs("li",{className:Ne("flex items-center gap-1 font-mono text-sm",O==="installing"&&"font-semibold",O==="failed"&&"text-destructive",O==="installed"&&"text-accent-foreground",O==="installed"&&f==="failed"&&"text-muted-foreground"),children:[d.jsx(NM,{status:O}),U]},B)},t[56]=f,t[57]=D):D=t[57],I=Object.entries(e.packages).map(D),t[53]=e.packages,t[54]=f,t[55]=I}else I=t[55];return t[58]!==I?(T=d.jsx("ul",{className:"list-disc ml-4 mt-1",children:I}),t[58]=I,t[59]=T):T=t[59],t[60]!==j||t[61]!==T?(A=d.jsxs("div",{children:[j,T]}),t[60]=j,t[61]=T,t[62]=A):A=t[62],t[63]!==N||t[64]!==A?(R=d.jsx("div",{className:N,children:A}),t[63]=N,t[64]=A,t[65]=R):R=t[65],t[66]!==R||t[67]!==p||t[68]!==C?(z=d.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-12 min-w-[400px] z-[200] opacity-95",children:d.jsxs(Lc,{kind:p,className:"flex flex-col rounded pt-3 pb-4 px-5",children:[C,R]})}),t[66]=R,t[67]=p,t[68]=C,t[69]=z):z=t[69],z}return dc(e),null},NM=t=>{const e=X.c(4),{status:n}=t;switch(n){case"queued":{let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=d.jsx(qs,{size:"1rem"}),e[0]=o):o=e[0],o}case"installing":{let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=d.jsx(ba,{size:"1rem"}),e[1]=o):o=e[1],o}case"installed":{let o;return e[2]===Symbol.for("react.memo_cache_sentinel")?(o=d.jsx(mc,{size:"1rem"}),e[2]=o):o=e[2],o}case"failed":{let o;return e[3]===Symbol.for("react.memo_cache_sentinel")?(o=d.jsx(eo,{size:"1rem"}),e[3]=o):o=e[3],o}default:return dc(n),null}},jM=t=>{const e=X.c(9),{manager:n,packages:o,versions:r,clearPackageAlert:s}=t;let i,a,l,c;return e[0]!==s||e[1]!==n||e[2]!==o||e[3]!==r?(i=async()=>{s();const u={...r};for(const h of o)u[h]=u[h]??"";await OV({manager:n,versions:u}).catch(TM)},e[0]=s,e[1]=n,e[2]=o,e[3]=r,e[4]=i):i=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(a=d.jsx(ba,{className:"w-4 h-4 mr-2"}),l=d.jsx("span",{className:"font-semibold",children:"Install"}),e[5]=a,e[6]=l):(a=e[5],l=e[6]),e[7]!==i?(c=d.jsxs(Me,{variant:"outline","data-testid":"install-packages-button",size:"sm",onClick:i,children:[a,l]}),e[7]=i,e[8]=c):c=e[8],c},EM=()=>{const t=X.c(16),[e,n]=Dr();let o,r;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=t4(AV),t[0]=o):o=t[0],t[1]!==e?(r={resolver:o,defaultValues:e},t[1]=e,t[2]=r):r=t[2];const s=n4(r);let i;t[3]!==n?(i=async f=>{await Rr({config:f}).then(()=>{n(f)})},t[3]=n,t[4]=i):i=t[4];const a=i;let l,c,u,h;return t[5]!==s||t[6]!==a?(l=s.handleSubmit(a),t[5]=s,t[6]=a,t[7]=l):l=t[7],t[8]!==s.control?(c=d.jsx("div",{className:"flex flex-col gap-3",children:d.jsx(J3,{control:s.control,name:"package_management.manager",render:OM})}),t[8]=s.control,t[9]=c):c=t[9],t[10]!==l||t[11]!==c?(u=d.jsx("form",{onChange:l,className:"flex flex-col gap-5",children:c}),t[10]=l,t[11]=c,t[12]=u):u=t[12],t[13]!==s||t[14]!==u?(h=d.jsx(TV,{...s,children:u}),t[13]=s,t[14]=u,t[15]=h):h=t[15],h},IM=t=>{const e=X.c(14),{packageName:n,selectedExtras:o,onExtrasChange:r}=t,[s,i]=M.useState(!1),{isPending:a,error:l,data:c}=Ay(n);let u;e[0]!==r||e[1]!==o?(u=(g,p)=>{r(p?[...o,g]:o.filter(b=>b!==g))},e[0]=r,e[1]=o,e[2]=u):u=e[2];const h=u,f=!a&&!l;let m,_;if(e[3]!==(c==null?void 0:c.extras)?(m=(c==null?void 0:c.extras)??[],e[3]=c==null?void 0:c.extras,e[4]=m):m=e[4],e[5]!==f||e[6]!==h||e[7]!==s||e[8]!==n||e[9]!==o||e[10]!==m){const g=m.filter(DM);let p;e[12]!==n?(p=d.jsx("span",{className:"shrink-0",children:n}),e[12]=n,e[13]=p):p=e[13],_=d.jsxs("div",{className:"flex items-center max-w-72",children:[p,o.length>0?d.jsxs("span",{className:"flex items-center min-w-0 flex-1",children:[d.jsx("span",{className:"shrink-0",children:"["}),d.jsxs(Pr,{open:s&&f,onOpenChange:b=>{f&&i(b)},children:[d.jsx(Lr,{asChild:!0,children:d.jsx("button",{className:"hover:bg-muted/50 rounded text-sm px-1 transition-colors border border-muted-foreground/30 hover:border-muted-foreground/60 min-w-0 flex-1 truncate text-left",title:`Selected extras: ${o.join(", ")}`,children:o.join(",")})}),d.jsxs(Fr,{align:"start",className:"w-64 p-0 max-h-96 flex flex-col",children:[o.length>0&&d.jsx("div",{className:"p-2 bg-popover border-b border-border",children:d.jsx("div",{className:"flex flex-wrap gap-1 p-1 min-h-[24px]",children:o.map(b=>d.jsxs("span",{className:"inline-flex items-center gap-1 px-1 py-0.5 text-sm font-mono border border-muted-foreground/30 hover:border-muted-foreground/60 rounded-sm cursor-pointer group transition-colors",onClick:()=>h(b,!1),children:[b,d.jsx(eo,{className:"w-3 h-3 opacity-60 group-hover:opacity-100"})]},b))})}),d.jsx("div",{className:"overflow-y-auto flex-1",children:g.map(b=>d.jsx(Y4,{checked:o.includes(b),onCheckedChange:x=>{h(b,x)},className:"font-mono text-sm",onSelect:RM,children:b},b))})]})]}),d.jsx("span",{className:"shrink-0",children:"]"})]}):g.length>0?d.jsxs(Pr,{open:s&&f,onOpenChange:b=>{f&&i(b)},children:[d.jsx(Lr,{asChild:!0,children:d.jsx("button",{disabled:!f,className:Ne("hover:bg-muted/50 rounded text-sm ml-2 transition-colors border border-muted-foreground/30 hover:border-muted-foreground/60 h-5 w-5 flex items-center justify-center p-0",!f&&"opacity-50 cursor-not-allowed"),title:f?"Add extras":"Loading extras...",children:d.jsx(ur,{className:"w-3 h-3 flex-shrink-0"})})}),d.jsxs(Fr,{align:"start",className:"w-64 p-0 max-h-96 flex flex-col",children:[d.jsx("div",{className:"p-2 bg-popover border-b border-border",children:d.jsx("span",{className:"text-muted-foreground italic text-sm",children:"Package extras"})}),d.jsx("div",{className:"overflow-y-auto flex-1",children:g.map(b=>d.jsx(Y4,{checked:o.includes(b),onCheckedChange:x=>{h(b,x)},className:"font-mono text-sm",onSelect:PM,children:b},b))})]})]}):null]}),e[5]=f,e[6]=h,e[7]=s,e[8]=n,e[9]=o,e[10]=m,e[11]=_}else _=e[11];return _},AM=t=>{const e=X.c(16),{value:n,onChange:o,packageName:r}=t,{error:s,isPending:i,data:a}=Ay(r);if(s){let h,f,m;return e[0]!==o?(h=_=>o(_.target.value),e[0]=o,e[1]=h):h=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(f=d.jsx("option",{value:"latest",children:"latest"}),e[2]=f):f=e[2],e[3]!==h||e[4]!==n?(m=d.jsx(Te,{content:"Failed to fetch package versions",children:d.jsx(Vm,{value:n,onChange:h,disabled:!0,className:"inline-flex ml-2 w-24 text-ellipsis",children:f})}),e[3]=h,e[4]=n,e[5]=m):m=e[5],m}let l,c,u;return e[6]!==o?(l=h=>o(h.target.value),e[6]=o,e[7]=l):l=e[7],e[8]!==i||e[9]!==a?(c=i?d.jsx("option",{value:"latest",children:"latest"}):["latest",...a.versions.slice(0,100)].map(LM),e[8]=i,e[9]=a,e[10]=c):c=e[10],e[11]!==i||e[12]!==l||e[13]!==c||e[14]!==n?(u=d.jsx(Vm,{value:n,onChange:l,disabled:i,className:"inline-flex ml-2 w-24 text-ellipsis",children:c}),e[11]=i,e[12]=l,e[13]=c,e[14]=n,e[15]=u):u=e[15],u};function TM(t){St.error(t)}function MM(t){return d.jsx("option",{value:t,children:t},t)}function OM(t){const{field:e}=t;return d.jsxs(K3,{children:[d.jsx(X3,{children:d.jsx(Vm,{"data-testid":"install-package-manager-select",onChange:n=>e.onChange(n.target.value),value:e.value,disabled:e.disabled,className:"inline-flex mr-2",children:MV.map(MM)})}),d.jsx(e4,{})]})}function DM(t){return!/^(dev|test|testing)$/i.test(t)}function RM(t){return t.preventDefault()}function PM(t){return t.preventDefault()}function LM(t){return d.jsx("option",{value:t,children:t},t)}const FM=t=>{let{transform:e}=t;return{...e,x:0}},zM={threshold:{x:0,y:.1}},BM=K.memo(t=>{const e=X.c(23),{children:n,multiColumn:o}=t,{dropCellOverCell:r,dropCellOverColumn:s,moveColumn:i,compactColumns:a}=Tt(),[l,c]=M.useState(null),[u,h]=M.useState(null),[f]=W3();let m;e:{if(f.width==="columns"){m=$m.EMPTY;break e}let D;e[0]===Symbol.for("react.memo_cache_sentinel")?(D=[FM],e[0]=D):D=e[0],m=D}const _=m;let g,p;e[1]===Symbol.for("react.memo_cache_sentinel")?(g={activationConstraint:{distance:8}},e[1]=g):g=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(p={coordinateGetter:Yj},e[2]=p):p=e[2];const b=function(){for(var D=arguments.length,F=new Array(D),B=0;B<D;B++)F[B]=arguments[B];return M.useMemo(()=>[...F].filter(U=>U!=null),[...F])}(Ug(Od,g),Ug(Td,p));let x;e[3]===Symbol.for("react.memo_cache_sentinel")?(x=D=>{c(D.active.id);const F=$n();h(F.cellIds)},e[3]=x):x=e[3];const y=Ke(x);let v;e[4]!==u?(v=()=>{c(null),h(null)},e[4]=u,e[5]=v):v=e[5];const C=Ke(v);let k;e[6]!==l?(k=D=>{const F=D.droppableContainers.filter(UM);if(l&&ls(l))return Nd({...D,droppableContainers:F});const B=(E=>{let{droppableContainers:W,droppableRects:G,pointerCoordinates:q}=E;if(!q)return[];const Y=[];for(const te of W){const{id:oe}=te,se=G.get(oe);if(se&&hj(q,se)){const Z=Sd(se).reduce((ue,me)=>ue+vd(q,me),0),Q=Number((Z/4).toFixed(4));Y.push({id:oe,data:{droppableContainer:te,value:Q}})}}return Y.sort(kd)})({...D,droppableContainers:F}),U=Cd(B.length>0?B:$g({...D,droppableContainers:F}),"id");if(!U)return[];Fo(ls(U),`Expected column id. Got: ${U}`);const O=$n().cellIds.get(U);if(Fo(O,`Expected column. Got: ${U}`),O&&O.topLevelIds.length===0)return[{id:U}];const S=new Set(O.topLevelIds),$=Nd({...D,droppableContainers:D.droppableContainers.filter(E=>E.id!==U&&S.has(E.id))});if($.length>0){const E=$[0].id;return Fo(qu(E),`Expected cell id. Got: ${E}`),[{id:E}]}return[]},e[6]=l,e[7]=k):k=e[7];const N=k;let j;e[8]!==r||e[9]!==s||e[10]!==i?(j=D=>{const{active:F,over:B}=D,U=B==null?void 0:B.id;if(U!=null&&F.id!==U){if(qu(F.id)){if(ls(U))return void s({cellId:F.id,columnId:U});if(qu(U))return void r({cellId:F.id,overCellId:U})}ls(F.id)&&ls(U)&&i({column:F.id,overColumn:U})}},e[8]=r,e[9]=s,e[10]=i,e[11]=j):j=e[11];const I=Ke(j);let T;e[12]!==a?(T=D=>{const{active:F,over:B}=D;B!==null&&F.id!==B.id&&a()},e[12]=a,e[13]=T):T=e[13];const A=Ke(T),R=o?N:Nd;let z;return e[14]!==n||e[15]!==C||e[16]!==A||e[17]!==I||e[18]!==y||e[19]!==_||e[20]!==b||e[21]!==R?(z=d.jsx(Rj,{autoScroll:zM,sensors:b,collisionDetection:R,modifiers:_,onDragEnd:A,onDragStart:y,onDragCancel:C,onDragOver:I,children:n}),e[14]=n,e[15]=C,e[16]=A,e[17]=I,e[18]=y,e[19]=_,e[20]=b,e[21]=R,e[22]=z):z=e[22],z});function qu(t){return typeof t=="string"&&!t.startsWith("tree_")}function ls(t){return typeof t=="string"&&t.startsWith("tree_")}function UM(t){return ls(t.id)}const VM=t=>{const e=X.c(13),{className:n,size:o,gap:r,durationMs:s}=t,i=o===void 0?8:o,a=r===void 0?"gap-1":r,l=s===void 0?1200:s,c=`${l}ms`;let u;e[0]!==c?(u={animationDuration:c},e[0]=c,e[1]=u):u=e[1];const h=u;let f,m,_,g;return e[2]!==n||e[3]!==a?(f=Rc("flex",a,n),e[2]=n,e[3]=a,e[4]=f):f=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(m=[0,1,2],e[5]=m):m=e[5],e[6]!==h||e[7]!==l||e[8]!==i?(_=m.map(p=>d.jsx(DV,{width:i,height:i,className:"fill-current text-current animate-ellipsis-dot",style:{...h,animationDelay:l/3*p+"ms"}},p)),e[6]=h,e[7]=l,e[8]=i,e[9]=_):_=e[9],e[10]!==f||e[11]!==_?(g=d.jsx("div",{className:f,"aria-label":"Loading",children:_}),e[10]=f,e[11]=_,e[12]=g):g=e[12],g},$M=()=>{const t=X.c(2),e=Ue(RV);let n;return t[0]!==e?(n=e&&d.jsx(zm,{milliseconds:1e3,children:d.jsx("div",{className:"absolute top-4 m-0 flex items-center min-h-[28px] left-1/2 transform -translate-x-1/2 z-[200] ",children:d.jsx(Te,{content:"Connecting to a marimo runtime",children:d.jsx("div",{className:"flex items-center",children:d.jsx(VM,{size:5,className:"text-yellow-500"})})})})}),t[0]=e,t[1]=n):n=t[1],n},My=K.forwardRef((t,e)=>{const n=X.c(62);let o,r,s,i,a,l;n[0]!==t?({columnId:i,canDelete:o,canMoveLeft:r,canMoveRight:s,...a}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=i,n[5]=a):(o=n[1],r=n[2],s=n[3],i=n[4],a=n[5]),n[6]!==i?(l={id:i},n[6]=i,n[7]=l):l=n[7];const{attributes:c,listeners:u,setNodeRef:h,transform:f,transition:m,isDragging:_,isOver:g}=b1(l);let p;n[8]!==f?(p=f?kc.Transform.toString({x:f.x,y:0,scaleX:1,scaleY:1}):void 0,n[8]=f,n[9]=p):p=n[9];const b=_?2:void 0;let x;n[10]!==p||n[11]!==b||n[12]!==m?(x={transform:p,transition:m,zIndex:b,position:"relative","--gutter-width":"50px"},n[10]=p,n[11]=b,n[12]=m,n[13]=x):x=n[13];const y=x,{deleteColumn:v,moveColumn:C,addColumn:k}=Tt();let N;n[14]===Symbol.for("react.memo_cache_sentinel")?(N=Ne("h-full hover:bg-muted rounded-none"),n[14]=N):N=n[14];const j=N,I=WM;let T;n[15]!==i||n[16]!==C?(T=()=>C({column:i,overColumn:"_left_"}),n[15]=i,n[16]=C,n[17]=T):T=n[17];const A=!r;let R,z,D;n[18]===Symbol.for("react.memo_cache_sentinel")?(R=d.jsx(H3,{className:"size-4"}),n[18]=R):R=n[18],n[19]!==T||n[20]!==A?(z=d.jsx(Te,{content:"Move column left",side:"top",delayDuration:300,children:d.jsx(Me,{variant:"text",size:"sm",className:j,onClick:T,disabled:A,children:R})}),n[19]=T,n[20]=A,n[21]=z):z=n[21],n[22]!==i||n[23]!==C?(D=()=>C({column:i,overColumn:"_right_"}),n[22]=i,n[23]=C,n[24]=D):D=n[24];const F=!s;let B,U,O,S,$,E,W,G;n[25]===Symbol.for("react.memo_cache_sentinel")?(B=d.jsx(Yi,{className:"size-4"}),n[25]=B):B=n[25],n[26]!==D||n[27]!==F?(U=d.jsx(Te,{content:"Move column right",side:"top",delayDuration:300,children:d.jsx(Me,{variant:"text",size:"sm",className:j,onClick:D,disabled:F,children:B})}),n[26]=D,n[27]=F,n[28]=U):U=n[28],n[29]!==c||n[30]!==u?(O=d.jsx("div",{className:"flex gap-2 h-full flex-grow active:bg-accent cursor-grab",...c,...u,"data-testid":"column-drag-button"}),n[29]=c,n[30]=u,n[31]=O):O=n[31],n[32]!==o||n[33]!==i||n[34]!==v?(S=o&&d.jsx(Te,{content:"Delete column",side:"top",delayDuration:300,children:d.jsx(Me,{variant:"text",size:"sm",className:"opacity-0 group-hover:opacity-70 group-hover:hover:opacity-100 text-destructive h-full hover:bg-destructive/20 rounded-none",onClick:()=>v({columnId:i}),children:d.jsx(eo,{className:"size-4"})})}),n[32]=o,n[33]=i,n[34]=v,n[35]=S):S=n[35],n[36]!==k||n[37]!==i?($=()=>{k({columnId:i}),requestAnimationFrame(I)},n[36]=k,n[37]=i,n[38]=$):$=n[38],n[39]===Symbol.for("react.memo_cache_sentinel")?(E=d.jsx(ur,{className:"size-4"}),n[39]=E):E=n[39],n[40]!==$?(W=d.jsx(Te,{content:"Add column",side:"top",delayDuration:300,children:d.jsx(Me,{variant:"text",size:"sm",className:j,onClick:$,children:E})}),n[40]=$,n[41]=W):W=n[41],n[42]!==U||n[43]!==O||n[44]!==S||n[45]!==W||n[46]!==z?(G=d.jsxs("div",{className:"h-6 group flex items-center rounded-t-lg border hover:border-border border-[var(--slate-3)] overflow-hidden bg-[var(--slate-1)]",children:[z,U,O,S,W]}),n[42]=U,n[43]=O,n[44]=S,n[45]=W,n[46]=z,n[47]=G):G=n[47];const q=G;let Y;n[48]!==e||n[49]!==h?(Y=ue=>{pl(e,h)(ue)},n[48]=e,n[49]=h,n[50]=Y):Y=n[50];const te=_?"":a.className,oe=_?"z-20":"z-1 hover:z-10 focus-within:z-10",se=g&&"bg-accent/20";let Z,Q;return n[51]!==te||n[52]!==oe||n[53]!==se?(Z=Ne(te,oe,se),n[51]=te,n[52]=oe,n[53]=se,n[54]=Z):Z=n[54],n[55]!==q||n[56]!==_||n[57]!==a||n[58]!==y||n[59]!==Y||n[60]!==Z?(Q=d.jsxs("div",{tabIndex:-1,ref:Y,...a,style:y,"data-is-dragging":_,className:Z,children:[q,a.children]}),n[55]=q,n[56]=_,n[57]=a,n[58]=y,n[59]=Y,n[60]=Z,n[61]=Q):Q=n[61],Q});My.displayName="SortableColumn";const HM=M.memo(My);function WM(){const t=document.getElementById("App");t&&t.scrollTo({left:t.scrollLeft+1e3,behavior:"smooth"})}const{getColumnWidth:qM,saveColumnWidth:GM}=PV,Oy=M.memo(t=>{const e=X.c(14),n=M.useRef(null);let o;e[0]!==t.children||e[1]!==t.index||e[2]!==t.width?(o=t.width==="columns"?d.jsx(YM,{startingWidth:qM(t.index),onResize:i=>{GM(t.index,i)},children:t.children}):d.jsx("div",{className:"flex flex-col gap-5",children:t.children}),e[0]=t.children,e[1]=t.index,e[2]=t.width,e[3]=o):o=e[3];const r=o;if(t.width==="columns"){let i;return e[4]!==r||e[5]!==t.canDelete||e[6]!==t.canMoveLeft||e[7]!==t.canMoveRight||e[8]!==t.columnId||e[9]!==t.footer?(i=d.jsxs(HM,{tabIndex:-1,ref:n,canDelete:t.canDelete,columnId:t.columnId,canMoveLeft:t.canMoveLeft,canMoveRight:t.canMoveRight,className:"group/column",children:[r,t.footer]}),e[4]=r,e[5]=t.canDelete,e[6]=t.canMoveLeft,e[7]=t.canMoveRight,e[8]=t.columnId,e[9]=t.footer,e[10]=i):i=e[10],i}let s;return e[11]!==r||e[12]!==t.footer?(s=d.jsxs(d.Fragment,{children:[r,t.footer]}),e[11]=r,e[12]=t.footer,e[13]=s):s=e[13],s});Oy.displayName="Column";const YM=t=>{const e=X.c(15),{startingWidth:n,onResize:o,children:r}=t;let s;e[0]!==o||e[1]!==n?(s={startingWidth:n,onResize:o},e[0]=o,e[1]=n,e[2]=s):s=e[2];const{resizableDivRef:i,handleRefs:a,style:l}=LV(s),c=JM;let u,h,f,m;return e[3]!==a.left?(u=c(a.left),e[3]=a.left,e[4]=u):u=e[4],e[5]!==r||e[6]!==i||e[7]!==l?(h=d.jsx("div",{ref:i,className:"flex flex-col gap-5 box-content min-h-[100px] px-11 py-6 min-w-[500px] z-1",style:l,children:r}),e[5]=r,e[6]=i,e[7]=l,e[8]=h):h=e[8],e[9]!==a.right?(f=c(a.right),e[9]=a.right,e[10]=f):f=e[10],e[11]!==u||e[12]!==h||e[13]!==f?(m=d.jsxs("div",{className:"flex flex-row",children:[u,h,f]}),e[11]=u,e[12]=h,e[13]=f,e[14]=m):m=e[14],m};function JM(t){return d.jsx("div",{ref:t,className:`w-[3px] cursor-col-resize transition-colors duration-200 z-[100]
|
121
|
-
relative before:content-[''] before:absolute before:inset-y-0 before:-left-[3px]
|
122
|
-
before:right-[-3px] before:w-[9px] before:z-[-1]
|
123
|
-
hover/column:bg-[var(--slate-3)] dark:hover/column:bg-[var(--slate-5)]
|
124
|
-
hover/column:hover:bg-primary/60 dark:hover/column:hover:bg-primary/60`})}const KM=t=>{const e=X.c(10),{width:n}=t,{banners:o}=$H(),{removeBanner:r}=HH();if(o.length===0)return null;const s=n==="columns"&&"sticky left-12 w-full max-w-[80vw]";let i,a,l;if(e[0]!==s?(i=Ne("flex flex-col gap-4 mb-5 print:hidden",s),e[0]=s,e[1]=i):i=e[1],e[2]!==o||e[3]!==r){let c;e[5]!==r?(c=u=>d.jsxs(Lc,{kind:u.variant||"info",className:"flex flex-col rounded p-3",children:[d.jsxs("div",{className:"flex justify-between",children:[d.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[d.jsx(J4,{className:"w-5 h-5 inline-block mr-2"}),u.title]}),d.jsx(Me,{"data-testid":"remove-banner-button",variant:"text",size:"icon",onClick:()=>r(u.id),children:d.jsx(eo,{className:"w-5 h-5"})})]}),d.jsxs("div",{className:"flex justify-between items-end",children:[d.jsx("span",{children:Hm({html:u.description})}),u.action==="restart"&&d.jsx(XM,{})]})]},u.id),e[5]=r,e[6]=c):c=e[6],a=o.map(c),e[2]=o,e[3]=r,e[4]=a}else a=e[4];return e[7]!==i||e[8]!==a?(l=d.jsx("div",{className:i,children:a}),e[7]=i,e[8]=a,e[9]=l):l=e[9],l},XM=()=>{const t=X.c(3),e=Ig();let n,o;return t[0]===Symbol.for("react.memo_cache_sentinel")?(n=d.jsx(Rp,{className:"w-3 h-3 mr-2"}),t[0]=n):n=t[0],t[1]!==e?(o=d.jsxs(Me,{"data-testid":"restart-session-button",variant:"link",size:"xs",onClick:e,children:[n,"Restart"]}),t[1]=e,t[2]=o):o=t[2],o},ZM=qt(t=>{const e=t(im);for(const n of e.cellIds.inOrderIds){const o=e.cellRuntime[n];if(o.status==="idle"&&o.consoleOutputs.some(r=>r.channel==="stdin"&&r.response===void 0))return!0}return!1}),QM=()=>{const t=X.c(3),e=eO;if(!Ue(ZM))return null;let n,o,r;if(t[0]===Symbol.for("react.memo_cache_sentinel")?(n=d.jsx("div",{className:"flex justify-between",children:d.jsx("span",{className:"font-bold text-lg flex items-center mb-1",children:"Program waiting for input"})}),t[0]=n):n=t[0],t[1]===Symbol.for("react.memo_cache_sentinel")?(o=d.jsx(S4,{className:"inline",children:"stdin"}),t[1]=o):o=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")){const s=d.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-1/2 transform -translate-x-1/2 z-[200] opacity-95",children:d.jsxs(Lc,{kind:"info",className:"flex flex-col rounded py-2 px-4 animate-in slide-in-from-top w-fit",children:[n,d.jsx("div",{className:"flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",children:d.jsx("div",{children:d.jsxs("p",{children:["The program is still running, but blocked on"," ",o,".",d.jsx(Me,{variant:"link",className:"h-auto font-normal",onClick:e,children:"Jump to the cell"})]})})})]})});r=d.jsx(zm,{milliseconds:2e3,children:s}),t[2]=r}else r=t[2];return r};function eO(){const t=document.querySelector("[data-stdin-blocking]");t?(t.scrollIntoView({behavior:"smooth",block:"center"}),requestAnimationFrame(()=>{t.focus()})):St.error("No element with data-stdin-blocking found")}function tO(){const t=setTimeout(nO,100);return()=>clearTimeout(t)}function nO(){requestAnimationFrame(oO)}function oO(){const t=function(e){const n=e.match(/scrollTo=([^&]+)/),o=n==null?void 0:n[1];return o?decodeURIComponent(o.split("&")[0]):null}(window.location.hash);if(t)(function(e){var o,r;if(Ry)return;const n=document.querySelector(`[data-cell-name="${e}"]`);if(n){if(n.scrollIntoView({behavior:"smooth",block:"start"}),Ry=!0,n instanceof HTMLElement){n.focus();const{cellHandles:s}=$n(),i=n.dataset.cellId;if(!i)return void St.error(`Missing cellId for cell with name ${e}`);const a=(r=(o=s[i])==null?void 0:o.current)==null?void 0:r.editorView;a&&a.focus()}}else St.warn(`Cannot focus cell with name ${e} because it was not found`),Dy()})(t);else try{Dy()}catch(e){const n=e;St.warn("Error focusing first editor",n)}}function Dy(){var o,r;const{cellIds:t,cellData:e,cellHandles:n}=$n();for(const s of t.iterateTopLevelIds){const i=n[s];if(!((o=e[s])==null?void 0:o.config.hide_code)&&((r=i==null?void 0:i.current)!=null&&r.editorView))return void i.current.editorView.focus()}}let Ry=!1;const rO=t=>{const e=X.c(8),n=Ue(FV),o=t.appConfig.width==="columns";let r,s,i;return e[0]!==t?(r=d.jsx(sO,{...t}),e[0]=t,e[1]=r):r=e[1],e[2]!==n||e[3]!==r?(s=d.jsx(g1,{id:"column-container",items:n,strategy:Bj,children:r}),e[2]=n,e[3]=r,e[4]=s):s=e[4],e[5]!==o||e[6]!==s?(i=d.jsx(BM,{multiColumn:o,children:s}),e[5]=o,e[6]=s,e[7]=i):i=e[7],i},sO=t=>{const e=X.c(52),{mode:n,userConfig:o,appConfig:r,connStatus:s}=t,i=xc(),a=Tt(),{theme:l}=hr(),{toggleSidebarPanel:c}=Zi();K4(tO),Yt("global.focusTop",a.focusTopCell),Yt("global.focusBottom",a.focusBottomCell),Yt("global.toggleSidebar",c),Yt("global.foldCode",a.foldAll),Yt("global.unfoldCode",a.unfoldAll),Yt("global.formatAll",lO),Yt("cell.hideCode",kn.NOOP),Yt("cell.format",kn.NOOP);const u=hd(),h=a.scrollToTarget;let f,m,_,g,p,b,x,y,v,C,k,N,j,I,T,A;if(e[0]!==i.scrollKey||e[1]!==h?(f=()=>{i.scrollKey!==null&&h()},e[0]=i.scrollKey,e[1]=h,e[2]=f):f=e[2],e[3]!==i.cellIds||e[4]!==i.scrollKey||e[5]!==h?(m=[i.cellIds,i.scrollKey,h],e[3]=i.cellIds,e[4]=i.scrollKey,e[5]=h,e[6]=m):m=e[6],M.useEffect(f,m),e[7]!==a||e[8]!==r||e[9]!==s||e[10]!==n||e[11]!==i||e[12]!==u||e[13]!==l||e[14]!==o){const R=i.cellIds.getColumns();let z;e[26]!==i.cellIds?(z=i.cellIds.hasOnlyOneId(),e[26]=i.cellIds,e[27]=z):z=e[27];const D=z;let F;e[28]!==i.cellIds.inOrderIds?(F=i.cellIds.inOrderIds.includes(Vo),e[28]=i.cellIds.inOrderIds,e[29]=F):F=e[29];const B=F;_=WH,v="pb-[40vh]",C=!1,k=r,N="pr-4",e[30]===Symbol.for("react.memo_cache_sentinel")?(j=d.jsx(CM,{}),g=d.jsx(QM,{}),p=d.jsx($M,{}),e[30]=g,e[31]=p,e[32]=j):(g=e[30],p=e[31],j=e[32]),e[33]!==r.width?(b=d.jsx(KM,{width:r.width}),e[33]=r.width,e[34]=b):b=e[34];const U=r.width==="columns"&&"grid grid-flow-col auto-cols-min gap-6";e[35]!==U?(x=Ne(U),e[35]=U,e[36]=x):x=e[36],y=R.map((O,S)=>d.jsx(iO,{column:O,index:S,columnsLength:R.length,appConfig:r,notebook:i,mode:n,userConfig:o,connStatus:s,actions:a,theme:l,hasOnlyOneCell:D,hasSetupCell:B,onDeleteCell:u},O.id)),e[7]=a,e[8]=r,e[9]=s,e[10]=n,e[11]=i,e[12]=u,e[13]=l,e[14]=o,e[15]=_,e[16]=g,e[17]=p,e[18]=b,e[19]=x,e[20]=y,e[21]=v,e[22]=C,e[23]=k,e[24]=N,e[25]=j}else _=e[15],g=e[16],p=e[17],b=e[18],x=e[19],y=e[20],v=e[21],C=e[22],k=e[23],N=e[24],j=e[25];return e[37]!==x||e[38]!==y?(I=d.jsx("div",{className:x,children:y}),e[37]=x,e[38]=y,e[39]=I):I=e[39],e[40]===Symbol.for("react.memo_cache_sentinel")?(T=d.jsx(qH,{}),e[40]=T):T=e[40],e[41]!==_||e[42]!==g||e[43]!==p||e[44]!==b||e[45]!==I||e[46]!==v||e[47]!==C||e[48]!==k||e[49]!==N||e[50]!==j?(A=d.jsxs(_,{className:v,invisible:C,appConfig:k,innerClassName:N,children:[j,g,p,b,I,T]}),e[41]=_,e[42]=g,e[43]=p,e[44]=b,e[45]=I,e[46]=v,e[47]=C,e[48]=k,e[49]=N,e[50]=j,e[51]=A):A=e[51],A},iO=t=>{const e=X.c(40),{column:n,index:o,columnsLength:r,appConfig:s,notebook:i,mode:a,userConfig:l,connStatus:c,actions:u,theme:h,hasOnlyOneCell:f,hasSetupCell:m,onDeleteCell:_}=t,g=c.state,p=n.id,b=o>0,x=o<r-1,y=s.width,v=r>1,C=n.id,k=s.width==="columns"&&"opacity-0 group-hover/column:opacity-100";let N,j;e[0]!==k?(N=Ne(k),e[0]=k,e[1]=N):N=e[1],e[2]!==n.id||e[3]!==N?(j=d.jsx(aO,{columnId:C,className:N}),e[2]=n.id,e[3]=N,e[4]=j):j=e[4];const I=`column-${o+1}`,T=n.topLevelIds;let A,R,z,D;return e[5]!==u||e[6]!==g||e[7]!==m||e[8]!==o||e[9]!==a||e[10]!==i||e[11]!==_||e[12]!==h||e[13]!==l?(A=o===0&&m&&d.jsx(Ey,{theme:h,showPlaceholder:!1,...i.cellData[Vo],...i.cellRuntime[Vo],...u,runElapsedTimeMs:i.cellRuntime[Vo].runElapsedTimeMs??i.cellData[Vo].lastExecutionTime,canDelete:!0,mode:a,connectionState:g,ref:i.cellHandles[Vo],userConfig:l,isCollapsed:!1,collapseCount:0,canMoveX:!1,actions:u,deleteCell:_},Vo),e[5]=u,e[6]=g,e[7]=m,e[8]=o,e[9]=a,e[10]=i,e[11]=_,e[12]=h,e[13]=l,e[14]=A):A=e[14],e[15]!==u||e[16]!==s.width||e[17]!==n||e[18]!==g||e[19]!==f||e[20]!==a||e[21]!==i||e[22]!==_||e[23]!==h||e[24]!==l?(R=n.topLevelIds.map(F=>{if(F===Vo)return null;const B=i.cellData[F],U=i.cellRuntime[F];return d.jsx(Ey,{theme:h,showPlaceholder:f,...B,...U,runElapsedTimeMs:U.runElapsedTimeMs??B.lastExecutionTime,canDelete:!f,mode:a,connectionState:g,ref:i.cellHandles[F],userConfig:l,config:B.config,name:B.name,isCollapsed:n.isCollapsed(F),collapseCount:n.getCount(F),canMoveX:s.width==="columns",actions:u,deleteCell:_},B.id.toString())}),e[15]=u,e[16]=s.width,e[17]=n,e[18]=g,e[19]=f,e[20]=a,e[21]=i,e[22]=_,e[23]=h,e[24]=l,e[25]=R):R=e[25],e[26]!==n.topLevelIds||e[27]!==I||e[28]!==A||e[29]!==R?(z=d.jsxs(g1,{id:I,items:T,strategy:Uj,children:[A,R]}),e[26]=n.topLevelIds,e[27]=I,e[28]=A,e[29]=R,e[30]=z):z=e[30],e[31]!==s.width||e[32]!==n.id||e[33]!==o||e[34]!==z||e[35]!==b||e[36]!==x||e[37]!==v||e[38]!==j?(D=d.jsx(Oy,{columnId:p,index:o,canMoveLeft:b,canMoveRight:x,width:y,canDelete:v,footer:j,children:z}),e[31]=s.width,e[32]=n.id,e[33]=o,e[34]=z,e[35]=b,e[36]=x,e[37]=v,e[38]=j,e[39]=D):D=e[39],D},aO=t=>{const e=X.c(17),{columnId:n,className:o}=t,{createNewCell:r}=Tt(),[s,i]=zV(!1),a=Ue(ec),l=Ue(x4);let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=Ne("mb-0 rounded-none sm:px-4 md:px-5 lg:px-8 tracking-wide no-wrap whitespace-nowrap","hover:bg-accent hover:text-accent-foreground font-semibold uppercase text-xs"),e[0]=c):c=e[0];const u=c;let h;e[1]!==a||e[2]!==n||e[3]!==r||e[4]!==s||e[5]!==i.toggle||e[6]!==l?(h=()=>s?d.jsx(BV,{onClose:i.toggle}):d.jsxs(d.Fragment,{children:[d.jsxs(Me,{className:u,variant:"text",size:"sm",disabled:!l,onClick:()=>r({cellId:{type:"__end__",columnId:n},before:!1}),children:[d.jsx(Fp,{className:"mr-2 size-4 flex-shrink-0"}),"Python"]}),d.jsxs(Me,{className:u,variant:"text",size:"sm",disabled:!l,onClick:()=>{fo(!0,r),r({cellId:{type:"__end__",columnId:n},before:!1,code:new Xi().defaultCode})},children:[d.jsx(Up,{className:"mr-2 size-4 flex-shrink-0"}),"Markdown"]}),d.jsxs(Me,{className:u,variant:"text",size:"sm",disabled:!l,onClick:()=>{fo(!0,r),r({cellId:{type:"__end__",columnId:n},before:!1,code:new Tc().defaultCode})},children:[d.jsx(ar,{className:"mr-2 size-4 flex-shrink-0"}),"SQL"]}),d.jsx(Te,{content:a?null:d.jsx("span",{children:"Enable via settings under AI Assist"}),delayDuration:100,asChild:!1,children:d.jsxs(Me,{className:u,variant:"text",size:"sm",disabled:!a||!l,onClick:i.toggle,children:[d.jsx(Gi,{className:"mr-2 size-4 flex-shrink-0"}),"Generate with AI"]})})]}),e[1]=a,e[2]=n,e[3]=r,e[4]=s,e[5]=i.toggle,e[6]=l,e[7]=h):h=e[7];const f=h,m=!s&&"w-fit",_=s&&"opacity-100 w-full max-w-4xl shadow-lg shadow-[var(--blue-3)]";let g,p,b;return e[8]!==o||e[9]!==m||e[10]!==_?(g=Ne("shadow-sm border border-border rounded transition-all duration-200 overflow-hidden divide-x divide-border flex",m,_,o),e[8]=o,e[9]=m,e[10]=_,e[11]=g):g=e[11],e[12]!==f?(p=f(),e[12]=f,e[13]=p):p=e[13],e[14]!==g||e[15]!==p?(b=d.jsx("div",{className:"flex justify-center mt-4 pt-6 pb-32 group gap-4 w-full print:hidden",children:d.jsx("div",{className:g,children:p})}),e[14]=g,e[15]=p,e[16]=b):b=e[16],b};function lO(){_4()}const cO=UV(VV,400),dO=(t,e)=>{lt.get(Ts)||t.isEmpty()||e.isEmpty()||ea(t.inOrderIds,e.inOrderIds)||cO({cell_ids:t.inOrderIds})},Py=t=>{const e=X.c(65),{userConfig:n,appConfig:o,hideControls:r}=t,s=r!==void 0&&r;$V(X4,dO);const{setCells:i,mergeAllColumns:a,collapseAllCells:l,expandAllCells:c}=Tt(),u=Ue(nm),h=Ue(HV),f=Ue(WV),m=bm(),_=Zt(wd),g=u.mode==="edit",p=u.mode==="present",b=Ue(qV);let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=[],e[0]=x):x=e[0],M.useEffect(hO,x);const y=n.runtime.auto_instantiate;let v,C,k;e[1]!==i||e[2]!==_?(v=(ue,me)=>{i(ue);const ce=ue.map(fO),fe=ue.map(mO),de=ue.map(pO);_({names:ce,codes:fe,configs:de,layout:me})},e[1]=i,e[2]=_,e[3]=v):v=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(C=R4(),e[4]=C):C=e[4],e[5]!==v||e[6]!==n.runtime.auto_instantiate?(k={autoInstantiate:y,setCells:v,sessionId:C},e[5]=v,e[6]=n.runtime.auto_instantiate,e[7]=k):k=e[7];const{connection:N}=GH(k);let j,I;e[8]!==o.app_title||e[9]!==m?(j=()=>{document.title=o.app_title||Cn.basename(m??"")||"Untitled Notebook"},I=[o.app_title,m],e[8]=o.app_title,e[9]=m,e[10]=j,e[11]=I):(j=e[10],I=e[11]),M.useEffect(j,I);const T=vc(o.width);let A,R;e[12]!==o.width||e[13]!==a||e[14]!==T?(A=()=>{T==="columns"&&o.width!=="columns"&&a()},e[12]=o.width,e[13]=a,e[14]=T,e[15]=A):A=e[15],e[16]!==o.width||e[17]!==a||e[18]!==h||e[19]!==T?(R=[o.width,T,a,h],e[16]=o.width,e[17]=a,e[18]=h,e[19]=T,e[20]=R):R=e[20],M.useEffect(A,R);const z=function(){const ue=X.c(2),me=ld();let ce;return ue[0]!==me?(ce=()=>me(Oz($n())),ue[0]=me,ue[1]=ce):ce=ue[1],Ke(ce)}(),D=Kp(),F=Jp();let B,U,O,S,$,E;e[21]!==z?(B=()=>{z()},e[21]=z,e[22]=B):B=e[22],Yt("global.runStale",B),Yt("global.interrupt",gO),e[23]!==F?(U=()=>{F()},e[23]=F,e[24]=U):U=e[24],Yt("global.hideCode",U),e[25]!==D?(O=()=>{D()},e[25]=D,e[26]=O):O=e[26],Yt("global.runAll",O),e[27]!==l?(S=()=>{l()},e[27]=l,e[28]=S):S=e[28],Yt("global.collapseAllSections",S),e[29]!==c?($=()=>{c()},e[29]=c,e[30]=$):$=e[30],Yt("global.expandAllSections",$),e[31]!==o||e[32]!==N||e[33]!==n||e[34]!==u.mode?(E=d.jsx(rO,{connStatus:N,mode:u.mode,userConfig:n,appConfig:o}),e[31]=o,e[32]=N,e[33]=n,e[34]=u.mode,e[35]=E):E=e[35];const W=E,G=o.width;let q,Y,te,oe,se,Z,Q;return e[36]===Symbol.for("react.memo_cache_sentinel")?(q=Ne("pt-4 sm:pt-12 pb-2 mb-4 print:hidden z-50","sticky left-0"),e[36]=q):q=e[36],e[37]!==m||e[38]!==g?(Y=g&&d.jsx("div",{className:"flex items-center justify-center container",children:d.jsx(oj,{filename:m})}),e[37]=m,e[38]=g,e[39]=Y):Y=e[39],e[40]!==N||e[41]!==Y?(te=d.jsx(JH,{connection:N,className:q,children:Y}),e[40]=N,e[41]=Y,e[42]=te):te=e[42],e[43]!==o||e[44]!==W||e[45]!==f||e[46]!==u.mode?(oe=f&&d.jsx(YH,{appConfig:o,mode:u.mode,children:W}),e[43]=o,e[44]=W,e[45]=f,e[46]=u.mode,e[47]=oe):oe=e[47],e[48]!==o.width||e[49]!==N||e[50]!==b||e[51]!==te||e[52]!==oe?(se=d.jsxs(KH,{connection:N,isRunning:b,width:G,children:[te,oe]}),e[48]=o.width,e[49]=N,e[50]=b,e[51]=te,e[52]=oe,e[53]=se):se=e[53],e[54]!==o||e[55]!==N||e[56]!==s||e[57]!==p||e[58]!==b||e[59]!==z||e[60]!==F?(Z=!s&&d.jsx(Fc,{children:d.jsx(ZN,{presenting:p,onTogglePresenting:F,onInterrupt:Em,onRun:z,connectionState:N.state,running:b,appConfig:o})}),e[54]=o,e[55]=N,e[56]=s,e[57]=p,e[58]=b,e[59]=z,e[60]=F,e[61]=Z):Z=e[61],e[62]!==se||e[63]!==Z?(Q=d.jsxs(d.Fragment,{children:[se,Z]}),e[62]=se,e[63]=Z,e[64]=Q):Q=e[64],Q};function uO(){qS.INSTANCE.stop()}function hO(){return qS.INSTANCE.start(GV),uO}function fO(t){return t.name}function mO(t){return t.code}function pO(t){return t.config}function gO(){Em()}const Ly=t=>Ue(YV)[t.capability]?t.children:null,Rn=M.forwardRef((t,e)=>{const n=X.c(18);let o,r,s,i,a;n[0]!==t?({children:o,tooltip:a,selected:i,className:r,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=i,n[5]=a):(o=n[1],r=n[2],s=n[3],i=n[4],a=n[5]);const l=!i&&"hover:bg-[var(--sage-3)]",c=i&&"bg-[var(--sage-4)]";let u,h;n[6]!==r||n[7]!==l||n[8]!==c?(u=Ne("h-full flex items-center p-2 text-sm shadow-inset font-mono cursor-pointer rounded",l,c,r),n[6]=r,n[7]=l,n[8]=c,n[9]=u):u=n[9],n[10]!==o||n[11]!==e||n[12]!==s||n[13]!==u?(h=d.jsx("div",{ref:e,className:u,...s,children:o}),n[10]=o,n[11]=e,n[12]=s,n[13]=u,n[14]=h):h=n[14];const f=h;if(a){let m;return n[15]!==f||n[16]!==a?(m=d.jsx(Te,{content:a,side:"top",delayDuration:200,children:f}),n[15]=f,n[16]=a,n[17]=m):m=n[17],m}return f});Rn.displayName="FooterItem";const _O=()=>{var u;const t=X.c(14),e=Ue(Z4),n=Ue(ec),o=((u=e==null?void 0:e.open_ai)==null?void 0:u.model)||"gpt-4-turbo",{handleClick:r}=fa();if(!n){let h,f,m;return t[0]!==r?(h=()=>r("ai"),t[0]=r,t[1]=h):h=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(f=d.jsx(Gi,{className:"h-4 w-4 opacity-60"}),t[2]=f):f=t[2],t[3]!==h?(m=d.jsx(Rn,{tooltip:"Assist is disabled",selected:!1,onClick:h,"data-testid":"footer-ai-disabled",children:f}),t[3]=h,t[4]=m):m=t[4],m}let s,i,a,l,c;return t[5]===Symbol.for("react.memo_cache_sentinel")?(s=d.jsx("b",{children:"Assist model:"}),t[5]=s):s=t[5],t[6]!==o?(i=d.jsxs(d.Fragment,{children:[s," ",o]}),t[6]=o,t[7]=i):i=t[7],t[8]!==r?(a=()=>r("ai"),t[8]=r,t[9]=a):a=t[9],t[10]===Symbol.for("react.memo_cache_sentinel")?(l=d.jsx(Gi,{className:"h-4 w-4"}),t[10]=l):l=t[10],t[11]!==i||t[12]!==a?(c=d.jsx(Rn,{tooltip:i,onClick:a,selected:!1,"data-testid":"footer-ai-enabled",children:l}),t[11]=i,t[12]=a,t[13]=c):c=t[13],c},bO=()=>{const t=X.c(26),e=Ue(hn).state,n=Fm();let o,r;t[0]!==e||t[1]!==n?(o=async()=>{if(e===Bt.OPEN){if(un())return{isHealthy:!0,lastChecked:new Date,error:void 0};try{return{isHealthy:await n.isHealthy(),lastChecked:new Date,error:void 0}}catch(v){const C=v;return{isHealthy:!1,lastChecked:new Date,error:C instanceof Error?C.message:"Unknown error"}}}},r=[n,e],t[0]=e,t[1]=n,t[2]=o,t[3]=r):(o=t[2],r=t[3]);const{isFetching:s,error:i,data:a,refetch:l}=Wn(o,r),c=e===Bt.OPEN?3e4:null;let u,h;t[4]!==c?(u={delayMs:c,whenVisible:!0},t[4]=c,t[5]=u):u=t[5],ha(l,u),t[6]!==e||t[7]!==a||t[8]!==i?(h=()=>[_m(e.toLowerCase()),a!=null&&a.lastChecked?a.isHealthy?"\u2713 Healthy":"\u2717 Unhealthy":"Health: Unknown",i?`Error: ${i}`:""].filter(Boolean).join(`
|
125
|
-
`),t[6]=e,t[7]=a,t[8]=i,t[9]=h):h=t[9];const f=h;let m;t[10]!==e||t[11]!==(a==null?void 0:a.isHealthy)||t[12]!==(a==null?void 0:a.lastChecked)||t[13]!==s?(m=()=>s||e===Bt.CONNECTING?d.jsx(Yn,{size:"small"}):e===Bt.CLOSING?d.jsx(Yn,{className:"text-destructive",size:"small"}):e===Bt.OPEN?a!=null&&a.isHealthy?d.jsx(qc,{className:"w-4 h-4 text-[var(--green-9)]"}):a!=null&&a.lastChecked?d.jsx(J4,{className:"w-4 h-4 text-[var(--yellow-9)]"}):d.jsx(qc,{className:"w-4 h-4"}):d.jsx(ma,{className:"w-4 h-4 text-red-500"}),t[10]=e,t[11]=a==null?void 0:a.isHealthy,t[12]=a==null?void 0:a.lastChecked,t[13]=s,t[14]=m):m=t[14];const _=m,g=f();let p,b,x,y;return t[15]!==e?(p=e===Bt.OPEN&&d.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:"Click to refresh health status"}),t[15]=e,t[16]=p):p=t[16],t[17]!==g||t[18]!==p?(b=d.jsxs("div",{className:"text-sm whitespace-pre-line",children:[g,p]}),t[17]=g,t[18]=p,t[19]=b):b=t[19],t[20]!==_?(x=_(),t[20]=_,t[21]=x):x=t[21],t[22]!==l||t[23]!==b||t[24]!==x?(y=d.jsx(Rn,{tooltip:b,selected:!1,onClick:l,"data-testid":"footer-backend-status",children:x}),t[22]=l,t[23]=b,t[24]=x,t[25]=y):y=t[25],y},xO=t=>{const e=X.c(3);let n,o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=d.jsx("path",{d:"M205.28 31.36c14.096 14.88 20.016 35.2 22.512 63.68c6.626 0 12.805 1.47 16.976 7.152l7.792 10.56A17.55 17.55 0 0 1 256 123.2v28.688c-.008 3.704-1.843 7.315-4.832 9.504C215.885 187.222 172.35 208 128 208c-49.066 0-98.19-28.273-123.168-46.608c-2.989-2.189-4.825-5.8-4.832-9.504V123.2c0-3.776 1.2-7.424 3.424-10.464l7.792-10.544c4.173-5.657 10.38-7.152 16.992-7.152c2.496-28.48 8.4-48.8 22.512-63.68C77.331 3.165 112.567.06 127.552 0H128c14.72 0 50.4 2.88 77.28 31.36m-77.264 47.376c-3.04 0-6.544.176-10.272.544c-1.312 4.896-3.248 9.312-6.08 12.128c-11.2 11.2-24.704 12.928-31.936 12.928c-6.802 0-13.927-1.42-19.744-5.088c-5.502 1.808-10.786 4.415-11.136 10.912c-.586 12.28-.637 24.55-.688 36.824c-.026 6.16-.05 12.322-.144 18.488c.024 3.579 2.182 6.903 5.44 8.384C79.936 185.92 104.976 192 128.016 192c23.008 0 48.048-6.08 74.512-18.144c3.258-1.48 5.415-4.805 5.44-8.384c.317-18.418.062-36.912-.816-55.312h.016c-.342-6.534-5.648-9.098-11.168-10.912c-5.82 3.652-12.927 5.088-19.728 5.088c-7.232 0-20.72-1.728-31.936-12.928c-2.832-2.816-4.768-7.232-6.08-12.128a106 106 0 0 0-10.24-.544m-26.941 43.93c5.748 0 10.408 4.66 10.408 10.409v19.183c0 5.749-4.66 10.409-10.408 10.409s-10.408-4.66-10.408-10.409v-19.183c0-5.748 4.66-10.408 10.408-10.408m53.333 0c5.749 0 10.409 4.66 10.409 10.409v19.183c0 5.749-4.66 10.409-10.409 10.409c-5.748 0-10.408-4.66-10.408-10.409v-19.183c0-5.748 4.66-10.408 10.408-10.408M81.44 28.32c-11.2 1.12-20.64 4.8-25.44 9.92c-10.4 11.36-8.16 40.16-2.24 46.24c4.32 4.32 12.48 7.2 21.28 7.2c6.72 0 19.52-1.44 30.08-12.16c4.64-4.48 7.52-15.68 7.2-27.04c-.32-9.12-2.88-16.64-6.72-19.84c-4.16-3.68-13.6-5.28-24.16-4.32m68.96 4.32c-3.84 3.2-6.4 10.72-6.72 19.84c-.32 11.36 2.56 22.56 7.2 27.04c10.56 10.72 23.36 12.16 30.08 12.16c8.8 0 16.96-2.88 21.28-7.2c5.92-6.08 8.16-34.88-2.24-46.24c-4.8-5.12-14.24-8.8-25.44-9.92c-10.56-.96-20 .64-24.16 4.32M128 56c-2.56 0-5.6.16-8.96.48c.32 1.76.48 3.68.64 5.76c0 1.44 0 2.88-.16 4.48c3.2-.32 5.92-.32 8.48-.32s5.28 0 8.48.32c-.16-1.6-.16-3.04-.16-4.48c.16-2.08.32-4 .64-5.76c-3.36-.32-6.4-.48-8.96-.48"}),e[0]=n):n=e[0],e[1]!==t?(o=d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.24em",height:"1em",viewBox:"0 0 256 208",fill:"currentColor",...t,children:n}),e[1]=t,e[2]=o):o=e[2],o},yO=qt(t=>t(JV).completion.copilot),wO=()=>{const t=X.c(1);if(Ue(yO)==="github"){let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=d.jsx(vO,{}),t[0]=e):e=t[0],e}return null},Fy=St.get("[copilot-status-bar]"),vO=()=>{const t=Ue(DS),e=Ue(AH)!==null,{handleClick:n}=fa(),o=()=>n("ai"),r=t?"Ready":"Not connected",s=Zt(DS),i=Zt(TH);return K4(()=>{const a=OS();let l=!0;return(async()=>{try{if(await a.initializePromise.catch(u=>{throw Fy.error("Failed to initialize",u),a.close(),u}),!l)return;const c=await a.signedIn();if(!l)return;s(c),i(c?"signedIn":"signedOut")}catch(c){if(!l)return;Fy.warn("Connection failed",c),s(!1),i("connectionError"),dt({title:"GitHub Copilot Connection Error",description:"Failed to connect to GitHub Copilot. Check settings and try again.",variant:"danger",action:d.jsx(Me,{variant:"link",onClick:o,children:"Settings"})})}})(),()=>{l=!1}}),d.jsx(Rn,{tooltip:d.jsxs(d.Fragment,{children:[d.jsx("b",{children:"GitHub Copilot:"})," ",r]}),selected:!1,onClick:o,"data-testid":"footer-copilot-status",children:d.jsx("span",{children:e?d.jsx(Yn,{className:"h-4 w-4"}):d.jsx(xO,{className:Ne("h-4 w-4",!t&&"opacity-60")})})})},kO=t=>{const e=X.c(17),[n,o]=M.useState(0),r=Ue(hn);let s,i,a,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=()=>o(jO),i={delayMs:1e4,whenVisible:!0},e[0]=s,e[1]=i):(s=e[0],i=e[1]),ha(s,i),e[2]!==r.state?(a=async()=>un()||r.state!==Bt.OPEN?null:KV(),e[2]=r.state,e[3]=a):a=e[3],e[4]!==r.state||e[5]!==n?(l=[n,r.state],e[4]=r.state,e[5]=n,e[6]=l):l=e[6];const{data:c}=Wn(a,l);let u,h,f,m;return e[7]!==c?(u=(c==null?void 0:c.gpu)&&c.gpu.length>0&&d.jsx(NO,{gpus:c.gpu}),e[7]=c,e[8]=u):u=e[8],e[9]!==c?(h=c&&d.jsx(SO,{memory:c.memory,kernel:c.kernel,server:c.server}),e[9]=c,e[10]=h):h=e[10],e[11]!==c?(f=c&&d.jsx(CO,{cpu:c.cpu}),e[11]=c,e[12]=f):f=e[12],e[13]!==u||e[14]!==h||e[15]!==f?(m=d.jsxs("div",{className:"flex gap-2 items-center px-1",children:[u,h,f]}),e[13]=u,e[14]=h,e[15]=f,e[16]=m):m=e[16],m},SO=t=>{const e=X.c(25),{memory:n,kernel:o,server:r}=t,{percent:s,total:i,available:a}=n;let l;e[0]!==s?(l=Math.round(s),e[0]=s,e[1]=l):l=e[1];const c=l;let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=d.jsx("b",{children:"computer memory:"}),e[2]=u):u=e[2];const h=i-a;let f,m,_,g,p,b,x,y,v;return e[3]!==h?(f=Yu(h),e[3]=h,e[4]=f):f=e[4],e[5]!==i?(m=Yu(i),e[5]=i,e[6]=m):m=e[6],e[7]!==c||e[8]!==f||e[9]!==m?(_=d.jsxs("span",{children:[u," ",f," / ",m," GB (",c,"%)"]}),e[7]=c,e[8]=f,e[9]=m,e[10]=_):_=e[10],e[11]!==r?(g=(r==null?void 0:r.memory)&&d.jsxs("span",{children:[d.jsx("b",{children:"marimo server:"})," ",wl(r.memory)]}),e[11]=r,e[12]=g):g=e[12],e[13]!==o?(p=(o==null?void 0:o.memory)&&d.jsxs("span",{children:[d.jsx("b",{children:"kernel:"})," ",wl(o.memory)]}),e[13]=o,e[14]=p):p=e[14],e[15]!==_||e[16]!==g||e[17]!==p?(b=d.jsxs("div",{className:"flex flex-col gap-1",children:[_,g,p]}),e[15]=_,e[16]=g,e[17]=p,e[18]=b):b=e[18],e[19]===Symbol.for("react.memo_cache_sentinel")?(x=d.jsx(Np,{className:"w-4 h-4"}),e[19]=x):x=e[19],e[20]!==c?(y=d.jsxs("div",{className:"flex items-center gap-1","data-testid":"memory-usage-bar",children:[x,d.jsx(Gu,{percent:c,colorClassName:"bg-primary"})]}),e[20]=c,e[21]=y):y=e[21],e[22]!==y||e[23]!==b?(v=d.jsx(Te,{delayDuration:200,content:b,children:y}),e[22]=y,e[23]=b,e[24]=v):v=e[24],v},CO=t=>{const e=X.c(11),{cpu:n}=t,{percent:o}=n;let r;e[0]!==o?(r=Math.round(o),e[0]=o,e[1]=r):r=e[1];const s=r;let i,a,l,c,u;return e[2]===Symbol.for("react.memo_cache_sentinel")?(i=d.jsx("b",{children:"CPU:"}),e[2]=i):i=e[2],e[3]!==s?(a=d.jsxs("span",{children:[i," ",s,"%"]}),e[3]=s,e[4]=a):a=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(l=d.jsx(MH,{className:"w-4 h-4"}),e[5]=l):l=e[5],e[6]!==s?(c=d.jsxs("div",{className:"flex items-center gap-1","data-testid":"cpu-bar",children:[l,d.jsx(Gu,{percent:s,colorClassName:"bg-primary"})]}),e[6]=s,e[7]=c):c=e[7],e[8]!==a||e[9]!==c?(u=d.jsx(Te,{delayDuration:200,content:a,children:c}),e[8]=a,e[9]=c,e[10]=u):u=e[10],u},NO=t=>{const e=X.c(12),{gpus:n}=t;let o;e[0]!==n?(o=Math.round(n.reduce(EO,0)/n.length),e[0]=n,e[1]=o):o=e[1];const r=o;let s,i,a,l,c;return e[2]!==n?(s=n.map(IO),e[2]=n,e[3]=s):s=e[3],e[4]!==s?(i=d.jsx("div",{className:"flex flex-col gap-1",children:s}),e[4]=s,e[5]=i):i=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(a=d.jsx(Ep,{className:"w-4 h-4"}),e[6]=a):a=e[6],e[7]!==r?(l=d.jsxs("div",{className:"flex items-center gap-1","data-testid":"gpu-bar",children:[a,d.jsx(Gu,{percent:r,colorClassName:"bg-[var(--grass-9)]"})]}),e[7]=r,e[8]=l):l=e[8],e[9]!==i||e[10]!==l?(c=d.jsx(Te,{delayDuration:200,content:i,children:l}),e[9]=i,e[10]=l,e[11]=c):c=e[11],c},Gu=t=>{const e=X.c(7),{percent:n,colorClassName:o}=t;let r;e[0]!==o?(r=Ne("h-full bg-primary",o),e[0]=o,e[1]=r):r=e[1];const s=`${n}%`;let i,a;return e[2]!==s?(i={width:s},e[2]=s,e[3]=i):i=e[3],e[4]!==r||e[5]!==i?(a=d.jsx("div",{className:"h-3 w-20 bg-[var(--slate-4)] rounded-lg overflow-hidden border",children:d.jsx("div",{className:r,style:i})}),e[4]=r,e[5]=i,e[6]=a):a=e[6],a};function wl(t){return t>1073741824?`${Yu(t)} GB`:`${function(e){return new Intl.NumberFormat("en-US",{maximumFractionDigits:0}).format(e/1048576)}(t)} MB`}function Yu(t){return new Intl.NumberFormat("en-US",{maximumFractionDigits:2}).format(t/1073741824)}function jO(t){return t+1}function EO(t,e){return t+e.memory.percent}function IO(t){return d.jsxs("span",{children:[d.jsxs("b",{children:["GPU ",t.index," (",t.name,"):"]})," ",wl(t.memory.used)," / ",wl(t.memory.total)," GB (",Math.round(t.memory.percent),"%)"]},t.index)}const AO=()=>{const t=X.c(13),e=Ue(os),[n,o]=on(P4),[r,s]=M.useState(!1);if(!Mc()||e==="disabled")return null;const i=e?"Real-time collaboration active":"Connecting to real-time collaboration";let a,l,c,u,h,f;return t[0]===Symbol.for("react.memo_cache_sentinel")?(a=d.jsx(qp,{className:"w-4 h-4"}),t[0]=a):a=t[0],t[1]!==i?(l=d.jsx(Vs,{asChild:!0,children:d.jsx(Rn,{tooltip:i,selected:!1,"data-testid":"footer-rtc-status",children:a})}),t[1]=i,t[2]=l):l=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsxs("div",{className:"space-y-2",children:[d.jsx("h4",{className:"font-medium leading-none",children:"Username"}),d.jsx("p",{className:"text-sm text-muted-foreground",children:"Set your username for real-time collaboration"})]}),t[3]=c):c=t[3],t[4]!==o?(u=m=>o(m.target.value),t[4]=o,t[5]=u):u=t[5],t[6]!==u||t[7]!==n?(h=d.jsx(Ps,{className:"w-80",children:d.jsxs("div",{className:"space-y-4",children:[c,d.jsx(sr,{value:n,autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",onChange:u,placeholder:"Enter your username"})]})}),t[6]=u,t[7]=n,t[8]=h):h=t[8],t[9]!==r||t[10]!==l||t[11]!==h?(f=d.jsxs(zr,{open:r,onOpenChange:s,children:[l,h]}),t[9]=r,t[10]=l,t[11]=h,t[12]=f):f=t[12],f},TO=t=>{const e=X.c(101),{className:n}=t,[o,r]=XV(),s=Dr()[0],[i,a]=M.useState(!1);let l,c,u;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{const De=window.matchMedia("(min-width: 768px)"),Ve=()=>{De.matches&&a(!1)};return De.addEventListener("change",Ve),()=>De.removeEventListener("change",Ve)},c=[],e[0]=l,e[1]=c):(l=e[0],c=e[1]),M.useEffect(l,c),e[2]!==s||e[3]!==r?(u=async De=>{const Ve={...s,runtime:{...s.runtime,auto_instantiate:De}};await Rr({config:Ve}).then(()=>r(Ve))},e[2]=s,e[3]=r,e[4]=u):u=e[4];const h=u;let f;e[5]!==r||e[6]!==o?(f=async De=>{const Ve={...o,runtime:{...o.runtime,on_cell_change:De?"autorun":"lazy"}};await Rr({config:Ve}).then(()=>r(Ve))},e[5]=r,e[6]=o,e[7]=f):f=e[7];const m=f;let _;e[8]!==r||e[9]!==o?(_=async De=>{const Ve={...o,runtime:{...o.runtime,auto_reload:De}};await Rr({config:Ve}).then(()=>r(Ve))},e[8]=r,e[9]=o,e[10]=_):_=e[10];const g=_;let p;e[11]!==s.runtime.auto_instantiate||e[12]!==s.runtime.auto_reload||e[13]!==s.runtime.on_cell_change?(p=!s.runtime.auto_instantiate&&s.runtime.on_cell_change==="lazy"&&(un()||s.runtime.auto_reload!=="autorun"),e[11]=s.runtime.auto_instantiate,e[12]=s.runtime.auto_reload,e[13]=s.runtime.on_cell_change,e[14]=p):p=e[14];const b=p;let x;e[15]!==n?(x=Ne("flex items-center",n),e[15]=n,e[16]=x):x=e[16];const y=s.runtime.auto_instantiate?"Disable autorun on startup":"Enable autorun on startup";let v,C,k;e[17]!==s.runtime.auto_instantiate||e[18]!==h?(v=()=>h(!s.runtime.auto_instantiate),e[17]=s.runtime.auto_instantiate,e[18]=h,e[19]=v):v=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(C=d.jsx("span",{children:"on startup: "}),e[20]=C):C=e[20],e[21]!==s.runtime.auto_instantiate?(k=s.runtime.auto_instantiate?d.jsx(In,{size:14}):d.jsx(En,{size:14}),e[21]=s.runtime.auto_instantiate,e[22]=k):k=e[22];const N=s.runtime.auto_instantiate?"autorun":"lazy";let j,I,T,A;e[23]!==N?(j=d.jsx("span",{children:N}),e[23]=N,e[24]=j):j=e[24],e[25]!==k||e[26]!==j?(I=d.jsxs("div",{className:"font-prose text-sm flex items-center gap-1 whitespace-nowrap",children:[C,k,j]}),e[25]=k,e[26]=j,e[27]=I):I=e[27],e[28]!==I||e[29]!==y||e[30]!==v?(T=d.jsx(Rn,{tooltip:y,selected:!1,onClick:v,"data-testid":"footer-autorun-startup",children:I}),e[28]=I,e[29]=y,e[30]=v,e[31]=T):T=e[31],e[32]===Symbol.for("react.memo_cache_sentinel")?(A=d.jsx("div",{className:"border-r border-border h-6 mx-1"}),e[32]=A):A=e[32];const R=s.runtime.on_cell_change==="autorun"?"Disable autorun":"Enable autorun";let z,D,F,B,U,O,S,$,E,W,G,q,Y;e[33]!==s.runtime.on_cell_change||e[34]!==m?(z=()=>m(s.runtime.on_cell_change!=="autorun"),e[33]=s.runtime.on_cell_change,e[34]=m,e[35]=z):z=e[35],e[36]===Symbol.for("react.memo_cache_sentinel")?(D=d.jsx("span",{children:"on cell change: "}),e[36]=D):D=e[36],e[37]!==s.runtime.on_cell_change?(F=d.jsxs("div",{className:"font-prose text-sm flex items-center gap-1 whitespace-nowrap",children:[D,s.runtime.on_cell_change==="autorun"?d.jsx(In,{size:14}):d.jsx(En,{size:14}),d.jsx("span",{children:s.runtime.on_cell_change})]}),e[37]=s.runtime.on_cell_change,e[38]=F):F=e[38],e[39]!==R||e[40]!==z||e[41]!==F?(B=d.jsx(Rn,{tooltip:R,selected:!1,onClick:z,"data-testid":"footer-autorun-cell-change",children:F}),e[39]=R,e[40]=z,e[41]=F,e[42]=B):B=e[42],e[43]!==s.runtime.auto_reload||e[44]!==g?(U=!un()&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"border-r border-border h-6 mx-1"}),d.jsx(Rn,{tooltip:null,selected:!1,"data-testid":"footer-module-reload",children:d.jsxs(Pr,{children:[d.jsxs(Lr,{className:"font-prose text-sm flex items-center gap-1 whitespace-nowrap",children:[d.jsx("span",{children:"on module change: "}),s.runtime.auto_reload==="off"&&d.jsx(ma,{size:14}),s.runtime.auto_reload==="lazy"&&d.jsx(En,{size:14}),s.runtime.auto_reload==="autorun"&&d.jsx(In,{size:14}),d.jsx("span",{children:s.runtime.auto_reload}),d.jsx(Tr,{size:14})]}),d.jsx(Fr,{children:["off","lazy","autorun"].map(De=>d.jsxs(Gt,{onClick:()=>g(De),children:[De==="off"&&d.jsx(ma,{size:14,className:"mr-2 text-muted-foreground"}),De==="lazy"&&d.jsx(En,{size:14,className:"mr-2 text-muted-foreground"}),De==="autorun"&&d.jsx(In,{size:14,className:"mr-2 text-muted-foreground"}),De]},De))})]})})]}),e[43]=s.runtime.auto_reload,e[44]=g,e[45]=U):U=e[45],e[46]!==T||e[47]!==B||e[48]!==U?(O=d.jsxs("div",{className:"hidden md:flex md:items-center",children:[T,A,B,U]}),e[46]=T,e[47]=B,e[48]=U,e[49]=O):O=e[49],e[50]!==b?(S=b?d.jsx(En,{size:16,className:"text-muted-foreground"}):d.jsx(In,{size:16,className:"text-amber-500"}),e[50]=b,e[51]=S):S=e[51],e[52]===Symbol.for("react.memo_cache_sentinel")?($=d.jsx(Tr,{size:14}),e[52]=$):$=e[52],e[53]!==S?(E=d.jsx(Lr,{asChild:!0,children:d.jsx(Rn,{tooltip:"Runtime reactivity",selected:!1,"data-testid":"footer-runtime-settings",children:d.jsxs("div",{className:"flex items-center gap-1",children:[S,$]})})}),e[53]=S,e[54]=E):E=e[54],e[55]===Symbol.for("react.memo_cache_sentinel")?(W=d.jsx(Q3,{children:"Runtime reactivity"}),G=d.jsx(Sn,{}),e[55]=W,e[56]=G):(W=e[55],G=e[56]),e[57]!==s.runtime.auto_instantiate?(q=s.runtime.auto_instantiate?d.jsx(In,{size:14,className:"text-amber-500"}):d.jsx(En,{size:14,className:"text-muted-foreground"}),e[57]=s.runtime.auto_instantiate,e[58]=q):q=e[58],e[59]===Symbol.for("react.memo_cache_sentinel")?(Y=d.jsx("div",{className:"text-sm font-medium",children:"On startup"}),e[59]=Y):Y=e[59];const te=s.runtime.auto_instantiate?"autorun":"lazy";let oe,se,Z,Q,ue,me,ce,fe,de;e[60]!==te?(oe=d.jsxs("div",{children:[Y,d.jsx("div",{className:"text-xs text-muted-foreground",children:te})]}),e[60]=te,e[61]=oe):oe=e[61],e[62]!==q||e[63]!==oe?(se=d.jsxs("div",{className:"flex items-center space-x-2",children:[q,oe]}),e[62]=q,e[63]=oe,e[64]=se):se=e[64],e[65]!==s.runtime.auto_instantiate||e[66]!==h?(Z=d.jsx(am,{checked:s.runtime.auto_instantiate,onCheckedChange:h,size:"sm"}),e[65]=s.runtime.auto_instantiate,e[66]=h,e[67]=Z):Z=e[67],e[68]!==se||e[69]!==Z?(Q=d.jsxs("div",{className:"flex items-center justify-between px-2 py-2",children:[se,Z]}),e[68]=se,e[69]=Z,e[70]=Q):Q=e[70],e[71]===Symbol.for("react.memo_cache_sentinel")?(ue=d.jsx(Sn,{}),e[71]=ue):ue=e[71],e[72]!==s.runtime.on_cell_change?(me=s.runtime.on_cell_change==="autorun"?d.jsx(In,{size:14,className:"text-amber-500"}):d.jsx(En,{size:14,className:"text-muted-foreground"}),e[72]=s.runtime.on_cell_change,e[73]=me):me=e[73],e[74]===Symbol.for("react.memo_cache_sentinel")?(ce=d.jsx("div",{className:"text-sm font-medium",children:"On cell change"}),e[74]=ce):ce=e[74],e[75]!==s.runtime.on_cell_change?(fe=d.jsxs("div",{children:[ce,d.jsx("div",{className:"text-xs text-muted-foreground",children:s.runtime.on_cell_change})]}),e[75]=s.runtime.on_cell_change,e[76]=fe):fe=e[76],e[77]!==me||e[78]!==fe?(de=d.jsxs("div",{className:"flex items-center space-x-2",children:[me,fe]}),e[77]=me,e[78]=fe,e[79]=de):de=e[79];const ke=s.runtime.on_cell_change==="autorun";let Se,ie,je,pe,Ae,ze;return e[80]!==m||e[81]!==ke?(Se=d.jsx(am,{checked:ke,onCheckedChange:m,size:"sm"}),e[80]=m,e[81]=ke,e[82]=Se):Se=e[82],e[83]!==de||e[84]!==Se?(ie=d.jsxs("div",{className:"flex items-center justify-between px-2 py-2",children:[de,Se]}),e[83]=de,e[84]=Se,e[85]=ie):ie=e[85],e[86]!==s.runtime.auto_reload||e[87]!==g?(je=!un()&&d.jsxs(d.Fragment,{children:[d.jsx(Sn,{}),d.jsxs("div",{className:"px-2 py-1",children:[d.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[s.runtime.auto_reload==="off"&&d.jsx(ma,{size:14,className:"text-muted-foreground"}),s.runtime.auto_reload==="lazy"&&d.jsx(En,{size:14,className:"text-muted-foreground"}),s.runtime.auto_reload==="autorun"&&d.jsx(In,{size:14,className:"text-amber-500"}),d.jsxs("div",{children:[d.jsx("div",{className:"text-sm font-medium",children:"On module change"}),d.jsx("div",{className:"text-xs text-muted-foreground",children:s.runtime.auto_reload})]})]}),d.jsx("div",{className:"space-y-1",children:["off","lazy","autorun"].map(De=>d.jsxs("button",{onClick:()=>g(De),className:Ne("w-full flex items-center px-2 py-1 text-sm rounded hover:bg-accent",De===s.runtime.auto_reload&&"bg-accent"),children:[De==="off"&&d.jsx(ma,{size:12,className:"mr-2"}),De==="lazy"&&d.jsx(En,{size:12,className:"mr-2"}),De==="autorun"&&d.jsx(In,{size:12,className:"mr-2"}),d.jsx("span",{className:"capitalize",children:De}),De===s.runtime.auto_reload&&d.jsx("span",{className:"ml-auto",children:"\u2713"})]},De))})]})]}),e[86]=s.runtime.auto_reload,e[87]=g,e[88]=je):je=e[88],e[89]!==Q||e[90]!==ie||e[91]!==je?(pe=d.jsxs(Fr,{align:"start",className:"w-64",children:[W,G,Q,ue,ie,je]}),e[89]=Q,e[90]=ie,e[91]=je,e[92]=pe):pe=e[92],e[93]!==i||e[94]!==E||e[95]!==pe?(Ae=d.jsx("div",{className:"flex md:hidden",children:d.jsxs(Pr,{open:i,onOpenChange:a,children:[E,pe]})}),e[93]=i,e[94]=E,e[95]=pe,e[96]=Ae):Ae=e[96],e[97]!==O||e[98]!==Ae||e[99]!==x?(ze=d.jsxs("div",{className:x,children:[O,Ae]}),e[97]=O,e[98]=Ae,e[99]=x,e[100]=ze):ze=e[100],ze},MO=()=>{const t=X.c(24),{selectedPanel:e,isTerminalOpen:n}=fc(),{toggleApplication:o,toggleTerminal:r}=Zi(),s=Ue(ZV),i=OO,a=cd.find(DO);let l;Fo(a,"Error panel not found"),t[0]!==r?(l=()=>{r()},t[0]=r,t[1]=l):l=t[1],Yt("global.toggleTerminal",l);const c=Rn,u=a.tooltip,h=e===a.type,f=()=>o(a.type),m=i(a,s>0?"text-destructive":"");let _,g,p,b,x,y,v,C,k,N;return t[2]!==s?(_=d.jsx("span",{className:"ml-1 font-mono mt-[0.125rem]",children:s}),t[2]=s,t[3]=_):_=t[3],t[4]!==c||t[5]!==a||t[6]!==h||t[7]!==f||t[8]!==m||t[9]!==_?(g=d.jsxs(c,{tooltip:u,selected:h,onClick:f,"data-testid":"footer-errors",children:[m,_]}),t[4]=c,t[5]=a,t[6]=h,t[7]=f,t[8]=m,t[9]=_,t[10]=g):g=t[10],t[11]!==r?(p=()=>r(),t[11]=r,t[12]=p):p=t[12],t[13]===Symbol.for("react.memo_cache_sentinel")?(b=d.jsx(Hp,{className:"h-5 w-5"}),t[13]=b):b=t[13],t[14]!==n||t[15]!==p?(x=d.jsx(Ly,{capability:"terminal",children:d.jsx(Rn,{tooltip:"Open terminal",selected:n,onClick:p,"data-testid":"footer-terminal",children:b})}),t[14]=n,t[15]=p,t[16]=x):x=t[16],t[17]===Symbol.for("react.memo_cache_sentinel")?(y=d.jsx(TO,{}),v=d.jsx("div",{className:"mx-auto"}),t[17]=y,t[18]=v):(y=t[17],v=t[18]),t[19]===Symbol.for("react.memo_cache_sentinel")?(C=d.jsx(JN,{children:d.jsx(Te,{content:d.jsx("div",{className:"w-[200px]",children:"Kiosk mode is enabled. This allows you to view the outputs of the cells without the ability to edit them."}),children:d.jsx("span",{className:"text-muted-foreground text-sm mr-4",children:"kiosk mode"})})}),t[19]=C):C=t[19],t[20]===Symbol.for("react.memo_cache_sentinel")?(k=d.jsxs("div",{className:"flex items-center flex-shrink-0 min-w-0",children:[d.jsx(kO,{}),d.jsx(_O,{}),d.jsx(wO,{}),d.jsx(AO,{}),d.jsx(bO,{})]}),t[20]=k):k=t[20],t[21]!==x||t[22]!==g?(N=d.jsxs("footer",{className:"h-10 py-2 bg-background flex items-center text-muted-foreground text-md px-1 border-t border-border select-none no-print text-sm shadow-[0_0_4px_1px_rgba(0,0,0,0.1)] z-50 print:hidden hide-on-fullscreen overflow-x-auto",children:[g,x,y,v,C,k]}),t[21]=x,t[22]=g,t[23]=N):N=t[23],N};function OO(t,e){const{Icon:n}=t;return d.jsx(n,{className:Ne("h-5 w-5",e)})}function DO(t){return t.type==="errors"}const RO=t=>{const e=X.c(6),{children:n}=t,{openModal:o,closeModal:r}=Hn();let s,i;return e[0]!==r||e[1]!==o?(s=()=>o(d.jsx(PO,{onClose:r})),e[0]=r,e[1]=o,e[2]=s):s=e[2],e[3]!==n||e[4]!==s?(i=d.jsx(Q4,{onClick:s,children:n}),e[3]=n,e[4]=s,e[5]=i):i=e[5],i},PO=t=>{const e=X.c(9),{onClose:n}=t;let o,r,s,i,a,l,c;return e[0]!==n?(o=async u=>{u.preventDefault();const h=new FormData(u.target),f=h.get("rating"),m=h.get("message");fetch("https://marimo.io/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({rating:f,message:m})}),n(),dt({title:"Feedback sent!",description:"Thank you for your feedback!"})},e[0]=n,e[1]=o):o=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(r=d.jsx(rr,{children:"Send Feedback"}),e[2]=r):r=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(s=d.jsx("p",{className:"my-2 prose dark:prose-invert",children:"We want to hear from you \u2014 from minor bug reports to wishlist features and everything in between. Here are some ways you can get in touch:"}),e[3]=s):s=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(i=d.jsxs("li",{className:"my-0",children:["Take our"," ",d.jsx("a",{href:Qn.feedbackForm,target:"_blank",className:"underline",children:"two-minute survey."})]}),e[4]=i):i=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(a=d.jsxs("li",{className:"my-0",children:["File a"," ",d.jsx("a",{href:Qn.issuesPage,target:"_blank",className:"underline",children:"GitHub issue."})]}),e[5]=a):a=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(l=d.jsxs(Es,{children:[r,d.jsxs(Is,{children:[s,d.jsxs("ul",{className:"list-disc ml-8 my-2 prose dark:prose-invert",children:[i,a,d.jsxs("li",{className:"my-0",children:["Chat with us on"," ",d.jsx("a",{href:Qn.discordLink,target:"_blank",className:"underline",children:"Discord."})]})]}),d.jsx("p",{className:"my-2 prose dark:prose-invert",children:"We're excited you're here as we build the future of Python data tooling. Thanks for being part of our community!"})]})]}),e[6]=l):l=e[6],e[7]!==o?(c=d.jsx(ir,{className:"w-fit",children:d.jsx("form",{onSubmit:o,children:l})}),e[7]=o,e[8]=c):c=e[8],c},LO=()=>{const t=X.c(10),{selectedPanel:e}=fc(),{toggleApplication:n}=Zi(),o=zO;let r,s,i,a,l,c;return t[0]!==e||t[1]!==n?(r="h-full pt-4 pb-1 px-1 flex flex-col items-start text-muted-foreground text-md select-none no-print text-sm z-50 dark:bg-background print:hidden hide-on-fullscreen",s=cd.filter(BO).map(u=>d.jsx(zy,{tooltip:u.tooltip,selected:e===u.type,onClick:()=>n(u.type),children:o(u)},u.type)),t[0]=e,t[1]=n,t[2]=r,t[3]=s):(r=t[2],s=t[3]),t[4]===Symbol.for("react.memo_cache_sentinel")?(i=d.jsx(RO,{children:d.jsx(zy,{tooltip:"Send feedback!",selected:!1,children:d.jsx(jp,{className:"h-5 w-5"})})}),a=d.jsx("div",{className:"flex-1"}),l=d.jsx(FO,{}),t[4]=i,t[5]=a,t[6]=l):(i=t[4],a=t[5],l=t[6]),t[7]!==r||t[8]!==s?(c=d.jsxs("div",{className:r,children:[s,i,a,l]}),t[7]=r,t[8]=s,t[9]=c):c=t[9],c},FO=()=>{const t=X.c(7),e=Ue(QV);let n,o,r;return t[0]!==e?(n=e>0?d.jsxs("span",{children:[e," cell",e>1?"s":""," queued or running"]}):"No cells queued or running",t[0]=e,t[1]=n):n=t[1],t[2]!==e?(o=d.jsx("div",{className:"flex flex-col-reverse gap-[1px] overflow-hidden",children:Array.from({length:e}).map(UO)}),t[2]=e,t[3]=o):o=t[3],t[4]!==n||t[5]!==o?(r=d.jsx(Te,{content:n,side:"right",delayDuration:200,children:o}),t[4]=n,t[5]=o,t[6]=r):r=t[6],r},zy=t=>{const e=X.c(17);let n,o,r,s,i;e[0]!==t?({children:n,tooltip:i,selected:s,className:o,...r}=t,e[0]=t,e[1]=n,e[2]=o,e[3]=r,e[4]=s,e[5]=i):(n=e[1],o=e[2],r=e[3],s=e[4],i=e[5]);const a=!s&&"hover:bg-[var(--sage-3)]",l=s&&"bg-[var(--sage-4)]";let c,u,h;return e[6]!==o||e[7]!==a||e[8]!==l?(c=Ne("flex items-center p-2 text-sm mx-[1px] shadow-inset font-mono cursor-pointer rounded",a,l,o),e[6]=o,e[7]=a,e[8]=l,e[9]=c):c=e[9],e[10]!==n||e[11]!==r||e[12]!==c?(u=d.jsx("div",{className:c,...r,children:n}),e[10]=n,e[11]=r,e[12]=c,e[13]=u):u=e[13],e[14]!==u||e[15]!==i?(h=d.jsx(Te,{content:i,side:"right",delayDuration:200,children:u}),e[14]=u,e[15]=i,e[16]=h):h=e[16],h};function zO(t,e){const{Icon:n}=t;return d.jsx(n,{className:Ne("h-5 w-5",e)})}function BO(t){return!t.hidden&&t.position==="sidebar"}function UO(t,e){return d.jsx("div",{className:"flex-shrink-0 h-1 w-2 bg-[var(--grass-6)] border border-[var(--grass-7)]"},e.toString())}var Ju="ScrollArea",[By,dW]=I4(Ju),[VO,Pn]=By(Ju),Uy=M.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:o="hover",dir:r,scrollHideDelay:s=600,...i}=t,[a,l]=M.useState(null),[c,u]=M.useState(null),[h,f]=M.useState(null),[m,_]=M.useState(null),[g,p]=M.useState(null),[b,x]=M.useState(0),[y,v]=M.useState(0),[C,k]=M.useState(!1),[N,j]=M.useState(!1),I=Hs(e,A=>l(A)),T=e$(r);return d.jsx(VO,{scope:n,type:o,dir:T,scrollHideDelay:s,scrollArea:a,viewport:c,onViewportChange:u,content:h,onContentChange:f,scrollbarX:m,onScrollbarXChange:_,scrollbarXEnabled:C,onScrollbarXEnabledChange:k,scrollbarY:g,onScrollbarYChange:p,scrollbarYEnabled:N,onScrollbarYEnabledChange:j,onCornerWidthChange:x,onCornerHeightChange:v,children:d.jsx(Us.div,{dir:T,...i,ref:I,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":y+"px",...t.style}})})});Uy.displayName=Ju;var Vy="ScrollAreaViewport",$y=M.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:o,nonce:r,...s}=t,i=Pn(Vy,n),a=M.useRef(null),l=Hs(e,a,i.onViewportChange);return d.jsxs(d.Fragment,{children:[d.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),d.jsx(Us.div,{"data-radix-scroll-area-viewport":"",...s,ref:l,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...t.style},children:d.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:o})})]})});$y.displayName=Vy;var io="ScrollAreaScrollbar",Ku=M.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=Pn(io,t.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:i}=r,a=t.orientation==="horizontal";return M.useEffect(()=>(a?s(!0):i(!0),()=>{a?s(!1):i(!1)}),[a,s,i]),r.type==="hover"?d.jsx($O,{...o,ref:e,forceMount:n}):r.type==="scroll"?d.jsx(HO,{...o,ref:e,forceMount:n}):r.type==="auto"?d.jsx(Hy,{...o,ref:e,forceMount:n}):r.type==="always"?d.jsx(Xu,{...o,ref:e}):null});Ku.displayName=io;var $O=M.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=Pn(io,t.__scopeScrollArea),[s,i]=M.useState(!1);return M.useEffect(()=>{const a=r.scrollArea;let l=0;if(a){const c=()=>{window.clearTimeout(l),i(!0)},u=()=>{l=window.setTimeout(()=>i(!1),r.scrollHideDelay)};return a.addEventListener("pointerenter",c),a.addEventListener("pointerleave",u),()=>{window.clearTimeout(l),a.removeEventListener("pointerenter",c),a.removeEventListener("pointerleave",u)}}},[r.scrollArea,r.scrollHideDelay]),d.jsx(zc,{present:n||s,children:d.jsx(Hy,{"data-state":s?"visible":"hidden",...o,ref:e})})}),HO=M.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=Pn(io,t.__scopeScrollArea),s=t.orientation==="horizontal",i=Cl(()=>l("SCROLL_END"),100),[a,l]=function(c,u){return M.useReducer((h,f)=>u[h][f]??h,c)}("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return M.useEffect(()=>{if(a==="idle"){const c=window.setTimeout(()=>l("HIDE"),r.scrollHideDelay);return()=>window.clearTimeout(c)}},[a,r.scrollHideDelay,l]),M.useEffect(()=>{const c=r.viewport,u=s?"scrollLeft":"scrollTop";if(c){let h=c[u];const f=()=>{const m=c[u];h!==m&&(l("SCROLL"),i()),h=m};return c.addEventListener("scroll",f),()=>c.removeEventListener("scroll",f)}},[r.viewport,s,l,i]),d.jsx(zc,{present:n||a!=="hidden",children:d.jsx(Xu,{"data-state":a==="hidden"?"hidden":"visible",...o,ref:e,onPointerEnter:Gn(t.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:Gn(t.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),Hy=M.forwardRef((t,e)=>{const n=Pn(io,t.__scopeScrollArea),{forceMount:o,...r}=t,[s,i]=M.useState(!1),a=t.orientation==="horizontal",l=Cl(()=>{if(n.viewport){const c=n.viewport.offsetWidth<n.viewport.scrollWidth,u=n.viewport.offsetHeight<n.viewport.scrollHeight;i(a?c:u)}},10);return cs(n.viewport,l),cs(n.content,l),d.jsx(zc,{present:o||s,children:d.jsx(Xu,{"data-state":s?"visible":"hidden",...r,ref:e})})}),Xu=M.forwardRef((t,e)=>{const{orientation:n="vertical",...o}=t,r=Pn(io,t.__scopeScrollArea),s=M.useRef(null),i=M.useRef(0),[a,l]=M.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=Jy(a.viewport,a.content),u={...o,sizes:a,onSizesChange:l,hasThumb:c>0&&c<1,onThumbChange:f=>s.current=f,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:f=>i.current=f};function h(f,m){return function(_,g,p,b="ltr"){const x=Sl(p),y=x/2,v=g||y,C=x-v,k=p.scrollbar.paddingStart+v,N=p.scrollbar.size-p.scrollbar.paddingEnd-C,j=p.content-p.viewport,I=b==="ltr"?[0,j]:[-1*j,0];return Xy([k,N],I)(_)}(f,i.current,a,m)}return n==="horizontal"?d.jsx(WO,{...u,ref:e,onThumbPositionChange:()=>{if(r.viewport&&s.current){const f=Ky(r.viewport.scrollLeft,a,r.dir);s.current.style.transform=`translate3d(${f}px, 0, 0)`}},onWheelScroll:f=>{r.viewport&&(r.viewport.scrollLeft=f)},onDragScroll:f=>{r.viewport&&(r.viewport.scrollLeft=h(f,r.dir))}}):n==="vertical"?d.jsx(qO,{...u,ref:e,onThumbPositionChange:()=>{if(r.viewport&&s.current){const f=Ky(r.viewport.scrollTop,a);s.current.style.transform=`translate3d(0, ${f}px, 0)`}},onWheelScroll:f=>{r.viewport&&(r.viewport.scrollTop=f)},onDragScroll:f=>{r.viewport&&(r.viewport.scrollTop=h(f))}}):null}),WO=M.forwardRef((t,e)=>{const{sizes:n,onSizesChange:o,...r}=t,s=Pn(io,t.__scopeScrollArea),[i,a]=M.useState(),l=M.useRef(null),c=Hs(e,l,s.onScrollbarXChange);return M.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),d.jsx(qy,{"data-orientation":"horizontal",...r,ref:c,sizes:n,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Sl(n)+"px",...t.style},onThumbPointerDown:u=>t.onThumbPointerDown(u.x),onDragScroll:u=>t.onDragScroll(u.x),onWheelScroll:(u,h)=>{if(s.viewport){const f=s.viewport.scrollLeft+u.deltaX;t.onWheelScroll(f),Zy(f,h)&&u.preventDefault()}},onResize:()=>{l.current&&s.viewport&&i&&o({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:kl(i.paddingLeft),paddingEnd:kl(i.paddingRight)}})}})}),qO=M.forwardRef((t,e)=>{const{sizes:n,onSizesChange:o,...r}=t,s=Pn(io,t.__scopeScrollArea),[i,a]=M.useState(),l=M.useRef(null),c=Hs(e,l,s.onScrollbarYChange);return M.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),d.jsx(qy,{"data-orientation":"vertical",...r,ref:c,sizes:n,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Sl(n)+"px",...t.style},onThumbPointerDown:u=>t.onThumbPointerDown(u.y),onDragScroll:u=>t.onDragScroll(u.y),onWheelScroll:(u,h)=>{if(s.viewport){const f=s.viewport.scrollTop+u.deltaY;t.onWheelScroll(f),Zy(f,h)&&u.preventDefault()}},onResize:()=>{l.current&&s.viewport&&i&&o({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:kl(i.paddingTop),paddingEnd:kl(i.paddingBottom)}})}})}),[GO,Wy]=By(io),qy=M.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:o,hasThumb:r,onThumbChange:s,onThumbPointerUp:i,onThumbPointerDown:a,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:u,onResize:h,...f}=t,m=Pn(io,n),[_,g]=M.useState(null),p=Hs(e,I=>g(I)),b=M.useRef(null),x=M.useRef(""),y=m.viewport,v=o.content-o.viewport,C=dr(u),k=dr(l),N=Cl(h,10);function j(I){if(b.current){const T=I.clientX-b.current.left,A=I.clientY-b.current.top;c({x:T,y:A})}}return M.useEffect(()=>{const I=T=>{const A=T.target;(_==null?void 0:_.contains(A))&&C(T,v)};return document.addEventListener("wheel",I,{passive:!1}),()=>document.removeEventListener("wheel",I,{passive:!1})},[y,_,v,C]),M.useEffect(k,[o,k]),cs(_,N),cs(m.content,N),d.jsx(GO,{scope:n,scrollbar:_,hasThumb:r,onThumbChange:dr(s),onThumbPointerUp:dr(i),onThumbPositionChange:k,onThumbPointerDown:dr(a),children:d.jsx(Us.div,{...f,ref:p,style:{position:"absolute",...f.style},onPointerDown:Gn(t.onPointerDown,I=>{I.button===0&&(I.target.setPointerCapture(I.pointerId),b.current=_.getBoundingClientRect(),x.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",m.viewport&&(m.viewport.style.scrollBehavior="auto"),j(I))}),onPointerMove:Gn(t.onPointerMove,j),onPointerUp:Gn(t.onPointerUp,I=>{const T=I.target;T.hasPointerCapture(I.pointerId)&&T.releasePointerCapture(I.pointerId),document.body.style.webkitUserSelect=x.current,m.viewport&&(m.viewport.style.scrollBehavior=""),b.current=null})})})}),vl="ScrollAreaThumb",Gy=M.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=Wy(vl,t.__scopeScrollArea);return d.jsx(zc,{present:n||r.hasThumb,children:d.jsx(YO,{ref:e,...o})})}),YO=M.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:o,...r}=t,s=Pn(vl,n),i=Wy(vl,n),{onThumbPositionChange:a}=i,l=Hs(e,h=>i.onThumbChange(h)),c=M.useRef(void 0),u=Cl(()=>{c.current&&(c.current(),c.current=void 0)},100);return M.useEffect(()=>{const h=s.viewport;if(h){const f=()=>{if(u(),!c.current){const m=KO(h,a);c.current=m,a()}};return a(),h.addEventListener("scroll",f),()=>h.removeEventListener("scroll",f)}},[s.viewport,u,a]),d.jsx(Us.div,{"data-state":i.hasThumb?"visible":"hidden",...r,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...o},onPointerDownCapture:Gn(t.onPointerDownCapture,h=>{const f=h.target.getBoundingClientRect(),m=h.clientX-f.left,_=h.clientY-f.top;i.onThumbPointerDown({x:m,y:_})}),onPointerUp:Gn(t.onPointerUp,i.onThumbPointerUp)})});Gy.displayName=vl;var Zu="ScrollAreaCorner",Yy=M.forwardRef((t,e)=>{const n=Pn(Zu,t.__scopeScrollArea),o=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&o?d.jsx(JO,{...t,ref:e}):null});Yy.displayName=Zu;var JO=M.forwardRef((t,e)=>{const{__scopeScrollArea:n,...o}=t,r=Pn(Zu,n),[s,i]=M.useState(0),[a,l]=M.useState(0),c=!!(s&&a);return cs(r.scrollbarX,()=>{var h;const u=((h=r.scrollbarX)==null?void 0:h.offsetHeight)||0;r.onCornerHeightChange(u),l(u)}),cs(r.scrollbarY,()=>{var h;const u=((h=r.scrollbarY)==null?void 0:h.offsetWidth)||0;r.onCornerWidthChange(u),i(u)}),c?d.jsx(Us.div,{...o,ref:e,style:{width:s,height:a,position:"absolute",right:r.dir==="ltr"?0:void 0,left:r.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function kl(t){return t?parseInt(t,10):0}function Jy(t,e){const n=t/e;return isNaN(n)?0:n}function Sl(t){const e=Jy(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=(t.scrollbar.size-n)*e;return Math.max(o,18)}function Ky(t,e,n="ltr"){const o=Sl(e),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=e.scrollbar.size-r,i=e.content-e.viewport,a=s-o,l=n$(t,n==="ltr"?[0,i]:[-1*i,0]);return Xy([0,i],[0,a])(l)}function Xy(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const o=(e[1]-e[0])/(t[1]-t[0]);return e[0]+o*(n-t[0])}}function Zy(t,e){return t>0&&t<e}var KO=(t,e=()=>{})=>{let n={left:t.scrollLeft,top:t.scrollTop},o=0;return function r(){const s={left:t.scrollLeft,top:t.scrollTop},i=n.left!==s.left,a=n.top!==s.top;(i||a)&&e(),n=s,o=window.requestAnimationFrame(r)}(),()=>window.cancelAnimationFrame(o)};function Cl(t,e){const n=dr(t),o=M.useRef(0);return M.useEffect(()=>()=>window.clearTimeout(o.current),[]),M.useCallback(()=>{window.clearTimeout(o.current),o.current=window.setTimeout(n,e)},[n,e])}function cs(t,e){const n=dr(e);t$(()=>{let o=0;if(t){const r=new ResizeObserver(()=>{cancelAnimationFrame(o),o=window.requestAnimationFrame(n)});return r.observe(t),()=>{window.cancelAnimationFrame(o),r.unobserve(t)}}},[t,n])}var Qy=Uy,XO=$y,ZO=Yy;const ew=M.forwardRef((t,e)=>{const n=X.c(15);let o,r,s,i,a,l,c,u;return n[0]!==t?({className:r,children:o,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]),n[4]!==r?(i=Ne("relative overflow-hidden",r),n[4]=r,n[5]=i):i=n[5],n[6]!==o?(a=d.jsx(XO,{className:"h-full w-full rounded-[inherit]",children:o}),n[6]=o,n[7]=a):a=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(l=d.jsx(tw,{}),c=d.jsx(ZO,{}),n[8]=l,n[9]=c):(l=n[8],c=n[9]),n[10]!==s||n[11]!==e||n[12]!==i||n[13]!==a?(u=d.jsxs(Qy,{ref:e,className:i,...s,children:[a,l,c]}),n[10]=s,n[11]=e,n[12]=i,n[13]=a,n[14]=u):u=n[14],u});ew.displayName=Qy.displayName;const tw=M.forwardRef((t,e)=>{const n=X.c(14);let o,r,s;n[0]!==t?({className:o,orientation:s,...r}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]);const i=s===void 0?"vertical":s,a=i==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",l=i==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]";let c,u,h;return n[4]!==o||n[5]!==a||n[6]!==l?(c=Ne("flex touch-none select-none transition-colors",a,l,o),n[4]=o,n[5]=a,n[6]=l,n[7]=c):c=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(u=d.jsx(Gy,{className:"relative flex-1 rounded-full bg-border"}),n[8]=u):u=n[8],n[9]!==i||n[10]!==r||n[11]!==e||n[12]!==c?(h=d.jsx(Ku,{ref:e,orientation:i,className:c,...r,children:u}),n[9]=i,n[10]=r,n[11]=e,n[12]=c,n[13]=h):h=n[13],h});tw.displayName=Ku.displayName;let Qu;Qu=(t,e,n,o,r,s)=>{if(!e)return St.warn("No active chat"),t;const i=t.chats.findIndex(h=>h.id===e);if(i===-1)return St.warn("No active chat"),t;const a=t.chats[i],l=a.messages.findIndex(h=>h.id===n),c=[...t.chats],u=Date.now();if(l===-1)c[i]={...a,messages:[...a.messages,{id:n,role:o,content:r,timestamp:u,parts:s}],updatedAt:u};else{const h=[...a.messages];h[l]={...h[l],content:r,parts:s},c[i]={...a,messages:h,updatedAt:u}}return{...t,chats:c}},xn=t=>{const e=X.c(15),{title:n,description:o,icon:r,action:s}=t;let i,a,l,c,u,h;return e[0]!==r?(i=r&&K.cloneElement(r,{className:"text-accent-foreground"}),e[0]=r,e[1]=i):i=e[1],e[2]!==n?(a=d.jsx("span",{className:"mt-1 text-accent-foreground",children:n}),e[2]=n,e[3]=a):a=e[3],e[4]!==i||e[5]!==a?(l=d.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[i,a]}),e[4]=i,e[5]=a,e[6]=l):l=e[6],e[7]!==o?(c=d.jsx("span",{className:"text-muted-foreground text-sm",children:o}),e[7]=o,e[8]=c):c=e[8],e[9]!==s?(u=s&&d.jsx("div",{className:"mt-2",children:s}),e[9]=s,e[10]=u):u=e[10],e[11]!==l||e[12]!==c||e[13]!==u?(h=d.jsxs("div",{className:"mx-6 my-6 flex flex-col gap-2",children:[l,c,u]}),e[11]=l,e[12]=c,e[13]=u,e[14]=h):h=e[14],h};function uW(){}function hW(){}const QO=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,e9=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,t9={};function nw(t,e){return(t9.jsx?e9:QO).test(t)}const n9=/[ \t\n\f\r]/g;function ow(t){return t.replace(n9,"")===""}class Ni{constructor(e,n,o){this.property=e,this.normal=n,o&&(this.space=o)}}function rw(t,e){const n={},o={};let r=-1;for(;++r<t.length;)Object.assign(n,t[r].property),Object.assign(o,t[r].normal);return new Ni(n,o,e)}function eh(t){return t.toLowerCase()}Ni.prototype.property={},Ni.prototype.normal={},Ni.prototype.space=null;class Ln{constructor(e,n){this.property=e,this.attribute=n}}Ln.prototype.space=null,Ln.prototype.boolean=!1,Ln.prototype.booleanish=!1,Ln.prototype.overloadedBoolean=!1,Ln.prototype.number=!1,Ln.prototype.commaSeparated=!1,Ln.prototype.spaceSeparated=!1,Ln.prototype.commaOrSpaceSeparated=!1,Ln.prototype.mustUseProperty=!1,Ln.prototype.defined=!1;let o9=0;const Ze=Nr(),Dt=Nr(),sw=Nr(),ye=Nr(),gt=Nr(),ds=Nr(),wn=Nr();function Nr(){return 2**++o9}const th=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ze,booleanish:Dt,commaOrSpaceSeparated:wn,commaSeparated:ds,number:ye,overloadedBoolean:sw,spaceSeparated:gt},Symbol.toStringTag,{value:"Module"})),nh=Object.keys(th);class oh extends Ln{constructor(e,n,o,r){let s=-1;if(super(e,n),iw(this,"space",r),typeof o=="number")for(;++s<nh.length;){const i=nh[s];iw(this,nh[s],(o&th[i])===th[i])}}}function iw(t,e,n){n&&(t[e]=n)}oh.prototype.defined=!0;const r9={}.hasOwnProperty;function us(t){const e={},n={};let o;for(o in t.properties)if(r9.call(t.properties,o)){const r=t.properties[o],s=new oh(o,t.transform(t.attributes||{},o),r,t.space);t.mustUseProperty&&t.mustUseProperty.includes(o)&&(s.mustUseProperty=!0),e[o]=s,n[eh(o)]=o,n[eh(s.attribute)]=o}return new Ni(e,n,t.space)}const aw=us({space:"xlink",transform:(t,e)=>"xlink:"+e.slice(5).toLowerCase(),properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}}),lw=us({space:"xml",transform:(t,e)=>"xml:"+e.slice(3).toLowerCase(),properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function cw(t,e){return e in t?t[e]:e}function dw(t,e){return cw(t,e.toLowerCase())}const uw=us({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:dw,properties:{xmlns:null,xmlnsXLink:null}}),hw=us({transform:(t,e)=>e==="role"?e:"aria-"+e.slice(4).toLowerCase(),properties:{ariaActiveDescendant:null,ariaAtomic:Dt,ariaAutoComplete:null,ariaBusy:Dt,ariaChecked:Dt,ariaColCount:ye,ariaColIndex:ye,ariaColSpan:ye,ariaControls:gt,ariaCurrent:null,ariaDescribedBy:gt,ariaDetails:null,ariaDisabled:Dt,ariaDropEffect:gt,ariaErrorMessage:null,ariaExpanded:Dt,ariaFlowTo:gt,ariaGrabbed:Dt,ariaHasPopup:null,ariaHidden:Dt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:gt,ariaLevel:ye,ariaLive:null,ariaModal:Dt,ariaMultiLine:Dt,ariaMultiSelectable:Dt,ariaOrientation:null,ariaOwns:gt,ariaPlaceholder:null,ariaPosInSet:ye,ariaPressed:Dt,ariaReadOnly:Dt,ariaRelevant:null,ariaRequired:Dt,ariaRoleDescription:gt,ariaRowCount:ye,ariaRowIndex:ye,ariaRowSpan:ye,ariaSelected:Dt,ariaSetSize:ye,ariaSort:null,ariaValueMax:ye,ariaValueMin:ye,ariaValueNow:ye,ariaValueText:null,role:null}}),s9=us({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:dw,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ds,acceptCharset:gt,accessKey:gt,action:null,allow:null,allowFullScreen:Ze,allowPaymentRequest:Ze,allowUserMedia:Ze,alt:null,as:null,async:Ze,autoCapitalize:null,autoComplete:gt,autoFocus:Ze,autoPlay:Ze,blocking:gt,capture:null,charSet:null,checked:Ze,cite:null,className:gt,cols:ye,colSpan:null,content:null,contentEditable:Dt,controls:Ze,controlsList:gt,coords:ye|ds,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ze,defer:Ze,dir:null,dirName:null,disabled:Ze,download:sw,draggable:Dt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ze,formTarget:null,headers:gt,height:ye,hidden:Ze,high:ye,href:null,hrefLang:null,htmlFor:gt,httpEquiv:gt,id:null,imageSizes:null,imageSrcSet:null,inert:Ze,inputMode:null,integrity:null,is:null,isMap:Ze,itemId:null,itemProp:gt,itemRef:gt,itemScope:Ze,itemType:gt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ze,low:ye,manifest:null,max:null,maxLength:ye,media:null,method:null,min:null,minLength:ye,multiple:Ze,muted:Ze,name:null,nonce:null,noModule:Ze,noValidate:Ze,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ze,optimum:ye,pattern:null,ping:gt,placeholder:null,playsInline:Ze,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ze,referrerPolicy:null,rel:gt,required:Ze,reversed:Ze,rows:ye,rowSpan:ye,sandbox:gt,scope:null,scoped:Ze,seamless:Ze,selected:Ze,shadowRootClonable:Ze,shadowRootDelegatesFocus:Ze,shadowRootMode:null,shape:null,size:ye,sizes:null,slot:null,span:ye,spellCheck:Dt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ye,step:null,style:null,tabIndex:ye,target:null,title:null,translate:null,type:null,typeMustMatch:Ze,useMap:null,value:Dt,width:ye,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:gt,axis:null,background:null,bgColor:null,border:ye,borderColor:null,bottomMargin:ye,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ze,declare:Ze,event:null,face:null,frame:null,frameBorder:null,hSpace:ye,leftMargin:ye,link:null,longDesc:null,lowSrc:null,marginHeight:ye,marginWidth:ye,noResize:Ze,noHref:Ze,noShade:Ze,noWrap:Ze,object:null,profile:null,prompt:null,rev:null,rightMargin:ye,rules:null,scheme:null,scrolling:Dt,standby:null,summary:null,text:null,topMargin:ye,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ye,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ze,disableRemotePlayback:Ze,prefix:null,property:null,results:ye,security:null,unselectable:null}}),i9=us({space:"svg",attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},transform:cw,properties:{about:wn,accentHeight:ye,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ye,amplitude:ye,arabicForm:null,ascent:ye,attributeName:null,attributeType:null,azimuth:ye,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ye,by:null,calcMode:null,capHeight:ye,className:gt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ye,diffuseConstant:ye,direction:null,display:null,dur:null,divisor:ye,dominantBaseline:null,download:Ze,dx:null,dy:null,edgeMode:null,editable:null,elevation:ye,enableBackground:null,end:null,event:null,exponent:ye,externalResourcesRequired:null,fill:null,fillOpacity:ye,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ds,g2:ds,glyphName:ds,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ye,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ye,horizOriginX:ye,horizOriginY:ye,id:null,ideographic:ye,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ye,k:ye,k1:ye,k2:ye,k3:ye,k4:ye,kernelMatrix:wn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ye,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ye,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ye,overlineThickness:ye,paintOrder:null,panose1:null,path:null,pathLength:ye,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:gt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ye,pointsAtY:ye,pointsAtZ:ye,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:wn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:wn,rev:wn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:wn,requiredFeatures:wn,requiredFonts:wn,requiredFormats:wn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ye,specularExponent:ye,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ye,strikethroughThickness:ye,string:null,stroke:null,strokeDashArray:wn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ye,strokeOpacity:ye,strokeWidth:null,style:null,surfaceScale:ye,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:wn,tabIndex:ye,tableValues:null,target:null,targetX:ye,targetY:ye,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:wn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ye,underlineThickness:ye,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ye,values:null,vAlphabetic:ye,vMathematical:ye,vectorEffect:null,vHanging:ye,vIdeographic:ye,version:null,vertAdvY:ye,vertOriginX:ye,vertOriginY:ye,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ye,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}}),a9=/^data[-\w.:]+$/i,fw=/-[a-z]/g,l9=/[A-Z]/g;function c9(t){return"-"+t.toLowerCase()}function d9(t){return t.charAt(1).toUpperCase()}const u9={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},h9=rw([lw,aw,uw,hw,s9],"html"),rh=rw([lw,aw,uw,hw,i9],"svg"),mw=eS(o$()),f9=mw.default||mw,pw=gw("end"),sh=gw("start");function gw(t){return function(e){const n=e&&e.position&&e.position[t]||{};if(typeof n.line=="number"&&n.line>0&&typeof n.column=="number"&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset=="number"&&n.offset>-1?n.offset:void 0}}}function ji(t){return t&&typeof t=="object"?"position"in t||"type"in t?_w(t.position):"start"in t||"end"in t?_w(t):"line"in t||"column"in t?ih(t):"":""}function ih(t){return bw(t&&t.line)+":"+bw(t&&t.column)}function _w(t){return ih(t&&t.start)+"-"+ih(t&&t.end)}function bw(t){return t&&typeof t=="number"?t:1}class en extends Error{constructor(e,n,o){super(),typeof n=="string"&&(o=n,n=void 0);let r="",s={},i=!1;if(n&&(s="line"in n&&"column"in n||"start"in n&&"end"in n?{place:n}:"type"in n?{ancestors:[n],place:n.position}:{...n}),typeof e=="string"?r=e:!s.cause&&e&&(i=!0,r=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof o=="string"){const l=o.indexOf(":");l===-1?s.ruleId=o:(s.source=o.slice(0,l),s.ruleId=o.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file,this.message=r,this.line=a?a.line:void 0,this.name=ji(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=i&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual,this.expected,this.note,this.url}}en.prototype.file="",en.prototype.name="",en.prototype.reason="",en.prototype.message="",en.prototype.stack="",en.prototype.column=void 0,en.prototype.line=void 0,en.prototype.ancestors=void 0,en.prototype.cause=void 0,en.prototype.fatal=void 0,en.prototype.place=void 0,en.prototype.ruleId=void 0,en.prototype.source=void 0;const ah={}.hasOwnProperty,m9=new Map,p9=/[A-Z]/g,g9=/-([a-z])/g,_9=new Set(["table","tbody","thead","tfoot","tr"]),b9=new Set(["td","th"]),xw="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function x9(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let o;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");o=function(i,a){return l;function l(c,u,h,f){const m=Array.isArray(h.children),_=sh(c);return a(u,h,f,m,{columnNumber:_?_.column-1:void 0,fileName:i,lineNumber:_?_.line:void 0},void 0)}}(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");o=function(i,a,l){return c;function c(u,h,f,m){const _=Array.isArray(f.children)?l:a;return m?_(h,f,m):_(h,f)}}(0,e.jsx,e.jsxs)}const r={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:o,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?rh:h9,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=yw(r,t,void 0);return s&&typeof s!="string"?s:r.create(t,r.Fragment,{children:s||void 0},void 0)}function yw(t,e,n){return e.type==="element"?function(o,r,s){const i=o.schema;let a=i;r.tagName.toLowerCase()==="svg"&&i.space==="html"&&(a=rh,o.schema=a),o.ancestors.push(r);const l=vw(o,r.tagName,!1),c=function(h,f){const m={};let _,g;for(g in f.properties)if(g!=="children"&&ah.call(f.properties,g)){const p=y9(h,g,f.properties[g]);if(p){const[b,x]=p;h.tableCellAlignToStyle&&b==="align"&&typeof x=="string"&&b9.has(f.tagName)?_=x:m[b]=x}}return _&&((m.style||(m.style={}))[h.stylePropertyNameCase==="css"?"text-align":"textAlign"]=_),m}(o,r);let u=ch(o,r);return _9.has(r.tagName)&&(u=u.filter(function(h){return typeof h!="string"||!(typeof(f=h)=="object"?f.type==="text"&&ow(f.value):ow(f));var f})),ww(o,c,l,r),lh(c,u),o.ancestors.pop(),o.schema=i,o.create(r,l,c,s)}(t,e,n):e.type==="mdxFlowExpression"||e.type==="mdxTextExpression"?function(o,r){if(r.data&&r.data.estree&&o.evaluater){const s=r.data.estree.body[0];return s.type,o.evaluater.evaluateExpression(s.expression)}Ei(o,r.position)}(t,e):e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement"?function(o,r,s){const i=o.schema;let a=i;r.name==="svg"&&i.space==="html"&&(a=rh,o.schema=a),o.ancestors.push(r);const l=r.name===null?o.Fragment:vw(o,r.name,!0),c=function(h,f){const m={};for(const _ of f.attributes)if(_.type==="mdxJsxExpressionAttribute")if(_.data&&_.data.estree&&h.evaluater){const g=_.data.estree.body[0];g.type;const p=g.expression;p.type;const b=p.properties[0];b.type,Object.assign(m,h.evaluater.evaluateExpression(b.argument))}else Ei(h,f.position);else{const g=_.name;let p;if(_.value&&typeof _.value=="object")if(_.value.data&&_.value.data.estree&&h.evaluater){const b=_.value.data.estree.body[0];b.type,p=h.evaluater.evaluateExpression(b.expression)}else Ei(h,f.position);else p=_.value===null||_.value;m[g]=p}return m}(o,r),u=ch(o,r);return ww(o,c,l,r),lh(c,u),o.ancestors.pop(),o.schema=i,o.create(r,l,c,s)}(t,e,n):e.type==="mdxjsEsm"?function(o,r){if(r.data&&r.data.estree&&o.evaluater)return o.evaluater.evaluateProgram(r.data.estree);Ei(o,r.position)}(t,e):e.type==="root"?function(o,r,s){const i={};return lh(i,ch(o,r)),o.create(r,o.Fragment,i,s)}(t,e,n):e.type==="text"?function(o,r){return r.value}(0,e):void 0}function ww(t,e,n,o){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=o)}function lh(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function ch(t,e){const n=[];let o=-1;const r=t.passKeys?new Map:m9;for(;++o<e.children.length;){const s=e.children[o];let i;if(t.passKeys){const l=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(l){const c=r.get(l)||0;i=l+"-"+c,r.set(l,c+1)}}const a=yw(t,s,i);a!==void 0&&n.push(a)}return n}function y9(t,e,n){const o=function(r,s){const i=eh(s);let a=s,l=Ln;if(i in r.normal)return r.property[r.normal[i]];if(i.length>4&&i.slice(0,4)==="data"&&a9.test(s)){if(s.charAt(4)==="-"){const c=s.slice(5).replace(fw,d9);a="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=s.slice(4);if(!fw.test(c)){let u=c.replace(l9,c9);u.charAt(0)!=="-"&&(u="-"+u),s="data"+u}}l=oh}return new l(a,s)}(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=o.commaSeparated?function(r){const s={};return(r[r.length-1]===""?[...r,""]:r).join((s.padRight?" ":"")+","+(s.padLeft===!1?"":" ")).trim()}(n):n.join(" ").trim()),o.property==="style"){let r=typeof n=="object"?n:function(s,i){const a={};try{f9(i,l)}catch(c){if(!s.ignoreInvalidStyle){const u=c,h=new en("Cannot parse `style` attribute",{ancestors:s.ancestors,cause:u,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw h.file=s.filePath||void 0,h.url=xw+"#cannot-parse-style-attribute",h}}return a;function l(c,u){let h=c;h.slice(0,2)!=="--"&&(h.slice(0,4)==="-ms-"&&(h="ms-"+h.slice(4)),h=h.replace(g9,v9)),a[h]=u}}(t,String(n));return t.stylePropertyNameCase==="css"&&(r=function(s){const i={};let a;for(a in s)ah.call(s,a)&&(i[w9(a)]=s[a]);return i}(r)),["style",r]}return[t.elementAttributeNameCase==="react"&&o.space?u9[o.property]||o.property:o.attribute,n]}}function vw(t,e,n){let o;if(n)if(e.includes(".")){const r=e.split(".");let s,i=-1;for(;++i<r.length;){const a=nw(r[i])?{type:"Identifier",name:r[i]}:{type:"Literal",value:r[i]};s=s?{type:"MemberExpression",object:s,property:a,computed:!!(i&&a.type==="Literal"),optional:!1}:a}o=s}else o=nw(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};else o={type:"Literal",value:e};if(o.type==="Literal"){const r=o.value;return ah.call(t.components,r)?t.components[r]:r}if(t.evaluater)return t.evaluater.evaluateExpression(o);Ei(t)}function Ei(t,e){const n=new en("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:e,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=t.filePath||void 0,n.url=xw+"#cannot-handle-mdx-estrees-without-createevaluater",n}function w9(t){let e=t.replace(p9,k9);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function v9(t,e){return e.toUpperCase()}function k9(t){return"-"+t.toLowerCase()}const dh={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Nl={};function kw(t,e,n){if(function(o){return!!(o&&typeof o=="object")}(t)){if("value"in t)return t.type!=="html"||n?t.value:"";if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return Sw(t.children,e,n)}return Array.isArray(t)?Sw(t,e,n):""}function Sw(t,e,n){const o=[];let r=-1;for(;++r<t.length;)o[r]=kw(t[r],e,n);return o.join("")}const Cw=document.createElement("i");function uh(t){const e="&"+t+";";Cw.innerHTML=e;const n=Cw.textContent;return(n.charCodeAt(n.length-1)!==59||t==="semi")&&n!==e&&n}function ao(t,e,n,o){const r=t.length;let s,i=0;if(e=e<0?-e>r?0:r+e:e>r?r:e,n=n>0?n:0,o.length<1e4)s=Array.from(o),s.unshift(e,n),t.splice(...s);else for(n&&t.splice(e,n);i<o.length;)s=o.slice(i,i+1e4),s.unshift(e,0),t.splice(...s),i+=1e4,e+=1e4}function Fn(t,e){return t.length>0?(ao(t,t.length,0,e),t):e}const Nw={}.hasOwnProperty;function S9(t,e){let n;for(n in e){const o=(Nw.call(t,n)?t[n]:void 0)||(t[n]={}),r=e[n];let s;if(r)for(s in r){Nw.call(o,s)||(o[s]=[]);const i=r[s];C9(o[s],Array.isArray(i)?i:i?[i]:[])}}}function C9(t,e){let n=-1;const o=[];for(;++n<e.length;)(e[n].add==="after"?t:o).push(e[n]);ao(t,0,0,o)}function jw(t,e){const n=Number.parseInt(t,e);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||!(65535&~n)||(65535&n)==65534||n>1114111?"\uFFFD":String.fromCodePoint(n)}function hs(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const lo=Ko(/[A-Za-z]/),vn=Ko(/[\dA-Za-z]/),N9=Ko(/[#-'*+\--9=?A-Z^-~]/);function hh(t){return t!==null&&(t<32||t===127)}const fh=Ko(/\d/),j9=Ko(/[\dA-Fa-f]/),E9=Ko(/[!-/:-@[-`{-~]/);function Ye(t){return t!==null&&t<-2}function pn(t){return t!==null&&(t<0||t===32)}function ut(t){return t===-2||t===-1||t===32}const I9=Ko(new RegExp("\\p{P}|\\p{S}","u")),A9=Ko(/\s/);function Ko(t){return function(e){return e!==null&&e>-1&&t.test(String.fromCharCode(e))}}function fs(t){const e=[];let n=-1,o=0,r=0;for(;++n<t.length;){const s=t.charCodeAt(n);let i="";if(s===37&&vn(t.charCodeAt(n+1))&&vn(t.charCodeAt(n+2)))r=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(i=String.fromCharCode(s));else if(s>55295&&s<57344){const a=t.charCodeAt(n+1);s<56320&&a>56319&&a<57344?(i=String.fromCharCode(s,a),r=1):i="\uFFFD"}else i=String.fromCharCode(s);i&&(e.push(t.slice(o,n),encodeURIComponent(i)),o=n+r+1,i=""),r&&(n+=r,r=0)}return e.join("")+t.slice(o)}function _t(t,e,n,o){const r=o?o-1:Number.POSITIVE_INFINITY;let s=0;return function(a){return ut(a)?(t.enter(n),i(a)):e(a)};function i(a){return ut(a)&&s++<r?(t.consume(a),i):(t.exit(n),e(a))}}const T9={tokenize:function(t){const e=t.attempt(this.parser.constructs.contentInitial,function(s){return s===null?void t.consume(s):(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),_t(t,e,"linePrefix"))},function(s){return t.enter("paragraph"),o(s)});let n;return e;function o(s){const i=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=i),n=i,r(s)}function r(s){return s===null?(t.exit("chunkText"),t.exit("paragraph"),void t.consume(s)):Ye(s)?(t.consume(s),t.exit("chunkText"),o):(t.consume(s),r)}}},M9={tokenize:function(t){const e=this,n=[];let o,r,s,i=0;return a;function a(y){if(i<n.length){const v=n[i];return e.containerState=v[1],t.attempt(v[0].continuation,l,c)(y)}return c(y)}function l(y){if(i++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,o&&x();const v=e.events.length;let C,k=v;for(;k--;)if(e.events[k][0]==="exit"&&e.events[k][1].type==="chunkFlow"){C=e.events[k][1].end;break}b(i);let N=v;for(;N<e.events.length;)e.events[N][1].end={...C},N++;return ao(e.events,k+1,0,e.events.slice(v)),e.events.length=N,c(y)}return a(y)}function c(y){if(i===n.length){if(!o)return f(y);if(o.currentConstruct&&o.currentConstruct.concrete)return _(y);e.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(Ew,u,h)(y)}function u(y){return o&&x(),b(i),f(y)}function h(y){return e.parser.lazy[e.now().line]=i!==n.length,s=e.now().offset,_(y)}function f(y){return e.containerState={},t.attempt(Ew,m,_)(y)}function m(y){return i++,n.push([e.currentConstruct,e.containerState]),f(y)}function _(y){return y===null?(o&&x(),b(0),void t.consume(y)):(o=o||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:r}),g(y))}function g(y){return y===null?(p(t.exit("chunkFlow"),!0),b(0),void t.consume(y)):Ye(y)?(t.consume(y),p(t.exit("chunkFlow")),i=0,e.interrupt=void 0,a):(t.consume(y),g)}function p(y,v){const C=e.sliceStream(y);if(v&&C.push(null),y.previous=r,r&&(r.next=y),r=y,o.defineSkip(y.start),o.write(C),e.parser.lazy[y.start.line]){let k=o.events.length;for(;k--;)if(o.events[k][1].start.offset<s&&(!o.events[k][1].end||o.events[k][1].end.offset>s))return;const N=e.events.length;let j,I,T=N;for(;T--;)if(e.events[T][0]==="exit"&&e.events[T][1].type==="chunkFlow"){if(j){I=e.events[T][1].end;break}j=!0}for(b(i),k=N;k<e.events.length;)e.events[k][1].end={...I},k++;ao(e.events,T+1,0,e.events.slice(N)),e.events.length=k}}function b(y){let v=n.length;for(;v-- >y;){const C=n[v];e.containerState=C[1],C[0].exit.call(e,t)}n.length=y}function x(){o.write([null]),r=void 0,o=void 0,e.containerState._closeFlow=void 0}}},Ew={tokenize:function(t,e,n){return _t(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}};function Iw(t){return t===null||pn(t)||A9(t)?1:I9(t)?2:void 0}function mh(t,e,n){const o=[];let r=-1;for(;++r<t.length;){const s=t[r].resolveAll;s&&!o.includes(s)&&(e=s(e,n),o.push(s))}return e}const ph={name:"attention",resolveAll:function(t,e){let n,o,r,s,i,a,l,c,u=-1;for(;++u<t.length;)if(t[u][0]==="enter"&&t[u][1].type==="attentionSequence"&&t[u][1]._close){for(n=u;n--;)if(t[n][0]==="exit"&&t[n][1].type==="attentionSequence"&&t[n][1]._open&&e.sliceSerialize(t[n][1]).charCodeAt(0)===e.sliceSerialize(t[u][1]).charCodeAt(0)){if((t[n][1]._close||t[u][1]._open)&&(t[u][1].end.offset-t[u][1].start.offset)%3&&!((t[n][1].end.offset-t[n][1].start.offset+t[u][1].end.offset-t[u][1].start.offset)%3))continue;a=t[n][1].end.offset-t[n][1].start.offset>1&&t[u][1].end.offset-t[u][1].start.offset>1?2:1;const h={...t[n][1].end},f={...t[u][1].start};Aw(h,-a),Aw(f,a),s={type:a>1?"strongSequence":"emphasisSequence",start:h,end:{...t[n][1].end}},i={type:a>1?"strongSequence":"emphasisSequence",start:{...t[u][1].start},end:f},r={type:a>1?"strongText":"emphasisText",start:{...t[n][1].end},end:{...t[u][1].start}},o={type:a>1?"strong":"emphasis",start:{...s.start},end:{...i.end}},t[n][1].end={...s.start},t[u][1].start={...i.end},l=[],t[n][1].end.offset-t[n][1].start.offset&&(l=Fn(l,[["enter",t[n][1],e],["exit",t[n][1],e]])),l=Fn(l,[["enter",o,e],["enter",s,e],["exit",s,e],["enter",r,e]]),l=Fn(l,mh(e.parser.constructs.insideSpan.null,t.slice(n+1,u),e)),l=Fn(l,[["exit",r,e],["enter",i,e],["exit",i,e],["exit",o,e]]),t[u][1].end.offset-t[u][1].start.offset?(c=2,l=Fn(l,[["enter",t[u][1],e],["exit",t[u][1],e]])):c=0,ao(t,n-1,u-n+3,l),u=n+l.length-c-2;break}}for(u=-1;++u<t.length;)t[u][1].type==="attentionSequence"&&(t[u][1].type="data");return t},tokenize:function(t,e){const n=this.parser.constructs.attentionMarkers.null,o=this.previous,r=Iw(o);let s;return function(a){return s=a,t.enter("attentionSequence"),i(a)};function i(a){if(a===s)return t.consume(a),i;const l=t.exit("attentionSequence"),c=Iw(a),u=!c||c===2&&r||n.includes(a),h=!r||r===2&&c||n.includes(o);return l._open=!!(s===42?u:u&&(r||!h)),l._close=!!(s===42?h:h&&(c||!u)),e(a)}}};function Aw(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const O9={name:"autolink",tokenize:function(t,e,n){let o=0;return function(f){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),r};function r(f){return lo(f)?(t.consume(f),s):f===64?n(f):l(f)}function s(f){return f===43||f===45||f===46||vn(f)?(o=1,i(f)):l(f)}function i(f){return f===58?(t.consume(f),o=0,a):(f===43||f===45||f===46||vn(f))&&o++<32?(t.consume(f),i):(o=0,l(f))}function a(f){return f===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):f===null||f===32||f===60||hh(f)?n(f):(t.consume(f),a)}function l(f){return f===64?(t.consume(f),c):N9(f)?(t.consume(f),l):n(f)}function c(f){return vn(f)?u(f):n(f)}function u(f){return f===46?(t.consume(f),o=0,c):f===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):h(f)}function h(f){if((f===45||vn(f))&&o++<63){const m=f===45?h:u;return t.consume(f),m}return n(f)}}},jl={partial:!0,tokenize:function(t,e,n){return function(r){return ut(r)?_t(t,o,"linePrefix")(r):o(r)};function o(r){return r===null||Ye(r)?e(r):n(r)}}},Tw={continuation:{tokenize:function(t,e,n){const o=this;return function(s){return ut(s)?_t(t,r,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):r(s)};function r(s){return t.attempt(Tw,e,n)(s)}}},exit:function(t){t.exit("blockQuote")},name:"blockQuote",tokenize:function(t,e,n){const o=this;return function(s){if(s===62){const i=o.containerState;return i.open||(t.enter("blockQuote",{_container:!0}),i.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(s),t.exit("blockQuoteMarker"),r}return n(s)};function r(s){return ut(s)?(t.enter("blockQuotePrefixWhitespace"),t.consume(s),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(s))}}},Mw={name:"characterEscape",tokenize:function(t,e,n){return function(r){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(r),t.exit("escapeMarker"),o};function o(r){return E9(r)?(t.enter("characterEscapeValue"),t.consume(r),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(r)}}},Ow={name:"characterReference",tokenize:function(t,e,n){const o=this;let r,s,i=0;return function(u){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(u),t.exit("characterReferenceMarker"),a};function a(u){return u===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(u),t.exit("characterReferenceMarkerNumeric"),l):(t.enter("characterReferenceValue"),r=31,s=vn,c(u))}function l(u){return u===88||u===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(u),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),r=6,s=j9,c):(t.enter("characterReferenceValue"),r=7,s=fh,c(u))}function c(u){if(u===59&&i){const h=t.exit("characterReferenceValue");return s!==vn||uh(o.sliceSerialize(h))?(t.enter("characterReferenceMarker"),t.consume(u),t.exit("characterReferenceMarker"),t.exit("characterReference"),e):n(u)}return s(u)&&i++<r?(t.consume(u),c):n(u)}}},Dw={partial:!0,tokenize:function(t,e,n){const o=this;return function(s){return s===null?n(s):(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),r)};function r(s){return o.parser.lazy[o.now().line]?n(s):e(s)}}},Rw={concrete:!0,name:"codeFenced",tokenize:function(t,e,n){const o=this,r={partial:!0,tokenize:function(y,v,C){let k=0;return N;function N(R){return y.enter("lineEnding"),y.consume(R),y.exit("lineEnding"),j}function j(R){return y.enter("codeFencedFence"),ut(R)?_t(y,I,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):I(R)}function I(R){return R===s?(y.enter("codeFencedFenceSequence"),T(R)):C(R)}function T(R){return R===s?(k++,y.consume(R),T):k>=a?(y.exit("codeFencedFenceSequence"),ut(R)?_t(y,A,"whitespace")(R):A(R)):C(R)}function A(R){return R===null||Ye(R)?(y.exit("codeFencedFence"),v(R)):C(R)}}};let s,i=0,a=0;return function(y){return function(v){const C=o.events[o.events.length-1];return i=C&&C[1].type==="linePrefix"?C[2].sliceSerialize(C[1],!0).length:0,s=v,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),l(v)}(y)};function l(y){return y===s?(a++,t.consume(y),l):a<3?n(y):(t.exit("codeFencedFenceSequence"),ut(y)?_t(t,c,"whitespace")(y):c(y))}function c(y){return y===null||Ye(y)?(t.exit("codeFencedFence"),o.interrupt?e(y):t.check(Dw,m,x)(y)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),u(y))}function u(y){return y===null||Ye(y)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),c(y)):ut(y)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),_t(t,h,"whitespace")(y)):y===96&&y===s?n(y):(t.consume(y),u)}function h(y){return y===null||Ye(y)?c(y):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),f(y))}function f(y){return y===null||Ye(y)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),c(y)):y===96&&y===s?n(y):(t.consume(y),f)}function m(y){return t.attempt(r,x,_)(y)}function _(y){return t.enter("lineEnding"),t.consume(y),t.exit("lineEnding"),g}function g(y){return i>0&&ut(y)?_t(t,p,"linePrefix",i+1)(y):p(y)}function p(y){return y===null||Ye(y)?t.check(Dw,m,x)(y):(t.enter("codeFlowValue"),b(y))}function b(y){return y===null||Ye(y)?(t.exit("codeFlowValue"),p(y)):(t.consume(y),b)}function x(y){return t.exit("codeFenced"),e(y)}}},gh={name:"codeIndented",tokenize:function(t,e,n){const o=this;return function(l){return t.enter("codeIndented"),_t(t,r,"linePrefix",5)(l)};function r(l){const c=o.events[o.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?s(l):n(l)}function s(l){return l===null?a(l):Ye(l)?t.attempt(D9,s,a)(l):(t.enter("codeFlowValue"),i(l))}function i(l){return l===null||Ye(l)?(t.exit("codeFlowValue"),s(l)):(t.consume(l),i)}function a(l){return t.exit("codeIndented"),e(l)}}},D9={partial:!0,tokenize:function(t,e,n){const o=this;return r;function r(i){return o.parser.lazy[o.now().line]?n(i):Ye(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),r):_t(t,s,"linePrefix",5)(i)}function s(i){const a=o.events[o.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(i):Ye(i)?r(i):n(i)}}},R9={name:"codeText",previous:function(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"},resolve:function(t){let e,n,o=t.length-4,r=3;if(!(t[r][1].type!=="lineEnding"&&t[r][1].type!=="space"||t[o][1].type!=="lineEnding"&&t[o][1].type!=="space")){for(e=r;++e<o;)if(t[e][1].type==="codeTextData"){t[r][1].type="codeTextPadding",t[o][1].type="codeTextPadding",r+=2,o-=2;break}}for(e=r-1,o++;++e<=o;)n===void 0?e!==o&&t[e][1].type!=="lineEnding"&&(n=e):e!==o&&t[e][1].type!=="lineEnding"||(t[n][1].type="codeTextData",e!==n+2&&(t[n][1].end=t[e-1][1].end,t.splice(n+2,e-n-2),o-=e-n-2,e=n+2),n=void 0);return t},tokenize:function(t,e,n){let o,r,s=0;return function(u){return t.enter("codeText"),t.enter("codeTextSequence"),i(u)};function i(u){return u===96?(t.consume(u),s++,i):(t.exit("codeTextSequence"),a(u))}function a(u){return u===null?n(u):u===32?(t.enter("space"),t.consume(u),t.exit("space"),a):u===96?(r=t.enter("codeTextSequence"),o=0,c(u)):Ye(u)?(t.enter("lineEnding"),t.consume(u),t.exit("lineEnding"),a):(t.enter("codeTextData"),l(u))}function l(u){return u===null||u===32||u===96||Ye(u)?(t.exit("codeTextData"),a(u)):(t.consume(u),l)}function c(u){return u===96?(t.consume(u),o++,c):o===s?(t.exit("codeTextSequence"),t.exit("codeText"),e(u)):(r.type="codeTextData",l(u))}}};class P9{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,n){const o=n??Number.POSITIVE_INFINITY;return o<this.left.length?this.left.slice(e,o):e>this.left.length?this.right.slice(this.right.length-o+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-o+this.left.length).reverse())}splice(e,n,o){const r=n||0;this.setCursor(Math.trunc(e));const s=this.right.splice(this.right.length-r,Number.POSITIVE_INFINITY);return o&&Ii(this.left,o),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),Ii(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Ii(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const n=this.left.splice(e,Number.POSITIVE_INFINITY);Ii(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Ii(this.left,n.reverse())}}}function Ii(t,e){let n=0;if(e.length<1e4)t.push(...e);else for(;n<e.length;)t.push(...e.slice(n,n+1e4)),n+=1e4}function Pw(t){const e={};let n,o,r,s,i,a,l,c=-1;const u=new P9(t);for(;++c<u.length;){for(;c in e;)c=e[c];if(n=u.get(c),c&&n[1].type==="chunkFlow"&&u.get(c-1)[1].type==="listItemPrefix"&&(a=n[1]._tokenizer.events,r=0,r<a.length&&a[r][1].type==="lineEndingBlank"&&(r+=2),r<a.length&&a[r][1].type==="content"))for(;++r<a.length&&a[r][1].type!=="content";)a[r][1].type==="chunkText"&&(a[r][1]._isInFirstContentOfListItem=!0,r++);if(n[0]==="enter")n[1].contentType&&(Object.assign(e,L9(u,c)),c=e[c],l=!0);else if(n[1]._container){for(r=c,o=void 0;r--&&(s=u.get(r),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank");)s[0]==="enter"&&(o&&(u.get(o)[1].type="lineEndingBlank"),s[1].type="lineEnding",o=r);o&&(n[1].end={...u.get(o)[1].start},i=u.slice(o,c),i.unshift(n),u.splice(o,c-o+1,i))}}return ao(t,0,Number.POSITIVE_INFINITY,u.slice(0)),!l}function L9(t,e){const n=t.get(e)[1],o=t.get(e)[2];let r=e-1;const s=[],i=n._tokenizer||o.parser[n.contentType](n.start),a=i.events,l=[],c={};let u,h,f=-1,m=n,_=0,g=0;const p=[g];for(;m;){for(;t.get(++r)[1]!==m;);s.push(r),m._tokenizer||(u=o.sliceStream(m),m.next||u.push(null),h&&i.defineSkip(m.start),m._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=!0),i.write(u),m._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=void 0)),h=m,m=m.next}for(m=n;++f<a.length;)a[f][0]==="exit"&&a[f-1][0]==="enter"&&a[f][1].type===a[f-1][1].type&&a[f][1].start.line!==a[f][1].end.line&&(g=f+1,p.push(g),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(i.events=[],m?(m._tokenizer=void 0,m.previous=void 0):p.pop(),f=p.length;f--;){const b=a.slice(p[f],p[f+1]),x=s.pop();l.push([x,x+b.length-1]),t.splice(x,2,b)}for(l.reverse(),f=-1;++f<l.length;)c[_+l[f][0]]=_+l[f][1],_+=l[f][1]-l[f][0]-1;return c}const F9={resolve:function(t){return Pw(t),t},tokenize:function(t,e){let n;return function(i){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),o(i)};function o(i){return i===null?r(i):Ye(i)?t.check(z9,s,r)(i):(t.consume(i),o)}function r(i){return t.exit("chunkContent"),t.exit("content"),e(i)}function s(i){return t.consume(i),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}},z9={partial:!0,tokenize:function(t,e,n){const o=this;return function(s){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),_t(t,r,"linePrefix")};function r(s){if(s===null||Ye(s))return n(s);const i=o.events[o.events.length-1];return!o.parser.constructs.disable.null.includes("codeIndented")&&i&&i[1].type==="linePrefix"&&i[2].sliceSerialize(i[1],!0).length>=4?e(s):t.interrupt(o.parser.constructs.flow,n,e)(s)}}};function Lw(t,e,n,o,r,s,i,a,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return function(p){return p===60?(t.enter(o),t.enter(r),t.enter(s),t.consume(p),t.exit(s),h):p===null||p===32||p===41||hh(p)?n(p):(t.enter(o),t.enter(i),t.enter(a),t.enter("chunkString",{contentType:"string"}),_(p))};function h(p){return p===62?(t.enter(s),t.consume(p),t.exit(s),t.exit(r),t.exit(o),e):(t.enter(a),t.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===62?(t.exit("chunkString"),t.exit(a),h(p)):p===null||p===60||Ye(p)?n(p):(t.consume(p),p===92?m:f)}function m(p){return p===60||p===62||p===92?(t.consume(p),f):f(p)}function _(p){return u||p!==null&&p!==41&&!pn(p)?u<c&&p===40?(t.consume(p),u++,_):p===41?(t.consume(p),u--,_):p===null||p===32||p===40||hh(p)?n(p):(t.consume(p),p===92?g:_):(t.exit("chunkString"),t.exit(a),t.exit(i),t.exit(o),e(p))}function g(p){return p===40||p===41||p===92?(t.consume(p),_):_(p)}}function Fw(t,e,n,o,r,s){const i=this;let a,l=0;return function(f){return t.enter(o),t.enter(r),t.consume(f),t.exit(r),t.enter(s),c};function c(f){return l>999||f===null||f===91||f===93&&!a||f===94&&!l&&"_hiddenFootnoteSupport"in i.parser.constructs?n(f):f===93?(t.exit(s),t.enter(r),t.consume(f),t.exit(r),t.exit(o),e):Ye(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),c):(t.enter("chunkString",{contentType:"string"}),u(f))}function u(f){return f===null||f===91||f===93||Ye(f)||l++>999?(t.exit("chunkString"),c(f)):(t.consume(f),a||(a=!ut(f)),f===92?h:u)}function h(f){return f===91||f===92||f===93?(t.consume(f),l++,u):u(f)}}function zw(t,e,n,o,r,s){let i;return function(h){return h===34||h===39||h===40?(t.enter(o),t.enter(r),t.consume(h),t.exit(r),i=h===40?41:h,a):n(h)};function a(h){return h===i?(t.enter(r),t.consume(h),t.exit(r),t.exit(o),e):(t.enter(s),l(h))}function l(h){return h===i?(t.exit(s),a(i)):h===null?n(h):Ye(h)?(t.enter("lineEnding"),t.consume(h),t.exit("lineEnding"),_t(t,l,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),c(h))}function c(h){return h===i||h===null||Ye(h)?(t.exit("chunkString"),l(h)):(t.consume(h),h===92?u:c)}function u(h){return h===i||h===92?(t.consume(h),c):c(h)}}function Ai(t,e){let n;return function o(r){return Ye(r)?(t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),n=!0,o):ut(r)?_t(t,o,n?"linePrefix":"lineSuffix")(r):e(r)}}const B9={name:"definition",tokenize:function(t,e,n){const o=this;let r;return function(h){return t.enter("definition"),function(f){return Fw.call(o,t,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}(h)};function s(h){return r=hs(o.sliceSerialize(o.events[o.events.length-1][1]).slice(1,-1)),h===58?(t.enter("definitionMarker"),t.consume(h),t.exit("definitionMarker"),i):n(h)}function i(h){return pn(h)?Ai(t,a)(h):a(h)}function a(h){return Lw(t,l,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function l(h){return t.attempt(U9,c,c)(h)}function c(h){return ut(h)?_t(t,u,"whitespace")(h):u(h)}function u(h){return h===null||Ye(h)?(t.exit("definition"),o.parser.defined.push(r),e(h)):n(h)}}},U9={partial:!0,tokenize:function(t,e,n){return function(i){return pn(i)?Ai(t,o)(i):n(i)};function o(i){return zw(t,r,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(i)}function r(i){return ut(i)?_t(t,s,"whitespace")(i):s(i)}function s(i){return i===null||Ye(i)?e(i):n(i)}}},V9={name:"hardBreakEscape",tokenize:function(t,e,n){return function(r){return t.enter("hardBreakEscape"),t.consume(r),o};function o(r){return Ye(r)?(t.exit("hardBreakEscape"),e(r)):n(r)}}},$9={name:"headingAtx",resolve:function(t,e){let n,o,r=t.length-2,s=3;return t[s][1].type==="whitespace"&&(s+=2),r-2>s&&t[r][1].type==="whitespace"&&(r-=2),t[r][1].type==="atxHeadingSequence"&&(s===r-1||r-4>s&&t[r-2][1].type==="whitespace")&&(r-=s+1===r?2:4),r>s&&(n={type:"atxHeadingText",start:t[s][1].start,end:t[r][1].end},o={type:"chunkText",start:t[s][1].start,end:t[r][1].end,contentType:"text"},ao(t,s,r-s+1,[["enter",n,e],["enter",o,e],["exit",o,e],["exit",n,e]])),t},tokenize:function(t,e,n){let o=0;return function(l){return t.enter("atxHeading"),function(c){return t.enter("atxHeadingSequence"),r(c)}(l)};function r(l){return l===35&&o++<6?(t.consume(l),r):l===null||pn(l)?(t.exit("atxHeadingSequence"),s(l)):n(l)}function s(l){return l===35?(t.enter("atxHeadingSequence"),i(l)):l===null||Ye(l)?(t.exit("atxHeading"),e(l)):ut(l)?_t(t,s,"whitespace")(l):(t.enter("atxHeadingText"),a(l))}function i(l){return l===35?(t.consume(l),i):(t.exit("atxHeadingSequence"),s(l))}function a(l){return l===null||l===35||pn(l)?(t.exit("atxHeadingText"),s(l)):(t.consume(l),a)}}},H9=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Bw=["pre","script","style","textarea"],W9={concrete:!0,name:"htmlFlow",resolveTo:function(t){let e=t.length;for(;e--&&(t[e][0]!=="enter"||t[e][1].type!=="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t},tokenize:function(t,e,n){const o=this;let r,s,i,a,l;return function(E){return function(W){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(W),c}(E)};function c(E){return E===33?(t.consume(E),u):E===47?(t.consume(E),s=!0,m):E===63?(t.consume(E),r=3,o.interrupt?e:O):lo(E)?(t.consume(E),i=String.fromCharCode(E),_):n(E)}function u(E){return E===45?(t.consume(E),r=2,h):E===91?(t.consume(E),r=5,a=0,f):lo(E)?(t.consume(E),r=4,o.interrupt?e:O):n(E)}function h(E){return E===45?(t.consume(E),o.interrupt?e:O):n(E)}function f(E){return E==="CDATA[".charCodeAt(a++)?(t.consume(E),a===6?o.interrupt?e:T:f):n(E)}function m(E){return lo(E)?(t.consume(E),i=String.fromCharCode(E),_):n(E)}function _(E){if(E===null||E===47||E===62||pn(E)){const W=E===47,G=i.toLowerCase();return W||s||!Bw.includes(G)?H9.includes(i.toLowerCase())?(r=6,W?(t.consume(E),g):o.interrupt?e(E):T(E)):(r=7,o.interrupt&&!o.parser.lazy[o.now().line]?n(E):s?p(E):b(E)):(r=1,o.interrupt?e(E):T(E))}return E===45||vn(E)?(t.consume(E),i+=String.fromCharCode(E),_):n(E)}function g(E){return E===62?(t.consume(E),o.interrupt?e:T):n(E)}function p(E){return ut(E)?(t.consume(E),p):j(E)}function b(E){return E===47?(t.consume(E),j):E===58||E===95||lo(E)?(t.consume(E),x):ut(E)?(t.consume(E),b):j(E)}function x(E){return E===45||E===46||E===58||E===95||vn(E)?(t.consume(E),x):y(E)}function y(E){return E===61?(t.consume(E),v):ut(E)?(t.consume(E),y):b(E)}function v(E){return E===null||E===60||E===61||E===62||E===96?n(E):E===34||E===39?(t.consume(E),l=E,C):ut(E)?(t.consume(E),v):k(E)}function C(E){return E===l?(t.consume(E),l=null,N):E===null||Ye(E)?n(E):(t.consume(E),C)}function k(E){return E===null||E===34||E===39||E===47||E===60||E===61||E===62||E===96||pn(E)?y(E):(t.consume(E),k)}function N(E){return E===47||E===62||ut(E)?b(E):n(E)}function j(E){return E===62?(t.consume(E),I):n(E)}function I(E){return E===null||Ye(E)?T(E):ut(E)?(t.consume(E),I):n(E)}function T(E){return E===45&&r===2?(t.consume(E),D):E===60&&r===1?(t.consume(E),F):E===62&&r===4?(t.consume(E),S):E===63&&r===3?(t.consume(E),O):E===93&&r===5?(t.consume(E),U):!Ye(E)||r!==6&&r!==7?E===null||Ye(E)?(t.exit("htmlFlowData"),A(E)):(t.consume(E),T):(t.exit("htmlFlowData"),t.check(q9,$,A)(E))}function A(E){return t.check(G9,R,$)(E)}function R(E){return t.enter("lineEnding"),t.consume(E),t.exit("lineEnding"),z}function z(E){return E===null||Ye(E)?A(E):(t.enter("htmlFlowData"),T(E))}function D(E){return E===45?(t.consume(E),O):T(E)}function F(E){return E===47?(t.consume(E),i="",B):T(E)}function B(E){if(E===62){const W=i.toLowerCase();return Bw.includes(W)?(t.consume(E),S):T(E)}return lo(E)&&i.length<8?(t.consume(E),i+=String.fromCharCode(E),B):T(E)}function U(E){return E===93?(t.consume(E),O):T(E)}function O(E){return E===62?(t.consume(E),S):E===45&&r===2?(t.consume(E),O):T(E)}function S(E){return E===null||Ye(E)?(t.exit("htmlFlowData"),$(E)):(t.consume(E),S)}function $(E){return t.exit("htmlFlow"),e(E)}}},q9={partial:!0,tokenize:function(t,e,n){return function(o){return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),t.attempt(jl,e,n)}}},G9={partial:!0,tokenize:function(t,e,n){const o=this;return function(s){return Ye(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),r):n(s)};function r(s){return o.parser.lazy[o.now().line]?n(s):e(s)}}},Y9={name:"htmlText",tokenize:function(t,e,n){const o=this;let r,s,i;return function(S){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(S),a};function a(S){return S===33?(t.consume(S),l):S===47?(t.consume(S),v):S===63?(t.consume(S),x):lo(S)?(t.consume(S),N):n(S)}function l(S){return S===45?(t.consume(S),c):S===91?(t.consume(S),s=0,m):lo(S)?(t.consume(S),b):n(S)}function c(S){return S===45?(t.consume(S),f):n(S)}function u(S){return S===null?n(S):S===45?(t.consume(S),h):Ye(S)?(i=u,B(S)):(t.consume(S),u)}function h(S){return S===45?(t.consume(S),f):u(S)}function f(S){return S===62?F(S):S===45?h(S):u(S)}function m(S){return S==="CDATA[".charCodeAt(s++)?(t.consume(S),s===6?_:m):n(S)}function _(S){return S===null?n(S):S===93?(t.consume(S),g):Ye(S)?(i=_,B(S)):(t.consume(S),_)}function g(S){return S===93?(t.consume(S),p):_(S)}function p(S){return S===62?F(S):S===93?(t.consume(S),p):_(S)}function b(S){return S===null||S===62?F(S):Ye(S)?(i=b,B(S)):(t.consume(S),b)}function x(S){return S===null?n(S):S===63?(t.consume(S),y):Ye(S)?(i=x,B(S)):(t.consume(S),x)}function y(S){return S===62?F(S):x(S)}function v(S){return lo(S)?(t.consume(S),C):n(S)}function C(S){return S===45||vn(S)?(t.consume(S),C):k(S)}function k(S){return Ye(S)?(i=k,B(S)):ut(S)?(t.consume(S),k):F(S)}function N(S){return S===45||vn(S)?(t.consume(S),N):S===47||S===62||pn(S)?j(S):n(S)}function j(S){return S===47?(t.consume(S),F):S===58||S===95||lo(S)?(t.consume(S),I):Ye(S)?(i=j,B(S)):ut(S)?(t.consume(S),j):F(S)}function I(S){return S===45||S===46||S===58||S===95||vn(S)?(t.consume(S),I):T(S)}function T(S){return S===61?(t.consume(S),A):Ye(S)?(i=T,B(S)):ut(S)?(t.consume(S),T):j(S)}function A(S){return S===null||S===60||S===61||S===62||S===96?n(S):S===34||S===39?(t.consume(S),r=S,R):Ye(S)?(i=A,B(S)):ut(S)?(t.consume(S),A):(t.consume(S),z)}function R(S){return S===r?(t.consume(S),r=void 0,D):S===null?n(S):Ye(S)?(i=R,B(S)):(t.consume(S),R)}function z(S){return S===null||S===34||S===39||S===60||S===61||S===96?n(S):S===47||S===62||pn(S)?j(S):(t.consume(S),z)}function D(S){return S===47||S===62||pn(S)?j(S):n(S)}function F(S){return S===62?(t.consume(S),t.exit("htmlTextData"),t.exit("htmlText"),e):n(S)}function B(S){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(S),t.exit("lineEnding"),U}function U(S){return ut(S)?_t(t,O,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(S):O(S)}function O(S){return t.enter("htmlTextData"),i(S)}}},_h={name:"labelEnd",resolveAll:function(t){let e=-1;const n=[];for(;++e<t.length;){const o=t[e][1];if(n.push(t[e]),o.type==="labelImage"||o.type==="labelLink"||o.type==="labelEnd"){const r=o.type==="labelImage"?4:2;o.type="data",e+=r}}return t.length!==n.length&&ao(t,0,t.length,n),t},resolveTo:function(t,e){let n,o,r,s,i=t.length,a=0;for(;i--;)if(n=t[i][1],o){if(n.type==="link"||n.type==="labelLink"&&n._inactive)break;t[i][0]==="enter"&&n.type==="labelLink"&&(n._inactive=!0)}else if(r){if(t[i][0]==="enter"&&(n.type==="labelImage"||n.type==="labelLink")&&!n._balanced&&(o=i,n.type!=="labelLink")){a=2;break}}else n.type==="labelEnd"&&(r=i);const l={type:t[o][1].type==="labelLink"?"link":"image",start:{...t[o][1].start},end:{...t[t.length-1][1].end}},c={type:"label",start:{...t[o][1].start},end:{...t[r][1].end}},u={type:"labelText",start:{...t[o+a+2][1].end},end:{...t[r-2][1].start}};return s=[["enter",l,e],["enter",c,e]],s=Fn(s,t.slice(o+1,o+a+3)),s=Fn(s,[["enter",u,e]]),s=Fn(s,mh(e.parser.constructs.insideSpan.null,t.slice(o+a+4,r-3),e)),s=Fn(s,[["exit",u,e],t[r-2],t[r-1],["exit",c,e]]),s=Fn(s,t.slice(r+1)),s=Fn(s,[["exit",l,e]]),ao(t,o,t.length,s),t},tokenize:function(t,e,n){const o=this;let r,s,i=o.events.length;for(;i--;)if((o.events[i][1].type==="labelImage"||o.events[i][1].type==="labelLink")&&!o.events[i][1]._balanced){r=o.events[i][1];break}return function(h){return r?r._inactive?u(h):(s=o.parser.defined.includes(hs(o.sliceSerialize({start:r.end,end:o.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(h),t.exit("labelMarker"),t.exit("labelEnd"),a):n(h)};function a(h){return h===40?t.attempt(J9,c,s?c:u)(h):h===91?t.attempt(K9,c,s?l:u)(h):s?c(h):u(h)}function l(h){return t.attempt(X9,c,u)(h)}function c(h){return e(h)}function u(h){return r._balanced=!0,n(h)}}},J9={tokenize:function(t,e,n){return function(u){return t.enter("resource"),t.enter("resourceMarker"),t.consume(u),t.exit("resourceMarker"),o};function o(u){return pn(u)?Ai(t,r)(u):r(u)}function r(u){return u===41?c(u):Lw(t,s,i,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(u)}function s(u){return pn(u)?Ai(t,a)(u):c(u)}function i(u){return n(u)}function a(u){return u===34||u===39||u===40?zw(t,l,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(u):c(u)}function l(u){return pn(u)?Ai(t,c)(u):c(u)}function c(u){return u===41?(t.enter("resourceMarker"),t.consume(u),t.exit("resourceMarker"),t.exit("resource"),e):n(u)}}},K9={tokenize:function(t,e,n){const o=this;return function(i){return Fw.call(o,t,r,s,"reference","referenceMarker","referenceString")(i)};function r(i){return o.parser.defined.includes(hs(o.sliceSerialize(o.events[o.events.length-1][1]).slice(1,-1)))?e(i):n(i)}function s(i){return n(i)}}},X9={tokenize:function(t,e,n){return function(r){return t.enter("reference"),t.enter("referenceMarker"),t.consume(r),t.exit("referenceMarker"),o};function o(r){return r===93?(t.enter("referenceMarker"),t.consume(r),t.exit("referenceMarker"),t.exit("reference"),e):n(r)}}},Z9={name:"labelStartImage",resolveAll:_h.resolveAll,tokenize:function(t,e,n){const o=this;return function(i){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(i),t.exit("labelImageMarker"),r};function r(i){return i===91?(t.enter("labelMarker"),t.consume(i),t.exit("labelMarker"),t.exit("labelImage"),s):n(i)}function s(i){return i===94&&"_hiddenFootnoteSupport"in o.parser.constructs?n(i):e(i)}}},Q9={name:"labelStartLink",resolveAll:_h.resolveAll,tokenize:function(t,e,n){const o=this;return function(s){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(s),t.exit("labelMarker"),t.exit("labelLink"),r};function r(s){return s===94&&"_hiddenFootnoteSupport"in o.parser.constructs?n(s):e(s)}}},bh={name:"lineEnding",tokenize:function(t,e){return function(n){return t.enter("lineEnding"),t.consume(n),t.exit("lineEnding"),_t(t,e,"linePrefix")}}},El={name:"thematicBreak",tokenize:function(t,e,n){let o,r=0;return function(a){return t.enter("thematicBreak"),function(l){return o=l,s(l)}(a)};function s(a){return a===o?(t.enter("thematicBreakSequence"),i(a)):r>=3&&(a===null||Ye(a))?(t.exit("thematicBreak"),e(a)):n(a)}function i(a){return a===o?(t.consume(a),r++,i):(t.exit("thematicBreakSequence"),ut(a)?_t(t,s,"whitespace")(a):s(a))}}},gn={continuation:{tokenize:function(t,e,n){const o=this;return o.containerState._closeFlow=void 0,t.check(jl,r,s);function r(a){return o.containerState.furtherBlankLines=o.containerState.furtherBlankLines||o.containerState.initialBlankLine,_t(t,e,"listItemIndent",o.containerState.size+1)(a)}function s(a){return o.containerState.furtherBlankLines||!ut(a)?(o.containerState.furtherBlankLines=void 0,o.containerState.initialBlankLine=void 0,i(a)):(o.containerState.furtherBlankLines=void 0,o.containerState.initialBlankLine=void 0,t.attempt(tD,e,i)(a))}function i(a){return o.containerState._closeFlow=!0,o.interrupt=void 0,_t(t,t.attempt(gn,e,n),"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}},exit:function(t){t.exit(this.containerState.type)},name:"list",tokenize:function(t,e,n){const o=this,r=o.events[o.events.length-1];let s=r&&r[1].type==="linePrefix"?r[2].sliceSerialize(r[1],!0).length:0,i=0;return function(f){const m=o.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!o.containerState.marker||f===o.containerState.marker:fh(f)){if(o.containerState.type||(o.containerState.type=m,t.enter(m,{_container:!0})),m==="listUnordered")return t.enter("listItemPrefix"),f===42||f===45?t.check(El,n,l)(f):l(f);if(!o.interrupt||f===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),a(f)}return n(f)};function a(f){return fh(f)&&++i<10?(t.consume(f),a):(!o.interrupt||i<2)&&(o.containerState.marker?f===o.containerState.marker:f===41||f===46)?(t.exit("listItemValue"),l(f)):n(f)}function l(f){return t.enter("listItemMarker"),t.consume(f),t.exit("listItemMarker"),o.containerState.marker=o.containerState.marker||f,t.check(jl,o.interrupt?n:c,t.attempt(eD,h,u))}function c(f){return o.containerState.initialBlankLine=!0,s++,h(f)}function u(f){return ut(f)?(t.enter("listItemPrefixWhitespace"),t.consume(f),t.exit("listItemPrefixWhitespace"),h):n(f)}function h(f){return o.containerState.size=s+o.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(f)}}},eD={partial:!0,tokenize:function(t,e,n){const o=this;return _t(t,function(r){const s=o.events[o.events.length-1];return!ut(r)&&s&&s[1].type==="listItemPrefixWhitespace"?e(r):n(r)},"listItemPrefixWhitespace",o.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},tD={partial:!0,tokenize:function(t,e,n){const o=this;return _t(t,function(r){const s=o.events[o.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===o.containerState.size?e(r):n(r)},"listItemIndent",o.containerState.size+1)}},Uw={name:"setextUnderline",resolveTo:function(t,e){let n,o,r,s=t.length;for(;s--;)if(t[s][0]==="enter"){if(t[s][1].type==="content"){n=s;break}t[s][1].type==="paragraph"&&(o=s)}else t[s][1].type==="content"&&t.splice(s,1),r||t[s][1].type!=="definition"||(r=s);const i={type:"setextHeading",start:{...t[o][1].start},end:{...t[t.length-1][1].end}};return t[o][1].type="setextHeadingText",r?(t.splice(o,0,["enter",i,e]),t.splice(r+1,0,["exit",t[n][1],e]),t[n][1].end={...t[r][1].end}):t[n][1]=i,t.push(["exit",i,e]),t},tokenize:function(t,e,n){const o=this;let r;return function(a){let l,c=o.events.length;for(;c--;)if(o.events[c][1].type!=="lineEnding"&&o.events[c][1].type!=="linePrefix"&&o.events[c][1].type!=="content"){l=o.events[c][1].type==="paragraph";break}return!o.parser.lazy[o.now().line]&&(o.interrupt||l)?(t.enter("setextHeadingLine"),r=a,function(u){return t.enter("setextHeadingLineSequence"),s(u)}(a)):n(a)};function s(a){return a===r?(t.consume(a),s):(t.exit("setextHeadingLineSequence"),ut(a)?_t(t,i,"lineSuffix")(a):i(a))}function i(a){return a===null||Ye(a)?(t.exit("setextHeadingLine"),e(a)):n(a)}}},nD={tokenize:function(t){const e=this,n=t.attempt(jl,function(r){return r===null?void t.consume(r):(t.enter("lineEndingBlank"),t.consume(r),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n)},t.attempt(this.parser.constructs.flowInitial,o,_t(t,t.attempt(this.parser.constructs.flow,o,t.attempt(F9,o)),"linePrefix")));return n;function o(r){if(r!==null)return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),e.currentConstruct=void 0,n;t.consume(r)}}},oD={resolveAll:$w()},rD=Vw("string"),sD=Vw("text");function Vw(t){return{resolveAll:$w(t==="text"?iD:void 0),tokenize:function(e){const n=this,o=this.parser.constructs[t],r=e.attempt(o,s,i);return s;function s(c){return l(c)?r(c):i(c)}function i(c){if(c!==null)return e.enter("data"),e.consume(c),a;e.consume(c)}function a(c){return l(c)?(e.exit("data"),r(c)):(e.consume(c),a)}function l(c){if(c===null)return!0;const u=o[c];let h=-1;if(u)for(;++h<u.length;){const f=u[h];if(!f.previous||f.previous.call(n,n.previous))return!0}return!1}}}}function $w(t){return function(e,n){let o,r=-1;for(;++r<=e.length;)o===void 0?e[r]&&e[r][1].type==="data"&&(o=r,r++):e[r]&&e[r][1].type==="data"||(r!==o+2&&(e[o][1].end=e[r-1][1].end,e.splice(o+2,r-o-2),r=o+2),o=void 0);return t?t(e,n):e}}function iD(t,e){let n=0;for(;++n<=t.length;)if((n===t.length||t[n][1].type==="lineEnding")&&t[n-1][1].type==="data"){const o=t[n-1][1],r=e.sliceStream(o);let s,i=r.length,a=-1,l=0;for(;i--;){const c=r[i];if(typeof c=="string"){for(a=c.length;c.charCodeAt(a-1)===32;)l++,a--;if(a)break;a=-1}else if(c===-2)s=!0,l++;else if(c!==-1){i++;break}}if(l){const c={type:n===t.length||s||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?a:o.start._bufferIndex+a,_index:o.start._index+i,line:o.end.line,column:o.end.column-l,offset:o.end.offset-l},end:{...o.end}};o.end={...c.start},o.start.offset===o.end.offset?Object.assign(o,c):(t.splice(n,0,["enter",c,e],["exit",c,e]),n+=2)}n++}return t}const aD={42:gn,43:gn,45:gn,48:gn,49:gn,50:gn,51:gn,52:gn,53:gn,54:gn,55:gn,56:gn,57:gn,62:Tw},lD={91:B9},cD={[-2]:gh,[-1]:gh,32:gh},dD={35:$9,42:El,45:[Uw,El],60:W9,61:Uw,95:El,96:Rw,126:Rw},uD={38:Ow,92:Mw},hD={[-5]:bh,[-4]:bh,[-3]:bh,33:Z9,38:Ow,42:ph,60:[O9,Y9],91:Q9,92:[V9,Mw],93:_h,95:ph,96:R9},fD={null:[ph,oD]},mD=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:{null:[42,95]},contentInitial:lD,disable:{null:[]},document:aD,flow:dD,flowInitial:cD,insideSpan:fD,string:uD,text:hD},Symbol.toStringTag,{value:"Module"}));function pD(t,e,n){let o={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const r={},s=[];let i=[],a=[];const l={attempt:p(function(y,v){b(y,v.from)}),check:p(g),consume:function(y){Ye(y)?(o.line++,o.column=1,o.offset+=y===-3?2:1,x()):y!==-1&&(o.column++,o.offset++),o._bufferIndex<0?o._index++:(o._bufferIndex++,o._bufferIndex===i[o._index].length&&(o._bufferIndex=-1,o._index++)),c.previous=y},enter:function(y,v){const C=v||{};return C.type=y,C.start=f(),c.events.push(["enter",C,c]),a.push(C),C},exit:function(y){const v=a.pop();return v.end=f(),c.events.push(["exit",v,c]),v},interrupt:p(g,{interrupt:!0})},c={code:null,containerState:{},defineSkip:function(y){r[y.line]=y.column,x()},events:[],now:f,parser:t,previous:null,sliceSerialize:function(y,v){return function(C,k){let N=-1;const j=[];let I;for(;++N<C.length;){const T=C[N];let A;if(typeof T=="string")A=T;else switch(T){case-5:A="\r";break;case-4:A=`
|
126
|
-
`;break;case-3:A=`\r
|
127
|
-
`;break;case-2:A=k?" ":" ";break;case-1:if(!k&&I)continue;A=" ";break;default:A=String.fromCharCode(T)}I=T===-2,j.push(A)}return j.join("")}(h(y),v)},sliceStream:h,write:function(y){return i=Fn(i,y),m(),i[i.length-1]!==null?[]:(b(e,0),c.events=mh(s,c.events,c),c.events)}};let u=e.tokenize.call(c,l);return e.resolveAll&&s.push(e),c;function h(y){return function(v,C){const k=C.start._index,N=C.start._bufferIndex,j=C.end._index,I=C.end._bufferIndex;let T;if(k===j)T=[v[k].slice(N,I)];else{if(T=v.slice(k,j),N>-1){const A=T[0];typeof A=="string"?T[0]=A.slice(N):T.shift()}I>0&&T.push(v[j].slice(0,I))}return T}(i,y)}function f(){const{_bufferIndex:y,_index:v,line:C,column:k,offset:N}=o;return{_bufferIndex:y,_index:v,line:C,column:k,offset:N}}function m(){let y;for(;o._index<i.length;){const v=i[o._index];if(typeof v=="string")for(y=o._index,o._bufferIndex<0&&(o._bufferIndex=0);o._index===y&&o._bufferIndex<v.length;)_(v.charCodeAt(o._bufferIndex));else _(v)}}function _(y){u=u(y)}function g(y,v){v.restore()}function p(y,v){return function(C,k,N){let j,I,T,A;return Array.isArray(C)?R(C):"tokenize"in C?R([C]):function(B){return U;function U(O){const S=O!==null&&B[O],$=O!==null&&B.null;return R([...Array.isArray(S)?S:S?[S]:[],...Array.isArray($)?$:$?[$]:[]])(O)}}(C);function R(B){return j=B,I=0,B.length===0?N:z(B[I])}function z(B){return function(U){return A=function(){const O=f(),S=c.previous,$=c.currentConstruct,E=c.events.length,W=Array.from(a);return{from:E,restore:G};function G(){o=O,c.previous=S,c.currentConstruct=$,c.events.length=E,a=W,x()}}(),T=B,B.partial||(c.currentConstruct=B),B.name&&c.parser.constructs.disable.null.includes(B.name)?F():B.tokenize.call(v?Object.assign(Object.create(c),v):c,l,D,F)(U)}}function D(B){return y(T,A),k}function F(B){return A.restore(),++I<j.length?z(j[I]):N}}}function b(y,v){y.resolveAll&&!s.includes(y)&&s.push(y),y.resolve&&ao(c.events,v,c.events.length-v,y.resolve(c.events.slice(v),c)),y.resolveTo&&(c.events=y.resolveTo(c.events,c))}function x(){o.line in r&&o.column<2&&(o.column=r[o.line],o.offset+=r[o.line]-1)}}function gD(t){const e=function(r){const s={};let i=-1;for(;++i<r.length;)S9(s,r[i]);return s}([mD,...(t||{}).extensions||[]]),n={constructs:e,content:o(T9),defined:[],document:o(M9),flow:o(nD),lazy:{},string:o(rD),text:o(sD)};return n;function o(r){return function(s){return pD(n,r,s)}}}const Hw=/[\0\t\n\r]/g,_D=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function bD(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const o=n.charCodeAt(1),r=o===120||o===88;return jw(n.slice(r?2:1),r?16:10)}return uh(n)||t}const Ww={}.hasOwnProperty;function xD(t,e,n){return typeof e!="string"&&(n=e,e=void 0),function(o){const r={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(ze),autolinkProtocol:R,autolinkEmail:R,atxHeading:l(ie),blockQuote:l(ce),characterEscape:R,characterReference:R,codeFenced:l(fe),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:l(fe,c),codeText:l(de,c),codeTextData:R,data:R,codeFlowValue:R,definition:l(ke),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:l(Se),hardBreakEscape:l(je),hardBreakTrailing:l(je),htmlFlow:l(pe,c),htmlFlowData:R,htmlText:l(pe,c),htmlTextData:R,image:l(Ae),label:c,link:l(ze),listItem:l(Ve),listItemValue:g,listOrdered:l(De,_),listUnordered:l(De),paragraph:l(Pe),reference:te,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:l(ie),strong:l(rt),thematicBreak:l(tt)},exit:{atxHeading:h(),atxHeadingSequence:j,autolink:h(),autolinkEmail:me,autolinkProtocol:ue,blockQuote:h(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:se,characterReferenceMarkerNumeric:se,characterReferenceValue:Z,characterReference:Q,codeFenced:h(y),codeFencedFence:x,codeFencedFenceInfo:p,codeFencedFenceMeta:b,codeFlowValue:z,codeIndented:h(v),codeText:h(O),codeTextData:z,data:z,definition:h(),definitionDestinationString:N,definitionLabelString:C,definitionTitleString:k,emphasis:h(),hardBreakEscape:h(F),hardBreakTrailing:h(F),htmlFlow:h(B),htmlFlowData:z,htmlText:h(U),htmlTextData:z,image:h($),label:W,labelText:E,lineEnding:D,link:h(S),listItem:h(),listOrdered:h(),listUnordered:h(),paragraph:h(),referenceString:oe,resourceDestinationString:G,resourceTitleString:q,resource:Y,setextHeading:h(A),setextHeadingLineSequence:T,setextHeadingText:I,strong:h(),thematicBreak:h()}};qw(r,(o||{}).mdastExtensions||[]);const s={};return i;function i(ne){let ve={type:"root",children:[]};const Ce={stack:[ve],tokenStack:[],config:r,enter:u,exit:f,buffer:c,resume:m,data:s},Re=[];let J=-1;for(;++J<ne.length;)(ne[J][1].type==="listOrdered"||ne[J][1].type==="listUnordered")&&(ne[J][0]==="enter"?Re.push(J):J=a(ne,Re.pop(),J));for(J=-1;++J<ne.length;){const _e=r[ne[J][0]];Ww.call(_e,ne[J][1].type)&&_e[ne[J][1].type].call(Object.assign({sliceSerialize:ne[J][2].sliceSerialize},Ce),ne[J][1])}if(Ce.tokenStack.length>0){const _e=Ce.tokenStack[Ce.tokenStack.length-1];(_e[1]||Gw).call(Ce,void 0,_e[0])}for(ve.position={start:Xo(ne.length>0?ne[0][1].start:{line:1,column:1,offset:0}),end:Xo(ne.length>0?ne[ne.length-2][1].end:{line:1,column:1,offset:0})},J=-1;++J<r.transforms.length;)ve=r.transforms[J](ve)||ve;return ve}function a(ne,ve,Ce){let Re,J,_e,be,ge=ve-1,le=-1,We=!1;for(;++ge<=Ce;){const Fe=ne[ge];switch(Fe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":Fe[0]==="enter"?le++:le--,be=void 0;break;case"lineEndingBlank":Fe[0]==="enter"&&(!Re||be||le||_e||(_e=ge),be=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:be=void 0}if(!le&&Fe[0]==="enter"&&Fe[1].type==="listItemPrefix"||le===-1&&Fe[0]==="exit"&&(Fe[1].type==="listUnordered"||Fe[1].type==="listOrdered")){if(Re){let Xe=ge;for(J=void 0;Xe--;){const ae=ne[Xe];if(ae[1].type==="lineEnding"||ae[1].type==="lineEndingBlank"){if(ae[0]==="exit")continue;J&&(ne[J][1].type="lineEndingBlank",We=!0),ae[1].type="lineEnding",J=Xe}else if(ae[1].type!=="linePrefix"&&ae[1].type!=="blockQuotePrefix"&&ae[1].type!=="blockQuotePrefixWhitespace"&&ae[1].type!=="blockQuoteMarker"&&ae[1].type!=="listItemIndent")break}_e&&(!J||_e<J)&&(Re._spread=!0),Re.end=Object.assign({},J?ne[J][1].start:Fe[1].end),ne.splice(J||ge,0,["exit",Re,Fe[2]]),ge++,Ce++}if(Fe[1].type==="listItemPrefix"){const Xe={type:"listItem",_spread:!1,start:Object.assign({},Fe[1].start),end:void 0};Re=Xe,ne.splice(ge,0,["enter",Xe,Fe[2]]),ge++,Ce++,_e=void 0,be=!0}}}return ne[ve][1]._spread=We,Ce}function l(ne,ve){return Ce;function Ce(Re){u.call(this,ne(Re),Re),ve&&ve.call(this,Re)}}function c(){this.stack.push({type:"fragment",children:[]})}function u(ne,ve,Ce){this.stack[this.stack.length-1].children.push(ne),this.stack.push(ne),this.tokenStack.push([ve,Ce||void 0]),ne.position={start:Xo(ve.start),end:void 0}}function h(ne){return ve;function ve(Ce){ne&&ne.call(this,Ce),f.call(this,Ce)}}function f(ne,ve){const Ce=this.stack.pop(),Re=this.tokenStack.pop();if(!Re)throw new Error("Cannot close `"+ne.type+"` ("+ji({start:ne.start,end:ne.end})+"): it\u2019s not open");Re[0].type!==ne.type&&(ve?ve.call(this,ne,Re[0]):(Re[1]||Gw).call(this,ne,Re[0])),Ce.position.end=Xo(ne.end)}function m(){return function(ne){return kw(ne,typeof Nl.includeImageAlt!="boolean"||Nl.includeImageAlt,typeof Nl.includeHtml!="boolean"||Nl.includeHtml)}(this.stack.pop())}function _(){this.data.expectingFirstListItemValue=!0}function g(ne){this.data.expectingFirstListItemValue&&(this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(ne),10),this.data.expectingFirstListItemValue=void 0)}function p(){const ne=this.resume();this.stack[this.stack.length-1].lang=ne}function b(){const ne=this.resume();this.stack[this.stack.length-1].meta=ne}function x(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function y(){const ne=this.resume();this.stack[this.stack.length-1].value=ne.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){const ne=this.resume();this.stack[this.stack.length-1].value=ne.replace(/(\r?\n|\r)$/g,"")}function C(ne){const ve=this.resume(),Ce=this.stack[this.stack.length-1];Ce.label=ve,Ce.identifier=hs(this.sliceSerialize(ne)).toLowerCase()}function k(){const ne=this.resume();this.stack[this.stack.length-1].title=ne}function N(){const ne=this.resume();this.stack[this.stack.length-1].url=ne}function j(ne){const ve=this.stack[this.stack.length-1];if(!ve.depth){const Ce=this.sliceSerialize(ne).length;ve.depth=Ce}}function I(){this.data.setextHeadingSlurpLineEnding=!0}function T(ne){this.stack[this.stack.length-1].depth=this.sliceSerialize(ne).codePointAt(0)===61?1:2}function A(){this.data.setextHeadingSlurpLineEnding=void 0}function R(ne){const ve=this.stack[this.stack.length-1].children;let Ce=ve[ve.length-1];Ce&&Ce.type==="text"||(Ce=Qe(),Ce.position={start:Xo(ne.start),end:void 0},ve.push(Ce)),this.stack.push(Ce)}function z(ne){const ve=this.stack.pop();ve.value+=this.sliceSerialize(ne),ve.position.end=Xo(ne.end)}function D(ne){const ve=this.stack[this.stack.length-1];if(this.data.atHardBreak)return ve.children[ve.children.length-1].position.end=Xo(ne.end),void(this.data.atHardBreak=void 0);!this.data.setextHeadingSlurpLineEnding&&r.canContainEols.includes(ve.type)&&(R.call(this,ne),z.call(this,ne))}function F(){this.data.atHardBreak=!0}function B(){const ne=this.resume();this.stack[this.stack.length-1].value=ne}function U(){const ne=this.resume();this.stack[this.stack.length-1].value=ne}function O(){const ne=this.resume();this.stack[this.stack.length-1].value=ne}function S(){const ne=this.stack[this.stack.length-1];if(this.data.inReference){const ve=this.data.referenceType||"shortcut";ne.type+="Reference",ne.referenceType=ve,delete ne.url,delete ne.title}else delete ne.identifier,delete ne.label;this.data.referenceType=void 0}function $(){const ne=this.stack[this.stack.length-1];if(this.data.inReference){const ve=this.data.referenceType||"shortcut";ne.type+="Reference",ne.referenceType=ve,delete ne.url,delete ne.title}else delete ne.identifier,delete ne.label;this.data.referenceType=void 0}function E(ne){const ve=this.sliceSerialize(ne),Ce=this.stack[this.stack.length-2];Ce.label=function(Re){return Re.replace(_D,bD)}(ve),Ce.identifier=hs(ve).toLowerCase()}function W(){const ne=this.stack[this.stack.length-1],ve=this.resume(),Ce=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ce.type==="link"){const Re=ne.children;Ce.children=Re}else Ce.alt=ve}function G(){const ne=this.resume();this.stack[this.stack.length-1].url=ne}function q(){const ne=this.resume();this.stack[this.stack.length-1].title=ne}function Y(){this.data.inReference=void 0}function te(){this.data.referenceType="collapsed"}function oe(ne){const ve=this.resume(),Ce=this.stack[this.stack.length-1];Ce.label=ve,Ce.identifier=hs(this.sliceSerialize(ne)).toLowerCase(),this.data.referenceType="full"}function se(ne){this.data.characterReferenceType=ne.type}function Z(ne){const ve=this.sliceSerialize(ne),Ce=this.data.characterReferenceType;let Re;Ce?(Re=jw(ve,Ce==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Re=uh(ve),this.stack[this.stack.length-1].value+=Re}function Q(ne){this.stack.pop().position.end=Xo(ne.end)}function ue(ne){z.call(this,ne),this.stack[this.stack.length-1].url=this.sliceSerialize(ne)}function me(ne){z.call(this,ne),this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(ne)}function ce(){return{type:"blockquote",children:[]}}function fe(){return{type:"code",lang:null,meta:null,value:""}}function de(){return{type:"inlineCode",value:""}}function ke(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Se(){return{type:"emphasis",children:[]}}function ie(){return{type:"heading",depth:0,children:[]}}function je(){return{type:"break"}}function pe(){return{type:"html",value:""}}function Ae(){return{type:"image",title:null,url:"",alt:null}}function ze(){return{type:"link",title:null,url:"",children:[]}}function De(ne){return{type:"list",ordered:ne.type==="listOrdered",start:null,spread:ne._spread,children:[]}}function Ve(ne){return{type:"listItem",spread:ne._spread,checked:null,children:[]}}function Pe(){return{type:"paragraph",children:[]}}function rt(){return{type:"strong",children:[]}}function Qe(){return{type:"text",value:""}}function tt(){return{type:"thematicBreak"}}}(n)(function(o){for(;!Pw(o););return o}(gD(n).document().write(function(){let o,r=1,s="",i=!0;return function(a,l,c){const u=[];let h,f,m,_,g;for(a=s+(typeof a=="string"?a.toString():new TextDecoder(l||void 0).decode(a)),m=0,s="",i&&(a.charCodeAt(0)===65279&&m++,i=void 0);m<a.length;){if(Hw.lastIndex=m,h=Hw.exec(a),_=h&&h.index!==void 0?h.index:a.length,g=a.charCodeAt(_),!h){s=a.slice(m);break}if(g===10&&m===_&&o)u.push(-3),o=void 0;else switch(o&&(u.push(-5),o=void 0),m<_&&(u.push(a.slice(m,_)),r+=_-m),g){case 0:u.push(65533),r++;break;case 9:for(f=4*Math.ceil(r/4),u.push(-2);r++<f;)u.push(-1);break;case 10:u.push(-4),r=1;break;default:o=!0,r=1}m=_+1}return c&&(o&&u.push(-5),s&&u.push(s),u.push(null)),u}}()(t,e,!0))))}function Xo(t){return{line:t.line,column:t.column,offset:t.offset}}function qw(t,e){let n=-1;for(;++n<e.length;){const o=e[n];Array.isArray(o)?qw(t,o):yD(t,o)}}function yD(t,e){let n;for(n in e)if(Ww.call(e,n))switch(n){case"canContainEols":{const o=e[n];o&&t[n].push(...o);break}case"transforms":{const o=e[n];o&&t[n].push(...o);break}case"enter":case"exit":{const o=e[n];o&&Object.assign(t[n],o);break}}}function Gw(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+ji({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+ji({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+ji({start:e.start,end:e.end})+") is still open")}function wD(t){const e=this;e.parser=function(n){return xD(n,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function Yw(t,e){const n=e.referenceType;let o="]";if(n==="collapsed"?o+="[]":n==="full"&&(o+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+o}];const r=t.all(e),s=r[0];s&&s.type==="text"?s.value="["+s.value:r.unshift({type:"text",value:"["});const i=r[r.length-1];return i&&i.type==="text"?i.value+=o:r.push({type:"text",value:o}),r}function Jw(t){const e=t.spread;return e??t.children.length>1}function vD(t){const e=String(t),n=/\r?\n|\r/g;let o=n.exec(e),r=0;const s=[];for(;o;)s.push(Kw(e.slice(r,o.index),r>0,!0),o[0]),r=o.index+o[0].length,o=n.exec(e);return s.push(Kw(e.slice(r),r>0,!1)),s.join("")}function Kw(t,e,n){let o=0,r=t.length;if(e){let s=t.codePointAt(o);for(;s===9||s===32;)o++,s=t.codePointAt(o)}if(n){let s=t.codePointAt(r-1);for(;s===9||s===32;)r--,s=t.codePointAt(r-1)}return r>o?t.slice(o,r):""}const kD={blockquote:function(t,e){const n={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,n),t.applyData(e,n)},break:function(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
|
128
|
-
`}]},code:function(t,e){const n=e.value?e.value+`
|
129
|
-
`:"",o={};e.lang&&(o.className=["language-"+e.lang]);let r={type:"element",tagName:"code",properties:o,children:[{type:"text",value:n}]};return e.meta&&(r.data={meta:e.meta}),t.patch(e,r),r=t.applyData(e,r),r={type:"element",tagName:"pre",properties:{},children:[r]},t.patch(e,r),r},delete:function(t,e){const n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)},emphasis:function(t,e){const n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)},footnoteReference:function(t,e){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",o=String(e.identifier).toUpperCase(),r=fs(o.toLowerCase()),s=t.footnoteOrder.indexOf(o);let i,a=t.footnoteCounts.get(o);a===void 0?(a=0,t.footnoteOrder.push(o),i=t.footnoteOrder.length):i=s+1,a+=1,t.footnoteCounts.set(o,a);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+r,id:n+"fnref-"+r+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(i)}]};t.patch(e,l);const c={type:"element",tagName:"sup",properties:{},children:[l]};return t.patch(e,c),t.applyData(e,c)},heading:function(t,e){const n={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)},html:function(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}},imageReference:function(t,e){const n=String(e.identifier).toUpperCase(),o=t.definitionById.get(n);if(!o)return Yw(t,e);const r={src:fs(o.url||""),alt:e.alt};o.title!==null&&o.title!==void 0&&(r.title=o.title);const s={type:"element",tagName:"img",properties:r,children:[]};return t.patch(e,s),t.applyData(e,s)},image:function(t,e){const n={src:fs(e.url)};e.alt!==null&&e.alt!==void 0&&(n.alt=e.alt),e.title!==null&&e.title!==void 0&&(n.title=e.title);const o={type:"element",tagName:"img",properties:n,children:[]};return t.patch(e,o),t.applyData(e,o)},inlineCode:function(t,e){const n={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,n);const o={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(e,o),t.applyData(e,o)},linkReference:function(t,e){const n=String(e.identifier).toUpperCase(),o=t.definitionById.get(n);if(!o)return Yw(t,e);const r={href:fs(o.url||"")};o.title!==null&&o.title!==void 0&&(r.title=o.title);const s={type:"element",tagName:"a",properties:r,children:t.all(e)};return t.patch(e,s),t.applyData(e,s)},link:function(t,e){const n={href:fs(e.url)};e.title!==null&&e.title!==void 0&&(n.title=e.title);const o={type:"element",tagName:"a",properties:n,children:t.all(e)};return t.patch(e,o),t.applyData(e,o)},listItem:function(t,e,n){const o=t.all(e),r=n?function(u){let h=!1;if(u.type==="list"){h=u.spread||!1;const f=u.children;let m=-1;for(;!h&&++m<f.length;)h=Jw(f[m])}return h}(n):Jw(e),s={},i=[];if(typeof e.checked=="boolean"){const u=o[0];let h;u&&u.type==="element"&&u.tagName==="p"?h=u:(h={type:"element",tagName:"p",properties:{},children:[]},o.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let a=-1;for(;++a<o.length;){const u=o[a];(r||a!==0||u.type!=="element"||u.tagName!=="p")&&i.push({type:"text",value:`
|
130
|
-
`}),u.type!=="element"||u.tagName!=="p"||r?i.push(u):i.push(...u.children)}const l=o[o.length-1];l&&(r||l.type!=="element"||l.tagName!=="p")&&i.push({type:"text",value:`
|
131
|
-
`});const c={type:"element",tagName:"li",properties:s,children:i};return t.patch(e,c),t.applyData(e,c)},list:function(t,e){const n={},o=t.all(e);let r=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++r<o.length;){const i=o[r];if(i.type==="element"&&i.tagName==="li"&&i.properties&&Array.isArray(i.properties.className)&&i.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const s={type:"element",tagName:e.ordered?"ol":"ul",properties:n,children:t.wrap(o,!0)};return t.patch(e,s),t.applyData(e,s)},paragraph:function(t,e){const n={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)},root:function(t,e){const n={type:"root",children:t.wrap(t.all(e))};return t.patch(e,n),t.applyData(e,n)},strong:function(t,e){const n={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)},table:function(t,e){const n=t.all(e),o=n.shift(),r=[];if(o){const i={type:"element",tagName:"thead",properties:{},children:t.wrap([o],!0)};t.patch(e.children[0],i),r.push(i)}if(n.length>0){const i={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},a=sh(e.children[1]),l=pw(e.children[e.children.length-1]);a&&l&&(i.position={start:a,end:l}),r.push(i)}const s={type:"element",tagName:"table",properties:{},children:t.wrap(r,!0)};return t.patch(e,s),t.applyData(e,s)},tableCell:function(t,e){const n={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)},tableRow:function(t,e,n){const o=n?n.children:void 0,r=(o?o.indexOf(e):1)===0?"th":"td",s=n&&n.type==="table"?n.align:void 0,i=s?s.length:e.children.length;let a=-1;const l=[];for(;++a<i;){const u=e.children[a],h={},f=s?s[a]:void 0;f&&(h.align=f);let m={type:"element",tagName:r,properties:h,children:[]};u&&(m.children=t.all(u),t.patch(u,m),m=t.applyData(u,m)),l.push(m)}const c={type:"element",tagName:"tr",properties:{},children:t.wrap(l,!0)};return t.patch(e,c),t.applyData(e,c)},text:function(t,e){const n={type:"text",value:vD(String(e.value))};return t.patch(e,n),t.applyData(e,n)},thematicBreak:function(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)},toml:Il,yaml:Il,definition:Il,footnoteDefinition:Il};function Il(){}const Xw=typeof self=="object"?self:globalThis,Zw=t=>((e,n)=>{const o=(s,i)=>(e.set(i,s),s),r=s=>{if(e.has(s))return e.get(s);const[i,a]=n[s];switch(i){case 0:case-1:return o(a,s);case 1:{const l=o([],s);for(const c of a)l.push(r(c));return l}case 2:{const l=o({},s);for(const[c,u]of a)l[r(c)]=r(u);return l}case 3:return o(new Date(a),s);case 4:{const{source:l,flags:c}=a;return o(new RegExp(l,c),s)}case 5:{const l=o(new Map,s);for(const[c,u]of a)l.set(r(c),r(u));return l}case 6:{const l=o(new Set,s);for(const c of a)l.add(r(c));return l}case 7:{const{name:l,message:c}=a;return o(new Xw[l](c),s)}case 8:return o(BigInt(a),s);case"BigInt":return o(Object(BigInt(a)),s)}return o(new Xw[i](a),s)};return r})(new Map,t)(0),ms="",{toString:SD}={},{keys:CD}=Object,Ti=t=>{const e=typeof t;if(e!=="object"||!t)return[0,e];const n=SD.call(t).slice(8,-1);switch(n){case"Array":return[1,ms];case"Object":return[2,ms];case"Date":return[3,ms];case"RegExp":return[4,ms];case"Map":return[5,ms];case"Set":return[6,ms]}return n.includes("Array")?[1,n]:n.includes("Error")?[7,n]:[2,n]},Al=([t,e])=>t===0&&(e==="function"||e==="symbol"),Qw=(t,{json:e,lossy:n}={})=>{const o=[];return((r,s,i,a)=>{const l=(u,h)=>{const f=a.push(u)-1;return i.set(h,f),f},c=u=>{if(i.has(u))return i.get(u);let[h,f]=Ti(u);switch(h){case 0:{let _=u;switch(f){case"bigint":h=8,_=u.toString();break;case"function":case"symbol":if(r)throw new TypeError("unable to serialize "+f);_=null;break;case"undefined":return l([-1],u)}return l([h,_],u)}case 1:{if(f)return l([f,[...u]],u);const _=[],g=l([h,_],u);for(const p of u)_.push(c(p));return g}case 2:{if(f)switch(f){case"BigInt":return l([f,u.toString()],u);case"Boolean":case"Number":case"String":return l([f,u.valueOf()],u)}if(s&&"toJSON"in u)return c(u.toJSON());const _=[],g=l([h,_],u);for(const p of CD(u))!r&&Al(Ti(u[p]))||_.push([c(p),c(u[p])]);return g}case 3:return l([h,u.toISOString()],u);case 4:{const{source:_,flags:g}=u;return l([h,{source:_,flags:g}],u)}case 5:{const _=[],g=l([h,_],u);for(const[p,b]of u)(r||!Al(Ti(p))&&!Al(Ti(b)))&&_.push([c(p),c(b)]);return g}case 6:{const _=[],g=l([h,_],u);for(const p of u)!r&&Al(Ti(p))||_.push(c(p));return g}}const{message:m}=u;return l([h,{name:f,message:m}],u)};return c})(!(e||n),!!e,new Map,o)(t),o},Tl=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?Zw(Qw(t,e)):structuredClone(t):(t,e)=>Zw(Qw(t,e));function ND(t,e){const n=[{type:"text",value:"\u21A9"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function jD(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}const ev=function(t){if(t==null)return ED;if(typeof t=="function")return Ml(t);if(typeof t=="object")return Array.isArray(t)?function(e){const n=[];let o=-1;for(;++o<e.length;)n[o]=ev(e[o]);return Ml(r);function r(...s){let i=-1;for(;++i<n.length;)if(n[i].apply(this,s))return!0;return!1}}(t):function(e){const n=e;return Ml(o);function o(r){const s=r;let i;for(i in e)if(s[i]!==n[i])return!1;return!0}}(t);if(typeof t=="string")return function(e){return Ml(n);function n(o){return o&&o.type===e}}(t);throw new Error("Expected function, string, or object as test")};function Ml(t){return function(e,n,o){return!!(function(r){return r!==null&&typeof r=="object"&&"type"in r}(e)&&t.call(this,e,typeof n=="number"?n:void 0,o||void 0))}}function ED(){return!0}const tv=[],ID=!0,nv=!1;function AD(t,e,n,o){let r;typeof e=="function"&&typeof n!="function"?(o=n,n=e):r=e;const s=ev(r),i=o?-1:1;(function a(l,c,u){const h=l&&typeof l=="object"?l:{};if(typeof h.type=="string"){const m=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(f,"name",{value:"node ("+l.type+(m?"<"+m+">":"")+")"})}return f;function f(){let m,_,g,p=tv;if((!e||s(l,c,u[u.length-1]||void 0))&&(p=function(b){return Array.isArray(b)?b:typeof b=="number"?[ID,b]:b==null?tv:[b]}(n(l,u)),p[0]===nv))return p;if("children"in l&&l.children){const b=l;if(b.children&&p[0]!=="skip")for(_=(o?b.children.length:-1)+i,g=u.concat(b);_>-1&&_<b.children.length;){const x=b.children[_];if(m=a(x,_,g)(),m[0]===nv)return m;_=typeof m[1]=="number"?m[1]:_+i}}return p}})(t,void 0,[])()}function ov(t,e,n,o){let r,s,i;typeof e=="function"?(s=void 0,i=e,r=n):(s=e,i=n,r=o),AD(t,s,function(a,l){const c=l[l.length-1],u=c?c.children.indexOf(a):void 0;return i(a,u,c)},r)}const xh={}.hasOwnProperty,TD={};function MD(t,e){t.position&&(e.position=function(n){const o=sh(n),r=pw(n);if(o&&r)return{start:o,end:r}}(t))}function OD(t,e){let n=e;if(t&&t.data){const o=t.data.hName,r=t.data.hChildren,s=t.data.hProperties;typeof o=="string"&&(n.type==="element"?n.tagName=o:n={type:"element",tagName:o,properties:{},children:"children"in n?n.children:[n]}),n.type==="element"&&s&&Object.assign(n.properties,Tl(s)),"children"in n&&n.children&&r!=null&&(n.children=r)}return n}function DD(t,e){const n=e.data||{},o=!("value"in e)||xh.call(n,"hProperties")||xh.call(n,"hChildren")?{type:"element",tagName:"div",properties:{},children:t.all(e)}:{type:"text",value:e.value};return t.patch(e,o),t.applyData(e,o)}function RD(t,e){const n=[];let o=-1;for(e&&n.push({type:"text",value:`
|
132
|
-
`});++o<t.length;)o&&n.push({type:"text",value:`
|
133
|
-
`}),n.push(t[o]);return e&&t.length>0&&n.push({type:"text",value:`
|
134
|
-
`}),n}function rv(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function sv(t,e){const n=function(i,a){const l=a||TD,c=new Map,u=new Map,h=new Map,f={...kD,...l.handlers},m={all:function(_){const g=[];if("children"in _){const p=_.children;let b=-1;for(;++b<p.length;){const x=m.one(p[b],_);if(x){if(b&&p[b-1].type==="break"&&(Array.isArray(x)||x.type!=="text"||(x.value=rv(x.value)),!Array.isArray(x)&&x.type==="element")){const y=x.children[0];y&&y.type==="text"&&(y.value=rv(y.value))}Array.isArray(x)?g.push(...x):g.push(x)}}}return g},applyData:OD,definitionById:c,footnoteById:u,footnoteCounts:h,footnoteOrder:[],handlers:f,one:function(_,g){const p=_.type,b=m.handlers[p];if(xh.call(m.handlers,p)&&b)return b(m,_,g);if(m.options.passThrough&&m.options.passThrough.includes(p)){if("children"in _){const{children:x,...y}=_,v=Tl(y);return v.children=m.all(_),v}return Tl(_)}return(m.options.unknownHandler||DD)(m,_,g)},options:l,patch:MD,wrap:RD};return ov(i,function(_){if(_.type==="definition"||_.type==="footnoteDefinition"){const g=_.type==="definition"?c:u,p=String(_.identifier).toUpperCase();g.has(p)||g.set(p,_)}}),m}(t,e),o=n.one(t,void 0),r=function(i){const a=typeof i.options.clobberPrefix=="string"?i.options.clobberPrefix:"user-content-",l=i.options.footnoteBackContent||ND,c=i.options.footnoteBackLabel||jD,u=i.options.footnoteLabel||"Footnotes",h=i.options.footnoteLabelTagName||"h2",f=i.options.footnoteLabelProperties||{className:["sr-only"]},m=[];let _=-1;for(;++_<i.footnoteOrder.length;){const g=i.footnoteById.get(i.footnoteOrder[_]);if(!g)continue;const p=i.all(g),b=String(g.identifier).toUpperCase(),x=fs(b.toLowerCase());let y=0;const v=[],C=i.footnoteCounts.get(b);for(;C!==void 0&&++y<=C;){v.length>0&&v.push({type:"text",value:" "});let j=typeof l=="string"?l:l(_,y);typeof j=="string"&&(j={type:"text",value:j}),v.push({type:"element",tagName:"a",properties:{href:"#"+a+"fnref-"+x+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof c=="string"?c:c(_,y),className:["data-footnote-backref"]},children:Array.isArray(j)?j:[j]})}const k=p[p.length-1];if(k&&k.type==="element"&&k.tagName==="p"){const j=k.children[k.children.length-1];j&&j.type==="text"?j.value+=" ":k.children.push({type:"text",value:" "}),k.children.push(...v)}else p.push(...v);const N={type:"element",tagName:"li",properties:{id:a+"fn-"+x},children:i.wrap(p,!0)};i.patch(g,N),m.push(N)}if(m.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:h,properties:{...Tl(f),id:"footnote-label"},children:[{type:"text",value:u}]},{type:"text",value:`
|
135
|
-
`},{type:"element",tagName:"ol",properties:{},children:i.wrap(m,!0)},{type:"text",value:`
|
136
|
-
`}]}}(n),s=Array.isArray(o)?{type:"root",children:o}:o||{type:"root",children:[]};return r&&s.children.push({type:"text",value:`
|
137
|
-
`},r),s}function PD(t,e){return t&&"run"in t?async function(n,o){const r=sv(n,{file:o,...e});await t.run(r,o)}:function(n,o){return sv(n,{file:o,...t||e})}}function iv(t){if(t)throw t}var yh,av,LD=function(){if(av)return yh;av=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,o=Object.getOwnPropertyDescriptor,r=function(l){return typeof Array.isArray=="function"?Array.isArray(l):e.call(l)==="[object Array]"},s=function(l){if(!l||e.call(l)!=="[object Object]")return!1;var c,u=t.call(l,"constructor"),h=l.constructor&&l.constructor.prototype&&t.call(l.constructor.prototype,"isPrototypeOf");if(l.constructor&&!u&&!h)return!1;for(c in l);return c===void 0||t.call(l,c)},i=function(l,c){n&&c.name==="__proto__"?n(l,c.name,{enumerable:!0,configurable:!0,value:c.newValue,writable:!0}):l[c.name]=c.newValue},a=function(l,c){if(c==="__proto__"){if(!t.call(l,c))return;if(o)return o(l,c).value}return l[c]};return yh=function l(){var c,u,h,f,m,_,g=arguments[0],p=1,b=arguments.length,x=!1;for(typeof g=="boolean"&&(x=g,g=arguments[1]||{},p=2),(g==null||typeof g!="object"&&typeof g!="function")&&(g={});p<b;++p)if((c=arguments[p])!=null)for(u in c)h=a(g,u),g!==(f=a(c,u))&&(x&&f&&(s(f)||(m=r(f)))?(m?(m=!1,_=h&&r(h)?h:[]):_=h&&s(h)?h:{},i(g,{name:u,newValue:l(x,_,f)})):f!==void 0&&i(g,{name:u,newValue:f}));return g},yh}();const wh=eS(LD);function vh(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return!(e!==null&&e!==Object.prototype&&Object.getPrototypeOf(e)!==null||Symbol.toStringTag in t||Symbol.iterator in t)}function FD(){const t=[],e={run:function(...n){let o=-1;const r=n.pop();if(typeof r!="function")throw new TypeError("Expected function as last argument, not "+r);(function s(i,...a){const l=t[++o];let c=-1;if(i)r(i);else{for(;++c<n.length;)a[c]!==null&&a[c]!==void 0||(a[c]=n[c]);n=a,l?function(u,h){let f;return m;function m(...p){const b=u.length>p.length;let x;b&&p.push(_);try{x=u.apply(this,p)}catch(y){if(b&&f)throw y;return _(y)}b||(x&&x.then&&typeof x.then=="function"?x.then(g,_):x instanceof Error?_(x):g(x))}function _(p,...b){f||(f=!0,h(p,...b))}function g(p){_(null,p)}}(l,s)(...a):r(null,...a)}})(null,...n)},use:function(n){if(typeof n!="function")throw new TypeError("Expected `middelware` to be a function, not "+n);return t.push(n),e}};return e}const co={basename:function(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Mi(t);let n,o=0,r=-1,s=t.length;if(e===void 0||e.length===0||e.length>t.length){for(;s--;)if(t.codePointAt(s)===47){if(n){o=s+1;break}}else r<0&&(n=!0,r=s+1);return r<0?"":t.slice(o,r)}if(e===t)return"";let i=-1,a=e.length-1;for(;s--;)if(t.codePointAt(s)===47){if(n){o=s+1;break}}else i<0&&(n=!0,i=s+1),a>-1&&(t.codePointAt(s)===e.codePointAt(a--)?a<0&&(r=s):(a=-1,r=i));return o===r?r=i:r<0&&(r=t.length),t.slice(o,r)},dirname:function(t){if(Mi(t),t.length===0)return".";let e,n=-1,o=t.length;for(;--o;)if(t.codePointAt(o)===47){if(e){n=o;break}}else e||(e=!0);return n<0?t.codePointAt(0)===47?"/":".":n===1&&t.codePointAt(0)===47?"//":t.slice(0,n)},extname:function(t){Mi(t);let e,n=t.length,o=-1,r=0,s=-1,i=0;for(;n--;){const a=t.codePointAt(n);if(a!==47)o<0&&(e=!0,o=n+1),a===46?s<0?s=n:i!==1&&(i=1):s>-1&&(i=-1);else if(e){r=n+1;break}}return s<0||o<0||i===0||i===1&&s===o-1&&s===r+1?"":t.slice(s,o)},join:function(...t){let e,n=-1;for(;++n<t.length;)Mi(t[n]),t[n]&&(e=e===void 0?t[n]:e+"/"+t[n]);return e===void 0?".":function(o){Mi(o);const r=o.codePointAt(0)===47;let s=function(i,a){let l,c,u="",h=0,f=-1,m=0,_=-1;for(;++_<=i.length;){if(_<i.length)l=i.codePointAt(_);else{if(l===47)break;l=47}if(l===47){if(!(f===_-1||m===1))if(f!==_-1&&m===2){if(u.length<2||h!==2||u.codePointAt(u.length-1)!==46||u.codePointAt(u.length-2)!==46){if(u.length>2){if(c=u.lastIndexOf("/"),c!==u.length-1){c<0?(u="",h=0):(u=u.slice(0,c),h=u.length-1-u.lastIndexOf("/")),f=_,m=0;continue}}else if(u.length>0){u="",h=0,f=_,m=0;continue}}a&&(u=u.length>0?u+"/..":"..",h=2)}else u.length>0?u+="/"+i.slice(f+1,_):u=i.slice(f+1,_),h=_-f-1;f=_,m=0}else l===46&&m>-1?m++:m=-1}return u}(o,!r);return s.length!==0||r||(s="."),s.length>0&&o.codePointAt(o.length-1)===47&&(s+="/"),r?"/"+s:s}(e)},sep:"/"};function Mi(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const zD={cwd:function(){return"/"}};function kh(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function BD(t){if(typeof t=="string")t=new URL(t);else if(!kh(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const n=e.pathname;let o=-1;for(;++o<n.length;)if(n.codePointAt(o)===37&&n.codePointAt(o+1)===50){const r=n.codePointAt(o+2);if(r===70||r===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(n)}(t)}const Sh=["history","path","basename","stem","extname","dirname"];class lv{constructor(e){let n;n=e?kh(e)?{path:e}:typeof e=="string"||function(s){return!!(s&&typeof s=="object"&&"byteLength"in s&&"byteOffset"in s)}(e)?{value:e}:e:{},this.cwd="cwd"in n?"":zD.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let o,r=-1;for(;++r<Sh.length;){const s=Sh[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}for(o in n)Sh.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?co.basename(this.path):void 0}set basename(e){Nh(e,"basename"),Ch(e,"basename"),this.path=co.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?co.dirname(this.path):void 0}set dirname(e){cv(this.basename,"dirname"),this.path=co.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?co.extname(this.path):void 0}set extname(e){if(Ch(e,"extname"),cv(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=co.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){kh(e)&&(e=BD(e)),Nh(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?co.basename(this.path,this.extname):void 0}set stem(e){Nh(e,"stem"),Ch(e,"stem"),this.path=co.join(this.dirname||"",e+(this.extname||""))}fail(e,n,o){const r=this.message(e,n,o);throw r.fatal=!0,r}info(e,n,o){const r=this.message(e,n,o);return r.fatal=void 0,r}message(e,n,o){const r=new en(e,n,o);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function Ch(t,e){if(t&&t.includes(co.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+co.sep+"`")}function Nh(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function cv(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}const UD=function(t){const e=this.constructor.prototype,n=e[t],o=function(){return n.apply(o,arguments)};return Object.setPrototypeOf(o,e),o},VD={}.hasOwnProperty;class jh extends UD{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=FD()}copy(){const e=new jh;let n=-1;for(;++n<this.attachers.length;){const o=this.attachers[n];e.use(...o)}return e.data(wh(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(Ah("data",this.frozen),this.namespace[e]=n,this):VD.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Ah("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...o]=this.attachers[this.freezeIndex];if(o[0]===!1)continue;o[0]===!0&&(o[0]=void 0);const r=n.call(e,...o);typeof r=="function"&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const n=Ol(e),o=this.parser||this.Parser;return Eh("parse",o),o(String(n),n)}process(e,n){const o=this;return this.freeze(),Eh("process",this.parser||this.Parser),Ih("process",this.compiler||this.Compiler),n?r(void 0,n):new Promise(r);function r(s,i){const a=Ol(e),l=o.parse(a);function c(u,h){u||!h?i(u):s?s(h):n(void 0,h)}o.run(l,a,function(u,h,f){if(u||!h||!f)return c(u);const m=h,_=o.stringify(m,f);var g;typeof(g=_)=="string"||function(p){return!!(p&&typeof p=="object"&&"byteLength"in p&&"byteOffset"in p)}(g)?f.value=_:f.result=_,c(u,f)})}}processSync(e){let n,o=!1;return this.freeze(),Eh("processSync",this.parser||this.Parser),Ih("processSync",this.compiler||this.Compiler),this.process(e,function(r,s){o=!0,iv(r),n=s}),uv("processSync","process",o),n}run(e,n,o){dv(e),this.freeze();const r=this.transformers;return o||typeof n!="function"||(o=n,n=void 0),o?s(void 0,o):new Promise(s);function s(i,a){const l=Ol(n);r.run(e,l,function(c,u,h){const f=u||e;c?a(c):i?i(f):o(void 0,f,h)})}}runSync(e,n){let o,r=!1;return this.run(e,n,function(s,i){iv(s),o=i,r=!0}),uv("runSync","run",r),o}stringify(e,n){this.freeze();const o=Ol(n),r=this.compiler||this.Compiler;return Ih("stringify",r),dv(e),r(e,o)}use(e,...n){const o=this.attachers,r=this.namespace;if(Ah("use",this.frozen),e!=null)if(typeof e=="function")l(e,n);else{if(typeof e!="object")throw new TypeError("Expected usable value, not `"+e+"`");Array.isArray(e)?a(e):i(e)}return this;function s(c){if(typeof c=="function")l(c,[]);else{if(typeof c!="object")throw new TypeError("Expected usable value, not `"+c+"`");if(Array.isArray(c)){const[u,...h]=c;l(u,h)}else i(c)}}function i(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(c.plugins),c.settings&&(r.settings=wh(!0,r.settings,c.settings))}function a(c){let u=-1;if(c!=null){if(!Array.isArray(c))throw new TypeError("Expected a list of plugins, not `"+c+"`");for(;++u<c.length;)s(c[u])}}function l(c,u){let h=-1,f=-1;for(;++h<o.length;)if(o[h][0]===c){f=h;break}if(f===-1)o.push([c,...u]);else if(u.length>0){let[m,..._]=u;const g=o[f][1];vh(g)&&vh(m)&&(m=wh(!0,g,m)),o[f]=[c,m,..._]}}}}const $D=new jh().freeze();function Eh(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function Ih(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Ah(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function dv(t){if(!vh(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function uv(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Ol(t){return function(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}(t)?t:new lv(t)}const hv=[],fv={allowDangerousHtml:!0},HD=/^(https?|ircs?|mailto|xmpp)$/i,WD=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function qD(t){const e=function(o){const r=o.rehypePlugins||hv,s=o.remarkPlugins||hv,i=o.remarkRehypeOptions?{...o.remarkRehypeOptions,...fv}:fv;return $D().use(wD).use(s).use(PD,i).use(r)}(t),n=function(o){const r=o.children||"",s=new lv;return typeof r=="string"&&(s.value=r),s}(t);return function(o,r){const s=r.allowedElements,i=r.allowElement,a=r.components,l=r.disallowedElements,c=r.skipHtml,u=r.unwrapDisallowed,h=r.urlTransform||GD;for(const m of WD)Object.hasOwn(r,m.from)&&(m.from,m.to&&m.to,m.id,void 0);return r.className&&(o={type:"element",tagName:"div",properties:{className:r.className},children:o.type==="root"?o.children:[o]}),ov(o,f),x9(o,{Fragment:d.Fragment,components:a,ignoreInvalidStyle:!0,jsx:d.jsx,jsxs:d.jsxs,passKeys:!0,passNode:!0});function f(m,_,g){if(m.type==="raw"&&g&&typeof _=="number")return c?g.children.splice(_,1):g.children[_]={type:"text",value:m.value},_;if(m.type==="element"){let p;for(p in dh)if(Object.hasOwn(dh,p)&&Object.hasOwn(m.properties,p)){const b=m.properties[p],x=dh[p];(x===null||x.includes(m.tagName))&&(m.properties[p]=h(String(b||""),p,m))}}if(m.type==="element"){let p=s?!s.includes(m.tagName):!!l&&l.includes(m.tagName);if(!p&&i&&typeof _=="number"&&(p=!i(m,_,g)),p&&g&&typeof _=="number")return u&&m.children?g.children.splice(_,1,...m.children):g.children.splice(_,1),_}}}(e.runSync(e.parse(n),n),t)}function GD(t){const e=t.indexOf(":"),n=t.indexOf("?"),o=t.indexOf("#"),r=t.indexOf("/");return e===-1||r!==-1&&e>r||n!==-1&&e>n||o!==-1&&e>o||HD.test(t.slice(0,e))?t:""}const YD=[et.lineWrapping],JD=new Set(["python","markdown","sql","json","yaml","toml","shell","javascript","typescript","jsx","tsx","css","html"]),KD=t=>{const e=X.c(26),{code:n,language:o}=t,{theme:r}=hr(),{createNewCell:s}=Tt(),i=Os(),a=Ue(tc),[l,c]=M.useState(n);let u,h,f;e[0]!==n?(u=()=>{c(n)},h=[n],e[0]=n,e[1]=u,e[2]=h):(u=e[1],h=e[2]),M.useEffect(u,h),e[3]!==a||e[4]!==s||e[5]!==o||e[6]!==i||e[7]!==l?(f=()=>{const j=function(I,T){return I?I==="python"?{language:I,code:T}:I==="sql"?{language:"python",code:Tc.fromQuery(T)}:I==="markdown"?{language:"python",code:Xi.fromMarkdown(T)}:I==="shell"||I==="bash"?{language:"python",code:`import subprocess
|
138
|
-
subprocess.run("${T}")`}:{language:"python",code:`_${I} = """
|
139
|
-
${T}
|
140
|
-
"""`}:{language:"python",code:T}}(o,l);o==="sql"&&fo(a,s,i),s({code:j.code,before:!1,cellId:i??"__end__"})},e[3]=a,e[4]=s,e[5]=o,e[6]=i,e[7]=l,e[8]=f):f=e[8];const m=f;let _;e[9]!==l?(_=async()=>{await _n(l)},e[9]=l,e[10]=_):_=e[10];const g=_,p=r==="dark"?"dark":"light",b=o&&JD.has(o)?o:void 0;let x,y,v,C,k,N;return e[11]!==p||e[12]!==b||e[13]!==l?(x=d.jsx(M.Suspense,{children:d.jsx(ua,{theme:p,language:b,className:"cm border rounded overflow-hidden",extensions:YD,value:l,onChange:c})}),e[11]=p,e[12]=b,e[13]=l,e[14]=x):x=e[14],e[15]!==g?(y=d.jsx(XD,{size:"xs",variant:"outline",onClick:g,children:"Copy"}),e[15]=g,e[16]=y):y=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(v=d.jsx($r,{className:"ml-2 h-4 w-4"}),e[17]=v):v=e[17],e[18]!==m?(C=d.jsxs(Me,{size:"xs",variant:"outline",onClick:m,children:["Add to Notebook",v]}),e[18]=m,e[19]=C):C=e[19],e[20]!==C||e[21]!==y?(k=d.jsxs("div",{className:"flex justify-end mt-2 space-x-2",children:[y,C]}),e[20]=C,e[21]=y,e[22]=k):k=e[22],e[23]!==k||e[24]!==x?(N=d.jsxs("div",{className:"relative",children:[x,k]}),e[23]=k,e[24]=x,e[25]=N):N=e[25],N},XD=t=>{const e=X.c(12);let n,o;e[0]!==t?({onClick:n,...o}=t,e[0]=t,e[1]=n,e[2]=o):(n=e[1],o=e[2]);const[r,s]=M.useState(!1);let i,a,l;e[3]!==r?(i=()=>{r&&setTimeout(()=>s(!1),1e3)},a=[r],e[3]=r,e[4]=i,e[5]=a):(i=e[4],a=e[5]),M.useEffect(i,a),e[6]!==n?(l=h=>{n==null||n(h),s(!0)},e[6]=n,e[7]=l):l=e[7];const c=r?"Copied":"Copy";let u;return e[8]!==o||e[9]!==l||e[10]!==c?(u=d.jsx(Me,{...o,onClick:l,children:c}),e[8]=o,e[9]=l,e[10]=c,e[11]=u):u=e[11],u},ZD={code:({children:t,className:e})=>{const n=e==null?void 0:e.replace("language-","");return n&&typeof t=="string"?d.jsxs("div",{children:[d.jsx("div",{className:"text-xs text-muted-foreground pl-1",children:n}),d.jsx(KD,{code:t.trim(),language:n})]}):d.jsx("code",{className:e,children:t})}},mv=M.memo(t=>{const e=X.c(2),{content:n}=t;let o;return e[0]!==n?(o=d.jsx(qD,{components:ZD,className:"prose dark:prose-invert max-w-none prose-pre:pl-0",children:n}),e[0]=n,e[1]=o):o=e[1],o},(t,e)=>t.content===e.content);mv.displayName="MemoizedMarkdownBlock";const Th=M.memo(({content:t})=>{const e=M.useMemo(()=>{return n=t,r$.lexer(n).map(o=>o.raw);var n},[t]);return d.jsx(d.Fragment,{children:e.map((n,o)=>d.jsx(mv,{content:n},`markdown-block-${o}`))})});Th.displayName="MarkdownRenderer";const QD=t=>{const e=X.c(13),{reasoning:n,index:o,isStreaming:r}=t,s=o===void 0?0:o,i=r!==void 0&&r,a=i?"reasoning":void 0;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=d.jsx(Xl,{className:"h-3 w-3"}),e[0]=l):l=e[0];const c=i?"Thinking":"View reasoning";let u,h,f,m;return e[1]!==n.length||e[2]!==c?(u=d.jsx(tS,{className:"text-xs text-muted-foreground hover:bg-muted/50 px-2 py-1 h-auto rounded-sm [&[data-state=open]>svg]:rotate-180",children:d.jsxs("span",{className:"flex items-center gap-2",children:[l,c," (",n.length," ","chars)"]})}),e[1]=n.length,e[2]=c,e[3]=u):u=e[3],e[4]!==n?(h=d.jsx(nS,{className:"pb-2 px-2",children:d.jsx("div",{className:"bg-muted/30 border border-muted/50 rounded-md p-3 italic text-muted-foreground/90 relative",children:d.jsx("div",{className:"pr-6",children:d.jsx(Th,{content:n})})})}),e[4]=n,e[5]=h):h=e[5],e[6]!==u||e[7]!==h?(f=d.jsxs(oS,{value:"reasoning",className:"border-0",children:[u,h]}),e[6]=u,e[7]=h,e[8]=f):f=e[8],e[9]!==s||e[10]!==a||e[11]!==f?(m=d.jsx(rS,{type:"single",collapsible:!0,className:"w-full mb-2",value:a,children:f},s),e[9]=s,e[10]=a,e[11]=f,e[12]=m):m=e[12],m},eR=t=>{const e=X.c(32),{toolName:n,result:o,error:r,index:s,state:i}=t,a=s===void 0?0:s,l=i==="result"&&(o||r),c=r?"error":l?"success":"loading";let u;e[0]!==c?(u=()=>{switch(c){case"loading":return d.jsx(Dc,{className:"h-3 w-3 animate-spin"});case"error":return d.jsx(Zl,{className:"h-3 w-3 text-destructive"});case"success":return d.jsx(OH,{className:"h-3 w-3 text-green-600"});default:return d.jsx(s$,{className:"h-3 w-3"})}},e[0]=c,e[1]=u):u=e[1];const h=u;let f;e[2]!==r||e[3]!==l||e[4]!==c?(f=()=>c==="loading"?"Running: ":r?"Failed: ":l?"Done: ":"Tool call",e[2]=r,e[3]=l,e[4]=c,e[5]=f):f=e[5];const m=f,_=`tool-${a}`,g=c==="error"&&"text-destructive/80",p=c==="success"&&"text-green-600/80";let b,x;e[6]!==g||e[7]!==p?(b=Ne("h-6 text-xs border-border !shadow-none !ring-0 bg-muted hover:bg-muted/30 py-0 px-2 gap-1 rounded-sm [&[data-state=open]>svg]:rotate-180",g,p),e[6]=g,e[7]=p,e[8]=b):b=e[8],e[9]!==h?(x=h(),e[9]=h,e[10]=x):x=e[10];const y=m();let v,C,k,N,j,I,T;return e[11]!==n?(v=d.jsx("code",{className:"font-mono text-xs",children:n}),e[11]=n,e[12]=v):v=e[12],e[13]!==v||e[14]!==x||e[15]!==y?(C=d.jsxs("span",{className:"flex items-center gap-1",children:[x,y,":"," ",v]}),e[13]=v,e[14]=x,e[15]=y,e[16]=C):C=e[16],e[17]!==C||e[18]!==b?(k=d.jsx(tS,{className:b,children:C}),e[17]=C,e[18]=b,e[19]=k):k=e[19],e[20]!==r||e[21]!==l||e[22]!==o?(N=l&&d.jsxs("div",{className:"space-y-3",children:[o&&d.jsxs("div",{children:[d.jsx("div",{className:"text-xs font-medium text-muted-foreground mt-2 mb-1",children:"Result:"}),d.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:typeof o=="string"?o:JSON.stringify(o,null,2)})]}),r&&d.jsxs("div",{children:[d.jsx("div",{className:"text-xs font-medium text-destructive mb-1",children:"Error:"}),d.jsx("div",{className:"bg-destructive/10 border border-destructive/20 rounded-md p-3 text-sm text-destructive",children:r})]})]}),e[20]=r,e[21]=l,e[22]=o,e[23]=N):N=e[23],e[24]!==N?(j=d.jsx(nS,{className:"pb-2 px-2",children:N}),e[24]=N,e[25]=j):j=e[25],e[26]!==k||e[27]!==j?(I=d.jsxs(oS,{value:"tool-call",className:"border-0",children:[k,j]}),e[26]=k,e[27]=j,e[28]=I):I=e[28],e[29]!==I||e[30]!==_?(T=d.jsx(rS,{type:"single",collapsible:!0,className:"w-full my-4",children:I},_),e[29]=I,e[30]=_,e[31]=T):T=e[31],T},tR=t=>{const e=X.c(27),{onNewChat:n,activeChatId:o,setActiveChat:r,chats:s}=t,{handleClick:i}=fa();let a,l,c,u,h,f,m,_,g,p,b;if(e[0]===Symbol.for("react.memo_cache_sentinel")?(a=d.jsx(ur,{className:"h-4 w-4"}),e[0]=a):a=e[0],e[1]!==n?(l=d.jsx(Te,{content:"New chat",children:d.jsx(Me,{variant:"text",size:"icon",onClick:n,children:a})}),e[1]=n,e[2]=l):l=e[2],e[3]!==i?(c=()=>i("ai"),e[3]=i,e[4]=c):c=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(u=d.jsx(ym,{className:"h-4 w-4"}),e[5]=u):u=e[5],e[6]!==c?(h=d.jsx(Te,{content:"AI Settings",children:d.jsx(Me,{variant:"text",size:"xs",className:"hover:bg-foreground/10 py-2",onClick:c,children:u})}),e[6]=c,e[7]=h):h=e[7],e[8]===Symbol.for("react.memo_cache_sentinel")?(f=d.jsx(Te,{content:"Previous chats",children:d.jsx(Vs,{asChild:!0,children:d.jsx(Me,{variant:"text",size:"icon",children:d.jsx(c$,{className:"h-4 w-4"})})})}),e[8]=f):f=e[8],e[9]!==s.length?(m=s.length===0&&d.jsx(xn,{title:"No chats yet",description:"Start a new chat to get started",icon:d.jsx(Xl,{})}),e[9]=s.length,e[10]=m):m=e[10],e[11]!==o||e[12]!==s||e[13]!==r){let x;e[15]!==o||e[16]!==r?(x=y=>d.jsxs("button",{className:Ne("w-full p-3 rounded-md cursor-pointer hover:bg-accent text-left",y.id===o&&"bg-accent"),onClick:()=>{r(y.id)},type:"button",children:[d.jsx("div",{className:"font-medium",children:y.title}),d.jsx("div",{className:"text-sm text-muted-foreground",children:d$(y.updatedAt)})]},y.id),e[15]=o,e[16]=r,e[17]=x):x=e[17],_=s.map(x),e[11]=o,e[12]=s,e[13]=r,e[14]=_}else _=e[14];return e[18]!==m||e[19]!==_?(g=d.jsxs(zr,{children:[f,d.jsx(Ps,{className:"w-[520px] p-0",align:"start",side:"right",children:d.jsx(ew,{className:"h-[500px] p-4",children:d.jsxs("div",{className:"space-y-4",children:[m,_]})})})]}),e[18]=m,e[19]=_,e[20]=g):g=e[20],e[21]!==h||e[22]!==g?(p=d.jsxs("div",{className:"flex items-center gap-2",children:[h,g]}),e[21]=h,e[22]=g,e[23]=p):p=e[23],e[24]!==p||e[25]!==l?(b=d.jsxs("div",{className:"flex border-b px-2 py-1 justify-between flex-shrink-0 items-center",children:[l,p]}),e[24]=p,e[25]=l,e[26]=b):b=e[26],b},pv=M.memo(t=>{var f;const e=X.c(15),{message:n,index:o,theme:r,onEdit:s,isStreamingReasoning:i,totalMessages:a}=t,l=n.role==="user"?"justify-end":"justify-start";let c,u,h;return e[0]!==l?(c=Ne("flex group relative",l),e[0]=l,e[1]=c):c=e[1],e[2]!==o||e[3]!==i||e[4]!==n.content||e[5]!==n.id||e[6]!==n.parts||e[7]!==n.role||e[8]!==s||e[9]!==r||e[10]!==a?(u=n.role==="user"?d.jsx("div",{className:"w-[95%] bg-background border p-1 rounded-sm",children:d.jsx(Oc,{value:n.content,theme:r,placeholder:"Type your message...",onChange:rR,onSubmit:(m,_)=>{_.trim()&&s(o,_)},onClose:sR},n.id)}):d.jsxs("div",{className:"w-[95%] break-words",children:[d.jsx("div",{className:"absolute right-1 top-1 opacity-0 group-hover:opacity-100 transition-opacity",children:d.jsx(sS,{className:"h-3 w-3",value:n.content})}),(f=n.parts)==null?void 0:f.map((m,_)=>{var g;switch(m.type){case"text":return d.jsx(Th,{content:m.text},_);case"reasoning":return d.jsx(QD,{reasoning:m.reasoning,index:_,isStreaming:o===a-1&&i&&_===(((g=n.parts)==null?void 0:g.length)||0)-1},_);case"tool-invocation":return d.jsx(eR,{index:_,toolName:m.toolInvocation.toolName,result:m.toolInvocation.state==="result"?m.toolInvocation.result:null,state:m.toolInvocation.state},_);default:return null}})]}),e[2]=o,e[3]=i,e[4]=n.content,e[5]=n.id,e[6]=n.parts,e[7]=n.role,e[8]=s,e[9]=r,e[10]=a,e[11]=u):u=e[11],e[12]!==c||e[13]!==u?(h=d.jsx("div",{className:c,children:u}),e[12]=c,e[13]=u,e[14]=h):h=e[14],h});pv.displayName="ChatMessage";const Mh=M.memo(t=>{var C;const e=X.c(22),{input:n,onSendClick:o,isLoading:r,onStop:s}=t,i=Ue(Z4),[a,l]=on(Am),c=((C=i==null?void 0:i.open_ai)==null?void 0:C.model)||"o4-mini";let u,h,f,m,_,g;if(e[0]!==l||e[1]!==a){u=async N=>{var I;const j={...a,ai:{...a.ai,open_ai:{...(I=a.ai)==null?void 0:I.open_ai,model:N}}};k(j)};const k=async N=>{await Rr({config:N}).then(()=>{l(N)})};e[0]=l,e[1]=a,e[2]=u}else u=e[2];e[3]===Symbol.for("react.memo_cache_sentinel")?(h=d.jsx(ac,{className:"h-6 text-xs border-border !shadow-none !ring-0 bg-muted hover:bg-muted/30 py-0 px-2 gap-1",children:d.jsx(lc,{placeholder:"Model"})}),e[3]=h):h=e[3],e[4]!==c?(f=!RS.includes(c)&&d.jsx(Ki,{value:c,className:"text-sm",children:c},c),e[4]=c,e[5]=f):f=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(m=RS.map(iR),e[6]=m):m=e[6],e[7]!==f?(_=d.jsxs(cc,{children:[f,m]}),e[7]=f,e[8]=_):_=e[8],e[9]!==c||e[10]!==u||e[11]!==_?(g=d.jsx("div",{className:"flex items-center gap-2",children:d.jsxs(ic,{value:c,onValueChange:u,children:[h,_]})}),e[9]=c,e[10]=u,e[11]=_,e[12]=g):g=e[12];const p=r?s:o,b=!r&&!n.trim();let x,y,v;return e[13]!==r?(x=r?d.jsx(uc,{className:"h-3 w-3 fill-current"}):d.jsx(i$,{className:"h-3 w-3"}),e[13]=r,e[14]=x):x=e[14],e[15]!==p||e[16]!==b||e[17]!==x?(y=d.jsx(Me,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 hover:bg-muted/30",onClick:p,disabled:b,children:x}),e[15]=p,e[16]=b,e[17]=x,e[18]=y):y=e[18],e[19]!==g||e[20]!==y?(v=d.jsxs("div",{className:"px-3 py-2 border-t border-border/20 flex items-center justify-between",children:[g,y]}),e[19]=g,e[20]=y,e[21]=v):v=e[21],v});Mh.displayName="ChatInputFooter";const gv=M.memo(t=>{var g,p;const e=X.c(19),{input:n,setInput:o,onSubmit:r,theme:s,inputRef:i,isLoading:a,onStop:l}=t;let c;e[0]!==n||e[1]!==r?(c=()=>{n.trim()&&r(void 0,n)},e[0]=n,e[1]=r,e[2]=c):c=e[2];const u=c;let h,f,m,_;return e[3]!==((g=i.current)==null?void 0:g.editor)?(h=()=>{var b,x;return(x=(b=i.current)==null?void 0:b.editor)==null?void 0:x.blur()},e[3]=(p=i.current)==null?void 0:p.editor,e[4]=h):h=e[4],e[5]!==n||e[6]!==r||e[7]!==o||e[8]!==h||e[9]!==s?(f=d.jsx("div",{className:"px-2 py-3 flex-1",children:d.jsx(Oc,{value:n,onChange:o,onSubmit:r,onClose:h,theme:s,placeholder:"Type your message..."})}),e[5]=n,e[6]=r,e[7]=o,e[8]=h,e[9]=s,e[10]=f):f=e[10],e[11]!==u||e[12]!==n||e[13]!==a||e[14]!==l?(m=d.jsx(Mh,{input:n,onSendClick:u,isLoading:a,onStop:l}),e[11]=u,e[12]=n,e[13]=a,e[14]=l,e[15]=m):m=e[15],e[16]!==f||e[17]!==m?(_=d.jsxs("div",{className:"border-t relative flex-shrink-0 min-h-[80px] flex flex-col",children:[f,m]}),e[16]=f,e[17]=m,e[18]=_):_=e[18],_});gv.displayName="ChatInput";const nR=()=>{const t=X.c(6),e=Ue(ec),{handleClick:n}=fa();if(!e){let r,s,i;return t[0]!==n?(r=d.jsx(Me,{variant:"outline",size:"sm",onClick:()=>n("ai"),children:"Edit AI settings"}),t[0]=n,t[1]=r):r=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(s=d.jsx(Xl,{}),t[2]=s):s=t[2],t[3]!==r?(i=d.jsx(xn,{title:"Chat with AI",description:"AI is currently disabled. Add your API key to enable.",action:r,icon:s}),t[3]=r,t[4]=i):i=t[4],i}let o;return t[5]===Symbol.for("react.memo_cache_sentinel")?(o=d.jsx(oR,{}),t[5]=o):o=t[5],o},oR=()=>{const[t,e]=on(dd),[n,o]=on(iC),[r,s]=M.useState(""),i=M.useRef(null),a=M.useRef(null),l=M.useRef(null),c=M.useRef(null),{theme:u}=hr(),h=Fm(),{messages:f,input:m,setInput:_,setMessages:g,append:p,handleSubmit:b,error:x,status:y,reload:v,stop:C}=a$({id:n==null?void 0:n.id,maxSteps:10,initialMessages:(n==null?void 0:n.messages)||[],keepLastMessageOnError:!0,api:h.getAiURL("chat").toString(),headers:h.headers(),experimental_prepareRequestBody:T=>({...T,...F4({input:T.messages.map(A=>A.content).join(`
|
141
|
-
`)}),includeOtherCode:Nc("")}),onFinish:T=>{e(A=>Qu(A,A.activeChatId,T.id,"assistant",T.content,T.parts))},onToolCall:async({toolCall:T})=>{try{const A=await l$({toolName:T.toolName,arguments:T.args});return A.result||A.error}catch(A){return St.error("Tool call failed:",A),`Error: ${A instanceof Error?A.message:String(A)}`}},onError:T=>{St.error("An error occurred:",T)},onResponse:T=>{St.debug("Received HTTP response from server:",T)}}),k=y==="submitted"||y==="streaming";M.useEffect(()=>{if(!t.activeChatId||f.length===0)return;const T=f[f.length-1];if((T==null?void 0:T.role)!=="user")return;const A=t.chats.find(D=>D.id===t.activeChatId);if(!A)return;const R=new Set(A.messages.map(D=>D.id)),z=f.filter(D=>D.role==="user"&&!R.has(D.id));z.length>0&&e(D=>{let F=D;for(const B of z)F=Qu(F,D.activeChatId,B.id,"user",B.content);return F})},[f,t.activeChatId,t.chats,e]);const N=k&&f.length>0&&(T=>{if(T.length===0)return!1;const A=T.at(-1);if(!A||A.role!=="assistant"||!A.parts)return!1;const R=A.parts;return R.length===0?!1:R[R.length-1].type==="reasoning"})(f);M.useEffect(()=>{requestAnimationFrame(()=>{if(l.current){const T=l.current;T.scrollTop=T.scrollHeight}})},[t.activeChatId]);const j=(T,A)=>{g(R=>R.slice(0,T)),t.activeChatId&&e(R=>({...R,chats:R.chats.map(z=>z.id===t.activeChatId?{...z,messages:z.messages.slice(0,T),updatedAt:Date.now()}:z)})),p({role:"user",content:A})},I=()=>{r.trim()&&(T=>{const A=Date.now(),R={id:iS(),title:T.length>50?`${T.slice(0,50)}...`:T,messages:[],createdAt:A,updatedAt:A};e(D=>({...D,chats:[...D.chats,R],activeChatId:R.id}));const z=iS();p({id:z,role:"user",content:T}),_("")})(r.trim())};return d.jsxs("div",{className:"flex flex-col h-[calc(100%-53px)]",children:[d.jsx(Bm,{children:d.jsx(tR,{onNewChat:()=>{o(null),_(""),s("")},activeChatId:n==null?void 0:n.id,setActiveChat:o,chats:[...t.chats].sort((T,A)=>A.updatedAt-T.updatedAt)})}),d.jsxs("div",{className:"flex-1 px-3 bg-[var(--slate-1)] gap-4 py-3 flex flex-col overflow-y-auto",ref:l,children:[(!f||f.length===0)&&d.jsxs("div",{className:"flex flex-col rounded-md border bg-background",children:[d.jsx("div",{className:"px-1",children:d.jsx(Oc,{value:r,placeholder:"Ask anything, @ to include context about tables or dataframes",theme:u,onClose:()=>{var T,A;return(A=(T=i.current)==null?void 0:T.editor)==null?void 0:A.blur()},onChange:s,onSubmit:I},"new-thread-input")}),d.jsx(Mh,{input:r,onSendClick:I,isLoading:k,onStop:C})]}),f.map((T,A)=>d.jsx(pv,{message:T,index:A,theme:u,onEdit:j,setChatState:e,chatState:t,isStreamingReasoning:N,totalMessages:f.length},A)),k&&d.jsx("div",{className:"flex justify-center py-4",children:d.jsx(Dc,{className:"h-4 w-4 animate-spin"})}),x&&d.jsxs("div",{className:"flex items-center justify-center space-x-2 mb-4",children:[d.jsx(Br,{error:x}),d.jsx(Me,{variant:"outline",size:"sm",onClick:()=>{v()},children:"Retry"})]}),d.jsx("div",{ref:c})]}),k&&d.jsx("div",{className:"w-full flex justify-center items-center z-20 border-t",children:d.jsx(Me,{variant:"linkDestructive",size:"sm",onClick:C,children:"Stop"})}),f&&f.length>0&&d.jsx(gv,{input:m,setInput:_,onSubmit:(T,A)=>{A.trim()&&b(T)},theme:u,inputRef:a,isLoading:k,onStop:C})]})};function rR(){}function sR(){}function iR(t){return d.jsx(Ki,{value:t,className:"text-sm",children:t},t)}function dn(t){if(typeof t=="string"||typeof t=="number")return""+t;let e="";if(Array.isArray(t))for(let n,o=0;o<t.length;o++)(n=dn(t[o]))!==""&&(e+=(e&&" ")+n);else for(let n in t)t[n]&&(e+=(e&&" ")+n);return e}const{useDebugValue:aR}=K,{useSyncExternalStoreWithSelector:lR}=u$,cR=t=>t;function _v(t,e=cR,n){const o=lR(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return aR(o),o}const bv=(t,e)=>{const n=h$(t),o=(r,s=e)=>_v(n,r,s);return Object.assign(o,n),o};function tn(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[o,r]of t)if(!Object.is(r,e.get(o)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const o of t)if(!e.has(o))return!1;return!0}const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(e,o)||!Object.is(t[o],e[o]))return!1;return!0}function uo(t,e){if(t=function(s){let i;for(;i=s.sourceEvent;)s=i;return s}(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=t.clientX,o.y=t.clientY,[(o=o.matrixTransform(e.getScreenCTM().inverse())).x,o.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop]}}return[t.pageX,t.pageY]}const dR={passive:!1},Oi={capture:!0,passive:!1};function Oh(t){t.stopImmediatePropagation()}function ps(t){t.preventDefault(),t.stopImmediatePropagation()}function xv(t){var e=t.document.documentElement,n=to(t).on("dragstart.drag",ps,Oi);"onselectstart"in e?n.on("selectstart.drag",ps,Oi):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function yv(t,e){var n=t.document.documentElement,o=to(t).on("dragstart.drag",null);e&&(o.on("click.drag",ps,Oi),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Dl=t=>()=>t;function Dh(t,{sourceEvent:e,subject:n,target:o,identifier:r,active:s,x:i,y:a,dx:l,dy:c,dispatch:u}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}function uR(t){return!t.ctrlKey&&!t.button}function hR(){return this.parentNode}function fR(t,e){return e??{x:t.x,y:t.y}}function mR(){return navigator.maxTouchPoints||"ontouchstart"in this}Dh.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};const Rl=t=>()=>t;function pR(t,{sourceEvent:e,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function Rh(t){t.stopImmediatePropagation()}function Di(t){t.preventDefault(),t.stopImmediatePropagation()}function gR(t){return!(t.ctrlKey&&t.type!=="wheel"||t.button)}function _R(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t).hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]:[[0,0],[t.clientWidth,t.clientHeight]]}function wv(){return this.__zoom||pr}function bR(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function xR(){return navigator.maxTouchPoints||"ontouchstart"in this}function yR(t,e,n){var o=t.invertX(e[0][0])-n[0][0],r=t.invertX(e[1][0])-n[1][0],s=t.invertY(e[0][1])-n[0][1],i=t.invertY(e[1][1])-n[1][1];return t.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i))}const Pl=M.createContext(null),wR=Pl.Provider,vR=t=>`Node type "${t}" not found. Using fallback type "default".`,kR=()=>"The React Flow parent container needs a width and a height to render the graph.",SR=()=>"Only child nodes can use a parent extent.",CR=t=>`Marker type "${t}" doesn't exist.`,NR=(t,e)=>`Couldn't create edge for ${t?"target":"source"} handle id: "${t?e.targetHandle:e.sourceHandle}", edge id: ${e.id}.`,jR=()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",ER=t=>`Edge type "${t}" not found. Using fallback type "default".`,IR=t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,vv="[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001";function mt(t,e){const n=M.useContext(Pl);if(n===null)throw new Error(vv);return _v(n,t,e)}const Ht=()=>{const t=M.useContext(Pl);if(t===null)throw new Error(vv);return M.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe,destroy:t.destroy}),[t])},AR=t=>t.userSelectionActive?"none":"all";function Ll({position:t,children:e,className:n,style:o,...r}){const s=mt(AR),i=`${t}`.split("-");return K.createElement("div",{className:dn(["react-flow__panel",n,...i]),style:{...o,pointerEvents:s},...r},e)}function TR({proOptions:t,position:e="bottom-right"}){return t!=null&&t.hideAttribution?null:K.createElement(Ll,{position:e,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},K.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}var MR=M.memo(({x:t,y:e,label:n,labelStyle:o={},labelShowBg:r=!0,labelBgStyle:s={},labelBgPadding:i=[2,4],labelBgBorderRadius:a=2,children:l,className:c,...u})=>{const h=M.useRef(null),[f,m]=M.useState({x:0,y:0,width:0,height:0}),_=dn(["react-flow__edge-textwrapper",c]);return M.useEffect(()=>{if(h.current){const g=h.current.getBBox();m({x:g.x,y:g.y,width:g.width,height:g.height})}},[n]),n!==void 0&&n?K.createElement("g",{transform:`translate(${t-f.width/2} ${e-f.height/2})`,className:_,visibility:f.width?"visible":"hidden",...u},r&&K.createElement("rect",{width:f.width+2*i[0],x:-i[0],y:-i[1],height:f.height+2*i[1],className:"react-flow__edge-textbg",style:s,rx:a,ry:a}),K.createElement("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:h,style:o},n),l):null});const Ph=t=>({width:t.offsetWidth,height:t.offsetHeight}),gs=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),Lh=(t={x:0,y:0},e)=>({x:gs(t.x,e[0][0],e[1][0]),y:gs(t.y,e[0][1],e[1][1])}),kv=(t,e,n)=>t<e?gs(Math.abs(t-e),1,50)/50:t>n?-gs(Math.abs(t-n),1,50)/50:0,Sv=(t,e)=>[20*kv(t.x,35,e.width-35),20*kv(t.y,35,e.height-35)],Cv=t=>{var e;return((e=t.getRootNode)==null?void 0:e.call(t))||(window==null?void 0:window.document)},Fh=({x:t,y:e,width:n,height:o})=>({x:t,y:e,x2:t+n,y2:e+o}),Nv=t=>({...t.positionAbsolute||{x:0,y:0},width:t.width||0,height:t.height||0}),zh=(t,e)=>{const n=Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x)),o=Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y));return Math.ceil(n*o)},zn=t=>!isNaN(t)&&isFinite(t),kt=Symbol.for("internals"),jv=["Enter"," ","Escape"];function Bh(t){var o,r;const e=(s=>"nativeEvent"in s)(t)?t.nativeEvent:t,n=((r=(o=e.composedPath)==null?void 0:o.call(e))==null?void 0:r[0])||t.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const Ev=t=>"clientX"in t,Zo=(t,e)=>{var s,i;const n=Ev(t),o=n?t.clientX:(s=t.touches)==null?void 0:s[0].clientX,r=n?t.clientY:(i=t.touches)==null?void 0:i[0].clientY;return{x:o-((e==null?void 0:e.left)??0),y:r-((e==null?void 0:e.top)??0)}},Fl=()=>{var t;return typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)==null?void 0:t.indexOf("Mac"))>=0},Ri=({id:t,path:e,labelX:n,labelY:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:u,markerEnd:h,markerStart:f,interactionWidth:m=20})=>K.createElement(K.Fragment,null,K.createElement("path",{id:t,style:u,d:e,fill:"none",className:"react-flow__edge-path",markerEnd:h,markerStart:f}),m&&K.createElement("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:m,className:"react-flow__edge-interaction"}),r&&zn(n)&&zn(o)?K.createElement(MR,{x:n,y:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c}):null);function Pi(t,e,n){return n===void 0?n:o=>{const r=e().edges.find(s=>s.id===t);r&&n(o,{...r})}}function Iv({sourceX:t,sourceY:e,targetX:n,targetY:o}){const r=Math.abs(n-t)/2,s=n<t?n+r:n-r,i=Math.abs(o-e)/2;return[s,o<e?o+i:o-i,r,i]}function Av({sourceX:t,sourceY:e,targetX:n,targetY:o,sourceControlX:r,sourceControlY:s,targetControlX:i,targetControlY:a}){const l=.125*t+.375*r+.375*i+.125*n,c=.125*e+.375*s+.375*a+.125*o;return[l,c,Math.abs(l-t),Math.abs(c-e)]}var jr,Tv,Qo,Uh,Li,Mv,er,Fi,_s,Ov,Be,zl;function Dv({pos:t,x1:e,y1:n,x2:o,y2:r}){return t===Be.Left||t===Be.Right?[.5*(e+o),n]:[e,.5*(n+r)]}function Rv({sourceX:t,sourceY:e,sourcePosition:n=Be.Bottom,targetX:o,targetY:r,targetPosition:s=Be.Top}){const[i,a]=Dv({pos:n,x1:t,y1:e,x2:o,y2:r}),[l,c]=Dv({pos:s,x1:o,y1:r,x2:t,y2:e}),[u,h,f,m]=Av({sourceX:t,sourceY:e,targetX:o,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:l,targetControlY:c});return[`M${t},${e} C${i},${a} ${l},${c} ${o},${r}`,u,h,f,m]}Ri.displayName="BaseEdge",(Tv=jr||(jr={})).Strict="strict",Tv.Loose="loose",(Uh=Qo||(Qo={})).Free="free",Uh.Vertical="vertical",Uh.Horizontal="horizontal",(Mv=Li||(Li={})).Partial="partial",Mv.Full="full",(Fi=er||(er={})).Bezier="default",Fi.Straight="straight",Fi.Step="step",Fi.SmoothStep="smoothstep",Fi.SimpleBezier="simplebezier",(Ov=_s||(_s={})).Arrow="arrow",Ov.ArrowClosed="arrowclosed",(zl=Be||(Be={})).Left="left",zl.Top="top",zl.Right="right",zl.Bottom="bottom";const Vh=M.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,sourcePosition:r=Be.Bottom,targetPosition:s=Be.Top,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:_,interactionWidth:g})=>{const[p,b,x]=Rv({sourceX:t,sourceY:e,sourcePosition:r,targetX:n,targetY:o,targetPosition:s});return K.createElement(Ri,{path:p,labelX:b,labelY:x,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:_,interactionWidth:g})});Vh.displayName="SimpleBezierEdge";const Pv={[Be.Left]:{x:-1,y:0},[Be.Right]:{x:1,y:0},[Be.Top]:{x:0,y:-1},[Be.Bottom]:{x:0,y:1}},Lv=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function OR({source:t,sourcePosition:e=Be.Bottom,target:n,targetPosition:o=Be.Top,center:r,offset:s}){const i=Pv[e],a=Pv[o],l={x:t.x+i.x*s,y:t.y+i.y*s},c={x:n.x+a.x*s,y:n.y+a.y*s},u=(({source:k,sourcePosition:N=Be.Bottom,target:j})=>N===Be.Left||N===Be.Right?k.x<j.x?{x:1,y:0}:{x:-1,y:0}:k.y<j.y?{x:0,y:1}:{x:0,y:-1})({source:l,sourcePosition:e,target:c}),h=u.x!==0?"x":"y",f=u[h];let m,_,g=[];const p={x:0,y:0},b={x:0,y:0},[x,y,v,C]=Iv({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(i[h]*a[h]===-1){m=r.x??x,_=r.y??y;const k=[{x:m,y:l.y},{x:m,y:c.y}],N=[{x:l.x,y:_},{x:c.x,y:_}];g=i[h]===f?h==="x"?k:N:h==="x"?N:k}else{const k=[{x:l.x,y:c.y}],N=[{x:c.x,y:l.y}];if(g=h==="x"?i.x===f?N:k:i.y===f?k:N,e===o){const T=Math.abs(t[h]-n[h]);if(T<=s){const A=Math.min(s-1,s-T);i[h]===f?p[h]=(l[h]>t[h]?-1:1)*A:b[h]=(c[h]>n[h]?-1:1)*A}}if(e!==o){const T=h==="x"?"y":"x",A=i[h]===a[T],R=l[T]>c[T],z=l[T]<c[T];(i[h]===1&&(!A&&R||A&&z)||i[h]!==1&&(!A&&z||A&&R))&&(g=h==="x"?k:N)}const j={x:l.x+p.x,y:l.y+p.y},I={x:c.x+b.x,y:c.y+b.y};Math.max(Math.abs(j.x-g[0].x),Math.abs(I.x-g[0].x))>=Math.max(Math.abs(j.y-g[0].y),Math.abs(I.y-g[0].y))?(m=(j.x+I.x)/2,_=g[0].y):(m=g[0].x,_=(j.y+I.y)/2)}return[[t,{x:l.x+p.x,y:l.y+p.y},...g,{x:c.x+b.x,y:c.y+b.y},n],m,_,v,C]}function $h({sourceX:t,sourceY:e,sourcePosition:n=Be.Bottom,targetX:o,targetY:r,targetPosition:s=Be.Top,borderRadius:i=5,centerX:a,centerY:l,offset:c=20}){const[u,h,f,m,_]=OR({source:{x:t,y:e},sourcePosition:n,target:{x:o,y:r},targetPosition:s,center:{x:a,y:l},offset:c});return[u.reduce((g,p,b)=>{let x="";return x=b>0&&b<u.length-1?function(y,v,C,k){const N=Math.min(Lv(y,v)/2,Lv(v,C)/2,k),{x:j,y:I}=v;if(y.x===j&&j===C.x||y.y===I&&I===C.y)return`L${j} ${I}`;if(y.y===I)return`L ${j+N*(y.x<C.x?-1:1)},${I}Q ${j},${I} ${j},${I+N*(y.y<C.y?1:-1)}`;const T=y.x<C.x?1:-1;return`L ${j},${I+N*(y.y<C.y?-1:1)}Q ${j},${I} ${j+N*T},${I}`}(u[b-1],p,u[b+1],i):`${b===0?"M":"L"}${p.x} ${p.y}`,g+=x},""),h,f,m,_]}const Bl=M.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:u,sourcePosition:h=Be.Bottom,targetPosition:f=Be.Top,markerEnd:m,markerStart:_,pathOptions:g,interactionWidth:p})=>{const[b,x,y]=$h({sourceX:t,sourceY:e,sourcePosition:h,targetX:n,targetY:o,targetPosition:f,borderRadius:g==null?void 0:g.borderRadius,offset:g==null?void 0:g.offset});return K.createElement(Ri,{path:b,labelX:x,labelY:y,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:u,markerEnd:m,markerStart:_,interactionWidth:p})});Bl.displayName="SmoothStepEdge";const Hh=M.memo(t=>{var e;return K.createElement(Bl,{...t,pathOptions:M.useMemo(()=>{var n;return{borderRadius:0,offset:(n=t.pathOptions)==null?void 0:n.offset}},[(e=t.pathOptions)==null?void 0:e.offset])})});Hh.displayName="StepEdge";const Wh=M.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:u,markerEnd:h,markerStart:f,interactionWidth:m})=>{const[_,g,p]=function({sourceX:b,sourceY:x,targetX:y,targetY:v}){const[C,k,N,j]=Iv({sourceX:b,sourceY:x,targetX:y,targetY:v});return[`M ${b},${x}L ${y},${v}`,C,k,N,j]}({sourceX:t,sourceY:e,targetX:n,targetY:o});return K.createElement(Ri,{path:_,labelX:g,labelY:p,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:u,markerEnd:h,markerStart:f,interactionWidth:m})});function Ul(t,e){return t>=0?.5*t:25*e*Math.sqrt(-t)}function Fv({pos:t,x1:e,y1:n,x2:o,y2:r,c:s}){switch(t){case Be.Left:return[e-Ul(e-o,s),n];case Be.Right:return[e+Ul(o-e,s),n];case Be.Top:return[e,n-Ul(n-r,s)];case Be.Bottom:return[e,n+Ul(r-n,s)]}}function zv({sourceX:t,sourceY:e,sourcePosition:n=Be.Bottom,targetX:o,targetY:r,targetPosition:s=Be.Top,curvature:i=.25}){const[a,l]=Fv({pos:n,x1:t,y1:e,x2:o,y2:r,c:i}),[c,u]=Fv({pos:s,x1:o,y1:r,x2:t,y2:e,c:i}),[h,f,m,_]=Av({sourceX:t,sourceY:e,targetX:o,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${t},${e} C${a},${l} ${c},${u} ${o},${r}`,h,f,m,_]}Wh.displayName="StraightEdge";const Vl=M.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,sourcePosition:r=Be.Bottom,targetPosition:s=Be.Top,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:_,pathOptions:g,interactionWidth:p})=>{const[b,x,y]=zv({sourceX:t,sourceY:e,sourcePosition:r,targetX:n,targetY:o,targetPosition:s,curvature:g==null?void 0:g.curvature});return K.createElement(Ri,{path:b,labelX:x,labelY:y,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:_,interactionWidth:p})});Vl.displayName="BezierEdge";const qh=M.createContext(null),DR=qh.Provider;qh.Consumer;const RR=({source:t,sourceHandle:e,target:n,targetHandle:o})=>`reactflow__edge-${t}${e||""}-${n}${o||""}`,Gh=(t,e)=>t===void 0?"":typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(n=>`${n}=${t[n]}`).join("&")}`,Yh=({x:t,y:e},[n,o,r],s,[i,a])=>{const l={x:(t-n)/r,y:(e-o)/r};return s?{x:i*Math.round(l.x/i),y:a*Math.round(l.y/a)}:l},Bv=({x:t,y:e},[n,o,r])=>({x:t*r+n,y:e*r+o}),bs=(t,e=[0,0])=>{if(!t)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(t.width??0)*e[0],o=(t.height??0)*e[1],r={x:t.position.x-n,y:t.position.y-o};return{...r,positionAbsolute:t.positionAbsolute?{x:t.positionAbsolute.x-n,y:t.positionAbsolute.y-o}:r}},Jh=(t,e=[0,0])=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const n=t.reduce((o,r)=>{const{x:s,y:i}=bs(r,e).positionAbsolute;return a=o,l=Fh({x:s,y:i,width:r.width||0,height:r.height||0}),{x:Math.min(a.x,l.x),y:Math.min(a.y,l.y),x2:Math.max(a.x2,l.x2),y2:Math.max(a.y2,l.y2)};var a,l},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return(({x:o,y:r,x2:s,y2:i})=>({x:o,y:r,width:s-o,height:i-r}))(n)},Uv=(t,e,[n,o,r]=[0,0,1],s=!1,i=!1,a=[0,0])=>{const l={x:(e.x-n)/r,y:(e.y-o)/r,width:e.width/r,height:e.height/r},c=[];return t.forEach(u=>{const{width:h,height:f,selectable:m=!0,hidden:_=!1}=u;if(i&&!m||_)return!1;const{positionAbsolute:g}=bs(u,a),p={x:g.x,y:g.y,width:h||0,height:f||0},b=zh(l,p);(h===void 0||f===void 0||h===null||f===null||s&&b>0||b>=(h||0)*(f||0)||u.dragging)&&c.push(u)}),c},Vv=(t,e)=>{const n=t.map(o=>o.id);return e.filter(o=>n.includes(o.source)||n.includes(o.target))},$v=(t,e,n,o,r,s=.1)=>{const i=e/(t.width*(1+s)),a=n/(t.height*(1+s)),l=Math.min(i,a),c=gs(l,o,r);return{x:e/2-(t.x+t.width/2)*c,y:n/2-(t.y+t.height/2)*c,zoom:c}},Er=(t,e=0)=>t.transition().duration(e);function Hv(t,e,n,o){return(e[n]||[]).reduce((r,s)=>{var i,a;return`${t.id}-${s.id}-${n}`!==o&&r.push({id:s.id||null,type:n,nodeId:t.id,x:(((i=t.positionAbsolute)==null?void 0:i.x)??0)+s.x+s.width/2,y:(((a=t.positionAbsolute)==null?void 0:a.y)??0)+s.y+s.height/2}),r},[])}const PR={source:null,target:null,sourceHandle:null,targetHandle:null},Wv=()=>({handleDomNode:null,isValid:!1,connection:PR,endHandle:null});function qv(t,e,n,o,r,s,i){const a=r==="target",l=i.querySelector(`.react-flow__handle[data-id="${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`),c={...Wv(),handleDomNode:l};if(l){const u=Kh(void 0,l),h=l.getAttribute("data-nodeid"),f=l.getAttribute("data-handleid"),m=l.classList.contains("connectable"),_=l.classList.contains("connectableend"),g={source:a?h:n,sourceHandle:a?f:o,target:a?n:h,targetHandle:a?o:f};c.connection=g,m&&_&&(e===jr.Strict?a&&u==="source"||!a&&u==="target":h!==n||f!==o)&&(c.endHandle={nodeId:h,handleId:f,type:u},c.isValid=s(g))}return c}function Kh(t,e){return t||(e!=null&&e.classList.contains("target")?"target":e!=null&&e.classList.contains("source")?"source":null)}function Xh(t){t==null||t.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function LR(t,e){let n=null;return e?n="valid":t&&!e&&(n="invalid"),n}function Gv({event:t,handleId:e,nodeId:n,onConnect:o,isTarget:r,getState:s,setState:i,isValidConnection:a,edgeUpdaterType:l,onReconnectEnd:c}){const u=Cv(t.target),{connectionMode:h,domNode:f,autoPanOnConnect:m,connectionRadius:_,onConnectStart:g,panBy:p,getNodes:b,cancelConnection:x}=s();let y,v=0;const{x:C,y:k}=Zo(t),N=u==null?void 0:u.elementFromPoint(C,k),j=Kh(l,N),I=f==null?void 0:f.getBoundingClientRect();if(!I||!j)return;let T,A=Zo(t,I),R=!1,z=null,D=!1,F=null;const B=function({nodes:$,nodeId:E,handleId:W,handleType:G}){return $.reduce((q,Y)=>{if(Y[kt]){const{handleBounds:te}=Y[kt];let oe=[],se=[];te&&(oe=Hv(Y,te,"source",`${E}-${W}-${G}`),se=Hv(Y,te,"target",`${E}-${W}-${G}`)),q.push(...oe,...se)}return q},[])}({nodes:b(),nodeId:n,handleId:e,handleType:j}),U=()=>{if(!m)return;const[$,E]=Sv(A,I);p({x:$,y:E}),v=requestAnimationFrame(U)};function O($){const{transform:E}=s();A=Zo($,I);const{handle:W,validHandleResult:G}=function(q,Y,te,oe,se,Z){const{x:Q,y:ue}=Zo(q),me=Y.elementsFromPoint(Q,ue).find(Se=>Se.classList.contains("react-flow__handle"));if(me){const Se=me.getAttribute("data-nodeid");if(Se){const ie=Kh(void 0,me),je=me.getAttribute("data-handleid"),pe=Z({nodeId:Se,id:je,type:ie});if(pe){const Ae=se.find(ze=>ze.nodeId===Se&&ze.type===ie&&ze.id===je);return{handle:{id:je,type:ie,nodeId:Se,x:(Ae==null?void 0:Ae.x)||te.x,y:(Ae==null?void 0:Ae.y)||te.y},validHandleResult:pe}}}}let ce=[],fe=1/0;if(se.forEach(Se=>{const ie=Math.sqrt((Se.x-te.x)**2+(Se.y-te.y)**2);if(ie<=oe){const je=Z(Se);ie<=fe&&(ie<fe?ce=[{handle:Se,validHandleResult:je}]:ie===fe&&ce.push({handle:Se,validHandleResult:je}),fe=ie)}}),!ce.length)return{handle:null,validHandleResult:Wv()};if(ce.length===1)return ce[0];const de=ce.some(({validHandleResult:Se})=>Se.isValid),ke=ce.some(({handle:Se})=>Se.type==="target");return ce.find(({handle:Se,validHandleResult:ie})=>ke?Se.type==="target":!de||ie.isValid)||ce[0]}($,u,Yh(A,E,!1,[1,1]),_,B,q=>qv(q,h,n,e,r?"target":"source",a,u));if(y=W,R||(U(),R=!0),F=G.handleDomNode,z=G.connection,D=G.isValid,i({connectionPosition:y&&D?Bv({x:y.x,y:y.y},E):A,connectionStatus:LR(!!y,D),connectionEndHandle:G.endHandle}),!y&&!D&&!F)return Xh(T);z.source!==z.target&&F&&(Xh(T),T=F,F.classList.add("connecting","react-flow__handle-connecting"),F.classList.toggle("valid",D),F.classList.toggle("react-flow__handle-valid",D))}function S($){var E,W;(y||F)&&z&&D&&(o==null||o(z)),(W=(E=s()).onConnectEnd)==null||W.call(E,$),l&&(c==null||c($)),Xh(T),x(),cancelAnimationFrame(v),R=!1,D=!1,z=null,F=null,u.removeEventListener("mousemove",O),u.removeEventListener("mouseup",S),u.removeEventListener("touchmove",O),u.removeEventListener("touchend",S)}i({connectionPosition:A,connectionStatus:null,connectionNodeId:n,connectionHandleId:e,connectionHandleType:j,connectionStartHandle:{nodeId:n,handleId:e,type:j},connectionEndHandle:null}),g==null||g(t,{nodeId:n,handleId:e,handleType:j}),u.addEventListener("mousemove",O),u.addEventListener("mouseup",S),u.addEventListener("touchmove",O),u.addEventListener("touchend",S)}const Yv=()=>!0,FR=t=>({connectionStartHandle:t.connectionStartHandle,connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName}),Jv=M.forwardRef(({type:t="source",position:e=Be.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:r=!0,isConnectableEnd:s=!0,id:i,onConnect:a,children:l,className:c,onMouseDown:u,onTouchStart:h,...f},m)=>{var j,I;const _=i||null,g=t==="target",p=Ht(),b=M.useContext(qh),{connectOnClick:x,noPanClassName:y}=mt(FR,tn),{connecting:v,clickConnecting:C}=mt(((T,A,R)=>z=>{const{connectionStartHandle:D,connectionEndHandle:F,connectionClickStartHandle:B}=z;return{connecting:(D==null?void 0:D.nodeId)===T&&(D==null?void 0:D.handleId)===A&&(D==null?void 0:D.type)===R||(F==null?void 0:F.nodeId)===T&&(F==null?void 0:F.handleId)===A&&(F==null?void 0:F.type)===R,clickConnecting:(B==null?void 0:B.nodeId)===T&&(B==null?void 0:B.handleId)===A&&(B==null?void 0:B.type)===R}})(b,_,t),tn);b||((I=(j=p.getState()).onError)==null||I.call(j,"010",jR()));const k=T=>{const{defaultEdgeOptions:A,onConnect:R,hasDefaultEdges:z}=p.getState(),D={...A,...T};if(z){const{edges:F,setEdges:B}=p.getState();B(((U,O)=>{if(!U.source||!U.target)return O;let S;return S=($=>"id"in $&&"source"in $&&"target"in $)(U)?{...U}:{...U,id:RR(U)},(($,E)=>E.some(W=>!(W.source!==$.source||W.target!==$.target||W.sourceHandle!==$.sourceHandle&&(W.sourceHandle||$.sourceHandle)||W.targetHandle!==$.targetHandle&&(W.targetHandle||$.targetHandle))))(S,O)?O:O.concat(S)})(D,F))}R==null||R(D),a==null||a(D)},N=T=>{if(!b)return;const A=Ev(T);r&&(A&&T.button===0||!A)&&Gv({event:T,handleId:_,nodeId:b,onConnect:k,isTarget:g,getState:p.getState,setState:p.setState,isValidConnection:n||p.getState().isValidConnection||Yv}),A?u==null||u(T):h==null||h(T)};return K.createElement("div",{"data-handleid":_,"data-nodeid":b,"data-handlepos":e,"data-id":`${b}-${_}-${t}`,className:dn(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",y,c,{source:!g,target:g,connectable:o,connectablestart:r,connectableend:s,connecting:C,connectionindicator:o&&(r&&!v||s&&v)}]),onMouseDown:N,onTouchStart:N,onClick:x?T=>{const{onClickConnectStart:A,onClickConnectEnd:R,connectionClickStartHandle:z,connectionMode:D,isValidConnection:F}=p.getState();if(!b||!z&&!r)return;if(!z)return A==null||A(T,{nodeId:b,handleId:_,handleType:t}),void p.setState({connectionClickStartHandle:{nodeId:b,type:t,handleId:_}});const B=Cv(T.target),U=n||F||Yv,{connection:O,isValid:S}=qv({nodeId:b,id:_,type:t},D,z.nodeId,z.handleId||null,z.type,U,B);S&&k(O),R==null||R(T),p.setState({connectionClickStartHandle:null})}:void 0,ref:m,...f},l)});Jv.displayName="Handle";var tr=M.memo(Jv);const Kv=({data:t,isConnectable:e,targetPosition:n=Be.Top,sourcePosition:o=Be.Bottom})=>K.createElement(K.Fragment,null,K.createElement(tr,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label,K.createElement(tr,{type:"source",position:o,isConnectable:e}));Kv.displayName="DefaultNode";var Zh=M.memo(Kv);const Xv=({data:t,isConnectable:e,sourcePosition:n=Be.Bottom})=>K.createElement(K.Fragment,null,t==null?void 0:t.label,K.createElement(tr,{type:"source",position:n,isConnectable:e}));Xv.displayName="InputNode";var Zv=M.memo(Xv);const Qv=({data:t,isConnectable:e,targetPosition:n=Be.Top})=>K.createElement(K.Fragment,null,K.createElement(tr,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label);Qv.displayName="OutputNode";var e2=M.memo(Qv);const Qh=()=>null;Qh.displayName="GroupNode";const zR=t=>({selectedNodes:t.getNodes().filter(e=>e.selected),selectedEdges:t.edges.filter(e=>e.selected).map(e=>({...e}))}),$l=t=>t.id;function BR(t,e){return tn(t.selectedNodes.map($l),e.selectedNodes.map($l))&&tn(t.selectedEdges.map($l),e.selectedEdges.map($l))}const t2=M.memo(({onSelectionChange:t})=>{const e=Ht(),{selectedNodes:n,selectedEdges:o}=mt(zR,BR);return M.useEffect(()=>{const r={nodes:n,edges:o};t==null||t(r),e.getState().onSelectionChange.forEach(s=>s(r))},[n,o,t]),null});t2.displayName="SelectionListener";const UR=t=>!!t.onSelectionChange;function VR({onSelectionChange:t}){const e=mt(UR);return t||e?K.createElement(t2,{onSelectionChange:t}):null}const $R=t=>({setNodes:t.setNodes,setEdges:t.setEdges,setDefaultNodesAndEdges:t.setDefaultNodesAndEdges,setMinZoom:t.setMinZoom,setMaxZoom:t.setMaxZoom,setTranslateExtent:t.setTranslateExtent,setNodeExtent:t.setNodeExtent,reset:t.reset});function xs(t,e){M.useEffect(()=>{t!==void 0&&e(t)},[t])}function ot(t,e,n){M.useEffect(()=>{e!==void 0&&n({[t]:e})},[e])}const HR=({nodes:t,edges:e,defaultNodes:n,defaultEdges:o,onConnect:r,onConnectStart:s,onConnectEnd:i,onClickConnectStart:a,onClickConnectEnd:l,nodesDraggable:c,nodesConnectable:u,nodesFocusable:h,edgesFocusable:f,edgesUpdatable:m,elevateNodesOnSelect:_,minZoom:g,maxZoom:p,nodeExtent:b,onNodesChange:x,onEdgesChange:y,elementsSelectable:v,connectionMode:C,snapGrid:k,snapToGrid:N,translateExtent:j,connectOnClick:I,defaultEdgeOptions:T,fitView:A,fitViewOptions:R,onNodesDelete:z,onEdgesDelete:D,onNodeDrag:F,onNodeDragStart:B,onNodeDragStop:U,onSelectionDrag:O,onSelectionDragStart:S,onSelectionDragStop:$,noPanClassName:E,nodeOrigin:W,rfId:G,autoPanOnConnect:q,autoPanOnNodeDrag:Y,onError:te,connectionRadius:oe,isValidConnection:se,nodeDragThreshold:Z})=>{const{setNodes:Q,setEdges:ue,setDefaultNodesAndEdges:me,setMinZoom:ce,setMaxZoom:fe,setTranslateExtent:de,setNodeExtent:ke,reset:Se}=mt($R,tn),ie=Ht();return M.useEffect(()=>{const je=o==null?void 0:o.map(pe=>({...pe,...T}));return me(n,je),()=>{Se()}},[]),ot("defaultEdgeOptions",T,ie.setState),ot("connectionMode",C,ie.setState),ot("onConnect",r,ie.setState),ot("onConnectStart",s,ie.setState),ot("onConnectEnd",i,ie.setState),ot("onClickConnectStart",a,ie.setState),ot("onClickConnectEnd",l,ie.setState),ot("nodesDraggable",c,ie.setState),ot("nodesConnectable",u,ie.setState),ot("nodesFocusable",h,ie.setState),ot("edgesFocusable",f,ie.setState),ot("edgesUpdatable",m,ie.setState),ot("elementsSelectable",v,ie.setState),ot("elevateNodesOnSelect",_,ie.setState),ot("snapToGrid",N,ie.setState),ot("snapGrid",k,ie.setState),ot("onNodesChange",x,ie.setState),ot("onEdgesChange",y,ie.setState),ot("connectOnClick",I,ie.setState),ot("fitViewOnInit",A,ie.setState),ot("fitViewOnInitOptions",R,ie.setState),ot("onNodesDelete",z,ie.setState),ot("onEdgesDelete",D,ie.setState),ot("onNodeDrag",F,ie.setState),ot("onNodeDragStart",B,ie.setState),ot("onNodeDragStop",U,ie.setState),ot("onSelectionDrag",O,ie.setState),ot("onSelectionDragStart",S,ie.setState),ot("onSelectionDragStop",$,ie.setState),ot("noPanClassName",E,ie.setState),ot("nodeOrigin",W,ie.setState),ot("rfId",G,ie.setState),ot("autoPanOnConnect",q,ie.setState),ot("autoPanOnNodeDrag",Y,ie.setState),ot("onError",te,ie.setState),ot("connectionRadius",oe,ie.setState),ot("isValidConnection",se,ie.setState),ot("nodeDragThreshold",Z,ie.setState),xs(t,Q),xs(e,ue),xs(g,ce),xs(p,fe),xs(j,de),xs(b,ke),null},n2={display:"none"},WR={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},o2="react-flow__node-desc",r2="react-flow__edge-desc",qR=t=>t.ariaLiveMessage;function GR({rfId:t}){const e=mt(qR);return K.createElement("div",{id:`react-flow__aria-live-${t}`,"aria-live":"assertive","aria-atomic":"true",style:WR},e)}function YR({rfId:t,disableKeyboardA11y:e}){return K.createElement(K.Fragment,null,K.createElement("div",{id:`${o2}-${t}`,style:n2},"Press enter or space to select a node.",!e&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),K.createElement("div",{id:`${r2}-${t}`,style:n2},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!e&&K.createElement(GR,{rfId:t}))}var zi=(t=null,e={actInsideInputWithModifier:!0})=>{const[n,o]=M.useState(!1),r=M.useRef(!1),s=M.useRef(new Set([])),[i,a]=M.useMemo(()=>{if(t!==null){const l=(Array.isArray(t)?t:[t]).filter(u=>typeof u=="string").map(u=>u.split("+")),c=l.reduce((u,h)=>u.concat(...h),[]);return[l,c]}return[[],[]]},[t]);return M.useEffect(()=>{const l=typeof document<"u"?document:null,c=(e==null?void 0:e.target)||l;if(t!==null){const u=m=>{if(r.current=m.ctrlKey||m.metaKey||m.shiftKey,(!r.current||r.current&&!e.actInsideInputWithModifier)&&Bh(m))return!1;const _=i2(m.code,a);s.current.add(m[_]),s2(i,s.current,!1)&&(m.preventDefault(),o(!0))},h=m=>{if((!r.current||r.current&&!e.actInsideInputWithModifier)&&Bh(m))return!1;const _=i2(m.code,a);s2(i,s.current,!0)?(o(!1),s.current.clear()):s.current.delete(m[_]),m.key==="Meta"&&s.current.clear(),r.current=!1},f=()=>{s.current.clear(),o(!1)};return c==null||c.addEventListener("keydown",u),c==null||c.addEventListener("keyup",h),window.addEventListener("blur",f),()=>{c==null||c.removeEventListener("keydown",u),c==null||c.removeEventListener("keyup",h),window.removeEventListener("blur",f)}}},[t,o]),n};function s2(t,e,n){return t.filter(o=>n||o.length===e.size).some(o=>o.every(r=>e.has(r)))}function i2(t,e){return e.includes(t)?"code":"key"}function a2(t,e,n,o){var a,l;const r=t.parentNode||t.parentId;if(!r)return n;const s=e.get(r),i=bs(s,o);return a2(s,e,{x:(n.x??0)+i.x,y:(n.y??0)+i.y,z:(((a=s[kt])==null?void 0:a.z)??0)>(n.z??0)?((l=s[kt])==null?void 0:l.z)??0:n.z??0},o)}function l2(t,e,n){t.forEach(o=>{var s;const r=o.parentNode||o.parentId;if(r&&!t.has(r))throw new Error(`Parent node ${r} not found`);if(r||n!=null&&n[o.id]){const{x:i,y:a,z:l}=a2(o,t,{...o.position,z:((s=o[kt])==null?void 0:s.z)??0},e);o.positionAbsolute={x:i,y:a},o[kt].z=l,n!=null&&n[o.id]&&(o[kt].isParent=!0)}})}function ef(t,e,n,o){const r=new Map,s={},i=o?1e3:0;return t.forEach(a=>{var m;const l=(zn(a.zIndex)?a.zIndex:0)+(a.selected?i:0),c=e.get(a.id),u={...a,positionAbsolute:{x:a.position.x,y:a.position.y}},h=a.parentNode||a.parentId;h&&(s[h]=!0);const f=(c==null?void 0:c.type)&&(c==null?void 0:c.type)!==a.type;Object.defineProperty(u,kt,{enumerable:!1,value:{handleBounds:f||(m=c==null?void 0:c[kt])==null?void 0:m.handleBounds,z:l}}),r.set(a.id,u)}),l2(r,n,s),r}function c2(t,e={}){const{getNodes:n,width:o,height:r,minZoom:s,maxZoom:i,d3Zoom:a,d3Selection:l,fitViewOnInitDone:c,fitViewOnInit:u,nodeOrigin:h}=t(),f=e.initial&&!c&&u;if(a&&l&&(f||!e.initial)){const m=n().filter(g=>{var b;const p=e.includeHiddenNodes?g.width&&g.height:!g.hidden;return(b=e.nodes)!=null&&b.length?p&&e.nodes.some(x=>x.id===g.id):p}),_=m.every(g=>g.width&&g.height);if(m.length>0&&_){const g=Jh(m,h),{x:p,y:b,zoom:x}=$v(g,o,r,e.minZoom??s,e.maxZoom??i,e.padding??.1),y=pr.translate(p,b).scale(x);return typeof e.duration=="number"&&e.duration>0?a.transform(Er(l,e.duration),y):a.transform(l,y),!0}}return!1}function JR(t,e){return t.forEach(n=>{const o=e.get(n.id);o&&e.set(o.id,{...o,[kt]:o[kt],selected:n.selected})}),new Map(e)}function KR(t,e){return e.map(n=>{const o=t.find(r=>r.id===n.id);return o&&(n.selected=o.selected),n})}function Hl({changedNodes:t,changedEdges:e,get:n,set:o}){const{nodeInternals:r,edges:s,onNodesChange:i,onEdgesChange:a,hasDefaultNodes:l,hasDefaultEdges:c}=n();t!=null&&t.length&&(l&&o({nodeInternals:JR(t,r)}),i==null||i(t)),e!=null&&e.length&&(c&&o({edges:KR(e,s)}),a==null||a(e))}const ys=()=>{},XR={zoomIn:ys,zoomOut:ys,zoomTo:ys,getZoom:()=>1,setViewport:ys,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:ys,fitBounds:ys,project:t=>t,screenToFlowPosition:t=>t,flowToScreenPosition:t=>t,viewportInitialized:!1},ZR=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection});function Bi(){const t=(()=>{const g=Ht(),{d3Zoom:p,d3Selection:b}=mt(ZR,tn);return M.useMemo(()=>b&&p?{zoomIn:y=>p.scaleBy(Er(b,y==null?void 0:y.duration),1.2),zoomOut:y=>p.scaleBy(Er(b,y==null?void 0:y.duration),1/1.2),zoomTo:(y,v)=>p.scaleTo(Er(b,v==null?void 0:v.duration),y),getZoom:()=>g.getState().transform[2],setViewport:(y,v)=>{const[C,k,N]=g.getState().transform,j=pr.translate(y.x??C,y.y??k).scale(y.zoom??N);p.transform(Er(b,v==null?void 0:v.duration),j)},getViewport:()=>{const[y,v,C]=g.getState().transform;return{x:y,y:v,zoom:C}},fitView:y=>c2(g.getState,y),setCenter:(y,v,C)=>{const{width:k,height:N,maxZoom:j}=g.getState(),I=(C==null?void 0:C.zoom)!==void 0?C.zoom:j,T=k/2-y*I,A=N/2-v*I,R=pr.translate(T,A).scale(I);p.transform(Er(b,C==null?void 0:C.duration),R)},fitBounds:(y,v)=>{const{width:C,height:k,minZoom:N,maxZoom:j}=g.getState(),{x:I,y:T,zoom:A}=$v(y,C,k,N,j,(v==null?void 0:v.padding)??.1),R=pr.translate(I,T).scale(A);p.transform(Er(b,v==null?void 0:v.duration),R)},project:y=>{const{transform:v,snapToGrid:C,snapGrid:k}=g.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),Yh(y,v,C,k)},screenToFlowPosition:y=>{const{transform:v,snapToGrid:C,snapGrid:k,domNode:N}=g.getState();if(!N)return y;const{x:j,y:I}=N.getBoundingClientRect(),T={x:y.x-j,y:y.y-I};return Yh(T,v,C,k)},flowToScreenPosition:y=>{const{transform:v,domNode:C}=g.getState();if(!C)return y;const{x:k,y:N}=C.getBoundingClientRect(),j=Bv(y,v);return{x:j.x+k,y:j.y+N}},viewportInitialized:!0}:XR,[p,b])})(),e=Ht(),n=M.useCallback(()=>e.getState().getNodes().map(g=>({...g})),[]),o=M.useCallback(g=>e.getState().nodeInternals.get(g),[]),r=M.useCallback(()=>{const{edges:g=[]}=e.getState();return g.map(p=>({...p}))},[]),s=M.useCallback(g=>{const{edges:p=[]}=e.getState();return p.find(b=>b.id===g)},[]),i=M.useCallback(g=>{const{getNodes:p,setNodes:b,hasDefaultNodes:x,onNodesChange:y}=e.getState(),v=p(),C=typeof g=="function"?g(v):g;if(x)b(C);else if(y){const k=C.length===0?v.map(N=>({type:"remove",id:N.id})):C.map(N=>({item:N,type:"reset"}));y(k)}},[]),a=M.useCallback(g=>{const{edges:p=[],setEdges:b,hasDefaultEdges:x,onEdgesChange:y}=e.getState(),v=typeof g=="function"?g(p):g;x?b(v):y&&y(v.length===0?p.map(C=>({type:"remove",id:C.id})):v.map(C=>({item:C,type:"reset"})))},[]),l=M.useCallback(g=>{const p=Array.isArray(g)?g:[g],{getNodes:b,setNodes:x,hasDefaultNodes:y,onNodesChange:v}=e.getState();if(y)x([...b(),...p]);else if(v){const C=p.map(k=>({item:k,type:"add"}));v(C)}},[]),c=M.useCallback(g=>{const p=Array.isArray(g)?g:[g],{edges:b=[],setEdges:x,hasDefaultEdges:y,onEdgesChange:v}=e.getState();y?x([...b,...p]):v&&v(p.map(C=>({item:C,type:"add"})))},[]),u=M.useCallback(()=>{const{getNodes:g,edges:p=[],transform:b}=e.getState(),[x,y,v]=b;return{nodes:g().map(C=>({...C})),edges:p.map(C=>({...C})),viewport:{x,y,zoom:v}}},[]),h=M.useCallback(({nodes:g,edges:p})=>{const{nodeInternals:b,getNodes:x,edges:y,hasDefaultNodes:v,hasDefaultEdges:C,onNodesDelete:k,onEdgesDelete:N,onNodesChange:j,onEdgesChange:I}=e.getState(),T=(g||[]).map(F=>F.id),A=(p||[]).map(F=>F.id),R=x().reduce((F,B)=>{const U=B.parentNode||B.parentId,O=!T.includes(B.id)&&U&&F.find(S=>S.id===U);return(typeof B.deletable!="boolean"||B.deletable)&&(T.includes(B.id)||O)&&F.push(B),F},[]),z=y.filter(F=>typeof F.deletable!="boolean"||F.deletable),D=z.filter(F=>A.includes(F.id));if(R||D){const F=Vv(R,z),B=[...D,...F],U=B.reduce((O,S)=>(O.includes(S.id)||O.push(S.id),O),[]);(C||v)&&(C&&e.setState({edges:y.filter(O=>!U.includes(O.id))}),v&&(R.forEach(O=>{b.delete(O.id)}),e.setState({nodeInternals:new Map(b)}))),U.length>0&&(N==null||N(B),I&&I(U.map(O=>({id:O,type:"remove"})))),R.length>0&&(k==null||k(R),j)&&j(R.map(O=>({id:O.id,type:"remove"})))}},[]),f=M.useCallback(g=>{const p=zn((b=g).width)&&zn(b.height)&&zn(b.x)&&zn(b.y);var b;const x=p?null:e.getState().nodeInternals.get(g.id);return!p&&!x?[null,null,p]:[p?g:Nv(x),x,p]},[]),m=M.useCallback((g,p=!0,b)=>{const[x,y,v]=f(g);return x?(b||e.getState().getNodes()).filter(C=>{if(!(v||C.id!==y.id&&C.positionAbsolute))return!1;const k=Nv(C),N=zh(k,x);return p&&N>0||N>=x.width*x.height}):[]},[]),_=M.useCallback((g,p,b=!0)=>{const[x]=f(g);if(!x)return!1;const y=zh(x,p);return b&&y>0||y>=x.width*x.height},[]);return M.useMemo(()=>({...t,getNodes:n,getNode:o,getEdges:r,getEdge:s,setNodes:i,setEdges:a,addNodes:l,addEdges:c,toObject:u,deleteElements:h,getIntersectingNodes:m,isNodeIntersecting:_}),[t,n,o,r,s,i,a,l,c,u,h,m,_])}const QR={actInsideInputWithModifier:!1},tf={position:"absolute",width:"100%",height:"100%",top:0,left:0},Wl=t=>({x:t.x,y:t.y,zoom:t.k}),ws=(t,e)=>t.target.closest(`.${e}`),d2=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),u2=t=>{const e=t.ctrlKey&&Fl()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e},eP=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection,d3ZoomHandler:t.d3ZoomHandler,userSelectionActive:t.userSelectionActive}),tP=({onMove:t,onMoveStart:e,onMoveEnd:n,onPaneContextMenu:o,zoomOnScroll:r=!0,zoomOnPinch:s=!0,panOnScroll:i=!1,panOnScrollSpeed:a=.5,panOnScrollMode:l=Qo.Free,zoomOnDoubleClick:c=!0,elementsSelectable:u,panOnDrag:h=!0,defaultViewport:f,translateExtent:m,minZoom:_,maxZoom:g,zoomActivationKeyCode:p,preventScrolling:b=!0,children:x,noWheelClassName:y,noPanClassName:v})=>{const C=M.useRef(),k=Ht(),N=M.useRef(!1),j=M.useRef(!1),I=M.useRef(null),T=M.useRef({x:0,y:0,zoom:0}),{d3Zoom:A,d3Selection:R,d3ZoomHandler:z,userSelectionActive:D}=mt(eP,tn),F=zi(p),B=M.useRef(0),U=M.useRef(!1),O=M.useRef();return function(S){const $=Ht();M.useEffect(()=>{let E;const W=()=>{var q,Y;if(!S.current)return;const G=Ph(S.current);G.height!==0&&G.width!==0||((Y=(q=$.getState()).onError)==null||Y.call(q,"004",kR())),$.setState({width:G.width||500,height:G.height||500})};return W(),window.addEventListener("resize",W),S.current&&(E=new ResizeObserver(()=>W()),E.observe(S.current)),()=>{window.removeEventListener("resize",W),E&&S.current&&E.unobserve(S.current)}},[])}(I),M.useEffect(()=>{if(I.current){const S=I.current.getBoundingClientRect(),$=function(){var Y,te,oe,se=gR,Z=_R,Q=yR,ue=bR,me=xR,ce=[0,1/0],fe=[[-1/0,-1/0],[1/0,1/0]],de=250,ke=aW,Se=GS("start","zoom","end"),ie=0,je=10;function pe(J){J.property("__zoom",wv).on("wheel.zoom",Qe,{passive:!1}).on("mousedown.zoom",tt).on("dblclick.zoom",ne).filter(me).on("touchstart.zoom",ve).on("touchmove.zoom",Ce).on("touchend.zoom touchcancel.zoom",Re).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function Ae(J,_e){return(_e=Math.max(ce[0],Math.min(ce[1],_e)))===J.k?J:new tp(_e,J.x,J.y)}function ze(J,_e,be){var ge=_e[0]-be[0]*J.k,le=_e[1]-be[1]*J.k;return ge===J.x&&le===J.y?J:new tp(J.k,ge,le)}function De(J){return[(+J[0][0]+ +J[1][0])/2,(+J[0][1]+ +J[1][1])/2]}function Ve(J,_e,be,ge){J.on("start.zoom",function(){Pe(this,arguments).event(ge).start()}).on("interrupt.zoom end.zoom",function(){Pe(this,arguments).event(ge).end()}).tween("zoom",function(){var le=this,We=arguments,Fe=Pe(le,We).event(ge),Xe=Z.apply(le,We),ae=be==null?De(Xe):typeof be=="function"?be.apply(le,We):be,Ee=Math.max(Xe[1][0]-Xe[0][0],Xe[1][1]-Xe[0][1]),Ie=le.__zoom,$e=typeof _e=="function"?_e.apply(le,We):_e,Je=ke(Ie.invert(ae).concat(Ee/Ie.k),$e.invert(ae).concat(Ee/$e.k));return function(Le){if(Le===1)Le=$e;else{var Ge=Je(Le),st=Ee/Ge[2];Le=new tp(st,ae[0]-Ge[0]*st,ae[1]-Ge[1]*st)}Fe.zoom(null,Le)}})}function Pe(J,_e,be){return!be&&J.__zooming||new rt(J,_e)}function rt(J,_e){this.that=J,this.args=_e,this.active=0,this.sourceEvent=null,this.extent=Z.apply(J,_e),this.taps=0}function Qe(J,..._e){if(se.apply(this,arguments)){var be=Pe(this,_e).event(J),ge=this.__zoom,le=Math.max(ce[0],Math.min(ce[1],ge.k*Math.pow(2,ue.apply(this,arguments)))),We=uo(J);if(be.wheel)be.mouse[0][0]===We[0]&&be.mouse[0][1]===We[1]||(be.mouse[1]=ge.invert(be.mouse[0]=We)),clearTimeout(be.wheel);else{if(ge.k===le)return;be.mouse=[We,ge.invert(We)],np(this),be.start()}Di(J),be.wheel=setTimeout(function(){be.wheel=null,be.end()},150),be.zoom("mouse",Q(ze(Ae(ge,le),be.mouse[0],be.mouse[1]),be.extent,fe))}}function tt(J,..._e){if(!oe&&se.apply(this,arguments)){var be=J.currentTarget,ge=Pe(this,_e,!0).event(J),le=to(J.view).on("mousemove.zoom",function(ae){if(Di(ae),!ge.moved){var Ee=ae.clientX-Fe,Ie=ae.clientY-Xe;ge.moved=Ee*Ee+Ie*Ie>ie}ge.event(ae).zoom("mouse",Q(ze(ge.that.__zoom,ge.mouse[0]=uo(ae,be),ge.mouse[1]),ge.extent,fe))},!0).on("mouseup.zoom",function(ae){le.on("mousemove.zoom mouseup.zoom",null),yv(ae.view,ge.moved),Di(ae),ge.event(ae).end()},!0),We=uo(J,be),Fe=J.clientX,Xe=J.clientY;xv(J.view),Rh(J),ge.mouse=[We,this.__zoom.invert(We)],np(this),ge.start()}}function ne(J,..._e){if(se.apply(this,arguments)){var be=this.__zoom,ge=uo(J.changedTouches?J.changedTouches[0]:J,this),le=be.invert(ge),We=be.k*(J.shiftKey?.5:2),Fe=Q(ze(Ae(be,We),ge,le),Z.apply(this,_e),fe);Di(J),de>0?to(this).transition().duration(de).call(Ve,Fe,ge,J):to(this).call(pe.transform,Fe,ge,J)}}function ve(J,..._e){if(se.apply(this,arguments)){var be,ge,le,We,Fe=J.touches,Xe=Fe.length,ae=Pe(this,_e,J.changedTouches.length===Xe).event(J);for(Rh(J),ge=0;ge<Xe;++ge)We=[We=uo(le=Fe[ge],this),this.__zoom.invert(We),le.identifier],ae.touch0?ae.touch1||ae.touch0[2]===We[2]||(ae.touch1=We,ae.taps=0):(ae.touch0=We,be=!0,ae.taps=1+!!Y);Y&&(Y=clearTimeout(Y)),be&&(ae.taps<2&&(te=We[0],Y=setTimeout(function(){Y=null},500)),np(this),ae.start())}}function Ce(J,..._e){if(this.__zooming){var be,ge,le,We,Fe=Pe(this,_e).event(J),Xe=J.changedTouches,ae=Xe.length;for(Di(J),be=0;be<ae;++be)le=uo(ge=Xe[be],this),Fe.touch0&&Fe.touch0[2]===ge.identifier?Fe.touch0[0]=le:Fe.touch1&&Fe.touch1[2]===ge.identifier&&(Fe.touch1[0]=le);if(ge=Fe.that.__zoom,Fe.touch1){var Ee=Fe.touch0[0],Ie=Fe.touch0[1],$e=Fe.touch1[0],Je=Fe.touch1[1],Le=(Le=$e[0]-Ee[0])*Le+(Le=$e[1]-Ee[1])*Le,Ge=(Ge=Je[0]-Ie[0])*Ge+(Ge=Je[1]-Ie[1])*Ge;ge=Ae(ge,Math.sqrt(Le/Ge)),le=[(Ee[0]+$e[0])/2,(Ee[1]+$e[1])/2],We=[(Ie[0]+Je[0])/2,(Ie[1]+Je[1])/2]}else{if(!Fe.touch0)return;le=Fe.touch0[0],We=Fe.touch0[1]}Fe.zoom("touch",Q(ze(ge,le,We),Fe.extent,fe))}}function Re(J,..._e){if(this.__zooming){var be,ge,le=Pe(this,_e).event(J),We=J.changedTouches,Fe=We.length;for(Rh(J),oe&&clearTimeout(oe),oe=setTimeout(function(){oe=null},500),be=0;be<Fe;++be)ge=We[be],le.touch0&&le.touch0[2]===ge.identifier?delete le.touch0:le.touch1&&le.touch1[2]===ge.identifier&&delete le.touch1;if(le.touch1&&!le.touch0&&(le.touch0=le.touch1,delete le.touch1),le.touch0)le.touch0[1]=this.__zoom.invert(le.touch0[0]);else if(le.end(),le.taps===2&&(ge=uo(ge,this),Math.hypot(te[0]-ge[0],te[1]-ge[1])<je)){var Xe=to(this).on("dblclick.zoom");Xe&&Xe.apply(this,arguments)}}}return pe.transform=function(J,_e,be,ge){var le=J.selection?J.selection():J;le.property("__zoom",wv),J!==le?Ve(J,_e,be,ge):le.interrupt().each(function(){Pe(this,arguments).event(ge).start().zoom(null,typeof _e=="function"?_e.apply(this,arguments):_e).end()})},pe.scaleBy=function(J,_e,be,ge){pe.scaleTo(J,function(){return this.__zoom.k*(typeof _e=="function"?_e.apply(this,arguments):_e)},be,ge)},pe.scaleTo=function(J,_e,be,ge){pe.transform(J,function(){var le=Z.apply(this,arguments),We=this.__zoom,Fe=be==null?De(le):typeof be=="function"?be.apply(this,arguments):be,Xe=We.invert(Fe),ae=typeof _e=="function"?_e.apply(this,arguments):_e;return Q(ze(Ae(We,ae),Fe,Xe),le,fe)},be,ge)},pe.translateBy=function(J,_e,be,ge){pe.transform(J,function(){return Q(this.__zoom.translate(typeof _e=="function"?_e.apply(this,arguments):_e,typeof be=="function"?be.apply(this,arguments):be),Z.apply(this,arguments),fe)},null,ge)},pe.translateTo=function(J,_e,be,ge,le){pe.transform(J,function(){var We=Z.apply(this,arguments),Fe=this.__zoom,Xe=ge==null?De(We):typeof ge=="function"?ge.apply(this,arguments):ge;return Q(pr.translate(Xe[0],Xe[1]).scale(Fe.k).translate(typeof _e=="function"?-_e.apply(this,arguments):-_e,typeof be=="function"?-be.apply(this,arguments):-be),We,fe)},ge,le)},rt.prototype={event:function(J){return J&&(this.sourceEvent=J),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(J,_e){return this.mouse&&J!=="mouse"&&(this.mouse[1]=_e.invert(this.mouse[0])),this.touch0&&J!=="touch"&&(this.touch0[1]=_e.invert(this.touch0[0])),this.touch1&&J!=="touch"&&(this.touch1[1]=_e.invert(this.touch1[0])),this.that.__zoom=_e,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(J){var _e=to(this.that).datum();Se.call(J,this.that,new pR(J,{sourceEvent:this.sourceEvent,target:pe,transform:this.that.__zoom,dispatch:Se}),_e)}},pe.wheelDelta=function(J){return arguments.length?(ue=typeof J=="function"?J:Rl(+J),pe):ue},pe.filter=function(J){return arguments.length?(se=typeof J=="function"?J:Rl(!!J),pe):se},pe.touchable=function(J){return arguments.length?(me=typeof J=="function"?J:Rl(!!J),pe):me},pe.extent=function(J){return arguments.length?(Z=typeof J=="function"?J:Rl([[+J[0][0],+J[0][1]],[+J[1][0],+J[1][1]]]),pe):Z},pe.scaleExtent=function(J){return arguments.length?(ce[0]=+J[0],ce[1]=+J[1],pe):[ce[0],ce[1]]},pe.translateExtent=function(J){return arguments.length?(fe[0][0]=+J[0][0],fe[1][0]=+J[1][0],fe[0][1]=+J[0][1],fe[1][1]=+J[1][1],pe):[[fe[0][0],fe[0][1]],[fe[1][0],fe[1][1]]]},pe.constrain=function(J){return arguments.length?(Q=J,pe):Q},pe.duration=function(J){return arguments.length?(de=+J,pe):de},pe.interpolate=function(J){return arguments.length?(ke=J,pe):ke},pe.on=function(){var J=Se.on.apply(Se,arguments);return J===Se?pe:J},pe.clickDistance=function(J){return arguments.length?(ie=(J=+J)*J,pe):Math.sqrt(ie)},pe.tapDistance=function(J){return arguments.length?(je=+J,pe):je},pe}().scaleExtent([_,g]).translateExtent(m),E=to(I.current).call($),W=pr.translate(f.x,f.y).scale(gs(f.zoom,_,g)),G=[[0,0],[S.width,S.height]],q=$.constrain()(W,G,m);$.transform(E,q),$.wheelDelta(u2),k.setState({d3Zoom:$,d3Selection:E,d3ZoomHandler:E.on("wheel.zoom"),transform:[q.x,q.y,q.k],domNode:I.current.closest(".react-flow")})}},[]),M.useEffect(()=>{R&&A&&(!i||F||D?z!==void 0&&R.on("wheel.zoom",function(S,$){if(!b&&S.type==="wheel"&&!S.ctrlKey||ws(S,y))return null;S.preventDefault(),z.call(this,S,$)},{passive:!1}):R.on("wheel.zoom",S=>{if(ws(S,y))return!1;S.preventDefault(),S.stopImmediatePropagation();const $=R.property("__zoom").k||1;if(S.ctrlKey&&s){const se=uo(S),Z=u2(S),Q=$*Math.pow(2,Z);return void A.scaleTo(R,Q,se,S)}const E=S.deltaMode===1?20:1;let W=l===Qo.Vertical?0:S.deltaX*E,G=l===Qo.Horizontal?0:S.deltaY*E;!Fl()&&S.shiftKey&&l!==Qo.Vertical&&(W=S.deltaY*E,G=0),A.translateBy(R,-W/$*a,-G/$*a,{internal:!0});const q=Wl(R.property("__zoom")),{onViewportChangeStart:Y,onViewportChange:te,onViewportChangeEnd:oe}=k.getState();clearTimeout(O.current),U.current||(U.current=!0,e==null||e(S,q),Y==null||Y(q)),U.current&&(t==null||t(S,q),te==null||te(q),O.current=setTimeout(()=>{n==null||n(S,q),oe==null||oe(q),U.current=!1},150))},{passive:!1}))},[D,i,l,R,A,z,F,s,b,y,e,t,n]),M.useEffect(()=>{A&&A.on("start",S=>{var W,G;if(!S.sourceEvent||S.sourceEvent.internal)return null;B.current=(W=S.sourceEvent)==null?void 0:W.button;const{onViewportChangeStart:$}=k.getState(),E=Wl(S.transform);N.current=!0,T.current=E,((G=S.sourceEvent)==null?void 0:G.type)==="mousedown"&&k.setState({paneDragging:!0}),$==null||$(E),e==null||e(S.sourceEvent,E)})},[A,e]),M.useEffect(()=>{A&&(D&&!N.current?A.on("zoom",null):D||A.on("zoom",S=>{var E;const{onViewportChange:$}=k.getState();if(k.setState({transform:[S.transform.x,S.transform.y,S.transform.k]}),j.current=!(!o||!d2(h,B.current??0)),(t||$)&&!((E=S.sourceEvent)!=null&&E.internal)){const W=Wl(S.transform);$==null||$(W),t==null||t(S.sourceEvent,W)}}))},[D,A,t,h,o]),M.useEffect(()=>{A&&A.on("end",S=>{if(!S.sourceEvent||S.sourceEvent.internal)return null;const{onViewportChangeEnd:$}=k.getState();if(N.current=!1,k.setState({paneDragging:!1}),o&&d2(h,B.current??0)&&!j.current&&o(S.sourceEvent),j.current=!1,(n||$)&&(E=T.current,W=S.transform,E.x!==W.x||E.y!==W.y||E.zoom!==W.k)){const G=Wl(S.transform);T.current=G,clearTimeout(C.current),C.current=setTimeout(()=>{$==null||$(G),n==null||n(S.sourceEvent,G)},i?150:0)}var E,W})},[A,i,h,n,o]),M.useEffect(()=>{A&&A.filter(S=>{const $=F||r,E=s&&S.ctrlKey;if((h===!0||Array.isArray(h)&&h.includes(1))&&S.button===1&&S.type==="mousedown"&&(ws(S,"react-flow__node")||ws(S,"react-flow__edge")))return!0;if(!(h||$||i||c||s)||D||!c&&S.type==="dblclick"||ws(S,y)&&S.type==="wheel"||ws(S,v)&&(S.type!=="wheel"||i&&S.type==="wheel"&&!F)||!s&&S.ctrlKey&&S.type==="wheel"||!$&&!i&&!E&&S.type==="wheel"||!h&&(S.type==="mousedown"||S.type==="touchstart")||Array.isArray(h)&&!h.includes(S.button)&&S.type==="mousedown")return!1;const W=Array.isArray(h)&&h.includes(S.button)||!S.button||S.button<=1;return(!S.ctrlKey||S.type==="wheel")&&W})},[D,A,r,s,i,c,h,u,F]),K.createElement("div",{className:"react-flow__renderer",ref:I,style:tf},x)},nP=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function oP(){const{userSelectionActive:t,userSelectionRect:e}=mt(nP,tn);return t&&e?K.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:e.width,height:e.height,transform:`translate(${e.x}px, ${e.y}px)`}}):null}function h2(t,e){const n=e.parentNode||e.parentId,o=t.find(r=>r.id===n);if(o){const r=e.position.x+e.width-o.width,s=e.position.y+e.height-o.height;if(r>0||s>0||e.position.x<0||e.position.y<0){if(o.style={...o.style},o.style.width=o.style.width??o.width,o.style.height=o.style.height??o.height,r>0&&(o.style.width+=r),s>0&&(o.style.height+=s),e.position.x<0){const i=Math.abs(e.position.x);o.position.x=o.position.x-i,o.style.width+=i,e.position.x=0}if(e.position.y<0){const i=Math.abs(e.position.y);o.position.y=o.position.y-i,o.style.height+=i,e.position.y=0}o.width=o.style.width,o.height=o.style.height}}}function f2(t,e){if(t.some(o=>o.type==="reset"))return t.filter(o=>o.type==="reset").map(o=>o.item);const n=t.filter(o=>o.type==="add").map(o=>o.item);return e.reduce((o,r)=>{const s=t.filter(a=>a.id===r.id);if(s.length===0)return o.push(r),o;const i={...r};for(const a of s)if(a)switch(a.type){case"select":i.selected=a.selected;break;case"position":a.position!==void 0&&(i.position=a.position),a.positionAbsolute!==void 0&&(i.positionAbsolute=a.positionAbsolute),a.dragging!==void 0&&(i.dragging=a.dragging),i.expandParent&&h2(o,i);break;case"dimensions":a.dimensions!==void 0&&(i.width=a.dimensions.width,i.height=a.dimensions.height),a.updateStyle!==void 0&&(i.style={...i.style||{},...a.dimensions}),typeof a.resizing=="boolean"&&(i.resizing=a.resizing),i.expandParent&&h2(o,i);break;case"remove":return o}return o.push(i),o},n)}function m2(t,e){return f2(t,e)}const nr=(t,e)=>({id:t,type:"select",selected:e});function vs(t,e){return t.reduce((n,o)=>{const r=e.includes(o.id);return!o.selected&&r?(o.selected=!0,n.push(nr(o.id,!0))):o.selected&&!r&&(o.selected=!1,n.push(nr(o.id,!1))),n},[])}const nf=(t,e)=>n=>{n.target===e.current&&(t==null||t(n))},rP=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,dragging:t.paneDragging}),p2=M.memo(({isSelecting:t,selectionMode:e=Li.Full,panOnDrag:n,onSelectionStart:o,onSelectionEnd:r,onPaneClick:s,onPaneContextMenu:i,onPaneScroll:a,onPaneMouseEnter:l,onPaneMouseMove:c,onPaneMouseLeave:u,children:h})=>{const f=M.useRef(null),m=Ht(),_=M.useRef(0),g=M.useRef(0),p=M.useRef(),{userSelectionActive:b,elementsSelectable:x,dragging:y}=mt(rP,tn),v=()=>{m.setState({userSelectionActive:!1,userSelectionRect:null}),_.current=0,g.current=0},C=j=>{s==null||s(j),m.getState().resetSelectedElements(),m.setState({nodesSelectionActive:!1})},k=a?j=>a(j):void 0,N=x&&(t||b);return K.createElement("div",{className:dn(["react-flow__pane",{dragging:y,selection:t}]),onClick:N?void 0:nf(C,f),onContextMenu:nf(j=>{Array.isArray(n)&&(n!=null&&n.includes(2))?j.preventDefault():i==null||i(j)},f),onWheel:nf(k,f),onMouseEnter:N?void 0:l,onMouseDown:N?j=>{const{resetSelectedElements:I,domNode:T}=m.getState();if(p.current=T==null?void 0:T.getBoundingClientRect(),!x||!t||j.button!==0||j.target!==f.current||!p.current)return;const{x:A,y:R}=Zo(j,p.current);I(),m.setState({userSelectionRect:{width:0,height:0,startX:A,startY:R,x:A,y:R}}),o==null||o(j)}:void 0,onMouseMove:N?j=>{const{userSelectionRect:I,nodeInternals:T,edges:A,transform:R,onNodesChange:z,onEdgesChange:D,nodeOrigin:F,getNodes:B}=m.getState();if(!t||!p.current||!I)return;m.setState({userSelectionActive:!0,nodesSelectionActive:!1});const U=Zo(j,p.current),O=I.startX??0,S=I.startY??0,$={...I,x:U.x<O?U.x:O,y:U.y<S?U.y:S,width:Math.abs(U.x-O),height:Math.abs(U.y-S)},E=B(),W=Uv(T,$,R,e===Li.Partial,!0,F),G=Vv(W,A).map(Y=>Y.id),q=W.map(Y=>Y.id);if(_.current!==q.length){_.current=q.length;const Y=vs(E,q);Y.length&&(z==null||z(Y))}if(g.current!==G.length){g.current=G.length;const Y=vs(A,G);Y.length&&(D==null||D(Y))}m.setState({userSelectionRect:$})}:c,onMouseUp:N?j=>{if(j.button!==0)return;const{userSelectionRect:I}=m.getState();!b&&I&&j.target===f.current&&(C==null||C(j)),m.setState({nodesSelectionActive:_.current>0}),v(),r==null||r(j)}:void 0,onMouseLeave:N?j=>{b&&(m.setState({nodesSelectionActive:_.current>0}),r==null||r(j)),v()}:u,ref:f,style:tf},h,K.createElement(oP,null))});function g2(t,e){const n=t.parentNode||t.parentId;if(!n)return!1;const o=e.get(n);return!!o&&(!!o.selected||g2(o,e))}function _2(t,e,n){let o=t;do{if(o!=null&&o.matches(e))return!0;if(o===n.current)return!1;o=o.parentElement}while(o);return!1}function sP(t,e,n,o){return Array.from(t.values()).filter(r=>(r.selected||r.id===o)&&(!r.parentNode||r.parentId||!g2(r,t))&&(r.draggable||e&&r.draggable===void 0)).map(r=>{var s,i;return{id:r.id,position:r.position||{x:0,y:0},positionAbsolute:r.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((s=r.positionAbsolute)==null?void 0:s.x)??0),y:n.y-(((i=r.positionAbsolute)==null?void 0:i.y)??0)},delta:{x:0,y:0},extent:r.extent,parentNode:r.parentNode||r.parentId,parentId:r.parentNode||r.parentId,width:r.width,height:r.height,expandParent:r.expandParent}})}function b2(t,e,n,o,r=[0,0],s){const i=function(h,f){return f&&f!=="parent"?[f[0],[f[1][0]-(h.width||0),f[1][1]-(h.height||0)]]:f}(t,t.extent||o);let a=i;const l=t.parentNode||t.parentId;if(t.extent!=="parent"||t.expandParent){if(t.extent&&l&&t.extent!=="parent"){const h=n.get(l),{x:f,y:m}=bs(h,r).positionAbsolute;a=[[t.extent[0][0]+f,t.extent[0][1]+m],[t.extent[1][0]+f,t.extent[1][1]+m]]}}else if(l&&t.width&&t.height){const h=n.get(l),{x:f,y:m}=bs(h,r).positionAbsolute;a=h&&zn(f)&&zn(m)&&zn(h.width)&&zn(h.height)?[[f+t.width*r[0],m+t.height*r[1]],[f+h.width-t.width+t.width*r[0],m+h.height-t.height+t.height*r[1]]]:a}else s==null||s("005",SR()),a=i;let c={x:0,y:0};if(l){const h=n.get(l);c=bs(h,r).positionAbsolute}const u=a&&a!=="parent"?Lh(e,a):e;return{position:{x:u.x-c.x,y:u.y-c.y},positionAbsolute:u}}function of({nodeId:t,dragItems:e,nodeInternals:n}){const o=e.map(r=>({...n.get(r.id),position:r.position,positionAbsolute:r.positionAbsolute}));return[t?o.find(r=>r.id===t):o[0],o]}p2.displayName="Pane";const x2=(t,e,n,o)=>{const r=e.querySelectorAll(t);if(!r||!r.length)return null;const s=Array.from(r),i=e.getBoundingClientRect(),a=i.width*o[0],l=i.height*o[1];return s.map(c=>{const u=c.getBoundingClientRect();return{id:c.getAttribute("data-handleid"),position:c.getAttribute("data-handlepos"),x:(u.left-i.left-a)/n,y:(u.top-i.top-l)/n,...Ph(c)}})};function Ui(t,e,n){return n===void 0?n:o=>{const r=e().nodeInternals.get(t);r&&n(o,{...r})}}function rf({id:t,store:e,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:s,multiSelectionActive:i,nodeInternals:a,onError:l}=e.getState(),c=a.get(t);c?(e.setState({nodesSelectionActive:!1}),c.selected?(n||c.selected&&i)&&(s({nodes:[c],edges:[]}),requestAnimationFrame(()=>{var u;return(u=o==null?void 0:o.current)==null?void 0:u.blur()})):r([t])):l==null||l("012",IR(t))}function sf(t){return(e,n,o)=>t==null?void 0:t(e,o)}function y2({nodeRef:t,disabled:e=!1,noDragClassName:n,handleSelector:o,nodeId:r,isSelectable:s,selectNodesOnDrag:i}){const a=Ht(),[l,c]=M.useState(!1),u=M.useRef([]),h=M.useRef({x:null,y:null}),f=M.useRef(0),m=M.useRef(null),_=M.useRef({x:0,y:0}),g=M.useRef(null),p=M.useRef(!1),b=M.useRef(!1),x=M.useRef(!1),y=function(){const v=Ht();return M.useCallback(({sourceEvent:k})=>{const{transform:N,snapGrid:j,snapToGrid:I}=v.getState(),T=k.touches?k.touches[0].clientX:k.clientX,A=k.touches?k.touches[0].clientY:k.clientY,R={x:(T-N[0])/N[2],y:(A-N[1])/N[2]};return{xSnapped:I?j[0]*Math.round(R.x/j[0]):R.x,ySnapped:I?j[1]*Math.round(R.y/j[1]):R.y,...R}},[])}();return M.useEffect(()=>{if(t!=null&&t.current){const v=to(t.current),C=({x:j,y:I})=>{const{nodeInternals:T,onNodeDrag:A,onSelectionDrag:R,updateNodePositions:z,nodeExtent:D,snapGrid:F,snapToGrid:B,nodeOrigin:U,onError:O}=a.getState();h.current={x:j,y:I};let S=!1,$={x:0,y:0,x2:0,y2:0};if(u.current.length>1&&D){const W=Jh(u.current,U);$=Fh(W)}if(u.current=u.current.map(W=>{const G={x:j-W.distance.x,y:I-W.distance.y};B&&(G.x=F[0]*Math.round(G.x/F[0]),G.y=F[1]*Math.round(G.y/F[1]));const q=[[D[0][0],D[0][1]],[D[1][0],D[1][1]]];u.current.length>1&&D&&!W.extent&&(q[0][0]=W.positionAbsolute.x-$.x+D[0][0],q[1][0]=W.positionAbsolute.x+(W.width??0)-$.x2+D[1][0],q[0][1]=W.positionAbsolute.y-$.y+D[0][1],q[1][1]=W.positionAbsolute.y+(W.height??0)-$.y2+D[1][1]);const Y=b2(W,G,T,q,U,O);return S=S||W.position.x!==Y.position.x||W.position.y!==Y.position.y,W.position=Y.position,W.positionAbsolute=Y.positionAbsolute,W}),!S)return;z(u.current,!0,!0),c(!0);const E=r?A:sf(R);if(E&&g.current){const[W,G]=of({nodeId:r,dragItems:u.current,nodeInternals:T});E(g.current,W,G)}},k=()=>{if(!m.current)return;const[j,I]=Sv(_.current,m.current);if(j!==0||I!==0){const{transform:T,panBy:A}=a.getState();h.current.x=(h.current.x??0)-j/T[2],h.current.y=(h.current.y??0)-I/T[2],A({x:j,y:I})&&C(h.current)}f.current=requestAnimationFrame(k)},N=j=>{var U;const{nodeInternals:I,multiSelectionActive:T,nodesDraggable:A,unselectNodesAndEdges:R,onNodeDragStart:z,onSelectionDragStart:D}=a.getState();b.current=!0;const F=r?z:sf(D);i&&s||T||!r||(U=I.get(r))!=null&&U.selected||R(),r&&s&&i&&rf({id:r,store:a,nodeRef:t});const B=y(j);if(h.current=B,u.current=sP(I,A,B,r),F&&u.current){const[O,S]=of({nodeId:r,dragItems:u.current,nodeInternals:I});F(j.sourceEvent,O,S)}};if(!e){const j=function(){var I,T,A,R,z=uR,D=hR,F=fR,B=mR,U={},O=GS("start","drag","end"),S=0,$=0;function E(Z){Z.on("mousedown.drag",W).filter(B).on("touchstart.drag",Y).on("touchmove.drag",te,dR).on("touchend.drag touchcancel.drag",oe).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function W(Z,Q){if(!R&&z.call(this,Z,Q)){var ue=se(this,D.call(this,Z,Q),Z,Q,"mouse");ue&&(to(Z.view).on("mousemove.drag",G,Oi).on("mouseup.drag",q,Oi),xv(Z.view),Oh(Z),A=!1,I=Z.clientX,T=Z.clientY,ue("start",Z))}}function G(Z){if(ps(Z),!A){var Q=Z.clientX-I,ue=Z.clientY-T;A=Q*Q+ue*ue>$}U.mouse("drag",Z)}function q(Z){to(Z.view).on("mousemove.drag mouseup.drag",null),yv(Z.view,A),ps(Z),U.mouse("end",Z)}function Y(Z,Q){if(z.call(this,Z,Q)){var ue,me,ce=Z.changedTouches,fe=D.call(this,Z,Q),de=ce.length;for(ue=0;ue<de;++ue)(me=se(this,fe,Z,Q,ce[ue].identifier,ce[ue]))&&(Oh(Z),me("start",Z,ce[ue]))}}function te(Z){var Q,ue,me=Z.changedTouches,ce=me.length;for(Q=0;Q<ce;++Q)(ue=U[me[Q].identifier])&&(ps(Z),ue("drag",Z,me[Q]))}function oe(Z){var Q,ue,me=Z.changedTouches,ce=me.length;for(R&&clearTimeout(R),R=setTimeout(function(){R=null},500),Q=0;Q<ce;++Q)(ue=U[me[Q].identifier])&&(Oh(Z),ue("end",Z,me[Q]))}function se(Z,Q,ue,me,ce,fe){var de,ke,Se,ie=O.copy(),je=uo(fe||ue,Q);if((Se=F.call(Z,new Dh("beforestart",{sourceEvent:ue,target:E,identifier:ce,active:S,x:je[0],y:je[1],dx:0,dy:0,dispatch:ie}),me))!=null)return de=Se.x-je[0]||0,ke=Se.y-je[1]||0,function pe(Ae,ze,De){var Ve,Pe=je;switch(Ae){case"start":U[ce]=pe,Ve=S++;break;case"end":delete U[ce],--S;case"drag":je=uo(De||ze,Q),Ve=S}ie.call(Ae,Z,new Dh(Ae,{sourceEvent:ze,subject:Se,target:E,identifier:ce,active:Ve,x:je[0]+de,y:je[1]+ke,dx:je[0]-Pe[0],dy:je[1]-Pe[1],dispatch:ie}),me)}}return E.filter=function(Z){return arguments.length?(z=typeof Z=="function"?Z:Dl(!!Z),E):z},E.container=function(Z){return arguments.length?(D=typeof Z=="function"?Z:Dl(Z),E):D},E.subject=function(Z){return arguments.length?(F=typeof Z=="function"?Z:Dl(Z),E):F},E.touchable=function(Z){return arguments.length?(B=typeof Z=="function"?Z:Dl(!!Z),E):B},E.on=function(){var Z=O.on.apply(O,arguments);return Z===O?E:Z},E.clickDistance=function(Z){return arguments.length?($=(Z=+Z)*Z,E):Math.sqrt($)},E}().on("start",I=>{const{domNode:T,nodeDragThreshold:A}=a.getState();A===0&&N(I),x.current=!1;const R=y(I);h.current=R,m.current=(T==null?void 0:T.getBoundingClientRect())||null,_.current=Zo(I.sourceEvent,m.current)}).on("drag",I=>{var z,D;const T=y(I),{autoPanOnNodeDrag:A,nodeDragThreshold:R}=a.getState();if(I.sourceEvent.type==="touchmove"&&I.sourceEvent.touches.length>1&&(x.current=!0),!x.current){if(!p.current&&b.current&&A&&(p.current=!0,k()),!b.current){const F=T.xSnapped-(((z=h==null?void 0:h.current)==null?void 0:z.x)??0),B=T.ySnapped-(((D=h==null?void 0:h.current)==null?void 0:D.y)??0);Math.sqrt(F*F+B*B)>R&&N(I)}(h.current.x!==T.xSnapped||h.current.y!==T.ySnapped)&&u.current&&b.current&&(g.current=I.sourceEvent,_.current=Zo(I.sourceEvent,m.current),C(T))}}).on("end",I=>{if(b.current&&!x.current&&(c(!1),p.current=!1,b.current=!1,cancelAnimationFrame(f.current),u.current)){const{updateNodePositions:T,nodeInternals:A,onNodeDragStop:R,onSelectionDragStop:z}=a.getState(),D=r?R:sf(z);if(T(u.current,!1,!1),D){const[F,B]=of({nodeId:r,dragItems:u.current,nodeInternals:A});D(I.sourceEvent,F,B)}}}).filter(I=>{const T=I.target;return!I.button&&(!n||!_2(T,`.${n}`,t))&&(!o||_2(T,o,t))});return v.call(j),()=>{v.on(".drag",null)}}v.on(".drag",null)}},[t,e,n,o,s,a,r,i,y]),l}function w2(){const t=Ht();return M.useCallback(n=>{const{nodeInternals:o,nodeExtent:r,updateNodePositions:s,getNodes:i,snapToGrid:a,snapGrid:l,onError:c,nodesDraggable:u}=t.getState(),h=i().filter(x=>x.selected&&(x.draggable||u&&x.draggable===void 0)),f=a?l[0]:5,m=a?l[1]:5,_=n.isShiftPressed?4:1,g=n.x*f*_,p=n.y*m*_,b=h.map(x=>{if(x.positionAbsolute){const y={x:x.positionAbsolute.x+g,y:x.positionAbsolute.y+p};a&&(y.x=l[0]*Math.round(y.x/l[0]),y.y=l[1]*Math.round(y.y/l[1]));const{positionAbsolute:v,position:C}=b2(x,y,o,r,void 0,c);x.position=C,x.positionAbsolute=v}return x});s(b,!0,!1)},[])}const ks={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var Vi=t=>{const e=({id:n,type:o,data:r,xPos:s,yPos:i,xPosOrigin:a,yPosOrigin:l,selected:c,onClick:u,onMouseEnter:h,onMouseMove:f,onMouseLeave:m,onContextMenu:_,onDoubleClick:g,style:p,className:b,isDraggable:x,isSelectable:y,isConnectable:v,isFocusable:C,selectNodesOnDrag:k,sourcePosition:N,targetPosition:j,hidden:I,resizeObserver:T,dragHandle:A,zIndex:R,isParent:z,noDragClassName:D,noPanClassName:F,initialized:B,disableKeyboardA11y:U,ariaLabel:O,rfId:S,hasHandleBounds:$})=>{const E=Ht(),W=M.useRef(null),G=M.useRef(null),q=M.useRef(N),Y=M.useRef(j),te=M.useRef(o),oe=y||x||u||h||f||m,se=w2(),Z=Ui(n,E.getState,h),Q=Ui(n,E.getState,f),ue=Ui(n,E.getState,m),me=Ui(n,E.getState,_),ce=Ui(n,E.getState,g);M.useEffect(()=>()=>{G.current&&(T==null||T.unobserve(G.current),G.current=null)},[]),M.useEffect(()=>{if(W.current&&!I){const de=W.current;B&&$&&G.current===de||(G.current&&(T==null||T.unobserve(G.current)),T==null||T.observe(de),G.current=de)}},[I,B,$]),M.useEffect(()=>{const de=te.current!==o,ke=q.current!==N,Se=Y.current!==j;W.current&&(de||ke||Se)&&(de&&(te.current=o),ke&&(q.current=N),Se&&(Y.current=j),E.getState().updateNodeDimensions([{id:n,nodeElement:W.current,forceUpdate:!0}]))},[n,o,N,j]);const fe=y2({nodeRef:W,disabled:I||!x,noDragClassName:D,handleSelector:A,nodeId:n,isSelectable:y,selectNodesOnDrag:k});return I?null:K.createElement("div",{className:dn(["react-flow__node",`react-flow__node-${o}`,{[F]:x},b,{selected:c,selectable:y,parent:z,dragging:fe}]),ref:W,style:{zIndex:R,transform:`translate(${a}px,${l}px)`,pointerEvents:oe?"all":"none",visibility:B?"visible":"hidden",...p},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:Z,onMouseMove:Q,onMouseLeave:ue,onContextMenu:me,onClick:de=>{const{nodeDragThreshold:ke}=E.getState();if(y&&(!k||!x||ke>0)&&rf({id:n,store:E,nodeRef:W}),u){const Se=E.getState().nodeInternals.get(n);Se&&u(de,{...Se})}},onDoubleClick:ce,onKeyDown:C?de=>{if(!Bh(de)&&!U)if(jv.includes(de.key)&&y){const ke=de.key==="Escape";rf({id:n,store:E,unselect:ke,nodeRef:W})}else x&&c&&Object.prototype.hasOwnProperty.call(ks,de.key)&&(E.setState({ariaLiveMessage:`Moved selected node ${de.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~s}, y: ${~~i}`}),se({x:ks[de.key].x,y:ks[de.key].y,isShiftPressed:de.shiftKey}))}:void 0,tabIndex:C?0:void 0,role:C?"button":void 0,"aria-describedby":U?void 0:`${o2}-${S}`,"aria-label":O},K.createElement(DR,{value:n},K.createElement(t,{id:n,data:r,type:o,xPos:s,yPos:i,selected:c,isConnectable:v,sourcePosition:N,targetPosition:j,dragging:fe,dragHandle:A,zIndex:R})))};return e.displayName="NodeWrapper",M.memo(e)};const iP=t=>{const e=t.getNodes().filter(n=>n.selected);return{...Jh(e,t.nodeOrigin),transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`,userSelectionActive:t.userSelectionActive}};var aP=M.memo(function({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:n}){const o=Ht(),{width:r,height:s,x:i,y:a,transformString:l,userSelectionActive:c}=mt(iP,tn),u=w2(),h=M.useRef(null);if(M.useEffect(()=>{var m;n||((m=h.current)==null||m.focus({preventScroll:!0}))},[n]),y2({nodeRef:h}),c||!r||!s)return null;const f=t?m=>{const _=o.getState().getNodes().filter(g=>g.selected);t(m,_)}:void 0;return K.createElement("div",{className:dn(["react-flow__nodesselection","react-flow__container",e]),style:{transform:l}},K.createElement("div",{ref:h,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:m=>{Object.prototype.hasOwnProperty.call(ks,m.key)&&u({x:ks[m.key].x,y:ks[m.key].y,isShiftPressed:m.shiftKey})},style:{width:r,height:s,top:a,left:i}}))});const lP=t=>t.nodesSelectionActive,v2=({children:t,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:i,deleteKeyCode:a,onMove:l,onMoveStart:c,onMoveEnd:u,selectionKeyCode:h,selectionOnDrag:f,selectionMode:m,onSelectionStart:_,onSelectionEnd:g,multiSelectionKeyCode:p,panActivationKeyCode:b,zoomActivationKeyCode:x,elementsSelectable:y,zoomOnScroll:v,zoomOnPinch:C,panOnScroll:k,panOnScrollSpeed:N,panOnScrollMode:j,zoomOnDoubleClick:I,panOnDrag:T,defaultViewport:A,translateExtent:R,minZoom:z,maxZoom:D,preventScrolling:F,onSelectionContextMenu:B,noWheelClassName:U,noPanClassName:O,disableKeyboardA11y:S})=>{const $=mt(lP),E=zi(h),W=zi(b),G=W||T,q=W||k,Y=E||f&&G!==!0;return(({deleteKeyCode:te,multiSelectionKeyCode:oe})=>{const se=Ht(),{deleteElements:Z}=Bi(),Q=zi(te,QR),ue=zi(oe);M.useEffect(()=>{if(Q){const{edges:me,getNodes:ce}=se.getState(),fe=ce().filter(ke=>ke.selected),de=me.filter(ke=>ke.selected);Z({nodes:fe,edges:de}),se.setState({nodesSelectionActive:!1})}},[Q]),M.useEffect(()=>{se.setState({multiSelectionActive:ue})},[ue])})({deleteKeyCode:a,multiSelectionKeyCode:p}),K.createElement(tP,{onMove:l,onMoveStart:c,onMoveEnd:u,onPaneContextMenu:s,elementsSelectable:y,zoomOnScroll:v,zoomOnPinch:C,panOnScroll:q,panOnScrollSpeed:N,panOnScrollMode:j,zoomOnDoubleClick:I,panOnDrag:!E&&G,defaultViewport:A,translateExtent:R,minZoom:z,maxZoom:D,zoomActivationKeyCode:x,preventScrolling:F,noWheelClassName:U,noPanClassName:O},K.createElement(p2,{onSelectionStart:_,onSelectionEnd:g,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:i,panOnDrag:G,isSelecting:!!Y,selectionMode:m},t,$&&K.createElement(aP,{onSelectionContextMenu:B,noPanClassName:O,disableKeyboardA11y:S})))};v2.displayName="FlowRenderer";var cP=M.memo(v2);function dP(t){return{input:Vi(t.input||Zv),default:Vi(t.default||Zh),output:Vi(t.output||e2),group:Vi(t.group||Qh),...Object.keys(t).filter(e=>!["input","default","output","group"].includes(e)).reduce((e,n)=>(e[n]=Vi(t[n]||Zh),e),{})}}const uP=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,updateNodeDimensions:t.updateNodeDimensions,onError:t.onError}),k2=t=>{const{nodesDraggable:e,nodesConnectable:n,nodesFocusable:o,elementsSelectable:r,updateNodeDimensions:s,onError:i}=mt(uP,tn),a=(l=t.onlyRenderVisibleElements,mt(M.useCallback(h=>l?Uv(h.nodeInternals,{x:0,y:0,width:h.width,height:h.height},h.transform,!0):h.getNodes(),[l])));var l;const c=M.useRef(),u=M.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const h=new ResizeObserver(f=>{const m=f.map(_=>({id:_.target.getAttribute("data-id"),nodeElement:_.target,forceUpdate:!0}));s(m)});return c.current=h,h},[]);return M.useEffect(()=>()=>{var h;(h=c==null?void 0:c.current)==null||h.disconnect()},[]),K.createElement("div",{className:"react-flow__nodes",style:tf},a.map(h=>{var k,N,j;let f=h.type||"default";t.nodeTypes[f]||(i==null||i("003",vR(f)),f="default");const m=t.nodeTypes[f]||t.nodeTypes.default,_=!!(h.draggable||e&&h.draggable===void 0),g=!!(h.selectable||r&&h.selectable===void 0),p=!!(h.connectable||n&&h.connectable===void 0),b=!!(h.focusable||o&&h.focusable===void 0),x=t.nodeExtent?Lh(h.positionAbsolute,t.nodeExtent):h.positionAbsolute,y=(x==null?void 0:x.x)??0,v=(x==null?void 0:x.y)??0,C=(({x:I,y:T,width:A,height:R,origin:z})=>A&&R?z[0]<0||z[1]<0||z[0]>1||z[1]>1?{x:I,y:T}:{x:I-A*z[0],y:T-R*z[1]}:{x:I,y:T})({x:y,y:v,width:h.width??0,height:h.height??0,origin:t.nodeOrigin});return K.createElement(m,{key:h.id,id:h.id,className:h.className,style:h.style,type:f,data:h.data,sourcePosition:h.sourcePosition||Be.Bottom,targetPosition:h.targetPosition||Be.Top,hidden:h.hidden,xPos:y,yPos:v,xPosOrigin:C.x,yPosOrigin:C.y,selectNodesOnDrag:t.selectNodesOnDrag,onClick:t.onNodeClick,onMouseEnter:t.onNodeMouseEnter,onMouseMove:t.onNodeMouseMove,onMouseLeave:t.onNodeMouseLeave,onContextMenu:t.onNodeContextMenu,onDoubleClick:t.onNodeDoubleClick,selected:!!h.selected,isDraggable:_,isSelectable:g,isConnectable:p,isFocusable:b,resizeObserver:u,dragHandle:h.dragHandle,zIndex:((k=h[kt])==null?void 0:k.z)??0,isParent:!!((N=h[kt])!=null&&N.isParent),noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,initialized:!!h.width&&!!h.height,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,ariaLabel:h.ariaLabel,hasHandleBounds:!!((j=h[kt])!=null&&j.handleBounds)})}))};k2.displayName="NodeRenderer";var hP=M.memo(k2);const fP=(t,e,n)=>n===Be.Left?t-e:n===Be.Right?t+e:t,mP=(t,e,n)=>n===Be.Top?t-e:n===Be.Bottom?t+e:t,S2="react-flow__edgeupdater",C2=({position:t,centerX:e,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:s,onMouseOut:i,type:a})=>K.createElement("circle",{onMouseDown:r,onMouseEnter:s,onMouseOut:i,className:dn([S2,`${S2}-${a}`]),cx:fP(e,o,t),cy:mP(n,o,t),r:o,stroke:"transparent",fill:"transparent"}),pP=()=>!0;var Ss=t=>{const e=({id:n,className:o,type:r,data:s,onClick:i,onEdgeDoubleClick:a,selected:l,animated:c,label:u,labelStyle:h,labelShowBg:f,labelBgStyle:m,labelBgPadding:_,labelBgBorderRadius:g,style:p,source:b,target:x,sourceX:y,sourceY:v,targetX:C,targetY:k,sourcePosition:N,targetPosition:j,elementsSelectable:I,hidden:T,sourceHandleId:A,targetHandleId:R,onContextMenu:z,onMouseEnter:D,onMouseMove:F,onMouseLeave:B,reconnectRadius:U,onReconnect:O,onReconnectStart:S,onReconnectEnd:$,markerEnd:E,markerStart:W,rfId:G,ariaLabel:q,isFocusable:Y,isReconnectable:te,pathOptions:oe,interactionWidth:se,disableKeyboardA11y:Z})=>{const Q=M.useRef(null),[ue,me]=M.useState(!1),[ce,fe]=M.useState(!1),de=Ht(),ke=M.useMemo(()=>`url('#${Gh(W,G)}')`,[W,G]),Se=M.useMemo(()=>`url('#${Gh(E,G)}')`,[E,G]);if(T)return null;const ie=Pi(n,de.getState,a),je=Pi(n,de.getState,z),pe=Pi(n,de.getState,D),Ae=Pi(n,de.getState,F),ze=Pi(n,de.getState,B),De=(Qe,tt)=>{if(Qe.button!==0)return;const{edges:ne,isValidConnection:ve}=de.getState(),Ce=tt?x:b,Re=(tt?R:A)||null,J=tt?"target":"source",_e=ve||pP,be=tt,ge=ne.find(le=>le.id===n);fe(!0),S==null||S(Qe,ge,J),Gv({event:Qe,handleId:Re,nodeId:Ce,onConnect:le=>O==null?void 0:O(ge,le),isTarget:be,getState:de.getState,setState:de.setState,isValidConnection:_e,edgeUpdaterType:J,onReconnectEnd:le=>{fe(!1),$==null||$(le,ge,J)}})},Ve=()=>me(!0),Pe=()=>me(!1),rt=!I&&!i;return K.createElement("g",{className:dn(["react-flow__edge",`react-flow__edge-${r}`,o,{selected:l,animated:c,inactive:rt,updating:ue}]),onClick:Qe=>{var J;const{edges:tt,addSelectedEdges:ne,unselectNodesAndEdges:ve,multiSelectionActive:Ce}=de.getState(),Re=tt.find(_e=>_e.id===n);Re&&(I&&(de.setState({nodesSelectionActive:!1}),Re.selected&&Ce?(ve({nodes:[],edges:[Re]}),(J=Q.current)==null||J.blur()):ne([n])),i&&i(Qe,Re))},onDoubleClick:ie,onContextMenu:je,onMouseEnter:pe,onMouseMove:Ae,onMouseLeave:ze,onKeyDown:Y?Qe=>{var tt;if(!Z&&jv.includes(Qe.key)&&I){const{unselectNodesAndEdges:ne,addSelectedEdges:ve,edges:Ce}=de.getState();Qe.key==="Escape"?((tt=Q.current)==null||tt.blur(),ne({edges:[Ce.find(Re=>Re.id===n)]})):ve([n])}}:void 0,tabIndex:Y?0:void 0,role:Y?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":q===null?void 0:q||`Edge from ${b} to ${x}`,"aria-describedby":Y?`${r2}-${G}`:void 0,ref:Q},!ce&&K.createElement(t,{id:n,source:b,target:x,selected:l,animated:c,label:u,labelStyle:h,labelShowBg:f,labelBgStyle:m,labelBgPadding:_,labelBgBorderRadius:g,data:s,style:p,sourceX:y,sourceY:v,targetX:C,targetY:k,sourcePosition:N,targetPosition:j,sourceHandleId:A,targetHandleId:R,markerStart:ke,markerEnd:Se,pathOptions:oe,interactionWidth:se}),te&&K.createElement(K.Fragment,null,(te==="source"||te===!0)&&K.createElement(C2,{position:N,centerX:y,centerY:v,radius:U,onMouseDown:Qe=>De(Qe,!0),onMouseEnter:Ve,onMouseOut:Pe,type:"source"}),(te==="target"||te===!0)&&K.createElement(C2,{position:j,centerX:C,centerY:k,radius:U,onMouseDown:Qe=>De(Qe,!1),onMouseEnter:Ve,onMouseOut:Pe,type:"target"})))};return e.displayName="EdgeWrapper",M.memo(e)};function gP(t){return{default:Ss(t.default||Vl),straight:Ss(t.bezier||Wh),step:Ss(t.step||Hh),smoothstep:Ss(t.step||Bl),simplebezier:Ss(t.simplebezier||Vh),...Object.keys(t).filter(e=>!["default","bezier"].includes(e)).reduce((e,n)=>(e[n]=Ss(t[n]||Vl),e),{})}}function N2(t,e,n=null){const o=((n==null?void 0:n.x)||0)+e.x,r=((n==null?void 0:n.y)||0)+e.y,s=(n==null?void 0:n.width)||e.width,i=(n==null?void 0:n.height)||e.height;switch(t){case Be.Top:return{x:o+s/2,y:r};case Be.Right:return{x:o+s,y:r+i/2};case Be.Bottom:return{x:o+s/2,y:r+i};case Be.Left:return{x:o,y:r+i/2}}}function j2(t,e){return t?t.length!==1&&e?e&&t.find(n=>n.id===e)||null:t[0]:null}function E2(t){var o,r,s,i,a;const e=((o=t==null?void 0:t[kt])==null?void 0:o.handleBounds)||null,n=e&&(t==null?void 0:t.width)&&(t==null?void 0:t.height)&&((r=t==null?void 0:t.positionAbsolute)==null?void 0:r.x)!==void 0&&((s=t==null?void 0:t.positionAbsolute)==null?void 0:s.y)!==void 0;return[{x:((i=t==null?void 0:t.positionAbsolute)==null?void 0:i.x)||0,y:((a=t==null?void 0:t.positionAbsolute)==null?void 0:a.y)||0,width:(t==null?void 0:t.width)||0,height:(t==null?void 0:t.height)||0},e,!!n]}const _P=[{level:0,isMaxLevel:!0,edges:[]}];function bP(t,e,n){return function(o,r,s=!1){let i=-1;const a=o.reduce((c,u)=>{var m,_;const h=zn(u.zIndex);let f=h?u.zIndex:0;if(s){const g=r.get(u.target),p=r.get(u.source),b=u.selected||(g==null?void 0:g.selected)||(p==null?void 0:p.selected),x=Math.max(((m=p==null?void 0:p[kt])==null?void 0:m.z)||0,((_=g==null?void 0:g[kt])==null?void 0:_.z)||0,1e3);f=(h?u.zIndex:0)+(b?x:0)}return c[f]?c[f].push(u):c[f]=[u],i=f>i?f:i,c},{}),l=Object.entries(a).map(([c,u])=>{const h=+c;return{edges:u,level:h,isMaxLevel:h===i}});return l.length===0?_P:l}(mt(M.useCallback(o=>t?o.edges.filter(r=>{const s=e.get(r.source),i=e.get(r.target);return(s==null?void 0:s.width)&&(s==null?void 0:s.height)&&(i==null?void 0:i.width)&&(i==null?void 0:i.height)&&function({sourcePos:a,targetPos:l,sourceWidth:c,sourceHeight:u,targetWidth:h,targetHeight:f,width:m,height:_,transform:g}){const p={x:Math.min(a.x,l.x),y:Math.min(a.y,l.y),x2:Math.max(a.x+c,l.x+h),y2:Math.max(a.y+u,l.y+f)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const b=Fh({x:(0-g[0])/g[2],y:(0-g[1])/g[2],width:m/g[2],height:_/g[2]}),x=Math.max(0,Math.min(b.x2,p.x2)-Math.max(b.x,p.x)),y=Math.max(0,Math.min(b.y2,p.y2)-Math.max(b.y,p.y));return Math.ceil(x*y)>0}({sourcePos:s.positionAbsolute||{x:0,y:0},targetPos:i.positionAbsolute||{x:0,y:0},sourceWidth:s.width,sourceHeight:s.height,targetWidth:i.width,targetHeight:i.height,width:o.width,height:o.height,transform:o.transform})}):o.edges,[t,e])),e,n)}const I2={[_s.Arrow]:({color:t="none",strokeWidth:e=1})=>K.createElement("polyline",{style:{stroke:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),[_s.ArrowClosed]:({color:t="none",strokeWidth:e=1})=>K.createElement("polyline",{style:{stroke:t,fill:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},xP=({id:t,type:e,color:n,width:o=12.5,height:r=12.5,markerUnits:s="strokeWidth",strokeWidth:i,orient:a="auto-start-reverse"})=>{const l=function(c){const u=Ht();return M.useMemo(()=>{var h,f;return Object.prototype.hasOwnProperty.call(I2,c)?I2[c]:((f=(h=u.getState()).onError)==null||f.call(h,"009",CR(c)),null)},[c])}(e);return l?K.createElement("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${o}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:a,refX:"0",refY:"0"},K.createElement(l,{color:n,strokeWidth:i})):null},A2=({defaultColor:t,rfId:e})=>{const n=mt(M.useCallback((({defaultColor:o,rfId:r})=>s=>{const i=[];return s.edges.reduce((a,l)=>([l.markerStart,l.markerEnd].forEach(c=>{if(c&&typeof c=="object"){const u=Gh(c,r);i.includes(u)||(a.push({id:u,color:c.color||o,...c}),i.push(u))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))})({defaultColor:t,rfId:e}),[t,e]),(o,r)=>!(o.length!==r.length||o.some((s,i)=>s.id!==r[i].id)));return K.createElement("defs",null,n.map(o=>K.createElement(xP,{id:o.id,key:o.id,type:o.type,color:o.color,width:o.width,height:o.height,markerUnits:o.markerUnits,strokeWidth:o.strokeWidth,orient:o.orient})))};A2.displayName="MarkerDefinitions";var yP=M.memo(A2);const wP=t=>({nodesConnectable:t.nodesConnectable,edgesFocusable:t.edgesFocusable,edgesUpdatable:t.edgesUpdatable,elementsSelectable:t.elementsSelectable,width:t.width,height:t.height,connectionMode:t.connectionMode,nodeInternals:t.nodeInternals,onError:t.onError}),T2=({defaultMarkerColor:t,onlyRenderVisibleElements:e,elevateEdgesOnSelect:n,rfId:o,edgeTypes:r,noPanClassName:s,onEdgeContextMenu:i,onEdgeMouseEnter:a,onEdgeMouseMove:l,onEdgeMouseLeave:c,onEdgeClick:u,onEdgeDoubleClick:h,onReconnect:f,onReconnectStart:m,onReconnectEnd:_,reconnectRadius:g,children:p,disableKeyboardA11y:b})=>{const{edgesFocusable:x,edgesUpdatable:y,elementsSelectable:v,width:C,height:k,connectionMode:N,nodeInternals:j,onError:I}=mt(wP,tn),T=bP(e,j,n);return C?K.createElement(K.Fragment,null,T.map(({level:A,edges:R,isMaxLevel:z})=>K.createElement("svg",{key:A,style:{zIndex:A},width:C,height:k,className:"react-flow__edges react-flow__container"},z&&K.createElement(yP,{defaultColor:t,rfId:o}),K.createElement("g",null,R.map(D=>{const[F,B,U]=E2(j.get(D.source)),[O,S,$]=E2(j.get(D.target));if(!U||!$)return null;let E=D.type||"default";r[E]||(I==null||I("011",ER(E)),E="default");const W=r[E]||r.default,G=N===jr.Strict?S.target:(S.target??[]).concat(S.source??[]),q=j2(B.source,D.sourceHandle),Y=j2(G,D.targetHandle),te=(q==null?void 0:q.position)||Be.Bottom,oe=(Y==null?void 0:Y.position)||Be.Top,se=!!(D.focusable||x&&D.focusable===void 0),Z=D.reconnectable||D.updatable,Q=f!==void 0&&(Z||y&&Z===void 0);if(!q||!Y)return I==null||I("008",NR(q,D)),null;const{sourceX:ue,sourceY:me,targetX:ce,targetY:fe}=((de,ke,Se,ie,je,pe)=>{const Ae=N2(Se,de,ke),ze=N2(pe,ie,je);return{sourceX:Ae.x,sourceY:Ae.y,targetX:ze.x,targetY:ze.y}})(F,q,te,O,Y,oe);return K.createElement(W,{key:D.id,id:D.id,className:dn([D.className,s]),type:E,data:D.data,selected:!!D.selected,animated:!!D.animated,hidden:!!D.hidden,label:D.label,labelStyle:D.labelStyle,labelShowBg:D.labelShowBg,labelBgStyle:D.labelBgStyle,labelBgPadding:D.labelBgPadding,labelBgBorderRadius:D.labelBgBorderRadius,style:D.style,source:D.source,target:D.target,sourceHandleId:D.sourceHandle,targetHandleId:D.targetHandle,markerEnd:D.markerEnd,markerStart:D.markerStart,sourceX:ue,sourceY:me,targetX:ce,targetY:fe,sourcePosition:te,targetPosition:oe,elementsSelectable:v,onContextMenu:i,onMouseEnter:a,onMouseMove:l,onMouseLeave:c,onClick:u,onEdgeDoubleClick:h,onReconnect:f,onReconnectStart:m,onReconnectEnd:_,reconnectRadius:g,rfId:o,ariaLabel:D.ariaLabel,isFocusable:se,isReconnectable:Q,pathOptions:"pathOptions"in D?D.pathOptions:void 0,interactionWidth:D.interactionWidth,disableKeyboardA11y:b})})))),p):null};T2.displayName="EdgeRenderer";var vP=M.memo(T2);const kP=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function SP({children:t}){const e=mt(kP);return K.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:e}},t)}const CP={[Be.Left]:Be.Right,[Be.Right]:Be.Left,[Be.Top]:Be.Bottom,[Be.Bottom]:Be.Top},M2=({nodeId:t,handleType:e,style:n,type:o=er.Bezier,CustomComponent:r,connectionStatus:s})=>{var k,N,j;const{fromNode:i,handleId:a,toX:l,toY:c,connectionMode:u}=mt(M.useCallback(I=>({fromNode:I.nodeInternals.get(t),handleId:I.connectionHandleId,toX:(I.connectionPosition.x-I.transform[0])/I.transform[2],toY:(I.connectionPosition.y-I.transform[1])/I.transform[2],connectionMode:I.connectionMode}),[t]),tn),h=(k=i==null?void 0:i[kt])==null?void 0:k.handleBounds;let f=h==null?void 0:h[e];if(u===jr.Loose&&(f=f||(h==null?void 0:h[e==="source"?"target":"source"])),!i||!f)return null;const m=a?f.find(I=>I.id===a):f[0],_=m?m.x+m.width/2:(i.width??0)/2,g=m?m.y+m.height/2:i.height??0,p=(((N=i.positionAbsolute)==null?void 0:N.x)??0)+_,b=(((j=i.positionAbsolute)==null?void 0:j.y)??0)+g,x=m==null?void 0:m.position,y=x?CP[x]:null;if(!x||!y)return null;if(r)return K.createElement(r,{connectionLineType:o,connectionLineStyle:n,fromNode:i,fromHandle:m,fromX:p,fromY:b,toX:l,toY:c,fromPosition:x,toPosition:y,connectionStatus:s});let v="";const C={sourceX:p,sourceY:b,sourcePosition:x,targetX:l,targetY:c,targetPosition:y};return o===er.Bezier?[v]=zv(C):o===er.Step?[v]=$h({...C,borderRadius:0}):o===er.SmoothStep?[v]=$h(C):o===er.SimpleBezier?[v]=Rv(C):v=`M${p},${b} ${l},${c}`,K.createElement("path",{d:v,fill:"none",className:"react-flow__connection-path",style:n})};M2.displayName="ConnectionLine";const NP=t=>({nodeId:t.connectionNodeId,handleType:t.connectionHandleType,nodesConnectable:t.nodesConnectable,connectionStatus:t.connectionStatus,width:t.width,height:t.height});function jP({containerStyle:t,style:e,type:n,component:o}){const{nodeId:r,handleType:s,nodesConnectable:i,width:a,height:l,connectionStatus:c}=mt(NP,tn);return r&&s&&a&&i?K.createElement("svg",{style:t,width:a,height:l,className:"react-flow__edges react-flow__connectionline react-flow__container"},K.createElement("g",{className:dn(["react-flow__connection",c])},K.createElement(M2,{nodeId:r,handleType:s,style:e,type:n,CustomComponent:o,connectionStatus:c}))):null}function O2(t,e){return M.useRef(null),Ht(),M.useMemo(()=>e(t),[t])}const D2=({nodeTypes:t,edgeTypes:e,onMove:n,onMoveStart:o,onMoveEnd:r,onInit:s,onNodeClick:i,onEdgeClick:a,onNodeDoubleClick:l,onEdgeDoubleClick:c,onNodeMouseEnter:u,onNodeMouseMove:h,onNodeMouseLeave:f,onNodeContextMenu:m,onSelectionContextMenu:_,onSelectionStart:g,onSelectionEnd:p,connectionLineType:b,connectionLineStyle:x,connectionLineComponent:y,connectionLineContainerStyle:v,selectionKeyCode:C,selectionOnDrag:k,selectionMode:N,multiSelectionKeyCode:j,panActivationKeyCode:I,zoomActivationKeyCode:T,deleteKeyCode:A,onlyRenderVisibleElements:R,elementsSelectable:z,selectNodesOnDrag:D,defaultViewport:F,translateExtent:B,minZoom:U,maxZoom:O,preventScrolling:S,defaultMarkerColor:$,zoomOnScroll:E,zoomOnPinch:W,panOnScroll:G,panOnScrollSpeed:q,panOnScrollMode:Y,zoomOnDoubleClick:te,panOnDrag:oe,onPaneClick:se,onPaneMouseEnter:Z,onPaneMouseMove:Q,onPaneMouseLeave:ue,onPaneScroll:me,onPaneContextMenu:ce,onEdgeContextMenu:fe,onEdgeMouseEnter:de,onEdgeMouseMove:ke,onEdgeMouseLeave:Se,onReconnect:ie,onReconnectStart:je,onReconnectEnd:pe,reconnectRadius:Ae,noDragClassName:ze,noWheelClassName:De,noPanClassName:Ve,elevateEdgesOnSelect:Pe,disableKeyboardA11y:rt,nodeOrigin:Qe,nodeExtent:tt,rfId:ne})=>{const ve=O2(t,dP),Ce=O2(e,gP);return function(Re){const J=Bi(),_e=M.useRef(!1);M.useEffect(()=>{!_e.current&&J.viewportInitialized&&Re&&(setTimeout(()=>Re(J),1),_e.current=!0)},[Re,J.viewportInitialized])}(s),K.createElement(cP,{onPaneClick:se,onPaneMouseEnter:Z,onPaneMouseMove:Q,onPaneMouseLeave:ue,onPaneContextMenu:ce,onPaneScroll:me,deleteKeyCode:A,selectionKeyCode:C,selectionOnDrag:k,selectionMode:N,onSelectionStart:g,onSelectionEnd:p,multiSelectionKeyCode:j,panActivationKeyCode:I,zoomActivationKeyCode:T,elementsSelectable:z,onMove:n,onMoveStart:o,onMoveEnd:r,zoomOnScroll:E,zoomOnPinch:W,zoomOnDoubleClick:te,panOnScroll:G,panOnScrollSpeed:q,panOnScrollMode:Y,panOnDrag:oe,defaultViewport:F,translateExtent:B,minZoom:U,maxZoom:O,onSelectionContextMenu:_,preventScrolling:S,noDragClassName:ze,noWheelClassName:De,noPanClassName:Ve,disableKeyboardA11y:rt},K.createElement(SP,null,K.createElement(vP,{edgeTypes:Ce,onEdgeClick:a,onEdgeDoubleClick:c,onlyRenderVisibleElements:R,onEdgeContextMenu:fe,onEdgeMouseEnter:de,onEdgeMouseMove:ke,onEdgeMouseLeave:Se,onReconnect:ie,onReconnectStart:je,onReconnectEnd:pe,reconnectRadius:Ae,defaultMarkerColor:$,noPanClassName:Ve,elevateEdgesOnSelect:!!Pe,disableKeyboardA11y:rt,rfId:ne},K.createElement(jP,{style:x,type:b,component:y,containerStyle:v})),K.createElement("div",{className:"react-flow__edgelabel-renderer"}),K.createElement(hP,{nodeTypes:ve,onNodeClick:i,onNodeDoubleClick:l,onNodeMouseEnter:u,onNodeMouseMove:h,onNodeMouseLeave:f,onNodeContextMenu:m,selectNodesOnDrag:D,onlyRenderVisibleElements:R,noPanClassName:Ve,noDragClassName:ze,disableKeyboardA11y:rt,nodeOrigin:Qe,nodeExtent:tt,rfId:ne})))};D2.displayName="GraphView";var EP=M.memo(D2);const af=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],or={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:af,nodeExtent:af,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:jr.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:(t,e)=>{},isValidConnection:void 0},IP=()=>((t,e)=>t?bv(t,e):bv)((t,e)=>({...or,setNodes:n=>{const{nodeInternals:o,nodeOrigin:r,elevateNodesOnSelect:s}=e();t({nodeInternals:ef(n,o,r,s)})},getNodes:()=>Array.from(e().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:o={}}=e();t({edges:n.map(r=>({...o,...r}))})},setDefaultNodesAndEdges:(n,o)=>{const r=n!==void 0,s=o!==void 0,i=r?ef(n,new Map,e().nodeOrigin,e().elevateNodesOnSelect):new Map;t({nodeInternals:i,edges:s?o:[],hasDefaultNodes:r,hasDefaultEdges:s})},updateNodeDimensions:n=>{const{onNodesChange:o,nodeInternals:r,fitViewOnInit:s,fitViewOnInitDone:i,fitViewOnInitOptions:a,domNode:l,nodeOrigin:c}=e(),u=l==null?void 0:l.querySelector(".react-flow__viewport");if(!u)return;const h=window.getComputedStyle(u),{m22:f}=new window.DOMMatrixReadOnly(h.transform),m=n.reduce((g,p)=>{const b=r.get(p.id);if(b!=null&&b.hidden)r.set(b.id,{...b,[kt]:{...b[kt],handleBounds:void 0}});else if(b){const x=Ph(p.nodeElement);!(!x.width||!x.height||b.width===x.width&&b.height===x.height&&!p.forceUpdate)&&(r.set(b.id,{...b,[kt]:{...b[kt],handleBounds:{source:x2(".source",p.nodeElement,f,c),target:x2(".target",p.nodeElement,f,c)}},...x}),g.push({id:b.id,type:"dimensions",dimensions:x}))}return g},[]);l2(r,c);const _=i||s&&!i&&c2(e,{initial:!0,...a});t({nodeInternals:new Map(r),fitViewOnInitDone:_}),(m==null?void 0:m.length)>0&&(o==null||o(m))},updateNodePositions:(n,o=!0,r=!1)=>{const{triggerNodeChanges:s}=e(),i=n.map(a=>{const l={id:a.id,type:"position",dragging:r};return o&&(l.positionAbsolute=a.positionAbsolute,l.position=a.position),l});s(i)},triggerNodeChanges:n=>{const{onNodesChange:o,nodeInternals:r,hasDefaultNodes:s,nodeOrigin:i,getNodes:a,elevateNodesOnSelect:l}=e();if(n!=null&&n.length){if(s){const c=ef(m2(n,a()),r,i,l);t({nodeInternals:c})}o==null||o(n)}},addSelectedNodes:n=>{const{multiSelectionActive:o,edges:r,getNodes:s}=e();let i,a=null;o?i=n.map(l=>nr(l,!0)):(i=vs(s(),n),a=vs(r,[])),Hl({changedNodes:i,changedEdges:a,get:e,set:t})},addSelectedEdges:n=>{const{multiSelectionActive:o,edges:r,getNodes:s}=e();let i,a=null;o?i=n.map(l=>nr(l,!0)):(i=vs(r,n),a=vs(s(),[])),Hl({changedNodes:a,changedEdges:i,get:e,set:t})},unselectNodesAndEdges:({nodes:n,edges:o}={})=>{const{edges:r,getNodes:s}=e(),i=o||r;Hl({changedNodes:(n||s()).map(a=>(a.selected=!1,nr(a.id,!1))),changedEdges:i.map(a=>nr(a.id,!1)),get:e,set:t})},setMinZoom:n=>{const{d3Zoom:o,maxZoom:r}=e();o==null||o.scaleExtent([n,r]),t({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:o,minZoom:r}=e();o==null||o.scaleExtent([r,n]),t({maxZoom:n})},setTranslateExtent:n=>{var o;(o=e().d3Zoom)==null||o.translateExtent(n),t({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:o}=e();Hl({changedNodes:o().filter(r=>r.selected).map(r=>nr(r.id,!1)),changedEdges:n.filter(r=>r.selected).map(r=>nr(r.id,!1)),get:e,set:t})},setNodeExtent:n=>{const{nodeInternals:o}=e();o.forEach(r=>{r.positionAbsolute=Lh(r.position,n)}),t({nodeExtent:n,nodeInternals:new Map(o)})},panBy:n=>{const{transform:o,width:r,height:s,d3Zoom:i,d3Selection:a,translateExtent:l}=e();if(!i||!a||!n.x&&!n.y)return!1;const c=pr.translate(o[0]+n.x,o[1]+n.y).scale(o[2]),u=[[0,0],[r,s]],h=i==null?void 0:i.constrain()(c,u,l);return i.transform(a,h),o[0]!==h.x||o[1]!==h.y||o[2]!==h.k},cancelConnection:()=>t({connectionNodeId:or.connectionNodeId,connectionHandleId:or.connectionHandleId,connectionHandleType:or.connectionHandleType,connectionStatus:or.connectionStatus,connectionStartHandle:or.connectionStartHandle,connectionEndHandle:or.connectionEndHandle}),reset:()=>t({...or})}),Object.is),lf=({children:t})=>{const e=M.useRef(null);return e.current||(e.current=IP()),K.createElement(wR,{value:e.current},t)};lf.displayName="ReactFlowProvider";const R2=({children:t})=>M.useContext(Pl)?K.createElement(K.Fragment,null,t):K.createElement(lf,null,t);R2.displayName="ReactFlowWrapper";const AP={input:Zv,default:Zh,output:e2,group:Qh},TP={default:Vl,straight:Wh,step:Hh,smoothstep:Bl,simplebezier:Vh},MP=[0,0],OP=[15,15],DP={x:0,y:0,zoom:1},RP={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},cf=M.forwardRef(({nodes:t,edges:e,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:s=AP,edgeTypes:i=TP,onNodeClick:a,onEdgeClick:l,onInit:c,onMove:u,onMoveStart:h,onMoveEnd:f,onConnect:m,onConnectStart:_,onConnectEnd:g,onClickConnectStart:p,onClickConnectEnd:b,onNodeMouseEnter:x,onNodeMouseMove:y,onNodeMouseLeave:v,onNodeContextMenu:C,onNodeDoubleClick:k,onNodeDragStart:N,onNodeDrag:j,onNodeDragStop:I,onNodesDelete:T,onEdgesDelete:A,onSelectionChange:R,onSelectionDragStart:z,onSelectionDrag:D,onSelectionDragStop:F,onSelectionContextMenu:B,onSelectionStart:U,onSelectionEnd:O,connectionMode:S=jr.Strict,connectionLineType:$=er.Bezier,connectionLineStyle:E,connectionLineComponent:W,connectionLineContainerStyle:G,deleteKeyCode:q="Backspace",selectionKeyCode:Y="Shift",selectionOnDrag:te=!1,selectionMode:oe=Li.Full,panActivationKeyCode:se="Space",multiSelectionKeyCode:Z=Fl()?"Meta":"Control",zoomActivationKeyCode:Q=Fl()?"Meta":"Control",snapToGrid:ue=!1,snapGrid:me=OP,onlyRenderVisibleElements:ce=!1,selectNodesOnDrag:fe=!0,nodesDraggable:de,nodesConnectable:ke,nodesFocusable:Se,nodeOrigin:ie=MP,edgesFocusable:je,edgesUpdatable:pe,elementsSelectable:Ae,defaultViewport:ze=DP,minZoom:De=.5,maxZoom:Ve=2,translateExtent:Pe=af,preventScrolling:rt=!0,nodeExtent:Qe,defaultMarkerColor:tt="#b1b1b7",zoomOnScroll:ne=!0,zoomOnPinch:ve=!0,panOnScroll:Ce=!1,panOnScrollSpeed:Re=.5,panOnScrollMode:J=Qo.Free,zoomOnDoubleClick:_e=!0,panOnDrag:be=!0,onPaneClick:ge,onPaneMouseEnter:le,onPaneMouseMove:We,onPaneMouseLeave:Fe,onPaneScroll:Xe,onPaneContextMenu:ae,children:Ee,onEdgeContextMenu:Ie,onEdgeDoubleClick:$e,onEdgeMouseEnter:Je,onEdgeMouseMove:Le,onEdgeMouseLeave:Ge,onEdgeUpdate:st,onEdgeUpdateStart:nt,onEdgeUpdateEnd:it,onReconnect:Pt,onReconnectStart:zt,onReconnectEnd:nn,reconnectRadius:Wt=10,edgeUpdaterRadius:Zn=10,onNodesChange:Ns,onEdgesChange:ho,noDragClassName:Lo="nodrag",noWheelClassName:Un="nowheel",noPanClassName:js="nopan",fitView:Hi=!1,fitViewOptions:oz,connectOnClick:rz=!0,attributionPosition:sz,proOptions:iz,defaultEdgeOptions:az,elevateNodesOnSelect:lz=!0,elevateEdgesOnSelect:cz=!1,disableKeyboardA11y:C3=!1,autoPanOnConnect:dz=!0,autoPanOnNodeDrag:uz=!0,connectionRadius:hz=20,isValidConnection:fz,onError:mz,style:pz,id:N3,nodeDragThreshold:gz,..._z},bz)=>{const em=N3||"1";return K.createElement("div",{..._z,style:{...pz,...RP},ref:bz,className:dn(["react-flow",r]),"data-testid":"rf__wrapper",id:N3},K.createElement(R2,null,K.createElement(EP,{onInit:c,onMove:u,onMoveStart:h,onMoveEnd:f,onNodeClick:a,onEdgeClick:l,onNodeMouseEnter:x,onNodeMouseMove:y,onNodeMouseLeave:v,onNodeContextMenu:C,onNodeDoubleClick:k,nodeTypes:s,edgeTypes:i,connectionLineType:$,connectionLineStyle:E,connectionLineComponent:W,connectionLineContainerStyle:G,selectionKeyCode:Y,selectionOnDrag:te,selectionMode:oe,deleteKeyCode:q,multiSelectionKeyCode:Z,panActivationKeyCode:se,zoomActivationKeyCode:Q,onlyRenderVisibleElements:ce,selectNodesOnDrag:fe,defaultViewport:ze,translateExtent:Pe,minZoom:De,maxZoom:Ve,preventScrolling:rt,zoomOnScroll:ne,zoomOnPinch:ve,zoomOnDoubleClick:_e,panOnScroll:Ce,panOnScrollSpeed:Re,panOnScrollMode:J,panOnDrag:be,onPaneClick:ge,onPaneMouseEnter:le,onPaneMouseMove:We,onPaneMouseLeave:Fe,onPaneScroll:Xe,onPaneContextMenu:ae,onSelectionContextMenu:B,onSelectionStart:U,onSelectionEnd:O,onEdgeContextMenu:Ie,onEdgeDoubleClick:$e,onEdgeMouseEnter:Je,onEdgeMouseMove:Le,onEdgeMouseLeave:Ge,onReconnect:Pt??st,onReconnectStart:zt??nt,onReconnectEnd:nn??it,reconnectRadius:Wt??Zn,defaultMarkerColor:tt,noDragClassName:Lo,noWheelClassName:Un,noPanClassName:js,elevateEdgesOnSelect:cz,rfId:em,disableKeyboardA11y:C3,nodeOrigin:ie,nodeExtent:Qe}),K.createElement(HR,{nodes:t,edges:e,defaultNodes:n,defaultEdges:o,onConnect:m,onConnectStart:_,onConnectEnd:g,onClickConnectStart:p,onClickConnectEnd:b,nodesDraggable:de,nodesConnectable:ke,nodesFocusable:Se,edgesFocusable:je,edgesUpdatable:pe,elementsSelectable:Ae,elevateNodesOnSelect:lz,minZoom:De,maxZoom:Ve,nodeExtent:Qe,onNodesChange:Ns,onEdgesChange:ho,snapToGrid:ue,snapGrid:me,connectionMode:S,translateExtent:Pe,connectOnClick:rz,defaultEdgeOptions:az,fitView:Hi,fitViewOptions:oz,onNodesDelete:T,onEdgesDelete:A,onNodeDragStart:N,onNodeDrag:j,onNodeDragStop:I,onSelectionDrag:D,onSelectionDragStart:z,onSelectionDragStop:F,noPanClassName:js,nodeOrigin:ie,rfId:em,autoPanOnConnect:dz,autoPanOnNodeDrag:uz,onError:mz,connectionRadius:hz,isValidConnection:fz,nodeDragThreshold:gz}),K.createElement(VR,{onSelectionChange:R}),Ee,K.createElement(TR,{proOptions:iz,position:sz}),K.createElement(YR,{rfId:em,disableKeyboardA11y:C3})))});function P2(t){return e=>{const[n,o]=M.useState(e),r=M.useCallback(s=>o(i=>t(s,i)),[]);return[n,o,r]}}cf.displayName="ReactFlow";const L2=P2(m2),F2=P2(function(t,e){return f2(t,e)});function PP(){return K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},K.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function LP(){return K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},K.createElement("path",{d:"M0 0h32v4.2H0z"}))}function FP(){return K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},K.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function zP(){return K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},K.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function BP(){return K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},K.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const Cs=({children:t,className:e,...n})=>K.createElement("button",{type:"button",className:dn(["react-flow__controls-button",e]),...n},t);Cs.displayName="ControlButton";const UP=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom}),z2=({style:t,showZoom:e=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:r,onZoomIn:s,onZoomOut:i,onFitView:a,onInteractiveChange:l,className:c,children:u,position:h="bottom-left"})=>{const f=Ht(),[m,_]=M.useState(!1),{isInteractive:g,minZoomReached:p,maxZoomReached:b}=mt(UP,tn),{zoomIn:x,zoomOut:y,fitView:v}=Bi();return M.useEffect(()=>{_(!0)},[]),m?K.createElement(Ll,{className:dn(["react-flow__controls",c]),position:h,style:t,"data-testid":"rf__controls"},e&&K.createElement(K.Fragment,null,K.createElement(Cs,{onClick:()=>{x(),s==null||s()},className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:b},K.createElement(PP,null)),K.createElement(Cs,{onClick:()=>{y(),i==null||i()},className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:p},K.createElement(LP,null))),n&&K.createElement(Cs,{className:"react-flow__controls-fitview",onClick:()=>{v(r),a==null||a()},title:"fit view","aria-label":"fit view"},K.createElement(FP,null)),o&&K.createElement(Cs,{className:"react-flow__controls-interactive",onClick:()=>{f.setState({nodesDraggable:!g,nodesConnectable:!g,elementsSelectable:!g}),l==null||l(!g)},title:"toggle interactivity","aria-label":"toggle interactivity"},g?K.createElement(BP,null):K.createElement(zP,null)),u):null};z2.displayName="Controls";var Bn,VP=M.memo(z2);function $P({color:t,dimensions:e,lineWidth:n}){return K.createElement("path",{stroke:t,strokeWidth:n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})}function HP({color:t,radius:e}){return K.createElement("circle",{cx:e,cy:e,r:e,fill:t})}(function(t){t.Lines="lines",t.Dots="dots",t.Cross="cross"})(Bn||(Bn={}));const WP={[Bn.Dots]:"#91919a",[Bn.Lines]:"#eee",[Bn.Cross]:"#e2e2e2"},qP={[Bn.Dots]:1,[Bn.Lines]:1,[Bn.Cross]:6},GP=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function B2({id:t,variant:e=Bn.Dots,gap:n=20,size:o,lineWidth:r=1,offset:s=2,color:i,style:a,className:l}){const c=M.useRef(null),{transform:u,patternId:h}=mt(GP,tn),f=i||WP[e],m=o||qP[e],_=e===Bn.Dots,g=e===Bn.Cross,p=Array.isArray(n)?n:[n,n],b=[p[0]*u[2]||1,p[1]*u[2]||1],x=m*u[2],y=g?[x,x]:b,v=_?[x/s,x/s]:[y[0]/s,y[1]/s];return K.createElement("svg",{className:dn(["react-flow__background",l]),style:{...a,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:c,"data-testid":"rf__background"},K.createElement("pattern",{id:h+t,x:u[0]%b[0],y:u[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${v[0]},-${v[1]})`},_?K.createElement(HP,{color:f,radius:x/s}):K.createElement($P,{dimensions:y,color:f,lineWidth:r})),K.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${h+t})`}))}B2.displayName="Background";var YP=M.memo(B2);function df(t){return Math.min(11*t+35,200)}const U2=K.createContext("LR"),V2=M.memo(t=>{const e=X.c(51),{data:n,selected:o}=t,r=Ue(n.atom),s=Bc().inOrderIds.indexOf(r.id),i=o?"var(--gray-9)":"var(--gray-3)",a=mt(JP),l=M.use(U2);let c,u,h,f,m;if(e[0]!==r.code||e[1]!==i||e[2]!==l||e[3]!==o){const A=r.code.split(`
|
142
|
-
`).length,R=l==="LR"?Be.Left:Be.Top;let z;e[8]!==i?(z={background:i},e[8]=i,e[9]=z):z=e[9],e[10]!==R||e[11]!==z?(h=d.jsx(tr,{type:"target",id:"inputs",position:R,style:z}),e[10]=R,e[11]=z,e[12]=h):h=e[12];const D=l==="LR"?Be.Left:Be.Top;let F;e[13]!==i?(F={background:i},e[13]=i,e[14]=F):F=e[14],e[15]!==D||e[16]!==F?(f=d.jsx(tr,{type:"source",id:"inputs",position:D,style:F}),e[15]=D,e[16]=F,e[17]=f):f=e[17];const B=o&&"border-primary";e[18]!==B?(u=Ne("flex flex-col bg-card border border-input/50 rounded-md mx-[2px] overflow-hidden",B),e[18]=B,e[19]=u):u=e[19],c=df(A),e[0]=r.code,e[1]=i,e[2]=l,e[3]=o,e[4]=c,e[5]=u,e[6]=h,e[7]=f}else c=e[4],u=e[5],h=e[6],f=e[7];var _;let g;e[20]!==n.forceWidth||e[21]!==a?(m=n.forceWidth||(_=a,Math.min(Math.max(_-100,100),400)),e[20]=n.forceWidth,e[21]=a,e[22]=m):m=e[22],e[23]!==c||e[24]!==m?(g={height:c,width:m},e[23]=c,e[24]=m,e[25]=g):g=e[25];const p=f$(r.name,s);let b,x,y;e[26]!==p?(b=d.jsx("div",{className:"text-muted-foreground font-semibold text-xs py-1 px-2 bg-muted border-b",children:p}),e[26]=p,e[27]=b):b=e[27],e[28]!==r.code?(x=d.jsx(XH,{code:r.code}),e[28]=r.code,e[29]=x):x=e[29],e[30]!==u||e[31]!==g||e[32]!==b||e[33]!==x?(y=d.jsxs("div",{className:u,style:g,children:[b,x]}),e[30]=u,e[31]=g,e[32]=b,e[33]=x,e[34]=y):y=e[34];const v=l==="LR"?Be.Right:Be.Bottom;let C,k;e[35]!==i?(C={background:i},e[35]=i,e[36]=C):C=e[36],e[37]!==v||e[38]!==C?(k=d.jsx(tr,{type:"source",id:"outputs",position:v,style:C}),e[37]=v,e[38]=C,e[39]=k):k=e[39];const N=l==="LR"?Be.Right:Be.Bottom;let j,I,T;return e[40]!==i?(j={background:i},e[40]=i,e[41]=j):j=e[41],e[42]!==N||e[43]!==j?(I=d.jsx(tr,{type:"target",id:"outputs",position:N,style:j}),e[42]=N,e[43]=j,e[44]=I):I=e[44],e[45]!==y||e[46]!==k||e[47]!==I||e[48]!==h||e[49]!==f?(T=d.jsxs("div",{children:[h,f,y,k,I]}),e[45]=y,e[46]=k,e[47]=I,e[48]=h,e[49]=f,e[50]=T):T=e[50],T},(t,e)=>["data","selected","id"].every(n=>t[n]===e[n]));V2.displayName="CustomNode";const $2={custom:V2};function JP(t){const{width:e}=t;return e}const H2=t=>{const e=X.c(18),{maxCount:n,cellIds:o,onClick:r,skipScroll:s}=t,i=Bc();let a,l,c,u;if(e[0]!==o||e[1]!==i||e[2]!==n||e[3]!==r||e[4]!==s){c=Symbol.for("react.early_return_sentinel");e:{let h;e[8]!==i?(h=(_,g)=>i.inOrderIds.indexOf(_)-i.inOrderIds.indexOf(g),e[8]=i,e[9]=h):h=e[9];const f=[...o].sort(h);if(o.length===0){let _;e[10]===Symbol.for("react.memo_cache_sentinel")?(_=d.jsx("div",{className:"text-muted-foreground",children:"--"}),e[10]=_):_=e[10],c=_;break e}let m;e[11]!==o.length||e[12]!==r||e[13]!==s?(m=(_,g)=>d.jsxs("span",{className:"truncate",children:[d.jsx(fr,{variant:"focus",cellId:_,skipScroll:s,className:"whitespace-nowrap",onClick:r?()=>r(_):void 0},_),g<o.length-1&&", "]},_),e[11]=o.length,e[12]=r,e[13]=s,e[14]=m):m=e[14],a=f.slice(0,n).map(m),l=o.length>n&&d.jsxs(zr,{children:[d.jsx(Vs,{asChild:!0,children:d.jsxs("span",{className:"whitespace-nowrap text-muted-foreground text-xs hover:underline cursor-pointer",children:["+",o.length-n," more"]})}),d.jsx(Ps,{className:"w-auto",children:d.jsx("div",{className:"flex flex-col gap-1 py-1",children:f.slice(n).map(_=>d.jsx(fr,{variant:"focus",cellId:_,className:"whitespace-nowrap",onClick:r?()=>r(_):void 0},_))})})]})}e[0]=o,e[1]=i,e[2]=n,e[3]=r,e[4]=s,e[5]=a,e[6]=l,e[7]=c}else a=e[5],l=e[6],c=e[7];return c!==Symbol.for("react.early_return_sentinel")?c:(e[15]!==a||e[16]!==l?(u=d.jsxs(d.Fragment,{children:[a,l]}),e[15]=a,e[16]=l,e[17]=u):u=e[17],u)},uf=t=>{const e=X.c(15);let n,o,r,s;e[0]!==t?({name:o,declaredBy:n,onClick:r,...s}=t,e[0]=t,e[1]=n,e[2]=o,e[3]=r,e[4]=s):(n=e[1],o=e[2],r=e[3],s=e[4]);const i=n.length>1?"destructive":"outline";let a,l,c;return e[5]!==o||e[6]!==r?(a=async u=>{r?r(u):(await _n(o),dt({title:"Copied to clipboard"}))},e[5]=o,e[6]=r,e[7]=a):a=e[7],e[8]!==o||e[9]!==i||e[10]!==a?(l=d.jsx(aS,{title:o,variant:i,className:"rounded-sm text-ellipsis block overflow-hidden max-w-fit cursor-pointer font-medium",onClick:a,children:o}),e[8]=o,e[9]=i,e[10]=a,e[11]=l):l=e[11],e[12]!==s||e[13]!==l?(c=d.jsx("div",{className:"max-w-[130px]",...s,children:l}),e[12]=s,e[13]=l,e[14]=c):c=e[14],c},hf=M.memo(t=>{const e=X.c(38),{onChange:n,view:o,settings:r,onSettingsChange:s}=t;let i;e[0]!==s||e[1]!==r?(i=(D,F)=>{s({...r,[D]:F})},e[0]=s,e[1]=r,e[2]=i):i=e[2];const a=i;let l,c,u,h,f,m;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=d.jsx(Vs,{asChild:!0,children:d.jsx(Me,{variant:"text",size:"xs",children:d.jsx(ym,{className:"w-4 h-4"})})}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx("div",{className:"font-semibold pb-4",children:"Settings"}),e[4]=c):c=e[4],e[5]!==a?(u=D=>a("hidePureMarkdown",!!D),e[5]=a,e[6]=u):u=e[6],e[7]!==r.hidePureMarkdown||e[8]!==u?(h=d.jsx(z4,{"data-testid":"hide-pure-markdown-checkbox",id:"hide-pure-markdown",checked:r.hidePureMarkdown,onCheckedChange:u}),e[7]=r.hidePureMarkdown,e[8]=u,e[9]=h):h=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(f=d.jsx(Or,{htmlFor:"hide-pure-markdown",children:"Hide pure markdown"}),e[10]=f):f=e[10],e[11]!==h?(m=d.jsxs(zr,{children:[l,d.jsxs(Ps,{className:"w-auto p-2 text-muted-foreground",children:[c,d.jsxs("div",{className:"flex items-center gap-2",children:[h,f]})]})]}),e[11]=h,e[12]=m):m=e[12];const _=m,g=o==="_minimap_";let p,b,x;e[13]!==n?(p=()=>n("_minimap_"),e[13]=n,e[14]=p):p=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(b=d.jsx(Pp,{className:"w-4 h-4 mr-1"}),e[15]=b):b=e[15],e[16]!==g||e[17]!==p?(x=d.jsxs(Me,{variant:"outline",className:"bg-background","aria-selected":g,size:"xs",onClick:p,children:[b,"Mini Map"]}),e[16]=g,e[17]=p,e[18]=x):x=e[18];const y=o==="TB";let v,C,k;e[19]!==n?(v=()=>n("TB"),e[19]=n,e[20]=v):v=e[20],e[21]===Symbol.for("react.memo_cache_sentinel")?(C=d.jsx(ya,{className:"w-4 h-4 mr-1"}),e[21]=C):C=e[21],e[22]!==y||e[23]!==v?(k=d.jsxs(Me,{variant:"outline",className:"bg-background","aria-selected":y,size:"xs",onClick:v,children:[C,"Vertical Tree"]}),e[22]=y,e[23]=v,e[24]=k):k=e[24];const N=o==="LR";let j,I,T,A;e[25]!==n?(j=()=>n("LR"),e[25]=n,e[26]=j):j=e[26],e[27]===Symbol.for("react.memo_cache_sentinel")?(I=d.jsx(ya,{className:"w-4 h-4 mr-1 transform -rotate-90"}),e[27]=I):I=e[27],e[28]!==N||e[29]!==j?(T=d.jsxs(Me,{variant:"outline",className:"bg-background","aria-selected":N,size:"xs",onClick:j,children:[I," ","Horizontal Tree"]}),e[28]=N,e[29]=j,e[30]=T):T=e[30],e[31]!==x||e[32]!==k||e[33]!==T?(A=d.jsxs("div",{className:"flex gap-2",children:[x,k,T]}),e[31]=x,e[32]=k,e[33]=T,e[34]=A):A=e[34];const R=o!=="_minimap_"&&_;let z;return e[35]!==A||e[36]!==R?(z=d.jsxs(Ll,{position:"top-right",className:"flex flex-col items-end gap-2",children:[A,R]}),e[35]=A,e[36]=R,e[37]=z):z=e[37],z});hf.displayName="GraphToolbar";const ql=M.memo(t=>{const e=X.c(11),{selection:n,variables:o,onClearSelection:r}=t;if(!n)return null;const s=KP;let i;e[0]!==r||e[1]!==n.id||e[2]!==n.source||e[3]!==n.target||e[4]!==n.type||e[5]!==o?(i=()=>{if(n.type==="node"){const u=Object.values(o).filter(m=>m.usedBy.includes(n.id)),h=Object.values(o).filter(m=>m.declaredBy.includes(n.id)),f=(m,_)=>d.jsxs(d.Fragment,{children:[m.length===0&&d.jsx("div",{className:"text-muted-foreground text-sm text-center",children:"--"}),d.jsx("div",{className:"grid grid-cols-5 gap-3 items-center text-sm py-1 flex-1 empty:hidden",children:m.map(g=>d.jsxs(K.Fragment,{children:[d.jsx(uf,{declaredBy:g.declaredBy,name:g.name}),d.jsxs("div",{className:"truncate col-span-2",title:g.value??"",children:[g.value,d.jsxs("span",{className:"ml-1 truncate text-foreground/60 font-mono",children:["(",g.dataType,")"]})]}),d.jsx("div",{className:"truncate col-span-2 gap-1 items-center",children:d.jsx(H2,{skipScroll:!0,onClick:()=>s(_==="in"?g.declaredBy[0]:g.usedBy[0],g.name),maxCount:3,cellIds:g.usedBy})})]},g.name))})]});return d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"font-bold py-2 flex items-center gap-2 border-b px-3",children:[d.jsx(Kl,{className:"w-5 h-5"}),d.jsx(fr,{cellId:n.id}),d.jsx("div",{className:"flex-1"}),d.jsx(_0,{cellId:n.id,children:d.jsx(Me,{variant:"ghost",size:"icon",children:d.jsx(Kc,{className:"w-4 h-4"})})}),d.jsx(Me,{variant:"text",size:"icon",onClick:()=>{r()},children:d.jsx(eo,{className:"w-4 h-4"})})]}),d.jsxs("div",{className:"text-sm flex flex-col py-3 pl-2 pr-4 flex-1 justify-center",children:[d.jsxs("div",{className:"flex flex-col gap-2",children:[d.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[d.jsx(rp,{className:"w-4 h-4"}),"Outputs"]}),f(h,"out")]}),d.jsx("hr",{className:"border-divider my-3"}),d.jsxs("div",{className:"flex flex-col gap-2",children:[d.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[d.jsx(fn,{className:"w-4 h-4"}),"Inputs"]}),f(u,"in")]})]})]})}if(n.type==="edge"){const u=Object.values(o).filter(h=>h.declaredBy.includes(n.source)&&h.usedBy.includes(n.target));return d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"font-bold py-2 flex items-center gap-2 border-b px-3",children:[d.jsx(va,{className:"w-4 h-4"}),d.jsx(fr,{cellId:n.source}),d.jsx(Gc,{className:"w-4 h-4"}),d.jsx(fr,{cellId:n.target})]}),d.jsx("div",{className:"grid grid-cols-4 gap-3 max-w-[350px] items-center text-sm p-3 flex-1",children:u.map(h=>d.jsxs(K.Fragment,{children:[d.jsx(uf,{declaredBy:h.declaredBy,name:h.name,onClick:()=>{s(h.declaredBy[0],h.name)}}),d.jsx("div",{className:"truncate text-foreground/60 font-mono",children:h.dataType}),d.jsx("div",{className:"truncate col-span-2",title:h.value??"",children:h.value})]},h.name))})]})}},e[0]=r,e[1]=n.id,e[2]=n.source,e[3]=n.target,e[4]=n.type,e[5]=o,e[6]=i):i=e[6];const a=i;let l,c;return e[7]!==a?(l=a(),e[7]=a,e[8]=l):l=e[8],e[9]!==l?(c=d.jsx(Ll,{position:"bottom-left",className:"max-h-[90%] flex flex-col w-[calc(100%-5rem)]",children:d.jsx("div",{className:"min-h-[100px] shadow-md rounded-md border max-w-[550px] border-primary/40 my-4 min-w-[240px] bg-[var(--slate-1)] text-muted-foreground/80 flex flex-col overflow-y-auto",children:l})}),e[9]=l,e[10]=c):c=e[10],c});function KP(t,e){const n=Ql(t);n&&Wm(n,e)}function W2(){const t=X.c(7),e=Bi(),n=mt(ZP),o=mt(XP);let r;t[0]!==e?(r=()=>{e.fitView({duration:100})},t[0]=e,t[1]=r):r=t[1];const s=m$(r,100);let i,a;t[2]!==s||t[3]!==o||t[4]!==n?(i=()=>{n&&o&&s()},a=[n,o,s],t[2]=s,t[3]=o,t[4]=n,t[5]=i,t[6]=a):(i=t[5],a=t[6]),M.useEffect(i,a)}function XP(t){const{height:e}=t;return e}function ZP(t){const{width:e}=t;return e}ql.displayName="GraphSelectionPanel";const q2=new class{createEdge(t,e,n){return{type:"smoothstep",pathOptions:{offset:20,borderRadius:100},data:{direction:n},markerEnd:{type:_s.Arrow},id:`${t}-${e}-${n}`,source:t,sourceHandle:n,targetHandle:n,target:e}}createNode(t,e,n){return{id:t,data:{atom:e},width:250,type:"custom",height:df(lt.get(e).code.trim().split(`
|
143
|
-
`).length),position:{x:0,y:n+20}}}createElements(t,e,n,o){let r=0;const s=[],i=[];for(const[l,c]of $m.zip(t,e)){const u=this.createNode(l,c,r);s.push(u),r=u.position.y+(u.height||0)}const a=new Set;for(const l of Object.values(n)){const{declaredBy:c,usedBy:u}=l;for(const h of c)for(const f of u){const m=`${h}-${f}`;a.has(m)||(a.add(m),i.push(this.createEdge(h,f,"inputs"),this.createEdge(h,f,"outputs")))}}return{nodes:s,edges:i}}},QP=t=>{const e=X.c(37),{cellIds:n,variables:o,cellAtoms:r,children:s}=t;let i;e[0]!==r||e[1]!==n||e[2]!==o?(i=q2.createElements(n,r,o,!1),e[0]=r,e[1]=n,e[2]=o,e[3]=i):i=e[3];const{nodes:a,edges:l}=i;let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=[],e[4]=c):c=e[4];const[u,h]=F2(c),[f,m]=L2(a),[_,g]=M.useState(),[p,b]=M.useState(),x=M.useRef(!1);W2();const y=mt(eL);let v;e[5]!==h||e[6]!==m?(v=S=>{m(S.nodes),h([])},e[5]=h,e[6]=m,e[7]=v):v=e[7];const C=Ke(v);let k,N,j,I;e[8]!==r||e[9]!==n||e[10]!==C||e[11]!==o?(k=()=>{x.current?C(q2.createElements(n,r,o,!1)):x.current=!0},N=[n,o,r,C],e[8]=r,e[9]=n,e[10]=C,e[11]=o,e[12]=k,e[13]=N):(k=e[12],N=e[13]),M.useEffect(k,N),e[14]!==l||e[15]!==_||e[16]!==h?(j=()=>{if(_){const S=l.filter($=>{const{source:E,target:W,data:G}=$;return E===_&&G.direction==="outputs"||W===_&&G.direction==="inputs"});h(S)}},I=[_,h,l],e[14]=l,e[15]=_,e[16]=h,e[17]=j,e[18]=I):(j=e[17],I=e[18]),M.useEffect(j,I);const T=function(S,$){const E=X.c(17);let W,G;if(E[0]!==$||E[1]!==S){let Q;E[3]!==$?(Q=(ue,me)=>{const{position:ce}=me;return Math.min(ue,ce.y-$/2-10)},E[3]=$,E[4]=Q):Q=E[4],G=S.reduce(Q,Number.POSITIVE_INFINITY),E[0]=$,E[1]=S,E[2]=G}else G=E[2];const q=G;let Y;if(E[5]!==$||E[6]!==S){let Q;E[8]!==$?(Q=(ue,me)=>{const{position:ce}=me;return Math.max(ue,ce.y+$/2+10)},E[8]=$,E[9]=Q):Q=E[9],Y=S.reduce(Q,Number.NEGATIVE_INFINITY),E[5]=$,E[6]=S,E[7]=Y}else Y=E[7];const te=Y;let oe,se,Z;return E[10]!==q?(oe=[Number.NEGATIVE_INFINITY,q],E[10]=q,E[11]=oe):oe=E[11],E[12]!==te?(se=[Number.POSITIVE_INFINITY,te],E[12]=te,E[13]=se):se=E[13],E[14]!==oe||E[15]!==se?(Z=[oe,se],E[14]=oe,E[15]=se,E[16]=Z):Z=E[16],W=Z,W}(f,y);let A;e[19]===Symbol.for("react.memo_cache_sentinel")?(A=()=>{g(void 0),b(void 0)},e[19]=A):A=e[19];const R=A;let z;e[20]!==u||e[21]!==p||e[22]!==_||e[23]!==o?(z=()=>p?d.jsx(ql,{selection:{type:"edge",source:p.source,target:p.target},onClearSelection:R,variables:o,edges:u}):_?d.jsx(ql,{selection:{type:"node",id:_},variables:o,edges:u,onClearSelection:R}):null,e[20]=u,e[21]=p,e[22]=_,e[23]=o,e[24]=z):z=e[24];const D=z;let F,B,U,O;return e[25]!==h?(F=(S,$)=>{const E=$.id;g(E),b(void 0),h([])},e[25]=h,e[26]=F):F=e[26],e[27]===Symbol.for("react.memo_cache_sentinel")?(B=(S,$)=>{b($)},e[27]=B):B=e[27],e[28]!==D?(U=D(),e[28]=D,e[29]=U):U=e[29],e[30]!==s||e[31]!==u||e[32]!==f||e[33]!==F||e[34]!==U||e[35]!==T?(O=d.jsxs(cf,{nodes:f,edges:u,nodeTypes:$2,translateExtent:T,onNodeClick:F,onNodeDoubleClick:tL,onEdgeClick:B,snapToGrid:!0,fitView:!0,elementsSelectable:!0,minZoom:1,maxZoom:1,draggable:!1,panOnScrollMode:Qo.Vertical,zoomOnDoubleClick:!1,nodesDraggable:!1,nodesConnectable:!1,nodesFocusable:!1,edgesFocusable:!1,selectNodesOnDrag:!1,panOnDrag:!1,preventScrolling:!1,zoomOnPinch:!1,panOnScroll:!0,autoPanOnNodeDrag:!1,autoPanOnConnect:!1,children:[U,s]}),e[30]=s,e[31]=u,e[32]=f,e[33]=F,e[34]=U,e[35]=T,e[36]=O):O=e[36],O};function eL(t){const{height:e}=t;return e}function tL(t,e){lS(e.id,"focus")}var ff,G2,Y2,J2,K2,X2,mf,Z2,pf,Q2,gf,ek,_f,tk,bf,nk,xf,ok,yf,rk,wf,sk,vf,ik,kf,ak,Sf,lk,Cf,ck,Nf,dk,jf,uk,hk,fk,mk,pk,gk,_k,Ef,bk,If,xk,Af,yk,Tf,wk,Mf,vk,Of,kk,Df,Sk,Rf,Ck,Pf,Nk,Lf,jk,Ff,Ek,zf,Ik,Bf,Ak,Uf,Tk,Mk,Ok,Dk,Rk,Pk,Lk,Vf,Fk,$f,zk,Bk,Uk,Hf,Vk,Wf,$k,qf,Hk,Gf,Wk,Yf,qk,Gk,Yk,Jk,Kk;function Jf(){if(G2)return ff;G2=1;var t="\0";function e(s,i){s[i]?s[i]++:s[i]=1}function n(s,i){--s[i]||delete s[i]}function o(s,i,a,l){var c=""+i,u=""+a;if(!s&&c>u){var h=c;c=u,u=h}return c+""+u+""+(l===void 0?"\0":l)}function r(s,i){return o(s,i.v,i.w,i.name)}return ff=class{constructor(s){ee(this,"_isDirected",!0);ee(this,"_isMultigraph",!1);ee(this,"_isCompound",!1);ee(this,"_label");ee(this,"_defaultNodeLabelFn",()=>{});ee(this,"_defaultEdgeLabelFn",()=>{});ee(this,"_nodes",{});ee(this,"_in",{});ee(this,"_preds",{});ee(this,"_out",{});ee(this,"_sucs",{});ee(this,"_edgeObjs",{});ee(this,"_edgeLabels",{});ee(this,"_nodeCount",0);ee(this,"_edgeCount",0);ee(this,"_parent");ee(this,"_children");s&&(this._isDirected=!Object.hasOwn(s,"directed")||s.directed,this._isMultigraph=!!Object.hasOwn(s,"multigraph")&&s.multigraph,this._isCompound=!!Object.hasOwn(s,"compound")&&s.compound),this._isCompound&&(this._parent={},this._children={},this._children[t]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(s){return this._label=s,this}graph(){return this._label}setDefaultNodeLabel(s){return this._defaultNodeLabelFn=s,typeof s!="function"&&(this._defaultNodeLabelFn=()=>s),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var s=this;return this.nodes().filter(i=>Object.keys(s._in[i]).length===0)}sinks(){var s=this;return this.nodes().filter(i=>Object.keys(s._out[i]).length===0)}setNodes(s,i){var a=arguments,l=this;return s.forEach(function(c){a.length>1?l.setNode(c,i):l.setNode(c)}),this}setNode(s,i){return Object.hasOwn(this._nodes,s)?(arguments.length>1&&(this._nodes[s]=i),this):(this._nodes[s]=arguments.length>1?i:this._defaultNodeLabelFn(s),this._isCompound&&(this._parent[s]=t,this._children[s]={},this._children[t][s]=!0),this._in[s]={},this._preds[s]={},this._out[s]={},this._sucs[s]={},++this._nodeCount,this)}node(s){return this._nodes[s]}hasNode(s){return Object.hasOwn(this._nodes,s)}removeNode(s){var i=this;if(Object.hasOwn(this._nodes,s)){var a=l=>i.removeEdge(i._edgeObjs[l]);delete this._nodes[s],this._isCompound&&(this._removeFromParentsChildList(s),delete this._parent[s],this.children(s).forEach(function(l){i.setParent(l)}),delete this._children[s]),Object.keys(this._in[s]).forEach(a),delete this._in[s],delete this._preds[s],Object.keys(this._out[s]).forEach(a),delete this._out[s],delete this._sucs[s],--this._nodeCount}return this}setParent(s,i){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(i===void 0)i=t;else{for(var a=i+="";a!==void 0;a=this.parent(a))if(a===s)throw new Error("Setting "+i+" as parent of "+s+" would create a cycle");this.setNode(i)}return this.setNode(s),this._removeFromParentsChildList(s),this._parent[s]=i,this._children[i][s]=!0,this}_removeFromParentsChildList(s){delete this._children[this._parent[s]][s]}parent(s){if(this._isCompound){var i=this._parent[s];if(i!==t)return i}}children(s=t){if(this._isCompound){var i=this._children[s];if(i)return Object.keys(i)}else{if(s===t)return this.nodes();if(this.hasNode(s))return[]}}predecessors(s){var i=this._preds[s];if(i)return Object.keys(i)}successors(s){var i=this._sucs[s];if(i)return Object.keys(i)}neighbors(s){var i=this.predecessors(s);if(i){const l=new Set(i);for(var a of this.successors(s))l.add(a);return Array.from(l.values())}}isLeaf(s){return(this.isDirected()?this.successors(s):this.neighbors(s)).length===0}filterNodes(s){var i=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});i.setGraph(this.graph());var a=this;Object.entries(this._nodes).forEach(function([u,h]){s(u)&&i.setNode(u,h)}),Object.values(this._edgeObjs).forEach(function(u){i.hasNode(u.v)&&i.hasNode(u.w)&&i.setEdge(u,a.edge(u))});var l={};function c(u){var h=a.parent(u);return h===void 0||i.hasNode(h)?(l[u]=h,h):h in l?l[h]:c(h)}return this._isCompound&&i.nodes().forEach(u=>i.setParent(u,c(u))),i}setDefaultEdgeLabel(s){return this._defaultEdgeLabelFn=s,typeof s!="function"&&(this._defaultEdgeLabelFn=()=>s),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(s,i){var a=this,l=arguments;return s.reduce(function(c,u){return l.length>1?a.setEdge(c,u,i):a.setEdge(c,u),u}),this}setEdge(){var s,i,a,l,c=!1,u=arguments[0];typeof u=="object"&&u!==null&&"v"in u?(s=u.v,i=u.w,a=u.name,arguments.length===2&&(l=arguments[1],c=!0)):(s=u,i=arguments[1],a=arguments[3],arguments.length>2&&(l=arguments[2],c=!0)),s=""+s,i=""+i,a!==void 0&&(a=""+a);var h=o(this._isDirected,s,i,a);if(Object.hasOwn(this._edgeLabels,h))return c&&(this._edgeLabels[h]=l),this;if(a!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(s),this.setNode(i),this._edgeLabels[h]=c?l:this._defaultEdgeLabelFn(s,i,a);var f=function(m,_,g,p){var b=""+_,x=""+g;if(!m&&b>x){var y=b;b=x,x=y}var v={v:b,w:x};return p&&(v.name=p),v}(this._isDirected,s,i,a);return s=f.v,i=f.w,Object.freeze(f),this._edgeObjs[h]=f,e(this._preds[i],s),e(this._sucs[s],i),this._in[i][h]=f,this._out[s][h]=f,this._edgeCount++,this}edge(s,i,a){var l=arguments.length===1?r(this._isDirected,arguments[0]):o(this._isDirected,s,i,a);return this._edgeLabels[l]}edgeAsObj(){const s=this.edge(...arguments);return typeof s!="object"?{label:s}:s}hasEdge(s,i,a){var l=arguments.length===1?r(this._isDirected,arguments[0]):o(this._isDirected,s,i,a);return Object.hasOwn(this._edgeLabels,l)}removeEdge(s,i,a){var l=arguments.length===1?r(this._isDirected,arguments[0]):o(this._isDirected,s,i,a),c=this._edgeObjs[l];return c&&(s=c.v,i=c.w,delete this._edgeLabels[l],delete this._edgeObjs[l],n(this._preds[i],s),n(this._sucs[s],i),delete this._in[i][l],delete this._out[s][l],this._edgeCount--),this}inEdges(s,i){var a=this._in[s];if(a){var l=Object.values(a);return i?l.filter(c=>c.v===i):l}}outEdges(s,i){var a=this._out[s];if(a){var l=Object.values(a);return i?l.filter(c=>c.w===i):l}}nodeEdges(s,i){var a=this.inEdges(s,i);if(a)return a.concat(this.outEdges(s,i))}},ff}function nL(){return X2?K2:(X2=1,K2={Graph:Jf(),version:J2?Y2:(J2=1,Y2="2.2.4")})}function oL(){if(Z2)return mf;Z2=1;var t=Jf();function e(o){return o.nodes().map(function(r){var s=o.node(r),i=o.parent(r),a={v:r};return s!==void 0&&(a.value=s),i!==void 0&&(a.parent=i),a})}function n(o){return o.edges().map(function(r){var s=o.edge(r),i={v:r.v,w:r.w};return r.name!==void 0&&(i.name=r.name),s!==void 0&&(i.value=s),i})}return mf={write:function(o){var r={options:{directed:o.isDirected(),multigraph:o.isMultigraph(),compound:o.isCompound()},nodes:e(o),edges:n(o)};return o.graph()!==void 0&&(r.value=structuredClone(o.graph())),r},read:function(o){var r=new t(o.options).setGraph(o.value);return o.nodes.forEach(function(s){r.setNode(s.v,s.value),s.parent&&r.setParent(s.v,s.parent)}),o.edges.forEach(function(s){r.setEdge({v:s.v,w:s.w,name:s.name},s.value)}),r}},mf}function rL(){return Q2||(Q2=1,pf=function(t){var e,n={},o=[];function r(s){Object.hasOwn(n,s)||(n[s]=!0,e.push(s),t.successors(s).forEach(r),t.predecessors(s).forEach(r))}return t.nodes().forEach(function(s){e=[],r(s),e.length&&o.push(e)}),o}),pf}function Xk(){return ek?gf:(ek=1,gf=class{constructor(){ee(this,"_arr",[]);ee(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map(function(t){return t.key})}has(t){return Object.hasOwn(this._keyIndices,t)}priority(t){var e=this._keyIndices[t];if(e!==void 0)return this._arr[e].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(t,e){var n=this._keyIndices;if(t=String(t),!Object.hasOwn(n,t)){var o=this._arr,r=o.length;return n[t]=r,o.push({key:t,priority:e}),this._decrease(r),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key}decrease(t,e){var n=this._keyIndices[t];if(e>this._arr[n].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[n].priority+" New: "+e);this._arr[n].priority=e,this._decrease(n)}_heapify(t){var e=this._arr,n=2*t,o=n+1,r=t;n<e.length&&(r=e[n].priority<e[r].priority?n:r,o<e.length&&(r=e[o].priority<e[r].priority?o:r),r!==t&&(this._swap(t,r),this._heapify(r)))}_decrease(t){for(var e,n=this._arr,o=n[t].priority;t!==0&&!(n[e=t>>1].priority<o);)this._swap(t,e),t=e}_swap(t,e){var n=this._arr,o=this._keyIndices,r=n[t],s=n[e];n[t]=s,n[e]=r,o[s.key]=t,o[r.key]=e}},gf)}function Zk(){if(tk)return _f;tk=1;var t=Xk();_f=function(n,o,r,s){return function(i,a,l,c){var u,h,f={},m=new t,_=function(g){var p=g.v!==u?g.v:g.w,b=f[p],x=l(g),y=h.distance+x;if(x<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+g+" Weight: "+x);y<b.distance&&(b.distance=y,b.predecessor=u,m.decrease(p,y))};for(i.nodes().forEach(function(g){var p=g===a?0:Number.POSITIVE_INFINITY;f[g]={distance:p},m.add(g,p)});m.size()>0&&(u=m.removeMin(),(h=f[u]).distance!==Number.POSITIVE_INFINITY);)c(u).forEach(_);return f}(n,String(o),r||e,s||function(i){return n.outEdges(i)})};var e=()=>1;return _f}function sL(){if(nk)return bf;nk=1;var t=Zk();return bf=function(e,n,o){return e.nodes().reduce(function(r,s){return r[s]=t(e,s,n,o),r},{})},bf}function Qk(){return ok||(ok=1,xf=function(t){var e=0,n=[],o={},r=[];function s(i){var a=o[i]={onStack:!0,lowlink:e,index:e++};if(n.push(i),t.successors(i).forEach(function(u){Object.hasOwn(o,u)?o[u].onStack&&(a.lowlink=Math.min(a.lowlink,o[u].index)):(s(u),a.lowlink=Math.min(a.lowlink,o[u].lowlink))}),a.lowlink===a.index){var l,c=[];do l=n.pop(),o[l].onStack=!1,c.push(l);while(i!==l);r.push(c)}}return t.nodes().forEach(function(i){Object.hasOwn(o,i)||s(i)}),r}),xf}function iL(){if(rk)return yf;rk=1;var t=Qk();return yf=function(e){return t(e).filter(function(n){return n.length>1||n.length===1&&e.hasEdge(n[0],n[0])})},yf}function aL(){if(sk)return wf;sk=1,wf=function(e,n,o){return function(r,s,i){var a={},l=r.nodes();return l.forEach(function(c){a[c]={},a[c][c]={distance:0},l.forEach(function(u){c!==u&&(a[c][u]={distance:Number.POSITIVE_INFINITY})}),i(c).forEach(function(u){var h=u.v===c?u.w:u.v,f=s(u);a[c][h]={distance:f,predecessor:c}})}),l.forEach(function(c){var u=a[c];l.forEach(function(h){var f=a[h];l.forEach(function(m){var _=f[c],g=u[m],p=f[m],b=_.distance+g.distance;b<p.distance&&(p.distance=b,p.predecessor=g.predecessor)})})}),a}(e,n||t,o||function(r){return e.outEdges(r)})};var t=()=>1;return wf}function e3(){if(ik)return vf;function t(n){var o={},r={},s=[];if(n.sinks().forEach(function i(a){if(Object.hasOwn(r,a))throw new e;Object.hasOwn(o,a)||(r[a]=!0,o[a]=!0,n.predecessors(a).forEach(i),delete r[a],s.push(a))}),Object.keys(o).length!==n.nodeCount())throw new e;return s}ik=1;class e extends Error{constructor(){super(...arguments)}}return vf=t,t.CycleException=e,vf}function lL(){if(ak)return kf;ak=1;var t=e3();return kf=function(e){try{t(e)}catch(n){if(n instanceof t.CycleException)return!1;throw n}return!0},kf}function t3(){if(lk)return Sf;function t(o,r,s,i){for(var a=[[o,!1]];a.length>0;){var l=a.pop();l[1]?i.push(l[0]):Object.hasOwn(s,l[0])||(s[l[0]]=!0,a.push([l[0],!0]),n(r(l[0]),c=>a.push([c,!1])))}}function e(o,r,s,i){for(var a=[o];a.length>0;){var l=a.pop();Object.hasOwn(s,l)||(s[l]=!0,i.push(l),n(r(l),c=>a.push(c)))}}function n(o,r){for(var s=o.length;s--;)r(o[s],s,o);return o}return lk=1,Sf=function(o,r,s){Array.isArray(r)||(r=[r]);var i=o.isDirected()?u=>o.successors(u):u=>o.neighbors(u),a=s==="post"?t:e,l=[],c={};return r.forEach(u=>{if(!o.hasNode(u))throw new Error("Graph does not have node: "+u);a(u,i,c,l)}),l},Sf}function cL(){if(ck)return Cf;ck=1;var t=t3();return Cf=function(e,n){return t(e,n,"post")},Cf}function dL(){if(dk)return Nf;dk=1;var t=t3();return Nf=function(e,n){return t(e,n,"pre")},Nf}function uL(){if(uk)return jf;uk=1;var t=Jf(),e=Xk();return jf=function(n,o){var r,s=new t,i={},a=new e;function l(u){var h=u.v===r?u.w:u.v,f=a.priority(h);if(f!==void 0){var m=o(u);m<f&&(i[h]=r,a.decrease(h,m))}}if(n.nodeCount()===0)return s;n.nodes().forEach(function(u){a.add(u,Number.POSITIVE_INFINITY),s.setNode(u)}),a.decrease(n.nodes()[0],0);for(var c=!1;a.size()>0;){if(r=a.removeMin(),Object.hasOwn(i,r))s.setEdge(r,i[r]);else{if(c)throw new Error("Input graph is not connected: "+n);c=!0}n.nodeEdges(r).forEach(l)}return s},jf}function Xn(){if(pk)return mk;pk=1;var t=nL();return mk={Graph:t.Graph,json:oL(),alg:fk?hk:(fk=1,hk={components:rL(),dijkstra:Zk(),dijkstraAll:sL(),findCycles:iL(),floydWarshall:aL(),isAcyclic:lL(),postorder:cL(),preorder:dL(),prim:uL(),tarjan:Qk(),topsort:e3()}),version:t.version}}function hL(){if(bk)return Ef;bk=1;let t=Xn().Graph,e=function(){if(_k)return gk;function s(a){a._prev._next=a._next,a._next._prev=a._prev,delete a._next,delete a._prev}function i(a,l){if(a!=="_next"&&a!=="_prev")return l}return _k=1,gk=class{constructor(){let a={};a._next=a._prev=a,this._sentinel=a}dequeue(){let a=this._sentinel,l=a._prev;if(l!==a)return s(l),l}enqueue(a){let l=this._sentinel;a._prev&&a._next&&s(a),a._next=l._next,l._next._prev=a,l._next=a,a._prev=l}toString(){let a=[],l=this._sentinel,c=l._prev;for(;c!==l;)a.push(JSON.stringify(c,i)),c=c._prev;return"["+a.join(", ")+"]"}}}();Ef=function(s,i){if(s.nodeCount()<=1)return[];let a=function(l,c){let u=new t,h=0,f=0;l.nodes().forEach(g=>{u.setNode(g,{v:g,in:0,out:0})}),l.edges().forEach(g=>{let p=u.edge(g.v,g.w)||0,b=c(g),x=p+b;u.setEdge(g.v,g.w,x),f=Math.max(f,u.node(g.v).out+=b),h=Math.max(h,u.node(g.w).in+=b)});let m=function(g){const p=[];for(let b=0;b<g;b++)p.push(b);return p}(f+h+3).map(()=>new e),_=h+1;return u.nodes().forEach(g=>{r(m,_,u.node(g))}),{graph:u,buckets:m,zeroIdx:_}}(s,i||n);return function(l,c,u){let h,f=[],m=c[c.length-1],_=c[0];for(;l.nodeCount();){for(;h=_.dequeue();)o(l,c,u,h);for(;h=m.dequeue();)o(l,c,u,h);if(l.nodeCount()){for(let g=c.length-2;g>0;--g)if(h=c[g].dequeue(),h){f=f.concat(o(l,c,u,h,!0));break}}}return f}(a.graph,a.buckets,a.zeroIdx).flatMap(l=>s.outEdges(l.v,l.w))};let n=()=>1;function o(s,i,a,l,c){let u=c?[]:void 0;return s.inEdges(l.v).forEach(h=>{let f=s.edge(h),m=s.node(h.v);c&&u.push({v:h.v,w:h.w}),m.out-=f,r(i,a,m)}),s.outEdges(l.v).forEach(h=>{let f=s.edge(h),m=h.w,_=s.node(m);_.in-=f,r(i,a,_)}),s.removeNode(l.v),u}function r(s,i,a){a.out?a.in?s[a.out-a.in+i].enqueue(a):s[s.length-1].enqueue(a):s[0].enqueue(a)}return Ef}function Rt(){if(xk)return If;xk=1;let t=Xn().Graph;function e(c,u,h,f){for(var m=f;c.hasNode(m);)m=i(f);return h.dummy=u,c.setNode(m,h),m}If={addBorderNode:function(c,u,h,f){let m={width:0,height:0};return arguments.length>=4&&(m.rank=h,m.order=f),e(c,"border",m,u)},addDummyNode:e,applyWithChunking:o,asNonCompoundGraph:function(c){let u=new t({multigraph:c.isMultigraph()}).setGraph(c.graph());return c.nodes().forEach(h=>{c.children(h).length||u.setNode(h,c.node(h))}),c.edges().forEach(h=>{u.setEdge(h,c.edge(h))}),u},buildLayerMatrix:function(c){let u=a(r(c)+1).map(()=>[]);return c.nodes().forEach(h=>{let f=c.node(h),m=f.rank;m!==void 0&&(u[m][f.order]=h)}),u},intersectRect:function(c,u){let h,f,m=c.x,_=c.y,g=u.x-m,p=u.y-_,b=c.width/2,x=c.height/2;if(!g&&!p)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(p)*b>Math.abs(g)*x?(p<0&&(x=-x),h=x*g/p,f=x):(g<0&&(b=-b),h=b,f=b*p/g),{x:m+h,y:_+f}},mapValues:function(c,u){let h=u;return typeof u=="string"&&(h=f=>f[u]),Object.entries(c).reduce((f,[m,_])=>(f[m]=h(_,m),f),{})},maxRank:r,normalizeRanks:function(c){let u=c.nodes().map(f=>{let m=c.node(f).rank;return m===void 0?Number.MAX_VALUE:m}),h=o(Math.min,u);c.nodes().forEach(f=>{let m=c.node(f);Object.hasOwn(m,"rank")&&(m.rank-=h)})},notime:function(c,u){return u()},partition:function(c,u){let h={lhs:[],rhs:[]};return c.forEach(f=>{u(f)?h.lhs.push(f):h.rhs.push(f)}),h},pick:function(c,u){const h={};for(const f of u)c[f]!==void 0&&(h[f]=c[f]);return h},predecessorWeights:function(c){let u=c.nodes().map(h=>{let f={};return c.inEdges(h).forEach(m=>{f[m.v]=(f[m.v]||0)+c.edge(m).weight}),f});return l(c.nodes(),u)},range:a,removeEmptyRanks:function(c){let u=c.nodes().map(g=>c.node(g).rank),h=o(Math.min,u),f=[];c.nodes().forEach(g=>{let p=c.node(g).rank-h;f[p]||(f[p]=[]),f[p].push(g)});let m=0,_=c.graph().nodeRankFactor;Array.from(f).forEach((g,p)=>{g===void 0&&p%_!==0?--m:g!==void 0&&m&&g.forEach(b=>c.node(b).rank+=m)})},simplify:function(c){let u=new t().setGraph(c.graph());return c.nodes().forEach(h=>u.setNode(h,c.node(h))),c.edges().forEach(h=>{let f=u.edge(h.v,h.w)||{weight:0,minlen:1},m=c.edge(h);u.setEdge(h.v,h.w,{weight:f.weight+m.weight,minlen:Math.max(f.minlen,m.minlen)})}),u},successorWeights:function(c){let u=c.nodes().map(h=>{let f={};return c.outEdges(h).forEach(m=>{f[m.w]=(f[m.w]||0)+c.edge(m).weight}),f});return l(c.nodes(),u)},time:function(c,u){let h=Date.now();try{return u()}finally{console.log(c+" time: "+(Date.now()-h)+"ms")}},uniqueId:i,zipObject:l};const n=65535;function o(c,u){if(u.length>n){const h=function(f,m=n){const _=[];for(let g=0;g<f.length;g+=m){const p=f.slice(g,g+m);_.push(p)}return _}(u);return c.apply(null,h.map(f=>c.apply(null,f)))}return c.apply(null,u)}function r(c){const u=c.nodes().map(h=>{let f=c.node(h).rank;return f===void 0?Number.MIN_VALUE:f});return o(Math.max,u)}let s=0;function i(c){return c+""+ ++s}function a(c,u,h=1){u==null&&(u=c,c=0);let f=_=>_<u;h<0&&(f=_=>u<_);const m=[];for(let _=c;f(_);_+=h)m.push(_);return m}function l(c,u){return c.reduce((h,f,m)=>(h[f]=u[m],h),{})}return If}function fL(){if(yk)return Af;yk=1;let t=hL(),e=Rt().uniqueId;return Af={run:function(n){(n.graph().acyclicer==="greedy"?t(n,function(r){return s=>r.edge(s).weight}(n)):function(r){let s=[],i={},a={};function l(c){Object.hasOwn(a,c)||(a[c]=!0,i[c]=!0,r.outEdges(c).forEach(u=>{Object.hasOwn(i,u.w)?s.push(u):l(u.w)}),delete i[c])}return r.nodes().forEach(l),s}(n)).forEach(r=>{let s=n.edge(r);n.removeEdge(r),s.forwardName=r.name,s.reversed=!0,n.setEdge(r.w,r.v,s,e("rev"))})},undo:function(n){n.edges().forEach(o=>{let r=n.edge(o);if(r.reversed){n.removeEdge(o);let s=r.forwardName;delete r.reversed,delete r.forwardName,n.setEdge(o.w,o.v,r,s)}})}},Af}function mL(){if(wk)return Tf;wk=1;let t=Rt();return Tf={run:function(e){e.graph().dummyChains=[],e.edges().forEach(n=>function(o,r){let s,i,a,l=r.v,c=o.node(l).rank,u=r.w,h=o.node(u).rank,f=r.name,m=o.edge(r),_=m.labelRank;if(h!==c+1){for(o.removeEdge(r),a=0,++c;c<h;++a,++c)m.points=[],i={width:0,height:0,edgeLabel:m,edgeObj:r,rank:c},s=t.addDummyNode(o,"edge",i,"_d"),c===_&&(i.width=m.width,i.height=m.height,i.dummy="edge-label",i.labelpos=m.labelpos),o.setEdge(l,s,{weight:m.weight},f),a===0&&o.graph().dummyChains.push(s),l=s;o.setEdge(l,u,{weight:m.weight},f)}}(e,n))},undo:function(e){e.graph().dummyChains.forEach(n=>{let o,r=e.node(n),s=r.edgeLabel;for(e.setEdge(r.edgeObj,s);r.dummy;)o=e.successors(n)[0],e.removeNode(n),s.points.push({x:r.x,y:r.y}),r.dummy==="edge-label"&&(s.x=r.x,s.y=r.y,s.width=r.width,s.height=r.height),n=o,r=e.node(n)})}},Tf}function Gl(){if(vk)return Mf;vk=1;const{applyWithChunking:t}=Rt();return Mf={longestPath:function(e){var n={};e.sources().forEach(function o(r){var s=e.node(r);if(Object.hasOwn(n,r))return s.rank;n[r]=!0;let i=e.outEdges(r).map(l=>l==null?Number.POSITIVE_INFINITY:o(l.w)-e.edge(l).minlen);var a=t(Math.min,i);return a===Number.POSITIVE_INFINITY&&(a=0),s.rank=a})},slack:function(e,n){return e.node(n.w).rank-e.node(n.v).rank-e.edge(n).minlen}},Mf}function n3(){if(kk)return Of;kk=1;var t=Xn().Graph,e=Gl().slack;function n(s,i){return s.nodes().forEach(function a(l){i.nodeEdges(l).forEach(c=>{var u=c.v,h=l===u?c.w:u;s.hasNode(h)||e(i,c)||(s.setNode(h,{}),s.setEdge(l,h,{}),a(h))})}),s.nodeCount()}function o(s,i){return i.edges().reduce((a,l)=>{let c=Number.POSITIVE_INFINITY;return s.hasNode(l.v)!==s.hasNode(l.w)&&(c=e(i,l)),c<a[0]?[c,l]:a},[Number.POSITIVE_INFINITY,null])[1]}function r(s,i,a){s.nodes().forEach(l=>i.node(l).rank+=a)}return Of=function(s){var i,a,l=new t({directed:!1}),c=s.nodes()[0],u=s.nodeCount();for(l.setNode(c,{});n(l,s)<u;)i=o(l,s),a=l.hasNode(i.v)?e(s,i):-e(s,i),r(l,s,a);return l},Of}function pL(){if(Sk)return Df;Sk=1;var t=n3(),e=Gl().slack,n=Gl().longestPath,o=Xn().alg.preorder,r=Xn().alg.postorder,s=Rt().simplify;function i(g){g=s(g),n(g);var p,b=t(g);for(c(b),a(b,g);p=h(b);)m(b,g,p,f(b,g,p))}function a(g,p){var b=r(g,g.nodes());(b=b.slice(0,b.length-1)).forEach(x=>function(y,v,C){var k=y.node(C),N=k.parent;y.edge(C,N).cutvalue=l(y,v,C)}(g,p,x))}function l(g,p,b){var x=g.node(b).parent,y=!0,v=p.edge(b,x),C=0;return v||(y=!1,v=p.edge(x,b)),C=v.weight,p.nodeEdges(b).forEach(k=>{var N,j,I=k.v===b,T=I?k.w:k.v;if(T!==x){var A=I===y,R=p.edge(k).weight;if(C+=A?R:-R,N=b,j=T,g.hasEdge(N,j)){var z=g.edge(b,T).cutvalue;C+=A?-z:z}}}),C}function c(g,p){arguments.length<2&&(p=g.nodes()[0]),u(g,{},1,p)}function u(g,p,b,x,y){var v=b,C=g.node(x);return p[x]=!0,g.neighbors(x).forEach(k=>{Object.hasOwn(p,k)||(b=u(g,p,b,k,x))}),C.low=v,C.lim=b++,y?C.parent=y:delete C.parent,b}function h(g){return g.edges().find(p=>g.edge(p).cutvalue<0)}function f(g,p,b){var x=b.v,y=b.w;p.hasEdge(x,y)||(x=b.w,y=b.v);var v=g.node(x),C=g.node(y),k=v,N=!1;v.lim>C.lim&&(k=C,N=!0);var j=p.edges().filter(I=>N===_(g,g.node(I.v),k)&&N!==_(g,g.node(I.w),k));return j.reduce((I,T)=>e(p,T)<e(p,I)?T:I)}function m(g,p,b,x){var y=b.v,v=b.w;g.removeEdge(y,v),g.setEdge(x.v,x.w,{}),c(g),a(g,p),function(C,k){var N=C.nodes().find(I=>!k.node(I).parent),j=o(C,N);(j=j.slice(1)).forEach(I=>{var T=C.node(I).parent,A=k.edge(I,T),R=!1;A||(A=k.edge(T,I),R=!0),k.node(I).rank=k.node(T).rank+(R?A.minlen:-A.minlen)})}(g,p)}function _(g,p,b){return b.low<=p.lim&&p.lim<=b.lim}return Df=i,i.initLowLimValues=c,i.initCutValues=a,i.calcCutValue=l,i.leaveEdge=h,i.enterEdge=f,i.exchangeEdges=m,Df}function gL(){if(Ck)return Rf;Ck=1;var t=Gl().longestPath,e=n3(),n=pL();Rf=function(s){var i=s.graph().ranker;if(i instanceof Function)return i(s);switch(s.graph().ranker){case"network-simplex":default:r(s);break;case"tight-tree":(function(a){t(a),e(a)})(s);break;case"longest-path":o(s);case"none":}};var o=t;function r(s){n(s)}return Rf}function _L(){return Nk||(Nk=1,Pf=function(t){let e=function(n){let o={},r=0;function s(i){let a=r;n.children(i).forEach(s),o[i]={low:a,lim:r++}}return n.children().forEach(s),o}(t);t.graph().dummyChains.forEach(n=>{let o=t.node(n),r=o.edgeObj,s=function(h,f,m,_){let g,p,b=[],x=[],y=Math.min(f[m].low,f[_].low),v=Math.max(f[m].lim,f[_].lim);g=m;do g=h.parent(g),b.push(g);while(g&&(f[g].low>y||v>f[g].lim));for(p=g,g=_;(g=h.parent(g))!==p;)x.push(g);return{path:b.concat(x.reverse()),lca:p}}(t,e,r.v,r.w),i=s.path,a=s.lca,l=0,c=i[l],u=!0;for(;n!==r.w;){if(o=t.node(n),u){for(;(c=i[l])!==a&&t.node(c).maxRank<o.rank;)l++;c===a&&(u=!1)}if(!u){for(;l<i.length-1&&t.node(c=i[l+1]).minRank<=o.rank;)l++;c=i[l]}t.setParent(n,c),n=t.successors(n)[0]}})}),Pf}function bL(){if(jk)return Lf;jk=1;let t=Rt();function e(n,o,r,s,i,a,l){let c=n.children(l);if(!c.length)return void(l!==o&&n.setEdge(o,l,{weight:0,minlen:r}));let u=t.addBorderNode(n,"_bt"),h=t.addBorderNode(n,"_bb"),f=n.node(l);n.setParent(u,l),f.borderTop=u,n.setParent(h,l),f.borderBottom=h,c.forEach(m=>{e(n,o,r,s,i,a,m);let _=n.node(m),g=_.borderTop?_.borderTop:m,p=_.borderBottom?_.borderBottom:m,b=_.borderTop?s:2*s,x=g!==p?1:i-a[l]+1;n.setEdge(u,g,{weight:b,minlen:x,nestingEdge:!0}),n.setEdge(p,h,{weight:b,minlen:x,nestingEdge:!0})}),n.parent(l)||n.setEdge(o,u,{weight:0,minlen:i+a[l]})}return Lf={run:function(n){let o=t.addDummyNode(n,"root",{},"_root"),r=function(c){var u={};function h(f,m){var _=c.children(f);_&&_.length&&_.forEach(g=>h(g,m+1)),u[f]=m}return c.children().forEach(f=>h(f,1)),u}(n),s=Object.values(r),i=t.applyWithChunking(Math.max,s)-1,a=2*i+1;n.graph().nestingRoot=o,n.edges().forEach(c=>n.edge(c).minlen*=a);let l=function(c){return c.edges().reduce((u,h)=>u+c.edge(h).weight,0)}(n)+1;n.children().forEach(c=>e(n,o,a,l,i,r,c)),n.graph().nodeRankFactor=a},cleanup:function(n){var o=n.graph();n.removeNode(o.nestingRoot),delete o.nestingRoot,n.edges().forEach(r=>{n.edge(r).nestingEdge&&n.removeEdge(r)})}},Lf}function xL(){if(Ik)return zf;function t(r){r.nodes().forEach(s=>e(r.node(s))),r.edges().forEach(s=>e(r.edge(s)))}function e(r){let s=r.width;r.width=r.height,r.height=s}function n(r){r.y=-r.y}function o(r){let s=r.x;r.x=r.y,r.y=s}return Ik=1,zf={adjust:function(r){let s=r.graph().rankdir.toLowerCase();s!=="lr"&&s!=="rl"||t(r)},undo:function(r){let s=r.graph().rankdir.toLowerCase();s!=="bt"&&s!=="rl"||function(i){i.nodes().forEach(a=>n(i.node(a))),i.edges().forEach(a=>{let l=i.edge(a);l.points.forEach(n),Object.hasOwn(l,"y")&&n(l)})}(r),s!=="lr"&&s!=="rl"||(function(i){i.nodes().forEach(a=>o(i.node(a))),i.edges().forEach(a=>{let l=i.edge(a);l.points.forEach(o),Object.hasOwn(l,"x")&&o(l)})}(r),t(r))}},zf}function yL(){if(Rk)return Dk;Rk=1;let t=Rt();return Dk=function(e,n){let o={};return e.forEach((r,s)=>{let i=o[r.v]={indegree:0,in:[],out:[],vs:[r.v],i:s};r.barycenter!==void 0&&(i.barycenter=r.barycenter,i.weight=r.weight)}),n.edges().forEach(r=>{let s=o[r.v],i=o[r.w];s!==void 0&&i!==void 0&&(i.indegree++,s.out.push(o[r.w]))}),function(r){let s=[];function i(l){return c=>{c.merged||(c.barycenter===void 0||l.barycenter===void 0||c.barycenter>=l.barycenter)&&function(u,h){let f=0,m=0;u.weight&&(f+=u.barycenter*u.weight,m+=u.weight),h.weight&&(f+=h.barycenter*h.weight,m+=h.weight),u.vs=h.vs.concat(u.vs),u.barycenter=f/m,u.weight=m,u.i=Math.min(h.i,u.i),h.merged=!0}(l,c)}}function a(l){return c=>{c.in.push(l),--c.indegree===0&&r.push(c)}}for(;r.length;){let l=r.pop();s.push(l),l.in.reverse().forEach(i(l)),l.out.forEach(a(l))}return s.filter(l=>!l.merged).map(l=>t.pick(l,["vs","i","barycenter","weight"]))}(Object.values(o).filter(r=>!r.indegree))}}function wL(){if(Fk)return Vf;Fk=1;let t=(Ok||(Ok=1,Mk=function(o,r=[]){return r.map(s=>{let i=o.inEdges(s);if(i.length){let a=i.reduce((l,c)=>{let u=o.edge(c),h=o.node(c.v);return{sum:l.sum+u.weight*h.order,weight:l.weight+u.weight}},{sum:0,weight:0});return{v:s,barycenter:a.sum/a.weight,weight:a.weight}}return{v:s}})}),Mk),e=yL(),n=function(){if(Lk)return Pk;Lk=1;let o=Rt();function r(s,i,a){let l;for(;i.length&&(l=i[i.length-1]).i<=a;)i.pop(),s.push(l.vs),a++;return a}return Pk=function(s,i){let a=o.partition(s,p=>Object.hasOwn(p,"barycenter")),l=a.lhs,c=a.rhs.sort((p,b)=>b.i-p.i),u=[],h=0,f=0,m=0;var _;l.sort((_=!!i,(p,b)=>p.barycenter<b.barycenter?-1:p.barycenter>b.barycenter?1:_?b.i-p.i:p.i-b.i)),m=r(u,c,m),l.forEach(p=>{m+=p.vs.length,u.push(p.vs),h+=p.barycenter*p.weight,f+=p.weight,m=r(u,c,m)});let g={vs:u.flat(!0)};return f&&(g.barycenter=h/f,g.weight=f),g}}();return Vf=function o(r,s,i,a){let l=r.children(s),c=r.node(s),u=c?c.borderLeft:void 0,h=c?c.borderRight:void 0,f={};u&&(l=l.filter(p=>p!==u&&p!==h));let m=t(r,l);m.forEach(p=>{if(r.children(p.v).length){let y=o(r,p.v,i,a);f[p.v]=y,Object.hasOwn(y,"barycenter")&&(x=y,(b=p).barycenter!==void 0?(b.barycenter=(b.barycenter*b.weight+x.barycenter*x.weight)/(b.weight+x.weight),b.weight+=x.weight):(b.barycenter=x.barycenter,b.weight=x.weight))}var b,x});let _=e(m,i);(function(p,b){p.forEach(x=>{x.vs=x.vs.flatMap(y=>b[y]?b[y].vs:y)})})(_,f);let g=n(_,a);if(u&&(g.vs=[u,g.vs,h].flat(!0),r.predecessors(u).length)){let p=r.node(r.predecessors(u)[0]),b=r.node(r.predecessors(h)[0]);Object.hasOwn(g,"barycenter")||(g.barycenter=0,g.weight=0),g.barycenter=(g.barycenter*g.weight+p.order+b.order)/(g.weight+2),g.weight+=2}return g},Vf}function vL(){if(zk)return $f;zk=1;let t=Xn().Graph,e=Rt();return $f=function(n,o,r){let s=function(a){for(var l;a.hasNode(l=e.uniqueId("_root")););return l}(n),i=new t({compound:!0}).setGraph({root:s}).setDefaultNodeLabel(a=>n.node(a));return n.nodes().forEach(a=>{let l=n.node(a),c=n.parent(a);(l.rank===o||l.minRank<=o&&o<=l.maxRank)&&(i.setNode(a),i.setParent(a,c||s),n[r](a).forEach(u=>{let h=u.v===a?u.w:u.v,f=i.edge(h,a),m=f!==void 0?f.weight:0;i.setEdge(h,a,{weight:n.edge(u).weight+m})}),Object.hasOwn(l,"minRank")&&i.setNode(a,{borderLeft:l.borderLeft[o],borderRight:l.borderRight[o]}))}),i},$f}function kL(){if(Vk)return Hf;Vk=1;let t=function(){if(Ak)return Bf;Ak=1;let u=Rt();return Bf=function(h){let f={},m=h.nodes().filter(x=>!h.children(x).length),_=m.map(x=>h.node(x).rank),g=u.applyWithChunking(Math.max,_),p=u.range(g+1).map(()=>[]);function b(x){if(f[x])return;f[x]=!0;let y=h.node(x);p[y.rank].push(x),h.successors(x).forEach(b)}return m.sort((x,y)=>h.node(x).rank-h.node(y).rank).forEach(b),p},Bf}(),e=function(){if(Tk)return Uf;Tk=1;let u=Rt().zipObject;function h(f,m,_){let g=u(_,_.map((C,k)=>k)),p=m.flatMap(C=>f.outEdges(C).map(k=>({pos:g[k.w],weight:f.edge(k).weight})).sort((k,N)=>k.pos-N.pos)),b=1;for(;b<_.length;)b<<=1;let x=2*b-1;b-=1;let y=new Array(x).fill(0),v=0;return p.forEach(C=>{let k=C.pos+b;y[k]+=C.weight;let N=0;for(;k>0;)k%2&&(N+=y[k+1]),k=k-1>>1,y[k]+=C.weight;v+=C.weight*N}),v}return Uf=function(f,m){let _=0;for(let g=1;g<m.length;++g)_+=h(f,m[g-1],m[g]);return _},Uf}(),n=wL(),o=vL(),r=(Uk||(Uk=1,Bk=function(u,h,f){let m,_={};f.forEach(g=>{let p,b,x=u.parent(g);for(;x;){if(p=u.parent(x),p?(b=_[p],_[p]=x):(b=m,m=x),b&&b!==x)return void h.setEdge(b,x);x=p}})}),Bk),s=Xn().Graph,i=Rt();function a(u,h,f){return h.map(function(m){return o(u,m,f)})}function l(u,h){let f=new s;u.forEach(function(m){let _=m.graph().root,g=n(m,_,f,h);g.vs.forEach((p,b)=>m.node(p).order=b),r(m,f,g.vs)})}function c(u,h){Object.values(h).forEach(f=>f.forEach((m,_)=>u.node(m).order=_))}return Hf=function u(h,f){if(f&&typeof f.customOrder=="function")return void f.customOrder(h,u);let m=i.maxRank(h),_=a(h,i.range(1,m+1),"inEdges"),g=a(h,i.range(m-1,-1,-1),"outEdges"),p=t(h);if(c(h,p),f&&f.disableOptimalOrderHeuristic)return;let b,x=Number.POSITIVE_INFINITY;for(let y=0,v=0;v<4;++y,++v){l(y%2?_:g,y%4>=2),p=i.buildLayerMatrix(h);let C=e(h,p);C<x&&(v=0,b=Object.assign({},p),x=C)}c(h,b)},Hf}function SL(){if($k)return Wf;$k=1;let t=Xn().Graph,e=Rt();function n(h,f){let m={};return f.length&&f.reduce(function(_,g){let p=0,b=0,x=_.length,y=g[g.length-1];return g.forEach((v,C)=>{let k=function(j,I){if(j.node(I).dummy)return j.predecessors(I).find(T=>j.node(T).dummy)}(h,v),N=k?h.node(k).order:x;(k||v===y)&&(g.slice(b,C+1).forEach(j=>{h.predecessors(j).forEach(I=>{let T=h.node(I),A=T.order;!(A<p||N<A)||T.dummy&&h.node(j).dummy||r(m,I,j)})}),b=C+1,p=N)}),g}),m}function o(h,f){let m={};function _(g,p,b,x,y){let v;e.range(p,b).forEach(C=>{v=g[C],h.node(v).dummy&&h.predecessors(v).forEach(k=>{let N=h.node(k);N.dummy&&(N.order<x||N.order>y)&&r(m,k,v)})})}return f.length&&f.reduce(function(g,p){let b,x=-1,y=0;return p.forEach((v,C)=>{if(h.node(v).dummy==="border"){let k=h.predecessors(v);k.length&&(b=h.node(k[0]).order,_(p,y,C,x,b),y=C,x=b)}_(p,y,p.length,b,g.length)}),p}),m}function r(h,f,m){if(f>m){let g=f;f=m,m=g}let _=h[f];_||(h[f]=_={}),_[m]=!0}function s(h,f,m){if(f>m){let _=f;f=m,m=_}return!!h[f]&&Object.hasOwn(h[f],m)}function i(h,f,m,_){let g={},p={},b={};return f.forEach(x=>{x.forEach((y,v)=>{g[y]=y,p[y]=y,b[y]=v})}),f.forEach(x=>{let y=-1;x.forEach(v=>{let C=_(v);if(C.length){C=C.sort((N,j)=>b[N]-b[j]);let k=(C.length-1)/2;for(let N=Math.floor(k),j=Math.ceil(k);N<=j;++N){let I=C[N];p[v]===v&&y<b[I]&&!s(m,v,I)&&(p[I]=v,p[v]=g[v]=g[I],y=b[I])}}})}),{root:g,align:p}}function a(h,f,m,_,g){let p={},b=function(v,C,k,N){let j=new t,I=v.graph(),T=function(A,R,z){return(D,F,B)=>{let U,O=D.node(F),S=D.node(B),$=0;if($+=O.width/2,Object.hasOwn(O,"labelpos"))switch(O.labelpos.toLowerCase()){case"l":U=-O.width/2;break;case"r":U=O.width/2}if(U&&($+=z?U:-U),U=0,$+=(O.dummy?R:A)/2,$+=(S.dummy?R:A)/2,$+=S.width/2,Object.hasOwn(S,"labelpos"))switch(S.labelpos.toLowerCase()){case"l":U=S.width/2;break;case"r":U=-S.width/2}return U&&($+=z?U:-U),U=0,$}}(I.nodesep,I.edgesep,N);return C.forEach(A=>{let R;A.forEach(z=>{let D=k[z];if(j.setNode(D),R){var F=k[R],B=j.edge(F,D);j.setEdge(F,D,Math.max(T(v,z,R),B||0))}R=z})}),j}(h,f,m,g),x=g?"borderLeft":"borderRight";function y(v,C){let k=b.nodes(),N=k.pop(),j={};for(;N;)j[N]?v(N):(j[N]=!0,k.push(N),k=k.concat(C(N))),N=k.pop()}return y(function(v){p[v]=b.inEdges(v).reduce((C,k)=>Math.max(C,p[k.v]+b.edge(k)),0)},b.predecessors.bind(b)),y(function(v){let C=b.outEdges(v).reduce((N,j)=>Math.min(N,p[j.w]-b.edge(j)),Number.POSITIVE_INFINITY),k=h.node(v);C!==Number.POSITIVE_INFINITY&&k.borderType!==x&&(p[v]=Math.max(p[v],C))},b.successors.bind(b)),Object.keys(_).forEach(v=>p[v]=p[m[v]]),p}function l(h,f){return Object.values(f).reduce((m,_)=>{let g=Number.NEGATIVE_INFINITY,p=Number.POSITIVE_INFINITY;Object.entries(_).forEach(([x,y])=>{let v=function(C,k){return C.node(k).width}(h,x)/2;g=Math.max(y+v,g),p=Math.min(y-v,p)});const b=g-p;return b<m[0]&&(m=[b,_]),m},[Number.POSITIVE_INFINITY,null])[1]}function c(h,f){let m=Object.values(f),_=e.applyWithChunking(Math.min,m),g=e.applyWithChunking(Math.max,m);["u","d"].forEach(p=>{["l","r"].forEach(b=>{let x=p+b,y=h[x];if(y===f)return;let v=Object.values(y),C=_-e.applyWithChunking(Math.min,v);b!=="l"&&(C=g-e.applyWithChunking(Math.max,v)),C&&(h[x]=e.mapValues(y,k=>k+C))})})}function u(h,f){return e.mapValues(h.ul,(m,_)=>{if(f)return h[f.toLowerCase()][_];{let g=Object.values(h).map(p=>p[_]).sort((p,b)=>p-b);return(g[1]+g[2])/2}})}return Wf={positionX:function(h){let f,m=e.buildLayerMatrix(h),_=Object.assign(n(h,m),o(h,m)),g={};["u","d"].forEach(b=>{f=b==="u"?m:Object.values(m).reverse(),["l","r"].forEach(x=>{x==="r"&&(f=f.map(k=>Object.values(k).reverse()));let y=(b==="u"?h.predecessors:h.successors).bind(h),v=i(h,f,_,y),C=a(h,f,v.root,v.align,x==="r");x==="r"&&(C=e.mapValues(C,k=>-k)),g[b+x]=C})});let p=l(h,g);return c(g,p),u(g,h.graph().align)},findType1Conflicts:n,findType2Conflicts:o,addConflict:r,hasConflict:s,verticalAlignment:i,horizontalCompaction:a,alignCoordinates:c,findSmallestWidthAlignment:l,balance:u},Wf}function CL(){if(Hk)return qf;Hk=1;let t=Rt(),e=SL().positionX;return qf=function(n){n=t.asNonCompoundGraph(n),function(o){let r=t.buildLayerMatrix(o),s=o.graph().ranksep,i=0;r.forEach(a=>{const l=a.reduce((c,u)=>{const h=o.node(u).height;return c>h?c:h},0);a.forEach(c=>o.node(c).y=i+l/2),i+=l+s})}(n),Object.entries(e(n)).forEach(([o,r])=>n.node(o).x=r)},qf}function NL(){if(Wk)return Gf;Wk=1;let t=fL(),e=mL(),n=gL(),o=Rt().normalizeRanks,r=_L(),s=Rt().removeEmptyRanks,i=bL(),a=function(){if(Ek)return Ff;Ek=1;let N=Rt();function j(I,T,A,R,z,D){let F={width:0,height:0,rank:D,borderType:T},B=z[T][D-1],U=N.addDummyNode(I,"border",F,A);z[T][D]=U,I.setParent(U,R),B&&I.setEdge(B,U,{weight:1})}return Ff=function(I){I.children().forEach(function T(A){let R=I.children(A),z=I.node(A);if(R.length&&R.forEach(T),Object.hasOwn(z,"minRank")){z.borderLeft=[],z.borderRight=[];for(let D=z.minRank,F=z.maxRank+1;D<F;++D)j(I,"borderLeft","_bl",A,z,D),j(I,"borderRight","_br",A,z,D)}})},Ff}(),l=xL(),c=kL(),u=CL(),h=Rt(),f=Xn().Graph;Gf=function(N,j){let I=j&&j.debugTiming?h.time:h.notime;I("layout",()=>{let T=I(" buildLayoutGraph",()=>function(A){let R=new f({multigraph:!0,compound:!0}),z=k(A.graph());return R.setGraph(Object.assign({},_,C(z,m),h.pick(z,g))),A.nodes().forEach(D=>{const F=C(k(A.node(D)),p);Object.keys(b).forEach(B=>{F[B]===void 0&&(F[B]=b[B])}),R.setNode(D,F),R.setParent(D,A.parent(D))}),A.edges().forEach(D=>{let F=k(A.edge(D));R.setEdge(D,Object.assign({},y,C(F,x),h.pick(F,v)))}),R}(N));I(" runLayout",()=>function(A,R,z){R(" makeSpaceForEdgeLabels",()=>function(D){let F=D.graph();F.ranksep/=2,D.edges().forEach(B=>{let U=D.edge(B);U.minlen*=2,U.labelpos.toLowerCase()!=="c"&&(F.rankdir==="TB"||F.rankdir==="BT"?U.width+=U.labeloffset:U.height+=U.labeloffset)})}(A)),R(" removeSelfEdges",()=>function(D){D.edges().forEach(F=>{if(F.v===F.w){var B=D.node(F.v);B.selfEdges||(B.selfEdges=[]),B.selfEdges.push({e:F,label:D.edge(F)}),D.removeEdge(F)}})}(A)),R(" acyclic",()=>t.run(A)),R(" nestingGraph.run",()=>i.run(A)),R(" rank",()=>n(h.asNonCompoundGraph(A))),R(" injectEdgeLabelProxies",()=>function(D){D.edges().forEach(F=>{let B=D.edge(F);if(B.width&&B.height){let U=D.node(F.v),O={rank:(D.node(F.w).rank-U.rank)/2+U.rank,e:F};h.addDummyNode(D,"edge-proxy",O,"_ep")}})}(A)),R(" removeEmptyRanks",()=>s(A)),R(" nestingGraph.cleanup",()=>i.cleanup(A)),R(" normalizeRanks",()=>o(A)),R(" assignRankMinMax",()=>function(D){let F=0;D.nodes().forEach(B=>{let U=D.node(B);U.borderTop&&(U.minRank=D.node(U.borderTop).rank,U.maxRank=D.node(U.borderBottom).rank,F=Math.max(F,U.maxRank))}),D.graph().maxRank=F}(A)),R(" removeEdgeLabelProxies",()=>function(D){D.nodes().forEach(F=>{let B=D.node(F);B.dummy==="edge-proxy"&&(D.edge(B.e).labelRank=B.rank,D.removeNode(F))})}(A)),R(" normalize.run",()=>e.run(A)),R(" parentDummyChains",()=>r(A)),R(" addBorderSegments",()=>a(A)),R(" order",()=>c(A,z)),R(" insertSelfEdges",()=>function(D){var F=h.buildLayerMatrix(D);F.forEach(B=>{var U=0;B.forEach((O,S)=>{var $=D.node(O);$.order=S+U,($.selfEdges||[]).forEach(E=>{h.addDummyNode(D,"selfedge",{width:E.label.width,height:E.label.height,rank:$.rank,order:S+ ++U,e:E.e,label:E.label},"_se")}),delete $.selfEdges})})}(A)),R(" adjustCoordinateSystem",()=>l.adjust(A)),R(" position",()=>u(A)),R(" positionSelfEdges",()=>function(D){D.nodes().forEach(F=>{var B=D.node(F);if(B.dummy==="selfedge"){var U=D.node(B.e.v),O=U.x+U.width/2,S=U.y,$=B.x-O,E=U.height/2;D.setEdge(B.e,B.label),D.removeNode(F),B.label.points=[{x:O+2*$/3,y:S-E},{x:O+5*$/6,y:S-E},{x:O+$,y:S},{x:O+5*$/6,y:S+E},{x:O+2*$/3,y:S+E}],B.label.x=B.x,B.label.y=B.y}})}(A)),R(" removeBorderNodes",()=>function(D){D.nodes().forEach(F=>{if(D.children(F).length){let B=D.node(F),U=D.node(B.borderTop),O=D.node(B.borderBottom),S=D.node(B.borderLeft[B.borderLeft.length-1]),$=D.node(B.borderRight[B.borderRight.length-1]);B.width=Math.abs($.x-S.x),B.height=Math.abs(O.y-U.y),B.x=S.x+B.width/2,B.y=U.y+B.height/2}}),D.nodes().forEach(F=>{D.node(F).dummy==="border"&&D.removeNode(F)})}(A)),R(" normalize.undo",()=>e.undo(A)),R(" fixupEdgeLabelCoords",()=>function(D){D.edges().forEach(F=>{let B=D.edge(F);if(Object.hasOwn(B,"x"))switch(B.labelpos!=="l"&&B.labelpos!=="r"||(B.width-=B.labeloffset),B.labelpos){case"l":B.x-=B.width/2+B.labeloffset;break;case"r":B.x+=B.width/2+B.labeloffset}})}(A)),R(" undoCoordinateSystem",()=>l.undo(A)),R(" translateGraph",()=>function(D){let F=Number.POSITIVE_INFINITY,B=0,U=Number.POSITIVE_INFINITY,O=0,S=D.graph(),$=S.marginx||0,E=S.marginy||0;function W(G){let q=G.x,Y=G.y,te=G.width,oe=G.height;F=Math.min(F,q-te/2),B=Math.max(B,q+te/2),U=Math.min(U,Y-oe/2),O=Math.max(O,Y+oe/2)}D.nodes().forEach(G=>W(D.node(G))),D.edges().forEach(G=>{let q=D.edge(G);Object.hasOwn(q,"x")&&W(q)}),F-=$,U-=E,D.nodes().forEach(G=>{let q=D.node(G);q.x-=F,q.y-=U}),D.edges().forEach(G=>{let q=D.edge(G);q.points.forEach(Y=>{Y.x-=F,Y.y-=U}),Object.hasOwn(q,"x")&&(q.x-=F),Object.hasOwn(q,"y")&&(q.y-=U)}),S.width=B-F+$,S.height=O-U+E}(A)),R(" assignNodeIntersects",()=>function(D){D.edges().forEach(F=>{let B,U,O=D.edge(F),S=D.node(F.v),$=D.node(F.w);O.points?(B=O.points[0],U=O.points[O.points.length-1]):(O.points=[],B=$,U=S),O.points.unshift(h.intersectRect(S,B)),O.points.push(h.intersectRect($,U))})}(A)),R(" reversePoints",()=>function(D){D.edges().forEach(F=>{let B=D.edge(F);B.reversed&&B.points.reverse()})}(A)),R(" acyclic.undo",()=>t.undo(A))}(T,I,j)),I(" updateInputGraph",()=>function(A,R){A.nodes().forEach(z=>{let D=A.node(z),F=R.node(z);D&&(D.x=F.x,D.y=F.y,D.rank=F.rank,R.children(z).length&&(D.width=F.width,D.height=F.height))}),A.edges().forEach(z=>{let D=A.edge(z),F=R.edge(z);D.points=F.points,Object.hasOwn(F,"x")&&(D.x=F.x,D.y=F.y)}),A.graph().width=R.graph().width,A.graph().height=R.graph().height}(N,T))})};let m=["nodesep","edgesep","ranksep","marginx","marginy"],_={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},g=["acyclicer","ranker","rankdir","align"],p=["width","height","rank"],b={width:0,height:0},x=["minlen","weight","width","height","labeloffset"],y={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},v=["labelpos"];function C(N,j){return h.mapValues(h.pick(N,j),Number)}function k(N){var j={};return N&&Object.entries(N).forEach(([I,T])=>{typeof I=="string"&&(I=I.toLowerCase()),j[I]=T}),j}return Gf}function jL(){if(qk)return Yf;qk=1;let t=Rt(),e=Xn().Graph;return Yf={debugOrdering:function(n){let o=t.buildLayerMatrix(n),r=new e({compound:!0,multigraph:!0}).setGraph({});return n.nodes().forEach(s=>{r.setNode(s,{label:s}),r.setParent(s,"layer"+n.node(s).rank)}),n.edges().forEach(s=>r.setEdge(s.v,s.w,{},s.name)),o.forEach((s,i)=>{let a="layer"+i;r.setNode(a,{rank:"same"}),s.reduce((l,c)=>(r.setEdge(l,c,{style:"invis"}),c))}),r}},Yf}var o3=Kk?Jk:(Kk=1,Jk={graphlib:Xn(),layout:NL(),debug:jL(),util:{time:Rt().time,notime:Rt().notime},version:Yk?Gk:(Yk=1,Gk="1.1.5")});const $i=new o3.graphlib.Graph().setDefaultEdgeLabel(()=>({})),r3=(t,e,n)=>($i.setGraph({rankdir:n.direction,nodesep:150,ranksep:200,ranker:"longest-path"}),e.forEach(o=>$i.setEdge(o.source,o.target)),t.forEach(o=>$i.setNode(o.id,{...o,width:o.width??0,height:o.height??0})),o3.layout($i),{nodes:t.map(o=>{const{x:r,y:s}=$i.node(o.id);return{...o,position:{x:r,y:s}}}),edges:e}),s3=new class{createEdge(t,e){return{animated:!0,markerEnd:{type:_s.ArrowClosed},id:`${t}-${e}`,style:{strokeWidth:2},source:t,sourceHandle:"outputs",targetHandle:"inputs",target:e}}createNode(t,e){return{id:t,data:{atom:e,forceWidth:300},width:300,type:"custom",height:df(lt.get(e).code.trim().split(`
|
144
|
-
`).length),position:{x:0,y:0}}}createElements(t,e,n,o){const r=[],s=[],i=new Set,a=new Set;for(const l of Object.values(n)){if(l.value==="marimo"&&l.name==="mo")continue;const{declaredBy:c,usedBy:u}=l;for(const h of c)for(const f of u){const m=`${h}-${f}`;a.has(m)||(a.add(m),i.add(h),i.add(f),s.push(this.createEdge(h,f)))}}for(const[l,c]of $m.zip(t,e)){o||r.push(this.createNode(l,c));const u=i.has(l),h=lt.get(c).code.trim().startsWith("mo.md");!u&&h||r.push(this.createNode(l,c))}return{nodes:r,edges:s}}},EL=t=>{const e=X.c(43),{cellIds:n,variables:o,cellAtoms:r,children:s,layoutDirection:i,settings:a}=t;let l;e[0]!==r||e[1]!==n||e[2]!==i||e[3]!==a.hidePureMarkdown||e[4]!==o?(l=()=>{let S=s3.createElements(n,r,o,a.hidePureMarkdown);return S=r3(S.nodes,S.edges,{direction:i}),S},e[0]=r,e[1]=n,e[2]=i,e[3]=a.hidePureMarkdown,e[4]=o,e[5]=l):l=e[5];const[c]=M.useState(l),[u,h,f]=L2(c.nodes),[m,_,g]=F2(c.edges),p=Bi();let b;e[6]!==i||e[7]!==_||e[8]!==h?(b=S=>{const $=r3(S.nodes,S.edges,{direction:i});h($.nodes),_($.edges)},e[6]=i,e[7]=_,e[8]=h,e[9]=b):b=e[9];const x=Ke(b);let y,v;e[10]!==r||e[11]!==n||e[12]!==a.hidePureMarkdown||e[13]!==x||e[14]!==o?(y=()=>{x(s3.createElements(n,r,o,a.hidePureMarkdown))},v=[n,o,r,x,a.hidePureMarkdown],e[10]=r,e[11]=n,e[12]=a.hidePureMarkdown,e[13]=x,e[14]=o,e[15]=y,e[16]=v):(y=e[15],v=e[16]),M.useEffect(y,v);const[C,k]=M.useState();let N;W2(),e[17]===Symbol.for("react.memo_cache_sentinel")?(N=()=>{k(void 0)},e[17]=N):N=e[17];const j=N;let I,T,A,R,z,D,F,B,U,O;return e[18]===Symbol.for("react.memo_cache_sentinel")?(I={minZoom:.5,maxZoom:1.5},T=(S,$)=>{k({type:"node",id:$.id})},A=(S,$)=>{const{source:E,target:W}=$;k({type:"edge",source:E,target:W})},e[18]=I,e[19]=T,e[20]=A):(I=e[18],T=e[19],A=e[20]),e[21]===Symbol.for("react.memo_cache_sentinel")?(R=d.jsx(YP,{color:"#ccc",variant:Bn.Dots}),e[21]=R):R=e[21],e[22]!==p||e[23]!==u?(z=()=>{const S=lt.get(p$);if(S){const $=u.find(E=>E.id===S);$&&(p.fitView({padding:1,duration:600,nodes:[$]}),k({type:"node",id:S}))}},e[22]=p,e[23]=u,e[24]=z):z=e[24],e[25]===Symbol.for("react.memo_cache_sentinel")?(D=d.jsx(Cp,{className:"size-4"}),e[25]=D):D=e[25],e[26]!==z?(F=d.jsx(VP,{position:"bottom-right",showInteractive:!1,children:d.jsx(Te,{content:"Jump to focused cell",delayDuration:200,side:"left",asChild:!1,children:d.jsx(Cs,{onMouseDown:Vn.preventFocus,onClick:z,children:D})})}),e[26]=z,e[27]=F):F=e[27],e[28]!==m||e[29]!==C||e[30]!==o?(B=d.jsx(ql,{selection:C,variables:o,edges:m,onClearSelection:j}),e[28]=m,e[29]=C,e[30]=o,e[31]=B):B=e[31],e[32]!==s||e[33]!==m||e[34]!==u||e[35]!==g||e[36]!==f||e[37]!==F||e[38]!==B?(U=d.jsxs(cf,{nodes:u,edges:m,nodeTypes:$2,minZoom:.2,fitViewOptions:I,onNodeClick:T,onEdgeClick:A,onNodeDoubleClick:IL,fitView:!0,onNodesChange:f,onEdgesChange:g,zoomOnDoubleClick:!1,nodesConnectable:!1,children:[R,F,B,s]}),e[32]=s,e[33]=m,e[34]=u,e[35]=g,e[36]=f,e[37]=F,e[38]=B,e[39]=U):U=e[39],e[40]!==i||e[41]!==U?(O=d.jsx(U2,{value:i,children:U}),e[40]=i,e[41]=U,e[42]=O):O=e[42],O};function IL(t,e){lS(e.id,"focus")}const AL=qt("_minimap_"),TL=qt({hidePureMarkdown:!0}),ML=t=>{const e=X.c(11),[n,o]=on(AL),[r,s]=on(TL);let i;e[0]!==n||e[1]!==t||e[2]!==o||e[3]!==s||e[4]!==r?(i=()=>n==="_minimap_"?d.jsx(QP,{...t,children:d.jsx(hf,{settings:r,onSettingsChange:s,view:n,onChange:o})}):d.jsx(EL,{...t,settings:r,layoutDirection:n,children:d.jsx(hf,{settings:r,onSettingsChange:s,view:n,onChange:o})}),e[0]=n,e[1]=t,e[2]=o,e[3]=s,e[4]=r,e[5]=i):i=e[5];const a=i;let l,c;return e[6]!==a?(l=a(),e[6]=a,e[7]=l):l=e[7],e[8]!==n||e[9]!==l?(c=d.jsx(lf,{children:l},n),e[8]=n,e[9]=l,e[10]=c):c=e[10],c},OL=()=>{const t=X.c(5),e=cS(),n=Bc(),[o]=g$();let r,s;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=Ne("w-full h-full flex-1 mx-auto -mb-4 relative"),t[0]=r):r=t[0],t[1]!==n.inOrderIds||t[2]!==o||t[3]!==e?(s=d.jsx("div",{className:r,children:d.jsx(ML,{cellAtoms:o,variables:e,cellIds:n.inOrderIds})}),t[1]=n.inOrderIds,t[2]=o,t[3]=e,t[4]=s):s=t[4],s},DL=t=>{const e=X.c(4),{isOpen:n,children:o}=t,[r,s]=K.useState(!1);let i,a;return e[0]!==r||e[1]!==n?(i=()=>{n&&!r&&s(!0)},a=[n,r],e[0]=r,e[1]=n,e[2]=i,e[3]=a):(i=e[2],a=e[3]),K.useEffect(i,a),r?o:null},RL=t=>{const e=X.c(8),{variableName:n,className:o}=t;let r;e[0]!==n?(r=()=>{const l=function(u){const h=lt.get(dS)[u];if(h)return h.declaredBy[0]}(n);if(!l)return;const c=Ql(l);c&&Wm(c,n)},e[0]=n,e[1]=r):r=e[1];const s=r;let i,a;return e[2]!==o?(i=Ne("text-link opacity-80 hover:opacity-100 hover:underline",o),e[2]=o,e[3]=i):i=e[3],e[4]!==s||e[5]!==i||e[6]!==n?(a=d.jsx("button",{type:"button",onClick:s,className:i,children:n}),e[4]=s,e[5]=i,e[6]=n,e[7]=a):a=e[7],a},PL=qt(t=>{const e=t(_$),n=t(dS),o=t(X4);return pa(e,r=>{if(!r.variable_name)return-1;const s=Object.values(n).find(a=>a.name===r.variable_name);if(!s)return 0;const i=o.inOrderIds.indexOf(s.declaredBy[0]);return i===-1?0:i})}),LL=qt(t=>{const e=new Map(t(b$));for(const n of uS){const o=e.get(n);o&&o.databases.length===0&&e.delete(n)}return pa([...e.values()],n=>uS.has(n.name)?1:0)}),FL=()=>{const t=X.c(32),[e,n]=K.useState(""),o=Zt(hS),r=Ue(PL),s=Ue(LL);if(r.length===0&&s.length===0){let b;return t[0]===Symbol.for("react.memo_cache_sentinel")?(b=d.jsx(xn,{title:"No tables found",description:"Any datasets/dataframes in the global scope will be shown here.",action:d.jsx(Cg,{children:d.jsxs(Me,{variant:"outline",size:"sm",children:["Add database or catalog",d.jsx(ur,{className:"h-4 w-4 ml-2"})]})}),icon:d.jsx(ar,{})}),t[0]=b):b=t[0],b}const i=!!e.trim();let a,l,c,u,h,f,m,_,g,p;if(t[1]!==o?(a=b=>{o(b.length>0),n(b)},t[1]=o,t[2]=a):a=t[2],t[3]!==e||t[4]!==a?(l=d.jsx(Ji,{placeholder:"Search tables...",className:"h-6 m-1",value:e,onValueChange:a,rootClassName:"flex-1 border-r"}),t[3]=e,t[4]=a,t[5]=l):l=t[5],t[6]!==i?(c=i&&d.jsx("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:()=>n(""),children:d.jsx(eo,{className:"h-4 w-4"})}),t[6]=i,t[7]=c):c=t[7],t[8]===Symbol.for("react.memo_cache_sentinel")?(u=d.jsx(Cg,{children:d.jsx("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:d.jsx(ur,{className:"h-4 w-4"})})}),t[8]=u):u=t[8],t[9]!==l||t[10]!==c?(h=d.jsxs("div",{className:"flex items-center w-full",children:[l,c,u]}),t[9]=l,t[10]=c,t[11]=h):h=t[11],t[12]!==s||t[13]!==i||t[14]!==e){let b;t[16]!==i||t[17]!==e?(b=x=>d.jsx(zL,{connection:x,hasChildren:x.databases.length>0,children:x.databases.map(y=>d.jsx(BL,{engineName:x.name,database:y,hasSearch:i,children:d.jsx(UL,{schemas:y.schemas,defaultSchema:x.default_schema,defaultDatabase:x.default_database,engineName:x.name,databaseName:y.name,hasSearch:i,searchValue:e})},y.name))},x.name),t[16]=i,t[17]=e,t[18]=b):b=t[18],f=s.map(b),t[12]=s,t[13]=i,t[14]=e,t[15]=f}else f=t[15];return t[19]!==s.length||t[20]!==r.length?(m=s.length>0&&r.length>0&&d.jsxs(fS,{children:[d.jsx(oc,{className:"h-4 w-4 text-muted-foreground"}),d.jsx("span",{className:"text-xs",children:"Python"})]}),t[19]=s.length,t[20]=r.length,t[21]=m):m=t[21],t[22]!==e||t[23]!==r?(_=r.length>0&&d.jsx(i3,{tables:r,searchValue:e}),t[22]=e,t[23]=r,t[24]=_):_=t[24],t[25]!==f||t[26]!==m||t[27]!==_?(g=d.jsxs(Om,{className:"flex flex-col",children:[f,m,_]}),t[25]=f,t[26]=m,t[27]=_,t[28]=g):g=t[28],t[29]!==h||t[30]!==g?(p=d.jsxs(_c,{className:"border-b bg-background rounded-none h-full pb-10 overflow-auto outline-none",shouldFilter:!1,children:[h,g]}),t[29]=h,t[30]=g,t[31]=p):p=t[31],p},zL=t=>{const e=X.c(25),{connection:n,children:o,hasChildren:r}=t,s=n.name===x$,i=s?"In-Memory":n.name,[a,l]=K.useState(!1);let c;e[0]!==n.name?(c=async()=>{l(!0),await w$({engine:n.name}),setTimeout(()=>l(!1),500)},e[0]=n.name,e[1]=c):c=e[1];const u=c;let h,f,m;e[2]!==n.dialect?(h=d.jsx(r4,{className:"h-4 w-4 text-muted-foreground",name:n.dialect}),e[2]=n.dialect,e[3]=h):h=e[3],e[4]!==n.dialect?(f=y$(n.dialect),e[4]=n.dialect,e[5]=f):f=e[5],e[6]!==f?(m=d.jsx("span",{className:"text-xs",children:f}),e[6]=f,e[7]=m):m=e[7];const _=i;let g,p,b,x,y;return e[8]!==_?(g=d.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",d.jsx(RL,{variableName:_}),")"]}),e[8]=_,e[9]=g):g=e[9],e[10]!==u||e[11]!==s||e[12]!==a?(p=!s&&d.jsx(Te,{content:"Refresh connection",children:d.jsx(Me,{variant:"ghost",size:"icon",className:"ml-auto hover:bg-transparent hover:shadow-none",onClick:u,children:d.jsx(Ic,{className:Ne("h-4 w-4 text-muted-foreground hover:text-foreground",a&&"animate-[spin_0.5s]")})})}),e[10]=u,e[11]=s,e[12]=a,e[13]=p):p=e[13],e[14]!==h||e[15]!==m||e[16]!==g||e[17]!==p?(b=d.jsxs(fS,{children:[h,m,g,p]}),e[14]=h,e[15]=m,e[16]=g,e[17]=p,e[18]=b):b=e[18],e[19]!==o||e[20]!==r?(x=r?o:d.jsx(Uc,{content:"No databases available",className:"pl-2"}),e[19]=o,e[20]=r,e[21]=x):x=e[21],e[22]!==b||e[23]!==x?(y=d.jsxs(d.Fragment,{children:[b,x]}),e[22]=b,e[23]=x,e[24]=y):y=e[24],y},BL=t=>{const e=X.c(28),{hasSearch:n,engineName:o,database:r,children:s}=t,[i,a]=K.useState(!1),[l,c]=K.useState(!1);let u,h,f;e[0]!==n?(u=()=>{a(n)},h=[n],e[0]=n,e[1]=u,e[2]=h):(u=e[1],h=e[2]),K.useEffect(u,h),e[3]!==i||e[4]!==l?(f=()=>{a(!i),c(!l)},e[3]=i,e[4]=l,e[5]=f):f=e[5];const m=`${o}:${r.name}`;let _;e[6]!==i?(_=d.jsx(xS,{isExpanded:i}),e[6]=i,e[7]=_):_=e[7];const g=l&&i?"text-foreground":"text-muted-foreground";let p,b;e[8]!==g?(p=Ne("h-4 w-4",g),e[8]=g,e[9]=p):p=e[9],e[10]!==p?(b=d.jsx(ar,{className:p}),e[10]=p,e[11]=b):b=e[11];const x=l&&i&&"font-semibold";let y,v,C,k;e[12]!==x?(y=Ne(x),e[12]=x,e[13]=y):y=e[13],e[14]!==r.name?(v=r.name===""?d.jsx("i",{children:"Not connected"}):r.name,e[14]=r.name,e[15]=v):v=e[15],e[16]!==y||e[17]!==v?(C=d.jsx("span",{className:y,children:v}),e[16]=y,e[17]=v,e[18]=C):C=e[18],e[19]!==C||e[20]!==f||e[21]!==m||e[22]!==_||e[23]!==b?(k=d.jsxs(mo,{className:"text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none",onSelect:f,value:m,children:[_,b,C]}),e[19]=C,e[20]=f,e[21]=m,e[22]=_,e[23]=b,e[24]=k):k=e[24];const N=i&&s;let j;return e[25]!==k||e[26]!==N?(j=d.jsxs(d.Fragment,{children:[k,N]}),e[25]=k,e[26]=N,e[27]=j):j=e[27],j},UL=t=>{const e=X.c(20),{schemas:n,defaultSchema:o,defaultDatabase:r,engineName:s,databaseName:i,hasSearch:a,searchValue:l}=t;if(n.length===0){let h;return e[0]===Symbol.for("react.memo_cache_sentinel")?(h=d.jsx(Uc,{content:"No schemas available",className:"pl-6"}),e[0]=h):h=e[0],h}let c,u;if(e[1]!==i||e[2]!==r||e[3]!==o||e[4]!==s||e[5]!==a||e[6]!==n||e[7]!==l){let h;e[9]!==l?(h=_=>!l||_.tables.some(g=>g.name.toLowerCase().includes(l.toLowerCase())),e[9]=l,e[10]=h):h=e[10];const f=n.filter(h);let m;e[11]!==i||e[12]!==r||e[13]!==o||e[14]!==s||e[15]!==a||e[16]!==l?(m=_=>d.jsx(VL,{databaseName:i,schema:_,hasSearch:a,children:d.jsx(i3,{tables:_.tables,searchValue:l,sqlTableContext:{engine:s,database:i,schema:_.name,defaultSchema:o,defaultDatabase:r}})},_.name),e[11]=i,e[12]=r,e[13]=o,e[14]=s,e[15]=a,e[16]=l,e[17]=m):m=e[17],c=f.map(m),e[1]=i,e[2]=r,e[3]=o,e[4]=s,e[5]=a,e[6]=n,e[7]=l,e[8]=c}else c=e[8];return e[18]!==c?(u=d.jsx(d.Fragment,{children:c}),e[18]=c,e[19]=u):u=e[19],u},VL=t=>{const e=X.c(26),{databaseName:n,schema:o,children:r,hasSearch:s}=t,[i,a]=K.useState(!1),[l,c]=K.useState(!1),u=`${n}:${o.name}`;let h,f,m,_;if(e[0]!==s?(h=()=>{a(s)},f=[s],e[0]=s,e[1]=h,e[2]=f):(h=e[1],f=e[2]),K.useEffect(h,f),bS(o.name))return r;e[3]!==i||e[4]!==l?(m=()=>{a(!i),c(!l)},e[3]=i,e[4]=l,e[5]=m):m=e[5],e[6]!==i?(_=d.jsx(xS,{isExpanded:i}),e[6]=i,e[7]=_):_=e[7];const g=l&&i&&"text-foreground";let p,b;e[8]!==g?(p=Ne("h-4 w-4 text-muted-foreground",g),e[8]=g,e[9]=p):p=e[9],e[10]!==p?(b=d.jsx(E$,{className:p}),e[10]=p,e[11]=b):b=e[11];const x=l&&i&&"font-semibold";let y,v,C;e[12]!==x?(y=Ne(x),e[12]=x,e[13]=y):y=e[13],e[14]!==o.name||e[15]!==y?(v=d.jsx("span",{className:y,children:o.name}),e[14]=o.name,e[15]=y,e[16]=v):v=e[16],e[17]!==v||e[18]!==m||e[19]!==_||e[20]!==b||e[21]!==u?(C=d.jsxs(mo,{className:"text-sm flex flex-row gap-1 items-center pl-5 cursor-pointer rounded-none",onSelect:m,value:u,children:[_,b,v]}),e[17]=v,e[18]=m,e[19]=_,e[20]=b,e[21]=u,e[22]=C):C=e[22];const k=i&&r;let N;return e[23]!==C||e[24]!==k?(N=d.jsxs(d.Fragment,{children:[C,k]}),e[23]=C,e[24]=k,e[25]=N):N=e[25],N},i3=t=>{const e=X.c(24),{tables:n,sqlTableContext:o,searchValue:r}=t,{addTableList:s}=mS(),[i,a]=K.useState(!1),[l,c]=K.useState(!1);let u,h;e[0]!==s||e[1]!==o||e[2]!==n.length||e[3]!==i?(u=async()=>{if(n.length===0&&o&&!i){a(!0),c(!0);const{engine:p,database:b,schema:x}=o,y=await ZH.request({engine:p,database:b,schema:x});if(!(y!=null&&y.tables))throw c(!1),new Error("No tables available");s({tables:y.tables,sqlTableContext:o}),c(!1)}},e[0]=s,e[1]=o,e[2]=n.length,e[3]=i,e[4]=u):u=e[4],e[5]!==o||e[6]!==n.length||e[7]!==i?(h=[n.length,o,i],e[5]=o,e[6]=n.length,e[7]=i,e[8]=h):h=e[8];const{isPending:f,error:m}=Wn(u,h);if(f||l){let p;return e[9]===Symbol.for("react.memo_cache_sentinel")?(p=d.jsx(pS,{message:"Loading tables...",className:"pl-12"}),e[9]=p):p=e[9],p}if(m){let p;return e[10]!==m?(p=d.jsx(gS,{error:m,className:"pl-12"}),e[10]=m,e[11]=p):p=e[11],p}if(n.length===0){let p;return e[12]===Symbol.for("react.memo_cache_sentinel")?(p=d.jsx(Uc,{content:"No tables found",className:"pl-9"}),e[12]=p):p=e[12],p}let _,g;if(e[13]!==r||e[14]!==o||e[15]!==n){let p;e[17]!==r?(p=y=>!r||y.name.toLowerCase().includes(r.toLowerCase()),e[17]=r,e[18]=p):p=e[18];const b=n.filter(p);let x;e[19]!==r||e[20]!==o?(x=y=>d.jsx($L,{table:y,sqlTableContext:o,isSearching:!!r},y.name),e[19]=r,e[20]=o,e[21]=x):x=e[21],_=b.map(x),e[13]=r,e[14]=o,e[15]=n,e[16]=_}else _=e[16];return e[22]!==_?(g=d.jsx(d.Fragment,{children:_}),e[22]=_,e[23]=g):g=e[23],g},$L=t=>{const e=X.c(64),{table:n,sqlTableContext:o,isSearching:r}=t,{addTable:s}=mS(),[i,a]=K.useState(!1),[l,c]=K.useState(!1),u=n.columns.length>0;let h,f;e[0]!==s||e[1]!==i||e[2]!==o||e[3]!==n.name||e[4]!==u||e[5]!==l?(h=async()=>{if(i&&!u&&o&&!l){c(!0);const{engine:oe,database:se,schema:Z}=o,Q=await QH.request({engine:oe,database:se,schema:Z,tableName:n.name});if(!(Q!=null&&Q.table))throw new Error("No table details available");s({table:Q.table,sqlTableContext:o})}},e[0]=s,e[1]=i,e[2]=o,e[3]=n.name,e[4]=u,e[5]=l,e[6]=h):h=e[6],e[7]!==i||e[8]!==u?(f=[i,u],e[7]=i,e[8]=u,e[9]=f):f=e[9];const{isFetching:m,isPending:_,error:g}=Wn(h,f),p=Ue(tc),b=Os(),{createNewCell:x}=Tt(),y=_S();let v;e[10]!==y||e[11]!==p||e[12]!==x||e[13]!==b||e[14]!==o||e[15]!==n?(v=()=>{fo(p,x,b),y((()=>{if(n.source_type==="catalog"){const oe=o!=null&&o.database?`${o.database}.${n.name}`:n.name;return`${n.engine}.load_table("${oe}")`}if(o)return yS(n,"*",o);switch(n.source_type){case"local":return`mo.ui.table(${n.name})`;case"duckdb":case"connection":return yS(n,"*",o);default:return dc(n.source_type),""}})())},e[10]=y,e[11]=p,e[12]=x,e[13]=b,e[14]=o,e[15]=n,e[16]=v):v=e[16];const C=v;let k;e[17]!==n.num_columns||e[18]!==n.num_rows?(k=()=>{const oe=[];return n.num_rows!=null&&oe.push(`${n.num_rows} rows`),n.num_columns!=null&&oe.push(`${n.num_columns} columns`),oe.length===0?null:d.jsx("div",{className:"flex flex-row gap-2 items-center pl-6 group-hover:hidden",children:d.jsx("span",{className:"text-xs text-muted-foreground",children:oe.join(", ")})})},e[17]=n.num_columns,e[18]=n.num_rows,e[19]=k):k=e[19];const N=k;let j;e[20]!==g||e[21]!==m||e[22]!==_||e[23]!==o||e[24]!==n?(j=()=>{if(_||m)return d.jsx(pS,{message:"Loading columns...",className:"pl-12"});if(g)return d.jsx(gS,{error:g,className:"pl-12"});const oe=n.columns;return oe.length===0?d.jsx(Uc,{content:"No columns found",className:"pl-12"}):oe.map(se=>d.jsx(HL,{table:n,column:se,sqlTableContext:o},se.name))},e[20]=g,e[21]=m,e[22]=_,e[23]=o,e[24]=n,e[25]=j):j=e[25];const I=j;let T;e[26]!==i||e[27]!==r||e[28]!==n.source_type||e[29]!==n.type?(T=()=>{if(n.source_type==="local")return;const oe=n.type==="table"?v$:U3;return d.jsx(oe,{className:"h-3 w-3",strokeWidth:i||r?2.5:void 0})},e[26]=i,e[27]=r,e[28]=n.source_type,e[29]=n.type,e[30]=T):T=e[30];const A=T,R=o?`${o.database}.${o.schema}.${n.name}`:n.name,z=o&&(bS(o.schema)?"pl-9":"pl-12"),D=(i||r)&&"font-semibold";let F,B,U,O,S,$,E,W,G,q,Y,te;return e[31]!==z||e[32]!==D?(F=Ne("rounded-none group h-8 cursor-pointer",z,D),e[31]=z,e[32]=D,e[33]=F):F=e[33],e[34]!==i?(B=()=>a(!i),e[34]=i,e[35]=B):B=e[35],e[36]!==A?(U=A(),e[36]=A,e[37]=U):U=e[37],e[38]!==n.name?(O=d.jsx("span",{className:"text-sm",children:n.name}),e[38]=n.name,e[39]=O):O=e[39],e[40]!==U||e[41]!==O?(S=d.jsxs("div",{className:"flex gap-2 items-center flex-1",children:[U,O]}),e[40]=U,e[41]=O,e[42]=S):S=e[42],e[43]!==N?($=N(),e[43]=N,e[44]=$):$=e[44],e[45]!==C?(E=Vn.stopPropagation(()=>C()),e[45]=C,e[46]=E):E=e[46],e[47]===Symbol.for("react.memo_cache_sentinel")?(W=d.jsx(k$,{className:"h-3 w-3"}),e[47]=W):W=e[47],e[48]!==E?(G=d.jsx(Te,{content:"Add table to notebook",delayDuration:400,children:d.jsx(Me,{className:"group-hover:inline-flex hidden",variant:"text",size:"icon",onClick:E,children:W})}),e[48]=E,e[49]=G):G=e[49],e[50]!==i||e[51]!==B||e[52]!==S||e[53]!==$||e[54]!==G||e[55]!==F||e[56]!==R?(q=d.jsxs(mo,{className:F,value:R,"aria-selected":i,forceMount:!0,onSelect:B,children:[S,$,G]}),e[50]=i,e[51]=B,e[52]=S,e[53]=$,e[54]=G,e[55]=F,e[56]=R,e[57]=q):q=e[57],e[58]!==i||e[59]!==I?(Y=i&&I(),e[58]=i,e[59]=I,e[60]=Y):Y=e[60],e[61]!==q||e[62]!==Y?(te=d.jsxs(d.Fragment,{children:[q,Y]}),e[61]=q,e[62]=Y,e[63]=te):te=e[63],te},HL=t=>{var E,W;const e=X.c(51),{table:n,column:o,sqlTableContext:r}=t,[s,i]=K.useState(!1),a=Ue(hS),l=Zt(S$);let c,u;e[0]!==a?(c=()=>{a&&i(!1)},u=[a],e[0]=a,e[1]=c,e[2]=u):(c=e[1],u=e[2]),K.useEffect(c,u),l(s?G=>new Set([...G,`${n.name}:${o.name}`]):G=>(G.delete(`${n.name}:${o.name}`),new Set(G)));const h=_S(),{columnsPreviews:f}=C$();let m;e[3]!==o.name||e[4]!==n.primary_keys?(m=((E=n.primary_keys)==null?void 0:E.includes(o.name))||!1,e[3]=o.name,e[4]=n.primary_keys,e[5]=m):m=e[5];const _=m;let g;e[6]!==o.name||e[7]!==n.indexes?(g=((W=n.indexes)==null?void 0:W.includes(o.name))||!1,e[6]=o.name,e[7]=n.indexes,e[8]=g):g=e[8];const p=g;let b;e[9]!==h?(b=G=>{h(G)},e[9]=h,e[10]=b):b=e[10];const x=b,y=WL,v=s?"font-semibold":"";let C;e[11]!==o.name||e[12]!==v?(C=d.jsx("span",{className:v,children:o.name}),e[11]=o.name,e[12]=v,e[13]=C):C=e[13];const k=C,N=`${n.name}.${o.name}`,j=`${n.name}.${o.name}`;let I;e[14]!==s?(I=()=>i(!s),e[14]=s,e[15]=I):I=e[15];const T=r?"pl-14":"pl-7";let A,R,z,D,F,B,U,O,S,$;return e[16]!==T?(A=Ne("flex flex-row gap-2 items-center flex-1",T),e[16]=T,e[17]=A):A=e[17],e[18]!==o.type||e[19]!==k?(R=d.jsx(N$,{columnName:k,dataType:o.type}),e[18]=o.type,e[19]=k,e[20]=R):R=e[20],e[21]!==_?(z=_&&y({tooltipContent:"Primary key",content:"PK"}),e[21]=_,e[22]=z):z=e[22],e[23]!==p?(D=p&&y({tooltipContent:"Indexed",content:"IDX"}),e[23]=p,e[24]=D):D=e[24],e[25]!==A||e[26]!==R||e[27]!==z||e[28]!==D?(F=d.jsxs("div",{className:A,children:[R,z,D]}),e[25]=A,e[26]=R,e[27]=z,e[28]=D,e[29]=F):F=e[29],e[30]!==o.name?(B=d.jsx(Te,{content:"Copy column name",delayDuration:400,children:d.jsx(Me,{variant:"text",size:"icon",className:"group-hover:opacity-100 opacity-0 hover:bg-muted text-muted-foreground hover:text-foreground",children:d.jsx(sS,{tooltip:!1,value:o.name,className:"h-3 w-3"})})}),e[30]=o.name,e[31]=B):B=e[31],e[32]!==o.external_type?(U=d.jsx("span",{className:"text-xs text-muted-foreground",children:o.external_type}),e[32]=o.external_type,e[33]=U):U=e[33],e[34]!==I||e[35]!==F||e[36]!==B||e[37]!==U||e[38]!==N||e[39]!==j?(O=d.jsxs(mo,{className:"rounded-none py-1 group cursor-pointer",value:j,onSelect:I,children:[F,B,U]},N),e[34]=I,e[35]=F,e[36]=B,e[37]=U,e[38]=N,e[39]=j,e[40]=O):O=e[40],e[41]!==o||e[42]!==f||e[43]!==x||e[44]!==s||e[45]!==r||e[46]!==n?(S=s&&d.jsx("div",{className:"pl-10 pr-2 py-2 bg-[var(--slate-1)] shadow-inner border-b",children:d.jsx(bc,{children:d.jsx(j$,{table:n,column:o,onAddColumnChart:x,preview:f.get(r?`${r.database}.${r.schema}.${n.name}:${o.name}`:`${n.name}:${o.name}`),sqlTableContext:r})})}),e[41]=o,e[42]=f,e[43]=x,e[44]=s,e[45]=r,e[46]=n,e[47]=S):S=e[47],e[48]!==O||e[49]!==S?($=d.jsxs(d.Fragment,{children:[O,S]}),e[48]=O,e[49]=S,e[50]=$):$=e[50],$};function WL(t){const{tooltipContent:e,content:n}=t;return d.jsx(Te,{content:e,delayDuration:100,children:d.jsx("span",{className:"text-xs text-black bg-gray-100 dark:invert rounded px-1",children:n})})}const qL=()=>{const t=X.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=d.jsx(FL,{}),t[0]=e):e=t[0],e},GL=()=>{const t=X.c(5),{documentation:e}=Ue(I$);if(!e){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=d.jsx(xn,{title:"View docs as you type",description:"Move your text cursor over a symbol to see its documentation.",icon:d.jsx(sd,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=Hm({html:e}),t[1]=e,t[2]=n):n=t[2],t[3]!==n?(o=d.jsx("div",{className:"p-3 overflow-y-auto overflow-x-hidden h-full docs-documentation flex flex-col gap-4",children:n}),t[3]=n,t[4]=o):o=t[4],o},YL=()=>{const t=X.c(5),e=A$();if(e.length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=d.jsx(xn,{title:"No errors!",icon:d.jsx(Mp,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=e.map(JL),t[1]=e,t[2]=n):n=t[2],t[3]!==n?(o=d.jsx("div",{className:"flex flex-col overflow-auto",children:n}),t[3]=n,t[4]=o):o=t[4],o};function JL(t){return d.jsxs("div",{children:[d.jsx("div",{className:"text-xs font-mono font-semibold bg-muted border-y px-2 py-1",children:d.jsx(T$,{cellId:t.cellId})}),d.jsx("div",{className:"px-2",children:d.jsx(M$,{errors:t.output.data,cellId:t.cellId},t.cellId)},t.cellId)]},t.cellId)}const Kf=new Map,KL=({file:t,onOpenNotebook:e})=>{const{theme:n}=hr(),o=Ue(cm),[r,s]=M.useState(""),{data:i,isPending:a,error:l,setData:c}=Wn(async()=>{const g=await qm({path:t.path}),p=g.contents||"";return s(Kf.get(t.path)||p),g},[t.path]),u=async()=>{r!==(i==null?void 0:i.contents)&&await B$({path:t.path,contents:r}).then(g=>{g.success&&(c(p=>({...p,contents:r})),s(r))})},h=M.useRef(r);if(h.current=r,M.useEffect(()=>()=>{if(!(i!=null&&i.contents))return;const g=h.current;g===i.contents?Kf.delete(t.path):Kf.set(t.path,g)},[t.path,i==null?void 0:i.contents]),l)return d.jsx(Br,{error:l});if(a||!i)return null;const f=i.mimeType||"text/plain",m=f in Xf;if(!i.contents&&!m)return d.jsxs("div",{className:"grid grid-cols-2 gap-2 p-6",children:[d.jsx("div",{className:"font-bold text-muted-foreground",children:"Name"}),d.jsx("div",{children:i.file.name}),d.jsx("div",{className:"font-bold text-muted-foreground",children:"Type"}),d.jsx("div",{children:f})]});const _=d.jsxs("div",{className:"text-xs text-muted-foreground p-1 flex justify-end gap-2 border-b",children:[t.isMarimoFile&&!un()&&d.jsx(Te,{content:"Open notebook",children:d.jsx(bn,{size:"small",onClick:g=>e(g),children:d.jsx(pc,{})})}),d.jsx(Te,{content:"Download",children:d.jsx(bn,{size:"small",onClick:()=>{if(a3(f)){const g=F$(i.contents,f);return void z$(g,i.file.name)}Qi(new Blob([i.contents||r],{type:f}),i.file.name)},children:d.jsx(xm,{})})}),!a3(f)&&d.jsxs(d.Fragment,{children:[d.jsx(Te,{content:"Copy contents to clipboard",children:d.jsx(bn,{size:"small",onClick:async()=>{await _n(r)},children:d.jsx(qi,{})})}),d.jsx(Te,{content:rn("global.save"),children:d.jsx(bn,{size:"small",color:r===i.contents?void 0:"green",onClick:u,disabled:r===i.contents,children:d.jsx(wa,{})})})]})]});return f.startsWith("image/")?d.jsxs(d.Fragment,{children:[_,d.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:d.jsx(O$,{base64:i.contents,mime:f})})]}):f==="text/csv"&&i.contents?d.jsxs(d.Fragment,{children:[_,d.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:d.jsx(D$,{contents:i.contents})})]}):f.startsWith("audio/")?d.jsxs(d.Fragment,{children:[_,d.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:d.jsx(R$,{base64:i.contents,mime:f})})]}):f.startsWith("video/")?d.jsxs(d.Fragment,{children:[_,d.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:d.jsx(P$,{base64:i.contents,mime:f})})]}):f.startsWith("application/pdf")?d.jsxs(d.Fragment,{children:[_,d.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:d.jsx(L$,{base64:i.contents,mime:f})})]}):d.jsxs(d.Fragment,{children:[_,d.jsx("div",{className:"flex-1 overflow-auto",children:d.jsx(M.Suspense,{children:d.jsx(ua,{theme:n==="dark"?"dark":"light",language:Xf[f]||Xf.default,className:"border-b",extensions:[et.lineWrapping,qn.of([{key:o.getHotkey("global.save").key,stopPropagation:!0,run:()=>r!==i.contents&&(u(),!0)}])],value:r,onChange:s})})})]})},a3=t=>t.startsWith("image/")||t.startsWith("audio/")||t.startsWith("video/")||t.startsWith("application/pdf"),Xf={"application/javascript":"javascript","text/markdown":"markdown","text/html":"html","text/css":"css","text/x-python":"python","application/json":"json","application/xml":"xml","text/x-yaml":"yaml","text/csv":"markdown","text/plain":"markdown",default:"markdown"},l3=qt(new class{constructor(t){this.callbacks=t,this.delegate=new Zm([]),this.rootPath="",this.onChange=kn.NOOP,this.path=new hc("/"),this.initialize=async e=>{if(this.onChange=e,this.delegate.data.length===0)try{const n=await this.callbacks.listFiles({path:this.rootPath});this.delegate=new Zm(n.files),this.rootPath=n.root,this.path=hc.guessDeliminator(n.root)}catch(n){dt({title:"Failed",description:L4(n)})}this.onChange(this.delegate.data)},this.refreshAll=async e=>{const n=[this.rootPath,...e.map(r=>{var s;return(s=this.delegate.find(r))==null?void 0:s.data.path})].filter(Boolean),o=await Promise.all(n.map(r=>this.callbacks.listFiles({path:r}).catch(()=>({files:[]}))));for(const[r,s]of n.entries()){const i=o[r];s===this.rootPath?this.delegate=new Zm(i.files):this.delegate.update({id:s,changes:{children:i.files}})}this.onChange(this.delegate.data)},this.relativeFromRoot=e=>{const n=this.rootPath.endsWith(this.path.deliminator)?this.rootPath:`${this.rootPath}${this.path.deliminator}`;return e.startsWith(n)?e.slice(n.length):e},this.handleResponse=e=>e.success?e:(dt({title:"Failed",description:e.message}),null)}async expand(t){const e=this.delegate.find(t);if(!e||!e.data.isDirectory)return!1;if(e.children&&e.children.length>0)return!0;const n=await this.callbacks.listFiles({path:e.data.path});return this.delegate.update({id:t,changes:{children:n.files}}),this.onChange(this.delegate.data),!0}async rename(t,e){const n=this.delegate.find(t);if(!n)return;const o=n.data.path,r=this.path.join(this.path.dirname(o),e);await this.callbacks.renameFileOrFolder({path:o,newPath:r}).then(this.handleResponse),this.delegate.update({id:t,changes:{name:e,path:r}}),this.onChange(this.delegate.data),await this.refreshAll([r])}async move(t,e){var o;const n=e?((o=this.delegate.find(e))==null?void 0:o.data.path)??e:this.rootPath;await Promise.all(t.map(r=>{this.delegate.move({id:r,parentId:e,index:0});const s=this.delegate.find(r);if(!s)return Promise.resolve();const i=this.path.join(n,this.path.basename(s.data.path));return this.delegate.update({id:r,changes:{path:i}}),this.callbacks.renameFileOrFolder({path:s.data.path,newPath:i}).then(this.handleResponse)})),this.onChange(this.delegate.data),await this.refreshAll([n])}async createFile(t,e){var r;const n=e?((r=this.delegate.find(e))==null?void 0:r.data.path)??e:this.rootPath,o=await this.callbacks.createFileOrFolder({path:n,type:"file",name:t}).then(this.handleResponse);o!=null&&o.info&&(this.delegate.create({parentId:e,index:0,data:o.info}),this.onChange(this.delegate.data),await this.refreshAll([n]))}async createFolder(t,e){var r;const n=e?((r=this.delegate.find(e))==null?void 0:r.data.path)??e:this.rootPath,o=await this.callbacks.createFileOrFolder({path:n,type:"directory",name:t}).then(this.handleResponse);o!=null&&o.info&&(this.delegate.create({parentId:e,index:0,data:o.info}),this.onChange(this.delegate.data),await this.refreshAll([n]))}async delete(t){const e=this.delegate.find(t);e&&(await this.callbacks.deleteFileOrFolder({path:e.data.path}).then(this.handleResponse),this.delegate.drop({id:t}),this.onChange(this.delegate.data))}}({listFiles:h4,createFileOrFolder:Gm,deleteFileOrFolder:V$,renameFileOrFolder:U$})),XL=qt({});function ZL(t){return new Promise((e,n)=>{const o=new FileReader;o.onload=r=>{var s;e((s=r.target)==null?void 0:s.result)},o.onerror=r=>{n(new Error(`Failed to read blob: ${r.type}`))},o.readAsDataURL(t)})}function c3(t){const e=X.c(4);let n;e[0]!==t?(n=t===void 0?{}:t,e[0]=t,e[1]=n):n=e[1];const o=n;let r;return e[2]!==o?(r={multiple:!0,maxSize:104857600,onError:oF,onDropRejected:eF,onDrop:QL,...o},e[2]=o,e[3]=r):r=e[3],$$(r)}async function QL(t){for(const e of t){const n=sF(rF(e));let o="";n&&(o=hc.guessDeliminator(n).dirname(n));const r=(await ZL(e)).split(",")[1];await Gm({path:o,type:"file",name:e.name,contents:r})}await async function(){await lt.get(l3).refreshAll([])}()}function eF(t){dt({title:"File upload failed",description:d.jsx("div",{className:"flex flex-col gap-1",children:t.map(tF)}),variant:"danger"})}function tF(t){return d.jsxs("div",{children:[t.file.name," (",t.errors.map(nF).join(", "),")"]},t.file.name)}function nF(t){return t.message}function oF(t){St.error(t),dt({title:"File upload failed",description:t.message,variant:"danger"})}function rF(t){return t.webkitRelativePath?t.webkitRelativePath:"path"in t&&typeof t.path=="string"?t.path:"relativePath"in t&&typeof t.relativePath=="string"?t.relativePath:void 0}function sF(t){if(t)return t.replace(/^\/+/,"")}const d3=K.createContext(null),iF=t=>{const e=X.c(60),{height:n}=t,o=M.useRef(null),[r]=on(l3);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=[],e[0]=s):s=e[0];const[i,a]=M.useState(s),[l,c]=M.useState(null),{openPrompt:u}=Hn(),[h,f]=on(XL);let m,_;e[1]!==r?(m=()=>r.initialize(a),e[1]=r,e[2]=m):m=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(_=[],e[3]=_):_=e[3];const{isPending:g,error:p}=Wn(m,_);let b;e[4]!==h||e[5]!==r?(b=()=>{r.refreshAll(Object.keys(h).filter(S=>h[S]))},e[4]=h,e[5]=r,e[6]=b):b=e[6];const x=Ke(b);let y;e[7]!==u||e[8]!==r?(y=async()=>{u({title:"Folder name",onConfirm:async S=>{r.createFolder(S,null)}})},e[7]=u,e[8]=r,e[9]=y):y=e[9];const v=Ke(y);let C;e[10]!==u||e[11]!==r?(C=async()=>{u({title:"File name",onConfirm:async S=>{r.createFile(S,null)}})},e[10]=u,e[11]=r,e[12]=C):C=e[12];const k=Ke(C);let N;e[13]!==f?(N=()=>{var S;(S=o.current)==null||S.closeAll(),f({})},e[13]=f,e[14]=N):N=e[14];const j=Ke(N);if(g){let S;return e[15]===Symbol.for("react.memo_cache_sentinel")?(S=d.jsx(Yn,{size:"medium",centered:!0}),e[15]=S):S=e[15],S}if(p){let S;return e[16]!==p?(S=d.jsx(Br,{error:p}),e[16]=p,e[17]=S):S=e[17],S}if(l){let S,$,E,W,G,q;return e[18]===Symbol.for("react.memo_cache_sentinel")?(S=()=>c(null),e[18]=S):S=e[18],e[19]===Symbol.for("react.memo_cache_sentinel")?($=d.jsx(Me,{onClick:S,"data-testid":"file-explorer-back-button",variant:"text",size:"xs",className:"mb-0",children:d.jsx(jt,{size:16})}),e[19]=$):$=e[19],e[20]!==l.name?(E=d.jsxs("div",{className:"flex items-center pl-1 pr-3 flex-shrink-0 border-b justify-between",children:[$,d.jsx("span",{className:"font-bold",children:l.name})]}),e[20]=l.name,e[21]=E):E=e[21],e[22]!==l.path||e[23]!==r?(W=Y=>u3(Y,r.relativeFromRoot(l.path)),e[22]=l.path,e[23]=r,e[24]=W):W=e[24],e[25]!==l||e[26]!==W?(G=d.jsx(M.Suspense,{children:d.jsx(KL,{onOpenNotebook:W,file:l})}),e[25]=l,e[26]=W,e[27]=G):G=e[27],e[28]!==E||e[29]!==G?(q=d.jsxs(d.Fragment,{children:[E,G]}),e[28]=E,e[29]=G,e[30]=q):q=e[30],q}let I;e[31]!==j||e[32]!==k||e[33]!==v||e[34]!==x||e[35]!==r?(I=d.jsx(lF,{onRefresh:x,onCreateFile:k,onCreateFolder:v,onCollapseAll:j,tree:r}),e[31]=j,e[32]=k,e[33]=v,e[34]=x,e[35]=r,e[36]=I):I=e[36];const T=n-33;let A,R,z,D,F,B,U,O;return e[37]!==r?(A=async S=>{const{ids:$}=S;for(const E of $)await r.delete(E)},R=async S=>{const{id:$,name:E}=S;await r.rename($,E)},z=async S=>{const{dragIds:$,parentId:E}=S;await r.move($,E)},e[37]=r,e[38]=A,e[39]=R,e[40]=z):(A=e[38],R=e[39],z=e[40]),e[41]===Symbol.for("react.memo_cache_sentinel")?(D=S=>{const $=S[0];$&&($.data.isDirectory||c($.data))},e[41]=D):D=e[41],e[42]!==h||e[43]!==f||e[44]!==r?(F=async S=>{if(await r.expand(S)){const $=h[S]??!1;f({...h,[S]:!$})}},e[42]=h,e[43]=f,e[44]=r,e[45]=F):F=e[45],e[46]!==i||e[47]!==h||e[48]!==A||e[49]!==R||e[50]!==z||e[51]!==F||e[52]!==T?(B=d.jsx(DH,{width:"100%",ref:o,height:T,className:"h-full",data:i,initialOpenState:h,openByDefault:!1,renderCursor:fF,disableDrop:mF,onDelete:A,onRename:R,onMove:z,onSelect:D,onToggle:F,padding:15,rowHeight:30,indent:aF,overscanCount:1e3,disableMultiSelection:!0,children:uF}),e[46]=i,e[47]=h,e[48]=A,e[49]=R,e[50]=z,e[51]=F,e[52]=T,e[53]=B):B=e[53],e[54]!==B||e[55]!==r?(U=d.jsx(d3,{value:r,children:B}),e[54]=B,e[55]=r,e[56]=U):U=e[56],e[57]!==U||e[58]!==I?(O=d.jsxs(d.Fragment,{children:[I,U]}),e[57]=U,e[58]=I,e[59]=O):O=e[59],O},aF=15,lF=t=>{const e=X.c(30),{onRefresh:n,onCreateFile:o,onCreateFolder:r,onCollapseAll:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={noDrag:!0,noDragEventsBubbling:!0},e[0]=i):i=e[0];const{getRootProps:a,getInputProps:l}=c3(i);let c,u,h,f,m,_,g,p,b,x,y,v,C,k,N;return e[1]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(xa,{size:16}),e[1]=c):c=e[1],e[2]!==o?(u=d.jsx(Te,{content:"Add file",children:d.jsx(Me,{"data-testid":"file-explorer-add-file-button",onClick:o,variant:"text",size:"xs",children:c})}),e[2]=o,e[3]=u):u=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(h=d.jsx(Xc,{size:16}),e[4]=h):h=e[4],e[5]!==r?(f=d.jsx(Te,{content:"Add folder",children:d.jsx(Me,{"data-testid":"file-explorer-add-folder-button",onClick:r,variant:"text",size:"xs",children:h})}),e[5]=r,e[6]=f):f=e[6],e[7]!==a?(m=a({}),e[7]=a,e[8]=m):m=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(_=H$({variant:"text",size:"xs"}),g=d.jsx(q$,{size:16}),e[9]=_,e[10]=g):(_=e[9],g=e[10]),e[11]!==m?(p=d.jsx(Te,{content:"Upload file",children:d.jsx("button",{"data-testid":"file-explorer-upload-button",...m,className:_,children:g})}),e[11]=m,e[12]=p):p=e[12],e[13]!==l?(b=l({}),e[13]=l,e[14]=b):b=e[14],e[15]!==b?(x=d.jsx("input",{...b,type:"file"}),e[15]=b,e[16]=x):x=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(y=d.jsx(V4,{size:16}),e[17]=y):y=e[17],e[18]!==n?(v=d.jsx(Te,{content:"Refresh",children:d.jsx(Me,{"data-testid":"file-explorer-refresh-button",onClick:n,variant:"text",size:"xs",children:y})}),e[18]=n,e[19]=v):v=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(C=d.jsx(up,{size:16}),e[20]=C):C=e[20],e[21]!==s?(k=d.jsx(Te,{content:"Collapse all folders",children:d.jsx(Me,{"data-testid":"file-explorer-collapse-button",onClick:s,variant:"text",size:"xs",children:C})}),e[21]=s,e[22]=k):k=e[22],e[23]!==x||e[24]!==v||e[25]!==k||e[26]!==u||e[27]!==f||e[28]!==p?(N=d.jsxs("div",{className:"flex items-center justify-end px-2 flex-shrink-0 border-b",children:[u,f,p,x,v,k]}),e[23]=x,e[24]=v,e[25]=k,e[26]=u,e[27]=f,e[28]=p,e[29]=N):N=e[29],N},cF=t=>{const e=X.c(9),{node:n,onOpenMarimoFile:o}=t;let r,s,i;return e[0]!==n?(r=a=>{n.data.isDirectory||(a.stopPropagation(),n.select())},e[0]=n,e[1]=r):r=e[1],e[2]!==n.data.isMarimoFile||e[3]!==o?(s=n.data.isMarimoFile&&!un()&&d.jsxs("span",{className:"flex-shrink-0 ml-2 text-sm hidden group-hover:inline hover:underline",onClick:o,children:["open ",d.jsx(pc,{className:"inline ml-1",size:12})]}),e[2]=n.data.isMarimoFile,e[3]=o,e[4]=s):s=e[4],e[5]!==n.data.name||e[6]!==r||e[7]!==s?(i=d.jsxs("span",{className:"flex-1 overflow-hidden text-ellipsis",onClick:r,children:[n.data.name,s]}),e[5]=n.data.name,e[6]=r,e[7]=s,e[8]=i):i=e[8],i},dF=t=>{const e=X.c(10),{node:n}=t,o=M.useRef(null);let r,s,i,a,l;return e[0]!==n.data.name?(r=()=>{var c,u;(c=o.current)==null||c.focus(),(u=o.current)==null||u.setSelectionRange(0,n.data.name.lastIndexOf("."))},s=[n.data.name],e[0]=n.data.name,e[1]=r,e[2]=s):(r=e[1],s=e[2]),M.useEffect(r,s),e[3]!==n?(i=()=>n.reset(),a=c=>{c.key==="Escape"&&n.reset(),c.key==="Enter"&&n.submit(c.currentTarget.value)},e[3]=n,e[4]=i,e[5]=a):(i=e[4],a=e[5]),e[6]!==n.data.name||e[7]!==i||e[8]!==a?(l=d.jsx("input",{ref:o,className:"flex-1 bg-transparent border border-border text-muted-foreground",defaultValue:n.data.name,onClick:pF,onBlur:i,onKeyDown:a}),e[6]=n.data.name,e[7]=i,e[8]=a,e[9]=l):l=e[9],l},uF=({node:t,style:e,dragHandle:n})=>{const o=t.data.isDirectory?"directory":d4(t.data.name),r=u4[o],{openConfirm:s,openPrompt:i}=Hn(),{createNewCell:a}=Tt(),l=Os(),c=M.use(d3),u=async g=>{u3(g,c?c.relativeFromRoot(t.data.path):t.data.path)},h=async g=>{g.stopPropagation(),g.preventDefault(),s({title:"Delete file",description:`Are you sure you want to delete ${t.data.name}?`,confirmAction:d.jsx(s4,{onClick:async()=>{await t.tree.delete(t.id)},"aria-label":"Confirm",children:"Delete"})})},f=Ke(async()=>{t.open(),i({title:"Folder name",onConfirm:async g=>{c==null||c.createFolder(g,t.id)}})}),m=Ke(async()=>{t.open(),i({title:"File name",onConfirm:async g=>{c==null||c.createFile(g,t.id)}})}),_=Ke(async()=>{var x;if(!c||t.data.isDirectory)return;const[g,p]=W$(t.data.name),b=`${g}_copy${p}`;try{const y=await qm({path:t.data.path}),v=((x=t.parent)==null?void 0:x.data.path)||"";await Gm({path:v,type:"file",name:b,contents:y.contents?btoa(y.contents):void 0}),await c.refreshAll([v])}catch{dt({title:"Failed to duplicate file",description:"Unable to create a duplicate of the file",variant:"danger"})}});return d.jsxs("div",{style:e,ref:n,className:Ne("flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group"),draggable:!0,onClick:g=>{g.stopPropagation(),t.data.isDirectory&&t.toggle()},children:[d.jsx(hF,{node:t}),d.jsxs("span",{className:Ne("flex items-center pl-1 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden group",t.willReceiveDrop&&t.data.isDirectory&&"bg-accent/80 hover:bg-accent/80 text-accent-foreground"),children:[t.data.isMarimoFile?d.jsx("img",{src:"./favicon.ico",className:"w-5 h-5 flex-shrink-0 mr-2 filter grayscale",alt:"Marimo"}):d.jsx(r,{className:"w-5 h-5 flex-shrink-0 mr-2",strokeWidth:1.5}),t.isEditing?d.jsx(dF,{node:t}):d.jsx(cF,{node:t,onOpenMarimoFile:u}),d.jsxs(Pr,{modal:!1,children:[d.jsx(Lr,{asChild:!0,tabIndex:-1,onClick:g=>g.stopPropagation(),children:d.jsx(Me,{"data-testid":"file-explorer-more-button",variant:"text",tabIndex:-1,size:"xs",className:"mb-0","aria-label":"More options",children:d.jsx(Kc,{strokeWidth:2,className:"w-5 h-5 hidden group-hover:block"})})}),(()=>{const g={size:14,strokeWidth:1.5,className:"mr-2"};return d.jsxs(Fr,{align:"end",className:"no-print w-[220px]",onClick:p=>p.stopPropagation(),onCloseAutoFocus:p=>p.preventDefault(),children:[!t.data.isDirectory&&d.jsxs(Gt,{onSelect:()=>t.select(),children:[d.jsx(Gp,{...g}),"Open file"]}),!t.data.isDirectory&&!un()&&d.jsxs(Gt,{onSelect:()=>{G$({path:t.data.path})},children:[d.jsx(pc,{...g}),"Open file in external editor"]}),t.data.isDirectory&&d.jsxs(d.Fragment,{children:[d.jsxs(Gt,{onSelect:()=>m(),children:[d.jsx(xa,{...g}),"Create file"]}),d.jsxs(Gt,{onSelect:()=>f(),children:[d.jsx(Xc,{...g}),"Create folder"]}),d.jsx(Sn,{})]}),d.jsxs(Gt,{onSelect:()=>t.edit(),children:[d.jsx(Op,{...g}),"Rename"]}),!t.data.isDirectory&&d.jsxs(Gt,{onSelect:_,children:[d.jsx(qi,{...g}),"Duplicate"]}),d.jsxs(Gt,{onSelect:async()=>{await _n(t.data.path),dt({title:"Copied to clipboard"})},children:[d.jsx(ed,{...g}),"Copy path"]}),c&&d.jsxs(Gt,{onSelect:async()=>{await _n(c.relativeFromRoot(t.data.path)),dt({title:"Copied to clipboard"})},children:[d.jsx(ed,{...g}),"Copy relative path"]}),d.jsx(Sn,{}),d.jsxs(Gt,{onSelect:()=>{const{path:p}=t.data;(b=>{a({code:b,before:!1,cellId:l??"__end__"})})(wS[o](p))},children:[d.jsx($r,{...g}),"Insert snippet for reading file"]}),d.jsxs(Gt,{onSelect:async()=>{dt({title:"Copied to clipboard",description:"Code to open the file has been copied to your clipboard. You can also drag and drop this file into the editor"});const{path:p}=t.data,b=wS[o](p);await _n(b)},children:[d.jsx(Y$,{...g}),"Copy snippet for reading file"]}),t.data.isMarimoFile&&!un()&&d.jsxs(d.Fragment,{children:[d.jsx(Sn,{}),d.jsxs(Gt,{onSelect:u,children:[d.jsx(Vp,{...g}),"Open notebook"]})]}),d.jsx(Sn,{}),!t.data.isDirectory&&d.jsxs(d.Fragment,{children:[d.jsxs(Gt,{onSelect:async()=>{const p=(await qm({path:t.data.path})).contents||"";Qi(new Blob([p]),t.data.name)},children:[d.jsx(xm,{...g}),"Download"]}),d.jsx(Sn,{})]}),d.jsxs(Gt,{onSelect:h,variant:"danger",children:[d.jsx(lm,{...g}),"Delete"]})]})})()]})]})]})},hF=t=>{const e=X.c(3),{node:n}=t;if(!n.data.isDirectory){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=d.jsx("span",{className:"w-5 h-5 flex-shrink-0"}),e[0]=r):r=e[0],r}let o;return e[1]!==n.isOpen?(o=n.isOpen?d.jsx(Tr,{className:"w-5 h-5 flex-shrink-0"}):d.jsx(Yi,{className:"w-5 h-5 flex-shrink-0"}),e[1]=n.isOpen,e[2]=o):o=e[2],o};function u3(t,e){t.stopPropagation(),t.preventDefault(),TS(e)}function fF(){return null}function mF(t){const{parentNode:e}=t;return!e.data.isDirectory}function pF(t){return t.stopPropagation()}let h3,f3,m3;h3=()=>{const t=X.c(20),{ref:e,height:n}=J$(),o=n===void 0?1:n;let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={noClick:!0,noKeyboard:!0},t[0]=r):r=t[0];const{getRootProps:s,getInputProps:i,isDragActive:a}=c3(r);let l,c,u,h,f,m,_,g;return t[1]!==s?(l=s(),t[1]=s,t[2]=l):l=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(c=Ne("flex flex-col flex-1 overflow-hidden relative"),t[3]=c):c=t[3],t[4]!==i?(u=i(),t[4]=i,t[5]=u):u=t[5],t[6]!==u?(h=d.jsx("input",{...u}),t[6]=u,t[7]=h):h=t[7],t[8]!==a?(f=a&&d.jsx("div",{className:"absolute inset-0 flex items-center uppercase justify-center text-xl font-bold text-primary/90 bg-accent/85 z-10 border-2 border-dashed border-primary/90 rounded-lg pointer-events-none",children:"Drop files here"}),t[8]=a,t[9]=f):f=t[9],t[10]!==o?(m=d.jsx(iF,{height:o}),t[10]=o,t[11]=m):m=t[11],t[12]!==e||t[13]!==m?(_=d.jsx("div",{ref:e,className:"flex flex-col flex-1 overflow-hidden",children:m}),t[12]=e,t[13]=m,t[14]=_):_=t[14],t[15]!==l||t[16]!==h||t[17]!==f||t[18]!==_?(g=d.jsxs("div",{...l,className:c,children:[h,f,_]}),t[15]=l,t[16]=h,t[17]=f,t[18]=_,t[19]=g):g=t[19],g},op=t=>{const e=X.c(6),n=t.dataTestId;let o,r;return e[0]!==t.className?(o=Ne("text-xs font-semibold text-accent-foreground",t.className),e[0]=t.className,e[1]=o):o=e[1],e[2]!==t.dataTestId||e[3]!==t.onClick||e[4]!==o?(r=d.jsx("button",{type:"button","data-testid":n,className:o,onClick:t.onClick,children:"Clear"}),e[2]=t.dataTestId,e[3]=t.onClick,e[4]=o,e[5]=r):r=e[5],r},f3=()=>{const t=X.c(9),e=K$(),{clearLogs:n}=Tt();if(e.length===0){let i,a;return t[0]===Symbol.for("react.memo_cache_sentinel")?(i=d.jsx("code",{className:"border rounded px-1",children:"stdout"}),t[0]=i):i=t[0],t[1]===Symbol.for("react.memo_cache_sentinel")?(a=d.jsx(xn,{title:"No logs",description:d.jsxs("span",{children:[i," and"," ",d.jsx("code",{className:"border rounded px-1",children:"stderr"})," logs will appear here."]}),icon:d.jsx(rm,{})}),t[1]=a):a=t[1],a}let o,r,s;return t[2]!==n?(o=d.jsx("div",{className:"flex flex-row justify-end px-2 py-1",children:d.jsx(op,{dataTestId:"clear-logs-button",onClick:n})}),t[2]=n,t[3]=o):o=t[3],t[4]!==e?(r=d.jsx("div",{className:"overflow-auto flex-1",children:d.jsx(m3,{logs:e,className:"min-w-[300px]"})}),t[4]=e,t[5]=r):r=t[5],t[6]!==o||t[7]!==r?(s=d.jsxs(d.Fragment,{children:[o,r]}),t[6]=o,t[7]=r,t[8]=s):s=t[8],s},m3=t=>{const e=X.c(10),{logs:n,className:o}=t;let r,s,i,a,l;return e[0]!==o?(r=Ne("flex flex-col",o),e[0]=o,e[1]=r):r=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(s={whiteSpace:"pre-wrap"},e[2]=s):s=e[2],e[3]!==n?(i=n.map(bF),e[3]=n,e[4]=i):i=e[4],e[5]!==i?(a=d.jsx("pre",{className:"grid text-xs font-mono gap-1 whitespace-break-spaces font-semibold align-left",children:d.jsx("div",{className:"grid grid-cols-[30px,1fr]",style:s,children:i})}),e[5]=i,e[6]=a):a=e[6],e[7]!==r||e[8]!==a?(l=d.jsx("div",{className:r,children:a}),e[7]=r,e[8]=a,e[9]=l):l=e[9],l};function gF(t){const e=X$(t.timestamp),n=_F[t.level],o=t.level.toUpperCase();return d.jsxs(d.Fragment,{children:[d.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)] dark:text-[var(--gray-11)]",children:["[",e,"]"]}),d.jsx("span",{className:Ne("flex-shrink-0",n),children:o}),d.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)]",children:["(",d.jsx(fr,{cellId:t.cellId}),")"]}),t.message]})}const _F={stdout:"text-[var(--grass-9)]",stderr:"text-[var(--red-9)]"};function bF(t,e){return d.jsxs("div",{className:"contents group",children:[d.jsx("span",{className:Ne("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","text-right col-span-1 py-1 pr-1"),children:e+1}),d.jsx("span",{className:Ne("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","px-2 flex gap-x-1.5 py-1 flex-wrap"),children:gF(t)})]},e)}const xF=()=>{const t=X.c(7),{items:e}=Ue(Z$);let n,o;t[0]!==e?(o=eW(e),t[0]=e,t[1]=o):o=t[1],n=o;const r=n,{activeHeaderId:s,activeOccurrences:i}=tW(r);if(e.length===0){let l;return t[2]===Symbol.for("react.memo_cache_sentinel")?(l=d.jsx(xn,{title:"No outline",description:"Add markdown headings to your notebook to create an outline.",icon:d.jsx(rd,{})}),t[2]=l):l=t[2],l}let a;return t[3]!==s||t[4]!==i||t[5]!==e?(a=d.jsx(nW,{items:e,activeHeaderId:s,activeOccurrences:i}),t[3]=s,t[4]=i,t[5]=e,t[6]=a):a=t[6],a},p3=qt(null),g3=t=>{const e=X.c(9),{onClick:n,loading:o,children:r,className:s}=t;if(o){let c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(Yn,{size:"small",className:"h-4 w-4 shrink-0 opacity-50"}),e[0]=c):c=e[0],c}let i,a,l;return e[1]!==s?(i=Ne("px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible",s),e[1]=s,e[2]=i):i=e[2],e[3]!==n?(a=Vn.stopPropagation(n),e[3]=n,e[4]=a):a=e[4],e[5]!==r||e[6]!==i||e[7]!==a?(l=d.jsx("button",{type:"button",className:i,onClick:a,children:r}),e[5]=r,e[6]=i,e[7]=a,e[8]=l):l=e[8],l},yF=()=>{var v,C;const t=X.c(27),[e]=Dr(),n=e.package_management.manager,[o,r]=K.useState(null);let s;t[0]!==n?(s=[n],t[0]=n,t[1]=s):s=t[1];const{data:i,error:a,refetch:l,isPending:c}=Wn(SF,s);if(c){let k;return t[2]===Symbol.for("react.memo_cache_sentinel")?(k=d.jsx(Yn,{size:"medium",centered:!0}),t[2]=k):k=t[2],k}if(a){let k;return t[3]!==a?(k=d.jsx(Br,{error:a}),t[3]=a,t[4]=k):k=t[4],k}const u=i.tree!=null;let h;t[5]!==u||t[6]!==o?(h=function(k,N){return k==="list"?"list":N?k||"tree":"list"}(o,u),t[5]=u,t[6]=o,t[7]=h):h=t[7];const f=h,m=(v=i.tree)==null?void 0:v.name,_=(C=i==null?void 0:i.tree)==null?void 0:C.version,g=m==="<root>";let p,b,x,y;return t[8]!==n||t[9]!==l?(p=d.jsx(wF,{packageManager:n,onSuccess:l}),t[8]=n,t[9]=l,t[10]=p):p=t[10],t[11]!==g||t[12]!==u||t[13]!==m||t[14]!==_||t[15]!==f?(b=u&&d.jsxs("div",{className:"flex items-center justify-between px-2 py-1 border-b",children:[d.jsxs("div",{className:"flex gap-1",children:[d.jsx("button",{type:"button",className:Ne("px-2 py-1 text-xs rounded",f==="list"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>r("list"),children:"List"}),d.jsx("button",{type:"button",className:Ne("px-2 py-1 text-xs rounded",f==="tree"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>r("tree"),children:"Tree"})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium",title:g?"sandbox":"project",children:g?"sandbox":"project"}),m&&!g&&d.jsxs("span",{className:"text-xs text-muted-foreground",children:[m,_&&` v${_}`]})]})]}),t[11]=g,t[12]=u,t[13]=m,t[14]=_,t[15]=f,t[16]=b):b=t[16],t[17]!==i.list||t[18]!==i.tree||t[19]!==a||t[20]!==l||t[21]!==f?(x=f==="list"?d.jsx(vF,{packages:i.list,onSuccess:l}):d.jsx(kF,{tree:i.tree,error:a,onSuccess:l}),t[17]=i.list,t[18]=i.tree,t[19]=a,t[20]=l,t[21]=f,t[22]=x):x=t[22],t[23]!==p||t[24]!==b||t[25]!==x?(y=d.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[p,b,x]}),t[23]=p,t[24]=b,t[25]=x,t[26]=y):y=t[26],y},wF=t=>{const e=X.c(40),{onSuccess:n,packageManager:o}=t,[r,s]=K.useState(""),{handleClick:i}=fa(),a=Ue(p3),l=Zt(p3);let c,u;e[0]!==a||e[1]!==l?(c=()=>{a&&(s(a),l(null))},u=[a,l],e[0]=a,e[1]=l,e[2]=c,e[3]=u):(c=e[2],u=e[3]),K.useEffect(c,u);const{loading:h,handleInstallPackages:f}=tH();let m;e[4]!==n?(m=()=>{n(),s("")},e[4]=n,e[5]=m):m=e[5];const _=m;let g;e[6]!==f||e[7]!==r||e[8]!==_?(g=()=>{f(r.split(",").map(CF),_)},e[6]=f,e[7]=r,e[8]=_,e[9]=g):g=e[9];const p=g,b=`Install packages with ${o}...`;let x,y,v,C,k,N,j,I,T,A,R,z,D,F;e[10]!==h||e[11]!==i?(x=h?d.jsx(Yn,{size:"small",className:"mr-2 h-4 w-4 shrink-0 opacity-50"}):d.jsx(Te,{content:"Change package manager",children:d.jsx(qs,{onClick:()=>i("packageManagement"),className:"mr-2 h-4 w-4 shrink-0 opacity-50 hover:opacity-80 cursor-pointer"})}),e[10]=h,e[11]=i,e[12]=x):x=e[12],e[13]!==p?(y=E=>{E.key==="Enter"&&(E.preventDefault(),p())},e[13]=p,e[14]=y):y=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(v=E=>s(E.target.value),e[15]=v):v=e[15],e[16]!==r||e[17]!==b||e[18]!==x||e[19]!==y?(C=d.jsx(vS,{placeholder:b,id:j1,icon:x,rootClassName:"flex-1 border-none",value:r,onKeyDown:y,onChange:v}),e[16]=r,e[17]=b,e[18]=x,e[19]=y,e[20]=C):C=e[20],e[21]===Symbol.for("react.memo_cache_sentinel")?(k=d.jsx("span",{className:"font-bold tracking-wide",children:"Package name:"}),e[21]=k):k=e[21],e[22]===Symbol.for("react.memo_cache_sentinel")?(N=d.jsxs("div",{children:[k," A package name; this will install the latest version.",d.jsx("div",{className:"text-muted-foreground",children:"Example: httpx"})]}),j=d.jsx("span",{className:"font-bold tracking-wide",children:"Package and version:"}),e[22]=N,e[23]=j):(N=e[22],j=e[23]),e[24]===Symbol.for("react.memo_cache_sentinel")?(I=d.jsxs("div",{children:[j," ","A package with a specific version or version range.",d.jsx("div",{className:"text-muted-foreground",children:"Examples: httpx==0.27.0, httpx>=0.27.0"})]}),T=d.jsx("span",{className:"font-bold tracking-wide",children:"Git:"}),e[24]=I,e[25]=T):(I=e[24],T=e[25]),e[26]===Symbol.for("react.memo_cache_sentinel")?(A=d.jsxs("div",{children:[T," A Git repository",d.jsx("div",{className:"text-muted-foreground",children:"Example: git+https://github.com/encode/httpx"})]}),R=d.jsx("span",{className:"font-bold tracking-wide",children:"URL:"}),e[26]=A,e[27]=R):(A=e[26],R=e[27]),e[28]===Symbol.for("react.memo_cache_sentinel")?(z=d.jsxs("div",{children:[R," A remote wheel or source distribution.",d.jsx("div",{className:"text-muted-foreground",children:"Example: https://example.com/httpx-0.27.0.tar.gz"})]}),D=d.jsx("span",{className:"font-bold tracking-wide",children:"Path:"}),e[28]=z,e[29]=D):(z=e[28],D=e[29]),e[30]===Symbol.for("react.memo_cache_sentinel")?(F=d.jsx(Te,{delayDuration:300,side:"left",align:"start",content:d.jsxs("div",{className:"text-sm flex flex-col w-full max-w-[360px]",children:["Packages are installed using the package manager specified in your user configuration. Depending on your package manager, you can install packages with various formats:",d.jsxs("div",{className:"flex flex-col gap-2 mt-2",children:[N,I,A,z,d.jsxs("div",{children:[D," A local wheel, source distribution, or project directory.",d.jsx("div",{className:"text-muted-foreground",children:"Example: /example/foo-0.1.0-py3-none-any.whl"})]})]})]}),children:d.jsx(Um,{className:"h-4 w-4 cursor-help text-muted-foreground hover:text-foreground bg-transparent"})}),e[30]=F):F=e[30];const B=r&&"bg-accent text-accent-foreground";let U;e[31]!==B?(U=Ne("float-right px-2 m-0 h-full text-sm text-secondary-foreground ml-2",B,"disabled:cursor-not-allowed disabled:opacity-50"),e[31]=B,e[32]=U):U=e[32];const O=!r;let S,$;return e[33]!==p||e[34]!==U||e[35]!==O?(S=d.jsx("button",{type:"button",className:U,onClick:p,disabled:O,children:"Add"}),e[33]=p,e[34]=U,e[35]=O,e[36]=S):S=e[36],e[37]!==S||e[38]!==C?($=d.jsxs("div",{className:"flex items-center w-full border-b",children:[C,F,S]}),e[37]=S,e[38]=C,e[39]=$):$=e[39],$},vF=t=>{const e=X.c(9),{onSuccess:n,packages:o}=t;if(o.length===0){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=d.jsx(xn,{title:"No packages",description:"No packages are installed in this environment.",icon:d.jsx(qs,{})}),e[0]=a):a=e[0],a}let r,s,i;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(r=d.jsx(Ym,{children:d.jsxs(Ws,{children:[d.jsx(Ur,{children:"Name"}),d.jsx(Ur,{children:"Version"}),d.jsx(Ur,{})]})}),e[1]=r):r=e[1],e[2]!==n||e[3]!==o){let a;e[5]!==n?(a=l=>d.jsxs(Ws,{className:"group",onClick:async()=>{await _n(`${l.name}==${l.version}`),dt({title:"Copied to clipboard"})},children:[d.jsx(Vr,{children:l.name}),d.jsx(Vr,{children:l.version}),d.jsxs(Vr,{className:"flex justify-end",children:[d.jsx(_3,{packageName:l.name,onSuccess:n}),d.jsx(b3,{packageName:l.name,onSuccess:n})]})]},l.name),e[5]=n,e[6]=a):a=e[6],s=o.map(a),e[2]=n,e[3]=o,e[4]=s}else s=e[4];return e[7]!==s?(i=d.jsxs(Jm,{className:"overflow-auto flex-1",children:[r,d.jsx(Km,{children:s})]}),e[7]=s,e[8]=i):i=e[8],i},_3=({packageName:t,onSuccess:e})=>{const[n,o]=K.useState(!1);return un()?null:d.jsx(g3,{onClick:async()=>{try{o(!0);const r=await nH({package:t,upgrade:!0});r.success?(e(),kS(t)):kS(t,r.error)}finally{o(!1)}},loading:n,children:"Upgrade"})},b3=({packageName:t,onSuccess:e})=>{const[n,o]=K.useState(!1);return d.jsx(g3,{onClick:async()=>{try{o(!0);const r=await oH({package:t});r.success?(e(),SS(t)):SS(t,r.error)}finally{o(!1)}},loading:n,children:"Remove"})},kF=t=>{const e=X.c(18),{tree:n,error:o,onSuccess:r}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=new Set,e[0]=s):s=e[0];const[i,a]=K.useState(s);let l,c,u;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{a(new Set)},e[1]=l):l=e[1],e[2]!==n?(c=[n],e[2]=n,e[3]=c):c=e[3],K.useEffect(l,c),o){let _;return e[4]!==o?(_=d.jsx(Br,{error:o}),e[4]=o,e[5]=_):_=e[5],_}if(!n){let _;return e[6]===Symbol.for("react.memo_cache_sentinel")?(_=d.jsx(Yn,{size:"medium",centered:!0}),e[6]=_):_=e[6],_}if(n.dependencies.length===0){let _;return e[7]===Symbol.for("react.memo_cache_sentinel")?(_=d.jsx(xn,{title:"No dependencies",description:"No package dependencies found in this environment.",icon:d.jsx(qs,{})}),e[7]=_):_=e[7],_}e[8]===Symbol.for("react.memo_cache_sentinel")?(u=_=>{a(g=>{const p=new Set(g);return p.has(_)?p.delete(_):p.add(_),p})},e[8]=u):u=e[8];const h=u;let f,m;if(e[9]!==i||e[10]!==r||e[11]!==n.dependencies){let _;e[13]!==i||e[14]!==r?(_=(g,p)=>d.jsx("div",{className:"border-b",children:d.jsx(x3,{nodeId:`root-${p}`,node:g,level:0,isTopLevel:!0,expandedNodes:i,onToggle:h,onSuccess:r})},`${g.name}-${p}`),e[13]=i,e[14]=r,e[15]=_):_=e[15],f=n.dependencies.map(_),e[9]=i,e[10]=r,e[11]=n.dependencies,e[12]=f}else f=e[12];return e[16]!==f?(m=d.jsx("div",{className:"flex-1 overflow-auto",children:d.jsx("div",{children:f})}),e[16]=f,e[17]=m):m=e[17],m},x3=t=>{const e=X.c(57),{nodeId:n,node:o,level:r,isTopLevel:s,expandedNodes:i,onToggle:a,onSuccess:l}=t,c=s!==void 0&&s,u=o.dependencies.length>0;let h;e[0]!==i||e[1]!==n?(h=i.has(n),e[0]=i,e[1]=n,e[2]=h):h=e[2];const f=h,m=c?0:16+16*r;let _;e[3]!==u||e[4]!==n||e[5]!==a?(_=U=>{U.key!=="Enter"&&U.key!==" "||(U.preventDefault(),u&&a(n))},e[3]=u,e[4]=n,e[5]=a,e[6]=_):_=e[6];const g=_;let p;e[7]!==u||e[8]!==n||e[9]!==a?(p=U=>{U.stopPropagation(),u&&a(n)},e[7]=u,e[8]=n,e[9]=a,e[10]=p):p=e[10];const b=p,x=u&&"select-none",y=c?"px-2 py-0.5":"";let v,C;e[11]!==x||e[12]!==y?(v=Ne("flex items-center group cursor-pointer text-sm whitespace-nowrap","hover:bg-[var(--slate-2)] focus:bg-[var(--slate-2)] focus:outline-none",x,y),e[11]=x,e[12]=y,e[13]=v):v=e[13],e[14]!==m||e[15]!==c?(C=c?{}:{paddingLeft:`${m}px`},e[14]=m,e[15]=c,e[16]=C):C=e[16];const k=u?f:void 0;let N,j,I,T,A,R,z,D,F,B;return e[17]!==u||e[18]!==f?(N=u?f?d.jsx(Tr,{className:"w-4 h-4 mr-2 flex-shrink-0"}):d.jsx(Yi,{className:"w-4 h-4 mr-2 flex-shrink-0"}):d.jsx("div",{className:"w-4 mr-2 flex-shrink-0"}),e[17]=u,e[18]=f,e[19]=N):N=e[19],e[20]!==o.name?(j=d.jsx("span",{className:"font-medium truncate",children:o.name}),e[20]=o.name,e[21]=j):j=e[21],e[22]!==o.version?(I=o.version&&d.jsxs("span",{className:"text-muted-foreground text-xs",children:["v",o.version]}),e[22]=o.version,e[23]=I):I=e[23],e[24]!==j||e[25]!==I?(T=d.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 py-1.5",children:[j,I]}),e[24]=j,e[25]=I,e[26]=T):T=e[26],e[27]!==o.tags?(A=o.tags.map(NF),e[27]=o.tags,e[28]=A):A=e[28],e[29]!==A?(R=d.jsx("div",{className:"flex items-center gap-1 ml-2",children:A}),e[29]=A,e[30]=R):R=e[30],e[31]!==c||e[32]!==o.name||e[33]!==l?(z=c&&d.jsxs("div",{className:"flex gap-1 invisible group-hover:visible",children:[d.jsx(_3,{packageName:o.name,onSuccess:l}),d.jsx(b3,{packageName:o.name,onSuccess:l})]}),e[31]=c,e[32]=o.name,e[33]=l,e[34]=z):z=e[34],e[35]!==b||e[36]!==g||e[37]!==N||e[38]!==T||e[39]!==R||e[40]!==z||e[41]!==v||e[42]!==C||e[43]!==k?(D=d.jsxs("div",{className:v,style:C,onClick:b,onKeyDown:g,tabIndex:0,role:"treeitem","aria-selected":!1,"aria-expanded":k,children:[N,T,R,z]}),e[35]=b,e[36]=g,e[37]=N,e[38]=T,e[39]=R,e[40]=z,e[41]=v,e[42]=C,e[43]=k,e[44]=D):D=e[44],e[45]!==i||e[46]!==u||e[47]!==f||e[48]!==r||e[49]!==o.dependencies||e[50]!==n||e[51]!==l||e[52]!==a?(F=u&&f&&d.jsx("div",{role:"group",children:o.dependencies.map((U,O)=>d.jsx(x3,{nodeId:`${n}-${O}`,node:U,level:r+1,isTopLevel:!1,expandedNodes:i,onToggle:a,onSuccess:l},`${U.name}-${O}`))}),e[45]=i,e[46]=u,e[47]=f,e[48]=r,e[49]=o.dependencies,e[50]=n,e[51]=l,e[52]=a,e[53]=F):F=e[53],e[54]!==D||e[55]!==F?(B=d.jsxs("div",{children:[D,F]}),e[54]=D,e[55]=F,e[56]=B):B=e[56],B};async function SF(){const[t,e]=await Promise.all([Q$(),eH()]);return{list:t.packages,tree:e.tree}}function CF(t){return t.trim()}function NF(t,e){return t.kind==="cycle"?d.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-orange-300 dark:border-orange-700 text-orange-700 dark:text-orange-300",title:"cycle",children:"cycle"},e):t.kind==="extra"?d.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-blue-300 dark:border-blue-700 text-blue-700 dark:text-blue-300",title:t.value,children:t.value},e):t.kind==="group"?d.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-green-300 dark:border-green-700 text-green-700 dark:text-green-300",title:t.value,children:t.value},e):null}const Zf=F3("marimo:scratchpadHistory:v1",[]),jF=qt(!1),EF=qt(null,(t,e,n)=>{if(!(n=n.trim()))return;const o=t(Zf),r=[n,...o.filter(s=>s!==n)].slice(0,15);e(Zf,r)}),IF={hide_code:!1,disabled:!1},AF=()=>{const t=X.c(69),e=xc(),[n]=Dr(),{theme:o}=hr(),r=M.useRef(null),s=Os(),{createNewCell:i,updateCellCode:a}=Tt(),l=e.cellRuntime[mr],c=l==null?void 0:l.output,u=l==null?void 0:l.status,h=l==null?void 0:l.consoleOutputs,f=e.cellData[mr],m=(f==null?void 0:f.code)??"",_=Zt(EF),[g,p]=on(jF),b=Ue(Zf);let x;t[0]!==_||t[1]!==m?(x=()=>{CS({code:m}),_(m)},t[0]=_,t[1]=m,t[2]=x):x=t[2];const y=Ke(x);let v;t[3]!==m||t[4]!==i||t[5]!==s?(v=()=>{m.trim()&&i({code:m,before:!1,cellId:s??"__end__"})},t[3]=m,t[4]=i,t[5]=s,t[6]=v):v=t[6];const C=Ke(v);let k;t[7]!==a?(k=()=>{a({cellId:mr,code:"",formattingChange:!1}),CS({code:""});const ie=r.current;ie&&ie.dispatch({changes:{from:0,to:ie.state.doc.length,insert:""}})},t[7]=a,t[8]=k):k=t[8];const N=Ke(k);let j;t[9]!==p||t[10]!==a?(j=ie=>{p(!1),a({cellId:mr,code:ie,formattingChange:!1});const je=r.current;je&&je.dispatch({changes:{from:0,to:je.state.doc.length,insert:ie}})},t[9]=p,t[10]=a,t[11]=j):j=t[11];const I=Ke(j),[T,A]=M.useState();let R;t[12]!==m||t[13]!==h||t[14]!==y||t[15]!==T||t[16]!==c||t[17]!==o||t[18]!==n?(R=()=>d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[40%]",children:d.jsx(Wu,{theme:o,showPlaceholder:!1,id:mr,code:m,config:IF,status:"idle",serializedEditorState:null,runCell:y,userConfig:n,editorViewRef:r,setEditorView:ie=>{r.current=ie},hidden:!1,temporarilyShowCode:kn.NOOP,languageAdapter:T,setLanguageAdapter:A})}),d.jsx("div",{className:"flex-1 overflow-auto flex-shrink-0",children:d.jsx(Pc,{allowExpand:!1,output:c,className:"output-area",cellId:mr,stale:!1,loading:!1})}),d.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[35%]",children:d.jsx(ep,{consoleOutputs:h,className:"overflow-auto",stale:!1,cellName:z3,onSubmitDebugger:kn.NOOP,cellId:mr,debuggerActive:!1})})]}),t[12]=m,t[13]=h,t[14]=y,t[15]=T,t[16]=c,t[17]=o,t[18]=n,t[19]=R):R=t[19];const z=R;let D;t[20]!==I||t[21]!==b||t[22]!==g||t[23]!==o?(D=()=>g?d.jsx("div",{className:"absolute inset-0 z-100 bg-background p-3 border-none overflow-auto",children:d.jsx("div",{className:"overflow-auto flex flex-col gap-3",children:b.map((ie,je)=>d.jsx("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>I(ie),children:d.jsx(M.Suspense,{children:d.jsx(ua,{language:"python",theme:o,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:ie.trim(),editable:!1,readOnly:!0})})},je))})}):null,t[20]=I,t[21]=b,t[22]=g,t[23]=o,t[24]=D):D=t[24];const F=D;let B,U,O,S,$,E,W,G,q,Y,te;t[25]===Symbol.for("react.memo_cache_sentinel")?(B=As.create(mr),U=d.jsx("p",{className:"mx-2 my-2 text-muted-foreground text-sm",children:"Use this scratchpad cell to experiment with code without restrictions on variable names. Scratchpad code is ephemeral: variables defined in the scratchpad aren't saved to notebook memory, and the code is not saved in the notebook file."}),t[25]=B,t[26]=U):(B=t[25],U=t[26]),t[27]===Symbol.for("react.memo_cache_sentinel")?(O=rn("cell.run"),t[27]=O):O=t[27],t[28]===Symbol.for("react.memo_cache_sentinel")?(S=d.jsx(Gs,{color:"var(--grass-11)",size:16}),t[28]=S):S=t[28],t[29]!==y||t[30]!==g?($=d.jsx(Te,{content:O,children:d.jsx(Me,{"data-testid":"scratchpad-run-button",onClick:y,disabled:g,variant:"text",size:"xs",children:S})}),t[29]=y,t[30]=g,t[31]=$):$=t[31],t[32]===Symbol.for("react.memo_cache_sentinel")?(E=d.jsx(fp,{size:16}),t[32]=E):E=t[32],t[33]!==N||t[34]!==g?(W=d.jsx(Te,{content:"Clear code and outputs",children:d.jsx(Me,{disabled:g,size:"xs",variant:"text",onClick:N,children:E})}),t[33]=N,t[34]=g,t[35]=W):W=t[35],t[36]===Symbol.for("react.memo_cache_sentinel")?(G=d.jsx($r,{size:16}),t[36]=G):G=t[36],t[37]!==C||t[38]!==g?(q=d.jsx(Xs,{children:d.jsx(Te,{content:"Insert code",children:d.jsx(Me,{disabled:g,size:"xs",variant:"text",onClick:C,children:G})})}),t[37]=C,t[38]=g,t[39]=q):q=t[39],t[40]!==u?(Y=(u==="running"||u==="queued")&&d.jsx(Yn,{className:"inline",size:"small"}),t[40]=u,t[41]=Y):Y=t[41],t[42]===Symbol.for("react.memo_cache_sentinel")?(te=d.jsx("div",{className:"flex-1"}),t[42]=te):te=t[42];const oe=g&&"bg-[var(--sky-3)] rounded-none";let se,Z;t[43]!==oe?(se=Ne(oe),t[43]=oe,t[44]=se):se=t[44],t[45]!==g||t[46]!==p?(Z=()=>p(!g),t[45]=g,t[46]=p,t[47]=Z):Z=t[47];const Q=b.length===0;let ue,me,ce,fe,de,ke,Se;return t[48]===Symbol.for("react.memo_cache_sentinel")?(ue=d.jsx(yp,{size:16}),t[48]=ue):ue=t[48],t[49]!==se||t[50]!==Z||t[51]!==Q?(me=d.jsx(Te,{content:"Toggle history",children:d.jsx(Me,{size:"xs",variant:"text",className:se,onClick:Z,disabled:Q,children:ue})}),t[49]=se,t[50]=Z,t[51]=Q,t[52]=me):me=t[52],t[53]!==$||t[54]!==W||t[55]!==q||t[56]!==Y||t[57]!==me?(ce=d.jsxs("div",{className:"flex items-center flex-shrink-0",children:[$,W,q,Y,te,me]}),t[53]=$,t[54]=W,t[55]=q,t[56]=Y,t[57]=me,t[58]=ce):ce=t[58],t[59]!==z?(fe=z(),t[59]=z,t[60]=fe):fe=t[60],t[61]!==F?(de=F(),t[61]=F,t[62]=de):de=t[62],t[63]!==fe||t[64]!==de?(ke=d.jsxs("div",{className:"flex-1 divide-y relative overflow-hidden flex flex-col",children:[fe,de]}),t[63]=fe,t[64]=de,t[65]=ke):ke=t[65],t[66]!==ce||t[67]!==ke?(Se=d.jsxs("div",{className:"flex flex-col h-full overflow-hidden divide-y",id:B,children:[U,ce,ke]}),t[66]=ce,t[67]=ke,t[68]=Se):Se=t[68],Se},TF=()=>{const t=X.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=d.jsx(AF,{}),t[0]=e):e=t[0],e},MF=()=>{const t=X.c(23),{openModal:e,closeModal:n}=Hn();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];const{data:r,isPending:s,error:i,refetch:a}=Wn(DF,o);if(s){let b;return t[1]===Symbol.for("react.memo_cache_sentinel")?(b=d.jsx(Yn,{size:"medium",centered:!0}),t[1]=b):b=t[1],b}if(i){let b;return t[2]!==i?(b=d.jsx(Br,{error:i}),t[2]=i,t[3]=b):b=t[3],b}let l;t[4]!==r?(l=r.filter(RF).map(PF),t[4]=r,t[5]=l):l=t[5];const c=l;if(r.length===0){let b;return t[6]===Symbol.for("react.memo_cache_sentinel")?(b=d.jsx(xn,{title:"No environment variables",description:"No environment variables are available in this notebook.",icon:d.jsx(Zc,{})}),t[6]=b):b=t[6],b}let u,h,f,m,_,g,p;return t[7]!==n||t[8]!==e||t[9]!==c||t[10]!==a?(u=()=>e(d.jsx(wg,{providerNames:c,onSuccess:()=>{a(),n()},onClose:n})),t[7]=n,t[8]=e,t[9]=c,t[10]=a,t[11]=u):u=t[11],t[12]===Symbol.for("react.memo_cache_sentinel")?(h=d.jsx(ur,{className:"h-4 w-4"}),t[12]=h):h=t[12],t[13]!==u?(f=d.jsx("div",{className:"flex justify-end h-8 border-b",children:d.jsx("button",{type:"button",className:"float-right border-l px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:u,children:h})}),t[13]=u,t[14]=f):f=t[14],t[15]===Symbol.for("react.memo_cache_sentinel")?(m=d.jsx(Ym,{children:d.jsxs(Ws,{children:[d.jsx(Ur,{children:"Environment Variable"}),d.jsx(Ur,{children:"Source"}),d.jsx(Ur,{})]})}),t[15]=m):m=t[15],t[16]!==r?(_=r.map(LF),t[16]=r,t[17]=_):_=t[17],t[18]!==_?(g=d.jsxs(Jm,{className:"overflow-auto flex-1 mb-16",children:[m,d.jsx(Km,{children:_})]}),t[18]=_,t[19]=g):g=t[19],t[20]!==f||t[21]!==g?(p=d.jsxs("div",{className:"flex flex-col h-full",children:[f,g]}),t[20]=f,t[21]=g,t[22]=p):p=t[22],p},OF=t=>{const e=X.c(9),{className:n,ariaLabel:o,onCopy:r}=t,[s,i]=K.useState(!1);let a;e[0]!==r?(a=()=>{r(),i(!0),setTimeout(()=>i(!1),1e3)},e[0]=r,e[1]=a):a=e[1];const l=a;let c,u;return e[2]!==s?(c=s?d.jsx(mc,{className:"w-3 h-3 text-green-700 rounded"}):d.jsx(qi,{className:"w-3 h-3 hover:bg-muted rounded"}),e[2]=s,e[3]=c):c=e[3],e[4]!==o||e[5]!==n||e[6]!==l||e[7]!==c?(u=d.jsx("button",{type:"button",className:n,onClick:l,"aria-label":o,children:c}),e[4]=o,e[5]=n,e[6]=l,e[7]=c,e[8]=u):u=e[8],u};async function DF(){return yg((await FS.request({})).secrets)}function RF(t){return t.provider!=="env"}function PF(t){return t.name}function LF(t){return t.keys.map(e=>d.jsxs(Ws,{className:"group",children:[d.jsx(Vr,{children:e}),d.jsx(Vr,{children:t.provider!=="env"&&d.jsx(aS,{variant:"outline",className:"select-none",children:t.name})}),d.jsx(Vr,{children:d.jsx(OF,{ariaLabel:`Copy ${e}`,onCopy:async()=>{await _n(`os.environ["${e}"]`),dt({title:"Copied to clipboard",description:`os.environ["${e}"] has been copied to your clipboard.`})},className:Ne("float-right px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible")})})]},`${t.name}-${e}`))}const FF=t=>{const e=X.c(6),{children:n}=t,{openModal:o,closeModal:r}=Hn();let s,i;return e[0]!==r||e[1]!==o?(s=()=>o(d.jsx(BF,{onClose:r})),e[0]=r,e[1]=o,e[2]=s):s=e[2],e[3]!==n||e[4]!==s?(i=d.jsx(Q4,{onClick:s,children:n}),e[3]=n,e[4]=s,e[5]=i):i=e[5],i},zF=[et.lineWrapping],BF=t=>{const e=X.c(23),{onClose:n}=t,[o,r]=M.useState(""),{theme:s}=hr();let i,a,l,c,u,h;e[0]!==n?(i=async y=>{y.preventDefault();const v=new FormData(y.target),C=v.get("title"),k=v.get("description"),N=v.get("code");fetch("https://marimo.io/api/suggest-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:C,description:k,code:N})}),n(),dt({title:"Snippet Submitted",description:"Thank you for contributing! We will review your snippet shortly."})},e[0]=n,e[1]=i):i=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(a=d.jsx(rr,{children:"Contribute a Snippet"}),e[2]=a):a=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(l=d.jsxs(Es,{children:[a,d.jsxs(Is,{children:["Have a useful snippet you want to share with the community? Submit it here or make a pull request"," ",d.jsx("a",{href:Qn.githubPage,target:"_blank",className:"underline",children:"on GitHub"}),"."]})]}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(sr,{id:"title",name:"title",autoFocus:!0,placeholder:"Title",required:!0,autoComplete:"off"}),u=d.jsx(rH,{id:"description",name:"description",autoFocus:!0,placeholder:"Description",rows:5,required:!0,autoComplete:"off"}),e[4]=c,e[5]=u):(c=e[4],u=e[5]),e[6]!==o?(h=d.jsx("input",{type:"hidden",name:"code",value:o}),e[6]=o,e[7]=h):h=e[7];const f=s==="dark"?"dark":"light";let m,_,g,p,b,x;return e[8]!==o||e[9]!==f?(m=d.jsx(ua,{theme:f,language:"python",className:"cm border rounded overflow-hidden",extensions:zF,value:o,onChange:r}),e[8]=o,e[9]=f,e[10]=m):m=e[10],e[11]!==h||e[12]!==m?(_=d.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[c,u,h,m]}),e[11]=h,e[12]=m,e[13]=_):_=e[13],e[14]!==n?(g=d.jsx(Me,{"data-testid":"snippet-cancel-button",variant:"secondary",onClick:n,children:"Cancel"}),e[14]=n,e[15]=g):g=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(p=d.jsx(Me,{"data-testid":"snippet-send-button","aria-label":"Save",variant:"default",type:"submit",children:"Send"}),e[16]=p):p=e[16],e[17]!==g?(b=d.jsxs(Wi,{children:[g,p]}),e[17]=g,e[18]=b):b=e[18],e[19]!==i||e[20]!==b||e[21]!==_?(x=d.jsx(ir,{className:"w-fit",children:d.jsxs("form",{onSubmit:i,children:[l,_,b]})}),e[19]=i,e[20]=b,e[21]=_,e[22]=x):x=e[22],x},UF=[et.lineWrapping],VF=()=>{const t=X.c(20),[e,n]=K.useState();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];const{data:r,error:s,isPending:i}=Wn(WF,o);if(s){let b;return t[1]!==s?(b=d.jsx(Br,{error:s}),t[1]=s,t[2]=b):b=t[2],b}if(i||!r){let b;return t[3]===Symbol.for("react.memo_cache_sentinel")?(b=d.jsx(Yn,{size:"medium",centered:!0}),t[3]=b):b=t[3],b}const a=e?"h-1/3":"h-full";let l,c,u,h,f,m,_,g,p;return t[4]!==a?(l=Ne("border-b rounded-none",a),t[4]=a,t[5]=l):l=t[5],t[6]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(Ji,{placeholder:"Search snippets...",className:"h-6 m-1",rootClassName:"flex-1 border-r"}),t[6]=c):c=t[6],t[7]===Symbol.for("react.memo_cache_sentinel")?(u=d.jsxs("div",{className:"flex items-center w-full",children:[c,d.jsx(FF,{children:d.jsx("button",{className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:d.jsx(ur,{className:"h-4 w-4"})})})]}),h=d.jsx(sc,{children:"No results"}),t[7]=u,t[8]=h):(u=t[7],h=t[8]),t[9]===Symbol.for("react.memo_cache_sentinel")?(f=b=>n(b),t[9]=f):f=t[9],t[10]!==r.snippets?(m=d.jsx(HF,{onSelect:f,snippets:r.snippets}),t[10]=r.snippets,t[11]=m):m=t[11],t[12]!==l||t[13]!==m?(_=d.jsxs(_c,{className:l,children:[u,h,m]}),t[12]=l,t[13]=m,t[14]=_):_=t[14],t[15]!==e?(g=d.jsx(M.Suspense,{children:d.jsx("div",{className:"h-2/3 snippet-viewer flex flex-col",children:e?d.jsx($F,{snippet:e},e.title):d.jsx(xn,{title:"",description:"Click on a snippet to view its content."})})}),t[15]=e,t[16]=g):g=t[16],t[17]!==_||t[18]!==g?(p=d.jsxs("div",{className:"flex-1 overflow-hidden",children:[_,g]}),t[17]=_,t[18]=g,t[19]=p):p=t[19],p},$F=t=>{const e=X.c(27),{snippet:n}=t,{theme:o}=hr(),{createNewCell:r}=Tt(),s=Os();let i;e[0]!==r||e[1]!==s||e[2]!==n.sections?(i=()=>{for(const p of[...n.sections].reverse())p.code&&r({code:p.code,before:!1,cellId:s??"__end__",skipIfCodeExists:!0})},e[0]=r,e[1]=s,e[2]=n.sections,e[3]=i):i=e[3];const a=i;let l;e[4]!==r||e[5]!==s?(l=p=>{r({code:p,before:!1,cellId:s??"__end__"})},e[4]=r,e[5]=s,e[6]=l):l=e[6];const c=l;let u,h,f,m,_,g;if(e[7]!==n.title?(u=d.jsx("div",{className:"text-sm font-semibold bg-muted border-y px-2 py-1",children:n.title}),e[7]=n.title,e[8]=u):u=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(h=d.jsx($r,{className:"ml-2 h-4 w-4"}),e[9]=h):h=e[9],e[10]!==a?(f=d.jsx("div",{className:"flex justify-end",children:d.jsx(Xs,{children:d.jsxs(Me,{className:"float-right",size:"xs",variant:"outline",onClick:a,children:["Insert snippet",h]})})}),e[10]=a,e[11]=f):f=e[11],e[12]!==c||e[13]!==n.sections||e[14]!==n.title||e[15]!==o){let p;e[17]!==c||e[18]!==n.title||e[19]!==o?(p=b=>{const{code:x,html:y,id:v}=b;return y?d.jsx("div",{children:Hm({html:y})},`${n.title}-${v}`):x?d.jsxs("div",{className:"relative hover-actions-parent pr-2",children:[d.jsx(Xs,{children:d.jsx(Te,{content:"Insert snippet",children:d.jsx(Me,{className:"absolute -top-2 -right-1 z-10 hover-action px-2 bg-background",size:"sm",variant:"outline",onClick:()=>{c(x)},children:d.jsx($r,{className:"h-5 w-5"})})})}),d.jsx(M.Suspense,{children:d.jsx(ua,{theme:o==="dark"?"dark":"light",language:"python",className:"cm border rounded overflow-hidden",extensions:UF,value:x,readOnly:!0},`${n.title}-${v}`)})]},`${n.title}-${v}`):null},e[17]=c,e[18]=n.title,e[19]=o,e[20]=p):p=e[20],m=n.sections.map(p),e[12]=c,e[13]=n.sections,e[14]=n.title,e[15]=o,e[16]=m}else m=e[16];return e[21]!==f||e[22]!==m?(_=d.jsxs("div",{className:"px-2 py-2 space-y-4 overflow-auto flex-1",children:[f,m]}),e[21]=f,e[22]=m,e[23]=_):_=e[23],e[24]!==u||e[25]!==_?(g=d.jsxs(d.Fragment,{children:[u,_]}),e[24]=u,e[25]=_,e[26]=g):g=e[26],g},HF=t=>{const e=X.c(7),{snippets:n,onSelect:o}=t;let r,s;if(e[0]!==o||e[1]!==n){let i;e[3]!==o?(i=a=>d.jsx(mo,{className:"rounded-none",onSelect:()=>o(a),children:d.jsx("div",{className:"flex flex-row gap-2 items-center",children:d.jsx("span",{className:"mt-1 text-accent-foreground",children:a.title})})},a.title),e[3]=o,e[4]=i):i=e[4],r=n.map(i),e[0]=o,e[1]=n,e[2]=r}else r=e[2];return e[5]!==r?(s=d.jsx(Om,{className:"flex flex-col overflow-auto",children:r}),e[5]=r,e[6]=s):s=e[6],s};function WF(){return sH()}const qF=K.lazy(()=>Dm(()=>import("./tracing-CisZiUH1.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123]),import.meta.url).then(t=>({default:t.Tracing}))),GF=()=>{const t=X.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=d.jsx(K.Suspense,{fallback:d.jsx(YF,{}),children:d.jsx(qF,{})}),t[0]=e):e=t[0],e},YF=()=>{const t=X.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=d.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:d.jsx(Yn,{})}),t[0]=e):e=t[0],e},y3="name",w3="type-value",Qf="defs-refs",JF=[{id:y3,accessorFn:t=>[t.name,t.declaredBy],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>d.jsx(Xm,{header:"Name",column:t}),cell:({getValue:t})=>{const[e,n]=t();return d.jsx(uf,{name:e,declaredBy:n})}},{id:w3,accessorFn:t=>[t.dataType,t.value],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>d.jsx(Xm,{header:d.jsxs("div",{className:"flex flex-col gap-1",children:[d.jsx("span",{children:"Type"}),d.jsx("span",{children:"Value"})]}),column:t}),cell:({getValue:t})=>{const[e,n]=t();return d.jsxs("div",{className:"max-w-[150px]",children:[d.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap text-muted-foreground font-mono text-xs",children:e}),d.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap",title:n??"",children:n})]})}},{id:Qf,accessorFn:t=>[t.declaredBy,t.usedBy,t.name,t.declaredByNames,t.usedByNames],enableSorting:!0,sortingFn:"basic",header:({column:t})=>d.jsx(Xm,{header:d.jsxs("div",{className:"flex flex-col gap-1",children:[d.jsx("span",{children:"Declared By"}),d.jsx("span",{children:"Used By"})]}),column:t}),cell:({getValue:t})=>{const[e,n,o]=t(),r=s=>{const i=Ql(s);i&&Wm(i,o)};return d.jsxs("div",{className:"flex flex-col gap-1 py-1",children:[d.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-center",children:[d.jsx("span",{title:"Declared by",children:d.jsx(Bp,{className:"w-3.5 h-3.5 text-muted-foreground"})}),e.length===1?d.jsx(fr,{variant:"focus",cellId:e[0],skipScroll:!0,onClick:()=>r(e[0])}):d.jsx("div",{className:"text-destructive flex flex-row gap-2",children:e.slice(0,3).map((s,i)=>d.jsxs("span",{className:"flex",children:[d.jsx(fr,{variant:"focus",cellId:s,skipScroll:!0,className:"whitespace-nowrap text-destructive",onClick:()=>r(s)},s),i<e.length-1&&", "]},s))})]}),d.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-baseline",children:[d.jsx("span",{title:"Used by",children:d.jsx(va,{className:"w-3.5 h-3.5 text-muted-foreground"})}),d.jsx(H2,{maxCount:3,cellIds:n,skipScroll:!0,onClick:r})]})]})}}],v3=M.memo(({className:t,cellIds:e,variables:n})=>{const[o,r]=K.useState([]),[s,i]=K.useState(""),a=iH(),l=M.useMemo(()=>{const h=f=>{const m=a[f];return uH(m)?`cell-${e.indexOf(f)}`:m??`cell-${e.indexOf(f)}`};return Object.values(n).map(f=>({...f,declaredByNames:f.declaredBy.map(h),usedByNames:f.usedBy.map(h)}))},[n,a,e]),c=M.useMemo(()=>{const h=new Map;return e.forEach((f,m)=>h.set(f,m)),function(f,m,_){m||(m={id:Qf,desc:!1});let g=[];switch(m.id){case y3:g=pa(f,p=>p.name);break;case w3:g=pa(f,p=>p.dataType);break;case Qf:g=pa(f,p=>_.get(p.declaredBy[0]))}return m.desc?g.reverse():g}(l,o[0],h)},[l,o,e]),u=aH({data:c,columns:JF,getCoreRowModel:dH(),onGlobalFilterChange:i,getFilteredRowModel:cH(),enableFilters:!0,enableGlobalFilter:!0,enableColumnPinning:!1,getColumnCanGlobalFilter:h=>h.columnDef.enableGlobalFilter??!0,globalFilterFn:"auto",manualSorting:!0,onSortingChange:r,getSortedRowModel:lH(),state:{sorting:o,globalFilter:s}});return d.jsxs(d.Fragment,{children:[d.jsx(vS,{className:"w-full",placeholder:"Search",value:s,onChange:h=>i(h.target.value)}),d.jsxs(Jm,{className:Ne("w-full text-sm flex-1 border-separate border-spacing-0",t),children:[d.jsx(Ym,{children:d.jsx(Ws,{className:"whitespace-nowrap text-xs",children:u.getFlatHeaders().map(h=>d.jsx(Ur,{className:"sticky top-0 bg-background border-b",children:NS(h.column.columnDef.header,h.getContext())},h.id))})}),d.jsx(Km,{children:u.getRowModel().rows.map(h=>d.jsx(Ws,{className:"hover:bg-accent",children:h.getVisibleCells().map(f=>d.jsx(Vr,{className:"border-b",children:NS(f.column.columnDef.cell,f.getContext())},f.id))},h.id))})]})]})});v3.displayName="VariableTable";const KF=()=>{const t=X.c(4),e=cS(),n=Bc();if(Object.keys(e).length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=d.jsx(xn,{title:"No variables",description:"Global variables will appear here.",icon:d.jsx(Kl,{})}),t[0]=r):r=t[0],r}let o;return t[1]!==n.inOrderIds||t[2]!==e?(o=d.jsx(v3,{className:"flex-1",cellIds:n.inOrderIds,variables:e}),t[1]=n.inOrderIds,t[2]=e,t[3]=o):o=t[3],o},XF=K.lazy(()=>Dm(()=>import("./terminal-B4nePlR_.js"),__vite__mapDeps([124,1,2,125]),import.meta.url)),ZF=t=>{const e=X.c(121),{children:n}=t,{isSidebarOpen:o,isTerminalOpen:r,selectedPanel:s}=fc(),{setIsSidebarOpen:i,setIsTerminalOpen:a}=Zi(),l=K.useRef(null),c=K.useRef(null);let u,h,f,m,_;e[0]!==o?(u=()=>{if(!l.current)return;const le=l.current.isCollapsed();o&&le&&l.current.expand(),o||le||l.current.collapse(),requestAnimationFrame(ez)},h=[o],e[0]=o,e[1]=u,e[2]=h):(u=e[1],h=e[2]),M.useEffect(u,h),e[3]!==r?(f=()=>{if(!c.current)return;const le=c.current.isCollapsed();r&&le&&c.current.expand(),r||le||c.current.collapse(),requestAnimationFrame(nz)},m=[r],e[3]=r,e[4]=f,e[5]=m):(f=e[4],m=e[5]),M.useEffect(f,m),e[6]!==n?(_=d.jsx(Vc,{id:"app",className:"relative h-full",children:d.jsx(M.Suspense,{children:n})},"app"),e[6]=n,e[7]=_):_=e[7];const g=_,p=o?"resize-handle":"resize-handle-collapsed";let b,x;e[8]!==p?(b=Ne("border-border no-print z-10",p,"vertical"),e[8]=p,e[9]=b):b=e[9],e[10]!==b?(x=d.jsx(jS,{onDragging:ES,className:b}),e[10]=b,e[11]=x):x=e[11];const y=x,v=r?"resize-handle":"resize-handle-collapsed";let C,k;e[12]!==v?(C=Ne("border-border no-print z-20",v,"horizontal"),e[12]=v,e[13]=C):C=e[13],e[14]!==C?(k=d.jsx(jS,{onDragging:ES,className:C}),e[14]=C,e[15]=k):k=e[15];const N=k;let j,I,T,A,R,z,D,F,B,U,O,S,$,E,W,G,q,Y,te,oe,se;e[16]!==s?(j=d.jsx("div",{className:"text-sm text-[var(--slate-11)] uppercase tracking-wide font-semibold flex-1",children:s}),e[16]=s,e[17]=j):j=e[17],e[18]!==i?(I=()=>i(!1),e[18]=i,e[19]=I):I=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(T=d.jsx(eo,{className:"w-4 h-4"}),e[20]=T):T=e[20],e[21]!==I?(A=d.jsx(Me,{"data-testid":"close-helper-pane",className:"m-0",size:"xs",variant:"text",onClick:I,children:T}),e[21]=I,e[22]=A):A=e[22],e[23]!==j||e[24]!==A?(R=d.jsxs("div",{className:"p-3 border-b flex justify-between items-center",children:[j,A]}),e[23]=j,e[24]=A,e[25]=R):R=e[25],e[26]!==s?(z=s==="files"&&d.jsx(h3,{}),e[26]=s,e[27]=z):z=e[27],e[28]!==s?(D=s==="errors"&&d.jsx(YL,{}),e[28]=s,e[29]=D):D=e[29],e[30]!==s?(F=s==="variables"&&d.jsx(KF,{}),e[30]=s,e[31]=F):F=e[31],e[32]!==s?(B=s==="dependencies"&&d.jsx(OL,{}),e[32]=s,e[33]=B):B=e[33],e[34]!==s?(U=s==="packages"&&d.jsx(yF,{}),e[34]=s,e[35]=U):U=e[35],e[36]!==s?(O=s==="outline"&&d.jsx(xF,{}),e[36]=s,e[37]=O):O=e[37],e[38]!==s?(S=s==="datasources"&&d.jsx(qL,{}),e[38]=s,e[39]=S):S=e[39],e[40]!==s?($=s==="documentation"&&d.jsx(GL,{}),e[40]=s,e[41]=$):$=e[41],e[42]!==s?(E=s==="snippets"&&d.jsx(VF,{}),e[42]=s,e[43]=E):E=e[43],e[44]!==s?(W=s==="scratchpad"&&d.jsx(TF,{}),e[44]=s,e[45]=W):W=e[45],e[46]!==s?(G=s==="chat"&&d.jsx(nR,{}),e[46]=s,e[47]=G):G=e[47],e[48]!==s?(q=s==="logs"&&d.jsx(f3,{}),e[48]=s,e[49]=q):q=e[49],e[50]!==s?(Y=s==="tracing"&&d.jsx(GF,{}),e[50]=s,e[51]=Y):Y=e[51],e[52]!==s?(te=s==="secrets"&&d.jsx(MF,{}),e[52]=s,e[53]=te):te=e[53],e[54]!==z||e[55]!==D||e[56]!==F||e[57]!==B||e[58]!==U||e[59]!==O||e[60]!==S||e[61]!==$||e[62]!==E||e[63]!==W||e[64]!==G||e[65]!==q||e[66]!==Y||e[67]!==te?(oe=d.jsx(M.Suspense,{children:d.jsxs(Fc,{children:[z,D,F,B,U,O,S,$,E,W,G,q,Y,te]})}),e[54]=z,e[55]=D,e[56]=F,e[57]=B,e[58]=U,e[59]=O,e[60]=S,e[61]=$,e[62]=E,e[63]=W,e[64]=G,e[65]=q,e[66]=Y,e[67]=te,e[68]=oe):oe=e[68],e[69]!==R||e[70]!==oe?(se=d.jsx(bc,{children:d.jsxs("div",{className:"flex flex-col h-full flex-1 overflow-hidden mr-[-4px]",children:[R,oe]})}),e[69]=R,e[70]=oe,e[71]=se):se=e[71];const Z=se,Q=o&&"border-r border-l border-[var(--slate-7)]";let ue,me,ce,fe,de,ke;e[72]!==Q?(ue=Ne("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",Q),e[72]=Q,e[73]=ue):ue=e[73],e[74]===Symbol.for("react.memo_cache_sentinel")?(me=(le,We)=>{var Fe;We===0&&le===10&&((Fe=l.current)==null||Fe.resize(30))},e[74]=me):me=e[74],e[75]!==i?(ce=()=>i(!1),fe=()=>i(!0),e[75]=i,e[76]=ce,e[77]=fe):(ce=e[76],fe=e[77]),e[78]!==Z||e[79]!==y?(de=d.jsxs("span",{className:"flex flex-row h-full",children:[Z," ",y]}),e[78]=Z,e[79]=y,e[80]=de):de=e[80],e[81]!==ue||e[82]!==ce||e[83]!==fe||e[84]!==de?(ke=d.jsx(Vc,{ref:l,id:"helper",collapsedSize:0,collapsible:!0,className:ue,minSize:10,defaultSize:0,maxSize:75,onResize:me,onCollapse:ce,onExpand:fe,children:de},"helper"),e[81]=ue,e[82]=ce,e[83]=fe,e[84]=de,e[85]=ke):ke=e[85];const Se=ke,ie=r&&"border-[var(--slate-7)]";let je,pe,Ae,ze,De,Ve,Pe,rt,Qe;e[86]!==ie?(je=Ne("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",ie),e[86]=ie,e[87]=je):je=e[87],e[88]===Symbol.for("react.memo_cache_sentinel")?(pe=(le,We)=>{var Fe;We===0&&le===10&&((Fe=c.current)==null||Fe.resize(30))},e[88]=pe):pe=e[88],e[89]!==a?(Ae=()=>a(!1),ze=()=>a(!0),e[89]=a,e[90]=Ae,e[91]=ze):(Ae=e[90],ze=e[91]),e[92]===Symbol.for("react.memo_cache_sentinel")?(De=d.jsx("div",{}),e[92]=De):De=e[92],e[93]!==a?(Ve=()=>a(!1),e[93]=a,e[94]=Ve):Ve=e[94],e[95]!==r||e[96]!==Ve?(Pe=d.jsx(M.Suspense,{fallback:De,children:d.jsx(XF,{visible:r,onClose:Ve})}),e[95]=r,e[96]=Ve,e[97]=Pe):Pe=e[97],e[98]!==r||e[99]!==Pe?(rt=d.jsx(DL,{isOpen:r,children:Pe}),e[98]=r,e[99]=Pe,e[100]=rt):rt=e[100],e[101]!==je||e[102]!==Ae||e[103]!==ze||e[104]!==rt||e[105]!==N?(Qe=d.jsxs(Vc,{ref:c,id:"terminal",collapsedSize:0,collapsible:!0,className:je,minSize:10,defaultSize:0,maxSize:75,onResize:pe,onCollapse:Ae,onExpand:ze,children:[N,rt]},"terminal"),e[101]=je,e[102]=Ae,e[103]=ze,e[104]=rt,e[105]=N,e[106]=Qe):Qe=e[106];const tt=Qe;let ne,ve,Ce,Re,J,_e,be,ge;return e[107]===Symbol.for("react.memo_cache_sentinel")?(ne=oW(),e[107]=ne):ne=e[107],e[108]===Symbol.for("react.memo_cache_sentinel")?(ve=d.jsx(Fc,{children:d.jsx(LO,{})}),e[108]=ve):ve=e[108],e[109]!==tt?(Ce=d.jsx(Ly,{capability:"terminal",children:tt}),e[109]=tt,e[110]=Ce):Ce=e[110],e[111]!==g||e[112]!==Ce?(Re=d.jsx(Vc,{children:d.jsxs(IS,{autoSaveId:"marimo:chrome:v1:l1",direction:"vertical",children:[g,Ce]})}),e[111]=g,e[112]=Ce,e[113]=Re):Re=e[113],e[114]===Symbol.for("react.memo_cache_sentinel")?(J=d.jsx(hH,{}),e[114]=J):J=e[114],e[115]!==Se||e[116]!==Re?(_e=d.jsxs(IS,{autoSaveId:"marimo:chrome:v1:l2",direction:"horizontal",storage:ne,children:[ve,Se,Re,J]}),e[115]=Se,e[116]=Re,e[117]=_e):_e=e[117],e[118]===Symbol.for("react.memo_cache_sentinel")?(be=d.jsx(bc,{children:d.jsx(Fc,{children:d.jsx(MO,{})})}),e[118]=be):be=e[118],e[119]!==_e?(ge=d.jsxs(rW,{children:[_e,be]}),e[119]=_e,e[120]=ge):ge=e[120],ge};function QF(){window.dispatchEvent(new Event("resize"))}function ez(){requestAnimationFrame(QF)}function tz(){window.dispatchEvent(new Event("resize"))}function nz(){requestAnimationFrame(tz)}let k3;k3=new URL(window.location.href).searchParams.get(fH.showChrome)==="false",YS=Object.freeze(Object.defineProperty({__proto__:null,default:t=>{const e=X.c(10);if(k3){let s,i,a;return e[0]!==t?(s=d.jsx(Py,{hideControls:!0,...t}),e[0]=t,e[1]=s):s=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(i=d.jsx(eg,{}),e[2]=i):i=e[2],e[3]!==s?(a=d.jsxs(d.Fragment,{children:[s,i]}),e[3]=s,e[4]=a):a=e[4],a}let n,o,r;return e[5]!==t?(n=d.jsx(Py,{...t}),e[5]=t,e[6]=n):n=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(o=d.jsx(eg,{}),e[7]=o):o=e[7],e[8]!==n?(r=d.jsxs(ZF,{children:[n,o]}),e[8]=n,e[9]=r):r=e[9],r}},Symbol.toStringTag,{value:"Module"}))});export{op as C,Wc as E,xn as P,lW as __tla,qc as a,YS as e,ga as f};
|