evalution 1.0.4 → 1.0.6
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/LICENSING.md +30 -6
- package/README.md +1 -0
- package/dist/check-BTg6THHB.d.ts +1925 -0
- package/dist/checks/index.d.ts +71 -0
- package/dist/checks/index.js +2 -0
- package/dist/checks-Cq97JU-h.js +309 -0
- package/dist/cli/index.js +5328 -348
- package/dist/client/assets/DatasetView-BcYR5beY.css +1 -0
- package/dist/client/assets/DatasetView-CyX0mCj8.js +15 -0
- package/dist/client/assets/EvalRunView-5IZp_6Ob.js +2 -0
- package/dist/client/assets/EvalView-DBTK6rCe.js +1 -0
- package/dist/client/assets/abap-BdImnpbu.js +1 -0
- package/dist/client/assets/actionscript-3-CoDkCxhg.js +1 -0
- package/dist/client/assets/ada-bCR0ucgS.js +1 -0
- package/dist/client/assets/andromeeda-C4gqWexZ.js +1 -0
- package/dist/client/assets/angular-html-CU67Zn6k.js +1 -0
- package/dist/client/assets/angular-ts-BwZT4LLn.js +1 -0
- package/dist/client/assets/apache-Pmp26Uib.js +1 -0
- package/dist/client/assets/apex-D8_7TLub.js +1 -0
- package/dist/client/assets/apl-dKokRX4l.js +1 -0
- package/dist/client/assets/applescript-Co6uUVPk.js +1 -0
- package/dist/client/assets/ara-BRHolxvo.js +1 -0
- package/dist/client/assets/asciidoc-Ve4PFQV2.js +1 -0
- package/dist/client/assets/asm-D_Q5rh1f.js +1 -0
- package/dist/client/assets/astro-CbQHKStN.js +1 -0
- package/dist/client/assets/aurora-x-D-2ljcwZ.js +1 -0
- package/dist/client/assets/awk-DMzUqQB5.js +1 -0
- package/dist/client/assets/ayu-dark-DYE7WIF3.js +1 -0
- package/dist/client/assets/ayu-light-BA47KaF1.js +1 -0
- package/dist/client/assets/ayu-mirage-32ctXXKs.js +1 -0
- package/dist/client/assets/ballerina-BFfxhgS-.js +1 -0
- package/dist/client/assets/bat-BkioyH1T.js +1 -0
- package/dist/client/assets/beancount-k_qm7-4y.js +1 -0
- package/dist/client/assets/berry-uYugtg8r.js +1 -0
- package/dist/client/assets/bibtex-CHM0blh-.js +1 -0
- package/dist/client/assets/bicep-Bmn6On1c.js +1 -0
- package/dist/client/assets/bird2-DPOp833l.js +1 -0
- package/dist/client/assets/blade-D4QpJJKB.js +1 -0
- package/dist/client/assets/bsl-BO_Y6i37.js +1 -0
- package/dist/client/assets/c-BIGW1oBm.js +1 -0
- package/dist/client/assets/c3-eo99z4R2.js +1 -0
- package/dist/client/assets/cadence-Bv_4Rxtq.js +1 -0
- package/dist/client/assets/cairo-KRGpt6FW.js +1 -0
- package/dist/client/assets/catppuccin-frappe-DFWUc33u.js +1 -0
- package/dist/client/assets/catppuccin-latte-C9dUb6Cb.js +1 -0
- package/dist/client/assets/catppuccin-macchiato-DQyhUUbL.js +1 -0
- package/dist/client/assets/catppuccin-mocha-D87Tk5Gz.js +1 -0
- package/dist/client/assets/clarity-D53aC0YG.js +1 -0
- package/dist/client/assets/clojure-P80f7IUj.js +1 -0
- package/dist/client/assets/cmake-D1j8_8rp.js +1 -0
- package/dist/client/assets/cobol-nwyudZeR.js +1 -0
- package/dist/client/assets/codeowners-Bp6g37R7.js +1 -0
- package/dist/client/assets/codeql-DsOJ9woJ.js +1 -0
- package/dist/client/assets/coffee-Ch7k5sss.js +1 -0
- package/dist/client/assets/common-lisp-Cg-RD9OK.js +1 -0
- package/dist/client/assets/coq-DkFqJrB1.js +1 -0
- package/dist/client/assets/cpp-CofmeUqb.js +1 -0
- package/dist/client/assets/crystal-tKQVLTB8.js +1 -0
- package/dist/client/assets/csharp-COcwbKMJ.js +1 -0
- package/dist/client/assets/css-DPfMkruS.js +1 -0
- package/dist/client/assets/csv-fuZLfV_i.js +1 -0
- package/dist/client/assets/cue-D82EKSYY.js +1 -0
- package/dist/client/assets/cypher-COkxafJQ.js +1 -0
- package/dist/client/assets/d-85-TOEBH.js +1 -0
- package/dist/client/assets/dark-plus-C3mMm8J8.js +1 -0
- package/dist/client/assets/dart-CF10PKvl.js +1 -0
- package/dist/client/assets/data-grid-overlay-editor-CBtkQufd.js +1 -0
- package/dist/client/assets/dax-CEL-wOlO.js +1 -0
- package/dist/client/assets/desktop-BmXAJ9_W.js +1 -0
- package/dist/client/assets/diff-D97Zzqfu.js +1 -0
- package/dist/client/assets/docker-BcOcwvcX.js +1 -0
- package/dist/client/assets/dotenv-Da5cRb03.js +1 -0
- package/dist/client/assets/dracula-BzJJZx-M.js +1 -0
- package/dist/client/assets/dracula-soft-BXkSAIEj.js +1 -0
- package/dist/client/assets/dream-maker-BtqSS_iP.js +1 -0
- package/dist/client/assets/edge-BkV0erSs.js +1 -0
- package/dist/client/assets/elixir-CDX3lj18.js +1 -0
- package/dist/client/assets/elm-DbKCFpqz.js +1 -0
- package/dist/client/assets/emacs-lisp-C9XAeP06.js +1 -0
- package/dist/client/assets/erb-B12qg9BL.js +1 -0
- package/dist/client/assets/erlang-DsQrWhSR.js +1 -0
- package/dist/client/assets/everforest-dark-BgDCqdQA.js +1 -0
- package/dist/client/assets/everforest-light-C8M2exoo.js +1 -0
- package/dist/client/assets/fennel-BYunw83y.js +1 -0
- package/dist/client/assets/fish-BvzEVeQv.js +1 -0
- package/dist/client/assets/fluent-C4IJs8-o.js +1 -0
- package/dist/client/assets/fortran-fixed-form-CkoXwp7k.js +1 -0
- package/dist/client/assets/fortran-free-form-BxgE0vQu.js +1 -0
- package/dist/client/assets/fsharp-CXgrBDvD.js +1 -0
- package/dist/client/assets/gdresource-BOOCDP_w.js +1 -0
- package/dist/client/assets/gdscript-C5YyOfLZ.js +1 -0
- package/dist/client/assets/gdshader-DkwncUOv.js +1 -0
- package/dist/client/assets/genie-D0YGMca9.js +1 -0
- package/dist/client/assets/gherkin-DyxjwDmM.js +1 -0
- package/dist/client/assets/git-commit-F4YmCXRG.js +1 -0
- package/dist/client/assets/git-rebase-r7XF79zn.js +1 -0
- package/dist/client/assets/github-dark-DHJKELXO.js +1 -0
- package/dist/client/assets/github-dark-default-Cuk6v7N8.js +1 -0
- package/dist/client/assets/github-dark-dimmed-DH5Ifo-i.js +1 -0
- package/dist/client/assets/github-dark-high-contrast-E3gJ1_iC.js +1 -0
- package/dist/client/assets/github-light-DAi9KRSo.js +1 -0
- package/dist/client/assets/github-light-default-D7oLnXFd.js +1 -0
- package/dist/client/assets/github-light-high-contrast-BfjtVDDH.js +1 -0
- package/dist/client/assets/gleam-BspZqrRM.js +1 -0
- package/dist/client/assets/glimmer-js-Rg0-pVw9.js +1 -0
- package/dist/client/assets/glimmer-ts-U6CK756n.js +1 -0
- package/dist/client/assets/glsl-DplSGwfg.js +1 -0
- package/dist/client/assets/gn-n2N0HUVH.js +1 -0
- package/dist/client/assets/gnuplot-DdkO51Og.js +1 -0
- package/dist/client/assets/go-CxLEBnE3.js +1 -0
- package/dist/client/assets/graphql-ChdNCCLP.js +1 -0
- package/dist/client/assets/groovy-gcz8RCvz.js +1 -0
- package/dist/client/assets/gruvbox-dark-hard-CFHQjOhq.js +1 -0
- package/dist/client/assets/gruvbox-dark-medium-GsRaNv29.js +1 -0
- package/dist/client/assets/gruvbox-dark-soft-CVdnzihN.js +1 -0
- package/dist/client/assets/gruvbox-light-hard-CH1njM8p.js +1 -0
- package/dist/client/assets/gruvbox-light-medium-DRw_LuNl.js +1 -0
- package/dist/client/assets/gruvbox-light-soft-hJgmCMqR.js +1 -0
- package/dist/client/assets/hack-CaT9iCJl.js +1 -0
- package/dist/client/assets/haml-B8DHNrY2.js +1 -0
- package/dist/client/assets/handlebars-BL8al0AC.js +1 -0
- package/dist/client/assets/haskell-Df6bDoY_.js +1 -0
- package/dist/client/assets/haxe-CzTSHFRz.js +1 -0
- package/dist/client/assets/hcl-BWvSN4gD.js +1 -0
- package/dist/client/assets/highlighted-body-KPVGNVTW-DyudWmoO.js +1 -0
- package/dist/client/assets/hjson-D5-asLiD.js +1 -0
- package/dist/client/assets/hlsl-D3lLCCz7.js +1 -0
- package/dist/client/assets/horizon-BUw7H-hv.js +1 -0
- package/dist/client/assets/horizon-bright-Cn-bp-IR.js +1 -0
- package/dist/client/assets/houston-DnULxvSX.js +1 -0
- package/dist/client/assets/html-GMplVEZG.js +1 -0
- package/dist/client/assets/html-derivative-BFtXZ54Q.js +1 -0
- package/dist/client/assets/http-jrhK8wxY.js +1 -0
- package/dist/client/assets/hurl-irOxFIW8.js +1 -0
- package/dist/client/assets/hxml-Bvhsp5Yf.js +1 -0
- package/dist/client/assets/hy-DFXneXwc.js +1 -0
- package/dist/client/assets/imba-DGztddWO.js +1 -0
- package/dist/client/assets/index-B7OFMd2c.css +32 -0
- package/dist/client/assets/index-aypgoZcG.js +701 -0
- package/dist/client/assets/ini-BEwlwnbL.js +1 -0
- package/dist/client/assets/java-CylS5w8V.js +1 -0
- package/dist/client/assets/javascript-wDzz0qaB.js +1 -0
- package/dist/client/assets/jinja-4LBKfQ-Z.js +1 -0
- package/dist/client/assets/jison-wvAkD_A8.js +1 -0
- package/dist/client/assets/json-Cp-IABpG.js +1 -0
- package/dist/client/assets/json5-C9tS-k6U.js +1 -0
- package/dist/client/assets/jsonc-Des-eS-w.js +1 -0
- package/dist/client/assets/jsonl-DcaNXYhu.js +1 -0
- package/dist/client/assets/jsonnet-DFQXde-d.js +1 -0
- package/dist/client/assets/jssm-C2t-YnRu.js +1 -0
- package/dist/client/assets/jsx-g9-lgVsj.js +1 -0
- package/dist/client/assets/julia-CxzCAyBv.js +1 -0
- package/dist/client/assets/just-Cw27pwNe.js +1 -0
- package/dist/client/assets/kanagawa-dragon-CkXjmgJE.js +1 -0
- package/dist/client/assets/kanagawa-lotus-CfQXZHmo.js +1 -0
- package/dist/client/assets/kanagawa-wave-DWedfzmr.js +1 -0
- package/dist/client/assets/kdl-DV7GczEv.js +1 -0
- package/dist/client/assets/kotlin-BdnUsdx6.js +1 -0
- package/dist/client/assets/kusto-DZf3V79B.js +1 -0
- package/dist/client/assets/laserwave-DUszq2jm.js +1 -0
- package/dist/client/assets/latex-CWtU0Tv5.js +1 -0
- package/dist/client/assets/lean-BZvkOJ9d.js +1 -0
- package/dist/client/assets/less-B1dDrJ26.js +1 -0
- package/dist/client/assets/light-plus-B7mTdjB0.js +1 -0
- package/dist/client/assets/liquid-DYVedYrR.js +1 -0
- package/dist/client/assets/llvm-DjAJT7YJ.js +1 -0
- package/dist/client/assets/log-2UxHyX5q.js +1 -0
- package/dist/client/assets/logo-BtOb2qkB.js +1 -0
- package/dist/client/assets/lua-BaeVxFsk.js +1 -0
- package/dist/client/assets/luau-C-HG3fhB.js +1 -0
- package/dist/client/assets/make-CHLpvVh8.js +1 -0
- package/dist/client/assets/markdown-Cvjx9yec.js +1 -0
- package/dist/client/assets/marko-CnJfTvn9.js +1 -0
- package/dist/client/assets/material-theme-D5KoaKCx.js +1 -0
- package/dist/client/assets/material-theme-darker-BfHTSMKl.js +1 -0
- package/dist/client/assets/material-theme-lighter-B0m2ddpp.js +1 -0
- package/dist/client/assets/material-theme-ocean-CyktbL80.js +1 -0
- package/dist/client/assets/material-theme-palenight-Csfq5Kiy.js +1 -0
- package/dist/client/assets/matlab-D7o27uSR.js +1 -0
- package/dist/client/assets/mdc-BMNejdWA.js +1 -0
- package/dist/client/assets/mdx-Cmh6b_Ma.js +1 -0
- package/dist/client/assets/mermaid-mWjccvbQ.js +1 -0
- package/dist/client/assets/min-dark-CafNBF8u.js +1 -0
- package/dist/client/assets/min-light-CTRr51gU.js +1 -0
- package/dist/client/assets/mipsasm-CKIfxQSi.js +1 -0
- package/dist/client/assets/mojo-rZm6bMo-.js +1 -0
- package/dist/client/assets/monokai-D4h5O-jR.js +1 -0
- package/dist/client/assets/moonbit-_H4v1dQx.js +1 -0
- package/dist/client/assets/move-IF9eRakj.js +1 -0
- package/dist/client/assets/narrat-DRg8JJMk.js +1 -0
- package/dist/client/assets/nextflow-Zz6hmt5N.js +1 -0
- package/dist/client/assets/nextflow-groovy-BeH2EWoN.js +1 -0
- package/dist/client/assets/nginx-BpAMiNFr.js +1 -0
- package/dist/client/assets/night-owl-C39BiMTA.js +1 -0
- package/dist/client/assets/night-owl-light-CMTm3GFP.js +1 -0
- package/dist/client/assets/nim-CVrawwO9.js +1 -0
- package/dist/client/assets/nix-CwoSXNpI.js +1 -0
- package/dist/client/assets/nord-Ddv68eIx.js +1 -0
- package/dist/client/assets/number-overlay-editor-CXHiTLsp.js +9 -0
- package/dist/client/assets/nushell-Cz2AlsmD.js +1 -0
- package/dist/client/assets/objective-c-DXmwc3jG.js +1 -0
- package/dist/client/assets/objective-cpp-CLxacb5B.js +1 -0
- package/dist/client/assets/ocaml-C0hk2d4L.js +1 -0
- package/dist/client/assets/odin-BBf5iR-q.js +1 -0
- package/dist/client/assets/one-dark-pro-DVMEJ2y_.js +1 -0
- package/dist/client/assets/one-light-C3Wv6jpd.js +1 -0
- package/dist/client/assets/openscad-C4EeE6gA.js +1 -0
- package/dist/client/assets/pascal-D93ZcfNL.js +1 -0
- package/dist/client/assets/perl-C0TMdlhV.js +1 -0
- package/dist/client/assets/php-Dhbhpdrm.js +1 -0
- package/dist/client/assets/pkl-u5AG7uiY.js +1 -0
- package/dist/client/assets/plastic-3e1v2bzS.js +1 -0
- package/dist/client/assets/plsql-ChMvpjG-.js +1 -0
- package/dist/client/assets/po-BTJTHyun.js +1 -0
- package/dist/client/assets/poimandres-CS3Unz2-.js +1 -0
- package/dist/client/assets/polar-C0HS_06l.js +1 -0
- package/dist/client/assets/postcss-CXtECtnM.js +1 -0
- package/dist/client/assets/powerquery-CEu0bR-o.js +1 -0
- package/dist/client/assets/powershell-Dpen1YoG.js +1 -0
- package/dist/client/assets/prisma-Dd19v3D-.js +1 -0
- package/dist/client/assets/prolog-CbFg5uaA.js +1 -0
- package/dist/client/assets/proto-C7zT0LnQ.js +1 -0
- package/dist/client/assets/pug-CGlum2m_.js +1 -0
- package/dist/client/assets/puppet-BMWR74SV.js +1 -0
- package/dist/client/assets/purescript-CklMAg4u.js +1 -0
- package/dist/client/assets/python-B6aJPvgy.js +1 -0
- package/dist/client/assets/qml-3beO22l8.js +1 -0
- package/dist/client/assets/qmldir-C8lEn-DE.js +1 -0
- package/dist/client/assets/qss-IeuSbFQv.js +1 -0
- package/dist/client/assets/r-Dspwwk_N.js +1 -0
- package/dist/client/assets/racket-BqYA7rlc.js +1 -0
- package/dist/client/assets/raku-DXvB9xmW.js +1 -0
- package/dist/client/assets/razor-Uh8Bk_45.js +1 -0
- package/dist/client/assets/red-bN70gL4F.js +1 -0
- package/dist/client/assets/reg-C-SQnVFl.js +1 -0
- package/dist/client/assets/regexp-CDVJQ6XC.js +1 -0
- package/dist/client/assets/rel-C3B-1QV4.js +1 -0
- package/dist/client/assets/riscv-BM1_JUlF.js +1 -0
- package/dist/client/assets/ron-D8l8udqQ.js +1 -0
- package/dist/client/assets/rose-pine-dawn-DHQR4-dF.js +1 -0
- package/dist/client/assets/rose-pine-moon-D4_iv3hh.js +1 -0
- package/dist/client/assets/rose-pine-qdsjHGoJ.js +1 -0
- package/dist/client/assets/rosmsg-BJDFO7_C.js +1 -0
- package/dist/client/assets/rst-BrH8l1NY.js +1 -0
- package/dist/client/assets/ruby-Dw2BHqvy.js +1 -0
- package/dist/client/assets/rust-B1yitclQ.js +1 -0
- package/dist/client/assets/sas-cz2c8ADy.js +1 -0
- package/dist/client/assets/sass-Cj5Yp3dK.js +1 -0
- package/dist/client/assets/scala-C151Ov-r.js +1 -0
- package/dist/client/assets/scheme-C98Dy4si.js +1 -0
- package/dist/client/assets/scss-OYdSNvt2.js +1 -0
- package/dist/client/assets/sdbl-DVxCFoDh.js +1 -0
- package/dist/client/assets/shaderlab-Dg9Lc6iA.js +1 -0
- package/dist/client/assets/shellscript-Yzrsuije.js +1 -0
- package/dist/client/assets/shellsession-BADoaaVG.js +1 -0
- package/dist/client/assets/slack-dark-BthQWCQV.js +1 -0
- package/dist/client/assets/slack-ochin-DqwNpetd.js +1 -0
- package/dist/client/assets/smalltalk-BERRCDM3.js +1 -0
- package/dist/client/assets/snazzy-light-Bw305WKR.js +1 -0
- package/dist/client/assets/solarized-dark-DXbdFlpD.js +1 -0
- package/dist/client/assets/solarized-light-L9t79GZl.js +1 -0
- package/dist/client/assets/solidity-rGO070M0.js +1 -0
- package/dist/client/assets/soy-Brmx7dQM.js +1 -0
- package/dist/client/assets/sparql-rVzFXLq3.js +1 -0
- package/dist/client/assets/splunk-BtCnVYZw.js +1 -0
- package/dist/client/assets/sql-BLtJtn59.js +1 -0
- package/dist/client/assets/ssh-config-_ykCGR6B.js +1 -0
- package/dist/client/assets/stata-BH5u7GGu.js +1 -0
- package/dist/client/assets/stylus-BEDo0Tqx.js +1 -0
- package/dist/client/assets/surrealql-Bq5Q-fJD.js +1 -0
- package/dist/client/assets/svelte-C_ipcX3V.js +1 -0
- package/dist/client/assets/swift-D82vCrfD.js +1 -0
- package/dist/client/assets/synthwave-84-CbfX1IO0.js +1 -0
- package/dist/client/assets/system-verilog-CnnmHF94.js +1 -0
- package/dist/client/assets/systemd-4A_iFExJ.js +1 -0
- package/dist/client/assets/talonscript-CkByrt1z.js +1 -0
- package/dist/client/assets/tasl-QIJgUcNo.js +1 -0
- package/dist/client/assets/tcl-dwOrl1Do.js +1 -0
- package/dist/client/assets/templ-P3uqSqPl.js +1 -0
- package/dist/client/assets/terraform-BETggiCN.js +1 -0
- package/dist/client/assets/tex-idrVyKtj.js +1 -0
- package/dist/client/assets/tokyo-night-hegEt444.js +1 -0
- package/dist/client/assets/toml-vGWfd6FD.js +1 -0
- package/dist/client/assets/ts-tags-zn1MmPIZ.js +1 -0
- package/dist/client/assets/tsv-B_m7g4N7.js +1 -0
- package/dist/client/assets/tsx-COt5Ahok.js +1 -0
- package/dist/client/assets/turtle-BsS91CYL.js +1 -0
- package/dist/client/assets/twig-DNn4PbVi.js +1 -0
- package/dist/client/assets/typescript-BPQ3VLAy.js +1 -0
- package/dist/client/assets/typespec-BGHnOYBU.js +1 -0
- package/dist/client/assets/typst-DHCkPAjA.js +1 -0
- package/dist/client/assets/v-BcVCzyr7.js +1 -0
- package/dist/client/assets/vala-CsfeWuGM.js +1 -0
- package/dist/client/assets/vb-D17OF-Vu.js +1 -0
- package/dist/client/assets/verilog-BQ8w6xss.js +1 -0
- package/dist/client/assets/vesper-DU1UobuO.js +1 -0
- package/dist/client/assets/vhdl-CeAyd5Ju.js +1 -0
- package/dist/client/assets/viml-CJc9bBzg.js +1 -0
- package/dist/client/assets/vitesse-black-Bkuqu6BP.js +1 -0
- package/dist/client/assets/vitesse-dark-D0r3Knsf.js +1 -0
- package/dist/client/assets/vitesse-light-CVO1_9PV.js +1 -0
- package/dist/client/assets/vue-DN_0RTcg.js +1 -0
- package/dist/client/assets/vue-html-AaS7Mt5G.js +1 -0
- package/dist/client/assets/vue-vine-CQOfvN7w.js +1 -0
- package/dist/client/assets/vyper-CDx5xZoG.js +1 -0
- package/dist/client/assets/wasm-CG6Dc4jp.js +1 -0
- package/dist/client/assets/wasm-MzD3tlZU.js +1 -0
- package/dist/client/assets/wenyan-BV7otONQ.js +1 -0
- package/dist/client/assets/wgsl-Dx-B1_4e.js +1 -0
- package/dist/client/assets/wikitext-BhOHFoWU.js +1 -0
- package/dist/client/assets/wit-5i3qLPDT.js +1 -0
- package/dist/client/assets/wolfram-lXgVvXCa.js +1 -0
- package/dist/client/assets/xml-sdJ4AIDG.js +1 -0
- package/dist/client/assets/xsl-CtQFsRM5.js +1 -0
- package/dist/client/assets/yaml-Buea-lGh.js +1 -0
- package/dist/client/assets/zenscript-DVFEvuxE.js +1 -0
- package/dist/client/assets/zig-VOosw3JB.js +1 -0
- package/dist/client/index.html +2 -2
- package/dist/dataset-types-CSjbM_Vz.d.ts +564 -0
- package/dist/index.d.ts +3806 -894
- package/dist/index.js +3653 -578
- package/dist/instance-names-pVQxJbtw.js +12 -0
- package/dist/otlp-trace-ingestor-V8_bbpUG.js +12376 -0
- package/dist/runtime-DCNx7dHI.js +302 -0
- package/dist/trace-Dn6Pfcc5.d.ts +200 -0
- package/dist/views/datasets/index.d.ts +68 -0
- package/dist/views/datasets/index.js +237 -0
- package/dist/views/index.d.ts +98 -0
- package/dist/views/index.js +156 -0
- package/dist/views/react/index.d.ts +55 -0
- package/dist/views/react/index.js +246 -0
- package/package.json +78 -14
- package/dist/client/assets/index-C4XXh0na.js +0 -144
- package/dist/client/assets/index-CHPZsnKo.css +0 -32
- package/dist/vercel-ai-sdk-B8ivuOzP.js +0 -853
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/data-grid-overlay-editor-CBtkQufd.js","assets/index-aypgoZcG.js","assets/index-B7OFMd2c.css","assets/number-overlay-editor-CXHiTLsp.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var sd=Object.defineProperty;var ad=(e,t,n)=>t in e?sd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ue=(e,t,n)=>ad(e,typeof t!="symbol"?t+"":t,n);import{ae as bi,af as Lr,r as c,ad as Bt,ag as Ql,ah as ld,ai as Zl,aj as cd,ak as ei,ac as ho,j as v,al as ud,a1 as Di,aa as dd,am as fd,an as ec,ao as hd,ap as tc,aq as gd,ar as md,as as Ia,at as Mi,a7 as pd,X as bd,a8 as yd,Y as vd,au as nc,av as rc,aw as wd,ax as xd,ay as Cd,az as Ea,aA as kd,aB as Ms,a2 as Sd,R as Rd,N as Md,H as Id,a4 as Ed,a6 as Td,aC as Dd,E as oc,aD as $d,aE as Ta,aF as Ad,aG as Fd,aH as _d,y as Pd,C as Od,aI as jd,aJ as Nd,aK as Hd,aL as Bd,aM as Ld,aN as Da,aO as zd,aP as Wd,aQ as Gd,aR as Ud,T as yi,aS as $a,J as Xd,I as Kd,aT as Yd,f as qd,K as Aa,P as Vd,aU as Jd,aV as Qd,aW as Zd,aX as Fa,aY as ef,aZ as tf,a_ as nf,a$ as rf,b0 as of,b1 as sf,b2 as af,b3 as lf,b4 as cf,O as uf,Q as df}from"./index-aypgoZcG.js";var ff=Object.prototype,hf=ff.hasOwnProperty;function gf(e,t){return e!=null&&hf.call(e,t)}var mf=gf,pf=Array.isArray,qn=pf,bf=typeof bi=="object"&&bi&&bi.Object===Object&&bi,ic=bf,yf=ic,vf=typeof self=="object"&&self&&self.Object===Object&&self,wf=yf||vf||Function("return this")(),Vn=wf,xf=Vn,Cf=xf.Symbol,ti=Cf,_a=ti,sc=Object.prototype,kf=sc.hasOwnProperty,Sf=sc.toString,jo=_a?_a.toStringTag:void 0;function Rf(e){var t=kf.call(e,jo),n=e[jo];try{e[jo]=void 0;var r=!0}catch{}var o=Sf.call(e);return r&&(t?e[jo]=n:delete e[jo]),o}var Mf=Rf,If=Object.prototype,Ef=If.toString;function Tf(e){return Ef.call(e)}var Df=Tf,Pa=ti,$f=Mf,Af=Df,Ff="[object Null]",_f="[object Undefined]",Oa=Pa?Pa.toStringTag:void 0;function Pf(e){return e==null?e===void 0?_f:Ff:Oa&&Oa in Object(e)?$f(e):Af(e)}var ni=Pf;function Of(e){return e!=null&&typeof e=="object"}var ri=Of,jf=ni,Nf=ri,Hf="[object Symbol]";function Bf(e){return typeof e=="symbol"||Nf(e)&&jf(e)==Hf}var Li=Bf,Lf=qn,zf=Li,Wf=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Gf=/^\w*$/;function Uf(e,t){if(Lf(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||zf(e)?!0:Gf.test(e)||!Wf.test(e)||t!=null&&e in Object(t)}var Ws=Uf;function Xf(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var po=Xf,Kf=ni,Yf=po,qf="[object AsyncFunction]",Vf="[object Function]",Jf="[object GeneratorFunction]",Qf="[object Proxy]";function Zf(e){if(!Yf(e))return!1;var t=Kf(e);return t==Vf||t==Jf||t==qf||t==Qf}var ac=Zf,eh=Vn,th=eh["__core-js_shared__"],nh=th,cs=nh,ja=function(){var e=/[^.]+$/.exec(cs&&cs.keys&&cs.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function rh(e){return!!ja&&ja in e}var oh=rh,ih=Function.prototype,sh=ih.toString;function ah(e){if(e!=null){try{return sh.call(e)}catch{}try{return e+""}catch{}}return""}var lc=ah,lh=ac,ch=oh,uh=po,dh=lc,fh=/[\\^$.*+?()[\]{}|]/g,hh=/^\[object .+?Constructor\]$/,gh=Function.prototype,mh=Object.prototype,ph=gh.toString,bh=mh.hasOwnProperty,yh=RegExp("^"+ph.call(bh).replace(fh,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function vh(e){if(!uh(e)||ch(e))return!1;var t=lh(e)?yh:hh;return t.test(dh(e))}var wh=vh;function xh(e,t){return e==null?void 0:e[t]}var Ch=xh,kh=wh,Sh=Ch;function Rh(e,t){var n=Sh(e,t);return kh(n)?n:void 0}var zr=Rh,Mh=zr,Ih=Mh(Object,"create"),zi=Ih,Na=zi;function Eh(){this.__data__=Na?Na(null):{},this.size=0}var Th=Eh;function Dh(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var $h=Dh,Ah=zi,Fh="__lodash_hash_undefined__",_h=Object.prototype,Ph=_h.hasOwnProperty;function Oh(e){var t=this.__data__;if(Ah){var n=t[e];return n===Fh?void 0:n}return Ph.call(t,e)?t[e]:void 0}var jh=Oh,Nh=zi,Hh=Object.prototype,Bh=Hh.hasOwnProperty;function Lh(e){var t=this.__data__;return Nh?t[e]!==void 0:Bh.call(t,e)}var zh=Lh,Wh=zi,Gh="__lodash_hash_undefined__";function Uh(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Wh&&t===void 0?Gh:t,this}var Xh=Uh,Kh=Th,Yh=$h,qh=jh,Vh=zh,Jh=Xh;function bo(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}bo.prototype.clear=Kh;bo.prototype.delete=Yh;bo.prototype.get=qh;bo.prototype.has=Vh;bo.prototype.set=Jh;var Qh=bo;function Zh(){this.__data__=[],this.size=0}var eg=Zh;function tg(e,t){return e===t||e!==e&&t!==t}var Gs=tg,ng=Gs;function rg(e,t){for(var n=e.length;n--;)if(ng(e[n][0],t))return n;return-1}var Wi=rg,og=Wi,ig=Array.prototype,sg=ig.splice;function ag(e){var t=this.__data__,n=og(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():sg.call(t,n,1),--this.size,!0}var lg=ag,cg=Wi;function ug(e){var t=this.__data__,n=cg(t,e);return n<0?void 0:t[n][1]}var dg=ug,fg=Wi;function hg(e){return fg(this.__data__,e)>-1}var gg=hg,mg=Wi;function pg(e,t){var n=this.__data__,r=mg(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}var bg=pg,yg=eg,vg=lg,wg=dg,xg=gg,Cg=bg;function yo(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}yo.prototype.clear=yg;yo.prototype.delete=vg;yo.prototype.get=wg;yo.prototype.has=xg;yo.prototype.set=Cg;var Gi=yo,kg=zr,Sg=Vn,Rg=kg(Sg,"Map"),Us=Rg,Ha=Qh,Mg=Gi,Ig=Us;function Eg(){this.size=0,this.__data__={hash:new Ha,map:new(Ig||Mg),string:new Ha}}var Tg=Eg;function Dg(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var $g=Dg,Ag=$g;function Fg(e,t){var n=e.__data__;return Ag(t)?n[typeof t=="string"?"string":"hash"]:n.map}var Ui=Fg,_g=Ui;function Pg(e){var t=_g(this,e).delete(e);return this.size-=t?1:0,t}var Og=Pg,jg=Ui;function Ng(e){return jg(this,e).get(e)}var Hg=Ng,Bg=Ui;function Lg(e){return Bg(this,e).has(e)}var zg=Lg,Wg=Ui;function Gg(e,t){var n=Wg(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}var Ug=Gg,Xg=Tg,Kg=Og,Yg=Hg,qg=zg,Vg=Ug;function vo(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}vo.prototype.clear=Xg;vo.prototype.delete=Kg;vo.prototype.get=Yg;vo.prototype.has=qg;vo.prototype.set=Vg;var Xs=vo,cc=Xs,Jg="Expected a function";function Ks(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(Jg);var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var a=e.apply(this,r);return n.cache=i.set(o,a)||i,a};return n.cache=new(Ks.Cache||cc),n}Ks.Cache=cc;var Qg=Ks,Zg=Qg,em=500;function tm(e){var t=Zg(e,function(r){return n.size===em&&n.clear(),r}),n=t.cache;return t}var nm=tm,rm=nm,om=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,im=/\\(\\)?/g,sm=rm(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(om,function(n,r,o,i){t.push(o?i.replace(im,"$1"):r||n)}),t}),am=sm;function lm(e,t){for(var n=-1,r=e==null?0:e.length,o=Array(r);++n<r;)o[n]=t(e[n],n,e);return o}var cm=lm,Ba=ti,um=cm,dm=qn,fm=Li,La=Ba?Ba.prototype:void 0,za=La?La.toString:void 0;function uc(e){if(typeof e=="string")return e;if(dm(e))return um(e,uc)+"";if(fm(e))return za?za.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var hm=uc,gm=hm;function mm(e){return e==null?"":gm(e)}var pm=mm,bm=qn,ym=Ws,vm=am,wm=pm;function xm(e,t){return bm(e)?e:ym(e,t)?[e]:vm(wm(e))}var dc=xm,Cm=ni,km=ri,Sm="[object Arguments]";function Rm(e){return km(e)&&Cm(e)==Sm}var Mm=Rm,Wa=Mm,Im=ri,fc=Object.prototype,Em=fc.hasOwnProperty,Tm=fc.propertyIsEnumerable,Dm=Wa(function(){return arguments}())?Wa:function(e){return Im(e)&&Em.call(e,"callee")&&!Tm.call(e,"callee")},Ys=Dm,$m=9007199254740991,Am=/^(?:0|[1-9]\d*)$/;function Fm(e,t){var n=typeof e;return t=t??$m,!!t&&(n=="number"||n!="symbol"&&Am.test(e))&&e>-1&&e%1==0&&e<t}var qs=Fm,_m=9007199254740991;function Pm(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=_m}var Vs=Pm,Om=Li;function jm(e){if(typeof e=="string"||Om(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var Xi=jm,Nm=dc,Hm=Ys,Bm=qn,Lm=qs,zm=Vs,Wm=Xi;function Gm(e,t,n){t=Nm(t,e);for(var r=-1,o=t.length,i=!1;++r<o;){var a=Wm(t[r]);if(!(i=e!=null&&n(e,a)))break;e=e[a]}return i||++r!=o?i:(o=e==null?0:e.length,!!o&&zm(o)&&Lm(a,o)&&(Bm(e)||Hm(e)))}var hc=Gm,Um=mf,Xm=hc;function Km(e,t){return e!=null&&Xm(e,t,Um)}var Ym=Km;const qm=Lr(Ym);function gc(e="This should not happen"){throw new Error(e)}function bn(e,t="Assertion failed"){if(!e)return gc(t)}function Vo(e,t){return gc(t??"Hell froze over")}function Vm(e,t){try{return e()}catch{return t}}const Ga=Object.prototype.hasOwnProperty;function go(e,t){let n,r;if(e===t)return!0;if(e&&t&&(n=e.constructor)===t.constructor){if(n===Date)return e.getTime()===t.getTime();if(n===RegExp)return e.toString()===t.toString();if(n===Array){if((r=e.length)===t.length)for(;r--&&go(e[r],t[r]););return r===-1}if(!n||typeof e=="object"){r=0;for(n in e)if(Ga.call(e,n)&&++r&&!Ga.call(t,n)||!(n in t)||!go(e[n],t[n]))return!1;return Object.keys(t).length===r}}return e!==e&&t!==t}const $i=null,Js=void 0;var ue;(function(e){e.Uri="uri",e.Text="text",e.Image="image",e.RowID="row-id",e.Number="number",e.Bubble="bubble",e.Boolean="boolean",e.Loading="loading",e.Markdown="markdown",e.Drilldown="drilldown",e.Protected="protected",e.Custom="custom"})(ue||(ue={}));var Ua;(function(e){e.HeaderRowID="headerRowID",e.HeaderCode="headerCode",e.HeaderNumber="headerNumber",e.HeaderString="headerString",e.HeaderBoolean="headerBoolean",e.HeaderAudioUri="headerAudioUri",e.HeaderVideoUri="headerVideoUri",e.HeaderEmoji="headerEmoji",e.HeaderImage="headerImage",e.HeaderUri="headerUri",e.HeaderPhone="headerPhone",e.HeaderMarkdown="headerMarkdown",e.HeaderDate="headerDate",e.HeaderTime="headerTime",e.HeaderEmail="headerEmail",e.HeaderReference="headerReference",e.HeaderIfThenElse="headerIfThenElse",e.HeaderSingleValue="headerSingleValue",e.HeaderLookup="headerLookup",e.HeaderTextTemplate="headerTextTemplate",e.HeaderMath="headerMath",e.HeaderRollup="headerRollup",e.HeaderJoinStrings="headerJoinStrings",e.HeaderSplitString="headerSplitString",e.HeaderGeoDistance="headerGeoDistance",e.HeaderArray="headerArray",e.RowOwnerOverlay="rowOwnerOverlay",e.ProtectedColumnOverlay="protectedColumnOverlay"})(Ua||(Ua={}));var Ai;(function(e){e.Triangle="triangle",e.Dots="dots"})(Ai||(Ai={}));function vi(e){return"width"in e&&typeof e.width=="number"}async function Xa(e){return typeof e=="object"?e:await e()}function oo(e){return!(e.kind===ue.Loading||e.kind===ue.Bubble||e.kind===ue.RowID||e.kind===ue.Protected||e.kind===ue.Drilldown)}function ao(e){return e.kind===En.Marker||e.kind===En.NewRow}function io(e){if(!oo(e)||e.kind===ue.Image)return!1;switch(e.kind){case ue.Text:case ue.Number:case ue.Markdown:case ue.Uri:case ue.Custom:case ue.Boolean:return e.readonly!==!0;default:Vo(e,"A cell was passed with an invalid kind")}}function Jm(e){return qm(e,"editor")}function Qs(e){return!(e.readonly??!1)}var En;(function(e){e.NewRow="new-row",e.Marker="marker"})(En||(En={}));const Fi={shape:"square",size:4,offsetX:-2,offsetY:-2,outline:0};function us(e){if(e.length===0)return[];const t=[...e],n=[];t.sort(function(r,o){return r[0]-o[0]}),n.push([...t[0]]);for(const r of t.slice(1)){const o=n[n.length-1];o[1]<r[0]?n.push([...r]):o[1]<r[1]&&(o[1]=r[1])}return n}let Ka;const cn=class cn{constructor(t){Ue(this,"items");this.items=t}offset(t){if(t===0)return this;const n=this.items.map(r=>[r[0]+t,r[1]+t]);return new cn(n)}add(t){const n=typeof t=="number"?[t,t+1]:t,r=us([...this.items,n]);return new cn(r)}remove(t){const n=[...this.items],r=typeof t=="number"?t:t[0],o=typeof t=="number"?t+1:t[1];for(const[i,a]of n.entries()){const[s,l]=a;if(s<=o&&r<=l){const u=[];s<r&&u.push([s,r]),o<l&&u.push([o,l]),n.splice(i,1,...u)}}return new cn(n)}first(){if(this.items.length!==0)return this.items[0][0]}last(){if(this.items.length!==0)return this.items.slice(-1)[0][1]-1}hasIndex(t){for(let n=0;n<this.items.length;n++){const[r,o]=this.items[n];if(t>=r&&t<o)return!0}return!1}hasAll(t){for(let n=t[0];n<t[1];n++)if(!this.hasIndex(n))return!1;return!0}some(t){for(const n of this)if(t(n))return!0;return!1}equals(t){if(t===this)return!0;if(t.items.length!==this.items.length)return!1;for(let n=0;n<this.items.length;n++){const r=t.items[n],o=this.items[n];if(r[0]!==o[0]||r[1]!==o[1])return!1}return!0}toArray(){const t=[];for(const[n,r]of this.items)for(let o=n;o<r;o++)t.push(o);return t}get length(){let t=0;for(const[n,r]of this.items)t+=r-n;return t}*[Symbol.iterator](){for(const[t,n]of this.items)for(let r=t;r<n;r++)yield r}};Ue(cn,"create",t=>new cn(us(t))),Ue(cn,"empty",()=>Ka??(Ka=new cn([]))),Ue(cn,"fromSingleSelection",t=>cn.empty().add(t)),Ue(cn,"fromArray",t=>{if(t.length===0)return cn.empty();const n=t.map(o=>[o,o+1]),r=us(n);return new cn(r)});let it=cn;function Qm(e){var t=Object.create(null);return function(n){return t[n]===void 0&&(t[n]=e(n)),t[n]}}var Zm=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|popover|popoverTarget|popoverTargetAction|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,ds=Qm(function(e){return Zm.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91}),ep=function(){const t=Array.prototype.slice.call(arguments).filter(Boolean),n={},r=[];t.forEach(i=>{(i?i.split(" "):[]).forEach(s=>{if(s.startsWith("atm_")){const[,l]=s.split("_");n[l]=s}else r.push(s)})});const o=[];for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&o.push(n[i]);return o.push(...r),o.join(" ")},Ya=ep,tp=e=>e.toUpperCase()===e,np=e=>t=>e.indexOf(t)===-1,mc=(e,t)=>{const n={};return Object.keys(e).filter(np(t)).forEach(r=>{n[r]=e[r]}),n};function rp(e,t,n){const r=mc(t,n);if(!e){const o=typeof ds=="function"?{default:ds}:ds;Object.keys(r).forEach(i=>{o.default(i)||delete r[i]})}return r}var op=(e,t)=>{};function ip(e){let t="";return n=>{const r=(i,a)=>{const{as:s=e,class:l=t}=i,u=n.propsAsIs===void 0?!(typeof s=="string"&&s.indexOf("-")===-1&&!tp(s[0])):n.propsAsIs,d=rp(u,i,["as","class"]);d.ref=a,d.className=n.atomic?Ya(n.class,d.className||l):Ya(d.className||l,n.class);const{vars:h}=n;if(h){const p={};for(const y in h){const x=h[y],C=x[0],w=x[1]||"",I=typeof C=="function"?C(i):C;op(I,n.name),p[`--${y}`]=`${I}${w}`}const b=d.style||{},m=Object.keys(b);m.length>0&&m.forEach(y=>{p[y]=b[y]}),d.style=p}return e.__wyw_meta&&e!==s?(d.as=s,c.createElement(e,d)):c.createElement(s,d)},o=c.forwardRef?c.forwardRef(r):i=>{const a=mc(i,["innerRef"]);return r(a,i.innerRef)};return o.displayName=n.name,o.__wyw_meta={className:n.class||t,extends:e},o}}var Cr=ip,sp=Vn,ap=function(){return sp.Date.now()},lp=ap,cp=/\s/;function up(e){for(var t=e.length;t--&&cp.test(e.charAt(t)););return t}var dp=up,fp=dp,hp=/^\s+/;function gp(e){return e&&e.slice(0,fp(e)+1).replace(hp,"")}var mp=gp,pp=mp,qa=po,bp=Li,Va=NaN,yp=/^[-+]0x[0-9a-f]+$/i,vp=/^0b[01]+$/i,wp=/^0o[0-7]+$/i,xp=parseInt;function Cp(e){if(typeof e=="number")return e;if(bp(e))return Va;if(qa(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=qa(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=pp(e);var n=vp.test(e);return n||wp.test(e)?xp(e.slice(2),n?2:8):yp.test(e)?Va:+e}var Zs=Cp,kp=po,fs=lp,Ja=Zs,Sp="Expected a function",Rp=Math.max,Mp=Math.min;function Ip(e,t,n){var r,o,i,a,s,l,u=0,d=!1,h=!1,p=!0;if(typeof e!="function")throw new TypeError(Sp);t=Ja(t)||0,kp(n)&&(d=!!n.leading,h="maxWait"in n,i=h?Rp(Ja(n.maxWait)||0,t):i,p="trailing"in n?!!n.trailing:p);function b($){var L=r,V=o;return r=o=void 0,u=$,a=e.apply(V,L),a}function m($){return u=$,s=setTimeout(C,t),d?b($):a}function y($){var L=$-l,V=$-u,R=t-L;return h?Mp(R,i-V):R}function x($){var L=$-l,V=$-u;return l===void 0||L>=t||L<0||h&&V>=i}function C(){var $=fs();if(x($))return w($);s=setTimeout(C,y($))}function w($){return s=void 0,p&&r?b($):(r=o=void 0,a)}function I(){s!==void 0&&clearTimeout(s),u=0,r=l=o=s=void 0}function W(){return s===void 0?a:w(fs())}function B(){var $=fs(),L=x($);if(r=arguments,o=this,l=$,L){if(s===void 0)return m(l);if(h)return clearTimeout(s),s=setTimeout(C,t),b(l)}return s===void 0&&(s=setTimeout(C,t)),a}return B.cancel=I,B.flush=W,B}var Ep=Ip;const pc=Lr(Ep);function nn(e,t,n,r,o=!1){const i=c.useRef();i.current=t,c.useEffect(()=>{if(n===null||n.addEventListener===void 0)return;const a=n,s=l=>{var u;(u=i.current)==null||u.call(a,l)};return a.addEventListener(e,s,{passive:r,capture:o}),()=>{a.removeEventListener(e,s,{capture:o})}},[e,n,r,o])}function vr(e,t){return e===void 0?void 0:t}const bc=(e,t,n)=>({x1:e-n/2,y1:t-n/2,x2:e+n/2,y2:t+n/2}),yc=(e,t,n,r,o)=>{switch(e){case"left":return Math.floor(t)+r+o/2;case"center":return Math.floor(t+n/2);case"right":return Math.floor(t+n)-r-o/2}},vc=(e,t,n)=>Math.min(e,t-n*2),wc=(e,t,n)=>n.x1<=e&&e<=n.x2&&n.y1<=t&&t<=n.y2;function Tp(e,t,n){const[r,o]=c.useState(e),i=c.useRef(!0);c.useEffect(()=>()=>{i.current=!1},[]);const a=c.useRef(pc(s=>{i.current&&o(s)},n));return c.useLayoutEffect(()=>{i.current&&a.current(()=>e())},t),r}const Dp="֑-߿יִ-﷽ﹰ-ﻼ",$p="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",Ap=new RegExp("^[^"+$p+"]*["+Dp+"]");function ea(e){return Ap.test(e)?"rtl":"not-rtl"}let wi;function Is(){if(typeof document>"u")return 0;if(wi!==void 0)return wi;const e=document.createElement("p");e.style.width="100%",e.style.height="200px";const t=document.createElement("div");t.id="testScrollbar",t.style.position="absolute",t.style.top="0px",t.style.left="0px",t.style.visibility="hidden",t.style.width="200px",t.style.height="150px",t.style.overflow="hidden",t.append(e),document.body.append(t);const n=e.offsetWidth;t.style.overflow="scroll";let r=e.offsetWidth;return n===r&&(r=t.clientWidth),t.remove(),wi=n-r,wi}const Or=Symbol();function Fp(e){const t=c.useRef([Or,e]);t.current[1]!==e&&(t.current[0]=e),t.current[1]=e;const[n,r]=c.useState(e),[,o]=c.useState(),i=c.useCallback(s=>{const l=t.current[0];l!==Or&&(s=typeof s=="function"?s(l):s,s===l)||(l!==Or&&o({}),r(u=>typeof s=="function"?s(l===Or?u:l):s),t.current[0]=Or)},[]),a=c.useCallback(()=>{t.current[0]=Or,o({})},[]);return[t.current[0]===Or?n:t.current[0],i,a]}function _p(e){if(e.length===0)return"";let t=0,n=0;for(const r of e){if(n+=r.length,n>1e4)break;t++}return e.slice(0,t).join(", ")}function Pp(e){const t=c.useRef(e);return go(e,t.current)||(t.current=e),t.current}const Op=Cr("textarea")({name:"InputBox",class:"gdg-izpuzkl",propsAsIs:!1}),jp=Cr("div")({name:"ShadowBox",class:"gdg-s69h75o",propsAsIs:!1}),Np=Cr("div")({name:"GrowingEntryStyle",class:"gdg-g1y0xocz",propsAsIs:!1});let Qa=0;const Hp=e=>{const{placeholder:t,value:n,onKeyDown:r,highlight:o,altNewline:i,validatedSelection:a,...s}=e,{onChange:l,className:u}=s,d=c.useRef(null),h=n??"";bn(l!==void 0,"GrowingEntry must be a controlled input area");const[p]=c.useState(()=>"input-box-"+(Qa=(Qa+1)%1e7));c.useEffect(()=>{const m=d.current;if(m===null||m.disabled)return;const y=h.toString().length;m.focus(),m.setSelectionRange(o?0:y,y)},[]),c.useLayoutEffect(()=>{var m;if(a!==void 0){const y=typeof a=="number"?[a,null]:a;(m=d.current)==null||m.setSelectionRange(y[0],y[1])}},[a]);const b=c.useCallback(m=>{m.key==="Enter"&&m.shiftKey&&i===!0||r==null||r(m)},[i,r]);return c.createElement(Np,{className:"gdg-growing-entry"},c.createElement(jp,{className:u},h+`
|
|
3
|
+
`),c.createElement(Op,{...s,className:(u??"")+" gdg-input",id:p,ref:d,onKeyDown:b,value:h,placeholder:t,dir:"auto"}))},hs={};let br=null;function Bp(){const e=document.createElement("div");return e.style.opacity="0",e.style.pointerEvents="none",e.style.position="fixed",document.body.append(e),e}function Es(e){const t=e.toLowerCase().trim();if(hs[t]!==void 0)return hs[t];br=br||Bp(),br.style.color="#000",br.style.color=t;const n=getComputedStyle(br).color;br.style.color="#fff",br.style.color=t;const r=getComputedStyle(br).color;if(r!==n)return[0,0,0,1];let o=r.replace(/[^\d.,]/g,"").split(",").map(Number.parseFloat);return o.length<4&&o.push(1),o=o.map(i=>Number.isNaN(i)?0:i),hs[t]=o,o}function Br(e,t){const[n,r,o]=Es(e);return`rgba(${n}, ${r}, ${o}, ${t})`}const Za=new Map;function el(e,t){const n=`${e}-${t}`,r=Za.get(n);if(r!==void 0)return r;const o=yn(e,t);return Za.set(n,o),o}function yn(e,t){if(t===void 0)return e;const[n,r,o,i]=Es(e);if(i===1)return e;const[a,s,l,u]=Es(t),d=i+u*(1-i),h=(i*n+u*a*(1-i))/d,p=(i*r+u*s*(1-i))/d,b=(i*o+u*l*(1-i))/d;return`rgba(${h}, ${p}, ${b}, ${d})`}var so=new Map,lo=new Map,Ts=new Map;function Lp(){so.clear(),Ts.clear(),lo.clear()}function zp(e,t,n,r,o){var i,a,s;let l=0,u={};for(let h of e)l+=(i=n.get(h))!=null?i:o,u[h]=((a=u[h])!=null?a:0)+1;let d=t-l;for(let h of Object.keys(u)){let p=u[h],b=(s=n.get(h))!=null?s:o,m=b*p/l,y=d*m*r/p,x=b+y;n.set(h,x)}}function Wp(e,t){var n;let r=new Map,o=0;for(let u of"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890,.-+=?"){let d=e.measureText(u).width;r.set(u,d),o+=d}let i=o/r.size,a=3,s=(t/i+a)/(a+1),l=r.keys();for(let u of l)r.set(u,((n=r.get(u))!=null?n:i)*s);return r}function Xo(e,t,n,r){var o,i;let a=lo.get(n);if(r&&a!==void 0&&a.count>2e4){let u=Ts.get(n);if(u===void 0&&(u=Wp(e,a.size),Ts.set(n,u)),a.count>5e5){let h=0;for(let p of t)h+=(o=u.get(p))!=null?o:a.size;return h*1.01}let d=e.measureText(t);return zp(t,d.width,u,Math.max(.05,1-a.count/2e5),a.size),lo.set(n,{count:a.count+t.length,size:a.size}),d.width}let s=e.measureText(t),l=s.width/t.length;if(((i=a==null?void 0:a.count)!=null?i:0)>2e4)return s.width;if(a===void 0)lo.set(n,{count:t.length,size:l});else{let u=l-a.size,d=t.length/(a.count+t.length),h=a.size+u*d;lo.set(n,{count:a.count+t.length,size:h})}return s.width}function Gp(e,t,n,r,o,i,a,s){if(t.length<=1)return t.length;if(o<n)return-1;let l=Math.floor(n/o*i),u=Xo(e,t.slice(0,Math.max(0,l)),r,a);if(u!==n)if(u<n){for(;u<n;)l++,u=Xo(e,t.slice(0,Math.max(0,l)),r,a);l--}else for(;u>n;){let d=t.lastIndexOf(" ",l-1);d>0?l=d:l--,u=Xo(e,t.slice(0,Math.max(0,l)),r,a)}if(t[l]!==" "){let d=0;d=t.lastIndexOf(" ",l),d>0&&(l=d)}return l}function Up(e,t,n,r,o,i){let a=`${t}_${n}_${r}px`,s=so.get(a);if(s!==void 0)return s;if(r<=0)return[];let l=[],u=t.split(`
|
|
4
|
+
`),d=lo.get(n),h=d===void 0?t.length:r/d.size*1.5,p=o&&d!==void 0&&d.count>2e4;for(let b of u){let m=Xo(e,b.slice(0,Math.max(0,h)),n,p),y=Math.min(b.length,h);if(m<=r)l.push(b);else{for(;m>r;){let x=Gp(e,b,r,n,m,y,p),C=b.slice(0,Math.max(0,x));b=b.slice(C.length),l.push(C),m=Xo(e,b.slice(0,Math.max(0,h)),n,p),y=Math.min(b.length,h)}m>0&&l.push(b)}}return l=l.map((b,m)=>m===0?b.trimEnd():b.trim()),so.set(a,l),so.size>500&&so.delete(so.keys().next().value),l}function Xp(e,t){return Bt.useMemo(()=>e.map((n,r)=>({group:n.group,grow:n.grow,hasMenu:n.hasMenu,icon:n.icon,id:n.id,menuIcon:n.menuIcon,overlayIcon:n.overlayIcon,sourceIndex:r,sticky:r<t,indicatorIcon:n.indicatorIcon,style:n.style,themeOverride:n.themeOverride,title:n.title,trailingRowOptions:n.trailingRowOptions,width:n.width,growOffset:n.growOffset,rowMarker:n.rowMarker,rowMarkerChecked:n.rowMarkerChecked,headerRowMarkerTheme:n.headerRowMarkerTheme,headerRowMarkerAlwaysVisible:n.headerRowMarkerAlwaysVisible,headerRowMarkerDisabled:n.headerRowMarkerDisabled})),[e,t])}function Kp(e,t){const[n,r]=t;if(e.columns.hasIndex(n)||e.rows.hasIndex(r))return!0;if(e.current!==void 0){if(Ko(e.current.cell,t))return!0;const o=[e.current.range,...e.current.rangeStack];for(const i of o)if(n>=i.x&&n<i.x+i.width&&r>=i.y&&r<i.y+i.height)return!0}return!1}function Jo(e,t){return(e??"")===(t??"")}function Yp(e,t,n){return n.current===void 0||e[1]!==n.current.cell[1]?!1:t.span===void 0?n.current.cell[0]===e[0]:n.current.cell[0]>=t.span[0]&&n.current.cell[0]<=t.span[1]}function xc(e,t){const[n,r]=e;return n>=t.x&&n<t.x+t.width&&r>=t.y&&r<t.y+t.height}function Ko(e,t){return(e==null?void 0:e[0])===(t==null?void 0:t[0])&&(e==null?void 0:e[1])===(t==null?void 0:t[1])}function Cc(e){return[e.x+e.width-1,e.y+e.height-1]}function tl(e,t,n){const r=n.x,o=n.x+n.width-1,i=n.y,a=n.y+n.height-1,[s,l]=e;if(l<i||l>a)return!1;if(t.span===void 0)return s>=r&&s<=o;const[u,d]=t.span;return u>=r&&u<=o||d>=r&&u<=o||u<r&&d>o}function qp(e,t,n,r){let o=0;if(n.current===void 0)return o;const i=n.current.range;(r||i.height*i.width>1)&&tl(e,t,i)&&o++;for(const a of n.current.rangeStack)tl(e,t,a)&&o++;return o}function kc(e,t){let n=e;if(t!==void 0){let r=[...e];const o=n[t.src];t.src>t.dest?(r.splice(t.src,1),r.splice(t.dest,0,o)):(r.splice(t.dest+1,0,o),r.splice(t.src,1)),r=r.map((i,a)=>({...i,sticky:e[a].sticky})),n=r}return n}function mo(e,t){let n=0;const r=kc(e,t);for(let o=0;o<r.length;o++){const i=r[o];if(i.sticky)n+=i.width;else break}return n}function Wr(e,t,n){if(typeof n=="number")return t*n;{let r=0;for(let o=e-t;o<e;o++)r+=n(o);return r}}function Ds(e,t,n,r,o){const i=kc(e,r),a=[];for(const u of i)if(u.sticky)a.push(u);else break;if(a.length>0)for(const u of a)n-=u.width;let s=t,l=o??0;for(;l<=n&&s<i.length;)l+=i[s].width,s++;for(let u=t;u<s;u++){const d=i[u];d.sticky||a.push(d)}return a}function Vp(e,t,n){let r=0;for(const o of t){const i=o.sticky?r:r+(n??0);if(e<=i+o.width)return o.sourceIndex;r+=o.width}return-1}function Jp(e,t,n,r,o,i,a,s,l,u){const d=r+o;if(n&&e<=o)return-2;if(e<=d)return-1;let h=t;for(let m=0;m<u;m++){const y=i-1-m,x=typeof a=="number"?a:a(y);if(h-=x,e>=h)return y}const p=i-u,b=e-(l??0);if(typeof a=="number"){const m=Math.floor((b-d)/a)+s;return m>=p?void 0:m}else{let m=d;for(let y=s;y<p;y++){const x=a(y);if(b<=m+x)return y;m+=x}return}}let Ii=0,Yo={};const Qp=typeof window>"u";async function Zp(){var e;Qp||((e=document==null?void 0:document.fonts)==null?void 0:e.ready)===void 0||(await document.fonts.ready,Ii=0,Yo={},Lp())}Zp();function Sc(e,t,n,r){return`${e}_${r??(t==null?void 0:t.font)}_${n}`}function Ki(e,t,n,r="middle"){const o=Sc(e,t,r,n);let i=Yo[o];return i===void 0&&(i=t.measureText(e),Yo[o]=i,Ii++),Ii>1e4&&(Yo={},Ii=0),i}function eb(e,t){const n=Sc(e,void 0,"middle",t);return Yo[n]}function wo(e,t){return typeof t!="string"&&(t=t.baseFontFull),tb(e,t)}function nl(e,t){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZ";e.save(),e.textBaseline=t;const r=e.measureText(n);return e.restore(),r}const rl=[];function tb(e,t){for(const i of rl)if(i.key===t)return i.val;const n=nl(e,"alphabetic"),o=-(nl(e,"middle").actualBoundingBoxDescent-n.actualBoundingBoxDescent)+n.actualBoundingBoxAscent/2;return rl.push({key:t,val:o}),o}function nb(e,t,n,r,o,i){const{ctx:a,rect:s,theme:l}=e;let u=Number.MAX_SAFE_INTEGER;const d=500;if(t!==void 0&&(u=n-t,u<d)){const h=1-u/d;a.globalAlpha=h,a.fillStyle=l.bgSearchResult,a.fillRect(s.x+1,s.y+1,s.width-(o?2:1),s.height-(i?2:1)),a.globalAlpha=1,r!==void 0&&(r.fillStyle=l.bgSearchResult)}return u<d}function Rc(e,t,n){const{ctx:r,theme:o}=e,i=t??{},a=n??o.textDark;return a!==i.fillStyle&&(r.fillStyle=a,i.fillStyle=a),i}function Mc(e,t,n,r,o,i,a,s,l){l==="right"?e.fillText(t,n+o-(s.cellHorizontalPadding+.5),r+i/2+a):l==="center"?e.fillText(t,n+o/2,r+i/2+a):e.fillText(t,n+s.cellHorizontalPadding+.5,r+i/2+a)}function rb(e,t){const n=Ki("ABCi09jgqpy",e,t);return n.actualBoundingBoxAscent+n.actualBoundingBoxDescent}function ob(e,t){e.includes(`
|
|
5
|
+
`)&&(e=e.split(/\r?\n/,1)[0]);const n=t/4;return e.length>n&&(e=e.slice(0,n)),e}function ib(e,t,n,r,o,i,a,s,l,u){const d=s.baseFontFull,h=Up(e,t,d,o-s.cellHorizontalPadding*2,u??!1),p=rb(e,d),b=s.lineHeight*p,m=p+b*(h.length-1),y=m+s.cellVerticalPadding>i;y&&(e.save(),e.rect(n,r,o,i),e.clip());const x=r+i/2-m/2;let C=Math.max(r+s.cellVerticalPadding,x);for(const w of h)if(Mc(e,w,n,C,o,p,a,s,l),C+=b,C>r+i)break;y&&e.restore()}function Ic(e,t,n,r,o){const{ctx:i,rect:a,theme:s}=e,{x:l,y:u,width:d,height:h}=a;r=r??!1,r||(t=ob(t,d));const p=wo(i,s),b=ea(t)==="rtl";if(n===void 0&&b&&(n="right"),b&&(i.direction="rtl"),t.length>0){let m=!1;n==="right"?(i.textAlign="right",m=!0):n!==void 0&&n!=="left"&&(i.textAlign=n,m=!0),r?ib(i,t,l,u,d,h,p,s,n,o):Mc(i,t,l,u,d,h,p,s,n),m&&(i.textAlign="start"),b&&(i.direction="inherit")}}function uo(e,t,n,r,o,i){typeof i=="number"&&(i={tl:i,tr:i,br:i,bl:i}),i={tl:Math.max(0,Math.min(i.tl,o/2,r/2)),tr:Math.max(0,Math.min(i.tr,o/2,r/2)),bl:Math.max(0,Math.min(i.bl,o/2,r/2)),br:Math.max(0,Math.min(i.br,o/2,r/2))},e.moveTo(t+i.tl,n),e.arcTo(t+r,n,t+r,n+i.tr,i.tr),e.arcTo(t+r,n+o,t+r-i.br,n+o,i.br),e.arcTo(t,n+o,t,n+o-i.bl,i.bl),e.arcTo(t,n,t+i.tl,n,i.tl)}function sb(e,t,n){e.arc(t,n-1.25*3.5,1.25,0,2*Math.PI,!1),e.arc(t,n,1.25,0,2*Math.PI,!1),e.arc(t,n+1.25*3.5,1.25,0,2*Math.PI,!1)}function ab(e,t,n){const r=function(s,l){const u=l.x-s.x,d=l.y-s.y,h=Math.sqrt(u*u+d*d),p=u/h,b=d/h;return{x:u,y:l.y-s.y,len:h,nx:p,ny:b,ang:Math.atan2(b,p)}};let o;const i=t.length;let a=t[i-1];for(let s=0;s<i;s++){let l=t[s%i];const u=t[(s+1)%i],d=r(l,a),h=r(l,u),p=d.nx*h.ny-d.ny*h.nx,b=d.nx*h.nx-d.ny*-h.ny;let m=Math.asin(p<-1?-1:p>1?1:p),y=1,x=!1;b<0?m<0?m=Math.PI+m:(m=Math.PI-m,y=-1,x=!0):m>0&&(y=-1,x=!0),o=l.radius!==void 0?l.radius:n;const C=m/2;let w=Math.abs(Math.cos(C)*o/Math.sin(C)),I;w>Math.min(d.len/2,h.len/2)?(w=Math.min(d.len/2,h.len/2),I=Math.abs(w*Math.sin(C)/Math.cos(C))):I=o;let W=l.x+h.nx*w,B=l.y+h.ny*w;W+=-h.ny*I*y,B+=h.nx*I*y,e.arc(W,B,I,d.ang+Math.PI/2*y,h.ang-Math.PI/2*y,x),a=l,l=u}e.closePath()}function $s(e,t,n,r,o,i,a,s,l,u,d,h,p,b,m){const y={x:0,y:i+u,width:0,height:0};if(e>=b.length||t>=d||t<-2||e<0)return y;const x=i-o;if(e>=h){const C=a>e?-1:1,w=mo(b);y.x+=w+l;for(let I=a;I!==e;I+=C)y.x+=b[C===1?I:I-1].width*C}else for(let C=0;C<e;C++)y.x+=b[C].width;if(y.width=b[e].width+1,t===-1)y.y=o,y.height=x;else if(t===-2){y.y=0,y.height=o;let C=e;const w=b[e].group,I=b[e].sticky;for(;C>0&&Jo(b[C-1].group,w)&&b[C-1].sticky===I;){const B=b[C-1];y.x-=B.width,y.width+=B.width,C--}let W=e;for(;W+1<b.length&&Jo(b[W+1].group,w)&&b[W+1].sticky===I;){const B=b[W+1];y.width+=B.width,W++}if(!I){const B=mo(b),$=y.x-B;$<0&&(y.x-=$,y.width+=$),y.x+y.width>n&&(y.width=n-y.x)}}else if(t>=d-p){let C=d-t;for(y.y=r;C>0;){const w=t+C-1;y.height=typeof m=="number"?m:m(w),y.y-=y.height,C--}y.height+=1}else{const C=s>t?-1:1;if(typeof m=="number"){const w=t-s;y.y+=w*m}else for(let w=s;w!==t;w+=C)y.y+=m(w)*C;y.height=(typeof m=="number"?m:m(t))+1}return y}const ta=1<<21;function nr(e,t){return(t+2)*ta+e}function Ec(e){return e%ta}function na(e){return Math.floor(e/ta)-2}function Tc(e){const t=Ec(e),n=na(e);return[t,n]}class lb{constructor(){Ue(this,"visibleWindow",{x:0,y:0,width:0,height:0});Ue(this,"freezeCols",0);Ue(this,"freezeRows",[]);Ue(this,"isInWindow",t=>{const n=Ec(t),r=na(t),o=this.visibleWindow,i=n>=o.x&&n<=o.x+o.width||n<this.freezeCols,a=r>=o.y&&r<=o.y+o.height||this.freezeRows.includes(r);return i&&a})}setWindow(t,n,r){this.visibleWindow.x===t.x&&this.visibleWindow.y===t.y&&this.visibleWindow.width===t.width&&this.visibleWindow.height===t.height&&this.freezeCols===n&&go(this.freezeRows,r)||(this.visibleWindow=t,this.freezeCols=n,this.freezeRows=r,this.clearOutOfWindow())}}class cb extends lb{constructor(){super(...arguments);Ue(this,"cache",new Map);Ue(this,"setValue",(n,r)=>{this.cache.set(nr(n[0],n[1]),r)});Ue(this,"getValue",n=>this.cache.get(nr(n[0],n[1])));Ue(this,"clearOutOfWindow",()=>{for(const[n]of this.cache.entries())this.isInWindow(n)||this.cache.delete(n)})}}class Ei{constructor(t=[]){Ue(this,"cells");this.cells=new Set(t.map(n=>nr(n[0],n[1])))}add(t){this.cells.add(nr(t[0],t[1]))}has(t){return t===void 0?!1:this.cells.has(nr(t[0],t[1]))}remove(t){this.cells.delete(nr(t[0],t[1]))}clear(){this.cells.clear()}get size(){return this.cells.size}hasHeader(){for(const t of this.cells)if(na(t)<0)return!0;return!1}hasItemInRectangle(t){for(let n=t.y;n<t.y+t.height;n++)for(let r=t.x;r<t.x+t.width;r++)if(this.cells.has(nr(r,n)))return!0;return!1}hasItemInRegion(t){for(const n of t)if(this.hasItemInRectangle(n))return!0;return!1}*values(){for(const t of this.cells)yield Tc(t)}}function ub(e){return{"--gdg-accent-color":e.accentColor,"--gdg-accent-fg":e.accentFg,"--gdg-accent-light":e.accentLight,"--gdg-text-dark":e.textDark,"--gdg-text-medium":e.textMedium,"--gdg-text-light":e.textLight,"--gdg-text-bubble":e.textBubble,"--gdg-bg-icon-header":e.bgIconHeader,"--gdg-fg-icon-header":e.fgIconHeader,"--gdg-text-header":e.textHeader,"--gdg-text-group-header":e.textGroupHeader??e.textHeader,"--gdg-bg-group-header":e.bgGroupHeader??e.bgHeader,"--gdg-bg-group-header-hovered":e.bgGroupHeaderHovered??e.bgHeaderHovered,"--gdg-text-header-selected":e.textHeaderSelected,"--gdg-bg-cell":e.bgCell,"--gdg-bg-cell-medium":e.bgCellMedium,"--gdg-bg-header":e.bgHeader,"--gdg-bg-header-has-focus":e.bgHeaderHasFocus,"--gdg-bg-header-hovered":e.bgHeaderHovered,"--gdg-bg-bubble":e.bgBubble,"--gdg-bg-bubble-selected":e.bgBubbleSelected,"--gdg-bubble-height":`${e.bubbleHeight}px`,"--gdg-bubble-padding":`${e.bubblePadding}px`,"--gdg-bubble-margin":`${e.bubbleMargin}px`,"--gdg-bg-search-result":e.bgSearchResult,"--gdg-border-color":e.borderColor,"--gdg-horizontal-border-color":e.horizontalBorderColor??e.borderColor,"--gdg-drilldown-border":e.drilldownBorder,"--gdg-link-color":e.linkColor,"--gdg-cell-horizontal-padding":`${e.cellHorizontalPadding}px`,"--gdg-cell-vertical-padding":`${e.cellVerticalPadding}px`,"--gdg-header-font-style":e.headerFontStyle,"--gdg-base-font-style":e.baseFontStyle,"--gdg-marker-font-style":e.markerFontStyle,"--gdg-font-family":e.fontFamily,"--gdg-editor-font-size":e.editorFontSize,"--gdg-checkbox-max-size":`${e.checkboxMaxSize}px`,...e.resizeIndicatorColor===void 0?{}:{"--gdg-resize-indicator-color":e.resizeIndicatorColor},...e.headerBottomBorderColor===void 0?{}:{"--gdg-header-bottom-border-color":e.headerBottomBorderColor},...e.roundingRadius===void 0?{}:{"--gdg-rounding-radius":`${e.roundingRadius}px`}}}const Dc={accentColor:"#4F5DFF",accentFg:"#FFFFFF",accentLight:"rgba(62, 116, 253, 0.1)",textDark:"#313139",textMedium:"#737383",textLight:"#B2B2C0",textBubble:"#313139",bgIconHeader:"#737383",fgIconHeader:"#FFFFFF",textHeader:"#313139",textGroupHeader:"#313139BB",textHeaderSelected:"#FFFFFF",bgCell:"#FFFFFF",bgCellMedium:"#FAFAFB",bgHeader:"#F7F7F8",bgHeaderHasFocus:"#E9E9EB",bgHeaderHovered:"#EFEFF1",bgBubble:"#EDEDF3",bgBubbleSelected:"#FFFFFF",bubbleHeight:20,bubblePadding:6,bubbleMargin:4,bgSearchResult:"#fff9e3",borderColor:"rgba(115, 116, 131, 0.16)",drilldownBorder:"rgba(0, 0, 0, 0)",linkColor:"#353fb5",cellHorizontalPadding:8,cellVerticalPadding:3,headerIconSize:18,headerFontStyle:"600 13px",baseFontStyle:"13px",markerFontStyle:"9px",fontFamily:"Inter, Roboto, -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Ubuntu, noto, arial, sans-serif",editorFontSize:"13px",lineHeight:1.4,checkboxMaxSize:18};function $c(){return Dc}const db=Bt.createContext(Dc);function rr(e,...t){const n={...e};for(const r of t)if(r!==void 0)for(const o in r)r.hasOwnProperty(o)&&(o==="bgCell"?n[o]=yn(r[o],n[o]):n[o]=r[o]);return(n.headerFontFull===void 0||e.fontFamily!==n.fontFamily||e.headerFontStyle!==n.headerFontStyle)&&(n.headerFontFull=`${n.headerFontStyle} ${n.fontFamily}`),(n.baseFontFull===void 0||e.fontFamily!==n.fontFamily||e.baseFontStyle!==n.baseFontStyle)&&(n.baseFontFull=`${n.baseFontStyle} ${n.fontFamily}`),(n.markerFontFull===void 0||e.fontFamily!==n.fontFamily||e.markerFontStyle!==n.markerFontStyle)&&(n.markerFontFull=`${n.markerFontStyle} ${n.fontFamily}`),n}const As=150;function fb(e,t,n,r){var i;const o=r(t);return((i=o==null?void 0:o.measure)==null?void 0:i.call(o,e,t,n))??As}function Ac(e,t,n,r,o,i,a,s,l){let u=0;const d=o===void 0?[]:o.map(b=>{const m=fb(e,b[r],t,l);return u=Math.max(u,m),m});if(d.length>5&&s){u=0;let b=0;for(const y of d)b+=y;const m=b/d.length;for(let y=0;y<d.length;y++)d[y]>=m*2?d[y]=0:u=Math.max(u,d[y])}const h=e.font;e.font=t.headerFontFull,u=Math.max(u,e.measureText(n.title).width+t.cellHorizontalPadding*2+(n.icon===void 0?0:28)),e.font=h;const p=Math.max(Math.ceil(i),Math.min(Math.floor(a),Math.ceil(u)));return{...n,width:p}}function hb(e,t,n,r,o,i,a,s,l){const u=c.useRef(t),d=c.useRef(n),h=c.useRef(a);u.current=t,d.current=n,h.current=a;const[p,b]=c.useMemo(()=>{if(typeof window>"u")return[null,null];const w=document.createElement("canvas");return w.style.display="none",w.style.opacity="0",w.style.position="fixed",[w,w.getContext("2d",{alpha:!1})]},[]);c.useLayoutEffect(()=>(p&&document.documentElement.append(p),()=>{p==null||p.remove()}),[p]);const m=c.useRef({}),y=c.useRef(),[x,C]=c.useState();return c.useLayoutEffect(()=>{const w=d.current;if(w===void 0||e.every(vi))return;let I=Math.max(1,10-Math.floor(e.length/1e4)),W=0;I<u.current&&I>1&&(I--,W=1);const B={x:0,y:0,width:e.length,height:Math.min(u.current,I)},$={x:0,y:u.current-1,width:e.length,height:1};(async()=>{const V=w(B,l.signal),R=W>0?w($,l.signal):void 0;let A;typeof V=="object"?A=V:A=await Xa(V),R!==void 0&&(typeof R=="object"?A=[...A,...R]:A=[...A,...await Xa(R)]),y.current=e,C(A)})()},[l.signal,e]),c.useMemo(()=>{let I=e.every(vi)?e:b===null?e.map(L=>vi(L)?L:{...L,width:As}):(b.font=h.current.baseFontFull,e.map((L,V)=>{if(vi(L))return L;if(m.current[L.id]!==void 0)return{...L,width:m.current[L.id]};if(x===void 0||y.current!==e||L.id===void 0)return{...L,width:As};const R=Ac(b,a,L,V,x,o,i,!0,s);return m.current[L.id]=R.width,R})),W=0,B=0;const $=[];for(const[L,V]of I.entries())W+=V.width,V.grow!==void 0&&V.grow>0&&(B+=V.grow,$.push(L));if(W<r&&$.length>0){const L=[...I],V=r-W;let R=V;for(let A=0;A<$.length;A++){const H=$[A],j=(I[H].grow??0)/B,F=A===$.length-1?R:Math.min(R,Math.floor(V*j));L[H]={...I[H],growOffset:F,width:I[H].width+F},R-=F}I=L}return{sizedColumns:I,nonGrowWidth:W}},[r,e,b,x,a,o,i,s])}function gb(e,t,n){return e===e&&(n!==void 0&&(e=e<=n?e:n),t!==void 0&&(e=e>=t?e:t)),e}var mb=gb,pb=mb,gs=Zs;function bb(e,t,n){return n===void 0&&(n=t,t=void 0),n!==void 0&&(n=gs(n),n=n===n?n:0),t!==void 0&&(t=gs(t),t=t===t?t:0),pb(gs(e),t,n)}var yb=bb;const In=Lr(yb);var vb="__lodash_hash_undefined__";function wb(e){return this.__data__.set(e,vb),this}var xb=wb;function Cb(e){return this.__data__.has(e)}var kb=Cb,Sb=Xs,Rb=xb,Mb=kb;function _i(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new Sb;++t<n;)this.add(e[t])}_i.prototype.add=_i.prototype.push=Rb;_i.prototype.has=Mb;var Fc=_i;function Ib(e,t,n,r){for(var o=e.length,i=n+(r?1:-1);r?i--:++i<o;)if(t(e[i],i,e))return i;return-1}var Eb=Ib;function Tb(e){return e!==e}var Db=Tb;function $b(e,t,n){for(var r=n-1,o=e.length;++r<o;)if(e[r]===t)return r;return-1}var Ab=$b,Fb=Eb,_b=Db,Pb=Ab;function Ob(e,t,n){return t===t?Pb(e,t,n):Fb(e,_b,n)}var jb=Ob,Nb=jb;function Hb(e,t){var n=e==null?0:e.length;return!!n&&Nb(e,t,0)>-1}var Bb=Hb;function Lb(e,t,n){for(var r=-1,o=e==null?0:e.length;++r<o;)if(n(t,e[r]))return!0;return!1}var zb=Lb;function Wb(e,t){return e.has(t)}var _c=Wb,Gb=zr,Ub=Vn,Xb=Gb(Ub,"Set"),Pc=Xb;function Kb(){}var Yb=Kb;function qb(e){var t=-1,n=Array(e.size);return e.forEach(function(r){n[++t]=r}),n}var ra=qb,ms=Pc,Vb=Yb,Jb=ra,Qb=1/0,Zb=ms&&1/Jb(new ms([,-0]))[1]==Qb?function(e){return new ms(e)}:Vb,ey=Zb,ty=Fc,ny=Bb,ry=zb,oy=_c,iy=ey,sy=ra,ay=200;function ly(e,t,n){var r=-1,o=ny,i=e.length,a=!0,s=[],l=s;if(n)a=!1,o=ry;else if(i>=ay){var u=t?null:iy(e);if(u)return sy(u);a=!1,o=oy,l=new ty}else l=t?[]:s;e:for(;++r<i;){var d=e[r],h=t?t(d):d;if(d=n||d!==0?d:0,a&&h===h){for(var p=l.length;p--;)if(l[p]===h)continue e;t&&l.push(h),s.push(d)}else o(l,h,n)||(l!==s&&l.push(h),s.push(d))}return s}var cy=ly,uy=cy;function dy(e){return e&&e.length?uy(e):[]}var fy=dy;const hy=Lr(fy);function gy(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}var Oc=gy,ol=ti,my=Ys,py=qn,il=ol?ol.isConcatSpreadable:void 0;function by(e){return py(e)||my(e)||!!(il&&e&&e[il])}var yy=by,vy=Oc,wy=yy;function jc(e,t,n,r,o){var i=-1,a=e.length;for(n||(n=wy),o||(o=[]);++i<a;){var s=e[i];t>0&&n(s)?t>1?jc(s,t-1,n,r,o):vy(o,s):r||(o[o.length]=s)}return o}var xy=jc,Cy=xy;function ky(e){var t=e==null?0:e.length;return t?Cy(e,1):[]}var Sy=ky;const sl=Lr(Sy);var Ry=Math.ceil,My=Math.max;function Iy(e,t,n,r){for(var o=-1,i=My(Ry((t-e)/(n||1)),0),a=Array(i);i--;)a[r?i:++o]=e,e+=n;return a}var Ey=Iy,Ty=ac,Dy=Vs;function $y(e){return e!=null&&Dy(e.length)&&!Ty(e)}var oa=$y,Ay=Gs,Fy=oa,_y=qs,Py=po;function Oy(e,t,n){if(!Py(n))return!1;var r=typeof t;return(r=="number"?Fy(n)&&_y(t,n.length):r=="string"&&t in n)?Ay(n[t],e):!1}var jy=Oy,Ny=Zs,al=1/0,Hy=17976931348623157e292;function By(e){if(!e)return e===0?e:0;if(e=Ny(e),e===al||e===-al){var t=e<0?-1:1;return t*Hy}return e===e?e:0}var Ly=By,zy=Ey,Wy=jy,ps=Ly;function Gy(e){return function(t,n,r){return r&&typeof r!="number"&&Wy(t,n,r)&&(n=r=void 0),t=ps(t),n===void 0?(n=t,t=0):n=ps(n),r=r===void 0?t<n?1:-1:ps(r),zy(t,n,r,e)}}var Uy=Gy,Xy=Uy,Ky=Xy(),Yy=Ky;const Hr=Lr(Yy);function qy(e,t){return e==="normal"?[t.bgIconHeader,t.fgIconHeader]:e==="selected"?["white",t.accentColor]:[t.accentColor,t.bgHeader]}class Vy{constructor(t,n){Ue(this,"onSettled");Ue(this,"spriteMap",new Map);Ue(this,"headerIcons");Ue(this,"inFlight",0);this.onSettled=n,this.headerIcons=t??{}}drawSprite(t,n,r,o,i,a,s,l=1){const[u,d]=qy(n,s),h=a*Math.ceil(window.devicePixelRatio),p=`${u}_${d}_${h}_${t}`;let b=this.spriteMap.get(p);if(b===void 0){const m=this.headerIcons[t];if(m===void 0)return;b=document.createElement("canvas");const y=b.getContext("2d");if(y===null)return;const x=new Image;x.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(m({fgColor:d,bgColor:u}))}`,this.spriteMap.set(p,b);const C=x.decode();if(C===void 0)return;this.inFlight++,C.then(()=>{y.drawImage(x,0,0,h,h)}).finally(()=>{this.inFlight--,this.inFlight===0&&this.onSettled()})}else l<1&&(r.globalAlpha=l),r.drawImage(b,0,0,h,h,o,i,a,a),l<1&&(r.globalAlpha=1)}}function Nc(e){if(e.length===0)return;let t;for(const n of e)t=Math.min(t??n.y,n.y);return t}function Yi(e,t,n,r,o,i,a,s,l){s=s??t;let u=t,d=e;const h=r-i;let p=!1;for(;u<n&&d<h;){const b=o(d);if(u+b>s&&l(u,d,b,!1,a&&d===r-1)===!0){p=!0;break}u+=b,d++}if(!p){u=n;for(let b=0;b<i;b++){d=r-1-b;const m=o(d);u-=m,l(u,d,m,!0,a&&d===r-1)}}}function kr(e,t,n,r,o,i){let a=0,s=0;const l=o+r;for(const u of e){const d=u.sticky?s:a+n;if(i(u,d,l,u.sticky?0:s,t)===!0)break;a+=u.width,s+=u.sticky?u.width:0}}function Hc(e,t,n,r,o){let i=0,a=0;for(let s=0;s<e.length;s++){const l=e[s];let u=s+1,d=l.width;for(l.sticky&&(a+=d);u<e.length&&Jo(e[u].group,l.group)&&e[u].sticky===e[s].sticky;){const y=e[u];d+=y.width,u++,s++,y.sticky&&(a+=y.width)}const h=l.sticky?0:n,p=i+h,b=l.sticky?0:Math.max(0,a-p),m=Math.min(d-b,t-(p+b));o([l.sourceIndex,e[u-1].sourceIndex],l.group??"",p+b,0,m,r),i+=d}}function Bc(e,t,n,r,o,i,a){var p;const[s,l]=e;let u,d;const h=((p=a.find(b=>!b.sticky))==null?void 0:p.sourceIndex)??0;if(l>h){const b=Math.max(s,h);let m=t,y=r;for(let x=i.sourceIndex-1;x>=b;x--)m-=a[x].width,y+=a[x].width;for(let x=i.sourceIndex+1;x<=l;x++)y+=a[x].width;d={x:m,y:n,width:y,height:o}}if(h>s){const b=Math.min(l,h-1);let m=t,y=r;for(let x=i.sourceIndex-1;x>=s;x--)m-=a[x].width,y+=a[x].width;for(let x=i.sourceIndex+1;x<=b;x++)y+=a[x].width;u={x:m,y:n,width:y,height:o}}return[u,d]}function Jy(e,t,n,r){if(r==="any")return Lc(e,{x:t,y:n,width:1,height:1});if(r==="vertical"&&(t=e.x),r==="horizontal"&&(n=e.y),xc([t,n],e))return;const o=t-e.x,i=e.x+e.width-t,a=n-e.y+1,s=e.y+e.height-n,l=Math.min(r==="vertical"?Number.MAX_SAFE_INTEGER:o,r==="vertical"?Number.MAX_SAFE_INTEGER:i,r==="horizontal"?Number.MAX_SAFE_INTEGER:a,r==="horizontal"?Number.MAX_SAFE_INTEGER:s);return l===s?{x:e.x,y:e.y+e.height,width:e.width,height:n-e.y-e.height+1}:l===a?{x:e.x,y:n,width:e.width,height:e.y-n}:l===i?{x:e.x+e.width,y:e.y,width:t-e.x-e.width+1,height:e.height}:{x:t,y:e.y,width:e.x-t,height:e.height}}function Qo(e,t,n,r,o,i,a,s){return e<=o+a&&o<=e+n&&t<=i+s&&i<=t+r}function fo(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function Lc(e,t){const n=Math.min(e.x,t.x),r=Math.min(e.y,t.y),o=Math.max(e.x+e.width,t.x+t.width)-n,i=Math.max(e.y+e.height,t.y+t.height)-r;return{x:n,y:r,width:o,height:i}}function Qy(e,t){return e.x<=t.x&&e.y<=t.y&&e.x+e.width>=t.x+t.width&&e.y+e.height>=t.y+t.height}function Zy(e,t,n,r){if(e.x>t||e.y>n||e.x<0&&e.y<0&&e.x+e.width>t&&e.y+e.height>n)return;if(e.x>=0&&e.y>=0&&e.x+e.width<=t&&e.y+e.height<=n)return e;const o=-4,i=-4,a=t+4,s=n+4,l=o-e.x,u=e.x+e.width-a,d=i-e.y,h=e.y+e.height-s,p=l>0?e.x+Math.floor(l/r)*r:e.x,b=u>0?e.x+e.width-Math.floor(u/r)*r:e.x+e.width,m=d>0?e.y+Math.floor(d/r)*r:e.y,y=h>0?e.y+e.height-Math.floor(h/r)*r:e.y+e.height;return{x:p,y:m,width:b-p,height:y-m}}function e0(e,t,n,r,o){const[i,a,s,l]=t,[u,d,h,p]=o,{x:b,y:m,width:y,height:x}=e,C=[];if(y<=0||x<=0)return C;const w=b+y,I=m+x,W=b<i,B=m<a,$=b+y>s,L=m+x>l,V=b>=i&&b<s||w>i&&w<=s||b<i&&w>s,R=m>=a&&m<l||I>a&&I<=l||m<a&&I>l;if(V&&R){const H=Math.max(b,i),j=Math.max(m,a),F=Math.min(w,s),T=Math.min(I,l);C.push({rect:{x:H,y:j,width:F-H,height:T-j},clip:{x:u,y:d,width:h-u+1,height:p-d+1}})}if(W&&B){const H=b,j=m,F=Math.min(w,i),T=Math.min(I,a);C.push({rect:{x:H,y:j,width:F-H,height:T-j},clip:{x:0,y:0,width:u+1,height:d+1}})}if(B&&V){const H=Math.max(b,i),j=m,F=Math.min(w,s),T=Math.min(I,a);C.push({rect:{x:H,y:j,width:F-H,height:T-j},clip:{x:u,y:0,width:h-u+1,height:d+1}})}if(B&&$){const H=Math.max(b,s),j=m,F=w,T=Math.min(I,a);C.push({rect:{x:H,y:j,width:F-H,height:T-j},clip:{x:h,y:0,width:n-h+1,height:d+1}})}if(W&&R){const H=b,j=Math.max(m,a),F=Math.min(w,i),T=Math.min(I,l);C.push({rect:{x:H,y:j,width:F-H,height:T-j},clip:{x:0,y:d,width:u+1,height:p-d+1}})}if($&&R){const H=Math.max(b,s),j=Math.max(m,a),F=w,T=Math.min(I,l);C.push({rect:{x:H,y:j,width:F-H,height:T-j},clip:{x:h,y:d,width:n-h+1,height:p-d+1}})}if(W&&L){const H=b,j=Math.max(m,l),F=Math.min(w,i),T=I;C.push({rect:{x:H,y:j,width:F-H,height:T-j},clip:{x:0,y:p,width:u+1,height:r-p+1}})}if(L&&V){const H=Math.max(b,i),j=Math.max(m,l),F=Math.min(w,s),T=I;C.push({rect:{x:H,y:j,width:F-H,height:T-j},clip:{x:u,y:p,width:h-u+1,height:r-p+1}})}if($&&L){const H=Math.max(b,s),j=Math.max(m,l),F=w,T=I;C.push({rect:{x:H,y:j,width:F-H,height:T-j},clip:{x:h,y:p,width:n-h+1,height:r-p+1}})}return C}const t0={kind:ue.Loading,allowOverlay:!1};function ll(e,t,n,r,o,i,a,s,l,u,d,h,p,b,m,y,x,C,w,I,W,B,$,L,V,R,A,H,j,F,T,fe,G,Z,he){let de=(I==null?void 0:I.size)??Number.MAX_SAFE_INTEGER;const te=performance.now();let q=F.baseFontFull;e.font=q;const ve={ctx:e},ie=[0,0],re=x>0?Wr(l,x,u):0;let Te,J;const se=Nc(w);return kr(t,s,i,a,o,(ge,Be,Ce,st,at)=>{const De=Math.max(0,st-Be),_e=Be+De,Pe=o+1,xt=ge.width-De,Ct=r-o-1;if(w.length>0){let Xe=!1;for(let Ke=0;Ke<w.length;Ke++){const ze=w[Ke];if(Qo(_e,Pe,xt,Ct,ze.x,ze.y,ze.width,ze.height)){Xe=!0;break}}if(!Xe)return}const ft=()=>{e.save(),e.beginPath(),e.rect(_e,Pe,xt,Ct),e.clip()},oe=W.columns.hasIndex(ge.sourceIndex),ye=h(ge.group??"").overrideTheme,Ee=ge.themeOverride===void 0&&ye===void 0?F:rr(F,ye,ge.themeOverride),$e=Ee.baseFontFull;$e!==q&&(q=$e,e.font=$e),ft();let me;return Yi(at,Ce,r,l,u,x,C,se,(Xe,Ke,ze,ce,xe)=>{var We,Et,Yt;if(Ke<0||(ie[0]=ge.sourceIndex,ie[1]=Ke,I!==void 0&&!I.has(ie)))return;if(w.length>0){let Ve=!1;for(let Rt=0;Rt<w.length;Rt++){const nt=w[Rt];if(Qo(Be,Xe,ge.width,ze,nt.x,nt.y,nt.width,nt.height)){Ve=!0;break}}if(!Ve)return}const Ye=W.rows.hasIndex(Ke),le=b.hasIndex(Ke),tt=Ke<l?d(ie):t0;let pt=Be,Re=ge.width,Le=!1,ut=!1;if(tt.span!==void 0){const[Ve,Rt]=tt.span,nt=`${Ke},${Ve},${Rt},${ge.sticky}`;if(J===void 0&&(J=new Set),J.has(nt)){de--;return}else{const _t=Bc(tt.span,Be,Xe,ge.width,ze,ge,n),gt=ge.sticky?_t[0]:_t[1];if(!ge.sticky&&_t[0]!==void 0&&(ut=!0),gt!==void 0){pt=gt.x,Re=gt.width,J.add(nt),e.restore(),me=void 0,e.save(),e.beginPath();const zt=Math.max(0,st-gt.x);e.rect(gt.x+zt,Xe,gt.width-zt,ze),Te===void 0&&(Te=[]),Te.push({x:gt.x+zt,y:Xe,width:gt.width-zt,height:ze}),e.clip(),Le=!0}}}const Fe=p==null?void 0:p(Ke),bt=xe&&((We=ge.trailingRowOptions)==null?void 0:We.themeOverride)!==void 0?(Et=ge.trailingRowOptions)==null?void 0:Et.themeOverride:void 0,ht=tt.themeOverride===void 0&&Fe===void 0&&bt===void 0?Ee:rr(Ee,Fe,bt,tt.themeOverride);e.beginPath();const Dt=Yp(ie,tt,W);let Ot=qp(ie,tt,W,y);const rn=tt.span!==void 0&&W.columns.some(Ve=>tt.span!==void 0&&Ve>=tt.span[0]&&Ve<=tt.span[1]);Dt&&!m&&y?Ot=0:Dt&&y&&(Ot=Math.max(Ot,1)),rn&&Ot++,Dt||(Ye&&Ot++,oe&&!xe&&Ot++);const Kt=tt.kind===ue.Protected?ht.bgCellMedium:ht.bgCell;let yt;if((ce||Kt!==F.bgCell)&&(yt=yn(Kt,yt)),Ot>0||le){le&&(yt=yn(ht.bgHeader,yt));for(let Ve=0;Ve<Ot;Ve++)yt=yn(ht.accentLight,yt)}else if(B!==void 0){for(const Ve of B)if(Ve[0]===ge.sourceIndex&&Ve[1]===Ke){yt=yn(ht.bgSearchResult,yt);break}}if($!==void 0)for(let Ve=0;Ve<$.length;Ve++){const Rt=$[Ve],nt=Rt.range;Rt.style!=="solid-outline"&&nt.x<=ge.sourceIndex&&ge.sourceIndex<nt.x+nt.width&&nt.y<=Ke&&Ke<nt.y+nt.height&&(yt=yn(Rt.color,yt))}let Dn=!1;if(I!==void 0){const Ve=Xe+1,nt=(ce?Ve+ze-1:Math.min(Ve+ze-1,r-re))-Ve;(nt!==ze-1||pt+1<=st)&&(Dn=!0,e.save(),e.beginPath(),e.rect(pt+1,Ve,Re-1,nt),e.clip()),yt=yt===void 0?ht.bgCell:yn(yt,ht.bgCell)}const un=ge.sourceIndex===n.length-1,mt=Ke===l-1;yt!==void 0&&(e.fillStyle=yt,me!==void 0&&(me.fillStyle=yt),I!==void 0?e.fillRect(pt+1,Xe+1,Re-(un?2:1),ze-(mt?2:1)):e.fillRect(pt,Xe,Re,ze)),tt.style==="faded"&&(e.globalAlpha=.6);let Mt;for(let Ve=0;Ve<R.length;Ve++){const Rt=R[Ve];if(Rt.item[0]===ge.sourceIndex&&Rt.item[1]===Ke){Mt=Rt;break}}if(Re>he&&!ut){const Ve=ht.baseFontFull;Ve!==q&&(e.font=Ve,q=Ve),me=zc(e,tt,ge.sourceIndex,Ke,un,mt,pt,Xe,Re,ze,Ot>0,ht,yt??ht.bgCell,L,V,(Mt==null?void 0:Mt.hoverAmount)??0,A,j,te,H,me,T,fe,G,Z)}return Dn&&e.restore(),tt.style==="faded"&&(e.globalAlpha=1),de--,Le&&(e.restore(),(Yt=me==null?void 0:me.deprep)==null||Yt.call(me,ve),me=void 0,ft(),q=$e,e.font=$e),de<=0}),e.restore(),de<=0}),Te}const No=[0,0],Ho={x:0,y:0,width:0,height:0},bs=[void 0,()=>{}];let Fs=!1;function n0(){Fs=!0}function zc(e,t,n,r,o,i,a,s,l,u,d,h,p,b,m,y,x,C,w,I,W,B,$,L,V){var fe,G;let R,A;x!==void 0&&x[0][0]===n&&x[0][1]===r&&(R=x[1][0],A=x[1][1]);let H;No[0]=n,No[1]=r,Ho.x=a,Ho.y=s,Ho.width=l,Ho.height=u,bs[0]=$.getValue(No),bs[1]=Z=>$.setValue(No,Z),Fs=!1;const j={ctx:e,theme:h,col:n,row:r,cell:t,rect:Ho,highlighted:d,cellFillColor:p,hoverAmount:y,frameTime:w,hoverX:R,drawState:bs,hoverY:A,imageLoader:b,spriteManager:m,hyperWrapping:C,overrideCursor:R!==void 0?V:void 0,requestAnimationFrame:n0},F=nb(j,t.lastUpdated,w,W,o,i),T=L(t);if(T!==void 0){(W==null?void 0:W.renderer)!==T&&((fe=W==null?void 0:W.deprep)==null||fe.call(W,j),W=void 0);const Z=(G=T.drawPrep)==null?void 0:G.call(T,j,W);I!==void 0&&!ao(j.cell)?I(j,()=>T.draw(j,t)):T.draw(j,t),H=Z===void 0?void 0:{deprep:Z==null?void 0:Z.deprep,fillStyle:Z==null?void 0:Z.fillStyle,font:Z==null?void 0:Z.font,renderer:T}}return(F||Fs)&&(B==null||B(No)),H}function ia(e,t,n,r,o,i,a,s,l=-20,u=-20,d=void 0,h="center",p="square"){const b=Math.floor(o+a/2),m=p==="circle"?1e4:t.roundingRadius??4;let y=vc(d??t.checkboxMaxSize,a,t.cellVerticalPadding),x=y/2;const C=yc(h,r,i,t.cellHorizontalPadding,y),w=bc(C,b,y),I=wc(r+l,o+u,w);switch(n){case!0:{e.beginPath(),uo(e,C-y/2,b-y/2,y,y,m),p==="circle"&&(x*=.8,y*=.8),e.fillStyle=s?t.accentColor:t.textMedium,e.fill(),e.beginPath(),e.moveTo(C-x+y/4.23,b-x+y/1.97),e.lineTo(C-x+y/2.42,b-x+y/1.44),e.lineTo(C-x+y/1.29,b-x+y/3.25),e.strokeStyle=t.bgCell,e.lineJoin="round",e.lineCap="round",e.lineWidth=1.9,e.stroke();break}case $i:case!1:{e.beginPath(),uo(e,C-y/2+.5,b-y/2+.5,y-1,y-1,m),e.lineWidth=1,e.strokeStyle=I?t.textDark:t.textMedium,e.stroke();break}case Js:{e.beginPath(),uo(e,C-y/2,b-y/2,y,y,m),e.fillStyle=I?t.textMedium:t.textLight,e.fill(),p==="circle"&&(x*=.8,y*=.8),e.beginPath(),e.moveTo(C-y/3,b),e.lineTo(C+y/3,b),e.strokeStyle=t.bgCell,e.lineCap="round",e.lineWidth=1.9,e.stroke();break}default:Vo()}}function r0(e,t,n,r,o,i,a,s,l,u,d,h,p,b,m,y,x,C,w){var R,A,H,j;const I=a+s;if(I<=0)return;e.fillStyle=h.bgHeader,e.fillRect(0,0,o,I);const W=(R=r==null?void 0:r[0])==null?void 0:R[0],B=(A=r==null?void 0:r[0])==null?void 0:A[1],$=(H=r==null?void 0:r[1])==null?void 0:H[0],L=(j=r==null?void 0:r[1])==null?void 0:j[1],V=h.headerFontFull;e.font=V,kr(t,0,i,0,I,(F,T,fe,G)=>{var ge;if(x!==void 0&&!x.has([F.sourceIndex,-1]))return;const Z=Math.max(0,G-T);e.save(),e.beginPath(),e.rect(T+Z,s,F.width-Z,a),e.clip();const he=y(F.group??"").overrideTheme,de=F.themeOverride===void 0&&he===void 0?h:rr(h,he,F.themeOverride);de.bgHeader!==h.bgHeader&&(e.fillStyle=de.bgHeader,e.fill()),de!==h&&(e.font=de.headerFontFull);const te=d.columns.hasIndex(F.sourceIndex),q=l!==void 0||u||F.headerRowMarkerDisabled===!0,ve=!q&&B===-1&&W===F.sourceIndex,ie=q?0:((ge=b.find(Be=>Be.item[0]===F.sourceIndex&&Be.item[1]===-1))==null?void 0:ge.hoverAmount)??0,re=(d==null?void 0:d.current)!==void 0&&d.current.cell[0]===F.sourceIndex,Te=te?de.accentColor:re?de.bgHeaderHasFocus:de.bgHeader,J=n?s:0,se=F.sourceIndex===0?0:1;te?(e.fillStyle=Te,e.fillRect(T+se,J,F.width-se,a)):(re||ie>0)&&(e.beginPath(),e.rect(T+se,J,F.width-se,a),re&&(e.fillStyle=de.bgHeaderHasFocus,e.fill()),ie>0&&(e.globalAlpha=ie,e.fillStyle=de.bgHeaderHovered,e.fill(),e.globalAlpha=1)),Uc(e,T,J,F.width,a,F,te,de,ve,ve?$:void 0,ve?L:void 0,re,ie,p,C,w),e.restore()}),n&&o0(e,t,o,i,s,r,h,p,b,m,y,x)}function o0(e,t,n,r,o,i,a,s,l,u,d,h){const[b,m]=(i==null?void 0:i[0])??[];let y=0;Hc(t,n,r,o,(x,C,w,I,W,B)=>{if(h!==void 0&&!h.hasItemInRectangle({x:x[0],y:-2,width:x[1]-x[0]+1,height:1}))return;e.save(),e.beginPath(),e.rect(w,I,W,B),e.clip();const $=d(C),L=($==null?void 0:$.overrideTheme)===void 0?a:rr(a,$.overrideTheme),V=m===-2&&b!==void 0&&b>=x[0]&&b<=x[1],R=V?L.bgGroupHeaderHovered??L.bgHeaderHovered:L.bgGroupHeader??L.bgHeader;if(R!==a.bgHeader&&(e.fillStyle=R,e.fill()),e.fillStyle=L.textGroupHeader??L.textHeader,$!==void 0){let A=w;if($.icon!==void 0&&(s.drawSprite($.icon,"normal",e,A+8,(o-20)/2,20,L),A+=26),e.fillText($.name,A+8,o/2+wo(e,a.headerFontFull)),$.actions!==void 0&&V){const H=Wc({x:w,y:I,width:W,height:B},$.actions);e.beginPath();const j=H[0].x-10,F=w+W-j;e.rect(j,0,F,o);const T=e.createLinearGradient(j,0,j+F,0),fe=Br(R,0);T.addColorStop(0,fe),T.addColorStop(10/F,R),T.addColorStop(1,R),e.fillStyle=T,e.fill(),e.globalAlpha=.6;const[G,Z]=(i==null?void 0:i[1])??[-1,-1];for(let he=0;he<$.actions.length;he++){const de=$.actions[he],te=H[he],q=fo(te,G+w,Z);q&&(e.globalAlpha=1),s.drawSprite(de.icon,"normal",e,te.x+te.width/2-10,te.y+te.height/2-10,20,L),q&&(e.globalAlpha=.6)}e.globalAlpha=1}}w!==0&&u(x[0])&&(e.beginPath(),e.moveTo(w+.5,0),e.lineTo(w+.5,o),e.strokeStyle=a.borderColor,e.lineWidth=1,e.stroke()),e.restore(),y=w+W}),e.beginPath(),e.moveTo(y+.5,0),e.lineTo(y+.5,o),e.moveTo(0,o+.5),e.lineTo(n,o+.5),e.strokeStyle=a.borderColor,e.lineWidth=1,e.stroke()}const xi=30;function i0(e,t,n,r,o){return{x:e+n-xi,y:Math.max(t,t+r/2-xi/2),width:xi,height:Math.min(xi,r)}}function Wc(e,t){const n=[];let r=e.x+e.width-26*t.length;const o=e.y+e.height/2-13,i=26,a=26;for(let s=0;s<t.length;s++)n.push({x:r,y:o,width:a,height:i}),r+=26;return n}function Bo(e,t,n){return!n||e===void 0||(e.x=t-(e.x-t)-e.width),e}function Gc(e,t,n,r,o,i,a,s){var C;const l=a.cellHorizontalPadding,u=a.headerIconSize,d=i0(n,r,o,i);let h=n+l;const p=t.icon===void 0?void 0:{x:h,y:r+(i-u)/2,width:u,height:u},b=p===void 0||t.overlayIcon===void 0?void 0:{x:p.x+9,y:p.y+6,width:18,height:18};p!==void 0&&(h+=Math.ceil(u*1.3));const m={x:h,y:r,width:o-h,height:i};let y;if(t.indicatorIcon!==void 0){const w=e===void 0?((C=eb(t.title,a.headerFontFull))==null?void 0:C.width)??0:Ki(t.title,e,a.headerFontFull).width;m.width=w,h+=w+l,y={x:h,y:r+(i-u)/2,width:u,height:u}}const x=n+o/2;return{menuBounds:Bo(d,x,s),iconBounds:Bo(p,x,s),iconOverlayBounds:Bo(b,x,s),textBounds:Bo(m,x,s),indicatorIconBounds:Bo(y,x,s)}}function cl(e,t,n,r,o,i,a,s,l,u,d,h,p,b,m,y){if(i.rowMarker!==void 0&&i.headerRowMarkerDisabled!==!0){const w=i.rowMarkerChecked;w!==!0&&i.headerRowMarkerAlwaysVisible!==!0&&(e.globalAlpha=h);const I=i.headerRowMarkerTheme!==void 0?rr(s,i.headerRowMarkerTheme):s;ia(e,I,w,t,n,r,o,!1,void 0,void 0,s.checkboxMaxSize,"center",i.rowMarker),w!==!0&&i.headerRowMarkerAlwaysVisible!==!0&&(e.globalAlpha=1);return}const x=a?s.textHeaderSelected:s.textHeader,C=i.hasMenu===!0&&(l||b&&a)&&y.menuBounds!==void 0;if(i.icon!==void 0&&y.iconBounds!==void 0){let w=a?"selected":"normal";i.style==="highlight"&&(w=a?"selected":"special"),p.drawSprite(i.icon,w,e,y.iconBounds.x,y.iconBounds.y,y.iconBounds.width,s),i.overlayIcon!==void 0&&y.iconOverlayBounds!==void 0&&p.drawSprite(i.overlayIcon,a?"selected":"special",e,y.iconOverlayBounds.x,y.iconOverlayBounds.y,y.iconOverlayBounds.width,s)}if(C&&r>35){const I=m?35:r-35,W=m?35*.7:r-35*.7,B=I/r,$=W/r,L=e.createLinearGradient(t,0,t+r,0),V=Br(x,0);L.addColorStop(m?1:0,x),L.addColorStop(B,x),L.addColorStop($,V),L.addColorStop(m?0:1,V),e.fillStyle=L}else e.fillStyle=x;if(m&&(e.textAlign="right"),y.textBounds!==void 0&&e.fillText(i.title,m?y.textBounds.x+y.textBounds.width:y.textBounds.x,n+o/2+wo(e,s.headerFontFull)),m&&(e.textAlign="left"),i.indicatorIcon!==void 0&&y.indicatorIconBounds!==void 0&&(!C||!Qo(y.menuBounds.x,y.menuBounds.y,y.menuBounds.width,y.menuBounds.height,y.indicatorIconBounds.x,y.indicatorIconBounds.y,y.indicatorIconBounds.width,y.indicatorIconBounds.height))){let w=a?"selected":"normal";i.style==="highlight"&&(w=a?"selected":"special"),p.drawSprite(i.indicatorIcon,w,e,y.indicatorIconBounds.x,y.indicatorIconBounds.y,y.indicatorIconBounds.width,s)}if(C&&y.menuBounds!==void 0){const w=y.menuBounds,I=u!==void 0&&d!==void 0&&fo(w,u+t,d+n);if(I||(e.globalAlpha=.7),i.menuIcon===void 0||i.menuIcon===Ai.Triangle){e.beginPath();const W=w.x+w.width/2-5.5,B=w.y+w.height/2-3;ab(e,[{x:W,y:B},{x:W+11,y:B},{x:W+5.5,y:B+6}],1),e.fillStyle=x,e.fill()}else if(i.menuIcon===Ai.Dots){e.beginPath();const W=w.x+w.width/2,B=w.y+w.height/2;sb(e,W,B),e.fillStyle=x,e.fill()}else{const W=w.x+(w.width-s.headerIconSize)/2,B=w.y+(w.height-s.headerIconSize)/2;p.drawSprite(i.menuIcon,"normal",e,W,B,s.headerIconSize,s)}I||(e.globalAlpha=1)}}function Uc(e,t,n,r,o,i,a,s,l,u,d,h,p,b,m,y){const x=ea(i.title)==="rtl",C=Gc(e,i,t,n,r,o,s,x);m!==void 0?m({ctx:e,theme:s,rect:{x:t,y:n,width:r,height:o},column:i,columnIndex:i.sourceIndex,isSelected:a,hoverAmount:p,isHovered:l,hasSelectedCell:h,spriteManager:b,menuBounds:(C==null?void 0:C.menuBounds)??{x:0,y:0,height:0,width:0},hoverX:u,hoverY:d},()=>cl(e,t,n,r,o,i,a,s,l,u,d,p,b,y,x,C)):cl(e,t,n,r,o,i,a,s,l,u,d,p,b,y,x,C)}var s0=zr,a0=function(){try{var e=s0(Object,"defineProperty");return e({},"",{}),e}catch{}}(),l0=a0,ul=l0;function c0(e,t,n){t=="__proto__"&&ul?ul(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var u0=c0;function d0(e,t,n,r){for(var o=-1,i=e==null?0:e.length;++o<i;){var a=e[o];t(r,a,n(a),e)}return r}var f0=d0;function h0(e){return function(t,n,r){for(var o=-1,i=Object(t),a=r(t),s=a.length;s--;){var l=a[e?s:++o];if(n(i[l],l,i)===!1)break}return t}}var g0=h0,m0=g0,p0=m0(),b0=p0;function y0(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var v0=y0,Pi={exports:{}};function w0(){return!1}var x0=w0;Pi.exports;(function(e,t){var n=Vn,r=x0,o=t&&!t.nodeType&&t,i=o&&!0&&e&&!e.nodeType&&e,a=i&&i.exports===o,s=a?n.Buffer:void 0,l=s?s.isBuffer:void 0,u=l||r;e.exports=u})(Pi,Pi.exports);var Xc=Pi.exports,C0=ni,k0=Vs,S0=ri,R0="[object Arguments]",M0="[object Array]",I0="[object Boolean]",E0="[object Date]",T0="[object Error]",D0="[object Function]",$0="[object Map]",A0="[object Number]",F0="[object Object]",_0="[object RegExp]",P0="[object Set]",O0="[object String]",j0="[object WeakMap]",N0="[object ArrayBuffer]",H0="[object DataView]",B0="[object Float32Array]",L0="[object Float64Array]",z0="[object Int8Array]",W0="[object Int16Array]",G0="[object Int32Array]",U0="[object Uint8Array]",X0="[object Uint8ClampedArray]",K0="[object Uint16Array]",Y0="[object Uint32Array]",Tt={};Tt[B0]=Tt[L0]=Tt[z0]=Tt[W0]=Tt[G0]=Tt[U0]=Tt[X0]=Tt[K0]=Tt[Y0]=!0;Tt[R0]=Tt[M0]=Tt[N0]=Tt[I0]=Tt[H0]=Tt[E0]=Tt[T0]=Tt[D0]=Tt[$0]=Tt[A0]=Tt[F0]=Tt[_0]=Tt[P0]=Tt[O0]=Tt[j0]=!1;function q0(e){return S0(e)&&k0(e.length)&&!!Tt[C0(e)]}var V0=q0;function J0(e){return function(t){return e(t)}}var Q0=J0,Oi={exports:{}};Oi.exports;(function(e,t){var n=ic,r=t&&!t.nodeType&&t,o=r&&!0&&e&&!e.nodeType&&e,i=o&&o.exports===r,a=i&&n.process,s=function(){try{var l=o&&o.require&&o.require("util").types;return l||a&&a.binding&&a.binding("util")}catch{}}();e.exports=s})(Oi,Oi.exports);var Z0=Oi.exports,ev=V0,tv=Q0,dl=Z0,fl=dl&&dl.isTypedArray,nv=fl?tv(fl):ev,Kc=nv,rv=v0,ov=Ys,iv=qn,sv=Xc,av=qs,lv=Kc,cv=Object.prototype,uv=cv.hasOwnProperty;function dv(e,t){var n=iv(e),r=!n&&ov(e),o=!n&&!r&&sv(e),i=!n&&!r&&!o&&lv(e),a=n||r||o||i,s=a?rv(e.length,String):[],l=s.length;for(var u in e)(t||uv.call(e,u))&&!(a&&(u=="length"||o&&(u=="offset"||u=="parent")||i&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||av(u,l)))&&s.push(u);return s}var fv=dv,hv=Object.prototype;function gv(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||hv;return e===n}var mv=gv;function pv(e,t){return function(n){return e(t(n))}}var bv=pv,yv=bv,vv=yv(Object.keys,Object),wv=vv,xv=mv,Cv=wv,kv=Object.prototype,Sv=kv.hasOwnProperty;function Rv(e){if(!xv(e))return Cv(e);var t=[];for(var n in Object(e))Sv.call(e,n)&&n!="constructor"&&t.push(n);return t}var Mv=Rv,Iv=fv,Ev=Mv,Tv=oa;function Dv(e){return Tv(e)?Iv(e):Ev(e)}var sa=Dv,$v=b0,Av=sa;function Fv(e,t){return e&&$v(e,t,Av)}var _v=Fv,Pv=oa;function Ov(e,t){return function(n,r){if(n==null)return n;if(!Pv(n))return e(n,r);for(var o=n.length,i=t?o:-1,a=Object(n);(t?i--:++i<o)&&r(a[i],i,a)!==!1;);return n}}var jv=Ov,Nv=_v,Hv=jv,Bv=Hv(Nv),Lv=Bv,zv=Lv;function Wv(e,t,n,r){return zv(e,function(o,i,a){t(r,o,n(o),a)}),r}var Gv=Wv,Uv=Gi;function Xv(){this.__data__=new Uv,this.size=0}var Kv=Xv;function Yv(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}var qv=Yv;function Vv(e){return this.__data__.get(e)}var Jv=Vv;function Qv(e){return this.__data__.has(e)}var Zv=Qv,ew=Gi,tw=Us,nw=Xs,rw=200;function ow(e,t){var n=this.__data__;if(n instanceof ew){var r=n.__data__;if(!tw||r.length<rw-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new nw(r)}return n.set(e,t),this.size=n.size,this}var iw=ow,sw=Gi,aw=Kv,lw=qv,cw=Jv,uw=Zv,dw=iw;function xo(e){var t=this.__data__=new sw(e);this.size=t.size}xo.prototype.clear=aw;xo.prototype.delete=lw;xo.prototype.get=cw;xo.prototype.has=uw;xo.prototype.set=dw;var Yc=xo;function fw(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var hw=fw,gw=Fc,mw=hw,pw=_c,bw=1,yw=2;function vw(e,t,n,r,o,i){var a=n&bw,s=e.length,l=t.length;if(s!=l&&!(a&&l>s))return!1;var u=i.get(e),d=i.get(t);if(u&&d)return u==t&&d==e;var h=-1,p=!0,b=n&yw?new gw:void 0;for(i.set(e,t),i.set(t,e);++h<s;){var m=e[h],y=t[h];if(r)var x=a?r(y,m,h,t,e,i):r(m,y,h,e,t,i);if(x!==void 0){if(x)continue;p=!1;break}if(b){if(!mw(t,function(C,w){if(!pw(b,w)&&(m===C||o(m,C,n,r,i)))return b.push(w)})){p=!1;break}}else if(!(m===y||o(m,y,n,r,i))){p=!1;break}}return i.delete(e),i.delete(t),p}var qc=vw,ww=Vn,xw=ww.Uint8Array,Cw=xw;function kw(e){var t=-1,n=Array(e.size);return e.forEach(function(r,o){n[++t]=[o,r]}),n}var Sw=kw,hl=ti,gl=Cw,Rw=Gs,Mw=qc,Iw=Sw,Ew=ra,Tw=1,Dw=2,$w="[object Boolean]",Aw="[object Date]",Fw="[object Error]",_w="[object Map]",Pw="[object Number]",Ow="[object RegExp]",jw="[object Set]",Nw="[object String]",Hw="[object Symbol]",Bw="[object ArrayBuffer]",Lw="[object DataView]",ml=hl?hl.prototype:void 0,ys=ml?ml.valueOf:void 0;function zw(e,t,n,r,o,i,a){switch(n){case Lw:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case Bw:return!(e.byteLength!=t.byteLength||!i(new gl(e),new gl(t)));case $w:case Aw:case Pw:return Rw(+e,+t);case Fw:return e.name==t.name&&e.message==t.message;case Ow:case Nw:return e==t+"";case _w:var s=Iw;case jw:var l=r&Tw;if(s||(s=Ew),e.size!=t.size&&!l)return!1;var u=a.get(e);if(u)return u==t;r|=Dw,a.set(e,t);var d=Mw(s(e),s(t),r,o,i,a);return a.delete(e),d;case Hw:if(ys)return ys.call(e)==ys.call(t)}return!1}var Ww=zw,Gw=Oc,Uw=qn;function Xw(e,t,n){var r=t(e);return Uw(e)?r:Gw(r,n(e))}var Kw=Xw;function Yw(e,t){for(var n=-1,r=e==null?0:e.length,o=0,i=[];++n<r;){var a=e[n];t(a,n,e)&&(i[o++]=a)}return i}var qw=Yw;function Vw(){return[]}var Jw=Vw,Qw=qw,Zw=Jw,ex=Object.prototype,tx=ex.propertyIsEnumerable,pl=Object.getOwnPropertySymbols,nx=pl?function(e){return e==null?[]:(e=Object(e),Qw(pl(e),function(t){return tx.call(e,t)}))}:Zw,rx=nx,ox=Kw,ix=rx,sx=sa;function ax(e){return ox(e,sx,ix)}var lx=ax,bl=lx,cx=1,ux=Object.prototype,dx=ux.hasOwnProperty;function fx(e,t,n,r,o,i){var a=n&cx,s=bl(e),l=s.length,u=bl(t),d=u.length;if(l!=d&&!a)return!1;for(var h=l;h--;){var p=s[h];if(!(a?p in t:dx.call(t,p)))return!1}var b=i.get(e),m=i.get(t);if(b&&m)return b==t&&m==e;var y=!0;i.set(e,t),i.set(t,e);for(var x=a;++h<l;){p=s[h];var C=e[p],w=t[p];if(r)var I=a?r(w,C,p,t,e,i):r(C,w,p,e,t,i);if(!(I===void 0?C===w||o(C,w,n,r,i):I)){y=!1;break}x||(x=p=="constructor")}if(y&&!x){var W=e.constructor,B=t.constructor;W!=B&&"constructor"in e&&"constructor"in t&&!(typeof W=="function"&&W instanceof W&&typeof B=="function"&&B instanceof B)&&(y=!1)}return i.delete(e),i.delete(t),y}var hx=fx,gx=zr,mx=Vn,px=gx(mx,"DataView"),bx=px,yx=zr,vx=Vn,wx=yx(vx,"Promise"),xx=wx,Cx=zr,kx=Vn,Sx=Cx(kx,"WeakMap"),Rx=Sx,_s=bx,Ps=Us,Os=xx,js=Pc,Ns=Rx,Vc=ni,Co=lc,yl="[object Map]",Mx="[object Object]",vl="[object Promise]",wl="[object Set]",xl="[object WeakMap]",Cl="[object DataView]",Ix=Co(_s),Ex=Co(Ps),Tx=Co(Os),Dx=Co(js),$x=Co(Ns),Nr=Vc;(_s&&Nr(new _s(new ArrayBuffer(1)))!=Cl||Ps&&Nr(new Ps)!=yl||Os&&Nr(Os.resolve())!=vl||js&&Nr(new js)!=wl||Ns&&Nr(new Ns)!=xl)&&(Nr=function(e){var t=Vc(e),n=t==Mx?e.constructor:void 0,r=n?Co(n):"";if(r)switch(r){case Ix:return Cl;case Ex:return yl;case Tx:return vl;case Dx:return wl;case $x:return xl}return t});var Ax=Nr,vs=Yc,Fx=qc,_x=Ww,Px=hx,kl=Ax,Sl=qn,Rl=Xc,Ox=Kc,jx=1,Ml="[object Arguments]",Il="[object Array]",Ci="[object Object]",Nx=Object.prototype,El=Nx.hasOwnProperty;function Hx(e,t,n,r,o,i){var a=Sl(e),s=Sl(t),l=a?Il:kl(e),u=s?Il:kl(t);l=l==Ml?Ci:l,u=u==Ml?Ci:u;var d=l==Ci,h=u==Ci,p=l==u;if(p&&Rl(e)){if(!Rl(t))return!1;a=!0,d=!1}if(p&&!d)return i||(i=new vs),a||Ox(e)?Fx(e,t,n,r,o,i):_x(e,t,l,n,r,o,i);if(!(n&jx)){var b=d&&El.call(e,"__wrapped__"),m=h&&El.call(t,"__wrapped__");if(b||m){var y=b?e.value():e,x=m?t.value():t;return i||(i=new vs),o(y,x,n,r,i)}}return p?(i||(i=new vs),Px(e,t,n,r,o,i)):!1}var Bx=Hx,Lx=Bx,Tl=ri;function Jc(e,t,n,r,o){return e===t?!0:e==null||t==null||!Tl(e)&&!Tl(t)?e!==e&&t!==t:Lx(e,t,n,r,Jc,o)}var Qc=Jc,zx=Yc,Wx=Qc,Gx=1,Ux=2;function Xx(e,t,n,r){var o=n.length,i=o,a=!r;if(e==null)return!i;for(e=Object(e);o--;){var s=n[o];if(a&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++o<i;){s=n[o];var l=s[0],u=e[l],d=s[1];if(a&&s[2]){if(u===void 0&&!(l in e))return!1}else{var h=new zx;if(r)var p=r(u,d,l,e,t,h);if(!(p===void 0?Wx(d,u,Gx|Ux,r,h):p))return!1}}return!0}var Kx=Xx,Yx=po;function qx(e){return e===e&&!Yx(e)}var Zc=qx,Vx=Zc,Jx=sa;function Qx(e){for(var t=Jx(e),n=t.length;n--;){var r=t[n],o=e[r];t[n]=[r,o,Vx(o)]}return t}var Zx=Qx;function e1(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}var eu=e1,t1=Kx,n1=Zx,r1=eu;function o1(e){var t=n1(e);return t.length==1&&t[0][2]?r1(t[0][0],t[0][1]):function(n){return n===e||t1(n,e,t)}}var i1=o1,s1=dc,a1=Xi;function l1(e,t){t=s1(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[a1(t[n++])];return n&&n==r?e:void 0}var tu=l1,c1=tu;function u1(e,t,n){var r=e==null?void 0:c1(e,t);return r===void 0?n:r}var d1=u1;function f1(e,t){return e!=null&&t in Object(e)}var h1=f1,g1=h1,m1=hc;function p1(e,t){return e!=null&&m1(e,t,g1)}var b1=p1,y1=Qc,v1=d1,w1=b1,x1=Ws,C1=Zc,k1=eu,S1=Xi,R1=1,M1=2;function I1(e,t){return x1(e)&&C1(t)?k1(S1(e),t):function(n){var r=v1(n,e);return r===void 0&&r===t?w1(n,e):y1(t,r,R1|M1)}}var E1=I1;function T1(e){return e}var D1=T1;function $1(e){return function(t){return t==null?void 0:t[e]}}var A1=$1,F1=tu;function _1(e){return function(t){return F1(t,e)}}var P1=_1,O1=A1,j1=P1,N1=Ws,H1=Xi;function B1(e){return N1(e)?O1(H1(e)):j1(e)}var L1=B1,z1=i1,W1=E1,G1=D1,U1=qn,X1=L1;function K1(e){return typeof e=="function"?e:e==null?G1:typeof e=="object"?U1(e)?W1(e[0],e[1]):z1(e):X1(e)}var Y1=K1,q1=f0,V1=Gv,J1=Y1,Q1=qn;function Z1(e,t){return function(n,r){var o=Q1(n)?q1:V1,i=t?t():{};return o(n,e,J1(r),i)}}var eC=Z1,tC=u0,nC=eC,rC=Object.prototype,oC=rC.hasOwnProperty,iC=nC(function(e,t,n){oC.call(e,n)?e[n].push(t):tC(e,n,[t])}),sC=iC;const aC=Lr(sC);function lC(e,t,n,r,o,i,a,s,l,u,d,h,p,b,m,y,x,C,w){if(C!==void 0||t[t.length-1]!==n[t.length-1])return;const I=Nc(x);kr(t,l,a,s,i,(W,B,$,L,V)=>{if(W!==t[t.length-1])return;B+=W.width;const R=Math.max(B,L);R>r||(e.save(),e.beginPath(),e.rect(R,i+1,1e4,o-i-1),e.clip(),Yi(V,$,o,u,d,m,y,I,(A,H,j,F)=>{if(!F&&x.length>0&&!x.some(he=>Qo(B,A,1e4,j,he.x,he.y,he.width,he.height)))return;const T=p.hasIndex(H),fe=b.hasIndex(H);e.beginPath();const G=h==null?void 0:h(H),Z=G===void 0?w:rr(w,G);Z.bgCell!==w.bgCell&&(e.fillStyle=Z.bgCell,e.fillRect(B,A,1e4,j)),fe&&(e.fillStyle=Z.bgHeader,e.fillRect(B,A,1e4,j)),T&&(e.fillStyle=Z.accentLight,e.fillRect(B,A,1e4,j))}),e.restore())})}function cC(e,t,n,r,o,i,a,s,l){let u=!1;for(const m of t)if(!m.sticky){u=a(m.sourceIndex);break}const d=l.horizontalBorderColor??l.borderColor,h=l.borderColor,p=u?mo(t):0;let b;if(p!==0&&(b=el(h,l.bgCell),e.beginPath(),e.moveTo(p+.5,0),e.lineTo(p+.5,r),e.strokeStyle=b,e.stroke()),o>0){const m=h===d&&b!==void 0?b:el(d,l.bgCell),y=Wr(i,o,s);e.beginPath(),e.moveTo(0,r-y+.5),e.lineTo(n,r-y+.5),e.strokeStyle=m,e.stroke()}}const nu=(e,t,n)=>{let r=0,o=t,i=0,a=n;if(e!==void 0&&e.length>0){r=Number.MAX_SAFE_INTEGER,i=Number.MAX_SAFE_INTEGER,o=Number.MIN_SAFE_INTEGER,a=Number.MIN_SAFE_INTEGER;for(const s of e)r=Math.min(r,s.x-1),o=Math.max(o,s.x+s.width+1),i=Math.min(i,s.y-1),a=Math.max(a,s.y+s.height+1)}return{minX:r,maxX:o,minY:i,maxY:a}};function uC(e,t,n,r,o,i,a,s,l,u,d,h,p,b,m){var j;const y=m.bgCell,{minX:x,maxX:C,minY:w,maxY:I}=nu(s,i,a),W=[],B=a-Wr(b,p,u);let $=l,L=n,V=0;for(;$+o<B;){const F=$+o,T=u(L);if(F>=w&&F<=I-1){const fe=d==null?void 0:d(L),G=fe==null?void 0:fe.bgCell;G!==void 0&&G!==y&&L>=b-p&&W.push({x,y:F,w:C-x,h:T,color:G})}$+=T,L<b-p&&(V=$),L++}let R=0;const A=Math.min(B,I)-V;if(A>0)for(let F=0;F<t.length;F++){const T=t[F];if(T.width===0)continue;const fe=T.sticky?R:R+r,G=(j=T.themeOverride)==null?void 0:j.bgCell;G!==void 0&&G!==y&&fe>=x&&fe<=C&&h(F+1)&&W.push({x:fe,y:V,w:T.width,h:A,color:G}),R+=T.width}if(W.length===0)return;let H;e.beginPath();for(let F=W.length-1;F>=0;F--){const T=W[F];H===void 0?H=T.color:T.color!==H&&(e.fillStyle=H,e.fill(),e.beginPath(),H=T.color),e.rect(T.x,T.y,T.w,T.h)}H!==void 0&&(e.fillStyle=H,e.fill()),e.beginPath()}function Dl(e,t,n,r,o,i,a,s,l,u,d,h,p,b,m,y,x,C=!1){if(l!==void 0){e.beginPath(),e.save(),e.rect(0,0,i,a);for(const j of l)e.rect(j.x+1,j.y+1,j.width-1,j.height-1);e.clip("evenodd")}const w=x.horizontalBorderColor??x.borderColor,I=x.borderColor,{minX:W,maxX:B,minY:$,maxY:L}=nu(s,i,a),V=[];e.beginPath();let R=.5;for(let j=0;j<t.length;j++){const F=t[j];if(F.width===0)continue;R+=F.width;const T=F.sticky?R:R+r;T>=W&&T<=B&&b(j+1)&&V.push({x1:T,y1:Math.max(u,$),x2:T,y2:Math.min(a,L),color:I})}let A=a+.5;for(let j=y-m;j<y;j++){const F=h(j);A-=F,V.push({x1:W,y1:A,x2:B,y2:A,color:w})}if(C!==!0){let j=d+.5,F=n;const T=A;for(;j+o<T;){const fe=j+o;if(fe>=$&&fe<=L-1){const G=p==null?void 0:p(F);V.push({x1:W,y1:fe,x2:B,y2:fe,color:(G==null?void 0:G.horizontalBorderColor)??(G==null?void 0:G.borderColor)??w})}j+=h(F),F++}}const H=aC(V,j=>j.color);for(const j of Object.keys(H)){e.strokeStyle=j;for(const F of H[j])e.moveTo(F.x1,F.y1),e.lineTo(F.x2,F.y2);e.stroke(),e.beginPath()}l!==void 0&&e.restore()}function dC(e,t,n,r,o,i,a,s,l,u,d,h,p,b,m,y,x,C,w){const I=[];e.imageSmoothingEnabled=!1;const W=Math.min(o.cellYOffset,a),B=Math.max(o.cellYOffset,a);let $=0;if(typeof C=="number")$+=(B-W)*C;else for(let T=W;T<B;T++)$+=C(T);a>o.cellYOffset&&($=-$),$+=l-o.translateY;const L=Math.min(o.cellXOffset,i),V=Math.max(o.cellXOffset,i);let R=0;for(let T=L;T<V;T++)R+=y[T].width;i>o.cellXOffset&&(R=-R),R+=s-o.translateX;const A=mo(x);if(R!==0&&$!==0)return{regions:[]};const H=u>0?Wr(p,u,C):0,j=d-A-Math.abs(R),F=h-b-H-Math.abs($)-1;if(j>150&&F>150){const T={sx:0,sy:0,sw:d*m,sh:h*m,dx:0,dy:0,dw:d*m,dh:h*m};if($>0?(T.sy=(b+1)*m,T.sh=F*m,T.dy=($+b+1)*m,T.dh=F*m,I.push({x:0,y:b,width:d,height:$+1})):$<0&&(T.sy=(-$+b+1)*m,T.sh=F*m,T.dy=(b+1)*m,T.dh=F*m,I.push({x:0,y:h+$-H,width:d,height:-$+H})),R>0?(T.sx=A*m,T.sw=j*m,T.dx=(R+A)*m,T.dw=j*m,I.push({x:A-1,y:0,width:R+2,height:h})):R<0&&(T.sx=(A-R)*m,T.sw=j*m,T.dx=A*m,T.dw=j*m,I.push({x:d+R,y:0,width:-R,height:h})),e.setTransform(1,0,0,1,0,0),w){if(A>0&&R!==0&&$===0&&(r===void 0||(n==null?void 0:n[1])!==!1)){const fe=A*m,G=h*m;e.drawImage(t,0,0,fe,G,0,0,fe,G)}if(H>0&&R===0&&$!==0&&(r===void 0||(n==null?void 0:n[0])!==!1)){const fe=(h-H)*m,G=d*m,Z=H*m;e.drawImage(t,0,fe,G,Z,0,fe,G,Z)}}e.drawImage(t,T.sx,T.sy,T.sw,T.sh,T.dx,T.dy,T.dw,T.dh),e.scale(m,m)}return e.imageSmoothingEnabled=!0,{regions:I}}function fC(e,t,n,r,o,i,a,s,l,u){const d=[];return t!==e.cellXOffset||n!==e.cellYOffset||r!==e.translateX||o!==e.translateY||kr(l,n,r,o,s,(h,p,b,m)=>{if(h.sourceIndex===u){const y=Math.max(p,m)+1;return d.push({x:y,y:0,width:i-y,height:a}),!0}}),d}function hC(e,t){if(t===void 0||e.width!==t.width||e.height!==t.height||e.theme!==t.theme||e.headerHeight!==t.headerHeight||e.rowHeight!==t.rowHeight||e.rows!==t.rows||e.freezeColumns!==t.freezeColumns||e.getRowThemeOverride!==t.getRowThemeOverride||e.isFocused!==t.isFocused||e.isResizing!==t.isResizing||e.verticalBorder!==t.verticalBorder||e.getCellContent!==t.getCellContent||e.highlightRegions!==t.highlightRegions||e.selection!==t.selection||e.dragAndDropState!==t.dragAndDropState||e.prelightCells!==t.prelightCells||e.touchMode!==t.touchMode||e.maxScaleFactor!==t.maxScaleFactor)return!1;if(e.mappedColumns!==t.mappedColumns){if(e.mappedColumns.length>100||e.mappedColumns.length!==t.mappedColumns.length)return!1;let n;for(let r=0;r<e.mappedColumns.length;r++){const o=e.mappedColumns[r],i=t.mappedColumns[r];if(go(o,i))continue;if(n!==void 0||o.width===i.width)return!1;const{width:a,...s}=o,{width:l,...u}=i;if(!go(s,u))return!1;n=r}return n===void 0?!0:n}return!0}function $l(e,t,n,r,o,i,a,s,l,u,d,h,p,b,m,y){const x=m==null?void 0:m.filter(L=>L.style!=="no-outline");if(x===void 0||x.length===0)return;const C=mo(s),w=Wr(b,p,h),I=[l,0,s.length,b-p],W=[C,0,t,n-w],B=x.map(L=>{const V=L.range,R=L.style??"dashed";return e0(V,I,t,n,W).map(A=>{const H=A.rect,j=$s(H.x,H.y,t,n,d,u+d,r,o,i,a,b,l,p,s,h),F=H.width===1&&H.height===1?j:$s(H.x+H.width-1,H.y+H.height-1,t,n,d,u+d,r,o,i,a,b,l,p,s,h);return H.x+H.width>=s.length&&(F.width-=1),H.y+H.height>=b&&(F.height-=1),{color:L.color,style:R,clip:A.clip,rect:Zy({x:j.x,y:j.y,width:F.x+F.width-j.x,height:F.y+F.height-j.y},t,n,8)}})}),$=()=>{e.lineWidth=1;let L=!1;for(const V of B)for(const R of V)if((R==null?void 0:R.rect)!==void 0&&Qo(0,0,t,n,R.rect.x,R.rect.y,R.rect.width,R.rect.height)){const A=L,H=!Qy(R.clip,R.rect);e.beginPath(),H&&(e.save(),e.rect(R.clip.x,R.clip.y,R.clip.width,R.clip.height),e.clip()),R.style==="dashed"&&!L?(e.setLineDash([5,3]),L=!0):(R.style==="solid"||R.style==="solid-outline")&&L&&(e.setLineDash([]),L=!1),e.strokeStyle=R.style==="solid-outline"?yn(yn(R.color,y.borderColor),y.bgCell):Br(R.color,1),e.closePath(),e.strokeRect(R.rect.x+.5,R.rect.y+.5,R.rect.width-1,R.rect.height-1),H&&(e.restore(),L=A)}L&&e.setLineDash([])};return $(),$}function Al(e,t,n,r,o){e.beginPath(),e.moveTo(t,n),e.lineTo(t,r),e.lineWidth=2,e.strokeStyle=o,e.stroke(),e.globalAlpha=1}function ws(e,t,n,r,o,i,a,s,l,u,d,h,p,b,m,y,x){if(d.current===void 0)return;const C=y!==!1&&y!==void 0;if(!C)return;const w=typeof y=="object"?{...Fi,...y}:Fi,I=d.current.range,W=d.current.cell,B=[I.x+I.width-1,I.y+I.height-1];if(W[1]>=x&&B[1]>=x||!a.some(G=>G.sourceIndex===W[0]||G.sourceIndex===B[0]))return;const[L,V]=d.current.cell,R=p(d.current.cell),A=R.span??[L,L],H=V>=x-b,j=b>0&&!H?Wr(x,b,h)-1:0,F=B[1];let T;if(kr(a,r,o,i,u,(G,Z,he,de,te)=>{if(G.sticky&&L>G.sourceIndex)return;const q=G.sourceIndex<A[0],ve=G.sourceIndex>A[1],ie=G.sourceIndex===B[0];if(!(!ie&&(q||ve)))return Yi(te,he,n,x,h,b,m,void 0,(re,Te,J)=>{if(Te!==V&&Te!==F)return;let se=Z,ge=G.width;if(R.span!==void 0){const Ce=Bc(R.span,Z,re,G.width,J,G,s),st=G.sticky?Ce[0]:Ce[1];st!==void 0&&(se=st.x,ge=st.width)}return Te===F&&ie&&C&&(T=()=>{var _e;de>se&&!G.sticky&&(e.beginPath(),e.rect(de,0,t-de,n),e.clip());const Ce=w.size,st=Ce/2,at=se+ge+w.offsetX-st+.5,De=re+J+w.offsetY-st+.5;e.beginPath(),w.shape==="circle"?e.arc(at+st,De+st,st,0,Math.PI*2):e.rect(at,De,Ce,Ce),e.fillStyle=((_e=G.themeOverride)==null?void 0:_e.accentColor)??l.accentColor,e.fill(),w.outline>0&&(e.lineWidth=w.outline,e.strokeStyle=l.bgCell,w.shape==="circle"?(e.beginPath(),e.arc(at+st,De+st,st+w.outline/2,0,Math.PI*2),e.stroke()):e.strokeRect(at-w.outline/2,De-w.outline/2,Ce+w.outline,Ce+w.outline))}),T!==void 0}),T!==void 0}),T===void 0)return;const fe=()=>{e.save(),e.beginPath(),e.rect(0,u,t,n-u-j),e.clip(),T==null||T(),e.restore()};return fe(),fe}function gC(e,t,n,r,o,i,a,s,l){l===void 0||l.size===0||(e.beginPath(),Hc(t,n,i,r,(u,d,h,p,b,m)=>{l.hasItemInRectangle({x:u[0],y:-2,width:u[1]-u[0]+1,height:1})&&e.rect(h,p,b,m)}),kr(t,s,i,a,o,(u,d,h,p)=>{const b=Math.max(0,p-d),m=d+b+1,y=u.width-b-1;l.has([u.sourceIndex,-1])&&e.rect(m,r,y,o-r)}),e.clip())}function mC(e,t,n,r,o,i,a,s,l,u){let d=0;return kr(e,i,r,o,n,(h,p,b,m,y)=>(Yi(y,b,t,a,s,l,u,void 0,(x,C,w,I)=>{I||(d=Math.max(C,d))}),!0)),d}function Fl(e,t){var un;const{canvasCtx:n,headerCanvasCtx:r,width:o,height:i,cellXOffset:a,cellYOffset:s,translateX:l,translateY:u,mappedColumns:d,enableGroups:h,freezeColumns:p,dragAndDropState:b,theme:m,drawFocus:y,headerHeight:x,groupHeaderHeight:C,disabledRows:w,rowHeight:I,verticalBorder:W,overrideCursor:B,isResizing:$,selection:L,fillHandle:V,freezeTrailingRows:R,rows:A,getCellContent:H,getGroupDetails:j,getRowThemeOverride:F,isFocused:T,drawHeaderCallback:fe,prelightCells:G,drawCellCallback:Z,highlightRegions:he,resizeCol:de,imageLoader:te,lastBlitData:q,hoverValues:ve,hyperWrapping:ie,hoverInfo:re,spriteManager:Te,maxScaleFactor:J,hasAppendRow:se,touchMode:ge,enqueue:Be,renderStateProvider:Ce,getCellRenderer:st,renderStrategy:at,bufferACtx:De,bufferBCtx:_e,damage:Pe,minimumCellWidth:xt,resizeIndicator:Ct}=e;if(o===0||i===0)return;const ft=at==="double-buffer",oe=Math.min(J,Math.ceil(window.devicePixelRatio??1)),ye=at!=="direct"&&hC(e,t),Ee=n.canvas;(Ee.width!==o*oe||Ee.height!==i*oe)&&(Ee.width=o*oe,Ee.height=i*oe,Ee.style.width=o+"px",Ee.style.height=i+"px");const $e=r.canvas,me=h?C+x:x,Xe=me+1;($e.width!==o*oe||$e.height!==Xe*oe)&&($e.width=o*oe,$e.height=Xe*oe,$e.style.width=o+"px",$e.style.height=Xe+"px");const Ke=De.canvas,ze=_e.canvas;ft&&(Ke.width!==o*oe||Ke.height!==i*oe)&&(Ke.width=o*oe,Ke.height=i*oe,q.current!==void 0&&(q.current.aBufferScroll=void 0)),ft&&(ze.width!==o*oe||ze.height!==i*oe)&&(ze.width=o*oe,ze.height=i*oe,q.current!==void 0&&(q.current.bBufferScroll=void 0));const ce=q.current;if(ye===!0&&a===(ce==null?void 0:ce.cellXOffset)&&s===(ce==null?void 0:ce.cellYOffset)&&l===(ce==null?void 0:ce.translateX)&&u===(ce==null?void 0:ce.translateY))return;let xe=null;ft&&(xe=n);const Ye=r;let le;ft?Pe!==void 0?le=(ce==null?void 0:ce.lastBuffer)==="b"?_e:De:le=(ce==null?void 0:ce.lastBuffer)==="b"?De:_e:le=n;const tt=le.canvas,pt=ft?tt===Ke?ze:Ke:Ee,Re=typeof I=="number"?()=>I:I;Ye.save(),le.save(),Ye.beginPath(),le.beginPath(),Ye.textBaseline="middle",le.textBaseline="middle",oe!==1&&(Ye.scale(oe,oe),le.scale(oe,oe));const Le=Ds(d,a,o,b,l);let ut=[];const Fe=y&&((un=L.current)==null?void 0:un.cell[1])===s&&u===0;let bt=!1;if(he!==void 0){for(const mt of he)if(mt.style!=="no-outline"&&mt.range.y===s&&u===0){bt=!0;break}}const ht=()=>{r0(Ye,Le,h,re,o,l,x,C,b,$,L,m,Te,ve,W,j,Pe,fe,ge),Dl(Ye,Le,s,l,u,o,i,void 0,void 0,C,me,Re,F,W,R,A,m,!0),Ye.beginPath(),Ye.moveTo(0,Xe-.5),Ye.lineTo(o,Xe-.5),Ye.strokeStyle=yn(m.headerBottomBorderColor??m.horizontalBorderColor??m.borderColor,m.bgHeader),Ye.stroke(),bt&&$l(Ye,o,i,a,s,l,u,d,p,x,C,I,R,A,he,m),Fe&&ws(Ye,o,i,s,l,u,Le,d,m,me,L,Re,H,R,se,V,A)};if(Pe!==void 0){const mt=Le[Le.length-1].sourceIndex+1,Mt=Pe.hasItemInRegion([{x:a,y:-2,width:mt,height:2},{x:a,y:s,width:mt,height:300},{x:0,y:s,width:p,height:300},{x:0,y:-2,width:p,height:2},{x:a,y:A-R,width:mt,height:R,when:R>0}]),We=Et=>{ll(Et,Le,d,i,me,l,u,s,A,Re,H,j,F,w,T,y,R,se,ut,Pe,L,G,he,te,Te,ve,re,Z,ie,m,Be,Ce,st,B,xt);const Yt=L.current;V!==!1&&V!==void 0&&y&&Yt!==void 0&&Pe.has(Cc(Yt.range))&&ws(Et,o,i,s,l,u,Le,d,m,me,L,Re,H,R,se,V,A)};Mt&&(We(le),xe!==null&&(xe.save(),xe.scale(oe,oe),xe.textBaseline="middle",We(xe),xe.restore()),Pe.hasHeader()&&(gC(Ye,Le,o,C,me,l,u,s,Pe),ht())),le.restore(),Ye.restore();return}if((ye!==!0||a!==(ce==null?void 0:ce.cellXOffset)||l!==(ce==null?void 0:ce.translateX)||Fe!==(ce==null?void 0:ce.mustDrawFocusOnHeader)||bt!==(ce==null?void 0:ce.mustDrawHighlightRingsOnHeader))&&ht(),ye===!0){bn(pt!==void 0&&ce!==void 0);const{regions:mt}=dC(le,pt,pt===Ke?ce.aBufferScroll:ce.bBufferScroll,pt===Ke?ce.bBufferScroll:ce.aBufferScroll,ce,a,s,l,u,R,o,i,A,me,oe,d,Le,I,ft);ut=mt}else ye!==!1&&(bn(ce!==void 0),ut=fC(ce,a,s,l,u,o,i,me,Le,ye));cC(le,Le,o,i,R,A,W,Re,m);const Dt=$l(le,o,i,a,s,l,u,d,p,x,C,I,R,A,he,m),Ot=y?ws(le,o,i,s,l,u,Le,d,m,me,L,Re,H,R,se,V,A):void 0;if(le.fillStyle=m.bgCell,ut.length>0){le.beginPath();for(const mt of ut)le.rect(mt.x,mt.y,mt.width,mt.height);le.clip(),le.fill(),le.beginPath()}else le.fillRect(0,0,o,i);const rn=ll(le,Le,d,i,me,l,u,s,A,Re,H,j,F,w,T,y,R,se,ut,Pe,L,G,he,te,Te,ve,re,Z,ie,m,Be,Ce,st,B,xt);lC(le,Le,d,o,i,me,l,u,s,A,Re,F,L.rows,w,R,se,ut,Pe,m),uC(le,Le,s,l,u,o,i,ut,me,Re,F,W,R,A,m),Dl(le,Le,s,l,u,o,i,ut,rn,C,me,Re,F,W,R,A,m),Dt==null||Dt(),Ot==null||Ot(),$&&Ct!=="none"&&kr(Le,0,l,0,me,(mt,Mt)=>mt.sourceIndex===de?(Al(Ye,Mt+mt.width,0,me+1,yn(m.resizeIndicatorColor??m.accentLight,m.bgHeader)),Ct==="full"&&Al(le,Mt+mt.width,me,i,yn(m.resizeIndicatorColor??m.accentLight,m.bgCell)),!0):!1),xe!==null&&(xe.fillStyle=m.bgCell,xe.fillRect(0,0,o,i),xe.drawImage(le.canvas,0,0));const Kt=mC(Le,i,me,l,u,s,A,Re,R,se);te==null||te.setWindow({x:a,y:s,width:Le.length,height:Kt-s},p,Array.from({length:R},(mt,Mt)=>A-1-Mt));const yt=ce!==void 0&&(a!==ce.cellXOffset||l!==ce.translateX),Dn=ce!==void 0&&(s!==ce.cellYOffset||u!==ce.translateY);q.current={cellXOffset:a,cellYOffset:s,translateX:l,translateY:u,mustDrawFocusOnHeader:Fe,mustDrawHighlightRingsOnHeader:bt,lastBuffer:ft?tt===Ke?"a":"b":void 0,aBufferScroll:tt===Ke?[yt,Dn]:ce==null?void 0:ce.aBufferScroll,bBufferScroll:tt===ze?[yt,Dn]:ce==null?void 0:ce.bBufferScroll},le.restore(),Ye.restore()}const pC=80;function bC(e){const t=e-1;return t*t*t+1}class yC{constructor(t){Ue(this,"callback");Ue(this,"currentHoveredItem");Ue(this,"leavingItems",[]);Ue(this,"lastAnimationTime");Ue(this,"addToLeavingItems",t=>{this.leavingItems.some(r=>Ko(r.item,t.item))||this.leavingItems.push(t)});Ue(this,"removeFromLeavingItems",t=>{const n=this.leavingItems.find(r=>Ko(r.item,t));return this.leavingItems=this.leavingItems.filter(r=>r!==n),(n==null?void 0:n.hoverAmount)??0});Ue(this,"cleanUpLeavingElements",()=>{this.leavingItems=this.leavingItems.filter(t=>t.hoverAmount>0)});Ue(this,"shouldStep",()=>{const t=this.leavingItems.length>0,n=this.currentHoveredItem!==void 0&&this.currentHoveredItem.hoverAmount<1;return t||n});Ue(this,"getAnimatingItems",()=>this.currentHoveredItem!==void 0?[...this.leavingItems,this.currentHoveredItem]:this.leavingItems.map(t=>({...t,hoverAmount:bC(t.hoverAmount)})));Ue(this,"step",t=>{if(this.lastAnimationTime===void 0)this.lastAnimationTime=t;else{const r=(t-this.lastAnimationTime)/pC;for(const i of this.leavingItems)i.hoverAmount=In(i.hoverAmount-r,0,1);this.currentHoveredItem!==void 0&&(this.currentHoveredItem.hoverAmount=In(this.currentHoveredItem.hoverAmount+r,0,1));const o=this.getAnimatingItems();this.callback(o),this.cleanUpLeavingElements()}this.shouldStep()?(this.lastAnimationTime=t,window.requestAnimationFrame(this.step)):this.lastAnimationTime=void 0});Ue(this,"setHovered",t=>{var n;if(!Ko((n=this.currentHoveredItem)==null?void 0:n.item,t)){if(this.currentHoveredItem!==void 0&&this.addToLeavingItems(this.currentHoveredItem),t!==void 0){const r=this.removeFromLeavingItems(t);this.currentHoveredItem={item:t,hoverAmount:r}}else this.currentHoveredItem=void 0;this.lastAnimationTime===void 0&&window.requestAnimationFrame(this.step)}});this.callback=t}}class vC{constructor(t){Ue(this,"fn");Ue(this,"val");this.fn=t}get value(){return this.val??(this.val=this.fn())}}function aa(e){return new vC(e)}const wC=aa(()=>window.navigator.userAgent.includes("Firefox")),ji=aa(()=>window.navigator.userAgent.includes("Mac OS")&&window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome")),Ni=aa(()=>window.navigator.platform.toLowerCase().startsWith("mac"));function xC(e){const t=c.useRef([]),n=c.useRef(0),r=c.useRef(e);r.current=e;const o=c.useCallback(()=>{const i=()=>window.requestAnimationFrame(a),a=()=>{const s=t.current.map(Tc);t.current=[],r.current(new Ei(s)),t.current.length>0?n.current++:n.current=0};window.requestAnimationFrame(n.current>600?i:a)},[]);return c.useCallback(i=>{t.current.length===0&&o();const a=nr(i[0],i[1]);t.current.includes(a)||t.current.push(a)},[o])}const wr="header",Nn="group-header",Hi="out-of-bounds";var co;(function(e){e[e.Start=-2]="Start",e[e.StartPadding=-1]="StartPadding",e[e.Center=0]="Center",e[e.EndPadding=1]="EndPadding",e[e.End=2]="End"})(co||(co={}));function ru(e,t){return e===t?!0:(e==null?void 0:e.kind)==="out-of-bounds"?(e==null?void 0:e.kind)===(t==null?void 0:t.kind)&&(e==null?void 0:e.location[0])===(t==null?void 0:t.location[0])&&(e==null?void 0:e.location[1])===(t==null?void 0:t.location[1])&&(e==null?void 0:e.region[0])===(t==null?void 0:t.region[0])&&(e==null?void 0:e.region[1])===(t==null?void 0:t.region[1]):(e==null?void 0:e.kind)===(t==null?void 0:t.kind)&&(e==null?void 0:e.location[0])===(t==null?void 0:t.location[0])&&(e==null?void 0:e.location[1])===(t==null?void 0:t.location[1])}const CC=(e,t)=>{if(e.kind===ue.Custom)return e.copyData;const n=t==null?void 0:t(e);return(n==null?void 0:n.getAccessibilityString(e))??""},kC=(e,t)=>{const{width:n,height:r,accessibilityHeight:o,columns:i,cellXOffset:a,cellYOffset:s,headerHeight:l,fillHandle:u=!1,groupHeaderHeight:d,rowHeight:h,rows:p,getCellContent:b,getRowThemeOverride:m,onHeaderMenuClick:y,onHeaderIndicatorClick:x,enableGroups:C,isFilling:w,onCanvasFocused:I,onCanvasBlur:W,isFocused:B,selection:$,freezeColumns:L,onContextMenu:V,freezeTrailingRows:R,fixedShadowX:A=!0,fixedShadowY:H=!0,drawFocusRing:j,onMouseDown:F,onMouseUp:T,onMouseMoveRaw:fe,onMouseMove:G,onItemHovered:Z,dragAndDropState:he,firstColAccessible:de,onKeyDown:te,onKeyUp:q,highlightRegions:ve,canvasRef:ie,onDragStart:re,onDragEnd:Te,eventTargetRef:J,isResizing:se,resizeColumn:ge,isDragging:Be,isDraggable:Ce=!1,allowResize:st,disabledRows:at,hasAppendRow:De,getGroupDetails:_e,theme:Pe,prelightCells:xt,headerIcons:Ct,verticalBorder:ft,drawCell:oe,drawHeader:ye,onCellFocused:Ee,onDragOverCell:$e,onDrop:me,onDragLeave:Xe,imageWindowLoader:Ke,smoothScrollX:ze=!1,smoothScrollY:ce=!1,experimental:xe,getCellRenderer:Ye,resizeIndicator:le="full"}=e,tt=e.translateX??0,pt=e.translateY??0,Re=Math.max(L,Math.min(i.length-1,a)),Le=c.useRef(null),ut=c.useRef((xe==null?void 0:xe.eventTarget)??window),Fe=ut.current,bt=Ke,ht=c.useRef(),[Dt,Ot]=c.useState(!1),rn=c.useRef([]),Kt=c.useRef(),[yt,Dn]=c.useState(),[un,mt]=c.useState(),Mt=c.useRef(null),[We,Et]=c.useState(),[Yt,Ve]=c.useState(!1),Rt=c.useRef(Yt);Rt.current=Yt;const nt=c.useMemo(()=>new Vy(Ct,()=>{ir.current=void 0,Ln.current()}),[Ct]),_t=C?d+l:l,gt=c.useRef(-1),zt=((xe==null?void 0:xe.enableFirefoxRescaling)??!1)&&wC.value,vn=((xe==null?void 0:xe.enableSafariRescaling)??!1)&&ji.value;c.useLayoutEffect(()=>{window.devicePixelRatio===1||!zt&&!vn||(gt.current!==-1&&Ot(!0),window.clearTimeout(gt.current),gt.current=window.setTimeout(()=>{Ot(!1),gt.current=-1},200))},[s,Re,tt,pt,zt,vn]);const vt=Xp(i,L),Wt=c.useMemo(()=>A?mo(vt,he):0,[vt,he,A]),Je=c.useCallback((g,k,_)=>{const K=g.getBoundingClientRect();if(k>=vt.length||_>=p)return;const Y=K.width/n,ee=$s(k,_,n,r,d,_t,Re,s,tt,pt,p,L,R,vt,h);return Y!==1&&(ee.x*=Y,ee.y*=Y,ee.width*=Y,ee.height*=Y),ee.x+=K.x,ee.y+=K.y,ee},[n,r,d,_t,Re,s,tt,pt,p,L,R,vt,h]),je=c.useCallback((g,k,_,K)=>{const Y=g.getBoundingClientRect(),ee=Y.width/n,ke=(k-Y.left)/ee,rt=(_-Y.top)/ee,we=5,jt=Ds(vt,Re,n,void 0,tt);let Se=0,ot=0;const Ge=typeof PointerEvent<"u"&&K instanceof PointerEvent&&K.pointerType==="mouse"||typeof MouseEvent<"u"&&K instanceof MouseEvent,qe=typeof PointerEvent<"u"&&K instanceof PointerEvent&&K.pointerType==="touch"||typeof TouchEvent<"u"&&K instanceof TouchEvent;Ge&&(Se=K.button,ot=K.buttons);const Ne=Vp(ke,jt,tt),ct=Jp(rt,r,C,l,d,p,h,s,pt,R),At=(K==null?void 0:K.shiftKey)===!0,Fn=(K==null?void 0:K.ctrlKey)===!0,_n=(K==null?void 0:K.metaKey)===!0,It=[ke<0?-1:n<ke?1:0,rt<_t?-1:r<rt?1:0];let Pt;if(Ne===-1||rt<0||ke<0||ct===void 0||ke>n||rt>r){const wt=ke>n?1:ke<0?-1:0,Sn=rt>r?1:rt<0?-1:0;let qt=wt*2,Vr=Sn*2;wt===0&&(qt=Ne===-1?co.EndPadding:co.Center),Sn===0&&(Vr=ct===void 0?co.EndPadding:co.Center);let er=!1;if(Ne===-1&&ct===-1){const Nt=Je(g,vt.length-1,-1);bn(Nt!==void 0),er=k<Nt.x+Nt.width+we}const Qe=ke>n&&ke<n+Is()||rt>r&&rt<r+Is();Pt={kind:Hi,location:[Ne!==-1?Ne:ke<0?0:vt.length-1,ct??p-1],region:[qt,Vr],shiftKey:At,ctrlKey:Fn,metaKey:_n,isEdge:er,isTouch:qe,button:Se,buttons:ot,scrollEdge:It,isMaybeScrollbar:Qe}}else if(ct<=-1){let wt=Je(g,Ne,ct);bn(wt!==void 0);let Sn=wt!==void 0&&wt.x+wt.width-k<=we;const qt=Ne-1;k-wt.x<=we&&qt>=0?(Sn=!0,wt=Je(g,qt,ct),bn(wt!==void 0),Pt={kind:C&&ct===-2?Nn:wr,location:[qt,ct],bounds:wt,group:vt[qt].group??"",isEdge:Sn,shiftKey:At,ctrlKey:Fn,metaKey:_n,isTouch:qe,localEventX:k-wt.x,localEventY:_-wt.y,button:Se,buttons:ot,scrollEdge:It}):Pt={kind:C&&ct===-2?Nn:wr,group:vt[Ne].group??"",location:[Ne,ct],bounds:wt,isEdge:Sn,shiftKey:At,ctrlKey:Fn,metaKey:_n,isTouch:qe,localEventX:k-wt.x,localEventY:_-wt.y,button:Se,buttons:ot,scrollEdge:It}}else{const wt=Je(g,Ne,ct);bn(wt!==void 0);const Sn=wt!==void 0&&wt.x+wt.width-k<we;let qt=!1;if(u!==!1&&u!==void 0&&$.current!==void 0){const er=typeof u=="object"?{...Fi,...u}:Fi,Qe=er.size,Nt=Qe/2,$r=Cc($.current.range),hr=Je(g,$r[0],$r[1]);if(hr!==void 0){const tr=hr.x+hr.width+er.offsetX-Nt+.5,St=hr.y+hr.height+er.offsetY-Nt+.5;qt=Math.abs(tr-k)<Qe&&Math.abs(St-_)<Qe}}Pt={kind:"cell",location:[Ne,ct],bounds:wt,isEdge:Sn,shiftKey:At,ctrlKey:Fn,isFillHandle:qt,metaKey:_n,isTouch:qe,localEventX:k-wt.x,localEventY:_-wt.y,button:Se,buttons:ot,scrollEdge:It}}return Pt},[n,vt,Re,tt,r,C,l,d,p,h,s,pt,R,Je,u,$,_t]),[wn]=yt??[],or=c.useRef(()=>{}),Gt=c.useRef(yt);Gt.current=yt;const[Jt,dn]=c.useMemo(()=>{const g=document.createElement("canvas"),k=document.createElement("canvas");return g.style.display="none",g.style.opacity="0",g.style.position="fixed",k.style.display="none",k.style.opacity="0",k.style.position="fixed",[g.getContext("2d",{alpha:!1}),k.getContext("2d",{alpha:!1})]},[]);c.useLayoutEffect(()=>{if(!(Jt===null||dn===null))return document.documentElement.append(Jt.canvas),document.documentElement.append(dn.canvas),()=>{Jt.canvas.remove(),dn.canvas.remove()}},[Jt,dn]);const Hn=c.useMemo(()=>new cb,[]),Sr=zt&&Dt?1:vn&&Dt?2:5,Bn=(xe==null?void 0:xe.disableMinimumCellWidth)===!0?1:10,ir=c.useRef(),sr=c.useRef(null),ar=c.useRef(null),xn=c.useCallback(()=>{var ke;const g=Le.current,k=Mt.current;if(g===null||k===null||(sr.current===null&&(sr.current=g.getContext("2d",{alpha:!1}),g.width=0,g.height=0),ar.current===null&&(ar.current=k.getContext("2d",{alpha:!1}),k.width=0,k.height=0),sr.current===null||ar.current===null||Jt===null||dn===null))return;let _=!1;const K=rt=>{_=!0,Et(rt)},Y=ir.current,ee={headerCanvasCtx:ar.current,canvasCtx:sr.current,bufferACtx:Jt,bufferBCtx:dn,width:n,height:r,cellXOffset:Re,cellYOffset:s,translateX:Math.round(tt),translateY:Math.round(pt),mappedColumns:vt,enableGroups:C,freezeColumns:L,dragAndDropState:he,theme:Pe,headerHeight:l,groupHeaderHeight:d,disabledRows:at??it.empty(),rowHeight:h,verticalBorder:ft,isResizing:se,resizeCol:ge,isFocused:B,selection:$,fillHandle:u,drawCellCallback:oe,hasAppendRow:De,overrideCursor:K,maxScaleFactor:Sr,freezeTrailingRows:R,rows:p,drawFocus:j,getCellContent:b,getGroupDetails:_e??(rt=>({name:rt})),getRowThemeOverride:m,drawHeaderCallback:ye,prelightCells:xt,highlightRegions:ve,imageLoader:bt,lastBlitData:Kt,damage:ht.current,hoverValues:rn.current,hoverInfo:Gt.current,spriteManager:nt,scrolling:Dt,hyperWrapping:(xe==null?void 0:xe.hyperWrapping)??!1,touchMode:Yt,enqueue:or.current,renderStateProvider:Hn,renderStrategy:(xe==null?void 0:xe.renderStrategy)??(ji.value?"double-buffer":"single-buffer"),getCellRenderer:Ye,minimumCellWidth:Bn,resizeIndicator:le};ee.damage===void 0?(ir.current=ee,Fl(ee,Y)):Fl(ee,void 0),!_&&(ee.damage===void 0||ee.damage.has((ke=Gt==null?void 0:Gt.current)==null?void 0:ke[0]))&&Et(void 0)},[Jt,dn,n,r,Re,s,tt,pt,vt,C,L,he,Pe,l,d,at,h,ft,se,De,ge,B,$,u,R,p,j,Sr,b,_e,m,oe,ye,xt,ve,bt,nt,Dt,xe==null?void 0:xe.hyperWrapping,xe==null?void 0:xe.renderStrategy,Yt,Hn,Ye,Bn,le]),Ln=c.useRef(xn);c.useLayoutEffect(()=>{xn(),Ln.current=xn},[xn]),c.useLayoutEffect(()=>{(async()=>{var k;((k=document==null?void 0:document.fonts)==null?void 0:k.ready)!==void 0&&(await document.fonts.ready,ir.current=void 0,Ln.current())})()},[]);const fn=c.useCallback(g=>{ht.current=g,Ln.current(),ht.current=void 0},[]),ko=xC(fn);or.current=ko;const Rr=c.useCallback(g=>{fn(new Ei(g.map(k=>k.cell)))},[fn]);bt.setCallback(fn);const[So,Ro]=c.useState(!1),[Qt,hn]=wn??[],Mo=Qt!==void 0&&hn===-1&&Qt>=0&&Qt<vt.length&&vt[Qt].headerRowMarkerDisabled!==!0,Io=Qt!==void 0&&hn===-2;let zn=!1,Ur=!1,Jn=We;if(Jn===void 0&&Qt!==void 0&&hn!==void 0&&hn>-1&&hn<p){const g=b([Qt,hn],!0);zn=g.kind===En.NewRow||g.kind===En.Marker&&g.markerKind!=="number",Ur=g.kind===ue.Boolean&&Qs(g),Jn=g.cursor}const Xr=Be?"grabbing":(un??!1)||se?"col-resize":So||w?"crosshair":Jn!==void 0?Jn:Mo||zn||Ur||Io?"pointer":"default",lr=c.useMemo(()=>({contain:"strict",display:"block",cursor:Xr}),[Xr]),kt=c.useRef("default"),Ut=J==null?void 0:J.current;Ut!=null&&kt.current!==lr.cursor&&(Ut.style.cursor=kt.current=lr.cursor);const on=c.useCallback((g,k,_,K)=>{if(_e===void 0)return;const Y=_e(g);if(Y.actions!==void 0){const ee=Wc(k,Y.actions);for(const[ke,rt]of ee.entries())if(fo(rt,_+k.x,K+rt.y))return Y.actions[ke]}},[_e]),sn=c.useCallback((g,k,_,K)=>{const Y=vt[k];if(!Be&&!se&&!(un??!1)){const ee=Je(g,k,-1);bn(ee!==void 0);const ke=Gc(void 0,Y,ee.x,ee.y,ee.width,ee.height,Pe,ea(Y.title)==="rtl");if(Y.hasMenu===!0&&ke.menuBounds!==void 0&&fo(ke.menuBounds,_,K))return{area:"menu",bounds:ke.menuBounds};if(Y.indicatorIcon!==void 0&&ke.indicatorIconBounds!==void 0&&fo(ke.indicatorIconBounds,_,K))return{area:"indicator",bounds:ke.indicatorIconBounds}}},[vt,Je,un,Be,se,Pe]),Xt=c.useRef(0),Wn=c.useRef(),cr=c.useRef(!1),Cn=c.useCallback(g=>{const k=Le.current,_=J==null?void 0:J.current;if(k===null||g.target!==k&&g.target!==_)return;cr.current=!0;const K=g.clientX,Y=g.clientY;if(g.target===_&&_!==null){const ke=_.getBoundingClientRect();if(K>ke.right||Y>ke.bottom)return}const ee=je(k,K,Y,g);Wn.current=ee.location,ee.isTouch&&(Xt.current=Date.now()),Rt.current!==ee.isTouch&&Ve(ee.isTouch),!(ee.kind===wr&&sn(k,ee.location[0],K,Y)!==void 0)&&(ee.kind===Nn&&on(ee.group,ee.bounds,ee.localEventX,ee.localEventY)!==void 0||(F==null||F(ee),!ee.isTouch&&Ce!==!0&&Ce!==ee.kind&&ee.button<3&&ee.button!==1&&g.preventDefault()))},[J,Ce,je,on,sn,F]);nn("pointerdown",Cn,Fe,!1);const Gn=c.useRef(0),Zt=c.useCallback(g=>{var ot,Ge;const k=Gn.current;Gn.current=Date.now();const _=Le.current;if(cr.current=!1,T===void 0||_===null)return;const K=J==null?void 0:J.current,Y=g.target!==_&&g.target!==K,ee=g.clientX,ke=g.clientY,rt=g.pointerType==="mouse"?g.button<3:!0;let we=je(_,ee,ke,g);we.isTouch&&Xt.current!==0&&Date.now()-Xt.current>500&&(we={...we,isLongTouch:!0}),k!==0&&Date.now()-k<(we.isTouch?1e3:500)&&(we={...we,isDoubleClick:!0}),Rt.current!==we.isTouch&&Ve(we.isTouch),!Y&&g.cancelable&&rt&&g.preventDefault();const[jt]=we.location,Se=sn(_,jt,ee,ke);if(we.kind===wr&&Se!==void 0){(we.button!==0||((ot=Wn.current)==null?void 0:ot[0])!==jt||((Ge=Wn.current)==null?void 0:Ge[1])!==-1)&&T(we,!0);return}else if(we.kind===Nn){const qe=on(we.group,we.bounds,we.localEventX,we.localEventY);if(qe!==void 0){we.button===0&&qe.onClick(we);return}}T(we,Y)},[T,J,je,sn,on]);nn("pointerup",Zt,Fe,!1);const $n=c.useCallback(g=>{var jt,Se;const k=Le.current;if(k===null)return;const _=J==null?void 0:J.current,K=g.target!==k&&g.target!==_;let Y,ee,ke=!0;g instanceof MouseEvent?(Y=g.clientX,ee=g.clientY,ke=g.button<3):(Y=g.changedTouches[0].clientX,ee=g.changedTouches[0].clientY);const rt=je(k,Y,ee,g);Rt.current!==rt.isTouch&&Ve(rt.isTouch),!K&&g.cancelable&&ke&&g.preventDefault();const[we]=rt.location;if(rt.kind===wr){const ot=sn(k,we,Y,ee);ot!==void 0&&rt.button===0&&((jt=Wn.current)==null?void 0:jt[0])===we&&((Se=Wn.current)==null?void 0:Se[1])===-1&&(ot.area==="menu"?y==null||y(we,ot.bounds):ot.area==="indicator"&&(x==null||x(we,ot.bounds)))}},[J,je,sn,y,x]);nn("click",$n,Fe,!1);const Mr=c.useCallback(g=>{const k=Le.current,_=J==null?void 0:J.current;if(k===null||g.target!==k&&g.target!==_||V===void 0)return;const K=je(k,g.clientX,g.clientY,g);V(K,()=>{g.cancelable&&g.preventDefault()})},[J,je,V]);nn("contextmenu",Mr,(J==null?void 0:J.current)??null,!1);const Ir=c.useCallback(g=>{ht.current=new Ei(g.map(k=>k.item)),rn.current=g,Ln.current(),ht.current=void 0},[]),Me=c.useMemo(()=>new yC(Ir),[Ir]),ur=c.useRef(Me);ur.current=Me,c.useLayoutEffect(()=>{const g=ur.current;if(wn===void 0||wn[1]<0){g.setHovered(wn);return}const k=b(wn,!0),_=Ye(k),K=_===void 0&&k.kind===ue.Custom||(_==null?void 0:_.needsHover)!==void 0&&(typeof _.needsHover=="boolean"?_.needsHover:_.needsHover(k));g.setHovered(K?wn:void 0)},[b,Ye,wn]);const Er=c.useRef(),an=c.useCallback(g=>{var rt;const k=Le.current;if(k===null)return;const _=J==null?void 0:J.current,K=g.target!==k&&g.target!==_,Y=je(k,g.clientX,g.clientY,g);if(Y.kind!=="out-of-bounds"&&K&&!cr.current&&!Y.isTouch)return;const ee=(we,jt)=>{Dn(Se=>Se===we||(Se==null?void 0:Se[0][0])===(we==null?void 0:we[0][0])&&(Se==null?void 0:Se[0][1])===(we==null?void 0:we[0][1])&&((Se==null?void 0:Se[1][0])===(we==null?void 0:we[1][0])&&(Se==null?void 0:Se[1][1])===(we==null?void 0:we[1][1])||!jt)?Se:we)};if(!ru(Y,Er.current))Et(void 0),Z==null||Z(Y),ee(Y.kind===Hi?void 0:[Y.location,[Y.localEventX,Y.localEventY]],!0),Er.current=Y;else if(Y.kind==="cell"||Y.kind===wr||Y.kind===Nn){let we=!1,jt=!0;if(Y.kind==="cell"){const ot=b(Y.location);jt=((rt=Ye(ot))==null?void 0:rt.needsHoverPosition)??ot.kind===ue.Custom,we=jt}else we=!0;const Se=[Y.location,[Y.localEventX,Y.localEventY]];ee(Se,jt),Gt.current=Se,we&&fn(new Ei([Y.location]))}const ke=Y.location[0]>=(de?0:1);mt(Y.kind===wr&&Y.isEdge&&ke&&st===!0),Ro(Y.kind==="cell"&&Y.isFillHandle),fe==null||fe(g),G(Y)},[J,je,de,st,fe,G,Z,b,Ye,fn]);nn("pointermove",an,Fe,!0);const Kr=c.useCallback(g=>{const k=Le.current;if(k===null)return;let _,K;$.current!==void 0&&(_=Je(k,$.current.cell[0],$.current.cell[1]),K=$.current.cell),te==null||te({bounds:_,stopPropagation:()=>g.stopPropagation(),preventDefault:()=>g.preventDefault(),cancel:()=>{},ctrlKey:g.ctrlKey,metaKey:g.metaKey,shiftKey:g.shiftKey,altKey:g.altKey,key:g.key,keyCode:g.keyCode,rawEvent:g,location:K})},[te,$,Je]),gn=c.useCallback(g=>{const k=Le.current;if(k===null)return;let _,K;$.current!==void 0&&(_=Je(k,$.current.cell[0],$.current.cell[1]),K=$.current.cell),q==null||q({bounds:_,stopPropagation:()=>g.stopPropagation(),preventDefault:()=>g.preventDefault(),cancel:()=>{},ctrlKey:g.ctrlKey,metaKey:g.metaKey,shiftKey:g.shiftKey,altKey:g.altKey,key:g.key,keyCode:g.keyCode,rawEvent:g,location:K})},[q,$,Je]),Tr=c.useCallback(g=>{if(Le.current=g,ie!==void 0&&(ie.current=g),xe!=null&&xe.eventTarget)ut.current=xe.eventTarget;else if(g===null)ut.current=window;else{const k=g.getRootNode();k===document&&(ut.current=window),ut.current=k}},[ie,xe==null?void 0:xe.eventTarget]),Dr=c.useCallback(g=>{const k=Le.current;if(k===null||Ce===!1||se){g.preventDefault();return}let _,K;const Y=je(k,g.clientX,g.clientY);if(Ce!==!0&&Y.kind!==Ce){g.preventDefault();return}const ee=(ot,Ge)=>{_=ot,K=Ge};let ke,rt,we;const jt=(ot,Ge,qe)=>{ke=ot,rt=Ge,we=qe};let Se=!1;if(re==null||re({...Y,setData:ee,setDragImage:jt,preventDefault:()=>Se=!0,defaultPrevented:()=>Se}),!Se&&_!==void 0&&K!==void 0&&g.dataTransfer!==null)if(g.dataTransfer.setData(_,K),g.dataTransfer.effectAllowed="copyLink",ke!==void 0&&rt!==void 0&&we!==void 0)g.dataTransfer.setDragImage(ke,rt,we);else{const[ot,Ge]=Y.location;if(Ge!==void 0){const qe=document.createElement("canvas"),Ne=Je(k,ot,Ge);bn(Ne!==void 0);const ct=Math.ceil(window.devicePixelRatio??1);qe.width=Ne.width*ct,qe.height=Ne.height*ct;const At=qe.getContext("2d");At!==null&&(At.scale(ct,ct),At.textBaseline="middle",Ge===-1?(At.font=Pe.headerFontFull,At.fillStyle=Pe.bgHeader,At.fillRect(0,0,qe.width,qe.height),Uc(At,0,0,Ne.width,Ne.height,vt[ot],!1,Pe,!1,void 0,void 0,!1,0,nt,ye,!1)):(At.font=Pe.baseFontFull,At.fillStyle=Pe.bgCell,At.fillRect(0,0,qe.width,qe.height),zc(At,b([ot,Ge]),0,Ge,!1,!1,0,0,Ne.width,Ne.height,!1,Pe,Pe.bgCell,bt,nt,1,void 0,!1,0,void 0,void 0,void 0,Hn,Ye,()=>{}))),qe.style.left="-100%",qe.style.position="absolute",qe.style.width=`${Ne.width}px`,qe.style.height=`${Ne.height}px`,document.body.append(qe),g.dataTransfer.setDragImage(qe,Ne.width/2,Ne.height/2),window.setTimeout(()=>{qe.remove()},0)}}else g.preventDefault()},[Ce,se,je,re,Je,Pe,vt,nt,ye,b,bt,Hn,Ye]);nn("dragstart",Dr,(J==null?void 0:J.current)??null,!1,!1);const dr=c.useRef(),Yr=c.useCallback(g=>{const k=Le.current;if(me!==void 0&&g.preventDefault(),k===null||$e===void 0)return;const _=je(k,g.clientX,g.clientY),[K,Y]=_.location,ee=K-(de?0:1),[ke,rt]=dr.current??[];(ke!==ee||rt!==Y)&&(dr.current=[ee,Y],$e([ee,Y],g.dataTransfer))},[de,je,$e,me]);nn("dragover",Yr,(J==null?void 0:J.current)??null,!1,!1);const qr=c.useCallback(()=>{dr.current=void 0,Te==null||Te()},[Te]);nn("dragend",qr,(J==null?void 0:J.current)??null,!1,!1);const mn=c.useCallback(g=>{const k=Le.current;if(k===null||me===void 0)return;g.preventDefault();const _=je(k,g.clientX,g.clientY),[K,Y]=_.location,ee=K-(de?0:1);me([ee,Y],g.dataTransfer)},[de,je,me]);nn("drop",mn,(J==null?void 0:J.current)??null,!1,!1);const kn=c.useCallback(()=>{Xe==null||Xe()},[Xe]);nn("dragleave",kn,(J==null?void 0:J.current)??null,!1,!1);const en=c.useRef($);en.current=$;const D=c.useRef(null),lt=c.useCallback(g=>{var k;Le.current===null||!Le.current.contains(document.activeElement)||(g===null&&en.current.current!==void 0?(k=ie==null?void 0:ie.current)==null||k.focus({preventScroll:!0}):g!==null&&g.focus({preventScroll:!0}),D.current=g)},[ie]);c.useImperativeHandle(t,()=>({focus:()=>{var k;const g=D.current;g===null||!document.contains(g)?(k=ie==null?void 0:ie.current)==null||k.focus({preventScroll:!0}):g.focus({preventScroll:!0})},getBounds:(g,k)=>{if(!(ie===void 0||ie.current===null))return Je(ie.current,g??0,k??-1)},damage:Rr,getMouseArgsForPosition:(g,k,_)=>{if(!(ie===void 0||ie.current===null))return je(ie.current,g,k,_)}}),[ie,Rr,Je,je]);const An=c.useRef(),To=Tp(()=>{var rt,we,jt;if(n<50||(xe==null?void 0:xe.disableAccessibilityTree)===!0)return null;let g=Ds(vt,Re,n,he,tt);const k=de?0:-1;!de&&((rt=g[0])==null?void 0:rt.sourceIndex)===0&&(g=g.slice(1));const[_,K]=((we=$.current)==null?void 0:we.cell)??[],Y=(jt=$.current)==null?void 0:jt.range,ee=g.map(Se=>Se.sourceIndex),ke=Hr(s,Math.min(p,s+o));return _!==void 0&&K!==void 0&&!(ee.includes(_)&&ke.includes(K))&<(null),c.createElement("table",{key:"access-tree",role:"grid","aria-rowcount":p+1,"aria-multiselectable":"true","aria-colcount":vt.length+k},c.createElement("thead",{role:"rowgroup"},c.createElement("tr",{role:"row","aria-rowindex":1},g.map(Se=>c.createElement("th",{role:"columnheader","aria-selected":$.columns.hasIndex(Se.sourceIndex),"aria-colindex":Se.sourceIndex+1+k,tabIndex:-1,onFocus:ot=>{if(ot.target!==D.current)return Ee==null?void 0:Ee([Se.sourceIndex,-1])},key:Se.sourceIndex},Se.title)))),c.createElement("tbody",{role:"rowgroup"},ke.map(Se=>c.createElement("tr",{role:"row","aria-selected":$.rows.hasIndex(Se),key:Se,"aria-rowindex":Se+2},g.map(ot=>{const Ge=ot.sourceIndex,qe=nr(Ge,Se),Ne=_===Ge&&K===Se,ct=Y!==void 0&&Ge>=Y.x&&Ge<Y.x+Y.width&&Se>=Y.y&&Se<Y.y+Y.height,At=`glide-cell-${Ge}-${Se}`,Fn=[Ge,Se],_n=b(Fn,!0);return c.createElement("td",{key:qe,role:"gridcell","aria-colindex":Ge+1+k,"aria-selected":ct,"aria-readonly":ao(_n)||!io(_n),id:At,"data-testid":At,onClick:()=>{const It=ie==null?void 0:ie.current;if(It!=null)return te==null?void 0:te({bounds:Je(It,Ge,Se),cancel:()=>{},preventDefault:()=>{},stopPropagation:()=>{},ctrlKey:!1,key:"Enter",keyCode:13,metaKey:!1,shiftKey:!1,altKey:!1,rawEvent:void 0,location:Fn})},onFocusCapture:It=>{var Pt,wt;if(!(It.target===D.current||((Pt=An.current)==null?void 0:Pt[0])===Ge&&((wt=An.current)==null?void 0:wt[1])===Se))return An.current=Fn,Ee==null?void 0:Ee(Fn)},ref:Ne?lt:void 0,tabIndex:-1},CC(_n,Ye))})))))},[n,vt,Re,he,tt,p,s,o,$,lt,b,ie,te,Je,Ee],200),Qn=L===0||!A?0:Re>L?1:In(-tt/100,0,1),fr=-s*32+pt,Zn=H?In(-fr/100,0,1):0,Do=c.useMemo(()=>{if(!Qn&&!Zn)return null;const g={position:"absolute",top:0,left:Wt,width:n-Wt,height:r,opacity:Qn,pointerEvents:"none",transition:ze?void 0:"opacity 0.2s",boxShadow:"inset 13px 0 10px -13px rgba(0, 0, 0, 0.2)"},k={position:"absolute",top:_t,left:0,width:n,height:r,opacity:Zn,pointerEvents:"none",transition:ce?void 0:"opacity 0.2s",boxShadow:"inset 0 13px 10px -13px rgba(0, 0, 0, 0.2)"};return c.createElement(c.Fragment,null,Qn>0&&c.createElement("div",{id:"shadow-x",style:g}),Zn>0&&c.createElement("div",{id:"shadow-y",style:k}))},[Qn,Zn,Wt,n,ze,_t,r,ce]),z=c.useMemo(()=>({position:"absolute",top:0,left:0}),[]);return c.createElement(c.Fragment,null,c.createElement("canvas",{"data-testid":"data-grid-canvas",tabIndex:0,onKeyDown:Kr,onKeyUp:gn,onFocus:I,onBlur:W,ref:Tr,style:lr},To),c.createElement("canvas",{ref:Mt,style:z}),Do)},SC=c.memo(c.forwardRef(kC));function Lo(e,t,n,r){return In(Math.round(t-(e.growOffset??0)),Math.ceil(n),Math.floor(r))}const RC=e=>{const[t,n]=c.useState(),[r,o]=c.useState(),[i,a]=c.useState(),[s,l]=c.useState(),[u,d]=c.useState(!1),[h,p]=c.useState(),[b,m]=c.useState(),[y,x]=c.useState(),[C,w]=c.useState(!1),[I,W]=c.useState(),{onHeaderMenuClick:B,onHeaderIndicatorClick:$,getCellContent:L,onColumnMoved:V,onColumnResize:R,onColumnResizeStart:A,onColumnResizeEnd:H,gridRef:j,maxColumnWidth:F,minColumnWidth:T,onRowMoved:fe,lockColumns:G,onColumnProposeMove:Z,onMouseDown:he,onMouseUp:de,onItemHovered:te,onDragStart:q,canvasRef:ve}=e,ie=(R??H??A)!==void 0,{columns:re,selection:Te}=e,J=Te.columns,se=c.useCallback(oe=>{const[ye,Ee]=oe.location;i!==void 0&&s!==ye&&ye>=G?(d(!0),l(ye)):b!==void 0&&Ee!==void 0?(w(!0),x(Math.max(0,Ee))):r===void 0&&!u&&!C&&(te==null||te(oe))},[i,b,s,te,G,r,u,C]),ge=V!==void 0,Be=c.useCallback(oe=>{var ye;if(oe.button===0){const[Ee,$e]=oe.location;if(oe.kind==="out-of-bounds"&&oe.isEdge&&ie){const me=(ye=j==null?void 0:j.current)==null?void 0:ye.getBounds(re.length-1,-1);me!==void 0&&(n(me.x),o(re.length-1))}else if(oe.kind==="header"&&Ee>=G){const me=ve==null?void 0:ve.current;if(oe.isEdge&&ie&&me){n(oe.bounds.x),o(Ee);const Ke=me.getBoundingClientRect().width/me.offsetWidth,ze=oe.bounds.width/Ke;A==null||A(re[Ee],ze,Ee,ze+(re[Ee].growOffset??0))}else oe.kind==="header"&&ge&&(p(oe.bounds.x),a(Ee))}else oe.kind==="cell"&&G>0&&Ee===0&&$e!==void 0&&fe!==void 0&&(W(oe.bounds.y),m($e))}he==null||he(oe)},[he,ie,G,fe,j,re,ge,A,ve]),Ce=c.useCallback((oe,ye)=>{u||C||B==null||B(oe,ye)},[u,C,B]),st=c.useCallback((oe,ye)=>{u||C||$==null||$(oe,ye)},[u,C,$]),at=c.useRef(-1),De=c.useCallback(()=>{at.current=-1,m(void 0),x(void 0),W(void 0),w(!1),a(void 0),l(void 0),p(void 0),d(!1),o(void 0),n(void 0)},[]),_e=c.useCallback((oe,ye)=>{if(oe.button===0){if(r!==void 0){if((J==null?void 0:J.hasIndex(r))===!0)for(const $e of J){if($e===r)continue;const me=re[$e],Xe=Lo(me,at.current,T,F);R==null||R(me,Xe,$e,Xe+(me.growOffset??0))}const Ee=Lo(re[r],at.current,T,F);if(H==null||H(re[r],Ee,r,Ee+(re[r].growOffset??0)),J.hasIndex(r))for(const $e of J){if($e===r)continue;const me=re[$e],Xe=Lo(me,at.current,T,F);H==null||H(me,Xe,$e,Xe+(me.growOffset??0))}}De(),i!==void 0&&s!==void 0&&(Z==null?void 0:Z(i,s))!==!1&&(V==null||V(i,s)),b!==void 0&&y!==void 0&&(fe==null||fe(b,y))}de==null||de(oe,ye)},[de,r,i,s,b,y,J,H,re,T,F,R,V,fe,De,Z]),Pe=c.useMemo(()=>{if(!(i===void 0||s===void 0)&&i!==s&&(Z==null?void 0:Z(i,s))!==!1)return{src:i,dest:s}},[i,s,Z]),xt=c.useCallback(oe=>{const ye=ve==null?void 0:ve.current;if(i!==void 0&&h!==void 0)Math.abs(oe.clientX-h)>20&&d(!0);else if(b!==void 0&&I!==void 0)Math.abs(oe.clientY-I)>20&&w(!0);else if(r!==void 0&&t!==void 0&&ye){const $e=ye.getBoundingClientRect().width/ye.offsetWidth,me=(oe.clientX-t)/$e,Xe=re[r],Ke=Lo(Xe,me,T,F);if(R==null||R(Xe,Ke,r,Ke+(Xe.growOffset??0)),at.current=me,(J==null?void 0:J.first())===r)for(const ze of J){if(ze===r)continue;const ce=re[ze],xe=Lo(ce,at.current,T,F);R==null||R(ce,xe,ze,xe+(ce.growOffset??0))}}},[i,h,b,I,r,t,re,T,F,R,J,ve]),Ct=c.useCallback((oe,ye)=>{if(b===void 0||y===void 0)return L(oe,ye);let[Ee,$e]=oe;return $e===y?$e=b:($e>y&&($e-=1),$e>=b&&($e+=1)),L([Ee,$e],ye)},[b,y,L]),ft=c.useCallback(oe=>{q==null||q(oe),oe.defaultPrevented()||De()},[De,q]);return c.createElement(SC,{accessibilityHeight:e.accessibilityHeight,canvasRef:e.canvasRef,cellXOffset:e.cellXOffset,cellYOffset:e.cellYOffset,columns:e.columns,disabledRows:e.disabledRows,drawFocusRing:e.drawFocusRing,drawHeader:e.drawHeader,drawCell:e.drawCell,enableGroups:e.enableGroups,eventTargetRef:e.eventTargetRef,experimental:e.experimental,fillHandle:e.fillHandle,firstColAccessible:e.firstColAccessible,fixedShadowX:e.fixedShadowX,fixedShadowY:e.fixedShadowY,freezeColumns:e.freezeColumns,getCellRenderer:e.getCellRenderer,getGroupDetails:e.getGroupDetails,getRowThemeOverride:e.getRowThemeOverride,groupHeaderHeight:e.groupHeaderHeight,headerHeight:e.headerHeight,headerIcons:e.headerIcons,height:e.height,highlightRegions:e.highlightRegions,imageWindowLoader:e.imageWindowLoader,resizeColumn:r,isDraggable:e.isDraggable,isFilling:e.isFilling,isFocused:e.isFocused,onCanvasBlur:e.onCanvasBlur,onCanvasFocused:e.onCanvasFocused,onCellFocused:e.onCellFocused,onContextMenu:e.onContextMenu,onDragEnd:e.onDragEnd,onDragLeave:e.onDragLeave,onDragOverCell:e.onDragOverCell,onDrop:e.onDrop,onKeyDown:e.onKeyDown,onKeyUp:e.onKeyUp,onMouseMove:e.onMouseMove,prelightCells:e.prelightCells,rowHeight:e.rowHeight,rows:e.rows,selection:e.selection,smoothScrollX:e.smoothScrollX,smoothScrollY:e.smoothScrollY,theme:e.theme,freezeTrailingRows:e.freezeTrailingRows,hasAppendRow:e.hasAppendRow,translateX:e.translateX,translateY:e.translateY,resizeIndicator:e.resizeIndicator,verticalBorder:e.verticalBorder,width:e.width,getCellContent:Ct,isResizing:r!==void 0,onHeaderMenuClick:Ce,onHeaderIndicatorClick:st,isDragging:u,onItemHovered:se,onDragStart:ft,onMouseDown:Be,allowResize:ie,onMouseUp:_e,dragAndDropState:Pe,onMouseMoveRaw:xt,ref:j})};function MC(e){const t=c.useRef(null),[n,r]=c.useState({width:e==null?void 0:e[0],height:e==null?void 0:e[1]});return c.useLayoutEffect(()=>{const o=a=>{for(const s of a){const{width:l,height:u}=s&&s.contentRect||{};r(d=>d.width===l&&d.height===u?d:{width:l,height:u})}},i=new window.ResizeObserver(o);return t.current&&i.observe(t.current,void 0),()=>{i.disconnect()}},[t.current]),{ref:t,...n}}const IC=(e,t,n)=>{const r=c.useRef(null),o=c.useRef(null),i=c.useRef(null),a=c.useRef(0),s=c.useRef(t);s.current=t;const l=n.current;c.useEffect(()=>{const u=()=>{var p,b;if(o.current===!1&&l!==null){const m=[l.scrollLeft,l.scrollTop];if(((p=i.current)==null?void 0:p[0])===m[0]&&((b=i.current)==null?void 0:b[1])===m[1])if(a.current>10){i.current=null,o.current=null;return}else a.current++;else a.current=0,s.current(m[0],m[1]),i.current=m;r.current=window.setTimeout(u,8.333333333333334)}},d=()=>{o.current=!0,i.current=null,r.current!==null&&(window.clearTimeout(r.current),r.current=null)},h=p=>{p.touches.length===0&&(o.current=!1,a.current=0,r.current=window.setTimeout(u,8.333333333333334))};if(e&&l!==null){const p=l;return p.addEventListener("touchstart",d),p.addEventListener("touchend",h),()=>{p.removeEventListener("touchstart",d),p.removeEventListener("touchend",h),r.current!==null&&window.clearTimeout(r.current)}}},[e,l])},EC=()=>e=>e.isSafari?"scroll":"auto",TC=Cr("div")({name:"ScrollRegionStyle",class:"gdg-s1dgczr6",propsAsIs:!1,vars:{"s1dgczr6-0":[EC()]}}),DC=33554400,$C=5e6;function AC(e){const[t,n]=c.useState(!1),r=typeof window>"u"?null:window,o=c.useRef(0);return nn("touchstart",c.useCallback(()=>{window.clearTimeout(o.current),n(!0)},[]),r,!0,!1),nn("touchend",c.useCallback(i=>{i.touches.length===0&&(o.current=window.setTimeout(()=>n(!1),e))},[e]),r,!0,!1),t}const FC=e=>{var Te,J;const{children:t,clientHeight:n,scrollHeight:r,scrollWidth:o,update:i,draggable:a,className:s,preventDiagonalScrolling:l=!1,paddingBottom:u=0,paddingRight:d=0,rightElement:h,rightElementProps:p,kineticScrollPerfHack:b=!1,scrollRef:m,initialSize:y}=e,x=[],C=(p==null?void 0:p.sticky)??!1,w=(p==null?void 0:p.fill)??!1,I=c.useRef(0),W=c.useRef(0),B=c.useRef(null),$=typeof window>"u"?1:window.devicePixelRatio,L=c.useRef($);c.useEffect(()=>{if(L.current!==$){I.current=0,W.current=0,L.current=$;const se=B.current;se!==null&&fe.current(se.scrollLeft,se.scrollTop)}},[$]);const V=c.useRef({scrollLeft:0,scrollTop:0,lockDirection:void 0}),R=c.useRef(null),A=AC(200),[H,j]=c.useState(!0),F=c.useRef(0);c.useLayoutEffect(()=>{if(!H||A||V.current.lockDirection===void 0)return;const se=B.current;if(se===null)return;const[ge,Be]=V.current.lockDirection;ge!==void 0?se.scrollLeft=ge:Be!==void 0&&(se.scrollTop=Be),V.current.lockDirection=void 0},[A,H]);const T=c.useCallback((se,ge)=>{var Ee;const Be=B.current;if(Be===null)return;ge=ge??Be.scrollTop,se=se??Be.scrollLeft;const Ce=V.current.scrollTop,st=V.current.scrollLeft,at=se-st,De=ge-Ce;A&&at!==0&&De!==0&&(Math.abs(at)>3||Math.abs(De)>3)&&l&&V.current.lockDirection===void 0&&(V.current.lockDirection=Math.abs(at)<Math.abs(De)?[st,void 0]:[void 0,Ce]);const _e=V.current.lockDirection;se=(_e==null?void 0:_e[0])??se,ge=(_e==null?void 0:_e[1])??ge,V.current.scrollLeft=se,V.current.scrollTop=ge;const Pe=Be.clientWidth,xt=Be.clientHeight,Ct=ge,ft=W.current-Ct,oe=Be.scrollHeight-xt;W.current=Ct;let ye;if(oe>0&&r>Be.scrollHeight+5)if(Math.abs(ft)>2e3||Ct===0||Ct===oe){const $e=Math.max(0,Math.min(1,Ct/oe)),me=r-xt;ye=$e*me,I.current=ye}else I.current-=ft,ye=I.current;else ye=Ct,I.current=ye;ye=Math.max(0,Math.min(ye,r-xt)),I.current=ye,_e!==void 0&&(window.clearTimeout(F.current),j(!1),F.current=window.setTimeout(()=>j(!0),200)),i({x:se,y:ye,width:Pe-d,height:xt-u,paddingRight:((Ee=R.current)==null?void 0:Ee.clientWidth)??0})},[u,d,r,i,l,A]);IC(b&&ji.value,T,B);const fe=c.useRef(T);fe.current=T;const G=c.useRef(),Z=c.useRef(!1);c.useLayoutEffect(()=>{Z.current?T():Z.current=!0},[T,u,d]);const he=c.useCallback(se=>{B.current=se,m!==void 0&&(m.current=se)},[m]);let de=0,te=0;const q=Math.min(r,DC);for(x.push(c.createElement("div",{key:de++,style:{width:o,height:0}}));te<q;){const se=Math.min($C,q-te);x.push(c.createElement("div",{key:de++,style:{width:0,height:se}})),te+=se}const{ref:ve,width:ie,height:re}=MC(y);return typeof window<"u"&&(((Te=G.current)==null?void 0:Te.height)!==re||((J=G.current)==null?void 0:J.width)!==ie)&&(window.setTimeout(()=>fe.current(),0),G.current={width:ie,height:re}),(ie??0)===0||(re??0)===0?c.createElement("div",{ref:ve}):c.createElement("div",{ref:ve},c.createElement(TC,{isSafari:ji.value},c.createElement("div",{className:"dvn-underlay"},t),c.createElement("div",{ref:he,style:G.current,draggable:a,onDragStart:se=>{a||(se.stopPropagation(),se.preventDefault())},className:"dvn-scroller "+(s??""),onScroll:()=>T()},c.createElement("div",{className:"dvn-scroll-inner"+(h===void 0?" dvn-hidden":"")},c.createElement("div",{className:"dvn-stack"},x),h!==void 0&&c.createElement(c.Fragment,null,!w&&c.createElement("div",{className:"dvn-spacer"}),c.createElement("div",{ref:R,style:{height:re,maxHeight:n-Math.ceil($%1),position:"sticky",top:0,paddingLeft:1,marginBottom:-40,marginRight:d,flexGrow:w?1:void 0,right:C?d??0:void 0,pointerEvents:"auto"}},h))))))},_C=e=>{const{columns:t,rows:n,rowHeight:r,headerHeight:o,groupHeaderHeight:i,enableGroups:a,freezeColumns:s,experimental:l,nonGrowWidth:u,clientSize:d,className:h,onVisibleRegionChanged:p,scrollRef:b,preventDiagonalScrolling:m,rightElement:y,rightElementProps:x,overscrollX:C,overscrollY:w,initialSize:I,smoothScrollX:W=!1,smoothScrollY:B=!1,isDraggable:$}=e,{paddingRight:L,paddingBottom:V}=l??{},[R,A]=d,H=c.useRef(),j=c.useRef(),F=c.useRef(),T=c.useRef(),fe=u+Math.max(0,C??0);let G=a?o+i:o;if(typeof r=="number")G+=n*r;else for(let te=0;te<n;te++)G+=r(te);w!==void 0&&(G+=w);const Z=c.useRef(),he=c.useCallback(()=>{var st,at;if(Z.current===void 0)return;const te={...Z.current};let q=0,ve=te.x<0?-te.x:0,ie=0,re=0;te.x=te.x<0?0:te.x;let Te=0;for(let De=0;De<s;De++)Te+=t[De].width;for(const De of t){const _e=q-Te;if(te.x>=_e+De.width)q+=De.width,re++,ie++;else if(te.x>_e)q+=De.width,W?ve+=_e-te.x:re++,ie++;else if(te.x+te.width>_e)q+=De.width,ie++;else break}let J=0,se=0,ge=0;if(typeof r=="number")B?(se=Math.floor(te.y/r),J=se*r-te.y):se=Math.ceil(te.y/r),ge=Math.ceil(te.height/r)+se,J<0&&ge++;else{let De=0;for(let _e=0;_e<n;_e++){const Pe=r(_e),xt=De+(B?0:Pe/2);if(te.y>=De+Pe)De+=Pe,se++,ge++;else if(te.y>xt)De+=Pe,B?J+=xt-te.y:se++,ge++;else if(te.y+te.height>Pe/2+De)De+=Pe,ge++;else break}}se=Math.max(0,Math.min(se,n-1)),ge=Math.max(se,Math.min(ge,n));const Be={x:re,y:se,width:ie-re,height:ge-se},Ce=H.current;(Ce===void 0||Ce.y!==Be.y||Ce.x!==Be.x||Ce.height!==Be.height||Ce.width!==Be.width||j.current!==ve||F.current!==J||te.width!==((st=T.current)==null?void 0:st[0])||te.height!==((at=T.current)==null?void 0:at[1]))&&(p==null||p({x:re,y:se,width:ie-re,height:ge-se},te.width,te.height,te.paddingRight??0,ve,J),H.current=Be,j.current=ve,F.current=J,T.current=[te.width,te.height])},[t,r,n,p,s,W,B]),de=c.useCallback(te=>{Z.current=te,he()},[he]);return c.useEffect(()=>{he()},[he]),c.createElement(FC,{scrollRef:b,className:h,kineticScrollPerfHack:l==null?void 0:l.kineticScrollPerfHack,preventDiagonalScrolling:m,draggable:$===!0||typeof $=="string",scrollWidth:fe+(L??0),scrollHeight:G+(V??0),clientHeight:A,rightElement:y,paddingBottom:V,paddingRight:L,rightElementProps:x,update:de,initialSize:I},c.createElement(RC,{eventTargetRef:b,width:R,height:A,accessibilityHeight:e.accessibilityHeight,canvasRef:e.canvasRef,cellXOffset:e.cellXOffset,cellYOffset:e.cellYOffset,columns:e.columns,disabledRows:e.disabledRows,enableGroups:e.enableGroups,fillHandle:e.fillHandle,firstColAccessible:e.firstColAccessible,fixedShadowX:e.fixedShadowX,fixedShadowY:e.fixedShadowY,freezeColumns:e.freezeColumns,getCellContent:e.getCellContent,getCellRenderer:e.getCellRenderer,getGroupDetails:e.getGroupDetails,getRowThemeOverride:e.getRowThemeOverride,groupHeaderHeight:e.groupHeaderHeight,headerHeight:e.headerHeight,highlightRegions:e.highlightRegions,imageWindowLoader:e.imageWindowLoader,isFilling:e.isFilling,isFocused:e.isFocused,lockColumns:e.lockColumns,maxColumnWidth:e.maxColumnWidth,minColumnWidth:e.minColumnWidth,onHeaderMenuClick:e.onHeaderMenuClick,onHeaderIndicatorClick:e.onHeaderIndicatorClick,onMouseMove:e.onMouseMove,prelightCells:e.prelightCells,rowHeight:e.rowHeight,rows:e.rows,selection:e.selection,theme:e.theme,freezeTrailingRows:e.freezeTrailingRows,hasAppendRow:e.hasAppendRow,translateX:e.translateX,translateY:e.translateY,onColumnProposeMove:e.onColumnProposeMove,verticalBorder:e.verticalBorder,drawFocusRing:e.drawFocusRing,drawHeader:e.drawHeader,drawCell:e.drawCell,experimental:e.experimental,gridRef:e.gridRef,headerIcons:e.headerIcons,isDraggable:e.isDraggable,onCanvasBlur:e.onCanvasBlur,onCanvasFocused:e.onCanvasFocused,onCellFocused:e.onCellFocused,onColumnMoved:e.onColumnMoved,onColumnResize:e.onColumnResize,onColumnResizeEnd:e.onColumnResizeEnd,onColumnResizeStart:e.onColumnResizeStart,onContextMenu:e.onContextMenu,onDragEnd:e.onDragEnd,onDragLeave:e.onDragLeave,onDragOverCell:e.onDragOverCell,onDragStart:e.onDragStart,onDrop:e.onDrop,onItemHovered:e.onItemHovered,onKeyDown:e.onKeyDown,onKeyUp:e.onKeyUp,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onRowMoved:e.onRowMoved,smoothScrollX:e.smoothScrollX,smoothScrollY:e.smoothScrollY,resizeIndicator:e.resizeIndicator}))},PC=Cr("div")({name:"SearchWrapper",class:"gdg-seveqep",propsAsIs:!1}),OC=c.createElement("svg",{className:"button-icon",viewBox:"0 0 512 512"},c.createElement("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"48",d:"M112 244l144-144 144 144M256 120v292"})),jC=c.createElement("svg",{className:"button-icon",viewBox:"0 0 512 512"},c.createElement("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"48",d:"M112 268l144 144 144-144M256 392V100"})),NC=c.createElement("svg",{className:"button-icon",viewBox:"0 0 512 512"},c.createElement("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"32",d:"M368 368L144 144M368 144L144 368"})),HC=10,BC=e=>{const{canvasRef:t,cellYOffset:n,rows:r,columns:o,searchInputRef:i,searchValue:a,searchResults:s,onSearchValueChange:l,getCellsForSelection:u,onSearchResultsChanged:d,showSearch:h=!1,onSearchClose:p}=e,[b]=c.useState(()=>"search-box-"+Math.round(Math.random()*1e3)),[m,y]=c.useState(""),x=a??m,C=c.useCallback(q=>{y(q),l==null||l(q)},[l]),[w,I]=c.useState(),W=c.useRef(w);W.current=w,c.useEffect(()=>{s!==void 0&&(s.length>0?I(q=>({rowsSearched:r,results:s.length,selectedIndex:(q==null?void 0:q.selectedIndex)??-1})):I(void 0))},[r,s]);const B=c.useRef();B.current===void 0&&(B.current=new AbortController);const $=c.useRef(),[L,V]=c.useState([]),R=s??L,A=c.useCallback(()=>{$.current!==void 0&&(window.cancelAnimationFrame($.current),$.current=void 0),B.current!==void 0&&B.current.abort(),B.current=new AbortController},[]),H=c.useRef(n);H.current=n;const j=c.useCallback(q=>{const ve=new RegExp(q.replace(/([$()*+.?[\\\]^{|}-])/g,"\\$1"),"i");let ie=H.current,re=Math.min(10,r),Te=0;I(void 0),V([]);const J=[],se=async()=>{var Ct;if(u===void 0)return;const ge=performance.now(),Be=r-Te;let Ce=u({x:0,y:ie,width:o.length,height:Math.min(re,Be,r-ie)},B.current.signal);typeof Ce=="function"&&(Ce=await Ce());let st=!1;for(const[ft,oe]of Ce.entries())for(const[ye,Ee]of oe.entries()){let $e;switch(Ee.kind){case ue.Text:case ue.Number:$e=Ee.displayData;break;case ue.Uri:case ue.Markdown:$e=Ee.data;break;case ue.Boolean:$e=typeof Ee.data=="boolean"?Ee.data.toString():void 0;break;case ue.Image:case ue.Bubble:$e=Ee.data.join("🐳");break;case ue.Custom:$e=Ee.copyData;break}$e!==void 0&&ve.test($e)&&(J.push([ye,ft+ie]),st=!0)}const at=performance.now();st&&V([...J]),Te+=Ce.length,bn(Te<=r);const De=((Ct=W.current)==null?void 0:Ct.selectedIndex)??-1;I({results:J.length,rowsSearched:Te,selectedIndex:De}),d==null||d(J,De),ie+re>=r?ie=0:ie+=re;const _e=at-ge,Pe=Math.max(_e,1),xt=HC/Pe;re=Math.ceil(re*xt),Te<r&&J.length<1e3&&($.current=window.requestAnimationFrame(se))};A(),$.current=window.requestAnimationFrame(se)},[A,o.length,u,d,r]),F=c.useCallback(()=>{var q;p==null||p(),I(void 0),V([]),d==null||d([],-1),A(),(q=t==null?void 0:t.current)==null||q.focus()},[A,t,p,d]),T=c.useCallback(q=>{C(q.target.value),s===void 0&&(q.target.value===""?(I(void 0),V([]),A()):j(q.target.value))},[j,A,C,s]);c.useEffect(()=>{i.current!==null&&(C(""),I(void 0),L.length>0&&(V([]),d==null||d([],-1)),h?i.current.focus({preventScroll:!0}):A())},[h,i]);const fe=c.useCallback(q=>{var ie;if((ie=q==null?void 0:q.stopPropagation)==null||ie.call(q),w===void 0||w.results===0)return;const ve=(w.selectedIndex+1)%w.results;I({...w,selectedIndex:ve}),d==null||d(R,ve)},[w,d,R]),G=c.useCallback(q=>{var ie;if((ie=q==null?void 0:q.stopPropagation)==null||ie.call(q),w===void 0||w.results===0)return;let ve=(w.selectedIndex-1)%w.results;ve<0&&(ve+=w.results),I({...w,selectedIndex:ve}),d==null||d(R,ve)},[d,R,w]),Z=c.useCallback(q=>{(q.ctrlKey||q.metaKey)&&q.nativeEvent.code==="KeyF"||q.key==="Escape"?(F(),q.stopPropagation(),q.preventDefault()):q.key==="Enter"&&(q.shiftKey?G():fe())},[F,fe,G]);c.useEffect(()=>()=>{A()},[A]);const[he,de]=c.useState(!1);c.useEffect(()=>{if(h)de(!0);else{const q=setTimeout(()=>de(!1),150);return()=>clearTimeout(q)}},[h]);const te=c.useMemo(()=>{if(!h&&!he)return null;let q;w!==void 0&&(q=w.results>=1e3?"over 1000":`${w.results} result${w.results!==1?"s":""}`,w.selectedIndex>=0&&(q=`${w.selectedIndex+1} of ${q}`));const ve=Te=>{Te.stopPropagation()},re={width:`${r>0?Math.floor(((w==null?void 0:w.rowsSearched)??0)/r*100):0}%`};return c.createElement(PC,{className:"gdg-search-bar"+(h?"":" out"),onMouseDown:ve,onMouseMove:ve,onMouseUp:ve,onClick:ve},c.createElement("div",{className:"gdg-search-bar-inner"},c.createElement("input",{id:b,"aria-hidden":!h,"data-testid":"search-input",ref:i,onChange:T,value:x,tabIndex:h?void 0:-1,onKeyDownCapture:Z}),c.createElement("button",{type:"button","aria-label":"Previous Result","aria-hidden":!h,tabIndex:h?void 0:-1,onClick:G,disabled:((w==null?void 0:w.results)??0)===0},OC),c.createElement("button",{type:"button","aria-label":"Next Result","aria-hidden":!h,tabIndex:h?void 0:-1,onClick:fe,disabled:((w==null?void 0:w.results)??0)===0},jC),p!==void 0&&c.createElement("button",{type:"button","aria-label":"Close Search","aria-hidden":!h,"data-testid":"search-close-button",tabIndex:h?void 0:-1,onClick:F},NC)),w!==void 0?c.createElement(c.Fragment,null,c.createElement("div",{className:"gdg-search-status"},c.createElement("div",{"data-testid":"search-result-area"},q)),c.createElement("div",{className:"gdg-search-progress",style:re})):c.createElement("div",{className:"gdg-search-status"},c.createElement("label",{htmlFor:b},"Type to search")))},[h,he,w,r,b,i,T,x,Z,G,fe,p,F]);return c.createElement(c.Fragment,null,c.createElement(_C,{prelightCells:R,accessibilityHeight:e.accessibilityHeight,canvasRef:e.canvasRef,cellXOffset:e.cellXOffset,cellYOffset:e.cellYOffset,className:e.className,clientSize:e.clientSize,columns:e.columns,disabledRows:e.disabledRows,enableGroups:e.enableGroups,fillHandle:e.fillHandle,firstColAccessible:e.firstColAccessible,nonGrowWidth:e.nonGrowWidth,fixedShadowX:e.fixedShadowX,fixedShadowY:e.fixedShadowY,freezeColumns:e.freezeColumns,getCellContent:e.getCellContent,getCellRenderer:e.getCellRenderer,getGroupDetails:e.getGroupDetails,getRowThemeOverride:e.getRowThemeOverride,groupHeaderHeight:e.groupHeaderHeight,headerHeight:e.headerHeight,highlightRegions:e.highlightRegions,imageWindowLoader:e.imageWindowLoader,initialSize:e.initialSize,isFilling:e.isFilling,isFocused:e.isFocused,lockColumns:e.lockColumns,maxColumnWidth:e.maxColumnWidth,minColumnWidth:e.minColumnWidth,onHeaderMenuClick:e.onHeaderMenuClick,onHeaderIndicatorClick:e.onHeaderIndicatorClick,onMouseMove:e.onMouseMove,onVisibleRegionChanged:e.onVisibleRegionChanged,overscrollX:e.overscrollX,overscrollY:e.overscrollY,preventDiagonalScrolling:e.preventDiagonalScrolling,rightElement:e.rightElement,rightElementProps:e.rightElementProps,rowHeight:e.rowHeight,rows:e.rows,scrollRef:e.scrollRef,selection:e.selection,theme:e.theme,freezeTrailingRows:e.freezeTrailingRows,hasAppendRow:e.hasAppendRow,translateX:e.translateX,translateY:e.translateY,verticalBorder:e.verticalBorder,onColumnProposeMove:e.onColumnProposeMove,drawFocusRing:e.drawFocusRing,drawCell:e.drawCell,drawHeader:e.drawHeader,experimental:e.experimental,gridRef:e.gridRef,headerIcons:e.headerIcons,isDraggable:e.isDraggable,onCanvasBlur:e.onCanvasBlur,onCanvasFocused:e.onCanvasFocused,onCellFocused:e.onCellFocused,onColumnMoved:e.onColumnMoved,onColumnResize:e.onColumnResize,onColumnResizeEnd:e.onColumnResizeEnd,onColumnResizeStart:e.onColumnResizeStart,onContextMenu:e.onContextMenu,onDragEnd:e.onDragEnd,onDragLeave:e.onDragLeave,onDragOverCell:e.onDragOverCell,onDragStart:e.onDragStart,onDrop:e.onDrop,onItemHovered:e.onItemHovered,onKeyDown:e.onKeyDown,onKeyUp:e.onKeyUp,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onRowMoved:e.onRowMoved,smoothScrollX:e.smoothScrollX,smoothScrollY:e.smoothScrollY,resizeIndicator:e.resizeIndicator}),te)};class LC extends c.PureComponent{constructor(){super(...arguments);Ue(this,"wrapperRef",c.createRef());Ue(this,"clickOutside",n=>{if(!(this.props.isOutsideClick&&!this.props.isOutsideClick(n))&&this.wrapperRef.current!==null&&!this.wrapperRef.current.contains(n.target)){let r=n.target;for(;r!==null;){if(r.classList.contains("click-outside-ignore"))return;r=r.parentElement}this.props.onClickOutside()}})}componentDidMount(){const n=this.props.customEventTarget??document;n.addEventListener("pointerdown",this.clickOutside,!0),n.addEventListener("contextmenu",this.clickOutside,!0)}componentWillUnmount(){const n=this.props.customEventTarget??document;n.removeEventListener("pointerdown",this.clickOutside,!0),n.removeEventListener("contextmenu",this.clickOutside,!0)}render(){const{onClickOutside:n,isOutsideClick:r,customEventTarget:o,...i}=this.props;return c.createElement("div",{...i,ref:this.wrapperRef},this.props.children)}}const zC=()=>e=>Math.max(16,e.targetHeight-10),WC=Cr("input")({name:"RenameInput",class:"gdg-r17m35ur",propsAsIs:!1,vars:{"r17m35ur-0":[zC(),"px"]}}),GC=e=>{const{bounds:t,group:n,onClose:r,canvasBounds:o,onFinish:i}=e,[a,s]=Bt.useState(n);return Bt.createElement(LC,{style:{position:"absolute",left:t.x-o.left+1,top:t.y-o.top,width:t.width-2,height:t.height},className:"gdg-c1tqibwd",onClickOutside:r},Bt.createElement(WC,{targetHeight:t.height,"data-testid":"group-rename-input",value:a,onBlur:r,onFocus:l=>l.target.setSelectionRange(0,a.length),onChange:l=>s(l.target.value),onKeyDown:l=>{l.key==="Enter"?i(a):l.key==="Escape"&&r()},autoFocus:!0}))};function UC(e,t){return e===void 0?!1:e.length>1&&e.startsWith("_")?Number.parseInt(e.slice(1))===t.keyCode:e.length===1&&e>="a"&&e<="z"?e.toUpperCase().codePointAt(0)===t.keyCode:e===t.key}function Ze(e,t,n){const r=ou(e,t);return r&&(n.didMatch=!0),r}function ou(e,t){if(e.length===0)return!1;if(e.includes("|")){const l=e.split("|");for(const u of l)if(ou(u,t))return!0;return!1}let n=!1,r=!1,o=!1,i=!1;const a=e.split("+"),s=a.pop();if(!UC(s,t))return!1;if(a[0]==="any")return!0;for(const l of a)switch(l){case"ctrl":n=!0;break;case"shift":r=!0;break;case"alt":o=!0;break;case"meta":i=!0;break;case"primary":Ni.value?i=!0:n=!0;break}return t.altKey===o&&t.ctrlKey===n&&t.shiftKey===r&&t.metaKey===i}function XC(e,t,n,r,o,i,a){const s=Bt.useCallback((d,h,p,b)=>{var I;(i==="cell"||i==="multi-cell")&&d!==void 0&&(d={...d,range:{x:d.cell[0],y:d.cell[1],width:1,height:1}}),!a&&d!==void 0&&d.range.width>1&&(d={...d,range:{...d.range,width:1,x:d.cell[0]}});const m=n==="mixed"&&(p||b==="drag")||n==="additive",y=(r==="mixed"||r==="additive")&&m,x=(o==="mixed"||o==="additive")&&m;let C={current:d===void 0?void 0:{...d,rangeStack:b==="drag"?((I=e.current)==null?void 0:I.rangeStack)??[]:[]},columns:y?e.columns:it.empty(),rows:x?e.rows:it.empty()};p&&(i==="multi-rect"||i==="multi-cell")&&C.current!==void 0&&e.current!==void 0&&(C={...C,current:{...C.current,rangeStack:[...e.current.rangeStack,e.current.range]}}),t(C,h)},[r,e,n,i,a,o,t]),l=Bt.useCallback((d,h,p)=>{d=d??e.rows,h!==void 0&&(d=d.add(h));let b;if(o==="exclusive"&&d.length>0)b={current:void 0,columns:it.empty(),rows:d};else{const m=p&&n==="mixed"||n==="additive",y=p&&r==="mixed"||r==="additive";b={current:m?e.current:void 0,columns:y?e.columns:it.empty(),rows:d}}t(b,!1)},[r,e,n,o,t]),u=Bt.useCallback((d,h,p)=>{d=d??e.columns,h!==void 0&&(d=d.add(h));let b;if(r==="exclusive"&&d.length>0)b={current:void 0,rows:it.empty(),columns:d};else{const m=p&&n==="mixed"||n==="additive",y=p&&o==="mixed"||o==="additive";b={current:m?e.current:void 0,rows:y?e.rows:it.empty(),columns:d}}t(b,!1)},[r,e,n,o,t]);return[s,l,u]}function KC(e,t,n,r,o){const i=c.useCallback(u=>{if(e===!0){const d=[];for(let h=u.y;h<u.y+u.height;h++){const p=[];for(let b=u.x;b<u.x+u.width;b++)b<0||h>=o?p.push({kind:ue.Loading,allowOverlay:!1}):p.push(t([b,h]));d.push(p)}return d}return(e==null?void 0:e(u,r.signal))??[]},[r.signal,t,e,o]),a=e!==void 0?i:void 0,s=c.useCallback(u=>{if(a===void 0)return[];const d={...u,x:u.x-n};if(d.x<0){d.x=0,d.width--;const h=a(d,r.signal);return typeof h=="function"?async()=>(await h()).map(p=>[{kind:ue.Loading,allowOverlay:!1},...p]):h.map(p=>[{kind:ue.Loading,allowOverlay:!1},...p])}return a(d,r.signal)},[r.signal,a,n]);return[e!==void 0?s:void 0,a]}function YC(e){if(e.copyData!==void 0)return{formatted:e.copyData,rawValue:e.copyData,format:"string",doNotEscape:!0};switch(e.kind){case ue.Boolean:return{formatted:e.data===!0?"TRUE":e.data===!1?"FALSE":e.data===Js?"INDETERMINATE":"",rawValue:e.data,format:"boolean"};case ue.Custom:return{formatted:e.copyData,rawValue:e.copyData,format:"string"};case ue.Image:case ue.Bubble:return{formatted:e.data,rawValue:e.data,format:"string-array"};case ue.Drilldown:return{formatted:e.data.map(t=>t.text),rawValue:e.data.map(t=>t.text),format:"string-array"};case ue.Text:return{formatted:e.displayData??e.data,rawValue:e.data,format:"string"};case ue.Uri:return{formatted:e.displayData??e.data,rawValue:e.data,format:"url"};case ue.Markdown:case ue.RowID:return{formatted:e.data,rawValue:e.data,format:"string"};case ue.Number:return{formatted:e.displayData,rawValue:e.data,format:"number"};case ue.Loading:return{formatted:"#LOADING",rawValue:"",format:"string"};case ue.Protected:return{formatted:"************",rawValue:"",format:"string"};default:Vo()}}function qC(e,t){return e.map((r,o)=>{const i=t[o];return r.map(a=>a.span!==void 0&&a.span[0]!==i?{formatted:"",rawValue:"",format:"string"}:YC(a))})}function _l(e,t){return(t?/[\t\n",]/:/[\t\n"]/).test(e)&&(e=`"${e.replace(/"/g,'""')}"`),e}function VC(e){var n;const t=[];for(const r of e){const o=[];for(const i of r)i.format==="url"?o.push(((n=i.rawValue)==null?void 0:n.toString())??""):i.format==="string-array"?o.push(i.formatted.map(a=>_l(a,!0)).join(",")):o.push(i.doNotEscape===!0?i.formatted:_l(i.formatted,!1));t.push(o.join(" "))}return t.join(`
|
|
6
|
+
`)}function xs(e){return e.replace(/\t/g," ").replace(/ {2,}/g,t=>"<span> </span>".repeat(t.length))}function Pl(e){return'"'+e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")+'"'}function JC(e){return e.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")}function QC(e){var n;const t=[];t.push('<style type="text/css"><!--br {mso-data-placement:same-cell;}--></style>',"<table><tbody>");for(const r of e){t.push("<tr>");for(const o of r){const i=`gdg-format="${o.format}"`;o.format==="url"?t.push(`<td ${i}><a href="${o.rawValue}">${xs(o.formatted)}</a></td>`):o.format==="string-array"?t.push(`<td ${i}><ol>${o.formatted.map((a,s)=>`<li gdg-raw-value=${Pl(o.rawValue[s])}>`+xs(a)+"</li>").join("")}</ol></td>`):t.push(`<td gdg-raw-value=${Pl(((n=o.rawValue)==null?void 0:n.toString())??"")} ${i}>${xs(o.formatted)}</td>`)}t.push("</tr>")}return t.push("</tbody></table>"),t.join("")}function ZC(e,t){const n=qC(e,t),r=VC(n),o=QC(n);return{textPlain:r,textHtml:o}}function Ol(e){var a;const t=document.createElement("html");t.innerHTML=e.replace(/ /g," ");const n=t.querySelector("table");if(n===null)return;const r=[n],o=[];let i;for(;r.length>0;){const s=r.pop();if(s===void 0)break;if(s instanceof HTMLTableElement||s.nodeName==="TBODY")r.push(...[...s.children].reverse());else if(s instanceof HTMLTableRowElement)i!==void 0&&o.push(i),i=[],r.push(...[...s.children].reverse());else if(s instanceof HTMLTableCellElement){const l=s.cloneNode(!0),d=l.children.length===1&&l.children[0].nodeName==="P"?l.children[0]:null,h=(d==null?void 0:d.children.length)===1&&d.children[0].nodeName==="FONT",p=l.querySelectorAll("br");for(const y of p)y.replaceWith(`
|
|
7
|
+
`);const b=l.getAttribute("gdg-raw-value"),m=l.getAttribute("gdg-format")??"string";if(l.querySelector("a")!==null)i==null||i.push({rawValue:((a=l.querySelector("a"))==null?void 0:a.getAttribute("href"))??"",formatted:l.textContent??"",format:m});else if(l.querySelector("ol")!==null){const y=l.querySelectorAll("li");i==null||i.push({rawValue:[...y].map(x=>x.getAttribute("gdg-raw-value")??""),formatted:[...y].map(x=>x.textContent??""),format:"string-array"})}else if(b!==null)i==null||i.push({rawValue:JC(b),formatted:l.textContent??"",format:m});else{let y=l.textContent??"";h&&(y=y.replace(/\n(?!\n)/g,"")),i==null||i.push({rawValue:y??"",formatted:y??"",format:m})}}}return i!==void 0&&o.push(i),o}function ek(e,t,n,r,o){var s;const i=e;if(r==="allowPartial"||e.current===void 0||t===void 0)return e;let a=!1;do{if((e==null?void 0:e.current)===void 0)break;const l=(s=e.current)==null?void 0:s.range,u=[];if(l.width>2){const p=t({x:l.x,y:l.y,width:1,height:l.height},o.signal);if(typeof p=="function")return i;u.push(...p);const b=t({x:l.x+l.width-1,y:l.y,width:1,height:l.height},o.signal);if(typeof b=="function")return i;u.push(...b)}else{const p=t({x:l.x,y:l.y,width:l.width,height:l.height},o.signal);if(typeof p=="function")return i;u.push(...p)}let d=l.x-n,h=l.x+l.width-1-n;for(const p of u)for(const b of p)b.span!==void 0&&(d=Math.min(b.span[0],d),h=Math.max(b.span[1],h));d===l.x-n&&h===l.x+l.width-1-n?a=!0:e={current:{cell:e.current.cell??[0,0],range:{x:d+n,y:l.y,width:h-d+1,height:l.height},rangeStack:e.current.rangeStack},columns:e.columns,rows:e.rows}}while(!a);return e}function jl(e){return e.startsWith('"')&&e.endsWith('"')&&(e=e.slice(1,-1).replace(/""/g,'"')),e}function tk(e){let t;(function(s){s[s.None=0]="None",s[s.inString=1]="inString",s[s.inStringPostQuote=2]="inStringPostQuote"})(t||(t={}));const n=[];let r=[],o=0,i=t.None;e=e.replace(/\r\n/g,`
|
|
8
|
+
`);let a=0;for(const s of e){switch(i){case t.None:s===" "||s===`
|
|
9
|
+
`?(r.push(e.slice(o,a)),o=a+1,s===`
|
|
10
|
+
`&&(n.push(r),r=[])):s==='"'&&(i=t.inString);break;case t.inString:s==='"'&&(i=t.inStringPostQuote);break;case t.inStringPostQuote:s==='"'?i=t.inString:((s===" "||s===`
|
|
11
|
+
`)&&(r.push(jl(e.slice(o,a))),o=a+1,s===`
|
|
12
|
+
`&&(n.push(r),r=[])),i=t.None);break}a++}return o<e.length&&r.push(jl(e.slice(o,e.length))),n.push(r),n.map(s=>s.map(l=>({rawValue:l,formatted:l,format:"string"})))}function Nl(e,t,n){var s;const r=ZC(e,t),o=l=>{var u;(u=window.navigator.clipboard)==null||u.writeText(l)},i=(l,u)=>{var d;return((d=window.navigator.clipboard)==null?void 0:d.write)===void 0?!1:(window.navigator.clipboard.write([new ClipboardItem({"text/plain":new Blob([l],{type:"text/plain"}),"text/html":new Blob([u],{type:"text/html"})})]),!0)},a=(l,u)=>{var d,h;try{if(n===void 0||n.clipboardData===null)throw new Error("No clipboard data");(d=n==null?void 0:n.clipboardData)==null||d.setData("text/plain",l),(h=n==null?void 0:n.clipboardData)==null||h.setData("text/html",u)}catch{i(l,u)||o(l)}};((s=window.navigator.clipboard)==null?void 0:s.write)!==void 0||(n==null?void 0:n.clipboardData)!==void 0?a(r.textPlain,r.textHtml):o(r.textPlain),n==null||n.preventDefault()}function iu(e){return e!==!0}function Hl(e){return typeof e=="string"?e:`${e}px`}const nk=()=>e=>e.innerWidth,rk=()=>e=>e.innerHeight,ok=Cr("div")({name:"Wrapper",class:"gdg-wmyidgi",propsAsIs:!1,vars:{"wmyidgi-0":[nk()],"wmyidgi-1":[rk()]}}),ik=e=>{const{inWidth:t,inHeight:n,children:r,...o}=e;return c.createElement(ok,{innerHeight:Hl(n),innerWidth:Hl(t),...o},r)},sk=2,ak=1300;function lk(e,t,n){const r=Bt.useRef(0),[o,i]=e??[0,0];Bt.useEffect(()=>{if(o===0&&i===0){r.current=0;return}let a=!1,s=0;const l=u=>{var d;if(!a){if(s===0)s=u;else{const h=u-s;r.current=Math.min(1,r.current+h/ak);const p=r.current**1.618*h*sk;(d=t.current)==null||d.scrollBy(o*p,i*p),s=u,n==null||n()}window.requestAnimationFrame(l)}};return window.requestAnimationFrame(l),()=>{a=!0}},[t,o,i,n])}function ck({rowHeight:e,headerHeight:t,groupHeaderHeight:n,theme:r,overscrollX:o,overscrollY:i,scaleToRem:a,remSize:s}){const[l,u,d,h,p,b]=Bt.useMemo(()=>{if(!a||s===16)return[e,t,n,r,o,i];const m=s/16,y=e,x=$c();return[typeof y=="number"?y*m:C=>Math.ceil(y(C)*m),Math.ceil(t*m),Math.ceil(n*m),{...r,headerIconSize:((r==null?void 0:r.headerIconSize)??x.headerIconSize)*m,cellHorizontalPadding:((r==null?void 0:r.cellHorizontalPadding)??x.cellHorizontalPadding)*m,cellVerticalPadding:((r==null?void 0:r.cellVerticalPadding)??x.cellVerticalPadding)*m},Math.ceil((o??0)*m),Math.ceil((i??0)*m)]},[n,t,o,i,s,e,a,r]);return{rowHeight:l,headerHeight:u,groupHeaderHeight:d,theme:h,overscrollX:p,overscrollY:b}}const yr={downFill:!1,rightFill:!1,clear:!0,closeOverlay:!0,acceptOverlayDown:!0,acceptOverlayUp:!0,acceptOverlayLeft:!0,acceptOverlayRight:!0,copy:!0,paste:!0,cut:!0,search:!1,delete:!0,activateCell:!0,scrollToSelectedCell:!0,goToFirstCell:!0,goToFirstColumn:!0,goToFirstRow:!0,goToLastCell:!0,goToLastColumn:!0,goToLastRow:!0,goToNextPage:!0,goToPreviousPage:!0,selectToFirstCell:!0,selectToFirstColumn:!0,selectToFirstRow:!0,selectToLastCell:!0,selectToLastColumn:!0,selectToLastRow:!0,selectAll:!0,selectRow:!0,selectColumn:!0,goUpCell:!0,goRightCell:!0,goDownCell:!0,goLeftCell:!0,goUpCellRetainSelection:!0,goRightCellRetainSelection:!0,goDownCellRetainSelection:!0,goLeftCellRetainSelection:!0,selectGrowUp:!0,selectGrowRight:!0,selectGrowDown:!0,selectGrowLeft:!0};function et(e,t){return e===!0?t:e===!1?"":e}function Bl(e){const t=Ni.value;return{activateCell:et(e.activateCell," |Enter|shift+Enter"),clear:et(e.clear,"any+Escape"),closeOverlay:et(e.closeOverlay,"any+Escape"),acceptOverlayDown:et(e.acceptOverlayDown,"Enter"),acceptOverlayUp:et(e.acceptOverlayUp,"shift+Enter"),acceptOverlayLeft:et(e.acceptOverlayLeft,"shift+Tab"),acceptOverlayRight:et(e.acceptOverlayRight,"Tab"),copy:e.copy,cut:e.cut,delete:et(e.delete,t?"Backspace|Delete":"Delete"),downFill:et(e.downFill,"primary+_68"),scrollToSelectedCell:et(e.scrollToSelectedCell,"primary+Enter"),goDownCell:et(e.goDownCell,"ArrowDown"),goDownCellRetainSelection:et(e.goDownCellRetainSelection,"alt+ArrowDown"),goLeftCell:et(e.goLeftCell,"ArrowLeft|shift+Tab"),goLeftCellRetainSelection:et(e.goLeftCellRetainSelection,"alt+ArrowLeft"),goRightCell:et(e.goRightCell,"ArrowRight|Tab"),goRightCellRetainSelection:et(e.goRightCellRetainSelection,"alt+ArrowRight"),goUpCell:et(e.goUpCell,"ArrowUp"),goUpCellRetainSelection:et(e.goUpCellRetainSelection,"alt+ArrowUp"),goToFirstCell:et(e.goToFirstCell,"primary+Home"),goToFirstColumn:et(e.goToFirstColumn,"Home|primary+ArrowLeft"),goToFirstRow:et(e.goToFirstRow,"primary+ArrowUp"),goToLastCell:et(e.goToLastCell,"primary+End"),goToLastColumn:et(e.goToLastColumn,"End|primary+ArrowRight"),goToLastRow:et(e.goToLastRow,"primary+ArrowDown"),goToNextPage:et(e.goToNextPage,"PageDown"),goToPreviousPage:et(e.goToPreviousPage,"PageUp"),paste:e.paste,rightFill:et(e.rightFill,"primary+_82"),search:et(e.search,"primary+f"),selectAll:et(e.selectAll,"primary+a"),selectColumn:et(e.selectColumn,"ctrl+ "),selectGrowDown:et(e.selectGrowDown,"shift+ArrowDown"),selectGrowLeft:et(e.selectGrowLeft,"shift+ArrowLeft"),selectGrowRight:et(e.selectGrowRight,"shift+ArrowRight"),selectGrowUp:et(e.selectGrowUp,"shift+ArrowUp"),selectRow:et(e.selectRow,"shift+ "),selectToFirstCell:et(e.selectToFirstCell,"primary+shift+Home"),selectToFirstColumn:et(e.selectToFirstColumn,"primary+shift+ArrowLeft"),selectToFirstRow:et(e.selectToFirstRow,"primary+shift+ArrowUp"),selectToLastCell:et(e.selectToLastCell,"primary+shift+End"),selectToLastColumn:et(e.selectToLastColumn,"primary+shift+ArrowRight"),selectToLastRow:et(e.selectToLastRow,"primary+shift+ArrowDown")}}function uk(e){const t=Pp(e);return Bt.useMemo(()=>{if(t===void 0)return Bl(yr);const n={...t,goToNextPage:(t==null?void 0:t.goToNextPage)??(t==null?void 0:t.pageDown)??yr.goToNextPage,goToPreviousPage:(t==null?void 0:t.goToPreviousPage)??(t==null?void 0:t.pageUp)??yr.goToPreviousPage,goToFirstCell:(t==null?void 0:t.goToFirstCell)??(t==null?void 0:t.first)??yr.goToFirstCell,goToLastCell:(t==null?void 0:t.goToLastCell)??(t==null?void 0:t.last)??yr.goToLastCell,selectToFirstCell:(t==null?void 0:t.selectToFirstCell)??(t==null?void 0:t.first)??yr.selectToFirstCell,selectToLastCell:(t==null?void 0:t.selectToLastCell)??(t==null?void 0:t.last)??yr.selectToLastCell};return Bl({...yr,...n})},[t])}function dk(e){function t(r,o,i){if(typeof r=="number")return{headerIndex:r,isCollapsed:!1,depth:o,path:i};const a={headerIndex:r.headerIndex,isCollapsed:r.isCollapsed,depth:o,path:i};return r.subGroups!==void 0&&(a.subGroups=r.subGroups.map((s,l)=>t(s,o+1,[...i,l])).sort((s,l)=>s.headerIndex-l.headerIndex)),a}return e.map((r,o)=>t(r,0,[o])).sort((r,o)=>r.headerIndex-o.headerIndex)}function la(e,t){const n=[];function r(s,l,u=!1){let d=l!==null?l-s.headerIndex:t-s.headerIndex;if(s.subGroups!==void 0&&(d=s.subGroups[0].headerIndex-s.headerIndex),d--,n.push({rowIndex:-1,headerIndex:s.headerIndex,contentIndex:-1,skip:u,isCollapsed:s.isCollapsed,depth:s.depth,path:s.path,rows:d}),s.subGroups)for(let h=0;h<s.subGroups.length;h++){const p=h<s.subGroups.length-1?s.subGroups[h+1].headerIndex:l;r(s.subGroups[h],p,u||s.isCollapsed)}}const o=dk(e.groups);for(let s=0;s<o.length;s++){const l=s<o.length-1?o[s+1].headerIndex:null;r(o[s],l)}let i=0,a=0;for(const s of n)s.contentIndex=a,a+=s.rows,s.rowIndex=i,i+=s.isCollapsed?1:s.rows+1;return n.filter(s=>s.skip===!1).map(s=>{const{skip:l,...u}=s;return u})}function Hs(e,t){if(t===void 0||la.length===0)return{path:[e],originalIndex:e,isGroupHeader:!1,groupIndex:e,contentIndex:e,groupRows:-1};let n=e;for(const r of t){if(n===0)return{path:[...r.path,-1],originalIndex:r.headerIndex,isGroupHeader:!0,groupIndex:-1,contentIndex:-1,groupRows:r.rows};if(r.isCollapsed)n--;else{if(n<=r.rows)return{path:[...r.path,n-1],originalIndex:r.headerIndex+n,isGroupHeader:!1,groupIndex:n-1,contentIndex:r.contentIndex+n-1,groupRows:r.rows};n=n-r.rows-1}}return{path:[e],originalIndex:e,isGroupHeader:!1,groupIndex:e,contentIndex:e,groupRows:-1}}function fk(e,t,n,r){const o=Bt.useMemo(()=>e===void 0?void 0:la(e,t),[e,t]),i=Bt.useMemo(()=>o==null?void 0:o.reduce((d,h)=>(d[h.rowIndex]=h,d),{}),[o]),a=Bt.useMemo(()=>o===void 0?t:o.reduce((d,h)=>d+(h.isCollapsed?1:h.rows+1),0),[o,t]),s=Bt.useMemo(()=>e===void 0||typeof n=="number"&&e.height===n?n:d=>i!=null&&i[d]?e.height:typeof n=="number"?n:n(d),[i,e,n]),l=Bt.useCallback(d=>{if(o===void 0)return d;let h=d;for(const p of o){if(h===0)return;if(h--,!p.isCollapsed){if(h<p.rows)return p.contentIndex+h;h-=p.rows}}return d},[o]),u=vr(r??(e==null?void 0:e.themeOverride),Bt.useCallback(d=>{if(e===void 0)return r==null?void 0:r(d,d,d);if(r===void 0&&(e==null?void 0:e.themeOverride)===void 0)return;const{isGroupHeader:h,contentIndex:p,groupIndex:b}=Hs(d,o);return h?e.themeOverride:r==null?void 0:r(d,b,p)},[o,r,e]));return e===void 0?{rowHeight:s,rows:t,rowNumberMapper:l,getRowThemeOverride:u}:{rowHeight:s,rows:a,rowNumberMapper:l,getRowThemeOverride:u}}function hk(e,t){const n=Bt.useMemo(()=>e===void 0?void 0:la(e,t),[e,t]);return{getRowGroupingForPath:au,updateRowGroupingByPath:su,mapper:Bt.useCallback(r=>{if(typeof r=="number")return Hs(r,n);const o=Hs(r[1],n);return{...o,originalIndex:[r[0],o.originalIndex]}},[n])}}function su(e,t,n){const[r,...o]=t;return o[0]===-1?e.map((i,a)=>a===r?{...i,...n}:i):e.map((i,a)=>a===r?{...i,subGroups:su(i.subGroups??[],o,n)}:i)}function au(e,t){const[n,...r]=t;return r[0]===-1?e[n]:au(e[n].subGroups??[],r)}function gk(e,t){const[n]=c.useState(()=>({value:e,callback:t,facade:{get current(){return n.value},set current(r){const o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}));return n.callback=t,n.facade}function mk(e,t,n,r,o){const[i,a]=c.useMemo(()=>[t!==void 0&&typeof n=="number"?Math.floor(t/n):0,t!==void 0&&typeof n=="number"?-(t%n):0],[t,n]),s=c.useMemo(()=>({x:r.current.x,y:i,width:r.current.width??1,height:r.current.height??1,ty:a}),[r,a,i]),[l,u,d]=Fp(s),h=c.useRef(o);h.current=o;const p=gk(null,y=>{y!==null&&t!==void 0?y.scrollTop=t:y!==null&&e!==void 0&&(y.scrollLeft=e)}),b=(l.height??1)>1;c.useLayoutEffect(()=>{if(t!==void 0&&p.current!==null&&b){if(p.current.scrollTop===t)return;p.current.scrollTop=t,p.current.scrollTop!==t&&d(),h.current()}},[t,b,d,p]);const m=(l.width??1)>1;return c.useLayoutEffect(()=>{if(e!==void 0&&p.current!==null&&m){if(p.current.scrollLeft===e)return;p.current.scrollLeft=e,p.current.scrollLeft!==e&&d(),h.current()}},[e,m,d,p]),{visibleRegion:l,setVisibleRegion:u,scrollRef:p}}const pk=c.lazy(async()=>await Ql(()=>import("./data-grid-overlay-editor-CBtkQufd.js"),__vite__mapDeps([0,1,2])));let bk=0;function yk(e){return hy(sl(sl(e).filter(t=>t.span!==void 0).map(t=>{var n,r;return Hr((((n=t.span)==null?void 0:n[0])??0)+1,(((r=t.span)==null?void 0:r[1])??0)+1)})))}function ki(e,t){return e===void 0||t===0||e.columns.length===0&&e.current===void 0?e:{current:e.current===void 0?void 0:{cell:[e.current.cell[0]+t,e.current.cell[1]],range:{...e.current.range,x:e.current.range.x+t},rangeStack:e.current.rangeStack.map(n=>({...n,x:n.x+t}))},rows:e.rows,columns:e.columns.offset(t)}}const Si={kind:ue.Loading,allowOverlay:!1},Ri={columns:it.empty(),rows:it.empty(),current:void 0},vk=(e,t)=>{var Sa,Ra,Ma;const[n,r]=c.useState(Ri),[o,i]=c.useState(),a=c.useRef(null),s=c.useRef(null),[l,u]=c.useState(),d=c.useRef(),h=typeof window>"u"?null:window,{imageEditorOverride:p,getRowThemeOverride:b,markdownDivCreateNode:m,width:y,height:x,columns:C,rows:w,getCellContent:I,onCellClicked:W,onCellActivated:B,onFillPattern:$,onFinishedEditing:L,coercePasteValue:V,drawHeader:R,drawCell:A,editorBloom:H,onHeaderClicked:j,onColumnProposeMove:F,rangeSelectionColumnSpanning:T=!0,spanRangeBehavior:fe="default",onGroupHeaderClicked:G,onCellContextMenu:Z,className:he,onHeaderContextMenu:de,getCellsForSelection:te,onGroupHeaderContextMenu:q,onGroupHeaderRenamed:ve,onCellEdited:ie,onCellsEdited:re,onSearchResultsChanged:Te,searchResults:J,onSearchValueChange:se,searchValue:ge,onKeyDown:Be,onKeyUp:Ce,keybindings:st,editOnType:at=!0,onRowAppended:De,onColumnAppended:_e,onColumnMoved:Pe,validateCell:xt,highlightRegions:Ct,rangeSelect:ft="rect",columnSelect:oe="multi",rowSelect:ye="multi",rangeSelectionBlending:Ee="exclusive",columnSelectionBlending:$e="exclusive",rowSelectionBlending:me="exclusive",onDelete:Xe,onDragStart:Ke,onMouseMove:ze,onPaste:ce,copyHeaders:xe=!1,freezeColumns:Ye=0,cellActivationBehavior:le="second-click",rowSelectionMode:tt="auto",columnSelectionMode:pt="auto",onHeaderMenuClick:Re,onHeaderIndicatorClick:Le,getGroupDetails:ut,rowGrouping:Fe,onSearchClose:bt,onItemHovered:ht,onSelectionCleared:Dt,showSearch:Ot,onVisibleRegionChanged:rn,gridSelection:Kt,onGridSelectionChange:yt,minColumnWidth:Dn=50,maxColumnWidth:un=500,maxColumnAutoWidth:mt,provideEditor:Mt,trailingRowOptions:We,freezeTrailingRows:Et=0,allowedFillDirections:Yt="orthogonal",scrollOffsetX:Ve,scrollOffsetY:Rt,verticalBorder:nt,onDragOverCell:_t,onDrop:gt,onColumnResize:zt,onColumnResizeEnd:vn,onColumnResizeStart:vt,customRenderers:Wt,fillHandle:Je,experimental:je,fixedShadowX:wn,fixedShadowY:or,headerIcons:Gt,imageWindowLoader:Jt,initialSize:dn,isDraggable:Hn,onDragLeave:Sr,onRowMoved:Bn,overscrollX:ir,overscrollY:sr,preventDiagonalScrolling:ar,rightElement:xn,rightElementProps:Ln,trapFocus:fn=!1,smoothScrollX:ko,smoothScrollY:Rr,scaleToRem:So=!1,rowHeight:Ro=34,headerHeight:Qt=36,groupHeaderHeight:hn=Qt,theme:Mo,isOutsideClick:Io,renderers:zn,resizeIndicator:Ur,scrollToActiveCell:Jn=!0,drawFocusRing:Eo=!0,portalElementRef:Xr}=e,lr=Eo==="no-editor"?o===void 0:Eo,kt=typeof e.rowMarkers=="string"?void 0:e.rowMarkers,Ut=(kt==null?void 0:kt.kind)??e.rowMarkers??"none",on=(kt==null?void 0:kt.width)??e.rowMarkerWidth,sn=(kt==null?void 0:kt.startIndex)??e.rowMarkerStartIndex??1,Xt=(kt==null?void 0:kt.theme)??e.rowMarkerTheme,Wn=kt==null?void 0:kt.headerTheme,cr=kt==null?void 0:kt.headerAlwaysVisible,Cn=ye!=="multi"||(kt==null?void 0:kt.headerDisabled)===!0,Gn=(kt==null?void 0:kt.checkboxStyle)??"square",Zt=Math.max(Dn,20),$n=Math.max(un,Zt),Mr=Math.max(mt??$n,Zt),Ir=c.useMemo(()=>typeof window>"u"?{fontSize:"16px"}:window.getComputedStyle(document.documentElement),[]),{rows:Me,rowNumberMapper:ur,rowHeight:Er,getRowThemeOverride:an}=fk(Fe,w,Ro,b),Kr=c.useMemo(()=>Number.parseFloat(Ir.fontSize),[Ir]),{rowHeight:gn,headerHeight:Tr,groupHeaderHeight:Dr,theme:dr,overscrollX:Yr,overscrollY:qr}=ck({groupHeaderHeight:hn,headerHeight:Qt,overscrollX:ir,overscrollY:sr,remSize:Kr,rowHeight:Er,scaleToRem:So,theme:Mo}),mn=uk(st),kn=on??(w>1e4?48:w>1e3?44:w>100?36:32),en=Ut!=="none",D=en?1:0,lt=We!==void 0,An=(We==null?void 0:We.sticky)===!0,[To,Qn]=c.useState(!1),fr=Ot??To,Zn=c.useCallback(()=>{bt!==void 0?bt():Qn(!1)},[bt]),z=c.useMemo(()=>Kt===void 0?void 0:ki(Kt,D),[Kt,D])??n,g=c.useRef();g.current===void 0&&(g.current=new AbortController),c.useEffect(()=>()=>g==null?void 0:g.current.abort(),[]);const[k,_]=KC(te,I,D,g.current,Me),K=c.useCallback((f,S,M)=>{if(xt===void 0)return!0;const E=[f[0]-D,f[1]];return xt==null?void 0:xt(E,S,M)},[D,xt]),Y=c.useRef(Kt),ee=c.useCallback((f,S)=>{S&&(f=ek(f,k,D,fe,g.current)),yt!==void 0?(Y.current=ki(f,-D),yt(Y.current)):r(f)},[yt,k,D,fe]),ke=vr(zt,c.useCallback((f,S,M,E)=>{zt==null||zt(C[M-D],S,M-D,E)},[zt,D,C])),rt=vr(vn,c.useCallback((f,S,M,E)=>{vn==null||vn(C[M-D],S,M-D,E)},[vn,D,C])),we=vr(vt,c.useCallback((f,S,M,E)=>{vt==null||vt(C[M-D],S,M-D,E)},[vt,D,C])),jt=vr(R,c.useCallback((f,S)=>(R==null?void 0:R({...f,columnIndex:f.columnIndex-D},S))??!1,[R,D])),Se=vr(A,c.useCallback((f,S)=>(A==null?void 0:A({...f,col:f.col-D},S))??!1,[A,D])),ot=c.useCallback(f=>{if(Xe!==void 0){const S=Xe(ki(f,-D));return typeof S=="boolean"?S:ki(S,D)}return!0},[Xe,D]),[Ge,qe,Ne]=XC(z,ee,Ee,$e,me,ft,T),ct=c.useMemo(()=>rr($c(),dr),[dr]),[At,Fn]=c.useState([0,0,0]),_n=c.useMemo(()=>{if(zn===void 0)return{};const f={};for(const S of zn)f[S.kind]=S;return f},[zn]),It=c.useCallback(f=>f.kind!==ue.Custom?_n[f.kind]:Wt==null?void 0:Wt.find(S=>S.isMatch(f)),[Wt,_n]);let{sizedColumns:Pt,nonGrowWidth:wt}=hb(C,Me,_,At[0]-(D===0?0:kn)-At[2],Zt,Mr,ct,It,g.current);Ut!=="none"&&(wt+=kn);const Sn=c.useMemo(()=>Pt.some(f=>f.group!==void 0),[Pt]),qt=Sn?Tr+Dr:Tr,Vr=z.rows.length,er=Ut==="none"?void 0:Vr===0?!1:Vr===Me?!0:void 0,Qe=c.useMemo(()=>Ut==="none"?Pt:[{title:"",width:kn,icon:void 0,hasMenu:!1,style:"normal",themeOverride:Xt,rowMarker:Gn,rowMarkerChecked:er,headerRowMarkerTheme:Wn,headerRowMarkerAlwaysVisible:cr,headerRowMarkerDisabled:Cn},...Pt],[Ut,Pt,kn,Xt,Gn,er,Wn,cr,Cn]),Nt=c.useRef({height:1,width:1,x:0,y:0}),$r=c.useRef(!1),{setVisibleRegion:hr,visibleRegion:tr,scrollRef:St}=mk(Ve,Rt,gn,Nt,()=>$r.current=!0);Nt.current=tr;const Tu=tr.x+D,oi=tr.y,Lt=c.useRef(null),tn=c.useCallback(f=>{var S;f===!0?(S=Lt.current)==null||S.focus():window.requestAnimationFrame(()=>{var M;(M=Lt.current)==null||M.focus()})},[]),Vt=lt?Me+1:Me,Rn=c.useCallback(f=>{const S=D===0?f:f.map(E=>({...E,location:[E.location[0]-D,E.location[1]]})),M=re==null?void 0:re(S);if(M!==!0)for(const E of S)ie==null||ie(E.location,E.value);return M},[ie,re,D]),[Ar,qi]=c.useState(),ii=z.current!==void 0&&z.current.range.width*z.current.range.height>1?z.current.range:void 0,Jr=lr?(Sa=z.current)==null?void 0:Sa.cell:void 0,si=Jr==null?void 0:Jr[0],ai=Jr==null?void 0:Jr[1],Du=c.useMemo(()=>{if((Ct===void 0||Ct.length===0)&&(ii??si??ai??Ar)===void 0)return;const f=[];if(Ct!==void 0)for(const S of Ct){const M=Qe.length-S.range.x-D;M>0&&f.push({color:S.color,range:{...S.range,x:S.range.x+D,width:Math.min(M,S.range.width)},style:S.style})}return Ar!==void 0&&f.push({color:Br(ct.accentColor,0),range:Ar,style:"dashed"}),ii!==void 0&&f.push({color:Br(ct.accentColor,.5),range:ii,style:"solid-outline"}),si!==void 0&&ai!==void 0&&f.push({color:ct.accentColor,range:{x:si,y:ai,width:1,height:1},style:"solid-outline"}),f.length>0?f:void 0},[Ar,ii,si,ai,Ct,Qe.length,ct.accentColor,D]),da=c.useRef(Qe);da.current=Qe;const pn=c.useCallback(([f,S],M=!1)=>{var U,P,N,X,Q,ae,pe;const E=lt&&S===Vt-1;if(f===0&&en){if(E)return Si;const ne=ur(S);return ne===void 0?Si:{kind:En.Marker,allowOverlay:!1,checkboxStyle:Gn,checked:(z==null?void 0:z.rows.hasIndex(S))===!0,markerKind:Ut==="clickable-number"?"number":Ut,row:sn+ne,drawHandle:Bn!==void 0,cursor:Ut==="clickable-number"?"pointer":void 0}}else if(E){const Ae=f===D?(We==null?void 0:We.hint)??"":"",be=da.current[f];if(((U=be==null?void 0:be.trailingRowOptions)==null?void 0:U.disabled)===!0)return Si;{const He=((P=be==null?void 0:be.trailingRowOptions)==null?void 0:P.hint)??Ae,Oe=((N=be==null?void 0:be.trailingRowOptions)==null?void 0:N.addIcon)??(We==null?void 0:We.addIcon);return{kind:En.NewRow,hint:He,allowOverlay:!1,icon:Oe}}}else{const ne=f-D;if(M||(je==null?void 0:je.strict)===!0){const be=Nt.current,He=be.x>ne||ne>be.x+be.width||be.y>S||S>be.y+be.height||S>=Zi.current,Oe=ne===((Q=(X=be.extras)==null?void 0:X.selected)==null?void 0:Q[0])&&S===((ae=be.extras)==null?void 0:ae.selected[1]);let Ie=!1;if(((pe=be.extras)==null?void 0:pe.freezeRegions)!==void 0){for(const dt of be.extras.freezeRegions)if(fo(dt,ne,S)){Ie=!0;break}}if(He&&!Oe&&!Ie)return Si}let Ae=I([ne,S]);return D!==0&&Ae.span!==void 0&&(Ae={...Ae,span:[Ae.span[0]+D,Ae.span[1]+D]}),Ae}},[lt,Vt,en,ur,Gn,z==null?void 0:z.rows,Ut,sn,Bn,D,We==null?void 0:We.hint,We==null?void 0:We.addIcon,je==null?void 0:je.strict,I]),Vi=c.useCallback(f=>{let S=(ut==null?void 0:ut(f))??{name:f};return ve!==void 0&&f!==""&&(S={icon:S.icon,name:S.name,overrideTheme:S.overrideTheme,actions:[...S.actions??[],{title:"Rename",icon:"renameIcon",onClick:M=>ts({group:S.name,bounds:M.bounds})}]}),S},[ut,ve]),li=c.useCallback(f=>{var N;const[S,M]=f.cell,E=Qe[S],O=(E==null?void 0:E.group)!==void 0?(N=Vi(E.group))==null?void 0:N.overrideTheme:void 0,U=E==null?void 0:E.themeOverride,P=an==null?void 0:an(M);i({...f,theme:rr(ct,O,U,P,f.content.themeOverride)})},[an,Qe,Vi,ct]),Qr=c.useCallback((f,S,M)=>{var P;if(z.current===void 0)return;const[E,O]=z.current.cell,U=pn([E,O]);if(U.kind!==ue.Boolean&&U.allowOverlay){let N=U;if(M!==void 0)switch(N.kind){case ue.Number:{const X=Vm(()=>M==="-"?-0:Number.parseFloat(M),0);N={...N,data:Number.isNaN(X)?0:X};break}case ue.Text:case ue.Markdown:case ue.Uri:N={...N,data:M};break}li({target:f,content:N,initialValue:M,cell:[E,O],highlight:M===void 0,forceEditMode:M!==void 0,activation:S})}else U.kind===ue.Boolean&&S.inputType==="keyboard"&&U.readonly!==!0&&(Rn([{location:z.current.cell,value:{...U,data:iu(U.data)}}]),(P=Lt.current)==null||P.damage([{cell:z.current.cell}]))},[pn,z,Rn,li]),fa=c.useCallback((f,S)=>{var O;const M=(O=Lt.current)==null?void 0:O.getBounds(f,S);if(M===void 0||St.current===null)return;const E=pn([f,S]);E.allowOverlay&&li({target:M,content:E,initialValue:void 0,highlight:!0,cell:[f,S],forceEditMode:!0,activation:{inputType:"keyboard",key:"Enter"}})},[pn,St,li]),Ft=c.useCallback((f,S,M="both",E=0,O=0,U=void 0)=>{if(St.current!==null){const P=Lt.current,N=s.current,X=typeof f!="number"?f.unit==="cell"?f.amount:void 0:f,Q=typeof S!="number"?S.unit==="cell"?S.amount:void 0:S,ae=typeof f!="number"&&f.unit==="px"?f.amount:void 0,pe=typeof S!="number"&&S.unit==="px"?S.amount:void 0;if(P!==null&&N!==null){let ne={x:0,y:0,width:0,height:0},Ae=0,be=0;if((X!==void 0||Q!==void 0)&&(ne=P.getBounds((X??0)+D,Q??0)??ne,ne.width===0||ne.height===0))return;const He=N.getBoundingClientRect(),Oe=He.width/N.offsetWidth;if(ae!==void 0&&(ne={...ne,x:ae-He.left-St.current.scrollLeft,width:1}),pe!==void 0&&(ne={...ne,y:pe+He.top-St.current.scrollTop,height:1}),ne!==void 0){const Ie={x:ne.x-E,y:ne.y-O,width:ne.width+2*E,height:ne.height+2*O};let dt=0;for(let ls=0;ls<Ye;ls++)dt+=Pt[ls].width;let $t=0;const Ht=Et+(An?1:0);Ht>0&&($t=Wr(Vt,Ht,gn));let ln=dt*Oe+He.left+D*kn*Oe,Xn=He.right,jn=He.top+qt*Oe,Kn=He.bottom-$t*Oe;const mi=ne.width+E*2;switch(U==null?void 0:U.hAlign){case"start":Xn=ln+mi;break;case"end":ln=Xn-mi;break;case"center":ln=Math.floor((ln+Xn)/2)-mi/2,Xn=ln+mi;break}const pi=ne.height+O*2;switch(U==null?void 0:U.vAlign){case"start":Kn=jn+pi;break;case"end":jn=Kn-pi;break;case"center":jn=Math.floor((jn+Kn)/2)-pi/2,Kn=jn+pi;break}ln>Ie.x?Ae=Ie.x-ln:Xn<Ie.x+Ie.width&&(Ae=Ie.x+Ie.width-Xn),jn>Ie.y?be=Ie.y-jn:Kn<Ie.y+Ie.height&&(be=Ie.y+Ie.height-Kn),M==="vertical"||typeof f=="number"&&f<Ye?Ae=0:(M==="horizontal"||typeof S=="number"&&S>=Vt-Ht)&&(be=0),(Ae!==0||be!==0)&&(Oe!==1&&(Ae/=Oe,be/=Oe),St.current.scrollTo({left:Ae+St.current.scrollLeft,top:be+St.current.scrollTop,behavior:(U==null?void 0:U.behavior)??"auto"}))}}}},[D,Et,kn,St,qt,Ye,Pt,Vt,An,gn]),Ji=c.useRef(fa),Qi=c.useRef(I);Ji.current=fa,Qi.current=I;const Zi=c.useRef(Me);Zi.current=Me;const ha=c.useRef(Qe.length);ha.current=Qe.length;const gr=c.useCallback(async(f,S=!0,M)=>{var Q;const E=Qe[f];if(((Q=E==null?void 0:E.trailingRowOptions)==null?void 0:Q.disabled)===!0)return;const O=De==null?void 0:De();let U,P=!0;O!==void 0&&(U=await O,U==="top"&&(P=!1),typeof U=="number"&&(P=!1));let N=0;const X=()=>{if(Zi.current<=Me){N<500&&window.setTimeout(X,N),N=50+N*2;return}const ae=typeof U=="number"?U:P?Me:0;gi.current(f-D,ae,"both",0,0,M?{behavior:M}:void 0),Ge({cell:[f,ae],range:{x:f,y:ae,width:1,height:1}},!1,!1,"edit");const pe=Qi.current([f-D,ae]);pe.allowOverlay&&io(pe)&&pe.readonly!==!0&&S&&window.setTimeout(()=>{Ji.current(f,ae)},0)};X()},[Qe,De,D,Me,Ge]),ci=c.useCallback(async(f,S=!0)=>{const M=_e==null?void 0:_e();let E,O=!0;M!==void 0&&(E=await M,E==="left"&&(O=!1),typeof E=="number"&&(O=!1));let U=0;const P=()=>{if(ha.current<=Qe.length){U<500&&window.setTimeout(P,U),U=50+U*2;return}const N=typeof E=="number"?E:O?Qe.length:0;Ft(N-D,f),Ge({cell:[N,f],range:{x:N,y:f,width:1,height:1}},!1,!1,"edit");const X=Qi.current([N-D,f]);X.allowOverlay&&io(X)&&X.readonly!==!0&&S&&window.setTimeout(()=>{Ji.current(N,f)},0)};P()},[Qe,_e,D,Ft,Ge]),Zr=c.useCallback(f=>{var M,E;const S=((E=(M=Pt[f])==null?void 0:M.trailingRowOptions)==null?void 0:E.targetColumn)??(We==null?void 0:We.targetColumn);if(typeof S=="number")return S+(en?1:0);if(typeof S=="object"){const O=C.indexOf(S);if(O>=0)return O+(en?1:0)}},[Pt,C,en,We==null?void 0:We.targetColumn]),mr=c.useRef(),eo=c.useRef(),$o=c.useCallback((f,S)=>{var O;const[M,E]=S;return rr(ct,(O=Qe[M])==null?void 0:O.themeOverride,an==null?void 0:an(E),f.themeOverride)},[an,Qe,ct]),{mapper:Fr}=hk(Fe,w),Pn=Fe==null?void 0:Fe.navigationBehavior,Ao=c.useCallback(f=>{var Q,ae,pe;const S=Ni.value?f.metaKey:f.ctrlKey,M=S&&ye==="multi",[E,O]=f.location,U=z.columns,P=z.rows,[N,X]=((Q=z.current)==null?void 0:Q.cell)??[];if(f.kind==="cell"){if(eo.current=void 0,_r.current=[E,O],E===0&&en){if(lt===!0&&O===Me||Ut==="number"||ye==="none")return;const ne=pn(f.location);if(ne.kind!==En.Marker)return;if(Bn!==void 0){const He=It(ne);bn((He==null?void 0:He.kind)===En.Marker);const Oe=(ae=He==null?void 0:He.onClick)==null?void 0:ae.call(He,{...f,cell:ne,posX:f.localEventX,posY:f.localEventY,bounds:f.bounds,theme:$o(ne,f.location),preventDefault:()=>{}});if(Oe===void 0||Oe.checked===ne.checked)return}i(void 0),tn();const Ae=P.hasIndex(O),be=mr.current;if(ye==="multi"&&(f.shiftKey||f.isLongTouch===!0)&&be!==void 0&&P.hasIndex(be)){const He=[Math.min(be,O),Math.max(be,O)+1];M||tt==="multi"?qe(void 0,He,!0):qe(it.fromSingleSelection(He),void 0,M)}else ye==="multi"&&(M||f.isTouch||tt==="multi")?Ae?qe(P.remove(O),void 0,!0):(qe(void 0,O,!0),mr.current=O):Ae&&P.length===1?qe(it.empty(),void 0,S):(qe(it.fromSingleSelection(O),void 0,S),mr.current=O)}else if(E>=D&<&&O===Me){const ne=Zr(E);gr(ne??E)}else if(N!==E||X!==O){const ne=pn(f.location),Ae=It(ne);if((Ae==null?void 0:Ae.onSelect)!==void 0){let Oe=!1;if(Ae.onSelect({...f,cell:ne,posX:f.localEventX,posY:f.localEventY,bounds:f.bounds,preventDefault:()=>Oe=!0,theme:$o(ne,f.location)}),Oe)return}if(Pn==="block"&&Fr(O).isGroupHeader)return;const be=An&&O===Me,He=An&&z!==void 0&&((pe=z.current)==null?void 0:pe.cell[1])===Me;if((f.shiftKey||f.isLongTouch===!0)&&N!==void 0&&X!==void 0&&z.current!==void 0&&!He){if(be)return;const Oe=Math.min(E,N),Ie=Math.max(E,N),dt=Math.min(O,X),$t=Math.max(O,X);Ge({...z.current,range:{x:Oe,y:dt,width:Ie-Oe+1,height:$t-dt+1}},!0,S,"click"),mr.current=void 0,tn()}else Ge({cell:[E,O],range:{x:E,y:O,width:1,height:1}},!0,S,"click"),mr.current=void 0,i(void 0),tn()}}else if(f.kind==="header")if(_r.current=[E,O],i(void 0),en&&E===0)mr.current=void 0,eo.current=void 0,!Cn&&ye==="multi"&&(P.length!==Me?qe(it.fromSingleSelection([0,Me]),void 0,S):qe(it.empty(),void 0,S),tn());else{const ne=eo.current;if(oe==="multi"&&(f.shiftKey||f.isLongTouch===!0)&&ne!==void 0&&U.hasIndex(ne)){const Ae=[Math.min(ne,E),Math.max(ne,E)+1];S||f.isTouch||pt==="multi"?Ne(void 0,Ae,S):Ne(it.fromSingleSelection(Ae),void 0,S)}else oe==="multi"&&(S||f.isTouch||pt==="multi")?(U.hasIndex(E)?Ne(U.remove(E),void 0,S):Ne(void 0,E,S),eo.current=E):oe!=="none"&&(U.hasIndex(E)?Ne(U.remove(E),void 0,S):Ne(it.fromSingleSelection(E),void 0,S),eo.current=E);mr.current=void 0,tn()}else f.kind===Nn?_r.current=[E,O]:f.kind===Hi&&!f.isMaybeScrollbar&&(ee(Ri,!1),i(void 0),tn(),Dt==null||Dt(),mr.current=void 0,eo.current=void 0)},[ye,oe,z,en,D,lt,Me,Ut,pn,Bn,tn,tt,pt,It,$o,qe,Zr,gr,Pn,Fr,An,Ge,Cn,Ne,ee,Dt]),Fo=c.useRef(!1),_r=c.useRef(),ga=c.useRef(tr),Mn=c.useRef(),$u=c.useCallback(f=>{if(to.current=!1,ga.current=Nt.current,f.button!==0&&f.button!==1){Mn.current=void 0;return}const S=performance.now();Mn.current={button:f.button,time:S,location:f.location},(f==null?void 0:f.kind)==="header"&&(Fo.current=!0);const M=f.kind==="cell"&&f.isFillHandle;!M&&f.kind!=="cell"&&f.isEdge||(u({previousSelection:z,fillHandle:M}),_r.current=void 0,!f.isTouch&&f.button===0&&!M?Ao(f):!f.isTouch&&f.button===1&&(_r.current=f.location))},[z,Ao]),[es,ts]=c.useState(),ma=c.useCallback(f=>{if(f.kind!==Nn||oe!=="multi")return;const S=Ni.value?f.metaKey:f.ctrlKey,[M]=f.location,E=z.columns;if(M<D)return;const O=Qe[M];let U=M,P=M;for(let N=M-1;N>=D&&Jo(O.group,Qe[N].group);N--)U--;for(let N=M+1;N<Qe.length&&Jo(O.group,Qe[N].group);N++)P++;if(tn(),S||f.isTouch||pt==="multi")if(E.hasAll([U,P+1])){let N=E;for(let X=U;X<=P;X++)N=N.remove(X);Ne(N,void 0,S)}else Ne(void 0,[U,P+1],S);else Ne(it.fromSingleSelection([U,P+1]),void 0,S)},[oe,tn,z.columns,Qe,D,Ne,pt]),to=c.useRef(!1),ui=c.useCallback(async f=>{if(k!==void 0&&ke!==void 0){const S=Nt.current.y,M=Nt.current.height;let E=k({x:f,y:S,width:1,height:Math.min(M,Me-S)},g.current.signal);typeof E!="object"&&(E=await E());const O=Pt[f-D],P=document.createElement("canvas").getContext("2d",{alpha:!1});if(P!==null){P.font=ct.baseFontFull;const N=Ac(P,ct,O,0,E,Zt,$n,!1,It);ke==null||ke(O,N.width,f,N.width)}}},[Pt,k,$n,ct,Zt,ke,D,Me,It]),[Au,ns]=c.useState(),no=c.useCallback(async(f,S)=>{var N,X;const M=(N=f.current)==null?void 0:N.range;if(M===void 0||k===void 0||S.current===void 0)return;const E=S.current.range;if($!==void 0){let Q=!1;if($({fillDestination:{...E,x:E.x-D},patternSource:{...M,x:M.x-D},preventDefault:()=>Q=!0}),Q)return}let O=k(M,g.current.signal);typeof O!="object"&&(O=await O());const U=O,P=[];for(let Q=0;Q<E.width;Q++)for(let ae=0;ae<E.height;ae++){const pe=[E.x+Q,E.y+ae];if(xc(pe,M))continue;const ne=U[ae%M.height][Q%M.width];ao(ne)||!io(ne)||P.push({location:pe,value:{...ne}})}Rn(P),(X=Lt.current)==null||X.damage(P.map(Q=>({cell:Q.location})))},[k,Rn,$,D]),pa=c.useCallback(()=>{if(z.current===void 0||z.current.range.width<=1)return;const f={...z,current:{...z.current,range:{...z.current.range,width:1}}};no(f,z)},[no,z]),ba=c.useCallback(()=>{if(z.current===void 0||z.current.range.height<=1)return;const f={...z,current:{...z.current,range:{...z.current.range,height:1}}};no(f,z)},[no,z]),Fu=c.useCallback((f,S)=>{var ae,pe;const M=l;if(u(void 0),qi(void 0),ns(void 0),Fo.current=!1,S)return;if((M==null?void 0:M.fillHandle)===!0&&z.current!==void 0&&((ae=M.previousSelection)==null?void 0:ae.current)!==void 0){if(Ar===void 0)return;const ne={...z,current:{...z.current,range:Lc(M.previousSelection.current.range,Ar)}};no(M.previousSelection,ne),ee(ne,!0);return}const[E,O]=f.location,[U,P]=_r.current??[],N=()=>{to.current=!0},X=ne=>{var be,He,Oe;const Ae=ne.isTouch||U===E&&P===O;if(Ae&&(W==null||W([E-D,O],{...ne,preventDefault:N})),ne.button===1)return!to.current;if(!to.current){const Ie=pn(f.location),dt=It(Ie);if(dt!==void 0&&dt.onClick!==void 0&&Ae){const Ht=dt.onClick({...ne,cell:Ie,posX:ne.localEventX,posY:ne.localEventY,bounds:ne.bounds,theme:$o(Ie,f.location),preventDefault:N});Ht!==void 0&&!ao(Ht)&&oo(Ht)&&(Rn([{location:ne.location,value:Ht}]),(be=Lt.current)==null||be.damage([{cell:ne.location}]))}if(to.current||z.current===void 0)return!1;let $t=!1;switch(Ie.activationBehaviorOverride??le){case"double-click":case"second-click":{if(((Oe=(He=M==null?void 0:M.previousSelection)==null?void 0:He.current)==null?void 0:Oe.cell)===void 0)break;const[Ht,ln]=z.current.cell,[Xn,jn]=M.previousSelection.current.cell;$t=E===Ht&&E===Xn&&O===ln&&O===jn&&(ne.isDoubleClick===!0||le==="second-click");break}case"single-click":{$t=!0;break}}if($t){const ln={inputType:"pointer",pointerActivation:ne.isDoubleClick===!0?"double-click":Ie.activationBehaviorOverride??le,pointerType:ne.isTouch?"touch":"mouse"};return B==null||B([E-D,O],ln),Qr(ne.bounds,ln),!0}}return!1},Q=f.location[0]-D;if(f.isTouch){const ne=Nt.current,Ae=ga.current;if(ne.x!==Ae.x||ne.y!==Ae.y)return;if(f.isLongTouch===!0){if(f.kind==="cell"&&Ko((pe=z.current)==null?void 0:pe.cell,f.location)){Z==null||Z([Q,f.location[1]],{...f,preventDefault:N});return}else if(f.kind==="header"&&z.columns.hasIndex(E)){de==null||de(Q,{...f,preventDefault:N});return}else if(f.kind===Nn){if(Q<0)return;q==null||q(Q,{...f,preventDefault:N});return}}f.kind==="cell"?X(f)||Ao(f):f.kind===Nn?G==null||G(Q,{...f,preventDefault:N}):(f.kind===wr&&(j==null||j(Q,{...f,preventDefault:N})),Ao(f));return}if(f.kind==="header"){if(Q<0)return;f.isEdge?f.isDoubleClick===!0&&ui(E):f.button===0&&E===U&&O===P&&(j==null||j(Q,{...f,preventDefault:N}))}if(f.kind===Nn){if(Q<0)return;f.button===0&&E===U&&O===P&&(G==null||G(Q,{...f,preventDefault:N}),to.current||ma(f))}f.kind==="cell"&&(f.button===0||f.button===1)&&X(f),_r.current=void 0},[l,z,D,Ar,no,ee,W,pn,It,le,$o,Rn,B,Qr,Z,de,q,Ao,G,j,ui,ma]),_u=c.useCallback(f=>{const S={...f,location:[f.location[0]-D,f.location[1]]};ze==null||ze(S),l!==void 0&&f.buttons===0&&(u(void 0),qi(void 0),ns(void 0),Fo.current=!1),ns(M=>{var E;return Fo.current?[f.scrollEdge[0],0]:f.scrollEdge[0]===(M==null?void 0:M[0])&&f.scrollEdge[1]===M[1]?M:l===void 0||(((E=Mn.current)==null?void 0:E.location[0])??0)<D?void 0:f.scrollEdge})},[l,ze,D]),Pu=c.useCallback((f,S)=>{Re==null||Re(f-D,S)},[Re,D]),Ou=c.useCallback((f,S)=>{Le==null||Le(f-D,S)},[Le,D]),Un=(Ra=z==null?void 0:z.current)==null?void 0:Ra.cell,ju=c.useCallback((f,S,M,E,O,U)=>{$r.current=!1;let P=Un;P!==void 0&&(P=[P[0]-D,P[1]]);const N=Ye===0?void 0:{x:0,y:f.y,width:Ye,height:f.height},X=[];N!==void 0&&X.push(N),Et>0&&(X.push({x:f.x-D,y:Me-Et,width:f.width,height:Et}),Ye>0&&X.push({x:0,y:Me-Et,width:Ye,height:Et}));const Q={x:f.x-D,y:f.y,width:f.width,height:lt&&f.y+f.height>=Me?f.height-1:f.height,tx:O,ty:U,extras:{selected:P,freezeRegion:N,freezeRegions:X}};Nt.current=Q,hr(Q),Fn([S,M,E]),rn==null||rn(Q,Q.tx,Q.ty,Q.extras)},[Un,D,lt,Me,Ye,Et,hr,rn]),Nu=vr(F,c.useCallback((f,S)=>(F==null?void 0:F(f-D,S-D))!==!1,[F,D])),Hu=vr(Pe,c.useCallback((f,S)=>{Pe==null||Pe(f-D,S-D),oe!=="none"&&Ne(it.fromSingleSelection(S),void 0,!0)},[oe,Pe,D,Ne])),rs=c.useRef(!1),Bu=c.useCallback(f=>{if(f.location[0]===0&&D>0){f.preventDefault();return}Ke==null||Ke({...f,location:[f.location[0]-D,f.location[1]]}),f.defaultPrevented()||(rs.current=!0),u(void 0)},[Ke,D]),Lu=c.useCallback(()=>{rs.current=!1},[]),ya=Fe==null?void 0:Fe.selectionBehavior,di=c.useCallback(f=>{if(ya!=="block-spanning")return;const{isGroupHeader:S,path:M,groupRows:E}=Fr(f);if(S)return[f,f];const O=M[M.length-1],U=f-O,P=f+E-O-1;return[U,P]},[Fr,ya]),os=c.useRef(),is=c.useCallback(f=>{var S,M,E;if(!ru(f,os.current)&&(os.current=f,!(((S=Mn==null?void 0:Mn.current)==null?void 0:S.button)!==void 0&&Mn.current.button>=1))){if(f.buttons!==0&&l!==void 0&&((M=Mn.current)==null?void 0:M.location[0])===0&&D===1&&ye==="multi"&&l.previousSelection&&!l.previousSelection.rows.hasIndex(Mn.current.location[1])&&z.rows.hasIndex(Mn.current.location[1])){const O=Math.min(Mn.current.location[1],f.location[1]),U=Math.max(Mn.current.location[1],f.location[1])+1;qe(it.fromSingleSelection([O,U]),void 0,!1)}else if(f.buttons!==0&&l!==void 0&&z.current!==void 0&&!rs.current&&!Fo.current&&(ft==="rect"||ft==="multi-rect")){const[O,U]=z.current.cell;let[P,N]=f.location;if(N<0&&(N=Nt.current.y),l.fillHandle===!0&&((E=l.previousSelection)==null?void 0:E.current)!==void 0){const X=l.previousSelection.current.range;N=Math.min(N,lt?Me-1:Me);const Q=Jy(X,P,N,Yt);qi(Q)}else{if(lt&&U===Me)return;if(lt&&N===Me)if(f.kind===Hi)N--;else return;P=Math.max(P,D);const ae=di(U);N=ae===void 0?N:In(N,ae[0],ae[1]);const pe=P-O,ne=N-U,Ae={x:pe>=0?O:P,y:ne>=0?U:N,width:Math.abs(pe)+1,height:Math.abs(ne)+1};Ge({...z.current,range:Ae},!0,!1,"drag")}}ht==null||ht({...f,location:[f.location[0]-D,f.location[1]]})}},[l,D,ye,z,ft,ht,qe,lt,Me,Yt,di,Ge]),zu=c.useCallback(()=>{var P,N;const f=os.current;if(f===void 0)return;const[S,M]=f.scrollEdge;let[E,O]=f.location;const U=Nt.current;S===-1?E=((N=(P=U.extras)==null?void 0:P.freezeRegion)==null?void 0:N.x)??U.x:S===1&&(E=U.x+U.width),M===-1?O=Math.max(0,U.y):M===1&&(O=Math.min(Me-1,U.y+U.height)),E=In(E,0,Qe.length-1),O=In(O,0,Me-1),is({...f,location:[E,O]})},[Qe.length,is,Me]);lk(Au,St,zu);const On=c.useCallback(f=>{if(z.current===void 0)return;const[S,M]=f,[E,O]=z.current.cell,U=z.current.range;let P=U.x,N=U.x+U.width,X=U.y,Q=U.y+U.height;const[ae,pe]=di(O)??[0,Me-1],ne=pe+1;if(M!==0)switch(M){case 2:{Q=ne,X=O,Ft(0,Q,"vertical");break}case-2:{X=ae,Q=O+1,Ft(0,X,"vertical");break}case 1:{X<O?(X++,Ft(0,X,"vertical")):(Q=Math.min(ne,Q+1),Ft(0,Q,"vertical"));break}case-1:{Q>O+1?(Q--,Ft(0,Q,"vertical")):(X=Math.max(ae,X-1),Ft(0,X,"vertical"));break}default:Vo()}if(S!==0)if(S===2)N=Qe.length,P=E,Ft(N-1-D,0,"horizontal");else if(S===-2)P=D,N=E+1,Ft(P-D,0,"horizontal");else{let Ae=[];if(k!==void 0){const be=k({x:P,y:X,width:N-P-D,height:Q-X},g.current.signal);typeof be=="object"&&(Ae=yk(be))}if(S===1){let be=!1;if(P<E){if(Ae.length>0){const He=Hr(P+1,E+1).find(Oe=>!Ae.includes(Oe-D));He!==void 0&&(P=He,be=!0)}else P++,be=!0;be&&Ft(P,0,"horizontal")}be||(N=Math.min(Qe.length,N+1),Ft(N-1-D,0,"horizontal"))}else if(S===-1){let be=!1;if(N>E+1){if(Ae.length>0){const He=Hr(N-1,E,-1).find(Oe=>!Ae.includes(Oe-D));He!==void 0&&(N=He,be=!0)}else N--,be=!0;be&&Ft(N-D,0,"horizontal")}be||(P=Math.max(D,P-1),Ft(P-D,0,"horizontal"))}else Vo()}Ge({cell:z.current.cell,range:{x:P,y:X,width:N-P,height:Q-X}},!0,!1,"keyboard-select")},[k,di,z,Qe.length,D,Me,Ft,Ge]),ss=c.useRef(Jn);ss.current=Jn;const pr=c.useCallback((f,S,M,E)=>{const O=Vt-(M?0:1);f=In(f,D,Pt.length-1+D),S=In(S,0,O);const U=Un==null?void 0:Un[0],P=Un==null?void 0:Un[1];if(f===U&&S===P)return!1;if(E&&z.current!==void 0){const N=[...z.current.rangeStack];(z.current.range.width>1||z.current.range.height>1)&&N.push(z.current.range),ee({...z,current:{cell:[f,S],range:{x:f,y:S,width:1,height:1},rangeStack:N}},!0)}else Ge({cell:[f,S],range:{x:f,y:S,width:1,height:1}},!0,!1,"keyboard-nav");return d.current!==void 0&&d.current[0]===f&&d.current[1]===S&&(d.current=void 0),ss.current&&Ft(f-D,S),!0},[Vt,D,Pt.length,Un,z,Ft,ee,Ge]),Wu=c.useCallback((f,S)=>{(o==null?void 0:o.cell)!==void 0&&f!==void 0&&oo(f)&&(Rn([{location:o.cell,value:f}]),window.requestAnimationFrame(()=>{var O;(O=Lt.current)==null||O.damage([{cell:o.cell}])})),tn(!0),i(void 0);const[M,E]=S;if(z.current!==void 0&&(M!==0||E!==0)){const O=z.current.cell[1]===Vt-1&&f!==void 0,U=z.current.cell[0]===Qe.length-1&&f!==void 0;let P=!0;if(O&&E===1&&De!==void 0){P=!1;const N=z.current.cell[0]+M,X=Zr(N);gr(X??N,!1)}if(U&&M===1&&_e!==void 0){P=!1;const N=z.current.cell[1]+E;ci(N,!1)}P&&pr(In(z.current.cell[0]+M,0,Qe.length-1),In(z.current.cell[1]+E,0,Vt-1),O,!1)}L==null||L(f,S)},[o==null?void 0:o.cell,tn,z,L,Rn,Vt,pr,Qe.length,gr,ci,De,_e,Zr]),Gu=c.useMemo(()=>`gdg-overlay-${bk++}`,[]),Pr=c.useCallback(f=>{var M,E,O,U;tn();const S=[];for(let P=f.x;P<f.x+f.width;P++)for(let N=f.y;N<f.y+f.height;N++){const X=I([P-D,N]);if(!X.allowOverlay&&X.kind!==ue.Boolean)continue;let Q;if(X.kind===ue.Custom){const ae=It(X),pe=(M=ae==null?void 0:ae.provideEditor)==null?void 0:M.call(ae,{...X,location:[P-D,N]});(ae==null?void 0:ae.onDelete)!==void 0?Q=ae.onDelete(X):Jm(pe)&&(Q=(E=pe==null?void 0:pe.deletedValue)==null?void 0:E.call(pe,X))}else if(oo(X)&&X.allowOverlay||X.kind===ue.Boolean){const ae=It(X);Q=(O=ae==null?void 0:ae.onDelete)==null?void 0:O.call(ae,X)}Q!==void 0&&!ao(Q)&&oo(Q)&&S.push({location:[P,N],value:Q})}Rn(S),(U=Lt.current)==null||U.damage(S.map(P=>({cell:P.location})))},[tn,I,It,Rn,D]),_o=o!==void 0,va=c.useCallback(f=>{var He,Oe;const S=()=>{f.stopPropagation(),f.preventDefault()},M={didMatch:!1},{bounds:E}=f,O=z.columns,U=z.rows,P=mn;if(!_o&&Ze(P.clear,f,M))ee(Ri,!1),Dt==null||Dt();else if(!_o&&Ze(P.selectAll,f,M))ee({columns:it.empty(),rows:it.empty(),current:{cell:((He=z.current)==null?void 0:He.cell)??[D,0],range:{x:D,y:0,width:C.length,height:Me},rangeStack:[]}},!1);else if(Ze(P.search,f,M))(Oe=a==null?void 0:a.current)==null||Oe.focus({preventScroll:!0}),Qn(!0);else if(Ze(P.delete,f,M)){const Ie=(ot==null?void 0:ot(z))??!0;if(Ie!==!1){const dt=Ie===!0?z:Ie;if(dt.current!==void 0){Pr(dt.current.range);for(const $t of dt.current.rangeStack)Pr($t)}for(const $t of dt.rows)Pr({x:D,y:$t,width:C.length,height:1});for(const $t of dt.columns)Pr({x:$t,y:0,width:1,height:Me})}}if(M.didMatch)return S(),!0;if(z.current===void 0)return!1;let[N,X]=z.current.cell;const[,Q]=z.current.cell;let ae=!1,pe=!1;if(Ze(P.scrollToSelectedCell,f,M))gi.current(N-D,X);else if(oe!=="none"&&Ze(P.selectColumn,f,M))O.hasIndex(N)?Ne(O.remove(N),void 0,!0):oe==="single"?Ne(it.fromSingleSelection(N),void 0,!0):Ne(void 0,N,!0);else if(ye!=="none"&&Ze(P.selectRow,f,M))U.hasIndex(X)?qe(U.remove(X),void 0,!0):ye==="single"?qe(it.fromSingleSelection(X),void 0,!0):qe(void 0,X,!0);else if(!_o&&E!==void 0&&Ze(P.activateCell,f,M))if(X===Me&<)window.setTimeout(()=>{const Ie=Zr(N);gr(Ie??N)},0);else{const Ie={inputType:"keyboard",key:f.key};B==null||B([N-D,X],Ie),Qr(E,Ie)}else z.current.range.height>1&&Ze(P.downFill,f,M)?ba():z.current.range.width>1&&Ze(P.rightFill,f,M)?pa():Ze(P.goToNextPage,f,M)?X+=Math.max(1,Nt.current.height-4):Ze(P.goToPreviousPage,f,M)?X-=Math.max(1,Nt.current.height-4):Ze(P.goToFirstCell,f,M)?(i(void 0),X=0,N=0):Ze(P.goToLastCell,f,M)?(i(void 0),X=Number.MAX_SAFE_INTEGER,N=Number.MAX_SAFE_INTEGER):Ze(P.selectToFirstCell,f,M)?(i(void 0),On([-2,-2])):Ze(P.selectToLastCell,f,M)?(i(void 0),On([2,2])):_o?(Ze(P.closeOverlay,f,M)&&i(void 0),Ze(P.acceptOverlayDown,f,M)&&(i(void 0),X++),Ze(P.acceptOverlayUp,f,M)&&(i(void 0),X--),Ze(P.acceptOverlayLeft,f,M)&&(i(void 0),N--),Ze(P.acceptOverlayRight,f,M)&&(i(void 0),N++)):(Ze(P.goDownCell,f,M)?X+=1:Ze(P.goUpCell,f,M)?X-=1:Ze(P.goRightCell,f,M)?N+=1:Ze(P.goLeftCell,f,M)?N-=1:Ze(P.goDownCellRetainSelection,f,M)?(X+=1,ae=!0):Ze(P.goUpCellRetainSelection,f,M)?(X-=1,ae=!0):Ze(P.goRightCellRetainSelection,f,M)?(N+=1,ae=!0):Ze(P.goLeftCellRetainSelection,f,M)?(N-=1,ae=!0):Ze(P.goToLastRow,f,M)?X=Me-1:Ze(P.goToFirstRow,f,M)?X=Number.MIN_SAFE_INTEGER:Ze(P.goToLastColumn,f,M)?N=Number.MAX_SAFE_INTEGER:Ze(P.goToFirstColumn,f,M)?N=Number.MIN_SAFE_INTEGER:(ft==="rect"||ft==="multi-rect")&&(Ze(P.selectGrowDown,f,M)?On([0,1]):Ze(P.selectGrowUp,f,M)?On([0,-1]):Ze(P.selectGrowRight,f,M)?On([1,0]):Ze(P.selectGrowLeft,f,M)?On([-1,0]):Ze(P.selectToLastRow,f,M)?On([0,2]):Ze(P.selectToFirstRow,f,M)?On([0,-2]):Ze(P.selectToLastColumn,f,M)?On([2,0]):Ze(P.selectToFirstColumn,f,M)&&On([-2,0])),pe=M.didMatch);if(Pn!==void 0&&Pn!=="normal"&&X!==Q){const Ie=Pn==="skip-up"||Pn==="skip"||Pn==="block",dt=Pn==="skip-down"||Pn==="skip"||Pn==="block",$t=X<Q;if($t&&Ie){for(;X>=0&&Fr(X).isGroupHeader;)X--;X<0&&(X=Q)}else if(!$t&&dt){for(;X<Me&&Fr(X).isGroupHeader;)X++;X>=Me&&(X=Q)}}const Ae=pr(N,X,!1,ae),be=M.didMatch;return be&&(Ae||!pe||fn)&&S(),be},[Pn,_o,z,mn,oe,ye,ft,D,Fr,Me,pr,ee,Dt,C.length,ot,fn,Pr,Ne,qe,lt,Zr,gr,B,Qr,ba,pa,On]),Po=c.useCallback(f=>{let S=!1;if(Be!==void 0&&Be({...f,...f.location&&{location:[f.location[0]-D,f.location[1]]},cancel:()=>{S=!0}}),S||va(f)||z.current===void 0)return;const[M,E]=z.current.cell,O=Nt.current;if(at&&!f.metaKey&&!f.ctrlKey&&z.current!==void 0&&f.key.length===1&&/[\p{L}\p{M}\p{N}\p{S}\p{P}]/u.test(f.key)&&f.bounds!==void 0&&io(I([M-D,Math.max(0,Math.min(E,Me-1))]))){if((!lt||E!==Me)&&(O.y>E||E>O.y+O.height||O.x>M||M>O.x+O.width))return;const U={inputType:"keyboard",key:f.key};B==null||B([M-D,E],U),Qr(f.bounds,U,f.key),f.stopPropagation(),f.preventDefault()}},[at,Be,va,z,I,D,Me,lt,B,Qr]),Uu=c.useCallback((f,S)=>{const M=f.location[0]-D;if(f.kind==="header"&&(de==null||de(M,{...f,preventDefault:S})),f.kind===Nn){if(M<0)return;q==null||q(M,{...f,preventDefault:S})}if(f.kind==="cell"){const[E,O]=f.location;Z==null||Z([M,O],{...f,preventDefault:S}),Kp(z,f.location)||pr(E,O,!1,!1)}},[z,Z,q,de,D,pr]),as=c.useCallback(async f=>{var P,N,X;if(!mn.paste)return;function S(Q,ae,pe,ne){var be,He;const Ae=typeof pe=="object"?(pe==null?void 0:pe.join(`
|
|
13
|
+
`))??"":(pe==null?void 0:pe.toString())??"";if(!ao(Q)&&io(Q)&&Q.readonly!==!0){const Oe=V==null?void 0:V(Ae,Q);if(Oe!==void 0&&oo(Oe))return{location:ae,value:Oe};const Ie=It(Q);if(Ie===void 0)return;if(Ie.kind===ue.Custom){bn(Q.kind===ue.Custom);const dt=(be=Ie.onPaste)==null?void 0:be.call(Ie,Ae,Q.data);return dt===void 0?void 0:{location:ae,value:{...Q,data:dt}}}else{const dt=(He=Ie.onPaste)==null?void 0:He.call(Ie,Ae,Q,{formatted:ne,formattedString:typeof ne=="string"?ne:ne==null?void 0:ne.join(`
|
|
14
|
+
`),rawValue:pe});return dt===void 0?void 0:(bn(dt.kind===Q.kind),{location:ae,value:dt})}}}const M=z.columns,E=z.rows,O=((P=St.current)==null?void 0:P.contains(document.activeElement))===!0||((N=s.current)==null?void 0:N.contains(document.activeElement))===!0;let U;if(z.current!==void 0?U=[z.current.range.x,z.current.range.y]:M.length===1?U=[M.first()??0,0]:E.length===1&&(U=[D,E.first()??0]),O&&U!==void 0){let Q,ae;const pe="text/plain",ne="text/html";if(navigator.clipboard.read!==void 0){const Oe=await navigator.clipboard.read();for(const Ie of Oe){if(Ie.types.includes(ne)){const $t=await(await Ie.getType(ne)).text(),Ht=Ol($t);if(Ht!==void 0){Q=Ht;break}}Ie.types.includes(pe)&&(ae=await(await Ie.getType(pe)).text())}}else if(navigator.clipboard.readText!==void 0)ae=await navigator.clipboard.readText();else if(f!==void 0&&(f==null?void 0:f.clipboardData)!==null){if(f.clipboardData.types.includes(ne)){const Oe=f.clipboardData.getData(ne);Q=Ol(Oe)}Q===void 0&&f.clipboardData.types.includes(pe)&&(ae=f.clipboardData.getData(pe))}else return;const[Ae,be]=U,He=[];do{if(ce===void 0){const Oe=pn(U),Ie=ae??(Q==null?void 0:Q.map($t=>$t.map(Ht=>Ht.rawValue).join(" ")).join(" "))??"",dt=S(Oe,U,Ie,void 0);dt!==void 0&&He.push(dt);break}if(Q===void 0){if(ae===void 0)return;Q=tk(ae)}if(ce===!1||typeof ce=="function"&&(ce==null?void 0:ce([U[0]-D,U[1]],Q.map(Oe=>Oe.map(Ie=>{var dt;return((dt=Ie.rawValue)==null?void 0:dt.toString())??""}))))!==!0)return;for(const[Oe,Ie]of Q.entries()){if(Oe+be>=Me)break;for(const[dt,$t]of Ie.entries()){const Ht=[dt+Ae,Oe+be],[ln,Xn]=Ht;if(ln>=Qe.length||Xn>=Vt)continue;const jn=pn(Ht),Kn=S(jn,Ht,$t.rawValue,$t.formatted);Kn!==void 0&&He.push(Kn)}}}while(!1);Rn(He),(X=Lt.current)==null||X.damage(He.map(Oe=>({cell:Oe.location})))}},[V,It,pn,z,mn.paste,St,Qe.length,Rn,Vt,ce,D,Me]);nn("paste",as,h,!1,!0);const Oo=c.useCallback(async(f,S)=>{var P,N;if(!mn.copy)return;const M=S===!0||((P=St.current)==null?void 0:P.contains(document.activeElement))===!0||((N=s.current)==null?void 0:N.contains(document.activeElement))===!0,E=z.columns,O=z.rows,U=(X,Q)=>{if(!xe)Nl(X,Q,f);else{const ae=Q.map(pe=>({kind:ue.Text,data:C[pe].title,displayData:C[pe].title,allowOverlay:!1}));Nl([ae,...X],Q,f)}};if(M&&k!==void 0){if(z.current!==void 0){let X=k(z.current.range,g.current.signal);typeof X!="object"&&(X=await X()),U(X,Hr(z.current.range.x-D,z.current.range.x+z.current.range.width-D))}else if(O!==void 0&&O.length>0){const Q=[...O].map(ae=>{const pe=k({x:D,y:ae,width:C.length,height:1},g.current.signal);return typeof pe=="object"?pe[0]:pe().then(ne=>ne[0])});if(Q.some(ae=>ae instanceof Promise)){const ae=await Promise.all(Q);U(ae,Hr(C.length))}else U(Q,Hr(C.length))}else if(E.length>0){const X=[],Q=[];for(const ae of E){let pe=k({x:ae,y:0,width:1,height:Me},g.current.signal);typeof pe!="object"&&(pe=await pe()),X.push(pe),Q.push(ae-D)}if(X.length===1)U(X[0],Q);else{const ae=X.reduce((pe,ne)=>pe.map((Ae,be)=>[...Ae,...ne[be]]));U(ae,Q)}}}},[C,k,z,mn.copy,D,St,Me,xe]);nn("copy",Oo,h,!1,!1);const Xu=c.useCallback(async f=>{var M,E;if(!(!mn.cut||!(((M=St.current)==null?void 0:M.contains(document.activeElement))===!0||((E=s.current)==null?void 0:E.contains(document.activeElement))===!0))&&(await Oo(f),z.current!==void 0)){let O={current:{cell:z.current.cell,range:z.current.range,rangeStack:[]},rows:it.empty(),columns:it.empty()};const U=ot==null?void 0:ot(O);if(U===!1||(O=U===!0?O:U,O.current===void 0))return;Pr(O.current.range)}},[Pr,z,mn.cut,Oo,St,ot]);nn("cut",Xu,h,!1,!1);const Ku=c.useCallback((f,S)=>{if(Te!==void 0){D!==0&&(f=f.map(O=>[O[0]-D,O[1]])),Te(f,S);return}if(f.length===0||S===-1)return;const[M,E]=f[S];d.current!==void 0&&d.current[0]===M&&d.current[1]===E||(d.current=[M,E],pr(M,E,!1,!1))},[Te,D,pr]),[fi,hi]=((Ma=Kt==null?void 0:Kt.current)==null?void 0:Ma.cell)??[],gi=c.useRef(Ft);gi.current=Ft,c.useLayoutEffect(()=>{var f,S,M,E;ss.current&&!$r.current&&fi!==void 0&&hi!==void 0&&(fi!==((S=(f=Y.current)==null?void 0:f.current)==null?void 0:S.cell[0])||hi!==((E=(M=Y.current)==null?void 0:M.current)==null?void 0:E.cell[1]))&&gi.current(fi,hi),$r.current=!1},[fi,hi]);const wa=z.current!==void 0&&(z.current.cell[0]>=Qe.length||z.current.cell[1]>=Vt);c.useLayoutEffect(()=>{wa&&ee(Ri,!1)},[wa,ee]);const Yu=c.useMemo(()=>lt===!0&&(We==null?void 0:We.tint)===!0?it.fromSingleSelection(Vt-1):it.empty(),[Vt,lt,We==null?void 0:We.tint]),qu=c.useCallback(f=>typeof nt=="boolean"?nt:(nt==null?void 0:nt(f-D))??!0,[D,nt]),Vu=c.useMemo(()=>{if(es===void 0||s.current===null)return null;const{bounds:f,group:S}=es,M=s.current.getBoundingClientRect();return c.createElement(GC,{bounds:f,group:S,canvasBounds:M,onClose:()=>ts(void 0),onFinish:E=>{ts(void 0),ve==null||ve(S,E)}})},[ve,es]),Ju=Math.min(Qe.length,Ye+(en?1:0));c.useImperativeHandle(t,()=>({appendRow:(f,S)=>gr(f+D,S),appendColumn:(f,S)=>ci(f,S),updateCells:f=>{var S;return D!==0&&(f=f.map(M=>({cell:[M.cell[0]+D,M.cell[1]]}))),(S=Lt.current)==null?void 0:S.damage(f)},getBounds:(f,S)=>{var M;if(!((s==null?void 0:s.current)===null||(St==null?void 0:St.current)===null)){if(f===void 0&&S===void 0){const E=s.current.getBoundingClientRect(),O=E.width/St.current.clientWidth;return{x:E.x-St.current.scrollLeft*O,y:E.y-St.current.scrollTop*O,width:St.current.scrollWidth*O,height:St.current.scrollHeight*O}}return(M=Lt.current)==null?void 0:M.getBounds((f??0)+D,S)}},focus:()=>{var f;return(f=Lt.current)==null?void 0:f.focus()},emit:async f=>{switch(f){case"delete":Po({bounds:void 0,cancel:()=>{},stopPropagation:()=>{},preventDefault:()=>{},ctrlKey:!1,key:"Delete",keyCode:46,metaKey:!1,shiftKey:!1,altKey:!1,rawEvent:void 0,location:void 0});break;case"fill-right":Po({bounds:void 0,cancel:()=>{},stopPropagation:()=>{},preventDefault:()=>{},ctrlKey:!0,key:"r",keyCode:82,metaKey:!1,shiftKey:!1,altKey:!1,rawEvent:void 0,location:void 0});break;case"fill-down":Po({bounds:void 0,cancel:()=>{},stopPropagation:()=>{},preventDefault:()=>{},ctrlKey:!0,key:"d",keyCode:68,metaKey:!1,shiftKey:!1,altKey:!1,rawEvent:void 0,location:void 0});break;case"copy":await Oo(void 0,!0);break;case"paste":await as();break}},scrollTo:Ft,remeasureColumns:f=>{for(const S of f)ui(S+D)},getMouseArgsForPosition:(f,S,M)=>{if((Lt==null?void 0:Lt.current)===null)return;const E=Lt.current.getMouseArgsForPosition(f,S,M);if(E!==void 0)return{...E,location:[E.location[0]-D,E.location[1]]}}}),[gr,ci,ui,St,Oo,Po,as,D,Ft]);const[xa,Ca]=Un??[],Qu=c.useCallback(f=>{const[S,M]=f;if(M===-1){oe!=="none"&&(Ne(it.fromSingleSelection(S),void 0,!1),tn());return}xa===S&&Ca===M||(Ge({cell:f,range:{x:S,y:M,width:1,height:1}},!0,!1,"keyboard-nav"),Ft(S,M))},[oe,tn,Ft,xa,Ca,Ge,Ne]),[Zu,ed]=c.useState(!1),ka=c.useRef(pc(f=>{ed(f)},5)),td=c.useCallback(()=>{ka.current(!0),z.current===void 0&&z.columns.length===0&&z.rows.length===0&&l===void 0&&Ge({cell:[D,oi],range:{x:D,y:oi,width:1,height:1}},!0,!1,"keyboard-select")},[oi,z,l,D,Ge]),nd=c.useCallback(()=>{ka.current(!1)},[]),[rd,od]=c.useMemo(()=>{let f;const S=(je==null?void 0:je.scrollbarWidthOverride)??Is(),M=Me+(lt?1:0);if(typeof gn=="number")f=qt+M*gn;else{let O=0;const U=Math.min(M,10);for(let P=0;P<U;P++)O+=gn(P);O=Math.floor(O/U),f=qt+M*O}f+=S;const E=Qe.reduce((O,U)=>U.width+O,0)+S;return[`${Math.min(1e5,E)}px`,`${Math.min(1e5,f)}px`]},[Qe,je==null?void 0:je.scrollbarWidthOverride,gn,Me,lt,qt]),id=c.useMemo(()=>ub(ct),[ct]);return c.createElement(db.Provider,{value:ct},c.createElement(ik,{style:id,className:he,inWidth:y??rd,inHeight:x??od},c.createElement(BC,{fillHandle:Je,drawFocusRing:lr,experimental:je,fixedShadowX:wn,fixedShadowY:or,getRowThemeOverride:an,headerIcons:Gt,imageWindowLoader:Jt,initialSize:dn,isDraggable:Hn,onDragLeave:Sr,onRowMoved:Bn,overscrollX:Yr,overscrollY:qr,preventDiagonalScrolling:ar,rightElement:xn,rightElementProps:Ln,smoothScrollX:ko,smoothScrollY:Rr,className:he,enableGroups:Sn,onCanvasFocused:td,onCanvasBlur:nd,canvasRef:s,onContextMenu:Uu,theme:ct,cellXOffset:Tu,cellYOffset:oi,accessibilityHeight:tr.height,onDragEnd:Lu,columns:Qe,nonGrowWidth:wt,drawHeader:jt,onColumnProposeMove:Nu,drawCell:Se,disabledRows:Yu,freezeColumns:Ju,lockColumns:D,firstColAccessible:D===0,getCellContent:pn,minColumnWidth:Zt,maxColumnWidth:$n,searchInputRef:a,showSearch:fr,onSearchClose:Zn,highlightRegions:Du,getCellsForSelection:k,getGroupDetails:Vi,headerHeight:Tr,isFocused:Zu,groupHeaderHeight:Sn?Dr:0,freezeTrailingRows:Et+(lt&&(We==null?void 0:We.sticky)===!0?1:0),hasAppendRow:lt,onColumnResize:ke,onColumnResizeEnd:rt,onColumnResizeStart:we,onCellFocused:Qu,onColumnMoved:Hu,onDragStart:Bu,onHeaderMenuClick:Pu,onHeaderIndicatorClick:Ou,onItemHovered:is,isFilling:(l==null?void 0:l.fillHandle)===!0,onMouseMove:_u,onKeyDown:Po,onKeyUp:Ce,onMouseDown:$u,onMouseUp:Fu,onDragOverCell:_t,onDrop:gt,onSearchResultsChanged:Ku,onVisibleRegionChanged:ju,clientSize:At,rowHeight:gn,searchResults:J,searchValue:ge,onSearchValueChange:se,rows:Vt,scrollRef:St,selection:z,translateX:tr.tx,translateY:tr.ty,verticalBorder:qu,gridRef:Lt,getCellRenderer:It,resizeIndicator:Ur}),Vu,o!==void 0&&c.createElement(c.Suspense,{fallback:null},c.createElement(pk,{...o,validateCell:K,bloom:H,id:Gu,getCellRenderer:It,className:(je==null?void 0:je.isSubGrid)===!0?"click-outside-ignore":void 0,provideEditor:Mt,imageEditorOverride:p,portalElementRef:Xr,onFinishEditing:Wu,markdownDivCreateNode:m,isOutsideClick:Io,customEventTarget:je==null?void 0:je.eventTarget}))))},wk=c.forwardRef(vk);function Ll(e){const{cell:t,posX:n,posY:r,bounds:o,theme:i}=e,{width:a,height:s,x:l,y:u}=o,d=t.maxSize??i.checkboxMaxSize,h=Math.floor(o.y+s/2),p=vc(d,s,i.cellVerticalPadding),b=yc(t.contentAlign??"center",l,a,i.cellHorizontalPadding,p),m=bc(b,h,p),y=wc(l+n,u+r,m);return Qs(t)&&y}const xk={getAccessibilityString:e=>{var t;return((t=e.data)==null?void 0:t.toString())??"false"},kind:ue.Boolean,needsHover:!0,useLabel:!1,needsHoverPosition:!0,measure:()=>50,draw:e=>Ck(e,e.cell.data,Qs(e.cell),e.cell.maxSize??e.theme.checkboxMaxSize,e.cell.hoverEffectIntensity??.35),onDelete:e=>({...e,data:!1}),onSelect:e=>{Ll(e)&&e.preventDefault()},onClick:e=>{if(Ll(e))return{...e.cell,data:iu(e.cell.data)}},onPaste:(e,t)=>{let n=$i;return e.toLowerCase()==="true"?n=!0:e.toLowerCase()==="false"?n=!1:e.toLowerCase()==="indeterminate"&&(n=Js),n===t.data?void 0:{...t,data:n}}};function Ck(e,t,n,r,o){if(!n&&t===$i)return;const{ctx:i,hoverAmount:a,theme:s,rect:l,highlighted:u,hoverX:d,hoverY:h,cell:{contentAlign:p}}=e,{x:b,y:m,width:y,height:x}=l;let C=!1;if(o>0){let w=n?1-o+o*a:.4;if(t===$i&&(w*=a),w===0)return;w<1&&(C=!0,i.globalAlpha=w)}ia(i,s,t,b,m,y,x,u,d,h,r,p),C&&(i.globalAlpha=1)}const kk=Cr("div")({name:"BubblesOverlayEditorStyle",class:"gdg-b1ygi5by",propsAsIs:!1}),Sk=e=>{const{bubbles:t}=e;return c.createElement(kk,null,t.map((n,r)=>c.createElement("div",{key:r,className:"boe-bubble"},n)),c.createElement("textarea",{className:"gdg-input",autoFocus:!0}))},Rk={getAccessibilityString:e=>_p(e.data),kind:ue.Bubble,needsHover:!1,useLabel:!1,needsHoverPosition:!1,measure:(e,t,n)=>{const r=t.data.reduce((o,i)=>e.measureText(i).width+o+n.bubblePadding*2+n.bubbleMargin,0);return t.data.length===0?n.cellHorizontalPadding*2:r+2*n.cellHorizontalPadding-n.bubbleMargin},draw:e=>Mk(e,e.cell.data),provideEditor:()=>e=>{const{value:t}=e;return c.createElement(Sk,{bubbles:t.data})},onPaste:()=>{}};function Mk(e,t){const{rect:n,theme:r,ctx:o,highlighted:i}=e,{x:a,y:s,width:l,height:u}=n;let d=a+r.cellHorizontalPadding;const h=[];for(const p of t){if(d>a+l)break;const b=Ki(p,o,r.baseFontFull).width;h.push({x:d,width:b}),d+=b+r.bubblePadding*2+r.bubbleMargin}o.beginPath();for(const p of h)uo(o,p.x,s+(u-r.bubbleHeight)/2,p.width+r.bubblePadding*2,r.bubbleHeight,r.roundingRadius??r.bubbleHeight/2);o.fillStyle=i?r.bgBubbleSelected:r.bgBubble,o.fill();for(const[p,b]of h.entries())o.beginPath(),o.fillStyle=r.textBubble,o.fillText(t[p],b.x+r.bubblePadding,s+u/2+wo(o,r))}function Ik(e,t){let n=e*49632+t*325176;return n^=n<<13,n^=n>>17,n^=n<<5,n/4294967295*2}const Ek={getAccessibilityString:()=>"",kind:ue.Loading,needsHover:!1,useLabel:!1,needsHoverPosition:!1,measure:()=>120,draw:e=>{const{cell:t,col:n,row:r,ctx:o,rect:i,theme:a}=e;if(t.skeletonWidth===void 0||t.skeletonWidth===0)return;let s=t.skeletonWidth;t.skeletonWidthVariability!==void 0&&t.skeletonWidthVariability>0&&(s+=Math.round(Ik(n,r)*t.skeletonWidthVariability));const l=a.cellHorizontalPadding;s+l*2>=i.width&&(s=i.width-l*2-1);const u=t.skeletonHeight??Math.min(18,i.height-2*a.cellVerticalPadding);uo(o,i.x+l,i.y+(i.height-u)/2,s,u,a.roundingRadius??3),o.fillStyle=Br(a.textDark,.1),o.fill()},onPaste:()=>{}},Tk={getAccessibilityString:e=>e.row.toString(),kind:En.Marker,needsHover:!0,needsHoverPosition:!1,drawPrep:Dk,measure:()=>44,draw:e=>Ak(e,e.cell.row,e.cell.checked,e.cell.markerKind,e.cell.drawHandle,e.cell.checkboxStyle),onClick:e=>{const{bounds:t,cell:n,posX:r,posY:o}=e,{width:i,height:a}=t,s=n.drawHandle?7+(i-7)/2:i/2,l=a/2;if(Math.abs(r-s)<=10&&Math.abs(o-l)<=10)return{...n,checked:!n.checked}},onPaste:()=>{}};function Dk(e,t){const{ctx:n,theme:r}=e,o=r.markerFontFull,i=t??{};return(i==null?void 0:i.font)!==o&&(n.font=o,i.font=o),i.deprep=$k,n.textAlign="center",i}function $k(e){const{ctx:t}=e;t.textAlign="start"}function Ak(e,t,n,r,o,i){const{ctx:a,rect:s,hoverAmount:l,theme:u}=e,{x:d,y:h,width:p,height:b}=s,m=n?1:r==="checkbox-visible"?.6+.4*l:l;if(r!=="number"&&m>0){a.globalAlpha=m;const y=7*(n?l:1);if(ia(a,u,n,o?d+y:d,h,o?p-y:p,b,!0,void 0,void 0,u.checkboxMaxSize,"center",i),o){a.globalAlpha=l,a.beginPath();for(const x of[3,6])for(const C of[-5,-1,3])a.rect(d+x,h+b/2+C,2,2);a.fillStyle=u.textLight,a.fill(),a.beginPath()}a.globalAlpha=1}if(r==="number"||r==="both"&&!n){const y=t.toString(),x=u.markerFontFull,C=d+p/2;r==="both"&&l!==0&&(a.globalAlpha=1-l),a.fillStyle=u.textLight,a.font=x,a.fillText(y,C,h+b/2+wo(a,x)),l!==0&&(a.globalAlpha=1)}}const Fk={getAccessibilityString:()=>"",kind:En.NewRow,needsHover:!0,needsHoverPosition:!1,measure:()=>200,draw:e=>_k(e,e.cell.hint,e.cell.icon),onPaste:()=>{}};function _k(e,t,n){const{ctx:r,rect:o,hoverAmount:i,theme:a,spriteManager:s}=e,{x:l,y:u,width:d,height:h}=o;r.beginPath(),r.globalAlpha=i,r.rect(l+1,u+1,d,h-2),r.fillStyle=a.bgHeaderHovered,r.fill(),r.globalAlpha=1,r.beginPath();const p=t!=="";let b=0;if(n!==void 0){const y=h-8,x=l+8/2,C=u+8/2;s.drawSprite(n,"normal",r,x,C,y,a,p?1:i),b=y}else{b=24;const m=12,y=p?m:i*m,x=p?0:(1-i)*m*.5,C=a.cellHorizontalPadding+4;y>0&&(r.moveTo(l+C+x,u+h/2),r.lineTo(l+C+x+y,u+h/2),r.moveTo(l+C+x+y*.5,u+h/2-y*.5),r.lineTo(l+C+x+y*.5,u+h/2+y*.5),r.lineWidth=2,r.strokeStyle=a.bgIconHeader,r.lineCap="round",r.stroke())}r.fillStyle=a.textMedium,r.fillText(t,b+l+a.cellHorizontalPadding+.5,u+h/2+wo(r,a)),r.beginPath()}function lu(e,t,n,r,o,i,a){e.textBaseline="alphabetic";const s=Pk(e,o,r,t,(n==null?void 0:n.fullSize)??!1);e.beginPath(),uo(e,s.x,s.y,s.width,s.height,t.roundingRadius??4),e.globalAlpha=i,e.fillStyle=(n==null?void 0:n.bgColor)??Br(t.textDark,.1),e.fill(),e.globalAlpha=1,e.fillStyle=t.textDark,e.textBaseline="middle",a==null||a("text")}function Pk(e,t,n,r,o){const i=r.cellHorizontalPadding,a=r.cellVerticalPadding;if(o)return{x:t.x+i/2,y:t.y+a/2+1,width:t.width-i,height:t.height-a-1};const s=Ki(n,e,r.baseFontFull,"alphabetic"),l=t.height-a,u=Math.min(l,s.actualBoundingBoxAscent*2.5);return{x:t.x+i/2,y:t.y+(t.height-u)/2+1,width:s.width+i*3,height:u-1}}const Ok=c.lazy(async()=>await Ql(()=>import("./number-overlay-editor-CXHiTLsp.js"),__vite__mapDeps([3,1,2]))),jk={getAccessibilityString:e=>{var t;return((t=e.data)==null?void 0:t.toString())??""},kind:ue.Number,needsHover:e=>e.hoverEffect===!0,needsHoverPosition:!1,useLabel:!0,drawPrep:Rc,draw:e=>{const{hoverAmount:t,cell:n,ctx:r,theme:o,rect:i,overrideCursor:a}=e,{hoverEffect:s,displayData:l,hoverEffectTheme:u}=n;s===!0&&t>0&&lu(r,o,u,l,i,t,a),Ic(e,e.cell.displayData,e.cell.contentAlign)},measure:(e,t,n)=>e.measureText(t.displayData).width+n.cellHorizontalPadding*2,onDelete:e=>({...e,data:void 0}),provideEditor:()=>e=>{const{isHighlighted:t,onChange:n,value:r,validatedSelection:o}=e;return c.createElement(c.Suspense,{fallback:null},c.createElement(Ok,{highlight:t,disabled:r.readonly===!0,value:r.data,fixedDecimals:r.fixedDecimals,allowNegative:r.allowNegative,thousandSeparator:r.thousandSeparator,decimalSeparator:r.decimalSeparator,validatedSelection:o,onChange:i=>n({...r,data:Number.isNaN(i.floatValue??0)?0:i.floatValue})}))},onPaste:(e,t,n)=>{const r=typeof n.rawValue=="number"?n.rawValue:Number.parseFloat(typeof n.rawValue=="string"?n.rawValue:e);if(!(Number.isNaN(r)||t.data===r))return{...t,data:r,displayData:n.formattedString??t.displayData}}},Nk={getAccessibilityString:e=>{var t;return((t=e.data)==null?void 0:t.toString())??""},kind:ue.Text,needsHover:e=>e.hoverEffect===!0,needsHoverPosition:!1,drawPrep:Rc,useLabel:!0,draw:e=>{const{cell:t,hoverAmount:n,hyperWrapping:r,ctx:o,rect:i,theme:a,overrideCursor:s}=e,{displayData:l,contentAlign:u,hoverEffect:d,allowWrapping:h,hoverEffectTheme:p}=t;d===!0&&n>0&&lu(o,a,p,l,i,n,s),Ic(e,l,u,h,r)},measure:(e,t,n)=>{const r=t.displayData.split(`
|
|
15
|
+
`,t.allowWrapping===!0?void 0:1);let o=0;for(const i of r)o=Math.max(o,e.measureText(i).width);return o+2*n.cellHorizontalPadding},onDelete:e=>({...e,data:""}),provideEditor:e=>({disablePadding:e.allowWrapping===!0,editor:t=>{const{isHighlighted:n,onChange:r,value:o,validatedSelection:i}=t;return c.createElement(Hp,{style:e.allowWrapping===!0?{padding:"3px 8.5px"}:void 0,highlight:n,autoFocus:o.readonly!==!0,disabled:o.readonly===!0,altNewline:!0,value:o.data,validatedSelection:i,onChange:a=>r({...o,data:a.target.value})})}}),onPaste:(e,t,n)=>e===t.data?void 0:{...t,data:e,displayData:n.formattedString??t.displayData}},Hk=new Set(["path","source"]);function Bk(e){return Hk.has(e.kind)}const Lk=16;function xr(e,t=[]){return{root:{field:e},keys:t}}function zk(e,t=[]){return{root:{instance:e},keys:t}}function Gr(e){return"field"in e.root?e.root.field:void 0}function cu(e){return"instance"in e.root?e.root.instance:void 0}function Wk(e,t){var n,r;switch(t.kind){case"value":return t.value.kind==="object"?Object.entries(t.value.properties).map(([o,i])=>[o,{kind:"value",value:i}]):[];case"object":return Object.entries(t.properties);case"instance":return Object.entries(((r=(n=e.resources)==null?void 0:n[t.name])==null?void 0:r.args)??{});default:return[]}}function Gk(e,t){if("field"in t.root)return e.cells[t.root.field]??"absent";const{instance:n}=t.root;return e.resources&&Object.hasOwn(e.resources,n)?{kind:"instance",name:n}:"absent"}function uu(e,t){const n=Gk(e,t);if(n==="absent")return{value:n};let r=n,o,i=0;for(const a of t.keys){if(o=void 0,r.kind==="instance"){if(++i>Lk)return{value:"n/a"};o={instance:r.name,arg:a}}const s=Wk(e,r).find(([l])=>l===a);if(!s)return{value:"n/a"};r=s[1]}return o?{value:r,argument:o}:{value:r}}function du(e,t){return uu(e,t).value}const Uk=e=>e.replaceAll("%","%25").replaceAll("/","%2F");function Tn(e){return("field"in e.root?e.root.field:`@${e.root.instance}`)+e.keys.map(n=>`/${Uk(n)}`).join("")}function ca(e,t){if(e===t)return!0;if(typeof e!="object"||typeof t!="object"||!e||!t||Array.isArray(e)!==Array.isArray(t))return!1;const n=Object.keys(e);return n.length!==Object.keys(t).length?!1:n.every(r=>Object.hasOwn(t,r)&&ca(e[r],t[r]))}function Bs(e,t,n,r){switch(e.kind){case"instance":r.push({from:n(t),to:e.name,...e.output!==void 0&&{output:e.output}});break;case"object":for(const[o,i]of Object.entries(e.properties))Bs(i,[...t,o],n,r);break}}function Xk(e){const t=[];for(const[n,r]of Object.entries(e.cells))Bs(r,[],o=>({cell:n,path:o}),t);for(const[n,r]of Object.entries(e.resources??{}))for(const[o,i]of Object.entries(r.args??{}))Bs(i,[],a=>({instance:n,arg:o,path:a}),t);return t}function Kk(e){const t=e.resources??{};return Xk(e).filter(n=>!Object.hasOwn(t,n.to))}function Yk(e){const t=e.from.path.length?` › ${e.from.path.join(" › ")}`:"";return`${"cell"in e.from?`cell ${e.from.cell}${t}`:`${e.from.instance}'s ${e.from.arg}${t}`} → ${e.to}${e.output?`.${e.output}`:""}`}function ro(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function qk(e){if(!ro(e))return"an update must be an object";if(typeof e.rowId!="string")return"an update needs a rowId";if(!ro(e.cells))return"an update needs cells (use {} for none)";for(const[t,n]of Object.entries(e.cells))if(n!==null&&!(ro(n)&&typeof n.kind=="string"))return`cell ${t} must be an input or null`;if(e.resources!==void 0){if(!ro(e.resources))return"resources must be an object";for(const[t,n]of Object.entries(e.resources)){if(!ld(t))return`'${t}' isn't a valid instance name`;if(n!==null){if(!ro(n)||typeof n.uri!="string")return`instance ${t} needs a resource uri`;if(n.args!==void 0&&!ro(n.args))return`instance ${t}'s args must be an object`}}}}const zl={name:"datasets",helper:"datasetView",isFinal:()=>!0,actions:{selectRow:{effect:"ephemeral",check(e,{subject:t}){const n=e==null?void 0:e.index;return Number.isInteger(n)&&n>=0&&n<t.overview.rowCount?void 0:`no row ${String(n)}`}},showInstance:{effect:"ephemeral",check(e,{context:t}){var o;const n=e==null?void 0:e.name;if(typeof n!="string")return"an instance needs a name";const{resources:r}=((o=t.selected)==null?void 0:o.row)??{};return r&&Object.hasOwn(r,n)?void 0:`the selected row has no instance ${n}`}},proposeUpdate:{effect:"effectful",check(e,{context:t}){var i;const n=e==null?void 0:e.update,r=qk(n);if(r)return r;const{rowId:o}=n;return o===((i=t.selected)==null?void 0:i.row.id)?void 0:"a view can only change the row it's showing"}}},props:({subject:e,context:t},n,r)=>({...r,dataset:e.dataset,overview:e.overview,selected:t.selected,selectRow:o=>n("selectRow",{index:o}),showInstance:o=>n("showInstance",{name:o}),proposeUpdate:o=>n("proposeUpdate",{update:o})})};function Vk(e,t){const n=[];for(const r of e){if(!r.providerId)continue;const{providerId:o,id:i}=r,a=(u,d)=>({value:JSON.stringify([o,i,u,d.name]),providerId:o,promptId:i,half:u,path:d.name,def:d}),s=[...r.functionParameters.map(u=>a("function",u)),...(r.executeParameters??[]).map(u=>a("execute",u))];if(s.length===0)continue;const l=Zl(r,t);n.push({key:JSON.stringify([o,i]),label:r.name,linked:l,options:s})}return n.sort((r,o)=>Number(o.linked)-Number(r.linked))}function Jk(e){var n,r;const t=new Map;for(const o of e){if(!o.providerId)continue;const{providerId:i,id:a}=o;for(const s of((n=o.inputSources)==null?void 0:n.resources)??[]){const l=JSON.stringify([i,s.uri]);t.has(l)||s.error||s.parent!==void 0||(r=s.parameters)!=null&&r.length&&t.set(l,{key:l,label:s.label,options:s.parameters.map(u=>({value:JSON.stringify(["resource",i,s.uri,u.name]),providerId:i,promptId:a,resourceUri:s.uri,path:u.name,def:u}))})}}return[...t.values()]}function Qk(e,t,n=[]){if(cd(e))return{kind:"primitive",type:e};for(const r of t){const o=r.options.find(i=>i.value===e);if(o)return{kind:"parameter",option:o}}for(const r of n){const o=r.options.find(i=>i.value===e);if(o)return{kind:"resource",option:o}}}function Zk(e){return e.kind==="primitive"?"":e.option.def.name}function eS(e,t){const n=e.trim();if(t.kind==="primitive")return n?{name:n,type:t.type}:void 0;if(t.kind==="resource"){const{providerId:s,promptId:l,resourceUri:u,path:d}=t.option;return{from:{providerId:s,promptId:l,resourceUri:u,path:d},...n&&n!==t.option.def.name&&{name:n}}}const{providerId:r,promptId:o,half:i,path:a}=t.option;return{from:{providerId:r,promptId:o,half:i,path:a},...n&&n!==t.option.def.name&&{name:n}}}const tS=60;function nS(e,t=tS){return e.length>t?`${e.slice(0,t-1)}…`:e}function fu(e){return e.value.map(t=>typeof t=="string"?t:`\${${t.expr}}`).join("")}function ua(e){switch(e.kind){case"primitive":return e.value===void 0?"—":typeof e.value=="string"?JSON.stringify(e.value):String(e.value);case"template":return`"${fu(e)}"`;case"object":{const t=Object.keys(e.properties);return t.length===0?"{}":`{ ${t.join(", ")} }`}case"array":case"tuple":return`[${e.elements.length}]`;case"functionCall":return`${e.callee}(…)`;case"reference":return e.path.join(".");case"lambda":return`(${e.parameters.join(", ")}) => …`;case"raw":return e.sourceText}}function rS(e){const t=e.lastIndexOf("#");return t>=0?e.slice(t+1):e}const oS="(unsupported)";function Yn(e){switch(e.kind){case"value":return nS(ua(e.value));case"object":return"{…}";case"instance":return e.output===void 0?e.name:`${e.name}.${e.output}`;case"dataset":return`= column ${e.field}`;case"input":return`= ${e.half==="execute"?"execute.":""}${e.path}`;default:return oS}}function qo(e){switch(e.kind){case"primitive":return e.value??null;case"template":return fu(e);case"object":return Object.fromEntries(Object.entries(e.properties).map(([t,n])=>[t,qo(n)]));case"array":case"tuple":return e.elements.map(qo);default:return ua(e)}}function iS({top:e,height:t,onPick:n,onFieldAdded:r,...o}){const[i,a]=c.useState(!1),s=c.useCallback(()=>a(!1),[]),{triggerRef:l,popoverRef:u,style:d}=ei({open:i,onClose:s,matchTriggerWidth:!1}),h=i&&ho.createPortal(v.jsx("div",{className:"trace-column-picker dataset-column-picker",ref:u,style:d,role:"dialog","aria-label":"Add column",children:v.jsx(hu,{...o,onPick:p=>{n(p),s()},onFieldAdded:()=>{r(),s()}})}),document.body);return v.jsxs("div",{className:"dataset-add-field-slot",style:{paddingTop:e},children:[v.jsx("button",{type:"button",ref:l,className:"dataset-add-field-trigger",style:{height:t},onClick:()=>i?s():a(!0),title:"Add column","aria-label":"Add column","aria-expanded":i,children:"+"}),h]})}function hu({fields:e,instances:t,describePath:n,onPick:r,newField:o,onFieldAdded:i,onBack:a}){const[s,l]=c.useState(!1);return s?v.jsxs("div",{className:"dataset-path-tree",role:"group","aria-label":"New field",children:[v.jsx("button",{type:"button",className:"trace-header-menu-item dataset-path-tree-back",onClick:()=>l(!1),children:v.jsx("span",{className:"trace-header-menu-item-label",children:"‹ Add column"})}),v.jsx(sS,{...o,onAdded:i})]}):v.jsxs("div",{className:"dataset-path-tree",role:"group","aria-label":"Add column",children:[a&&v.jsx("button",{type:"button",className:"trace-header-menu-item dataset-path-tree-back",onClick:a,children:v.jsx("span",{className:"trace-header-menu-item-label",children:"‹ Columns"})}),e.map(u=>v.jsx(Ls,{path:xr(u.id),label:u.def.name,depth:0,describePath:n,onPick:r},u.id)),Object.entries(t).map(([u,d])=>v.jsx(Ls,{path:zk(u),label:`◆ ${u}`,detail:d.uri.slice(d.uri.lastIndexOf("#")+1),depth:0,describePath:n,onPick:r},`@${u}`)),v.jsx("button",{type:"button",className:"trace-header-menu-item dataset-path-tree-new",onClick:()=>l(!0),children:v.jsx("span",{className:"trace-header-menu-item-label",children:"New field…"})})]})}function sS({providerId:e,datasetId:t,prompts:n,linked:r,onAdded:o}){const[i,a]=c.useState(""),[s,l]=c.useState("string"),[u,d]=c.useState(null),[h,p]=c.useState(!1),b=c.useMemo(()=>Vk(n,r),[n,r]),m=c.useMemo(()=>Jk(n),[n]),y=Qk(s,b,m)??{kind:"primitive",type:"string"},x=eS(i,y),C=async()=>{if(!(!x||h)){p(!0);try{await dd(e,t,x),o()}catch(w){d((w==null?void 0:w.message)??String(w)),p(!1)}}};return v.jsx("div",{className:"dataset-add-field",children:v.jsxs("form",{onSubmit:w=>{w.preventDefault(),C()},children:[v.jsxs("label",{className:"dataset-add-field-row",children:[v.jsx("span",{children:"Name"}),v.jsx("input",{autoFocus:!0,"data-1p-ignore":!0,className:"add-to-dataset-name","aria-label":"Field name",value:i,placeholder:Zk(y)||void 0,onChange:w=>{a(w.target.value),d(null)}})]}),v.jsxs("label",{className:"dataset-add-field-row",children:[v.jsx("span",{children:"Type"}),v.jsxs("select",{className:"add-to-dataset-name","aria-label":"Field type",value:s,onChange:w=>{l(w.target.value),d(null)},children:[ud.map(w=>v.jsx("option",{value:w,children:w},w)),b.map(w=>v.jsx("optgroup",{label:`Same type as a parameter of ${w.label}${w.linked?" (linked)":""}`,children:w.options.map(I=>v.jsxs("option",{value:I.value,children:[I.def.name,": ",Di(I.def.type.syntax,40)]},I.value))},w.key)),m.map(w=>v.jsx("optgroup",{label:`Same type as an input of resource ${w.label}`,children:w.options.map(I=>v.jsxs("option",{value:I.value,children:[I.def.name,": ",Di(I.def.type.syntax,40)]},I.value))},w.key))]})]}),u&&v.jsx("div",{className:"dataset-add-field-error",role:"alert",children:u}),v.jsx("div",{className:"dataset-add-field-actions",children:v.jsx("button",{type:"submit",className:"add-to-dataset-create",disabled:!x||h,children:"Add field"})})]})})}function Ls({path:e,label:t,detail:n,depth:r,describePath:o,onPick:i}){const[a,s]=c.useState(!1),[l,u]=c.useState(null),[d,h]=c.useState(null),p=()=>{const b=!a;s(b),b&&l===null&&o(e).then(u,m=>h(m.message))};return v.jsxs("div",{children:[v.jsxs("div",{className:"dataset-path-tree-node",style:{paddingLeft:4+r*14},children:[v.jsx("button",{type:"button",className:"dataset-column-picker-disclosure","aria-label":`${a?"Collapse":"Expand"} ${t}`,onClick:p,disabled:(l==null?void 0:l.length)===0,children:(l==null?void 0:l.length)===0?"":a?"▾":"▸"}),v.jsxs("button",{type:"button",className:"dataset-path-tree-pick",title:`Add a column at ${t}`,onClick:()=>i(e),children:[v.jsx("span",{className:"dataset-column-picker-title",children:t}),n&&v.jsx("span",{className:"dataset-column-picker-detail",children:n})]})]}),a&&v.jsxs("div",{role:"group",children:[d&&v.jsx("div",{className:"dataset-path-tree-note",children:d}),l===null&&!d&&v.jsx("div",{className:"dataset-path-tree-note",style:{paddingLeft:22+(r+1)*14},children:"Loading…"}),l==null?void 0:l.map(b=>v.jsx(Ls,{path:{root:e.root,keys:[...e.keys,b.key]},label:b.key,...b.sample&&{detail:Yn(b.sample)},depth:r+1,describePath:o,onPick:i},b.key))]})]})}function aS({field:e,anchor:t,onRename:n,onDelete:r,onHide:o,rowLabel:i,onClose:a}){const[s,l]=c.useState(!1),[u,d]=c.useState((e==null?void 0:e.def.name)??""),[h,p]=c.useState(null),[b,m]=c.useState(!1),{triggerRef:y,popoverRef:x,style:C}=ei({open:!0,onClose:a,matchTriggerWidth:!1}),w=async()=>{const I=u.trim();if(!b){if(!I||I===(e==null?void 0:e.def.name))return a();m(!0);try{await n(I),a()}catch(W){p((W==null?void 0:W.message)??String(W)),m(!1)}}};return ho.createPortal(v.jsxs(v.Fragment,{children:[v.jsx("span",{ref:y,"aria-hidden":!0,style:{position:"fixed",left:t.x,top:t.y,width:t.width,height:t.height,pointerEvents:"none"}}),s?v.jsx("div",{className:"dataset-add-field dataset-add-field-popover",ref:x,style:C,role:"dialog","aria-label":"Rename field",children:v.jsxs("form",{onSubmit:I=>{I.preventDefault(),w()},children:[v.jsx("input",{autoFocus:!0,"data-1p-ignore":!0,className:"add-to-dataset-name","aria-label":"Field name",value:u,onChange:I=>{d(I.target.value),p(null)},onFocus:I=>I.target.select()}),h&&v.jsx("div",{className:"dataset-add-field-error",role:"alert",children:h}),v.jsx("div",{className:"dataset-add-field-actions",children:v.jsx("button",{type:"submit",className:"add-to-dataset-create",disabled:!u.trim()||b,children:"Rename"})})]})}):v.jsxs("div",{className:"trace-header-menu",ref:x,style:C,role:"menu",children:[v.jsx("button",{type:"button",role:"menuitem",className:"trace-header-menu-item",onClick:()=>{o(),a()},children:v.jsx("span",{className:"trace-header-menu-item-label",children:"Hide column"})}),i&&v.jsx("button",{type:"button",role:"menuitem",className:"trace-header-menu-item",onClick:()=>{i.toggle(),a()},children:v.jsx("span",{className:"trace-header-menu-item-label",children:i.isLabel?"Don't use as row label":"Use as row label"})}),e&&v.jsxs(v.Fragment,{children:[v.jsx("button",{type:"button",role:"menuitem",className:"trace-header-menu-item",onClick:()=>l(!0),children:v.jsx("span",{className:"trace-header-menu-item-label",children:"Rename field…"})}),v.jsx("button",{type:"button",role:"menuitem",className:"trace-header-menu-item dataset-menu-delete",onClick:r,children:v.jsx("span",{className:"trace-header-menu-item-label",children:"Delete field"})})]})]})]}),document.body)}function lS(e,t,n){var u,d;const r=new Set(t.map(h=>h.id)),o=[],i=new Map,a=new Set;let s=!1;const l=h=>{let p=i.get(h);return p||(p={kind:"field",fieldId:h,hidden:!1,keys:[]},i.set(h,p),o.push(p)),p};for(const h of e??[]){const p=h.hidden===!0;if(!Bk(h)){o.push({kind:"unknown",spec:h,hidden:p});continue}if(h.kind==="source"){if(s)continue;s=!0,o.push({kind:"source",hidden:p});continue}const{path:b,title:m}=h,y=Tn(b);if(a.has(y))continue;const x=Gr(b);if(x!==void 0&&!r.has(x))continue;const[C,...w]=b.keys;if(x!==void 0&&C===void 0){a.add(y);const I=l(x);I.hidden=p,m!==void 0&&(I.title=m);continue}if(x!==void 0&&w.length===0){if((u=n[x])!=null&&u.keys.includes(C)){a.add(y),l(x).keys.push({key:C,hidden:p,...m!==void 0&&{title:m}});continue}if(!h.added)continue}a.add(y),o.push({kind:"added",path:b,hidden:p,...m!==void 0&&{title:m}})}for(const h of t){const p=l(h.id),b=new Set(p.keys.map(m=>m.key));for(const m of((d=n[h.id])==null?void 0:d.keys)??[])b.has(m)||p.keys.push({key:m,hidden:!1})}return s||o.push({kind:"source",hidden:!1}),o}const zo=e=>e?{hidden:!0}:{};function cS(e){return e.flatMap(uS)}function uS(e){switch(e.kind){case"field":return[{kind:"path",path:xr(e.fieldId),...e.title!==void 0&&{title:e.title},...zo(e.hidden)},...e.keys.map(t=>({kind:"path",path:xr(e.fieldId,[t.key]),...t.title!==void 0&&{title:t.title},...zo(t.hidden)}))];case"added":return[{kind:"path",path:e.path,...e.title!==void 0&&{title:e.title},...zo(e.hidden),added:!0}];case"source":return[{kind:"source",...zo(e.hidden)}];case"unknown":{const{hidden:t,...n}=e.spec;return[{...n,...zo(e.hidden)}]}}}function gu(e){if(e.kind==="field")return xr(e.fieldId);if(e.kind==="added")return e.path}function mu(e,t){const n=e[t.index];if(n)return t.key!==void 0?n.kind==="field"?xr(n.fieldId,[t.key]):void 0:gu(n)}function Bi(e,t,n){return e.map((r,o)=>o!==t.index?r:t.key===void 0?{...r,hidden:n}:r.kind!=="field"?r:{...r,keys:r.keys.map(i=>i.key===t.key?{...i,hidden:n}:i)})}function pu(e,t,n){if(t===n||t<0||t>=e.length||n<0||n>=e.length)return[...e];const r=[...e],[o]=r.splice(t,1);return r.splice(n,0,o),r}function dS(e,t,n){return pu(e,t,n)}function fS(e,t,n,r){return e.map((o,i)=>i===t&&o.kind==="field"?{...o,keys:pu(o.keys,n,r)}:o)}function hS(e,t){var n;return((n=e[t])==null?void 0:n.kind)==="added"?e.filter((r,o)=>o!==t):e}function gS(e,t){const n=Tn(t);for(const[r,o]of e.entries()){const i=gu(o);if(i&&Tn(i)===n)return{index:r};if(o.kind==="field"){for(const{key:a}of o.keys)if(Tn(xr(o.fieldId,[a]))===n)return{index:r,key:a}}}}function mS(e,t){const n=gS(e,t);if(n){let r=Bi(e,n,!1);return n.key!==void 0&&(r=Bi(r,{index:n.index},!1)),r}return[...e,{kind:"added",path:t,hidden:!1}]}function Wl(e,t,n){const r=[...n];return e.map(o=>t(o)?r.shift()??o:o)}function Gl(e){return({fgColor:t})=>`<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><polyline points="${e}" fill="none" stroke="${t}" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`}const bu="disclosureCollapsed",yu="disclosureExpanded",pS={[bu]:Gl("8.75,6.75 11.9,10 8.75,13.25"),[yu]:Gl("6.75,8.75 10,11.9 13.25,8.75")},Wo={whole:240,key:160,added:200,source:96,unknown:120};function bS(e){return e.def.name}function vu(e,t){var o;const n=e.keys.at(-1);if(n!==void 0)return n;const r=Gr(e);return r===void 0?cu(e)??"":((o=t.find(i=>i.id===r))==null?void 0:o.def.name)??r}function yS(e,t){var o;const n=Gr(e);return[n===void 0?`◆ ${cu(e)}`:((o=t.find(i=>i.id===n))==null?void 0:o.def.name)??n,...e.keys].join(" › ")}function vS({fields:e,layout:t,expanded:n,shortType:r}){const o=new Map(e.map(a=>[a.id,a])),i=[];for(const[a,s]of t.entries()){if(s.hidden)continue;const l={index:a};switch(s.kind){case"field":{const u=o.get(s.fieldId);if(!u)break;const d=r(u.def.type.syntax),h=fd(u.def.type),p={id:u.id,title:u.def.name,type:d,role:"whole",path:xr(u.id),width:Wo.whole,slot:l,...h&&{base:h}};if(s.keys.length===0){i.push(p);break}const b=bS(u),m=s.keys.filter(y=>!y.hidden);if(!n.has(u.id)||m.length===0){i.push({...p,group:b});break}for(const{key:y}of m){const x=xr(u.id,[y]);i.push({id:Tn(x),title:y,group:b,role:"key",path:x,width:Wo.key,slot:{index:a,key:y}})}break}case"added":i.push({id:Tn(s.path),title:s.title??vu(s.path,e),role:"added",path:s.path,width:Wo.added,slot:l});break;case"source":i.push({id:"source",title:"source",role:"source",width:Wo.source,slot:l});break;case"unknown":i.push({id:`?${a}`,title:"Unknown column",type:s.spec.kind,role:"unknown",kind:s.spec.kind,width:Wo.unknown,slot:l});break}}return i}function wS(e){return(e==null?void 0:e.role)==="whole"?Gr(e.path):void 0}function xS(e){return e&&"path"in e?e.path:void 0}function wu(e,t,n){const r=[...e],[o]=r.splice(t,1);return r.splice(n,0,o),r}function xu(e,t,n){const r=e[t];if(!r||!e[n])return!1;if(t===n)return!0;if(r.role==="key"){const s=e[n];return s.role==="key"&&s.slot.index===r.slot.index}const o=wu(e,t,n),i=new Set;let a;for(const s of o){const l=s.role==="key"?s.slot.index:void 0;if(l!==a){if(a!==void 0&&i.add(a),l!==void 0&&i.has(l))return!1;a=l}}return!0}function CS(e,t,n,r){const o=t[n];if(!o||n===r||!xu(t,n,r))return e;const i=wu(t,n,r),{index:a}=o.slot,s=e[a];if(o.role==="key"&&(s==null?void 0:s.kind)==="field"){const d=i.flatMap(b=>b.role==="key"&&b.slot.index===a?[b.slot.key]:[]),h=new Set(d),p=Wl(s.keys,b=>h.has(b.key),d.flatMap(b=>s.keys.filter(m=>m.key===b)));return e.map((b,m)=>m===a?{...s,keys:p}:b)}const l=[];for(const d of i)l.at(-1)!==d.slot.index&&l.push(d.slot.index);const u=new Set(l);return Wl(e.map((d,h)=>h),d=>u.has(d),l).map(d=>e[d])}function kS(e){const t=new Map;for(const n of e){const r="path"in n?Gr(n.path):void 0;n.group!==void 0&&r!==void 0&&(t.has(n.group)||t.set(n.group,r))}return t}function SS(e,t,n){const r=t.get(e);return r===void 0?{name:e}:{name:e,icon:n.has(r)?yu:bu}}function RS(e){const t=typeof e;return t==="string"||t==="number"||t==="boolean"?t:void 0}function Zo(e,t){if(!e||!t)return;if(t.role==="added")return MS(e,t.path);if(t.role!=="whole"||!t.base)return;const{base:n}=t,r=Gr(t.path);if(r===void 0)return;const o=e.cells[r];if(!o)return{base:n,fieldId:r};if(o.kind!=="value"||o.value.kind!=="primitive")return;const{value:i}=o.value;return typeof i===n?{base:n,fieldId:r,value:i}:void 0}function MS(e,t){var s;const{value:n,argument:r}=uu(e,t),o=r&&((s=e.resources)==null?void 0:s[r.instance]);if(!r||!o||typeof n!="object"||n.kind!=="value"||n.value.kind!=="primitive")return;const{value:i}=n.value,a=RS(i);if(a)return{base:a,instance:r.instance,arg:r.arg,spec:o,value:i}}function Cu(e,t){return t==null||t===""?!0:e==="number"?typeof t=="number"&&Number.isFinite(t):typeof t===e}function IS(e,t){if(Cu(e,t))return ec({kind:"primitive",value:t??void 0})}function ku(e){return"fieldId"in e?{fieldId:e.fieldId}:{instance:e.instance,arg:e.arg,spec:e.spec}}function ES(e,t,n){const r=[];for(const{col:o,row:i,value:a}of e){const s=n(i),l=s&&Zo(s,t[o]);if(!l)continue;const u=IS(l.base,a);u===void 0||u===null&&!("fieldId"in l)||r.push({rowId:s.id,...ku(l),cell:u})}return r}function TS(e,t,n){const r=[];for(const{x:o,y:i,width:a,height:s}of e)for(let l=i;l<i+s;l++){const u=n(l);for(let d=o;d<o+a;d++){const h=u&&Zo(u,t[d]);h&&"fieldId"in h&&h.value!==void 0&&r.push({rowId:u.id,...ku(h),cell:null})}}return r}function DS(e){const t=new Map;for(const n of e){const{rowId:r,cell:o}=n;let i=t.get(r);if(i||(i={rowId:r,cells:{}},t.set(r,i)),"fieldId"in n){i.cells[n.fieldId]=o;continue}const a=i.resources??{};i.resources=a;const s=a[n.instance]??n.spec,{args:l,...u}=s,d={...s.args};o===null?delete d[n.arg]:d[n.arg]=o,a[n.instance]={...u,...Object.keys(d).length>0&&{args:d}}}return[...t.values()]}function Su(e,t){const n={...e.cells};for(const[a,s]of Object.entries(t.cells))s===null?delete n[a]:n[a]=s;if(!t.resources)return{...e,cells:n};const r={...e.resources};for(const[a,s]of Object.entries(t.resources))s===null?delete r[a]:r[a]=s;const{resources:o,...i}=e;return{...i,cells:n,...Object.keys(r).length>0&&{resources:r}}}function $S(e){const t=Object.entries(e.properties);return t.length===0?"{}":`{ ${t.map(([n,r])=>`${n}: ${r.kind==="instance"?`◆ ${Yn(r)}`:Yn(r)}`).join(", ")} }`}function AS(e){const t=Object.entries(e.properties);return t.length===0?"{}":`{ ${t.map(([n,r])=>`${n}: ${ua(r)}`).join(", ")} }`}function FS(e){switch(e.kind){case"instance":return{kind:"chip",text:`◆ ${Yn(e)}`};case"object":return{kind:"text",text:$S(e)};default:return{kind:"text",text:e.kind==="value"&&e.value.kind==="object"?AS(e.value):Yn(e)}}}function _S(e,t){var n,r;if(!t)return{kind:"empty"};if(!e)return{kind:"loading"};switch(t.role){case"source":return((n=e.source)==null?void 0:n.kind)==="trace"?{kind:"text",text:"trace ↗",tone:"link"}:((r=e.source)==null?void 0:r.kind)==="playground"?{kind:"text",text:"playground",tone:"dim"}:{kind:"empty"};case"unknown":return{kind:"unknown"};default:{const o=du(e,t.path),i=Zo(e,t);return i?{kind:"edit",base:i.base,value:i.value,text:typeof o=="object"?Yn(o):"—"}:o==="absent"?{kind:"empty"}:o==="n/a"?{kind:"n/a"}:FS(o)}}}function Cs(e,t){const n=du(e,t);if(typeof n!="string"){if(n.kind==="value"&&n.value.kind==="primitive"){const{value:r}=n.value;return r==null||r===""?void 0:String(r)}return Yn(n)}}class PS{constructor(t,n,r,o=100,i=20){Ue(this,"pages",new Map);Ue(this,"inFlight",new Map);Ue(this,"generation",0);Ue(this,"focus",{first:0,last:0});Ue(this,"fetchRows");Ue(this,"onLoad");Ue(this,"onError");Ue(this,"pageSize");Ue(this,"maxPages");this.fetchRows=t,this.onLoad=n,this.onError=r,this.pageSize=o,this.maxPages=i}get(t){const n=this.pages.get(Math.floor(t/this.pageSize));return n==null?void 0:n.rows[t%this.pageSize]}async rowsAt(t){const n=new Set(t.filter(o=>!this.get(o)).map(o=>Math.floor(o/this.pageSize))),r=new Map(await Promise.all(Array.from(n,async o=>[o,await this.fetchRows(o*this.pageSize,this.pageSize)])));return t.flatMap(o=>{var a;const i=this.get(o)??((a=r.get(Math.floor(o/this.pageSize)))==null?void 0:a[o%this.pageSize]);return i?[i]:[]})}ensure(t,n){var i;if(n<=t)return;const r=Math.floor(t/this.pageSize),o=Math.floor((n-1)/this.pageSize);this.focus={first:r,last:o};for(let a=r;a<=o;a++)((i=this.pages.get(a))==null?void 0:i.generation)!==this.generation&&this.inFlight.get(a)!==this.generation&&this.load(a)}patch(t){const n=new Map(t.map(o=>[o.rowId,o])),r=this.generation++;for(const[o,i]of this.pages){let a;i.rows.forEach((s,l)=>{const u=n.get(s.id);u&&(a??(a=[...i.rows]),a[l]=Su(s,u))}),a?this.pages.set(o,{rows:a,generation:this.generation}):i.generation===r&&this.pages.set(o,{...i,generation:this.generation})}}invalidate(){this.generation++}evict(){if(this.pages.size<=this.maxPages)return;const{first:t,last:n}=this.focus,r=i=>i<t?t-i:i>n?i-n:0,o=[...this.pages.keys()].sort((i,a)=>r(a)-r(i));for(const i of o.slice(0,this.pages.size-this.maxPages))r(i)>0&&this.pages.delete(i)}load(t){const n=this.generation;this.inFlight.set(t,n);const r=t*this.pageSize;this.fetchRows(r,this.pageSize).then(o=>{this.inFlight.get(t)===n&&this.inFlight.delete(t);const i=this.pages.get(t);i&&i.generation>n||(this.pages.set(t,{rows:o,generation:n}),this.evict(),this.onLoad(r,r+o.length))},o=>{this.inFlight.get(t)===n&&this.inFlight.delete(t),this.onError(o instanceof Error?o:new Error(String(o)))})}}const Ru={expanded:new Set,widths:{}};function OS(e,t){return`dataset-layout:${e}:${t}`}function jS(e){if(typeof e!="object"||e===null)return Ru;const{expanded:t,widths:n}=e,r={};if(typeof n=="object"&&n!==null)for(const[o,i]of Object.entries(n))typeof i=="number"&&Number.isFinite(i)&&i>0&&(r[o]=i);return{expanded:new Set(Array.isArray(t)?t.filter(o=>typeof o=="string"):[]),widths:r}}function NS(e,t){const n=new Set(e.expanded);n.delete(t);const r=Object.fromEntries(Object.entries(e.widths).filter(([o])=>o!==t&&!o.startsWith(`${t}/`)));return{expanded:n,widths:r}}function HS(e){return JSON.stringify({expanded:[...e.expanded],widths:e.widths})}const Ul=e=>e.key===void 0?`${e.index}`:`${e.index}/${e.key}`;function BS({layout:e,fields:t,instances:n,rowLabel:r,onChange:o,onRowLabel:i,onAdd:a,onRemove:s,describePath:l,newField:u,onFieldAdded:d}){const[h,p]=c.useState(!1),[b,m]=c.useState(!1),[y,x]=c.useState(null),[C,w]=c.useState(null),[I,W]=c.useState(new Set),B=()=>{p(!1),m(!1)},{triggerRef:$,popoverRef:L,style:V}=ei({open:h,onClose:B,matchTriggerWidth:!1}),R=y??e,A=r&&Tn(r),H=G=>{var Z;return((Z=t.find(he=>he.id===G))==null?void 0:Z.def.name)??G},j=G=>{if(!C||!y)return!1;if(C.key===void 0&&G.key===void 0)return G.index!==C.index&&(x(dS(y,C.index,G.index)),w({index:G.index})),!0;const Z=y[C.index];if(C.key===void 0||G.key===void 0||G.index!==C.index||(Z==null?void 0:Z.kind)!=="field")return!1;if(G.key!==C.key){const he=Z.keys.findIndex(te=>te.key===C.key),de=Z.keys.findIndex(te=>te.key===G.key);x(fS(y,C.index,he,de))}return!0},F=()=>{y&&y!==e&&o(y),x(null),w(null)},T=({slot:G,title:Z,detail:he,hidden:de,removable:te,disclosure:q,dim:ve})=>{const ie=Ul(G),re=mu(R,G),Te=!!re&&Tn(re)===A;return v.jsxs("div",{className:`trace-column-picker-row dataset-column-picker-row${G.key!==void 0?" dataset-column-picker-key":""}${C&&Ul(C)===ie?" trace-column-picker-row-dragging":""}${ve?" dataset-column-picker-dim":""}`,onDragOver:J=>{j(G)&&J.preventDefault()},onDrop:J=>J.preventDefault(),children:[v.jsx("span",{className:"trace-column-picker-grab",draggable:!0,onDragStart:J=>{J.dataTransfer.effectAllowed="move",J.dataTransfer.setData("text/plain",ie),x(e),w(G)},onDragEnd:F,title:"Drag to reorder",children:v.jsx(gd,{})}),q?v.jsx("button",{type:"button",className:"dataset-column-picker-disclosure","aria-label":`${q.open?"Hide":"Show"} ${Z}'s keys`,"aria-expanded":q.open,onClick:q.toggle,children:q.open?"▾":"▸"}):G.key===void 0&&v.jsx("span",{className:"dataset-column-picker-disclosure"}),v.jsxs("label",{className:"trace-column-picker-check",children:[v.jsx("input",{type:"checkbox","aria-label":`Show ${Z}`,checked:!de,onChange:()=>o(Bi(e,G,!de))}),v.jsx("span",{className:"dataset-column-picker-title",children:Z}),he&&v.jsx("span",{className:"dataset-column-picker-detail",children:he})]}),re&&v.jsxs("span",{className:"dataset-column-picker-actions",children:[te&&v.jsx("button",{type:"button",className:"dataset-column-picker-icon-btn","aria-label":`Remove column ${Z}`,title:"Remove column",onClick:()=>s(G.index),children:"✕"}),v.jsx("button",{type:"button",className:`dataset-column-picker-icon-btn${Te?" dataset-column-picker-icon-btn-on":""}`,"aria-label":`Use ${Z} as row label`,"aria-pressed":Te,title:Te?"Don't use as row label":"Use as row label",onClick:()=>i(Te?void 0:re),children:v.jsx(md,{filled:Te})})]})]},ie)},fe=(G,Z)=>{const he={index:Z};switch(G.kind){case"field":{const de=I.has(G.fieldId),te=T({slot:he,title:H(G.fieldId),hidden:G.hidden,...G.keys.length>0&&{disclosure:{open:de,toggle:()=>{const q=new Set(I);q.delete(G.fieldId)||q.add(G.fieldId),W(q)}}}});return de?[te,...G.keys.map(q=>T({slot:{index:Z,key:q.key},title:q.key,hidden:q.hidden}))]:te}case"added":return T({slot:he,title:G.title??vu(G.path,t),detail:yS(G.path,t),hidden:G.hidden,removable:!0});case"source":return T({slot:he,title:"source",hidden:G.hidden});case"unknown":return T({slot:he,title:"Unknown column",detail:G.spec.kind,hidden:G.hidden,dim:!0})}};return v.jsxs(v.Fragment,{children:[v.jsxs("button",{ref:$,type:"button",className:`trace-view-prompt-btn${h?" dataset-columns-btn-active":""}`,title:"Show, hide, reorder and add columns","aria-label":"Columns","aria-expanded":h,onClick:()=>h?B():p(!0),children:[v.jsx(hd,{}),"Columns",v.jsx(tc,{})]}),h&&ho.createPortal(v.jsx("div",{className:"trace-column-picker dataset-column-picker",ref:L,style:V,role:"dialog","aria-label":"Columns",children:b?v.jsx(hu,{fields:t,instances:n,describePath:l,onPick:G=>{a(G),m(!1)},newField:u,onFieldAdded:()=>{d(),m(!1)},onBack:()=>m(!1)}):v.jsxs(v.Fragment,{children:[R.flatMap((G,Z)=>fe(G,Z)),v.jsx("button",{type:"button",className:"trace-header-menu-item dataset-column-picker-add",onClick:()=>m(!0),children:v.jsx("span",{className:"trace-header-menu-item-label",children:"Add column…"})})]})}),document.body)]})}function LS(e){var r;const t=new Map,n=(o,i)=>{for(const a of o){const s=i==null?void 0:i[a.path];if(!(s!=null&&s.length))continue;const l=t.get(a.type.syntax)??[];t.set(a.type.syntax,[...new Set([...l,...s])])}};for(const{functionParameters:o,executeParameters:i,inputSources:a}of e)if(a){n(Mi(o),a.functionSlots),n(Mi(i??[]),a.executeSlots);for(const s of a.resources)s.parameters&&n(Mi(s.parameters),(r=a.resourceSlots)==null?void 0:r[s.uri])}return t}function zS(e,t,n=[]){const r=[...t?[t]:[],...n.filter(u=>!Zl(u,t)&&(!(t!=null&&t.providerId)||u.providerId===t.providerId))].filter(u=>u.inputSources);if(r.length===0)return;const o=t!=null&&t.inputSources?[{defs:t.functionParameters,slots:t.inputSources.functionSlots},{defs:t.executeParameters??[],slots:t.inputSources.executeSlots}]:[],i=LS(r),a={};for(const u of e){const d=Ia(u.def),h=o.find(m=>m.defs.some(y=>Ia(y)===d)),p=u.def.name,b=h?Object.fromEntries(Object.entries(h.slots).filter(([m])=>m===p||m.startsWith(`${p}.`))):{};for(const m of Mi([u.def])){const y=i.get(m.type.syntax);y&&(b[m.path]=[...new Set([...b[m.path]??[],...y])])}Object.keys(b).length>0&&(a[u.id]=b)}const s=new Map,l={};for(const{inputSources:u}of r){for(const d of(u==null?void 0:u.resources)??[])s.has(d.uri)||s.set(d.uri,d);for(const[d,h]of Object.entries((u==null?void 0:u.resourceSlots)??{}))l[d]??(l[d]=h)}return{resources:[...s.values()],fieldSlots:a,resourceSlots:l}}function ks(e){const t={};for(const[n,r]of Object.entries(e.cells))t[n]=pd(r);return{selections:t,instances:bd(e.resources)}}function WS(e,t,n){const r={};for(const s of e){const l=yd(t.selections[s]),u=(l==null?void 0:l.kind)==="value"?ec(l.value):l??null;Uo(u)!==Uo(n.cells[s]??null)&&(r[s]=u)}const o=n.resources??{},i=vd(t.instances)??{},a={};for(const s of new Set([...Object.keys(o),...Object.keys(i)])){const l=i[s]??null,{receipt:u,...d}=o[s]??{uri:""};Uo(l)!==Uo(o[s]?d:null)&&(a[s]=l)}return{cells:r,...Object.keys(a).length>0&&{resources:a}}}function GS(e){const t=Object.fromEntries(Object.entries(e.resources??{}).map(([n,{receipt:r,...o}])=>[n,structuredClone(o)]));return{cells:structuredClone(e.cells),...Object.keys(t).length>0&&{resources:t}}}function US(e){return Object.keys(e.cells).length>0||Object.keys(e.resources??{}).length>0}function Xl(e){const t=n=>Object.fromEntries(Object.entries(n).flatMap(([r,o])=>o.resources&&Object.keys(o.resources).length>0?[[r,o.resources]]:[]));return Uo([t(e.selections),Object.entries(e.instances).map(([n,r])=>[n,r.uri,t(r.args)])])}function Uo(e){return JSON.stringify(e,(t,n)=>n&&typeof n=="object"&&!Array.isArray(n)?Object.fromEntries(Object.entries(n).sort(([r],[o])=>r<o?-1:r>o?1:0)):n)}function XS({value:e}){return e.kind==="primitive"&&typeof e.value=="string"||e.kind==="template"?v.jsx("div",{className:"dataset-detail-text",children:qo(e)}):e.kind==="object"||e.kind==="array"||e.kind==="tuple"?v.jsx(Dd,{data:qo(e)}):v.jsx("code",{className:"dataset-detail-scalar",children:String(qo(e))})}function Mu({inputs:e}){return v.jsx("div",{className:"dataset-detail-keys",children:Object.entries(e).map(([t,n])=>v.jsxs("div",{className:"dataset-detail-key-row",children:[v.jsx("span",{className:"dataset-detail-key",children:t}),v.jsx(Iu,{input:n})]},t))})}function Iu({input:e}){switch(e.kind){case"value":return v.jsx(XS,{value:e.value});case"object":return v.jsx(Mu,{inputs:e.properties});case"instance":return v.jsxs("span",{className:"dataset-cell-chip",children:[v.jsx("span",{className:"dataset-cell-chip-icon","aria-hidden":!0,children:"◆"}),Yn(e)]});case"dataset":case"input":return v.jsx("code",{className:"dataset-detail-scalar",children:Yn(e)});default:return v.jsx("span",{className:"dataset-detail-scalar",children:Yn(e)})}}const KS=[];function YS({row:e}){const t=Object.entries(e.resources??{});return t.length===0?null:v.jsx(Ms,{label:v.jsx("span",{className:"dataset-detail-field",children:"Resources"}),children:v.jsx("div",{className:"dataset-detail-keys",children:t.map(([n,r])=>v.jsxs("div",{className:"dataset-detail-key-row",children:[v.jsxs("span",{className:"dataset-detail-key",children:["◆ ",n]}),v.jsxs("div",{className:"dataset-detail-resource",children:[v.jsx("span",{className:"dataset-cell-chip",title:r.uri,children:rS(r.uri)}),r.args&&Object.keys(r.args).length>0&&v.jsx(Mu,{inputs:r.args})]})]},n))})})}function qS({fields:e,row:t,sources:n,onChangeRow:r}){const o=(n==null?void 0:n.resources)??KS,i=c.useMemo(()=>new Map(o.map(R=>[R.uri,R])),[o]),[a,s]=c.useState(()=>ks(t)),l=c.useRef(a),[u,d]=c.useState(!1),[h,p]=c.useState(t);if(h!==t&&(p(t),!u)){const R=ks(t);l.current=R,s(R)}const b=R=>{const A=t.cells[R.id];return!!r&&(!!n||!A||A.kind==="value")},m=e.filter(b).map(R=>R.id),y=R=>{d(!1);const A=WS(m,n?R:{...R,instances:ks(t).instances},t);US(A)&&(r==null||r(A))},x=R=>{const A=l.current,H=typeof R=="function"?R(A):R;l.current=H,s(H),Xl(H)!==Xl(A)?y(H):d(!0)},C=()=>{u&&y(l.current)},w=R=>{R.key!=="Enter"||R.shiftKey||R.defaultPrevented||R.nativeEvent.isComposing||(R.preventDefault(),C())},I=c.useRef(C);I.current=C,c.useEffect(()=>()=>I.current(),[]);const{instances:W}=a,B=c.useMemo(()=>({resources:kd(o,W),functionSlots:{},executeSlots:{},resourceSlots:Object.fromEntries(Object.entries((n==null?void 0:n.resourceSlots)??{}).map(([R,A])=>[R,Ea(A,o,W)]))}),[o,W,n]),$=(R,A)=>x(H=>{const j=typeof R=="function"?R(H.instances):R;if(!A)return{...H,instances:j};const[F,T]=A.kind==="rename"?[A.from,A.to]:[A.name,null];return{instances:j,selections:Td(H.selections,F,T)}}),L=Id({instances:W,catalogByUri:i,adopt:R=>{const A=Ed(l.current.instances,R,i),j={...l.current,instances:A.instances};return l.current=j,s(j),d(!0),A.uri}}),V=!!r&&!!n;return v.jsxs(v.Fragment,{children:[e.map(R=>{const A=t.cells[R.id];return v.jsx(Ms,{label:v.jsxs(v.Fragment,{children:[v.jsx("span",{className:"dataset-detail-field",children:R.def.name}),v.jsx("span",{className:"dataset-detail-type",title:R.def.type.syntax,children:Di(R.def.type.syntax,32)})]}),children:v.jsxs("div",{className:"dataset-detail-cell",children:[b(R)?v.jsx("div",{className:"dataset-detail-editor",onBlur:H=>{H.currentTarget.contains(H.relatedTarget)||C()},onKeyDown:w,children:v.jsx(Sd,{propDef:R.def,selection:a.selections[R.id]??{},onChange:H=>x(j=>({...j,selections:{...j.selections,[R.id]:H}})),resources:B.resources,slots:Ea(n==null?void 0:n.fieldSlots[R.id],o,W),context:n&&L})}):A?v.jsx(Iu,{input:A}):v.jsx("span",{className:"dataset-cell-empty",children:"—"}),r&&A&&v.jsx("button",{type:"button",className:"dataset-detail-clear",title:`Clear ${R.def.name}`,"aria-label":`Clear ${R.def.name}`,onClick:()=>r({cells:{[R.id]:null}}),children:"×"})]})},R.id)}),V?v.jsx(Ms,{label:v.jsx("span",{className:"dataset-detail-field"}),children:v.jsx("div",{className:"dataset-detail-editor",onBlur:R=>{R.currentTarget.contains(R.relatedTarget)||C()},onKeyDown:w,children:v.jsx(Rd,{instances:W,onChange:$,sources:B,catalog:o,referencedBy:R=>Md(R,W,[{selections:Object.fromEntries(e.flatMap(A=>a.selections[A.id]?[[A.def.name,a.selections[A.id]]]:[]))}]),context:L})})}):v.jsx(YS,{row:t})]})}function VS({dataset:e,row:t,onOpenTrace:n,onChangeRow:r,sources:o}){const i=[{label:"Added",icon:v.jsx(rc,{}),value:nc(t.createdAt)}],{source:a}=t;return a&&i.push({label:"Source",icon:v.jsx(wd,{}),value:a.kind==="trace"?v.jsx("button",{type:"button",className:"dataset-link-btn",onClick:()=>n(a.traceProviderId,a.traceId),title:"Open the trace this row came from",children:"trace ↗"}):"playground"}),v.jsx("div",{className:"span-details",children:v.jsxs("div",{className:"span-details-list",children:[v.jsx(xd,{children:v.jsx(Cd,{facts:i})}),v.jsx(qS,{fields:e.fields,row:t,sources:o,onChangeRow:r},t.id)]})})}function JS(e){const[t,n]=c.useState(!1),r=()=>n(!1),{triggerRef:o,popoverRef:i,style:a}=ei({open:t,onClose:r,matchTriggerWidth:!1});return v.jsxs(v.Fragment,{children:[v.jsxs("button",{type:"button",ref:o,className:"trace-view-prompt-btn dataset-eval-btn",onClick:()=>n(s=>!s),"aria-haspopup":"menu","aria-expanded":t,title:"Run an eval on this dataset, or set up a new one",children:[v.jsx(oc,{size:14}),"Evals",v.jsx(tc,{})]}),t&&ho.createPortal(v.jsx("div",{className:"trace-header-menu",ref:i,style:a,role:"menu",children:v.jsx(Eu,{...e,onChosen:r})}),document.body)]})}function Eu({evals:e,selectedRows:t,onRun:n,onNewEval:r,onChosen:o}){const i=t>0?` on ${t} row${t===1?"":"s"}`:"";return v.jsxs(v.Fragment,{children:[e.map(a=>v.jsxs("button",{type:"button",role:"menuitem",className:"trace-header-menu-item",onClick:()=>{o(),n(a)},children:[v.jsx("span",{className:"trace-header-menu-item-icon",children:"▶"}),v.jsxs("span",{className:"trace-header-menu-item-label",children:["Run ",a.name,i]})]},`${a.providerId}/${a.id}`)),r&&v.jsxs(v.Fragment,{children:[e.length>0&&v.jsx("hr",{className:"ask-agent-menu-divider"}),v.jsxs("button",{type:"button",role:"menuitem",className:"trace-header-menu-item",onClick:()=>{o(),r()},children:[v.jsx("span",{className:"trace-header-menu-item-icon",children:v.jsx(oc,{size:14})}),v.jsx("span",{className:"trace-header-menu-item-label",children:"New eval…"})]})]})]})}const jr=30;function QS({rowCount:e,getRow:t,ensure:n,label:r,selected:o,onSelect:i}){const a=c.useRef(null),[s,l]=c.useState({start:0,end:40}),u=()=>{const h=a.current;if(!h)return;const p=Math.floor(h.scrollTop/jr),b=p+Math.ceil(h.clientHeight/jr)+1;l(m=>m.start===p&&m.end===b?m:{start:p,end:b})};c.useEffect(u,[]),c.useEffect(()=>{n(s.start,Math.min(s.end,e))},[n,s,e]),c.useEffect(()=>{const h=a.current;if(!h||o===null)return;const p=o*jr;p<h.scrollTop?h.scrollTop=p:p+jr>h.scrollTop+h.clientHeight&&(h.scrollTop=p+jr-h.clientHeight)},[o]);const d=[];for(let h=s.start;h<Math.min(s.end,e);h++){const p=t(h),b=p?r(p):void 0;d.push(v.jsxs("div",{role:"option",tabIndex:-1,"aria-selected":h===o,className:`dataset-row-list-item${h===o?" dataset-row-list-item-selected":""}`,style:{top:h*jr},onClick:()=>i(h),children:[v.jsx("span",{className:"dataset-row-list-number",children:h+1}),v.jsx("span",{className:"dataset-row-list-label",children:p?b??`Row ${h+1}`:"…"})]},h))}return v.jsx("div",{ref:a,className:"dataset-row-list",role:"listbox","aria-label":"Rows",tabIndex:0,onScroll:u,onKeyDown:h=>{if(e===0)return;const p=h.key==="ArrowDown"?1:h.key==="ArrowUp"?-1:0;if(!p)return;h.preventDefault();const b=Math.min(e-1,Math.max(0,(o??-p)+p));b!==o&&i(b)},children:v.jsx("div",{className:"dataset-row-list-inner",style:{height:e*jr},children:d})})}function ZS({viewLabel:e,rowName:t,stale:n,onSave:r,onDiscard:o}){return v.jsxs("div",{className:`row-draft-bar${n?" row-draft-bar-stale":""}`,role:"status",children:[v.jsx("span",{className:"row-draft-bar-text",children:n?`${t} changed since you started editing it in ${e}. Discard and redo the changes.`:`Unsaved changes to ${t} from ${e}`}),v.jsx("button",{type:"button",className:"dialog-btn-cancel",onClick:o,children:"Discard"}),v.jsx("button",{type:"button",className:"dialog-btn-create",onClick:r,disabled:n,children:"Save"})]})}function eR(e,t){const n=e.resources||t.resources?{...e.resources,...t.resources}:void 0;return{rowId:e.rowId,cells:{...e.cells,...t.cells},...n&&{resources:n}}}function tR(e,t,n){return e&&e.rowId===n.rowId?{...e,update:eR(e.update,n)}:{rowId:t.id,base:t,update:n}}function zs(e){return Su(e.base,e.update)}function Kl(e,t){return t!==void 0&&!ca(t,e.base)}function Ti(e){return!!e&&!ca(zs(e),e.base)}function nR(e,t){return(e==null?void 0:e.rowId)===t&&Ti(e)?e.base:void 0}const rR='"Geist Mono", ui-monospace, monospace';function Yl(){const e=getComputedStyle(document.documentElement),t=r=>e.getPropertyValue(r).trim(),n=getComputedStyle(document.body).fontFamily;return{accentColor:t("--link"),accentLight:t("--accent-faint"),textDark:t("--trace-text"),textMedium:t("--trace-text-dim"),textLight:t("--trace-text-dim"),textHeader:t("--trace-text"),textGroupHeader:t("--trace-text-dim"),fgIconHeader:t("--trace-text-dim"),textBubble:t("--pill-text"),bgCell:t("--trace-bg"),bgCellMedium:t("--trace-row-alt"),bgHeader:t("--trace-bg"),bgHeaderHasFocus:t("--trace-row-alt"),bgHeaderHovered:t("--trace-row-hover"),bgGroupHeader:t("--trace-bg"),bgGroupHeaderHovered:t("--trace-row-hover"),bgBubble:t("--pill-hover-bg"),bgBubbleSelected:t("--pill-hover-bg"),borderColor:t("--trace-border"),horizontalBorderColor:t("--trace-border"),linkColor:t("--link"),fontFamily:n,baseFontStyle:"12.5px",headerFontStyle:"600 11.5px",markerFontStyle:"11px",editorFontSize:"12.5px"}}function oR(){const[e,t]=c.useState(Yl);return c.useEffect(()=>$d(()=>t(Yl())),[]),e}const iR=[Tk,Nk,jk,xk,Rk,Ek,Fk];function ql(e){switch(e.kind){case ue.Text:case ue.Number:case ue.Boolean:return{value:e.data};default:return}}const sR={setWindow:()=>{},loadOrGetImage:()=>{},setCallback:()=>{}};function Vl(e){try{const t=localStorage.getItem(e);if(t)return jS(JSON.parse(t))}catch{}return Ru}function aR(e,t){try{localStorage.setItem(e,HS(t))}catch{}}function lR(e){try{localStorage.removeItem(e)}catch{}}const Jl=32,Ss=32,Rs=26,cR=300,uR=[],dR=[],fR=[],Go={columns:it.empty(),rows:it.empty()};function hR(e,t){const n=e.value===void 0&&{themeOverride:{textDark:t.textLight}};switch(e.base){case"boolean":return{kind:ue.Boolean,data:typeof e.value=="boolean"?e.value:null,allowOverlay:!1,readonly:!1};case"number":return{kind:ue.Number,data:typeof e.value=="number"?e.value:void 0,displayData:e.text,allowOverlay:!0,readonly:!1,...n};case"string":return{kind:ue.Text,data:typeof e.value=="string"?e.value:"",displayData:e.text,allowOverlay:!0,readonly:!1,...n}}}function gR(e,t){const n=(r,o={})=>({kind:ue.Text,data:r,displayData:r,allowOverlay:!1,readonly:!0,...o});switch(e.kind){case"loading":return{kind:ue.Loading,allowOverlay:!1};case"edit":return hR(e,t);case"empty":return n("—",{themeOverride:{textDark:t.textLight}});case"n/a":return n("n/a",{themeOverride:{textDark:t.textLight,bgCell:t.bgCellMedium}});case"unknown":return n("",{themeOverride:{textDark:t.textLight,bgCell:t.bgCellMedium}});case"chip":return{kind:ue.Bubble,data:[e.text],allowOverlay:!1};case"text":return n(e.text,{...e.tone==="dim"&&{themeOverride:{textDark:t.textMedium}},...e.tone==="link"&&{themeOverride:{textDark:t.linkColor},cursor:"pointer"}})}}function mR({providerId:e,datasetId:t,version:n,findPrompt:r,prompts:o=uR,onOpenPrompt:i,onOpenInPlayground:a,onOpenTrace:s,onDeleted:l,onNewEval:u,evals:d=dR,onRunStarted:h,agents:p=fR,onAskAgent:b}){var Zn,Do,z;const[m,y]=c.useState(null),[x,C]=c.useState({rowCount:0,fields:{},instances:{}}),[w,I]=c.useState(null),[W,B]=c.useState(0),[$,L]=c.useState(0),V=c.useRef({count:0}),R=c.useRef(null),A=OS(e,t),[H,j]=c.useState(()=>Vl(A)),{expanded:F,widths:T}=H,fe=c.useCallback(g=>{j(g),aR(A,g)},[A]),G=c.useRef(A);c.useEffect(()=>{G.current!==A&&(G.current=A,j(Vl(A)))},[A]);const[Z,he]=c.useState(Go),de=c.useRef(null),te=`evalution.datasetTab:${e}/${t}`,[q,ve]=c.useState(()=>Ta(te)??"grid"),ie=c.useRef(te);c.useEffect(()=>{ie.current!==te&&(ie.current=te,ve(Ta(te)??"grid"))},[te]);const[re,Te]=c.useState(null),[J,se]=c.useState(),[ge,Be]=c.useState(null),[Ce,st]=c.useState(),at=c.useMemo(()=>new Ad(zl,{selected:null}),[e,t]),[De,_e]=c.useState(!1),[Pe,xt]=c.useState(""),[Ct,ft]=c.useState(!1),oe=c.useCallback(()=>ft(!1),[]),{triggerRef:ye,popoverRef:Ee,style:$e}=ei({open:Ct,onClose:oe,matchTriggerWidth:!1}),[me,Xe]=c.useState(null),Ke=c.useCallback(()=>Xe(null),[]),ze=oR(),ce=c.useRef(null),{ref:xe,isWide:Ye}=Fd(760),le=c.useMemo(()=>new PS((g,k)=>_d(e,t,g,k),()=>L(g=>g+1),g=>I(g.message)),[e,t]),tt=c.useCallback((g,k)=>le.ensure(g,k),[le]),pt=c.useRef({start:0,end:0});c.useEffect(()=>{V.current={count:0},R.current=null},[e,t]),c.useEffect(()=>{let g=!1;return Pd(e,t).then(({dataset:k,rowCount:_,fields:K,instances:Y})=>{if(g)return;y(k),C({rowCount:_+V.current.count,fields:K,instances:Y??{}}),I(R.current),R.current=null,le.invalidate();const{start:ee,end:ke}=pt.current;le.ensure(ee,Math.min(ke,_))}).catch(k=>!g&&I(k.message)),()=>{g=!0}},[e,t,n,W,le]),c.useEffect(()=>{m&&at.setSubject({dataset:m,overview:x})},[at,m,x]);const Re=m!=null&&m.prompt?r(m.prompt):void 0,Le=Od(m&&(!m.prompt||Re)?zS(m.fields,Re,o):void 0),ut=c.useMemo(()=>m?lS(m.columns,m.fields,x.fields):[],[m,x.fields]),Fe=c.useMemo(()=>m?vS({fields:m.fields,layout:ut,expanded:F,shortType:g=>Di(g,24)}):[],[m,ut,F]),bt=m==null?void 0:m.rowLabel,ht=c.useCallback((g,k=bt??null)=>{const _=cS(g);y(K=>{if(!K)return K;const{rowLabel:Y,...ee}=K;return{...ee,columns:_,...k&&{rowLabel:k}}}),jd(e,t,_,k).catch(K=>{I(`Couldn't save the columns: ${K.message}`),B(Y=>Y+1)})},[e,t,bt]),Dt=c.useMemo(()=>kS(Fe),[Fe]),Ot=c.useCallback(g=>SS(g,Dt,F),[Dt,F]),rn=c.useMemo(()=>new Map(Fe.map(g=>[g.id,g])),[Fe]),Kt=c.useMemo(()=>Fe.map(g=>({id:g.id,title:g.title,width:T[g.id]??g.width,hasMenu:!0,...g.group!==void 0&&{group:g.group},...g.role==="unknown"&&{themeOverride:{textHeader:ze.textLight}}})),[Fe,T,ze]),yt=c.useCallback(([g,k])=>gR(_S(le.get(k),Fe[g]),ze),[Fe,le,ze,$]),Dn=c.useCallback(g=>{const k=g.y,_=g.y+g.height;pt.current={start:k,end:_},le.ensure(k,Math.min(_,x.rowCount)),Xe(null)},[le,x.rowCount]),un=c.useCallback((g,k)=>{k();const _=rn.get(g.column.id??"");if(!(_!=null&&_.type))return;const{ctx:K,rect:Y,theme:ee}=g;K.save(),K.beginPath(),K.rect(Y.x,Y.y,Y.width,Y.height),K.clip(),K.font=`${ee.headerFontStyle} ${ee.fontFamily}`,K.textBaseline="middle";const ke=K.measureText(_.title);K.font=`10.5px ${rR}`,K.fillStyle=ee.textLight,K.textBaseline="alphabetic",K.fillText(_.type,Y.x+ee.cellHorizontalPadding+ke.width+6,Y.y+Y.height/2-ke.alphabeticBaseline+.5),K.restore()},[rn]),mt=((Zn=Z.current)==null?void 0:Zn.cell[1])??Z.rows.first()??null,Mt=mt!==null&&mt<x.rowCount?mt:null,We=Mt!==null?le.get(Mt):void 0,Et=c.useRef(null);We&&Mt!==null&&(Et.current={index:Mt,row:We});const Yt=We??(Mt!==null&&((Do=Et.current)==null?void 0:Do.index)===Mt?Et.current.row:void 0),Ve=c.useRef(void 0);c.useEffect(()=>()=>clearTimeout(Ve.current),[]);const Rt=c.useCallback(g=>{if(he(g),clearTimeout(Ve.current),!g.current&&g.rows.length===0)se(k=>k&&void 0);else{if(J!==void 0)return;g.rows.length>0?se(!0):Ve.current=setTimeout(()=>se(k=>k??!0),cR)}},[J]),nt=c.useRef(Ce),_t=c.useCallback(g=>{nt.current=g,st(g)},[]),gt=re!==null&&re<x.rowCount?le.get(re):void 0,zt=()=>{const g=nt.current;return Ti(g)?window.confirm("Discard the unsaved changes to this row?")?(_t(void 0),!0):!1:(g&&_t(void 0),!0)},vn=g=>{g===re||!zt()||Te(g)},vt=g=>{switch(g.name){case"selectRow":vn(g.args.index);return;case"showInstance":{const{name:k}=g.args;if(!gt||!Object.hasOwn(gt.resources??{},k))return`the row has no stored instance ${k}`;se(!0),Be(k);return}case"proposeUpdate":{const{update:k}=g.args;if(!gt||gt.id!==k.rowId)return"the row isn't loaded";const _=nt.current,K=tR((_==null?void 0:_.rowId)===gt.id?_:void 0,gt,k),Y=Kk(zs(K));if(Y.length>0)return`That would leave references to instances the row doesn't declare: ${Y.map(Yk).join("; ")}`;_t(K);return}default:return`no action ${g.name}`}},Wt=Nd({surface:zl,channel:at,activeUri:q.startsWith("view:")?q.slice(5):null,onAction:vt}),Je=Wt.shownUri!==null,je=c.useMemo(()=>Je?[]:Z.rows.toArray().filter(g=>g<x.rowCount),[Je,Z.rows,x.rowCount]);c.useEffect(()=>{ge&&(Hd(ge),Be(null))},[ge]);const wn=((z=Wt.tabs.find(g=>g.uri===Wt.shownUri))==null?void 0:z.label)??Bd(Wt.shownUri??"");c.useEffect(()=>{if(!Je)return;const{rowCount:g}=x;g===0?Te(null):re===null?Te(0):re>=g&&Te(g-1)},[Je,re,x]),c.useEffect(()=>{Je&&re!==null&&le.ensure(re,Math.min(re+1,x.rowCount))},[Je,re,le,x.rowCount]);const or=Je?re:Mt,Gt=Je?gt:Yt,Jt=c.useMemo(()=>Gt&&(Ce==null?void 0:Ce.rowId)===Gt.id?zs(Ce):Gt,[Gt,Ce]),dn=Jt&&bt?Cs(Jt,bt):void 0,Hn=Gt&&nR(Ce,Gt.id);c.useEffect(()=>{at.setContext({selected:Jt&&or!==null?{index:or,row:Jt,...Hn&&{stored:Hn},...dn!==void 0&&{label:dn}}:null})},[at,Jt,or,dn,Hn]);const Sr=g=>{if(!(g===q||!zt())){if(g.startsWith("view:")&&!Je)Te(Mt);else if(g==="grid"&&Je&&re!==null){he({columns:it.empty(),rows:it.fromSingleSelection(re)}),se(_=>_??!0);const k=re;requestAnimationFrame(()=>{var _;return(_=de.current)==null?void 0:_.scrollTo(0,k)})}ve(g),lf(te,g)}},Bn=()=>{const g=nt.current;if(g){if(!gt||gt.id!==g.rowId||Kl(g,gt)){I("This row changed since you started; discard and redo.");return}_t(void 0),Qt([g.update]).then(k=>{!k&&!nt.current&&_t(g)})}},ir=Je&&Ti(Ce)&&(gt==null?void 0:gt.id)===Ce.rowId,sr=!!Ce&&!!gt&>.id===Ce.rowId&&Kl(Ce,gt),ar=g=>{const k=le.get(g);!m||!Re||!k||a(Re,ef(tf(m,k),Re,{type:"dataset",description:`${m.name}, row ${g+1}`,providerId:e,datasetId:t,name:m.name},k.resources))},xn=!!m&&m.fields.length>0,Ln=Fe.some(g=>g.group!==void 0),fn=(Ln?Rs:0)+Ss+(x.rowCount+(xn?1:0))*Jl+1,{ref:ko,matches:Rr}=Ld(c.useCallback(g=>fn>g.height,[fn])),So=c.useMemo(()=>xn?{hint:"New row",sticky:Rr}:void 0,[xn,Rr]),Ro=c.useCallback(()=>{const g=V.current;g.count++,C(_=>({..._,rowCount:_.rowCount+1}));const k=()=>{g.count--,g===V.current&&B(_=>_+1)};return Da(e,t,[{cells:{}}]).then(k,_=>{g===V.current&&(R.current=_.message,I(_.message)),k()}),Promise.resolve("bottom")},[e,t]),Qt=c.useCallback(async g=>{if(g.length===0)return!0;le.patch(g),L(k=>k+1);try{return await zd(e,t,g),!0}catch(k){I(`Couldn't save: ${k.message}`),le.invalidate();const{start:_,end:K}=pt.current;return le.ensure(_,Math.min(K,x.rowCount)),re!==null&&le.ensure(re,re+1),!1}},[le,e,t,x.rowCount,re]),hn=c.useCallback(g=>Qt(DS(g)),[Qt]),Mo=c.useCallback(g=>{const k=[];for(const{location:_,value:K}of g){const Y=ql(K);Y&&k.push({col:_[0],row:_[1],...Y})}return hn(ES(k,Fe,_=>le.get(_))),!0},[Fe,le,hn]),Io=c.useCallback(([g,k],_)=>{var ee;const K=(ee=Zo(le.get(k),Fe[g]))==null?void 0:ee.base,Y=ql(_);return K!==void 0&&!!Y&&Cu(K,Y.value)},[Fe,le]),zn=c.useCallback(async g=>{var _;if(g.length===0)return;const k=g.length===1?`row ${g[0]+1}`:`${g.length} rows`;if(window.confirm(`Delete ${k}?`))try{const K=(await le.rowsAt(g)).map(ee=>ee.id);await Wd(e,t,K),Rt(Go);const Y=(_=nt.current)==null?void 0:_.rowId;Y!==void 0&&K.includes(Y)&&_t(void 0),B(ee=>ee+1)}catch(K){I(K.message)}},[le,e,t,Rt,_t]),Ur=c.useCallback(g=>{const{current:k}=g;return k?hn(TS([k.range,...k.rangeStack],Fe,_=>le.get(_))):g.rows.length>0&&zn(g.rows.toArray()),!1},[Fe,le,hn,zn]),Jn=c.useCallback(([g,k])=>{var Y;const _=Fe[g],K=(Y=le.get(k))==null?void 0:Y.source;(_==null?void 0:_.role)==="source"&&(K==null?void 0:K.kind)==="trace"&&s(K.traceProviderId,K.traceId)},[Fe,le,s]),Eo=c.useCallback(([g,k])=>{Zo(le.get(k),Fe[g])&&clearTimeout(Ve.current)},[Fe,le]),Xr=c.useCallback((g,k)=>{const _=Fe[g],K=_&&"path"in _?Gr(_.path):void 0;if(K===void 0)return;k.preventDefault();const Y=new Set(F);Y.delete(K)||Y.add(K),fe({...H,expanded:Y})},[Fe,F,H,fe]),lr=c.useCallback((g,k)=>{const _=Fe[g];_&&Xe({columnId:_.id,anchor:k})},[Fe]),kt=c.useCallback((g,k)=>xu(Fe,g,k),[Fe]),Ut=c.useCallback((g,k)=>{const _=CS(ut,Fe,g,k);_!==ut&&ht(_)},[ut,Fe,ht]),on=async g=>{try{await g()}catch(k){I(k.message)}};if(w&&!m)return v.jsxs("div",{className:"dataset-view dataset-view-error",children:["Error: ",w]});if(!m)return v.jsx("div",{className:"dataset-view",children:v.jsx("div",{className:"trace-view-loading",children:"Loading dataset…"})});const sn=Re?Gd(m.fields,Re):[],{rowCount:Xt}=x,Wn=()=>on(async()=>{const g=Pe.trim();_e(!1),!(!g||g===m.name)&&y(await nf(e,t,g))}),cr=()=>{xt(m.name),_e(!0)},Cn=me?Fe.find(g=>g.id===me.columnId):void 0,Gn=wS(Cn),Zt=Gn!==void 0?m.fields.find(g=>g.id===Gn):void 0,$n=xS(Cn),Mr=bt&&Tn(bt),Ir=async(g,k)=>{const _=await sf(e,t,g.id,k);y({...m,fields:m.fields.map(K=>K.id===_.id?_:K)}),B(K=>K+1)},Me=g=>{Xe(null),window.confirm(`Delete the field “${g.def.name}” and its values in every row?`)&&on(async()=>{await of(e,t,g.id),fe(NS(H,g.id)),Rt(Go),B(k=>k+1)})},ur=g=>rf(e,t,g),Er=g=>ht(mS(ut,g)),an=()=>B(g=>g+1),Kr={providerId:e,datasetId:t,prompts:o,...m.prompt&&{linked:m.prompt}},gn=()=>{window.confirm(`Delete “${m.name}” and its ${Xt} row${Xt===1?"":"s"}?`)&&on(async()=>{await cf(e,t),lR(A),l()})},Tr=()=>u==null?void 0:u({dataset:{providerId:e,id:t},...(Re==null?void 0:Re.providerId)&&{prompt:{id:Re.id,providerId:Re.providerId}}}),Dr=async()=>(await le.rowsAt(je)).map(g=>g.id),dr=g=>on(async()=>{const k=je.length>0?await Dr():void 0;try{const _=await uf(g.providerId,g.id,{...k&&{rowIds:k}});h==null||h(g,_)}catch(_){throw _ instanceof df?new Error(`Can't run ${g.name}: ${_.problems.join("; ")}`):_}}),Yr=g=>on(async()=>{je.length>0?b==null||b(g,await Dr()):b==null||b(g,Gt&&[Gt.id])}),qr=d.filter(g=>g.dataset.providerId===e&&g.dataset.id===t),mn={evals:qr,selectedRows:je.length,onRun:dr,...u&&{onNewEval:Tr}},kn=qr.length>0||!!u,en=Ct&&ho.createPortal(v.jsxs("div",{className:"trace-header-menu",ref:Ee,style:$e,children:[kn&&v.jsx(Eu,{...mn,onChosen:oe}),b&&v.jsx(Ud,{agents:p.filter(g=>!g.disabledReason),onAsk:g=>{ft(!1),Yr(g)}}),(kn||b)&&v.jsx("hr",{className:"ask-agent-menu-divider"}),v.jsxs("button",{type:"button",className:"trace-header-menu-item dataset-menu-delete",onClick:()=>{ft(!1),gn()},children:[v.jsx("span",{className:"trace-header-menu-item-icon",children:v.jsx(yi,{})}),v.jsx("span",{className:"trace-header-menu-item-label",children:"Delete dataset"})]})]}),document.body),D=J?Je?re:Mt:null,lt=J?Je?gt:Yt:void 0,An=lt&&bt?Cs(lt,bt):void 0,To=g=>on(async()=>{const k=x.rowCount;await Da(e,t,[GS(g)]),B(_=>_+1),Je||(he({columns:it.empty(),rows:it.fromSingleSelection(k)}),requestAnimationFrame(()=>{var _;return(_=de.current)==null?void 0:_.scrollTo(0,k)}))}),Qn=()=>{var k,_;if(se(!J),J||Je||mt!==null)return;const g=Math.min(((k=Et.current)==null?void 0:k.index)??0,Xt-1);he({columns:it.empty(),rows:it.fromSingleSelection(g)}),(_=de.current)==null||_.scrollTo(0,g)},fr=J&&je.length>1?v.jsx($a,{title:v.jsxs("span",{className:"trace-row-name",children:[je.length," rows selected"]}),actions:v.jsx("button",{type:"button",className:"dataset-row-btn dataset-row-delete",title:"Delete rows","aria-label":"Delete rows",onClick:()=>void zn(je),children:v.jsx(yi,{})})}):lt&&D!==null&&v.jsxs(v.Fragment,{children:[v.jsx($a,{title:v.jsxs("span",{className:"trace-row-name",children:["Row ",D+1,v.jsxs("code",{className:"dataset-row-id",children:[" · ",lt.id]})]}),subtitle:An,actions:v.jsxs(v.Fragment,{children:[Re&&v.jsx("button",{type:"button",className:"dataset-row-btn",title:`Open in playground (${Re.name})`,"aria-label":"Open row in playground",onClick:()=>ar(D),children:"▶"}),v.jsx("button",{type:"button",className:"dataset-row-btn",title:"Duplicate row","aria-label":"Duplicate row",onClick:()=>void To(lt),children:v.jsx(Xd,{})}),v.jsx("button",{type:"button",className:"dataset-row-btn dataset-row-delete",title:"Delete row","aria-label":"Delete row",onClick:()=>{window.confirm(`Delete row ${D+1}?`)&&on(async()=>{var g;await af(e,t,lt.id),Je?he(Go):Rt(Go),((g=nt.current)==null?void 0:g.rowId)===lt.id&&_t(void 0),B(k=>k+1)})},children:v.jsx(yi,{})})]})}),Ti(Ce)&&Ce.rowId===lt.id&&v.jsxs("div",{className:"dataset-row-draft-banner",children:[wn," has unsaved changes to this row. Edits here are saved at once, and will leave those changes stale."]}),v.jsx(VS,{dataset:m,row:lt,onOpenTrace:s,onChangeRow:g=>Qt([{rowId:lt.id,...g}]),sources:Le})]});return v.jsxs("div",{className:"dataset-view",children:[v.jsxs("div",{className:"trace-view-header dataset-view-header",children:[v.jsxs("div",{className:"trace-view-header-row",children:[v.jsx("div",{className:"trace-view-title",children:De?v.jsx("form",{className:"dataset-view-rename",onSubmit:g=>{g.preventDefault(),Wn()},children:v.jsx("input",{autoFocus:!0,"aria-label":"Dataset name",value:Pe,onChange:g=>xt(g.target.value),onFocus:g=>g.target.select(),onBlur:()=>_e(!1),onKeyDown:g=>g.key==="Escape"&&_e(!1)})}):v.jsx("span",{className:"trace-view-name",onDoubleClick:cr,title:"Double-click to rename",children:m.name})}),v.jsxs("div",{className:"trace-view-header-actions",children:[v.jsx(BS,{layout:ut,fields:m.fields,instances:x.instances,rowLabel:bt,onChange:g=>ht(g),onRowLabel:g=>ht(ut,g??null),onAdd:Er,onRemove:g=>{const k=mu(ut,{index:g});ht(hS(ut,g),k&&Tn(k)===Mr?null:bt??null)},describePath:ur,newField:Kr,onFieldAdded:an}),v.jsxs("div",{className:"trace-view-header-actions-full",children:[kn&&v.jsx(JS,{...mn}),b&&v.jsx(Kd,{agents:p,onAsk:Yr}),v.jsx("button",{type:"button",className:"trace-view-prompt-btn trace-view-delete-btn",onClick:gn,title:"Delete dataset","aria-label":"Delete dataset",children:v.jsx(yi,{})})]}),v.jsx("button",{type:"button",ref:ye,className:"trace-view-header-menu-trigger",onClick:()=>ft(g=>!g),title:"More actions","aria-label":"More actions",children:v.jsx(Yd,{})})]})]}),v.jsxs("div",{className:"trace-view-meta",children:[v.jsxs("span",{className:"trace-view-meta-item",title:"Last updated",children:[v.jsx(rc,{}),v.jsx("span",{className:"trace-view-date-full",children:nc(m.updatedAt)}),v.jsx("span",{className:"trace-view-date-compact",children:qd(m.updatedAt)})]}),v.jsxs("span",{className:"trace-view-meta-item",title:"Row count",children:[v.jsx(Aa,{}),Xt," row",Xt===1?"":"s"]}),Re&&v.jsxs("button",{type:"button",className:"trace-view-meta-item trace-view-prompt-link",onClick:()=>i(Re),title:"Open the linked prompt",children:[v.jsx(Vd,{}),v.jsx("span",{className:"trace-view-prompt-link-name",children:Re.name}),"↗"]})]})]}),en,me&&Cn&&v.jsx(aS,{...Zt&&{field:Zt},anchor:me.anchor,onRename:async g=>{Zt&&await Ir(Zt,g)},onDelete:()=>Zt&&Me(Zt),onHide:()=>ht(Bi(ut,Cn.slot,!0)),...$n&&{rowLabel:{isLabel:Tn($n)===Mr,toggle:()=>ht(ut,Tn($n)===Mr?null:$n)}},onClose:Ke},Cn.id),ho.createPortal(v.jsx("div",{ref:ce,className:"dataset-grid-portal"}),document.body),w&&v.jsxs("div",{className:"pg-exec-error dataset-view-action-error",children:[w,v.jsx("button",{type:"button",className:"pg-dismiss",onClick:()=>I(null),children:"×"})]}),Re&&sn.length>0&&v.jsxs("div",{className:"dataset-view-stale",children:[sn.length," field",sn.length===1?"":"s"," no longer match"," ",v.jsx("code",{children:Re.name}),"'s parameters:"," ",sn.map((g,k)=>v.jsxs("span",{children:[k>0&&", ",v.jsx("code",{children:g.def.name})]},g.id))]}),v.jsxs("div",{className:"trace-view-body dataset-view-body",ref:xe,children:[v.jsxs("div",{className:"trace-view-main-column",children:[v.jsxs("div",{className:"trace-view-tabs dataset-view-tabs",children:[v.jsxs("div",{className:"trace-view-tab-list",children:[v.jsxs("button",{type:"button",className:`trace-view-tab${Je?"":" trace-view-tab-active"}`,onClick:()=>Sr("grid"),children:[v.jsx(Aa,{}),"Grid"]}),v.jsx(Jd,{tabs:Wt.tabs,active:Wt.shownUri,onSelect:g=>Sr(`view:${g}`)}),v.jsx(Qd,{problems:Wt.problems})]}),v.jsx("button",{type:"button",className:`dataset-pane-toggle${J?" dataset-pane-toggle-active":""}`,onClick:Qn,disabled:Xt===0,title:"Row details","aria-label":"Row details","aria-pressed":!!J,children:v.jsx(Zd,{})})]}),ir&&v.jsx(ZS,{viewLabel:wn,rowName:`Row ${(re??0)+1}`,stale:sr,onSave:Bn,onDiscard:()=>_t(void 0)}),v.jsxs("div",{className:"dataset-view-main",children:[Je&&v.jsx(QS,{rowCount:Xt,getRow:g=>le.get(g),ensure:tt,label:g=>bt?Cs(g,bt):void 0,selected:re,onSelect:vn}),v.jsxs("div",{className:"view-stack",children:[v.jsxs("div",{className:"dataset-grid",ref:ko,style:Je?{display:"none"}:void 0,children:[v.jsx(wk,{ref:de,renderers:iR,imageWindowLoader:sR,headerIcons:pS,getGroupDetails:Ot,width:"100%",height:"100%",theme:ze,columns:Kt,rows:Xt,trailingRowOptions:So,onRowAppended:xn?Ro:void 0,getCellContent:yt,onVisibleRegionChanged:Dn,drawHeader:un,rowMarkers:"both",rowSelect:"multi",rangeSelect:"rect",columnSelect:"none",gridSelection:Z,onGridSelectionChange:Rt,onCellClicked:Jn,onCellActivated:Eo,onGroupHeaderClicked:Xr,onHeaderMenuClick:lr,onColumnProposeMove:kt,onColumnMoved:Ut,onCellsEdited:Mo,validateCell:Io,onDelete:Ur,onPaste:!0,getCellsForSelection:!0,fillHandle:!0,onColumnResize:(g,k)=>g.id&&fe({...H,widths:{...T,[g.id]:k}}),rowHeight:Jl,headerHeight:Ss,groupHeaderHeight:Rs,smoothScrollX:!0,smoothScrollY:!0,portalElementRef:ce,rightElement:v.jsx(iS,{fields:m.fields,instances:x.instances,describePath:ur,onPick:Er,newField:Kr,onFieldAdded:an,top:Ln?Rs:0,height:Ss}),rightElementProps:{sticky:!1,fill:!0}}),v.jsx("div",{className:"dataset-grid-fill",style:{top:fn},children:Xt===0&&!xn&&v.jsx("p",{className:"dataset-grid-empty",children:"No fields yet. Add one with the “+” to start filling this dataset in by hand."})})]}),Je&&Xt===0&&v.jsx("div",{className:"view-frame-message",children:"No rows"}),Wt.layer]})]}),!Ye&&fr&&v.jsx(Fa,{placement:"bottom",label:"Row details",children:fr})]}),Ye&&fr&&v.jsx(Fa,{placement:"side",label:"Row details",children:fr})]})]})}const yR=Object.freeze(Object.defineProperty({__proto__:null,default:mR},Symbol.toStringTag,{value:"Module"}));export{LC as C,yR as D,db as T,ao as a,Jm as b,oo as i,ub as m,Cr as s};
|