markstream-react 0.0.52 → 0.0.54
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/README.md +43 -6
- package/dist/Tooltip-DRyaxB2U.js +207 -0
- package/dist/abap-DnJxzdy9.js +1 -0
- package/dist/actionscript-3-DKotD2Vd.js +1 -0
- package/dist/ada-iG1FnIvR.js +1 -0
- package/dist/andromeeda-C4gqWexZ.js +1 -0
- package/dist/angular-html-C5GGT2tR.js +1 -0
- package/dist/angular-ts-Qqqp7JE0.js +1 -0
- package/dist/apache-CdTKWnKT.js +1 -0
- package/dist/apex-BtozVX6V.js +1 -0
- package/dist/apl-BkgZWazH.js +1 -0
- package/dist/applescript-BlLNmGTp.js +1 -0
- package/dist/ara-Ba3fhlsS.js +1 -0
- package/dist/asciidoc-AY8u9WWM.js +1 -0
- package/dist/asm-CHX6lpGW.js +1 -0
- package/dist/astro-BxFA88J7.js +1 -0
- package/dist/aurora-x-D-2ljcwZ.js +1 -0
- package/dist/awk-XRrwoikR.js +1 -0
- package/dist/ayu-dark-DYE7WIF3.js +1 -0
- package/dist/ayu-light-BA47KaF1.js +1 -0
- package/dist/ayu-mirage-32ctXXKs.js +1 -0
- package/dist/ballerina-Dh0JsEtz.js +1 -0
- package/dist/bat-BVu0TwaT.js +1 -0
- package/dist/beancount-CJl0njO0.js +1 -0
- package/dist/berry-Bmu6i3Vs.js +1 -0
- package/dist/bibtex-CGjxJ4Zd.js +1 -0
- package/dist/bicep-DSW96mAt.js +1 -0
- package/dist/bird2-DxzquW1t.js +1 -0
- package/dist/blade-B0Yy4jmA.js +1 -0
- package/dist/bsl-DGicdwC0.js +1 -0
- package/dist/c-BmJt9k-y.js +1 -0
- package/dist/c3-BP_4uRj3.js +1 -0
- package/dist/cadence-DbDq8SCj.js +1 -0
- package/dist/cairo-Dz8fl918.js +1 -0
- package/dist/catppuccin-frappe-DFWUc33u.js +1 -0
- package/dist/catppuccin-latte-C9dUb6Cb.js +1 -0
- package/dist/catppuccin-macchiato-DQyhUUbL.js +1 -0
- package/dist/catppuccin-mocha-D87Tk5Gz.js +1 -0
- package/dist/clarity-Bb40UnPS.js +1 -0
- package/dist/clojure-BjI0Knrv.js +1 -0
- package/dist/cmake-BYiqpiH1.js +1 -0
- package/dist/cobol-B1Bs9cCy.js +1 -0
- package/dist/codeBlockExtraProps-bURhH5ZJ.js +3 -0
- package/dist/codeowners-L91meNbn.js +1 -0
- package/dist/codeql-Cd-JFsJB.js +1 -0
- package/dist/coffee-BDkVV41o.js +1 -0
- package/dist/common-lisp-DOi1njVG.js +1 -0
- package/dist/coq-BfbrVLCY.js +1 -0
- package/dist/cpp-oXxK9OCk.js +1 -0
- package/dist/crystal-2eHiXEKD.js +1 -0
- package/dist/csharp-DhuT4xSQ.js +1 -0
- package/dist/css-C6sBVIXB.js +1 -0
- package/dist/csv-DXKU4rRd.js +1 -0
- package/dist/cue-zmT78Agv.js +1 -0
- package/dist/cypher-bkHSskm3.js +1 -0
- package/dist/d-vs9xsbRV.js +1 -0
- package/dist/dark-plus-C3mMm8J8.js +1 -0
- package/dist/dart-ATbvIoNW.js +1 -0
- package/dist/dax-D135z3aS.js +1 -0
- package/dist/desktop-CigPEpQ5.js +1 -0
- package/dist/diff-Beq1YlA8.js +1 -0
- package/dist/docker-V5Al5bpF.js +1 -0
- package/dist/dotenv-D9G8sA2m.js +1 -0
- package/dist/dracula-BzJJZx-M.js +1 -0
- package/dist/dracula-soft-BXkSAIEj.js +1 -0
- package/dist/dream-maker-BsoKROiO.js +1 -0
- package/dist/edge-BUP_aW-j.js +1 -0
- package/dist/elixir-CV6JUqYA.js +1 -0
- package/dist/elm-5NnWpb8Q.js +1 -0
- package/dist/emacs-lisp-C4732ieo.js +1 -0
- package/dist/erb-DzuXK2qx.js +1 -0
- package/dist/erlang-DAw79KxH.js +1 -0
- package/dist/everforest-dark-BgDCqdQA.js +1 -0
- package/dist/everforest-light-C8M2exoo.js +1 -0
- package/dist/fennel-qzPJJAAI.js +1 -0
- package/dist/fish-Cx6My9pS.js +1 -0
- package/dist/fluent-BsukS3Co.js +1 -0
- package/dist/fortran-fixed-form-BiRvzwyR.js +1 -0
- package/dist/fortran-free-form-CakU9R0a.js +1 -0
- package/dist/fsharp-BmLNaTNL.js +1 -0
- package/dist/gdresource-pHyHNgx5.js +1 -0
- package/dist/gdscript-BpxQpKjR.js +1 -0
- package/dist/gdshader-BC7WJXp9.js +1 -0
- package/dist/genie-IZOju1hG.js +1 -0
- package/dist/gherkin-DUpgZfGr.js +1 -0
- package/dist/git-commit-Bptnmh-c.js +1 -0
- package/dist/git-rebase-CqNhyBhE.js +1 -0
- package/dist/github-dark-DHJKELXO.js +1 -0
- package/dist/github-dark-default-Cuk6v7N8.js +1 -0
- package/dist/github-dark-dimmed-DH5Ifo-i.js +1 -0
- package/dist/github-dark-high-contrast-E3gJ1_iC.js +1 -0
- package/dist/github-light-DAi9KRSo.js +1 -0
- package/dist/github-light-default-D7oLnXFd.js +1 -0
- package/dist/github-light-high-contrast-BfjtVDDH.js +1 -0
- package/dist/gleam-CCCEh_av.js +1 -0
- package/dist/glimmer-js-C8NS61CI.js +1 -0
- package/dist/glimmer-ts-B-RapyDB.js +1 -0
- package/dist/glsl-BDbjGBhJ.js +1 -0
- package/dist/gn-BNGDdMfm.js +1 -0
- package/dist/gnuplot-D0FoiB-W.js +1 -0
- package/dist/go-D4Ovm2g9.js +1 -0
- package/dist/graphql-DTlHKpVh.js +1 -0
- package/dist/groovy-D9sPn4Z-.js +1 -0
- package/dist/gruvbox-dark-hard-CFHQjOhq.js +1 -0
- package/dist/gruvbox-dark-medium-GsRaNv29.js +1 -0
- package/dist/gruvbox-dark-soft-CVdnzihN.js +1 -0
- package/dist/gruvbox-light-hard-CH1njM8p.js +1 -0
- package/dist/gruvbox-light-medium-DRw_LuNl.js +1 -0
- package/dist/gruvbox-light-soft-hJgmCMqR.js +1 -0
- package/dist/hack-BxpNoYuc.js +1 -0
- package/dist/haml-B9roiRDW.js +1 -0
- package/dist/handlebars-Bal7dEre.js +1 -0
- package/dist/haskell-Cp0NQEkn.js +1 -0
- package/dist/haxe-D-PmAGDa.js +1 -0
- package/dist/hcl-DRMo6eis.js +1 -0
- package/dist/hjson-BPEpXUFQ.js +1 -0
- package/dist/hlsl-B-PjNM4a.js +1 -0
- package/dist/horizon-BUw7H-hv.js +1 -0
- package/dist/horizon-bright-CUuTKBJd.js +1 -0
- package/dist/houston-DnULxvSX.js +1 -0
- package/dist/html-B3ILK6fm.js +1 -0
- package/dist/html-derivative-CfZez7eO.js +1 -0
- package/dist/http-Dh7mhfAc.js +1 -0
- package/dist/hurl-DvxDWHzM.js +1 -0
- package/dist/hxml-DB3_nACV.js +1 -0
- package/dist/hy-CLIvbAhW.js +1 -0
- package/dist/imba-B-tO30Ge.js +1 -0
- package/dist/index-70BGc65F.js +1 -0
- package/dist/index-BfHYFUlj.js +85 -0
- package/dist/index-Bsx2m-LR.js +47 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.px.css +1 -1
- package/dist/index.tailwind.css +1 -1
- package/dist/ini-Bpxu4Zsc.js +1 -0
- package/dist/java-DtRXFtDl.js +1 -0
- package/dist/javascript-DFyEbC5y.js +1 -0
- package/dist/jinja-CVIIYihW.js +1 -0
- package/dist/jison-rKmQmF2-.js +1 -0
- package/dist/json-LWN7Ml79.js +1 -0
- package/dist/json5-CgCB487x.js +1 -0
- package/dist/jsonc-BXrjvC_e.js +1 -0
- package/dist/jsonl-D5dm1SHP.js +1 -0
- package/dist/jsonnet-B60UklUs.js +1 -0
- package/dist/jssm-CsqlGknB.js +1 -0
- package/dist/jsx-g2NrEQII.js +1 -0
- package/dist/julia-3RKjS8FQ.js +1 -0
- package/dist/just-CVCZ9vRQ.js +1 -0
- package/dist/kanagawa-dragon-CkXjmgJE.js +1 -0
- package/dist/kanagawa-lotus-CfQXZHmo.js +1 -0
- package/dist/kanagawa-wave-DWedfzmr.js +1 -0
- package/dist/kdl-DWIPcypl.js +1 -0
- package/dist/kotlin-DiV2Dt9D.js +1 -0
- package/dist/kusto-Bjy7G7j4.js +1 -0
- package/dist/laserwave-DUszq2jm.js +1 -0
- package/dist/latex-Bs1X87VY.js +1 -0
- package/dist/lean-BpZurxeZ.js +1 -0
- package/dist/less-DKKxO4Pm.js +1 -0
- package/dist/light-plus-B7mTdjB0.js +1 -0
- package/dist/liquid-DhgCFC9B.js +1 -0
- package/dist/llvm-w4szIS5k.js +1 -0
- package/dist/log-CnKjEmrw.js +1 -0
- package/dist/logo-BmG1tMr6.js +1 -0
- package/dist/lua-DlAioYQl.js +1 -0
- package/dist/luau-CDzI2T2B.js +1 -0
- package/dist/make-Ccm3NI5i.js +1 -0
- package/dist/markdown-DY93LJPj.js +1 -0
- package/dist/marko-DcK8dvuy.js +1 -0
- package/dist/markstream-react.css +1 -1
- package/dist/material-theme-D5KoaKCx.js +1 -0
- package/dist/material-theme-darker-BfHTSMKl.js +1 -0
- package/dist/material-theme-lighter-B0m2ddpp.js +1 -0
- package/dist/material-theme-ocean-CyktbL80.js +1 -0
- package/dist/material-theme-palenight-Csfq5Kiy.js +1 -0
- package/dist/matlab-nYX3zffi.js +1 -0
- package/dist/mdc-DQafIqD6.js +1 -0
- package/dist/mdx-C8C9IGe9.js +1 -0
- package/dist/mermaid--Jyu4oWd.js +1 -0
- package/dist/min-dark-CafNBF8u.js +1 -0
- package/dist/min-light-CTRr51gU.js +1 -0
- package/dist/mipsasm-BjAqecqh.js +1 -0
- package/dist/mojo-C2cxD0aZ.js +1 -0
- package/dist/monokai-D4h5O-jR.js +1 -0
- package/dist/moonbit-B4gpyPjt.js +1 -0
- package/dist/move-Dg7rFHVC.js +1 -0
- package/dist/narrat-BTSicUR-.js +1 -0
- package/dist/next.d.ts +41 -18
- package/dist/next.js +1 -1
- package/dist/nextflow-CRfcQpDI.js +1 -0
- package/dist/nextflow-groovy-DuWVVkaq.js +1 -0
- package/dist/nginx-B2z8CTeP.js +1 -0
- package/dist/night-owl-C39BiMTA.js +1 -0
- package/dist/night-owl-light-CMTm3GFP.js +1 -0
- package/dist/nim-DP_Ekwra.js +1 -0
- package/dist/nix-_0LqsLde.js +1 -0
- package/dist/nord-Ddv68eIx.js +1 -0
- package/dist/nushell-Mk45ZIMx.js +1 -0
- package/dist/objective-c-DLT9zZoE.js +1 -0
- package/dist/objective-cpp-DKXr-AK_.js +1 -0
- package/dist/ocaml-DP9q6K5L.js +1 -0
- package/dist/odin-BINPiy40.js +1 -0
- package/dist/one-dark-pro-DVMEJ2y_.js +1 -0
- package/dist/one-light-C3Wv6jpd.js +1 -0
- package/dist/openscad-CVq2HK1T.js +1 -0
- package/dist/pascal-DjTTLVNS.js +1 -0
- package/dist/perl-CmsZP_P9.js +1 -0
- package/dist/php-vdga8FKK.js +1 -0
- package/dist/pierre-dark-CyvmCCZW.js +1 -0
- package/dist/pierre-dark-protanopia-deuteranopia-Rgc0TwpF.js +1 -0
- package/dist/pierre-dark-soft-BHGpRqa4.js +1 -0
- package/dist/pierre-dark-tritanopia-Beq2gCRQ.js +1 -0
- package/dist/pierre-dark-vibrant-BWBVywrn.js +1 -0
- package/dist/pierre-light-480U9XYS.js +1 -0
- package/dist/pierre-light-protanopia-deuteranopia-CaVOBURG.js +1 -0
- package/dist/pierre-light-soft-CVdyfjmI.js +1 -0
- package/dist/pierre-light-tritanopia-B4_gpKOM.js +1 -0
- package/dist/pierre-light-vibrant-DdTDNdfJ.js +1 -0
- package/dist/pkl-0Sl31KKD.js +1 -0
- package/dist/plastic-3e1v2bzS.js +1 -0
- package/dist/plsql-CJrHCTnj.js +1 -0
- package/dist/po-y5MdiEbo.js +1 -0
- package/dist/poimandres-CS3Unz2-.js +1 -0
- package/dist/polar-Bsx6RkUC.js +1 -0
- package/dist/postcss-CeUBPB2S.js +1 -0
- package/dist/powerquery-CW27I574.js +1 -0
- package/dist/powershell-DSYJ6xcj.js +1 -0
- package/dist/prisma-CLoN-gBj.js +1 -0
- package/dist/prolog-Bgt5DHUA.js +1 -0
- package/dist/proto-C194Edqz.js +1 -0
- package/dist/pug-KXbBtQiy.js +1 -0
- package/dist/puppet-TSkl_nn0.js +1 -0
- package/dist/purescript-BrDje9qL.js +1 -0
- package/dist/python-DlV7vnVD.js +1 -0
- package/dist/qml-DTv-54bL.js +1 -0
- package/dist/qmldir-CSZk7E48.js +1 -0
- package/dist/qss-DACx-k9g.js +1 -0
- package/dist/r-EOoB7omE.js +1 -0
- package/dist/racket-D1nq-KeH.js +1 -0
- package/dist/raku-DocPDKZq.js +1 -0
- package/dist/razor-B-tk-wsx.js +1 -0
- package/dist/red-bN70gL4F.js +1 -0
- package/dist/reg-5ydmJHEw.js +1 -0
- package/dist/regexp-CpyjTnFF.js +1 -0
- package/dist/rel-D68lwU-3.js +1 -0
- package/dist/riscv-Cl4WfXj6.js +1 -0
- package/dist/ron-DIZViclS.js +1 -0
- package/dist/rose-pine-dawn-DHQR4-dF.js +1 -0
- package/dist/rose-pine-moon-D4_iv3hh.js +1 -0
- package/dist/rose-pine-qdsjHGoJ.js +1 -0
- package/dist/rosmsg-sf_0D22S.js +1 -0
- package/dist/rst-BG5pn2qR.js +1 -0
- package/dist/ruby-DcH2yJAk.js +1 -0
- package/dist/rust-DpWcZSqc.js +1 -0
- package/dist/sas-B5HzFFRM.js +1 -0
- package/dist/sass-DY_rGA2-.js +1 -0
- package/dist/scala-CYRsmRER.js +1 -0
- package/dist/scheme-C45fPb3F.js +1 -0
- package/dist/scss-BV51UrMN.js +1 -0
- package/dist/sdbl-BpucmfEo.js +1 -0
- package/dist/server.d.ts +28 -5
- package/dist/server.js +1 -1
- package/dist/shaderlab-DNyPh2Q6.js +1 -0
- package/dist/shellscript-B8OHlvmy.js +1 -0
- package/dist/shellsession-OATBsyRD.js +1 -0
- package/dist/slack-dark-BthQWCQV.js +1 -0
- package/dist/slack-ochin-DqwNpetd.js +1 -0
- package/dist/smalltalk-CKvddXL8.js +1 -0
- package/dist/snazzy-light-Bw305WKR.js +1 -0
- package/dist/solarized-dark-DXbdFlpD.js +1 -0
- package/dist/solarized-light-L9t79GZl.js +1 -0
- package/dist/solidity-XfXaqt9k.js +1 -0
- package/dist/soy-B8YA9JrK.js +1 -0
- package/dist/sparql-CLNNOQQI.js +1 -0
- package/dist/splunk-CFtInczE.js +1 -0
- package/dist/sql-Q2iGWUi5.js +1 -0
- package/dist/ssh-config-Dqsr-I88.js +1 -0
- package/dist/stata-BR_XK0X0.js +1 -0
- package/dist/stylus-BeJftkpb.js +1 -0
- package/dist/surrealql-C_6seBBi.js +1 -0
- package/dist/svelte-0br9ZpFT.js +1 -0
- package/dist/swift-0qv2hBXI.js +1 -0
- package/dist/synthwave-84-ChtBzv_y.js +1 -0
- package/dist/system-verilog-B3nElewZ.js +1 -0
- package/dist/systemd-B7SlkmfE.js +1 -0
- package/dist/tailwind.cjs +1 -1
- package/dist/tailwind.js +1 -1
- package/dist/talonscript-BrsbXmRy.js +1 -0
- package/dist/tasl-CMkPZNj1.js +1 -0
- package/dist/tcl-CiyEbZSK.js +1 -0
- package/dist/templ-B0JhIwv9.js +1 -0
- package/dist/terraform-BUB-_BlF.js +1 -0
- package/dist/tex-ByCZWQmN.js +1 -0
- package/dist/tokyo-night-hegEt444.js +1 -0
- package/dist/toml-VldhK7iW.js +1 -0
- package/dist/ts-tags-BWP4nPgY.js +1 -0
- package/dist/tsv-BQ9ptESM.js +1 -0
- package/dist/tsx-DYwE5ssU.js +1 -0
- package/dist/turtle-BVy4HXn4.js +1 -0
- package/dist/twig-z8zdyiH9.js +1 -0
- package/dist/types/components/HtmlInlineNode/HtmlInlineNode.d.ts +4 -1
- package/dist/types/components/NodeRenderer.d.ts +2 -1
- package/dist/types/customComponents.d.ts +20 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/next.d.ts +7 -3
- package/dist/types/renderers/renderNode.d.ts +1 -1
- package/dist/types/server-renderer/index.d.ts +6 -2
- package/dist/types/server.d.ts +2 -2
- package/dist/types/types.d.ts +8 -3
- package/dist/types/utils/customHtmlTag.d.ts +5 -4
- package/dist/types/utils/htmlToReact.d.ts +17 -6
- package/dist/typescript-DI7mmMRd.js +1 -0
- package/dist/typespec-BAzX0Tk7.js +1 -0
- package/dist/typst-JIZTSUoJ.js +1 -0
- package/dist/v-B66J5FdL.js +1 -0
- package/dist/vala-p2PL1w-1.js +1 -0
- package/dist/vb-Dv-GCw1m.js +1 -0
- package/dist/verilog-DKP7kpC6.js +1 -0
- package/dist/vesper-DRje8inN.js +1 -0
- package/dist/vhdl-Cog-DhcW.js +1 -0
- package/dist/viml-0AN1aqkP.js +1 -0
- package/dist/vitesse-black-Bkuqu6BP.js +1 -0
- package/dist/vitesse-dark-D0r3Knsf.js +1 -0
- package/dist/vitesse-light-CVO1_9PV.js +1 -0
- package/dist/vue-DqsE_lDH.js +1 -0
- package/dist/vue-html-a8uCr53v.js +1 -0
- package/dist/vue-vine-CVmLzYuL.js +1 -0
- package/dist/vyper-sB2l1MOO.js +1 -0
- package/dist/wasm--yL7jHw-.js +1 -0
- package/dist/wasm-CSAWeJiV.js +1 -0
- package/dist/wenyan-CLHHXU5e.js +1 -0
- package/dist/wgsl-DiTcYanS.js +1 -0
- package/dist/wikitext-DT8E9qe0.js +1 -0
- package/dist/wit-CtjT-RdY.js +1 -0
- package/dist/wolfram-1xJNnwe2.js +1 -0
- package/dist/xml-BsgRw6d1.js +1 -0
- package/dist/xsl-CNIkWbJg.js +1 -0
- package/dist/yaml-c2-Vhxho.js +1 -0
- package/dist/zenscript-ChP1MlQf.js +1 -0
- package/dist/zig-rivS3YQG.js +1 -0
- package/package.json +9 -9
- package/dist/Tooltip-Ux2h3oiV.js +0 -207
- package/dist/codeBlockExtraProps-NhTjbA1T.js +0 -3
- package/dist/index-DdaK6qko.js +0 -85
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import{jsxs as e,jsx as n,Fragment as t}from"react/jsx-runtime";import r,{useMemo as o,useState as i,createContext as l,useContext as a,useRef as s,useEffect as c,useCallback as d,useSyncExternalStore as u,useLayoutEffect as m}from"react";import{sanitizeHtmlTokenAttrs as h,normalizeCustomHtmlTagName as f,convertHtmlAttrsToProps as p,tokenAttrsToRecord as g,NON_STRUCTURING_HTML_TAGS as v,isHtmlTagBlocked as w,sanitizeHtmlContent as y,BLOCKED_HTML_TAGS as x,isHtmlTagHardBlocked as k,sanitizeImageSrc as b,sanitizeHtmlAttrs as C,shouldOpenLinkInNewTab as N,toSafeSvgElement as M,getHtmlTagFromContent as B,stripCustomHtmlWrapper as S,shouldRenderUnknownHtmlTagAsText as T,mergeCustomHtmlTags as L,getMarkdown as E,parseMarkdownToStructure as $}from"stream-markdown-parser";import{C as D,u as P,J as _,E as A,l as R,q as I,A as H,I as F,j as W,k as O,K as j,s as z,m as K,v as V,L as X,n as U,i as q,F as Y,x as Z,c as G,f as J,t as Q,w as ee,a as ne,g as te,B as re,p as oe,D as ie,h as le,M as ae,r as se,o as ce}from"./codeBlockExtraProps-bURhH5ZJ.js";import{createSmoothMarkdownStream as de,resolveStreamingTextUpdate as ue,normalizeShikiLanguage as me,getHighlightRegistrationKey as he,registerHighlightOnce as fe,getRuntimeShikiRegistrationConfig as pe}from"markstream-core";import{createPortal as ge}from"react-dom";import{autoUpdate as ve,computePosition as we,offset as ye,flip as xe,shift as ke}from"@floating-ui/dom";const be={note:"ℹ️",info:"ℹ️",tip:"💡",warning:"⚠️",danger:"❗",error:"⛔",caution:"⚠️"};function Ce(t){const{node:r,ctx:l,renderNode:a,indexKey:s,isDark:c}=t,d=String(r.kind||"note"),u=o(()=>r.title&&String(r.title).trim().length?String(r.title):d.charAt(0).toUpperCase()+d.slice(1),[d,r.title]),[m,h]=i(()=>{var e;return!!r.collapsible&&!(null==(e=r.open)||e)}),f=o(()=>`admonition-${Math.random().toString(36).slice(2,9)}`,[]);/* @__PURE__ */
|
|
2
|
+
return e("div",{className:`admonition admonition-${d}${c?" is-dark":""}`,"data-index-key":s,children:[
|
|
3
|
+
/* @__PURE__ */e("div",{id:f,className:"admonition-header",children:[be[d]&&/* @__PURE__ */n("span",{className:"admonition-icon",children:be[d]}),
|
|
4
|
+
/* @__PURE__ */n("span",{className:"admonition-title",children:u}),r.collapsible&&/* @__PURE__ */n("button",{type:"button",className:"admonition-toggle","aria-expanded":!m,"aria-controls":`${f}-content`,title:m?"Expand":"Collapse",onClick:()=>h(e=>!e),children:/* @__PURE__ */n("span",{children:m?"▶":"▼"})})]}),!m&&/* @__PURE__ */n("div",{id:`${f}-content`,className:"admonition-content","aria-labelledby":f,children:l&&a?D(r.children,l,String(null!=s?s:f),a):null})]})}const Ne=l(!1),Me=l(null);function Be(){return a(Me)}const Se=l(null);function Te(e,n){var t,r;const o="undefined"!=typeof window&&"undefined"!=typeof document,i=o?null!=(t=window.requestIdleCallback)?t:e=>window.setTimeout(()=>e({didTimeout:!0,timeRemaining:()=>0}),16):null,l=o?null!=(r=window.cancelIdleCallback)?r:e=>window.clearTimeout(e):null;let a=null,s=null;const c=/* @__PURE__ */new Map,d=/* @__PURE__ */new Set;let u=null;const m=()=>{if(!c.size){try{null==a||a.disconnect()}catch{}a=null,s=null,d.size||(()=>{if(null!=u){try{null==l||l(u)}catch{}u=null}})()}},h=e=>{const n=c.get(e);if(n){n.state.current=!0;try{n.resolve()}catch{}try{null==a||a.unobserve(e)}catch{}c.delete(e),d.delete(e),m()}},f=()=>{i&&null==u&&d.size&&(u=i(()=>{u=null;const e=d.values().next().value;e&&(d.delete(e),h(e),d.size&&f())},{timeout:1200}))};return(t,r)=>{var i,l;const u={current:!1};let p,g=!1;const v=new Promise(e=>{p=()=>{g||(g=!0,e())}}),w=()=>{if(c.has(t)){c.delete(t);try{null==a||a.unobserve(t)}catch{}}d.delete(t),m()};if(!o||!n())return u.current=!0,p(),{isVisible:()=>!0,whenVisible:v,destroy:w};const y=((n,t)=>{if(!o)return null;if("undefined"==typeof IntersectionObserver)return null;const r=((n,t)=>{var r;return{root:null!=(r=e())?r:null,rootMargin:n,threshold:t}})(n,t);if(a&&(l=r,(i=s)&&i.root===l.root&&i.rootMargin===l.rootMargin&&i.threshold===l.threshold))return a;var i,l;if(a)try{a.disconnect()}catch{}a=new IntersectionObserver(e=>{for(const n of e)(n.isIntersecting||n.intersectionRatio>0)&&h(n.target)},{root:r.root,rootMargin:r.rootMargin,threshold:r.threshold}),s=r;for(const e of c.keys())a.observe(e);return a})(null!=(i=null==r?void 0:r.rootMargin)?i:"300px",null!=(l=null==r?void 0:r.threshold)?l:0);return y?(c.set(t,{resolve:p,state:u}),y.observe(t),d.add(t),f(),{isVisible:()=>u.current,whenVisible:v,destroy:w}):(u.current=!0,p(),{isVisible:()=>!0,whenVisible:v,destroy:w})}}const Le=Te(()=>null,()=>!0);function Ee({getRoot:e,enabled:t=!0,children:r}){const i=s(t);i.current=t;const l=s(e);l.current=e;const a=o(()=>Te(()=>{var e,n;return null!=(n=null==(e=l.current)?void 0:e.call(l))?n:null},()=>i.current),[]);/* @__PURE__ */
|
|
5
|
+
return n(Se.Provider,{value:a,children:r})}function $e(){var e;return null!=(e=a(Se))?e:Le}function De(e={}){const n=s(null);n.current||(n.current=de(e));const t=n.current,[r,l]=i(()=>t.getSnapshot());return c(()=>{const e=t.subscribe(()=>{l(t.getSnapshot())});return t.resume(),l(t.getSnapshot()),()=>{e(),t.pause()}},[t]),o(()=>({...r,enqueue:t.enqueue,finish:t.finish,flush:t.flush,reset:t.reset,pause:t.pause,resume:t.resume,getSnapshot:t.getSnapshot}),[t,r])}function Pe(e){const{node:t}=e;/* @__PURE__ */
|
|
6
|
+
return n("span",{className:"checkbox-node",children:/* @__PURE__ */n("input",{type:"checkbox",checked:Boolean(t.checked),disabled:!0,className:"checkbox-input",readOnly:!0})})}const _e={"common.copy":"Copy","common.copied":"Copied","common.decrease":"Decrease","common.reset":"Reset","common.increase":"Increase","common.expand":"Expand","common.collapse":"Collapse","common.preview":"Preview","common.source":"Source","common.export":"Export","common.open":"Open","common.close":"Close","common.zoomIn":"Zoom in","common.zoomOut":"Zoom out","common.resetZoom":"Reset zoom","image.loadError":"Image failed to load","image.loading":"Loading image..."};function Ae(e){Object.assign(_e,e)}function Re(){return{t:e=>{var n;return null!=(n=_e[e])?n:function(e){return(e.split(".").pop()||e).replace(/[_-]/g," ").replace(/([A-Z])/g," $1").replace(/\s+/g," ").replace(/\b\w/g,e=>e.toUpperCase()).trim()}(e)}}}let Ie=null,He=null,Fe=null,We=null,Oe=null,je=null;function ze(){We&&(clearTimeout(We),We=null),Oe&&(clearTimeout(Oe),Oe=null)}async function Ke(e){if(!Ie||!He)return;const{x:n,y:t}=await we(He,Ie,{placement:e,middleware:[ye(8),xe(),ke({padding:8})],strategy:"fixed"});Ie.style.transform=`translate3d(${Math.round(n)}px, ${Math.round(t)}px, 0)`}function Ve(e,n,t="top",r=!1,o,i){if(!e||"undefined"==typeof document)return;if(Ie||"undefined"==typeof document||(Ie=document.createElement("div"),Ie.className="markstream-react ms-tooltip",Ie.setAttribute("role","tooltip"),Ie.dataset.visible="false",Ie.style.position="fixed",Ie.style.left="0px",Ie.style.top="0px",Ie.style.transform="translate3d(0,0,0)",document.body.appendChild(Ie)),!Ie)return;ze();const l=async()=>{if(Ie){He=e,Ie.textContent=n,Ie.dataset.placement=t,Ie.dataset.dark=function(e){if("boolean"==typeof e)return e;if("undefined"!=typeof document)try{if(document.documentElement.classList.contains("dark"))return!0}catch{}if("undefined"!=typeof window&&"function"==typeof window.matchMedia)try{return window.matchMedia("(prefers-color-scheme: dark)").matches}catch{}return!1}(i)?"true":"false",Ie.dataset.visible="false",je=`tooltip-${Date.now()}-${Math.random().toString(36).slice(2)}`,Ie.id=je;try{e.setAttribute("aria-describedby",je)}catch{}await Ke(t),Ie.dataset.visible="true",null==Fe||Fe(),Fe=ve(e,Ie,()=>{Ke(t)})}};r?l():We=setTimeout(l,80)}function Xe(e=!1){if(!Ie)return;ze();const n=()=>{if(Ie){if(Ie.dataset.visible="false",He&&je)try{He.removeAttribute("aria-describedby")}catch{}He=null,je=null,Fe&&(Fe(),Fe=null)}};e?n():Oe=setTimeout(n,120)}const Ue=void 0!==import.meta&&Boolean(!1);let qe=null;function Ye(t){const{t:r}=Re(),i=o(()=>{const e=t.code||"",n=e.trim().toLowerCase();return n.startsWith("<!doctype")||n.startsWith("<html")||n.startsWith("<body")?e:`<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1" />\n <style>\n html, body {\n margin: 0;\n padding: 0;\n height: 100%;\n background-color: ${t.isDark?"#020617":"#ffffff"};\n color: ${t.isDark?"#e5e7eb":"#020617"};\n }\n body {\n font-family: system-ui, -apple-system, BlinkMacSystemFont, 'SF Pro Text', ui-sans-serif, sans-serif;\n }\n </style>\n </head>\n <body>\n ${e}\n </body>\n</html>`},[t.code,t.isDark]),l=o(()=>{return e=t.htmlPreviewSandbox,n=t.htmlPreviewAllowScripts,"string"==typeof e?(function(e){if(!Ue||"undefined"==typeof console||qe===e)return;const n=function(e){return new Set(e.trim().toLowerCase().split(/\s+/).filter(Boolean))}(e);n.has("allow-scripts")&&n.has("allow-same-origin")&&(qe=e,console.warn("[markstream-react] htmlPreviewSandbox contains both allow-scripts and allow-same-origin. Use this only for fully trusted content served from an isolated origin."))}(e),e):void 0!==e?"":!0===n?"allow-scripts":"";var e,n},[t.htmlPreviewAllowScripts,t.htmlPreviewSandbox]);return c(()=>{const e=e=>{var n;"Escape"!==e.key&&"Esc"!==e.key||null==(n=t.onClose)||n.call(t)};return"undefined"!=typeof window&&window.addEventListener("keydown",e),()=>{"undefined"!=typeof window&&window.removeEventListener("keydown",e)}},[t]),"undefined"==typeof document?null:ge(
|
|
7
|
+
/* @__PURE__ */n("div",{className:"markstream-react html-preview-frame__backdrop"+(t.isDark?" html-preview-frame__backdrop--dark":""),onClick:()=>{var e;return null==(e=t.onClose)?void 0:e.call(t)},children:/* @__PURE__ */e("div",{className:"html-preview-frame"+(t.isDark?" html-preview-frame--dark":""),onClick:e=>e.stopPropagation(),children:[
|
|
8
|
+
/* @__PURE__ */e("div",{className:"html-preview-frame__header",children:[
|
|
9
|
+
/* @__PURE__ */e("div",{className:"html-preview-frame__title",children:[
|
|
10
|
+
/* @__PURE__ */n("span",{className:"html-preview-frame__dot"}),
|
|
11
|
+
/* @__PURE__ */n("span",{className:"html-preview-frame__label",children:t.title||`HTML ${r("common.preview")}`})]}),
|
|
12
|
+
/* @__PURE__ */n("button",{type:"button",className:"html-preview-frame__close"+(t.isDark?" html-preview-frame__close--dark":""),onClick:()=>{var e;return null==(e=t.onClose)?void 0:e.call(t)},children:"×"})]}),
|
|
13
|
+
/* @__PURE__ */n("iframe",{className:"html-preview-frame__iframe",sandbox:l,referrerPolicy:"no-referrer",src:"about:blank",srcDoc:i,title:t.title||"Preview"})]})}),document.body)}let Ze=!1,Ge=null;async function Je(e){if(Ze)return;if(Ge)return Ge;const n=(async()=>{const n=null==globalThis?void 0:globalThis.MonacoEnvironment;!n||"function"!=typeof n.getWorker&&"function"!=typeof n.getWorkerUrl?("function"==typeof(null==e?void 0:e.preloadMonacoWorkers)&&await e.preloadMonacoWorkers(),Ze=!0):Ze=!0})();return Ge=n.finally(()=>{Ge=null}),Ge}let Qe=null,en=!1;const nn=[()=>import("./index-70BGc65F.js"),()=>import("stream-monaco")];function tn(e){var n;return"function"==typeof(null==e?void 0:e.useMonaco)?e:"function"==typeof(null==(n=null==e?void 0:e.default)?void 0:n.useMonaco)?e.default:null}async function rn(){if(Qe)return Qe;if(en)return null;for(const e of nn)try{const n=tn(await e());if(!n)continue;return await Je(n),Qe=n,Qe}catch{}return en=!0,null}let on=null,ln=!1,an=null,sn=null,cn=null,dn=null,un=null;const mn=/* @__PURE__ */new WeakMap;let hn=0;function fn(e,n){const t=function(e){if(null==e)return null;if("string"==typeof e)return e;if("object"==typeof e&&e&&"name"in e)return String(e.name);if("object"==typeof e){const n=mn.get(e);if(n)return n;try{const n=JSON.stringify(e);if(n)return mn.set(e,n),n}catch{}const t="__theme_"+ ++hn;return mn.set(e,t),t}return String(e)}(e);return t?(on!==n&&(on=n),ln||un!==t?!an||dn!==t&&sn!==t?(cn=e,dn=t,an||(ln=!0,an=(async()=>{for(;null!=cn&&null!=dn;){const e=cn,n=dn;if(cn=null,dn=null,un===n)continue;const t=on;if(!t)break;try{sn=n,await Promise.resolve(t(e)),un=n}catch{}}})().finally(()=>{ln=!1,an=null,sn=null}),an)):an:Promise.resolve()):Promise.resolve()}let pn=null,gn=null,vn=null;const wn=/* @__PURE__ */new Set,yn=/* @__PURE__ */new WeakMap;let xn=0;function kn(){for(const e of Array.from(wn))try{e()}catch{}}function bn(e){var n;return String(null!=(n=String(null!=e?e:"").split(/\s+/g)[0])?n:"").split(":")[0].toLowerCase().replace(/[^\w-]/g,"")||"plaintext"}function Cn(e){const n=String(null!=e?e:"");return n?n.split(/\r\n|\n|\r/):[]}function Nn(e){return e.startsWith("-")&&!e.startsWith("---")}function Mn(e){return e.startsWith("+")&&!e.startsWith("+++")}function Bn(e,n){return t=e[n],!(0===String(null!=t?t:"").trim().length)||n<e.length-1;var t}function Sn(e,n,t,r,o={}){const i=0===String(null!=e?e:"").trim().length;return{code:e,empty:i,kind:i&&"hunk"!==n&&!o.preserveBlankKind?"context":n,key:t,number:r}}function Tn(e,n){const t=Cn(e),r=Cn(n),o=function(e,n){const t=e.length,r=n.length;if((t+1)*(r+1)>15e5)return null;const o=r+1,i=new Uint16Array((t+1)*(r+1));for(let c=t-1;c>=0;c--)for(let t=r-1;t>=0;t--){const r=c*o+t;e[c]===n[t]?i[r]=i[(c+1)*o+t+1]+1:i[r]=Math.max(i[(c+1)*o+t],i[c*o+t+1])}const l=[];let a=0,s=0;for(;a<t&&s<r;)e[a]===n[s]?(l.push({originalIndex:a,modifiedIndex:s}),a++,s++):i[(a+1)*o+s]>=i[a*o+s+1]?a++:s++;return l}(t,r);if(o){const e=[];let n=0,i=0;for(const l of o){for(;n<l.originalIndex;)e.push(Sn(t[n],"removed",`inline-removed-source-${n}`,"",{preserveBlankKind:Bn(t,n)})),n++;for(;i<l.modifiedIndex;)e.push(Sn(r[i],"added",`inline-added-source-${i}`,i+1,{preserveBlankKind:Bn(r,i)})),i++;e.push(Sn(r[l.modifiedIndex],"context",`inline-context-source-${l.originalIndex}-${l.modifiedIndex}`,l.modifiedIndex+1)),n=l.originalIndex+1,i=l.modifiedIndex+1}for(;n<t.length;)e.push(Sn(t[n],"removed",`inline-removed-source-${n}`,"",{preserveBlankKind:Bn(t,n)})),n++;for(;i<r.length;)e.push(Sn(r[i],"added",`inline-added-source-${i}`,i+1,{preserveBlankKind:Bn(r,i)})),i++;return e}const i=[];let l=0,a=t.length-1,s=r.length-1;for(;l<=a&&l<=s&&t[l]===r[l];)i.push(Sn(r[l],"context",`inline-prefix-${l}`,l+1)),l++;const c=[];for(;a>=l&&s>=l&&t[a]===r[s];)c.unshift(Sn(r[s],"context",`inline-suffix-${s}`,s+1)),a--,s--;for(let d=l;d<=a;d++)i.push(Sn(t[d],"removed",`inline-removed-source-${d}`,"",{preserveBlankKind:Bn(t,d)}));for(let d=l;d<=s;d++)i.push(Sn(r[d],"added",`inline-added-source-${d}`,d+1,{preserveBlankKind:Bn(r,d)}));return i.concat(c)}function Ln(e,n=!1,t=bn(null==e?void 0:e.language)){const r=(o=null==e?void 0:e.code,String(null!=o?o:"").split(/\r\n|\n|\r/));var o;if(!function(e,n,t){const r=e.some(e=>Nn(e)),o=e.some(e=>Mn(e));return r&&o||function(e,n){var t,r,o;if("diff"===n)return!0;const i=null!=(o=null==(r=String(null!=(t=null==e?void 0:e.raw)?t:"").split(/\r?\n/,1)[0])?void 0:r.trim())?o:"";return/^`{3,}\s*diff(?:\s|$)|^~{3,}\s*diff(?:\s|$)/.test(i)}(n,t)&&(r||o)}(r,e,t)&&function(e){return null!=(null==e?void 0:e.originalCode)||null!=(null==e?void 0:e.updatedCode)}(e)){if(n)return[{key:"inline",className:"markstream-pre__diff-pane--inline",lines:Tn(null==e?void 0:e.originalCode,null==e?void 0:e.updatedCode)}];const t=Cn(null==e?void 0:e.originalCode),r=Cn(null==e?void 0:e.updatedCode);return[{key:"original",className:"markstream-pre__diff-pane--original",lines:t.map((e,n)=>Sn(e,r[n]===e?"context":"removed",`original-${n}`,n+1,{preserveBlankKind:Bn(t,n)}))},{key:"modified",className:"markstream-pre__diff-pane--modified",lines:r.map((e,n)=>Sn(e,t[n]===e?"context":"added",`modified-${n}`,n+1,{preserveBlankKind:Bn(r,n)}))}]}if(n){const e=function(e){let n=1;return e.map((e,t)=>e.startsWith("@@")?Sn(e,"hunk",`inline-hunk-${t}`,""):Nn(e)?Sn(e.slice(1),"removed",`inline-removed-${t}`,"",{preserveBlankKind:!0}):Mn(e)?Sn(e.slice(1),"added",`inline-added-${t}`,n++,{preserveBlankKind:!0}):Sn(e.startsWith(" ")?e.slice(1):e,"context",`inline-context-${t}`,n++))}(r);return[{key:"inline",className:"markstream-pre__diff-pane--inline",lines:e}]}const i=[],l=[];let a=1,s=1;for(const[c,d]of r.entries())if(d.startsWith("@@"))i.push(Sn(d,"hunk",`original-hunk-${c}`,"")),l.push(Sn(d,"hunk",`modified-hunk-${c}`,""));else if(Nn(d))i.push(Sn(d.slice(1),"removed",`original-removed-${c}`,a++,{preserveBlankKind:!0}));else if(Mn(d))l.push(Sn(d.slice(1),"added",`modified-added-${c}`,s++,{preserveBlankKind:!0}));else{const e=d.startsWith(" ")?d.slice(1):d;i.push(Sn(e,"context",`original-context-${c}`,a++)),l.push(Sn(e,"context",`modified-context-${c}`,s++))}return[{key:"original",className:"markstream-pre__diff-pane--original",lines:i},{key:"modified",className:"markstream-pre__diff-pane--modified",lines:l}]}function En({node:t,className:r,diffInline:i,showLineNumbers:l,style:a}){const s=o(()=>bn(null==t?void 0:t.language),[t]),c=`language-${s}`,d=s?`Code block: ${s}`:"Code block",u=!0===l&&!0===(null==t?void 0:t.diff),m=o(()=>u?Ln(t,!0===i,s):[],[i,u,t,s]),h=o(()=>function(e){var n,t;if(!0===(null==e?void 0:e.diff))return String(null!=(n=null==e?void 0:e.code)?n:"");const r=String(null!=(t=null==e?void 0:e.code)?t:"");return!0===(null==e?void 0:e.loading)?r:r.replace(/\r\n$|\n$|\r$/,"")}(t),[t]);/* @__PURE__ */
|
|
14
|
+
return n("pre",{className:[c,r,l?"markstream-pre--line-numbers":"",u?"markstream-pre--diff-preview":"",u&&i?"markstream-pre--diff-inline":""].filter(Boolean).join(" "),style:a,"aria-busy":!0===(null==t?void 0:t.loading),"aria-label":d,"data-language":s,"data-markstream-line-numbers":l?"1":void 0,"data-markstream-pre":"1",tabIndex:0,children:/* @__PURE__ */n("code",u?{translate:"no",className:"markstream-pre__diff-code",children:m.map(t=>/* @__PURE__ */n("span",{className:["markstream-pre__diff-pane",t.className].join(" "),children:t.lines.map(t=>/* @__PURE__ */e("span",{className:["markstream-pre__diff-line",`markstream-pre__diff-line--${t.kind}`,t.empty?"markstream-pre__diff-line--empty":""].filter(Boolean).join(" "),children:[
|
|
15
|
+
/* @__PURE__ */n("span",{className:"markstream-pre__diff-rail","aria-hidden":"true"}),
|
|
16
|
+
/* @__PURE__ */n("span",{className:"markstream-pre__diff-number","aria-hidden":"true",children:t.number}),
|
|
17
|
+
/* @__PURE__ */n("span",{className:"markstream-pre__diff-content",children:/* @__PURE__ */n("span",{className:"markstream-pre__diff-content-inner",children:t.code})})]},t.key))},t.key))}:{translate:"no",children:h})})}const $n={isShowPreview:!0,loading:!0,stream:!0,enableFontSizeControl:!0,showHeader:!0,showCopyButton:!0,showExpandButton:!0,showPreviewButton:!0,showCollapseButton:!0,showFontSizeButtons:!0},Dn=Object.freeze({enabled:!0,contextLineCount:2,minimumLineCount:4,revealLineCount:5});function Pn(e){return"number"==typeof e&&Number.isFinite(e)&&e>0?e:void 0}function _n(e){var n;if("boolean"==typeof e)return e;if(e&&"object"==typeof e){const t=e;return{...Dn,...t,enabled:null==(n=t.enabled)||n}}return{...Dn}}function An(e,n){var t,r;const o=n?{...n}:{};if(!e)return o;const i=void 0===o.diffHideUnchangedRegions?{...Dn}:_n(o.diffHideUnchangedRegions),l=void 0===o.hideUnchangedRegions?void 0:_n(o.hideUnchangedRegions),a=null!=(t=o.diffUnchangedRegionStyle)?t:"line-info";return{maxComputationTime:0,diffAlgorithm:"legacy",ignoreTrimWhitespace:!1,renderIndicators:!0,diffUpdateThrottleMs:120,renderLineHighlight:"none",renderLineHighlightOnlyWhenFocus:!0,selectionHighlight:!1,occurrencesHighlight:"off",matchBrackets:"never",lineDecorationsWidth:4,lineNumbersMinChars:2,glyphMargin:!1,minimap:{enabled:!1},renderOverviewRuler:!1,overviewRulerBorder:!1,hideCursorInOverviewRuler:!0,scrollBeyondLastLine:!1,diffHideUnchangedRegions:i,useInlineViewWhenSpaceIsLimited:null!=(r=o.useInlineViewWhenSpaceIsLimited)&&r,diffLineStyle:"background",diffAppearance:"auto",diffUnchangedRegionStyle:a,diffHunkActionsOnHover:!1,diffHunkHoverHideDelayMs:160,...o,...void 0===l?{}:{hideUnchangedRegions:l},diffHideUnchangedRegions:i}}function Rn(e){return"string"==typeof e?e:e&&"object"==typeof e&&"name"in e?String(e.name):null}function In(e){const n=String(null!=e?e:"").match(/\d+(?:\.\d+)?/g);if(!n||n.length<3)return null;const[t,r,o]=n.slice(0,3).map(Number);return.2126*t+.7152*r+.0722*o}function Hn(r){var l;const a={...$n,...r},{node:u,isDark:m,loading:h,stream:f,isShowPreview:p,enableFontSizeControl:g,darkTheme:v,lightTheme:w,monacoOptions:y,themes:x,minWidth:k,maxWidth:b,showHeader:C,showCopyButton:N,showExpandButton:M,showPreviewButton:B,showCollapseButton:S,showFontSizeButtons:T,showTooltips:L}=a,E=s(null),$=s(null),D=s(null),H=s(null),F=s(null),W=s(null),O=s(null),j=s(0),z=s(null),K=s(null),V=$e(),X=s(y),U=s(null),q=s(null),Y=s([]),Z=s(null),G=s(!1),[J,Q]=i(!1),[ee,ne]=i(()=>"undefined"==typeof window),[te,re]=i(!1),[oe,ie]=i(!1),[le,ae]=i(!1),[se,ce]=i(()=>u.language||"plaintext"),[de,ue]=i(()=>P(u.language)),[me,he]=i(!1),[fe,pe]=i(!1),[ge,ve]=i(!1),[we,ye]=i(!1),[xe,ke]=i(0),be=h||!ee,{t:Ce}=Re();c(()=>{G.current=fe},[fe]);const Ne=o(()=>An(Boolean(u.diff),y),[y,u.diff]),[Me,Be]=i(()=>{var e;const n=Number(null==(e=An(Boolean(u.diff),y))?void 0:e.fontSize);return Number.isFinite(n)&&n>0?n:12}),[Se,Te]=i(Me),Le=o(()=>!1!==L,[L]),Ee=d(()=>{var e,n;const t=null!=(n=null==(e=X.current)?void 0:e.MAX_HEIGHT)?n:500;if("number"==typeof t&&Number.isFinite(t))return Math.max(80,t);const r=String(t).match(/^(\d+(?:\.\d+)?)/),o=r?Number.parseFloat(r[1]):500;return Number.isFinite(o)?Math.max(80,o):500},[]),De=d(e=>{var n,t,r,o;if(J)return;const i=E.current,l=D.current;if(!i||!l)return;const a="diff"===W.current?null==(n=l.getDiffEditorView)?void 0:n.call(l):null==(t=l.getEditorView)?void 0:t.call(l);if(!a)return;const s=Ee();try{null==(r=a.updateOptions)||r.call(a,{automaticLayout:e})}catch{}const c="diff"===W.current,d=c?"important":"";e?(i.style.minHeight="0px",i.style.setProperty("max-height","none",d),i.style.overflow="visible"):(i.style.minHeight="0px",i.style.setProperty("max-height",`${Math.ceil(s)}px`,d),i.style.overflow=c?"hidden":"auto");try{const n=()=>{if(c){const e=function(e){if("undefined"==typeof window)return null;try{const n=e.getBoundingClientRect();if(n.width<=0)return null;const t=[".editor.original .view-lines .view-line",".editor.modified .view-lines .view-line",".editor.original .margin-view-overlays .line-numbers",".editor.modified .margin-view-overlays .line-numbers",".editor.original .view-zones > div",".editor.modified .view-zones > div",".editor.original .margin-view-zones > div",".editor.modified .margin-view-zones > div",".editor.original .diff-hidden-lines",".editor.modified .diff-hidden-lines",".stream-monaco-diff-unchanged-bridge"];let r=0;for(const o of Array.from(e.querySelectorAll(t.join(",")))){if(!(o instanceof HTMLElement))continue;const e=window.getComputedStyle(o);if("none"===e.display||"hidden"===e.visibility)continue;if(Number.parseFloat(e.opacity||"1")<=.01)continue;const t=o.getBoundingClientRect();t.height<=0||t.bottom<=n.top||(r=Math.max(r,t.bottom-n.top))}return r>0?Math.ceil(r+4):null}catch{return null}}(i);if(null!=e)return e}if("function"==typeof a.getContentHeight)return a.getContentHeight();if(c&&"function"==typeof a.getModifiedEditor){const e=a.getModifiedEditor();if(e&&"function"==typeof e.getContentHeight)return e.getContentHeight()}},t=Number(n());if(Number.isFinite(t)&&t>0){const n=e?t:Math.min(t,s);i.style.setProperty("height",`${Math.ceil(Math.max(1,n))}px`,d)}null==(o=a.layout)||o.call(a)}catch{}},[Ee,J]),Pe=d(e=>{if(De(e),"undefined"==typeof window||"function"!=typeof window.requestAnimationFrame)return;const n=window.requestAnimationFrame(()=>{De(e),window.requestAnimationFrame(()=>De(e))});return window.setTimeout(()=>De(e),180),()=>window.cancelAnimationFrame(n)},[De]),_e=d(()=>{var e,n;for(const t of Y.current)try{"function"==typeof t?t():null==(e=null==t?void 0:t.dispose)||e.call(t)}catch{}Y.current=[],null==(n=Z.current)||n.disconnect(),Z.current=null},[]),Ae=d(()=>{var e,n,t;_e();const r=D.current,o=E.current;if(!r||!o||"diff"!==W.current)return;const i=()=>Pe(G.current),l=(e,n)=>{try{const t=null==e?void 0:e[n];if("function"!=typeof t)return;const r=t.call(e,i);r&&Y.current.push(r)}catch{}},a=null==(e=r.getDiffEditorView)?void 0:e.call(r),s=null==(n=null==a?void 0:a.getOriginalEditor)?void 0:n.call(a),c=null==(t=null==a?void 0:a.getModifiedEditor)?void 0:t.call(a);if(l(a,"onDidUpdateDiff"),l(s,"onDidContentSizeChange"),l(c,"onDidContentSizeChange"),l(s,"onDidLayoutChange"),l(c,"onDidLayoutChange"),"undefined"!=typeof window&&"function"==typeof window.MutationObserver){const e=new window.MutationObserver(e=>{e.some(e=>"childList"===e.type||"attributes"===e.type&&e.target!==o)&&i()});e.observe(o,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class"]}),Z.current=e}},[_e,Pe]);c(()=>_(()=>{ke(e=>e+1)}),[]),c(()=>{ue(P(u.language))},[u.language]);const Ie=s(u);Ie.current=u;const He=d(()=>{var e;j.current+=1;try{null==(e=H.current)||e.call(H)}catch{}_e(),F.current=null,W.current=null,O.current=null,ae(!1),ie(!1)},[_e]),Fe=d(()=>{var e,n,t,r,o,i;const l=E.current,a=$.current;if(!l||!a)return;if(u.diff)return a.style.removeProperty("--vscode-editor-foreground"),a.style.removeProperty("--vscode-editor-background"),void a.style.removeProperty("--vscode-editor-selectionBackground");const s=null!=(e=l.querySelector(".monaco-editor"))?e:l;try{const e="undefined"!=typeof window&&window.getComputedStyle?window.getComputedStyle(s):null,l=String(null!=(n=null==e?void 0:e.getPropertyValue("--vscode-editor-foreground"))?n:"").trim()||String(null!=(t=null==e?void 0:e.color)?t:"").trim(),c=String(null!=(r=null==e?void 0:e.getPropertyValue("--vscode-editor-background"))?r:"").trim()||String(null!=(o=null==e?void 0:e.backgroundColor)?o:"").trim(),d=String(null!=(i=null==e?void 0:e.getPropertyValue("--vscode-editor-selectionBackground"))?i:"").trim();if(function(e,n,t,r){if(!t)return!1;const o=In(e),i=In(n);return r?null!=o&&o>170||null!=i&&i<110:null!=o&&o<85||null!=i&&i>190}(c,l,"plaintext"===A(String(u.language||de||se||"plaintext")),a.classList.contains("is-dark")))return a.style.removeProperty("--vscode-editor-foreground"),a.style.removeProperty("--vscode-editor-background"),void a.style.removeProperty("--vscode-editor-selectionBackground");l&&a.style.setProperty("--vscode-editor-foreground",l),c&&a.style.setProperty("--vscode-editor-background",c),d&&a.style.setProperty("--vscode-editor-selectionBackground",d)}catch{}},[de,se,u.diff,u.language]),We=o(()=>m?v:w,[v,m,w]),Oe=d(()=>{var e;const n=null==Ne?void 0:Ne.theme,t=null!=(e=null!=We?We:n)?e:pn,r=Array.isArray(x)?x:[];if(!r.length||null==t)return t;const o=Rn(t),i=r.map(e=>Rn(e)).filter(e=>!!e);if(!o||i.includes(o))return t;const l=Rn(n);return null!=n&&l&&i.includes(l)?n:r[0]},[We,Ne,x]),je=o(()=>Oe(),[Oe]),ze=o(()=>function(e,n){var t;const r=(null!=(t=Rn(e))?t:"").toLowerCase();return r?["dark","night","moon","black","dracula","mocha","frappe","macchiato","palenight","ocean","poimandres","monokai","laserwave","tokyo","slack-dark","rose-pine","github-dark","material-theme","one-dark","catppuccin-mocha","catppuccin-frappe","catppuccin-macchiato"].some(e=>r.includes(e))&&!["light","latte","dawn","lotus"].some(e=>r.includes(e)):n}(je,Boolean(m)),[m,je]),Ke=o(()=>{if(!u.diff)return ze?"dark":"light";const e=null==Ne?void 0:Ne.diffAppearance;return"light"===e||"dark"===e?e:m?"dark":"light"},[m,u.diff,ze,Ne]),Ue=o(()=>u.diff?"dark"===Ke:ze,[Ke,u.diff,ze]),qe=o(()=>{var e,n,t,r;const o=Ne,i=null!=(n=null!=(e=Pn(null==o?void 0:o.fontSize))?e:Se)?n:12,l=null!=(t=Pn(null==o?void 0:o.lineHeight))?t:12===i?18:Math.max(12,Math.round(1.5*i)),a="string"==typeof(null==o?void 0:o.fontFamily)&&o.fontFamily.trim()?o.fontFamily.trim():void 0,s=function(e){var n,t;if(!e||"object"!=typeof e)return{top:0,bottom:0};const r=e;return{top:null!=(n=Pn(r.top))?n:0,bottom:null!=(t=Pn(r.bottom))?t:0}}(null==o?void 0:o.padding),c=null!=(r=Pn(null==o?void 0:o.tabSize))?r:4;return{fontFamily:a,fontSize:i,lineHeight:l,paddingBottom:s.bottom,paddingTop:s.top,tabSize:c}},[Se,Ne]),Ze=o(()=>!!u.diff&&!1===(null==Ne?void 0:Ne.renderSideBySide),[u.diff,Ne]),Ge=o(()=>{const e={"--markstream-code-padding-left":"62px","--markstream-pre-diff-line-height":`${qe.lineHeight}px`,"--markstream-pre-line-number-top":`${qe.paddingTop}px`,"--markstream-pre-line-number-width":"36px","--markstream-pre-line-number-gap":"0px",fontSize:`${qe.fontSize}px`,lineHeight:`${qe.lineHeight}px`,paddingBottom:`${qe.paddingBottom}px`,paddingTop:`${qe.paddingTop}px`,tabSize:qe.tabSize};return qe.fontFamily&&(e.fontFamily=qe.fontFamily),e},[qe]),Je=d(()=>{const e={wordWrap:"on",wrappingIndent:"same",themes:x,...Ne||{},stream:!1,theme:je,disableFileHeader:!0,...u.diff?{diffAppearance:Ke}:{},onThemeChange(){Fe()}};return u.diff&&(null!=e.fontSize||(e.fontSize=qe.fontSize),null!=e.lineHeight||(e.lineHeight=qe.lineHeight),null!=e.padding||(e.padding={top:qe.paddingTop,bottom:qe.paddingBottom}),null!=e.tabSize||(e.tabSize=qe.tabSize),qe.fontFamily&&(null!=e.fontFamily||(e.fontFamily=qe.fontFamily))),e},[Ke,u.diff,qe,je,Ne,Fe,x]),Qe=d(()=>{const e=Je(),n=U.current;if(!n)return U.current=e,e;for(const t of Object.keys(n))t in e||delete n[t];return Object.assign(n,e),n},[Je]),en=o(()=>{var e,n,t,r,o,i,l;return JSON.stringify({diffLineStyle:null!=(e=null==Ne?void 0:Ne.diffLineStyle)?e:"background",diffUnchangedRegionStyle:null!=(n=null==Ne?void 0:Ne.diffUnchangedRegionStyle)?n:"line-info",diffHideUnchangedRegions:null==(t=null==Ne?void 0:Ne.diffHideUnchangedRegions)||t,renderSideBySide:null==(r=null==Ne?void 0:Ne.renderSideBySide)||r,enableSplitViewResizing:null==(o=null==Ne?void 0:Ne.enableSplitViewResizing)||o,ignoreTrimWhitespace:null==(i=null==Ne?void 0:Ne.ignoreTrimWhitespace)||i,originalEditable:null!=(l=null==Ne?void 0:Ne.originalEditable)&&l})},[Ne]);c(()=>{X.current=Ne,Qe()},[Ne,Qe]),c(()=>()=>{var e,n,t;j.current+=1,null==(e=H.current)||e.call(H),_e(),H.current=null,F.current=null,W.current=null,O.current=null,z.current=null,null==(t=null==(n=K.current)?void 0:n.destroy)||t.call(n),K.current=null},[_e]),c(()=>{var e,n;if("undefined"==typeof window)return;if(ee)return;const t=$.current;if(!t)return;null==(n=null==(e=K.current)?void 0:e.destroy)||n.call(e);const r=V(t,{rootMargin:"400px"});return K.current=r,r.isVisible()&&ne(!0),r.whenVisible.then(()=>ne(!0)),()=>{r.destroy(),K.current===r&&(K.current=null)}},[V,ee]),c(()=>{let e=!0;return"undefined"==typeof window||be?()=>{e=!1}:D.current?(Qe(),()=>{e=!1}):((async()=>{try{const t=await rn();if(!e)return;if(!t)return void Q(!0);const r=t.useMonaco,o=t.detectLanguage;if("function"==typeof o&&(z.current=o),"function"!=typeof r)return void Q(!0);const i=r(Qe());D.current=i,"function"==typeof(n=i.setTheme)&&(vn=n,null!=pn&&null!=gn&&fn(pn,vn).then(()=>kn()).catch(()=>{})),H.current="function"==typeof i.safeClean?()=>i.safeClean():"function"==typeof i.cleanupEditor?()=>i.cleanupEditor():null,re(!0)}catch{e&&Q(!0)}var n})(),()=>{e=!1})},[be,Qe]),c(()=>{var e;if(!u.language&&!de&&z.current)try{const n=z.current(String(null!=(e=u.code)?e:""));n&&ce(n)}catch{}},[de,u.code,u.language]);const nn=o(()=>String(u.language||de||se||"plaintext"),[de,se,u.language]),tn=o(()=>P(nn),[nn]),on=o(()=>A(tn),[tn]),ln=o(()=>"plaintext"===on,[on]),an=o(()=>R(tn),[tn,xe]),sn=o(()=>!!p&&("html"===tn||"svg"===tn),[tn,p]),cn=o(()=>{const e=tn;return e?I[e]||e.charAt(0).toUpperCase()+e.slice(1):I[""]||"Plain Text"},[tn]),dn=o(()=>{var e,n,t;return u.diff?null!=(n=null!=(e=u.updatedCode)?e:u.code)?n:"":null!=(t=u.code)?t:""},[u.code,u.diff,u.updatedCode]),un=o(()=>{const e=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},n={},t=e(k),r=e(b);return t&&(n.minWidth=t),r&&(n.maxWidth=r),u.diff?(n.color="var(--markstream-diff-shell-fg)",n.borderColor="var(--markstream-diff-shell-border)"):(n.color=`var(--vscode-editor-foreground, ${Ue?"#e5e7eb":"#111827"})`,n.backgroundColor=`var(--vscode-editor-background, ${Ue?"#111827":"#ffffff"})`,n.borderColor=Ue?"rgb(55 65 81 / 0.3)":"rgb(229 231 235)"),n},[b,k,u.diff,Ue]),mn=o(()=>{if(!u.diff)return{color:`var(--vscode-editor-foreground, ${Ue?"#e5e7eb":"#111827"})`,backgroundColor:`var(--vscode-editor-background, ${Ue?"#111827":"#ffffff"})`}},[u.diff,Ue]);c(()=>{if(J)return;if(!te)return;if(!oe||!ee)return;const e=D.current;Qe();const n=()=>{var n;u.diff&&(null==(n=null==e?void 0:e.refreshDiffPresentation)||n.call(e)),Fe(),ge||null==("undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(()=>Pe(fe)):null)&&Pe(fe)};(null==e?void 0:e.setTheme)&&je?fn(je,e.setTheme).then(n).catch(()=>{}):n()},[ge,oe,Ke,fe,te,u.diff,je,Pe,Fe,Qe,J,ee]),c(()=>{var e;if("undefined"!=typeof window)return e=()=>{Fe()},wn.add(e),()=>{wn.delete(e)}},[Fe]);const hn=d(async()=>{var e,n;if(J)return null;if(!ee)return null;if(ge)return null;if(be)return null;const t=D.current,r=E.current;if(!t||!r||!t.createEditor)return null;Qe();const o=Ie.current,i=o.diff?"diff":"single",l=O.current,a="diff"===i?Boolean(null==(e=t.getDiffEditorView)?void 0:e.call(t)):Boolean(null==(n=t.getEditorView)?void 0:n.call(t));if(W.current===i&&l===r&&a)return null;if(F.current)return F.current;j.current+=1;const s=j.current;ie(!0);const c=(async()=>{var e,n,i,l,a,c,d,u,m,h;try{null==(e=H.current)||e.call(H),W.current=null,O.current=null,ae(!1);const f=on;if(o.diff?"function"==typeof t.createDiffEditor?(W.current="diff",await t.createDiffEditor(r,String(null!=(n=o.originalCode)?n:""),String(null!=(i=o.updatedCode)?i:""),f)):(W.current="single",await t.createEditor(r,String(null!=(a=null!=(l=o.updatedCode)?l:o.code)?a:""),f)):(W.current="single",await t.createEditor(r,String(null!=(c=o.code)?c:""),f)),O.current=r,j.current!==s)return;const p=Number(null==(d=X.current)?void 0:d.fontSize);if(Number.isFinite(p)&&p>0){Be(p),Te(p);try{const e="diff"===W.current?null==(u=t.getDiffEditorView)?void 0:u.call(t):null==(m=t.getEditorView)?void 0:m.call(t);null==(h=null==e?void 0:e.updateOptions)||h.call(e,{fontSize:p,automaticLayout:!1})}catch{}}Ae(),Fe(),fe||ge||Pe(!1),ae(!0)}catch{j.current===s&&Q(!0)}})().finally(()=>{F.current===c&&(F.current=null)});return F.current=c,c},[Ae,_e,ge,fe,on,Pe,be,Fe,Qe,J,ee]);c(()=>{Qe();const e=q.current;if(q.current=en,!u.diff)return;if(J)return;if(!te||!ee||!oe)return;if(ge||be)return;if(e===en)return;let n=!1;return(async()=>{if(He(),!n)try{await hn()}catch{}})(),()=>{n=!0}},[ge,oe,hn,te,en,u.diff,He,be,Qe,J,ee]),c(()=>{J||te&&ee&&(ge||be?He():hn())},[ge,hn,te,He,be,J,ee]),c(()=>{var e;if(J)return;if(!te)return;if(!ee)return;if(ge)return;if(be)return;const n=D.current;if(!n)return;const t=String(null!=(e=u.code)?e:"");(async()=>{var e,r;let o=de;if(!o&&z.current)try{o=P(z.current(t)),o&&ue(o)}catch{}const i=A(o||tn);if(n.createEditor&&E.current){try{await Promise.resolve(hn())}catch{}const e=F.current;if(e)try{await e}catch{}}try{u.diff&&n.updateDiff?await Promise.resolve(n.updateDiff(String(null!=(e=u.originalCode)?e:""),String(null!=(r=u.updatedCode)?r:""),i)):n.updateCode&&await Promise.resolve(n.updateCode(t,i))}catch{}Pe(fe)})()},[tn,de,ge,oe,hn,fe,te,u.code,u.diff,u.originalCode,u.updatedCode,Pe,be,J,ee]),c(()=>{if(J)return;if(!te)return;if(!ee)return;if(ge)return;if(be)return;if(!fe&&h)return;const e="undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(()=>Pe(fe)):null;return null==e&&Pe(fe),()=>{null!=e&&"undefined"!=typeof window&&"function"==typeof window.cancelAnimationFrame&&window.cancelAnimationFrame(e)}},[ge,fe,h,te,Pe,be,J,ee]),c(()=>{var e,n,t;if(!g)return;if(J)return;const r=D.current;if(r){try{const o="diff"===W.current?null==(e=r.getDiffEditorView)?void 0:e.call(r):null==(n=r.getEditorView)?void 0:n.call(r);null==(t=null==o?void 0:o.updateOptions)||t.call(o,{fontSize:Se})}catch{}Pe(fe)}},[g,fe,Se,u.diff,Pe,J]),c(()=>{Le||Xe(!0)},[Le]);const yn=d((e,n)=>{if(!Le)return;const t=e.currentTarget;t&&!t.disabled&&("clientX"in e&&(e.clientX,e.clientY),Ve(t,n,"top",!1,0,Ue))},[Ue,Le]),xn=d(()=>{Le&&Xe()},[Le]),bn=d(async()=>{var e;try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&await navigator.clipboard.writeText(String(dn)),he(!0),null==(e=a.onCopy)||e.call(a,String(dn)),setTimeout(()=>he(!1),1e3)}catch{}},[a,dn]),Cn=d(()=>{if(!sn)return;const e="html"===tn?"text/html":"image/svg+xml",n="html"===tn?Ce("artifacts.htmlPreviewTitle")||"HTML Preview":Ce("artifacts.svgPreviewTitle")||"SVG Preview";"function"!=typeof a.onPreviewCode?"html"===tn&&ye(e=>!e):a.onPreviewCode({node:u,artifactType:e,artifactTitle:n,id:`temp-${tn}-${Date.now()}`})},[tn,sn,u,a,Ce]);return J?/* @__PURE__ */n(En,{className:"code-fallback-plain m-0",diffInline:Ze,node:u,showLineNumbers:Boolean(u.diff),style:Ge}):/* @__PURE__ */e("div",{ref:$,className:["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm",Ue?"border-gray-700/30 bg-gray-900":"border-gray-200 bg-white",h?"is-rendering":"",Ue?"is-dark":"",u.diff?"is-diff":"",ln?"is-plain-text":""].join(" "),style:un,children:[C&&/* @__PURE__ */e("div",{className:"code-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5",style:mn,children:[
|
|
18
|
+
/* @__PURE__ */e("div",{className:"flex items-center space-x-2 flex-1 overflow-hidden",children:[
|
|
19
|
+
/* @__PURE__ */n("span",{className:"icon-slot h-4 w-4 flex-shrink-0",dangerouslySetInnerHTML:{__html:an}}),
|
|
20
|
+
/* @__PURE__ */n("span",{className:"text-sm font-medium font-mono truncate",children:cn})]}),
|
|
21
|
+
/* @__PURE__ */e("div",{className:"flex items-center space-x-2",children:[S&&/* @__PURE__ */n("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":ge,onClick:()=>ve(e=>!e),onMouseEnter:e=>yn(e,ge?Ce("common.expand")||"Expand":Ce("common.collapse")||"Collapse"),onFocus:e=>yn(e,ge?Ce("common.expand")||"Expand":Ce("common.collapse")||"Collapse"),onMouseLeave:xn,onBlur:xn,children:/* @__PURE__ */n("svg",{style:{rotate:ge?"0deg":"90deg"},xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 18l6-6l-6-6"})})}),T&&g&&/* @__PURE__ */e(t,{children:[
|
|
22
|
+
/* @__PURE__ */n("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:Se<=10,onClick:()=>Te(e=>Math.max(10,e-1)),onMouseEnter:e=>yn(e,Ce("common.decrease")||"Decrease"),onFocus:e=>yn(e,Ce("common.decrease")||"Decrease"),onMouseLeave:xn,onBlur:xn,children:/* @__PURE__ */n("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 12h14"})})}),
|
|
23
|
+
/* @__PURE__ */n("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:Se===Me,onClick:()=>Te(Me),onMouseEnter:e=>yn(e,Ce("common.reset")||"Reset"),onFocus:e=>yn(e,Ce("common.reset")||"Reset"),onMouseLeave:xn,onBlur:xn,children:/* @__PURE__ */n("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
|
|
24
|
+
/* @__PURE__ */n("path",{d:"M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8"}),
|
|
25
|
+
/* @__PURE__ */n("path",{d:"M3 3v5h5"})]})})}),
|
|
26
|
+
/* @__PURE__ */n("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:Se>=36,onClick:()=>Te(e=>Math.min(36,e+1)),onMouseEnter:e=>yn(e,Ce("common.increase")||"Increase"),onFocus:e=>yn(e,Ce("common.increase")||"Increase"),onMouseLeave:xn,onBlur:xn,children:/* @__PURE__ */n("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 12h14m-7-7v14"})})})]}),N&&/* @__PURE__ */n("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":me?Ce("common.copied")||"Copied":Ce("common.copy")||"Copy",onClick:bn,onMouseEnter:e=>yn(e,me?Ce("common.copied")||"Copied":Ce("common.copy")||"Copy"),onFocus:e=>yn(e,me?Ce("common.copied")||"Copied":Ce("common.copy")||"Copy"),onMouseLeave:xn,onBlur:xn,children:/* @__PURE__ */n("svg",me?{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M20 6L9 17l-5-5"})}:{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
|
|
27
|
+
/* @__PURE__ */n("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),
|
|
28
|
+
/* @__PURE__ */n("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]})})}),M&&/* @__PURE__ */n("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":fe,onClick:e=>{pe(e=>!e),yn(e,fe?Ce("common.expand")||"Expand":Ce("common.collapse")||"Collapse")},onMouseEnter:e=>yn(e,fe?Ce("common.collapse")||"Collapse":Ce("common.expand")||"Expand"),onFocus:e=>yn(e,fe?Ce("common.collapse")||"Collapse":Ce("common.expand")||"Expand"),onMouseLeave:xn,onBlur:xn,children:/* @__PURE__ */n("svg",fe?{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"})}:{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"})})}),sn&&B&&/* @__PURE__ */n("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":Ce("common.preview")||"Preview",onClick:Cn,onMouseEnter:e=>yn(e,Ce("common.preview")||"Preview"),onFocus:e=>yn(e,Ce("common.preview")||"Preview"),onMouseLeave:xn,onBlur:xn,children:/* @__PURE__ */n("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",children:/* @__PURE__ */e("g",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",children:[
|
|
29
|
+
/* @__PURE__ */n("path",{d:"M23.628 7.41c-.12-1.172-.08-3.583-.9-4.233c-1.921-1.51-6.143-1.11-8.815-1.19c-3.481-.15-7.193.14-10.625.24a.34.34 0 0 0 0 .67c3.472-.05 7.074-.29 10.575-.09c2.471.15 6.653-.14 8.254 1.16c.4.33.41 2.732.49 3.582a42 42 0 0 1 .08 9.005a13.8 13.8 0 0 1-.45 3.001c-2.42 1.4-19.69 2.381-20.72.55a21 21 0 0 1-.65-4.632a41.5 41.5 0 0 1 .12-7.964c.08 0 7.334.33 12.586.24c2.331 0 4.682-.13 6.764-.21a.33.33 0 0 0 0-.66c-7.714-.16-12.897-.43-19.31.05c.11-1.38.48-3.922.38-4.002a.3.3 0 0 0-.42 0c-.37.41-.29 1.77-.36 2.251s-.14 1.07-.2 1.6a45 45 0 0 0-.36 8.645a21.8 21.8 0 0 0 .66 5.002c1.46 2.702 17.248 1.461 20.95.43c1.45-.4 1.69-.8 1.871-1.95c.575-3.809.602-7.68.08-11.496"}),
|
|
30
|
+
/* @__PURE__ */n("path",{d:"M4.528 5.237a.84.84 0 0 0-.21-1c-.77-.41-1.71.39-1 1.1a.83.83 0 0 0 1.21-.1m2.632-.25c.14-.14.19-.84-.2-1c-.77-.41-1.71.39-1 1.09a.82.82 0 0 0 1.2-.09m2.88 0a.83.83 0 0 0-.21-1c-.77-.41-1.71.39-1 1.09a.82.82 0 0 0 1.21-.09m-4.29 8.735c0 .08.23 2.471.31 2.561a.371.371 0 0 0 .63-.14c0-.09 0 0 .15-1.72a10 10 0 0 0-.11-2.232a5.3 5.3 0 0 1-.26-1.37a.3.3 0 0 0-.54-.24a6.8 6.8 0 0 0-.2 2.33c-1.281-.38-1.121.13-1.131-.42a15 15 0 0 0-.19-1.93c-.16-.17-.36-.17-.51.14a20 20 0 0 0-.43 3.471c.04.773.18 1.536.42 2.272c.26.4.7.22.7-.1c0-.09-.16-.09 0-1.862c.06-1.18-.23-.3 1.16-.76m5.033-2.552c.32-.07.41-.28.39-.37c0-.55-3.322-.34-3.462-.24s-.2.18-.18.28s0 .11 0 .16a3.8 3.8 0 0 0 1.591.361v.82a15 15 0 0 0-.13 3.132c0 .2-.09.94.17 1.16a.34.34 0 0 0 .48 0c.125-.35.196-.718.21-1.09a8 8 0 0 0 .14-3.232c0-.13.05-.7-.1-.89a8 8 0 0 0 .89-.09m5.544-.181a.69.69 0 0 0-.89-.44a2.8 2.8 0 0 0-1.252 1.001a2.3 2.3 0 0 0-.41-.83a1 1 0 0 0-1.6.27a7 7 0 0 0-.35 2.07c0 .571 0 2.642.06 2.762c.14 1.09 1 .51.63.13a17.6 17.6 0 0 1 .38-3.962c.32-1.18.32.2.39.51s.11 1.081.73 1.081s.48-.93 1.401-1.78q.075 1.345 0 2.69a15 15 0 0 0 0 1.811a.34.34 0 0 0 .68 0q.112-.861.11-1.73a16.7 16.7 0 0 0 .12-3.582m1.441-.201c-.05.16-.3 3.002-.31 3.202a6.3 6.3 0 0 0 .21 1.741c.33 1 1.21 1.07 2.291.82a3.7 3.7 0 0 0 1.14-.23c.21-.22.10-.59-.41-.64q-.817.096-1.64.07c-.44-.07-.34 0-.67-4.442q.015-.185 0-.37a.316.316 0 0 0-.23-.38a.316.316 0 0 0-.38.23"})]})})})]})]}),
|
|
31
|
+
/* @__PURE__ */e("div",{className:`code-block-body${ge?" code-block-body--collapsed":""}${fe?" code-block-body--expanded":""}`,children:[!ge&&(!!f||!h)&&(J?/* @__PURE__ */n(En,{node:u}):/* @__PURE__ */e("div",{className:"code-editor-layer",children:[
|
|
32
|
+
/* @__PURE__ */n("div",{ref:E,className:"code-editor-container"+(f?"":" code-height-placeholder"),style:{visibility:le?"visible":"hidden"},"aria-hidden":!le}),!le&&/* @__PURE__ */n("div",{className:"code-editor-fallback-surface",children:/* @__PURE__ */n(En,{className:"code-fallback-plain m-0",diffInline:Ze,node:u,showLineNumbers:Boolean(u.diff),style:Ge})})]})),!f&&h&&/* @__PURE__ */n("div",{className:"code-loading-placeholder",children:/* @__PURE__ */e("div",{className:"loading-skeleton",children:[
|
|
33
|
+
/* @__PURE__ */n("div",{className:"skeleton-line"}),
|
|
34
|
+
/* @__PURE__ */n("div",{className:"skeleton-line"}),
|
|
35
|
+
/* @__PURE__ */n("div",{className:"skeleton-line short"})]})})]}),we&&!a.onPreviewCode&&sn&&"html"===tn&&/* @__PURE__ */n(Ye,{code:String(null!=(l=u.code)?l:""),htmlPreviewAllowScripts:a.htmlPreviewAllowScripts,htmlPreviewSandbox:a.htmlPreviewSandbox,isDark:m,onClose:()=>ye(!1)}),
|
|
36
|
+
/* @__PURE__ */n("span",{className:"sr-only","aria-live":"polite",role:"status",children:me?Ce("common.copied")||"Copied":""})]})}function Fn(e){var n,t,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(n=0;n<o;n++)e[n]&&(t=Fn(e[n]))&&(r&&(r+=" "),r+=t)}else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function Wn(){for(var e,n,t=0,r="",o=arguments.length;t<o;t++)(e=arguments[t])&&(n=Fn(e))&&(r&&(r+=" "),r+=n);return r}const On=()=>import("@terrastruct/d2");let jn=null,zn=On;function Kn(e){zn=e,jn=null}function Vn(e){Kn(null!=e?e:On)}function Xn(){Kn(null)}function Un(){return"function"==typeof zn}async function qn(){if(jn)return jn;const e=zn;if(!e)return null;let n;try{n=await e()}catch(t){if(e===On)throw new Error('Optional dependency "@terrastruct/d2" is not installed. Please install it to enable D2 diagrams.');throw t}return n?(jn=function(e){var n;if(!e)return e;if(e.D2&&"function"==typeof e.D2)return e.D2;if(e.default&&e.default.D2&&"function"==typeof e.default.D2)return e.default.D2;const t=null!=(n=e.default)?n:e;return"function"==typeof t?t:(null==t?void 0:t.D2)&&"function"==typeof t.D2?t.D2:t}(n),jn):null}const Yn={maxHeight:"500px",loading:!0,progressiveRender:!0,progressiveIntervalMs:700,showHeader:!0,showModeToggle:!0,showCopyButton:!0,showExportButton:!0,showCollapseButton:!0},Zn={N1:"#E5E7EB",N2:"#CBD5E1",N3:"#94A3B8",N4:"#64748B",N5:"#475569",N6:"#334155",N7:"#0B1220",B1:"#60A5FA",B2:"#3B82F6",B3:"#2563EB",B4:"#1D4ED8",B5:"#1E40AF",B6:"#111827",AA2:"#22D3EE",AA4:"#0EA5E9",AA5:"#0284C7",AB4:"#FBBF24",AB5:"#F59E0B"},Gn=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],Jn=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function Qn(e){if(!e)return"";const n=e.trim();return Jn.test(n)?n:""}function et(r){var l,a;const u={...Yn,...r},{t:m}=Re(),[h,f]=i(!1),[p,g]=i(!1),[v,w]=i(!1),[y,x]=i(!1),[k,b]=i(null),[C,N]=i(""),[M,B]=i(null),[S,T]=i(!1),[L,E]=i(()=>"undefined"==typeof window),$=s(0),D=s(null),P=s(!1),_=s(!1),A=s(0),R=s(null),I=s(!1),H=s(null),F=s(null),W=s(null),O=s(null),j=s(!1),z=s(()=>{}),K=$e(),V=null!=(a=null==(l=u.node)?void 0:l.code)?a:"",X=v||!y||!C,U=!!C,q=o(()=>{if(u.maxHeight)return{maxHeight:"number"==typeof u.maxHeight?`${u.maxHeight}px`:String(u.maxHeight)}},[u.maxHeight]),Y=o(()=>{if(X&&M)return{minHeight:`${M}px`}},[M,X]);c(()=>{j.current=S},[S]),c(()=>{const e=H.current;if(!e)return;const n=K(e,{rootMargin:"160px"});return F.current=n,n.isVisible()&&E(!0),n.whenVisible.then(()=>E(!0)),()=>{n.destroy(),F.current=null}},[K]);const Z=d(()=>{const e=W.current;if(!e)return;const n=e.getBoundingClientRect().height;n>0&&B(e=>e!==n?n:e)},[]),G=d((e=!1)=>{if(P.current||"undefined"==typeof window)return;if(_.current)return;if(!L)return;if(j.current)return void(I.current=!0);const n=Math.max(120,Number(u.progressiveIntervalMs)||0),t=Date.now()-A.current;if(!e&&t<n)return I.current=!0,void(null==R.current&&(R.current=window.setTimeout(()=>{R.current=null,I.current&&(I.current=!1,G(!0))},Math.max(0,n-t))));P.current=!0;const r=()=>{P.current=!1,A.current=Date.now(),z.current()};"undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(r):setTimeout(r,0)},[u.progressiveIntervalMs,L]),J=d(async()=>{if(D.current)return D.current;const e=await qn();if(!e)return null;if("function"==typeof e){const n=new e;return n&&"function"==typeof n.compile?D.current=n:"function"==typeof e.compile&&(D.current=e),D.current}return(null==e?void 0:e.D2)&&"function"==typeof e.D2?(D.current=new e.D2,D.current):("function"==typeof e.compile&&(D.current=e),D.current)},[]),Q=d(async()=>{var e,n,t,r,o;if("undefined"==typeof window||_.current)return;if(!L)return;if(u.loading&&!u.progressiveRender)return;if(!V)return N(""),void b(null);const i=++$.current;T(!0),b(null);try{const l=await J();if(!l)return x(!1),w(!0),N(""),void b("D2 is not available.");if("function"!=typeof l.compile||"function"!=typeof l.render)throw new Error("D2 instance is missing compile/render methods.");x(!0);const a=await l.compile(V);if(i!==$.current)return;const s=null!=(e=null==a?void 0:a.diagram)?e:a,c=null!=(t=null!=(n=null==a?void 0:a.renderOptions)?n:null==a?void 0:a.options)?t:{},d=null!=(r=u.themeId)?r:c.themeID,m=null!=(o=u.darkThemeId)?o:c.darkThemeID,h={...c};if(h.themeID=u.isDark&&null!=m?m:d,h.darkThemeID=null,h.darkThemeOverrides=null,u.isDark){const e=c.themeOverrides&&"object"==typeof c.themeOverrides?c.themeOverrides:null;h.themeOverrides={...Zn,...e||{}}}const f=await l.render(s,h);if(i!==$.current)return;const p=function(e){return e?"string"==typeof e?e:"string"==typeof e.svg?e.svg:"string"==typeof e.data?e.data:"":""}(f);if(!p)throw new Error("D2 render returned empty output.");const g=function(e){if("undefined"==typeof window||"undefined"==typeof DOMParser)return"";if(!e)return"";const n=e.replace(/["']\s*javascript:/gi,"#").replace(/\bjavascript:/gi,"#").replace(/["']\s*vbscript:/gi,"#").replace(/\bvbscript:/gi,"#").replace(/\bdata:text\/html/gi,"#"),t=(new DOMParser).parseFromString(n,"image/svg+xml").documentElement;if(!t||"svg"!==t.nodeName.toLowerCase())return"";const r=t;return function(e){const n=/* @__PURE__ */new Set(["script"]),t=[e,...Array.from(e.querySelectorAll("*"))];for(const r of t){if(n.has(r.tagName.toLowerCase())){r.remove();continue}const e=Array.from(r.attributes);for(const n of e){const e=n.name;if(/^on/i.test(e))r.removeAttribute(e);else{if("style"===e&&n.value){const t=n.value;if(Gn.some(e=>e.test(t))){r.removeAttribute(e);continue}}if(("href"===e||"xlink:href"===e)&&n.value){const t=Qn(n.value);if(!t){r.removeAttribute(e);continue}t!==n.value&&r.setAttribute(e,t)}}}}}(r),r.classList.add("markstream-d2-root-svg"),r.outerHTML}(p);N(g||""),u.loading&&w(!1),b(null)}catch(l){if(i!==$.current)return;const e=(null==l?void 0:l.message)?String(l.message):"D2 render failed.";u.loading||b(e),e.includes("@terrastruct/d2")&&(x(!1),w(!0))}finally{i===$.current&&(T(!1),I.current&&(I.current=!1,G()))}},[V,J,u.darkThemeId,u.isDark,u.loading,u.progressiveRender,u.themeId,G,L]);c(()=>{z.current=Q},[Q]);const ee=d(async()=>{var e;try{(null==(e=null==navigator?void 0:navigator.clipboard)?void 0:e.writeText)&&await navigator.clipboard.writeText(V),f(!0),setTimeout(()=>f(!1),1e3)}catch{}},[V]),ne=d(()=>{if(C)try{const e=new Blob([C],{type:"image/svg+xml;charset=utf-8"}),n=URL.createObjectURL(e),t=document.createElement("a");t.href=n,t.download=`d2-diagram-${Date.now()}.svg`,document.body.appendChild(t),t.click(),document.body.removeChild(t),URL.revokeObjectURL(n)}catch(e){console.error("Failed to export SVG:",e)}},[C]),te=d((e,n)=>{var t;(t=e.currentTarget)&&!t.disabled&&Ve(e.currentTarget,n,"top",!1,(e.clientX,e.clientY),u.isDark)},[u.isDark]),re=d(()=>{Xe()},[]);return c(()=>{G()},[V,u.loading,u.isDark,G]),c(()=>{u.loading||G(!0)},[u.loading,G]),c(()=>{const e=requestAnimationFrame(()=>Z());return()=>cancelAnimationFrame(e)},[X,C,V,Z]),c(()=>{_.current=!1,G();const e=requestAnimationFrame(()=>Z());if("undefined"!=typeof ResizeObserver){const e=new ResizeObserver(()=>{Z()});O.current=e,W.current&&e.observe(W.current)}return()=>{var n;_.current=!0,null!=R.current&&(clearTimeout(R.current),R.current=null),null==(n=O.current)||n.disconnect(),O.current=null,cancelAnimationFrame(e)}},[G,Z]),/* @__PURE__ */e("div",{ref:H,className:Wn("d2-block my-4 rounded-lg border overflow-hidden shadow-sm",u.isDark?"border-gray-700/30 bg-gray-900 text-gray-100":"border-gray-200 bg-white text-gray-900"),children:[u.showHeader&&/* @__PURE__ */e("div",{className:"d2-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5",style:{color:"var(--vscode-editor-foreground)",backgroundColor:"var(--vscode-editor-background)"},children:[
|
|
37
|
+
/* @__PURE__ */n("div",{className:"flex items-center gap-x-2",children:/* @__PURE__ */n("span",{className:"text-sm font-medium font-mono",children:"D2"})}),
|
|
38
|
+
/* @__PURE__ */e("div",{className:"flex items-center gap-x-2",children:[u.showModeToggle&&/* @__PURE__ */e("div",{className:Wn("flex items-center gap-x-1 rounded-md p-0.5",u.isDark?"bg-gray-700":"bg-gray-100"),children:[
|
|
39
|
+
/* @__PURE__ */n("button",{type:"button",className:Wn("mode-btn px-2 py-1 text-xs rounded",!v&&"is-active"),onClick:()=>w(!1),onMouseEnter:e=>te(e,m("common.preview")||"Preview"),onFocus:e=>te(e,m("common.preview")||"Preview"),onMouseLeave:re,onBlur:re,children:m("common.preview")||"Preview"}),
|
|
40
|
+
/* @__PURE__ */n("button",{type:"button",className:Wn("mode-btn px-2 py-1 text-xs rounded",v&&"is-active"),onClick:()=>w(!0),onMouseEnter:e=>te(e,m("common.source")||"Source"),onFocus:e=>te(e,m("common.source")||"Source"),onMouseLeave:re,onBlur:re,children:m("common.source")||"Source"})]}),u.showCopyButton&&/* @__PURE__ */n("button",{type:"button",className:"d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":h?m("common.copied")||"Copied":m("common.copy")||"Copy",onClick:ee,onMouseEnter:e=>te(e,h?m("common.copied")||"Copied":m("common.copy")||"Copy"),onFocus:e=>te(e,h?m("common.copied")||"Copied":m("common.copy")||"Copy"),onMouseLeave:re,onBlur:re,children:/* @__PURE__ */n("svg",h?{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M20 6L9 17l-5-5"})}:{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
|
|
41
|
+
/* @__PURE__ */n("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),
|
|
42
|
+
/* @__PURE__ */n("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]})})}),u.showExportButton&&C&&/* @__PURE__ */n("button",{type:"button",className:"d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":m("common.export")||"Export",onClick:ne,onMouseEnter:e=>te(e,m("common.export")||"Export"),onFocus:e=>te(e,m("common.export")||"Export"),onMouseLeave:re,onBlur:re,children:/* @__PURE__ */n("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 3v12m0-12l-4 4m4-4l4 4M4 14v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4"})})}),u.showCollapseButton&&/* @__PURE__ */n("button",{type:"button",className:"d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":p,onClick:()=>g(e=>!e),onMouseEnter:e=>te(e,p?m("common.expand")||"Expand":m("common.collapse")||"Collapse"),onFocus:e=>te(e,p?m("common.expand")||"Expand":m("common.collapse")||"Collapse"),onMouseLeave:re,onBlur:re,children:/* @__PURE__ */n("svg",{style:{transform:`rotate(${p?0:90}deg)`},xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 18l6-6l-6-6"})})})]})]}),!p&&/* @__PURE__ */n("div",{ref:W,className:"d2-block-body",style:Y,children:u.loading&&!U?/* @__PURE__ */e("div",{className:"d2-source px-4 py-4",children:[
|
|
43
|
+
/* @__PURE__ */n("pre",{className:"d2-code",children:/* @__PURE__ */n("code",{children:V})}),k&&/* @__PURE__ */n("p",{className:"d2-error mt-2 text-xs",children:k})]}):/* @__PURE__ */n(t,{children:/* @__PURE__ */e("div",X?{className:"d2-source px-4 py-4",children:[
|
|
44
|
+
/* @__PURE__ */n("pre",{className:"d2-code",children:/* @__PURE__ */n("code",{children:V})}),k&&/* @__PURE__ */n("p",{className:"d2-error mt-2 text-xs",children:k})]}:{className:"d2-render",style:q,children:[
|
|
45
|
+
/* @__PURE__ */n("div",{className:"d2-svg",dangerouslySetInnerHTML:{__html:C}}),k&&/* @__PURE__ */n("p",{className:"d2-error px-4 pb-3 text-xs",children:k})]})})})]})}function nt(t){const{node:r,ctx:o,renderNode:i,indexKey:l}=t,a=Array.isArray(r.items)?r.items:[];/* @__PURE__ */
|
|
46
|
+
return n("dl",{className:"definition-list","data-index-key":l,children:a.map((t,r)=>/* @__PURE__ */e("div",{className:"mb-4",children:[
|
|
47
|
+
/* @__PURE__ */n("dt",{className:"definition-term font-semibold",children:o&&i?H(t.term,o,`${String(null!=l?l:"definition")}-term-${r}`,i):null}),
|
|
48
|
+
/* @__PURE__ */n("dd",{className:"definition-desc ml-4",children:o&&i?H(t.definition,o,`${String(null!=l?l:"definition")}-desc-${r}`,i):null})]},`${String(null!=l?l:"definition")}-${r}`))})}function tt(e){var t;const{node:r}=e;/* @__PURE__ */
|
|
49
|
+
return n("span",{className:"emoji-node",children:null!=(t=r.name)?t:r.markup})}function rt(e){/* @__PURE__ */
|
|
50
|
+
return n("em",{className:"emphasis-node",children:e.children})}function ot(e){const{node:t}=e,r=d(e=>{var n;if(e.preventDefault(),"undefined"==typeof document)return;const r=document.getElementById(`fnref-${String(null!=(n=t.id)?n:"")}`);r&&r.scrollIntoView({behavior:"smooth"})},[t.id]);/* @__PURE__ */
|
|
51
|
+
return n("a",{className:"footnote-anchor text-sm hover:underline cursor-pointer",href:`#fnref-${t.id}`,title:`返回引用 ${t.id}`,onClick:r,children:"↩︎"})}function it(e){const{node:t,ctx:r,renderNode:o,indexKey:i}=e;/* @__PURE__ */
|
|
52
|
+
return n("div",{id:`fnref--${t.id}`,className:"footnote-node flex text-sm leading-relaxed border-t border-[var(--footnote-border,#eaecef)] pt-2",children:/* @__PURE__ */n("div",{className:"flex-1",children:r&&o?D(t.children,r,String(null!=i?i:`footnote-${t.id}`),o):null})})}function lt(t){const{node:r}=t,i=o(()=>`#fnref--${r.id}`,[r.id]),l=o(()=>({href:i}),[i]),a=d(e=>{if(e.preventDefault(),"undefined"==typeof document)return;const n=document.querySelector(i);n&&n.scrollIntoView({behavior:"smooth"})},[i]);/* @__PURE__ */
|
|
53
|
+
return n("sup",{id:`fnref-${r.id}`,className:"footnote-reference",onClick:a,children:/* @__PURE__ */e("span",{...l,title:`查看脚注 ${r.id}`,className:"footnote-link cursor-pointer",children:["[",r.id,"]"]})})}function at(e){/* @__PURE__ */
|
|
54
|
+
return n("br",{className:"hard-break"})}function st(e){const{node:t,ctx:r,renderNode:o,indexKey:i,children:l}=e,a=Math.min(6,Math.max(1,Number(t.level)||1)),s=`h${a}`,c=null==t?void 0:t.attrs,{class:d,className:u,style:m,...h}=null!=c?c:{};/* @__PURE__ */
|
|
55
|
+
return n(s,{dir:"auto",className:Wn("heading-node font-semibold",`heading-${a}`,d,u),..."object"==typeof m&&null!=m?{style:m}:{},...h,children:null!=l?l:r&&o?D(t.children,r,String(null!=i?i:`heading-${a}`),o):null})}function ct(e){/* @__PURE__ */
|
|
56
|
+
return n("mark",{className:"highlight-node",children:e.children})}function dt(l){var a,d,m,x,k,b,C,N;const{node:M,placeholder:B,customId:S}=l,T=null!=(m=null!=(d=l.htmlPolicy)?d:null==(a=l.ctx)?void 0:a.htmlPolicy)?m:"safe",L=$e(),[E,$]=i(null),P=s(null),[_,A]=i(()=>"undefined"==typeof window),[R,I]=i(M.content),H=Boolean(M.loading),X=u(F,W,W),U=o(()=>{var e,n,t,r,o;return{...null!=(t=null!=(n=l.customComponents)?n:null==(e=l.ctx)?void 0:e.customComponents)?t:O(S),...null!=(o=null==(r=l.ctx)?void 0:r.htmlComponents)?o:{}}},[S,null==(x=l.ctx)?void 0:x.customComponents,null==(k=l.ctx)?void 0:k.htmlComponents,l.customComponents,X]),q=o(()=>{var e,n;return{...U,...null!=(n=null==(e=l.ctx)?void 0:e.streamingComponents)?n:{}}},[U,null==(b=l.ctx)?void 0:b.streamingComponents]);c(()=>{var e;if("undefined"==typeof window)return void A(!0);if(null==(e=P.current)||e.destroy(),P.current=null,!H)return A(!0),void I(M.content);if(!E)return void A(!1);const n=L(E,{rootMargin:"400px"});return P.current=n,n.isVisible()&&A(!0),n.whenVisible.then(()=>A(!0)).catch(()=>{}),()=>{n.destroy(),P.current=null}},[E,H,M.content,L]),c(()=>()=>{var e;null==(e=P.current)||e.destroy(),P.current=null},[]),c(()=>{H&&!_||I(M.content)},[H,M.content,_]);const Y=o(()=>{var e;const n=j(h(null!=(e=M.attrs)?e:void 0,T));return n?z(n):void 0},[T,M.attrs]),Z=o(()=>{var e;return String(null!=(e=M.tag)?e:"").trim()},[M.tag]),G=o(()=>f(Z),[Z]),J=o(()=>{var e;const n=j(h(null!=(e=M.attrs)?e:void 0,T,Z));return n?z(n):void 0},[T,M.attrs,Z]),Q=o(()=>{var e;return p(g(h(null!=(e=M.attrs)?e:void 0,T,G)))},[T,M.attrs,G]),ee=o(()=>Array.isArray(M.children)?M.children:[],[M.children]),ne=ee.length>0&&!!Z&&!v.has(Z.toLowerCase())&&!w(Z,T)&&!!l.ctx&&!!l.renderNode,te=o(()=>function(e){const n={...e||{}},t="string"==typeof n.className?n.className.trim():"";return n.className=t?`html-block-node ${t}`:"html-block-node",n}(J),[J]),re=o(()=>{var e;return"escape"!==T&&K(null!=(e=M.content)?e:"",q)},[q,T,M.content]),oe=o(()=>{var e,n,t;return re&&M.content?V(M.content,U,T,{ctx:l.ctx,keyPrefix:String(null!=(e=l.indexKey)?e:"html-block"),nodeComponents:null==(n=l.ctx)?void 0:n.streamingComponents,propComponents:null==(t=l.ctx)?void 0:t.htmlComponents,renderNode:l.renderNode,sourceNode:M}):null},[U,T,M.autoClosed,M.content,M.loading,l.ctx,l.indexKey,l.renderNode,re]),ie=o(()=>y(null!=R?R:"",T),[T,R]),le=o(()=>{var e;return ne&&l.ctx&&l.renderNode?D(ee,l.ctx,`${String(null!=(e=l.indexKey)?e:"html-block")}-structured`,l.renderNode):null},[ne,l.ctx,l.indexKey,l.renderNode,ee]),ae=G?null==(N=null==(C=l.ctx)?void 0:C.htmlComponents)?void 0:N[G]:void 0,se=/* @__PURE__ */n("div",{className:"html-block-node__placeholder",children:null!=B?B:/* @__PURE__ */e(t,{children:[
|
|
57
|
+
/* @__PURE__ */n("span",{className:"html-block-node__placeholder-bar"}),
|
|
58
|
+
/* @__PURE__ */n("span",{className:"html-block-node__placeholder-bar w-4/5"}),
|
|
59
|
+
/* @__PURE__ */n("span",{className:"html-block-node__placeholder-bar w-2/3"})]})});return ne&&ae?r.createElement(ae,Q,le):ne?r.createElement(Z,{...te,ref:$},_?le:se):/* @__PURE__ */n("div",{ref:$,className:"html-block-node",...Y,children:_?re&&oe?/* @__PURE__ */n(t,{children:oe}):/* @__PURE__ */n("div",{dangerouslySetInnerHTML:{__html:ie}}):se})}const ut=(()=>{try{return Boolean(!1)}catch{}return!1})();function mt(e){ut&&console.warn(e)}function ht(e,n,t=!1){const r=Object.entries(null!=n?n:{}),o=r.length>0?r.map(([e,n])=>""===n?` ${e}`:` ${e}="${n}"`).join(""):"";return t?`<${e}${o} />`:`<${e}${o}>`}function ft(e,n){Array.isArray(n)?e.push(...n):null!=n&&e.push(n)}function pt(e,n){var t;for(const r of X(e)){if("tag_open"!==r.type&&"self_closing"!==r.type)continue;const e=null!=(t=r.tagName)?t:"";if(!U(e,n))continue;const o=n[e]||n[e.toLowerCase()];if("block"===q(o))return!0}return!1}function gt(e,n){var t,r;return(null==(t=n.nodeComponents)?void 0:t[e])||(null==(r=n.nodeComponents)?void 0:r[e.toLowerCase()])}function vt(e){if(null==e||"boolean"==typeof e)return"";if("string"==typeof e||"number"==typeof e)return String(e);if(Array.isArray(e))return e.map(vt).join("");if(!r.isValidElement(e))return"";const n=e;if("string"!=typeof n.type)return vt(n.props.children);const t=Object.entries(n.props).filter(([e,n])=>"children"!==e&&"key"!==e&&"ref"!==e&&null!=n&&"boolean"!=typeof n).map(([e,n])=>` ${"className"===e?"class":e}="${String(n)}"`).join("");return`<${n.type}${t}>${vt(n.props.children)}</${n.type}>`}function wt(e){return Object.entries(e).map(([e,n])=>[e,""===n?null:n])}function yt(e){var n,t;const r=e.sourceNode,o=!0!==(null==(n=e.ctx)?void 0:n.final)&&(!1===(null==(t=e.ctx)?void 0:t.final)||Boolean(null==r?void 0:r.loading));return{loading:o,autoClosed:o||Boolean(null==r?void 0:r.autoClosed)}}function xt(e,n,t,o,i,l,a,s,c,d){const u=U(e,o),m=Boolean(gt(e,a));if(x.has(e.toLowerCase())||!u&&!m&&k(e,l))return null;if(!u&&!m&&w(e,l))return[ht(e,n),...t,`</${e}>`];const h=Y(n,l,e),g=h.key,v=null!=g&&""!==g?g:i;if(m)return function(e,n,t,o,i,l,a,s=yt(i)){const c=f(e),d=null!=l?l:function(e){return e.map(vt).join("")}(t),u={type:c,tag:c,attrs:wt(n),content:d,raw:null!=a?a:`${ht(e,n)}${d}</${e}>`,loading:s.loading,autoClosed:s.autoClosed};if(i.ctx&&i.renderNode)return i.renderNode(u,o,i.ctx);const m=gt(e,i);return m?r.createElement(m,{key:o,node:u}):null}(e,n,t,String(v),a,s,c,d);if(u){const n=o[e]||o[e.toLowerCase()],i=p(h);return r.createElement(n,{...i,key:v},...t)}return r.createElement(e,{...z(h),key:v},...t)}function kt(e){var o,l,a,d,u,m,v,b;const{node:C,customId:N}=e,M=null!=(a=null!=(l=e.htmlPolicy)?l:null==(o=e.ctx)?void 0:o.htmlPolicy)?a:"safe",B=s(null),[S,T]=i(!1);c(()=>{T(!0)},[]);const L=r.useMemo(()=>{var n,t,r,o;return{...null!=(t=null==(n=e.ctx)?void 0:n.customComponents)?t:O(N),...null!=(o=null==(r=e.ctx)?void 0:r.htmlComponents)?o:{}}},[N,null==(d=e.ctx)?void 0:d.customComponents,null==(u=e.ctx)?void 0:u.htmlComponents]),E=r.useMemo(()=>{var n,t;return{...L,...null!=(t=null==(n=e.ctx)?void 0:n.streamingComponents)?t:{}}},[L,null==(m=e.ctx)?void 0:m.streamingComponents]),$=r.useMemo(()=>{var e;return y(null!=(e=C.content)?e:"",M)},[M,C.content]),P=r.useMemo(()=>{var e;return String(null!=(e=C.tag)?e:"").trim()},[C.tag]),_=r.useMemo(()=>f(P),[P]),A=r.useMemo(()=>Array.isArray(C.children)?C.children:[],[C.children]),R=r.useMemo(()=>{var e;return p(g(h(null!=(e=C.attrs)?e:void 0,M,_)))},[M,C.attrs,_]),I=_?null==(b=null==(v=e.ctx)?void 0:v.htmlComponents)?void 0:b[_]:void 0,H=A.length>0&&!!P&&"escape"!==M&&!w(P,M)&&!!e.ctx&&!!e.renderNode&&!!I,F=r.useMemo(()=>{var n;return H&&e.ctx&&e.renderNode?D(A,e.ctx,`${String(null!=(n=e.indexKey)?n:"html-inline")}-structured`,e.renderNode):null},[H,e.ctx,e.indexKey,e.renderNode,A]),W=r.useMemo(()=>{var n,t;const r=C.content;if(!r)return{mode:"html",content:""};if("escape"===M)return{mode:"html",content:r};if(!K(r,E))return{mode:"html",content:r};const o=function(e,n,t="safe",r={}){if(!e)return[];try{const o=function(e,n,t="safe",r={}){var o;let i=0;const l=null!=(o=r.keyPrefix)?o:"ms-html",a=[],s=[];for(const c of e)if("text"===c.type){if(a.length>0&&a[a.length-1].hardBlocked)continue;(a.length>0?a[a.length-1].children:s).push(c.content),a.length>0&&a[a.length-1].sourceParts.push(c.content)}else if("self_closing"===c.type){const e=c.attrs||{},o=ht(c.tagName,e,!0),d=U(c.tagName,n),u=Boolean(gt(c.tagName,r));if(x.has(c.tagName.toLowerCase())||!d&&!u&&k(c.tagName,t))continue;if(!d&&!u&&w(c.tagName,t)){(a.length>0?a[a.length-1].children:s).push(o),a.length>0&&a[a.length-1].sourceParts.push(o);continue}const m=xt(c.tagName,e,[],n,`${l}-${i++}`,t,r,"",o,{loading:!1,autoClosed:!1});ft(a.length>0?a[a.length-1].children:s,m),a.length>0&&a[a.length-1].sourceParts.push(o)}else if("tag_open"===c.type){const e=a.length>0&&a[a.length-1].hardBlocked,o=U(c.tagName,n),i=Boolean(gt(c.tagName,r));a.push({tagName:c.tagName,children:[],attrs:c.attrs,sourceParts:[],customComponent:o||i,hardBlocked:e||x.has(c.tagName.toLowerCase())||!o&&!i&&k(c.tagName,t),softBlocked:!e&&!o&&!i&&w(c.tagName,t)})}else if("tag_close"===c.type){const e=c.tagName.toLowerCase();let o=-1;for(let n=a.length-1;n>=0;n--)if(a[n].tagName.toLowerCase()===e){o=n;break}if(-1!==o)for(;a.length>o;){const c=a.pop(),d=c.sourceParts.join(""),u=`${ht(c.tagName,c.attrs||{})}${d}</${c.tagName}>`;let m;if(c.hardBlocked)m=null;else if(c.softBlocked)m=[ht(c.tagName,c.attrs||{}),...c.children,`</${c.tagName}>`];else{const o=c.tagName.toLowerCase()===e?{loading:!1,autoClosed:!1}:yt(r);m=xt(c.tagName,c.attrs||{},c.children,n,`${l}-${i++}`,t,r,d,u,o)}a.length>0?ft(a[a.length-1].children,m):ft(s,m),a.length>0&&!c.hardBlocked&&a[a.length-1].sourceParts.push(u),c.tagName.toLowerCase()!==e&&a.length>o&&mt(`Auto-closing unclosed tag: <${c.tagName}>`)}else mt(`Ignoring closing tag with no matching opening tag: </${c.tagName}>`)}for(;a.length>0;){const e=a.pop(),o=e.sourceParts.join(""),c=`${ht(e.tagName,e.attrs||{})}${o}`;let d;d=e.hardBlocked?null:e.softBlocked?[ht(e.tagName,e.attrs||{}),...e.children,`</${e.tagName}>`]:xt(e.tagName,e.attrs||{},e.children,n,`${l}-${i++}`,t,r,o,c,yt(r)),ft(s,d),a.length>0&&!e.hardBlocked&&a[a.length-1].sourceParts.push(c),mt(`Auto-closing unclosed tag: <${e.tagName}>`)}return s}(X(e),n,t,r);return o}catch(i){return o=i,ut&&console.error("Failed to parse HTML to React nodes:",o),null}var o}(r,L,M,{ctx:e.ctx,keyPrefix:String(null!=(n=e.indexKey)?n:"html-inline"),nodeComponents:null==(t=e.ctx)?void 0:t.streamingComponents,renderNode:e.renderNode,sourceNode:C});return null===o?{mode:"html",content:r}:{mode:"dynamic",block:pt(r,E),nodes:o}},[L,E,M,C.autoClosed,C.content,C.loading,e.ctx,e.indexKey,e.renderNode]);return c(()=>{if(!S||!B.current||"html"!==W.mode)return;const e=B.current;e.innerHTML="";const n=document.createElement("template");n.innerHTML=$,e.appendChild(n.content.cloneNode(!0))},[W.mode,S,$]),!C.loading||C.autoClosed||H||"dynamic"===W.mode?H?r.createElement(I,R,F):"dynamic"===W.mode?W.block?/* @__PURE__ */n(t,{children:W.nodes}):/* @__PURE__ */n("span",{className:"html-inline-node",style:{display:"inline"},children:W.nodes}):/* @__PURE__ */n("span",{ref:B,className:"html-inline-node",style:{display:"inline"}}):/* @__PURE__ */n("span",{className:"html-inline-node html-inline-node--loading",children:C.content})}const bt={fallbackSrc:"",lazy:!0,usePlaceholder:!0};function Ct(e,n,t){return t||e?{src:e,stage:"primary"}:n?{src:n,stage:"fallback"}:{src:"",stage:"failed"}}function Nt(r){var o,l,a,s,d,u;const m={...bt,...r},h=b(m.node.src),f=b(m.fallbackSrc),p=Ct(h,f,m.node.loading),[g,v]=i(!1),[w,y]=i(!1),[x,k]=i(p.src),[C,N]=i(p.stage),M=x;c(()=>{const e=Ct(h,f,m.node.loading);k(e.src),N(e.stage),v(!1),y("failed"===e.stage)},[h,f,m.node.loading]);return!m.node.loading&&"failed"!==C&&M?/* @__PURE__ */n("img",{src:M,alt:String(null!=(l=null!=(o=m.node.alt)?o:m.node.title)?l:""),title:String(null!=(s=null!=(a=m.node.title)?a:m.node.alt)?s:""),className:"image-node__img"+(g?" is-loaded":""),loading:m.lazy?"lazy":"eager",decoding:"async",tabIndex:g?0:-1,"aria-label":null!=(d=m.node.alt)?d:"Preview image",onError:()=>{var e;if("primary"===C&&f&&f!==x)return k(f),N("fallback"),v(!1),void y(!1);N("failed"),y(!0),null==(e=m.onError)||e.call(m,x)},onLoad:()=>{var e;v(!0),y(!1),null==(e=m.onLoad)||e.call(m,M)},onClick:e=>{var n;e.preventDefault(),g&&!w&&(null==(n=m.onClick)||n.call(m,[e,M]))}},"image"):m.node.loading&&!w?/* @__PURE__ */n("span",{className:"image-node__placeholder",children:m.usePlaceholder?/* @__PURE__ */e(t,{children:[
|
|
60
|
+
/* @__PURE__ */n("span",{className:"image-node__spinner","aria-hidden":"true"}),
|
|
61
|
+
/* @__PURE__ */n("span",{className:"image-node__placeholder-text",children:"Loading image..."})]}):/* @__PURE__ */n("span",{className:"image-node__placeholder-text",children:null!=(u=m.node.raw)?u:"Loading image…"})},"placeholder"):m.node.loading||"failed"!==C?null:/* @__PURE__ */e("span",{className:"image-node__error",children:[
|
|
62
|
+
/* @__PURE__ */n("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24","aria-hidden":"true",children:/* @__PURE__ */n("path",{fill:"currentColor",d:"M2 2h20v10h-2V4H4v9.586l5-5L14.414 14L13 15.414l-4-4l-5 5V20h8v2H2zm13.547 5a1 1 0 1 0 0 2a1 1 0 0 0 0-2m-3 1a3 3 0 1 1 6 0a3 3 0 0 1-6 0m3.625 6.757L19 17.586l2.828-2.829l1.415 1.415L20.414 19l2.829 2.828l-1.415 1.415L19 20.414l-2.828 2.829l-1.415-1.415L17.586 19l-2.829-2.828z"})}),
|
|
63
|
+
/* @__PURE__ */n("span",{className:"image-node__placeholder-text",children:"Image failed to load"})]})}let Mt=null,Bt=null;const St=/* @__PURE__ */n("svg",{width:"1em",height:"1em",viewBox:"0 0 291 300",fill:"none",className:"w-4 h-4 flex-shrink-0",xmlns:"http://www.w3.org/2000/svg",children:/* @__PURE__ */e("g",{children:[
|
|
64
|
+
/* @__PURE__ */n("path",{d:"M140.904 239.376C128.83 239.683 119.675 239.299 115.448 243.843C110.902 248.07 111.288 257.227 110.979 269.302C111.118 274.675 111.118 279.478 111.472 283.52C111.662 285.638 111.95 287.547 112.406 289.224C112.411 289.243 112.416 289.259 112.422 289.28C112.462 289.419 112.496 289.558 112.539 289.691C113.168 291.787 114.088 293.491 115.446 294.758C116.662 296.064 118.283 296.963 120.264 297.69C120.36 297.614 120.464 297.646 120.555 297.675C120.56 297.68 120.56 297.68 120.566 297.68C120.848 297.768 121.142 297.846 121.443 297.923C121.454 297.923 121.464 297.928 121.478 297.934C122.875 298.272 124.424 298.507 126.11 298.678C126.326 298.696 126.542 298.718 126.763 298.739C130.79 299.086 135.558 299.088 140.904 299.222C152.974 298.912 162.128 299.302 166.36 294.758C170.904 290.526 170.515 281.371 170.824 269.302C170.515 257.227 170.907 248.07 166.36 243.843C162.131 239.299 152.974 239.683 140.904 239.376Z",fill:"#FF6376"}),
|
|
65
|
+
/* @__PURE__ */n("path",{d:"M21.2155 128.398C12.6555 128.616 6.16484 128.339 3.16751 131.56C-0.0538222 134.56 0.218178 141.054 -0.000488281 149.608C0.218178 158.168 -0.0538222 164.659 3.16751 167.656C6.16484 170.878 12.6555 170.606 21.2155 170.824C25.0262 170.726 28.4288 170.726 31.2955 170.475C32.7968 170.342 34.1488 170.136 35.3382 169.814C35.3542 169.811 35.3648 169.806 35.3782 169.803C35.4768 169.774 35.5755 169.747 35.6688 169.718C37.1568 169.272 38.3648 168.622 39.2635 167.656C40.1915 166.795 40.8262 165.646 41.2715 164.243C41.2875 164.174 41.3115 164.102 41.3328 164.035C41.3328 164.035 41.3355 164.032 41.3355 164.027C41.3968 163.827 41.4529 163.622 41.5062 163.406C41.5062 163.398 41.5115 163.392 41.5142 163.382C41.7542 162.392 41.9222 161.294 42.0422 160.096C42.0555 159.944 42.0715 159.792 42.0848 159.635C42.3328 156.779 42.3328 153.398 42.4262 149.608C42.2075 141.054 42.4848 134.56 39.2635 131.56C36.2635 128.339 29.7728 128.616 21.2155 128.398Z",fill:"#FFCCCC"}),
|
|
66
|
+
/* @__PURE__ */n("path",{d:"M81.0595 184.171C70.8568 184.433 63.1208 184.102 59.5475 187.942C55.7075 191.518 56.0328 199.254 55.7742 209.454C56.0328 219.657 55.7075 227.393 59.5475 230.963C63.1208 234.803 70.8568 234.478 81.0595 234.739C85.6008 234.622 89.6595 234.622 93.0728 234.323C94.8648 234.163 96.4755 233.921 97.8942 233.534C97.9102 233.529 97.9235 233.526 97.9422 233.521C98.0568 233.486 98.1742 233.457 98.2888 233.422C100.06 232.889 101.5 232.113 102.569 230.963C103.676 229.937 104.433 228.566 104.964 226.894C104.985 226.811 105.012 226.726 105.036 226.646C105.041 226.643 105.041 226.643 105.041 226.638C105.116 226.401 105.18 226.153 105.244 225.897C105.244 225.889 105.249 225.881 105.254 225.867C105.54 224.689 105.74 223.379 105.881 221.953C105.9 221.771 105.916 221.59 105.934 221.403C106.228 218.001 106.228 213.969 106.342 209.454C106.081 199.254 106.412 191.518 102.572 187.942C98.9955 184.102 91.2568 184.433 81.0595 184.171Z",fill:"#FF939F"}),
|
|
67
|
+
/* @__PURE__ */n("path",{d:"M260.591 151.87C215.652 151.87 203.02 164.523 203.02 209.462H198.476C198.476 164.523 185.836 151.881 140.895 151.881V147.337C185.836 147.337 198.487 134.705 198.487 89.7659H203.02C203.02 134.705 215.652 147.337 260.591 147.337V151.87ZM286.052 124.158C281.82 119.614 272.66 120.001 260.591 119.689C248.521 119.385 239.361 119.771 235.129 115.227C230.585 110.995 230.983 101.846 230.671 89.7659C230.513 83.7312 230.535 78.4272 230.023 74.1019C229.513 69.7659 228.481 66.4219 226.209 64.3046C221.967 59.7606 212.817 60.1472 200.748 59.8459C188.681 60.1472 179.519 59.7606 175.287 64.3046C170.753 68.5366 171.129 77.6966 170.828 89.7659C170.516 101.835 170.9 110.995 166.356 115.227C162.124 119.771 152.985 119.374 140.905 119.689C138.873 119.739 136.924 119.771 135.071 119.811C119.313 118.697 106.337 112.318 106.337 89.7659C106.212 84.6699 106.233 80.1792 105.807 76.5206C105.367 72.8726 104.492 70.0379 102.575 68.2566C99.0013 64.4112 91.2573 64.7446 81.0653 64.4832C70.86 64.7446 63.1186 64.4112 59.5533 68.2566C55.708 71.8299 56.0306 79.5632 55.7693 89.7659C56.0306 99.9686 55.708 107.702 59.5533 111.278C63.1186 115.113 70.86 114.79 81.0653 115.049C103.617 115.049 109.996 128.035 111.1 143.803C111.068 145.659 111.028 147.587 110.975 149.619C111.121 154.987 111.121 159.79 111.476 163.835C111.663 165.95 111.945 167.857 112.404 169.534C112.412 169.555 112.412 169.566 112.423 169.598C112.465 169.734 112.497 169.867 112.537 170.003C113.164 172.099 114.092 173.809 115.447 175.07C116.665 176.371 118.281 177.278 120.271 177.905C120.364 177.934 120.46 177.955 120.564 177.987C120.855 178.081 121.145 178.153 121.439 178.238C121.46 178.238 121.471 178.238 121.479 178.249C122.876 178.582 124.42 178.822 126.108 178.987C126.327 179.009 126.545 179.03 126.764 179.051C130.788 179.395 135.559 179.395 140.905 179.529C152.975 179.843 162.124 179.457 166.356 184.001C170.9 188.233 170.516 197.371 170.828 209.451C171.129 221.529 170.743 230.681 175.287 234.91C179.519 239.454 188.681 239.07 200.748 239.371C206.127 239.235 210.921 239.235 214.975 238.881C217.079 238.694 218.985 238.403 220.676 237.955C220.695 237.945 220.705 237.934 220.727 237.934C220.873 237.891 220.999 237.859 221.135 237.819C223.228 237.193 224.937 236.265 226.209 234.91C227.511 233.691 228.409 232.065 229.044 230.097C229.065 230.003 229.095 229.899 229.127 229.803V229.793C229.22 229.513 229.295 229.222 229.367 228.918C229.367 228.897 229.377 228.897 229.377 228.878C229.721 227.481 229.951 225.937 230.127 224.249C230.137 224.03 230.169 223.811 230.191 223.593C230.535 219.571 230.535 214.798 230.671 209.451C230.972 197.371 230.585 188.233 235.129 184.001C239.361 179.457 248.511 179.843 260.591 179.529C272.66 179.227 281.82 179.614 286.052 175.07C290.596 170.838 290.209 161.689 290.511 149.619C290.209 137.539 290.596 128.379 286.052 124.158Z",fill:"#FF356A"}),
|
|
68
|
+
/* @__PURE__ */n("path",{d:"M112.405 49.848C112.411 49.8694 112.416 49.8827 112.421 49.904C112.461 50.0427 112.499 50.1814 112.539 50.3147C113.171 52.4134 114.088 54.1147 115.448 55.384C116.661 56.6907 118.283 57.5894 120.264 58.2134C120.36 58.24 120.464 58.2694 120.555 58.3014C120.56 58.3067 120.56 58.3067 120.565 58.3067C120.848 58.3947 121.141 58.4694 121.443 58.5467C121.453 58.5467 121.464 58.552 121.48 58.5574C122.875 58.896 124.424 59.1334 126.112 59.3014C126.325 59.3227 126.541 59.3414 126.763 59.3627C130.789 59.712 135.56 59.712 140.904 59.8454C152.973 59.5387 162.128 59.928 166.36 55.384C170.907 51.152 170.515 41.9947 170.824 29.9254C170.517 17.8507 170.907 8.69602 166.363 4.46935C162.131 -0.0746511 152.973 0.309349 140.904 1.52588e-05C128.829 0.309349 119.675 -0.0746511 115.448 4.46935C110.904 8.69602 111.288 17.8507 110.979 29.9254C111.117 35.3014 111.117 40.1014 111.472 44.144C111.661 46.2614 111.949 48.1707 112.405 49.848Z",fill:"#FF6376"})]})}),Tt={maxHeight:"500px",loading:!0,showHeader:!0,showCopyButton:!0,showCollapseButton:!0,showModeToggle:!0,showExportButton:!0,showFullscreenButton:!0,showZoomControls:!0};function Lt(r){var l;const a={...Tt,...r},{t:u}=Re(),[m,h]=i(!1),[f,p]=i(!1),[g,v]=i(!1),[w,y]=i(!1),[x,k]=i(()=>"undefined"==typeof window),b=a.node.code,C=o(()=>a.maxHeight&&"none"!==a.maxHeight?Z(a.maxHeight):null,[a.maxHeight]),N=o(()=>{var e;return G(null!=(e=Z(a.estimatedPreviewHeightPx))?e:J(b),void 0,C)},[b,C,a.estimatedPreviewHeightPx]),[M,B]=i(`${N}px`),[S,T]=i(!1),[L,E]=i(1),[$,D]=i({x:0,y:0}),[P,_]=i(!1),A=s(null),R=s(null),I=s(null),H=s(null),F=s(null),W=s({x:0,y:0}),O=s(null),j=$e(),z=d(e=>{if(!a.maxHeight||"none"===a.maxHeight)return`${Math.max(e,N)}px`;const n=Number.parseFloat(String(a.maxHeight));return Number.isFinite(n)?`${Math.max(Math.min(e,n),N)}px`:`${Math.max(e,N)}px`},[N,a.maxHeight]),K=d(()=>{const e=A.current;if(!e)return;const n=e.scrollHeight;n>0&&B(z(n))},[z]);c(()=>{g||f||B(e=>{const n=Z(e);return null!=n&&n>=N?e:`${N}px`})},[N,f,g]);const V=d(async()=>{var e,n;try{await(null==(e=navigator.clipboard)?void 0:e.writeText(b)),h(!0),null==(n=a.onCopy)||n.call(a,b),setTimeout(()=>h(!1),1e3)}catch{}},[b,a]),X=d(async()=>{var e,n;if(!x)return;if(!A.current)return;const t=A.current;try{const r=await async function(){return Bt||Mt||(Mt=import("@antv/infographic").then(e=>{const n=e&&e.default?e.default:e;let t=n;return"function"==typeof n&&n.prototype&&n.prototype.render?t=n:e.Infographic?t=e.Infographic:n&&n.Infographic&&(t=n.Infographic),Bt=t,t}).catch(e=>(console.warn("Failed to load @antv/infographic",e),null)),Mt)}();if(!r)return void console.warn("Infographic library failed to load.");O.current&&(null==(n=(e=O.current).destroy)||n.call(e),O.current=null),t.innerHTML="";const o=new r({container:t,width:"100%",height:"100%"});O.current=o,o.render(b),T(!0),setTimeout(()=>{K()},0)}catch(r){console.error("Failed to render infographic:",r),T(!1),t.innerHTML=`<div class="text-red-500 p-4">Failed to render infographic: ${r instanceof Error?r.message:"Unknown error"}</div>`}},[b,K,x]);c(()=>{const e=R.current;if(!e)return;const n=j(e,{rootMargin:"160px"});return I.current=n,n.isVisible()&&k(!0),n.whenVisible.then(()=>k(!0)),()=>{n.destroy(),I.current=null}},[j]),c(()=>{!x||g||f||X()},[b,f,X,g,x]),c(()=>()=>{var e,n;O.current&&(null==(n=(e=O.current).destroy)||n.call(e),O.current=null)},[]);const U=d(()=>{y(!1),H.current&&(H.current.innerHTML=""),F.current=null,document.body.style.overflow=""},[]),q=d(()=>{y(!0),document.body.style.overflow="hidden"},[]);c(()=>{if(!w)return;const e=e=>{"Escape"===e.key&&U()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[w,U]),c(()=>{w&&setTimeout(()=>{if(A.current&&H.current){H.current.innerHTML="";const e=document.createElement("div");Object.assign(e.style,{transition:"transform 0.1s ease",transformOrigin:"center center",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"});const n=A.current.cloneNode(!0);n.classList.add("fullscreen"),n.style.height="auto",e.appendChild(n),H.current.appendChild(e),F.current=e,e.style.transform=`translate(${$.x}px, ${$.y}px) scale(${L})`}},0)},[w]),c(()=>{w&&F.current&&(F.current.style.transform=`translate(${$.x}px, ${$.y}px) scale(${L})`)},[w,$,L]);const Y=d(()=>{var e;const n=null==(e=A.current)?void 0:e.querySelector("svg");if(!n)return;const t=(new XMLSerializer).serializeToString(n),r=new Blob([t],{type:"image/svg+xml;charset=utf-8"}),o=URL.createObjectURL(r),i=document.createElement("a");i.href=o,i.download=`infographic-${Date.now()}.svg`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(o)},[]),Q=e=>{_(!0);const n="touches"in e?e.touches[0].clientX:e.clientX,t="touches"in e?e.touches[0].clientY:e.clientY;W.current={x:n-$.x,y:t-$.y}},ee=e=>{if(!P)return;const n="touches"in e?e.touches[0].clientX:e.clientX,t="touches"in e?e.touches[0].clientY:e.clientY;D({x:n-W.current.x,y:t-W.current.y})},ne=()=>_(!1),te=a.isDark?"p-2 text-xs rounded text-gray-400 hover:bg-gray-700 hover:text-gray-200":"p-2 text-xs rounded text-gray-600 hover:bg-gray-200 hover:text-gray-700",re=g||f;/* @__PURE__ */
|
|
69
|
+
return e(t,{children:[
|
|
70
|
+
/* @__PURE__ */e("div",{ref:R,"data-markstream-infographic":"1","data-markstream-mode":g?"source":S?"preview":"pending",className:Wn("my-4 rounded-lg border overflow-hidden shadow-sm",a.isDark?"border-gray-700/30":"border-gray-200",{"is-rendering":a.loading}),children:[a.showHeader&&/* @__PURE__ */e("div",{className:Wn("flex justify-between items-center px-4 py-2.5 border-b",a.isDark?"bg-gray-800 border-gray-700/30":"bg-gray-50 border-gray-200"),children:[
|
|
71
|
+
/* @__PURE__ */e("div",{className:"flex items-center gap-x-2 overflow-hidden",children:[St,
|
|
72
|
+
/* @__PURE__ */n("span",{className:Wn("text-sm font-medium font-mono truncate",a.isDark?"text-gray-400":"text-gray-600"),children:"Infographic"})]}),a.showModeToggle&&/* @__PURE__ */e("div",{className:Wn("flex items-center gap-x-1 rounded-md p-0.5",a.isDark?"bg-gray-700":"bg-gray-100"),children:[
|
|
73
|
+
/* @__PURE__ */n("button",{className:Wn("px-2.5 py-1 text-xs rounded transition-colors",g?a.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700":a.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm"),onClick:()=>v(!1),onMouseEnter:e=>Ve(e.currentTarget,u("common.preview")||"Preview","top",!1,0,a.isDark),onMouseLeave:()=>Xe(),children:/* @__PURE__ */e("div",{className:"flex items-center gap-x-1",children:[
|
|
74
|
+
/* @__PURE__ */n("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
|
|
75
|
+
/* @__PURE__ */n("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"}),
|
|
76
|
+
/* @__PURE__ */n("circle",{cx:"12",cy:"12",r:"3"})]})}),
|
|
77
|
+
/* @__PURE__ */n("span",{children:u("common.preview")||"Preview"})]})}),
|
|
78
|
+
/* @__PURE__ */n("button",{className:Wn("px-2.5 py-1 text-xs rounded transition-colors",g?a.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm":a.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700"),onClick:()=>v(!0),onMouseEnter:e=>Ve(e.currentTarget,u("common.source")||"Source","top",!1,0,a.isDark),onMouseLeave:()=>Xe(),children:/* @__PURE__ */e("div",{className:"flex items-center gap-x-1",children:[
|
|
79
|
+
/* @__PURE__ */n("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m16 18l6-6l-6-6M8 6l-6 6l6 6"})}),
|
|
80
|
+
/* @__PURE__ */n("span",{children:u("common.source")||"Source"})]})})]}),
|
|
81
|
+
/* @__PURE__ */e("div",{className:"flex items-center gap-x-1",children:[a.showCollapseButton&&/* @__PURE__ */n("button",{className:te,onClick:()=>p(!f),onMouseEnter:e=>Ve(e.currentTarget,f?u("common.expand")||"Expand":u("common.collapse")||"Collapse","top",!1,0,a.isDark),onMouseLeave:()=>Xe(),children:/* @__PURE__ */n("svg",{style:{rotate:f?"0deg":"90deg"},xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 18l6-6l-6-6"})})}),a.showCopyButton&&/* @__PURE__ */n("button",{className:te,onClick:V,onMouseEnter:e=>Ve(e.currentTarget,m?u("common.copied")||"Copied":u("common.copy")||"Copy","top",!1,0,a.isDark),onMouseLeave:()=>Xe(),children:/* @__PURE__ */n("svg",m?{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M20 6L9 17l-5-5"})}:{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
|
|
82
|
+
/* @__PURE__ */n("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),
|
|
83
|
+
/* @__PURE__ */n("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]})})}),a.showExportButton&&/* @__PURE__ */n("button",{className:Wn(te,re&&"opacity-50 cursor-not-allowed"),disabled:re,onClick:Y,onMouseEnter:e=>Ve(e.currentTarget,u("common.export")||"Export","top",!1,0,a.isDark),onMouseLeave:()=>Xe(),children:/* @__PURE__ */n("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
|
|
84
|
+
/* @__PURE__ */n("path",{d:"M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),
|
|
85
|
+
/* @__PURE__ */n("path",{d:"m7 10l5 5l5-5"})]})})}),a.showFullscreenButton&&/* @__PURE__ */n("button",{className:Wn(te,re&&"opacity-50 cursor-not-allowed"),disabled:re,onClick:q,onMouseEnter:e=>Ve(e.currentTarget,w?u("common.minimize")||"Minimize":u("common.open")||"Open","top",!1,0,a.isDark),onMouseLeave:()=>Xe(),children:/* @__PURE__ */n("svg",w?{xmlns:"http://www.w3.org/2000/svg",width:"0.75rem",height:"0.75rem",viewBox:"0 0 24 24",children:/* @__PURE__ */n("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"})}:{xmlns:"http://www.w3.org/2000/svg",width:"0.75rem",height:"0.75rem",viewBox:"0 0 24 24",children:/* @__PURE__ */n("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"})})})]})]}),!f&&/* @__PURE__ */n("div",{children:g?/* @__PURE__ */n("div",{className:Wn("p-4",a.isDark?"bg-gray-900":"bg-gray-50"),children:/* @__PURE__ */n("pre",{className:Wn("text-sm font-mono whitespace-pre-wrap",a.isDark?"text-gray-300":"text-gray-700"),children:b})}):/* @__PURE__ */e("div",{className:"relative",children:[a.showZoomControls&&/* @__PURE__ */n("div",{className:"absolute top-2 right-2 z-10 rounded-lg",children:/* @__PURE__ */e("div",{className:"flex items-center gap-2 backdrop-blur rounded-lg",children:[
|
|
86
|
+
/* @__PURE__ */n("button",{className:Wn("p-2 text-xs rounded transition-colors",a.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>E(Math.min(L+.1,3)),children:"+"}),
|
|
87
|
+
/* @__PURE__ */n("button",{className:Wn("p-2 text-xs rounded transition-colors",a.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>E(Math.max(L-.1,.5)),children:"-"}),
|
|
88
|
+
/* @__PURE__ */e("button",{className:Wn("p-2 text-xs rounded transition-colors",a.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>{E(1),D({x:0,y:0})},children:[Math.round(100*L),"%"]})]})}),
|
|
89
|
+
/* @__PURE__ */n("div",{className:Wn("infographic-preview min-h-[360px] relative transition-all duration-100 overflow-hidden block",a.isDark?"bg-gray-900":"bg-gray-50"),style:{height:M,maxHeight:null!=(l=a.maxHeight)?l:void 0},onMouseDown:Q,onMouseMove:ee,onMouseUp:ne,onMouseLeave:ne,onTouchStart:Q,onTouchMove:ee,onTouchEnd:ne,children:/* @__PURE__ */n("div",{className:Wn("absolute inset-0 cursor-grab",P&&"cursor-grabbing"),style:{transform:`translate(${$.x}px, ${$.y}px) scale(${L})`},children:/* @__PURE__ */n("div",{ref:A,className:"w-full text-center flex items-center justify-center min-h-full"})})})]})})]}),w&&"undefined"!=typeof document&&ge(
|
|
90
|
+
/* @__PURE__ */n("div",{className:"markstream-react fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4",onClick:U,role:"dialog","aria-modal":"true",children:/* @__PURE__ */e("div",{className:Wn("dialog-panel relative w-full h-full max-w-full max-h-full rounded shadow-lg overflow-hidden",a.isDark?"bg-gray-900":"bg-white"),onClick:e=>e.stopPropagation(),children:[
|
|
91
|
+
/* @__PURE__ */e("div",{className:"absolute top-6 right-6 z-50 flex items-center gap-2",children:[
|
|
92
|
+
/* @__PURE__ */n("button",{className:Wn("p-2 text-xs rounded transition-colors",a.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>E(Math.min(L+.1,3)),children:"+"}),
|
|
93
|
+
/* @__PURE__ */n("button",{className:Wn("p-2 text-xs rounded transition-colors",a.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>E(Math.max(L-.1,.5)),children:"-"}),
|
|
94
|
+
/* @__PURE__ */e("button",{className:Wn("p-2 text-xs rounded transition-colors",a.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>{E(1),D({x:0,y:0})},children:[Math.round(100*L),"%"]}),
|
|
95
|
+
/* @__PURE__ */n("button",{className:Wn("inline-flex items-center justify-center p-2 rounded transition-colors",a.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:U,children:"X"})]}),
|
|
96
|
+
/* @__PURE__ */n("div",{ref:H,className:Wn("w-full h-full flex items-center justify-center p-4 overflow-hidden",!P&&"cursor-grab",P&&"cursor-grabbing"),onMouseDown:Q,onMouseMove:ee,onMouseUp:ne,onMouseLeave:ne,onTouchStart:Q,onTouchMove:ee,onTouchEnd:ne})]})}),document.body)]})}function Et(r){var o,l;const{node:a,children:d,ctx:u,indexKey:m,fade:h}=r,f=String(null!=(o=a.code)?o:""),p=null==(l=null!=h?h:null==u?void 0:u.fade)||l,g=null==m||""===m?"":String(m),[v,w]=i(f),[y,x]=i(""),[k,b]=i(0),C=Be(),N=s(void 0),M=s({settledContent:f,streamedDelta:""}),B=(e,n)=>{M.current={settledContent:e,streamedDelta:n},w(e),x(n)},S=()=>{const{settledContent:e,streamedDelta:n}=M.current;return e+n};return c(()=>{var e,n;const t=null!=(e=null==C?void 0:C.getStreamRenderVersion())?e:null==u?void 0:u.streamRenderVersion,r=t!==N.current;if(null!=d)return B("",""),void(N.current=t);const o=null!=(n=null==C?void 0:C.textStreamState)?n:null==u?void 0:u.textStreamState,i=M.current,l=g?null==o?void 0:o.get(g):void 0,a=ue({nextContent:f,persistedContent:l,currentState:i,typewriterEnabled:p,streamRenderVersionChanged:r});B(a.settledContent,a.streamedDelta),a.appended&&b(e=>e+1),g&&(null==o||o.set(g,f)),N.current=t},[d,f,C,null==u?void 0:u.textStreamState,null==u?void 0:u.streamRenderVersion,g,p]),c(()=>{if(p)return;const e=S();B(e,"")},[p]),/* @__PURE__ */n("code",{className:"inline-code inline text-[85%] px-1 py-0.5 rounded font-mono bg-[hsl(var(--secondary))] whitespace-normal break-words max-w-full",children:d||/* @__PURE__ */e(t,{children:[v?/* @__PURE__ */n("span",{children:v}):null,y?/* @__PURE__ */n("span",{className:Wn("text-node-stream-delta",k%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b"),onAnimationEnd:()=>{M.current.streamedDelta&&B(S(),"")},children:y}):null]})})}function $t(e){/* @__PURE__ */
|
|
97
|
+
return n("ins",{className:"insert-node",children:e.children})}function Dt(t){var r,o;const{node:l,children:a,ctx:d,indexKey:u,fade:m}=t,h=String(null!=(r=l.content)?r:""),f=null==(o=null!=m?m:null==d?void 0:d.fade)||o,p=null==u||""===u?"":String(u),[g,v]=i(h),[w,y]=i(""),[x,k]=i(0),b=Be(),C=s(void 0),N=s({settledContent:h,streamedDelta:""}),M=(e,n)=>{N.current={settledContent:e,streamedDelta:n},v(e),y(n)},B=()=>{const{settledContent:e,streamedDelta:n}=N.current;return e+n};return c(()=>{var e,n;const t=null!=(e=null==b?void 0:b.getStreamRenderVersion())?e:null==d?void 0:d.streamRenderVersion,r=t!==C.current;if(null!=a)return M("",""),void(C.current=t);const o=null!=(n=null==b?void 0:b.textStreamState)?n:null==d?void 0:d.textStreamState,i=N.current,l=p?null==o?void 0:o.get(p):void 0,s=ue({nextContent:h,persistedContent:l,currentState:i,typewriterEnabled:f,streamRenderVersionChanged:r});M(s.settledContent,s.streamedDelta),s.appended&&k(e=>e+1),p&&(null==o||o.set(p,h)),C.current=t},[a,h,b,null==d?void 0:d.textStreamState,null==d?void 0:d.streamRenderVersion,p,f]),c(()=>{if(f)return;const e=B();M(e,"")},[f]),null!=a?/* @__PURE__ */n("span",{className:Wn("text-node whitespace-pre-wrap break-words",l.center&&"text-node-center"),children:a}):/* @__PURE__ */e("span",{className:Wn("text-node whitespace-pre-wrap break-words",l.center&&"text-node-center"),children:[g?/* @__PURE__ */n("span",{children:g}):null,w?/* @__PURE__ */n("span",{className:Wn("text-node-stream-delta",x%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b"),onAnimationEnd:()=>{N.current.streamedDelta&&M(B(),"")},children:w}):null]})}function Pt(t){var r,i,l;const{node:a,ctx:s,renderNode:c,indexKey:u}=t,m=!1!==t.showTooltip,h=null!=(r=t.isDark)?r:null==s?void 0:s.isDark,f=o(()=>{var e,n,r,o,i,l;const a=void 0!==t.underlineBottom?"number"==typeof t.underlineBottom?`${t.underlineBottom}px`:String(t.underlineBottom):"-3px",s=null!=(e=t.animationOpacity)?e:.35,c=Math.max(.12,Math.min(.5*s,s));return{"--link-color":null!=(n=t.color)?n:"#0366d6","--underline-height":`${null!=(r=t.underlineHeight)?r:2}px`,"--underline-bottom":a,"--underline-opacity":String(s),"--underline-rest-opacity":String(c),"--underline-duration":`${null!=(o=t.animationDuration)?o:1.6}s`,"--underline-timing":null!=(i=t.animationTiming)?i:"ease-in-out","--underline-iteration":"number"==typeof t.animationIteration?String(t.animationIteration):null!=(l=t.animationIteration)?l:"infinite"}},[t.animationDuration,t.animationIteration,t.animationOpacity,t.animationTiming,t.color,t.underlineBottom,t.underlineHeight]),p=o(()=>{var e;return C({href:String(null!=(e=a.href)?e:"")}).href},[a.href]),g="string"==typeof a.title&&a.title.trim().length>0?a.title:String(null!=p?p:""),v=N(p),w=d(e=>{m&&Ve(e.currentTarget,String(a.title||p||a.text||""),"top",!1,(e.clientX,e.clientY),h)},[h,a.text,a.title,p,m]),y=d(()=>{m&&Xe()},[m]);return a.loading?/* @__PURE__ */n("span",{className:"link-loading inline-flex items-baseline gap-1.5","aria-hidden":"false",style:f,children:/* @__PURE__ */e("span",{className:"link-text-wrapper relative inline-flex",children:[
|
|
98
|
+
/* @__PURE__ */n("span",{className:"leading-[normal] link-text",children:/* @__PURE__ */n(Dt,{node:{type:"text",content:String(null!=(i=a.text)?i:"")},ctx:s,indexKey:`${String(null!=u?u:"link")}-loading`,typewriter:t.typewriter})}),
|
|
99
|
+
/* @__PURE__ */n("span",{className:"link-loading-indicator","aria-hidden":"true"})]})}):/* @__PURE__ */n("a",{className:"link-node",href:p||void 0,title:m?"":g,"aria-label":`Link: ${g}`,target:v?"_blank":void 0,rel:v?"noopener noreferrer":void 0,style:f,onMouseEnter:w,onMouseLeave:y,children:s&&c?D(a.children,s,String(null!=u?u:"link"),c):/* @__PURE__ */n(Dt,{node:{type:"text",content:String(null!=(l=a.text)?l:"")},ctx:s,indexKey:`${String(null!=u?u:"link")}-fallback`,typewriter:t.typewriter})})}function _t(e){const{node:t,ctx:r,renderNode:o,value:i,indexKey:l,children:a}=e;/* @__PURE__ */
|
|
100
|
+
return n("li",{className:"list-item pl-1.5 my-2",dir:"auto",value:null==i?void 0:i,children:null!=a?a:r&&o?D(t.children,r,String(null!=l?l:"list-item"),o):null})}function At(e){var t;const{node:r,ctx:o,renderNode:i,indexKey:l}=e,a=r.ordered?"ol":"ul",s=r.ordered&&r.start?r.start:void 0,c=o&&O(o.customId).list_item||_t;/* @__PURE__ */
|
|
101
|
+
return n(a,{className:Wn("list-node my-5 pl-[calc(13/8*1em)]",r.ordered?"list-decimal":"list-disc max-lg:my-[calc(4/3*1em)] max-lg:pl-[calc(14/9*1em)]"),start:s,children:null==(t=r.items)?void 0:t.map((e,t)=>{var a;/* @__PURE__ */
|
|
102
|
+
return n(c,{node:e,value:r.ordered?(null!=(a=r.start)?a:1)+t:void 0,ctx:o,renderNode:i,indexKey:`${String(null!=l?l:"list")}-${t}`,customId:null==o?void 0:o.customId,isDark:null==o?void 0:o.isDark,typewriter:null==o?void 0:o.typewriter},`${String(null!=l?l:"list")}-${t}`)})})}let Rt=null,It=null,Ht=!1;const Ft=/* @__PURE__ */new Map,Wt=/* @__PURE__ */new Map;let Ot=5;const jt=/* @__PURE__ */new Set;function zt(){if(Ft.size<Ot&&jt.size){const e=Array.from(jt);jt.clear();for(const n of e)try{n()}catch{}}}function Kt(e){Rt=e,It=null,Rt.onmessage=e=>{const{id:n,html:t,error:r}=e.data,o=Ft.get(n);if(o)if(Ft.delete(n),clearTimeout(o.timeoutId),zt(),r)o.reject(new Error(r));else{const{content:n,displayMode:r}=e.data;if(n){const e=`${r?"d":"i"}:${n}`;if(Wt.set(e,t),Wt.size>200){const e=Wt.keys().next().value;Wt.delete(e)}}o.resolve(t)}},Rt.onerror=e=>{console.error("[katexWorkerClient] Worker error:",e);for(const[n,t]of Ft.entries())clearTimeout(t.timeoutId),t.reject(new Error(`Worker error: ${e.message}`));Ft.clear(),zt()}}function Vt(){var e;Rt&&(null==(e=Rt.terminate)||e.call(Rt)),Rt=null,It=null}function Xt(e){Ht=!!e,Rt&&Rt.postMessage({type:"init",debug:Ht})}const Ut="WORKER_BUSY";async function qt(e,n=!0,t=2e3,r){performance.now();const o=Q(e);if(It)return Promise.reject(It);const i=`${n?"d":"i"}:${o}`,l=Wt.get(i);if(l)return Promise.resolve(l);const a=Rt||(It=new Error("[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker()."),It.name="WORKER_INIT_ERROR",It.code="WORKER_INIT_ERROR",null);if(!a)return Promise.reject(It);if(Ft.size>=Ot){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code=Ut,e.busy=!0,e.inFlight=Ft.size,e.max=Ot,Promise.reject(e)}return new Promise((e,i)=>{if(null==r?void 0:r.aborted){const e=new Error("Aborted");return e.name="AbortError",void i(e)}const l=Math.random().toString(36).slice(2),s=setTimeout(()=>{Ft.delete(l);const e=new Error("Worker render timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT",i(e),zt()},t),c=()=>{},d=()=>{Ft.delete(l),clearTimeout(s),jt.delete(c);const e=new Error("Aborted");e.name="AbortError",i(e),zt()};r&&r.addEventListener("abort",d,{once:!0}),Ft.set(l,{resolve:n=>{r&&r.removeEventListener("abort",d),e(n)},reject:e=>{r&&r.removeEventListener("abort",d),i(e)},timeoutId:s});try{a.postMessage({id:l,content:o,displayMode:n,debug:Ht})}catch(u){Ft.delete(l),clearTimeout(s),r&&r.removeEventListener("abort",d),i(u),zt()}})}function Yt(e,n,t){const r=`${n?"d":"i"}:${Q(e)}`;if(Wt.set(r,t),Wt.size>200){const e=Wt.keys().next().value;Wt.delete(e)}}function Zt(){Wt.clear()}function Gt(e){Ot=Math.max(1,Math.floor(e)),zt()}function Jt(e=1500,n){return Ft.size<Ot?Promise.resolve():new Promise((t,r)=>{if(null==n?void 0:n.aborted){const e=new Error("Aborted");return e.name="AbortError",void r(e)}let o=null;function i(){jt.delete(l),null!=o&&clearTimeout(o),n&&n.removeEventListener("abort",a)}function l(){i(),t()}function a(){i();const e=new Error("Aborted");e.name="AbortError",r(e)}o=e>0?setTimeout(()=>{i(),r(new Error("Timeout waiting for worker slot"))},e):null,n&&n.addEventListener("abort",a,{once:!0}),jt.add(l)})}const Qt={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};function er(e){null!=e.timeout&&(Qt.timeout=Math.max(0,Math.floor(e.timeout))),null!=e.waitTimeout&&(Qt.waitTimeout=Math.max(0,Math.floor(e.waitTimeout))),null!=e.backoffMs&&(Qt.backoffMs=Math.max(0,Math.floor(e.backoffMs))),null!=e.maxRetries&&(Qt.maxRetries=Math.max(0,Math.floor(e.maxRetries)))}function nr(){return{...Qt}}async function tr(e,n=!0,t={}){var r,o,i,l;const a=null!=(r=t.timeout)?r:Qt.timeout,s=null!=(o=t.waitTimeout)?o:Qt.waitTimeout,c=null!=(i=t.backoffMs)?i:Qt.backoffMs,d=null!=(l=t.maxRetries)?l:Qt.maxRetries,u=Number.isFinite(d)?Math.max(0,Math.min(Math.floor(d),8)):Qt.maxRetries,m=t.signal;let h=0;for(;;){if(null==m?void 0:m.aborted){const e=new Error("Aborted");throw e.name="AbortError",e}try{return await qt(e,n,a,m)}catch(f){if((null==f?void 0:f.code)!==Ut||h>=u)throw f;if(h++,await Jt(s,m).catch(()=>{}),null==m?void 0:m.aborted){const e=new Error("Aborted");throw e.name="AbortError",e}c>0&&await new Promise(e=>setTimeout(e,c*h))}}}let rr=null,or=!1;async function ir(){if(rr)return rr;if(or)return null;try{return rr=await import("katex"),await import("katex/contrib/mhchem"),rr}catch{return or=!0,null}}function lr({node:e}){const t=s(null),r=s(null),o=s(null),l=$e(),[a,d]=i(!0),[u,m]=i(()=>"undefined"==typeof window),h=s(0);return c(()=>{const e=t.current;if(!e)return;const n=l(e,{rootMargin:"400px"});return o.current=n,n.isVisible()&&m(!0),n.whenVisible.then(()=>m(!0)),()=>{n.destroy(),o.current=null}},[l]),c(()=>{var n;const t=Q(null!=(n=e.content)?n:"");if(!t)return r.current&&(r.current.innerHTML=""),void d(!1);if(!u)return void d(!0);let o=!1;const i=new AbortController,l=++h.current;return tr(t,!0,{timeout:3e3,waitTimeout:2e3,maxRetries:1,signal:i.signal}).then(e=>{o||l!==h.current||(r.current&&(r.current.innerHTML=e),d(!1))}).catch(async n=>{if(o||l!==h.current)return;if(!r.current)return;const i=(null==n?void 0:n.code)||(null==n?void 0:n.name);if("WORKER_INIT_ERROR"===i||(null==n?void 0:n.fallbackToRenderer)||i===Ut||"WORKER_TIMEOUT"===i){const n=await ir();if(n)try{const i=n.renderToString(t,{throwOnError:e.loading,displayMode:!0});return void(!o&&l===h.current&&r.current&&(r.current.innerHTML=i,d(!1),Yt(t,!0,i)))}catch{}}e.loading||(r.current.textContent=e.raw,d(!1))}),()=>{o=!0,i.abort()}},[e.content,e.loading,e.raw,u]),/* @__PURE__ */n("div",{ref:t,className:"math-block text-center overflow-x-auto relative min-h-[40px]",children:/* @__PURE__ */n("div",{ref:r,className:a?"math-rendering":void 0})})}function ar({node:t}){const r=s(null),o=s(null),l=s(null),a=$e(),[d,u]=i(!0),[m,h]=i(()=>"undefined"==typeof window),f=s(0);return c(()=>{const e=r.current;if(!e)return;const n=a(e,{rootMargin:"400px"});return l.current=n,n.isVisible()&&h(!0),n.whenVisible.then(()=>h(!0)),()=>{n.destroy(),l.current=null}},[a]),c(()=>{var e;const n=Q(null!=(e=t.content)?e:"");if(!n)return o.current&&(o.current.innerHTML=""),void u(!1);if(!m)return void u(!0);let r=!1;const i=new AbortController,l=++f.current,a="$$"===t.markup;return tr(n,a,{timeout:1500,waitTimeout:0,maxRetries:0,signal:i.signal}).then(e=>{r||l!==f.current||o.current&&(o.current.innerHTML=e,u(!1))}).catch(async e=>{if(r||l!==f.current)return;if(!o.current)return;const i=(null==e?void 0:e.code)||(null==e?void 0:e.name);if("WORKER_INIT_ERROR"===i||(null==e?void 0:e.fallbackToRenderer)||i===Ut||"WORKER_TIMEOUT"===i){const e=await ir();if(e)try{const i=e.renderToString(n,{throwOnError:t.loading,displayMode:a});return void(!r&&l===f.current&&o.current&&(o.current.innerHTML=i,u(!1),Yt(n,a,i)))}catch{}}t.loading||(o.current.textContent=t.raw,u(!1))}),()=>{r=!0,i.abort()}},[t.content,t.loading,t.raw,t.markup,m]),/* @__PURE__ */e("span",{ref:r,className:"math-inline-wrapper",children:[
|
|
103
|
+
/* @__PURE__ */n("span",{ref:o,className:"math-inline"+(d?" math-inline--hidden":"")}),d&&/* @__PURE__ */e("span",{className:"math-inline__loading",role:"status","aria-live":"polite",children:[
|
|
104
|
+
/* @__PURE__ */n("span",{className:"math-inline__spinner","aria-hidden":"true"}),
|
|
105
|
+
/* @__PURE__ */n("span",{className:"sr-only",children:"Loading"})]})]})}function sr(e){try{if("undefined"!=typeof globalThis&&"function"==typeof globalThis.requestAnimationFrame)return globalThis.requestAnimationFrame(e)}catch{}return globalThis.setTimeout(e,0)}let cr=null,dr=null;const ur=/* @__PURE__ */new Map;let mr=5,hr=!1;function fr(e){hr=!!e}function pr(e){Number.isFinite(e)&&e>0&&(mr=Math.floor(e))}function gr(){return{inFlight:ur.size,max:mr}}const vr="WORKER_BUSY";function wr(e){cr=e,dr=null;const n=e;cr.onmessage=e=>{if(cr!==n)return;const{id:t,ok:r,result:o,error:i}=e.data,l=ur.get(t);l&&(!1===r||i?l.reject(new Error(i||"Unknown error")):l.resolve(o))},cr.onerror=e=>{var t,r;if(cr===n)if(0!==ur.size){try{hr?console.error("[mermaidWorkerClient] Worker error:",(null==e?void 0:e.message)||e):null==(r=console.debug)||r.call(console,"[mermaidWorkerClient] Worker error:",(null==e?void 0:e.message)||e)}catch{}for(const[n,t]of ur.entries())t.reject(new Error(`Worker error: ${e.message}`));ur.clear()}else null==(t=console.debug)||t.call(console,"[mermaidWorkerClient] Worker error (no pending):",(null==e?void 0:e.message)||e)},cr.onmessageerror=e=>{var t,r;if(cr===n)if(0!==ur.size){try{hr?console.error("[mermaidWorkerClient] Worker messageerror:",e):null==(r=console.debug)||r.call(console,"[mermaidWorkerClient] Worker messageerror:",e)}catch{}for(const[e,n]of ur.entries())n.reject(new Error("Worker messageerror"));ur.clear()}else null==(t=console.debug)||t.call(console,"[mermaidWorkerClient] Worker messageerror (no pending):",e)}}function yr(){var e;if(cr)try{for(const[e,n]of ur.entries())n.reject(new Error("Worker cleared"));ur.clear(),null==(e=cr.terminate)||e.call(cr)}catch{}cr=null,dr=null}function xr(e,n,t=1400){if(dr)return Promise.reject(dr);const r=cr||(dr=new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker()."),dr.name="WORKER_INIT_ERROR",dr.code="WORKER_INIT_ERROR",null);if(!r)return Promise.reject(dr);if(ur.size>=mr){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code=vr,e.inFlight=ur.size,e.max=mr,Promise.reject(e)}return new Promise((o,i)=>{const l=Math.random().toString(36).slice(2);let a=!1,s=null;const c=()=>{a||(a=!0,null!=s&&clearTimeout(s),ur.delete(l))},d={resolve:e=>{c(),o(e)},reject:e=>{c(),i(e)}};ur.set(l,d);try{r.postMessage({id:l,action:e,payload:n})}catch(u){return ur.delete(l),void i(u)}s=setTimeout(()=>{const e=new Error("Worker call timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT";const n=ur.get(l);null==n||n.reject(e)},t)})}async function kr(e,n,t=1400){return xr("canParse",{code:e,theme:n},t)}async function br(e,n,t=2400){return xr("findPrefix",{code:e,theme:n},t)}function Cr(){var e;null==(e=null==cr?void 0:cr.terminate)||e.call(cr),cr=null,dr=null,ur.clear()}let Nr=null,Mr=!1,Br=null,Sr=null;function Tr(e,n){var t;if(!e||!n)return;const r=function(e){var n,t;return`${String(null!=(n=null==e?void 0:e.securityLevel)?n:"strict")}|htmlLabels:${!1===(null==(t=null==e?void 0:e.flowchart)?void 0:t.htmlLabels)?"0":"1"}`}(n);if(Br!==r)try{"function"==typeof e.initialize?e.initialize(n):(null==(t=e.mermaidAPI)?void 0:t.initialize)&&e.mermaidAPI.initialize(n),Br=r}catch{}}const Lr="undefined"!=typeof window?m:c,Er={USE_PROFILES:{svg:!0},FORBID_TAGS:["script"],FORBID_ATTR:[/^on/i],ADD_TAGS:["style"],ADD_ATTR:["style"],SAFE_FOR_TEMPLATES:!0};function $r(e){if(e)try{e.replaceChildren()}catch{e.innerHTML=""}}function Dr(e,n,t={}){if(!e)return"";const r=function(e,n){if(!e)return"";const t=M(n);return t?($r(e),e.appendChild(t),e.innerHTML):""}(e,n);return r||t.keepPreviousOnFailure||$r(e),r}function Pr(e,n,t){if(t&&(null==e?void 0:e.querySelector("svg")))try{null==n||n(e)}catch{}}const _r={maxHeight:"500px",loading:!0,workerTimeoutMs:1400,parseTimeoutMs:1800,renderTimeoutMs:2500,fullRenderTimeoutMs:4e3,renderDebounceMs:300,contentStableDelayMs:500,previewPollDelayMs:800,previewPollMaxDelayMs:4e3,previewPollMaxAttempts:12,showHeader:!0,showModeToggle:!0,showCopyButton:!0,showExportButton:!0,showFullscreenButton:!0,showCollapseButton:!0,showZoomControls:!0,enableWheelZoom:!1,isStrict:!0,enableMermaidInteractions:!1};function Ar(r){var l,a,u,h,f,p,g,v,w,y;const x={..._r,...r},{t:k}=Re(),b=o(()=>R("mermaid"),[]),C=null!=(a=null==(l=x.node)?void 0:l.code)?a:"",N=o(()=>C.replace(/\]::([^:])/g,"]:::$1").replace(/:::subgraphNode$/gm,"::subgraphNode"),[C]),M=null!=(u=x.workerTimeoutMs)?u:_r.workerTimeoutMs,B=null!=(h=x.parseTimeoutMs)?h:_r.parseTimeoutMs,S=null!=(f=x.renderTimeoutMs)?f:_r.renderTimeoutMs,T=null!=(p=x.fullRenderTimeoutMs)?p:_r.fullRenderTimeoutMs,L=Math.max(0,null!=(g=x.renderDebounceMs)?g:_r.renderDebounceMs),E=o(()=>x.maxHeight&&"none"!==x.maxHeight?ee(x.maxHeight):null,[x.maxHeight]),$=o(()=>{var e;return ne(null!=(e=ee(x.estimatedPreviewHeightPx))?e:te(N),void 0,E)},[N,E,x.estimatedPreviewHeightPx]),[D,P]=i(!1),[_,A]=i(!1),[I,H]=i(!1),[F,W]=i(!1),[O,j]=i(1),[z,K]=i({x:0,y:0}),[V,X]=i(!1),[U,q]=i(!1),[Y,Z]=i(!1),[G,J]=i(null),[Q,re]=i(!1),[oe,ie]=i(`${$}px`),[le,ae]=i("undefined"==typeof window),se=s(null),ce=s(null),de=s(null),ue=s(null),me=s(null),he=s(null),fe=s(null),pe=s({x:0,y:0}),ve=s(0),we=s({}),ye=s(null),xe=s(""),ke=s(!1),be=s(null),Ce=s(!1),Ne=s({zoom:1,translateX:0,translateY:0,containerHeight:oe||"360px"}),Me=$e(),Be=Boolean(null!=(w=null==(v=x.node)?void 0:v.loading)?w:x.loading),Se=x.isDark?"dark":"light",Te=Boolean(x.isStrict),Le=!0===x.enableMermaidInteractions,Ee=o(()=>Te?{startOnLoad:!1,securityLevel:"strict",suppressErrorRendering:!0,dompurifyConfig:Er,flowchart:{htmlLabels:!1}}:{startOnLoad:!1,securityLevel:"loose",suppressErrorRendering:!0},[Te]);c(()=>{Ce.current=Y},[Y]),c(()=>{_||I||ie(e=>{const n=ee(e);return null!=n&&n>=$?e:`${$}px`})},[$,I,_]),c(()=>{we.current={}},[Se,N,Te]),c(()=>{let e=!1;return(async()=>{const n=await async function(e){if(Nr)return Tr(Nr,e),Nr;if(Sr){const n=await Sr;return n&&Tr(n,e),n}if(Mr)return null;try{Mr=!0,Sr=(async()=>{try{const n=await import("mermaid"),t=(null==n?void 0:n.default)||n;if(Nr=(null==t?void 0:t.default)?t.default:(null==t?void 0:t.mermaidAPI)?t:(null==t?void 0:t.mermaid)?t.mermaid:t,!Nr)throw new Error("Mermaid module did not export expected API");return Tr(Nr,null!=e?e:{startOnLoad:!1,securityLevel:"strict",flowchart:{htmlLabels:!1}}),Nr}catch(n){return console.warn("[markstream-react] Failed to load mermaid:",n),null}finally{Sr=null}})();const n=await Sr;return n&&Tr(n,e),n}catch{return null}}(Ee);e||(se.current=n,P(Boolean(n)),ke.current||A(!n))})(),()=>{e=!0}},[Ee]),c(()=>{const e=ce.current;if(!e)return;const n=Me(e,{rootMargin:"400px"});return be.current=n,n.isVisible()&&ae(!0),n.whenVisible.then(()=>ae(!0)),()=>{n.destroy(),be.current=null}},[Me]),c(()=>{if("undefined"==typeof document)return;if(!Q)return;const e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}},[Q]);const De=d(()=>E,[E]),Pe=d(e=>{const n=ce.current,t=ue.current;if(!n||!t)return;const r=t.querySelector("svg");if(!r)return;let o=0,i=0;const l=r.getAttribute("viewBox");if(l){const e=l.split(" ");4===e.length&&(o=Number.parseFloat(e[2]),i=Number.parseFloat(e[3]))}if(o&&i||!r.hasAttribute("width")||!r.hasAttribute("height")||(o=Number.parseFloat(r.getAttribute("width")||"0"),i=Number.parseFloat(r.getAttribute("height")||"0")),!o||!i||Number.isNaN(o)||Number.isNaN(i))try{const e=r.getBBox();o=e.width,i=e.height}catch{return}if(!(o>0&&i>0))return;const a=(null!=e?e:n.clientWidth)*(i/o),s=Number.isFinite(a)&&a>0?a:i,c=De(),d=null==c?s:Math.min(s,c);ie(`${"none"===x.maxHeight?d:Math.max(d,$)}px`)},[$,x.maxHeight,De]);c(()=>{if(!ce.current||"undefined"==typeof ResizeObserver)return;if(_||I)return;const e=new ResizeObserver(e=>{if(!e.length)return;const n=e[0].contentRect.width;sr(()=>Pe(n))});return e.observe(ce.current),()=>e.disconnect()},[I,_,Pe]),c(()=>{_||I||Pe()},[I,x.maxHeight,_,Pe]),c(()=>()=>{Cr()},[]),m(()=>{var e;const n=we.current[Se];!_&&ue.current&&(null==n?void 0:n.svg)&&(Dr(ue.current,n.svg)&&(ye.current=null!=(e=n.bindFunctions)?e:null,Pr(ue.current,n.bindFunctions,Le)),sr(()=>Pe()))},[Le,_,Se,Pe]);const _e=d(async(e,n,t)=>{var r;if(!se.current||!ue.current)return!1;q(!0);try{const o=`mermaid-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,i=Hr(e,n),l=await jr(()=>se.current.render(o,i),{timeoutMs:T,signal:t});if(!(null==l?void 0:l.svg))return!1;const a=Dr(ue.current,l.svg);return!!a&&(ye.current=null!=(r=l.bindFunctions)?r:null,Pr(ue.current,l.bindFunctions,Le),Pe(),we.current[n]={svg:a,bindFunctions:l.bindFunctions},Z(!0),J(null),!0)}catch(o){if(!Be){if("function"==typeof x.onRenderError&&ue.current&&!0===x.onRenderError(o,N,ue.current))return!1;J(o instanceof Error?o.message:String(o))}return!1}finally{q(!1)}},[Le,T,Be,Pe]),Ae=d(async(e,n,t)=>{var r;if(se.current&&ue.current){q(!0);try{const o=`mermaid-preview-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,i=Hr(Or(e)||e,n),l=await jr(()=>se.current.render(o,i),{timeoutMs:S,signal:t});if(null==l?void 0:l.svg){const e=Dr(ue.current,l.svg,{keepPreviousOnFailure:!0});e&&(ye.current=null!=(r=l.bindFunctions)?r:null,Pr(ue.current,l.bindFunctions,Le)),e&&Pe()}}catch{}finally{q(!1)}}},[Le,S,Be,Pe]),Ie=d(async(e,n)=>{if(!e.trim())return $r(ue.current),Z(!1),void(xe.current="");const t=e.replace(/\s+/g,"");if(t===xe.current&&Ce.current)return;const r=++ve.current;if("gantt"===Fr(e)){const i=Or(e);if(!i.trim())return;try{if(await Ir(i,Se,{workerTimeout:M,parseTimeout:B,mermaid:se.current,signal:n}),(null==n?void 0:n.aborted)||ve.current!==r)return;i===e?await _e(e,Se,n)&&(xe.current=t):await Ae(i,Se,n)}catch(o){if("AbortError"===(null==o?void 0:o.name))return}return}try{if(await Ir(e,Se,{workerTimeout:M,parseTimeout:B,mermaid:se.current,signal:n}),(null==n?void 0:n.aborted)||ve.current!==r)return;return void(await _e(e,Se,n)&&(xe.current=t))}catch(o){if("AbortError"===(null==o?void 0:o.name))return}try{const t=await async function(e,n,t){try{const r=await br(e,n,t.workerTimeout);if(r)return r}catch(o){if("AbortError"===(null==o?void 0:o.name))throw o}return Or(e)}(e,Se,{workerTimeout:M,signal:n});if(!t||(null==n?void 0:n.aborted)||ve.current!==r)return;await Ae(t,Se,n)}catch{}},[B,_e,Ae,Se,M]),He=d(()=>le&&!_&&!I,[I,_,le]);c(()=>{if(!He())return;if(!se.current)return;const e=new AbortController,n=window.setTimeout(()=>{!e.signal.aborted&&He()&&Ie(N,e.signal)},L);return()=>{e.abort(),window.clearTimeout(n)}},[N,He,D,Ie,L]);const Fe=d((e,n)=>{e.clientX,e.clientY,Ve(e.currentTarget,n,"top",!1,0,x.isDark)},[x.isDark]),We=d(async()=>{var e,n;try{await(null==(e=navigator.clipboard)?void 0:e.writeText(N)),W(!0),null==(n=x.onCopy)||n.call(x,N),setTimeout(()=>W(!1),1e3)}catch{}},[N,x]),Oe=d(()=>{var e,n,t;const r=null!=(n=null==(e=ue.current)?void 0:e.querySelector("svg"))?n:null;if(!r)return;const o=zr(r),i={payload:{type:"export"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:r,svgString:o};null==(t=x.onExport)||t.call(x,i),i.defaultPrevented||function(e,n){const t=null!=n?n:zr(e),r=new Blob([t],{type:"image/svg+xml;charset=utf-8"}),o=URL.createObjectURL(r),i=document.createElement("a");i.href=o,i.download=`mermaid-${Date.now()}.svg`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(o)}(r,o)},[x]),je=d(()=>{fe.current=null,$r(he.current)},[]),ze=d(()=>{re(!1),je()},[je]),Ke=d(()=>{var e,n,t;const r=null!=(n=null==(e=ue.current)?void 0:e.querySelector("svg"))?n:null,o=r?zr(r):null,i={payload:{type:"open-modal"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:r,svgString:o};null==(t=x.onOpenModal)||t.call(x,i),i.defaultPrevented||re(!0)},[x]);c(()=>{if(!Q)return;if("undefined"==typeof window)return;const e=e=>{"Escape"===e.key&&ze()};try{window.addEventListener("keydown",e)}catch{}return()=>{try{window.removeEventListener("keydown",e)}catch{}}},[ze,Q]),Lr(()=>{var e,n;if(!Q)return;const t=he.current,r=ce.current;if(!t||!r)return;const o=`translate(${z.x}px, ${z.y}px) scale(${O})`,i=r.cloneNode(!0);i.classList.add("fullscreen"),i.style.height="100%",i.style.maxHeight="100%";const l=i.querySelector("[data-mermaid-wrapper]");l&&(fe.current=l,l.style.transform=o),$r(t),t.appendChild(i),Pr(t,null!=(n=ye.current)?n:null==(e=we.current[Se])?void 0:e.bindFunctions,Le)},[Le,Q,Se]),c(()=>{Q&&fe.current&&(fe.current.style.transform=`translate(${z.x}px, ${z.y}px) scale(${O})`)},[Q,z.x,z.y,O]);const Ue=_||U||I,qe=o(()=>x.isDark?"mermaid-action-btn p-2 text-xs rounded text-gray-400 hover:bg-gray-700 hover:text-gray-200":"mermaid-action-btn p-2 text-xs rounded text-gray-600 hover:bg-gray-200 hover:text-gray-700",[x.isDark]),Ye=d(e=>{var n;const t={payload:{type:"toggle-mode",target:e},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0}};if(null==(n=x.onToggleMode)||n.call(x,e,t),!t.defaultPrevented)if(ke.current=!0,"preview"===e){A(!1);const e=Ne.current;j(e.zoom),K({x:e.translateX,y:e.translateY}),ie(e.containerHeight)}else Ne.current={zoom:O,translateX:z.x,translateY:z.y,containerHeight:oe},A(!0)},[N,oe,Ie,x,Se,z.x,z.y,Pe,O]),Ze=d(e=>{if(!1===x.enableWheelZoom)return;if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault();const n=ce.current;if(!n)return;const t=n.getBoundingClientRect(),r=e.clientX-t.left-z.x,o=e.clientY-t.top-z.y,i=.01*-e.deltaY,l=Rr(O+i,.5,3);if(l===O)return;const a=l/O;K({x:z.x-r*(a-1),y:z.y-o*(a-1)}),j(l)},[z,O]),Ge=d((e,n)=>{X(!0),pe.current={x:e-z.x,y:n-z.y}},[z.x,z.y]),Je=d((e,n)=>{V&&K({x:e-pe.current.x,y:n-pe.current.y})},[V]),Qe=d(()=>{X(!1)},[]),en=/* @__PURE__ */e("div",{className:"relative",children:[x.showZoomControls&&/* @__PURE__ */n("div",{className:"absolute top-2 right-2 z-10 rounded-lg",children:/* @__PURE__ */e("div",{className:"flex items-center gap-2 backdrop-blur rounded-lg",children:[
|
|
106
|
+
/* @__PURE__ */n("button",{type:"button",className:Wn("p-2 text-xs rounded transition-colors",x.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onMouseEnter:e=>Fe(e,k("common.zoomIn")),onMouseLeave:()=>Xe(),onClick:()=>j(Rr(O+.1,.5,3)),children:"+"}),
|
|
107
|
+
/* @__PURE__ */n("button",{type:"button",className:Wn("p-2 text-xs rounded transition-colors",x.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onMouseEnter:e=>Fe(e,k("common.zoomOut")),onMouseLeave:()=>Xe(),onClick:()=>j(Rr(O-.1,.5,3)),children:"−"}),
|
|
108
|
+
/* @__PURE__ */e("button",{type:"button",className:Wn("p-2 text-xs rounded transition-colors",x.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onMouseEnter:e=>Fe(e,k("common.resetZoom")),onMouseLeave:()=>Xe(),onClick:()=>{j(1),K({x:0,y:0})},children:[Math.round(100*O),"%"]})]})}),
|
|
109
|
+
/* @__PURE__ */e("div",{ref:ce,className:Wn("min-h-[360px] relative overflow-hidden block transition-[height] duration-150 ease-out",x.isDark?"bg-gray-900":"bg-gray-50"),style:{height:oe,maxHeight:null!=(y=x.maxHeight)?y:void 0},onWheel:Ze,onMouseDown:e=>{0===e.button&&(e.preventDefault(),Ge(e.clientX,e.clientY))},onMouseMove:e=>Je(e.clientX,e.clientY),onMouseUp:Qe,onMouseLeave:Qe,onTouchStart:e=>{const n=e.touches[0];n&&Ge(n.clientX,n.clientY)},onTouchMove:e=>{const n=e.touches[0];n&&Je(n.clientX,n.clientY)},onTouchEnd:Qe,children:[
|
|
110
|
+
/* @__PURE__ */n("div",{ref:de,"data-mermaid-wrapper":!0,className:Wn("absolute inset-0 cursor-grab",{"cursor-grabbing":V}),style:{transform:`translate(${z.x}px, ${z.y}px) scale(${O})`},children:/* @__PURE__ */n("div",{ref:ue,className:"_mermaid w-full text-center flex items-center justify-center min-h-full"})}),(U||Be)&&/* @__PURE__ */e("div",{className:"mermaid-loading",children:[
|
|
111
|
+
/* @__PURE__ */n("span",{className:"mermaid-spinner"}),
|
|
112
|
+
/* @__PURE__ */n("span",{children:"Rendering diagram…"})]})]})]}),nn=x.showHeader&&/* @__PURE__ */e("div",{className:Wn("mermaid-block-header flex justify-between items-center px-4 py-2.5 border-b",x.isDark?"bg-gray-800 border-gray-700/30":"bg-gray-50 border-gray-200"),children:[
|
|
113
|
+
/* @__PURE__ */e("div",{className:"flex items-center space-x-2 overflow-hidden",children:[
|
|
114
|
+
/* @__PURE__ */n("span",{className:"icon-slot h-4 w-4 flex-shrink-0",dangerouslySetInnerHTML:{__html:b}}),
|
|
115
|
+
/* @__PURE__ */n("span",{className:Wn("text-sm font-medium font-mono truncate",x.isDark?"text-gray-400":"text-gray-600"),children:"Mermaid"})]}),x.showModeToggle&&D&&/* @__PURE__ */e("div",{className:Wn("flex items-center space-x-1 rounded-md p-0.5",x.isDark?"bg-gray-700":"bg-gray-100"),children:[
|
|
116
|
+
/* @__PURE__ */n("button",{type:"button",className:Wn("px-2.5 py-1 text-xs rounded transition-colors",_?x.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700":x.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm"),onClick:()=>Ye("preview"),onMouseEnter:e=>Fe(e,k("common.preview")),onFocus:e=>Fe(e,k("common.preview")),onMouseLeave:()=>Xe(),onBlur:()=>Xe(),children:/* @__PURE__ */e("div",{className:"flex items-center space-x-1",children:[
|
|
117
|
+
/* @__PURE__ */n("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
|
|
118
|
+
/* @__PURE__ */n("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"}),
|
|
119
|
+
/* @__PURE__ */n("circle",{cx:"12",cy:"12",r:"3"})]})}),
|
|
120
|
+
/* @__PURE__ */n("span",{children:k("common.preview")})]})}),
|
|
121
|
+
/* @__PURE__ */n("button",{type:"button",className:Wn("px-2.5 py-1 text-xs rounded transition-colors",_?x.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm":x.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700"),onClick:()=>Ye("source"),onMouseEnter:e=>Fe(e,k("common.source")),onFocus:e=>Fe(e,k("common.source")),onMouseLeave:()=>Xe(),onBlur:()=>Xe(),children:/* @__PURE__ */e("div",{className:"flex items-center space-x-1",children:[
|
|
122
|
+
/* @__PURE__ */n("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m16 18l6-6l-6-6M8 6l-6 6l6 6"})}),
|
|
123
|
+
/* @__PURE__ */n("span",{children:k("common.source")})]})})]}),
|
|
124
|
+
/* @__PURE__ */e("div",{className:"flex items-center space-x-1",children:[x.showCollapseButton&&/* @__PURE__ */n("button",{type:"button",className:qe,"aria-pressed":I,onClick:()=>H(e=>!e),onMouseEnter:e=>Fe(e,k(I?"common.expand":"common.collapse")),onFocus:e=>Fe(e,k(I?"common.expand":"common.collapse")),onMouseLeave:()=>Xe(),onBlur:()=>Xe(),children:/* @__PURE__ */n("svg",{style:{rotate:I?"0deg":"90deg"},xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 18l6-6l-6-6"})})}),x.showCopyButton&&/* @__PURE__ */n("button",{type:"button",className:qe,onClick:We,onMouseEnter:e=>Fe(e,k(F?"common.copied":"common.copy")),onFocus:e=>Fe(e,k(F?"common.copied":"common.copy")),onMouseLeave:()=>Xe(),onBlur:()=>Xe(),children:/* @__PURE__ */n("svg",F?{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M20 6L9 17l-5-5"})}:{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
|
|
125
|
+
/* @__PURE__ */n("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),
|
|
126
|
+
/* @__PURE__ */n("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]})})}),x.showExportButton&&D&&/* @__PURE__ */n("button",{type:"button",className:Wn(qe,Ue?"opacity-50 cursor-not-allowed":""),disabled:Ue,onClick:Oe,onMouseEnter:e=>Fe(e,k("common.export")),onFocus:e=>Fe(e,k("common.export")),onMouseLeave:()=>Xe(),onBlur:()=>Xe(),children:/* @__PURE__ */n("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
|
|
127
|
+
/* @__PURE__ */n("path",{d:"M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),
|
|
128
|
+
/* @__PURE__ */n("path",{d:"m7 10l5 5l5-5"})]})})}),x.showFullscreenButton&&D&&/* @__PURE__ */n("button",{type:"button",className:Wn(qe,Ue?"opacity-50 cursor-not-allowed":""),disabled:Ue,onClick:Q?ze:Ke,onMouseEnter:e=>Fe(e,k(Q?"common.minimize":"common.open")),onFocus:e=>Fe(e,k(Q?"common.minimize":"common.open")),onMouseLeave:()=>Xe(),onBlur:()=>Xe(),children:/* @__PURE__ */n("svg",Q?{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"})}:{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"})})})]})]}),tn=/* @__PURE__ */e("div",{children:[_?/* @__PURE__ */n("div",{className:Wn("p-4",x.isDark?"bg-gray-900 text-gray-300":"bg-gray-50 text-gray-700"),children:/* @__PURE__ */n("pre",{className:"text-sm font-mono whitespace-pre-wrap",children:N})}):en,G&&/* @__PURE__ */n("div",{className:"mermaid-error",children:G})]});/* @__PURE__ */
|
|
129
|
+
return e(t,{children:[
|
|
130
|
+
/* @__PURE__ */e("div",{"data-markstream-mermaid":"1","data-markstream-mode":_?"source":Y?"preview":"pending",className:Wn("my-4 rounded-lg border overflow-hidden shadow-sm mermaid-block",x.isDark?"border-gray-700/30":"border-gray-200",{"is-rendering":Be}),children:[nn,
|
|
131
|
+
/* @__PURE__ */n("div",{ref:me,style:{display:I?"none":""},children:tn})]}),Q&&"undefined"!=typeof document&&ge(
|
|
132
|
+
/* @__PURE__ */n("div",{className:"markstream-react mermaid-modal-overlay",onClick:()=>ze(),children:/* @__PURE__ */e("div",{className:Wn("mermaid-modal-panel",{"is-dark":x.isDark}),role:"dialog","aria-modal":"true",onClick:e=>e.stopPropagation(),children:[
|
|
133
|
+
/* @__PURE__ */e("div",{className:"mermaid-modal-header",children:[
|
|
134
|
+
/* @__PURE__ */n("span",{className:"mermaid-modal-title",children:`Mermaid ${k("common.preview")}`}),
|
|
135
|
+
/* @__PURE__ */n("button",{type:"button",className:"mermaid-modal-close",onClick:ze,children:k("common.close")})]}),
|
|
136
|
+
/* @__PURE__ */n("div",{className:"mermaid-modal-body",children:/* @__PURE__ */n("div",{ref:he,className:"mermaid-modal-content"})})]})}),document.body)]})}function Rr(e,n,t){return Math.min(Math.max(e,n),t)}async function Ir(e,n,t){try{if(await kr(e,n,t.workerTimeout))return!0}catch(l){if("AbortError"===(null==l?void 0:l.name))throw l}if(!t.mermaid)throw new Error("Mermaid not available");const r=Hr(e,n),o=t.mermaid;if("function"==typeof o.parse)return await jr(()=>o.parse(r),{timeoutMs:t.parseTimeout,signal:t.signal}),!0;const i=`mermaid-parse-${Math.random().toString(36).slice(2,9)}`;return await jr(()=>o.render(i,r),{timeoutMs:t.parseTimeout,signal:t.signal}),!0}function Hr(e,n){return e.trimStart().startsWith("%%{")?e:`%%{init: {"theme": "${"dark"===n?"dark":"default"}"}}%%\n${e}`}function Fr(e){var n;for(const t of e.split(/\r?\n/)){const e=t.trim();if(!e||e.startsWith("%%"))continue;const r=e.match(/^([A-Z][\w-]*)\b/i);return(null==(n=null==r?void 0:r[1])?void 0:n.toLowerCase())||""}return""}function Wr(e){const n=e.trim();return!(!n||n.startsWith("%%"))&&!/^(?:gantt|title|dateformat|axisformat|tickinterval|excludes|section|todaymarker|topaxis|weekday|weekend|acctitle|accdescr|accdescrmultiline)\b/i.test(n)&&n.includes(":")}function Or(e){if("gantt"===Fr(e))return function(e){var n;const t=e.split(/\r?\n/);for(!/\r?\n$/.test(e)&&t.length>0&&t.pop();t.length>0;){const e=null==(n=t[t.length-1])?void 0:n.trim();if(e&&!e.startsWith("%%")){if(Wr(e))break;t.pop()}else t.pop()}return t.some(Wr)?t.join("\n"):""}(e);const n=e.split("\n");for(;n.length>0;){const e=n[n.length-1].trimEnd();if(""!==e){if(!(/^[-=~>|<\s]+$/.test(e.trim())||/(?:--|==|~~|->|<-|-\||-\)|-x|o-|\|-|\.-)\s*$/.test(e)||/[-|><]$/.test(e)||/(?:graph|flowchart|sequenceDiagram|classDiagram|stateDiagram|erDiagram|gantt)\s*$/i.test(e)))break;n.pop()}else n.pop()}return n.join("\n")}async function jr(e,n={}){const{timeoutMs:t,signal:r}=n;return(null==r?void 0:r.aborted)?Promise.reject(new DOMException("Aborted","AbortError")):new Promise((n,o)=>{let i=!1,l=null;function a(){i||(i=!0,s(),o(new DOMException("Aborted","AbortError")))}function s(){null!=l&&clearTimeout(l),r&&r.removeEventListener("abort",a)}r&&r.addEventListener("abort",a,{once:!0}),t&&t>0&&(l=setTimeout(()=>{i||(i=!0,s(),o(new Error("Operation timed out")))},t)),e().then(e=>{i||(i=!0,s(),n(e))}).catch(e=>{i||(i=!0,s(),o(e))})})}function zr(e){return(new XMLSerializer).serializeToString(e)}function Kr(n){const{node:t}=n;/* @__PURE__ */
|
|
137
|
+
return e("div",{className:"unknown-node text-sm text-gray-500 italic",children:["Unsupported node type:"," ",String(null==t?void 0:t.type)]})}function Vr(e){var n;return"text"===(null==e?void 0:e.type)&&""===String(null!=(n=null==e?void 0:e.content)?n:"").trim()}function Xr(e,t,o,i){const l=e.filter(e=>!Vr(e)),a=l.length>0&&l.every(e=>"image"===e.type||function(e){var n;const t=function(e){return"link"===(null==e?void 0:e.type)&&Array.isArray(null==e?void 0:e.children)?e.children.filter(e=>!Vr(e)):[]}(e);return 1===t.length&&"image"===(null==(n=t[0])?void 0:n.type)}(e));if(!a||l.length<=1)return D(e,o,i,t);const s=[];for(let n=0;n<e.length;n++){const t=e[n];if(!Vr(t)){s.push(t);continue}const r=s.length>0,o=e.slice(n+1).some(e=>!Vr(e));r&&o&&s.push({...t,content:" ",raw:" "})}return s.map((e,l)=>{var s;return a&&Vr(e)?/* @__PURE__ */n(r.Fragment,{children:String(null!=(s=null==e?void 0:e.content)?s:"")},`${i}-${l}`):t(e,`${i}-${l}`,o)})}function Ur(e){var o,i,l,a;const{node:s,ctx:c,renderNode:d,indexKey:u,children:m}=e;if(!c||!d)/* @__PURE__ */
|
|
138
|
+
return n("p",{dir:"auto",className:"paragraph-node",children:m});const h=null!=(o=s.children)?o:[],f={...null!=(i=c.customComponents)?i:O(c.customId),...null!=(l=c.htmlComponents)?l:{},...null!=(a=c.streamingComponents)?a:{}},p=[],g=[],v=()=>{if(!g.length)return;const e=p.length;p.push(
|
|
139
|
+
/* @__PURE__ */n("p",{dir:"auto",className:"paragraph-node",children:Xr(g.slice(),d,c,`${String(null!=u?u:"paragraph")}-${e}`)},`${String(null!=u?u:"paragraph")}-inline-${e}`)),g.length=0};return h.forEach((e,t)=>{var o;const i="escape"!==(null!=(o=c.htmlPolicy)?o:"safe")||"html_inline"!==e.type&&"html_block"!==e.type;re.has(e.type)||i&&oe(e,f,c.customHtmlTags)?(v(),p.push(
|
|
140
|
+
/* @__PURE__ */n(r.Fragment,{children:d(e,`${String(null!=u?u:"paragraph")}-block-${t}`,c)},`${String(null!=u?u:"paragraph")}-block-${t}`))):g.push(e)}),v(),p.length?/* @__PURE__ */n(t,{children:p}):/* @__PURE__ */n("p",{dir:"auto",className:"paragraph-node",children:Xr(h,d,c,String(null!=u?u:"paragraph"))})}function qr(e){const{node:t}=e,r=d(n=>{var r;null==(r=e.onClick)||r.call(e,n,t.id,e.messageId,e.threadId)},[t.id,e]);/* @__PURE__ */
|
|
141
|
+
return n("span",{className:"reference-node cursor-pointer bg-[hsl(var(--muted))] text-xs rounded-md px-1.5 mx-0.5 hover:bg-[hsl(var(--secondary))]",role:"button",tabIndex:0,onClick:r,onMouseEnter:n=>{var r;null==(r=e.onMouseEnter)||r.call(e,n,t.id,e.messageId,e.threadId)},onMouseLeave:n=>{var r;null==(r=e.onMouseLeave)||r.call(e,n,t.id,e.messageId,e.threadId)},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||r(e)},children:t.id})}function Yr(e){/* @__PURE__ */
|
|
142
|
+
return n("s",{className:"strikethrough-node",children:e.children})}function Zr(e){/* @__PURE__ */
|
|
143
|
+
return n("strong",{className:"strong-node",children:e.children})}function Gr(e){/* @__PURE__ */
|
|
144
|
+
return n("sub",{className:"subscript-node",children:e.children})}function Jr(e){/* @__PURE__ */
|
|
145
|
+
return n("sup",{className:"superscript-node",children:e.children})}function Qr(t){var o;const{node:i,ctx:l,renderNode:a,indexKey:s}=t,c=Array.isArray(null==(o=null==i?void 0:i.header)?void 0:o.cells)?i.header.cells:[],d=Boolean(null==i?void 0:i.loading),u=Array.isArray(null==i?void 0:i.rows)?i.rows:[],m=r.useRef(null),h=r.useRef(null),f=r.useRef(null),[p,g]=r.useState([]),v=e=>"right"===e?"text-right":"center"===e?"text-center":"text-left",w=()=>{const e=f.current;e&&(window.removeEventListener("pointermove",e.move),window.removeEventListener("pointerup",e.stop),window.removeEventListener("pointercancel",e.stop),f.current=null),h.current=null};return r.useEffect(()=>(w(),g([]),w),[c.length]),/* @__PURE__ */e("div",{className:"table-node-wrapper","data-index-key":s,children:[
|
|
146
|
+
/* @__PURE__ */e("table",{ref:m,className:Wn("my-8 text-sm table-node",d&&"table-node--loading"),"aria-busy":d,children:[p.length>0&&/* @__PURE__ */n("colgroup",{children:c.map((e,t)=>/* @__PURE__ */n("col",{style:p[t]>0?{width:`${p[t]}px`}:void 0},`col-${t}`))}),
|
|
147
|
+
/* @__PURE__ */n("thead",{className:"border-[var(--table-border,#cbd5e1)]",children:/* @__PURE__ */n("tr",{className:"border-b",children:c.map((t,r)=>/* @__PURE__ */e("th",{className:Wn("font-semibold p-[calc(4/7*1em)]",v(t.align)),dir:"auto",children:[l&&a?H(t.children,l,`${String(null!=s?s:"table")}-th-${r}`,a):null,r<c.length-1&&/* @__PURE__ */n("button",{type:"button",className:"table-node__resize-handle","aria-label":`Resize columns ${r+1} and ${r+2}`,onPointerDown:e=>((e,n)=>{if(0!==n.button)return;const t=(()=>{var e;const n=null==(e=m.current)?void 0:e.querySelectorAll("thead th");return Array.from(null!=n?n:[],e=>Math.round(e.getBoundingClientRect().width))})(),r=t[e],o=t[e+1];if(!r||!o)return;n.preventDefault(),w(),h.current={index:e,startX:n.clientX,startWidth:r,nextStartWidth:o,widths:t},g(t);const i=e=>{const n=h.current;if(!n)return;e.preventDefault();const t=n.startWidth+n.nextStartWidth,r=Math.min(48,Math.floor(t/2)),o=Math.max(r,Math.min(t-r,Math.round(n.startWidth+e.clientX-n.startX))),i=[...n.widths];i[n.index]=o,i[n.index+1]=t-o,g(i)},l=()=>{w()};f.current={move:i,stop:l},window.addEventListener("pointermove",i),window.addEventListener("pointerup",l),window.addEventListener("pointercancel",l)})(r,e)})]},`header-${r}`))})}),
|
|
148
|
+
/* @__PURE__ */n("tbody",{children:u.map((e,t)=>{var r;/* @__PURE__ */
|
|
149
|
+
return n("tr",{className:Wn("border-[var(--table-border,#cbd5e1)]",t<u.length-1&&"border-b"),children:null==(r=e.cells)?void 0:r.map((e,r)=>/* @__PURE__ */n("td",{className:Wn("p-[calc(4/7*1em)]",v(e.align)),dir:"auto",children:l&&a?H(e.children,l,`${String(null!=s?s:"table")}-row-${t}-${r}`,a):null},`cell-${t}-${r}`))},`row-${t}`)})})]}),d&&/* @__PURE__ */e("div",{className:"table-node__loading",role:"status","aria-live":"polite",children:[
|
|
150
|
+
/* @__PURE__ */n("span",{className:"table-node__spinner","aria-hidden":"true"}),
|
|
151
|
+
/* @__PURE__ */n("span",{className:"sr-only",children:"Loading"})]})]})}function eo(){/* @__PURE__ */
|
|
152
|
+
return n("hr",{className:"hr-node thematic-break"})}function no(e){const{node:t,ctx:i,renderNode:l,indexKey:a}=e,s=`vmr-container vmr-container-${t.name}`,c=o(()=>{if(t.attrs)return Array.isArray(t.attrs)?j(t.attrs):t.attrs},[t.attrs]);/* @__PURE__ */
|
|
153
|
+
return n("div",{className:s,...c,children:i&&l&&Array.isArray(t.children)?t.children.map((e,t)=>/* @__PURE__ */n(r.Fragment,{children:l(e,`${String(null!=a?a:"vmr-container")}-${t}`,i)},`${String(null!=a?a:"vmr-container")}-${t}`)):null})}function to(e,n,t,o,i={}){var l,a,s,c,d,u;const m=le(o.codeBlockProps),h=o.events.onHandleArtifactClick?e=>{var r,i;const l="image/svg+xml"===e.type?"image/svg+xml":"text/html";null==(i=(r=o.events).onHandleArtifactClick)||i.call(r,{node:null==e.content?n:{...n,code:e.content},artifactType:l,artifactTitle:e.title||("image/svg+xml"===l?"SVG Preview":"HTML Preview"),id:String(t)})}:void 0;return r.createElement(e,{key:t,node:n,loading:Boolean(n.loading),stream:o.codeBlockStream,customId:o.customId,isDark:o.isDark,darkTheme:null==(l=o.codeBlockThemes)?void 0:l.darkTheme,lightTheme:null==(a=o.codeBlockThemes)?void 0:a.lightTheme,themes:null==(s=o.codeBlockThemes)?void 0:s.themes,langs:null==(c=o.codeBlockThemes)?void 0:c.langs,minWidth:null==(d=o.codeBlockThemes)?void 0:d.minWidth,maxWidth:null==(u=o.codeBlockThemes)?void 0:u.maxWidth,onCopy:o.events.onCopy,onPreviewCode:h,...m,...i,ctx:o,renderNode:oo,indexKey:t,typewriter:o.typewriter,fade:o.fade})}function ro(e,n,t,o,i={}){return r.createElement(e,{key:t,node:n,isDark:o.isDark,...i})}function oo(e,t,o){var i,l,a,s,c,d,u,m,v,w,y;const x=null!=(i=o.customComponents)?i:O(o.customId),k=null!=(l=o.streamingComponents)?l:{},b=null!=(a=o.htmlComponents)?a:{},C=function(e){if("html_block"===e.type||"html_inline"===e.type)return"";const n=f(e.type),t=f(e.tag);return n&&t&&n===t?n:""}(e),N=C?k[C]:null,M=C&&!N?b[C]:null,L="code_block"===e.type?null:x[e.type];if(N)return r.createElement(N,{key:t,node:e,customId:o.customId,isDark:o.isDark,ctx:o,renderNode:oo,indexKey:t,typewriter:o.typewriter,fade:o.fade});if(M)return function(e,n,t,o,i){var l,a,s;const c=h(null!=(l=n.attrs)?l:void 0,null!=(a=o.htmlPolicy)?a:"safe",i),d=p(g(c)),u=Array.isArray(n.children)?D(n.children,o,`${String(t)}-html`,oo):null!=(s=n.content)?s:null;return r.createElement(e,{...d,key:t},u)}(M,e,t,o,C);if(L)return r.createElement(L,{key:t,node:e,customId:o.customId,isDark:o.isDark,ctx:o,renderNode:oo,indexKey:t,typewriter:o.typewriter,fade:o.fade});if("html_block"===e.type||"html_inline"===e.type){const i={...x,...k},l=ie(e,i,o.customHtmlTags),a=String(null!=(s=e.tag)?s:"").trim().toLowerCase()||B(e.content),h=null!=(c=null==l?void 0:l.tag)?c:a;if(h){const i=null!=(d=null==l?void 0:l.component)?d:x[h],a=null!=(m=null==l?void 0:l.isWhitelisted)?m:(null!=(u=o.customHtmlTags)?u:[]).some(e=>e.toLowerCase()===h);if(a&&i){const n={...e,type:h,tag:h,content:S(e.content,h)};return r.createElement(i,{key:t,node:n,customId:o.customId,isDark:o.isDark,ctx:o,renderNode:oo,indexKey:t,typewriter:o.typewriter,fade:o.fade})}const s=String(null!=(w=null!=(v=e.content)?v:e.raw)?w:"");if(!a&&T(s,h))return"html_inline"===e.type?/* @__PURE__ */n(Dt,{node:{type:"text",content:s,raw:s},ctx:o,indexKey:t,typewriter:o.typewriter,fade:o.fade},t):/* @__PURE__ */n(Ur,{node:{type:"paragraph",children:[{type:"text",content:s,raw:s}],raw:s},ctx:o,renderNode:oo,indexKey:t,typewriter:o.typewriter,fade:o.fade},t)}}switch(e.type){case"text":/* @__PURE__ */
|
|
154
|
+
return n(Dt,{node:e,ctx:o,indexKey:t,typewriter:o.typewriter,fade:o.fade},t);case"text_special":/* @__PURE__ */
|
|
155
|
+
return n(Dt,{node:{type:"text",content:null!=(y=e.content)?y:"",center:e.center},ctx:o,indexKey:t,typewriter:o.typewriter,fade:o.fade},t);case"paragraph":/* @__PURE__ */
|
|
156
|
+
return n(Ur,{node:e,ctx:o,renderNode:oo,indexKey:t,typewriter:o.typewriter,fade:o.fade},t);case"heading":/* @__PURE__ */
|
|
157
|
+
return n(st,{node:e,ctx:o,renderNode:oo,indexKey:t,typewriter:o.typewriter,fade:o.fade},t);case"blockquote":/* @__PURE__ */
|
|
158
|
+
return n(ho,{node:e,ctx:o,renderNode:oo,indexKey:t,typewriter:o.typewriter,fade:o.fade},t);case"list":/* @__PURE__ */
|
|
159
|
+
return n(At,{node:e,ctx:o,renderNode:oo,indexKey:t,typewriter:o.typewriter,fade:o.fade},t);case"list_item":/* @__PURE__ */
|
|
160
|
+
return n(_t,{node:e,ctx:o,renderNode:oo,indexKey:t,typewriter:o.typewriter,fade:o.fade},t);case"table":/* @__PURE__ */
|
|
161
|
+
return n(Qr,{node:e,ctx:o,renderNode:oo,indexKey:t,typewriter:o.typewriter,fade:o.fade},t);case"definition_list":/* @__PURE__ */
|
|
162
|
+
return n(nt,{node:e,ctx:o,renderNode:oo,indexKey:t,typewriter:o.typewriter,fade:o.fade},t);case"footnote":/* @__PURE__ */
|
|
163
|
+
return n(it,{node:e,ctx:o,renderNode:oo,indexKey:t,typewriter:o.typewriter,fade:o.fade},t);case"footnote_reference":/* @__PURE__ */
|
|
164
|
+
return n(lt,{node:e},t);case"footnote_anchor":/* @__PURE__ */
|
|
165
|
+
return n(ot,{node:e},t);case"admonition":/* @__PURE__ */
|
|
166
|
+
return n(Ce,{node:e,ctx:o,renderNode:oo,indexKey:t,isDark:o.isDark,typewriter:o.typewriter,fade:o.fade},t);case"hardbreak":/* @__PURE__ */
|
|
167
|
+
return n(at,{node:e,typewriter:o.typewriter,fade:o.fade},t);case"link":/* @__PURE__ */
|
|
168
|
+
return n(Pt,{node:e,ctx:o,renderNode:oo,indexKey:t,isDark:o.isDark,showTooltip:"boolean"==typeof o.showTooltips?o.showTooltips:void 0,typewriter:o.typewriter,fade:o.fade},t);case"image":/* @__PURE__ */
|
|
169
|
+
return n(Nt,{node:e},t);case"inline_code":/* @__PURE__ */
|
|
170
|
+
return n(Et,{node:e,ctx:o,indexKey:t,typewriter:o.typewriter,fade:o.fade},t);case"code_block":return function(e,t,r,o){var i,l,a,s;const c=function(e){const n=String((null==e?void 0:e.language)||"").trim();if(!n)return"";const[t]=n.split(/\s+/),[r]=t.split(":");return r.toLowerCase()}(e),d=P(c),u=function(e,n){const t=n.trim().toLowerCase();if(!t)return null;for(const r of[t,P(t),me(t)]){const n=r&&e[r];if(n)return n}return null}(o,c);if("mermaid"===d){const i=function(e,n){var t,r;const o={...n.mermaidProps||{}};return null==ee(o.estimatedPreviewHeightPx)&&(o.estimatedPreviewHeightPx=ne(te(String(null!=(t=null==e?void 0:e.code)?t:"")),void 0,"none"===o.maxHeight?null:null!=(r=ee(o.maxHeight))?r:void 0)),o}(e,r),l=u||o.mermaid;if(l)return ro(l,e,t,r,i);if(!r.renderCodeBlocksAsPre)/* @__PURE__ */
|
|
171
|
+
return n(Ar,{node:e,isDark:r.isDark,loading:Boolean(e.loading),...i},t)}if("infographic"===d){const i=function(e,n){var t,r;const o={...n.infographicProps||{}};return null==Z(o.estimatedPreviewHeightPx)&&(o.estimatedPreviewHeightPx=G(J(String(null!=(t=null==e?void 0:e.code)?t:"")),void 0,"none"===o.maxHeight?null:null!=(r=Z(o.maxHeight))?r:void 0)),o}(e,r),l=u||o.infographic;return l?ro(l,e,t,r,i):/* @__PURE__ */n(Lt,{node:e,isDark:r.isDark,loading:Boolean(e.loading),...i},t)}if("d2"===d||"d2lang"===d){const i=u||o.d2;return i?ro(i,e,t,r,r.d2Props||{}):/* @__PURE__ */n(et,{node:e,isDark:r.isDark,loading:Boolean(e.loading),...r.d2Props||{}},t)}if(u)return to(u,e,t,r);const m=o.code_block;return m?to(m,e,t,r):r.renderCodeBlocksAsPre||"mermaid"===d?/* @__PURE__ */n(En,{node:e},t):/* @__PURE__ */n(Hn,{node:e,loading:Boolean(e.loading),stream:r.codeBlockStream,monacoOptions:null==(i=r.codeBlockThemes)?void 0:i.monacoOptions,themes:null==(l=r.codeBlockThemes)?void 0:l.themes,minWidth:null==(a=r.codeBlockThemes)?void 0:a.minWidth,maxWidth:null==(s=r.codeBlockThemes)?void 0:s.maxWidth,isDark:r.isDark,onCopy:r.events.onCopy,...le(r.codeBlockProps,{omit:["langs"]})},t)}(e,t,o,x);case"strong":/* @__PURE__ */
|
|
172
|
+
return n(Zr,{node:e,children:D(e.children,o,`${String(t)}-strong`,oo)},t);case"emphasis":/* @__PURE__ */
|
|
173
|
+
return n(rt,{node:e,children:D(e.children,o,`${String(t)}-em`,oo)},t);case"strikethrough":/* @__PURE__ */
|
|
174
|
+
return n(Yr,{node:e,children:D(e.children,o,`${String(t)}-strike`,oo)},t);case"highlight":/* @__PURE__ */
|
|
175
|
+
return n(ct,{node:e,children:D(e.children,o,`${String(t)}-highlight`,oo)},t);case"insert":/* @__PURE__ */
|
|
176
|
+
return n($t,{node:e,children:D(e.children,o,`${String(t)}-insert`,oo)},t);case"subscript":/* @__PURE__ */
|
|
177
|
+
return n(Gr,{node:e,children:D(e.children,o,`${String(t)}-sub`,oo)},t);case"superscript":/* @__PURE__ */
|
|
178
|
+
return n(Jr,{node:e,children:D(e.children,o,`${String(t)}-sup`,oo)},t);case"checkbox":case"checkbox_input":/* @__PURE__ */
|
|
179
|
+
return n(Pe,{node:e,typewriter:o.typewriter,fade:o.fade},t);case"emoji":/* @__PURE__ */
|
|
180
|
+
return n(tt,{node:e,typewriter:o.typewriter,fade:o.fade},t);case"thematic_break":/* @__PURE__ */
|
|
181
|
+
return n(eo,{},t);case"math_inline":/* @__PURE__ */
|
|
182
|
+
return n(ar,{node:e},t);case"math_block":/* @__PURE__ */
|
|
183
|
+
return n(lr,{node:e},t);case"reference":/* @__PURE__ */
|
|
184
|
+
return n(qr,{node:e,ctx:o,typewriter:o.typewriter,fade:o.fade},t);case"html_block":case"html_inline":return"html_block"===e.type?/* @__PURE__ */n(dt,{node:e,ctx:o,renderNode:oo,indexKey:t,typewriter:o.typewriter,fade:o.fade,customId:o.customId},t):/* @__PURE__ */n(kt,{node:e,ctx:o,renderNode:oo,indexKey:t,typewriter:o.typewriter,fade:o.fade,customId:o.customId},t);case"vmr_container":/* @__PURE__ */
|
|
185
|
+
return n(no,{node:e,ctx:o,renderNode:oo,indexKey:t,typewriter:o.typewriter,fade:o.fade},t);case"label_open":case"label_close":return null;default:/* @__PURE__ */
|
|
186
|
+
return n(Kr,{node:e},t)}}const io={codeBlockStream:!0,typewriter:!1,fade:!0,smoothStreaming:"auto",batchRendering:!0,initialRenderBatchSize:40,renderBatchSize:80,renderBatchDelay:16,renderBatchBudgetMs:6,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:320,liveNodeBuffer:60},lo=E();function ao(e,n){return e.type===n.type&&e.raw===n.raw&&e.loading===n.loading&&e.autoClosed===n.autoClosed&&!!function(e,n){if(e===n)return!0;if(!e||!n||"object"!=typeof e||"object"!=typeof n)return!1;const t=e,r=n;return t.startLine===r.startLine&&t.endLine===r.endLine}(e.sourceMap,n.sourceMap)&&("code_block"!==e.type&&"code_block"!==n.type||e.diff===n.diff)}function so(e){const n=o(()=>se(e),[e]),t=s(n);return function(e,n){const t=Object.keys(e),r=Object.keys(n);return t.length===r.length&&t.every(t=>e[t]===n[t])}(t.current,n)||(t.current=n),t.current}const co=r.memo(({node:e,nodeKey:n,renderCtx:t})=>oo(e,n,t),(e,n)=>e.node===n.node&&e.renderCtx===n.renderCtx&&e.nodeKey===n.nodeKey),uo=r.memo(({props:t,parsedNodes:r,renderCtx:l,indexPrefix:a,containerRef:u,showTypewriterCursor:m,typewriterCursorRef:h})=>{var f,p,g,v,w,y,x;const k=$e(),b="undefined"!=typeof window,C="undefined"!=typeof window&&"function"==typeof window.requestIdleCallback,N=Math.max(0,Math.trunc(null!=(f=t.renderBatchSize)?f:80)),M=Math.max(0,Math.trunc(null!=(p=t.initialRenderBatchSize)?p:N||r.length)),B=!1!==t.batchRendering&&N>0&&b,S=Math.max(0,null!=(g=t.liveNodeBuffer)?g:60),T=Math.max(1,null!=(v=t.maxLiveNodes)?v:320),L=(null!=(w=t.maxLiveNodes)?w:0)>0&&r.length>T,E=!1!==t.viewportPriority,$=B&&(null!=(y=t.maxLiveNodes)?y:0)<=0,D=o(()=>{var e;return!1!==t.deferNodesUntilVisible&&!((null!=(e=t.maxLiveNodes)?e:0)<=0)&&!L&&!(r.length>900)&&E},[r.length,t.deferNodesUntilVisible,t.maxLiveNodes,E,L]),[P,_]=i(()=>$?Math.min(r.length,M):r.length),A=s(P);c(()=>{A.current=P},[P]);const R=$?P:r.length,[I,H]=i(0),[F,W]=i({start:0,end:r.length}),O=s(/* @__PURE__ */new Map),[j,z]=i(0),K=s({}),V=s(/* @__PURE__ */new Map),X=s(/* @__PURE__ */new Map),U=s(/* @__PURE__ */new Map),q=s(/* @__PURE__ */new Map),Y=s(/* @__PURE__ */new Set),Z=s(P),G=s(null),J=s(null),Q=s(null),ee=s(!1),ne=s(null),te=s(Math.max(1,N||1)),re=s(r.length),oe=s({key:t.indexKey,total:r.length}),ie=s({batchSize:N,initial:M,delay:null!=(x=t.renderBatchDelay)?x:16,enabled:$}),le=D||L,ae=o(()=>{const e=O.current;if(!e.size)return 32;let n=0;for(const t of e.values())n+=t;return Math.max(16,n/e.size)},[j]),se=o(()=>{if(!L)return r.map((e,n)=>({node:e,index:n}));const e=r.length,n=Math.max(0,Math.min(F.start,e)),t=Math.max(n,Math.min(F.end,e));return r.slice(n,t).map((e,t)=>({node:e,index:n+t}))},[r,F,L]),ce=o(()=>{if(!L)return r.length;const e=Math.max(F.end+S,M),n=Math.min(r.length,e);return Math.max(P,n)},[r.length,L,F.end,S,M,P]);re.current=ce;const de=d((e,n)=>{var t;if(e>=n)return 0;const r=O.current;let o=0;for(let i=e;i<n;i++)o+=null!=(t=r.get(i))?t:ae;return o},[ae]),ue=L?de(0,Math.min(F.start,r.length)):0,me=L?de(Math.min(F.end,r.length),r.length):0,he=d(()=>{null!=G.current&&"function"==typeof cancelAnimationFrame&&(cancelAnimationFrame(G.current),G.current=null),null!=J.current&&(window.clearTimeout(J.current),J.current=null),null!=Q.current&&"function"==typeof window.cancelIdleCallback&&(window.cancelIdleCallback(Q.current),Q.current=null),ee.current=!1,ne.current=null},[]),fe=d(e=>{var n;if(!$)return;const r=Math.max(2,null!=(n=t.renderBatchBudgetMs)?n:6),o=Math.max(1,N||1),i=Math.max(1,Math.floor(o/4));e>1.2*r?te.current=Math.max(i,Math.floor(.7*te.current)):e<.5*r&&te.current<o&&(te.current=Math.min(o,Math.ceil(1.2*te.current)))},[$,t.renderBatchBudgetMs,N]),pe=d((e,n={})=>{var r,o;if(!$)return;const i=re.current;if(A.current>=i)return;const l=Math.max(1,e),a=e=>{const n="undefined"!=typeof performance?performance.now():Date.now();_(n=>{const t=Math.min(re.current,n+Math.max(1,e));return A.current=t,t});const t="undefined"!=typeof performance?performance.now():Date.now();fe(t-n)},s=()=>{const e=Math.max(1,Math.round(te.current));pe(e)},c=e=>{var n;G.current=null,J.current=null,Q.current=null,ee.current=!1;const r=ne.current;if(ne.current=null,a(null!=r?r:l),A.current>=re.current)return;if(!e)return void s();const o=Math.max(2,null!=(n=t.renderBatchBudgetMs)?n:6);for(;A.current<re.current&&!(("function"==typeof e.timeRemaining?e.timeRemaining():0)<=.5*o);)a(Math.max(1,Math.round(te.current)));A.current<re.current&&s()};if(!b||n.immediate)return void c();const d=Math.max(0,null!=(r=t.renderBatchDelay)?r:16);if(ne.current=null!=ne.current?Math.max(ne.current,l):l,!ee.current){if(ee.current=!0,C){const e=Math.max(0,null!=(o=t.renderBatchIdleTimeoutMs)?o:120);return void(Q.current=window.requestIdleCallback(e=>c(e),{timeout:e}))}"function"==typeof requestAnimationFrame?G.current=requestAnimationFrame(()=>{0!==d?J.current=window.setTimeout(()=>c(),d):c()}):J.current=window.setTimeout(()=>c(),d)}},[fe,C,$,b,t.renderBatchDelay,t.renderBatchBudgetMs,t.renderBatchIdleTimeoutMs]);c(()=>{var e;const n=t.indexKey,o=r.length,i=oe.current,l=void 0!==n?n!==i.key:o!==i.total;oe.current={key:n,total:o};const a=ie.current,s=null!=(e=t.renderBatchDelay)?e:16,c=a.batchSize!==N||a.initial!==M||a.delay!==s||a.enabled!==$;if(ie.current={batchSize:N,initial:M,delay:s,enabled:$},(l||c||!$)&&he(),(l||c)&&(te.current=Math.max(1,N||1),Y.current.clear()),!o)return A.current=0,void _(0);const d=re.current;if(!$)return A.current=d,void _(d);if(l||c){const e=Math.min(d,M);return A.current=e,_(e),void(e<d&&pe(Math.max(1,M),{immediate:!b}))}const u=Math.min(A.current,d);u!==A.current&&(A.current=u,_(u)),A.current<d&&pe(Math.max(1,N||1))},[he,$,b,r.length,t.indexKey,t.renderBatchDelay,N,M,pe]),c(()=>{if(!L)return void W({start:0,end:r.length});const e=r.length;if(!e)return void W({start:0,end:0});const n=Math.max(0,Math.min(I,e-1));let t=Math.max(0,n-S),o=Math.min(e,n+S+1);const i=o-t;if(i>T){const e=i-T;t+=Math.ceil(e/2),o-=Math.floor(e/2)}else if(i<T){const n=T-i;t=Math.max(0,t-Math.ceil(n/2)),o=Math.min(e,o+Math.floor(n/2))}W({start:t,end:o})},[I,S,T,r.length,L]),c(()=>()=>{he();for(const e of V.current.values())e.destroy();V.current.clear()},[he]);const ge=d(e=>{for(const[n,t]of V.current.entries())n>=e&&(t.destroy(),V.current.delete(n),delete K.current[n],X.current.delete(n),U.current.delete(n),q.current.delete(n))},[]);c(()=>{ge(R)},[ge,R]),c(()=>{const e=r.length;let n=!1;for(const t of Array.from(O.current.keys()))t>=e&&(O.current.delete(t),n=!0);n&&z(e=>e+1);for(const t of Object.keys(K.current))Number(t)>=e&&delete K.current[t];for(const t of Array.from(Y.current))t>=e&&Y.current.delete(t)},[r.length]);const ve=d((e,n)=>{D&&n&&(K.current[e]=!0),n&&L&&H(n=>e>n?e:n)},[D,L]),we=d(e=>{const n=V.current.get(e);n&&(n.destroy(),V.current.delete(e))},[]),ye=d((e,n)=>{const t=X.current;if(n?t.set(e,n):t.delete(e),!le||!n)return we(e),D&&!n&&delete K.current[e],void(n&&ve(e,!0));if(e<M&&!L)return we(e),void ve(e,!0);we(e);const r=k(n,{rootMargin:"400px"});V.current.set(e,r),r.isVisible()&&ve(e,!0),r.whenVisible.then(()=>ve(e,!0)).catch(()=>{})},[D,we,ve,k,M,le,L]),xe=d(e=>{const n=U.current.get(e);if(n)return n;const t=n=>ye(e,n);return U.current.set(e,t),t},[ye]),ke=d((e,n)=>{if(!n)return void(O.current.has(e)&&(O.current.delete(e),z(e=>e+1)));const t=()=>{const t=n.offsetHeight;t&&O.current.get(e)!==t&&(O.current.set(e,t),z(e=>e+1))};"function"==typeof queueMicrotask?queueMicrotask(t):Promise.resolve().then(t)},[]),be=d(e=>{const n=q.current.get(e);if(n)return n;const t=n=>ke(e,n);return q.current.set(e,t),t},[ke]),Ce=d(e=>!($&&e>=A.current)&&(!D||e<M||!0===K.current[e]),[D,$,M]),Ne=d(e=>n=>{if(!e)return;const t=n.target;(null==t?void 0:t.closest("[data-node-index]"))&&e(n)},[]);c(()=>{for(const[e,n]of X.current.entries())n&&ye(e,n)},[ye]),c(()=>{L&&P>Z.current&&H(P-1),Z.current=P},[P,L]);const Me=L?/* @__PURE__ */n("div",{className:"node-spacer",style:{height:`${ue}px`},"aria-hidden":"true"}):null,Be=L?/* @__PURE__ */n("div",{className:"node-spacer",style:{height:`${me}px`},"aria-hidden":"true"}):null;/* @__PURE__ */
|
|
187
|
+
return e("div",{ref:u,className:`markstream-react markdown-renderer${t.isDark?" dark":""}${L?" virtualized":""}`,"data-custom-id":t.customId,onClick:t.onClick,onMouseOver:Ne(t.onMouseOver),onMouseOut:Ne(t.onMouseOut),children:[Me,se.map(({node:e,index:r})=>{var o;const i=Ce(r),s=null!=(o=O.current.get(r))?o:ae,c=!1!==t.fade&&"code_block"!==e.type&&!Y.current.has(r)&&i;return c&&Y.current.add(r),/* @__PURE__ */n("div",{ref:xe(r),className:"node-slot","data-node-index":r,"data-node-type":e.type,children:/* @__PURE__ */n("div",i?{ref:be(r),className:"node-content"+(c?" fade-node typewriter-node":""),children:/* @__PURE__ */n(co,{node:e,nodeKey:`${a}-${r}`,renderCtx:l})}:{className:"node-placeholder",style:{height:`${s}px`}})},`${a}-${r}`)}),Be,m&&/* @__PURE__ */n("span",{ref:h,className:"typewriter-cursor","aria-hidden":"true"})]})},function(e,n){if(e.renderCtx!==n.renderCtx)return!1;if(e.indexPrefix!==n.indexPrefix)return!1;if(e.containerRef!==n.containerRef)return!1;if(e.showTypewriterCursor!==n.showTypewriterCursor)return!1;const t=e.parsedNodes,r=n.parsedNodes;if(t===r)return!0;if(t.length!==r.length)return!1;for(let l=0;l<t.length;l++)if(t[l]!==r[l])return!1;const o=e.props,i=n.props;return o.isDark===i.isDark&&o.typewriter===i.typewriter&&o.fade===i.fade&&o.batchRendering===i.batchRendering&&o.initialRenderBatchSize===i.initialRenderBatchSize&&o.renderBatchSize===i.renderBatchSize&&o.renderBatchDelay===i.renderBatchDelay&&o.renderBatchBudgetMs===i.renderBatchBudgetMs&&o.renderBatchIdleTimeoutMs===i.renderBatchIdleTimeoutMs&&o.deferNodesUntilVisible===i.deferNodesUntilVisible&&o.maxLiveNodes===i.maxLiveNodes&&o.liveNodeBuffer===i.liveNodeBuffer&&o.viewportPriority===i.viewportPriority&&o.indexKey===i.indexKey&&o.onClick===i.onClick&&o.onMouseOver===i.onMouseOver&&o.onMouseOut===i.onMouseOut});function mo(e){var t,l;const a={...io,...e},m=s(null),h=s(null),f=s(/* @__PURE__ */new Map),p=s(0),g=s(null),v=De(a.smoothStreamingOptions),w=r.useContext(Ne),y=s(/* @__PURE__ */new Set),[x,k]=i(()=>!0===a.smoothStreaming);c(()=>{k(!0)},[]);const b=Array.isArray(a.nodes)&&a.nodes.length>0,C=o(()=>{var e;return!1!==a.smoothStreaming&&!b&&(!0===a.smoothStreaming||!w)&&(!0===a.smoothStreaming||!0===a.typewriter||(null!=(e=a.maxLiveNodes)?e:0)<=0)},[b,w,a.maxLiveNodes,a.smoothStreaming,a.typewriter]),N=x&&C,M=N?v.visible:null!=(t=a.content)?t:"",B=o(()=>{var e,n;const t=null!=(e=a.parseOptions)?e:{};return null!=(n=a.final)?n:t.final},[a.final,a.parseOptions]),S=null!=(l=a.content)?l:"",T=b||v.source===S,D=o(()=>N&&null!=B?Boolean(B&&T&&v.caughtUp):B,[B,T,v.caughtUp,N]),_=s(null),[A,R]=i(!1),I=s(void 0),H=s(0),j=o(()=>/* @__PURE__ */new Set(["code_block","admonition","table","math_block","html_block","image"]),[]),z=d(e=>{if(!e||"object"!=typeof e)return!1;const n=e.type;return"string"==typeof n&&j.has(n)},[j]),K=d(e=>{var n,t;if(!e||"object"!=typeof e)return 0;const r=e,o=null!=(t=null!=(n=r.raw)?n:r.content)?t:r.code;if("string"==typeof o)return o.length;const i=r.children;if(Array.isArray(i))return i.reduce((e,n)=>e+K(n),0);const l=r.items;return Array.isArray(l)?l.reduce((e,n)=>e+K(n),0):0},[]),V=d(()=>{var e,n;return(null==(e=a.nodes)?void 0:e.length)?a.nodes.reduce((e,n)=>e+K(n),0):(null!=(n=a.content)?n:"").length},[a.nodes,a.content,K]),X=d(()=>{I.current&&(clearTimeout(I.current),I.current=void 0)},[]),U=d(e=>{const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode(e){var n;if(!(null!=(n=e.textContent)?n:"").trim())return NodeFilter.FILTER_REJECT;const t=e.parentElement;return t?t.closest('.typewriter-cursor, .height-estimation-probes, [data-node-type="code_block"], [data-node-type="admonition"], [data-node-type="table"], [data-node-type="math_block"], [data-node-type="html_block"], [data-node-type="image"], script, style')?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}});let t=null,r=n.nextNode();for(;r;)t=r,r=n.nextNode();return t},[]),q=d(()=>{var e,n;if("undefined"==typeof window||!A||!m.current||!_.current)return;const t=m.current,r=_.current,o=U(t),i=t.getBoundingClientRect();let l=0,a=0,s=20;if(null==o?void 0:o.textContent){const r=document.createRange(),c=o.textContent.length;r.setStart(o,Math.max(0,c-1)),r.setEnd(o,c);const d="function"==typeof r.getClientRects?r.getClientRects():void 0,u=null!=(n=null==d?void 0:d[d.length-1])?n:null==(e=o.parentElement)?void 0:e.getBoundingClientRect();u&&(l=u.right-i.left+t.scrollLeft,a=u.top-i.top+t.scrollTop,s=u.height||s),r.detach()}r.style.transform=`translate(${Math.max(0,l)}px, ${Math.max(0,a)}px)`,r.style.height=`${s}px`},[A,m,U]);c(()=>{A&&requestAnimationFrame(()=>{q()})},[A,q]),c(()=>()=>{X()},[X]);const Y=b?a.nodes:M;g.current!==Y&&(p.current+=1,g.current=Y);const Z=u(F,W,W),G=o(()=>O(a.customId),[a.customId,Z]),J=so(a.streamingComponents),Q=so(a.htmlComponents);c(()=>{ae(J,Q,y.current)},[Q,J]);const ee=o(()=>a.customId?`renderer-${a.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,[a.customId]),ne=o(()=>{var e,n;const t=null!=(n=(null!=(e=a.parseOptions)?e:{}).customHtmlTags)?n:[];return L(a.customHtmlTags,Array.isArray(t)?t:[],Object.keys(J))},[a.customId,a.customHtmlTags,a.parseOptions,Z,J]),te=o(()=>{const e=ne;return e&&0!==e.length?E(ee,{customHtmlTags:e}):E(ee)},[ee,ne]),re=o(()=>{const e=te;return a.customMarkdownIt?a.customMarkdownIt(e):e},[te,a.customMarkdownIt]),oe=o(()=>{var e;const n=null!=(e=a.parseOptions)?e:{},t=D,r=null!=t,o=ne.length>0;return r||o?{...n,...r?{final:t}:{},...o?{customHtmlTags:ne}:{}}:n},[ne,D,a.parseOptions]),ie=o(()=>{const e=Boolean(a.debugPerformance)&&"undefined"!=typeof console&&"undefined"!=typeof performance,n=e?performance.now():0;let t=[];return b?t=a.nodes.map(e=>({...e})):M&&(t=$(M,null!=re?re:lo,oe)),e&&console.info("[markstream-react][perf] parse(sync)",{ms:Math.round(performance.now()-n),nodes:t.length,contentLength:M.length}),t},[a.debugPerformance,M,b,a.nodes,oe,re,a.customId,Z,ne]),le=d(()=>{const e=ie[ie.length-1];return!z(e)},[ie,z]);c(()=>{if("undefined"==typeof window||b)return;if(D)return R(!1),void X();const e=V(),n=le();return!1===a.typewriter||!n||e<=H.current?(!1!==a.typewriter&&n||R(!1),void(H.current=e)):(H.current=e,R(!0),X(),requestAnimationFrame(()=>{q()}),I.current=setTimeout(()=>{R(!1)},3e3),()=>{X()})},[M,a.nodes,a.typewriter,a.content,D,ie.length,b,V,le,X,q]);const se=s([]),ce=null==oe?void 0:oe.postTransformNodes,de=s(ce);de.current!==ce&&(se.current=[],de.current=ce);const ue=function(e,n){if(!n.length)return e;const t=new Array(e.length);let r=e.length===n.length;for(let o=0;o<e.length;o++){const i=o<n.length?n[o]:null;i&&ao(i,e[o])?t[o]=i:(t[o]=e[o],r=!1)}return r?n:t}(ie,se.current);se.current=ue,c(()=>{var e;if(b)return void v.reset("");const n=null!=(e=a.content)?e:"";if(!N)return v.reset(n),void(B&&v.finish({flush:!0}));const t=v.getSnapshot().source;n?n===t||(n.startsWith(t)?v.enqueue(n.slice(t.length)):v.reset(n)):v.reset(""),B&&v.finish()},[b,a.content,B,N]),c(()=>{var e,n;if("undefined"==typeof window)return;if(a.renderCodeBlocksAsPre)return;if(!ue.some(e=>{var n;return"code_block"===(null==e?void 0:e.type)&&"mermaid"!==P(String(null!=(n=null==e?void 0:e.language)?n:""))}))return;const t=null!=(e=window.requestIdleCallback)?e:(e,n)=>{var t;return window.setTimeout(()=>e({didTimeout:!0,timeRemaining:()=>0}),null!=(t=null==n?void 0:n.timeout)?t:600)},r=null!=(n=window.cancelIdleCallback)?n:e=>window.clearTimeout(e),o=t(()=>{rn()},{timeout:900});return()=>r(o)},[ue,a.renderCodeBlocksAsPre]),c(()=>{if("undefined"==typeof window)return;if(a.renderCodeBlocksAsPre)return;const e=a.isDark?a.codeBlockDarkTheme:a.codeBlockLightTheme,n="string"==typeof e?e:"object"==typeof e&&e&&"name"in e?String(e.name):null;n&&h.current!==n&&(h.current=n,function(e){if(null==e)return;const n=function(e){if(null==e)return null;if("string"==typeof e)return e;if("object"==typeof e&&e&&"name"in e)return String(e.name);if("object"==typeof e){const n=yn.get(e);if(n)return n;try{const n=JSON.stringify(e);if(n)return yn.set(e,n),n}catch{}const t="__theme_"+ ++xn;return yn.set(e,t),t}return String(e)}(e);n&&gn!==n&&(pn=e,gn=n,vn&&fn(pn,vn).then(()=>kn()).catch(()=>{}))}(e))},[a.codeBlockDarkTheme,a.codeBlockLightTheme,a.isDark,a.renderCodeBlocksAsPre]);const me=o(()=>null!=a.indexKey?String(a.indexKey):"markdown-renderer",[a.indexKey]),he=o(()=>({..."boolean"==typeof a.showTooltips?{showTooltips:a.showTooltips}:{},...a.codeBlockProps||{}}),[a.codeBlockProps,a.showTooltips]),fe=o(()=>({...a.mermaidProps||{}}),[a.mermaidProps]),pe=o(()=>({...a.d2Props||{}}),[a.d2Props]),ge=o(()=>({...a.infographicProps||{}}),[a.infographicProps]),ve=o(()=>{var e;return{customId:a.customId,isDark:a.isDark,final:D,indexKey:me,typewriter:a.typewriter,fade:a.fade,textStreamState:f.current,streamRenderVersion:p.current,customComponents:G,streamingComponents:J,htmlComponents:Q,customHtmlTags:ne,htmlPolicy:null!=(e=a.htmlPolicy)?e:"safe",showTooltips:a.showTooltips,renderCodeBlocksAsPre:a.renderCodeBlocksAsPre,codeBlockStream:a.codeBlockStream,codeBlockProps:he,mermaidProps:fe,d2Props:pe,infographicProps:ge,codeBlockThemes:{themes:a.themes,darkTheme:a.codeBlockDarkTheme,lightTheme:a.codeBlockLightTheme,langs:a.langs,monacoOptions:a.codeBlockMonacoOptions,minWidth:a.codeBlockMinWidth,maxWidth:a.codeBlockMaxWidth},events:{onCopy:a.onCopy,onHandleArtifactClick:a.onHandleArtifactClick}}},[a.customId,a.isDark,D,me,a.typewriter,a.fade,a.showTooltips,a.htmlPolicy,a.renderCodeBlocksAsPre,a.codeBlockStream,ne,he,fe,pe,ge,a.themes,a.codeBlockDarkTheme,a.codeBlockLightTheme,a.langs,a.codeBlockMonacoOptions,a.codeBlockMinWidth,a.codeBlockMaxWidth,a.onCopy,a.onHandleArtifactClick,G,J,Q]);ve.streamRenderVersion=p.current,ve.textStreamState=f.current;const we=s(null);return we.current||(we.current={textStreamState:f.current,getStreamRenderVersion:()=>p.current}),/* @__PURE__ */n(Me.Provider,{value:we.current,children:/* @__PURE__ */n(Ne.Provider,{value:N,children:/* @__PURE__ */n(Ee,{getRoot:()=>m.current,enabled:!1!==a.viewportPriority,children:/* @__PURE__ */n(uo,{props:a,parsedNodes:ue,renderCtx:ve,indexPrefix:me,containerRef:m,showTypewriterCursor:A,typewriterCursorRef:_})})})})}function ho(e){var t,r,o,i,l,a;const{node:s,ctx:c,renderNode:d,indexKey:u,children:m}=e;/* @__PURE__ */
|
|
188
|
+
return n("blockquote",{className:"blockquote-node",dir:"auto",cite:s.cite,children:null!=m?m:c&&d?/* @__PURE__ */n(mo,{nodes:s.children||[],indexKey:`blockquote-${String(null!=u?u:"blockquote")}`,customId:c.customId,isDark:c.isDark,typewriter:c.typewriter,viewportPriority:!0,codeBlockStream:c.codeBlockStream,renderCodeBlocksAsPre:c.renderCodeBlocksAsPre,codeBlockProps:c.codeBlockProps,themes:null==(t=c.codeBlockThemes)?void 0:t.themes,codeBlockDarkTheme:null==(r=c.codeBlockThemes)?void 0:r.darkTheme,codeBlockLightTheme:null==(o=c.codeBlockThemes)?void 0:o.lightTheme,codeBlockMonacoOptions:null==(i=c.codeBlockThemes)?void 0:i.monacoOptions,codeBlockMinWidth:null==(l=c.codeBlockThemes)?void 0:l.minWidth,codeBlockMaxWidth:null==(a=c.codeBlockThemes)?void 0:a.maxWidth,htmlPolicy:c.htmlPolicy,showTooltips:c.showTooltips,onCopy:c.events.onCopy,onHandleArtifactClick:c.events.onHandleArtifactClick}):null})}const fo=ce();function po(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function go(r){const l={loading:!0,stream:!0,darkTheme:"vitesse-dark",lightTheme:"vitesse-light",isDark:!1,isShowPreview:!0,enableFontSizeControl:!0,showHeader:!0,showCopyButton:!0,showExpandButton:!0,showPreviewButton:!0,showCollapseButton:!0,showFontSizeButtons:!0,...r},a=o(()=>{var e;return String(null!=(e=l.node.language)?e:"")},[l.node.language]),u=o(()=>P(a),[a]),[m,h]=i(0);c(()=>_(()=>{h(e=>e+1)}),[]);const f=o(()=>{const e=I[u]||u;return e?e.charAt(0).toUpperCase()+e.slice(1):"Text"},[u]),p=o(()=>R(u),[u,m]),{t:g}=Re(),v=o(()=>!!l.isShowPreview&&("html"===u||"svg"===u),[u,l.isShowPreview]),w=o(()=>{const e={},n=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},t=n(l.minWidth),r=n(l.maxWidth);return t&&(e.minWidth=t),r&&(e.maxWidth=r),e},[l.maxWidth,l.minWidth]),[y,x]=i(!1),[k,b]=i(!1),[C,N]=i(!1),[M,B]=i(()=>l.node.code?`<pre class="shiki shiki-fallback"><code>${po(l.node.code)}</code></pre>`:""),[S,T]=i(!1),[L,E]=i(14),[$,D]=i(L),A=o(()=>!1!==l.showTooltips,[l.showTooltips]),H=he(l.themes,l.langs),F=s(null);F.current&&F.current.key===H||(F.current={key:H,themes:l.themes,langs:l.langs});const W=s(null),O=s(null),j=s(null),z=s(null),K=s(null),V=s(""),X=s(""),U=s(0),q=s(null),Y=s(null),Z=s(null),G=s(!1),J=s(!1),Q=s(null),ee=s(!1),ne=s(/* @__PURE__ */new Set),te=s(/* @__PURE__ */new Set),re=s(""),oe=s(0),ie=s(H),le=s(0),ae=s(!0),se=s(null),ce=$e(),[de,ue]=i(()=>"undefined"==typeof window),ge=d(()=>l.isDark?l.darkTheme:l.lightTheme,[l.darkTheme,l.isDark,l.lightTheme]),ve=d(e=>{null==e||e.disconnect(),e&&z.current!==e||(z.current=null)},[]),we=d(()=>{j.current&&(j.current.innerHTML="")},[]),ye=d(e=>{if(q.current=null,ve(),!e)return we(),X.current="",B(""),void T(!1);B(`<pre class="shiki shiki-fallback"><code>${po(e)}</code></pre>`),T(!1)},[we,ve]),xe=d(()=>{ve(),B(""),T(!0)},[ve]),ke=d(e=>{X.current=e,xe()},[xe]),be=d(()=>{var e;const n=j.current;return!!n&&(n.childNodes.length>0||Boolean(null==(e=n.textContent)?void 0:e.trim().length))},[]),Ce=d((e=!0)=>{const n=K.current;ve(),K.current=null,V.current="",X.current="",q.current=null,ne.current.clear();try{null==n||n.dispose()}catch(t){fo&&"undefined"!=typeof console&&console.warn("[MarkdownCodeBlockNode] Failed to dispose Shiki renderer.",t)}finally{we(),e&&T(!1)}},[we,ve]),Ne=d(()=>(le.current+=1,le.current),[]),Me=d(e=>ae.current&&le.current===e,[]),Be=d((e,n)=>{ve();const t=j.current;if(!t||"undefined"==typeof MutationObserver)return;q.current=null;const r=new MutationObserver(()=>{U.current+=1;const t=q.current;if(t)return Me(e)?void(U.current!==n&&be()&&(q.current=null,ve(r),ke(t))):(q.current=null,void ve(r))});z.current=r,r.observe(t,{childList:!0,subtree:!0,characterData:!0,attributes:!0})},[ve,be,Me,ke]),Se=d(async(e,n,t,r)=>{var o;if(q.current=t,await Promise.resolve(),!Me(e))return;const i=be(),l=U.current!==n,a=void 0!==r&&(null==(o=j.current)?void 0:o.innerHTML)!==r;i&&(!X.current||l||a||X.current===t)&&(q.current=null,ve(),ke(t))},[ve,be,Me,ke]),Te=d(async()=>{if(!Y.current&&!G.current)return Z.current||(Z.current=(async()=>{try{const e=await import("stream-markdown"),n=e.createShikiStreamRenderer;if("function"!=typeof n)throw new TypeError("stream-markdown.createShikiStreamRenderer is not available");Y.current=n;const t=e.registerHighlight;Q.current="function"==typeof t?t:null,G.current=!1,J.current=!1}catch(e){G.current=!0,fo&&!J.current&&"undefined"!=typeof console&&(J.current=!0,console.warn("[MarkdownCodeBlockNode] stream-markdown not available:",e))}finally{Z.current=null}})()),Z.current},[]),Le=d(async e=>{const n=e.key;if(ie.current!==n)return"stale";if(!Q.current)return"ready";if(re.current===n)return"ready";const t=++oe.current;try{await fe(Q.current,e.registerOptions,n)}catch{return t!==oe.current||ie.current!==n?"stale":"failed"}return t!==oe.current||ie.current!==n?"stale":(re.current=n,"ready")},[]),Ee=d(async e=>{const n=await Le(e);return"failed"!==n?n:ie.current!==e.key?"stale":Le(e)},[Le]),De=d(e=>{var n;const t={hasRegisterHighlight:Boolean(Q.current),hasCreateRenderer:Boolean(Y.current)},r=pe(null==e?void 0:e.themes,null==e?void 0:e.langs,t),o=(null==(n=r.rendererOptions.langs)?void 0:n.length)&&te.current.has(r.key)?pe(null==e?void 0:e.themes,void 0,t):r;return r.ignoredLangs&&fo&&!ee.current&&"undefined"!=typeof console&&(ee.current=!0,console.warn("[MarkdownCodeBlockNode] `langs` requires stream-markdown >=0.0.15 with registerHighlight(); ignoring `langs` and using stream-markdown default language preload.")),{key:o.key,registerOptions:o.registerOptions,rendererOptions:o.rendererOptions}},[]),Pe=d(async(e,n,t)=>{const r=K.current;if(!r||!Me(t))return;const o=function(e){return me(e)||"plaintext"}(n),i=async n=>{const r=K.current;if(r&&Me(t)){n&&"plaintext"!==o&&ne.current.add(o);try{return await r.updateCode(e,"plaintext"),Me(t)?"plaintext":void 0}catch{return}}};if("plaintext"!==o&&ne.current.has(o))return i();try{return await r.updateCode(e,o),Me(t)?o:void 0}catch(l){if(!Me(t)||"plaintext"===o)return;return i(l)}},[Me]),_e=d(async()=>{var e,n;const t=Ne(),r=l.node.code,o=l.node.language,i=F.current;if(l.loading||!de)return void ye(r);if(await Te(),!Me(t))return;let a=De(i),s=a.key;ie.current=s;let c=Boolean(K.current&&V.current!==s);c&&ye(r);let d=await Ee(a);if("failed"===d&&(null==(e=a.rendererOptions.langs)?void 0:e.length)&&(te.current.add(a.key),fo&&"undefined"!=typeof console&&console.warn("[MarkdownCodeBlockNode] Failed to register configured Shiki languages; retrying without `langs`.",{langs:a.rendererOptions.langs}),a=De({themes:null==i?void 0:i.themes,langs:void 0}),s=a.key,ie.current=s,d=await Ee(a)),!Me(t)||"stale"===d)return;if(c=Boolean(K.current&&V.current!==s),"failed"===d)return void(c&&K.current&&be()?xe():ye(r));if(c&&Ce(),!O.current||!j.current)return void ye(r);if(!K.current&&Y.current&&(K.current=Y.current(j.current,{theme:ge(),themes:a.rendererOptions.themes,langs:a.rendererOptions.langs}),V.current=s,T(!0)),!K.current)return void ye(r);if(!1===l.stream&&l.loading)return void ye(r);ye(r);const u=U.current,m=null==(n=j.current)?void 0:n.innerHTML;Be(t,u);const h=await Pe(r,o,t);Me(t)&&(h?await Se(t,u,function(e,n,t){return`${null!=e?e:""}\0${n}\0${t}`}(s,h,r),m):(q.current=null,ve()))},[Ne,l.node.code,l.node.language,l.stream,l.loading,H,de,Te,De,Ee,Ce,xe,ge,be,ye,Be,Pe,Se,ve,Me]);c(()=>{const e=W.current;if(!e)return;let n=!0;const t=ce(e,{rootMargin:"400px"});return se.current=t,t.isVisible()&&ue(!0),t.whenVisible.then(()=>{n&&ue(!0)}),()=>{n=!1,t.destroy(),se.current=null}},[ce]),c(()=>{_e().catch(()=>{ae.current&&j.current&&ye(l.node.code)})},[_e,l.node.code,ye]),c(()=>(ae.current=!0,()=>{ae.current=!1,le.current+=1,Ce(!1)}),[Ce]),c(()=>{K.current&&de&&K.current.setTheme(ge())},[ge,de]),c(()=>{A||Xe(!0)},[A]);const Ae=d((e,n)=>{if(!A)return;const t=e.currentTarget;t&&!t.disabled&&("clientX"in e&&(e.clientX,e.clientY),Ve(t,n,"top",!1,0,l.isDark))},[l.isDark,A]),Ie=d(()=>{A&&Xe()},[A]),He=d(async()=>{var e;try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&await navigator.clipboard.writeText(l.node.code),x(!0),null==(e=l.onCopy)||e.call(l,l.node.code),setTimeout(()=>x(!1),1e3)}catch{}},[l]),Fe=d(()=>{var e;if(!v)return;const n="html"===u?"text/html":"image/svg+xml",t="html"===u?"HTML Preview":"SVG Preview";null==(e=l.onPreviewCode)||e.call(l,{type:n,content:l.node.code,title:t})},[u,v,l]),We=o(()=>({fontSize:`${$}px`}),[$]);return c(()=>{E(14),D(14)},[]),/* @__PURE__ */e("div",{ref:W,className:["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm",l.isDark?"border-gray-700/30 bg-gray-900 is-dark":"border-gray-200 bg-white"].join(" "),style:w,children:[l.showHeader&&/* @__PURE__ */e("div",{className:"code-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5",style:{color:"var(--vscode-editor-foreground)",backgroundColor:"var(--vscode-editor-background)"},children:[
|
|
189
|
+
/* @__PURE__ */e("div",{className:"flex items-center space-x-2",children:[
|
|
190
|
+
/* @__PURE__ */n("span",{className:"icon-slot h-4 w-4 flex-shrink-0",dangerouslySetInnerHTML:{__html:p}}),
|
|
191
|
+
/* @__PURE__ */n("span",{className:"text-sm font-medium font-mono",children:f})]}),
|
|
192
|
+
/* @__PURE__ */e("div",{className:"flex items-center space-x-2",children:[l.showCollapseButton&&/* @__PURE__ */n("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":C,onClick:()=>N(e=>!e),onMouseEnter:e=>Ae(e,C?g("common.expand")||"Expand":g("common.collapse")||"Collapse"),onFocus:e=>Ae(e,C?g("common.expand")||"Expand":g("common.collapse")||"Collapse"),onMouseLeave:Ie,onBlur:Ie,children:/* @__PURE__ */n("svg",{style:{rotate:C?"0deg":"90deg"},xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 18l6-6l-6-6"})})}),l.showFontSizeButtons&&l.enableFontSizeControl&&/* @__PURE__ */e(t,{children:[
|
|
193
|
+
/* @__PURE__ */n("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:$<=10,onClick:()=>D(e=>Math.max(10,e-1)),onMouseEnter:e=>Ae(e,g("common.decrease")||"Decrease"),onFocus:e=>Ae(e,g("common.decrease")||"Decrease"),onMouseLeave:Ie,onBlur:Ie,children:/* @__PURE__ */n("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 12h14"})})}),
|
|
194
|
+
/* @__PURE__ */n("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:$===L,onClick:()=>D(L),onMouseEnter:e=>Ae(e,g("common.reset")||"Reset"),onFocus:e=>Ae(e,g("common.reset")||"Reset"),onMouseLeave:Ie,onBlur:Ie,children:/* @__PURE__ */n("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
|
|
195
|
+
/* @__PURE__ */n("path",{d:"M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8"}),
|
|
196
|
+
/* @__PURE__ */n("path",{d:"M3 3v5h5"})]})})}),
|
|
197
|
+
/* @__PURE__ */n("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:$>=36,onClick:()=>D(e=>Math.min(36,e+1)),onMouseEnter:e=>Ae(e,g("common.increase")||"Increase"),onFocus:e=>Ae(e,g("common.increase")||"Increase"),onMouseLeave:Ie,onBlur:Ie,children:/* @__PURE__ */n("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 12h14m-7-7v14"})})})]}),l.showCopyButton&&/* @__PURE__ */n("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":y?g("common.copied")||"Copied":g("common.copy")||"Copy",onClick:He,onMouseEnter:e=>Ae(e,y?g("common.copied")||"Copied":g("common.copy")||"Copy"),onFocus:e=>Ae(e,y?g("common.copied")||"Copied":g("common.copy")||"Copy"),onMouseLeave:Ie,onBlur:Ie,children:/* @__PURE__ */n("svg",y?{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M20 6L9 17l-5-5"})}:{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
|
|
198
|
+
/* @__PURE__ */n("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),
|
|
199
|
+
/* @__PURE__ */n("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]})})}),l.showExpandButton&&/* @__PURE__ */n("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":k,onClick:e=>{b(e=>!e),Ae(e,k?g("common.expand")||"Expand":g("common.collapse")||"Collapse")},onMouseEnter:e=>Ae(e,k?g("common.collapse")||"Collapse":g("common.expand")||"Expand"),onFocus:e=>Ae(e,k?g("common.collapse")||"Collapse":g("common.expand")||"Expand"),onMouseLeave:Ie,onBlur:Ie,children:/* @__PURE__ */n("svg",k?{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"})}:{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"})})}),v&&l.showPreviewButton&&/* @__PURE__ */n("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":g("common.preview")||"Preview",onClick:Fe,onMouseEnter:e=>Ae(e,g("common.preview")||"Preview"),onFocus:e=>Ae(e,g("common.preview")||"Preview"),onMouseLeave:Ie,onBlur:Ie,children:/* @__PURE__ */n("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
|
|
200
|
+
/* @__PURE__ */n("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"}),
|
|
201
|
+
/* @__PURE__ */n("circle",{cx:"12",cy:"12",r:"3"})]})})})]})]}),!C&&(!!l.stream||!l.loading)&&/* @__PURE__ */e("div",{ref:O,className:"code-block-content",style:{...We,maxHeight:k?"none":"500px",overflowY:k?"visible":"auto",overflowX:"auto"},children:[
|
|
202
|
+
/* @__PURE__ */n("div",{ref:j,className:"code-block-render"}),!S&&M&&/* @__PURE__ */n("div",{className:"code-fallback-plain",dangerouslySetInnerHTML:{__html:M}})]}),!l.stream&&l.loading&&/* @__PURE__ */n("div",{className:"code-loading-placeholder",children:/* @__PURE__ */e("div",{className:"loading-skeleton",children:[
|
|
203
|
+
/* @__PURE__ */n("div",{className:"skeleton-line"}),
|
|
204
|
+
/* @__PURE__ */n("div",{className:"skeleton-line"}),
|
|
205
|
+
/* @__PURE__ */n("div",{className:"skeleton-line short"})]})}),
|
|
206
|
+
/* @__PURE__ */n("span",{className:"sr-only","aria-live":"polite",role:"status",children:y?g("common.copied")||"Copied":""})]})}function vo(e){var t;const r=s(null),[l,a]=i(!1),[d,u]=i({transform:"translate3d(0px, 0px, 0px)",left:"0px",top:"0px"}),m=o(()=>function(e){if("boolean"==typeof e)return e;if("undefined"!=typeof document)try{if(document.documentElement.classList.contains("dark"))return!0}catch{}if("undefined"!=typeof window&&"function"==typeof window.matchMedia)try{return window.matchMedia("(prefers-color-scheme: dark)").matches}catch{}return!1}(e.isDark),[e.isDark]);return c(()=>{if(!e.visible)return void a(!1);if(!e.anchorEl||!r.current)return void a(!0);let n=null,t=!1;const o=async()=>{var n,o;if(!e.anchorEl||!r.current)return;const{x:i,y:l}=await we(e.anchorEl,r.current,{placement:null!=(n=e.placement)?n:"top",middleware:[ye(null!=(o=e.offset)?o:8),xe(),ke({padding:8})],strategy:"fixed"});t||u({position:"fixed",left:"0px",top:"0px",transform:`translate3d(${Math.round(i)}px, ${Math.round(l)}px, 0)`})};return o().then(()=>{t||a(!0)}),n=ve(e.anchorEl,r.current,o),()=>{t=!0,null==n||n()}},[e.anchorEl,e.offset,e.placement,e.visible,l]),"undefined"==typeof document?null:e.visible&&l?ge(
|
|
207
|
+
/* @__PURE__ */n("div",{id:null!=(t=e.id)?t:void 0,ref:r,style:d,className:["markstream-react ms-tooltip z-[9999] inline-block text-base py-2 px-3 rounded-md shadow-md whitespace-nowrap pointer-events-none border tooltip-element",m?"bg-gray-900 text-white border-gray-700 is-dark":"bg-white text-gray-900 border-gray-200"].join(" "),role:"tooltip",children:e.content}),document.body):null}export{gr as $,Ce as A,ho as B,Pe as C,et as D,tt as E,Kr as F,vo as G,at as H,Nt as I,kr as J,Zt as K,Pt as L,vr as M,mo as N,Vt as O,Ur as P,yr as Q,qr as R,Yr as S,Qr as T,Xn as U,no as V,Ut as W,Vn as X,br as Y,qn as Z,nr as _,Hn as a,Un as a0,qt as a1,tr as a2,oo as a3,Kn as a4,Ae as a5,er as a6,Yt as a7,Gt as a8,Kt as a9,Xt as aa,wr as ab,fr as ac,pr as ad,Cr as ae,Re as af,De as ag,Jt as ah,nt as b,rt as c,ot as d,it as e,lt as f,st as g,ct as h,dt as i,kt as j,Ye as k,Lt as l,Et as m,$t as n,_t as o,At as p,go as q,lr as r,ar as s,Ar as t,En as u,Zr as v,Gr as w,Jr as x,Dt as y,eo as z};
|