@backmatter/studio 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/UiKitPage-CgNMOqfE.js +172 -0
- package/dist/chunks/WorkspaceRoutes-DgRtdie8.js +87297 -0
- package/dist/chunks/abap-Y8Dl9g_6.js +6 -0
- package/dist/chunks/actionscript-3-DQVEcJUW.js +6 -0
- package/dist/chunks/ada-vP6ak0IW.js +6 -0
- package/dist/chunks/andromeeda-BbmzSJq1.js +4 -0
- package/dist/chunks/angular-html-DPB4Rf0C.js +32 -0
- package/dist/chunks/angular-ts-CTOR2ofC.js +21 -0
- package/dist/chunks/apache-BUjz-sD2.js +6 -0
- package/dist/chunks/apex-OyTfjCYK.js +6 -0
- package/dist/chunks/apl-CjNiDgad.js +16 -0
- package/dist/chunks/applescript-BPx7YFFu.js +6 -0
- package/dist/chunks/ara-Z2fSOxSw.js +6 -0
- package/dist/chunks/asciidoc-C1T9ziH6.js +6 -0
- package/dist/chunks/asm-BTWLY5ym.js +6 -0
- package/dist/chunks/astro-CFFExE8Q.js +18 -0
- package/dist/chunks/aurora-x-BwoVEUWZ.js +4 -0
- package/dist/chunks/awk-Fb0P9dkn.js +6 -0
- package/dist/chunks/ayu-dark-DJoqd4M9.js +4 -0
- package/dist/chunks/ayu-light-BzXEJRJ-.js +4 -0
- package/dist/chunks/ayu-mirage-BJ2oZGzi.js +4 -0
- package/dist/chunks/ballerina-oZK-YekG.js +6 -0
- package/dist/chunks/bat-0FvbqU9S.js +6 -0
- package/dist/chunks/beancount-DqJEb89h.js +6 -0
- package/dist/chunks/berry-DODBq_Ff.js +6 -0
- package/dist/chunks/bibtex-EULQRLY5.js +6 -0
- package/dist/chunks/bicep-BorU73w0.js +6 -0
- package/dist/chunks/bird2-CIjBSNj3.js +6 -0
- package/dist/chunks/blade-D0HyNvCw.js +20 -0
- package/dist/chunks/bsl-NkNNwerW.js +8 -0
- package/dist/chunks/c-eeMepfLm.js +6 -0
- package/dist/chunks/c3-BY5XW5ym.js +6 -0
- package/dist/chunks/cadence-02UX7mW8.js +6 -0
- package/dist/chunks/cairo-DM6WF2e3.js +8 -0
- package/dist/chunks/catppuccin-frappe-D3cH2rXe.js +4 -0
- package/dist/chunks/catppuccin-latte-C0LRGUW4.js +4 -0
- package/dist/chunks/catppuccin-macchiato-c5wQ11TT.js +4 -0
- package/dist/chunks/catppuccin-mocha-WMD6Qvya.js +4 -0
- package/dist/chunks/clarity-PKm5CwqM.js +6 -0
- package/dist/chunks/clojure-CXJfHrL3.js +6 -0
- package/dist/chunks/cmake-BJz8BOTU.js +6 -0
- package/dist/chunks/cobol-HihOMwht.js +10 -0
- package/dist/chunks/codeowners-Bt9yU6NX.js +6 -0
- package/dist/chunks/codeql-DHkodjjI.js +6 -0
- package/dist/chunks/coffee-DGBR_nr_.js +8 -0
- package/dist/chunks/common-lisp-EVqT9Zhp.js +6 -0
- package/dist/chunks/coq-B0L9upzn.js +6 -0
- package/dist/chunks/cpp-Cj177cuW.js +18 -0
- package/dist/chunks/crystal-CRJyc4G-.js +18 -0
- package/dist/chunks/csharp-CCgA4A09.js +6 -0
- package/dist/chunks/css-CECN5uSL.js +6 -0
- package/dist/chunks/csv-CmYOceLb.js +6 -0
- package/dist/chunks/cue-ZzumE7IT.js +6 -0
- package/dist/chunks/cypher-jpdmjtA6.js +6 -0
- package/dist/chunks/d-CBagWSwH.js +6 -0
- package/dist/chunks/dark-plus-pUHDTVV0.js +4 -0
- package/dist/chunks/dart-6ObCrKr9.js +6 -0
- package/dist/chunks/dashboard-XKKZuJGm.js +1736 -0
- package/dist/chunks/dax-CcDT-8dH.js +6 -0
- package/dist/chunks/define-studio-BYtYDGLX.js +33 -0
- package/dist/chunks/desktop-B93p9R9O.js +6 -0
- package/dist/chunks/diff-BxzP2J8R.js +6 -0
- package/dist/chunks/docker-CsHqm9tx.js +6 -0
- package/dist/chunks/dotenv-BMjVjUL1.js +6 -0
- package/dist/chunks/dracula-BtZx2Kac.js +4 -0
- package/dist/chunks/dracula-soft-BKa-aqBv.js +4 -0
- package/dist/chunks/dream-maker-PAx17jaB.js +6 -0
- package/dist/chunks/edge-BYQkOzbF.js +12 -0
- package/dist/chunks/elixir-Dh036GMp.js +8 -0
- package/dist/chunks/elm-BtNbw_Cd.js +8 -0
- package/dist/chunks/emacs-lisp-Cfxdx5D-.js +6 -0
- package/dist/chunks/erb-ScVOXVpH.js +10 -0
- package/dist/chunks/erlang-DNcDT8Hi.js +8 -0
- package/dist/chunks/everforest-dark-DMCBqXCK.js +4 -0
- package/dist/chunks/everforest-light-BbXl82Em.js +4 -0
- package/dist/chunks/fennel-N4WcXuKx.js +6 -0
- package/dist/chunks/fish-BTDEUgqH.js +6 -0
- package/dist/chunks/fluent-BMXUxfv1.js +6 -0
- package/dist/chunks/fortran-fixed-form-B67KFkXH.js +8 -0
- package/dist/chunks/fortran-free-form-CwqYvCLJ.js +6 -0
- package/dist/chunks/fsharp-CYOiIVNx.js +8 -0
- package/dist/chunks/gdresource-CvCIUjhi.js +10 -0
- package/dist/chunks/gdscript-DSAxJ_aS.js +6 -0
- package/dist/chunks/gdshader-Bk8fF6yr.js +6 -0
- package/dist/chunks/genie-DzUvd7U9.js +6 -0
- package/dist/chunks/gherkin-DHRaV0YP.js +6 -0
- package/dist/chunks/git-commit-Bd32YZ0K.js +8 -0
- package/dist/chunks/git-rebase-ZWUFO_T4.js +8 -0
- package/dist/chunks/github-dark-DenFmJkN.js +4 -0
- package/dist/chunks/github-dark-default-BJPUVz4H.js +4 -0
- package/dist/chunks/github-dark-dimmed-DUshB20C.js +4 -0
- package/dist/chunks/github-dark-high-contrast-D3aGCnF8.js +4 -0
- package/dist/chunks/github-light-JYsPkUQd.js +4 -0
- package/dist/chunks/github-light-default-D99KPAby.js +4 -0
- package/dist/chunks/github-light-high-contrast-BbmZE-Mp.js +4 -0
- package/dist/chunks/gleam-Bv284lvN.js +6 -0
- package/dist/chunks/glimmer-js-DkxNrfPT.js +14 -0
- package/dist/chunks/glimmer-ts-D6YZEmK_.js +14 -0
- package/dist/chunks/glsl-CkUcVZNK.js +8 -0
- package/dist/chunks/gn-XtJxiLa4.js +6 -0
- package/dist/chunks/gnuplot-yPG9-sE_.js +6 -0
- package/dist/chunks/go-CvFNMTvu.js +6 -0
- package/dist/chunks/graphql-CBu2ehBn.js +14 -0
- package/dist/chunks/groovy-CJQTphOW.js +6 -0
- package/dist/chunks/gruvbox-dark-hard-C5HOtKIh.js +4 -0
- package/dist/chunks/gruvbox-dark-medium-FVgwJHuz.js +4 -0
- package/dist/chunks/gruvbox-dark-soft-B46F314v.js +4 -0
- package/dist/chunks/gruvbox-light-hard-CJD38wDZ.js +4 -0
- package/dist/chunks/gruvbox-light-medium-BlIhMYTA.js +4 -0
- package/dist/chunks/gruvbox-light-soft-DoPHyLVZ.js +4 -0
- package/dist/chunks/hack-ItRNKiEb.js +10 -0
- package/dist/chunks/haml-NZLVzu_R.js +10 -0
- package/dist/chunks/handlebars-mxStpSE7.js +14 -0
- package/dist/chunks/haskell-WeIwNIP6.js +6 -0
- package/dist/chunks/haxe-TztHsm5T.js +6 -0
- package/dist/chunks/hcl-D438OF-I.js +6 -0
- package/dist/chunks/hjson-DYBUbqOl.js +6 -0
- package/dist/chunks/hlsl-Bk8TCZNL.js +6 -0
- package/dist/chunks/horizon-CJQ10nlf.js +4 -0
- package/dist/chunks/horizon-bright-CdkBZOMB.js +4 -0
- package/dist/chunks/houston-BDYrDoDW.js +4 -0
- package/dist/chunks/html-B50bmoVb.js +10 -0
- package/dist/chunks/html-derivative-C6bxFbFW.js +8 -0
- package/dist/chunks/http-DLvAkeD-.js +14 -0
- package/dist/chunks/hurl-CgkFN90t.js +12 -0
- package/dist/chunks/hxml-GbqSQCLa.js +8 -0
- package/dist/chunks/hy-Brt5EZ7-.js +6 -0
- package/dist/chunks/imba-CimUv-Uh.js +6 -0
- package/dist/chunks/index-CFAIR8GH.js +18924 -0
- package/dist/chunks/ini-BZIuRIvJ.js +6 -0
- package/dist/chunks/java-DY6VlHhP.js +6 -0
- package/dist/chunks/javascript-C25yR2R2.js +6 -0
- package/dist/chunks/jinja-CFW5uAwY.js +11 -0
- package/dist/chunks/jison-DdreslRX.js +8 -0
- package/dist/chunks/json-DxJze_jm.js +6 -0
- package/dist/chunks/json5-BT4Fjg39.js +6 -0
- package/dist/chunks/jsonc-CHjZD8gR.js +6 -0
- package/dist/chunks/jsonl-BGuvDmy9.js +6 -0
- package/dist/chunks/jsonnet-Bx2cfsXg.js +6 -0
- package/dist/chunks/jssm-BcADi6EI.js +6 -0
- package/dist/chunks/jsx-BtKADgXT.js +6 -0
- package/dist/chunks/julia-CZiKXNNP.js +16 -0
- package/dist/chunks/just-CEK2SJ_k.js +18 -0
- package/dist/chunks/kanagawa-dragon-CiKur4Hl.js +4 -0
- package/dist/chunks/kanagawa-lotus-BKu-smKu.js +4 -0
- package/dist/chunks/kanagawa-wave-CQwozSzG.js +4 -0
- package/dist/chunks/kdl-BNOv9TC3.js +6 -0
- package/dist/chunks/kotlin-ByBMgTeR.js +6 -0
- package/dist/chunks/kusto-DH_XitHS.js +6 -0
- package/dist/chunks/laserwave-6a00oqik.js +4 -0
- package/dist/chunks/latex-B8Egmqc5.js +8 -0
- package/dist/chunks/lean-BnVxaZxY.js +6 -0
- package/dist/chunks/less-B1GLI2Di.js +6 -0
- package/dist/chunks/light-plus-CZuVqSLX.js +4 -0
- package/dist/chunks/liquid-CHzkx3jT.js +14 -0
- package/dist/chunks/llvm-Bk2XctFf.js +6 -0
- package/dist/chunks/log-Al8wyEFV.js +6 -0
- package/dist/chunks/logo-DBa4JDzV.js +6 -0
- package/dist/chunks/lua-Bp3IRv7I.js +8 -0
- package/dist/chunks/luau-UQyhudEE.js +6 -0
- package/dist/chunks/make-CsMclxtr.js +6 -0
- package/dist/chunks/markdown-CrScaQ96.js +6 -0
- package/dist/chunks/marko-CJBA24Ri.js +14 -0
- package/dist/chunks/material-theme-D6KBX41T.js +4 -0
- package/dist/chunks/material-theme-darker-CkRroheE.js +4 -0
- package/dist/chunks/material-theme-lighter-BUBw43Yz.js +4 -0
- package/dist/chunks/material-theme-ocean-ClGX14Ja.js +4 -0
- package/dist/chunks/material-theme-palenight-C1RVm8K1.js +4 -0
- package/dist/chunks/matlab-BOAaUVP0.js +6 -0
- package/dist/chunks/mdc-C9YSUwVC.js +12 -0
- package/dist/chunks/mdx-BOhZZUJ8.js +6 -0
- package/dist/chunks/mermaid-C3rz4dYh.js +6 -0
- package/dist/chunks/min-dark-C7ak0t6c.js +4 -0
- package/dist/chunks/min-light-CKFxVcPp.js +4 -0
- package/dist/chunks/mipsasm-CTx18fBl.js +6 -0
- package/dist/chunks/mojo-EIZIZRTQ.js +6 -0
- package/dist/chunks/monokai-C1KBYcO0.js +4 -0
- package/dist/chunks/moonbit-B1TV0fG3.js +6 -0
- package/dist/chunks/move-Db4ltDq1.js +6 -0
- package/dist/chunks/narrat-DmhDCBs-.js +6 -0
- package/dist/chunks/nextflow-47kAzSl1.js +8 -0
- package/dist/chunks/nextflow-groovy-Drz_2V0j.js +6 -0
- package/dist/chunks/nginx-D7O4WoB1.js +8 -0
- package/dist/chunks/night-owl-Bm2rzalh.js +4 -0
- package/dist/chunks/night-owl-light-CBI5u5kw.js +4 -0
- package/dist/chunks/nim-QAjRdh9w.js +20 -0
- package/dist/chunks/nix-fTRXMGic.js +9 -0
- package/dist/chunks/nord-CC5OiUXg.js +4 -0
- package/dist/chunks/nushell-BGCPRlV5.js +6 -0
- package/dist/chunks/objective-c-Itk8tzmv.js +6 -0
- package/dist/chunks/objective-cpp-DGt5UKRO.js +6 -0
- package/dist/chunks/ocaml-eSVK32Eg.js +6 -0
- package/dist/chunks/odin-BItnF517.js +6 -0
- package/dist/chunks/one-dark-pro-DTA3VF0_.js +4 -0
- package/dist/chunks/one-light-LkMrt1Cf.js +4 -0
- package/dist/chunks/openscad-Sp5uZ6f2.js +6 -0
- package/dist/chunks/pascal-xy8pJNns.js +6 -0
- package/dist/chunks/perl-DkVrgJBg.js +16 -0
- package/dist/chunks/php-BIzsF_5x.js +18 -0
- package/dist/chunks/pkl-C-zSNmaA.js +6 -0
- package/dist/chunks/plastic-CSTz3KZp.js +4 -0
- package/dist/chunks/plsql-pVbGZfOv.js +6 -0
- package/dist/chunks/po-BNfHvqmm.js +6 -0
- package/dist/chunks/poimandres-C-VADXHD.js +4 -0
- package/dist/chunks/polar-CAZahv3u.js +6 -0
- package/dist/chunks/postcss-05aHdL-n.js +6 -0
- package/dist/chunks/powerquery-DI9HkTvs.js +6 -0
- package/dist/chunks/powershell-Clc4ydu-.js +6 -0
- package/dist/chunks/prisma-FZjmVtSl.js +6 -0
- package/dist/chunks/prolog-C5-yg4TO.js +6 -0
- package/dist/chunks/proto-C7QgialS.js +6 -0
- package/dist/chunks/pug-XOw9Q1Ho.js +12 -0
- package/dist/chunks/puppet-CUJHmnxV.js +6 -0
- package/dist/chunks/purescript-rUfGld-4.js +6 -0
- package/dist/chunks/python-BFNSHbwJ.js +6 -0
- package/dist/chunks/qml-rTNXsquU.js +8 -0
- package/dist/chunks/qmldir-BInDYbpo.js +6 -0
- package/dist/chunks/qss-AeJTysr_.js +6 -0
- package/dist/chunks/r-CSmzDPi7.js +6 -0
- package/dist/chunks/racket-B83wSAja.js +6 -0
- package/dist/chunks/raku-nEQ4ZJJ7.js +6 -0
- package/dist/chunks/razor-Ci8D0dQK.js +10 -0
- package/dist/chunks/red-7y8PH7HH.js +4 -0
- package/dist/chunks/reg-m_s_Kiip.js +6 -0
- package/dist/chunks/regexp-BazyLpPg.js +6 -0
- package/dist/chunks/rel-BcRfyd6Q.js +6 -0
- package/dist/chunks/riscv-Ce8MAQLP.js +6 -0
- package/dist/chunks/ron-DCEEQypA.js +6 -0
- package/dist/chunks/rose-pine-BKc3yVeu.js +4 -0
- package/dist/chunks/rose-pine-dawn-BulJcPZT.js +4 -0
- package/dist/chunks/rose-pine-moon-j6jiXKV8.js +4 -0
- package/dist/chunks/rosmsg-Cz0w1km8.js +6 -0
- package/dist/chunks/rst-DM32Wy3O.js +22 -0
- package/dist/chunks/ruby-BeqCs27h.js +30 -0
- package/dist/chunks/rust-CLzF9zIN.js +6 -0
- package/dist/chunks/sas-fpEvgATw.js +8 -0
- package/dist/chunks/sass-DxHp5rTx.js +6 -0
- package/dist/chunks/scala-D4grkFkl.js +6 -0
- package/dist/chunks/scheme-BCRWuEm4.js +6 -0
- package/dist/chunks/scss-B1FaCqwR.js +8 -0
- package/dist/chunks/sdbl-B7T8abf4.js +6 -0
- package/dist/chunks/shaderlab-Cr62-Wb4.js +8 -0
- package/dist/chunks/shellscript-InADTalH.js +6 -0
- package/dist/chunks/shellsession-DiDJNQdy.js +8 -0
- package/dist/chunks/slack-dark-i7wN4OET.js +4 -0
- package/dist/chunks/slack-ochin-ndHf0LoP.js +4 -0
- package/dist/chunks/smalltalk-BlI1_OkM.js +6 -0
- package/dist/chunks/snazzy-light-BlSJXAu4.js +4 -0
- package/dist/chunks/solarized-dark-UTmkh7lw.js +4 -0
- package/dist/chunks/solarized-light-BheCkDPT.js +4 -0
- package/dist/chunks/solidity-DUWnFhS6.js +6 -0
- package/dist/chunks/soy-C1-6njHa.js +8 -0
- package/dist/chunks/sparql-B0KWFEri.js +8 -0
- package/dist/chunks/splunk-CRXR8A9s.js +6 -0
- package/dist/chunks/sql-Cn_v3PB0.js +6 -0
- package/dist/chunks/ssh-config-DP-hNVbF.js +6 -0
- package/dist/chunks/stata-B8c5fTjX.js +8 -0
- package/dist/chunks/stylus-CyKEU1Ej.js +6 -0
- package/dist/chunks/surrealql-CQi7GQN7.js +8 -0
- package/dist/chunks/svelte-rYri41WT.js +14 -0
- package/dist/chunks/swift-DJpUqPLg.js +6 -0
- package/dist/chunks/synthwave-84-NU3C_KFZ.js +4 -0
- package/dist/chunks/system-verilog-BCm7smPJ.js +6 -0
- package/dist/chunks/systemd-C-4qm6XH.js +6 -0
- package/dist/chunks/talonscript-CFF3LF_O.js +6 -0
- package/dist/chunks/tasl-Cg_WBUAe.js +6 -0
- package/dist/chunks/tcl-DN7buRTF.js +6 -0
- package/dist/chunks/templ-Crs9Ui8q.js +12 -0
- package/dist/chunks/terraform-DGvcn9zM.js +6 -0
- package/dist/chunks/tex-AHxmLTL0.js +8 -0
- package/dist/chunks/tokyo-night-DP4TmcQl.js +4 -0
- package/dist/chunks/toml-DY62mUL_.js +6 -0
- package/dist/chunks/ts-tags-ioVe2PKw.js +41 -0
- package/dist/chunks/tsv-BtvSkaG0.js +6 -0
- package/dist/chunks/tsx-B8rCNbgL.js +6 -0
- package/dist/chunks/turtle-_H59FV7D.js +6 -0
- package/dist/chunks/twig-DwV2Fi4L.js +18 -0
- package/dist/chunks/typescript-RycA9KXf.js +6 -0
- package/dist/chunks/typespec-DWqp-kUU.js +6 -0
- package/dist/chunks/typst-D_1QKWns.js +6 -0
- package/dist/chunks/v-BPCNiyYe.js +6 -0
- package/dist/chunks/vala-uxaPR7d1.js +6 -0
- package/dist/chunks/vb-D8_c5-KN.js +6 -0
- package/dist/chunks/verilog-B-bybjPF.js +6 -0
- package/dist/chunks/vesper-BckBta1U.js +4 -0
- package/dist/chunks/vhdl-CUlNa8ac.js +6 -0
- package/dist/chunks/viml-DsfA-sWm.js +6 -0
- package/dist/chunks/vitesse-black-BoGvW84i.js +4 -0
- package/dist/chunks/vitesse-dark-Cym-eLtO.js +4 -0
- package/dist/chunks/vitesse-light-CcmG315c.js +4 -0
- package/dist/chunks/vue-DXEmyXn9.js +31 -0
- package/dist/chunks/vue-html-j9xNEdu3.js +8 -0
- package/dist/chunks/vue-vine-D41-N99t.js +18 -0
- package/dist/chunks/vyper-CPQuu50u.js +6 -0
- package/dist/chunks/wasm-BBXxrAl7.js +6 -0
- package/dist/chunks/wasm-DQxwEHae.js +7 -0
- package/dist/chunks/wenyan-pbVjoM9_.js +6 -0
- package/dist/chunks/wgsl-DY4iK1q1.js +6 -0
- package/dist/chunks/wikitext-Z-MoUasO.js +6 -0
- package/dist/chunks/wit-CQMQOlTg.js +6 -0
- package/dist/chunks/wolfram-Dz4KXISs.js +6 -0
- package/dist/chunks/xml-C2J0sS9M.js +8 -0
- package/dist/chunks/xsl-BmSZphgC.js +8 -0
- package/dist/chunks/yaml-DaO7k5B1.js +6 -0
- package/dist/chunks/zenscript-CxBjpf9c.js +6 -0
- package/dist/chunks/zig-Vm0PO9wB.js +6 -0
- package/dist/dashboard.js +8 -0
- package/dist/define.js +4 -0
- package/dist/index.js +317 -0
- package/dist/studio.css +2272 -0
- package/dist/styles.js +1 -0
- package/package.json +88 -0
- package/prose-node-shims/fs.ts +6 -0
- package/prose-node-shims/path.ts +16 -0
- package/prose-node-shims/sharp.ts +4 -0
- package/prose-ui-node-shim.ts +26 -0
- package/src/App.tsx +173 -0
- package/src/WorkspaceRoutes.tsx +38 -0
- package/src/api.ts +833 -0
- package/src/auth-client.ts +15 -0
- package/src/chat/ChangeCard.tsx +330 -0
- package/src/chat/ChatBar.tsx +238 -0
- package/src/chat/ChatMessage.tsx +478 -0
- package/src/chat/ChatPanel.tsx +406 -0
- package/src/chat/ChatProvider.tsx +661 -0
- package/src/chat/Composer.tsx +461 -0
- package/src/chat/DocListCard.tsx +322 -0
- package/src/chat/LiveStatus.tsx +83 -0
- package/src/chat/MentionPopover.tsx +164 -0
- package/src/chat/ModelPicker.tsx +113 -0
- package/src/chat/Shimmer.tsx +39 -0
- package/src/chat/ThreadHistory.tsx +268 -0
- package/src/chat/chat-context.ts +41 -0
- package/src/chat/chat-helpers.ts +402 -0
- package/src/chat/chat-state.ts +59 -0
- package/src/chat/icons.tsx +171 -0
- package/src/chat/useStickToBottom.ts +110 -0
- package/src/chrome/AppShell.tsx +100 -0
- package/src/chrome/AppSidebar.tsx +305 -0
- package/src/chrome/CommandPalette.tsx +559 -0
- package/src/chrome/ContentApiPopover.tsx +215 -0
- package/src/chrome/EditorActionsContext.tsx +63 -0
- package/src/chrome/EditorFocusContext.tsx +80 -0
- package/src/chrome/EditorStatusContext.tsx +84 -0
- package/src/chrome/NavItem.tsx +75 -0
- package/src/chrome/OpenSiteButton.tsx +148 -0
- package/src/chrome/StatusBar.tsx +73 -0
- package/src/chrome/UserMenu.tsx +130 -0
- package/src/chrome/WorkspaceNavContext.tsx +60 -0
- package/src/chrome/WorkspaceStatusBar.tsx +940 -0
- package/src/chrome/content-api-url.ts +111 -0
- package/src/chrome/content-type-groups.ts +32 -0
- package/src/chrome/hotkeys.ts +79 -0
- package/src/chrome/icons.tsx +191 -0
- package/src/chrome/open-site.ts +30 -0
- package/src/chrome/status-bar-action.ts +24 -0
- package/src/components/AppChromeContext.tsx +32 -0
- package/src/components/Shell.tsx +18 -0
- package/src/components/WorkspaceSwitcher.tsx +345 -0
- package/src/content-blocks/index.tsx +262 -0
- package/src/css.d.ts +2 -0
- package/src/dashboard.ts +5 -0
- package/src/define-studio.tsx +98 -0
- package/src/define.ts +12 -0
- package/src/index.css +123 -0
- package/src/index.ts +19 -0
- package/src/last-user.ts +40 -0
- package/src/last-workspace.ts +57 -0
- package/src/mcp/McpConnectorsPanel.tsx +872 -0
- package/src/mcp/parse-json.ts +52 -0
- package/src/pages/AcceptInvitePage.tsx +99 -0
- package/src/pages/BlockSettingsDialog.tsx +303 -0
- package/src/pages/BlocksList.tsx +402 -0
- package/src/pages/BodyProse.tsx +236 -0
- package/src/pages/DocEditorPage.tsx +1394 -0
- package/src/pages/EmbedChatPage.tsx +110 -0
- package/src/pages/EmbedPublishPage.tsx +259 -0
- package/src/pages/EnterPage.tsx +96 -0
- package/src/pages/GithubConnectPage.tsx +142 -0
- package/src/pages/LegacyWorkspaceRedirect.tsx +57 -0
- package/src/pages/LoginPage.tsx +335 -0
- package/src/pages/NewWorkspacePage.tsx +74 -0
- package/src/pages/RenderedBody.tsx +598 -0
- package/src/pages/ResumeHome.tsx +18 -0
- package/src/pages/SelectionBar.tsx +277 -0
- package/src/pages/SettingsGeneralPage.tsx +403 -0
- package/src/pages/SettingsGithubPage.tsx +277 -0
- package/src/pages/SettingsLayout.tsx +127 -0
- package/src/pages/SettingsMcpPage.tsx +30 -0
- package/src/pages/SettingsSchemaPage.tsx +93 -0
- package/src/pages/SettingsUsersPage.tsx +363 -0
- package/src/pages/TypeDocsPage.tsx +225 -0
- package/src/pages/UiKitPage.tsx +331 -0
- package/src/pages/UserSettingsPage.tsx +94 -0
- package/src/pages/WorkspaceHomeRedirect.tsx +17 -0
- package/src/pages/WorkspaceLayout.tsx +103 -0
- package/src/pages/WorkspacesPage.tsx +35 -0
- package/src/pages/blocks-list.ts +73 -0
- package/src/pages/body-blocks.ts +233 -0
- package/src/pages/body-mdx.tsx +82 -0
- package/src/pages/compile-body.ts +37 -0
- package/src/pages/host-env.ts +22 -0
- package/src/pages/html-to-markdown.ts +99 -0
- package/src/pages/preview-bridge.ts +46 -0
- package/src/pages/preview-split.ts +30 -0
- package/src/pages/preview-url.ts +92 -0
- package/src/pages/selection-format.ts +179 -0
- package/src/pages/type-docs.ts +9 -0
- package/src/replica/BootstrapSplash.tsx +80 -0
- package/src/replica/ReplicaProvider.tsx +267 -0
- package/src/replica/cache.ts +30 -0
- package/src/replica/idb.ts +89 -0
- package/src/replica/instance.ts +39 -0
- package/src/replica/pull.ts +23 -0
- package/src/replica/store.ts +497 -0
- package/src/replica/sync-cache.ts +51 -0
- package/src/replica/types.ts +119 -0
- package/src/replica/useReplica.ts +13 -0
- package/src/site.tsx +230 -0
- package/src/studio-config.ts +81 -0
- package/src/styles/themes.ts +49 -0
- package/src/styles/tokens.stylex.ts +58 -0
- package/src/styles.ts +11 -0
- package/src/theme/AccentOverride.tsx +29 -0
- package/src/theme/ThemeProvider.tsx +130 -0
- package/src/theme/apply-theme-class.ts +12 -0
- package/src/ui/BackLink.tsx +28 -0
- package/src/ui/Button.tsx +167 -0
- package/src/ui/ConfirmDialog.tsx +141 -0
- package/src/ui/Field.tsx +45 -0
- package/src/ui/Input.tsx +183 -0
- package/src/ui/ListRow.tsx +88 -0
- package/src/ui/Page.tsx +151 -0
- package/src/ui/Text.tsx +77 -0
- package/src/ui/Tooltip.tsx +85 -0
- package/src/ui/popup.ts +216 -0
- package/src/workspace/permissions.ts +17 -0
- package/src/workspace/types.ts +12 -0
- package/src/workspace-path.ts +98 -0
|
@@ -0,0 +1,1736 @@
|
|
|
1
|
+
var Qe = Object.defineProperty;
|
|
2
|
+
var Ze = (e, t, n) => t in e ? Qe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var D = (e, t, n) => Ze(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import { jsxs as R, jsx as o, Fragment as be } from "react/jsx-runtime";
|
|
5
|
+
import { useRef as et, useCallback as tt, useSyncExternalStore as nt, useState as E, useEffect as J, Suspense as we, lazy as rt } from "react";
|
|
6
|
+
import { _ as st, $ as Ce, a0 as it, T as O, a1 as at, p as ot, a2 as lt, a3 as Ie, a4 as qe, a5 as Fe, a6 as ct, a7 as ut, W as ze, a8 as dt, a9 as ae, e as V, b as Be, aa as ft, ab as Me, B as ht, S as se, F as Z, I as ee, a as ye, ac as pt, Z as z, ad as gt, M as ve, ae as te, P as mt, af as xt, ag as yt, o as vt, ah as bt, ai as wt, aj as St, A as kt, G as Et, ak as De, L as Rt, al as _t, am as Ot, an as Tt, N as Pt, R as Lt, O as Ut, Q as Nt, U as jt, V as q, X as At, Y as Ct } from "./WorkspaceRoutes-DgRtdie8.js";
|
|
7
|
+
const ne = /* @__PURE__ */ Object.create(null), W = (e) => {
|
|
8
|
+
var t, n;
|
|
9
|
+
return ((t = globalThis.process) == null ? void 0 : t.env) || ((n = globalThis.Deno) == null ? void 0 : n.env.toObject()) || globalThis.__env__ || (e ? ne : globalThis);
|
|
10
|
+
}, F = new Proxy(ne, {
|
|
11
|
+
get(e, t) {
|
|
12
|
+
return W()[t] ?? ne[t];
|
|
13
|
+
},
|
|
14
|
+
has(e, t) {
|
|
15
|
+
return t in W() || t in ne;
|
|
16
|
+
},
|
|
17
|
+
set(e, t, n) {
|
|
18
|
+
const r = W(!0);
|
|
19
|
+
return r[t] = n, !0;
|
|
20
|
+
},
|
|
21
|
+
deleteProperty(e, t) {
|
|
22
|
+
if (!t) return !1;
|
|
23
|
+
const n = W(!0);
|
|
24
|
+
return delete n[t], !0;
|
|
25
|
+
},
|
|
26
|
+
ownKeys() {
|
|
27
|
+
const e = W(!0);
|
|
28
|
+
return Object.keys(e);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
F.NODE_ENV;
|
|
32
|
+
var re = class extends Error {
|
|
33
|
+
constructor(e, t) {
|
|
34
|
+
super(e, t), this.name = "BetterAuthError", this.message = e, this.stack = "";
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const It = 47;
|
|
38
|
+
function He(e) {
|
|
39
|
+
let t = e.length;
|
|
40
|
+
for (; t > 0 && e.charCodeAt(t - 1) === It; ) t--;
|
|
41
|
+
return t === e.length ? e : e.slice(0, t);
|
|
42
|
+
}
|
|
43
|
+
function qt(e) {
|
|
44
|
+
try {
|
|
45
|
+
return (He(new URL(e).pathname) || "/") !== "/";
|
|
46
|
+
} catch {
|
|
47
|
+
throw new re(`Invalid base URL: ${e}. Please provide a valid base URL.`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function Ft(e) {
|
|
51
|
+
try {
|
|
52
|
+
const t = new URL(e);
|
|
53
|
+
if (t.protocol !== "http:" && t.protocol !== "https:") throw new re(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`);
|
|
54
|
+
} catch (t) {
|
|
55
|
+
throw t instanceof re ? t : new re(`Invalid base URL: ${e}. Please provide a valid base URL.`, { cause: t });
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function oe(e, t = "/api/auth") {
|
|
59
|
+
if (Ft(e), qt(e)) return e;
|
|
60
|
+
const n = He(e);
|
|
61
|
+
return !t || t === "/" ? n : (t = t.startsWith("/") ? t : `/${t}`, `${n}${t}`);
|
|
62
|
+
}
|
|
63
|
+
function zt(e, t, n, r, s) {
|
|
64
|
+
if (e) return oe(e, t);
|
|
65
|
+
{
|
|
66
|
+
const i = F.BETTER_AUTH_URL || F.NEXT_PUBLIC_BETTER_AUTH_URL || F.PUBLIC_BETTER_AUTH_URL || F.NUXT_PUBLIC_BETTER_AUTH_URL || F.NUXT_PUBLIC_AUTH_URL || (F.BASE_URL !== "/" ? F.BASE_URL : void 0);
|
|
67
|
+
if (i) return oe(i, t);
|
|
68
|
+
}
|
|
69
|
+
if (typeof window < "u" && window.location) return oe(window.location.origin, t);
|
|
70
|
+
}
|
|
71
|
+
const Bt = {
|
|
72
|
+
proto: /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,
|
|
73
|
+
constructor: /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,
|
|
74
|
+
protoShort: /"__proto__"\s*:/,
|
|
75
|
+
constructorShort: /"constructor"\s*:/
|
|
76
|
+
}, Mt = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/, Se = {
|
|
77
|
+
true: !0,
|
|
78
|
+
false: !1,
|
|
79
|
+
null: null,
|
|
80
|
+
undefined: void 0,
|
|
81
|
+
nan: NaN,
|
|
82
|
+
infinity: Number.POSITIVE_INFINITY,
|
|
83
|
+
"-infinity": Number.NEGATIVE_INFINITY
|
|
84
|
+
}, Dt = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;
|
|
85
|
+
function Ht(e) {
|
|
86
|
+
return e instanceof Date && !isNaN(e.getTime());
|
|
87
|
+
}
|
|
88
|
+
function Wt(e) {
|
|
89
|
+
const t = Dt.exec(e);
|
|
90
|
+
if (!t) return null;
|
|
91
|
+
const [, n, r, s, i, l, d, a, u, c, m] = t, p = new Date(Date.UTC(parseInt(n, 10), parseInt(r, 10) - 1, parseInt(s, 10), parseInt(i, 10), parseInt(l, 10), parseInt(d, 10), a ? parseInt(a.padEnd(3, "0"), 10) : 0));
|
|
92
|
+
if (u) {
|
|
93
|
+
const g = (parseInt(c, 10) * 60 + parseInt(m, 10)) * (u === "+" ? -1 : 1);
|
|
94
|
+
p.setUTCMinutes(p.getUTCMinutes() + g);
|
|
95
|
+
}
|
|
96
|
+
return Ht(p) ? p : null;
|
|
97
|
+
}
|
|
98
|
+
function $t(e, t = {}) {
|
|
99
|
+
const { strict: n = !1, warnings: r = !1, reviver: s, parseDates: i = !0 } = t;
|
|
100
|
+
if (typeof e != "string") return e;
|
|
101
|
+
const l = e.trim(), d = l.toLowerCase();
|
|
102
|
+
if (d.length <= 9 && d in Se) return Se[d];
|
|
103
|
+
if (!Mt.test(l)) {
|
|
104
|
+
if (n) throw new SyntaxError("[better-json] Invalid JSON");
|
|
105
|
+
return e;
|
|
106
|
+
}
|
|
107
|
+
if (Object.entries(Bt).some(([a, u]) => {
|
|
108
|
+
const c = u.test(l);
|
|
109
|
+
return c && r && console.warn(`[better-json] Detected potential prototype pollution attempt using ${a} pattern`), c;
|
|
110
|
+
}) && n) throw new Error("[better-json] Potential prototype pollution attempt detected");
|
|
111
|
+
try {
|
|
112
|
+
return JSON.parse(l, (u, c) => {
|
|
113
|
+
if (u === "__proto__" || u === "constructor" && c && typeof c == "object" && "prototype" in c) {
|
|
114
|
+
r && console.warn(`[better-json] Dropping "${u}" key to prevent prototype pollution`);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
if (i && typeof c == "string") {
|
|
118
|
+
const m = Wt(c);
|
|
119
|
+
if (m) return m;
|
|
120
|
+
}
|
|
121
|
+
return s ? s(u, c) : c;
|
|
122
|
+
});
|
|
123
|
+
} catch (a) {
|
|
124
|
+
if (n) throw a;
|
|
125
|
+
return e;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function Gt(e, t = { strict: !0 }) {
|
|
129
|
+
return $t(e, t);
|
|
130
|
+
}
|
|
131
|
+
const Vt = [
|
|
132
|
+
"javascript:",
|
|
133
|
+
"data:",
|
|
134
|
+
"vbscript:"
|
|
135
|
+
];
|
|
136
|
+
function Jt(e) {
|
|
137
|
+
let t;
|
|
138
|
+
try {
|
|
139
|
+
t = new URL(e);
|
|
140
|
+
} catch {
|
|
141
|
+
return !0;
|
|
142
|
+
}
|
|
143
|
+
return !Vt.includes(t.protocol);
|
|
144
|
+
}
|
|
145
|
+
const Kt = {
|
|
146
|
+
id: "redirect",
|
|
147
|
+
name: "Redirect",
|
|
148
|
+
hooks: { onSuccess(e) {
|
|
149
|
+
var t, n;
|
|
150
|
+
if ((t = e.data) != null && t.url && ((n = e.data) != null && n.redirect) && Jt(e.data.url) && typeof window < "u" && window.location && window.location)
|
|
151
|
+
try {
|
|
152
|
+
window.location.href = e.data.url;
|
|
153
|
+
} catch {
|
|
154
|
+
}
|
|
155
|
+
} }
|
|
156
|
+
};
|
|
157
|
+
let N = [], $ = 0;
|
|
158
|
+
const ge = 4, Xt = globalThis.nanostoresGlobal || (globalThis.nanostoresGlobal = { epoch: 0 });
|
|
159
|
+
let Yt = () => {
|
|
160
|
+
let e, t;
|
|
161
|
+
for (; $ < N.length; ) {
|
|
162
|
+
t = $, $ += ge;
|
|
163
|
+
try {
|
|
164
|
+
N[t](
|
|
165
|
+
N[t + 1].value,
|
|
166
|
+
N[t + 2],
|
|
167
|
+
N[t + 3]
|
|
168
|
+
);
|
|
169
|
+
} catch (n) {
|
|
170
|
+
e = n;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
if (N.length = $ = 0, e) throw e;
|
|
174
|
+
};
|
|
175
|
+
const ke = /* @__NO_SIDE_EFFECTS__ */ (e) => {
|
|
176
|
+
let t = [], n = {
|
|
177
|
+
eq: Object.is,
|
|
178
|
+
get() {
|
|
179
|
+
return n.lc || n.listen(() => {
|
|
180
|
+
})(), n.value;
|
|
181
|
+
},
|
|
182
|
+
init: e,
|
|
183
|
+
lc: 0,
|
|
184
|
+
listen(r) {
|
|
185
|
+
return n.lc = t.push(r), () => {
|
|
186
|
+
for (let i = $; i < N.length; )
|
|
187
|
+
N[i] === r ? N.splice(i, ge) : i += ge;
|
|
188
|
+
let s = t.indexOf(r);
|
|
189
|
+
~s && (t.splice(s, 1), --n.lc || n.off());
|
|
190
|
+
};
|
|
191
|
+
},
|
|
192
|
+
notify(r, s) {
|
|
193
|
+
Xt.epoch++;
|
|
194
|
+
let i = !N.length && !0;
|
|
195
|
+
for (let l of t)
|
|
196
|
+
N.push(
|
|
197
|
+
l,
|
|
198
|
+
n,
|
|
199
|
+
r,
|
|
200
|
+
s
|
|
201
|
+
);
|
|
202
|
+
i && Yt();
|
|
203
|
+
},
|
|
204
|
+
/* It will be called on last listener unsubscribing.
|
|
205
|
+
We will redefine it in onMount and onStop. */
|
|
206
|
+
off() {
|
|
207
|
+
},
|
|
208
|
+
set(r) {
|
|
209
|
+
let s = n.value;
|
|
210
|
+
n.eq(s, r) || (n.value = r, n.notify(s));
|
|
211
|
+
},
|
|
212
|
+
subscribe(r) {
|
|
213
|
+
let s = n.listen(r);
|
|
214
|
+
return r(n.value), s;
|
|
215
|
+
},
|
|
216
|
+
value: e
|
|
217
|
+
};
|
|
218
|
+
return n;
|
|
219
|
+
}, Qt = 2, Zt = 5, X = 6, Y = 10;
|
|
220
|
+
let We = (e, t, n, r) => (e.events = e.events || {}, e.events[n + Y] || (e.events[n + Y] = r((s) => {
|
|
221
|
+
e.events[n].reduceRight((i, l) => (l(i), i), {
|
|
222
|
+
shared: {},
|
|
223
|
+
...s
|
|
224
|
+
});
|
|
225
|
+
})), e.events[n] = e.events[n] || [], e.events[n].push(t), () => {
|
|
226
|
+
let s = e.events[n], i = s.indexOf(t);
|
|
227
|
+
~i && (s.splice(i, 1), s.length || (e.events[n + Y](), delete e.events[n + Y]));
|
|
228
|
+
}), en = (e, t) => We(e, t, Qt, (n) => {
|
|
229
|
+
let r = e.set, s = e.setKey;
|
|
230
|
+
return e.setKey && (e.setKey = (i, l) => {
|
|
231
|
+
let d;
|
|
232
|
+
if (n({
|
|
233
|
+
abort: () => {
|
|
234
|
+
d = !0;
|
|
235
|
+
},
|
|
236
|
+
changed: i,
|
|
237
|
+
newValue: { ...e.value, [i]: l }
|
|
238
|
+
}), !d) return s(i, l);
|
|
239
|
+
}), e.set = (i) => {
|
|
240
|
+
let l;
|
|
241
|
+
if (n({ abort: () => {
|
|
242
|
+
l = !0;
|
|
243
|
+
}, newValue: i }), !l) return r(i);
|
|
244
|
+
}, () => {
|
|
245
|
+
e.set = r, e.setKey = s;
|
|
246
|
+
};
|
|
247
|
+
});
|
|
248
|
+
const $e = 1e3;
|
|
249
|
+
let tn = (e, t) => We(e, (r) => {
|
|
250
|
+
let s = t(r);
|
|
251
|
+
s && e.events[X].push(s);
|
|
252
|
+
}, Zt, (r) => {
|
|
253
|
+
let s = e.listen;
|
|
254
|
+
e.listen = (...l) => (!e.lc && !e.active && (e.active = !0, r()), s(...l));
|
|
255
|
+
let i = e.off;
|
|
256
|
+
return e.events[X] = [], e.off = () => {
|
|
257
|
+
i(), setTimeout(() => {
|
|
258
|
+
if (e.active && !e.lc) {
|
|
259
|
+
e.active = !1;
|
|
260
|
+
for (let l of e.events[X]) l();
|
|
261
|
+
e.events[X] = [];
|
|
262
|
+
}
|
|
263
|
+
}, $e);
|
|
264
|
+
}, () => {
|
|
265
|
+
e.listen = s, e.off = i;
|
|
266
|
+
};
|
|
267
|
+
});
|
|
268
|
+
function Ee(e, t) {
|
|
269
|
+
let n = nn(t), r = e;
|
|
270
|
+
for (let s of n) {
|
|
271
|
+
if (r == null)
|
|
272
|
+
return;
|
|
273
|
+
r = r[s];
|
|
274
|
+
}
|
|
275
|
+
return r;
|
|
276
|
+
}
|
|
277
|
+
const Re = /(.*)\[(\d+)\]/;
|
|
278
|
+
function nn(e) {
|
|
279
|
+
return e.split(".").flatMap((t) => Ge(t));
|
|
280
|
+
}
|
|
281
|
+
function Ge(e) {
|
|
282
|
+
if (Re.test(e)) {
|
|
283
|
+
let [, t, n] = e.match(Re);
|
|
284
|
+
return [...Ge(t), n];
|
|
285
|
+
}
|
|
286
|
+
return [e];
|
|
287
|
+
}
|
|
288
|
+
function rn(e, t, n) {
|
|
289
|
+
let r = new Set(t);
|
|
290
|
+
return e.listen((s, i, l) => {
|
|
291
|
+
(l === void 0 ? t.some(
|
|
292
|
+
(d) => i === void 0 || // `map` keys are plain properties, but a `deepMap` key is a path into
|
|
293
|
+
// the value, where a plain lookup would compare undefined to undefined
|
|
294
|
+
// and never report a change.
|
|
295
|
+
s[d] !== i[d] || Ee(s, d) !== Ee(i, d)
|
|
296
|
+
) : r.has(l) || r.has(l.split(/\.|\[/)[0])) && n(s, i, l);
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
function _e(e) {
|
|
300
|
+
if (typeof e != "object" || e === null) return !1;
|
|
301
|
+
const t = Object.getPrototypeOf(e);
|
|
302
|
+
return t === Object.prototype || t === null;
|
|
303
|
+
}
|
|
304
|
+
function ie(e, t) {
|
|
305
|
+
if (e === t) return !0;
|
|
306
|
+
if (Array.isArray(e) && Array.isArray(t)) {
|
|
307
|
+
if (e.length !== t.length) return !1;
|
|
308
|
+
for (let n = 0; n < e.length; n++) if (!ie(e[n], t[n])) return !1;
|
|
309
|
+
return !0;
|
|
310
|
+
}
|
|
311
|
+
if (_e(e) && _e(t)) {
|
|
312
|
+
const n = Object.keys(e), r = Object.keys(t);
|
|
313
|
+
if (n.length !== r.length) return !1;
|
|
314
|
+
for (const s of n) if (!(s in t) || !ie(e[s], t[s])) return !1;
|
|
315
|
+
return !0;
|
|
316
|
+
}
|
|
317
|
+
return !1;
|
|
318
|
+
}
|
|
319
|
+
function sn(e, t) {
|
|
320
|
+
return en(e, ({ newValue: n, abort: r }) => {
|
|
321
|
+
t(e.value, n) && r();
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
const le = Symbol.for("better-auth:broadcast-channel"), an = () => Math.floor(Date.now() / 1e3);
|
|
325
|
+
var on = class {
|
|
326
|
+
constructor(e = "better-auth.message") {
|
|
327
|
+
D(this, "listeners", /* @__PURE__ */ new Set());
|
|
328
|
+
D(this, "name");
|
|
329
|
+
this.name = e;
|
|
330
|
+
}
|
|
331
|
+
subscribe(e) {
|
|
332
|
+
return this.listeners.add(e), () => {
|
|
333
|
+
this.listeners.delete(e);
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
post(e) {
|
|
337
|
+
if (!(typeof window > "u"))
|
|
338
|
+
try {
|
|
339
|
+
localStorage.setItem(this.name, JSON.stringify({
|
|
340
|
+
...e,
|
|
341
|
+
timestamp: an()
|
|
342
|
+
}));
|
|
343
|
+
} catch {
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
setup() {
|
|
347
|
+
if (typeof window > "u" || typeof window.addEventListener > "u") return () => {
|
|
348
|
+
};
|
|
349
|
+
const e = (t) => {
|
|
350
|
+
if (t.key !== this.name) return;
|
|
351
|
+
const n = JSON.parse(t.newValue ?? "{}");
|
|
352
|
+
(n == null ? void 0 : n.event) !== "session" || !(n != null && n.data) || this.listeners.forEach((r) => r(n));
|
|
353
|
+
};
|
|
354
|
+
return window.addEventListener("storage", e), () => {
|
|
355
|
+
window.removeEventListener("storage", e);
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
};
|
|
359
|
+
function ce(e = "better-auth.message") {
|
|
360
|
+
return globalThis[le] || (globalThis[le] = new on(e)), globalThis[le];
|
|
361
|
+
}
|
|
362
|
+
const ue = Symbol.for("better-auth:focus-manager");
|
|
363
|
+
var ln = class {
|
|
364
|
+
constructor() {
|
|
365
|
+
D(this, "listeners", /* @__PURE__ */ new Set());
|
|
366
|
+
}
|
|
367
|
+
subscribe(e) {
|
|
368
|
+
return this.listeners.add(e), () => {
|
|
369
|
+
this.listeners.delete(e);
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
setFocused(e) {
|
|
373
|
+
this.listeners.forEach((t) => t(e));
|
|
374
|
+
}
|
|
375
|
+
setup() {
|
|
376
|
+
if (typeof window > "u" || typeof document > "u" || typeof window.addEventListener > "u") return () => {
|
|
377
|
+
};
|
|
378
|
+
const e = () => {
|
|
379
|
+
document.visibilityState === "visible" && this.setFocused(!0);
|
|
380
|
+
};
|
|
381
|
+
return document.addEventListener("visibilitychange", e, !1), () => {
|
|
382
|
+
document.removeEventListener("visibilitychange", e, !1);
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
};
|
|
386
|
+
function Oe() {
|
|
387
|
+
return globalThis[ue] || (globalThis[ue] = new ln()), globalThis[ue];
|
|
388
|
+
}
|
|
389
|
+
const de = Symbol.for("better-auth:online-manager");
|
|
390
|
+
var cn = class {
|
|
391
|
+
constructor() {
|
|
392
|
+
D(this, "listeners", /* @__PURE__ */ new Set());
|
|
393
|
+
D(this, "isOnline", typeof navigator < "u" ? navigator.onLine : !0);
|
|
394
|
+
}
|
|
395
|
+
subscribe(e) {
|
|
396
|
+
return this.listeners.add(e), () => {
|
|
397
|
+
this.listeners.delete(e);
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
setOnline(e) {
|
|
401
|
+
this.isOnline = e, this.listeners.forEach((t) => t(e));
|
|
402
|
+
}
|
|
403
|
+
setup() {
|
|
404
|
+
if (typeof window > "u" || typeof window.addEventListener > "u") return () => {
|
|
405
|
+
};
|
|
406
|
+
const e = () => this.setOnline(!0), t = () => this.setOnline(!1);
|
|
407
|
+
return window.addEventListener("online", e, !1), window.addEventListener("offline", t, !1), () => {
|
|
408
|
+
window.removeEventListener("online", e, !1), window.removeEventListener("offline", t, !1);
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
};
|
|
412
|
+
function fe() {
|
|
413
|
+
return globalThis[de] || (globalThis[de] = new cn()), globalThis[de];
|
|
414
|
+
}
|
|
415
|
+
const he = () => Math.floor(Date.now() / 1e3), un = 5;
|
|
416
|
+
function dn(e) {
|
|
417
|
+
var _, b, T;
|
|
418
|
+
const { fetchSession: t, shouldPollSession: n = () => !0, sessionSignal: r, options: s = {} } = e, i = ((_ = s.sessionOptions) == null ? void 0 : _.refetchInterval) ?? 0, l = ((b = s.sessionOptions) == null ? void 0 : b.refetchOnWindowFocus) ?? !0, d = ((T = s.sessionOptions) == null ? void 0 : T.refetchWhenOffline) ?? !1, a = {
|
|
419
|
+
isInitialized: !1,
|
|
420
|
+
lastSessionRequest: 0
|
|
421
|
+
}, u = () => d || fe().isOnline, c = (f) => {
|
|
422
|
+
if (u()) {
|
|
423
|
+
if ((f == null ? void 0 : f.event) === "storage") {
|
|
424
|
+
t();
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
if ((f == null ? void 0 : f.event) === "poll") {
|
|
428
|
+
a.lastSessionRequest = he(), t();
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
if ((f == null ? void 0 : f.event) === "visibilitychange") {
|
|
432
|
+
if (he() - a.lastSessionRequest < un) return;
|
|
433
|
+
a.lastSessionRequest = he(), t();
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
t();
|
|
437
|
+
}
|
|
438
|
+
}, m = (f) => {
|
|
439
|
+
ce().post({
|
|
440
|
+
event: "session",
|
|
441
|
+
data: { trigger: f },
|
|
442
|
+
clientId: Math.random().toString(36).substring(7)
|
|
443
|
+
});
|
|
444
|
+
}, p = () => {
|
|
445
|
+
i && i > 0 && (a.pollInterval = setInterval(() => {
|
|
446
|
+
n() && c({ event: "poll" });
|
|
447
|
+
}, i * 1e3));
|
|
448
|
+
}, g = () => {
|
|
449
|
+
a.unsubscribeBroadcast = ce().subscribe(() => {
|
|
450
|
+
c({ event: "storage" });
|
|
451
|
+
});
|
|
452
|
+
}, y = () => {
|
|
453
|
+
l && (a.unsubscribeFocus = Oe().subscribe(() => {
|
|
454
|
+
c({ event: "visibilitychange" });
|
|
455
|
+
}));
|
|
456
|
+
}, v = () => {
|
|
457
|
+
a.unsubscribeOnline = fe().subscribe((f) => {
|
|
458
|
+
f && c({ event: "visibilitychange" });
|
|
459
|
+
});
|
|
460
|
+
}, x = () => {
|
|
461
|
+
a.unsubscribeSignal = r.listen(() => {
|
|
462
|
+
t();
|
|
463
|
+
});
|
|
464
|
+
};
|
|
465
|
+
return {
|
|
466
|
+
init: () => {
|
|
467
|
+
a.isInitialized || (a.isInitialized = !0, p(), g(), y(), v(), x(), a.cleanupBroadcastSetup = ce().setup(), a.cleanupFocusSetup = Oe().setup(), a.cleanupOnlineSetup = fe().setup());
|
|
468
|
+
},
|
|
469
|
+
cleanup: () => {
|
|
470
|
+
a.isInitialized && (a.pollInterval && (clearInterval(a.pollInterval), a.pollInterval = void 0), a.unsubscribeBroadcast && (a.unsubscribeBroadcast(), a.unsubscribeBroadcast = void 0), a.unsubscribeFocus && (a.unsubscribeFocus(), a.unsubscribeFocus = void 0), a.unsubscribeOnline && (a.unsubscribeOnline(), a.unsubscribeOnline = void 0), a.unsubscribeSignal && (a.unsubscribeSignal(), a.unsubscribeSignal = void 0), a.cleanupBroadcastSetup && (a.cleanupBroadcastSetup(), a.cleanupBroadcastSetup = void 0), a.cleanupFocusSetup && (a.cleanupFocusSetup(), a.cleanupFocusSetup = void 0), a.cleanupOnlineSetup && (a.cleanupOnlineSetup(), a.cleanupOnlineSetup = void 0), a.isInitialized = !1, a.lastSessionRequest = 0);
|
|
471
|
+
},
|
|
472
|
+
triggerRefetch: c,
|
|
473
|
+
broadcastSessionUpdate: m
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
const fn = () => typeof window > "u", hn = $e;
|
|
477
|
+
function pn(e, t) {
|
|
478
|
+
if (typeof window > "u") return;
|
|
479
|
+
const n = e.get();
|
|
480
|
+
n.data !== null || t === null || e.set({
|
|
481
|
+
...n,
|
|
482
|
+
data: t,
|
|
483
|
+
error: null,
|
|
484
|
+
isPending: !1
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
function Te(e) {
|
|
488
|
+
return typeof e == "object" && e !== null && "data" in e && "error" in e ? e : {
|
|
489
|
+
data: e,
|
|
490
|
+
error: null
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
function gn(e) {
|
|
494
|
+
return !e || e.session === null && e.user === null ? null : e;
|
|
495
|
+
}
|
|
496
|
+
function mn(e, t) {
|
|
497
|
+
return ie(e.data, t.data) && e.error === t.error && e.isPending === t.isPending && e.isRefetching === t.isRefetching && e.refetch === t.refetch;
|
|
498
|
+
}
|
|
499
|
+
function xn(e, t) {
|
|
500
|
+
const n = /* @__PURE__ */ ke(!1);
|
|
501
|
+
let r, s = 0, i = 0;
|
|
502
|
+
n.listen(() => {
|
|
503
|
+
i++, s = 0;
|
|
504
|
+
});
|
|
505
|
+
const l = (g) => c(g), d = /* @__PURE__ */ ke({
|
|
506
|
+
data: null,
|
|
507
|
+
error: null,
|
|
508
|
+
isPending: !0,
|
|
509
|
+
isRefetching: !1,
|
|
510
|
+
refetch: l
|
|
511
|
+
});
|
|
512
|
+
sn(d, mn);
|
|
513
|
+
const a = async (g, y) => {
|
|
514
|
+
const v = d.value;
|
|
515
|
+
if (d.set({
|
|
516
|
+
...v,
|
|
517
|
+
isPending: v.data === null,
|
|
518
|
+
isRefetching: !0,
|
|
519
|
+
error: null,
|
|
520
|
+
refetch: l
|
|
521
|
+
}), g.aborted) return "aborted";
|
|
522
|
+
try {
|
|
523
|
+
const x = await e("/get-session", {
|
|
524
|
+
method: "GET",
|
|
525
|
+
query: y == null ? void 0 : y.query,
|
|
526
|
+
signal: g
|
|
527
|
+
});
|
|
528
|
+
if (g.aborted) return "aborted";
|
|
529
|
+
let { data: w, error: S } = Te(x), _ = "fresh";
|
|
530
|
+
if (w != null && w.needsRefresh) try {
|
|
531
|
+
const k = await e("/get-session", {
|
|
532
|
+
method: "POST",
|
|
533
|
+
signal: g
|
|
534
|
+
});
|
|
535
|
+
if (g.aborted) return "aborted";
|
|
536
|
+
({ data: w, error: S } = Te(k));
|
|
537
|
+
} catch {
|
|
538
|
+
if (g.aborted) return "aborted";
|
|
539
|
+
_ = "stale";
|
|
540
|
+
}
|
|
541
|
+
if (S) {
|
|
542
|
+
const k = d.value, j = (S == null ? void 0 : S.status) === 401;
|
|
543
|
+
return d.set({
|
|
544
|
+
data: j ? null : k.data,
|
|
545
|
+
error: S,
|
|
546
|
+
isPending: !1,
|
|
547
|
+
isRefetching: !1,
|
|
548
|
+
refetch: l
|
|
549
|
+
}), "failed";
|
|
550
|
+
}
|
|
551
|
+
const b = gn(w), T = d.value, f = T.data != null && b != null && ie(T.data, b) ? T.data : b;
|
|
552
|
+
return d.set({
|
|
553
|
+
data: f,
|
|
554
|
+
error: null,
|
|
555
|
+
isPending: !1,
|
|
556
|
+
isRefetching: !1,
|
|
557
|
+
refetch: l
|
|
558
|
+
}), _;
|
|
559
|
+
} catch (x) {
|
|
560
|
+
if (g.aborted) return "aborted";
|
|
561
|
+
const w = d.value;
|
|
562
|
+
return d.set({
|
|
563
|
+
data: w.data,
|
|
564
|
+
error: x,
|
|
565
|
+
isPending: !1,
|
|
566
|
+
isRefetching: !1,
|
|
567
|
+
refetch: l
|
|
568
|
+
}), "failed";
|
|
569
|
+
}
|
|
570
|
+
}, u = () => {
|
|
571
|
+
var v, x;
|
|
572
|
+
const g = (x = (v = d.value.data) == null ? void 0 : v.session) == null ? void 0 : x.expiresAt, y = g instanceof Date ? g.getTime() : Number.POSITIVE_INFINITY;
|
|
573
|
+
return Math.min(Date.now() + hn, y);
|
|
574
|
+
}, c = (g) => {
|
|
575
|
+
s = 0, r == null || r.cancel();
|
|
576
|
+
const y = new AbortController(), v = {
|
|
577
|
+
cancel: () => y.abort(),
|
|
578
|
+
promise: Promise.resolve().then(() => y.signal.aborted ? "aborted" : a(y.signal, g)),
|
|
579
|
+
revision: i
|
|
580
|
+
};
|
|
581
|
+
r = v;
|
|
582
|
+
const x = (w) => {
|
|
583
|
+
r === v && (r = void 0, w === "fresh" && v.revision === i && (s = u()));
|
|
584
|
+
};
|
|
585
|
+
return v.promise.then(x, () => x("failed")), v.promise.then(() => {
|
|
586
|
+
});
|
|
587
|
+
}, m = () => (r == null ? void 0 : r.revision) === i ? r.promise.then(() => {
|
|
588
|
+
}) : Date.now() < s ? Promise.resolve() : c();
|
|
589
|
+
let p = () => {
|
|
590
|
+
};
|
|
591
|
+
return tn(d, () => {
|
|
592
|
+
let g;
|
|
593
|
+
fn() || (g = setTimeout(() => {
|
|
594
|
+
m();
|
|
595
|
+
}, 0));
|
|
596
|
+
const y = dn({
|
|
597
|
+
fetchSession: c,
|
|
598
|
+
shouldPollSession: () => d.value.data != null,
|
|
599
|
+
sessionSignal: n,
|
|
600
|
+
options: t
|
|
601
|
+
});
|
|
602
|
+
return y.init(), p = y.broadcastSessionUpdate, () => {
|
|
603
|
+
g && clearTimeout(g), y.cleanup();
|
|
604
|
+
};
|
|
605
|
+
}), {
|
|
606
|
+
session: d,
|
|
607
|
+
$sessionSignal: n,
|
|
608
|
+
broadcastSessionUpdate: (g) => p(g)
|
|
609
|
+
};
|
|
610
|
+
}
|
|
611
|
+
function pe(e) {
|
|
612
|
+
if (e === null || typeof e != "object")
|
|
613
|
+
return !1;
|
|
614
|
+
const t = Object.getPrototypeOf(e);
|
|
615
|
+
return t !== null && t !== Object.prototype && Object.getPrototypeOf(t) !== null || Symbol.iterator in e ? !1 : Symbol.toStringTag in e ? Object.prototype.toString.call(e) === "[object Module]" : !0;
|
|
616
|
+
}
|
|
617
|
+
function me(e, t, n = ".", r) {
|
|
618
|
+
if (!pe(t))
|
|
619
|
+
return me(e, {}, n, r);
|
|
620
|
+
const s = { ...t };
|
|
621
|
+
for (const i of Object.keys(e)) {
|
|
622
|
+
if (i === "__proto__" || i === "constructor")
|
|
623
|
+
continue;
|
|
624
|
+
const l = e[i];
|
|
625
|
+
l != null && (r && r(s, i, l, n) || (Array.isArray(l) && Array.isArray(s[i]) ? s[i] = [...l, ...s[i]] : pe(l) && pe(s[i]) ? s[i] = me(
|
|
626
|
+
l,
|
|
627
|
+
s[i],
|
|
628
|
+
(n ? `${n}.` : "") + i.toString(),
|
|
629
|
+
r
|
|
630
|
+
) : s[i] = l));
|
|
631
|
+
}
|
|
632
|
+
return s;
|
|
633
|
+
}
|
|
634
|
+
function yn(e) {
|
|
635
|
+
return (...t) => (
|
|
636
|
+
// eslint-disable-next-line unicorn/no-array-reduce
|
|
637
|
+
t.reduce((n, r) => me(n, r, "", e), {})
|
|
638
|
+
);
|
|
639
|
+
}
|
|
640
|
+
const vn = yn();
|
|
641
|
+
var bn = Object.defineProperty, wn = Object.defineProperties, Sn = Object.getOwnPropertyDescriptors, Pe = Object.getOwnPropertySymbols, kn = Object.prototype.hasOwnProperty, En = Object.prototype.propertyIsEnumerable, Le = (e, t, n) => t in e ? bn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, U = (e, t) => {
|
|
642
|
+
for (var n in t || (t = {}))
|
|
643
|
+
kn.call(t, n) && Le(e, n, t[n]);
|
|
644
|
+
if (Pe)
|
|
645
|
+
for (var n of Pe(t))
|
|
646
|
+
En.call(t, n) && Le(e, n, t[n]);
|
|
647
|
+
return e;
|
|
648
|
+
}, A = (e, t) => wn(e, Sn(t)), Rn = class extends Error {
|
|
649
|
+
constructor(e, t, n) {
|
|
650
|
+
super(t || e.toString(), {
|
|
651
|
+
cause: n
|
|
652
|
+
}), this.status = e, this.statusText = t, this.error = n, Error.captureStackTrace(this, this.constructor);
|
|
653
|
+
}
|
|
654
|
+
}, _n = async (e, t) => {
|
|
655
|
+
var n, r, s, i, l, d;
|
|
656
|
+
let a = t || {};
|
|
657
|
+
const u = {
|
|
658
|
+
onRequest: [t == null ? void 0 : t.onRequest],
|
|
659
|
+
onResponse: [t == null ? void 0 : t.onResponse],
|
|
660
|
+
onSuccess: [t == null ? void 0 : t.onSuccess],
|
|
661
|
+
onError: [t == null ? void 0 : t.onError],
|
|
662
|
+
onRetry: [t == null ? void 0 : t.onRetry]
|
|
663
|
+
};
|
|
664
|
+
if (!t || !(t != null && t.plugins))
|
|
665
|
+
return {
|
|
666
|
+
url: e,
|
|
667
|
+
options: a,
|
|
668
|
+
hooks: u
|
|
669
|
+
};
|
|
670
|
+
for (const c of (t == null ? void 0 : t.plugins) || []) {
|
|
671
|
+
if (c.init) {
|
|
672
|
+
const m = await ((n = c.init) == null ? void 0 : n.call(c, e.toString(), t));
|
|
673
|
+
a = m.options || a, e = m.url;
|
|
674
|
+
}
|
|
675
|
+
u.onRequest.push((r = c.hooks) == null ? void 0 : r.onRequest), u.onResponse.push((s = c.hooks) == null ? void 0 : s.onResponse), u.onSuccess.push((i = c.hooks) == null ? void 0 : i.onSuccess), u.onError.push((l = c.hooks) == null ? void 0 : l.onError), u.onRetry.push((d = c.hooks) == null ? void 0 : d.onRetry);
|
|
676
|
+
}
|
|
677
|
+
return {
|
|
678
|
+
url: e,
|
|
679
|
+
options: a,
|
|
680
|
+
hooks: u
|
|
681
|
+
};
|
|
682
|
+
}, Ue = class {
|
|
683
|
+
constructor(e) {
|
|
684
|
+
this.options = e;
|
|
685
|
+
}
|
|
686
|
+
shouldAttemptRetry(e, t) {
|
|
687
|
+
return this.options.shouldRetry ? Promise.resolve(
|
|
688
|
+
e < this.options.attempts && this.options.shouldRetry(t)
|
|
689
|
+
) : Promise.resolve(e < this.options.attempts);
|
|
690
|
+
}
|
|
691
|
+
getDelay() {
|
|
692
|
+
return this.options.delay;
|
|
693
|
+
}
|
|
694
|
+
}, On = class {
|
|
695
|
+
constructor(e) {
|
|
696
|
+
this.options = e;
|
|
697
|
+
}
|
|
698
|
+
shouldAttemptRetry(e, t) {
|
|
699
|
+
return this.options.shouldRetry ? Promise.resolve(
|
|
700
|
+
e < this.options.attempts && this.options.shouldRetry(t)
|
|
701
|
+
) : Promise.resolve(e < this.options.attempts);
|
|
702
|
+
}
|
|
703
|
+
getDelay(e) {
|
|
704
|
+
return Math.min(
|
|
705
|
+
this.options.maxDelay,
|
|
706
|
+
this.options.baseDelay * 2 ** e
|
|
707
|
+
);
|
|
708
|
+
}
|
|
709
|
+
};
|
|
710
|
+
function Tn(e) {
|
|
711
|
+
if (typeof e == "number")
|
|
712
|
+
return new Ue({
|
|
713
|
+
type: "linear",
|
|
714
|
+
attempts: e,
|
|
715
|
+
delay: 1e3
|
|
716
|
+
});
|
|
717
|
+
switch (e.type) {
|
|
718
|
+
case "linear":
|
|
719
|
+
return new Ue(e);
|
|
720
|
+
case "exponential":
|
|
721
|
+
return new On(e);
|
|
722
|
+
default:
|
|
723
|
+
throw new Error("Invalid retry strategy");
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
var Pn = async (e) => {
|
|
727
|
+
const t = {}, n = async (r) => typeof r == "function" ? await r() : r;
|
|
728
|
+
if (e != null && e.auth) {
|
|
729
|
+
if (e.auth.type === "Bearer") {
|
|
730
|
+
const r = await n(e.auth.token);
|
|
731
|
+
if (!r)
|
|
732
|
+
return t;
|
|
733
|
+
t.authorization = `Bearer ${r}`;
|
|
734
|
+
} else if (e.auth.type === "Basic") {
|
|
735
|
+
const [r, s] = await Promise.all([
|
|
736
|
+
n(e.auth.username),
|
|
737
|
+
n(e.auth.password)
|
|
738
|
+
]);
|
|
739
|
+
if (!r || !s)
|
|
740
|
+
return t;
|
|
741
|
+
t.authorization = `Basic ${btoa(`${r}:${s}`)}`;
|
|
742
|
+
} else if (e.auth.type === "Custom") {
|
|
743
|
+
const [r, s] = await Promise.all([
|
|
744
|
+
n(e.auth.prefix),
|
|
745
|
+
n(e.auth.value)
|
|
746
|
+
]);
|
|
747
|
+
if (!s)
|
|
748
|
+
return t;
|
|
749
|
+
t.authorization = `${r ?? ""} ${s}`;
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
return t;
|
|
753
|
+
}, Ln = /^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;
|
|
754
|
+
function Un(e) {
|
|
755
|
+
const t = e.headers.get("content-type"), n = /* @__PURE__ */ new Set([
|
|
756
|
+
"image/svg",
|
|
757
|
+
"application/xml",
|
|
758
|
+
"application/xhtml",
|
|
759
|
+
"application/html"
|
|
760
|
+
]);
|
|
761
|
+
if (!t)
|
|
762
|
+
return "json";
|
|
763
|
+
const r = t.split(";").shift() || "";
|
|
764
|
+
return Ln.test(r) ? "json" : n.has(r) || r.startsWith("text/") ? "text" : "blob";
|
|
765
|
+
}
|
|
766
|
+
function Nn(e) {
|
|
767
|
+
try {
|
|
768
|
+
return JSON.parse(e), !0;
|
|
769
|
+
} catch {
|
|
770
|
+
return !1;
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
function Ve(e) {
|
|
774
|
+
if (e === void 0)
|
|
775
|
+
return !1;
|
|
776
|
+
const t = typeof e;
|
|
777
|
+
return t === "string" || t === "number" || t === "boolean" || t === null ? !0 : t !== "object" ? !1 : Array.isArray(e) ? !0 : e.buffer ? !1 : e.constructor && e.constructor.name === "Object" || typeof e.toJSON == "function";
|
|
778
|
+
}
|
|
779
|
+
function Ne(e) {
|
|
780
|
+
try {
|
|
781
|
+
return JSON.parse(e);
|
|
782
|
+
} catch {
|
|
783
|
+
return e;
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
function je(e) {
|
|
787
|
+
return typeof e == "function";
|
|
788
|
+
}
|
|
789
|
+
function jn(e) {
|
|
790
|
+
if (e != null && e.customFetchImpl)
|
|
791
|
+
return e.customFetchImpl;
|
|
792
|
+
if (typeof globalThis < "u" && je(globalThis.fetch))
|
|
793
|
+
return globalThis.fetch;
|
|
794
|
+
if (typeof window < "u" && je(window.fetch))
|
|
795
|
+
return window.fetch;
|
|
796
|
+
throw new Error("No fetch implementation found");
|
|
797
|
+
}
|
|
798
|
+
function Je(...e) {
|
|
799
|
+
const t = {};
|
|
800
|
+
for (const n of e)
|
|
801
|
+
if (n)
|
|
802
|
+
if (n instanceof Headers)
|
|
803
|
+
n.forEach((r, s) => {
|
|
804
|
+
t[s] = r;
|
|
805
|
+
});
|
|
806
|
+
else {
|
|
807
|
+
const r = Array.isArray(n) ? n : Object.entries(n);
|
|
808
|
+
for (const [s, i] of r)
|
|
809
|
+
i != null && (t[s] = i);
|
|
810
|
+
}
|
|
811
|
+
return t;
|
|
812
|
+
}
|
|
813
|
+
async function An(e) {
|
|
814
|
+
const t = new Headers(Je(e == null ? void 0 : e.headers, await Pn(e)));
|
|
815
|
+
if (!t.has("content-type")) {
|
|
816
|
+
const n = Cn(e == null ? void 0 : e.body);
|
|
817
|
+
n && t.set("content-type", n);
|
|
818
|
+
}
|
|
819
|
+
return t;
|
|
820
|
+
}
|
|
821
|
+
function Cn(e) {
|
|
822
|
+
return Ve(e) ? "application/json" : null;
|
|
823
|
+
}
|
|
824
|
+
function In(e) {
|
|
825
|
+
const t = e.get("content-type");
|
|
826
|
+
return t ? t.split(";")[0].trim().toLowerCase() : null;
|
|
827
|
+
}
|
|
828
|
+
function qn(e, t) {
|
|
829
|
+
const { body: n } = e;
|
|
830
|
+
return n ? !Ve(n) || typeof n == "string" ? n : In(t) === "application/x-www-form-urlencoded" ? new URLSearchParams(n).toString() : JSON.stringify(n) : null;
|
|
831
|
+
}
|
|
832
|
+
function Fn(e, t) {
|
|
833
|
+
var n;
|
|
834
|
+
if (t != null && t.method)
|
|
835
|
+
return t.method.toUpperCase();
|
|
836
|
+
if (e.startsWith("@")) {
|
|
837
|
+
const r = (n = e.split("@")[1]) == null ? void 0 : n.split("/")[0];
|
|
838
|
+
return Xe.includes(r) ? r.toUpperCase() : t != null && t.body ? "POST" : "GET";
|
|
839
|
+
}
|
|
840
|
+
return t != null && t.body ? "POST" : "GET";
|
|
841
|
+
}
|
|
842
|
+
function zn(e, t) {
|
|
843
|
+
let n;
|
|
844
|
+
return !(e != null && e.signal) && (e != null && e.timeout) && (n = setTimeout(() => t == null ? void 0 : t.abort(), e == null ? void 0 : e.timeout)), {
|
|
845
|
+
abortTimeout: n,
|
|
846
|
+
clearTimeout: () => {
|
|
847
|
+
n && clearTimeout(n);
|
|
848
|
+
}
|
|
849
|
+
};
|
|
850
|
+
}
|
|
851
|
+
var Bn = class Ke extends Error {
|
|
852
|
+
constructor(t, n) {
|
|
853
|
+
super(n || JSON.stringify(t, null, 2)), this.issues = t, Object.setPrototypeOf(this, Ke.prototype);
|
|
854
|
+
}
|
|
855
|
+
};
|
|
856
|
+
async function G(e, t) {
|
|
857
|
+
const n = await e["~standard"].validate(t);
|
|
858
|
+
if (n.issues)
|
|
859
|
+
throw new Bn(n.issues);
|
|
860
|
+
return n.value;
|
|
861
|
+
}
|
|
862
|
+
var Xe = ["get", "post", "put", "patch", "delete"], Mn = (e) => ({
|
|
863
|
+
id: "apply-schema",
|
|
864
|
+
name: "Apply Schema",
|
|
865
|
+
version: "1.0.0",
|
|
866
|
+
async init(t, n) {
|
|
867
|
+
var r, s, i, l;
|
|
868
|
+
const d = ((s = (r = e.plugins) == null ? void 0 : r.find(
|
|
869
|
+
(a) => {
|
|
870
|
+
var u;
|
|
871
|
+
return (u = a.schema) != null && u.config ? t.startsWith(a.schema.config.baseURL || "") || t.startsWith(a.schema.config.prefix || "") : !1;
|
|
872
|
+
}
|
|
873
|
+
)) == null ? void 0 : s.schema) || e.schema;
|
|
874
|
+
if (d) {
|
|
875
|
+
let a = t;
|
|
876
|
+
(i = d.config) != null && i.prefix && a.startsWith(d.config.prefix) && (a = a.replace(d.config.prefix, ""), d.config.baseURL && (t = t.replace(d.config.prefix, d.config.baseURL))), (l = d.config) != null && l.baseURL && a.startsWith(d.config.baseURL) && (a = a.replace(d.config.baseURL, "")), a.startsWith("/") && a.charAt(1) === "@" && (a = a.substring(1));
|
|
877
|
+
const u = d.schema[a];
|
|
878
|
+
if (u) {
|
|
879
|
+
let c = n == null ? void 0 : n.headers;
|
|
880
|
+
if (u.headers && !(n != null && n.disableValidation)) {
|
|
881
|
+
const p = {};
|
|
882
|
+
if (n != null && n.headers) {
|
|
883
|
+
if (n.headers instanceof Headers)
|
|
884
|
+
n.headers.forEach((v, x) => {
|
|
885
|
+
p[x.toLowerCase()] = v;
|
|
886
|
+
});
|
|
887
|
+
else if (typeof n.headers == "object")
|
|
888
|
+
for (const [v, x] of Object.entries(n.headers))
|
|
889
|
+
x != null && (p[v.toLowerCase()] = x);
|
|
890
|
+
}
|
|
891
|
+
const g = await G(
|
|
892
|
+
u.headers,
|
|
893
|
+
p
|
|
894
|
+
), y = {};
|
|
895
|
+
for (const [v, x] of Object.entries(g))
|
|
896
|
+
y[v.toLowerCase()] = x;
|
|
897
|
+
c = y;
|
|
898
|
+
}
|
|
899
|
+
let m = A(U({}, n), {
|
|
900
|
+
method: u.method,
|
|
901
|
+
output: u.output,
|
|
902
|
+
headers: c
|
|
903
|
+
});
|
|
904
|
+
return n != null && n.disableValidation || (m = A(U({}, m), {
|
|
905
|
+
body: u.input ? await G(u.input, n == null ? void 0 : n.body) : n == null ? void 0 : n.body,
|
|
906
|
+
params: u.params ? await G(u.params, n == null ? void 0 : n.params) : n == null ? void 0 : n.params,
|
|
907
|
+
query: u.query ? await G(u.query, n == null ? void 0 : n.query) : n == null ? void 0 : n.query
|
|
908
|
+
})), {
|
|
909
|
+
url: t,
|
|
910
|
+
options: m
|
|
911
|
+
};
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
return {
|
|
915
|
+
url: t,
|
|
916
|
+
options: n
|
|
917
|
+
};
|
|
918
|
+
}
|
|
919
|
+
}), Dn = (e) => {
|
|
920
|
+
async function t(n, r) {
|
|
921
|
+
const s = A(U(U({}, e), r), {
|
|
922
|
+
headers: Je(e == null ? void 0 : e.headers, r == null ? void 0 : r.headers),
|
|
923
|
+
plugins: [...(e == null ? void 0 : e.plugins) || [], Mn(e || {}), ...(r == null ? void 0 : r.plugins) || []]
|
|
924
|
+
});
|
|
925
|
+
if (e != null && e.catchAllError)
|
|
926
|
+
try {
|
|
927
|
+
return await xe(n, s);
|
|
928
|
+
} catch (i) {
|
|
929
|
+
return {
|
|
930
|
+
data: null,
|
|
931
|
+
error: {
|
|
932
|
+
status: 500,
|
|
933
|
+
statusText: "Fetch Error",
|
|
934
|
+
message: "Fetch related error. Captured by catchAllError option. See error property for more details.",
|
|
935
|
+
error: i
|
|
936
|
+
}
|
|
937
|
+
};
|
|
938
|
+
}
|
|
939
|
+
return await xe(n, s);
|
|
940
|
+
}
|
|
941
|
+
return t;
|
|
942
|
+
}, Hn = (e) => e === "." || e === "..";
|
|
943
|
+
function Wn(e, t) {
|
|
944
|
+
let n = e;
|
|
945
|
+
for (const [r, s] of t)
|
|
946
|
+
n = n.replace(r, s);
|
|
947
|
+
if (Hn(n))
|
|
948
|
+
throw new TypeError("Path parameters cannot be reserved path segments");
|
|
949
|
+
return encodeURIComponent(n);
|
|
950
|
+
}
|
|
951
|
+
function $n(e, t) {
|
|
952
|
+
const { baseURL: n, params: r, query: s } = t || {
|
|
953
|
+
query: {},
|
|
954
|
+
params: {},
|
|
955
|
+
baseURL: ""
|
|
956
|
+
};
|
|
957
|
+
let i = e.startsWith("http") ? e.split("/").slice(0, 3).join("/") : n || "";
|
|
958
|
+
if (e.startsWith("@")) {
|
|
959
|
+
const p = e.toString().split("@")[1].split("/")[0];
|
|
960
|
+
Xe.includes(p) && (e = e.replace(`@${p}/`, "/"));
|
|
961
|
+
}
|
|
962
|
+
i.endsWith("/") || (i += "/");
|
|
963
|
+
let [l, d] = e.replace(i, "").split("?");
|
|
964
|
+
const a = new URLSearchParams(d);
|
|
965
|
+
for (const [p, g] of Object.entries(s || {})) {
|
|
966
|
+
if (g == null) continue;
|
|
967
|
+
let y;
|
|
968
|
+
if (typeof g == "string")
|
|
969
|
+
y = g;
|
|
970
|
+
else if (Array.isArray(g)) {
|
|
971
|
+
for (const v of g)
|
|
972
|
+
a.append(p, v);
|
|
973
|
+
continue;
|
|
974
|
+
} else
|
|
975
|
+
y = JSON.stringify(g);
|
|
976
|
+
a.set(p, y);
|
|
977
|
+
}
|
|
978
|
+
const u = /* @__PURE__ */ new Map();
|
|
979
|
+
if (r)
|
|
980
|
+
if (Array.isArray(r)) {
|
|
981
|
+
const p = l.split("/").filter((g) => g.startsWith(":"));
|
|
982
|
+
for (const [g, y] of p.entries()) {
|
|
983
|
+
const v = r[g];
|
|
984
|
+
u.set(y, String(v));
|
|
985
|
+
}
|
|
986
|
+
} else
|
|
987
|
+
for (const [p, g] of Object.entries(r))
|
|
988
|
+
u.set(`:${p}`, String(g));
|
|
989
|
+
l = l.split("/").map((p) => Wn(p, u)).join("/"), l = l.replace(/^\/+/, "");
|
|
990
|
+
let c = a.toString();
|
|
991
|
+
return c = c.length > 0 ? `?${c}`.replace(/\+/g, "%20") : "", i.startsWith("http") ? new URL(`${l}${c}`, i) : `${i}${l}${c}`;
|
|
992
|
+
}
|
|
993
|
+
var xe = async (e, t) => {
|
|
994
|
+
var n, r, s, i, l, d, a, u;
|
|
995
|
+
const {
|
|
996
|
+
hooks: c,
|
|
997
|
+
url: m,
|
|
998
|
+
options: p
|
|
999
|
+
} = await _n(e, t), g = jn(p), y = new AbortController(), v = (n = p.signal) != null ? n : y.signal, x = $n(m, p), w = await An(p), S = qn(p, w), _ = Fn(m, p), b = A(U({}, p), {
|
|
1000
|
+
url: x,
|
|
1001
|
+
headers: w,
|
|
1002
|
+
body: S,
|
|
1003
|
+
method: _,
|
|
1004
|
+
signal: v
|
|
1005
|
+
});
|
|
1006
|
+
for (const P of c.onRequest)
|
|
1007
|
+
if (P) {
|
|
1008
|
+
const h = await P(b);
|
|
1009
|
+
typeof h == "object" && h !== null && Object.assign(b, h);
|
|
1010
|
+
}
|
|
1011
|
+
("pipeTo" in b && typeof b.pipeTo == "function" || typeof ((r = t == null ? void 0 : t.body) == null ? void 0 : r.pipe) == "function") && ("duplex" in b || (b.duplex = "half"));
|
|
1012
|
+
const { clearTimeout: T } = zn(p, y);
|
|
1013
|
+
let f = await g(b.url, b);
|
|
1014
|
+
T();
|
|
1015
|
+
const k = {
|
|
1016
|
+
response: f,
|
|
1017
|
+
request: b
|
|
1018
|
+
};
|
|
1019
|
+
for (const P of c.onResponse)
|
|
1020
|
+
if (P) {
|
|
1021
|
+
const h = await P(A(U({}, k), {
|
|
1022
|
+
response: (s = t == null ? void 0 : t.hookOptions) != null && s.cloneResponse ? f.clone() : f
|
|
1023
|
+
}));
|
|
1024
|
+
h instanceof Response ? f = h : typeof h == "object" && h !== null && (f = h.response);
|
|
1025
|
+
}
|
|
1026
|
+
if (f.ok) {
|
|
1027
|
+
if (!(b.method !== "HEAD"))
|
|
1028
|
+
return {
|
|
1029
|
+
data: "",
|
|
1030
|
+
error: null
|
|
1031
|
+
};
|
|
1032
|
+
const h = Un(f), L = {
|
|
1033
|
+
data: null,
|
|
1034
|
+
response: f,
|
|
1035
|
+
request: b
|
|
1036
|
+
};
|
|
1037
|
+
if (h === "json" || h === "text") {
|
|
1038
|
+
const I = await f.text(), Ye = (i = b.jsonParser) != null ? i : Ne;
|
|
1039
|
+
L.data = await Ye(I);
|
|
1040
|
+
} else
|
|
1041
|
+
L.data = await f[h]();
|
|
1042
|
+
b != null && b.output && b.output && !b.disableValidation && (L.data = await G(
|
|
1043
|
+
b.output,
|
|
1044
|
+
L.data
|
|
1045
|
+
));
|
|
1046
|
+
for (const I of c.onSuccess)
|
|
1047
|
+
I && await I(A(U({}, L), {
|
|
1048
|
+
response: (l = t == null ? void 0 : t.hookOptions) != null && l.cloneResponse ? f.clone() : f
|
|
1049
|
+
}));
|
|
1050
|
+
return t != null && t.throw ? L.data : {
|
|
1051
|
+
data: L.data,
|
|
1052
|
+
error: null
|
|
1053
|
+
};
|
|
1054
|
+
}
|
|
1055
|
+
const j = (d = t == null ? void 0 : t.jsonParser) != null ? d : Ne, C = await f.text(), H = Nn(C), M = H ? await j(C) : null, K = {
|
|
1056
|
+
response: f,
|
|
1057
|
+
responseText: C,
|
|
1058
|
+
request: b,
|
|
1059
|
+
error: A(U({}, M), {
|
|
1060
|
+
status: f.status,
|
|
1061
|
+
statusText: f.statusText
|
|
1062
|
+
})
|
|
1063
|
+
};
|
|
1064
|
+
for (const P of c.onError)
|
|
1065
|
+
P && await P(A(U({}, K), {
|
|
1066
|
+
response: (a = t == null ? void 0 : t.hookOptions) != null && a.cloneResponse ? f.clone() : f
|
|
1067
|
+
}));
|
|
1068
|
+
if (t != null && t.retry) {
|
|
1069
|
+
const P = Tn(t.retry), h = (u = t.retryAttempt) != null ? u : 0;
|
|
1070
|
+
if (await P.shouldAttemptRetry(h, f)) {
|
|
1071
|
+
for (const I of c.onRetry)
|
|
1072
|
+
I && await I(k);
|
|
1073
|
+
const L = P.getDelay(h);
|
|
1074
|
+
return await new Promise((I) => setTimeout(I, L)), await xe(e, A(U({}, t), {
|
|
1075
|
+
retryAttempt: h + 1
|
|
1076
|
+
}));
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
if (t != null && t.throw)
|
|
1080
|
+
throw new Rn(
|
|
1081
|
+
f.status,
|
|
1082
|
+
f.statusText,
|
|
1083
|
+
H ? M : C
|
|
1084
|
+
);
|
|
1085
|
+
return {
|
|
1086
|
+
data: null,
|
|
1087
|
+
error: A(U({}, M), {
|
|
1088
|
+
status: f.status,
|
|
1089
|
+
statusText: f.statusText
|
|
1090
|
+
})
|
|
1091
|
+
};
|
|
1092
|
+
};
|
|
1093
|
+
const Gn = (e) => {
|
|
1094
|
+
if (typeof process > "u") return;
|
|
1095
|
+
const t = e ?? "/api/auth";
|
|
1096
|
+
if (process.env.NEXT_PUBLIC_AUTH_URL) return process.env.NEXT_PUBLIC_AUTH_URL;
|
|
1097
|
+
if (typeof window > "u") {
|
|
1098
|
+
if (process.env.NEXTAUTH_URL) try {
|
|
1099
|
+
return process.env.NEXTAUTH_URL;
|
|
1100
|
+
} catch {
|
|
1101
|
+
}
|
|
1102
|
+
if (process.env.VERCEL_URL) try {
|
|
1103
|
+
const n = process.env.VERCEL_URL.startsWith("http") ? "" : "https://";
|
|
1104
|
+
return `${new URL(`${n}${process.env.VERCEL_URL}`).origin}${t}`;
|
|
1105
|
+
} catch {
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
}, Vn = (e, t) => {
|
|
1109
|
+
var k, j, C, H, M, K, P;
|
|
1110
|
+
const n = "credentials" in Request.prototype, r = zt(e == null ? void 0 : e.baseURL, e == null ? void 0 : e.basePath) ?? Gn(e == null ? void 0 : e.basePath) ?? "/api/auth", s = ((k = e == null ? void 0 : e.plugins) == null ? void 0 : k.flatMap((h) => h.fetchPlugins).filter((h) => h !== void 0)) || [], i = {
|
|
1111
|
+
id: "lifecycle-hooks",
|
|
1112
|
+
name: "lifecycle-hooks",
|
|
1113
|
+
hooks: {
|
|
1114
|
+
onSuccess: (j = e == null ? void 0 : e.fetchOptions) == null ? void 0 : j.onSuccess,
|
|
1115
|
+
onError: (C = e == null ? void 0 : e.fetchOptions) == null ? void 0 : C.onError,
|
|
1116
|
+
onRequest: (H = e == null ? void 0 : e.fetchOptions) == null ? void 0 : H.onRequest,
|
|
1117
|
+
onResponse: (M = e == null ? void 0 : e.fetchOptions) == null ? void 0 : M.onResponse
|
|
1118
|
+
}
|
|
1119
|
+
}, { onSuccess: l, onError: d, onRequest: a, onResponse: u, ...c } = (e == null ? void 0 : e.fetchOptions) || {}, m = Dn({
|
|
1120
|
+
baseURL: r,
|
|
1121
|
+
...n ? { credentials: "include" } : {},
|
|
1122
|
+
method: "GET",
|
|
1123
|
+
jsonParser(h) {
|
|
1124
|
+
return h ? Gt(h, { strict: !1 }) : null;
|
|
1125
|
+
},
|
|
1126
|
+
customFetchImpl: fetch,
|
|
1127
|
+
...c,
|
|
1128
|
+
plugins: [
|
|
1129
|
+
i,
|
|
1130
|
+
...c.plugins || [],
|
|
1131
|
+
...e != null && e.disableDefaultFetchPlugins ? [] : [Kt],
|
|
1132
|
+
...s
|
|
1133
|
+
]
|
|
1134
|
+
}), { $sessionSignal: p, session: g, broadcastSessionUpdate: y } = xn(m, e);
|
|
1135
|
+
let v = !1;
|
|
1136
|
+
const x = (h) => {
|
|
1137
|
+
v || h === null || (v = !0, pn(g, h));
|
|
1138
|
+
}, w = (e == null ? void 0 : e.plugins) || [];
|
|
1139
|
+
let S = {};
|
|
1140
|
+
const _ = {
|
|
1141
|
+
$sessionSignal: p,
|
|
1142
|
+
session: g
|
|
1143
|
+
}, b = {
|
|
1144
|
+
"/sign-out": "POST",
|
|
1145
|
+
"/revoke-sessions": "POST",
|
|
1146
|
+
"/revoke-other-sessions": "POST",
|
|
1147
|
+
"/delete-user": "POST"
|
|
1148
|
+
}, T = [{
|
|
1149
|
+
signal: "$sessionSignal",
|
|
1150
|
+
matcher(h) {
|
|
1151
|
+
return h === "/sign-out" || h === "/update-user" || h === "/update-session" || h === "/sign-up/email" || h === "/sign-in/email" || h === "/delete-user" || h === "/verify-email" || h === "/revoke-sessions" || h === "/revoke-session" || h === "/revoke-other-sessions" || h === "/change-email" || h === "/change-password";
|
|
1152
|
+
},
|
|
1153
|
+
callback(h) {
|
|
1154
|
+
h === "/sign-out" ? y("signout") : (h === "/update-user" || h === "/update-session") && y("updateUser");
|
|
1155
|
+
}
|
|
1156
|
+
}];
|
|
1157
|
+
for (const h of w)
|
|
1158
|
+
h.getAtoms && Object.assign(_, (K = h.getAtoms) == null ? void 0 : K.call(h, m)), h.pathMethods && Object.assign(b, h.pathMethods), h.atomListeners && T.push(...h.atomListeners);
|
|
1159
|
+
const f = {
|
|
1160
|
+
notify: (h) => {
|
|
1161
|
+
_[h].set(!_[h].get());
|
|
1162
|
+
},
|
|
1163
|
+
listen: (h, L) => {
|
|
1164
|
+
_[h].subscribe(L);
|
|
1165
|
+
},
|
|
1166
|
+
atoms: _
|
|
1167
|
+
};
|
|
1168
|
+
for (const h of w) h.getActions && (S = vn(((P = h.getActions) == null ? void 0 : P.call(h, m, f, e)) ?? {}, S));
|
|
1169
|
+
return {
|
|
1170
|
+
get baseURL() {
|
|
1171
|
+
return r;
|
|
1172
|
+
},
|
|
1173
|
+
pluginsActions: S,
|
|
1174
|
+
pluginsAtoms: _,
|
|
1175
|
+
pluginPathMethods: b,
|
|
1176
|
+
atomListeners: T,
|
|
1177
|
+
hydrateSession: x,
|
|
1178
|
+
$sessionSignal: p,
|
|
1179
|
+
$fetch: m,
|
|
1180
|
+
$store: f
|
|
1181
|
+
};
|
|
1182
|
+
};
|
|
1183
|
+
function Jn(e) {
|
|
1184
|
+
return typeof e == "object" && e !== null && "get" in e && typeof e.get == "function" && "lc" in e && typeof e.lc == "number";
|
|
1185
|
+
}
|
|
1186
|
+
function Kn(e) {
|
|
1187
|
+
return e.charAt(0).toUpperCase() + e.slice(1);
|
|
1188
|
+
}
|
|
1189
|
+
const Xn = new RegExp("[\\p{Ll}\\d]+|\\p{Lu}+(?!\\p{Ll})|\\p{Lu}[\\p{Ll}\\d]+|\\p{Lo}+", "gu"), Yn = /['\u2019]/g;
|
|
1190
|
+
function Qn(e) {
|
|
1191
|
+
return e.replace(Yn, "").match(Xn) ?? [];
|
|
1192
|
+
}
|
|
1193
|
+
function Zn(e) {
|
|
1194
|
+
return Qn(e).map((t) => t.toLowerCase()).join("-");
|
|
1195
|
+
}
|
|
1196
|
+
function er(e, t, n) {
|
|
1197
|
+
const r = t[e], { fetchOptions: s, query: i, ...l } = n || {};
|
|
1198
|
+
return r || (s != null && s.method ? s.method : l && Object.keys(l).length > 0 ? "POST" : "GET");
|
|
1199
|
+
}
|
|
1200
|
+
function tr(e, t, n, r, s) {
|
|
1201
|
+
function i(l = []) {
|
|
1202
|
+
return new Proxy(function() {
|
|
1203
|
+
}, {
|
|
1204
|
+
get(d, a) {
|
|
1205
|
+
if (typeof a != "string" || a === "then" || a === "catch" || a === "finally") return;
|
|
1206
|
+
const u = [...l, a];
|
|
1207
|
+
let c = e;
|
|
1208
|
+
for (const m of u) if (c && typeof c == "object" && m in c) c = c[m];
|
|
1209
|
+
else {
|
|
1210
|
+
c = void 0;
|
|
1211
|
+
break;
|
|
1212
|
+
}
|
|
1213
|
+
return typeof c == "function" || Jn(c) ? c : i(u);
|
|
1214
|
+
},
|
|
1215
|
+
apply: async (d, a, u) => {
|
|
1216
|
+
const c = "/" + l.map(Zn).join("/"), m = u[0] || {}, p = u[1] || {}, { query: g, fetchOptions: y, ...v } = m, x = {
|
|
1217
|
+
...p,
|
|
1218
|
+
...y
|
|
1219
|
+
}, w = er(c, n, m);
|
|
1220
|
+
return await t(c, {
|
|
1221
|
+
...x,
|
|
1222
|
+
body: w === "GET" ? void 0 : {
|
|
1223
|
+
...v,
|
|
1224
|
+
...(x == null ? void 0 : x.body) || {}
|
|
1225
|
+
},
|
|
1226
|
+
query: g || (x == null ? void 0 : x.query),
|
|
1227
|
+
method: w,
|
|
1228
|
+
async onSuccess(S) {
|
|
1229
|
+
var T, f;
|
|
1230
|
+
if (await ((T = x == null ? void 0 : x.onSuccess) == null ? void 0 : T.call(x, S)), !s || x.disableSignal) return;
|
|
1231
|
+
const _ = s.filter((k) => k.matcher(c));
|
|
1232
|
+
if (!_.length) return;
|
|
1233
|
+
const b = /* @__PURE__ */ new Set();
|
|
1234
|
+
for (const k of _) {
|
|
1235
|
+
const j = r[k.signal];
|
|
1236
|
+
if (!j) return;
|
|
1237
|
+
if (b.has(k.signal)) continue;
|
|
1238
|
+
b.add(k.signal);
|
|
1239
|
+
const C = j.get();
|
|
1240
|
+
setTimeout(() => {
|
|
1241
|
+
j.set(!C);
|
|
1242
|
+
}, 10), (f = k.callback) == null || f.call(k, c);
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
});
|
|
1246
|
+
}
|
|
1247
|
+
});
|
|
1248
|
+
}
|
|
1249
|
+
return i();
|
|
1250
|
+
}
|
|
1251
|
+
function nr(e, t = {}) {
|
|
1252
|
+
const n = et(e.get()), { keys: r, deps: s = [e, r] } = t, i = tt((d) => {
|
|
1253
|
+
const a = (u) => {
|
|
1254
|
+
n.current !== u && (n.current = u, d());
|
|
1255
|
+
};
|
|
1256
|
+
return a(e.value), r != null && r.length ? rn(e, r, a) : e.listen(a);
|
|
1257
|
+
}, s), l = () => n.current;
|
|
1258
|
+
return nt(i, l, l);
|
|
1259
|
+
}
|
|
1260
|
+
function rr(e) {
|
|
1261
|
+
return `use${Kn(e)}`;
|
|
1262
|
+
}
|
|
1263
|
+
function sr(e) {
|
|
1264
|
+
const { pluginPathMethods: t, pluginsActions: n, pluginsAtoms: r, hydrateSession: s, $fetch: i, $store: l, atomListeners: d } = Vn(e), a = {};
|
|
1265
|
+
for (const [u, c] of Object.entries(r)) a[rr(u)] = () => nr(c);
|
|
1266
|
+
return tr({
|
|
1267
|
+
...n,
|
|
1268
|
+
...a,
|
|
1269
|
+
hydrateSession: s,
|
|
1270
|
+
$fetch: i,
|
|
1271
|
+
$store: l
|
|
1272
|
+
}, i, t, r, d);
|
|
1273
|
+
}
|
|
1274
|
+
var ir = "1.7.3";
|
|
1275
|
+
const ar = ir, or = () => ({
|
|
1276
|
+
id: "magic-link",
|
|
1277
|
+
version: ar,
|
|
1278
|
+
$InferServerPlugin: {}
|
|
1279
|
+
});
|
|
1280
|
+
let Ae = null;
|
|
1281
|
+
function B() {
|
|
1282
|
+
return Ae ?? (Ae = sr({
|
|
1283
|
+
baseURL: st(),
|
|
1284
|
+
plugins: [or()]
|
|
1285
|
+
})), Ae;
|
|
1286
|
+
}
|
|
1287
|
+
function lr() {
|
|
1288
|
+
const [e] = Ce(), [t, n] = E(null), [r, s] = E(null), [i, l] = E(!1), [d, a] = E(null), u = e.get("token") ? e.get("email") ?? "" : "", [c, m] = E(u || (e.get("email") ?? "")), [p, g] = E(""), [y, v] = E(""), [x, w] = E("signin");
|
|
1289
|
+
J(() => {
|
|
1290
|
+
it().then((f) => a(f.github)).catch(() => a(!1));
|
|
1291
|
+
}, []);
|
|
1292
|
+
const S = window.location.href;
|
|
1293
|
+
async function _() {
|
|
1294
|
+
l(!0), n(null);
|
|
1295
|
+
try {
|
|
1296
|
+
await B().signIn.social({
|
|
1297
|
+
provider: "github",
|
|
1298
|
+
callbackURL: S
|
|
1299
|
+
});
|
|
1300
|
+
} catch (f) {
|
|
1301
|
+
n(f instanceof Error ? f.message : "GitHub sign-in failed"), l(!1);
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
async function b() {
|
|
1305
|
+
l(!0), n(null), s(null);
|
|
1306
|
+
const f = await B().signIn.magicLink({
|
|
1307
|
+
email: c,
|
|
1308
|
+
callbackURL: S
|
|
1309
|
+
});
|
|
1310
|
+
if (l(!1), f.error) {
|
|
1311
|
+
n(f.error.message ?? "Could not send the magic link");
|
|
1312
|
+
return;
|
|
1313
|
+
}
|
|
1314
|
+
s("Check your email for a sign-in link.");
|
|
1315
|
+
}
|
|
1316
|
+
async function T(f) {
|
|
1317
|
+
f.preventDefault(), l(!0), n(null);
|
|
1318
|
+
const k = x === "signup" ? await B().signUp.email({
|
|
1319
|
+
email: c,
|
|
1320
|
+
password: p,
|
|
1321
|
+
name: y,
|
|
1322
|
+
callbackURL: S
|
|
1323
|
+
}) : await B().signIn.email({
|
|
1324
|
+
email: c,
|
|
1325
|
+
password: p,
|
|
1326
|
+
callbackURL: S
|
|
1327
|
+
});
|
|
1328
|
+
if (k.error) {
|
|
1329
|
+
n(k.error.message ?? "Sign-in failed"), l(!1);
|
|
1330
|
+
return;
|
|
1331
|
+
}
|
|
1332
|
+
window.location.assign(S);
|
|
1333
|
+
}
|
|
1334
|
+
return /* @__PURE__ */ R("main", { ...ot(lt, ur.main), children: [
|
|
1335
|
+
/* @__PURE__ */ o("div", { className: "x10l6tqk x10a8y8t x47corl x87ps6o xlxt4rd", "aria-hidden": !0 }),
|
|
1336
|
+
/* @__PURE__ */ R("div", { className: "x1n2onr6 x78zum5 xh8yej3 xxc7z9f xdt5ytf x6s0dn4 x2b8uid", children: [
|
|
1337
|
+
/* @__PURE__ */ o("div", { className: "xrvj5dj x1ku5rj1 x1useyqa xsdox4t x1y5o9j5 x1n0nidx", children: /* @__PURE__ */ o(cr, {}) }),
|
|
1338
|
+
/* @__PURE__ */ o("h1", { className: "x1ghz6dp xqjzbou xneq65o x1s688f x1b4dsll x1u7k74 x1w2vvpw", children: u ? "Join this workspace" : "Welcome back" }),
|
|
1339
|
+
/* @__PURE__ */ o("div", { className: "x1g7u8ds", children: /* @__PURE__ */ o(O, { tone: "muted", children: u ? `Sign in as ${u}. A password or GitHub stays on this page. A magic link sends one more email.` : "Sign in with email or GitHub." }) }),
|
|
1340
|
+
/* @__PURE__ */ R("div", { className: "x78zum5 xh8yej3 x1tfhste xdt5ytf x6s0dn4 x11cgr9k", children: [
|
|
1341
|
+
t ? /* @__PURE__ */ o(O, { tone: "danger", children: t }) : null,
|
|
1342
|
+
r ? /* @__PURE__ */ o(O, { tone: "muted", children: r }) : null,
|
|
1343
|
+
/* @__PURE__ */ R("form", { onSubmit: (f) => void T(f), className: "x78zum5 xh8yej3 xdt5ytf x1ndbd79", children: [
|
|
1344
|
+
x === "signup" ? /* @__PURE__ */ o("input", { required: !0, value: y, onChange: (f) => v(f.target.value), placeholder: "Name", autoComplete: "name", className: "x9f619 xh8yej3 x1gg8mnh x173sf5p xmkeg23 x1y0btm7 x198m1os x4pepcl xf6xdpg x17ia0ru x1l3a84d" }) : null,
|
|
1345
|
+
/* @__PURE__ */ o("input", { required: !0, type: "email", value: c, onChange: (f) => m(f.target.value), placeholder: "Email", autoComplete: "email", readOnly: !!u, ...{
|
|
1346
|
+
0: {
|
|
1347
|
+
className: "x9f619 xh8yej3 x1gg8mnh x173sf5p xmkeg23 x1y0btm7 x198m1os x4pepcl xf6xdpg x17ia0ru x1l3a84d"
|
|
1348
|
+
},
|
|
1349
|
+
1: {
|
|
1350
|
+
className: "x9f619 xh8yej3 x1gg8mnh x173sf5p xmkeg23 x1y0btm7 x198m1os x4pepcl xf6xdpg x1l3a84d x10jjolp"
|
|
1351
|
+
}
|
|
1352
|
+
}[!!u << 0] }),
|
|
1353
|
+
/* @__PURE__ */ o("input", { required: !0, type: "password", value: p, onChange: (f) => g(f.target.value), placeholder: "Password", autoComplete: x === "signup" ? "new-password" : "current-password", className: "x9f619 xh8yej3 x1gg8mnh x173sf5p xmkeg23 x1y0btm7 x198m1os x4pepcl xf6xdpg x17ia0ru x1l3a84d" }),
|
|
1354
|
+
/* @__PURE__ */ o("button", { type: "submit", disabled: i, ...{
|
|
1355
|
+
0: {
|
|
1356
|
+
className: "x3nfvp2 x9f619 xh8yej3 x1gg8mnh x6s0dn4 xl56j7k x3smv4v x161b3w3 xc342km x1e6avla xj4hn0o x1wt99x4 x1l3a84d xk50ysn x1u7k74 xggy1nq xr1c510 xx6bhzk xwji4o3 xq3txz7 xd3so5o x12w9bfk xb93eig"
|
|
1357
|
+
},
|
|
1358
|
+
1: {
|
|
1359
|
+
className: "x3nfvp2 x9f619 xh8yej3 x1gg8mnh x6s0dn4 xl56j7k x3smv4v x161b3w3 xc342km x1e6avla xj4hn0o x1wt99x4 x1l3a84d xk50ysn x1u7k74 xggy1nq xr1c510 xx6bhzk xwji4o3 xq3txz7 xd3so5o x12w9bfk xb93eig xwq05k6 x1h6gzvc x47corl"
|
|
1360
|
+
}
|
|
1361
|
+
}[!!i << 0], children: x === "signup" ? "Create account" : "Sign in" })
|
|
1362
|
+
] }),
|
|
1363
|
+
/* @__PURE__ */ o("button", { type: "button", disabled: i || !c, onClick: () => void b(), ...{
|
|
1364
|
+
0: {
|
|
1365
|
+
className: "x3nfvp2 x9f619 xh8yej3 x1gg8mnh x6s0dn4 xl56j7k xc342km x1e6avla xjbqb8w x1n0nidx x1vrk1b5 x1ypdohk"
|
|
1366
|
+
},
|
|
1367
|
+
1: {
|
|
1368
|
+
className: "x3nfvp2 x9f619 xh8yej3 x1gg8mnh x6s0dn4 xl56j7k xc342km x1e6avla xjbqb8w x1n0nidx x1vrk1b5 xwq05k6 x1h6gzvc x47corl"
|
|
1369
|
+
}
|
|
1370
|
+
}[!!(i || !c) << 0], children: "Email me a magic link" }),
|
|
1371
|
+
/* @__PURE__ */ o("button", { type: "button", disabled: i, onClick: () => w(x === "signup" ? "signin" : "signup"), className: "x3nfvp2 x9f619 xh8yej3 x1gg8mnh x6s0dn4 xl56j7k xc342km x1e6avla xjbqb8w x1n0nidx x1vrk1b5 x1ypdohk", children: x === "signup" ? "I already have an account" : "Create an account" }),
|
|
1372
|
+
/* @__PURE__ */ R("button", { type: "button", disabled: i || d !== !0, onClick: () => void _(), ...{
|
|
1373
|
+
0: {
|
|
1374
|
+
className: "x3nfvp2 x9f619 xh8yej3 x1gg8mnh x6s0dn4 xl56j7k x3smv4v x161b3w3 xc342km x1e6avla xj4hn0o x1wt99x4 x1l3a84d xk50ysn x1u7k74 xggy1nq xr1c510 xx6bhzk xwji4o3 xq3txz7 xd3so5o x12w9bfk xb93eig"
|
|
1375
|
+
},
|
|
1376
|
+
1: {
|
|
1377
|
+
className: "x3nfvp2 x9f619 xh8yej3 x1gg8mnh x6s0dn4 xl56j7k x3smv4v x161b3w3 xc342km x1e6avla xj4hn0o x1wt99x4 x1l3a84d xk50ysn x1u7k74 xggy1nq xr1c510 xx6bhzk xwji4o3 xq3txz7 xd3so5o x12w9bfk xb93eig xwq05k6 x1h6gzvc x47corl"
|
|
1378
|
+
}
|
|
1379
|
+
}[!!(i || d !== !0) << 0], children: [
|
|
1380
|
+
/* @__PURE__ */ o(at, { size: 18 }),
|
|
1381
|
+
"Continue with GitHub"
|
|
1382
|
+
] })
|
|
1383
|
+
] })
|
|
1384
|
+
] })
|
|
1385
|
+
] });
|
|
1386
|
+
}
|
|
1387
|
+
function cr() {
|
|
1388
|
+
return /* @__PURE__ */ R("svg", { width: "48", height: "48", viewBox: "0 0 48 48", fill: "none", "aria-hidden": !0, children: [
|
|
1389
|
+
/* @__PURE__ */ o("circle", { cx: "24", cy: "24", r: "18.25", stroke: "currentColor", strokeWidth: "1.25", opacity: "0.28" }),
|
|
1390
|
+
/* @__PURE__ */ o("circle", { cx: "24", cy: "24", r: "11.25", stroke: "currentColor", strokeWidth: "1.25", opacity: "0.55" }),
|
|
1391
|
+
/* @__PURE__ */ o("circle", { cx: "24", cy: "24", r: "4", fill: "currentColor" })
|
|
1392
|
+
] });
|
|
1393
|
+
}
|
|
1394
|
+
const ur = {
|
|
1395
|
+
main: {
|
|
1396
|
+
kVAEAm: "x1n2onr6",
|
|
1397
|
+
k1xSpc: "x78zum5",
|
|
1398
|
+
kVQacm: "xb3r6kr",
|
|
1399
|
+
kB7OPa: "x9f619",
|
|
1400
|
+
kAzted: "x1ov3xa9",
|
|
1401
|
+
kGNEyG: "x6s0dn4",
|
|
1402
|
+
kjj79g: "xl56j7k",
|
|
1403
|
+
kg3NbH: "xm8shrt",
|
|
1404
|
+
kLKAdn: "x1dmhkuj",
|
|
1405
|
+
kGO01o: "xwlwngp",
|
|
1406
|
+
kWkggS: "xemx7gx",
|
|
1407
|
+
kMwMTN: "xqjzbou",
|
|
1408
|
+
$$css: !0
|
|
1409
|
+
}
|
|
1410
|
+
};
|
|
1411
|
+
function dr() {
|
|
1412
|
+
var s;
|
|
1413
|
+
const { userId: e } = Ie(), t = qe(), n = Fe(e), r = ct(n, ((s = t.control) == null ? void 0 : s.workspaces) ?? []);
|
|
1414
|
+
return r === "/workspaces" && n && ut(e), /* @__PURE__ */ o(ze, { to: r, replace: !0 });
|
|
1415
|
+
}
|
|
1416
|
+
function fr({
|
|
1417
|
+
to: e,
|
|
1418
|
+
title: t,
|
|
1419
|
+
meta: n,
|
|
1420
|
+
trailing: r
|
|
1421
|
+
}) {
|
|
1422
|
+
return /* @__PURE__ */ R(dt, { to: e, className: "x78zum5 x6s0dn4 x1qughib x11cgr9k x21xpn4 x173sf5p x15jjofa x1hl2dhg xqjzbou xso031l x1q0q8m5 x4b2zrn x1t1lzn6 x1xcxyqb", children: [
|
|
1423
|
+
/* @__PURE__ */ R("span", { className: "x78zum5 xeuugli xdt5ytf x195vfkc", children: [
|
|
1424
|
+
/* @__PURE__ */ o("span", { className: "x17tv04q xk50ysn", children: t }),
|
|
1425
|
+
n ? /* @__PURE__ */ o("span", { className: "x1vrk1b5 x111yfic", children: n }) : null
|
|
1426
|
+
] }),
|
|
1427
|
+
r ? /* @__PURE__ */ o("span", { className: "x2lah0s x1vrk1b5 x111yfic", children: r }) : null
|
|
1428
|
+
] });
|
|
1429
|
+
}
|
|
1430
|
+
function hr({
|
|
1431
|
+
children: e
|
|
1432
|
+
}) {
|
|
1433
|
+
return /* @__PURE__ */ o("div", { className: "x78zum5 xdt5ytf xmkeg23 x1y0btm7 x1j0qoeq x13oidi x1hb2obb xb3r6kr", children: e });
|
|
1434
|
+
}
|
|
1435
|
+
function pr() {
|
|
1436
|
+
var t;
|
|
1437
|
+
const e = ((t = qe().control) == null ? void 0 : t.workspaces) ?? [];
|
|
1438
|
+
return /* @__PURE__ */ R(ae, { centered: !0, children: [
|
|
1439
|
+
/* @__PURE__ */ o(
|
|
1440
|
+
V,
|
|
1441
|
+
{
|
|
1442
|
+
title: "Workspaces",
|
|
1443
|
+
description: "Each workspace is a site and a team.",
|
|
1444
|
+
action: /* @__PURE__ */ o(Be, { to: "/workspaces/new", children: "New workspace" })
|
|
1445
|
+
}
|
|
1446
|
+
),
|
|
1447
|
+
e.length === 0 ? /* @__PURE__ */ o(O, { tone: "muted", children: "No workspaces yet." }) : /* @__PURE__ */ o(hr, { children: e.map((n) => /* @__PURE__ */ o(
|
|
1448
|
+
fr,
|
|
1449
|
+
{
|
|
1450
|
+
to: ft(n.slug),
|
|
1451
|
+
title: n.name,
|
|
1452
|
+
meta: n.role
|
|
1453
|
+
},
|
|
1454
|
+
n.id
|
|
1455
|
+
)) })
|
|
1456
|
+
] });
|
|
1457
|
+
}
|
|
1458
|
+
function gr() {
|
|
1459
|
+
const e = Me(), [t, n] = E(""), [r, s] = E(null), [i, l] = E(!1);
|
|
1460
|
+
async function d(a) {
|
|
1461
|
+
a.preventDefault(), l(!0), s(null);
|
|
1462
|
+
try {
|
|
1463
|
+
const { workspace: u } = await pt(t), c = z.getState().control;
|
|
1464
|
+
c && z.applyControl({
|
|
1465
|
+
...c,
|
|
1466
|
+
workspaces: [
|
|
1467
|
+
...c.workspaces,
|
|
1468
|
+
{
|
|
1469
|
+
id: u.id,
|
|
1470
|
+
name: u.name,
|
|
1471
|
+
slug: u.slug,
|
|
1472
|
+
role: u.role
|
|
1473
|
+
}
|
|
1474
|
+
]
|
|
1475
|
+
}), e(`/${u.slug}`);
|
|
1476
|
+
} catch (u) {
|
|
1477
|
+
s(u instanceof Error ? u.message : "Failed to create workspace");
|
|
1478
|
+
} finally {
|
|
1479
|
+
l(!1);
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
return /* @__PURE__ */ R(ae, { children: [
|
|
1483
|
+
/* @__PURE__ */ o(
|
|
1484
|
+
V,
|
|
1485
|
+
{
|
|
1486
|
+
kicker: /* @__PURE__ */ o(ht, { to: "/workspaces", children: "← Workspaces" }),
|
|
1487
|
+
title: "Create workspace"
|
|
1488
|
+
}
|
|
1489
|
+
),
|
|
1490
|
+
/* @__PURE__ */ o("form", { onSubmit: d, children: /* @__PURE__ */ R(se, { children: [
|
|
1491
|
+
/* @__PURE__ */ o(Z, { label: "Name", children: /* @__PURE__ */ o(
|
|
1492
|
+
ee,
|
|
1493
|
+
{
|
|
1494
|
+
required: !0,
|
|
1495
|
+
value: t,
|
|
1496
|
+
onChange: (a) => n(a.target.value),
|
|
1497
|
+
placeholder: "Docs site"
|
|
1498
|
+
}
|
|
1499
|
+
) }),
|
|
1500
|
+
r ? /* @__PURE__ */ o(O, { tone: "danger", children: r }) : null,
|
|
1501
|
+
/* @__PURE__ */ o("div", { children: /* @__PURE__ */ o(ye, { type: "submit", disabled: i, children: i ? "Creating…" : "Create workspace" }) })
|
|
1502
|
+
] }) })
|
|
1503
|
+
] });
|
|
1504
|
+
}
|
|
1505
|
+
function mr(e, t) {
|
|
1506
|
+
switch (e) {
|
|
1507
|
+
case "invite_expired":
|
|
1508
|
+
return "This invite has expired. Ask for a new one.";
|
|
1509
|
+
case "invite_revoked":
|
|
1510
|
+
return "This invite was revoked.";
|
|
1511
|
+
case "not_found":
|
|
1512
|
+
return "This invite link is not valid.";
|
|
1513
|
+
case "last_admin":
|
|
1514
|
+
return "Accepting this invite would remove the last admin.";
|
|
1515
|
+
case "email_unverified":
|
|
1516
|
+
return "Verify this email before joining. Sign out, then choose “Email me a magic link” on the sign-in screen.";
|
|
1517
|
+
default:
|
|
1518
|
+
return t;
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1521
|
+
function xr() {
|
|
1522
|
+
const [e] = Ce(), t = Me(), n = e.get("token") ?? "", r = e.get("email") ?? "", [s, i] = E(null), [l, d] = E(null), [a, u] = E(!1);
|
|
1523
|
+
J(() => {
|
|
1524
|
+
if (!n) {
|
|
1525
|
+
i("This invite link is missing a token.");
|
|
1526
|
+
return;
|
|
1527
|
+
}
|
|
1528
|
+
let m = !1;
|
|
1529
|
+
return gt(n).then((p) => {
|
|
1530
|
+
m || t(`/${p.slug}`, { replace: !0 });
|
|
1531
|
+
}).catch(async (p) => {
|
|
1532
|
+
if (m) return;
|
|
1533
|
+
const g = p && typeof p == "object" && "code" in p ? p.code : void 0;
|
|
1534
|
+
if (g === "invite_email_mismatch" || g === "unauthorized") {
|
|
1535
|
+
const v = await ve().catch(() => null);
|
|
1536
|
+
if (m) return;
|
|
1537
|
+
d((v == null ? void 0 : v.user.email) ?? null), u(!0);
|
|
1538
|
+
return;
|
|
1539
|
+
}
|
|
1540
|
+
const y = p instanceof Error ? p.message : "Could not accept invite";
|
|
1541
|
+
i(mr(g, y));
|
|
1542
|
+
}), () => {
|
|
1543
|
+
m = !0;
|
|
1544
|
+
};
|
|
1545
|
+
}, [t, n]);
|
|
1546
|
+
async function c() {
|
|
1547
|
+
await B().signOut().catch(() => {
|
|
1548
|
+
}), te(), z.wipe(), window.location.assign(window.location.href);
|
|
1549
|
+
}
|
|
1550
|
+
return /* @__PURE__ */ R(ae, { centered: !0, children: [
|
|
1551
|
+
/* @__PURE__ */ o(V, { title: "Accept invite" }),
|
|
1552
|
+
a ? /* @__PURE__ */ R(se, { children: [
|
|
1553
|
+
/* @__PURE__ */ o(O, { children: l ? `You're signed in as ${l}. This invite is for ${r || "someone else"}.` : `Sign in as ${r || "the invited email"} to join.` }),
|
|
1554
|
+
/* @__PURE__ */ o(O, { size: "sm", tone: "muted", children: "Password and GitHub stay on the next screen. A magic link sends one more email to that address." }),
|
|
1555
|
+
/* @__PURE__ */ o("div", { children: /* @__PURE__ */ o(ye, { type: "button", variant: "secondary", onClick: () => void c(), children: r ? `Sign in as ${r}` : "Sign in to continue" }) })
|
|
1556
|
+
] }) : s ? /* @__PURE__ */ o(O, { tone: "danger", children: s }) : /* @__PURE__ */ o(O, { tone: "muted", children: "Joining workspace…" })
|
|
1557
|
+
] });
|
|
1558
|
+
}
|
|
1559
|
+
function yr() {
|
|
1560
|
+
const { email: e, userId: t } = Ie(), [n, r] = E(""), [s, i] = E(null), [l, d] = E(null), [a, u] = E(!1);
|
|
1561
|
+
J(() => {
|
|
1562
|
+
ve().then((m) => {
|
|
1563
|
+
m != null && m.user.name && r(m.user.name);
|
|
1564
|
+
});
|
|
1565
|
+
}, []);
|
|
1566
|
+
async function c(m) {
|
|
1567
|
+
m.preventDefault(), u(!0), d(null), i(null);
|
|
1568
|
+
const p = await B().updateUser({ name: n });
|
|
1569
|
+
if (u(!1), p.error) {
|
|
1570
|
+
d(p.error.message ?? "Could not save name");
|
|
1571
|
+
return;
|
|
1572
|
+
}
|
|
1573
|
+
i("Name saved. New publishes will use it.");
|
|
1574
|
+
}
|
|
1575
|
+
return /* @__PURE__ */ R(ae, { children: [
|
|
1576
|
+
/* @__PURE__ */ o(
|
|
1577
|
+
V,
|
|
1578
|
+
{
|
|
1579
|
+
title: "User settings",
|
|
1580
|
+
description: "Your account on this Backmatter instance."
|
|
1581
|
+
}
|
|
1582
|
+
),
|
|
1583
|
+
/* @__PURE__ */ R(se, { gap: "lg", children: [
|
|
1584
|
+
/* @__PURE__ */ o(mt, { children: /* @__PURE__ */ o("form", { onSubmit: (m) => void c(m), children: /* @__PURE__ */ R(se, { children: [
|
|
1585
|
+
/* @__PURE__ */ o(O, { as: "h2", size: "lg", weight: "medium", children: "Account" }),
|
|
1586
|
+
/* @__PURE__ */ o(Z, { label: "Name", children: /* @__PURE__ */ o(ee, { value: n, onChange: (m) => r(m.target.value), autoComplete: "name" }) }),
|
|
1587
|
+
/* @__PURE__ */ o(Z, { label: "Email", children: /* @__PURE__ */ o(
|
|
1588
|
+
ee,
|
|
1589
|
+
{
|
|
1590
|
+
type: "email",
|
|
1591
|
+
value: e,
|
|
1592
|
+
readOnly: !0,
|
|
1593
|
+
autoComplete: "off",
|
|
1594
|
+
spellCheck: !1
|
|
1595
|
+
}
|
|
1596
|
+
) }),
|
|
1597
|
+
/* @__PURE__ */ o(Z, { label: "User ID", hint: "Stable id for this account.", children: /* @__PURE__ */ o(
|
|
1598
|
+
ee,
|
|
1599
|
+
{
|
|
1600
|
+
value: t,
|
|
1601
|
+
readOnly: !0,
|
|
1602
|
+
autoComplete: "off",
|
|
1603
|
+
spellCheck: !1
|
|
1604
|
+
}
|
|
1605
|
+
) }),
|
|
1606
|
+
l ? /* @__PURE__ */ o(O, { tone: "danger", children: l }) : null,
|
|
1607
|
+
s ? /* @__PURE__ */ o(O, { tone: "muted", children: s }) : null,
|
|
1608
|
+
/* @__PURE__ */ o("div", { children: /* @__PURE__ */ o(ye, { type: "submit", disabled: a, children: a ? "Saving…" : "Save name" }) })
|
|
1609
|
+
] }) }) }),
|
|
1610
|
+
/* @__PURE__ */ R("div", { children: [
|
|
1611
|
+
/* @__PURE__ */ o(
|
|
1612
|
+
V,
|
|
1613
|
+
{
|
|
1614
|
+
title: "Connectors",
|
|
1615
|
+
description: "Personal MCP servers that follow you across workspaces.",
|
|
1616
|
+
compact: !0
|
|
1617
|
+
}
|
|
1618
|
+
),
|
|
1619
|
+
/* @__PURE__ */ o(xt, { scope: "user", canEdit: !0 })
|
|
1620
|
+
] })
|
|
1621
|
+
] })
|
|
1622
|
+
] });
|
|
1623
|
+
}
|
|
1624
|
+
function vr({
|
|
1625
|
+
userId: e
|
|
1626
|
+
}) {
|
|
1627
|
+
const [t, n] = E({
|
|
1628
|
+
kind: "working"
|
|
1629
|
+
});
|
|
1630
|
+
return J(() => {
|
|
1631
|
+
const r = yt(window.location.search);
|
|
1632
|
+
if (!r) {
|
|
1633
|
+
n({
|
|
1634
|
+
kind: "error",
|
|
1635
|
+
message: "This link is missing the workspace or the page to return to."
|
|
1636
|
+
});
|
|
1637
|
+
return;
|
|
1638
|
+
}
|
|
1639
|
+
let s = !1;
|
|
1640
|
+
return (async () => {
|
|
1641
|
+
try {
|
|
1642
|
+
const {
|
|
1643
|
+
workspace: i
|
|
1644
|
+
} = await vt(r.workspaceId), l = bt(r.returnUrl, i.siteUrls);
|
|
1645
|
+
if (!l) {
|
|
1646
|
+
n({
|
|
1647
|
+
kind: "error",
|
|
1648
|
+
message: "That site is not listed under this workspace. Add its origin in Settings → General first."
|
|
1649
|
+
});
|
|
1650
|
+
return;
|
|
1651
|
+
}
|
|
1652
|
+
const {
|
|
1653
|
+
ticket: d
|
|
1654
|
+
} = await wt(i.id, {
|
|
1655
|
+
redirect: l.redirect,
|
|
1656
|
+
tree: e
|
|
1657
|
+
});
|
|
1658
|
+
if (s) return;
|
|
1659
|
+
window.location.replace(St(l.origin, d));
|
|
1660
|
+
} catch (i) {
|
|
1661
|
+
if (s) return;
|
|
1662
|
+
n({
|
|
1663
|
+
kind: "error",
|
|
1664
|
+
message: i instanceof Error ? i.message : "Could not open the site."
|
|
1665
|
+
});
|
|
1666
|
+
}
|
|
1667
|
+
})(), () => {
|
|
1668
|
+
s = !0;
|
|
1669
|
+
};
|
|
1670
|
+
}, [e]), /* @__PURE__ */ o("div", { className: "x1ov3xa9 xrvj5dj x1ku5rj1 x1t7e3gq", children: /* @__PURE__ */ o("div", { className: "x78zum5 xdt5ytf x1ndbd79 x1lr1uin x1t7e3gq x4pepcl x1d0qn7y", children: t.kind === "working" ? /* @__PURE__ */ R(be, { children: [
|
|
1671
|
+
/* @__PURE__ */ o(O, { size: "lg", weight: "medium", children: "Opening your site…" }),
|
|
1672
|
+
/* @__PURE__ */ o(O, { tone: "muted", children: "Setting up editing on the site and sending you back." })
|
|
1673
|
+
] }) : /* @__PURE__ */ R(be, { children: [
|
|
1674
|
+
/* @__PURE__ */ o(O, { size: "lg", weight: "medium", children: "Could not open the site" }),
|
|
1675
|
+
/* @__PURE__ */ o(O, { tone: "muted", children: t.message }),
|
|
1676
|
+
/* @__PURE__ */ o(Be, { to: "/", variant: "secondary", children: "Back to the dashboard" })
|
|
1677
|
+
] }) }) });
|
|
1678
|
+
}
|
|
1679
|
+
const Q = De() ? rt(() => import("./UiKitPage-CgNMOqfE.js").then((e) => ({
|
|
1680
|
+
default: e.UiKitPage
|
|
1681
|
+
}))) : null;
|
|
1682
|
+
function br(e) {
|
|
1683
|
+
return De() && e.replace(/\/$/, "") === "/__ui";
|
|
1684
|
+
}
|
|
1685
|
+
function _r() {
|
|
1686
|
+
return /* @__PURE__ */ o(kt, { children: /* @__PURE__ */ o(Et, { children: /* @__PURE__ */ o(wr, {}) }) });
|
|
1687
|
+
}
|
|
1688
|
+
function wr() {
|
|
1689
|
+
const e = Rt(), [t, n] = E(() => {
|
|
1690
|
+
const r = _t();
|
|
1691
|
+
return r ? {
|
|
1692
|
+
user: r
|
|
1693
|
+
} : "loading";
|
|
1694
|
+
});
|
|
1695
|
+
return J(() => {
|
|
1696
|
+
ve().then((r) => {
|
|
1697
|
+
if (!(r != null && r.user)) {
|
|
1698
|
+
te(), z.wipe(), n(null);
|
|
1699
|
+
return;
|
|
1700
|
+
}
|
|
1701
|
+
if (Ot(r.user), n({
|
|
1702
|
+
user: {
|
|
1703
|
+
id: r.user.id,
|
|
1704
|
+
email: r.user.email
|
|
1705
|
+
}
|
|
1706
|
+
}), z.getState().sessionUserId !== r.user.id) {
|
|
1707
|
+
const s = Tt(window.location.pathname);
|
|
1708
|
+
z.hydrate(r.user.id, s ?? Fe(r.user.id));
|
|
1709
|
+
}
|
|
1710
|
+
}).catch(() => {
|
|
1711
|
+
te(), z.wipe(), n(null);
|
|
1712
|
+
});
|
|
1713
|
+
}, []), Q && br(e.pathname) ? /* @__PURE__ */ o(we, { fallback: /* @__PURE__ */ o("div", { className: "x1y5dg2c", children: /* @__PURE__ */ o(O, { tone: "muted", children: "Loading kit…" }) }), children: /* @__PURE__ */ o(Q, {}) }) : t === "loading" ? /* @__PURE__ */ o(Pt, {}) : t ? e.pathname.replace(/\/$/, "") === "/enter" ? /* @__PURE__ */ o(vr, { userId: t.user.id }) : /* @__PURE__ */ o(Lt, { user: t.user, children: /* @__PURE__ */ o(Ut, { children: /* @__PURE__ */ o(Nt, { userId: t.user.id, email: t.user.email, onLogout: () => {
|
|
1714
|
+
te(), z.wipe(), B().signOut().then(() => {
|
|
1715
|
+
n(null);
|
|
1716
|
+
}).catch(() => {
|
|
1717
|
+
n(null);
|
|
1718
|
+
});
|
|
1719
|
+
}, children: /* @__PURE__ */ R(jt, { children: [
|
|
1720
|
+
/* @__PURE__ */ o(q, { path: "/", element: /* @__PURE__ */ o(dr, {}) }),
|
|
1721
|
+
/* @__PURE__ */ o(q, { path: "/workspaces", element: /* @__PURE__ */ o(pr, {}) }),
|
|
1722
|
+
/* @__PURE__ */ o(q, { path: "/workspaces/new", element: /* @__PURE__ */ o(gr, {}) }),
|
|
1723
|
+
/* @__PURE__ */ o(q, { path: "/invite", element: /* @__PURE__ */ o(xr, {}) }),
|
|
1724
|
+
/* @__PURE__ */ o(q, { path: "/account", element: /* @__PURE__ */ o(yr, {}) }),
|
|
1725
|
+
/* @__PURE__ */ o(q, { path: "/workspaces/:workspaceId/*", element: /* @__PURE__ */ o(At, {}) }),
|
|
1726
|
+
Ct(),
|
|
1727
|
+
Q ? /* @__PURE__ */ o(q, { path: "/__ui", element: /* @__PURE__ */ o(we, { fallback: /* @__PURE__ */ o("div", { className: "x1y5dg2c", children: /* @__PURE__ */ o(O, { tone: "muted", children: "Loading kit…" }) }), children: /* @__PURE__ */ o(Q, {}) }) }) : null,
|
|
1728
|
+
/* @__PURE__ */ o(q, { path: "*", element: /* @__PURE__ */ o(ze, { to: "/", replace: !0 }) })
|
|
1729
|
+
] }) }) }) }) : /* @__PURE__ */ o(lr, {});
|
|
1730
|
+
}
|
|
1731
|
+
export {
|
|
1732
|
+
_r as A,
|
|
1733
|
+
hr as L,
|
|
1734
|
+
fr as a,
|
|
1735
|
+
br as i
|
|
1736
|
+
};
|