@foris/ai-agent 0.9.0 → 0.9.1-beta.2
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/ai-agent.es.js +2780 -7
- package/dist/ai-agent.umd.js +4 -3817
- package/dist/ai-prompt-code-editor/PromptCodeEditor.d.ts +2 -2
- package/dist/components/ai-elements/code-block.d.ts +4 -3
- package/dist/components/ai-elements/streamdown-code.d.ts +13 -0
- package/dist/components/ui/input-group.d.ts +1 -1
- package/dist/style.css +1 -1
- package/package.json +56 -13
- package/dist/abap-Y8Dl9g_6.js +0 -6
- package/dist/actionscript-3-DZzbMeqX.js +0 -6
- package/dist/ada-vP6ak0IW.js +0 -6
- package/dist/andromeeda-BIpZ7gaU.js +0 -4
- package/dist/angular-html-DPB4Rf0C.js +0 -32
- package/dist/angular-ts-CeqPwKaz.js +0 -24
- package/dist/apache-BUjz-sD2.js +0 -6
- package/dist/apex-oLhhs58q.js +0 -6
- package/dist/apl-Bfz1rp5e.js +0 -17
- package/dist/applescript-BPx7YFFu.js +0 -6
- package/dist/ara-Z2fSOxSw.js +0 -6
- package/dist/arc-DHSZg76Q.js +0 -85
- package/dist/architectureDiagram-VXUJARFQ-Cp8vugxX.js +0 -4674
- package/dist/asciidoc-B-pCoB3G.js +0 -6
- package/dist/asm-BTWLY5ym.js +0 -6
- package/dist/astro-CFFExE8Q.js +0 -18
- package/dist/aurora-x-BwoVEUWZ.js +0 -4
- package/dist/awk-Fb0P9dkn.js +0 -6
- package/dist/ayu-dark-CxPZkpb2.js +0 -4
- package/dist/ballerina-oZK-YekG.js +0 -6
- package/dist/bat-0FvbqU9S.js +0 -6
- package/dist/beancount-DqJEb89h.js +0 -6
- package/dist/berry-DODBq_Ff.js +0 -6
- package/dist/bibtex-EULQRLY5.js +0 -6
- package/dist/bicep-BorU73w0.js +0 -6
- package/dist/blade-DRRSiTQz.js +0 -21
- package/dist/blockDiagram-VD42YOAC-B4cTulr6.js +0 -2407
- package/dist/bsl-NkNNwerW.js +0 -8
- package/dist/c-eeMepfLm.js +0 -6
- package/dist/c4Diagram-YG6GDRKO-B8--s8xx.js +0 -1585
- package/dist/cadence-02UX7mW8.js +0 -6
- package/dist/cairo-DM6WF2e3.js +0 -8
- package/dist/catppuccin-frappe-D3cH2rXe.js +0 -4
- package/dist/catppuccin-latte-C0LRGUW4.js +0 -4
- package/dist/catppuccin-macchiato-c5wQ11TT.js +0 -4
- package/dist/catppuccin-mocha-WMD6Qvya.js +0 -4
- package/dist/channel-Cqk_cOiy.js +0 -5
- package/dist/chunk-4BX2VUAB-Cb-wAjVN.js +0 -9
- package/dist/chunk-55IACEB6-QFXfbMHG.js +0 -8
- package/dist/chunk-B4BG7PRW-CFs53zrP.js +0 -1377
- package/dist/chunk-DI55MBZ5-CKjAOeh7.js +0 -1383
- package/dist/chunk-FMBD7UC4-B29MtLTn.js +0 -19
- package/dist/chunk-QN33PNHL-5bU-bM6A.js +0 -20
- package/dist/chunk-QZHKN3VN-B_Q6cMrq.js +0 -15
- package/dist/chunk-TZMSLE5B-DlULRafu.js +0 -64
- package/dist/clarity-PKm5CwqM.js +0 -6
- package/dist/classDiagram-2ON5EDUG-DJmXfcVi.js +0 -22
- package/dist/classDiagram-v2-WZHVMYZB-DJmXfcVi.js +0 -22
- package/dist/clojure-CXJfHrL3.js +0 -6
- package/dist/cmake-BJz8BOTU.js +0 -6
- package/dist/cobol-DYTFdEK1.js +0 -12
- package/dist/code-block-QI2IAROF-C_F85uim.js +0 -2812
- package/dist/codeowners-Bt9yU6NX.js +0 -6
- package/dist/codeql-DHkodjjI.js +0 -6
- package/dist/coffee-DGBR_nr_.js +0 -8
- package/dist/common-lisp-EVqT9Zhp.js +0 -6
- package/dist/coq-B0L9upzn.js +0 -6
- package/dist/cose-bilkent-S5V4N54A-N3jM_XQd.js +0 -2612
- package/dist/cpp-ZFnOq6fV.js +0 -19
- package/dist/crystal-CRJyc4G-.js +0 -18
- package/dist/csharp-C7yUs7-w.js +0 -6
- package/dist/css-CECN5uSL.js +0 -6
- package/dist/csv-CmYOceLb.js +0 -6
- package/dist/cue-ZzumE7IT.js +0 -6
- package/dist/cypher-jpdmjtA6.js +0 -6
- package/dist/cytoscape.esm-ClN43hhW.js +0 -18846
- package/dist/d-CBagWSwH.js +0 -6
- package/dist/dagre-6UL2VRFP-CJdrtgOu.js +0 -451
- package/dist/dark-plus-pUHDTVV0.js +0 -4
- package/dist/dart-6ObCrKr9.js +0 -6
- package/dist/dax-CcDT-8dH.js +0 -6
- package/dist/defaultLocale-DcQU6Vee.js +0 -177
- package/dist/desktop-B93p9R9O.js +0 -6
- package/dist/diagram-PSM6KHXK-DSaDqHvO.js +0 -544
- package/dist/diagram-QEK2KX5R-BbxboH_-.js +0 -224
- package/dist/diagram-S2PKOQOG-DWsCb5He.js +0 -146
- package/dist/diff-BxzP2J8R.js +0 -6
- package/dist/docker-CsHqm9tx.js +0 -6
- package/dist/dotenv-BMjVjUL1.js +0 -6
- package/dist/dracula-BtZx2Kac.js +0 -4
- package/dist/dracula-soft-BKa-aqBv.js +0 -4
- package/dist/dream-maker-PAx17jaB.js +0 -6
- package/dist/edge-B882-fmN.js +0 -14
- package/dist/elixir-DRzNHQCz.js +0 -10
- package/dist/elm-DZPAA5Qn.js +0 -9
- package/dist/emacs-lisp-Cfxdx5D-.js +0 -6
- package/dist/erDiagram-Q2GNP2WA-Bl0uHx93.js +0 -846
- package/dist/erb-DB1DqdBc.js +0 -27
- package/dist/erlang-DNcDT8Hi.js +0 -8
- package/dist/everforest-dark-DMCBqXCK.js +0 -4
- package/dist/everforest-light-BbXl82Em.js +0 -4
- package/dist/fennel-N4WcXuKx.js +0 -6
- package/dist/fish-BTDEUgqH.js +0 -6
- package/dist/flowDiagram-NV44I4VS-Dq0mXT8f.js +0 -1631
- package/dist/fluent-BMXUxfv1.js +0 -6
- package/dist/fortran-fixed-form-DUsA-VGo.js +0 -8
- package/dist/fortran-free-form-DPIT_jbP.js +0 -6
- package/dist/fsharp-CYOiIVNx.js +0 -8
- package/dist/ganttDiagram-JELNMOA3-Dj1adndm.js +0 -2702
- package/dist/gdresource-BwtMIoBm.js +0 -10
- package/dist/gdscript-BifyeYhI.js +0 -6
- package/dist/gdshader-Bk8fF6yr.js +0 -6
- package/dist/genie-DzUvd7U9.js +0 -6
- package/dist/gherkin-DHRaV0YP.js +0 -6
- package/dist/git-commit-Bd32YZ0K.js +0 -8
- package/dist/git-rebase-ZWUFO_T4.js +0 -8
- package/dist/gitGraphDiagram-NY62KEGX-DIFZugA1.js +0 -715
- package/dist/github-dark-DenFmJkN.js +0 -4
- package/dist/github-dark-default-BJPUVz4H.js +0 -4
- package/dist/github-dark-dimmed-DUshB20C.js +0 -4
- package/dist/github-dark-high-contrast-D3aGCnF8.js +0 -4
- package/dist/github-light-JYsPkUQd.js +0 -4
- package/dist/github-light-default-D99KPAby.js +0 -4
- package/dist/github-light-high-contrast-BbmZE-Mp.js +0 -4
- package/dist/gleam-Bv284lvN.js +0 -6
- package/dist/glimmer-js-DkxNrfPT.js +0 -14
- package/dist/glimmer-ts-D6YZEmK_.js +0 -14
- package/dist/glsl-CkUcVZNK.js +0 -8
- package/dist/gnuplot-yPG9-sE_.js +0 -6
- package/dist/go-ChxJuLYK.js +0 -6
- package/dist/graph-DB2UxkYH.js +0 -1190
- package/dist/graphql-CBu2ehBn.js +0 -14
- package/dist/groovy-CJQTphOW.js +0 -6
- package/dist/gruvbox-dark-hard-C5HOtKIh.js +0 -4
- package/dist/gruvbox-dark-medium-FVgwJHuz.js +0 -4
- package/dist/gruvbox-dark-soft-B46F314v.js +0 -4
- package/dist/gruvbox-light-hard-CJD38wDZ.js +0 -4
- package/dist/gruvbox-light-medium-BlIhMYTA.js +0 -4
- package/dist/gruvbox-light-soft-DoPHyLVZ.js +0 -4
- package/dist/hack-DVWgrvc2.js +0 -12
- package/dist/haml-NZLVzu_R.js +0 -10
- package/dist/handlebars-mxStpSE7.js +0 -14
- package/dist/haskell-WeIwNIP6.js +0 -6
- package/dist/haxe-TztHsm5T.js +0 -6
- package/dist/hcl-D438OF-I.js +0 -6
- package/dist/hjson-DYBUbqOl.js +0 -6
- package/dist/hlsl-Bk8TCZNL.js +0 -6
- package/dist/houston-BDYrDoDW.js +0 -4
- package/dist/html-B50bmoVb.js +0 -10
- package/dist/html-derivative-ByyNxAP5.js +0 -10
- package/dist/http-BVIWqb92.js +0 -19
- package/dist/hurl-B8OTiYoQ.js +0 -17
- package/dist/hxml-GbqSQCLa.js +0 -8
- package/dist/hy-Brt5EZ7-.js +0 -6
- package/dist/imba-CimUv-Uh.js +0 -6
- package/dist/index-gmzqSpwg.js +0 -71246
- package/dist/infoDiagram-WHAUD3N6-DPjzRs82.js +0 -27
- package/dist/ini-BZIuRIvJ.js +0 -6
- package/dist/init-DjUOC4st.js +0 -16
- package/dist/java-DY6VlHhP.js +0 -6
- package/dist/javascript-C25yR2R2.js +0 -6
- package/dist/jinja-CI-LSgSv.js +0 -13
- package/dist/jison-DdreslRX.js +0 -8
- package/dist/journeyDiagram-XKPGCS4Q-DLrlPVyq.js +0 -840
- package/dist/json-DxJze_jm.js +0 -6
- package/dist/json5-BT4Fjg39.js +0 -6
- package/dist/jsonc-CHjZD8gR.js +0 -6
- package/dist/jsonl-BGuvDmy9.js +0 -6
- package/dist/jsonnet-Bx2cfsXg.js +0 -6
- package/dist/jssm-BcADi6EI.js +0 -6
- package/dist/jsx-BtKADgXT.js +0 -6
- package/dist/julia-ll8P6QXy.js +0 -19
- package/dist/kanagawa-dragon-CiKur4Hl.js +0 -4
- package/dist/kanagawa-lotus-BKu-smKu.js +0 -4
- package/dist/kanagawa-wave-CQwozSzG.js +0 -4
- package/dist/kanban-definition-3W4ZIXB7-BTI5yGHx.js +0 -724
- package/dist/katex.min-l0sNRNKZ.js +0 -1
- package/dist/kdl-BNOv9TC3.js +0 -6
- package/dist/kotlin-ByBMgTeR.js +0 -6
- package/dist/kusto-VWFLl2T0.js +0 -6
- package/dist/laserwave-6a00oqik.js +0 -4
- package/dist/latex-DF20280u.js +0 -9
- package/dist/layout-Q6wQN5dr.js +0 -1730
- package/dist/lean-D5yRrexI.js +0 -6
- package/dist/less-B1GLI2Di.js +0 -6
- package/dist/light-plus-CZuVqSLX.js +0 -4
- package/dist/linear-UL3ZZUJv.js +0 -277
- package/dist/liquid-CHzkx3jT.js +0 -14
- package/dist/llvm-co1rIKs3.js +0 -6
- package/dist/log-Al8wyEFV.js +0 -6
- package/dist/logo-DBa4JDzV.js +0 -6
- package/dist/lua-kX5WP_P5.js +0 -8
- package/dist/luau-DtBSxLyz.js +0 -6
- package/dist/make-CsMclxtr.js +0 -6
- package/dist/markdown-CrScaQ96.js +0 -6
- package/dist/marko-ls0Jg2j8.js +0 -14
- package/dist/material-theme-D6KBX41T.js +0 -4
- package/dist/material-theme-darker-CkRroheE.js +0 -4
- package/dist/material-theme-lighter-BUBw43Yz.js +0 -4
- package/dist/material-theme-ocean-ClGX14Ja.js +0 -4
- package/dist/material-theme-palenight-C1RVm8K1.js +0 -4
- package/dist/matlab-BOAaUVP0.js +0 -6
- package/dist/mdc-DIP5_jeM.js +0 -15
- package/dist/mdx-BOhZZUJ8.js +0 -6
- package/dist/mermaid-B0ixDHKN.js +0 -6
- package/dist/mermaid-NA5CF7SZ-BDJrKfjz.js +0 -6
- package/dist/mermaid.core-Cpfp0NBU.js +0 -14414
- package/dist/min-dark-C7ak0t6c.js +0 -4
- package/dist/min-light-CKFxVcPp.js +0 -4
- package/dist/mindmap-definition-VGOIOE7T-B6ovfeib.js +0 -790
- package/dist/mipsasm-CTx18fBl.js +0 -6
- package/dist/mojo-BD611d7o.js +0 -6
- package/dist/monokai-C1KBYcO0.js +0 -4
- package/dist/move-F-dICmj2.js +0 -6
- package/dist/narrat-DmhDCBs-.js +0 -6
- package/dist/nextflow-DmSVRGjG.js +0 -6
- package/dist/nginx-COxS3qoU.js +0 -9
- package/dist/night-owl-Bm2rzalh.js +0 -4
- package/dist/nim-CCwXZLHG.js +0 -21
- package/dist/nix-BZK5F767.js +0 -9
- package/dist/nord-CC5OiUXg.js +0 -4
- package/dist/nushell-D8j3dhT-.js +0 -6
- package/dist/objective-c-Itk8tzmv.js +0 -6
- package/dist/objective-cpp-DGt5UKRO.js +0 -6
- package/dist/ocaml-eSVK32Eg.js +0 -6
- package/dist/one-dark-pro-DTA3VF0_.js +0 -4
- package/dist/one-light-D9sNaUtq.js +0 -4
- package/dist/openscad-Sp5uZ6f2.js +0 -6
- package/dist/ordinal-MUacOSdK.js +0 -65
- package/dist/pascal-xy8pJNns.js +0 -6
- package/dist/perl-NvKK8p2P.js +0 -17
- package/dist/php-CK5hNnT0.js +0 -19
- package/dist/pieDiagram-ADFJNKIX-Bn24elWA.js +0 -166
- package/dist/pkl-C-zSNmaA.js +0 -6
- package/dist/plastic-CSTz3KZp.js +0 -4
- package/dist/plsql-pVbGZfOv.js +0 -6
- package/dist/po-BNfHvqmm.js +0 -6
- package/dist/poimandres-C-VADXHD.js +0 -4
- package/dist/polar-CAZahv3u.js +0 -6
- package/dist/postcss-05aHdL-n.js +0 -6
- package/dist/powerquery-DI9HkTvs.js +0 -6
- package/dist/powershell-Clc4ydu-.js +0 -6
- package/dist/prisma-FZjmVtSl.js +0 -6
- package/dist/prolog-C5-yg4TO.js +0 -6
- package/dist/proto-MmCPeFAD.js +0 -6
- package/dist/pug-XOw9Q1Ho.js +0 -12
- package/dist/puppet-CUJHmnxV.js +0 -6
- package/dist/purescript-rUfGld-4.js +0 -6
- package/dist/python-BFNSHbwJ.js +0 -6
- package/dist/qml-rTNXsquU.js +0 -8
- package/dist/qmldir-BInDYbpo.js +0 -6
- package/dist/qss-AeJTysr_.js +0 -6
- package/dist/quadrantDiagram-AYHSOK5B-CsbmyLll.js +0 -1030
- package/dist/r-Bm0uF0U2.js +0 -6
- package/dist/racket-B83wSAja.js +0 -6
- package/dist/raku-nEQ4ZJJ7.js +0 -6
- package/dist/razor-CoqPuKQU.js +0 -12
- package/dist/red-7y8PH7HH.js +0 -4
- package/dist/reg-m_s_Kiip.js +0 -6
- package/dist/regexp-BazyLpPg.js +0 -6
- package/dist/rel-BcRfyd6Q.js +0 -6
- package/dist/requirementDiagram-UZGBJVZJ--9rfbKaz.js +0 -856
- package/dist/riscv-Ce8MAQLP.js +0 -6
- package/dist/rose-pine-BKc3yVeu.js +0 -4
- package/dist/rose-pine-dawn-BulJcPZT.js +0 -4
- package/dist/rose-pine-moon-j6jiXKV8.js +0 -4
- package/dist/rosmsg-Cz0w1km8.js +0 -6
- package/dist/rst-AoEjemIj.js +0 -36
- package/dist/ruby-CGSl8JoB.js +0 -36
- package/dist/rust-CLzF9zIN.js +0 -6
- package/dist/sankeyDiagram-TZEHDZUN-Cp2id-3k.js +0 -830
- package/dist/sas-fpEvgATw.js +0 -8
- package/dist/sass-DxHp5rTx.js +0 -6
- package/dist/scala-D4grkFkl.js +0 -6
- package/dist/scheme-BCRWuEm4.js +0 -6
- package/dist/scss-B1FaCqwR.js +0 -8
- package/dist/sdbl-B7T8abf4.js +0 -6
- package/dist/sequenceDiagram-WL72ISMW-Bdoz1Co7.js +0 -2526
- package/dist/shaderlab-Cr62-Wb4.js +0 -8
- package/dist/shellscript-InADTalH.js +0 -6
- package/dist/shellsession-DiDJNQdy.js +0 -8
- package/dist/slack-dark-i7wN4OET.js +0 -4
- package/dist/slack-ochin-ndHf0LoP.js +0 -4
- package/dist/smalltalk-BlI1_OkM.js +0 -6
- package/dist/snazzy-light-BlSJXAu4.js +0 -4
- package/dist/solarized-dark-UTmkh7lw.js +0 -4
- package/dist/solarized-light-BheCkDPT.js +0 -4
- package/dist/solidity-DUWnFhS6.js +0 -6
- package/dist/soy-YPoZ1G2p.js +0 -10
- package/dist/sparql-B0KWFEri.js +0 -8
- package/dist/splunk-CRXR8A9s.js +0 -6
- package/dist/sql-Cn_v3PB0.js +0 -6
- package/dist/ssh-config-DP-hNVbF.js +0 -6
- package/dist/stata-B8c5fTjX.js +0 -8
- package/dist/stateDiagram-FKZM4ZOC-BLHxjrc8.js +0 -268
- package/dist/stateDiagram-v2-4FDKWEC3-CbxCwS8b.js +0 -21
- package/dist/stylus-CyKEU1Ej.js +0 -6
- package/dist/svelte-5UasyOg7.js +0 -14
- package/dist/swift-9UzSvamq.js +0 -6
- package/dist/synthwave-84-NU3C_KFZ.js +0 -4
- package/dist/system-verilog-BCm7smPJ.js +0 -6
- package/dist/systemd-C-4qm6XH.js +0 -6
- package/dist/talonscript-CFF3LF_O.js +0 -6
- package/dist/tasl-Cg_WBUAe.js +0 -6
- package/dist/tcl-DN7buRTF.js +0 -6
- package/dist/templ-peLZIM2D.js +0 -12
- package/dist/terraform-DGvcn9zM.js +0 -6
- package/dist/tex-DpOayVob.js +0 -8
- package/dist/timeline-definition-IT6M3QCI-s3Wsbz6h.js +0 -805
- package/dist/tokyo-night-DP4TmcQl.js +0 -4
- package/dist/toml-DY62mUL_.js +0 -6
- package/dist/treemap-KMMF4GRG-D_L55G0b.js +0 -15045
- package/dist/ts-tags-CWmBp2js.js +0 -43
- package/dist/tsv-BtvSkaG0.js +0 -6
- package/dist/tsx-B8rCNbgL.js +0 -6
- package/dist/turtle-_H59FV7D.js +0 -6
- package/dist/twig-Cpoho6oi.js +0 -35
- package/dist/typescript-RycA9KXf.js +0 -6
- package/dist/typespec-DWqp-kUU.js +0 -6
- package/dist/typst-D_1QKWns.js +0 -6
- package/dist/v-BPCNiyYe.js +0 -6
- package/dist/vala-uxaPR7d1.js +0 -6
- package/dist/vb-D8_c5-KN.js +0 -6
- package/dist/verilog-B-bybjPF.js +0 -6
- package/dist/vesper-BckBta1U.js +0 -4
- package/dist/vhdl-CUlNa8ac.js +0 -6
- package/dist/viml-DsfA-sWm.js +0 -6
- package/dist/vitesse-black-BoGvW84i.js +0 -4
- package/dist/vitesse-dark-Cym-eLtO.js +0 -4
- package/dist/vitesse-light-CcmG315c.js +0 -4
- package/dist/vue-DmFKWfEU.js +0 -31
- package/dist/vue-html-BB2aI7Yc.js +0 -15
- package/dist/vue-vine-CznNap4x.js +0 -24
- package/dist/vyper-CPQuu50u.js +0 -6
- package/dist/wasm-BBXxrAl7.js +0 -6
- package/dist/wasm-DQxwEHae.js +0 -7
- package/dist/wenyan-pbVjoM9_.js +0 -6
- package/dist/wgsl-DY4iK1q1.js +0 -6
- package/dist/wikitext-Z-MoUasO.js +0 -6
- package/dist/wit-CQMQOlTg.js +0 -6
- package/dist/wolfram-Dz4KXISs.js +0 -6
- package/dist/xml-C2J0sS9M.js +0 -8
- package/dist/xsl-CbTBIiv3.js +0 -9
- package/dist/xychartDiagram-PRI3JC2R-D3ejwy7u.js +0 -1345
- package/dist/yaml-DaO7k5B1.js +0 -6
- package/dist/zenscript-CxBjpf9c.js +0 -6
- package/dist/zig-Vm0PO9wB.js +0 -6
package/dist/ai-agent.es.js
CHANGED
|
@@ -1,9 +1,2782 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
var Ge = Object.defineProperty;
|
|
2
|
+
var $e = (t, n, a) => n in t ? Ge(t, n, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[n] = a;
|
|
3
|
+
var ue = (t, n, a) => ($e(t, typeof n != "symbol" ? n + "" : n, a), a);
|
|
4
|
+
import { jsx as e, jsxs as l, Fragment as le } from "react/jsx-runtime";
|
|
5
|
+
import We, { createContext as ee, useState as I, useContext as te, useRef as B, useEffect as z, memo as ne, isValidElement as Le, useMemo as ge, useCallback as Z, Fragment as Ze, Children as qe } from "react";
|
|
6
|
+
import { Slot as Te } from "@radix-ui/react-slot";
|
|
7
|
+
import { cva as oe } from "class-variance-authority";
|
|
8
|
+
import { clsx as Je } from "clsx";
|
|
9
|
+
import { twMerge as Ke } from "tailwind-merge";
|
|
10
|
+
import "@radix-ui/react-separator";
|
|
11
|
+
import "@radix-ui/react-tooltip";
|
|
12
|
+
import { CheckIcon as Ve, CopyIcon as Ye, BrainIcon as Xe, ChevronDownIcon as ve, BookIcon as Qe, WrenchIcon as et, XCircleIcon as Se, CheckCircleIcon as Ne, ClockIcon as ke, CircleIcon as tt, PaperclipIcon as nt, XIcon as at, PlusIcon as rt, ImageIcon as ot, Minimize2 as st, Maximize2 as it } from "lucide-react";
|
|
13
|
+
import { StreamdownContext as lt, Streamdown as De } from "streamdown";
|
|
14
|
+
import { createHighlighterCore as ct } from "shiki/core";
|
|
15
|
+
import { createJavaScriptRegexEngine as dt } from "shiki/engine/javascript";
|
|
16
|
+
import { transformerNotationDiff as ut, transformerNotationHighlight as pt, transformerNotationErrorLevel as mt } from "@shikijs/transformers";
|
|
17
|
+
import ht from "@shikijs/themes/one-light";
|
|
18
|
+
import ft from "@shikijs/themes/one-dark-pro";
|
|
19
|
+
import _t from "@shikijs/langs/json";
|
|
20
|
+
import gt from "@shikijs/langs/typescript";
|
|
21
|
+
import vt from "@shikijs/langs/javascript";
|
|
22
|
+
import bt from "@shikijs/langs/markdown";
|
|
23
|
+
import xt from "@shikijs/langs/html";
|
|
24
|
+
import Ct from "@shikijs/langs/css";
|
|
25
|
+
import yt from "@shikijs/langs/python";
|
|
26
|
+
import Pt from "@shikijs/langs/yaml";
|
|
27
|
+
import wt from "@shikijs/langs/rust";
|
|
28
|
+
import St from "@shikijs/langs/go";
|
|
29
|
+
import Nt from "@shikijs/langs/csharp";
|
|
30
|
+
import kt from "@shikijs/langs/sql";
|
|
31
|
+
import It from "@shikijs/langs/shellscript";
|
|
32
|
+
import Lt from "@shikijs/langs/toml";
|
|
33
|
+
import { useControllableState as Ie } from "@radix-ui/react-use-controllable-state";
|
|
34
|
+
import * as be from "@radix-ui/react-collapsible";
|
|
35
|
+
import { motion as Tt } from "motion/react";
|
|
36
|
+
import "cmdk";
|
|
37
|
+
import "@radix-ui/react-dialog";
|
|
38
|
+
import * as ae from "@radix-ui/react-dropdown-menu";
|
|
39
|
+
import * as ie from "@radix-ui/react-hover-card";
|
|
40
|
+
import "@radix-ui/react-select";
|
|
41
|
+
import { nanoid as Dt } from "nanoid";
|
|
42
|
+
import { Icon as me } from "@foris/avocado-icons";
|
|
43
|
+
import Mt from "react-markdown";
|
|
44
|
+
import zt from "@uiw/react-codemirror";
|
|
45
|
+
import { json as At } from "@codemirror/lang-json";
|
|
46
|
+
function C(...t) {
|
|
47
|
+
return Ke(Je(t));
|
|
48
|
+
}
|
|
49
|
+
const Ot = oe(
|
|
50
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
51
|
+
{
|
|
52
|
+
variants: {
|
|
53
|
+
variant: {
|
|
54
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
55
|
+
destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
56
|
+
outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
57
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
58
|
+
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
59
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
60
|
+
},
|
|
61
|
+
size: {
|
|
62
|
+
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
63
|
+
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
64
|
+
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
65
|
+
icon: "size-9",
|
|
66
|
+
"icon-sm": "size-8",
|
|
67
|
+
"icon-lg": "size-10"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
defaultVariants: {
|
|
71
|
+
variant: "default",
|
|
72
|
+
size: "default"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
function X({
|
|
77
|
+
className: t,
|
|
78
|
+
variant: n = "default",
|
|
79
|
+
size: a = "default",
|
|
80
|
+
asChild: s = !1,
|
|
81
|
+
...i
|
|
82
|
+
}) {
|
|
83
|
+
return /* @__PURE__ */ e(
|
|
84
|
+
s ? Te : "button",
|
|
85
|
+
{
|
|
86
|
+
"data-slot": "button",
|
|
87
|
+
"data-variant": n,
|
|
88
|
+
"data-size": a,
|
|
89
|
+
className: C(Ot({ variant: n, size: a, className: t })),
|
|
90
|
+
...i
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
oe(
|
|
95
|
+
"flex w-fit items-stretch [&>*]:focus-visible:z-10 [&>*]:focus-visible:relative [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md has-[>[data-slot=button-group]]:gap-2",
|
|
96
|
+
{
|
|
97
|
+
variants: {
|
|
98
|
+
orientation: {
|
|
99
|
+
horizontal: "[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",
|
|
100
|
+
vertical: "flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none"
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
defaultVariants: {
|
|
104
|
+
orientation: "horizontal"
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
const Me = ee({
|
|
109
|
+
code: ""
|
|
110
|
+
}), Ut = {
|
|
111
|
+
name: "line-numbers",
|
|
112
|
+
line(t, n) {
|
|
113
|
+
t.children.unshift({
|
|
114
|
+
type: "element",
|
|
115
|
+
tagName: "span",
|
|
116
|
+
properties: {
|
|
117
|
+
className: [
|
|
118
|
+
"inline-block",
|
|
119
|
+
"min-w-10",
|
|
120
|
+
"mr-4",
|
|
121
|
+
"text-right",
|
|
122
|
+
"select-none",
|
|
123
|
+
"text-muted-foreground"
|
|
124
|
+
]
|
|
125
|
+
},
|
|
126
|
+
children: [{ type: "text", value: String(n) }]
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}, Bt = ct({
|
|
130
|
+
themes: [ht, ft],
|
|
131
|
+
langs: [
|
|
132
|
+
_t,
|
|
133
|
+
gt,
|
|
134
|
+
vt,
|
|
135
|
+
bt,
|
|
136
|
+
xt,
|
|
137
|
+
Ct,
|
|
138
|
+
yt,
|
|
139
|
+
Pt,
|
|
140
|
+
wt,
|
|
141
|
+
St,
|
|
142
|
+
Nt,
|
|
143
|
+
kt,
|
|
144
|
+
It,
|
|
145
|
+
Lt
|
|
146
|
+
],
|
|
147
|
+
engine: dt()
|
|
148
|
+
}), Rt = {
|
|
149
|
+
py: "python",
|
|
150
|
+
yml: "yaml",
|
|
151
|
+
js: "javascript",
|
|
152
|
+
ts: "typescript",
|
|
153
|
+
md: "markdown",
|
|
154
|
+
rs: "rust",
|
|
155
|
+
cs: "csharp",
|
|
156
|
+
sh: "shellscript",
|
|
157
|
+
bash: "shellscript"
|
|
158
|
+
};
|
|
159
|
+
function Et(t) {
|
|
160
|
+
return Rt[t] ?? t;
|
|
161
|
+
}
|
|
162
|
+
async function Ht(t, n, a = !1) {
|
|
163
|
+
const s = await Bt, i = Et(n), p = [
|
|
164
|
+
ut(),
|
|
165
|
+
pt(),
|
|
166
|
+
mt(),
|
|
167
|
+
...a ? [Ut] : []
|
|
168
|
+
];
|
|
169
|
+
return await Promise.all([
|
|
170
|
+
s.codeToHtml(t, {
|
|
171
|
+
lang: i,
|
|
172
|
+
theme: "one-light",
|
|
173
|
+
transformers: p
|
|
174
|
+
}),
|
|
175
|
+
s.codeToHtml(t, {
|
|
176
|
+
lang: i,
|
|
177
|
+
theme: "one-dark-pro",
|
|
178
|
+
transformers: p
|
|
179
|
+
})
|
|
180
|
+
]);
|
|
181
|
+
}
|
|
182
|
+
const re = ({
|
|
183
|
+
code: t,
|
|
184
|
+
language: n,
|
|
185
|
+
showLineNumbers: a = !1,
|
|
186
|
+
className: s,
|
|
187
|
+
children: i,
|
|
188
|
+
...p
|
|
189
|
+
}) => {
|
|
190
|
+
const [h, u] = I(""), [f, _] = I(""), c = B(!1);
|
|
191
|
+
return z(() => (Ht(t, n, a).then(([o, r]) => {
|
|
192
|
+
c.current || (u(o), _(r), c.current = !0);
|
|
193
|
+
}), () => {
|
|
194
|
+
c.current = !1;
|
|
195
|
+
}), [t, n, a]), /* @__PURE__ */ e(Me.Provider, { value: { code: t }, children: /* @__PURE__ */ e(
|
|
196
|
+
"div",
|
|
197
|
+
{
|
|
198
|
+
className: C(
|
|
199
|
+
"group relative w-full overflow-hidden rounded-md bg-background text-foreground",
|
|
200
|
+
s
|
|
201
|
+
),
|
|
202
|
+
...p,
|
|
203
|
+
children: /* @__PURE__ */ l("div", { className: "relative", children: [
|
|
204
|
+
/* @__PURE__ */ e(
|
|
205
|
+
"div",
|
|
206
|
+
{
|
|
207
|
+
className: "overflow-auto dark:hidden [&>pre]:m-0 [&>pre]:bg-background [&>pre]:p-4 [&>pre]:text-foreground! [&>pre]:text-sm [&_code]:font-mono [&_code]:text-sm",
|
|
208
|
+
dangerouslySetInnerHTML: { __html: h }
|
|
209
|
+
}
|
|
210
|
+
),
|
|
211
|
+
/* @__PURE__ */ e(
|
|
212
|
+
"div",
|
|
213
|
+
{
|
|
214
|
+
className: "hidden overflow-auto dark:block [&>pre]:m-0 [&>pre]:bg-background [&>pre]:p-4 [&>pre]:text-foreground! [&>pre]:text-sm [&_code]:font-mono [&_code]:text-sm",
|
|
215
|
+
dangerouslySetInnerHTML: { __html: f }
|
|
216
|
+
}
|
|
217
|
+
),
|
|
218
|
+
i && /* @__PURE__ */ e("div", { className: "absolute top-2 right-2 flex items-center gap-2", children: i })
|
|
219
|
+
] })
|
|
220
|
+
}
|
|
221
|
+
) });
|
|
222
|
+
}, jt = ({
|
|
223
|
+
onCopy: t,
|
|
224
|
+
onError: n,
|
|
225
|
+
timeout: a = 2e3,
|
|
226
|
+
children: s,
|
|
227
|
+
className: i,
|
|
228
|
+
...p
|
|
229
|
+
}) => {
|
|
230
|
+
const [h, u] = I(!1), { code: f } = te(Me), _ = async () => {
|
|
231
|
+
var o;
|
|
232
|
+
if (typeof window > "u" || !((o = navigator == null ? void 0 : navigator.clipboard) != null && o.writeText)) {
|
|
233
|
+
n == null || n(new Error("Clipboard API not available"));
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
try {
|
|
237
|
+
await navigator.clipboard.writeText(f), u(!0), t == null || t(), setTimeout(() => u(!1), a);
|
|
238
|
+
} catch (r) {
|
|
239
|
+
n == null || n(r);
|
|
240
|
+
}
|
|
241
|
+
}, c = h ? Ve : Ye;
|
|
242
|
+
return /* @__PURE__ */ e(
|
|
243
|
+
X,
|
|
244
|
+
{
|
|
245
|
+
className: C("shrink-0", i),
|
|
246
|
+
onClick: _,
|
|
247
|
+
size: "icon",
|
|
248
|
+
variant: "ghost",
|
|
249
|
+
...p,
|
|
250
|
+
children: s ?? /* @__PURE__ */ e(c, { size: 14 })
|
|
251
|
+
}
|
|
252
|
+
);
|
|
253
|
+
}, Ft = /language-(\S+)/, Gt = /* @__PURE__ */ new Set([
|
|
254
|
+
"json",
|
|
255
|
+
"typescript",
|
|
256
|
+
"ts",
|
|
257
|
+
"javascript",
|
|
258
|
+
"js",
|
|
259
|
+
"markdown",
|
|
260
|
+
"md",
|
|
261
|
+
"html",
|
|
262
|
+
"css",
|
|
263
|
+
"python",
|
|
264
|
+
"py",
|
|
265
|
+
"yaml",
|
|
266
|
+
"yml",
|
|
267
|
+
"rust",
|
|
268
|
+
"rs",
|
|
269
|
+
"go",
|
|
270
|
+
"csharp",
|
|
271
|
+
"cs",
|
|
272
|
+
"sql",
|
|
273
|
+
"shellscript",
|
|
274
|
+
"sh",
|
|
275
|
+
"bash",
|
|
276
|
+
"toml"
|
|
277
|
+
]);
|
|
278
|
+
function $t(t) {
|
|
279
|
+
const n = t.toLowerCase();
|
|
280
|
+
return Gt.has(n) ? n : "markdown";
|
|
281
|
+
}
|
|
282
|
+
function he(t) {
|
|
283
|
+
var n;
|
|
284
|
+
return typeof t == "string" ? t : Le(t) && ((n = t.props) == null ? void 0 : n.children) != null ? he(t.props.children) : Array.isArray(t) ? t.map(he).join("") : "";
|
|
285
|
+
}
|
|
286
|
+
const xe = ne(
|
|
287
|
+
({ node: t, className: n, children: a, ...s }) => {
|
|
288
|
+
var m, g, v, P;
|
|
289
|
+
const i = (g = (m = t == null ? void 0 : t.position) == null ? void 0 : m.start) == null ? void 0 : g.line, p = (P = (v = t == null ? void 0 : t.position) == null ? void 0 : v.end) == null ? void 0 : P.line;
|
|
290
|
+
if (i != null && p != null && i === p)
|
|
291
|
+
return /* @__PURE__ */ e(
|
|
292
|
+
"code",
|
|
293
|
+
{
|
|
294
|
+
className: C(
|
|
295
|
+
"rounded bg-muted px-1.5 py-0.5 font-mono text-sm",
|
|
296
|
+
n
|
|
297
|
+
),
|
|
298
|
+
"data-streamdown": "inline-code",
|
|
299
|
+
...s,
|
|
300
|
+
children: a
|
|
301
|
+
}
|
|
302
|
+
);
|
|
303
|
+
const u = n == null ? void 0 : n.match(Ft), f = $t(
|
|
304
|
+
(u == null ? void 0 : u[1]) ?? "text"
|
|
305
|
+
), _ = he(a), { controls: c, isAnimating: o } = te(lt), r = typeof c == "boolean" ? c : (c == null ? void 0 : c.code) !== !1;
|
|
306
|
+
return /* @__PURE__ */ l(
|
|
307
|
+
"div",
|
|
308
|
+
{
|
|
309
|
+
className: C(
|
|
310
|
+
"my-4 w-full overflow-hidden rounded-xl border border-border",
|
|
311
|
+
n
|
|
312
|
+
),
|
|
313
|
+
"data-language": f,
|
|
314
|
+
"data-streamdown": "code-block",
|
|
315
|
+
style: {
|
|
316
|
+
contentVisibility: "auto",
|
|
317
|
+
containIntrinsicSize: "auto 200px"
|
|
318
|
+
},
|
|
319
|
+
children: [
|
|
320
|
+
r && /* @__PURE__ */ l(
|
|
321
|
+
"div",
|
|
322
|
+
{
|
|
323
|
+
className: "flex items-center justify-between bg-muted/80 p-3 text-muted-foreground text-xs",
|
|
324
|
+
"data-language": f,
|
|
325
|
+
"data-streamdown": "code-block-header",
|
|
326
|
+
children: [
|
|
327
|
+
/* @__PURE__ */ e("span", { className: "ml-1 font-mono lowercase", children: f }),
|
|
328
|
+
/* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ e(jt, { disabled: o }) })
|
|
329
|
+
]
|
|
330
|
+
}
|
|
331
|
+
),
|
|
332
|
+
/* @__PURE__ */ e(
|
|
333
|
+
re,
|
|
334
|
+
{
|
|
335
|
+
className: "overflow-x-auto border-border border-t",
|
|
336
|
+
code: _,
|
|
337
|
+
language: f
|
|
338
|
+
}
|
|
339
|
+
)
|
|
340
|
+
]
|
|
341
|
+
}
|
|
342
|
+
);
|
|
343
|
+
}
|
|
344
|
+
);
|
|
345
|
+
xe.displayName = "StreamdownCode";
|
|
346
|
+
const Wt = ({ className: t, from: n, ...a }) => /* @__PURE__ */ e(
|
|
347
|
+
"div",
|
|
348
|
+
{
|
|
349
|
+
className: C(
|
|
350
|
+
"message-box group flex w-full max-w-[95%] flex-col gap-2",
|
|
351
|
+
n === "user" ? "is-user ml-auto justify-end" : "is-assistant",
|
|
352
|
+
t
|
|
353
|
+
),
|
|
354
|
+
...a
|
|
355
|
+
}
|
|
356
|
+
), Zt = ({
|
|
357
|
+
children: t,
|
|
358
|
+
className: n,
|
|
359
|
+
...a
|
|
360
|
+
}) => /* @__PURE__ */ e(
|
|
361
|
+
"div",
|
|
362
|
+
{
|
|
363
|
+
className: C(
|
|
364
|
+
"message-content is-user:dark flex w-fit max-w-full min-w-0 flex-col gap-2 overflow-hidden text-sm",
|
|
365
|
+
"group-[.is-user]:ml-auto group-[.is-user]:rounded-lg group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground",
|
|
366
|
+
"group-[.is-assistant]:text-foreground",
|
|
367
|
+
n
|
|
368
|
+
),
|
|
369
|
+
...a,
|
|
370
|
+
children: t
|
|
371
|
+
}
|
|
372
|
+
);
|
|
373
|
+
ee(
|
|
374
|
+
null
|
|
375
|
+
);
|
|
376
|
+
const fe = ne(
|
|
377
|
+
({ className: t, ...n }) => /* @__PURE__ */ e(
|
|
378
|
+
De,
|
|
379
|
+
{
|
|
380
|
+
className: C(
|
|
381
|
+
"message-response size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",
|
|
382
|
+
t
|
|
383
|
+
),
|
|
384
|
+
components: { code: xe },
|
|
385
|
+
...n
|
|
386
|
+
}
|
|
387
|
+
),
|
|
388
|
+
(t, n) => t.children === n.children
|
|
389
|
+
);
|
|
390
|
+
fe.displayName = "MessageResponse";
|
|
391
|
+
function Ce({
|
|
392
|
+
...t
|
|
393
|
+
}) {
|
|
394
|
+
return /* @__PURE__ */ e(be.Root, { "data-slot": "collapsible", ...t });
|
|
395
|
+
}
|
|
396
|
+
function ye({
|
|
397
|
+
...t
|
|
398
|
+
}) {
|
|
399
|
+
return /* @__PURE__ */ e(
|
|
400
|
+
be.CollapsibleTrigger,
|
|
401
|
+
{
|
|
402
|
+
"data-slot": "collapsible-trigger",
|
|
403
|
+
...t
|
|
404
|
+
}
|
|
405
|
+
);
|
|
406
|
+
}
|
|
407
|
+
function Pe({
|
|
408
|
+
...t
|
|
409
|
+
}) {
|
|
410
|
+
return /* @__PURE__ */ e(
|
|
411
|
+
be.CollapsibleContent,
|
|
412
|
+
{
|
|
413
|
+
"data-slot": "collapsible-content",
|
|
414
|
+
...t
|
|
415
|
+
}
|
|
416
|
+
);
|
|
417
|
+
}
|
|
418
|
+
const qt = ({
|
|
419
|
+
children: t,
|
|
420
|
+
as: n = "p",
|
|
421
|
+
className: a,
|
|
422
|
+
duration: s = 2,
|
|
423
|
+
spread: i = 2
|
|
424
|
+
}) => {
|
|
425
|
+
const p = Tt.create(
|
|
426
|
+
n
|
|
427
|
+
), h = ge(
|
|
428
|
+
() => ((t == null ? void 0 : t.length) ?? 0) * i,
|
|
429
|
+
[t, i]
|
|
430
|
+
);
|
|
431
|
+
return /* @__PURE__ */ e(
|
|
432
|
+
p,
|
|
433
|
+
{
|
|
434
|
+
animate: { backgroundPosition: "0% center" },
|
|
435
|
+
className: C(
|
|
436
|
+
"relative inline-block bg-[length:250%_100%,auto] bg-clip-text text-transparent",
|
|
437
|
+
"[--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--color-background),#0000_calc(50%+var(--spread)))] [background-repeat:no-repeat,padding-box]",
|
|
438
|
+
a
|
|
439
|
+
),
|
|
440
|
+
initial: { backgroundPosition: "100% center" },
|
|
441
|
+
style: {
|
|
442
|
+
"--spread": `${h}px`,
|
|
443
|
+
backgroundImage: "var(--bg), linear-gradient(var(--color-muted-foreground), var(--color-muted-foreground))"
|
|
444
|
+
},
|
|
445
|
+
transition: {
|
|
446
|
+
repeat: Number.POSITIVE_INFINITY,
|
|
447
|
+
duration: s,
|
|
448
|
+
ease: "linear"
|
|
449
|
+
},
|
|
450
|
+
children: t
|
|
451
|
+
}
|
|
452
|
+
);
|
|
453
|
+
}, Jt = ne(qt), ze = ee(null), Kt = () => {
|
|
454
|
+
const t = te(ze);
|
|
455
|
+
if (!t)
|
|
456
|
+
throw new Error("Reasoning components must be used within Reasoning");
|
|
457
|
+
return t;
|
|
458
|
+
}, Vt = 1e3, Yt = 1e3, Ae = ne(
|
|
459
|
+
({
|
|
460
|
+
className: t,
|
|
461
|
+
isStreaming: n = !1,
|
|
462
|
+
open: a,
|
|
463
|
+
defaultOpen: s = !0,
|
|
464
|
+
onOpenChange: i,
|
|
465
|
+
duration: p,
|
|
466
|
+
children: h,
|
|
467
|
+
...u
|
|
468
|
+
}) => {
|
|
469
|
+
const [f, _] = Ie({
|
|
470
|
+
prop: a,
|
|
471
|
+
defaultProp: s,
|
|
472
|
+
onChange: i
|
|
473
|
+
}), [c, o] = Ie({
|
|
474
|
+
prop: p,
|
|
475
|
+
defaultProp: void 0
|
|
476
|
+
}), [r, m] = I(!1), [g, v] = I(null);
|
|
477
|
+
z(() => {
|
|
478
|
+
n ? g === null && v(Date.now()) : g !== null && (o(Math.ceil((Date.now() - g) / Yt)), v(null));
|
|
479
|
+
}, [n, g, o]), z(() => {
|
|
480
|
+
if (s && !n && f && !r) {
|
|
481
|
+
const w = setTimeout(() => {
|
|
482
|
+
_(!1), m(!0);
|
|
483
|
+
}, Vt);
|
|
484
|
+
return () => clearTimeout(w);
|
|
485
|
+
}
|
|
486
|
+
}, [n, f, s, _, r]);
|
|
487
|
+
const P = (w) => {
|
|
488
|
+
_(w);
|
|
489
|
+
};
|
|
490
|
+
return /* @__PURE__ */ e(
|
|
491
|
+
ze.Provider,
|
|
492
|
+
{
|
|
493
|
+
value: { isStreaming: n, isOpen: f, setIsOpen: _, duration: c },
|
|
494
|
+
children: /* @__PURE__ */ e(
|
|
495
|
+
Ce,
|
|
496
|
+
{
|
|
497
|
+
className: C("not-prose mb-4", t),
|
|
498
|
+
onOpenChange: P,
|
|
499
|
+
open: f,
|
|
500
|
+
...u,
|
|
501
|
+
children: h
|
|
502
|
+
}
|
|
503
|
+
)
|
|
504
|
+
}
|
|
505
|
+
);
|
|
506
|
+
}
|
|
507
|
+
), Xt = (t, n) => t || n === 0 ? /* @__PURE__ */ e(Jt, { duration: 1, children: "Thinking..." }) : n === void 0 ? /* @__PURE__ */ e("p", { children: "Thought for a few seconds" }) : /* @__PURE__ */ l("p", { children: [
|
|
508
|
+
"Thought for ",
|
|
509
|
+
n,
|
|
510
|
+
" seconds"
|
|
511
|
+
] }), Oe = ne(
|
|
512
|
+
({ className: t, children: n, getThinkingMessage: a = Xt, ...s }) => {
|
|
513
|
+
const { isStreaming: i, isOpen: p, duration: h } = Kt();
|
|
514
|
+
return /* @__PURE__ */ e(
|
|
515
|
+
ye,
|
|
516
|
+
{
|
|
517
|
+
className: C(
|
|
518
|
+
"flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",
|
|
519
|
+
t
|
|
520
|
+
),
|
|
521
|
+
...s,
|
|
522
|
+
children: n ?? /* @__PURE__ */ l(le, { children: [
|
|
523
|
+
/* @__PURE__ */ e(Xe, { className: "size-4" }),
|
|
524
|
+
a(i, h),
|
|
525
|
+
/* @__PURE__ */ e(
|
|
526
|
+
ve,
|
|
527
|
+
{
|
|
528
|
+
className: C(
|
|
529
|
+
"size-4 transition-transform",
|
|
530
|
+
p ? "rotate-180" : "rotate-0"
|
|
531
|
+
)
|
|
532
|
+
}
|
|
533
|
+
)
|
|
534
|
+
] })
|
|
535
|
+
}
|
|
536
|
+
);
|
|
537
|
+
}
|
|
538
|
+
), Ue = ne(
|
|
539
|
+
({ className: t, children: n, ...a }) => /* @__PURE__ */ e(
|
|
540
|
+
Pe,
|
|
541
|
+
{
|
|
542
|
+
className: C(
|
|
543
|
+
"mt-4 text-sm",
|
|
544
|
+
"data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",
|
|
545
|
+
t
|
|
546
|
+
),
|
|
547
|
+
...a,
|
|
548
|
+
children: /* @__PURE__ */ e(De, { components: { code: xe }, ...a, children: n })
|
|
549
|
+
}
|
|
550
|
+
)
|
|
551
|
+
);
|
|
552
|
+
Ae.displayName = "Reasoning";
|
|
553
|
+
Oe.displayName = "ReasoningTrigger";
|
|
554
|
+
Ue.displayName = "ReasoningContent";
|
|
555
|
+
const Qt = ({ className: t, ...n }) => /* @__PURE__ */ e(
|
|
556
|
+
Ce,
|
|
557
|
+
{
|
|
558
|
+
className: C("not-prose mb-4 text-primary text-xs", t),
|
|
559
|
+
...n
|
|
560
|
+
}
|
|
561
|
+
), en = ({
|
|
562
|
+
className: t,
|
|
563
|
+
count: n,
|
|
564
|
+
children: a,
|
|
565
|
+
...s
|
|
566
|
+
}) => /* @__PURE__ */ e(
|
|
567
|
+
ye,
|
|
568
|
+
{
|
|
569
|
+
className: C("flex items-center gap-2", t),
|
|
570
|
+
...s,
|
|
571
|
+
children: a ?? /* @__PURE__ */ l(le, { children: [
|
|
572
|
+
/* @__PURE__ */ l("p", { className: "font-medium", children: [
|
|
573
|
+
"Used ",
|
|
574
|
+
n,
|
|
575
|
+
" sources"
|
|
576
|
+
] }),
|
|
577
|
+
/* @__PURE__ */ e(ve, { className: "h-4 w-4" })
|
|
578
|
+
] })
|
|
579
|
+
}
|
|
580
|
+
), tn = ({
|
|
581
|
+
className: t,
|
|
582
|
+
...n
|
|
583
|
+
}) => /* @__PURE__ */ e(
|
|
584
|
+
Pe,
|
|
585
|
+
{
|
|
586
|
+
className: C(
|
|
587
|
+
"mt-3 flex w-fit flex-col gap-2",
|
|
588
|
+
"data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",
|
|
589
|
+
t
|
|
590
|
+
),
|
|
591
|
+
...n
|
|
592
|
+
}
|
|
593
|
+
), nn = ({ href: t, title: n, children: a, ...s }) => /* @__PURE__ */ e(
|
|
594
|
+
"a",
|
|
595
|
+
{
|
|
596
|
+
className: "flex items-center gap-2",
|
|
597
|
+
href: t,
|
|
598
|
+
rel: "noreferrer",
|
|
599
|
+
target: "_blank",
|
|
600
|
+
...s,
|
|
601
|
+
children: a ?? /* @__PURE__ */ l(le, { children: [
|
|
602
|
+
/* @__PURE__ */ e(Qe, { className: "h-4 w-4" }),
|
|
603
|
+
/* @__PURE__ */ e("span", { className: "block font-medium", children: n })
|
|
604
|
+
] })
|
|
605
|
+
}
|
|
606
|
+
), an = oe(
|
|
607
|
+
"inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
|
|
608
|
+
{
|
|
609
|
+
variants: {
|
|
610
|
+
variant: {
|
|
611
|
+
default: "border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
|
|
612
|
+
secondary: "border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
|
|
613
|
+
destructive: "border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
614
|
+
outline: "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"
|
|
615
|
+
}
|
|
616
|
+
},
|
|
617
|
+
defaultVariants: {
|
|
618
|
+
variant: "default"
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
);
|
|
622
|
+
function rn({
|
|
623
|
+
className: t,
|
|
624
|
+
variant: n,
|
|
625
|
+
asChild: a = !1,
|
|
626
|
+
...s
|
|
627
|
+
}) {
|
|
628
|
+
return /* @__PURE__ */ e(
|
|
629
|
+
a ? Te : "span",
|
|
630
|
+
{
|
|
631
|
+
"data-slot": "badge",
|
|
632
|
+
className: C(an({ variant: n }), t),
|
|
633
|
+
...s
|
|
634
|
+
}
|
|
635
|
+
);
|
|
636
|
+
}
|
|
637
|
+
const on = ({ className: t, ...n }) => /* @__PURE__ */ e(
|
|
638
|
+
Ce,
|
|
639
|
+
{
|
|
640
|
+
className: C("not-prose mb-4 w-full rounded-md border", t),
|
|
641
|
+
...n
|
|
642
|
+
}
|
|
643
|
+
), sn = (t) => {
|
|
644
|
+
const n = {
|
|
645
|
+
"input-streaming": "Pending",
|
|
646
|
+
"input-available": "Running",
|
|
647
|
+
// @ts-expect-error state only available in AI SDK v6
|
|
648
|
+
"approval-requested": "Awaiting Approval",
|
|
649
|
+
"approval-responded": "Responded",
|
|
650
|
+
"output-available": "Completed",
|
|
651
|
+
"output-error": "Error",
|
|
652
|
+
"output-denied": "Denied"
|
|
653
|
+
};
|
|
654
|
+
return /* @__PURE__ */ l(rn, { className: "gap-1.5 rounded-full text-xs", variant: "secondary", children: [
|
|
655
|
+
{
|
|
656
|
+
"input-streaming": /* @__PURE__ */ e(tt, { className: "size-4" }),
|
|
657
|
+
"input-available": /* @__PURE__ */ e(ke, { className: "size-4 animate-pulse" }),
|
|
658
|
+
// @ts-expect-error state only available in AI SDK v6
|
|
659
|
+
"approval-requested": /* @__PURE__ */ e(ke, { className: "size-4 text-yellow-600" }),
|
|
660
|
+
"approval-responded": /* @__PURE__ */ e(Ne, { className: "size-4 text-blue-600" }),
|
|
661
|
+
"output-available": /* @__PURE__ */ e(Ne, { className: "size-4 text-green-600" }),
|
|
662
|
+
"output-error": /* @__PURE__ */ e(Se, { className: "size-4 text-red-600" }),
|
|
663
|
+
"output-denied": /* @__PURE__ */ e(Se, { className: "size-4 text-orange-600" })
|
|
664
|
+
}[t],
|
|
665
|
+
n[t]
|
|
666
|
+
] });
|
|
667
|
+
}, ln = ({
|
|
668
|
+
className: t,
|
|
669
|
+
title: n,
|
|
670
|
+
type: a,
|
|
671
|
+
state: s,
|
|
672
|
+
...i
|
|
673
|
+
}) => /* @__PURE__ */ l(
|
|
674
|
+
ye,
|
|
675
|
+
{
|
|
676
|
+
className: C(
|
|
677
|
+
"flex w-full items-center justify-between gap-4 p-3",
|
|
678
|
+
t
|
|
679
|
+
),
|
|
680
|
+
...i,
|
|
681
|
+
children: [
|
|
682
|
+
/* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
683
|
+
/* @__PURE__ */ e(et, { className: "size-4 text-muted-foreground" }),
|
|
684
|
+
/* @__PURE__ */ e("span", { className: "font-medium text-sm", children: n ?? a.split("-").slice(1).join("-") }),
|
|
685
|
+
sn(s)
|
|
686
|
+
] }),
|
|
687
|
+
/* @__PURE__ */ e(ve, { className: "size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180" })
|
|
688
|
+
]
|
|
689
|
+
}
|
|
690
|
+
), cn = ({ className: t, ...n }) => /* @__PURE__ */ e(
|
|
691
|
+
Pe,
|
|
692
|
+
{
|
|
693
|
+
className: C(
|
|
694
|
+
"data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",
|
|
695
|
+
t
|
|
696
|
+
),
|
|
697
|
+
...n
|
|
698
|
+
}
|
|
699
|
+
), dn = ({ className: t, input: n, ...a }) => /* @__PURE__ */ l("div", { className: C("space-y-2 overflow-hidden p-4", t), ...a, children: [
|
|
700
|
+
/* @__PURE__ */ e("h4", { className: "font-medium text-muted-foreground text-xs uppercase tracking-wide", children: "Parameters" }),
|
|
701
|
+
/* @__PURE__ */ e("div", { className: "rounded-md bg-muted/50", children: /* @__PURE__ */ e(re, { code: JSON.stringify(n, null, 2), language: "json" }) })
|
|
702
|
+
] }), un = ({
|
|
703
|
+
className: t,
|
|
704
|
+
output: n,
|
|
705
|
+
errorText: a,
|
|
706
|
+
...s
|
|
707
|
+
}) => {
|
|
708
|
+
if (!(n || a))
|
|
709
|
+
return null;
|
|
710
|
+
let i = /* @__PURE__ */ e("div", { children: n });
|
|
711
|
+
return typeof n == "object" && !Le(n) ? i = /* @__PURE__ */ e(re, { code: JSON.stringify(n, null, 2), language: "json" }) : typeof n == "string" && (i = /* @__PURE__ */ e(re, { code: n, language: "json" })), /* @__PURE__ */ l("div", { className: C("space-y-2 p-4", t), ...s, children: [
|
|
712
|
+
/* @__PURE__ */ e("h4", { className: "font-medium text-muted-foreground text-xs uppercase tracking-wide", children: a ? "Error" : "Result" }),
|
|
713
|
+
/* @__PURE__ */ l(
|
|
714
|
+
"div",
|
|
715
|
+
{
|
|
716
|
+
className: C(
|
|
717
|
+
"overflow-x-auto rounded-md text-xs [&_table]:w-full",
|
|
718
|
+
a ? "bg-destructive/10 text-destructive" : "success-result bg-muted/50 text-foreground"
|
|
719
|
+
),
|
|
720
|
+
children: [
|
|
721
|
+
a && /* @__PURE__ */ e("div", { children: a }),
|
|
722
|
+
i
|
|
723
|
+
]
|
|
724
|
+
}
|
|
725
|
+
)
|
|
726
|
+
] });
|
|
727
|
+
};
|
|
728
|
+
function pn({
|
|
729
|
+
...t
|
|
730
|
+
}) {
|
|
731
|
+
return /* @__PURE__ */ e(ae.Root, { "data-slot": "dropdown-menu", ...t });
|
|
732
|
+
}
|
|
733
|
+
function mn({
|
|
734
|
+
...t
|
|
735
|
+
}) {
|
|
736
|
+
return /* @__PURE__ */ e(
|
|
737
|
+
ae.Trigger,
|
|
738
|
+
{
|
|
739
|
+
"data-slot": "dropdown-menu-trigger",
|
|
740
|
+
...t
|
|
741
|
+
}
|
|
742
|
+
);
|
|
743
|
+
}
|
|
744
|
+
function hn({
|
|
745
|
+
className: t,
|
|
746
|
+
sideOffset: n = 4,
|
|
747
|
+
...a
|
|
748
|
+
}) {
|
|
749
|
+
return /* @__PURE__ */ e(ae.Portal, { children: /* @__PURE__ */ e(
|
|
750
|
+
ae.Content,
|
|
751
|
+
{
|
|
752
|
+
"data-slot": "dropdown-menu-content",
|
|
753
|
+
sideOffset: n,
|
|
754
|
+
className: C(
|
|
755
|
+
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",
|
|
756
|
+
t
|
|
757
|
+
),
|
|
758
|
+
...a
|
|
759
|
+
}
|
|
760
|
+
) });
|
|
761
|
+
}
|
|
762
|
+
function fn({
|
|
763
|
+
className: t,
|
|
764
|
+
inset: n,
|
|
765
|
+
variant: a = "default",
|
|
766
|
+
...s
|
|
767
|
+
}) {
|
|
768
|
+
return /* @__PURE__ */ e(
|
|
769
|
+
ae.Item,
|
|
770
|
+
{
|
|
771
|
+
"data-slot": "dropdown-menu-item",
|
|
772
|
+
"data-inset": n,
|
|
773
|
+
"data-variant": a,
|
|
774
|
+
className: C(
|
|
775
|
+
"focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
776
|
+
t
|
|
777
|
+
),
|
|
778
|
+
...s
|
|
779
|
+
}
|
|
780
|
+
);
|
|
781
|
+
}
|
|
782
|
+
function _n({
|
|
783
|
+
...t
|
|
784
|
+
}) {
|
|
785
|
+
return /* @__PURE__ */ e(ie.Root, { "data-slot": "hover-card", ...t });
|
|
786
|
+
}
|
|
787
|
+
function gn({
|
|
788
|
+
...t
|
|
789
|
+
}) {
|
|
790
|
+
return /* @__PURE__ */ e(ie.Trigger, { "data-slot": "hover-card-trigger", ...t });
|
|
791
|
+
}
|
|
792
|
+
function vn({
|
|
793
|
+
className: t,
|
|
794
|
+
align: n = "center",
|
|
795
|
+
sideOffset: a = 4,
|
|
796
|
+
...s
|
|
797
|
+
}) {
|
|
798
|
+
return /* @__PURE__ */ e(ie.Portal, { "data-slot": "hover-card-portal", children: /* @__PURE__ */ e(
|
|
799
|
+
ie.Content,
|
|
800
|
+
{
|
|
801
|
+
"data-slot": "hover-card-content",
|
|
802
|
+
align: n,
|
|
803
|
+
sideOffset: a,
|
|
804
|
+
className: C(
|
|
805
|
+
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",
|
|
806
|
+
t
|
|
807
|
+
),
|
|
808
|
+
...s
|
|
809
|
+
}
|
|
810
|
+
) });
|
|
811
|
+
}
|
|
812
|
+
function bn({ className: t, type: n, ...a }) {
|
|
813
|
+
return /* @__PURE__ */ e(
|
|
814
|
+
"input",
|
|
815
|
+
{
|
|
816
|
+
type: n,
|
|
817
|
+
"data-slot": "input",
|
|
818
|
+
className: C(
|
|
819
|
+
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
820
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
821
|
+
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
822
|
+
t
|
|
823
|
+
),
|
|
824
|
+
...a
|
|
825
|
+
}
|
|
826
|
+
);
|
|
827
|
+
}
|
|
828
|
+
function xn({ className: t, ...n }) {
|
|
829
|
+
return /* @__PURE__ */ e(
|
|
830
|
+
"textarea",
|
|
831
|
+
{
|
|
832
|
+
"data-slot": "textarea",
|
|
833
|
+
className: C(
|
|
834
|
+
"border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
835
|
+
t
|
|
836
|
+
),
|
|
837
|
+
...n
|
|
838
|
+
}
|
|
839
|
+
);
|
|
840
|
+
}
|
|
841
|
+
function Cn({ className: t, ...n }) {
|
|
842
|
+
return /* @__PURE__ */ e(
|
|
843
|
+
"div",
|
|
844
|
+
{
|
|
845
|
+
"data-slot": "input-group",
|
|
846
|
+
role: "group",
|
|
847
|
+
className: C(
|
|
848
|
+
"group/input-group border-input dark:bg-input/30 relative flex w-full items-center rounded-md border shadow-xs transition-[color,box-shadow] outline-none",
|
|
849
|
+
"h-9 min-w-0 has-[>textarea]:h-auto",
|
|
850
|
+
// Variants based on alignment.
|
|
851
|
+
"has-[>[data-align=inline-start]]:[&>input]:pl-2",
|
|
852
|
+
"has-[>[data-align=inline-end]]:[&>input]:pr-2",
|
|
853
|
+
"has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3",
|
|
854
|
+
"has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3",
|
|
855
|
+
// Focus state.
|
|
856
|
+
"has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot=input-group-control]:focus-visible]:ring-[3px]",
|
|
857
|
+
// Error state.
|
|
858
|
+
"has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",
|
|
859
|
+
t
|
|
860
|
+
),
|
|
861
|
+
...n
|
|
862
|
+
}
|
|
863
|
+
);
|
|
864
|
+
}
|
|
865
|
+
const yn = oe(
|
|
866
|
+
"text-muted-foreground flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium select-none [&>svg:not([class*='size-'])]:size-4 [&>kbd]:rounded-[calc(var(--radius)-5px)] group-data-[disabled=true]/input-group:opacity-50",
|
|
867
|
+
{
|
|
868
|
+
variants: {
|
|
869
|
+
align: {
|
|
870
|
+
"inline-start": "order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]",
|
|
871
|
+
"inline-end": "order-last pr-3 has-[>button]:mr-[-0.45rem] has-[>kbd]:mr-[-0.35rem]",
|
|
872
|
+
"block-start": "order-first w-full justify-start px-3 pt-3 [.border-b]:pb-3 group-has-[>input]/input-group:pt-2.5",
|
|
873
|
+
"block-end": "order-last w-full justify-start px-3 pb-3 [.border-t]:pt-3 group-has-[>input]/input-group:pb-2.5"
|
|
874
|
+
}
|
|
875
|
+
},
|
|
876
|
+
defaultVariants: {
|
|
877
|
+
align: "inline-start"
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
);
|
|
881
|
+
function Be({
|
|
882
|
+
className: t,
|
|
883
|
+
align: n = "inline-start",
|
|
884
|
+
...a
|
|
885
|
+
}) {
|
|
886
|
+
return /* @__PURE__ */ e(
|
|
887
|
+
"div",
|
|
888
|
+
{
|
|
889
|
+
role: "group",
|
|
890
|
+
"data-slot": "input-group-addon",
|
|
891
|
+
"data-align": n,
|
|
892
|
+
className: C(yn({ align: n }), t),
|
|
893
|
+
onClick: (s) => {
|
|
894
|
+
var i, p;
|
|
895
|
+
s.target.closest("button") || (p = (i = s.currentTarget.parentElement) == null ? void 0 : i.querySelector("input")) == null || p.focus();
|
|
896
|
+
},
|
|
897
|
+
...a
|
|
898
|
+
}
|
|
899
|
+
);
|
|
900
|
+
}
|
|
901
|
+
const Pn = oe(
|
|
902
|
+
" input-group-button text-sm shadow-none flex gap-2 items-center",
|
|
903
|
+
{
|
|
904
|
+
variants: {
|
|
905
|
+
size: {
|
|
906
|
+
xs: "h-6 gap-1 px-2 rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-3.5 has-[>svg]:px-2",
|
|
907
|
+
sm: "h-8 px-2.5 gap-1.5 rounded-md has-[>svg]:px-2.5",
|
|
908
|
+
"icon-xs": "size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0",
|
|
909
|
+
"icon-sm": "size-8 p-0 has-[>svg]:p-0"
|
|
910
|
+
}
|
|
911
|
+
},
|
|
912
|
+
defaultVariants: {
|
|
913
|
+
size: "xs"
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
);
|
|
917
|
+
function wn({
|
|
918
|
+
className: t,
|
|
919
|
+
type: n = "button",
|
|
920
|
+
variant: a = "ghost",
|
|
921
|
+
size: s = "xs",
|
|
922
|
+
...i
|
|
923
|
+
}) {
|
|
924
|
+
return /* @__PURE__ */ e(
|
|
925
|
+
X,
|
|
926
|
+
{
|
|
927
|
+
type: n,
|
|
928
|
+
"data-size": s,
|
|
929
|
+
variant: a,
|
|
930
|
+
className: C(Pn({ size: s }), t),
|
|
931
|
+
...i
|
|
932
|
+
}
|
|
933
|
+
);
|
|
934
|
+
}
|
|
935
|
+
function Sn({
|
|
936
|
+
className: t,
|
|
937
|
+
...n
|
|
938
|
+
}) {
|
|
939
|
+
return /* @__PURE__ */ e(
|
|
940
|
+
xn,
|
|
941
|
+
{
|
|
942
|
+
"data-slot": "input-group-control",
|
|
943
|
+
className: C(
|
|
944
|
+
"input-group-textarea flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent",
|
|
945
|
+
t
|
|
946
|
+
),
|
|
947
|
+
...n
|
|
948
|
+
}
|
|
949
|
+
);
|
|
950
|
+
}
|
|
951
|
+
const Nn = ee(
|
|
952
|
+
null
|
|
953
|
+
), kn = ee(
|
|
954
|
+
null
|
|
955
|
+
), Re = () => te(Nn), In = () => te(kn), Ee = ee(null), ce = () => {
|
|
956
|
+
const t = In(), n = te(Ee), a = t ?? n;
|
|
957
|
+
if (!a)
|
|
958
|
+
throw new Error(
|
|
959
|
+
"usePromptInputAttachments must be used within a PromptInput or PromptInputProvider"
|
|
960
|
+
);
|
|
961
|
+
return a;
|
|
962
|
+
};
|
|
963
|
+
function Ln({
|
|
964
|
+
data: t,
|
|
965
|
+
className: n,
|
|
966
|
+
...a
|
|
967
|
+
}) {
|
|
968
|
+
var f;
|
|
969
|
+
const s = ce(), i = t.filename || "", h = ((f = t.mediaType) != null && f.startsWith("image/") && t.url ? "image" : "file") === "image", u = i || (h ? "Image" : "Attachment");
|
|
970
|
+
return /* @__PURE__ */ l(jn, { children: [
|
|
971
|
+
/* @__PURE__ */ e(gn, { asChild: !0, children: /* @__PURE__ */ l(
|
|
972
|
+
"div",
|
|
973
|
+
{
|
|
974
|
+
className: C(
|
|
975
|
+
"group relative flex h-8 cursor-pointer select-none items-center gap-1.5 rounded-md border border-border px-1.5 font-medium text-sm transition-all hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
976
|
+
n
|
|
977
|
+
),
|
|
978
|
+
...a,
|
|
979
|
+
children: [
|
|
980
|
+
/* @__PURE__ */ l("div", { className: "relative size-5 shrink-0", children: [
|
|
981
|
+
/* @__PURE__ */ e("div", { className: "absolute inset-0 flex size-5 items-center justify-center overflow-hidden rounded bg-background transition-opacity group-hover:opacity-0", children: h ? /* @__PURE__ */ e(
|
|
982
|
+
"img",
|
|
983
|
+
{
|
|
984
|
+
alt: i || "attachment",
|
|
985
|
+
className: "size-5 object-cover",
|
|
986
|
+
height: 20,
|
|
987
|
+
src: t.url,
|
|
988
|
+
width: 20
|
|
989
|
+
}
|
|
990
|
+
) : /* @__PURE__ */ e("div", { className: "flex size-5 items-center justify-center text-muted-foreground", children: /* @__PURE__ */ e(nt, { className: "size-3" }) }) }),
|
|
991
|
+
/* @__PURE__ */ l(
|
|
992
|
+
X,
|
|
993
|
+
{
|
|
994
|
+
"aria-label": "Remove attachment",
|
|
995
|
+
className: "absolute inset-0 size-5 cursor-pointer rounded p-0 opacity-0 transition-opacity group-hover:pointer-events-auto group-hover:opacity-100 [&>svg]:size-2.5",
|
|
996
|
+
onClick: (_) => {
|
|
997
|
+
_.stopPropagation(), s.remove(t.id);
|
|
998
|
+
},
|
|
999
|
+
type: "button",
|
|
1000
|
+
variant: "ghost",
|
|
1001
|
+
children: [
|
|
1002
|
+
/* @__PURE__ */ e(at, {}),
|
|
1003
|
+
/* @__PURE__ */ e("span", { className: "sr-only", children: "Remove" })
|
|
1004
|
+
]
|
|
1005
|
+
}
|
|
1006
|
+
)
|
|
1007
|
+
] }),
|
|
1008
|
+
/* @__PURE__ */ e("span", { className: "flex-1 truncate", children: u })
|
|
1009
|
+
]
|
|
1010
|
+
},
|
|
1011
|
+
t.id
|
|
1012
|
+
) }),
|
|
1013
|
+
/* @__PURE__ */ e(Fn, { className: "w-auto p-2", children: /* @__PURE__ */ l("div", { className: "w-auto space-y-3", children: [
|
|
1014
|
+
h && /* @__PURE__ */ e("div", { className: "flex max-h-96 w-96 items-center justify-center overflow-hidden rounded-md border", children: /* @__PURE__ */ e(
|
|
1015
|
+
"img",
|
|
1016
|
+
{
|
|
1017
|
+
alt: i || "attachment preview",
|
|
1018
|
+
className: "max-h-full max-w-full object-contain",
|
|
1019
|
+
height: 384,
|
|
1020
|
+
src: t.url,
|
|
1021
|
+
width: 448
|
|
1022
|
+
}
|
|
1023
|
+
) }),
|
|
1024
|
+
/* @__PURE__ */ e("div", { className: "flex items-center gap-2.5", children: /* @__PURE__ */ l("div", { className: "min-w-0 flex-1 space-y-1 px-0.5", children: [
|
|
1025
|
+
/* @__PURE__ */ e("h4", { className: "truncate font-semibold text-sm leading-none", children: i || (h ? "Image" : "Attachment") }),
|
|
1026
|
+
t.mediaType && /* @__PURE__ */ e("p", { className: "truncate font-mono text-muted-foreground text-xs", children: t.mediaType })
|
|
1027
|
+
] }) })
|
|
1028
|
+
] }) })
|
|
1029
|
+
] });
|
|
1030
|
+
}
|
|
1031
|
+
function Tn({
|
|
1032
|
+
children: t,
|
|
1033
|
+
className: n,
|
|
1034
|
+
...a
|
|
1035
|
+
}) {
|
|
1036
|
+
const s = ce();
|
|
1037
|
+
return s.files.length ? /* @__PURE__ */ e(
|
|
1038
|
+
"div",
|
|
1039
|
+
{
|
|
1040
|
+
className: C("flex flex-wrap items-center gap-2 p-3 w-full", n),
|
|
1041
|
+
...a,
|
|
1042
|
+
children: s.files.map((i) => /* @__PURE__ */ e(Ze, { children: t(i) }, i.id))
|
|
1043
|
+
}
|
|
1044
|
+
) : null;
|
|
1045
|
+
}
|
|
1046
|
+
const Dn = ({
|
|
1047
|
+
label: t = "Add photos or files",
|
|
1048
|
+
...n
|
|
1049
|
+
}) => {
|
|
1050
|
+
const a = ce();
|
|
1051
|
+
return /* @__PURE__ */ l(
|
|
1052
|
+
fn,
|
|
1053
|
+
{
|
|
1054
|
+
...n,
|
|
1055
|
+
onSelect: (s) => {
|
|
1056
|
+
s.preventDefault(), a.openFileDialog();
|
|
1057
|
+
},
|
|
1058
|
+
children: [
|
|
1059
|
+
/* @__PURE__ */ e(ot, { className: "mr-2 size-4" }),
|
|
1060
|
+
" ",
|
|
1061
|
+
t
|
|
1062
|
+
]
|
|
1063
|
+
}
|
|
1064
|
+
);
|
|
1065
|
+
}, Mn = ({
|
|
1066
|
+
className: t,
|
|
1067
|
+
accept: n,
|
|
1068
|
+
multiple: a,
|
|
1069
|
+
globalDrop: s,
|
|
1070
|
+
syncHiddenInput: i,
|
|
1071
|
+
maxFiles: p,
|
|
1072
|
+
maxFileSize: h,
|
|
1073
|
+
onError: u,
|
|
1074
|
+
onSubmit: f,
|
|
1075
|
+
children: _,
|
|
1076
|
+
...c
|
|
1077
|
+
}) => {
|
|
1078
|
+
const o = Re(), r = !!o, m = B(null), g = B(null), [v, P] = I([]), w = r ? o.attachments.files : v, x = B(w);
|
|
1079
|
+
x.current = w;
|
|
1080
|
+
const U = Z(() => {
|
|
1081
|
+
var b;
|
|
1082
|
+
(b = m.current) == null || b.click();
|
|
1083
|
+
}, []), G = Z(
|
|
1084
|
+
(b) => !n || n.trim() === "" ? !0 : n.split(",").map((S) => S.trim()).filter(Boolean).some((S) => {
|
|
1085
|
+
if (S.endsWith("/*")) {
|
|
1086
|
+
const N = S.slice(0, -1);
|
|
1087
|
+
return b.type.startsWith(N);
|
|
1088
|
+
}
|
|
1089
|
+
return b.type === S;
|
|
1090
|
+
}),
|
|
1091
|
+
[n]
|
|
1092
|
+
), K = Z(
|
|
1093
|
+
(b) => {
|
|
1094
|
+
const D = Array.from(b), S = D.filter((M) => G(M));
|
|
1095
|
+
if (D.length && S.length === 0) {
|
|
1096
|
+
u == null || u({
|
|
1097
|
+
code: "accept",
|
|
1098
|
+
message: "No files match the accepted types."
|
|
1099
|
+
});
|
|
1100
|
+
return;
|
|
1101
|
+
}
|
|
1102
|
+
const N = (M) => h ? M.size <= h : !0, y = S.filter(N);
|
|
1103
|
+
if (S.length > 0 && y.length === 0) {
|
|
1104
|
+
u == null || u({
|
|
1105
|
+
code: "max_file_size",
|
|
1106
|
+
message: "All files exceed the maximum size."
|
|
1107
|
+
});
|
|
1108
|
+
return;
|
|
1109
|
+
}
|
|
1110
|
+
P((M) => {
|
|
1111
|
+
const W = typeof p == "number" ? Math.max(0, p - M.length) : void 0, de = typeof W == "number" ? y.slice(0, W) : y;
|
|
1112
|
+
typeof W == "number" && y.length > W && (u == null || u({
|
|
1113
|
+
code: "max_files",
|
|
1114
|
+
message: "Too many files. Some were not added."
|
|
1115
|
+
}));
|
|
1116
|
+
const se = [];
|
|
1117
|
+
for (const Q of de)
|
|
1118
|
+
se.push({
|
|
1119
|
+
id: Dt(),
|
|
1120
|
+
type: "file",
|
|
1121
|
+
url: URL.createObjectURL(Q),
|
|
1122
|
+
mediaType: Q.type,
|
|
1123
|
+
filename: Q.name
|
|
1124
|
+
});
|
|
1125
|
+
return M.concat(se);
|
|
1126
|
+
});
|
|
1127
|
+
},
|
|
1128
|
+
[G, p, h, u]
|
|
1129
|
+
), A = Z(
|
|
1130
|
+
(b) => P((D) => {
|
|
1131
|
+
const S = D.find((N) => N.id === b);
|
|
1132
|
+
return S != null && S.url && URL.revokeObjectURL(S.url), D.filter((N) => N.id !== b);
|
|
1133
|
+
}),
|
|
1134
|
+
[]
|
|
1135
|
+
), R = Z(
|
|
1136
|
+
() => P((b) => {
|
|
1137
|
+
for (const D of b)
|
|
1138
|
+
D.url && URL.revokeObjectURL(D.url);
|
|
1139
|
+
return [];
|
|
1140
|
+
}),
|
|
1141
|
+
[]
|
|
1142
|
+
), T = r ? o.attachments.add : K, j = r ? o.attachments.remove : A, V = r ? o.attachments.clear : R, d = r ? o.attachments.openFileDialog : U;
|
|
1143
|
+
z(() => {
|
|
1144
|
+
r && o.__registerFileInput(m, () => {
|
|
1145
|
+
var b;
|
|
1146
|
+
return (b = m.current) == null ? void 0 : b.click();
|
|
1147
|
+
});
|
|
1148
|
+
}, [r, o]), z(() => {
|
|
1149
|
+
i && m.current && w.length === 0 && (m.current.value = "");
|
|
1150
|
+
}, [w, i]), z(() => {
|
|
1151
|
+
const b = g.current;
|
|
1152
|
+
if (!b || s)
|
|
1153
|
+
return;
|
|
1154
|
+
const D = (N) => {
|
|
1155
|
+
var y, M;
|
|
1156
|
+
(M = (y = N.dataTransfer) == null ? void 0 : y.types) != null && M.includes("Files") && N.preventDefault();
|
|
1157
|
+
}, S = (N) => {
|
|
1158
|
+
var y, M, W;
|
|
1159
|
+
(M = (y = N.dataTransfer) == null ? void 0 : y.types) != null && M.includes("Files") && N.preventDefault(), (W = N.dataTransfer) != null && W.files && N.dataTransfer.files.length > 0 && T(N.dataTransfer.files);
|
|
1160
|
+
};
|
|
1161
|
+
return b.addEventListener("dragover", D), b.addEventListener("drop", S), () => {
|
|
1162
|
+
b.removeEventListener("dragover", D), b.removeEventListener("drop", S);
|
|
1163
|
+
};
|
|
1164
|
+
}, [T, s]), z(() => {
|
|
1165
|
+
if (!s)
|
|
1166
|
+
return;
|
|
1167
|
+
const b = (S) => {
|
|
1168
|
+
var N, y;
|
|
1169
|
+
(y = (N = S.dataTransfer) == null ? void 0 : N.types) != null && y.includes("Files") && S.preventDefault();
|
|
1170
|
+
}, D = (S) => {
|
|
1171
|
+
var N, y, M;
|
|
1172
|
+
(y = (N = S.dataTransfer) == null ? void 0 : N.types) != null && y.includes("Files") && S.preventDefault(), (M = S.dataTransfer) != null && M.files && S.dataTransfer.files.length > 0 && T(S.dataTransfer.files);
|
|
1173
|
+
};
|
|
1174
|
+
return document.addEventListener("dragover", b), document.addEventListener("drop", D), () => {
|
|
1175
|
+
document.removeEventListener("dragover", b), document.removeEventListener("drop", D);
|
|
1176
|
+
};
|
|
1177
|
+
}, [T, s]), z(
|
|
1178
|
+
() => () => {
|
|
1179
|
+
if (!r)
|
|
1180
|
+
for (const b of x.current)
|
|
1181
|
+
b.url && URL.revokeObjectURL(b.url);
|
|
1182
|
+
},
|
|
1183
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- cleanup only on unmount; filesRef always current
|
|
1184
|
+
[r]
|
|
1185
|
+
);
|
|
1186
|
+
const O = (b) => {
|
|
1187
|
+
b.currentTarget.files && T(b.currentTarget.files), b.currentTarget.value = "";
|
|
1188
|
+
}, E = async (b) => {
|
|
1189
|
+
try {
|
|
1190
|
+
const S = await (await fetch(b)).blob();
|
|
1191
|
+
return new Promise((N) => {
|
|
1192
|
+
const y = new FileReader();
|
|
1193
|
+
y.onloadend = () => N(y.result), y.onerror = () => N(null), y.readAsDataURL(S);
|
|
1194
|
+
});
|
|
1195
|
+
} catch {
|
|
1196
|
+
return null;
|
|
1197
|
+
}
|
|
1198
|
+
}, H = ge(
|
|
1199
|
+
() => ({
|
|
1200
|
+
files: w.map((b) => ({ ...b, id: b.id })),
|
|
1201
|
+
add: T,
|
|
1202
|
+
remove: j,
|
|
1203
|
+
clear: V,
|
|
1204
|
+
openFileDialog: d,
|
|
1205
|
+
fileInputRef: m
|
|
1206
|
+
}),
|
|
1207
|
+
[w, T, j, V, d]
|
|
1208
|
+
), Y = (b) => {
|
|
1209
|
+
b.preventDefault();
|
|
1210
|
+
const D = b.currentTarget, S = r ? o.textInput.value : new FormData(D).get("message") || "";
|
|
1211
|
+
r || D.reset(), Promise.all(
|
|
1212
|
+
w.map(async ({ id: N, ...y }) => {
|
|
1213
|
+
if (y.url && y.url.startsWith("blob:")) {
|
|
1214
|
+
const M = await E(y.url);
|
|
1215
|
+
return {
|
|
1216
|
+
...y,
|
|
1217
|
+
url: M ?? y.url
|
|
1218
|
+
};
|
|
1219
|
+
}
|
|
1220
|
+
return y;
|
|
1221
|
+
})
|
|
1222
|
+
).then((N) => {
|
|
1223
|
+
try {
|
|
1224
|
+
const y = f({ text: S, files: N }, b);
|
|
1225
|
+
y instanceof Promise ? y.then(() => {
|
|
1226
|
+
V(), r && o.textInput.clear();
|
|
1227
|
+
}).catch(() => {
|
|
1228
|
+
}) : (V(), r && o.textInput.clear());
|
|
1229
|
+
} catch {
|
|
1230
|
+
}
|
|
1231
|
+
}).catch(() => {
|
|
1232
|
+
});
|
|
1233
|
+
}, q = /* @__PURE__ */ l(le, { children: [
|
|
1234
|
+
/* @__PURE__ */ e(
|
|
1235
|
+
"input",
|
|
1236
|
+
{
|
|
1237
|
+
accept: n,
|
|
1238
|
+
"aria-label": "Upload files",
|
|
1239
|
+
className: "hidden",
|
|
1240
|
+
multiple: a,
|
|
1241
|
+
onChange: O,
|
|
1242
|
+
ref: m,
|
|
1243
|
+
title: "Upload files",
|
|
1244
|
+
type: "file"
|
|
1245
|
+
}
|
|
1246
|
+
),
|
|
1247
|
+
/* @__PURE__ */ e(
|
|
1248
|
+
"form",
|
|
1249
|
+
{
|
|
1250
|
+
className: C("w-full", t),
|
|
1251
|
+
onSubmit: Y,
|
|
1252
|
+
ref: g,
|
|
1253
|
+
...c,
|
|
1254
|
+
children: /* @__PURE__ */ e(Cn, { className: "overflow-hidden", children: _ })
|
|
1255
|
+
}
|
|
1256
|
+
)
|
|
1257
|
+
] });
|
|
1258
|
+
return r ? q : /* @__PURE__ */ e(Ee.Provider, { value: H, children: q });
|
|
1259
|
+
}, zn = ({
|
|
1260
|
+
className: t,
|
|
1261
|
+
...n
|
|
1262
|
+
}) => /* @__PURE__ */ e("div", { className: C("contents", t), ...n }), An = ({
|
|
1263
|
+
onChange: t,
|
|
1264
|
+
className: n,
|
|
1265
|
+
placeholder: a = "What would you like to know?",
|
|
1266
|
+
...s
|
|
1267
|
+
}) => {
|
|
1268
|
+
const i = Re(), p = ce(), [h, u] = I(!1), f = (o) => {
|
|
1269
|
+
if (o.key === "Enter") {
|
|
1270
|
+
if (h || o.nativeEvent.isComposing || o.shiftKey)
|
|
1271
|
+
return;
|
|
1272
|
+
o.preventDefault();
|
|
1273
|
+
const r = o.currentTarget.form, m = r == null ? void 0 : r.querySelector(
|
|
1274
|
+
'button[type="submit"]'
|
|
1275
|
+
);
|
|
1276
|
+
if (m != null && m.disabled)
|
|
1277
|
+
return;
|
|
1278
|
+
r == null || r.requestSubmit();
|
|
1279
|
+
}
|
|
1280
|
+
if (o.key === "Backspace" && o.currentTarget.value === "" && p.files.length > 0) {
|
|
1281
|
+
o.preventDefault();
|
|
1282
|
+
const r = p.files.at(-1);
|
|
1283
|
+
r && p.remove(r.id);
|
|
1284
|
+
}
|
|
1285
|
+
}, _ = (o) => {
|
|
1286
|
+
var g;
|
|
1287
|
+
const r = (g = o.clipboardData) == null ? void 0 : g.items;
|
|
1288
|
+
if (!r)
|
|
1289
|
+
return;
|
|
1290
|
+
const m = [];
|
|
1291
|
+
for (const v of r)
|
|
1292
|
+
if (v.kind === "file") {
|
|
1293
|
+
const P = v.getAsFile();
|
|
1294
|
+
P && m.push(P);
|
|
1295
|
+
}
|
|
1296
|
+
m.length > 0 && (o.preventDefault(), p.add(m));
|
|
1297
|
+
}, c = i ? {
|
|
1298
|
+
value: i.textInput.value,
|
|
1299
|
+
onChange: (o) => {
|
|
1300
|
+
i.textInput.setInput(o.currentTarget.value), t == null || t(o);
|
|
1301
|
+
}
|
|
1302
|
+
} : {
|
|
1303
|
+
onChange: t
|
|
1304
|
+
};
|
|
1305
|
+
return /* @__PURE__ */ e(
|
|
1306
|
+
Sn,
|
|
1307
|
+
{
|
|
1308
|
+
className: C("field-sizing-content max-h-48 min-h-16", n),
|
|
1309
|
+
name: "message",
|
|
1310
|
+
onCompositionEnd: () => u(!1),
|
|
1311
|
+
onCompositionStart: () => u(!0),
|
|
1312
|
+
onKeyDown: f,
|
|
1313
|
+
onPaste: _,
|
|
1314
|
+
placeholder: a,
|
|
1315
|
+
...s,
|
|
1316
|
+
...c
|
|
1317
|
+
}
|
|
1318
|
+
);
|
|
1319
|
+
}, On = ({
|
|
1320
|
+
className: t,
|
|
1321
|
+
...n
|
|
1322
|
+
}) => /* @__PURE__ */ e(
|
|
1323
|
+
Be,
|
|
1324
|
+
{
|
|
1325
|
+
align: "block-end",
|
|
1326
|
+
className: C("order-first flex-wrap gap-1", t),
|
|
1327
|
+
...n
|
|
1328
|
+
}
|
|
1329
|
+
), Un = ({
|
|
1330
|
+
className: t,
|
|
1331
|
+
...n
|
|
1332
|
+
}) => /* @__PURE__ */ e(
|
|
1333
|
+
Be,
|
|
1334
|
+
{
|
|
1335
|
+
align: "block-end",
|
|
1336
|
+
className: C("justify-between gap-1", t),
|
|
1337
|
+
...n
|
|
1338
|
+
}
|
|
1339
|
+
), Bn = ({
|
|
1340
|
+
variant: t = "ghost",
|
|
1341
|
+
className: n,
|
|
1342
|
+
size: a,
|
|
1343
|
+
...s
|
|
1344
|
+
}) => {
|
|
1345
|
+
const i = a ?? (qe.count(s.children) > 1 ? "sm" : "icon-sm");
|
|
1346
|
+
return /* @__PURE__ */ e(
|
|
1347
|
+
wn,
|
|
1348
|
+
{
|
|
1349
|
+
className: C(n),
|
|
1350
|
+
size: i,
|
|
1351
|
+
type: "button",
|
|
1352
|
+
variant: t,
|
|
1353
|
+
...s
|
|
1354
|
+
}
|
|
1355
|
+
);
|
|
1356
|
+
}, Rn = (t) => /* @__PURE__ */ e(pn, { ...t }), En = ({
|
|
1357
|
+
className: t,
|
|
1358
|
+
children: n,
|
|
1359
|
+
...a
|
|
1360
|
+
}) => /* @__PURE__ */ e(mn, { asChild: !0, children: /* @__PURE__ */ e(Bn, { className: t, ...a, children: n ?? /* @__PURE__ */ e(rt, { className: "size-4" }) }) }), Hn = ({
|
|
1361
|
+
className: t,
|
|
1362
|
+
...n
|
|
1363
|
+
}) => /* @__PURE__ */ e(hn, { align: "start", className: C(t), ...n }), jn = ({
|
|
1364
|
+
openDelay: t = 0,
|
|
1365
|
+
closeDelay: n = 0,
|
|
1366
|
+
...a
|
|
1367
|
+
}) => /* @__PURE__ */ e(_n, { closeDelay: n, openDelay: t, ...a }), Fn = ({
|
|
1368
|
+
align: t = "start",
|
|
1369
|
+
...n
|
|
1370
|
+
}) => /* @__PURE__ */ e(vn, { align: t, ...n });
|
|
1371
|
+
class we {
|
|
1372
|
+
constructor(n, a) {
|
|
1373
|
+
ue(this, "api");
|
|
1374
|
+
ue(this, "headers", {
|
|
1375
|
+
"Content-Type": "application/json"
|
|
1376
|
+
});
|
|
1377
|
+
this.api = n, this.headers = a ?? this.headers;
|
|
1378
|
+
}
|
|
1379
|
+
post(n) {
|
|
1380
|
+
return fetch(this.api, {
|
|
1381
|
+
method: "POST",
|
|
1382
|
+
headers: this.headers,
|
|
1383
|
+
body: JSON.stringify(n)
|
|
1384
|
+
});
|
|
1385
|
+
}
|
|
1386
|
+
put(n) {
|
|
1387
|
+
return fetch(this.api, {
|
|
1388
|
+
method: "PUT",
|
|
1389
|
+
headers: this.headers,
|
|
1390
|
+
body: JSON.stringify(n)
|
|
1391
|
+
});
|
|
1392
|
+
}
|
|
1393
|
+
}
|
|
1394
|
+
const He = (t) => {
|
|
1395
|
+
let n = !1;
|
|
1396
|
+
const a = (c) => {
|
|
1397
|
+
t((o) => {
|
|
1398
|
+
const r = o[o.length - 1];
|
|
1399
|
+
return (r == null ? void 0 : r.role) !== "assistant" ? o : [...o.slice(0, -1), c(r)];
|
|
1400
|
+
});
|
|
1401
|
+
}, s = (c) => {
|
|
1402
|
+
c && t((o) => {
|
|
1403
|
+
var m;
|
|
1404
|
+
const r = o[o.length - 1];
|
|
1405
|
+
return n && (r == null ? void 0 : r.role) === "assistant" && ((m = r == null ? void 0 : r.tool) == null ? void 0 : m.result) !== void 0 ? (n = !1, [...o, { role: "assistant", content: c }]) : (r == null ? void 0 : r.role) === "assistant" && (r != null && r.tool) && !r.tool.result ? o : (r == null ? void 0 : r.role) === "assistant" ? [
|
|
1406
|
+
...o.slice(0, -1),
|
|
1407
|
+
{ ...r, content: r.content + c }
|
|
1408
|
+
] : [...o, { role: "assistant", content: c }];
|
|
1409
|
+
});
|
|
1410
|
+
}, i = (c) => {
|
|
1411
|
+
t((o) => {
|
|
1412
|
+
const r = o[o.length - 1], m = {
|
|
1413
|
+
tool: c.tool,
|
|
1414
|
+
input: c.input
|
|
1415
|
+
};
|
|
1416
|
+
return (r == null ? void 0 : r.role) === "assistant" ? [...o.slice(0, -1), { ...r, tool: m }] : [...o, { role: "assistant", content: "", tool: m }];
|
|
1417
|
+
});
|
|
1418
|
+
}, p = (c) => {
|
|
1419
|
+
n = !0, a((o) => ({
|
|
1420
|
+
...o,
|
|
1421
|
+
tool: {
|
|
1422
|
+
...o.tool,
|
|
1423
|
+
result: c.result
|
|
1424
|
+
}
|
|
1425
|
+
}));
|
|
1426
|
+
}, h = (c) => (c == null ? void 0 : c.type) === "message_chunk" ? c.content : "", u = (c) => {
|
|
1427
|
+
const o = c == null ? void 0 : c.type;
|
|
1428
|
+
if (o === "tool_call") {
|
|
1429
|
+
i(c);
|
|
1430
|
+
return;
|
|
1431
|
+
}
|
|
1432
|
+
if (o === "tool_result") {
|
|
1433
|
+
p(c);
|
|
1434
|
+
return;
|
|
1435
|
+
}
|
|
1436
|
+
const r = h(c);
|
|
1437
|
+
r && s(r);
|
|
1438
|
+
}, f = (c) => {
|
|
1439
|
+
const o = c.trim();
|
|
1440
|
+
return !o || o.startsWith(":") || o.startsWith("event:") ? null : o === "[DONE]" ? "[DONE]" : o.startsWith("data:") ? o.slice(5).trim() : o;
|
|
1441
|
+
};
|
|
1442
|
+
return {
|
|
1443
|
+
splitChunks: async (c) => {
|
|
1444
|
+
if (!c.body)
|
|
1445
|
+
return;
|
|
1446
|
+
n = !1;
|
|
1447
|
+
const o = c.body.getReader(), r = new TextDecoder();
|
|
1448
|
+
let m = "";
|
|
1449
|
+
for (; ; ) {
|
|
1450
|
+
const { done: g, value: v } = await o.read();
|
|
1451
|
+
if (g)
|
|
1452
|
+
break;
|
|
1453
|
+
m += r.decode(v, { stream: !0 });
|
|
1454
|
+
const P = m.split(`
|
|
1455
|
+
`);
|
|
1456
|
+
m = P.pop() ?? "";
|
|
1457
|
+
for (const w of P) {
|
|
1458
|
+
const x = f(w);
|
|
1459
|
+
if (x) {
|
|
1460
|
+
if (x === "[DONE]")
|
|
1461
|
+
return;
|
|
1462
|
+
try {
|
|
1463
|
+
const U = JSON.parse(x);
|
|
1464
|
+
u(U);
|
|
1465
|
+
} catch {
|
|
1466
|
+
s(x);
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
};
|
|
1473
|
+
}, Gn = "demo-123", $n = (t, n) => {
|
|
1474
|
+
const [a, s] = I([]), { splitChunks: i } = He(s);
|
|
1475
|
+
return {
|
|
1476
|
+
onSubmit: async ({ params: h = {}, input: u, setInput: f, abortRef: _ }) => {
|
|
1477
|
+
var o;
|
|
1478
|
+
if (!u.trim())
|
|
1479
|
+
return;
|
|
1480
|
+
const c = u;
|
|
1481
|
+
f(""), s((r) => [...r, { role: "user", content: c }]);
|
|
1482
|
+
try {
|
|
1483
|
+
(o = _ == null ? void 0 : _.current) == null || o.abort();
|
|
1484
|
+
const r = new AbortController();
|
|
1485
|
+
_.current = r;
|
|
1486
|
+
const m = n ? {
|
|
1487
|
+
"Content-Type": "application/json",
|
|
1488
|
+
...n
|
|
1489
|
+
} : {}, g = new we(t, m), v = {
|
|
1490
|
+
chat_id: Gn,
|
|
1491
|
+
message: c,
|
|
1492
|
+
...h
|
|
1493
|
+
}, P = await g.post(v);
|
|
1494
|
+
if (!P.ok) {
|
|
1495
|
+
const w = await P.text().catch(() => "");
|
|
1496
|
+
throw new Error(`HTTP ${P.status} ${P.statusText} ${w}`);
|
|
1497
|
+
}
|
|
1498
|
+
i(P);
|
|
1499
|
+
} catch (r) {
|
|
1500
|
+
console.error("Error onSubmit", r);
|
|
1501
|
+
}
|
|
1502
|
+
},
|
|
1503
|
+
messages: a
|
|
1504
|
+
};
|
|
1505
|
+
}, pe = [
|
|
1506
|
+
{
|
|
1507
|
+
key: "suggestion-1",
|
|
1508
|
+
title: "Mostrar reglas del mismo conjunto (rule set)",
|
|
1509
|
+
description: "Lista todas las reglas que pertenecen al mismo conjunto de reglas de esta convocatoria."
|
|
1510
|
+
},
|
|
1511
|
+
{
|
|
1512
|
+
key: "suggestion-2",
|
|
1513
|
+
title: "Buscar reglas por tipo o etiquetas",
|
|
1514
|
+
description: "Encuentra reglas relacionadas filtrando por tipo específico o etiquetas asignadas."
|
|
1515
|
+
},
|
|
1516
|
+
{
|
|
1517
|
+
key: "suggestion-3",
|
|
1518
|
+
title: "Encontrar reglas con descripción similar",
|
|
1519
|
+
description: "Identifica reglas que tienen descripciones parecidas a la regla actual."
|
|
1520
|
+
},
|
|
1521
|
+
{
|
|
1522
|
+
key: "suggestion-4",
|
|
1523
|
+
title: "Listar reglas que afectan estudiantes similares",
|
|
1524
|
+
description: "Descubre reglas que impactan al mismo perfil de estudiantes según criterios compartidos."
|
|
1525
|
+
}
|
|
1526
|
+
], Wn = ({ className: t }) => /* @__PURE__ */ l(
|
|
1527
|
+
"svg",
|
|
1528
|
+
{
|
|
1529
|
+
className: t,
|
|
1530
|
+
fill: "none",
|
|
1531
|
+
preserveAspectRatio: "none",
|
|
1532
|
+
viewBox: "0 0 72 72",
|
|
1533
|
+
children: [
|
|
1534
|
+
/* @__PURE__ */ l("g", { children: [
|
|
1535
|
+
/* @__PURE__ */ e(
|
|
1536
|
+
"path",
|
|
1537
|
+
{
|
|
1538
|
+
d: "M36 0.5C55.6061 0.5 71.5 16.3939 71.5 36C71.5 55.6061 55.6061 71.5 36 71.5C16.3939 71.5 0.5 55.6061 0.5 36C0.5 16.3939 16.3939 0.5 36 0.5Z",
|
|
1539
|
+
fill: "white"
|
|
1540
|
+
}
|
|
1541
|
+
),
|
|
1542
|
+
/* @__PURE__ */ e(
|
|
1543
|
+
"path",
|
|
1544
|
+
{
|
|
1545
|
+
d: "M36 0.5C55.6061 0.5 71.5 16.3939 71.5 36C71.5 55.6061 55.6061 71.5 36 71.5C16.3939 71.5 0.5 55.6061 0.5 36C0.5 16.3939 16.3939 0.5 36 0.5Z",
|
|
1546
|
+
stroke: "url(#paint0_linear_large)"
|
|
1547
|
+
}
|
|
1548
|
+
),
|
|
1549
|
+
/* @__PURE__ */ l("g", { children: [
|
|
1550
|
+
/* @__PURE__ */ e(
|
|
1551
|
+
"path",
|
|
1552
|
+
{
|
|
1553
|
+
d: "M38.9821 55.1206C37.6998 56.8889 34.9068 55.7423 35.2368 53.583L36.1449 47.6417C36.2627 46.8707 35.94 46.0985 35.3088 45.6407L30.4432 42.1122C28.675 40.8297 29.8216 38.0368 31.9808 38.3669L37.9221 39.275C38.6931 39.3927 39.4652 39.07 39.923 38.4387L43.4516 33.5732C44.734 31.8049 47.5269 32.9515 47.1969 35.1108L46.2889 41.0521C46.1711 41.823 46.4937 42.5952 47.125 43.0531L51.9905 46.5817C53.7589 47.864 52.6123 50.6569 50.453 50.3269L44.5116 49.4189C43.7407 49.301 42.9686 49.6237 42.5107 50.2551L38.9821 55.1206Z",
|
|
1554
|
+
fill: "url(#paint1_linear_large)"
|
|
1555
|
+
}
|
|
1556
|
+
),
|
|
1557
|
+
/* @__PURE__ */ e(
|
|
1558
|
+
"path",
|
|
1559
|
+
{
|
|
1560
|
+
d: "M30.9942 29.8056C30.2051 30.8938 28.4863 30.1881 28.6894 28.8594L29.2482 25.2032C29.3207 24.7288 29.1222 24.2537 28.7337 23.972L25.7396 21.8004C24.6513 21.0113 25.3569 19.2926 26.6857 19.4957L30.3419 20.0545C30.8164 20.1269 31.2915 19.9284 31.5732 19.5399L33.7447 16.5457C34.5338 15.4576 36.2526 16.1632 36.0495 17.4919L35.4907 21.1481C35.4182 21.6225 35.6167 22.0977 36.0053 22.3796L38.9994 24.551C40.0876 25.3401 39.382 27.0588 38.0533 26.8557L34.3971 26.2969C33.9225 26.2244 33.4474 26.423 33.1657 26.8115L30.9942 29.8056Z",
|
|
1561
|
+
fill: "url(#paint2_linear_large)"
|
|
1562
|
+
}
|
|
1563
|
+
),
|
|
1564
|
+
/* @__PURE__ */ e(
|
|
1565
|
+
"path",
|
|
1566
|
+
{
|
|
1567
|
+
d: "M17.4703 46.5414C16.9525 47.2555 15.8246 46.7925 15.9579 45.9205L16.3246 43.5211C16.3722 43.2098 16.2418 42.8979 15.9869 42.713L14.022 41.288C13.3079 40.7701 13.7709 39.6422 14.643 39.7755L17.0424 40.1422C17.3536 40.1898 17.6655 40.0595 17.8504 39.8046L19.2754 37.8396C19.7933 37.1255 20.9212 37.5885 20.7878 38.4605L20.4211 40.8599C20.3737 41.1713 20.5039 41.4831 20.7589 41.668L22.7238 43.093C23.4379 43.6109 22.9748 44.7388 22.1029 44.6056L19.7035 44.2388C19.3921 44.1912 19.0803 44.3216 18.8953 44.5765L17.4703 46.5414Z",
|
|
1568
|
+
fill: "url(#paint3_linear_large)"
|
|
1569
|
+
}
|
|
1570
|
+
),
|
|
1571
|
+
/* @__PURE__ */ e(
|
|
1572
|
+
"path",
|
|
1573
|
+
{
|
|
1574
|
+
clipRule: "evenodd",
|
|
1575
|
+
d: "M16.8731 45.8438L18.0361 44.2401C18.501 43.599 19.2851 43.2714 20.0678 43.391L22.0261 43.6903L20.4224 42.5273C19.7814 42.0624 19.4537 41.2783 19.5733 40.4956L19.8728 38.5372L18.7096 40.141C18.2447 40.782 17.4608 41.1097 16.6779 40.99L14.7196 40.6907L16.3233 41.8538C16.9644 42.3187 17.292 43.1027 17.1724 43.8855L16.8731 45.8438ZM15.6129 46.4534C15.4606 47.4499 16.7496 47.9791 17.3415 47.163L18.97 44.9174C19.1813 44.626 19.5378 44.4771 19.8935 44.5314L22.6357 44.9506C23.6323 45.1028 24.1615 43.8138 23.3454 43.222L21.0997 41.5934C20.8084 41.3821 20.6594 41.0257 20.7138 40.6698L21.1329 37.9277C21.2852 36.9312 19.9962 36.402 19.4043 37.2181L17.7757 39.4636C17.5644 39.7551 17.2081 39.9041 16.8522 39.8496L14.1101 39.4305C13.1134 39.2782 12.5843 40.5672 13.4005 41.1591L15.646 42.7877C15.9375 42.999 16.0863 43.3554 16.0319 43.7112L15.6129 46.4534Z",
|
|
1576
|
+
fill: "url(#paint4_linear_large)",
|
|
1577
|
+
fillRule: "evenodd"
|
|
1578
|
+
}
|
|
1579
|
+
),
|
|
1580
|
+
/* @__PURE__ */ e(
|
|
1581
|
+
"path",
|
|
1582
|
+
{
|
|
1583
|
+
d: "M51.8864 20.871C52.8616 21.2714 53.3275 22.3866 52.9272 23.3618C52.5268 24.337 51.4117 24.803 50.4365 24.4026C49.4613 24.0023 48.9952 22.8871 49.3955 21.9119C49.7959 20.9367 50.9112 20.4706 51.8864 20.871Z",
|
|
1584
|
+
fill: "url(#paint5_linear_large)"
|
|
1585
|
+
}
|
|
1586
|
+
),
|
|
1587
|
+
/* @__PURE__ */ e(
|
|
1588
|
+
"path",
|
|
1589
|
+
{
|
|
1590
|
+
d: "M57.8156 31.5589C58.7908 31.9593 59.2569 33.0744 58.8565 34.0496C58.4561 35.0248 57.341 35.4908 56.3658 35.0904C55.3905 34.6901 54.9245 33.575 55.3249 32.5997C55.7252 31.6245 56.8404 31.1585 57.8156 31.5589Z",
|
|
1591
|
+
fill: "url(#paint6_linear_large)"
|
|
1592
|
+
}
|
|
1593
|
+
),
|
|
1594
|
+
/* @__PURE__ */ e(
|
|
1595
|
+
"path",
|
|
1596
|
+
{
|
|
1597
|
+
d: "M26.793 51.8375C27.7682 52.2379 28.2342 53.353 27.8338 54.3282C27.4335 55.3035 26.3183 55.7695 25.3431 55.3691C24.3679 54.9688 23.9018 53.8536 24.3022 52.8784C24.7025 51.9031 25.8178 51.4372 26.793 51.8375Z",
|
|
1598
|
+
fill: "url(#paint7_linear_large)"
|
|
1599
|
+
}
|
|
1600
|
+
),
|
|
1601
|
+
/* @__PURE__ */ e(
|
|
1602
|
+
"path",
|
|
1603
|
+
{
|
|
1604
|
+
d: "M18.875 25.8893C19.8502 26.2897 20.3161 27.4049 19.9158 28.3801C19.5154 29.3553 18.4003 29.8213 17.4251 29.4209C16.4499 29.0206 15.9838 27.9054 16.3841 26.9302C16.7845 25.955 17.8998 25.4889 18.875 25.8893Z",
|
|
1605
|
+
fill: "url(#paint8_linear_large)"
|
|
1606
|
+
}
|
|
1607
|
+
)
|
|
1608
|
+
] })
|
|
1609
|
+
] }),
|
|
1610
|
+
/* @__PURE__ */ l("defs", { children: [
|
|
1611
|
+
/* @__PURE__ */ l(
|
|
1612
|
+
"linearGradient",
|
|
1613
|
+
{
|
|
1614
|
+
gradientUnits: "userSpaceOnUse",
|
|
1615
|
+
id: "paint0_linear_large",
|
|
1616
|
+
x1: "0",
|
|
1617
|
+
x2: "72",
|
|
1618
|
+
y1: "36",
|
|
1619
|
+
y2: "36",
|
|
1620
|
+
children: [
|
|
1621
|
+
/* @__PURE__ */ e("stop", { stopColor: "#FF7173" }),
|
|
1622
|
+
/* @__PURE__ */ e("stop", { offset: "1", stopColor: "#0DC1D3" })
|
|
1623
|
+
]
|
|
1624
|
+
}
|
|
1625
|
+
),
|
|
1626
|
+
/* @__PURE__ */ l(
|
|
1627
|
+
"linearGradient",
|
|
1628
|
+
{
|
|
1629
|
+
gradientUnits: "userSpaceOnUse",
|
|
1630
|
+
id: "paint1_linear_large",
|
|
1631
|
+
x1: "13",
|
|
1632
|
+
x2: "59",
|
|
1633
|
+
y1: "36",
|
|
1634
|
+
y2: "36",
|
|
1635
|
+
children: [
|
|
1636
|
+
/* @__PURE__ */ e("stop", { stopColor: "#FF7173" }),
|
|
1637
|
+
/* @__PURE__ */ e("stop", { offset: "1", stopColor: "#0DC1D3" })
|
|
1638
|
+
]
|
|
1639
|
+
}
|
|
1640
|
+
),
|
|
1641
|
+
/* @__PURE__ */ l(
|
|
1642
|
+
"linearGradient",
|
|
1643
|
+
{
|
|
1644
|
+
gradientUnits: "userSpaceOnUse",
|
|
1645
|
+
id: "paint2_linear_large",
|
|
1646
|
+
x1: "13",
|
|
1647
|
+
x2: "59",
|
|
1648
|
+
y1: "36",
|
|
1649
|
+
y2: "36",
|
|
1650
|
+
children: [
|
|
1651
|
+
/* @__PURE__ */ e("stop", { stopColor: "#FF7173" }),
|
|
1652
|
+
/* @__PURE__ */ e("stop", { offset: "1", stopColor: "#0DC1D3" })
|
|
1653
|
+
]
|
|
1654
|
+
}
|
|
1655
|
+
),
|
|
1656
|
+
/* @__PURE__ */ l(
|
|
1657
|
+
"linearGradient",
|
|
1658
|
+
{
|
|
1659
|
+
gradientUnits: "userSpaceOnUse",
|
|
1660
|
+
id: "paint3_linear_large",
|
|
1661
|
+
x1: "13",
|
|
1662
|
+
x2: "59",
|
|
1663
|
+
y1: "36",
|
|
1664
|
+
y2: "36",
|
|
1665
|
+
children: [
|
|
1666
|
+
/* @__PURE__ */ e("stop", { stopColor: "#FF7173" }),
|
|
1667
|
+
/* @__PURE__ */ e("stop", { offset: "1", stopColor: "#0DC1D3" })
|
|
1668
|
+
]
|
|
1669
|
+
}
|
|
1670
|
+
),
|
|
1671
|
+
/* @__PURE__ */ l(
|
|
1672
|
+
"linearGradient",
|
|
1673
|
+
{
|
|
1674
|
+
gradientUnits: "userSpaceOnUse",
|
|
1675
|
+
id: "paint4_linear_large",
|
|
1676
|
+
x1: "13",
|
|
1677
|
+
x2: "59",
|
|
1678
|
+
y1: "36",
|
|
1679
|
+
y2: "36",
|
|
1680
|
+
children: [
|
|
1681
|
+
/* @__PURE__ */ e("stop", { stopColor: "#FF7173" }),
|
|
1682
|
+
/* @__PURE__ */ e("stop", { offset: "1", stopColor: "#0DC1D3" })
|
|
1683
|
+
]
|
|
1684
|
+
}
|
|
1685
|
+
),
|
|
1686
|
+
/* @__PURE__ */ l(
|
|
1687
|
+
"linearGradient",
|
|
1688
|
+
{
|
|
1689
|
+
gradientUnits: "userSpaceOnUse",
|
|
1690
|
+
id: "paint5_linear_large",
|
|
1691
|
+
x1: "13",
|
|
1692
|
+
x2: "59",
|
|
1693
|
+
y1: "36",
|
|
1694
|
+
y2: "36",
|
|
1695
|
+
children: [
|
|
1696
|
+
/* @__PURE__ */ e("stop", { stopColor: "#FF7173" }),
|
|
1697
|
+
/* @__PURE__ */ e("stop", { offset: "1", stopColor: "#0DC1D3" })
|
|
1698
|
+
]
|
|
1699
|
+
}
|
|
1700
|
+
),
|
|
1701
|
+
/* @__PURE__ */ l(
|
|
1702
|
+
"linearGradient",
|
|
1703
|
+
{
|
|
1704
|
+
gradientUnits: "userSpaceOnUse",
|
|
1705
|
+
id: "paint6_linear_large",
|
|
1706
|
+
x1: "13",
|
|
1707
|
+
x2: "59",
|
|
1708
|
+
y1: "36",
|
|
1709
|
+
y2: "36",
|
|
1710
|
+
children: [
|
|
1711
|
+
/* @__PURE__ */ e("stop", { stopColor: "#FF7173" }),
|
|
1712
|
+
/* @__PURE__ */ e("stop", { offset: "1", stopColor: "#0DC1D3" })
|
|
1713
|
+
]
|
|
1714
|
+
}
|
|
1715
|
+
),
|
|
1716
|
+
/* @__PURE__ */ l(
|
|
1717
|
+
"linearGradient",
|
|
1718
|
+
{
|
|
1719
|
+
gradientUnits: "userSpaceOnUse",
|
|
1720
|
+
id: "paint7_linear_large",
|
|
1721
|
+
x1: "13",
|
|
1722
|
+
x2: "59",
|
|
1723
|
+
y1: "36",
|
|
1724
|
+
y2: "36",
|
|
1725
|
+
children: [
|
|
1726
|
+
/* @__PURE__ */ e("stop", { stopColor: "#FF7173" }),
|
|
1727
|
+
/* @__PURE__ */ e("stop", { offset: "1", stopColor: "#0DC1D3" })
|
|
1728
|
+
]
|
|
1729
|
+
}
|
|
1730
|
+
),
|
|
1731
|
+
/* @__PURE__ */ l(
|
|
1732
|
+
"linearGradient",
|
|
1733
|
+
{
|
|
1734
|
+
gradientUnits: "userSpaceOnUse",
|
|
1735
|
+
id: "paint8_linear_large",
|
|
1736
|
+
x1: "13",
|
|
1737
|
+
x2: "59",
|
|
1738
|
+
y1: "36",
|
|
1739
|
+
y2: "36",
|
|
1740
|
+
children: [
|
|
1741
|
+
/* @__PURE__ */ e("stop", { stopColor: "#FF7173" }),
|
|
1742
|
+
/* @__PURE__ */ e("stop", { offset: "1", stopColor: "#0DC1D3" })
|
|
1743
|
+
]
|
|
1744
|
+
}
|
|
1745
|
+
)
|
|
1746
|
+
] })
|
|
1747
|
+
]
|
|
1748
|
+
}
|
|
1749
|
+
), Zn = "_chatPanel_1hevb_1", qn = "_chatPanel__expanded_1hevb_14", Jn = "_chatPanel__resizing_1hevb_17", Kn = "_chatPanel_header_1hevb_20", Vn = "_chatPanel_actions_1hevb_29", Yn = "_chatPanel_actionButton_1hevb_35", Xn = "_chatPanel_title_1hevb_53", Qn = "_chatPanel_closeButton_1hevb_59", ea = "_chatPanel_welcome_1hevb_62", ta = "_chatPanel_welcomeLogo_1hevb_69", na = "_chatPanel_welcomeTitle_1hevb_74", aa = "_chatPanel_welcomeDescription_1hevb_81", ra = "_chatPanel_welcomeSuggestions_1hevb_88", oa = "_chatPanel_welcomeSuggestion_1hevb_88", sa = "_chatPanel_welcomeSuggestionTitle_1hevb_109", ia = "_chatPanel_welcomeSuggestionIcon_1hevb_112", la = "_chatPanel_welcomeSuggestionText_1hevb_116", ca = "_chatPanel_welcomeSuggestionDescription_1hevb_127", da = "_chatPanel_content_1hevb_141", ua = "_chatPanel_conversation_1hevb_147", pa = "_chatPanel_textMessage_1hevb_198", ma = "_chatPanel_textMessage__assistant_1hevb_198", ha = "_chatPanel_textMessage__user_1hevb_204", fa = "_chatPanel_tool_1hevb_212", _a = "_chatPanel_inputSubmit_1hevb_251", ga = "_chatPanel_inputSubmitIcon_1hevb_265", va = "_chatPanel_ruleCard_1hevb_269", ba = "_chatPanel_ruleCardHeader_1hevb_276", xa = "_chatPanel_ruleCardTitle_1hevb_283", Ca = "_chatPanel_ruleCardStatus_1hevb_283", ya = "_chatPanel_ruleCardDescription_1hevb_283", Pa = "_chatPanel_ruleCardTag_1hevb_283", wa = "_chatPanel_ruleCardTags_1hevb_301", Sa = "_chatPanel_typingIndicator_1hevb_313", Na = "_typingIndicatorBlink_1hevb_1", ka = "_chatPanel_reasoning_1hevb_334", Ia = "_chatPanel_resizer_1hevb_337", La = "_chatPanel_input_1hevb_251", k = {
|
|
1750
|
+
chatPanel: Zn,
|
|
1751
|
+
chatPanel__expanded: qn,
|
|
1752
|
+
chatPanel__resizing: Jn,
|
|
1753
|
+
chatPanel_header: Kn,
|
|
1754
|
+
chatPanel_actions: Vn,
|
|
1755
|
+
chatPanel_actionButton: Yn,
|
|
1756
|
+
chatPanel_title: Xn,
|
|
1757
|
+
chatPanel_closeButton: Qn,
|
|
1758
|
+
chatPanel_welcome: ea,
|
|
1759
|
+
chatPanel_welcomeLogo: ta,
|
|
1760
|
+
chatPanel_welcomeTitle: na,
|
|
1761
|
+
chatPanel_welcomeDescription: aa,
|
|
1762
|
+
chatPanel_welcomeSuggestions: ra,
|
|
1763
|
+
chatPanel_welcomeSuggestion: oa,
|
|
1764
|
+
chatPanel_welcomeSuggestionTitle: sa,
|
|
1765
|
+
chatPanel_welcomeSuggestionIcon: ia,
|
|
1766
|
+
chatPanel_welcomeSuggestionText: la,
|
|
1767
|
+
chatPanel_welcomeSuggestionDescription: ca,
|
|
1768
|
+
chatPanel_content: da,
|
|
1769
|
+
chatPanel_conversation: ua,
|
|
1770
|
+
chatPanel_textMessage: pa,
|
|
1771
|
+
chatPanel_textMessage__assistant: ma,
|
|
1772
|
+
chatPanel_textMessage__user: ha,
|
|
1773
|
+
chatPanel_tool: fa,
|
|
1774
|
+
chatPanel_inputSubmit: _a,
|
|
1775
|
+
chatPanel_inputSubmitIcon: ga,
|
|
1776
|
+
chatPanel_ruleCard: va,
|
|
1777
|
+
chatPanel_ruleCardHeader: ba,
|
|
1778
|
+
chatPanel_ruleCardTitle: xa,
|
|
1779
|
+
chatPanel_ruleCardStatus: Ca,
|
|
1780
|
+
chatPanel_ruleCardDescription: ya,
|
|
1781
|
+
chatPanel_ruleCardTag: Pa,
|
|
1782
|
+
chatPanel_ruleCardTags: wa,
|
|
1783
|
+
chatPanel_typingIndicator: Sa,
|
|
1784
|
+
typingIndicatorBlink: Na,
|
|
1785
|
+
chatPanel_reasoning: ka,
|
|
1786
|
+
chatPanel_resizer: Ia,
|
|
1787
|
+
chatPanel_input: La
|
|
1788
|
+
}, Ta = (t, n = {}) => {
|
|
1789
|
+
const { threshold: a = 50, delay: s = 100 } = n, i = B(null), p = B(null), h = B(!1), u = B(), f = B(0), _ = Z(() => {
|
|
1790
|
+
if (!i.current)
|
|
1791
|
+
return !0;
|
|
1792
|
+
const { scrollTop: r, scrollHeight: m, clientHeight: g } = i.current;
|
|
1793
|
+
return m - r - g <= a;
|
|
1794
|
+
}, [a]), c = Z(
|
|
1795
|
+
(r = !1) => {
|
|
1796
|
+
if (!i.current || h.current)
|
|
1797
|
+
return;
|
|
1798
|
+
const m = () => {
|
|
1799
|
+
i.current && i.current.scrollTo({
|
|
1800
|
+
top: i.current.scrollHeight,
|
|
1801
|
+
behavior: r ? "auto" : "smooth"
|
|
1802
|
+
});
|
|
1803
|
+
};
|
|
1804
|
+
u.current && clearTimeout(u.current), r ? m() : u.current = setTimeout(m, s);
|
|
1805
|
+
},
|
|
1806
|
+
[s]
|
|
1807
|
+
), o = Z(() => {
|
|
1808
|
+
h.current = !1;
|
|
1809
|
+
}, []);
|
|
1810
|
+
return z(() => {
|
|
1811
|
+
const r = () => {
|
|
1812
|
+
if (!i.current)
|
|
1813
|
+
return;
|
|
1814
|
+
const g = _();
|
|
1815
|
+
h.current = !g;
|
|
1816
|
+
}, m = i.current;
|
|
1817
|
+
if (m)
|
|
1818
|
+
return m.addEventListener("scroll", r, { passive: !0 }), () => m.removeEventListener("scroll", r);
|
|
1819
|
+
}, [_]), z(() => {
|
|
1820
|
+
if (!i.current)
|
|
1821
|
+
return;
|
|
1822
|
+
const r = i.current.scrollHeight, m = r > f.current;
|
|
1823
|
+
_() && !h.current ? requestAnimationFrame(() => {
|
|
1824
|
+
i.current && i.current.scrollTo({
|
|
1825
|
+
top: i.current.scrollHeight,
|
|
1826
|
+
behavior: "smooth"
|
|
1827
|
+
});
|
|
1828
|
+
}) : m && !h.current && requestAnimationFrame(() => {
|
|
1829
|
+
c();
|
|
1830
|
+
}), f.current = r;
|
|
1831
|
+
}, t), z(() => () => {
|
|
1832
|
+
u.current && clearTimeout(u.current);
|
|
1833
|
+
}, []), {
|
|
1834
|
+
scrollRef: i,
|
|
1835
|
+
contentRef: p,
|
|
1836
|
+
scrollToBottom: c,
|
|
1837
|
+
resetUserScrolling: o,
|
|
1838
|
+
isAtBottom: _
|
|
1839
|
+
};
|
|
1840
|
+
}, Lo = ({
|
|
1841
|
+
api: t,
|
|
1842
|
+
params: n = {},
|
|
1843
|
+
headers: a,
|
|
1844
|
+
className: s,
|
|
1845
|
+
onClose: i,
|
|
1846
|
+
...p
|
|
1847
|
+
}) => {
|
|
1848
|
+
const { onSubmit: h, messages: u } = $n(t, a), [f, _] = I(""), [c, o] = I([]), [r, m] = I(!1), [g, v] = I(!1), [P, w] = I(!1), x = B(null), U = B(null), G = B(/* @__PURE__ */ new Map()), {
|
|
1849
|
+
scrollRef: K,
|
|
1850
|
+
contentRef: A,
|
|
1851
|
+
scrollToBottom: R,
|
|
1852
|
+
resetUserScrolling: T,
|
|
1853
|
+
isAtBottom: j
|
|
1854
|
+
} = Ta([c, r], {
|
|
1855
|
+
threshold: 50,
|
|
1856
|
+
delay: 50
|
|
1857
|
+
}), V = Z(
|
|
1858
|
+
async (d) => {
|
|
1859
|
+
var H;
|
|
1860
|
+
const O = !!d.text, E = !!((H = d.files) != null && H.length);
|
|
1861
|
+
(O || E) && (P || w(!0), m(!0), T(), R(!0), await h({
|
|
1862
|
+
params: n,
|
|
1863
|
+
input: d.text || "",
|
|
1864
|
+
setInput: _,
|
|
1865
|
+
abortRef: U
|
|
1866
|
+
}), m(!1));
|
|
1867
|
+
},
|
|
1868
|
+
[h]
|
|
1869
|
+
);
|
|
1870
|
+
return z(() => {
|
|
1871
|
+
if (u.length === 0)
|
|
1872
|
+
return;
|
|
1873
|
+
const d = u.map((O, E) => {
|
|
1874
|
+
G.current.has(E) || G.current.set(E, `chat-${E}-${Date.now()}`);
|
|
1875
|
+
const H = G.current.get(E);
|
|
1876
|
+
return {
|
|
1877
|
+
key: H,
|
|
1878
|
+
from: O.role,
|
|
1879
|
+
versions: [
|
|
1880
|
+
{
|
|
1881
|
+
id: `version-${H}`,
|
|
1882
|
+
content: O.content
|
|
1883
|
+
}
|
|
1884
|
+
],
|
|
1885
|
+
tool: O.tool
|
|
1886
|
+
};
|
|
1887
|
+
});
|
|
1888
|
+
o((O) => {
|
|
1889
|
+
var E, H, Y, q, b, D, S, N;
|
|
1890
|
+
if (O.length === d.length && O.length > 0) {
|
|
1891
|
+
const y = O.length - 1, M = (Y = (H = (E = O[y]) == null ? void 0 : E.versions) == null ? void 0 : H[0]) == null ? void 0 : Y.content, W = (D = (b = (q = d[y]) == null ? void 0 : q.versions) == null ? void 0 : b[0]) == null ? void 0 : D.content, de = (S = O[y]) == null ? void 0 : S.tool, se = (N = d[y]) == null ? void 0 : N.tool;
|
|
1892
|
+
if (M !== W || JSON.stringify(de) !== JSON.stringify(se)) {
|
|
1893
|
+
const Q = [...O];
|
|
1894
|
+
return Q[y] = d[y], j() && T(), Q;
|
|
1895
|
+
}
|
|
1896
|
+
return O;
|
|
1897
|
+
}
|
|
1898
|
+
return T(), d;
|
|
1899
|
+
});
|
|
1900
|
+
}, [u, j, T]), /* @__PURE__ */ l(
|
|
1901
|
+
"div",
|
|
1902
|
+
{
|
|
1903
|
+
ref: x,
|
|
1904
|
+
className: C(
|
|
1905
|
+
k.chatPanel,
|
|
1906
|
+
g && k.chatPanel__expanded,
|
|
1907
|
+
s
|
|
1908
|
+
),
|
|
1909
|
+
...p,
|
|
1910
|
+
children: [
|
|
1911
|
+
/* @__PURE__ */ l("header", { className: k.chatPanel_header, children: [
|
|
1912
|
+
/* @__PURE__ */ e("h2", { className: k.chatPanel_title, children: "Foris Agent" }),
|
|
1913
|
+
/* @__PURE__ */ l("div", { className: k.chatPanel_actions, children: [
|
|
1914
|
+
/* @__PURE__ */ e(
|
|
1915
|
+
"button",
|
|
1916
|
+
{
|
|
1917
|
+
className: k.chatPanel_actionButton,
|
|
1918
|
+
onClick: () => v(!g),
|
|
1919
|
+
children: g ? /* @__PURE__ */ e(st, { size: "16" }) : /* @__PURE__ */ e(it, { size: "16" })
|
|
1920
|
+
}
|
|
1921
|
+
),
|
|
1922
|
+
!!i && /* @__PURE__ */ e("button", { className: k.chatPanel_actionButton, onClick: i, children: /* @__PURE__ */ e(me, { name: "close", color: "neutral-90" }) })
|
|
1923
|
+
] })
|
|
1924
|
+
] }),
|
|
1925
|
+
/* @__PURE__ */ e("div", { className: k.chatPanel_content, children: /* @__PURE__ */ e(
|
|
1926
|
+
"div",
|
|
1927
|
+
{
|
|
1928
|
+
ref: K,
|
|
1929
|
+
id: "chatPanel_conversation",
|
|
1930
|
+
className: k.chatPanel_conversation,
|
|
1931
|
+
children: /* @__PURE__ */ l(
|
|
1932
|
+
"div",
|
|
1933
|
+
{
|
|
1934
|
+
ref: A,
|
|
1935
|
+
className: k.chatPanel_conversationContent,
|
|
1936
|
+
children: [
|
|
1937
|
+
!P && /* @__PURE__ */ l("div", { className: k.chatPanel_welcome, children: [
|
|
1938
|
+
/* @__PURE__ */ e(Wn, { className: k.chatPanel_welcomeLogo }),
|
|
1939
|
+
/* @__PURE__ */ e("h3", { className: k.chatPanel_welcomeTitle, children: "¿Cómo puedo ayudarte?" }),
|
|
1940
|
+
/* @__PURE__ */ e("p", { className: k.chatPanel_welcomeDescription, children: "Puedes elegir una sugerencia o hacerme una pregunta." }),
|
|
1941
|
+
/* @__PURE__ */ e("ul", { className: k.chatPanel_welcomeSuggestions, children: pe == null ? void 0 : pe.map((d) => /* @__PURE__ */ l(
|
|
1942
|
+
"li",
|
|
1943
|
+
{
|
|
1944
|
+
className: k.chatPanel_welcomeSuggestion,
|
|
1945
|
+
role: "button",
|
|
1946
|
+
onClick: () => V({
|
|
1947
|
+
text: d == null ? void 0 : d.title,
|
|
1948
|
+
files: []
|
|
1949
|
+
}),
|
|
1950
|
+
children: [
|
|
1951
|
+
/* @__PURE__ */ l("div", { className: k.chatPanel_welcomeSuggestionText, children: [
|
|
1952
|
+
/* @__PURE__ */ e("p", { className: k.chatPanel_welcomeSuggestionTitle, children: d == null ? void 0 : d.title }),
|
|
1953
|
+
/* @__PURE__ */ e(
|
|
1954
|
+
"p",
|
|
1955
|
+
{
|
|
1956
|
+
className: k.chatPanel_welcomeSuggestionDescription,
|
|
1957
|
+
children: d == null ? void 0 : d.description
|
|
1958
|
+
}
|
|
1959
|
+
)
|
|
1960
|
+
] }),
|
|
1961
|
+
/* @__PURE__ */ e(
|
|
1962
|
+
me,
|
|
1963
|
+
{
|
|
1964
|
+
className: k.chatPanel_welcomeSuggestionIcon,
|
|
1965
|
+
name: "chevron-right",
|
|
1966
|
+
color: "neutral-90"
|
|
1967
|
+
}
|
|
1968
|
+
)
|
|
1969
|
+
]
|
|
1970
|
+
},
|
|
1971
|
+
d.key
|
|
1972
|
+
)) })
|
|
1973
|
+
] }),
|
|
1974
|
+
P && (c == null ? void 0 : c.map((d, O) => {
|
|
1975
|
+
var E, H, Y;
|
|
1976
|
+
return /* @__PURE__ */ l(
|
|
1977
|
+
"div",
|
|
1978
|
+
{
|
|
1979
|
+
className: `from-${d.from}`,
|
|
1980
|
+
children: [
|
|
1981
|
+
(d == null ? void 0 : d.from) === "assistant" && (d == null ? void 0 : d.sources) && !!((E = d == null ? void 0 : d.sources) != null && E.length) && /* @__PURE__ */ l(Qt, { className: k.chatPanel_sources, children: [
|
|
1982
|
+
/* @__PURE__ */ e(en, { count: d.sources.length }),
|
|
1983
|
+
d.sources.map((q, b) => /* @__PURE__ */ e(tn, { children: /* @__PURE__ */ e(nn, { href: q.href, title: q.title }) }, `${d.key}-source-${b}`))
|
|
1984
|
+
] }),
|
|
1985
|
+
(d == null ? void 0 : d.from) === "assistant" && (d == null ? void 0 : d.reasoning) && /* @__PURE__ */ l(Ae, { className: k.chatPanel_reasoning, children: [
|
|
1986
|
+
/* @__PURE__ */ e(Oe, {}),
|
|
1987
|
+
/* @__PURE__ */ e(Ue, { children: d.reasoning.content })
|
|
1988
|
+
] }),
|
|
1989
|
+
(d == null ? void 0 : d.from) === "assistant" && (d == null ? void 0 : d.tool) && /* @__PURE__ */ l(on, { defaultOpen: !0, className: k.chatPanel_tool, children: [
|
|
1990
|
+
/* @__PURE__ */ e(
|
|
1991
|
+
ln,
|
|
1992
|
+
{
|
|
1993
|
+
title: d.tool.tool,
|
|
1994
|
+
type: `tool-${d.tool.tool}`,
|
|
1995
|
+
state: d.tool.result !== void 0 ? "output-available" : "input-available"
|
|
1996
|
+
}
|
|
1997
|
+
),
|
|
1998
|
+
/* @__PURE__ */ l(cn, { children: [
|
|
1999
|
+
d.tool.input && /* @__PURE__ */ e(dn, { input: d.tool.input }),
|
|
2000
|
+
d.tool.result !== void 0 && /* @__PURE__ */ e(
|
|
2001
|
+
un,
|
|
2002
|
+
{
|
|
2003
|
+
output: /* @__PURE__ */ e(fe, { children: typeof d.tool.result == "string" ? d.tool.result : JSON.stringify(
|
|
2004
|
+
d.tool.result,
|
|
2005
|
+
null,
|
|
2006
|
+
2
|
|
2007
|
+
) }),
|
|
2008
|
+
errorText: void 0
|
|
2009
|
+
}
|
|
2010
|
+
)
|
|
2011
|
+
] })
|
|
2012
|
+
] }),
|
|
2013
|
+
/* @__PURE__ */ e(Wt, { from: d.from, children: /* @__PURE__ */ e(Zt, { children: /* @__PURE__ */ e(fe, { children: ((Y = (H = d == null ? void 0 : d.versions) == null ? void 0 : H[0]) == null ? void 0 : Y.content) || "" }) }) })
|
|
2014
|
+
]
|
|
2015
|
+
},
|
|
2016
|
+
`${d.key}-${O}`
|
|
2017
|
+
);
|
|
2018
|
+
})),
|
|
2019
|
+
P && r && /* @__PURE__ */ e("div", { className: "from-assistant", children: /* @__PURE__ */ l("div", { className: k.chatPanel_typingIndicator, children: [
|
|
2020
|
+
/* @__PURE__ */ e("span", {}),
|
|
2021
|
+
/* @__PURE__ */ e("span", {}),
|
|
2022
|
+
/* @__PURE__ */ e("span", {})
|
|
2023
|
+
] }) })
|
|
2024
|
+
]
|
|
2025
|
+
}
|
|
2026
|
+
)
|
|
2027
|
+
}
|
|
2028
|
+
) }),
|
|
2029
|
+
/* @__PURE__ */ e("div", { className: k.chatPanel_resizer }),
|
|
2030
|
+
/* @__PURE__ */ e("div", { className: k.chatPanel_input, children: /* @__PURE__ */ l(Mn, { onSubmit: V, globalDrop: !0, multiple: !0, children: [
|
|
2031
|
+
/* @__PURE__ */ e(On, { children: /* @__PURE__ */ e(Tn, { children: (d) => /* @__PURE__ */ e(Ln, { data: d }) }) }),
|
|
2032
|
+
/* @__PURE__ */ e(zn, { children: /* @__PURE__ */ e(
|
|
2033
|
+
An,
|
|
2034
|
+
{
|
|
2035
|
+
placeholder: "Hazme una pregunta",
|
|
2036
|
+
onChange: (d) => _(d.target.value),
|
|
2037
|
+
value: f
|
|
2038
|
+
}
|
|
2039
|
+
) }),
|
|
2040
|
+
/* @__PURE__ */ l(Un, { children: [
|
|
2041
|
+
/* @__PURE__ */ l(Rn, { children: [
|
|
2042
|
+
/* @__PURE__ */ e(En, {}),
|
|
2043
|
+
/* @__PURE__ */ e(Hn, { children: /* @__PURE__ */ e(Dn, {}) })
|
|
2044
|
+
] }),
|
|
2045
|
+
/* @__PURE__ */ e(
|
|
2046
|
+
"button",
|
|
2047
|
+
{
|
|
2048
|
+
className: k.chatPanel_inputSubmit,
|
|
2049
|
+
type: "submit",
|
|
2050
|
+
disabled: !f,
|
|
2051
|
+
children: /* @__PURE__ */ e(
|
|
2052
|
+
"svg",
|
|
2053
|
+
{
|
|
2054
|
+
className: k.chatPanel_inputSubmitIcon,
|
|
2055
|
+
fill: "none",
|
|
2056
|
+
viewBox: "0 0 20 20",
|
|
2057
|
+
children: /* @__PURE__ */ e(
|
|
2058
|
+
"path",
|
|
2059
|
+
{
|
|
2060
|
+
d: "M17.5 2.5L8.75 11.25M17.5 2.5L11.875 17.5L8.75 11.25M17.5 2.5L2.5 8.125L8.75 11.25",
|
|
2061
|
+
stroke: "currentColor",
|
|
2062
|
+
strokeLinecap: "round",
|
|
2063
|
+
strokeLinejoin: "round",
|
|
2064
|
+
strokeWidth: "1.66667"
|
|
2065
|
+
}
|
|
2066
|
+
)
|
|
2067
|
+
}
|
|
2068
|
+
)
|
|
2069
|
+
}
|
|
2070
|
+
)
|
|
2071
|
+
] })
|
|
2072
|
+
] }) })
|
|
2073
|
+
]
|
|
2074
|
+
}
|
|
2075
|
+
);
|
|
2076
|
+
};
|
|
2077
|
+
function Da(t) {
|
|
2078
|
+
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
2079
|
+
}
|
|
2080
|
+
var je = { exports: {} };
|
|
2081
|
+
/*!
|
|
2082
|
+
Copyright (c) 2018 Jed Watson.
|
|
2083
|
+
Licensed under the MIT License (MIT), see
|
|
2084
|
+
http://jedwatson.github.io/classnames
|
|
2085
|
+
*/
|
|
2086
|
+
(function(t) {
|
|
2087
|
+
(function() {
|
|
2088
|
+
var n = {}.hasOwnProperty;
|
|
2089
|
+
function a() {
|
|
2090
|
+
for (var s = [], i = 0; i < arguments.length; i++) {
|
|
2091
|
+
var p = arguments[i];
|
|
2092
|
+
if (p) {
|
|
2093
|
+
var h = typeof p;
|
|
2094
|
+
if (h === "string" || h === "number")
|
|
2095
|
+
s.push(p);
|
|
2096
|
+
else if (Array.isArray(p)) {
|
|
2097
|
+
if (p.length) {
|
|
2098
|
+
var u = a.apply(null, p);
|
|
2099
|
+
u && s.push(u);
|
|
2100
|
+
}
|
|
2101
|
+
} else if (h === "object") {
|
|
2102
|
+
if (p.toString !== Object.prototype.toString && !p.toString.toString().includes("[native code]")) {
|
|
2103
|
+
s.push(p.toString());
|
|
2104
|
+
continue;
|
|
2105
|
+
}
|
|
2106
|
+
for (var f in p)
|
|
2107
|
+
n.call(p, f) && p[f] && s.push(f);
|
|
2108
|
+
}
|
|
2109
|
+
}
|
|
2110
|
+
}
|
|
2111
|
+
return s.join(" ");
|
|
2112
|
+
}
|
|
2113
|
+
t.exports ? (a.default = a, t.exports = a) : window.classNames = a;
|
|
2114
|
+
})();
|
|
2115
|
+
})(je);
|
|
2116
|
+
var Ma = je.exports;
|
|
2117
|
+
const _e = /* @__PURE__ */ Da(Ma), za = "_aiSparklesIcon_1ixvw_1", Aa = "_aiSparklesIcon__animated_1ixvw_5", Oa = "_aiSparklesIcon_aiMainPulse_1ixvw_14", Ua = "_aiMainPulse_1ixvw_1", Ba = "_aiSparklesIcon_aiSecondaryPulse_1ixvw_17", Ra = "_aiSecondaryPulse_1ixvw_1", Ea = "_aiSparklesIcon_aiStarPulse1_1ixvw_20", Ha = "_aiStarPulse1_1ixvw_1", ja = "_aiSparklesIcon_aiStarPulse1Delay_1ixvw_23", Fa = "_aiSparklesIcon_aiStarPulse2_1ixvw_26", Ga = "_aiStarPulse2_1ixvw_1", $a = "_aiSparklesIcon_aiStarPulse2Alt_1ixvw_29", Wa = "_aiSparklesIcon_aiStarPulse3_1ixvw_32", Za = "_aiStarPulse3_1ixvw_1", qa = "_aiSparklesIcon_aiStarPulse2Delay_1ixvw_35", $ = {
|
|
2118
|
+
aiSparklesIcon: za,
|
|
2119
|
+
aiSparklesIcon__animated: Aa,
|
|
2120
|
+
aiSparklesIcon_aiMainPulse: Oa,
|
|
2121
|
+
aiMainPulse: Ua,
|
|
2122
|
+
aiSparklesIcon_aiSecondaryPulse: Ba,
|
|
2123
|
+
aiSecondaryPulse: Ra,
|
|
2124
|
+
aiSparklesIcon_aiStarPulse1: Ea,
|
|
2125
|
+
aiStarPulse1: Ha,
|
|
2126
|
+
aiSparklesIcon_aiStarPulse1Delay: ja,
|
|
2127
|
+
aiSparklesIcon_aiStarPulse2: Fa,
|
|
2128
|
+
aiStarPulse2: Ga,
|
|
2129
|
+
aiSparklesIcon_aiStarPulse2Alt: $a,
|
|
2130
|
+
aiSparklesIcon_aiStarPulse3: Wa,
|
|
2131
|
+
aiStarPulse3: Za,
|
|
2132
|
+
aiSparklesIcon_aiStarPulse2Delay: qa
|
|
2133
|
+
}, J = {
|
|
2134
|
+
p1710e940: "M8.58599 5.11211C8.94555 3.6293 11.0544 3.6293 11.414 5.11211L12.4034 9.19217C12.5317 9.72158 12.9451 10.1349 13.4745 10.2633L17.5546 11.2527C19.0374 11.6122 19.0374 13.7211 17.5546 14.0807L13.4745 15.07C12.9451 15.1984 12.5317 15.6118 12.4034 16.1412L11.414 20.2212C11.0544 21.704 8.94555 21.704 8.58599 20.2212L7.59664 16.1412C7.46826 15.6118 7.05491 15.1984 6.5255 15.07L2.44544 14.0807C0.96263 13.7211 0.962629 11.6122 2.44544 11.2527L6.5255 10.2633C7.05491 10.1349 7.46826 9.72158 7.59664 9.19217L8.58599 5.11211Z",
|
|
2135
|
+
p1dd12900: "M25.3333 5.24146L25.0072 6.58629C24.8769 7.12384 24.4572 7.54355 23.9196 7.6739L22.5748 8L23.9196 8.3261C24.4572 8.45645 24.8769 8.87616 25.0072 9.41371L25.3333 10.7585L25.6594 9.41371C25.7898 8.87616 26.2095 8.45645 26.747 8.3261L28.0919 8L26.747 7.6739C26.2095 7.54355 25.7898 7.12384 25.6594 6.58629L25.3333 5.24146ZM25.986 4.51328C25.82 3.82891 24.8467 3.82891 24.6807 4.51328L24.2241 6.39639C24.1648 6.64073 23.9741 6.83151 23.7297 6.89076L21.8466 7.34738C21.1622 7.51333 21.1622 8.48667 21.8466 8.65262L23.7297 9.10925C23.9741 9.1685 24.1648 9.35927 24.2241 9.60361L24.6807 11.4867C24.8467 12.1711 25.82 12.1711 25.986 11.4867L26.4426 9.60361C26.5018 9.35927 26.6926 9.1685 26.9369 9.10925L28.8201 8.65262C29.5044 8.48667 29.5044 7.51333 28.8201 7.34738L26.9369 6.89075C26.6926 6.83151 26.5018 6.64073 26.4426 6.39639L25.986 4.51328Z",
|
|
2136
|
+
p31b0a80: "M20.4632 19.351C20.6844 18.4385 21.9822 18.4385 22.2035 19.351L22.8123 21.8618C22.8913 22.1876 23.1457 22.442 23.4715 22.521L25.9823 23.1298C26.8948 23.3511 26.8948 24.6489 25.9823 24.8702L23.4715 25.479C23.1457 25.558 22.8913 25.8124 22.8123 26.1382L22.2035 28.649C21.9822 29.5615 20.6844 29.5615 20.4632 28.649L19.8543 26.1382C19.7753 25.8124 19.521 25.558 19.1952 25.479L16.6844 24.8702C15.7719 24.6489 15.7719 23.3511 16.6844 23.1298L19.1952 22.521C19.521 22.442 19.7753 22.1876 19.8543 21.8618L20.4632 19.351Z",
|
|
2137
|
+
p31cbf800: "M29.3333 18.6667C28.597 18.6667 28 18.0697 28 17.3333C28 16.597 28.597 16 29.3333 16C30.0697 16 30.6667 16.597 30.6667 17.3333C30.6667 18.0697 30.0697 18.6667 29.3333 18.6667Z",
|
|
2138
|
+
p32560f80: "M2.66667 25.3333C1.93029 25.3333 1.33333 24.7364 1.33333 24C1.33333 23.2636 1.93029 22.6667 2.66667 22.6667C3.40305 22.6667 4 23.2636 4 24C4 24.7364 3.40305 25.3333 2.66667 25.3333Z",
|
|
2139
|
+
p3fd05680: "M17.3333 4C16.597 4 16 3.40305 16 2.66667C16 1.93029 16.597 1.33333 17.3333 1.33333C18.0697 1.33333 18.6667 1.93029 18.6667 2.66667C18.6667 3.40305 18.0697 4 17.3333 4Z",
|
|
2140
|
+
p5724c80: "M9.33333 30.6667C8.59695 30.6667 8 30.0697 8 29.3333C8 28.597 8.59695 28 9.33333 28C10.0697 28 10.6667 28.597 10.6667 29.3333C10.6667 30.0697 10.0697 30.6667 9.33333 30.6667Z",
|
|
2141
|
+
pd049700: "M24.7623 4.94912C24.9075 4.35029 25.7592 4.35029 25.9044 4.94912L26.3039 6.59684C26.3558 6.81064 26.5227 6.97757 26.7365 7.02941L28.3842 7.42896C28.983 7.57416 28.983 8.42584 28.3842 8.57104L26.7365 8.97059C26.5227 9.02243 26.3558 9.18936 26.3039 9.40316L25.9044 11.0509C25.7592 11.6497 24.9075 11.6497 24.7623 11.0509L24.3627 9.40316C24.3109 9.18936 24.144 9.02243 23.9302 8.97059L22.2825 8.57104C21.6836 8.42584 21.6836 7.57416 22.2825 7.42896L23.9302 7.02941C24.144 6.97757 24.3109 6.81064 24.3627 6.59684L24.7623 4.94912Z"
|
|
2142
|
+
}, Fe = ({ isAnimated: t }) => /* @__PURE__ */ l(
|
|
2143
|
+
"svg",
|
|
2144
|
+
{
|
|
2145
|
+
className: _e(
|
|
2146
|
+
$.aiSparklesIcon,
|
|
2147
|
+
t && $.aiSparklesIcon__animated
|
|
2148
|
+
),
|
|
2149
|
+
fill: "none",
|
|
2150
|
+
preserveAspectRatio: "none",
|
|
2151
|
+
viewBox: "0 0 32 32",
|
|
2152
|
+
children: [
|
|
2153
|
+
/* @__PURE__ */ l("g", { children: [
|
|
2154
|
+
/* @__PURE__ */ e(
|
|
2155
|
+
"path",
|
|
2156
|
+
{
|
|
2157
|
+
d: J.p1710e940,
|
|
2158
|
+
fill: "url(#paint0_linear_ctx)",
|
|
2159
|
+
className: $.aiSparklesIcon_aiMainPulse
|
|
2160
|
+
}
|
|
2161
|
+
),
|
|
2162
|
+
/* @__PURE__ */ e(
|
|
2163
|
+
"path",
|
|
2164
|
+
{
|
|
2165
|
+
d: J.p31b0a80,
|
|
2166
|
+
fill: "url(#paint1_linear_ctx)",
|
|
2167
|
+
className: $.aiSparklesIcon_aiSecondaryPulse
|
|
2168
|
+
}
|
|
2169
|
+
),
|
|
2170
|
+
/* @__PURE__ */ e(
|
|
2171
|
+
"path",
|
|
2172
|
+
{
|
|
2173
|
+
d: J.pd049700,
|
|
2174
|
+
fill: "url(#paint2_linear_ctx)",
|
|
2175
|
+
className: $.aiSparklesIcon_aiStarPulse1
|
|
2176
|
+
}
|
|
2177
|
+
),
|
|
2178
|
+
/* @__PURE__ */ e(
|
|
2179
|
+
"path",
|
|
2180
|
+
{
|
|
2181
|
+
clipRule: "evenodd",
|
|
2182
|
+
d: J.p1dd12900,
|
|
2183
|
+
fill: "url(#paint3_linear_ctx)",
|
|
2184
|
+
fillRule: "evenodd",
|
|
2185
|
+
className: $.aiSparklesIcon_aiStarPulse1Delay
|
|
2186
|
+
}
|
|
2187
|
+
),
|
|
2188
|
+
/* @__PURE__ */ e(
|
|
2189
|
+
"path",
|
|
2190
|
+
{
|
|
2191
|
+
d: J.p5724c80,
|
|
2192
|
+
fill: "url(#paint4_linear_ctx)",
|
|
2193
|
+
className: $.aiSparklesIcon_aiStarPulse2
|
|
2194
|
+
}
|
|
2195
|
+
),
|
|
2196
|
+
/* @__PURE__ */ e(
|
|
2197
|
+
"path",
|
|
2198
|
+
{
|
|
2199
|
+
d: J.p32560f80,
|
|
2200
|
+
fill: "url(#paint5_linear_ctx)",
|
|
2201
|
+
className: $.aiSparklesIcon_aiStarPulse2Alt
|
|
2202
|
+
}
|
|
2203
|
+
),
|
|
2204
|
+
/* @__PURE__ */ e(
|
|
2205
|
+
"path",
|
|
2206
|
+
{
|
|
2207
|
+
d: J.p3fd05680,
|
|
2208
|
+
fill: "url(#paint6_linear_ctx)",
|
|
2209
|
+
className: $.aiSparklesIcon_aiStarPulse3
|
|
2210
|
+
}
|
|
2211
|
+
),
|
|
2212
|
+
/* @__PURE__ */ e(
|
|
2213
|
+
"path",
|
|
2214
|
+
{
|
|
2215
|
+
d: J.p31cbf800,
|
|
2216
|
+
fill: "url(#paint7_linear_ctx)",
|
|
2217
|
+
className: $.aiSparklesIcon_aiStarPulse2Delay
|
|
2218
|
+
}
|
|
2219
|
+
)
|
|
2220
|
+
] }),
|
|
2221
|
+
/* @__PURE__ */ l("defs", { children: [
|
|
2222
|
+
/* @__PURE__ */ l(
|
|
2223
|
+
"linearGradient",
|
|
2224
|
+
{
|
|
2225
|
+
gradientUnits: "userSpaceOnUse",
|
|
2226
|
+
id: "paint0_linear_ctx",
|
|
2227
|
+
x1: "16",
|
|
2228
|
+
x2: "16",
|
|
2229
|
+
y1: "1.33333",
|
|
2230
|
+
y2: "30.6667",
|
|
2231
|
+
children: [
|
|
2232
|
+
/* @__PURE__ */ e("stop", {}),
|
|
2233
|
+
/* @__PURE__ */ e("stop", { offset: "1" })
|
|
2234
|
+
]
|
|
2235
|
+
}
|
|
2236
|
+
),
|
|
2237
|
+
/* @__PURE__ */ l(
|
|
2238
|
+
"linearGradient",
|
|
2239
|
+
{
|
|
2240
|
+
gradientUnits: "userSpaceOnUse",
|
|
2241
|
+
id: "paint1_linear_ctx",
|
|
2242
|
+
x1: "16",
|
|
2243
|
+
x2: "16",
|
|
2244
|
+
y1: "1.33333",
|
|
2245
|
+
y2: "30.6667",
|
|
2246
|
+
children: [
|
|
2247
|
+
/* @__PURE__ */ e("stop", {}),
|
|
2248
|
+
/* @__PURE__ */ e("stop", { offset: "1" })
|
|
2249
|
+
]
|
|
2250
|
+
}
|
|
2251
|
+
),
|
|
2252
|
+
/* @__PURE__ */ l(
|
|
2253
|
+
"linearGradient",
|
|
2254
|
+
{
|
|
2255
|
+
gradientUnits: "userSpaceOnUse",
|
|
2256
|
+
id: "paint2_linear_ctx",
|
|
2257
|
+
x1: "16",
|
|
2258
|
+
x2: "16",
|
|
2259
|
+
y1: "1.33333",
|
|
2260
|
+
y2: "30.6667",
|
|
2261
|
+
children: [
|
|
2262
|
+
/* @__PURE__ */ e("stop", {}),
|
|
2263
|
+
/* @__PURE__ */ e("stop", { offset: "1" })
|
|
2264
|
+
]
|
|
2265
|
+
}
|
|
2266
|
+
),
|
|
2267
|
+
/* @__PURE__ */ l(
|
|
2268
|
+
"linearGradient",
|
|
2269
|
+
{
|
|
2270
|
+
gradientUnits: "userSpaceOnUse",
|
|
2271
|
+
id: "paint3_linear_ctx",
|
|
2272
|
+
x1: "16",
|
|
2273
|
+
x2: "16",
|
|
2274
|
+
y1: "1.33333",
|
|
2275
|
+
y2: "30.6667",
|
|
2276
|
+
children: [
|
|
2277
|
+
/* @__PURE__ */ e("stop", {}),
|
|
2278
|
+
/* @__PURE__ */ e("stop", { offset: "1" })
|
|
2279
|
+
]
|
|
2280
|
+
}
|
|
2281
|
+
),
|
|
2282
|
+
/* @__PURE__ */ l(
|
|
2283
|
+
"linearGradient",
|
|
2284
|
+
{
|
|
2285
|
+
gradientUnits: "userSpaceOnUse",
|
|
2286
|
+
id: "paint4_linear_ctx",
|
|
2287
|
+
x1: "16",
|
|
2288
|
+
x2: "16",
|
|
2289
|
+
y1: "1.33333",
|
|
2290
|
+
y2: "30.6667",
|
|
2291
|
+
children: [
|
|
2292
|
+
/* @__PURE__ */ e("stop", {}),
|
|
2293
|
+
/* @__PURE__ */ e("stop", { offset: "1" })
|
|
2294
|
+
]
|
|
2295
|
+
}
|
|
2296
|
+
),
|
|
2297
|
+
/* @__PURE__ */ l(
|
|
2298
|
+
"linearGradient",
|
|
2299
|
+
{
|
|
2300
|
+
gradientUnits: "userSpaceOnUse",
|
|
2301
|
+
id: "paint5_linear_ctx",
|
|
2302
|
+
x1: "16",
|
|
2303
|
+
x2: "16",
|
|
2304
|
+
y1: "1.33333",
|
|
2305
|
+
y2: "30.6667",
|
|
2306
|
+
children: [
|
|
2307
|
+
/* @__PURE__ */ e("stop", {}),
|
|
2308
|
+
/* @__PURE__ */ e("stop", { offset: "1" })
|
|
2309
|
+
]
|
|
2310
|
+
}
|
|
2311
|
+
),
|
|
2312
|
+
/* @__PURE__ */ l(
|
|
2313
|
+
"linearGradient",
|
|
2314
|
+
{
|
|
2315
|
+
gradientUnits: "userSpaceOnUse",
|
|
2316
|
+
id: "paint6_linear_ctx",
|
|
2317
|
+
x1: "16",
|
|
2318
|
+
x2: "16",
|
|
2319
|
+
y1: "1.33333",
|
|
2320
|
+
y2: "30.6667",
|
|
2321
|
+
children: [
|
|
2322
|
+
/* @__PURE__ */ e("stop", {}),
|
|
2323
|
+
/* @__PURE__ */ e("stop", { offset: "1" })
|
|
2324
|
+
]
|
|
2325
|
+
}
|
|
2326
|
+
),
|
|
2327
|
+
/* @__PURE__ */ l(
|
|
2328
|
+
"linearGradient",
|
|
2329
|
+
{
|
|
2330
|
+
gradientUnits: "userSpaceOnUse",
|
|
2331
|
+
id: "paint7_linear_ctx",
|
|
2332
|
+
x1: "16",
|
|
2333
|
+
x2: "16",
|
|
2334
|
+
y1: "1.33333",
|
|
2335
|
+
y2: "30.6667",
|
|
2336
|
+
children: [
|
|
2337
|
+
/* @__PURE__ */ e("stop", {}),
|
|
2338
|
+
/* @__PURE__ */ e("stop", { offset: "1" })
|
|
2339
|
+
]
|
|
2340
|
+
}
|
|
2341
|
+
)
|
|
2342
|
+
] })
|
|
2343
|
+
]
|
|
2344
|
+
}
|
|
2345
|
+
), Ja = "_chatPanelMenu_uxb4e_1", Ka = {
|
|
2346
|
+
chatPanelMenu: Ja
|
|
2347
|
+
}, To = ({ handleClick: t }) => /* @__PURE__ */ e(
|
|
2348
|
+
"button",
|
|
2349
|
+
{
|
|
2350
|
+
type: "button",
|
|
2351
|
+
className: Ka.chatPanelMenu,
|
|
2352
|
+
"aria-label": "open/close chat panel menu",
|
|
2353
|
+
onClick: () => t(),
|
|
2354
|
+
children: /* @__PURE__ */ e(Fe, {})
|
|
2355
|
+
}
|
|
2356
|
+
), Va = (t, n) => {
|
|
2357
|
+
const [a, s] = I(""), [i, p] = I([]), [h, u] = I(!1), { splitChunks: f } = He(p);
|
|
2358
|
+
return {
|
|
2359
|
+
onSubmit: async (c) => {
|
|
2360
|
+
u(!0);
|
|
2361
|
+
try {
|
|
2362
|
+
p([]), s("");
|
|
2363
|
+
const o = n ? {
|
|
2364
|
+
"Content-Type": "application/json",
|
|
2365
|
+
...n
|
|
2366
|
+
} : {}, m = await new we(t, o).post(c);
|
|
2367
|
+
if (m.ok) {
|
|
2368
|
+
f(m);
|
|
2369
|
+
const g = await m.json();
|
|
2370
|
+
g && g.description && s(g.description), u(!1);
|
|
2371
|
+
}
|
|
2372
|
+
if (!m.ok) {
|
|
2373
|
+
u(!1);
|
|
2374
|
+
const g = await m.text().catch(() => "");
|
|
2375
|
+
throw new Error(`HTTP ${m.status} ${m.statusText} ${g}`);
|
|
2376
|
+
}
|
|
2377
|
+
} catch (o) {
|
|
2378
|
+
u(!1), console.error("Error onSubmit", o);
|
|
2379
|
+
}
|
|
2380
|
+
},
|
|
2381
|
+
loading: h,
|
|
2382
|
+
summary: a,
|
|
2383
|
+
messages: i
|
|
2384
|
+
};
|
|
2385
|
+
}, Ya = "_summaryCard_19ngt_1", Xa = "_summaryCard_borderGlow_19ngt_16", Qa = "_borderGlow_19ngt_1", er = "_summaryCard_header_19ngt_33", tr = "_summaryCard_chevron_19ngt_41", nr = "_summaryCard_chevron__open_19ngt_45", ar = "_summaryCard_titleWrapper_19ngt_48", rr = "_summaryCard_title_19ngt_48", or = "_summaryCard_title__loading_19ngt_60", sr = "_shimmer_19ngt_1", ir = "_blink_19ngt_1", lr = "_summaryCard_content_19ngt_77", cr = "_summaryCard_contentInner_19ngt_81", dr = "_summaryCard_summaryText_19ngt_89", ur = "_fadeIn_19ngt_1", F = {
|
|
2386
|
+
summaryCard: Ya,
|
|
2387
|
+
summaryCard_borderGlow: Xa,
|
|
2388
|
+
borderGlow: Qa,
|
|
2389
|
+
summaryCard_header: er,
|
|
2390
|
+
summaryCard_chevron: tr,
|
|
2391
|
+
summaryCard_chevron__open: nr,
|
|
2392
|
+
summaryCard_titleWrapper: ar,
|
|
2393
|
+
summaryCard_title: rr,
|
|
2394
|
+
summaryCard_title__loading: or,
|
|
2395
|
+
shimmer: sr,
|
|
2396
|
+
blink: ir,
|
|
2397
|
+
summaryCard_content: lr,
|
|
2398
|
+
summaryCard_contentInner: cr,
|
|
2399
|
+
summaryCard_summaryText: dr,
|
|
2400
|
+
fadeIn: ur
|
|
2401
|
+
}, Do = ({
|
|
2402
|
+
api: t,
|
|
2403
|
+
headers: n,
|
|
2404
|
+
body: a,
|
|
2405
|
+
title: s = "Resumen inteligente",
|
|
2406
|
+
loadingMessage: i = "Analizando el comportamiento de la regla...",
|
|
2407
|
+
noDataMessage: p = "No hay datos para mostrar."
|
|
2408
|
+
}) => {
|
|
2409
|
+
const [h, u] = I(!1), [f, _] = I(!1), [c, o] = I(0), [r, m] = I(!0), g = B(null), v = B(null), { loading: P, onSubmit: w, messages: x } = Va(t, n), U = f || P, G = (A) => {
|
|
2410
|
+
const R = A.target, T = R.scrollHeight - R.scrollTop - R.clientHeight < 10;
|
|
2411
|
+
m(T);
|
|
2412
|
+
};
|
|
2413
|
+
z(() => {
|
|
2414
|
+
if (!(v != null && v.current) || !h)
|
|
2415
|
+
return;
|
|
2416
|
+
const A = () => {
|
|
2417
|
+
var j;
|
|
2418
|
+
if (!(v != null && v.current))
|
|
2419
|
+
return;
|
|
2420
|
+
const T = (j = v == null ? void 0 : v.current) == null ? void 0 : j.scrollHeight;
|
|
2421
|
+
o(T);
|
|
2422
|
+
};
|
|
2423
|
+
A();
|
|
2424
|
+
const R = new ResizeObserver(A);
|
|
2425
|
+
return R.observe(v == null ? void 0 : v.current), () => {
|
|
2426
|
+
R.disconnect();
|
|
2427
|
+
};
|
|
2428
|
+
}, [x, P]), z(() => {
|
|
2429
|
+
var A;
|
|
2430
|
+
if (h && (v != null && v.current)) {
|
|
2431
|
+
const R = (A = v == null ? void 0 : v.current) == null ? void 0 : A.scrollHeight;
|
|
2432
|
+
o(R);
|
|
2433
|
+
} else
|
|
2434
|
+
o(0);
|
|
2435
|
+
}, [h]), z(() => {
|
|
2436
|
+
r && v.current && h && x.length && (v.current.scrollTop = v.current.scrollHeight);
|
|
2437
|
+
}, [x]);
|
|
2438
|
+
const K = () => {
|
|
2439
|
+
const A = !h;
|
|
2440
|
+
A && !P && !(x != null && x.length) && t && w(a), u(A);
|
|
2441
|
+
};
|
|
2442
|
+
return /* @__PURE__ */ l("div", { className: F.summaryCard, children: [
|
|
2443
|
+
/* @__PURE__ */ e("div", { className: F.summaryCard_borderGlow }),
|
|
2444
|
+
/* @__PURE__ */ l(
|
|
2445
|
+
"div",
|
|
2446
|
+
{
|
|
2447
|
+
className: F.summaryCard_header,
|
|
2448
|
+
role: "button",
|
|
2449
|
+
"aria-expanded": h,
|
|
2450
|
+
"aria-controls": "summary-content",
|
|
2451
|
+
onMouseEnter: () => !f && _(!0),
|
|
2452
|
+
onMouseLeave: () => f && _(!1),
|
|
2453
|
+
onClick: K,
|
|
2454
|
+
children: [
|
|
2455
|
+
/* @__PURE__ */ l("div", { className: F.summaryCard_titleWrapper, children: [
|
|
2456
|
+
/* @__PURE__ */ e(Fe, { isAnimated: U }),
|
|
2457
|
+
/* @__PURE__ */ e(
|
|
2458
|
+
"h3",
|
|
2459
|
+
{
|
|
2460
|
+
className: _e(
|
|
2461
|
+
F.summaryCard_title,
|
|
2462
|
+
P && F.summaryCard_title__loading
|
|
2463
|
+
),
|
|
2464
|
+
children: s
|
|
2465
|
+
}
|
|
2466
|
+
)
|
|
2467
|
+
] }),
|
|
2468
|
+
/* @__PURE__ */ e(
|
|
2469
|
+
me,
|
|
2470
|
+
{
|
|
2471
|
+
className: _e(
|
|
2472
|
+
F.summaryCard_chevron,
|
|
2473
|
+
h && F.summaryCard_chevron__open
|
|
2474
|
+
),
|
|
2475
|
+
name: "chevron-down",
|
|
2476
|
+
color: "primary-50"
|
|
2477
|
+
}
|
|
2478
|
+
)
|
|
2479
|
+
]
|
|
2480
|
+
}
|
|
2481
|
+
),
|
|
2482
|
+
/* @__PURE__ */ e(
|
|
2483
|
+
"div",
|
|
2484
|
+
{
|
|
2485
|
+
id: "summary-content",
|
|
2486
|
+
ref: g,
|
|
2487
|
+
className: F.summaryCard_content,
|
|
2488
|
+
style: {
|
|
2489
|
+
maxHeight: `${c}px`
|
|
2490
|
+
},
|
|
2491
|
+
children: /* @__PURE__ */ e(
|
|
2492
|
+
"div",
|
|
2493
|
+
{
|
|
2494
|
+
ref: v,
|
|
2495
|
+
className: F.summaryCard_contentInner,
|
|
2496
|
+
onScroll: G,
|
|
2497
|
+
children: /* @__PURE__ */ l("div", { className: F.summaryCard_summaryText, children: [
|
|
2498
|
+
x.length > 0 && x.map((A) => /* @__PURE__ */ e(Mt, { children: A.content })),
|
|
2499
|
+
!P && !x.length && p,
|
|
2500
|
+
P && !x.length && i
|
|
2501
|
+
] })
|
|
2502
|
+
}
|
|
2503
|
+
)
|
|
2504
|
+
}
|
|
2505
|
+
)
|
|
2506
|
+
] });
|
|
2507
|
+
}, pr = {
|
|
2508
|
+
codeWithAnnotations: `{
|
|
2509
|
+
"id": 1,
|
|
2510
|
+
"name": "test", // [!code --]
|
|
2511
|
+
"description": "Updated description", // [!code ++]
|
|
2512
|
+
"value": 100
|
|
2513
|
+
}`,
|
|
2514
|
+
modifiedCode: `{
|
|
2515
|
+
"id": 1,
|
|
2516
|
+
"description": "Updated description",
|
|
2517
|
+
"value": 100
|
|
2518
|
+
}`
|
|
2519
|
+
}, mr = (t) => {
|
|
2520
|
+
const { url: n, method: a = "post", headers: s = {}, body: i = {} } = t, p = n.includes("mock") || n.includes("test"), [h, u] = I(null), [f, _] = I(!1), [c, o] = I(null);
|
|
2521
|
+
return {
|
|
2522
|
+
onSubmit: async (m) => {
|
|
2523
|
+
_(!0), o(null);
|
|
2524
|
+
try {
|
|
2525
|
+
if (p) {
|
|
2526
|
+
await new Promise((x) => setTimeout(x, 1500)), u(pr), _(!1);
|
|
2527
|
+
return;
|
|
2528
|
+
}
|
|
2529
|
+
const g = s ? {
|
|
2530
|
+
"Content-Type": "application/json",
|
|
2531
|
+
...s
|
|
2532
|
+
} : {}, v = {
|
|
2533
|
+
...m,
|
|
2534
|
+
...i
|
|
2535
|
+
}, w = await new we(n, g)[a](v);
|
|
2536
|
+
if (w.ok) {
|
|
2537
|
+
const x = await w.json();
|
|
2538
|
+
u({
|
|
2539
|
+
codeWithAnnotations: (x == null ? void 0 : x.codeWithAnnotations) ?? "",
|
|
2540
|
+
modifiedCode: (x == null ? void 0 : x.modifiedCode) ?? ""
|
|
2541
|
+
}), _(!1);
|
|
2542
|
+
}
|
|
2543
|
+
if (!w.ok) {
|
|
2544
|
+
_(!1);
|
|
2545
|
+
const x = await w.text().catch(() => ""), U = `HTTP ${w.status} ${w.statusText} ${x}`;
|
|
2546
|
+
throw o(U), new Error(U);
|
|
2547
|
+
}
|
|
2548
|
+
} catch (g) {
|
|
2549
|
+
console.error("Error onSubmit", g), _(!1), o(g instanceof Error ? g.message : "Unknown error");
|
|
2550
|
+
}
|
|
2551
|
+
},
|
|
2552
|
+
loading: f,
|
|
2553
|
+
response: h,
|
|
2554
|
+
error: c
|
|
2555
|
+
};
|
|
2556
|
+
}, hr = "_promptCodeEditor_aoopo_16", fr = "_promptCodeEditor_headerContainer_aoopo_23", _r = "_form_aoopo_30", gr = "_form_label_aoopo_35", vr = "_form_field_aoopo_41", br = "_inputWrapper_aoopo_46", xr = "_inputIcon_aoopo_52", Cr = "_fieldInput_aoopo_61", yr = "_buttonSubmit_aoopo_78", Pr = "_panel_aoopo_105", wr = "_slideDown_aoopo_1", Sr = "_panel_loading_aoopo_122", Nr = "_loadingSpinner_aoopo_125", kr = "_spin_aoopo_1", Ir = "_loadingText_aoopo_134", Lr = "_panel_error_aoopo_139", Tr = "_errorText_aoopo_144", Dr = "_discardButton_aoopo_149", Mr = "_panel_response_aoopo_159", zr = "_diffContainer_aoopo_164", Ar = "_diffContainer_label_aoopo_169", Or = "_actions_aoopo_181", Ur = "_actions_discardButton_aoopo_186", Br = "_actions_applyButton_aoopo_197", Rr = "_promptCodeEditor_codeContainer_aoopo_207", Er = "_codeBlockLabel_aoopo_214", Hr = "_promptCodeEditor_codeBlock_aoopo_259", L = {
|
|
2557
|
+
promptCodeEditor: hr,
|
|
2558
|
+
promptCodeEditor_headerContainer: fr,
|
|
2559
|
+
form: _r,
|
|
2560
|
+
form_label: gr,
|
|
2561
|
+
form_field: vr,
|
|
2562
|
+
inputWrapper: br,
|
|
2563
|
+
inputIcon: xr,
|
|
2564
|
+
fieldInput: Cr,
|
|
2565
|
+
buttonSubmit: yr,
|
|
2566
|
+
panel: Pr,
|
|
2567
|
+
slideDown: wr,
|
|
2568
|
+
panel_loading: Sr,
|
|
2569
|
+
loadingSpinner: Nr,
|
|
2570
|
+
spin: kr,
|
|
2571
|
+
loadingText: Ir,
|
|
2572
|
+
panel_error: Lr,
|
|
2573
|
+
errorText: Tr,
|
|
2574
|
+
discardButton: Dr,
|
|
2575
|
+
panel_response: Mr,
|
|
2576
|
+
diffContainer: zr,
|
|
2577
|
+
diffContainer_label: Ar,
|
|
2578
|
+
actions: Or,
|
|
2579
|
+
actions_discardButton: Ur,
|
|
2580
|
+
actions_applyButton: Br,
|
|
2581
|
+
promptCodeEditor_codeContainer: Rr,
|
|
2582
|
+
codeBlockLabel: Er,
|
|
2583
|
+
promptCodeEditor_codeBlock: Hr
|
|
2584
|
+
}, jr = ({
|
|
2585
|
+
value: t,
|
|
2586
|
+
placeholder: n,
|
|
2587
|
+
label: a,
|
|
2588
|
+
loading: s,
|
|
2589
|
+
disabled: i,
|
|
2590
|
+
setValue: p,
|
|
2591
|
+
onSubmit: h
|
|
2592
|
+
}) => {
|
|
2593
|
+
const u = ge(
|
|
2594
|
+
() => [
|
|
2595
|
+
n || "Edita esta regla con un prompt...",
|
|
2596
|
+
"Describe los cambios que necesitas...",
|
|
2597
|
+
"Modifica la configuración sin tocar el código..."
|
|
2598
|
+
],
|
|
2599
|
+
[n]
|
|
2600
|
+
), [f, _] = We.useState(0);
|
|
2601
|
+
return z(() => {
|
|
2602
|
+
if (t != null && t.trim() || s || i)
|
|
2603
|
+
return;
|
|
2604
|
+
const c = setInterval(() => {
|
|
2605
|
+
_(
|
|
2606
|
+
(o) => (o + 1) % u.length
|
|
2607
|
+
);
|
|
2608
|
+
}, 3e3);
|
|
2609
|
+
return () => clearInterval(c);
|
|
2610
|
+
}, [t, s, i, u == null ? void 0 : u.length]), /* @__PURE__ */ l("div", { className: L.form, children: [
|
|
2611
|
+
a && /* @__PURE__ */ e("label", { className: L.form_label, children: a }),
|
|
2612
|
+
/* @__PURE__ */ e("div", { className: L.form_field, children: /* @__PURE__ */ l("div", { className: L.inputWrapper, children: [
|
|
2613
|
+
/* @__PURE__ */ l(
|
|
2614
|
+
"svg",
|
|
2615
|
+
{
|
|
2616
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2617
|
+
width: "24",
|
|
2618
|
+
height: "24",
|
|
2619
|
+
viewBox: "0 0 24 24",
|
|
2620
|
+
fill: "none",
|
|
2621
|
+
stroke: "currentColor",
|
|
2622
|
+
strokeWidth: "2",
|
|
2623
|
+
strokeLinecap: "round",
|
|
2624
|
+
strokeLinejoin: "round",
|
|
2625
|
+
className: L.inputIcon,
|
|
2626
|
+
"aria-hidden": "true",
|
|
2627
|
+
children: [
|
|
2628
|
+
/* @__PURE__ */ e("path", { d: "M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z" }),
|
|
2629
|
+
/* @__PURE__ */ e("path", { d: "M20 2v4" }),
|
|
2630
|
+
/* @__PURE__ */ e("path", { d: "M22 4h-4" }),
|
|
2631
|
+
/* @__PURE__ */ e("circle", { cx: "4", cy: "20", r: "2" })
|
|
2632
|
+
]
|
|
2633
|
+
}
|
|
2634
|
+
),
|
|
2635
|
+
/* @__PURE__ */ e(
|
|
2636
|
+
bn,
|
|
2637
|
+
{
|
|
2638
|
+
type: "text",
|
|
2639
|
+
placeholder: u[f],
|
|
2640
|
+
value: t,
|
|
2641
|
+
onChange: (c) => p == null ? void 0 : p(c.target.value),
|
|
2642
|
+
onKeyDown: (c) => {
|
|
2643
|
+
c.key === "Enter" && !c.shiftKey && (t != null && t.trim()) && !s && !i && (c.preventDefault(), h == null || h());
|
|
2644
|
+
},
|
|
2645
|
+
className: L.fieldInput,
|
|
2646
|
+
disabled: s || i
|
|
2647
|
+
}
|
|
2648
|
+
),
|
|
2649
|
+
/* @__PURE__ */ e(
|
|
2650
|
+
X,
|
|
2651
|
+
{
|
|
2652
|
+
onClick: h,
|
|
2653
|
+
disabled: !(t != null && t.trim()) || s || i,
|
|
2654
|
+
className: L.buttonSubmit,
|
|
2655
|
+
children: "Proponer solución"
|
|
2656
|
+
}
|
|
2657
|
+
)
|
|
2658
|
+
] }) })
|
|
2659
|
+
] });
|
|
2660
|
+
}, Mo = ({
|
|
2661
|
+
themeMode: t,
|
|
2662
|
+
requestConfig: n,
|
|
2663
|
+
language: a,
|
|
2664
|
+
disabled: s = !1,
|
|
2665
|
+
inputLabel: i,
|
|
2666
|
+
inputPlaceholder: p = "",
|
|
2667
|
+
codeBlockLabel: h,
|
|
2668
|
+
codeBlockValue: u,
|
|
2669
|
+
onCodeChange: f
|
|
2670
|
+
}) => {
|
|
2671
|
+
const [_, c] = I(u), [o, r] = I(""), [m, g] = I(!1), v = B(null), P = B(null), { loading: w, response: x, error: U, onSubmit: G } = mr(n), K = () => {
|
|
2672
|
+
o.trim() && G({ code: _, prompt: o });
|
|
2673
|
+
}, A = () => {
|
|
2674
|
+
x != null && x.modifiedCode && (c(x.modifiedCode), f == null || f(x.modifiedCode), g(!1), r(""));
|
|
2675
|
+
}, R = () => {
|
|
2676
|
+
g(!1);
|
|
2677
|
+
};
|
|
2678
|
+
return z(() => {
|
|
2679
|
+
u !== _ && c(u);
|
|
2680
|
+
}, [u, _]), z(() => {
|
|
2681
|
+
(w || x || U) && g(!0);
|
|
2682
|
+
}, [w, x, U]), z(() => {
|
|
2683
|
+
const T = (j) => {
|
|
2684
|
+
v.current && !v.current.contains(j.target) && P.current && !P.current.contains(j.target) && g(!1);
|
|
2685
|
+
};
|
|
2686
|
+
return m && document.addEventListener("mousedown", T), () => {
|
|
2687
|
+
document.removeEventListener("mousedown", T);
|
|
2688
|
+
};
|
|
2689
|
+
}, [m]), /* @__PURE__ */ l("section", { className: L.promptCodeEditor, children: [
|
|
2690
|
+
/* @__PURE__ */ l("div", { className: L.promptCodeEditor_headerContainer, ref: P, children: [
|
|
2691
|
+
/* @__PURE__ */ e(
|
|
2692
|
+
jr,
|
|
2693
|
+
{
|
|
2694
|
+
value: o,
|
|
2695
|
+
loading: w,
|
|
2696
|
+
label: i,
|
|
2697
|
+
disabled: s,
|
|
2698
|
+
placeholder: p,
|
|
2699
|
+
setValue: r,
|
|
2700
|
+
onSubmit: K
|
|
2701
|
+
}
|
|
2702
|
+
),
|
|
2703
|
+
m && (w || U || x) && /* @__PURE__ */ l("div", { ref: v, className: L.panel, children: [
|
|
2704
|
+
w && /* @__PURE__ */ l("div", { className: L.panel_loading, children: [
|
|
2705
|
+
/* @__PURE__ */ e("div", { className: L.loadingSpinner }),
|
|
2706
|
+
/* @__PURE__ */ e("p", { className: L.loadingText, children: "Generando solución..." })
|
|
2707
|
+
] }),
|
|
2708
|
+
U && /* @__PURE__ */ l("div", { className: L.panel_error, children: [
|
|
2709
|
+
/* @__PURE__ */ e("p", { className: L.errorText, children: U }),
|
|
2710
|
+
/* @__PURE__ */ e(
|
|
2711
|
+
X,
|
|
2712
|
+
{
|
|
2713
|
+
onClick: R,
|
|
2714
|
+
variant: "outline",
|
|
2715
|
+
size: "sm",
|
|
2716
|
+
className: L.discardButton,
|
|
2717
|
+
children: "Cerrar"
|
|
2718
|
+
}
|
|
2719
|
+
)
|
|
2720
|
+
] }),
|
|
2721
|
+
x && !w && /* @__PURE__ */ l("div", { className: L.panel_response, children: [
|
|
2722
|
+
/* @__PURE__ */ l("div", { className: L.diffContainer, children: [
|
|
2723
|
+
/* @__PURE__ */ e("p", { className: L.diffContainer_label, children: "Solución propuesta" }),
|
|
2724
|
+
/* @__PURE__ */ e("div", { className: t === "light" ? "light" : "dark", children: /* @__PURE__ */ e(
|
|
2725
|
+
re,
|
|
2726
|
+
{
|
|
2727
|
+
code: x.codeWithAnnotations,
|
|
2728
|
+
language: a,
|
|
2729
|
+
showLineNumbers: !0
|
|
2730
|
+
}
|
|
2731
|
+
) })
|
|
2732
|
+
] }),
|
|
2733
|
+
/* @__PURE__ */ l("div", { className: L.actions, children: [
|
|
2734
|
+
/* @__PURE__ */ e(
|
|
2735
|
+
X,
|
|
2736
|
+
{
|
|
2737
|
+
size: "sm",
|
|
2738
|
+
onClick: R,
|
|
2739
|
+
variant: "outline",
|
|
2740
|
+
className: L.actions_discardButton,
|
|
2741
|
+
children: "Cancelar"
|
|
2742
|
+
}
|
|
2743
|
+
),
|
|
2744
|
+
/* @__PURE__ */ e(
|
|
2745
|
+
X,
|
|
2746
|
+
{
|
|
2747
|
+
size: "sm",
|
|
2748
|
+
onClick: A,
|
|
2749
|
+
variant: "default",
|
|
2750
|
+
className: L.actions_applyButton,
|
|
2751
|
+
children: "Insertar código"
|
|
2752
|
+
}
|
|
2753
|
+
)
|
|
2754
|
+
] })
|
|
2755
|
+
] })
|
|
2756
|
+
] })
|
|
2757
|
+
] }),
|
|
2758
|
+
/* @__PURE__ */ l("div", { className: L.promptCodeEditor_codeContainer, children: [
|
|
2759
|
+
h && /* @__PURE__ */ e("label", { className: L.codeBlockLabel, children: h }),
|
|
2760
|
+
/* @__PURE__ */ e(
|
|
2761
|
+
zt,
|
|
2762
|
+
{
|
|
2763
|
+
value: _,
|
|
2764
|
+
className: L.promptCodeEditor_codeBlock,
|
|
2765
|
+
height: "400px",
|
|
2766
|
+
extensions: [At()],
|
|
2767
|
+
onChange: (T) => {
|
|
2768
|
+
c(T), f == null || f(T);
|
|
2769
|
+
},
|
|
2770
|
+
theme: t,
|
|
2771
|
+
editable: !0
|
|
2772
|
+
}
|
|
2773
|
+
)
|
|
2774
|
+
] })
|
|
2775
|
+
] });
|
|
2776
|
+
};
|
|
4
2777
|
export {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2778
|
+
Lo as ChatPanel,
|
|
2779
|
+
To as ChatPanelMenu,
|
|
2780
|
+
Mo as PromptCodeEditor,
|
|
2781
|
+
Do as SummaryCard
|
|
9
2782
|
};
|