@cmmd-center/forge 0.9.3 → 0.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BunHttpServer-Dc5XijQF.mjs → BunHttpServer-BgNCpQzV.mjs} +2 -2
- package/dist/{BunHttpServer-Cuya1Zon.cjs → BunHttpServer-DOAuw4Iq.cjs} +2 -2
- package/dist/{BunPTY-z9OKvyBo.cjs → BunPTY-2icf7sRj.cjs} +2 -2
- package/dist/{BunPTY-CfS5zDoQ.mjs → BunPTY-D-Klry5N.mjs} +2 -2
- package/dist/{BunServices-eq_c-3x1.mjs → BunServices-ChM4mYH9.mjs} +1 -1
- package/dist/{BunServices-khEuvPaA.cjs → BunServices-CiNXNzHD.cjs} +1 -1
- package/dist/Mime-BITO-E1U.mjs +1395 -0
- package/dist/Mime-CyHbecis.cjs +1400 -0
- package/dist/{Mime-B75_d9aw.mjs → NodeHttpServer-C_wePPV0.mjs} +614 -1456
- package/dist/{Mime-aSilaQX9.cjs → NodeHttpServer-D_ismXpd.cjs} +617 -1466
- package/dist/{NodePTY-ChjVFpUH.mjs → NodePTY-BMUFdM93.mjs} +2 -2
- package/dist/{NodePTY-BOaJi0JA.cjs → NodePTY-cb7HIasY.cjs} +2 -2
- package/dist/{NodeSqliteClient-GlgGqc8V.mjs → NodeSqliteClient-OdI1TawL.mjs} +1 -1
- package/dist/{NodeSqliteClient-Vunn3aFN.cjs → NodeSqliteClient-SsUCk9mA.cjs} +1 -1
- package/dist/{PTY-rn2kGjhB.mjs → PTY-CBkE5akF.mjs} +1 -1
- package/dist/{PTY-D5OpMK9s.cjs → PTY-U3JQnLXS.cjs} +1 -1
- package/dist/{SqliteClient-Bpkno4Ob.cjs → SqliteClient-CdAhI4lb.cjs} +1 -1
- package/dist/{SqliteClient-DYQAvreq.mjs → SqliteClient-aoOb51gB.mjs} +1 -1
- package/dist/bin.cjs +14484 -10871
- package/dist/bin.mjs +14667 -11052
- package/dist/client/apple-touch-icon.png +0 -0
- package/dist/client/apple-touch-icon.png.publish-bak +0 -0
- package/dist/client/assets/CanvasPanel-BIN3OTEQ.js +441 -0
- package/dist/client/assets/CompositeItem-UKxcvvWv.js +2 -0
- package/dist/client/assets/DiffPanel-CeuRaSj1.js +64 -0
- package/dist/client/assets/DiffPanel.logic-D5i9QswQ.js +21 -0
- package/dist/client/assets/DiffPanelShell-W5nEVL52.js +2531 -0
- package/dist/client/assets/DiffWorkerPoolProvider-D87CO5TY.js +73 -0
- package/dist/client/assets/PullRequestCodePanel-DAmHwtY9.js +5 -0
- package/dist/client/assets/Stream-CToP6xzI.js +15 -0
- package/dist/client/assets/Virtualizer-CnwVHiy3.js +2 -0
- package/dist/client/assets/__vite-browser-external-DkEyUtaV.js +2 -0
- package/dist/client/assets/abap-kWSt4ETq.js +2 -0
- package/dist/client/assets/actionscript-3-DUMfZd56.js +2 -0
- package/dist/client/assets/ada-B5ZVVI6u.js +2 -0
- package/dist/client/assets/andromeeda-DXFdNco6.js +2 -0
- package/dist/client/assets/andromeeda-DwmQuk--.js +2 -0
- package/dist/client/assets/angular-html-BHUTdQ2k.js +2 -0
- package/dist/client/assets/angular-ts-BSGCbJ0j.js +2 -0
- package/dist/client/assets/apache-Cu40O3Ol.js +2 -0
- package/dist/client/assets/apex-DMPEjfSG.js +2 -0
- package/dist/client/assets/apl-BoCi4WkG.js +2 -0
- package/dist/client/assets/applescript-mUd3mpyF.js +2 -0
- package/dist/client/assets/ara-LhQXZmm_.js +2 -0
- package/dist/client/assets/asciidoc-BhTPoeH5.js +2 -0
- package/dist/client/assets/asm-BGGwX2ZL.js +2 -0
- package/dist/client/assets/astro-BMi5lGMm.js +2 -0
- package/dist/client/assets/atomRegistry-Bq5Y4LP1.js +3 -0
- package/dist/client/assets/aurora-x-CLgz8jpO.js +2 -0
- package/dist/client/assets/aurora-x-DY4EgSB_.js +2 -0
- package/dist/client/assets/awk-emAjNmqG.js +2 -0
- package/dist/client/assets/ayu-dark-BOsBaLmt.js +2 -0
- package/dist/client/assets/ayu-dark-Dm87GVDE.js +2 -0
- package/dist/client/assets/ayu-light-CVzS2PQZ.js +2 -0
- package/dist/client/assets/ayu-light-nGNJ-WDB.js +2 -0
- package/dist/client/assets/ayu-mirage-CionIqJ2.js +2 -0
- package/dist/client/assets/ayu-mirage-wUDx3klU.js +2 -0
- package/dist/client/assets/ballerina-Zz4P1PCo.js +2 -0
- package/dist/client/assets/bat-CojohPr3.js +2 -0
- package/dist/client/assets/beancount-DIrDFIbZ.js +2 -0
- package/dist/client/assets/berry-BktKISqk.js +2 -0
- package/dist/client/assets/bibtex-QuZiL8vO.js +2 -0
- package/dist/client/assets/bicep-BBqBjbA3.js +2 -0
- package/dist/client/assets/bird2-FrGIamnO.js +2 -0
- package/dist/client/assets/blade-CUGHtpnt.js +2 -0
- package/dist/client/assets/bsl-Dwz0otKA.js +2 -0
- package/dist/client/assets/c-3r97XxSq.js +2 -0
- package/dist/client/assets/c3-D-fgrOzJ.js +2 -0
- package/dist/client/assets/cadence-53eYIqKQ.js +2 -0
- package/dist/client/assets/cairo-Cai_OBhL.js +2 -0
- package/dist/client/assets/canvasStateStore-D3R1Ldk1.js +2 -0
- package/dist/client/assets/catppuccin-frappe-B9ztfCCY.js +2 -0
- package/dist/client/assets/catppuccin-frappe-Dtq86Zt-.js +2 -0
- package/dist/client/assets/catppuccin-latte-D1lF_ULk.js +2 -0
- package/dist/client/assets/catppuccin-latte-jgmNlGoB.js +2 -0
- package/dist/client/assets/catppuccin-macchiato-CcX-f1yB.js +2 -0
- package/dist/client/assets/catppuccin-macchiato-DfuKQKcK.js +2 -0
- package/dist/client/assets/catppuccin-mocha-B3_lpdvM.js +2 -0
- package/dist/client/assets/catppuccin-mocha-DfNnOvvn.js +2 -0
- package/dist/client/assets/clarity-DCS2DMlE.js +2 -0
- package/dist/client/assets/clojure-XwHeeE37.js +2 -0
- package/dist/client/assets/cmake-VIYk9tbe.js +2 -0
- package/dist/client/assets/cmmdAuthRedirect-DLvl7JNi.js +2 -0
- package/dist/client/assets/cobol-IPhylbE9.js +2 -0
- package/dist/client/assets/codeowners-DiTXAskR.js +2 -0
- package/dist/client/assets/codeql-0208dEuz.js +2 -0
- package/dist/client/assets/coffee-BwGUpF4f.js +2 -0
- package/dist/client/assets/common-lisp-Bbk7xLRF.js +2 -0
- package/dist/client/assets/coq-CDDZdGGh.js +2 -0
- package/dist/client/assets/cpp-jFyTvZsm.js +2 -0
- package/dist/client/assets/crystal-DYkQl9zO.js +2 -0
- package/dist/client/assets/csharp-Dausz59m.js +2 -0
- package/dist/client/assets/css-jXIxCbs3.js +2 -0
- package/dist/client/assets/csv-e2HVQau9.js +2 -0
- package/dist/client/assets/cue-BMgE_xju.js +2 -0
- package/dist/client/assets/cypher-CA95tXqi.js +2 -0
- package/dist/client/assets/d-DeO2qMKQ.js +2 -0
- package/dist/client/assets/dark-plus-DaoBxEuI.js +2 -0
- package/dist/client/assets/dark-plus-hlEOAUn6.js +2 -0
- package/dist/client/assets/dart-_9gbW0uG.js +2 -0
- package/dist/client/assets/dax-BMSB_urL.js +2 -0
- package/dist/client/assets/desktop-CFWOIXtS.js +2 -0
- package/dist/client/assets/diff-K3NAzB5h.js +2 -0
- package/dist/client/assets/docker-BHQx5Ff2.js +2 -0
- package/dist/client/assets/dotenv-CkiqXLC8.js +2 -0
- package/dist/client/assets/dracula-C9rp4fWn.js +2 -0
- package/dist/client/assets/dracula-CIJxKfwh.js +2 -0
- package/dist/client/assets/dracula-soft-BN-taJLQ.js +2 -0
- package/dist/client/assets/dracula-soft-De1wWQ_v.js +2 -0
- package/dist/client/assets/dream-maker-BM-H3AID.js +2 -0
- package/dist/client/assets/edge-CVf1J8H7.js +2 -0
- package/dist/client/assets/elixir-DtWV_YYF.js +2 -0
- package/dist/client/assets/elm-BJC2NMzB.js +2 -0
- package/dist/client/assets/emacs-lisp-BBM_ORbk.js +2 -0
- package/dist/client/assets/erb-cwYn0k3w.js +2 -0
- package/dist/client/assets/erlang-QNS0KA0S.js +2 -0
- package/dist/client/assets/everforest-dark-BSYmfNnp.js +2 -0
- package/dist/client/assets/everforest-dark-DUW3cHBn.js +2 -0
- package/dist/client/assets/everforest-light-CXyS_8Pc.js +2 -0
- package/dist/client/assets/everforest-light-DR-OhbXr.js +2 -0
- package/dist/client/assets/fennel-CAUJGoSU.js +2 -0
- package/dist/client/assets/fish-Cgln2BIC.js +2 -0
- package/dist/client/assets/fluent-BFL910sE.js +2 -0
- package/dist/client/assets/fortran-fixed-form-GNS6k7js.js +2 -0
- package/dist/client/assets/fortran-free-form-DB-siuqX.js +2 -0
- package/dist/client/assets/fsharp-BEjSdIee.js +2 -0
- package/dist/client/assets/gdresource-D24f9BeL.js +2 -0
- package/dist/client/assets/gdscript-Bq5ZYHDh.js +2 -0
- package/dist/client/assets/gdshader-BWxXiThj.js +2 -0
- package/dist/client/assets/genie-BOcsPMcn.js +2 -0
- package/dist/client/assets/gherkin-pSvoetjt.js +2 -0
- package/dist/client/assets/git-commit-Ddcy2Rzd.js +2 -0
- package/dist/client/assets/git-rebase-95AHstHI.js +2 -0
- package/dist/client/assets/github-dark-BbHkogeI.js +2 -0
- package/dist/client/assets/github-dark-D1nTcH4E.js +2 -0
- package/dist/client/assets/github-dark-default-Cgu-j31c.js +2 -0
- package/dist/client/assets/github-dark-default-CwMUtNVn.js +2 -0
- package/dist/client/assets/github-dark-dimmed-BmSK4vhs.js +2 -0
- package/dist/client/assets/github-dark-dimmed-CQVfITf-.js +2 -0
- package/dist/client/assets/github-dark-high-contrast-8_9Rbsic.js +2 -0
- package/dist/client/assets/github-dark-high-contrast-BO-0858k.js +2 -0
- package/dist/client/assets/github-light-DWIA8Fx_.js +2 -0
- package/dist/client/assets/github-light-default-CR0FtjVb.js +2 -0
- package/dist/client/assets/github-light-default-LLPbqR-K.js +2 -0
- package/dist/client/assets/github-light-high-contrast-5o8qRjCb.js +2 -0
- package/dist/client/assets/github-light-high-contrast-C8BCDz6a.js +2 -0
- package/dist/client/assets/github-light-lCcn0xRl.js +2 -0
- package/dist/client/assets/gleam-DPm9Zc9U.js +2 -0
- package/dist/client/assets/glimmer-js-Cjwf-Ijv.js +2 -0
- package/dist/client/assets/glimmer-ts-DXnOWlZf.js +2 -0
- package/dist/client/assets/glsl-iXGbnqIU.js +2 -0
- package/dist/client/assets/gn-DEuV1her.js +2 -0
- package/dist/client/assets/gnuplot-CqGlKjK6.js +2 -0
- package/dist/client/assets/go-mptU-yl2.js +2 -0
- package/dist/client/assets/graphql-DJMVZQv3.js +2 -0
- package/dist/client/assets/groovy-CKg5KWq9.js +2 -0
- package/dist/client/assets/gruvbox-dark-hard-Df4rfbxN.js +2 -0
- package/dist/client/assets/gruvbox-dark-hard-DsK6pQOr.js +2 -0
- package/dist/client/assets/gruvbox-dark-medium-nlSbDtaA.js +2 -0
- package/dist/client/assets/gruvbox-dark-medium-zSmEeDKP.js +2 -0
- package/dist/client/assets/gruvbox-dark-soft-BSW4a3D0.js +2 -0
- package/dist/client/assets/gruvbox-dark-soft-DgI1MxVf.js +2 -0
- package/dist/client/assets/gruvbox-light-hard-D144A6HZ.js +2 -0
- package/dist/client/assets/gruvbox-light-hard-DMNoHzNU.js +2 -0
- package/dist/client/assets/gruvbox-light-medium-C0B0NCuj.js +2 -0
- package/dist/client/assets/gruvbox-light-medium-CY2MDbN0.js +2 -0
- package/dist/client/assets/gruvbox-light-soft-CWJ8aP9f.js +2 -0
- package/dist/client/assets/gruvbox-light-soft-CyPlqRD8.js +2 -0
- package/dist/client/assets/hack-CkGKtoya.js +2 -0
- package/dist/client/assets/haml-mV-E4efJ.js +2 -0
- package/dist/client/assets/handlebars-Da6i86YE.js +2 -0
- package/dist/client/assets/haskell-DFWkJmsd.js +2 -0
- package/dist/client/assets/haxe-DoXg9N2w.js +2 -0
- package/dist/client/assets/hcl-VbcvLW6X.js +2 -0
- package/dist/client/assets/hjson-dQ--SYg9.js +2 -0
- package/dist/client/assets/hlsl-DNh8NDKB.js +2 -0
- package/dist/client/assets/horizon-BeufL1QP.js +2 -0
- package/dist/client/assets/horizon-CnOil3H1.js +2 -0
- package/dist/client/assets/horizon-bright-BoFfNO4u.js +2 -0
- package/dist/client/assets/horizon-bright-CJCE-DcQ.js +2 -0
- package/dist/client/assets/houston-C5_OTP91.js +2 -0
- package/dist/client/assets/houston-jaZUvSzs.js +2 -0
- package/dist/client/assets/html-derivative-BOw7yS3Z.js +2 -0
- package/dist/client/assets/html-e1ppUAVa.js +2 -0
- package/dist/client/assets/html2canvas-C_LL7spC.js +6 -0
- package/dist/client/assets/http-DFrMFVWs.js +2 -0
- package/dist/client/assets/hurl-3N2UscjA.js +2 -0
- package/dist/client/assets/hxml-Ip0yb8dg.js +2 -0
- package/dist/client/assets/hy-Bg-RIaMc.js +2 -0
- package/dist/client/assets/imba-BjZ9NRcj.js +2 -0
- package/dist/client/assets/index-Dr7HwjTE.css +1 -0
- package/dist/client/assets/index-DyEYqQdf.js +151 -0
- package/dist/client/assets/index.es-piUKIQw4.js +6 -0
- package/dist/client/assets/ini-CXagdQO9.js +2 -0
- package/dist/client/assets/java-DY6ZSujp.js +2 -0
- package/dist/client/assets/javascript-BfTuFzbs.js +2 -0
- package/dist/client/assets/jinja-C4NVx4X-.js +2 -0
- package/dist/client/assets/jison-BaE4DrvM.js +2 -0
- package/dist/client/assets/json-LL0kLbs_.js +2 -0
- package/dist/client/assets/json5-B1LcXsA8.js +2 -0
- package/dist/client/assets/jsonc-CYSDka7c.js +2 -0
- package/dist/client/assets/jsonl-CwfwQmvE.js +2 -0
- package/dist/client/assets/jsonnet-DG_zYewp.js +2 -0
- package/dist/client/assets/jspdf.es.min-_OjqfV_L.js +80 -0
- package/dist/client/assets/jssm-IkACsEzj.js +2 -0
- package/dist/client/assets/jsx-BOBg7x46.js +2 -0
- package/dist/client/assets/julia-D5dobu9Y.js +2 -0
- package/dist/client/assets/just-D99ddsWv.js +2 -0
- package/dist/client/assets/kanagawa-dragon-BBUl63AF.js +2 -0
- package/dist/client/assets/kanagawa-dragon-CBGy-6ik.js +2 -0
- package/dist/client/assets/kanagawa-lotus-BKY9TlU3.js +2 -0
- package/dist/client/assets/kanagawa-lotus-D93oLQjR.js +2 -0
- package/dist/client/assets/kanagawa-wave-CWf0rFWt.js +2 -0
- package/dist/client/assets/kanagawa-wave-CZBJ3hQh.js +2 -0
- package/dist/client/assets/kdl-DuytcvNV.js +2 -0
- package/dist/client/assets/kotlin-DmtnKz6Z.js +2 -0
- package/dist/client/assets/kusto-DmrVjfae.js +2 -0
- package/dist/client/assets/laserwave-DTzUwFmi.js +2 -0
- package/dist/client/assets/laserwave-NRABVcaO.js +2 -0
- package/dist/client/assets/latex-0e5rhe9m.js +2 -0
- package/dist/client/assets/lean-Bhkhoed1.js +2 -0
- package/dist/client/assets/less-BgyohKqc.js +2 -0
- package/dist/client/assets/light-plus-Cbc9ZUH4.js +2 -0
- package/dist/client/assets/light-plus-SK-KfMAV.js +2 -0
- package/dist/client/assets/liquid-BR35Xk1k.js +2 -0
- package/dist/client/assets/llvm-BtFJuFOJ.js +2 -0
- package/dist/client/assets/log-Df3M8ERB.js +2 -0
- package/dist/client/assets/logo-VfSEjTs6.js +2 -0
- package/dist/client/assets/lua-BMt4EqAw.js +2 -0
- package/dist/client/assets/luau-DIHOVG2A.js +2 -0
- package/dist/client/assets/make-gTMDFaMm.js +2 -0
- package/dist/client/assets/markdown-B_5il8S2.js +2 -0
- package/dist/client/assets/marko-DN4rLggA.js +2 -0
- package/dist/client/assets/material-theme-Pm6m-Kzc.js +2 -0
- package/dist/client/assets/material-theme-darker-BxFgxa9U.js +2 -0
- package/dist/client/assets/material-theme-darker-pKUQPx9-.js +2 -0
- package/dist/client/assets/material-theme-lighter-BLqni5my.js +2 -0
- package/dist/client/assets/material-theme-lighter-D6-26WhM.js +2 -0
- package/dist/client/assets/material-theme-ocean-C2N-nFlu.js +2 -0
- package/dist/client/assets/material-theme-ocean-DCxzET3l.js +2 -0
- package/dist/client/assets/material-theme-palenight-DyQqRTLL.js +2 -0
- package/dist/client/assets/material-theme-palenight-Y14J3SJp.js +2 -0
- package/dist/client/assets/material-theme-zfTX2d95.js +2 -0
- package/dist/client/assets/matlab-B2zVSjQq.js +2 -0
- package/dist/client/assets/mdc-kokCuEO8.js +2 -0
- package/dist/client/assets/mdx-CL7pLDiG.js +2 -0
- package/dist/client/assets/mermaid-Cou83ohU.js +2 -0
- package/dist/client/assets/min-dark-Bg1kQHvJ.js +2 -0
- package/dist/client/assets/min-dark-BhN4iMRs.js +2 -0
- package/dist/client/assets/min-light-BjU80CRL.js +2 -0
- package/dist/client/assets/min-light-Bw9u-P_u.js +2 -0
- package/dist/client/assets/mipsasm-CNFOlV7Y.js +2 -0
- package/dist/client/assets/module-fAFg92om.js +4 -0
- package/dist/client/assets/mojo-DmJMpmxj.js +2 -0
- package/dist/client/assets/monokai-C4NNjw1j.js +2 -0
- package/dist/client/assets/monokai-DIfgn9Q6.js +2 -0
- package/dist/client/assets/moonbit-f-DlcHvh.js +2 -0
- package/dist/client/assets/move-3UEJ-86q.js +2 -0
- package/dist/client/assets/narrat-BSySVkso.js +2 -0
- package/dist/client/assets/nextflow-B6YiVxNF.js +2 -0
- package/dist/client/assets/nextflow-groovy-CJM1tnxB.js +2 -0
- package/dist/client/assets/nginx-yFGqgywB.js +2 -0
- package/dist/client/assets/night-owl-CVqrHJ7c.js +2 -0
- package/dist/client/assets/night-owl-M-9PEzO3.js +2 -0
- package/dist/client/assets/night-owl-light-BFLAfCgh.js +2 -0
- package/dist/client/assets/night-owl-light-CbICj08I.js +2 -0
- package/dist/client/assets/nim-H0r8m4Bj.js +2 -0
- package/dist/client/assets/nix-D01-yy0s.js +2 -0
- package/dist/client/assets/nord-DdQ2eXb7.js +2 -0
- package/dist/client/assets/nord-b31BpoFd.js +2 -0
- package/dist/client/assets/nushell-CHtjMTHK.js +2 -0
- package/dist/client/assets/objective-c-CpnACn2A.js +2 -0
- package/dist/client/assets/objective-cpp-CC37zF8s.js +2 -0
- package/dist/client/assets/ocaml-zEzf7VRa.js +2 -0
- package/dist/client/assets/odin-7LfNaizd.js +2 -0
- package/dist/client/assets/one-dark-pro-D7GXMkD_.js +2 -0
- package/dist/client/assets/one-dark-pro-DZNXQIff.js +2 -0
- package/dist/client/assets/one-light-D0m2woYU.js +2 -0
- package/dist/client/assets/one-light-vpvEwBNE.js +2 -0
- package/dist/client/assets/openscad-alCnkqb3.js +2 -0
- package/dist/client/assets/pascal-BzxE7FG0.js +2 -0
- package/dist/client/assets/perl-DMfQlGhS.js +2 -0
- package/dist/client/assets/php-eC0_nfgu.js +2 -0
- package/dist/client/assets/pierre-dark-C8scyjTE.js +2 -0
- package/dist/client/assets/pierre-dark-protanopia-deuteranopia-DjjI5tLG.js +2 -0
- package/dist/client/assets/pierre-dark-soft-U4k3hSAg.js +2 -0
- package/dist/client/assets/pierre-dark-tritanopia-CwldMLve.js +2 -0
- package/dist/client/assets/pierre-dark-vibrant-CbqW77RL.js +2 -0
- package/dist/client/assets/pierre-light-CRazXHrY.js +2 -0
- package/dist/client/assets/pierre-light-protanopia-deuteranopia-C-0-s32M.js +2 -0
- package/dist/client/assets/pierre-light-soft-CeMgeGD-.js +2 -0
- package/dist/client/assets/pierre-light-tritanopia-CwP7kaEp.js +2 -0
- package/dist/client/assets/pierre-light-vibrant-BRw7kdwa.js +2 -0
- package/dist/client/assets/pkl-B_4Y3aQj.js +2 -0
- package/dist/client/assets/plastic-7ebP7j7m.js +2 -0
- package/dist/client/assets/plastic-BxJ4wlPp.js +2 -0
- package/dist/client/assets/plsql-Vnj6O-p2.js +2 -0
- package/dist/client/assets/po-BDEiW-In.js +2 -0
- package/dist/client/assets/poimandres-CjxvpNV1.js +2 -0
- package/dist/client/assets/poimandres-DaajSABO.js +2 -0
- package/dist/client/assets/polar-DkeS43LD.js +2 -0
- package/dist/client/assets/postcss-BdW9ckpW.js +2 -0
- package/dist/client/assets/powerquery-Ck_tTsxM.js +2 -0
- package/dist/client/assets/powershell-CSE_7mny.js +2 -0
- package/dist/client/assets/preload-helper-2nxZ5jlD.js +1 -0
- package/dist/client/assets/prisma-Bo0mLS5-.js +2 -0
- package/dist/client/assets/prolog-BKKH5B6F.js +2 -0
- package/dist/client/assets/proto-CQGfqf21.js +2 -0
- package/dist/client/assets/pug-CdkPd3m5.js +2 -0
- package/dist/client/assets/puppet-CMQRMMTw.js +2 -0
- package/dist/client/assets/purescript-CCcyGQO2.js +2 -0
- package/dist/client/assets/purify.es-BOhOJYGt.js +3 -0
- package/dist/client/assets/python-DMPOlDIf.js +2 -0
- package/dist/client/assets/qml-CjgSvi7A.js +2 -0
- package/dist/client/assets/qmldir-WCdsq__X.js +2 -0
- package/dist/client/assets/qss-AtgwhOez.js +2 -0
- package/dist/client/assets/r-CyfaTtPo.js +2 -0
- package/dist/client/assets/racket-BChN0yKc.js +2 -0
- package/dist/client/assets/raku-y2whvo3i.js +2 -0
- package/dist/client/assets/razor-xg0jlt5d.js +2 -0
- package/dist/client/assets/red-4ASUbyQz.js +2 -0
- package/dist/client/assets/red-FUTSeuNn.js +2 -0
- package/dist/client/assets/reg-Vw5mc10D.js +2 -0
- package/dist/client/assets/regexp-DNjghFOM.js +2 -0
- package/dist/client/assets/rel-B7yBab0H.js +2 -0
- package/dist/client/assets/riscv-CoVA6mXv.js +2 -0
- package/dist/client/assets/rolldown-runtime-BeQ30c1w.js +1 -0
- package/dist/client/assets/ron-Dncoj8f2.js +2 -0
- package/dist/client/assets/rose-pine-BYqQazSr.js +2 -0
- package/dist/client/assets/rose-pine-DKVJldI6.js +2 -0
- package/dist/client/assets/rose-pine-dawn-BzAj1SA_.js +2 -0
- package/dist/client/assets/rose-pine-dawn-DpMWSJny.js +2 -0
- package/dist/client/assets/rose-pine-moon-BF7RtPma.js +2 -0
- package/dist/client/assets/rose-pine-moon-Buv_ZumG.js +2 -0
- package/dist/client/assets/rosmsg-DMM9gQ6F.js +2 -0
- package/dist/client/assets/rst-DUzGXO8S.js +2 -0
- package/dist/client/assets/ruby-rVw1KmtO.js +2 -0
- package/dist/client/assets/rust-Do9fnzCe.js +2 -0
- package/dist/client/assets/sas-DqCEPep6.js +2 -0
- package/dist/client/assets/sass-C-AYCcFv.js +2 -0
- package/dist/client/assets/scala-g1Tl2-Vx.js +2 -0
- package/dist/client/assets/scheme-DMNTmmtl.js +2 -0
- package/dist/client/assets/scss-DUVpCPFS.js +2 -0
- package/dist/client/assets/sdbl-DN-YwBSp.js +2 -0
- package/dist/client/assets/shaderlab-CU1ngQGv.js +2 -0
- package/dist/client/assets/shellscript-DhExEfAl.js +2 -0
- package/dist/client/assets/shellsession-BRLd459R.js +2 -0
- package/dist/client/assets/slack-dark-CHVebfsv.js +2 -0
- package/dist/client/assets/slack-dark-DsHK2SW9.js +2 -0
- package/dist/client/assets/slack-ochin-DLRnnjq1.js +2 -0
- package/dist/client/assets/slack-ochin-auUeui07.js +2 -0
- package/dist/client/assets/smalltalk-DfTqE6NI.js +2 -0
- package/dist/client/assets/snazzy-light-DYCniS15.js +2 -0
- package/dist/client/assets/snazzy-light-DcJ4c2TI.js +2 -0
- package/dist/client/assets/solarized-dark-C2M3A6iX.js +2 -0
- package/dist/client/assets/solarized-dark-f_BlEcC2.js +2 -0
- package/dist/client/assets/solarized-light-DGdaihLk.js +2 -0
- package/dist/client/assets/solarized-light-p0lk9NUw.js +2 -0
- package/dist/client/assets/solidity-UrsYApv4.js +2 -0
- package/dist/client/assets/soy-B2el7XDq.js +2 -0
- package/dist/client/assets/sparql-Ckg9aAAq.js +2 -0
- package/dist/client/assets/splunk-BbdNC7mF.js +2 -0
- package/dist/client/assets/sql-DiDaRjp9.js +2 -0
- package/dist/client/assets/src-pwcrD9wg.js +3 -0
- package/dist/client/assets/ssh-config-NaDpXiNE.js +2 -0
- package/dist/client/assets/stata-C71yNzqX.js +2 -0
- package/dist/client/assets/stylus-BmDWwNjA.js +2 -0
- package/dist/client/assets/surrealql-Cmypmwl2.js +2 -0
- package/dist/client/assets/svelte-VS6niI_T.js +2 -0
- package/dist/client/assets/swift-C69NyPuQ.js +2 -0
- package/dist/client/assets/synthwave-84-2NxBVDLO.js +2 -0
- package/dist/client/assets/synthwave-84-CVwMZOby.js +2 -0
- package/dist/client/assets/system-verilog-DJk0s1jv.js +2 -0
- package/dist/client/assets/systemd-CcQAXEZ9.js +2 -0
- package/dist/client/assets/talonscript-CUGr7vYM.js +2 -0
- package/dist/client/assets/tasl-BB-YNBB8.js +2 -0
- package/dist/client/assets/tcl-DR8-AcmN.js +2 -0
- package/dist/client/assets/templ-Cr4Do0uA.js +2 -0
- package/dist/client/assets/terraform-DS-GC2Bj.js +2 -0
- package/dist/client/assets/tex-CcZtvqzZ.js +2 -0
- package/dist/client/assets/toggle-BBEoD8mr.js +2 -0
- package/dist/client/assets/tokyo-night-9wJEO1G-.js +2 -0
- package/dist/client/assets/tokyo-night-ZUp4Hulo.js +2 -0
- package/dist/client/assets/toml-ByrHRc5Z.js +2 -0
- package/dist/client/assets/transport-B-82Ada5.js +2 -0
- package/dist/client/assets/ts-tags-Dhe4Ce_p.js +2 -0
- package/dist/client/assets/tsv-2A2hWH8i.js +2 -0
- package/dist/client/assets/tsx-rRP2I03K.js +2 -0
- package/dist/client/assets/turtle-BYbwzkhD.js +2 -0
- package/dist/client/assets/twig-DtN4j4nR.js +2 -0
- package/dist/client/assets/typeof-DOAxNSYQ.js +2 -0
- package/dist/client/assets/typescript-tv4fsI1Q.js +2 -0
- package/dist/client/assets/typespec-DoZVUoUi.js +2 -0
- package/dist/client/assets/typst-BmNF0lss.js +2 -0
- package/dist/client/assets/useTriggerFocusGuards-B2i3DSgR.js +2 -0
- package/dist/client/assets/v-CtCN4vLO.js +2 -0
- package/dist/client/assets/vala-DOsY6Y3z.js +2 -0
- package/dist/client/assets/vb-C1Ff9hOT.js +2 -0
- package/dist/client/assets/verilog-Dt4OfjHN.js +2 -0
- package/dist/client/assets/vesper-5ZmhmIun.js +2 -0
- package/dist/client/assets/vesper-J3W-7eep.js +2 -0
- package/dist/client/assets/vhdl-DkoQ3qnl.js +2 -0
- package/dist/client/assets/viml-C3b4aEDf.js +2 -0
- package/dist/client/assets/vitesse-black-CYOC7ssU.js +2 -0
- package/dist/client/assets/vitesse-black-DWaDDoI3.js +2 -0
- package/dist/client/assets/vitesse-dark-Bxewb9U5.js +2 -0
- package/dist/client/assets/vitesse-dark-CZotVzc8.js +2 -0
- package/dist/client/assets/vitesse-light-Bf_msd9a.js +2 -0
- package/dist/client/assets/vitesse-light-BfrRSjRx.js +2 -0
- package/dist/client/assets/vue-C0rWZC13.js +2 -0
- package/dist/client/assets/vue-html-bxw887C2.js +2 -0
- package/dist/client/assets/vue-vine-DUWGjTI5.js +2 -0
- package/dist/client/assets/vyper-BamdcTqV.js +2 -0
- package/dist/client/assets/wasm-C2MLrNQ1.js +2 -0
- package/dist/client/assets/wasm-CGd31VpO.js +2 -0
- package/dist/client/assets/wenyan-BPZ76iog.js +2 -0
- package/dist/client/assets/wgsl-sH_fVDG_.js +2 -0
- package/dist/client/assets/wikitext-BsPo9Czf.js +2 -0
- package/dist/client/assets/wit-BfBhtJwS.js +2 -0
- package/dist/client/assets/wolfram-GL7CPBRD.js +2 -0
- package/dist/client/assets/worker-Cvq2iJN1.js +162 -0
- package/dist/client/assets/workspaceReadinessAtom-DUP5NKsc.js +2 -0
- package/dist/client/assets/xml-C0zxRzgj.js +2 -0
- package/dist/client/assets/xsl-CC403A_G.js +2 -0
- package/dist/client/assets/yaml-BCnsJrvx.js +2 -0
- package/dist/client/assets/zenscript-CmwVE7RW.js +2 -0
- package/dist/client/assets/zig-GtQXM-vf.js +2 -0
- package/dist/client/favicon-16x16.png +0 -0
- package/dist/client/favicon-16x16.png.publish-bak +0 -0
- package/dist/client/favicon-32x32.png +0 -0
- package/dist/client/favicon-32x32.png.publish-bak +0 -0
- package/dist/client/favicon.ico +0 -0
- package/dist/client/favicon.ico.publish-bak +0 -0
- package/dist/client/forge-mark.svg +5 -0
- package/dist/client/index.html +131 -0
- package/dist/client/mockServiceWorker.js +336 -0
- package/dist/client/sidebar/forge-ember-field.webp +0 -0
- package/dist/{esm-wLIF-u3N.mjs → esm-Ce1GqbVk.mjs} +1 -1
- package/dist/{esm-BZhXwX5p.cjs → esm-Do7HVhLA.cjs} +1 -1
- package/dist/{execAsync-DWZyWH-_.mjs → execAsync-BNNdR88o.mjs} +1 -1
- package/dist/{execAsync-jnYVB5RZ.cjs → execAsync-BUcaFQ1D.cjs} +1 -1
- package/dist/forge-provision-display.sh +316 -0
- package/dist/{getMachineId-bsd-BLtyMA4j.cjs → getMachineId-bsd-C_qi9crE.cjs} +3 -3
- package/dist/{getMachineId-bsd-CTjiY7jG.mjs → getMachineId-bsd-FI863wjR.mjs} +3 -3
- package/dist/{getMachineId-darwin-DaGS2zUd.cjs → getMachineId-darwin-BOoNuqXn.cjs} +3 -3
- package/dist/{getMachineId-darwin-BrPuyPOo.mjs → getMachineId-darwin-D9VhTaPM.mjs} +3 -3
- package/dist/{getMachineId-linux-BsP3wJaE.cjs → getMachineId-linux-C9L-vW7m.cjs} +2 -2
- package/dist/{getMachineId-linux-D9QEWWF-.mjs → getMachineId-linux-DE2x36Kt.mjs} +2 -2
- package/dist/{getMachineId-unsupported-Cm-2s4Sg.mjs → getMachineId-unsupported-9S6pcxXb.mjs} +2 -2
- package/dist/{getMachineId-unsupported-B_M-gck7.cjs → getMachineId-unsupported-CmbM8LYa.cjs} +2 -2
- package/dist/{getMachineId-win-qtEKaUYj.mjs → getMachineId-win-0EVRuBxU.mjs} +3 -3
- package/dist/{getMachineId-win-3zJ3HQLG.cjs → getMachineId-win-BPaemVew.cjs} +3 -3
- package/dist/{open-CGXZLos4.cjs → open-BAsPVCWX.cjs} +1 -1
- package/dist/{open-Cf0bgbyx.mjs → open-FIgTDosf.mjs} +1 -1
- package/dist/runtimeBootstrap.cjs +8 -0
- package/dist/runtimeBootstrap.mjs +4 -0
- package/dist/runtimeControlAuthority-L85w5RTn.mjs +535 -0
- package/dist/runtimeControlAuthority-SNBF5Mjy.cjs +601 -0
- package/package.json +28 -30
- package/dist/NodeHttpServer-C7YMYP5R.cjs +0 -616
- package/dist/NodeHttpServer-D5-EtRwc.mjs +0 -605
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{};e.SENTRY_RELEASE={id:`forge-web@0.9.4`};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`565fe2f3-553e-4703-9ece-1575624ed4d7`,e._sentryDebugIdIdentifier=`sentry-dbid-565fe2f3-553e-4703-9ece-1575624ed4d7`)}catch{}})();import{Ra as e}from"./Stream-CToP6xzI.js";import{$ as t,$t as n,A as r,B as i,Bt as a,C as o,Cn as s,Ct as c,D as l,E as u,F as d,G as f,Gt as p,H as m,Ht as h,I as g,J as _,K as v,Kt as y,L as b,Lt as x,M as S,N as C,O as w,P as T,Qt as E,R as D,Rt as O,S as k,Sn as A,St as j,T as ee,U as M,Ut as N,V as P,Vt as F,W as I,Wt as te,X as ne,Xt as re,Y as ie,Z as ae,Zt as oe,_n as se,an as ce,b as L,bn as le,bt as ue,c as de,cn as fe,ct as pe,dn as R,dt as me,en as he,et as ge,fn as _e,ft as ve,gn as ye,gt as be,h as xe,in as Se,it as Ce,j as z,k as we,ln as Te,lt as Ee,nt as De,pt as Oe,q as ke,qt as B,rt as Ae,s as je,st as V,tn as Me,tt as Ne,ut as Pe,v as H,vn as Fe,vt as Ie,w as Le,wn as Re,wt as U,x as W,xn as ze,xt as Be,y as Ve,yn as He,yt as Ue,z as We,zt as Ge}from"./DiffPanelShell-W5nEVL52.js";import{Pn as Ke}from"./CompositeItem-UKxcvvWv.js";var qe=Ke(`columns-2`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M12 3v18`,key:`108xh3`}]]),Je=Ke(`rows-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M21 9H3`,key:`1338ky`}],[`path`,{d:`M21 15H3`,key:`9uk58r`}]]),Ye=Ke(`text-wrap`,[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]]),Xe=new TextEncoder,Ze=new TextDecoder(`utf-8`,{ignoreBOM:!0}),Qe=/[\uD800-\uDFFF]/,$e=1024,G=new Uint8Array($e);function et(){G.length!==$e&&(G=new Uint8Array($e))}function K(e){if(e.length===0)return e;if(Qe.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;G.length<t&&(G=new Uint8Array(t));let{written:n}=Xe.encodeInto(e,G);return Ze.decode(G.subarray(0,n))}var tt=4096,nt=.5;function rt(e){for(let t of e.hunks){for(let n=0;n<t.hunkContent.length;n++){let r=t.hunkContent[n];if(r.type!==`change`)continue;let i=at(e,r);i!=null&&(t.hunkContent.splice(n,1,...i),n+=i.length-1)}it(t,e)}}function it(e,t){let{hunkContent:n}=e;for(let e=1;e<n.length;e++){let r=n[e],i=n[e-1];if(r.type!==`change`||r.additions>0&&r.deletions>0||i.type!==`context`)continue;let a=r.additions>0,o=a?t.additionLines:t.deletionLines,s=a?r.additionLineIndex:r.deletionLineIndex,c=a?r.additions:r.deletions,l=o[s]??``;if(l.trim()!==``)continue;let u=!0;for(let e=1;e<c;e++)if(o[s+e]!==l){u=!1;break}if(!u)continue;let d=0;for(;d<i.lines&&t.additionLines[i.additionLineIndex+i.lines-1-d]===l;)d++;if(d===0||e===1&&d===i.lines)continue;r.additionLineIndex-=d,r.deletionLineIndex-=d;let f=r.additionLineIndex+r.additions,p=r.deletionLineIndex+r.deletions,m=n[e+1];m?.type===`context`?(m.lines+=d,m.additionLineIndex=f,m.deletionLineIndex=p):n.splice(e+1,0,{type:`context`,lines:d,additionLineIndex:f,deletionLineIndex:p}),i.lines-=d,i.lines===0&&(n.splice(e-1,1),e--)}}function at(e,t){let{deletions:n,additions:r,deletionLineIndex:i,additionLineIndex:a}=t,o=Math.min(n,r),s=Math.abs(r-n);if(o===0||s===0||o*(s+1)>tt)return null;let c=[];for(let t=0;t<n;t++)c.push(st(e.deletionLines[i+t]??``));let l=[];for(let t=0;t<r;t++)l.push(st(e.additionLines[a+t]??``));let u=r>n,d=0,f=-1;for(let e=0;e<=s;e++){let t=0;for(let n=0;n<o;n++)t+=ct(c[n+(u?0:e)],l[n+(u?e:0)]);e===0?f=t+o*nt:t>f&&(f=t,d=e)}if(d===0)return null;let p=[],m=(e,t,n,r)=>{(e>0||t>0)&&p.push({type:`change`,deletions:e,additions:t,deletionLineIndex:n,additionLineIndex:r})};return u?(m(0,d,i,a),m(o,o,i,a+d),m(0,r-o-d,i+o,a+d+o)):(m(d,0,i,a),m(o,o,i+d,a),m(n-o-d,0,i+d+o,a+o)),p}var ot=/\s+/g;function st(e){return e.replace(ot,``)}function ct(e,t){if(e===t)return 1;let n=Math.max(e.length,t.length),r=Math.min(e.length,t.length);if(r===0)return 0;let i=0;for(;i<r&&e[i]===t[i];)i++;let a=0;for(;a<r-i&&e[e.length-1-a]===t[t.length-1-a];)a++;return(i+a)/n}function lt(e,t,n){try{return ut(e,t,n)}finally{et()}}function ut(e,t,n=!1){let r=Ot(e),i=r?_t(e):vt(e),a,o=[];for(let e of i){if(r&&!He.test(e)){if(a==null)a=K(e);else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}if(!r&&!yt(e)){if(a==null)a=K(e);else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}let i=ft(e,{cacheKey:t==null?void 0:`${t}-${o.length}`,isGitDiff:r,throwOnError:n});i!=null&&o.push(i)}return{patchMetadata:a,files:o}}function dt(e,t){try{return ft(e,t)}finally{et()}}function ft(e,{cacheKey:t,isGitDiff:n=He.test(e),oldFile:r,newFile:i,throwOnError:a=!1}={}){let o=0,c=kt(e,`@@ `),l,u=r==null||i==null,d=0,f=0;for(let e of c){let c=gt(e),m=c[0];if(m==null){if(a)throw Error(`parsePatchContent: invalid hunk`);console.error(`parsePatchContent: invalid hunk`,e);continue}let h=Tt(m),g=0,_=0;if(h==null||l==null){if(l!=null){if(a)throw Error(`parsePatchContent: Invalid hunk`);console.error(`parsePatchContent: Invalid hunk`,e);continue}l={name:``,type:`change`,hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:u,additionLines:!u&&r!=null&&i!=null?ht(i.contents):[],deletionLines:!u&&r!=null&&i!=null?ht(r.contents):[],cacheKey:jt(t)},l.additionLines.length===1&&i?.contents===``&&(l.additionLines.length=0),l.deletionLines.length===1&&r?.contents===``&&(l.deletionLines.length=0);for(let e of c){if(e.startsWith(`diff --git`)){let t=e.trim().match(Me),n=t?.[1]??t?.[2],r=t?.[3]??t?.[4];if(n==null||r==null){if(a)throw Error(`parsePatchContent: invalid git diff header`);console.error(`parsePatchContent: invalid git diff header`,e);continue}l.name=K(r.trim()),n!==r&&(l.prevName=K(n.trim()));continue}let t=e.startsWith(`---`)||e.startsWith(`+++`)?e.match(n?Fe:se):null;if(t!=null){let[,e,n]=t;if(e===`---`&&n!==`/dev/null`){let e=K(n.trim());l.prevName=e,l.name=e}else e===`+++`&&n!==`/dev/null`&&(l.name=K(n.trim()))}else if(n){if(e.startsWith(`new mode `)&&(l.mode=K(e.slice(8).trim())),e.startsWith(`old mode `)&&(l.prevMode=K(e.slice(8).trim())),e.startsWith(`new file mode`)&&(l.type=`new`,l.mode=K(e.slice(13).trim())),e.startsWith(`deleted file mode`)&&(l.type=`deleted`,l.mode=K(e.slice(17).trim())),e.startsWith(`similarity index`)&&(e.startsWith(`similarity index 100%`)?l.type=`rename-pure`:l.type=`rename-changed`),e.startsWith(`index `)){let[,t,n,r]=e.trim().match(s)??[];t!=null&&(l.prevObjectId=K(t)),n!=null&&(l.newObjectId=K(n)),r!=null&&(l.mode=K(r))}e.startsWith(`rename from `)&&(l.prevName=K(e.slice(12).trim())),e.startsWith(`rename to `)&&(l.name=K(e.slice(10).trim()))}}continue}let v,b;for(;c.length>0&&(c[c.length-1]===`
|
|
2
|
+
`||c[c.length-1]===`\r`||c[c.length-1]===`\r
|
|
3
|
+
`||c[c.length-1]===``);)c.pop();let{additionStart:x,deletionStart:S}=h;d=u?d:S-1,f=u?f:x-1;let C={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:h.additionCount,additionStart:x,additionLines:g,deletionCount:h.deletionCount,deletionStart:S,deletionLines:_,deletionLineIndex:d,additionLineIndex:f,hunkContent:[],hunkContext:jt(h.hunkContext),hunkSpecs:K(m),noEOFCRAdditions:!1,noEOFCRDeletions:!1},w=0,T=0;for(let e=1;e<c.length;e++){let t=c[e];if(w>=C.additionCount&&T>=C.deletionCount&&!t.startsWith(`\\`)){if(a&&Ct(t)&&!wt(t))throw Error(`parsePatchContent: hunk has more lines than expected`);break}let n=t[0];if(n!==`+`&&n!==`-`&&n!==` `&&n!==`\\`){if(a)throw Error(`parsePatchContent: invalid hunk line`);console.error(`parseLineType: Invalid firstChar: "${n}", full line: "${t}"`),console.error(`processFile: invalid rawLine:`,t);continue}let r=Mt(n);if(r===`addition`){if(a&&w>=C.additionCount)throw Error(`parsePatchContent: hunk has too many addition lines`);let e=Nt(t);(v==null||v.type!==`change`)&&(v=Pt(`change`,d,f),C.hunkContent.push(v)),f++,w++,u&&l.additionLines.push(e),v.additions++,g++,b=`addition`}else if(r===`deletion`){if(a&&T>=C.deletionCount)throw Error(`parsePatchContent: hunk has too many deletion lines`);let e=Nt(t);(v==null||v.type!==`change`)&&(v=Pt(`change`,d,f),C.hunkContent.push(v)),d++,T++,u&&l.deletionLines.push(e),v.deletions++,_++,b=`deletion`}else if(r===`context`){if(a&&(T>=C.deletionCount||w>=C.additionCount))throw Error(`parsePatchContent: hunk has too many context lines`);let e=Nt(t);(v==null||v.type!==`context`)&&(v=Pt(`context`,d,f),C.hunkContent.push(v)),f++,d++,w++,T++,u&&(l.deletionLines.push(e),l.additionLines.push(e)),v.lines++,b=`context`}else if(r===`metadata`&&v!=null){if(v.type===`context`?(C.noEOFCRAdditions=!0,C.noEOFCRDeletions=!0):b===`deletion`?C.noEOFCRDeletions=!0:b===`addition`&&(C.noEOFCRAdditions=!0),u&&(b===`addition`||b===`context`)){let e=l.additionLines.length-1;e>=0&&(l.additionLines[e]=B(l.additionLines[e]))}if(u&&(b===`deletion`||b===`context`)){let e=l.deletionLines.length-1;e>=0&&(l.deletionLines[e]=B(l.deletionLines[e]))}}}if(a&&(w!==C.additionCount||T!==C.deletionCount))throw Error(`parsePatchContent: hunk line count mismatch`);C.additionLines=g,C.deletionLines=_,C.collapsedBefore=Math.max(y(C.additionStart,C.additionCount)-o,0),l.hunks.push(C),o=p(C.additionStart,C.additionCount);for(let e of C.hunkContent)e.type===`context`?(C.splitLineCount+=e.lines,C.unifiedLineCount+=e.lines):(C.splitLineCount+=Math.max(e.additions,e.deletions),C.unifiedLineCount+=e.deletions+e.additions);C.splitLineStart=l.splitLineCount+C.collapsedBefore,C.unifiedLineStart=l.unifiedLineCount+C.collapsedBefore,l.splitLineCount+=C.collapsedBefore+C.splitLineCount,l.unifiedLineCount+=C.collapsedBefore+C.unifiedLineCount}if(l!=null){if(a&&u&&!n&&l.hunks.length===0)throw Error(`parsePatchContent: unified file has no hunks`);if(l.hunks.length>0&&!u&&l.additionLines.length>0&&l.deletionLines.length>0){let e=l.hunks[l.hunks.length-1],t=p(e.additionStart,e.additionCount),n=l.additionLines.length,r=Math.max(n-t,0);l.splitLineCount+=r,l.unifiedLineCount+=r}return n||(l.prevName!=null&&l.name!==l.prevName?l.hunks.length>0?l.type=`rename-changed`:l.type=`rename-pure`:(r==null||r.contents===``)&&i!=null&&i.contents!==``?l.type=`new`:r!=null&&r.contents!==``&&(i==null||i.contents===``)&&(l.type=`deleted`)),l.type!==`rename-pure`&&l.type!==`rename-changed`&&(l.prevName=void 0),rt(l),l}}function pt(e,t,n=!1){let r=[],i=mt(e)?e.split(Se):[e];for(let e of i)try{r.push(lt(e,t==null?void 0:`${t}-${r.length}`,n))}catch(e){if(n)throw e;console.error(e)}return r}function mt(e){return e.startsWith(`From `)||e.includes(`
|
|
4
|
+
From `)}function ht(e){let t=gt(e);for(let e=0;e<t.length;e++)t[e]=K(t[e]);return t}function gt(e){if(e.length===0)return[``];let t=[],n=0;for(;;){let r=e.indexOf(`
|
|
5
|
+
`,n);if(r===-1)break;t.push(e.slice(n,r+1)),n=r+1}return n<e.length&&t.push(e.slice(n)),t}function _t(e){return kt(e,`diff --git`)}function vt(e){if(e.length===0)return[``];let t=[],n=0,r=0,i=0,a=0,o=!1;for(;r<e.length;){let s=St(e,r);if(i<=0&&a<=0){if(bt(e,r)){r>n&&t.push(e.slice(n,r)),n=r,o=!0,r=St(e,s);continue}if(o&&e.startsWith(`@@ -`,r)){let t=Tt(e.slice(r,s));t!=null&&(i=t.deletionCount,a=t.additionCount)}r=s;continue}let c=e[r];if(c===`\\`){r=s;continue}c===` `?(i=Math.max(i-1,0),a=Math.max(a-1,0)):c===`-`?i=Math.max(i-1,0):c===`+`&&(a=Math.max(a-1,0)),r=s}return t.push(e.slice(n)),t}function yt(e){return bt(e,0)}function bt(e,t){let n=St(e,t);return xt(e,t,`---`)&&xt(e,n,`+++`)}function xt(e,t,n){if(!e.startsWith(n,t))return!1;let r=e[t+n.length];if(r!==` `&&r!==` `)return!1;for(let r=t+n.length+1;r<e.length;r++){let t=e[r];if(t===`
|
|
6
|
+
`||t===`\r`)break;if(t!==` `&&t!==` `)return!0}return!1}function St(e,t){let n=e.indexOf(`
|
|
7
|
+
`,t);return n===-1?e.length:n+1}function Ct(e){let t=e[0];return t===`+`||t===`-`||t===` `}function wt(e){if(!e.startsWith(`--`))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==` `&&n!==` `&&n!==`
|
|
8
|
+
`&&n!==`\r`)return!1}return!0}function Tt(e){if(!e.startsWith(`@@ -`))return;let t=4,n=Et(e,t);if(n==null)return;let r=n.value;t=n.endIndex;let i=1;if(e[t]===`,`){let n=Et(e,t+1);if(n==null)return;i=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`+`)return;t+=2;let a=Et(e,t);if(a==null)return;let o=a.value;t=a.endIndex;let s=1;if(e[t]===`,`){let n=Et(e,t+1);if(n==null)return;s=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`@`||e[t+2]!==`@`)return;let c,l=t+3;return e[l]===` `&&(c=Dt(e.slice(l+1))),{additionCount:s,additionStart:o,deletionCount:i,deletionStart:r,hunkContext:c}}function Et(e,t){let n=t,r=0;for(;n<e.length;n++){let t=e.charCodeAt(n)-48;if(t<0||t>9)break;r=r*10+t}if(n!==t)return{value:r,endIndex:n}}function Dt(e){return e.endsWith(`\r
|
|
9
|
+
`)?e.slice(0,-2):e.endsWith(`
|
|
10
|
+
`)?e.slice(0,-1):e}function Ot(e){return e.startsWith(`diff --git`)||e.includes(`
|
|
11
|
+
diff --git`)}function kt(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.startsWith(t)?0:At(e,n,0);if(r===-1)return[e];let i=[];r>0&&i.push(e.slice(0,r));let a=r;for(;;){let t=At(e,n,a+1);if(t===-1)break;i.push(e.slice(a,t)),a=t}return i.push(e.slice(a)),i}function At(e,t,n){let r=e.indexOf(t,n);return r===-1?-1:r+1}function jt(e){return e==null?e:K(e)}function Mt(e){return e===` `?`context`:e===`\\`?`metadata`:e===`+`?`addition`:`deletion`}function Nt(e){let t=e.slice(1);return K(t===``?`
|
|
12
|
+
`:t)}function Pt(e,t,n){return e===`change`?{type:`change`,additions:0,deletions:0,additionLineIndex:n,deletionLineIndex:t}:{type:`context`,lines:0,additionLineIndex:n,deletionLineIndex:t}}var Ft=`/dev/null`;function q(e,t,n,r=!1){if(e===null&&t===null)throw Error(`parseDiffFromFile: You must pass oldFile, newFile, or both`);let i=e??It(),a=t??It(),o=dt(te(i.name,a.name,i.contents,a.contents,i.header,a.header,n),{cacheKey:(()=>{let n=e?.cacheKey??e?.name,r=t?.cacheKey??t?.name;return n!=null&&r!=null?n+`:`+r:n??r})(),oldFile:i,newFile:a,throwOnError:r});if(o==null)throw Error(`parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?`);e===null?(o.type=`new`,o.prevName=void 0):t===null&&(o.type=`deleted`,o.prevName=void 0);let s=t?.lang??(t===null?e?.lang:void 0);return s!=null&&(o.lang=s),o}function It(){return{name:Ft,contents:``}}function Lt(e){return{...e,hunks:e.hunks.map(e=>({...e,hunkContent:e.hunkContent.map(e=>({...e}))})),deletionLines:[...e.deletionLines],additionLines:[...e.additionLines]}}function Rt(e){return e===``?[]:e.split(Re)}function zt(e,t,n){let r=e===`clone`?Lt(t):t;if(!r.isPartial)throw Error(`hydratePartialDiff: fileDiff must be partial`);switch(r.type){case`change`:case`rename-changed`:return Bt(r,Ht(r,n),Ut(r,n));case`rename-pure`:{let e=Ut(r,n);Wt(r,n);let t=Rt(e.contents);return r.isPartial=!1,r.deletionLines=t,r.additionLines=t,Kt(r,null,e),r}}throw Error(`hydratePartialDiff: ${r.type} diffs cannot be hydrated from loaded files`)}function Bt(e,t,n){let r=Rt(t.contents),i=Rt(n.contents),{hunks:a,splitLineCount:o,unifiedLineCount:s}=Vt(e.hunks,i.length);return e.hunks=a,e.splitLineCount=o,e.unifiedLineCount=s,e.isPartial=!1,e.deletionLines=r,e.additionLines=i,Kt(e,t,n),e}function Vt(e,t){let n=0,r=0,i=0,a=[];for(let t of e){let e=Math.max(t.additionStart-1,0),o=Math.max(t.deletionStart-1,0),s=e,c=o,l=0,u=0,d=0,f=0,m=[];for(let e of t.hunkContent){if(e.type===`context`){m.push({...e,additionLineIndex:s,deletionLineIndex:c}),s+=e.lines,c+=e.lines,d+=e.lines,f+=e.lines;continue}m.push({...e,additionLineIndex:s,deletionLineIndex:c}),s+=e.additions,c+=e.deletions,l+=e.additions,u+=e.deletions,d+=Math.max(e.additions,e.deletions),f+=e.additions+e.deletions}let h=Math.max(y(t.additionStart,t.additionCount)-i,0);a.push({...t,collapsedBefore:h,additionLineIndex:e,deletionLineIndex:o,additionLines:l,deletionLines:u,hunkContent:m,splitLineStart:n+h,unifiedLineStart:r+h,splitLineCount:d,unifiedLineCount:f}),n+=h+d,r+=h+f,i=p(t.additionStart,t.additionCount)}if(a.length>0){let e=a[a.length-1],i=p(e.additionStart,e.additionCount),o=Math.max(t-i,0);n+=o,r+=o}return{hunks:a,splitLineCount:n,unifiedLineCount:r}}function Ht(e,t){if(t.oldFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile`);return t.oldFile}function Ut(e,t){if(t.newFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires newFile`);return t.newFile}function Wt(e,t){if(t.oldFile!==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile to be null`)}function Gt(e,t,n){return e.cacheKey==null?qt(t,n):`${e.cacheKey}:hydrated`}function Kt(e,t,n){let r=Gt(e,t,n);if(r==null){delete e.cacheKey;return}e.cacheKey=r}function qt(e,t){return e!=null&&t!=null?e.cacheKey!=null&&t.cacheKey!=null?`${e.cacheKey}:${t.cacheKey}`:void 0:e?.cacheKey??t?.cacheKey}var Jt=class{isDeletionsScrolling=!1;isAdditionsScrolling=!1;timeoutId=-1;codeDeletions;codeAdditions;enabled=!1;cleanUp(){this.enabled&&=(this.codeDeletions?.removeEventListener(`scroll`,this.handleDeletionsScroll),this.codeAdditions?.removeEventListener(`scroll`,this.handleAdditionsScroll),clearTimeout(this.timeoutId),this.codeDeletions=void 0,this.codeAdditions=void 0,!1)}setup(e,t,n){if(t==null||n==null)for(let r of e.children??[])r instanceof HTMLElement&&(`deletions`in r.dataset?t=r:`additions`in r.dataset&&(n=r));if(n==null||t==null){this.cleanUp();return}this.codeDeletions!==t&&(this.codeDeletions?.removeEventListener(`scroll`,this.handleDeletionsScroll),this.codeDeletions=t,t.addEventListener(`scroll`,this.handleDeletionsScroll,{passive:!0})),this.codeAdditions!==n&&(this.codeAdditions?.removeEventListener(`scroll`,this.handleAdditionsScroll),this.codeAdditions=n,n.addEventListener(`scroll`,this.handleAdditionsScroll,{passive:!0})),this.enabled=!0}handleDeletionsScroll=()=>{this.isAdditionsScrolling||(this.isDeletionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isDeletionsScrolling=!1},300),this.codeAdditions?.scrollTo({left:this.codeDeletions?.scrollLeft}))};handleAdditionsScroll=()=>{this.isDeletionsScrolling||(this.isAdditionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isAdditionsScrolling=!1},300),this.codeDeletions?.scrollTo({left:this.codeAdditions?.scrollLeft}))}};function Yt(e){return a({tagName:`div`,properties:{"data-content-buffer":``,"data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function Xt(e){return a({tagName:`div`,children:[a({tagName:`span`,children:[h(`No newline at end of file`)]})],properties:{"data-no-newline":``,"data-line-type":e,"data-column-content":``}})}function Zt(e){return a({tagName:`div`,children:[F({name:e===`both`?`diffs-icon-expand-all`:`diffs-icon-expand`,properties:{"data-icon":``}})],properties:{role:`button`,"data-expand-button":``,"data-expand-both":e===`both`?``:void 0,"data-expand-up":e===`up`?``:void 0,"data-expand-down":e===`down`?``:void 0}})}function J({type:e,content:t,expandIndex:n,chunked:r=!1,slotName:i,isFirstHunk:o,isLastHunk:s}){let c=0,l=[];if(e===`metadata`&&t!=null&&l.push(a({tagName:`div`,children:[h(t)],properties:{"data-separator-wrapper":``}})),(e===`line-info`||e===`line-info-basic`)&&t!=null){let e=[];n!=null&&(r?(o||(e.push(Zt(`up`)),c++),s||(e.push(Zt(`down`)),c++)):(e.push(Zt(!o&&!s?`both`:o?`down`:`up`)),c++)),e.push(a({tagName:`div`,children:[a({tagName:`span`,children:[h(t)],properties:{"data-unmodified-lines":``}})],properties:{"data-separator-content":``}})),r&&n!=null&&e.push(a({tagName:`div`,children:[h(`Expand all`)],properties:{role:`button`,"data-expand-button":``,"data-expand-all-button":``}})),l.push(a({tagName:`div`,children:e,properties:{"data-separator-wrapper":``,"data-separator-multi-button":c>1?``:void 0}}))}return e===`custom`&&i!=null&&l.push(a({tagName:`slot`,properties:{name:i}})),a({tagName:`div`,children:l,properties:{"data-separator":l.length===0?`simple`:e,"data-expand-index":n,"data-separator-first":o?``:void 0,"data-separator-last":s?``:void 0}})}function Qt(e,t){return`hunk-separator-${e}-${t}`}function $t(e){let t=e.at(-1);return t==null?0:Math.max(p(t.additionStart,t.additionCount),p(t.deletionStart,t.deletionCount))}function en(e){return e.startingLine===0&&e.totalLines===1/0&&e.bufferBefore===0&&e.bufferAfter===0}function Y(e,t){let n=q({name:e.prevName??e.name,contents:e.deletionLines.join(``)},{name:e.name,contents:e.additionLines.join(``),lang:e.lang},t);return{hunks:n.hunks,splitLineCount:n.splitLineCount,unifiedLineCount:n.unifiedLineCount,additionLines:n.additionLines,deletionLines:n.deletionLines,type:n.type}}function tn(e,t){let n=Math.max(e,1),r=Array.from({length:n},(e,t)=>`${` `.repeat(t+1)}\n`).join(``);return r===t&&(r=Array.from({length:n},(e,t)=>`\u0000${` `.repeat(t)}\n`).join(``)),r}function nn(e){for(let t of e)if(t.trim().length>0)return!1;return!0}function rn(e,t){return t.length>0&&t.length<e.deletionLines.length&&nn(t)}function an(e,t,n){let r=e.deletionLines.join(``),i=tn(t.length,r),a=q({name:e.prevName??e.name,contents:r},{name:e.name,contents:i,lang:e.lang},n);return{hunks:a.hunks,splitLineCount:a.splitLineCount,unifiedLineCount:a.unifiedLineCount,additionLines:t,deletionLines:a.deletionLines,type:a.type}}function on(e,t){return an(e,[``],t)}function sn(e,t){if(e.additionLines.length===0)return on(e,t);if(rn(e,e.additionLines))return an(e,e.additionLines,t);let n=e.additionLines,r=Y(e,t);return ln(r,n),r}function cn(e){return e.length>1&&e.at(-1)===``}function ln(e,t){if(!cn(t))return;let n=t.length-e.additionLines.length;if(n<=0)return;let r=e.additionLines.length,i=e.hunks.at(-1);if(i!=null&&p(i.additionStart,i.additionCount)===r){for(let a of i.hunkContent)if(a.type===`change`&&a.additions<a.deletions&&a.additionLineIndex+a.additions===r){e.additionLines=t,a.additions+=n,i.additionCount+=n,i.additionLines+=n,vn(e);return}}}function un(e,t,n){if(e.isPartial||e.deletionLines.length!==e.additionLines.length)return X(e,Y(e,n));let r=Array.from(t);if(r.length===0)return X(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type});for(let t of r){let r=e.additionLines[t],i=e.deletionLines[t];if(r==null||i==null||B(r)===B(i))return X(e,Y(e,n))}let i=dn(e,r);if(i.size===0)return X(e,Y(e,n));for(let t of i)if(!pn(e,t,n))return X(e,Y(e,n));return vn(e),w(e)?X(e,Y(e,n)):X(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type})}function X(e,t){return Object.assign(e,t),t}function dn(e,t){let n=new Set;for(let r of t){let t=fn(e,r);if(t==null)return new Set;n.add(t)}return n}function fn(e,t){for(let[n,r]of e.hunks.entries()){let e=r.additionLineIndex+r.additionCount;if(t>=r.additionLineIndex&&t<e)return n}}function pn(e,t,n){let r=e.hunks[t];if(r==null)return!1;let i=e.deletionLines.slice(r.deletionLineIndex,r.deletionLineIndex+r.deletionCount),a=e.additionLines.slice(r.additionLineIndex,r.additionLineIndex+r.additionCount),o=q({name:e.prevName??e.name,contents:i.join(``)},{name:e.name,contents:a.join(``),lang:e.lang},{...n,context:0}),s=o.hunks[0];return s==null||o.hunks.length!==1?!1:(hn(r,s),mn(e,t),!0)}function mn(e,t){let n=e.hunks[t];if(n==null)return;if(t!==e.hunks.length-1){n.noEOFCRAdditions=!1,n.noEOFCRDeletions=!1;return}let r=e.additionLines.at(-1),i=e.deletionLines.at(-1);n.noEOFCRAdditions=r!=null&&r!==``&&!r.endsWith(`
|
|
13
|
+
`),n.noEOFCRDeletions=i!=null&&i!==``&&!i.endsWith(`
|
|
14
|
+
`)}function hn(e,t){let n=e.additionLineIndex,r=e.deletionLineIndex;e.hunkContent=t.hunkContent.map(e=>gn(e,n,r)),e.additionLineIndex=n+t.additionLineIndex,e.additionStart+=t.additionLineIndex,e.additionCount=t.additionCount,e.additionLines=t.additionLines,t.deletionLineIndex>=0&&(e.deletionLineIndex=r+t.deletionLineIndex,e.deletionStart+=t.deletionLineIndex),e.deletionCount=t.deletionCount,e.deletionLines=t.deletionLines,e.noEOFCRAdditions=t.noEOFCRAdditions,e.noEOFCRDeletions=t.noEOFCRDeletions,_n(e)}function gn(e,t,n){return{...e,additionLineIndex:e.additionLineIndex+t,deletionLineIndex:e.deletionLineIndex+n}}function _n(e){let t=0,n=0;for(let r of e.hunkContent)r.type===`context`?(t+=r.lines,n+=r.lines):(t+=Math.max(r.additions,r.deletions),n+=r.additions+r.deletions);e.splitLineCount=t,e.unifiedLineCount=n}function vn(e){let t=0,n=0,r=0;for(let i of e.hunks)i.collapsedBefore=Math.max(y(i.additionStart,i.additionCount)-r,0),i.splitLineStart=t+i.collapsedBefore,i.unifiedLineStart=n+i.collapsedBefore,_n(i),t+=i.collapsedBefore+i.splitLineCount,n+=i.collapsedBefore+i.unifiedLineCount,r=p(i.additionStart,i.additionCount);if(e.hunks.length>0){let r=e.hunks[e.hunks.length-1],i=Math.max(e.additionLines.length-p(r.additionStart,r.additionCount),0);t+=i,n+=i}e.splitLineCount=t,e.unifiedLineCount=n}var yn=new WeakMap;function bn(e){return e.length>1&&e[e.length-1]===``?e.slice(0,-1):e}function xn(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r++;let i=e.length,a=t.length;for(;i>r&&a>r&&e[i-1]===t[a-1];)i--,a--;if(r!==i||r!==a)return{start:r,deletionEnd:i,additionEnd:a}}function Sn(e,t){let n=e.hunks,r=e.additionLines,i=bn(r),a=i===r?e:{...e,additionLines:i},o=Mn(n,jn(a,t),e.deletionLines.length),s=Fn(a,o);if(e.additionLines=i,e.hunks=s,e.editSessionDirty=!0,Wn(e),ln(e,r),Rn(n,e.hunks))return{regions:o.map(e=>e.previousSpan)}}function Cn(e,t,n,r){let i=Array.from(new Set(t)).filter(t=>t>=0&&t<e.additionLines.length).sort((e,t)=>e-t);if(i.length===0)return;let{hunks:a}=e,o,s=0;for(let t of i){for(;s<a.length;){let e=a[s];if(t<Vn(e)+e.additionCount)break;s++}let r=a[s],i=r==null?void 0:Vn(r);if(i==null||t<i||o!=null&&o!==s)return Sn(e,n);o=s}if(o!=null){if(wn(e,i,o,r,n)){e.editSessionDirty=!0;return}return Sn(e,n)}}function wn(e,t,n,r,i){if(r==null||i?.ignoreWhitespace===!0||i?.stripTrailingCr===!0)return!1;let a=Tn(e),o=e.hunks[n];if(o.hunkContent.some(En))return!1;for(let n of t){let t=r.get(n),i=e.additionLines[n];if(t==null||i==null||a.has(t)||a.has(i))return!1;let s=!1;for(let e of o.hunkContent)if(e.type===`change`&&e.additions===e.deletions&&n>=e.additionLineIndex&&n<e.additionLineIndex+e.additions){s=!0;break}if(!s)return!1}return!0}function Tn(e){let t=yn.get(e);if(t?.lines===e.deletionLines)return t.set;let n=new Set(e.deletionLines);return yn.set(e,{lines:e.deletionLines,set:n}),n}function En(e){return e?.type===`change`&&(e.additions===0||e.deletions===0)}function Dn(e,t){let n=new Map,{regions:r}=t;for(let t=0;t<=r.length;t++){let i=r[t-1],a=r[t],o=t===0?e.get(0):i==null?void 0:e.get(i.lastIndex+1),s=a==null?void 0:e.get(a.firstIndex),c=o?.fromStart??0,l=s?.fromEnd??0;(c>0||l>0)&&n.set(t,{fromStart:c,fromEnd:l})}return n}function On(e,t,n){let r=[];if(e.isPartial)return r;for(let[i,a]of e.hunks.entries()){let o=W({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:t,hunkIndex:i,collapsedContextThreshold:n});if(o.rangeSize<=n)continue;let s=Z(a),c=s-o.rangeSize;o.fromStart>0&&r.push([c,c+o.fromStart]),o.fromEnd>0&&r.push([s-o.fromEnd,s])}let i=u({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:`captureExpansionAnchors`});if(i!=null&&i.fromStart>0&&i.rangeSize>n){let t=e.hunks[e.hunks.length-1],n=Z(t)+t.deletionCount;r.push([n,n+i.fromStart])}return r}function kn(e,t){let n=new Map;if(t.length===0)return n;let r=(e,r,i)=>{if(i<=r)return;let a=0,o=0;for(let[e,n]of t)n<=r||e>=i||(e<=r&&(a=Math.max(a,Math.min(n,i)-r)),n>=i&&(o=Math.max(o,i-Math.max(e,r))));(a>0||o>0)&&n.set(e,{fromStart:a,fromEnd:o})};for(let[t,n]of e.hunks.entries()){let e=Z(n);r(t,e-Math.max(n.collapsedBefore,0),e)}let i=e.hunks[e.hunks.length-1];return i!=null&&!e.isPartial&&e.deletionLines.length>0&&r(e.hunks.length,Z(i)+i.deletionCount,e.deletionLines.length),n}function An(e,t){return e.editSessionDirty===!0&&(e.editSessionDirty=void 0,Object.assign(e,e.additionLines.length<=1&&e.additionLines.join(``)===``?Y(e,t):sn(e,t)),!0)}function jn(e,t){if(xn(e.deletionLines,e.additionLines)==null)return[];let n=q({name:e.prevName??e.name,contents:e.deletionLines.join(``)},{name:e.name,contents:e.additionLines.join(``),lang:e.lang},t),r=[],i=0,a=0;for(let e of n.hunks){let t=e.additionCount>0?e.additionLineIndex-i:e.deletionLineIndex-a;i+=t,a+=t;for(let t of e.hunkContent){if(t.type===`context`){i+=t.lines,a+=t.lines;continue}let e=gn(t,0,0);e.additions===0&&(e.additionLineIndex=i),e.deletions===0&&(e.deletionLineIndex=a),r.push(e),i+=e.additions,a+=e.deletions}}return r}function Mn(e,t,n){let r=e.map((e,t)=>{let n=Z(e);return{deletionStart:n,deletionEnd:n+e.deletionCount,blocks:[],previousSpan:{firstIndex:t,lastIndex:t}}}),i=[],a=0;for(let e of t){let t=e.deletionLineIndex,o=t+e.deletions;for(;a<r.length&&r[a].deletionEnd<t;)i.push(r[a]),a++;let s=i.length>0&&Nn(t,o,i[i.length-1])?i.pop():void 0;for(;a<r.length&&r[a].deletionStart<=o;)s=Pn(s,r[a]),a++;if(s==null){let c=t,l=o;if((e.deletions===0||e.additions===0)&&n>e.deletions){let e=i[i.length-1]?.deletionEnd??0,s=r[a]?.deletionStart??n;t>e?c--:o<s&&l++}s={deletionStart:c,deletionEnd:l,blocks:[],previousSpan:void 0}}s.deletionStart=Math.min(s.deletionStart,t),s.deletionEnd=Math.max(s.deletionEnd,o),s.blocks.push(e),i.push(s)}for(;a<r.length;)i.push(r[a]),a++;return i}function Nn(e,t,n){return e<=n.deletionEnd&&t>=n.deletionStart}function Pn(e,t){return e==null?t:(e.deletionStart=Math.min(e.deletionStart,t.deletionStart),e.deletionEnd=Math.max(e.deletionEnd,t.deletionEnd),e.blocks.push(...t.blocks),t.previousSpan!=null&&(e.previousSpan??={...t.previousSpan},e.previousSpan.firstIndex=Math.min(e.previousSpan.firstIndex,t.previousSpan.firstIndex),e.previousSpan.lastIndex=Math.max(e.previousSpan.lastIndex,t.previousSpan.lastIndex)),e)}function Fn(e,t){let n=[],r=0,i=0;for(let a of t){let t=a.deletionStart-r;if(t<0)throw Error(`buildRegionHunks: overlapping old-side regions`);r+=t,i+=t;let o=i,s=[];for(let e of a.blocks){let t=e.deletionLineIndex-r,n=e.additionLineIndex-i;if(t<0||t!==n)throw Error(`buildRegionHunks: canonical block context mismatch`);Ln(s,t,i,r),r+=t,i+=n,s.push({...e}),r+=e.deletions,i+=e.additions}let c=a.deletionEnd-r;if(c<0)throw Error(`buildRegionHunks: block exceeds its old-side region`);Ln(s,c,i,r),r+=c,i+=c,n.push(In(e,{additionStart:o,additionEnd:i,deletionStart:a.deletionStart,deletionEnd:a.deletionEnd},s))}if(e.deletionLines.length-r!==e.additionLines.length-i)throw Error(`buildRegionHunks: trailing context mismatch`);return n}function In(e,t,n){let r=t.additionEnd-t.additionStart,i=t.deletionEnd-t.deletionStart,a=0,o=0;for(let e of n)e.type===`change`&&(a+=e.additions,o+=e.deletions);let s={collapsedBefore:0,additionStart:Hn(t.additionStart,r),additionCount:r,additionLines:a,additionLineIndex:Un(t.additionStart,r),deletionStart:Hn(t.deletionStart,i),deletionCount:i,deletionLines:o,deletionLineIndex:Un(t.deletionStart,i),hunkContent:n,hunkSpecs:`@@ -${Hn(t.deletionStart,i)},${i} +${Hn(t.additionStart,r)},${r} @@`,splitLineStart:0,splitLineCount:0,unifiedLineStart:0,unifiedLineCount:0,noEOFCRAdditions:!1,noEOFCRDeletions:!1};return _n(s),s}function Ln(e,t,n,r){t>0&&e.push({type:`context`,lines:t,additionLineIndex:n,deletionLineIndex:r})}function Rn(e,t){if(e.length!==t.length)return!0;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(Z(r)!==Z(i)||r.deletionCount!==i.deletionCount||Vn(r)!==Vn(i)||r.additionCount!==i.additionCount||r.splitLineCount!==i.splitLineCount||!zn(r,i))return!0}return!1}function zn(e,t){let n=Bn(e),r=Bn(t);for(;;){let e=n.next(),t=r.next();if(e.done===!0||t.done===!0)return e.done===t.done;if(e.value[0]!==t.value[0]||e.value[1]!==t.value[1])return!1}}function*Bn(e){for(let t of e.hunkContent){if(t.type===`context`){for(let e=0;e<t.lines;e++)yield[t.deletionLineIndex+e,t.additionLineIndex+e];continue}let e=Math.max(t.deletions,t.additions);for(let n=0;n<e;n++)yield[n<t.deletions?t.deletionLineIndex+n:void 0,n<t.additions?t.additionLineIndex+n:void 0]}}function Vn(e){return y(e.additionStart,e.additionCount)}function Z(e){return y(e.deletionStart,e.deletionCount)}function Hn(e,t){return t===0?e:e+1}function Un(e,t){return t===0?e-1:e}function Wn(e){vn(e);for(let t=0;t<e.hunks.length;t++)mn(e,t)}var Gn=-1,Kn=class{options;onRenderUpdate;workerManager;__id=`diff-hunks-renderer:${++Gn}`;highlighter;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLang=`text`;renderCache;editSessionActive=!1;constructor(e={theme:R},t,n){this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=be(e.theme??R)?Ie():void 0)}cleanUp(){this.recycle(),this.expandedHunks.clear(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.highlighter=void 0,this.diff=void 0,this.clearRenderCache(),this.additionAnnotations={},this.deletionAnnotations={},this.workerManager?.cleanUpTasks(this),this.endEditSession()}beginEditSession(){this.editSessionActive=!0;let e=this.diffCache;e!=null&&!e.isPartial&&e.additionLines.length===0&&(Object.assign(e,on(e,this.options.parseDiffOptions)),this.markEditSessionPass(e),this.clearRenderCache())}endEditSession(){this.editSessionActive=!1}editorRenderReady(){return this.renderCache?.options.useTokenTransformer===!0&&this.renderCache.highlighted&&this.renderCache.result!=null}refreshHighlightedResult(){let{renderCache:e}=this;if(e==null||H(e.diff)||sr(e.diff,this.getTokenizeMaxLength()))return Promise.resolve();let{diff:t}=e,{workerManager:n}=this;return!this.editSessionActive&&n?.isWorkingPool()===!0&&t.cacheKey!=null?(n.evictDiffFromCache(t.cacheKey),n.primeDiffHighlightCache(t).then(()=>{this.applyRefreshedResult(t,n.getDiffResultCache(t))}).catch(e=>this.onHighlightError(e))):this.asyncHighlight(t).then(e=>this.applyRefreshedResult(t,e)).catch(e=>this.onHighlightError(e))}applyRefreshedResult(e,t){if(t==null||this.renderCache==null||this.renderCache.diff!==e||this.editSessionActive)return;let{options:n}=this.getRenderOptions(e);r(n,t.options)&&(this.renderCache={diff:e,options:t.options,highlighted:!0,result:t.result,renderRange:void 0},this.onRenderUpdate?.())}get diffCache(){return this.renderCache?.diff??this.diff}clearRenderCache(){let e=this.renderCache;this.renderCache=void 0,e!=null&&e.isDirty===!0&&e.diff.cacheKey!=null&&this.workerManager?.evictDiffFromCache(e.diff.cacheKey)}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}expandHunk(e,t,n=this.getOptionsWithDefaults().expansionLineCount){let r={...this.expandedHunks.get(e)??{fromStart:0,fromEnd:0}};(t===`up`||t===`both`)&&(r.fromStart+=n),(t===`down`||t===`both`)&&(r.fromEnd+=n),this.renderCache?.highlighted!==!0&&this.clearRenderCache(),this.expandedHunks.set(e,r)}getExpandedHunk(e){return this.expandedHunks.get(e)??fe}getExpandedHunksMap(){return this.expandedHunks}setExpandedHunksMap(e){this.expandedHunks=e}setLineAnnotations(e){this.additionAnnotations={},this.deletionAnnotations={};for(let t of e){let e=(()=>{switch(t.side){case`deletions`:return this.deletionAnnotations;case`additions`:return this.additionAnnotations}})(),n=e[t.lineNumber]??[];e[t.lineNumber]=n,n.push(t)}}updateRenderCache(e,t,n=!1){if(this.renderCache==null)return!1;let{result:r,diff:i}=this.renderCache;if(r==null)return!1;if(i.isPartial)throw Error(`Could not update render cache for partial diff`);let a=r.code.additionLines,o=[],s=new Map;for(let[t,n]of e){let e=a[t]?.properties??{},r=n.map(e=>e[2]).join(``),c=t<i.additionLines.length,l=c?i.additionLines[t]??``:``,u=B(l);c&&(i.additionLines[t]=ge(l,r),u!==r&&(o.push(t),s.set(t,l))),a[t]={type:`element`,tagName:`div`,properties:{"data-line":e[`data-line`]??t+1,"data-line-index":e[`data-line-index`]??t,"data-line-type":e[`data-line-type`]??`context`},children:n.map(([e,t,n])=>e===0&&t===``?n===``?{type:`element`,tagName:`br`,properties:{},children:[]}:{type:`text`,value:n}:{type:`element`,tagName:`span`,properties:{"data-char":e,style:`color:${t};`},children:[{type:`text`,value:n}]})}}let c=!1;if(o.length>0)if(this.editSessionActive&&!i.isPartial){if(!n)if(i.additionLines.length<=1&&i.additionLines.join(``)===``)Object.assign(i,on(i,this.options.parseDiffOptions)),this.markEditSessionPass(i),c=!0;else if(rn(i,i.additionLines))Object.assign(i,an(i,i.additionLines,this.options.parseDiffOptions)),this.markEditSessionPass(i),c=!0;else{let e=Cn(i,o,this.options.parseDiffOptions,s);this.applyExpansionRemap(e),c=e!=null}}else Object.assign(i,un(i,o,this.options.parseDiffOptions));return r.baseThemeType=t,this.renderCache.isDirty=!0,c}applyExpansionRemap(e){e!=null&&(this.expandedHunks=Dn(this.expandedHunks,e))}applyDocumentChange(e){if(this.renderCache==null)return;let{diff:t,result:n}=this.renderCache;if(n==null)return;if(t.isPartial)throw Error(`Could not apply document change for partial diff`);let{additionLines:r}=t;t.additionLines=ir(e,r),n.code.additionLines=nr(r,t.additionLines,n.code.additionLines,e),t.additionLines.length<=1&&t.additionLines.join(``)===``?(Object.assign(t,on(t,this.options.parseDiffOptions)),n.code.additionLines[0]=rr(0,e.getLineText(0)),this.markEditSessionPass(t)):this.editSessionActive?this.applySessionDocumentChange(t):Object.assign(t,sn(t,this.options.parseDiffOptions)),this.renderCache.isDirty=!0}applySessionDocumentChange(e){let{parseDiffOptions:t}=this.options,n=e.additionLines;if(rn(e,n)){Object.assign(e,an(e,n,t)),this.markEditSessionPass(e);return}this.applyExpansionRemap(Sn(e,t))}markEditSessionPass(e){this.editSessionActive&&(e.editSessionDirty=!0)}getUnifiedLineDecoration({lineType:e}){return{gutterLineType:e,contentProperties:{"data-line-type":e}}}getSplitLineDecoration({side:e,type:t}){let n=t===`change`?e===`deletions`?`change-deletion`:`change-addition`:t;return{gutterLineType:n,contentProperties:{"data-line-type":n}}}createAnnotationElement=e=>ve(e);getOptionsWithDefaults(){let{diffIndicators:e=`bars`,diffStyle:t=`split`,disableBackground:n=!1,disableFileHeader:r=!1,disableLineNumbers:i=!1,disableVirtualizationBuffers:a=!1,collapsed:o=!1,expandUnchanged:s=!1,collapsedContextThreshold:c=1,expansionLineCount:l=100,hunkSeparators:u=`line-info`,lineDiffType:d=`word-alt`,maxLineDiffLength:f=1e3,overflow:p=`scroll`,stickyHeader:m=!1,theme:h=R,headerRenderMode:g=`default`,tokenizeMaxLineLength:_=1e3,tokenizeMaxLength:v=_e,useTokenTransformer:y=!1,useCSSClasses:b=!1}=this.options;return{diffIndicators:e,diffStyle:t,disableBackground:n,disableFileHeader:r,disableLineNumbers:i,disableVirtualizationBuffers:a,collapsed:o,expandUnchanged:s,collapsedContextThreshold:c,expansionLineCount:l,hunkSeparators:u,lineDiffType:d,maxLineDiffLength:f,overflow:p,stickyHeader:m,theme:this.workerManager?.getDiffRenderOptions().theme??h,headerRenderMode:g,tokenizeMaxLineLength:_,tokenizeMaxLength:v,useTokenTransformer:y,useCSSClasses:b}}async initializeHighlighter(){return this.highlighter=await Ue(pe(this.computedLang,{theme:this.getLocalHighlightTheme(),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter})),this.highlighter}hydrate(e){if(e==null)return;this.diff=e;let{options:t}=this.getRenderOptions(e),n=sr(e,this.getTokenizeMaxLength()),i=this.workerManager?.getDiffResultCache(e);i!=null&&!r(t,i.options)&&(i=void 0),this.renderCache??={diff:e,highlighted:!n&&!H(e),options:t,result:n?void 0:i?.result,renderRange:void 0},!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightDiffAST(this,this.diff):this.highlighter??(this.computedLang=e.lang??Ee(e.name),this.initializeHighlighter())}getLocalHighlightTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??R}getEffectiveCodeOptions(){let e=this.workerManager?.isWorkingPool()===!0?this.workerManager.getDiffRenderOptions():void 0;return{theme:this.getLocalHighlightTheme(),tokenizeMaxLineLength:e?.tokenizeMaxLineLength??this.options.tokenizeMaxLineLength}}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0){let e=this.workerManager.getDiffRenderOptions();return this.editSessionActive&&e.useTokenTransformer!==!0?{...e,useTokenTransformer:!0}:e}let{theme:e,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}=this.getOptionsWithDefaults();return{theme:e,useTokenTransformer:this.editSessionActive||this.options.useTokenTransformer===!0,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}})();this.getOptionsWithDefaults();let{renderCache:n}=this;return n?.result==null||!z(e,n.diff)||!r(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}renderDiff(e=this.renderCache?.diff,t=Te){if(e==null)return;let{expandUnchanged:n,collapsedContextThreshold:r}=this.getOptionsWithDefaults(),{options:i,forceHighlight:a}=this.getRenderOptions(e),o=this.getMatchingWorkerResultCache(e,i);o!=null&&!this.hasHighlightedRenderCache(e,i)&&(this.renderCache={diff:e,highlighted:!0,renderRange:void 0,...o},a=!1),this.renderCache??={diff:e,highlighted:!1,options:i,result:void 0,renderRange:void 0};let s=e.additionLines.length>0||e.deletionLines.length>0,c=!s||H(e)||sr(e,this.getTokenizeMaxLength()),l=!z(e,this.renderCache.diff),u=!Oe(this.renderCache.renderRange,t);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0){let o=this.renderCache.result==null&&this.renderCache.highlighted&&!c&&!l&&en(t);o&&(this.renderCache.highlightPending=!0),!o&&(c||this.renderCache.result==null||!this.renderCache.highlighted&&(l||u))&&(this.renderCache.diff=e,this.renderCache.options=i,this.renderCache.highlighted=!1,(this.renderCache.result==null||l||u||a)&&(this.renderCache.result=this.workerManager.getPlainDiffAST(e,t.startingLine,t.totalLines,en(t)||n?!0:this.expandedHunks,r)),this.renderCache.renderRange=t),!c&&s&&(!this.renderCache.highlighted||a)&&this.workerManager.highlightDiffAST(this,e)}else{this.computedLang=e.lang??Ee(e.name);let t=this.highlighter!=null&&be(i.theme),n=this.highlighter!=null&&ue(this.computedLang),r=!c&&n;if(this.highlighter!=null&&t&&(a||c||!this.renderCache.highlighted&&r||this.renderCache.result==null)){let{result:t,options:i}=this.renderDiffWithHighlighter(e,this.highlighter,c||!n);this.renderCache={diff:e,options:i,highlighted:r,result:t,renderRange:void 0}}(!t||!c&&!n)&&this.asyncHighlight(e).then(({result:t,options:n})=>{this.renderCache!=null&&(this.renderCache.highlighted=!1),this.applyHighlightResult(e,t,n,!c)})}return this.renderCache.result==null?void 0:this.processDiffResult(this.renderCache.diff,t,this.renderCache.result)}async asyncRender(e,t=Te){let{result:n}=await this.asyncHighlight(e);return this.processDiffResult(e,t,n)}createPreElement(e,t,n){let{diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o}=this.getOptionsWithDefaults();return Pe({type:`diff`,diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e){let t=sr(e,this.getTokenizeMaxLength());this.computedLang=t?`text`:e.lang??Ee(e.name);let n=this.highlighter!=null&&be(this.getLocalHighlightTheme()),r=t||this.highlighter!=null&&ue(this.computedLang);return(this.highlighter==null||!n||!r)&&(this.highlighter=await this.initializeHighlighter()),this.renderDiffWithHighlighter(e,this.highlighter,t)}renderDiffWithHighlighter(e,t,n=!1){let{options:r}=this.getRenderOptions(e),{collapsedContextThreshold:i}=this.getOptionsWithDefaults(),a=Ve(e,t,r,{forcePlainText:n,expandedHunks:n?!0:void 0,collapsedContextThreshold:i});if(this.editSessionActive&&e.additionLines.length===1&&e.additionLines[0]===``&&a.code.additionLines[0]==null){let t;if(L({diff:e,diffStyle:`both`,expandedHunks:n?!0:void 0,collapsedContextThreshold:i,callback:({additionLine:e})=>{if(e?.lineIndex===0)return t=e,!0}}),t==null)throw Error(`DiffHunksRenderer: missing empty addition line`);a.code.additionLines[0]=rr(0,``,t.unifiedLineIndex,t.splitLineIndex)}return{result:a,options:r}}onHighlightSuccess(e,t,n,r=!0){this.editSessionActive||this.applyHighlightResult(e,t,n,r)}applyHighlightResult(e,t,n,i=!0){if(this.renderCache==null)return;let a=this.renderCache.highlightPending===!0||!this.renderCache.highlighted||!r(this.renderCache.options,n)||!z(this.renderCache.diff,e);this.renderCache={diff:e,options:n,highlighted:i,result:t,renderRange:void 0},a&&this.onRenderUpdate?.()}getMatchingWorkerResultCache(e,t){if(this.editSessionActive)return;let n=this.workerManager?.getDiffResultCache(e);if(!(n==null||!r(t,n.options)))return n}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&z(e,n.diff)&&r(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}processDiffResult(e,t,{code:n,themeStyles:r,baseThemeType:i}){let{diffStyle:a,disableFileHeader:o,expandUnchanged:s,expansionLineCount:c,collapsedContextThreshold:l,hunkSeparators:u}=this.getOptionsWithDefaults(),d=this.renderCache?.isDirty??!1;this.diff=e;let f=a===`unified`,p=cr(e,this.options.loadDiffFiles!=null),m=!e.isPartial||p,h=[],g=[],_=[],v=[],{additionLines:y,deletionLines:b}=n,S={rowCount:0,hunkSeparators:u,additionsContentAST:h,deletionsContentAST:g,unifiedContentAST:_,unifiedGutterAST:Ge(),deletionsGutterAST:Ge(),additionsGutterAST:Ge(),expansionLineCount:c,hunkData:v,incrementRowCount(e=1){S.rowCount+=e},pushToGutter(e,t){switch(e){case`unified`:S.unifiedGutterAST.children.push(t);break;case`deletions`:S.deletionsGutterAST.children.push(t);break;case`additions`:S.additionsGutterAST.children.push(t)}}},C=ee({fileDiff:e,errorPrefix:`DiffHunksRenderer.processDiffResult`}),w={size:0,side:void 0,increment(){this.size+=1},flush(){if(a!==`unified`){if(this.size<=0||this.side==null){this.side=void 0,this.size=0;return}this.side===`additions`?(S.pushToGutter(`additions`,x(void 0,`buffer`,this.size)),h?.push(Yt(this.size))):(S.pushToGutter(`deletions`,x(void 0,`buffer`,this.size)),g?.push(Yt(this.size))),this.size=0,this.side=void 0}}},T=(e,t,n,r,i)=>{S.pushToGutter(e,O(t,n,r,i))};function E(e){w.flush(),a===`unified`?$n(`unified`,e,S):($n(`deletions`,e,S),$n(`additions`,e,S))}this.pushFileLevelAnnotations(e,a,t,S),L({diff:e,diffStyle:a,startingLine:t.startingLine,totalLines:t.totalLines,expandedHunks:s?!0:this.expandedHunks,collapsedContextThreshold:l,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,additionLine:o,deletionLine:s,type:c})=>{let l=s==null?o.splitLineIndex:s.splitLineIndex,f=o==null?s.unifiedLineIndex:o.unifiedLineIndex;a===`split`&&c!==`change`&&w.flush(),r>0&&E({hunkIndex:t,collapsedLines:r,rangeSize:Math.max(n?.collapsedBefore??0,0),hunkSpecs:n?.hunkSpecs,isFirstHunk:t===0,isLastHunk:!1,isExpandable:m});let h=a===`unified`?f:l,g={type:c,hunkIndex:t,lineIndex:h,unifiedLineIndex:f,splitLineIndex:l,deletionLine:s,additionLine:o};if(a===`unified`){let n=this.getUnifiedInjectedRowsForLine?.(g);n?.before!=null&&Xn(n.before,S);let r=s==null?void 0:b[s.lineIndex],i=o==null?void 0:y[o.lineIndex];if(r==null&&i==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}let a=c===`change`?o==null?`change-deletion`:`change-addition`:c,u=this.getUnifiedLineDecoration({type:c,lineType:a,additionLineIndex:o?.lineIndex,deletionLineIndex:s?.lineIndex});T(`unified`,u.gutterLineType,o==null?s.lineNumber:o.lineNumber,`${f},${l}`,u.gutterProperties),i==null?r!=null&&(r=er(r,u.contentProperties,d&&s!=null?{"data-line":s.lineNumber,"data-line-index":`${f},${l}`}:void 0)):i=er(i,u.contentProperties,d&&o!=null?{"data-line":o.lineNumber,"data-line-index":`${f},${l}`}:void 0),Qn({diffStyle:`unified`,type:c,deletionLine:r,additionLine:i,unifiedSpan:this.getAnnotations(`unified`,s?.lineNumber,o?.lineNumber,t,h),createAnnotationElement:e=>this.createAnnotationElement(e),context:S}),n?.after!=null&&Xn(n.after,S)}else{let n=this.getSplitInjectedRowsForLine?.(g);n?.before!=null&&Zn(n.before,S,w);let r=s==null?void 0:b[s.lineIndex],i=o==null?void 0:y[o.lineIndex],a=this.getSplitLineDecoration({side:`deletions`,type:c,lineIndex:s?.lineIndex}),u=this.getSplitLineDecoration({side:`additions`,type:c,lineIndex:o?.lineIndex});if(r==null&&i==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}let f=(()=>{if(c===`change`){if(i==null)return`additions`;if(r==null)return`deletions`}})();f==null?c===`change`&&w.flush():(w.side!=null&&w.side!==f&&w.flush(),w.side=f,w.increment());let p=this.getAnnotations(`split`,s?.lineNumber,o?.lineNumber,t,h);if(p!=null&&w.size>0&&w.flush(),s!=null){let e=er(r,a.contentProperties,d?{"data-line":s.lineNumber,"data-line-index":`${s.unifiedLineIndex},${l}`}:void 0);T(`deletions`,a.gutterLineType,s.lineNumber,`${s.unifiedLineIndex},${l}`,a.gutterProperties),e!=null&&(r=e)}if(o!=null){let e=er(i,u.contentProperties,d?{"data-line":o.lineNumber,"data-line-index":`${o.unifiedLineIndex},${l}`}:void 0);T(`additions`,u.gutterLineType,o.lineNumber,`${o.unifiedLineIndex},${l}`,u.gutterProperties),e!=null&&(i=e)}Qn({diffStyle:`split`,type:c,additionLine:i,deletionLine:r,...p,createAnnotationElement:e=>this.createAnnotationElement(e),context:S}),n?.after!=null&&Zn(n.after,S,w)}let _=a===`split`&&n!=null&&l===n.splitLineStart+n.splitLineCount-1,v=t===e.hunks.length-1&&n!=null&&(a===`split`?l===n.splitLineStart+n.splitLineCount-1:f===n.unifiedLineStart+n.unifiedLineCount-1),D=_?n.noEOFCRDeletions:!1,O=_?n.noEOFCRAdditions:!1,k=(s?.noEOFCR??!1)||D,A=(o?.noEOFCR??!1)||O;if(A||k){if(a===`split`&&w.flush(),k){let e=c===`context`||c===`context-expanded`?c:`change-deletion`;a===`unified`?(S.unifiedContentAST.push(Xt(e)),S.pushToGutter(`unified`,x(e,`metadata`,1))):(S.deletionsContentAST.push(Xt(e)),S.pushToGutter(`deletions`,x(e,`metadata`,1)),A||(S.pushToGutter(`additions`,x(void 0,`buffer`,1)),S.additionsContentAST.push(Yt(1))))}if(A){let e=c===`context`||c===`context-expanded`?c:`change-addition`;a===`unified`?(S.unifiedContentAST.push(Xt(e)),S.pushToGutter(`unified`,x(e,`metadata`,1))):(S.additionsContentAST.push(Xt(e)),S.pushToGutter(`additions`,x(e,`metadata`,1)),k||(S.pushToGutter(`deletions`,x(void 0,`buffer`,1)),S.deletionsContentAST.push(Yt(1))))}S.incrementRowCount(1)}u!==`simple`&&u!==`metadata`&&(i>0||v&&p)&&E({hunkIndex:c===`context-expanded`?t:t+1,collapsedLines:v&&p?`unknown`:i,rangeSize:C,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:m}),S.incrementRowCount(1)}}),a===`split`&&w.flush();let D=Math.max($t(e.hunks),e.additionLines.length??0,e.deletionLines.length??0),k=t.bufferBefore>0||t.bufferAfter>0,A=!f&&e.type!==`deleted`,j=!f&&e.type!==`new`,M=S.rowCount>0||k;h=A&&M?h:void 0,g=j&&M?g:void 0,_=f&&M?_:void 0;let N=this.createPreElement(g!=null&&h!=null,D);return{unifiedGutterAST:f&&M?S.unifiedGutterAST.children:void 0,unifiedContentAST:_,deletionsGutterAST:j&&M?S.deletionsGutterAST.children:void 0,deletionsContentAST:g,additionsGutterAST:A&&M?S.additionsGutterAST.children:void 0,additionsContentAST:h,hunkData:v,preNode:N,themeStyles:r,baseThemeType:i,headerElement:o?void 0:this.renderHeader(this.diff),totalLines:D,rowCount:S.rowCount,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:``}}renderCodeAST(e,n){let r=e===`unified`?n.unifiedGutterAST:e===`deletions`?n.deletionsGutterAST:n.additionsGutterAST,i=e===`unified`?n.unifiedContentAST:e===`deletions`?n.deletionsContentAST:n.additionsContentAST;if(r==null||i==null)return;let a=Ge(r);return a.properties.style=`grid-row: span ${n.rowCount}`,[a,t(i,n.rowCount)]}renderFullAST(e,t=[]){let n=this.getOptionsWithDefaults().hunkSeparators===`line-info`,r=this.renderCodeAST(`unified`,e);if(r!=null)return t.push(a({tagName:`code`,children:r,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-unified":``}})),{...e.preNode,children:t};let i=this.renderCodeAST(`deletions`,e);i!=null&&t.push(a({tagName:`code`,children:i,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-deletions":``}}));let o=this.renderCodeAST(`additions`,e);return o!=null&&t.push(a({tagName:`code`,children:o,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-additions":``}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return U(this.renderFullAST(e,t))}renderPartialHTML(e,t){return U(t==null?e:a({tagName:`code`,children:e,properties:{"data-code":``,"data-container-size":this.getOptionsWithDefaults().hunkSeparators===`line-info`?``:void 0,[`data-${t}`]:``}}))}pushFileLevelAnnotations(e,t,n,r){if(!Ce(n))return;let i=e.type===`new`?[]:qn(De(this.deletionAnnotations)),a=e.type===`deleted`?[]:qn(De(this.additionAnnotations));if(i.length===0&&a.length===0)return;let{createAnnotationElement:o}=this;if(t===`unified`){Qn({diffStyle:t,type:`context`,unifiedSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i.concat(a)},createAnnotationElement:o,context:r});return}Qn({diffStyle:t,type:`context`,deletionSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i},additionSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:a},createAnnotationElement:o,context:r})}getAnnotations(e,t,n,r,i){let a={type:`annotation`,hunkIndex:r,lineIndex:i,annotations:[]};if(t!=null)for(let e of this.deletionAnnotations[t]??[])a.annotations.push(V(e));let o={type:`annotation`,hunkIndex:r,lineIndex:i,annotations:[]};if(n!=null)for(let t of this.additionAnnotations[n]??[])(e===`unified`?a:o).annotations.push(V(t));if(e===`unified`)return a.annotations.length>0?a:void 0;if(o.annotations.length!==0||a.annotations.length!==0)return{deletionSpan:a,additionSpan:o}}renderHeader(e){let{headerRenderMode:t,stickyHeader:n}=this.getOptionsWithDefaults();return me({fileOrDiff:e,mode:t,stickyHeader:n})}};function qn(e){return e?.map(e=>V(e))??[]}var Jn=new Intl.PluralRules(`en-US`);function Yn(e){return`${e} unmodified line${Jn.select(e)===`one`?``:`s`}`}function Xn(e,t){for(let n of e)t.unifiedContentAST.push(n.content),t.pushToGutter(`unified`,n.gutter),t.incrementRowCount(1)}function Zn(e,t,n){for(let{deletion:r,addition:i}of e){if(r==null&&i==null)continue;let e=r!=null&&i!=null?void 0:r==null?`deletions`:`additions`;(e==null||n.side!==e)&&n.flush(),r!=null&&(t.deletionsContentAST.push(r.content),t.pushToGutter(`deletions`,r.gutter)),i!=null&&(t.additionsContentAST.push(i.content),t.pushToGutter(`additions`,i.gutter)),e!=null&&(n.side=e,n.increment()),t.incrementRowCount(1)}}function Qn({diffStyle:e,type:t,deletionLine:n,additionLine:r,unifiedSpan:i,deletionSpan:a,additionSpan:o,createAnnotationElement:s,context:c}){let l=!1;if(e===`unified`){if(r==null?n!=null&&c.unifiedContentAST.push(n):c.unifiedContentAST.push(r),i!=null){let e=t===`change`?n==null?`change-addition`:`change-deletion`:t;c.unifiedContentAST.push(s(i)),c.pushToGutter(`unified`,x(e,`annotation`,1)),l=!0}}else if(e===`split`){if(n!=null&&c.deletionsContentAST.push(n),r!=null&&c.additionsContentAST.push(r),a!=null){let e=t===`change`?n==null?`context`:`change-deletion`:t;c.deletionsContentAST.push(s(a)),c.pushToGutter(`deletions`,x(e,`annotation`,1)),l=!0}if(o!=null){let e=t===`change`?r==null?`context`:`change-addition`:t;c.additionsContentAST.push(s(o)),c.pushToGutter(`additions`,x(e,`annotation`,1)),l=!0}}l&&c.incrementRowCount(1)}function $n(e,{hunkIndex:t,collapsedLines:n,rangeSize:r,hunkSpecs:i,isFirstHunk:a,isLastHunk:o,isExpandable:s},c){if(typeof n==`number`&&n<=0)return;let l=e===`unified`?c.unifiedContentAST:e===`deletions`?c.deletionsContentAST:c.additionsContentAST;if(c.hunkSeparators===`metadata`){i!=null&&(c.pushToGutter(e,J({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),l.push(J({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1));return}if(c.hunkSeparators===`simple`){t>0&&(c.pushToGutter(e,J({type:`simple`,isFirstHunk:a,isLastHunk:!1})),l.push(J({type:`simple`,isFirstHunk:a,isLastHunk:!1})),e!==`additions`&&c.incrementRowCount(1));return}let u=Qt(e,t),d=r>c.expansionLineCount,f=s?t:void 0,p=typeof n==`number`?Yn(n):`More unchanged context may be available`;c.pushToGutter(e,J({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),l.push(J({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1),c.hunkData.push({slotName:u,hunkIndex:t,lines:typeof n==`number`?n:0,lineCountKnown:typeof n==`number`,type:e,expandable:s?{up:!a,down:!o,chunked:d}:void 0})}function er(e,t,n){return e==null||e.type!==`element`||t==null&&n==null?e:{...e,properties:{...e.properties,...t,...n}}}function tr(e){return e.length>0&&e[e.length-1]===``?e.length-1:e.length}function nr(e,t,n,r){let i=tr(e),a=tr(t),o=Math.min(i,a),s=0;for(;s<o&&e[s]===t[s];)s++;let c=0;for(;c<o-s&&e[i-1-c]===t[a-1-c];)c++;let l=Array(t.length);for(let e=0;e<s;e++)l[e]=n[e];for(let e=0;e<c;e++)l[a-1-e]=n[i-1-e];i<e.length&&a<t.length&&(l[t.length-1]=n[e.length-1]);for(let r=e.length;r<t.length;r++)l[r]??=n[r];for(let e=s;e<t.length;e++)l[e]??=rr(e,r.getLineText(e));return l}function rr(e,t,n=e,r=e){return{type:`element`,tagName:`div`,properties:{"data-line":e+1,"data-line-index":`${n},${r}`,"data-line-type":`context`},children:[{type:`element`,tagName:`span`,properties:{"data-char":0},children:[{type:`text`,value:t}]}]}}function ir(e,t){let n=[],r=or(t);for(let t=0;t<e.lineCount;t++){let i=e.getLineText(t,!0);n.push(t<e.lineCount-1&&!ar(i)?i+r:i)}return n}function ar(e){return e.endsWith(`
|
|
15
|
+
`)||e.endsWith(`\r`)}function or(e){for(let t of e){if(t.endsWith(`\r
|
|
16
|
+
`))return`\r
|
|
17
|
+
`;if(t.endsWith(`
|
|
18
|
+
`))return`
|
|
19
|
+
`;if(t.endsWith(`\r`))return`\r`}return`
|
|
20
|
+
`}function sr(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function cr(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function lr(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function ur(e,t){return e.slotName===t.slotName&&e.hunkIndex===t.hunkIndex&&e.lines===t.lines&&e.lineCountKnown===t.lineCountKnown&&e.type===t.type&&e.expandable?.chunked===t.expandable?.chunked&&e.expandable?.up===t.expandable?.up&&e.expandable?.down===t.expandable?.down}async function dr(e,t=300){let n;try{await Promise.race([e(),new Promise(e=>{n=setTimeout(e,t)})])}finally{n!=null&&clearTimeout(n)}}function fr({oldFile:e,newFile:t},n){if(e!==void 0||t!==void 0){if(e===void 0||t===void 0)throw Error(`${n}: Pass null for an intentionally missing oldFile or newFile side`);if(e===null){if(t===null)throw Error(`${n}: You must pass oldFile, newFile, or both`);return{oldFile:e,newFile:t}}return{oldFile:e,newFile:t}}}function pr(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,useCSSClasses:e?.useCSSClasses,useTokenTransformer:D(e),tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,diffStyle:e?.diffStyle,diffIndicators:e?.diffIndicators,disableBackground:e?.disableBackground,hunkSeparators:typeof e?.hunkSeparators==`function`?`custom`:e?.hunkSeparators,expandUnchanged:e?.expandUnchanged,loadDiffFiles:e?.loadDiffFiles,collapsedContextThreshold:e?.collapsedContextThreshold,lineDiffType:e?.lineDiffType,maxLineDiffLength:e?.maxLineDiffLength,expansionLineCount:e?.expansionLineCount,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}function mr(e){return e.isPartial&&(e.type===`change`||e.type===`rename-changed`||e.type===`rename-pure`)}var hr=-1,gr=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file-diff:${++hr}`;type=`file-diff`;fileContainer;spriteSVG;pre;codeUnified;codeDeletions;codeAdditions;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;headerElement;headerPrefix;headerFilenameSuffix;headerMetadata;headerCustom;separatorCache=new Map;errorWrapper;placeHolder;hunksRenderer;resizeManager;scrollSyncManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;deletionFile;additionFile;fileDiff;renderRange;pendingFiles;appliedPreAttributes;lastRenderedHeaderHTML;cachedHeaderHTML;lastRowCount;mounted=!1;enabled=!0;editor;refreshViewTimeout;lineStateRefreshPending=!1;deferredSelectedLines;deferredEditorActiveLine;constructor(e={theme:R},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new Be,this.scrollSyncManager=new Jt,this.interactionManager=new j(`diff`,c(e,typeof e.hunkSeparators==`function`||(e.hunkSeparators??`line-info`)===`line-info`||e.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex)),this.workerManager?.subscribeToThemeChanges(this),this.enabled=!0}handleHighlightRender=()=>{this.rerender()};getHunksRendererOptions(e){return pr(e)}createHunksRenderer(e){return new Kn(this.getHunksRendererOptions(e),this.handleHighlightRender,this.workerManager)}getLineIndex=(e,t=`additions`)=>{let n=this.fileDiffCache;if(n==null)return;let r=n.hunks.at(-1),i,a;hunkIterator:for(let o of n.hunks){let n=t===`deletions`?o.deletionStart:o.additionStart,s=t===`deletions`?o.deletionCount:o.additionCount,c=y(n,s)+1,l=o.splitLineStart,u=o.unifiedLineStart;if(e<c){let t=c-e;i=Math.max(u-t,0),a=Math.max(l-t,0);break hunkIterator}if(e>=c+s){if(o===r){let t=e-(c+s);i=u+o.unifiedLineCount+t,a=l+o.splitLineCount+t;break hunkIterator}continue}for(let n of o.hunkContent)if(n.type===`context`)if(e<c+n.lines){let t=e-c;a=l+t,i=u+t;break hunkIterator}else c+=n.lines,l+=n.lines,u+=n.lines;else{let r=t===`deletions`?n.deletions:n.additions;if(e<c+r){let r=e-c;i=u+(t===`additions`?n.deletions:0)+r,a=l+r;break hunkIterator}c+=r,l+=Math.max(n.deletions,n.additions),u+=n.deletions+n.additions}break hunkIterator}if(i!=null&&a!=null)return[i,a]};setOptions(e){e!=null&&(this.options=e,this.cachedHeaderHTML=void 0,this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(c(this.options,typeof this.options.hunkSeparators==`function`||(this.options.hunkSeparators??`line-info`)===`line-info`||this.options.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??`system`)!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){if(typeof this.options.theme==`string`||this.fileContainer==null||this.appliedThemeCSS==null)return!1;let t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType!==t&&(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!oe(this.appliedThemeCSS.theme,this.options.theme??R)}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(e){this.lineAnnotations=e}canPartiallyRender(e,t,n){return!(e||t||n||typeof this.options.hunkSeparators==`function`)}setSelectedLines(e,t){this.lineStateRefreshPending?this.deferredSelectedLines=[e,t]:this.interactionManager.setSelection(e,t)}setEditorActiveLine(e,t){this.lineStateRefreshPending?this.deferredEditorActiveLine=[e,t]:this.interactionManager.setEditorActiveLine(e,{lineNumberOnly:t?.lineNumberOnly,side:t?.side??`additions`})}flushDeferredLineState(){let{deferredEditorActiveLine:e,deferredSelectedLines:t}=this;this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,e!=null&&this.setEditorActiveLine(...e),t!=null&&this.interactionManager.setSelection(...t)}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{diffStyle:e=`split`,overflow:t=`scroll`}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:t===`wrap`,columnVariables:this.shouldApplyColumnVariables(t)?`apply`:`measure`}),t===`scroll`&&e===`split`?this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions):this.scrollSyncManager.cleanUp(),this.managersDirty=!1}shouldApplyColumnVariables(e){return typeof this.options.hunkSeparators==`function`||e===`scroll`&&(this.lineAnnotations.length>0||this.pre?.hasAttribute(`data-has-merge-conflict`)===!0)}getCodeScrollLeft(){return Math.max(this.codeUnified?.scrollLeft??0,this.codeDeletions?.scrollLeft??0,this.codeAdditions?.scrollLeft??0)}setCodeScrollLeft(e){this.codeUnified!=null&&(this.codeUnified.scrollLeft=e),this.codeAdditions!=null&&(this.codeAdditions.scrollLeft=e),this.codeDeletions!=null&&(this.codeDeletions.scrollLeft=e)}__getEffectiveCodeOptions(){return{...this.options,...this.hunksRenderer.getEffectiveCodeOptions()}}cleanUp(e=!1){n(this.handleEditSessionRender),this.emitPostRender(!0),this.editor?.cleanUp(e),this.editor=void 0,this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.pendingFiles=void 0,this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.clearAuxiliaryNodes(),this.annotationCache.clear(),this.pre=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.placeHolder?.remove(),this.placeHolder=void 0,this.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),this.errorWrapper?.remove(),this.errorWrapper=void 0,this.spriteSVG=void 0,this.lastRowCount=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,e?this.hunksRenderer.recycle():(this.hunksRenderer.cleanUp(),this.workerManager=void 0,this.fileDiff=void 0,this.deletionFile=void 0,this.additionFile=void 0),this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate({fileContainer:e,prerenderedHTML:t,preventEmit:n=!1,lineAnnotations:r,fileDiff:i,...a}){if(!this.enabled)throw Error(`FileDiff.hydrate: attempting to call hydrate after cleaned up`);if(this.fileContainer!=null)throw Error(`FileDiff.hydrate: hydrate can only be called before the instance has rendered or hydrated`);let o=fr(a,`FileDiff.hydrate`),s=o?.oldFile,c=o?.newFile;this.hydrateElements(e,t),br(this.pre,vr({fileDiff:i,oldFile:s,newFile:c}),this.options.collapsed)||xr(this.headerElement,yr({fileDiff:i,oldFile:s,newFile:c}),this.options.disableFileHeader)?this.render({...a,fileContainer:e,lineAnnotations:r,fileDiff:i,preventEmit:!0}):this.hydrationSetup({fileDiff:i,lineAnnotations:r,...o}),n||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),P(e,t);for(let t of e.shadowRoot?.children??[]){if(t instanceof SVGElement){this.spriteSVG=t;continue}if(t instanceof HTMLElement){if(t instanceof HTMLPreElement){this.pre=t;for(let e of t.children)!(e instanceof HTMLElement)||e.tagName.toLowerCase()!==`code`||(`deletions`in e.dataset&&(this.codeDeletions=e),`additions`in e.dataset&&(this.codeAdditions=e),`unified`in e.dataset&&(this.codeUnified=e));continue}if(`diffsHeader`in t.dataset){this.headerElement=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-theme-css`)){this.themeCSSStyle=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-unsafe-css`)){this.unsafeCSSStyle=t,this.appliedUnsafeCSS=t.textContent;continue}}}this.pre!=null&&(this.syncCodeNodesFromPre(this.pre),this.pre.removeAttribute(`data-dehydrated`)),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({fileDiff:e,oldFile:t,newFile:n,lineAnnotations:r}){this.lineAnnotations=r??this.lineAnnotations,this.additionFile=n,this.deletionFile=t,this.fileDiff=e??(t!==void 0&&n!==void 0?q(t,n,this.options.parseDiffOptions):void 0),this.pre!=null&&(this.syncInteractionOptions(),this.hunksRenderer.hydrate(this.fileDiff),this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}rerender(){!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null||this.render({forceRender:!0,renderRange:this.renderRange})}onThemeChange(){this.hunksRenderer.clearRenderCache(),this.rerender()}handleExpandHunk=(e,t,n)=>{this.expandHunk(e,t,n)};expandHunk=(e,t,n)=>{this.hunksRenderer.expandHunk(e,t,n),this.loadFilesIfNecessary(),this.rerender()};loadFilesIfNecessary(){let{fileDiff:e,options:{loadDiffFiles:t}}=this;e==null||t==null||!mr(e)||this.pendingFiles?.fileDiff===e||(this.pendingFiles={fileDiff:e,promise:this.loadFilesForDiff(e,t)})}async loadFilesForDiff(e,t){try{let n=await t(e);if(!this.enabled||this.fileDiff!==e)return;await this.handleFilesLoaded(e,n)}catch(e){if(this.options.disableErrorHandling===!0)throw e;console.error(e)}finally{this.pendingFiles?.fileDiff===e&&(this.pendingFiles=void 0)}}async handleFilesLoaded(e,t){this.fileDiff!==e||!e.isPartial||(zt(`merge`,e,t),this.setHydratedState(t),await dr(()=>this.primeHighlightCache(e)),!(!this.enabled||this.fileDiff!==e)&&this.rerender())}setHydratedState(e){this.deletionFile=e.oldFile,this.additionFile=e.newFile,this.workerManager?.cleanUpTasks(this.hunksRenderer),this.hunksRenderer.clearRenderCache()}render({fileDiff:e,deferManagers:t=!1,forceRender:n=!1,preventEmit:r=!1,lineAnnotations:i,fileContainer:a,containerWrapper:o,renderRange:s,...c}){let l=fr(c,`FileDiff.render`),u=l?.oldFile,d=l?.newFile;if(!this.enabled)throw Error(`FileDiff.render: attempting to call render after cleaned up`);e!=null&&e.cacheKey===void 0&&(e.cacheKey=e.prevName==null?e.name:e.prevName+`:`+e.name),this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:f=!1,themeType:p=`system`,expandUnchanged:m=!1}=this.options,h=f?void 0:s,g=this.hasThemeChanged(),_=l!=null,v=_&&(!_r(u,this.deletionFile)||!_r(d,this.additionFile)),y=e!=null&&e!==this.fileDiff,b=i!=null&&(i.length>0||this.lineAnnotations.length>0)&&i!==this.lineAnnotations;if(!f&&Oe(h,this.renderRange)&&!n&&!b&&!g&&(e!=null&&e===this.fileDiff||e==null&&!v))return this.applyCachedThemeState(p);let x;e==null&&_&&(v||this.fileDiff==null)&&(x=q(l.oldFile,l.newFile,this.options.parseDiffOptions));let{renderRange:S}=this;if(this.renderRange=h,_?(this.deletionFile=u,this.additionFile=d):e!=null&&(this.deletionFile=void 0,this.additionFile=void 0),e==null?x!=null&&(y=!0,this.fileDiff=x):this.fileDiff=e,y&&(this.cachedHeaderHTML=void 0),i!=null&&this.setLineAnnotations(i),this.fileDiff==null)return!1;this.fileDiff.editSessionDirty===!0&&this.shouldSelfHealEditSession()&&(An(this.fileDiff,this.options.parseDiffOptions),this.hunksRenderer.refreshHighlightedResult()),m&&this.loadFilesIfNecessary(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.hunksRenderer.setLineAnnotations(this.lineAnnotations);let{disableErrorHandling:C=!1,disableFileHeader:w=!1}=this.options;if(w&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),a=this.getOrCreateFileContainer(a,o),this.applyCachedThemeState(p),f){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.hunksRenderer.renderDiff(this.fileDiff,ye);e!=null&&this.applyThemeState(a,e.themeStyles,p,e.baseThemeType),e?.headerElement!=null&&this.applyHeaderToDOM(e.headerElement,a),this.renderSeparators([]),this.injectUnsafeCSS()}catch(e){if(C)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return r||this.emitPostRender(),!0}try{let e=this.getOrCreatePreNode(a);if(!(this.canPartiallyRender(n,b,v||y||g)&&this.applyPartialRender({previousRenderRange:S,renderRange:h}))){let t=this.hunksRenderer.renderDiff(this.fileDiff,h);if(t==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.initialize().then(()=>this.rerender()),!1;this.applyThemeState(a,t.themeStyles,p,t.baseThemeType),t.headerElement!=null&&this.applyHeaderToDOM(t.headerElement,a),t.additionsContentAST!=null||t.deletionsContentAST!=null||t.unifiedContentAST!=null?this.applyHunksToDOM(e,t):this.pre!=null&&(this.pre.remove(),this.pre=void 0),this.renderSeparators(t.hunkData)}this.applyBuffers(e,h),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,t||this.flushManagers(),this.editor!=null&&this.syncRenderViewToEditor()}catch(e){if(C)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return r||this.emitPostRender(),!0}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;this.options.onPostRender?.(t,this,`unmount`);return}if(t==null)return;let r=this.mounted?`update`:`mount`;this.mounted=!0,n?.(t,this,r)}get fileDiffCache(){return this.hunksRenderer.diffCache??this.fileDiff}syncRenderViewToEditor(){let e=this.editor,t=this.fileContainer,n=this.fileDiffCache,r=this.lineAnnotations,i=this.computeEditorRenderRange(this.renderRange);e!=null&&t!=null&&n!=null&&!n.isPartial&&this.hunksRenderer.initializeHighlighter().then(a=>{!this.enabled||this.editor!==e||this.fileContainer!==t||this.fileDiffCache!==n||e.__syncRenderView(a,t,n,r,i)})}computeEditorRenderRange(e){let t=this.fileDiffCache;if(e==null||t==null||en(e))return e;let{diffStyle:n=`split`,expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a,o;return L({diff:t,diffStyle:n,startingLine:e.startingLine,totalLines:e.totalLines,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i,callback:({additionLine:e})=>{e!=null&&(a??=e.lineNumber,o=e.lineNumber)}}),a==null||o==null?{...e,startingLine:0,totalLines:0}:{...e,startingLine:a-1,totalLines:o-a+1}}attachEditor(e){if(this.type!==`file-diff`)throw Error(`FileDiff.attachEditor: cannot attach an editor to a "${this.type}" diff`);return this.editor?.cleanUp(),this.editor=e,this.hunksRenderer.beginEditSession(),this.fileDiff?.isPartial===!0&&this.loadFilesIfNecessary(),this.hunksRenderer.editorRenderReady()?this.syncRenderViewToEditor():this.rerender(),e=>{this.editor=void 0,e!==!0&&this.finishEditSession()}}finishEditSession(){this.hunksRenderer.endEditSession(),this.completeEditSession()}completeEditSession(){let e=this.fileDiffCache;if(e==null||e.editSessionDirty!==!0)return!1;let{collapsedContextThreshold:t=1}=this.options,n=On(e,this.hunksRenderer.getExpandedHunksMap(),t);return An(e,this.options.parseDiffOptions),this.hunksRenderer.setExpandedHunksMap(kn(e,n)),this.hunksRenderer.refreshHighlightedResult(),this.escalateEditSessionRender(),!0}applyDocumentChange(e,t){this.hunksRenderer.applyDocumentChange(e);let n=this.hunksRenderer.diffCache;if(n!=null){let e=this.fileDiff?.cacheKey;e!=null&&n.cacheKey==null&&(n.cacheKey=e),this.fileDiff=n}t!==void 0&&t!==this.lineAnnotations&&(this.setLineAnnotations(t),this.hunksRenderer.setLineAnnotations(this.lineAnnotations),this.renderAnnotations()),this.rerender(),this.interactionManager.setSelectionDirty()}updateRenderCache(e,t,n={}){let{shouldRefreshDiffsView:r,lineCountChangeInFlight:i}=n;if(this.hunksRenderer.updateRenderCache(e,t,i)){this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!0,this.escalateEditSessionRender();return}r===!0&&(this.refreshViewTimeout!=null&&clearTimeout(this.refreshViewTimeout),this.lineStateRefreshPending=!0,this.refreshViewTimeout=setTimeout(()=>{this.refreshViewTimeout=void 0,this.options.diffStyle===`split`?this.refreshSplitDiffView():this.refreshUnifiedDiffView(),this.flushDeferredLineState()},150))}isLineRenderable(e){let t=this.fileDiffCache;if(t==null)return!0;let{expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options;return we({fileDiff:t,lineNumber:e,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r})}getNearestRenderableLine(e,t){let n=this.fileDiffCache;if(n==null)return e;let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options;return Le({fileDiff:n,lineNumber:e,direction:t,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i})}revealLine(e){let t=this.fileDiffCache,{expandUnchanged:n=!1,collapsedContextThreshold:r=1,expansionLineCount:i=100}=this.options;if(t==null||t.isPartial||n)return!1;let a=this.hunksRenderer.getExpandedHunksMap();for(let[n,o]of t.hunks.entries()){let[s,c]=k(o);if(e<s){let c=W({isPartial:t.isPartial,rangeSize:o.collapsedBefore,expandedHunks:a,hunkIndex:n,collapsedContextThreshold:r}),l=s-c.rangeSize;if(c.renderAll||e<l+c.fromStart||e>=s-c.fromEnd)return!1;let u=e-(l+c.fromStart)+1,d=s-c.fromEnd-e;return u<=d?this.expandHunk(n,`up`,u+i):this.expandHunk(n,`down`,d+i),!0}if(e<c)return!1}let o=u({fileDiff:t,hunkIndex:t.hunks.length-1,expandedHunks:a,collapsedContextThreshold:r,errorPrefix:`FileDiff.revealLine`});if(o==null||o.renderAll)return!1;let s=t.hunks[t.hunks.length-1],[,c]=k(s);return e<c+o.fromStart||e>=c+o.rangeSize?!1:(this.expandHunk(t.hunks.length,`up`,e-(c+o.fromStart)+1+i),!0)}shouldSelfHealEditSession(){return this.editor==null}escalateEditSessionRender(){he(this.handleEditSessionRender)}handleEditSessionRender=()=>{this.rerender(),this.flushDeferredLineState()};removeRenderedCode(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){let e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:`open`});this.placeHolder=document.createElement(`div`),this.placeHolder.dataset.placeholder=``,e.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty(`height`,`${e}px`),!0}async primeHighlightCache(e=this.fileDiff){let{workerManager:t}=this;if(e==null||t==null||!t.isWorkingPool()||e.cacheKey==null||H(e))return;let n=this.options.tokenizeMaxLength??1e5;Math.max(e.additionLines.length,e.deletionLines.length)>n||await t.primeDiffHighlightCache(e).catch(e=>{console.error(e)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.codeAdditions?.remove(),this.codeDeletions?.remove(),this.codeUnified?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.codeAdditions=void 0,this.codeDeletions=void 0,this.codeUnified=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderSeparators(e){let{hunkSeparators:t}=this.options;if(this.isContainerManaged||this.fileContainer==null||typeof t!=`function`){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();return}let n=new Map(this.separatorCache);for(let r of e){let e=r.slotName,i=this.separatorCache.get(e);if(i==null||!ur(r,i.hunkData)){i?.element.remove();let n=document.createElement(`div`);n.style.display=`contents`,n.slot=r.slotName;let a=t(r,this);a!=null&&n.appendChild(a),this.fileContainer.appendChild(n),i={element:n,hunkData:r},this.separatorCache.set(e,i)}n.delete(e)}for(let[e,{element:t}]of n.entries())this.separatorCache.delete(e),t.remove()}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options;if(t!=null&&this.lineAnnotations.length>0)for(let[n,r]of this.lineAnnotations.entries()){let i=`${n}-${V(r)}`,a=this.annotationCache.get(i);if(a==null||!lr(r,a.annotation)){a?.element.remove();let e=t(r);if(e==null)continue;a={element:ie(V(r)),annotation:r},a.element.appendChild(e),this.fileContainer.appendChild(a.element),this.annotationCache.set(i,a)}e.delete(i)}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=_();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}getOrCreateFileContainer(e,t){let{fileContainer:n}=this,r=e??n??document.createElement(`diffs-container`),i=n!==r;return n!=null&&i&&this.editor?.__captureFocusForDOMReplacement(),i&&this.emitPostRender(!0),this.fileContainer=r,n!=null&&i&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),i&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){let{shadowRoot:t}=e;if(t!=null)for(let e of t.children)e instanceof SVGElement?this.spriteSVG??=e:We(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):We(e)&&e.hasAttribute(`data-unsafe-css`)&&(this.unsafeCSSStyle??=e,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});if(this.spriteSVG==null){let e=document.createElement(`div`);e.innerHTML=ae;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});return this.pre==null?(this.pre=document.createElement(`pre`),this.appliedPreAttributes=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(this.editor?.__captureFocusForDOMReplacement(),t.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodesFromPre(e){this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0;for(let t of Array.from(e.children))t instanceof HTMLElement&&(t.hasAttribute(`data-unified`)?this.codeUnified=t:t.hasAttribute(`data-deletions`)?this.codeDeletions=t:t.hasAttribute(`data-additions`)&&(this.codeAdditions=t))}applyHeaderToDOM(e,t){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let{fileDiff:n}=this,r=this.cachedHeaderHTML??U(e);if(this.cachedHeaderHTML=r,r!==this.lastRenderedHeaderHTML){let e=document.createElement(`div`);e.innerHTML=r;let n=e.firstElementChild;if(!(n instanceof HTMLElement))return;this.headerElement==null?t.shadowRoot?.prepend(n):t.shadowRoot?.replaceChild(n,this.headerElement),this.headerElement=n,this.lastRenderedHeaderHTML=r}if(this.isContainerManaged||n==null)return;let{renderCustomHeader:i,renderHeaderPrefix:a,renderHeaderFilenameSuffix:o,renderHeaderMetadata:s}=this.options;if(i!=null){let e=i(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,ce,e),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0;return}let c=a?.(n)??void 0,l=o?.(n)??void 0,u=s?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,A,c),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,le,l),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,ze,u),this.headerCustom?.remove(),this.headerCustom=void 0}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,r){if(r==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t??e.appendChild(i),this.replaceHeaderSlotContent(i,r),i}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement(`div`);return t.slot=e,t}injectUnsafeCSS(){let{unsafeCSS:e}=this.options,t=this.fileContainer?.shadowRoot;if(t!=null){if(e==null||e===``){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}(this.unsafeCSSStyle?.parentNode!==t||this.appliedUnsafeCSS!==e)&&(this.unsafeCSSStyle??=ke(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=f(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.options.theme??R,s=typeof o==`string`?o:{...o},c=v(i);if(this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===a&&this.appliedThemeCSS.scrollbarGutter===c){this.appliedThemeCSS.theme=s;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===i){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c};return}this.themeCSSStyle=g({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:I(t,a,c)}),this.appliedThemeCSS=this.themeCSSStyle==null?void 0:{theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c}}hydrateMeasuredScrollbar(){let e=this.fileContainer?.shadowRoot;e!=null&&this.themeCSSStyle!=null&&(this.themeCSSStyle.textContent=M(this.themeCSSStyle.textContent??``,v(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&d()}applyHunksToDOM(e,t){this.shouldGuardRebuildScroll()?b(e,()=>this.replaceCodeColumns(e,t)):this.replaceCodeColumns(e,t)}applyCodeColumnsInPlace(e,t,n){let r=this.getColumnPair(e);if(r==null)return!1;let i=Q(t[0]),a=Q(t[1]);return i==null||a==null?!1:(r.gutter.innerHTML=U(i),r.content.innerHTML=U(a),n!==this.lastRowCount&&(r.gutter.style.setProperty(`grid-row`,`span ${n}`),r.content.style.setProperty(`grid-row`,`span ${n}`)),!0)}replaceCodeColumns(e,t){let{overflow:n=`scroll`}=this.options,r=(this.options.hunkSeparators??`line-info`)===`line-info`,i=n===`wrap`?t.rowCount:void 0;this.cleanupErrorWrapper(),this.applyPreNodeAttributes(e,t);let a=!1,o=[],s=this.hunksRenderer.renderCodeAST(`unified`,t),c=this.hunksRenderer.renderCodeAST(`deletions`,t),l=this.hunksRenderer.renderCodeAST(`additions`,t);this.editor?.__captureFocusForDOMReplacement(),s==null?c!=null||l!=null?(c==null?(this.codeDeletions?.remove(),this.codeDeletions=void 0):(a=this.codeDeletions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions=m({code:this.codeDeletions,columnType:`deletions`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeDeletions,c,t.rowCount)||(this.codeDeletions.innerHTML=this.hunksRenderer.renderPartialHTML(c)),o.push(this.codeDeletions)),l==null?(this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=a||this.codeAdditions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeAdditions=m({code:this.codeAdditions,columnType:`additions`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeAdditions,l,t.rowCount)||(this.codeAdditions.innerHTML=this.hunksRenderer.renderPartialHTML(l)),o.push(this.codeAdditions))):(this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=this.codeUnified==null||this.codeAdditions!=null||this.codeDeletions!=null,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.codeUnified=m({code:this.codeUnified,columnType:`unified`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeUnified,s,t.rowCount)||(this.codeUnified.innerHTML=this.hunksRenderer.renderPartialHTML(s)),o.push(this.codeUnified)),o.length===0?e.textContent=``:a&&e.replaceChildren(...o),this.lastRowCount=t.rowCount}applyPartialRender({previousRenderRange:e,renderRange:t}){let{pre:n,codeUnified:r,codeAdditions:i,codeDeletions:a,options:{diffStyle:o=`split`}}=this;if(n==null||e==null||t==null||!Number.isFinite(e.totalLines)||!Number.isFinite(t.totalLines)||this.lastRowCount==null)return!1;let s=this.getCodeColumns(o,r,a,i);if(s==null)return!1;let c=e.startingLine,l=t.startingLine,u=c+e.totalLines,d=l+t.totalLines,f=Math.max(c,l),p=Math.min(u,d);if(p<=f)return!1;let m=Math.max(0,f-c),h=Math.max(0,u-p),g=this.trimColumns({columns:s,trimStart:m,trimEnd:h,previousStart:c,overlapStart:f,overlapEnd:p,diffStyle:o});if(g<0)throw Error(`FileDiff.applyPartialRender: failed to trim to overlap`);if(this.lastRowCount<g)throw Error(`FileDiff.applyPartialRender: trimmed beyond DOM row count`);let _=this.lastRowCount-g,v=(e,t)=>{if(!(t<=0||this.fileDiff==null))return this.hunksRenderer.renderDiff(this.fileDiff,{startingLine:e,totalLines:t,bufferBefore:0,bufferAfter:0})},y=v(l,Math.max(f-l,0));if(y==null&&l<f)return!1;let b=v(p,Math.max(d-p,0));if(b==null&&d>p)return!1;let x=(e,t)=>{if(e!=null){if(o===`unified`&&!Array.isArray(s))this.insertPartialHTML(o,s,e,t);else if(o===`split`&&Array.isArray(s))this.insertPartialHTML(o,s,e,t);else throw Error(`FileDiff.applyPartialRender.applyChunk: invalid chunk application`);_+=e.rowCount}};return this.cleanupErrorWrapper(),x(y,`afterbegin`),x(b,`beforeend`),this.lastRowCount!==_&&(this.applyRowSpan(o,s,_),this.lastRowCount=_),!0}insertPartialHTML(e,t,n,r){if(e===`unified`&&!Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`unified`,n);this.renderPartialColumn(t,e,r)}else if(e===`split`&&Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`deletions`,n),i=this.hunksRenderer.renderCodeAST(`additions`,n);this.renderPartialColumn(t[0],e,r),this.renderPartialColumn(t[1],i,r)}else throw Error(`FileDiff.insertPartialHTML: Invalid argument composition`)}refreshSplitDiffView(){if(this.options.diffStyle!==`split`)return;let e=this.hunksRenderer.renderDiff(this.fileDiff,this.renderRange);if(e==null)return;let t=this.getCodeColumns(`split`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(!Array.isArray(t))return;let n=(t,n)=>{if(n==null)return;let r=this.hunksRenderer.renderCodeAST(t,e),i=Q(r?.[0]),a=Q(r?.[1]);for(let[e,t]of[[n.gutter,i],[n.content,a]])if(t!=null&&e.childElementCount===t.length)for(let n=0;n<t.length;n++){let r=e.children[n],i=t[n].properties[`data-line-type`];i!=null&&r.dataset.lineType!==i&&(r.dataset.lineType=i)}};n(`deletions`,t[0]),n(`additions`,t[1])}refreshUnifiedDiffView(){if(this.options.diffStyle!==`unified`)return;let e=this.hunksRenderer.renderDiff(this.fileDiff,this.renderRange);if(e==null)return;let t=this.getCodeColumns(`unified`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(t==null||Array.isArray(t))return;let n=this.hunksRenderer.renderCodeAST(`unified`,e),r=Q(n?.[0]),i=Q(n?.[1]),a=()=>{for(let[e,n]of[[t.gutter,r],[t.content,i]])n!=null&&(e.innerHTML=U(n));e.rowCount!==this.lastRowCount&&(this.applyRowSpan(`unified`,t,e.rowCount),this.lastRowCount=e.rowCount)};this.shouldGuardRebuildScroll()?b(this.pre,a):a(),this.renderSeparators(e.hunkData),this.managersDirty=!0,this.flushManagers(),this.syncRenderViewToEditor()}renderPartialColumn(e,t,n){if(e==null||t==null)return;let r=Q(t[0]),i=Q(t[1]);if(r==null||i==null)throw Error(`FileDiff.insertPartialHTML: Unexpected AST structure`);let a=i.at(0);n===`beforeend`&&a?.type===`element`&&typeof a.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(a.properties[`data-buffer-size`],e.content.children[e.content.children.length-1],e.gutter.children[e.gutter.children.length-1],r,i,!0);let o=i.at(-1);n===`afterbegin`&&o?.type===`element`&&typeof o.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(o.properties[`data-buffer-size`],e.content.children[0],e.gutter.children[0],r,i,!1),e.gutter.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(r)),e.content.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(i))}mergeBuffersIfNecessary(e,t,n,r,i,a){if(!(t instanceof HTMLElement)||!(n instanceof HTMLElement))return;let o=this.getBufferSize(t.dataset);o!=null&&(a?(r.shift(),i.shift()):(r.pop(),i.pop()),this.updateBufferSize(t,o+e),this.updateBufferSize(n,o+e))}applyRowSpan(e,t,n){let r=e=>{e!=null&&(e.gutter.style.setProperty(`grid-row`,`span ${n}`),e.content.style.setProperty(`grid-row`,`span ${n}`))};if(e===`unified`&&!Array.isArray(t))r(t);else if(e===`split`&&Array.isArray(t))r(t[0]),r(t[1]);else throw Error(`dun fuuuuked up`)}trimColumnRows(e,t,n){let r=0,i=0,a=0,o=!1,s=n>=0;if(e==null)return 0;let c=Array.from(e.content.children),l=Array.from(e.gutter.children);if(c.length!==l.length)throw Error(`FileDiff.trimColumnRows: columns do not match`);for(;a<c.length&&!(t<=0&&!s&&!o);){let e=l[a],u=c[a];if(a++,!(e instanceof HTMLElement)||!(u instanceof HTMLElement))throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: invalid row elements`);if(o&&(o=!1,e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset||e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset)){e.remove(),u.remove(),i++;continue}if(`lineIndex`in e.dataset&&`lineIndex`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),t>0&&(t--,t===0&&(o=!0)),i++),r++;continue}if(`separator`in e.dataset&&`separator`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`buffer`&&`contentBuffer`in u.dataset){let a=this.getBufferSize(u.dataset);if(a==null)throw Error(`FileDiff.trimColumnRows: invalid element`);if(t>0){let n=Math.min(t,a),r=a-n;r>0?(this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=n):(e.remove(),u.remove(),i+=a),t-=n,t===0&&r===0&&(o=!0)}else if(s){let t=r,o=r+a-1;if(n<=t)e.remove(),u.remove(),i+=a;else if(n<=o){let t=o-n+1,r=a-t;this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=t}}r+=a;continue}throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: unknown row elements`)}return i}trimColumns({columns:e,diffStyle:t,overlapEnd:n,overlapStart:r,previousStart:i,trimEnd:a,trimStart:o}){let s=Math.max(0,r-i),c=n-i;if(c<0)throw Error(`FileDiff.trimColumns: overlap ends before previous`);let l=o>0,u=a>0;if(!l&&!u)return 0;let d=l?s:0,f=u?c:-1;if(t===`unified`&&!Array.isArray(e))return this.trimColumnRows(e,d,f);if(t===`split`&&Array.isArray(e)){let t=this.trimColumnRows(e[0],d,f),n=this.trimColumnRows(e[1],d,f);if(e[0]!=null&&e[1]!=null&&t!==n)throw Error(`FileDiff.trimColumns: split columns out of sync`);return e[0]==null?n:t}throw console.error({diffStyle:t,columns:e}),Error(`FileDiff.trimColumns: Invalid columns for diffType`)}getBufferSize(e){let t=Number.parseInt(e?.bufferSize??``,10);return Number.isNaN(t)?void 0:t}updateBufferSize(e,t){e.dataset.bufferSize=`${t}`,e.style.setProperty(`grid-row`,`span ${t}`),e.style.setProperty(`min-height`,`calc(${t} * 1lh)`)}getColumnPair(e){if(e==null)return;let t=e.children[0],n=e.children[1];if(!(!(t instanceof HTMLElement)||!(n instanceof HTMLElement)||t.dataset.gutter==null||n.dataset.content==null))return{gutter:t,content:n}}getCodeColumns(e,t,n,r){if(e===`unified`)return this.getColumnPair(t);{let e=this.getColumnPair(n),t=this.getColumnPair(r);return e!=null||t!=null?[e,t]:void 0}}updateBuffers(e){this.pre!=null&&this.applyBuffers(this.pre,e)}applyBuffers(e,t){if(t==null||this.shouldDisableVirtualizationBuffers()){this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(this.bufferBefore??(this.bufferBefore=document.createElement(`div`),this.bufferBefore.dataset.virtualizerBuffer=`before`,e.before(this.bufferBefore)),this.bufferBefore.style.setProperty(`height`,`${t.bufferBefore}px`),this.bufferBefore.style.setProperty(`contain`,`strict`)):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter??(this.bufferAfter=document.createElement(`div`),this.bufferAfter.dataset.virtualizerBuffer=`after`,e.after(this.bufferAfter)),this.bufferAfter.style.setProperty(`height`,`${t.bufferAfter}px`),this.bufferAfter.style.setProperty(`contain`,`strict`)):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyPreNodeAttributes(e,{additionsContentAST:t,deletionsContentAST:n,totalLines:r},a){let{diffIndicators:o=`bars`,disableBackground:s=!1,disableLineNumbers:c=!1,overflow:l=`scroll`,diffStyle:u=`split`}=this.options,d={type:`diff`,diffIndicators:o,disableBackground:s,disableLineNumbers:c,overflow:l,split:u!==`unified`&&t!=null&&n!=null,totalLines:r,customProperties:a};ne(d,this.appliedPreAttributes)||(i(e,d),this.appliedPreAttributes=d)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let n=t.shadowRoot??t.attachShadow({mode:`open`});this.errorWrapper??=document.createElement(`div`),this.errorWrapper.dataset.errorWrapper=``,this.errorWrapper.textContent=``,n.appendChild(this.errorWrapper);let r=document.createElement(`div`);r.dataset.errorMessage=``,r.innerText=e.message,this.errorWrapper.appendChild(r);let i=document.createElement(`pre`);i.dataset.errorStack=``,i.innerText=e.stack??`No Error Stack`,this.errorWrapper.appendChild(i)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function _r(e,t){return e==null||t==null?e==null&&t==null:N(e,t)}function vr({fileDiff:e,oldFile:t,newFile:n}){return e!=null&&e.hunks.length>0||t!=null||n!=null}function yr({fileDiff:e,oldFile:t,newFile:n}){return e!=null||t!=null||n!=null}function br(e,t,n=!1){return!n&&e==null&&t}function xr(e,t,n=!1){return e==null&&t&&!n}function Q(e){if(e!=null&&e.type===`element`)return e.children??[]}function Sr({fileDiff:e,metrics:t,disableFileHeader:n,hunkSeparators:r,expandUnchanged:i,expandedHunks:a,collapsedContextThreshold:s,canHydratePartialDiff:c}){let d=C(t,n),f=d,p=i?!0:a,m=e.hunks.length-1;for(let n=0;n<e.hunks.length;n++){let i=e.hunks[n];if(i==null)throw Error(`computeEstimatedDiffHeights: invalid hunk index`);let a=W({isPartial:e.isPartial,rangeSize:i.collapsedBefore,expandedHunks:p,hunkIndex:n,collapsedContextThreshold:s}),h=(a.fromStart+a.fromEnd)*t.lineHeight;if(d+=h,f+=h,a.collapsedLines>0){let e=o({type:r,metrics:t,hunkIndex:n,hunkSpecs:i.hunkSpecs})?.totalHeight??0;d+=e,f+=e}d+=i.splitLineCount*t.lineHeight,f+=i.unifiedLineCount*t.lineHeight;let g=Cr(i);d+=g.split*t.lineHeight,f+=g.unified*t.lineHeight;let _=n===m?u({fileDiff:e,hunkIndex:n,expandedHunks:p,collapsedContextThreshold:s,errorPrefix:`computeEstimatedDiffHeights`}):void 0;if(_!=null){let e=(_.fromStart+_.fromEnd)*t.lineHeight;if(d+=e,f+=e,_.collapsedLines>0){let e=l({type:r,metrics:t})?.totalHeight??0;d+=e,f+=e}}else if(n===m&&e.isPartial&&c){let e=l({type:r,metrics:t})?.totalHeight??0;d+=e,f+=e}}if(e.hunks.length>0){let e=T(t);d+=e,f+=e}return{splitHeight:d,unifiedHeight:f}}function Cr(e){if(!e.noEOFCRAdditions&&!e.noEOFCRDeletions)return{split:0,unified:0};let t=e.hunkContent.at(-1);if(t==null)return{split:0,unified:0};if(t.type===`context`){let e=+(t.lines>0);return{split:e,unified:e}}return wr(e,t)}function wr(e,t){let n=(t.deletions>0&&e.noEOFCRDeletions?1:0)+(t.additions>0&&e.noEOFCRAdditions?1:0),r=t.deletions>0&&e.noEOFCRDeletions,i=t.additions>0&&e.noEOFCRAdditions;return{split:r||i?1:0,unified:n}}var Tr=3e3,Er=-1,Dr=class extends gr{__id=`little-virtualized-file-diff:${++Er}`;top;height=0;metrics;cache={heightDeltas:new Map,measuredHeightDeltaTotal:0,estimatedSplitHeight:void 0,estimatedUnifiedHeight:void 0,checkpoints:[],totalLines:0,fileAnnotationHeight:0};isVisible=!1;isSetup=!1;virtualizer;layoutDirty=!0;forceRenderOverride;currentCollapsed;currentExpandUnchanged;pendingHydratedDiff;pendingExpansions;constructor(e,t,n,r,i=!1){super(e,r,i),this.virtualizer=t,this.metrics=S(n)}setMetrics(e,t=!1){let n=S(e);!t&&E(this.metrics,n)||(this.metrics=n,this.resetLayoutCache({includeEstimatedHeights:!0}))}setLineAnnotations(e){this.syncLineAnnotations(e)&&this.resetLayoutCache({includeEstimatedHeights:!1})}syncLineAnnotations(e){return e==null||e===this.lineAnnotations||e.length===0&&this.lineAnnotations.length===0?!1:(super.setLineAnnotations(e),!0)}setFileAnnotationHeight(e){let t=this.cache.fileAnnotationHeight;return e!==t&&(this.cache.fileAnnotationHeight=e,this.cache.measuredHeightDeltaTotal+=e-t,!0)}hasFileAnnotations(e=this.fileDiff){return e==null||!Ae(this.lineAnnotations)?!1:this.lineAnnotations.some(t=>t.lineNumber===0?e.type===`new`?t.side===`additions`:e.type!==`deleted`||t.side===`deletions`:!1)}getLineHeight(e,t=!1){return this.getEstimatedLineHeight(t)+(this.cache.heightDeltas.get(e)??0)}getEstimatedLineHeight(e=!1){let t=e?2:1;return this.metrics.lineHeight*t}setOptions(e){if(this.isAdvancedMode())throw Error(`VirtualizedFileDiff.setOptions cannot be used inside CodeView. Update CodeView options instead.`);if(e==null)return;let{options:t}=this,n=!re(t,e),r=n&&Fr(t,e);super.setOptions(e),r&&this.resetLayoutCache({forceSimpleRecompute:!0,includeEstimatedHeights:Ir(t,e)}),n&&(this.forceRenderOverride=!0),n&&this.isSimpleMode()&&this.virtualizer.instanceChanged(this,r)}setThemeType(e){if(this.isAdvancedMode())throw Error(`VirtualizedFileDiff.setThemeType cannot be used inside CodeView. Update CodeView options instead.`);super.setThemeType(e)}resetLayoutCache({forceSimpleRecompute:e=!1,includeEstimatedHeights:t=!1,resetRenderRange:n=!0}={}){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heightDeltas.size>0&&this.cache.heightDeltas.clear(),this.cache.measuredHeightDeltaTotal!==0&&(this.cache.measuredHeightDeltaTotal=0),this.invalidateDerivedLayoutCache(t,n),e&&this.isSimpleMode()&&this.computeApproximateSize()}invalidateDerivedLayoutCache(e,t=!0){this.layoutDirty=!0,this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.cache.totalLines!==0&&(this.cache.totalLines=0),e&&(this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0),this.renderRange!=null&&t&&(this.renderRange=void 0)}reconcileHeights(){let e=!1,{overflow:t=`scroll`}=this.options;if(this.fileContainer==null||this.fileDiff==null)return this.height!==0&&(e=!0),this.height=0,e;if(this.top=this.getVirtualizedTop(),t===`scroll`&&this.lineAnnotations.length===0&&!this.isResizeDebuggingEnabled())return e;let n=this.getDiffStyle(),r=n===`split`?[this.codeDeletions,this.codeAdditions]:[this.codeUnified],i=this.hasFileAnnotations(this.fileDiff);if(this.renderRange!=null&&i&&Ce(this.renderRange)){let t=Or(r)??0;this.setFileAnnotationHeight(t)&&(e=!0)}else!i&&this.setFileAnnotationHeight(0)&&(e=!0);for(let t of r){if(t==null)continue;let r=t.children[1];if(r instanceof HTMLElement)for(let t of r.children){if(!(t instanceof HTMLElement))continue;let r=t.dataset.lineIndex;if(r==null)continue;let i=Br(r,n),a=t.getBoundingClientRect().height,o=!1;t.nextElementSibling instanceof HTMLElement&&(`lineAnnotation`in t.nextElementSibling.dataset||`noNewline`in t.nextElementSibling.dataset)&&(`noNewline`in t.nextElementSibling.dataset&&(o=!0),a+=t.nextElementSibling.getBoundingClientRect().height);let s=this.getEstimatedLineHeight(o),c=this.cache.heightDeltas.get(i)??0,l=a-s;l!==c&&(e=!0,this.cache.measuredHeightDeltaTotal+=l-c,l===0?this.cache.heightDeltas.delete(i):this.cache.heightDeltas.set(i,l))}}return(e||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),e}onRender=e=>this.fileContainer!=null&&(e&&(this.top=this.getVirtualizedTop()),this.render());flushManagers(){super.flushManagers(),this.lineStateRefreshPending&&this.flushDeferredLineState()}prepareCodeViewItem(e,t,n,r){let i=!z(this.fileDiff,e),a=this.syncLineAnnotations(r),o=n?.resetDiffLayoutCache===!0||i||a,s=i||n?.resetDiffLayoutCache===!0&&n.includeEstimatedDiffHeights;n?.metrics!=null&&(this.metrics=S(n.metrics),o=!0,s=!0);let{collapsed:c=!1,expandUnchanged:l=!1}=this.options;return this.currentCollapsed!==c&&(this.currentCollapsed=c,o=!0),this.currentExpandUnchanged!==l&&(this.currentExpandUnchanged=l,o=!0,s=!0),o&&this.resetLayoutCache({includeEstimatedHeights:s}),this.fileDiff=e,this.top=t,this.computeApproximateSize(),this.height}getLinePosition(e,t=`additions`){if(this.fileDiff==null||e<1)return;let n=this.getLineIndex(e,t);if(n==null)return;let{disableFileHeader:r=!1,expandUnchanged:i=!1,collapsed:a=!1,collapsedContextThreshold:s=1}=this.options,c=this.getDiffStyle(),u=this.getHunkSeparatorType(),d=c===`split`?n[1]:n[0];this.approximateLayoutCheckpoints();let f=C(this.metrics,r),p=this.getLayoutCheckpointBeforeLineIndex(d),m=p?.top??f+this.cache.fileAnnotationHeight;if(a)return{top:f,height:0};let h;return L({diff:this.fileDiff,diffStyle:c,startingLine:p?.renderedLineIndex??0,expandedHunks:i?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:s,callback:({hunkIndex:e,hunk:t,collapsedBefore:n,collapsedAfter:r,deletionLine:i,additionLine:a})=>{let s=c===`split`?a?.splitLineIndex??i?.splitLineIndex:a?.unifiedLineIndex??i?.unifiedLineIndex;if(s==null)throw Error(`VirtualizedFileDiff.getLinePosition: missing line index data`);if(n>0){let r=o({type:u,metrics:this.metrics,hunkIndex:e,hunkSpecs:t?.hunkSpecs});if(r!=null){if(m+=r.gapBefore,d>=s-n&&d<s)return h={top:m,height:r.height},!0;m+=r.height+r.gapAfter}}let f=this.getLineHeight(s,(a?.noEOFCR??!1)||(i?.noEOFCR??!1));if(s===d)return h={top:m,height:f},!0;if(m+=f,r>0){let e=l({type:u,metrics:this.metrics});if(e!=null){if(d>s&&d<=s+r)return h={top:m+e.gapBefore,height:e.height},!0;m+=e.totalHeight}}return!1}}),h}getEditorViewport(){return this.virtualizer.type===`simple`?this.virtualizer.getRoot():this.virtualizer.getContainerElement()}getNumericScrollAnchor(e){if(this.fileDiff==null)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsed:r=!1,collapsedContextThreshold:i=1}=this.options;if(r)return;let a=this.getDiffStyle(),s=this.getHunkSeparatorType();this.approximateLayoutCheckpoints();let c=this.getLayoutCheckpointBeforeTop(e),u=c?.top??C(this.metrics,t)+this.cache.fileAnnotationHeight,d;return L({diff:this.fileDiff,diffStyle:a,startingLine:c?.renderedLineIndex??0,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,deletionLine:c,additionLine:f})=>{let p=a===`split`?f?.splitLineIndex??c?.splitLineIndex:f?.unifiedLineIndex??c?.unifiedLineIndex;if(p==null)throw Error(`VirtualizedFileDiff.getNumericScrollAnchor: missing line index data`);if(r>0){let e=o({type:s,metrics:this.metrics,hunkIndex:t,hunkSpecs:n?.hunkSpecs});e!=null&&(u+=e.totalHeight)}if(u>=e&&(c==null?f!=null&&(d={lineNumber:f.lineNumber,side:`additions`,top:u}):d={lineNumber:c.lineNumber,side:`deletions`,top:u},d!=null))return!0;let m=this.getLineHeight(p,(f?.noEOFCR??!1)||(c?.noEOFCR??!1));if(u+=m,i>0){let e=l({type:s,metrics:this.metrics});e!=null&&(u+=e.totalHeight)}return!1}}),d}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){if(this.top==null||this.fileDiff==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};let t=e==null?this.renderRange:this.computeRenderRangeFromWindow(this.fileDiff,this.top,e);if(t==null)return;let{bufferBefore:n,bufferAfter:r,totalLines:i}=t,a=0;if(i===0){let t=e??this.virtualizer.getWindowSpecs();this.top<t.top&&(a=r)}return{topOffset:this.top+n+a,height:this.height-(n+r)}}cleanUp(e=!1){this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||(this.resetLayoutCache({includeEstimatedHeights:!0}),this.pendingExpansions=void 0,this.pendingHydratedDiff=void 0),this.isSetup=!1,super.cleanUp(e)}expandHunk=(e,t,n)=>{this.fileDiff!=null&&(this.isAdvancedMode()?(this.pendingExpansions??=[],this.pendingExpansions.push({hunkIndex:e,direction:t,expansionLineCountOverride:n})):(this.hunksRenderer.expandHunk(e,t,n),this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()),this.loadFilesIfNecessary(),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))};async handleFilesLoaded(e,t){if(!(this.fileDiff!==e||!e.isPartial)){if(this.isAdvancedMode()){let n=zt(`clone`,e,t);if(await dr(()=>this.primeHighlightCache(n)),!this.enabled||this.fileDiff!==e)return;this.pendingHydratedDiff={expectedDiff:e,nextDiff:n,files:t}}else{if(zt(`merge`,e,t),this.setHydratedState(t),await dr(()=>this.primeHighlightCache(e)),!this.enabled||this.fileDiff!==e)return;this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}}consumeCodeViewLayoutChanges(e){let t=!1,n,{pendingExpansions:r,pendingHydratedDiff:i}=this;if(r!=null){this.pendingExpansions=void 0;for(let e of r)this.hunksRenderer.expandHunk(e.hunkIndex,e.direction,e.expansionLineCountOverride),t=!0}return i!=null&&(this.pendingHydratedDiff=void 0,i.expectedDiff===e&&(this.setHydratedState(i.files),n=i.nextDiff)),n==null?t&&(this.forceRenderOverride=!0,this.invalidateDerivedLayoutCache(!0)):(this.forceRenderOverride=!0,this.resetLayoutCache({includeEstimatedHeights:!0})),n}loadFilesIfNecessary(){if(this.pendingHydratedDiff!=null){if(this.pendingHydratedDiff.expectedDiff===this.fileDiff)return;this.pendingHydratedDiff=void 0}super.loadFilesIfNecessary()}isLineRenderable(e){if(super.isLineRenderable(e))return!0;let{pendingExpansions:t}=this,n=this.fileDiffCache;if(t==null||t.length===0||n==null)return!1;let{expansionLineCount:r=100,collapsedContextThreshold:i=1}=this.options,a=new Map(this.hunksRenderer.getExpandedHunksMap());for(let e of t){let t={...a.get(e.hunkIndex)??{fromStart:0,fromEnd:0}},n=e.expansionLineCountOverride??r;(e.direction===`up`||e.direction===`both`)&&(t.fromStart+=n),(e.direction===`down`||e.direction===`both`)&&(t.fromEnd+=n),a.set(e.hunkIndex,t)}return we({fileDiff:n,lineNumber:e,expandedHunks:a,collapsedContextThreshold:i})}invalidateEditSessionLayout(){this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1}),this.isSimpleMode()||this.computeApproximateSize(!0),this.getSimpleVirtualizer()?.requestHeightReconcile(this)}escalateEditSessionRender(){this.invalidateEditSessionLayout(),!(!this.enabled||this.fileDiff==null)&&(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))}shouldSelfHealEditSession(){return!this.isAdvancedMode()&&super.shouldSelfHealEditSession()}setVisibility(e){this.isAdvancedMode()||this.fileContainer==null||(this.renderRange=void 0,e&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null||(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!1))}applyDocumentChange(e,t,n=!1){let{renderRange:r}=this;if(this.getAdvancedVirtualizer()?.capturePendingLayoutAnchor(),super.applyDocumentChange(e,t),this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1}),!this.isSimpleMode())this.computeApproximateSize(!0);else if(n&&r!==void 0&&this.fileDiff!==void 0){let e=this.virtualizer.getWindowSpecs(),t=this.computeRenderRangeFromWindow(this.fileDiff,this.top??0,e);t.bufferAfter!==r.bufferAfter&&this.updateBuffers(t)}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}computeApproximateSize(e=!1,t=this.fileDiff){let n=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!n)return;let r=this.height===0;if(this.height=0,this.cache.checkpoints=[],this.cache.totalLines=0,t==null){this.layoutDirty=!1;return}let{disableFileHeader:i=!1,collapsed:a=!1}=this.options,o=C(this.metrics,i);if(this.height+=o,a){this.layoutDirty=!1;return}this.height=this.getActiveEstimatedHeight(t)+this.cache.measuredHeightDeltaTotal,n&&!r&&this.validateComputedHeight(t),this.layoutDirty=!1}getActiveEstimatedHeight(e=this.fileDiff){this.ensureEstimatedDiffHeights(e);let t=this.getDiffStyle()===`split`?this.cache.estimatedSplitHeight:this.cache.estimatedUnifiedHeight;if(t==null)throw Error(`VirtualizedFileDiff.getActiveEstimatedHeight: missing estimated height`);return t}ensureEstimatedDiffHeights(e=this.fileDiff){if(e==null){this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0;return}if(this.cache.estimatedSplitHeight!=null&&this.cache.estimatedUnifiedHeight!=null)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options,{splitHeight:i,unifiedHeight:a}=Sr({fileDiff:e,metrics:this.metrics,disableFileHeader:t,hunkSeparators:this.getHunkSeparatorType(),expandUnchanged:n,expandedHunks:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r,canHydratePartialDiff:Lr(e,this.options.loadDiffFiles!=null)});this.cache.estimatedSplitHeight=i,this.cache.estimatedUnifiedHeight=a}validateComputedHeight(e=this.fileDiff){if(this.fileContainer==null||e==null)return;let t=this.fileContainer.getBoundingClientRect();t.height===this.height?console.log(`VirtualizedFileDiff.computeApproximateSize: computed height IS CORRECT`):console.log(`VirtualizedFileDiff.computeApproximateSize: computed height doesnt match`,{name:e.name,elementHeight:t.height,computedHeight:this.height})}render({fileContainer:e,fileDiff:t,forceRender:n=!1,lineAnnotations:r,...i}={}){let a=fr(i,`VirtualizedFileDiff.render`),o=a!=null,s=a?.oldFile,c=a?.newFile,l=o&&(!zr(s,this.deletionFile)||!zr(c,this.additionFile)),u=t??this.fileDiff;t==null&&o&&(l||this.fileDiff==null)&&(u=q(a.oldFile,a.newFile,this.options.parseDiffOptions));let{forceRenderOverride:d,isSetup:f}=this;this.forceRenderOverride=void 0;let p=this.syncLineAnnotations(r);p&&this.resetLayoutCache({includeEstimatedHeights:!1});let m=t!=null&&t!==this.fileDiff,h=u!=null&&!z(this.fileDiff,u),g=m||l;if(h&&this.resetLayoutCache({includeEstimatedHeights:!0}),e=this.getOrCreateFileContainer(e),u==null)return console.error(`VirtualizedFileDiff.render: attempting to virtually render when we dont have the correct data`),!1;if(f)this.top??=this.getVirtualizedTop(),h&&(this.getSimpleVirtualizer()?.markDOMDirty(),this.computeApproximateSize(!1,u));else{this.computeApproximateSize(!1,u);let t=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(t==null)throw Error(`VirtualizedFileDiff.render: simple virtualizer is not available`);t.connect(e,this),this.isVisible=t.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode()&&(!g||!f))return this.fileDiff=u,a!=null&&(this.deletionFile=s,this.additionFile=c),h&&(this.cachedHeaderHTML=void 0),this.renderPlaceholder(this.height);let _=this.virtualizer.getWindowSpecs(),v=this.top??0,y=this.computeRenderRangeFromWindow(u,v,_),b=super.render({fileDiff:u,fileContainer:e,renderRange:y,lineAnnotations:r,forceRender:(d??n)||p||h,...a,...i});return this.isSimpleMode()&&b&&this.getSimpleVirtualizer()?.requestHeightReconcile(this),b}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}shouldGuardRebuildScroll(){return!1}isSimpleMode(){return this.virtualizer.type===`simple`}isAdvancedMode(){return this.virtualizer.type===`advanced`}getVirtualizedTop(){return this.virtualizer.type===`advanced`?this.virtualizer.getLocalTopForInstance(this):this.fileContainer==null?0:this.virtualizer.getOffsetInScrollContainer(this.fileContainer)}getSimpleVirtualizer(){return this.virtualizer.type===`simple`?this.virtualizer:void 0}getAdvancedVirtualizer(){return this.virtualizer.type===`advanced`?this.virtualizer:void 0}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}getDiffStyle(){return this.options.diffStyle??`split`}getHunkSeparatorType(){return Rr(this.options.hunkSeparators)}approximateLayoutCheckpoints(e=this.fileDiff){if(!this.layoutDirty&&this.cache.checkpoints.length>0||e==null||e.hunks.length===0||this.options.collapsed===!0)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options,i=e.hunks.length-1,a=Lr(e,this.options.loadDiffFiles!=null),s=this.getDiffStyle(),c=this.getHunkSeparatorType(),d=n?!0:this.hunksRenderer.getExpandedHunksMap(),f=kr(this.cache.heightDeltas),p=C(this.metrics,t)+this.cache.fileAnnotationHeight,m=0,h=({rowCount:e,startLineIndex:t,preSeparatorHeight:n=0,postSeparatorHeight:r=0,metadataOffsets:i=[]})=>{if(e<=0)return;let a=m,o=m+e,s=Mr(a);for(;s<o;){let e=s-a,r=p+(e>0?n:0)+e*this.metrics.lineHeight+Nr(i,e)*this.metrics.lineHeight+Ar(f,t,t+e);this.cache.checkpoints.push({renderedLineIndex:s,lineIndex:t+e,top:r}),s+=Tr}p+=n+e*this.metrics.lineHeight+i.length*this.metrics.lineHeight+Ar(f,t,t+e)+r,m=o};for(let t=0;t<e.hunks.length;t++){let n=e.hunks[t];if(n==null)throw Error(`VirtualizedFileDiff.approximateLayoutCheckpoints: invalid hunk index`);let f=W({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:d,hunkIndex:t,collapsedContextThreshold:r}),p=f.collapsedLines>0?o({type:c,metrics:this.metrics,hunkIndex:t,hunkSpecs:n.hunkSpecs})?.totalHeight??0:0;h({rowCount:f.fromStart,startLineIndex:(s===`split`?n.splitLineStart:n.unifiedLineStart)-f.rangeSize});let m=p;h({rowCount:f.fromEnd,startLineIndex:(s===`split`?n.splitLineStart:n.unifiedLineStart)-f.fromEnd,preSeparatorHeight:m}),f.fromEnd>0&&(m=0);let g=t===i?u({fileDiff:e,hunkIndex:t,expandedHunks:d,collapsedContextThreshold:r,errorPrefix:`VirtualizedFileDiff`}):void 0,_=g!=null&&g.collapsedLines>0||t===i&&a?l({type:c,metrics:this.metrics})?.totalHeight??0:0,v=g==null?0:g.fromStart+g.fromEnd,y=s===`split`?n.splitLineCount:n.unifiedLineCount,b=s===`split`?n.splitLineStart:n.unifiedLineStart;h({rowCount:y,startLineIndex:b,preSeparatorHeight:m,postSeparatorHeight:v===0?_:0,metadataOffsets:Pr({diffStyle:s,hunk:n,rowCount:y})}),g!=null&&v>0&&h({rowCount:v,startLineIndex:b+y,postSeparatorHeight:_})}this.cache.totalLines=m}getLayoutCheckpointBeforeLineIndex(e){if(e<=0||this.cache.checkpoints.length===0)return;let t=0,n=this.cache.checkpoints.length-1,r;for(;t<=n;){let i=t+n>>1,a=this.cache.checkpoints[i];if(a==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);a.lineIndex<=e?(r=a,t=i+1):n=i-1}return r}getLayoutCheckpointBeforeTop(e,t){let n=0,r=this.cache.checkpoints.length-1,i=-1;for(;n<=r;){let t=n+r>>1,a=this.cache.checkpoints[t];if(a==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);a.top<=e?(i=t,n=t+1):r=t-1}if(t==null)return i>=0?this.cache.checkpoints[i]:void 0;for(let e=i;e>=0;e--){let n=this.cache.checkpoints[e];if(n==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);if(n.renderedLineIndex%t===0)return n}}getExpandedLineCount(e,t){let n=0;if(e.isPartial){for(let r of e.hunks)n+=t===`split`?r.splitLineCount:r.unifiedLineCount;return n}let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a=r?!0:this.hunksRenderer.getExpandedHunksMap();for(let[r,o]of e.hunks.entries()){let s=t===`split`?o.splitLineCount:o.unifiedLineCount;n+=s;let c=Math.max(o.collapsedBefore,0),{fromStart:l,fromEnd:u,renderAll:d}=W({isPartial:e.isPartial,rangeSize:c,expandedHunks:a,hunkIndex:r,collapsedContextThreshold:i});c>0&&(n+=d?c:l+u)}let o=u({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:a,collapsedContextThreshold:i,errorPrefix:`VirtualizedFileDiff`});return o!=null&&(n+=o.fromStart+o.fromEnd),n}getLayoutLineCount(e,t){let n=this.getExpandedLineCount(e,t),r=t===`split`?e.splitLineCount:e.unifiedLineCount;return Math.max(n,r,e.additionLines.length,e.deletionLines.length,this.cache.totalLines)}computeRenderRangeFromWindow(e,t,{top:n,bottom:r}){let{disableFileHeader:i=!1,expandUnchanged:a=!1,collapsedContextThreshold:s=1}=this.options,{hunkLineCount:c,lineHeight:u}=this.metrics,d=this.getDiffStyle(),f=this.getHunkSeparatorType(),p=Lr(e,this.options.loadDiffFiles!=null),m=this.height,h=this.getLayoutLineCount(e,d),g=C(this.metrics,i),_=e.hunks.length>0?T(this.metrics):0,{fileAnnotationHeight:v}=this.cache,y=g+v,b=Math.max(0,m-g-v-_),x=this.hasFileAnnotations(e),S=t+g,w=v>0&&x&&S<r&&S+v>n;if(t<n-m||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:m-g-_};if(h<=c||e.hunks.length===0)return{startingLine:0,totalLines:c,bufferBefore:0,bufferAfter:0};this.approximateLayoutCheckpoints(e),h=this.getLayoutLineCount(e,d);let E=Math.ceil(Math.max(r-n,0)/u),D=Math.ceil(E/c)*c+c,O=D/c,k=O,A=[],j=(n+r)/2,ee=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-D*u*2),c),M=t+(ee?.top??y),N=ee?.renderedLineIndex??0,P,F,I;if(L({diff:e,diffStyle:d,startingLine:ee?.renderedLineIndex??0,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:s,callback:({hunkIndex:i,hunk:a,collapsedBefore:s,collapsedAfter:u,deletionLine:m,additionLine:h})=>{let g=h==null?m.splitLineIndex:h.splitLineIndex,_=h==null?m.unifiedLineIndex:h.unifiedLineIndex,v=(h?.noEOFCR??!1)||(m?.noEOFCR??!1),b=i===e.hunks.length-1&&a!=null&&(d===`split`?g===a.splitLineStart+a.splitLineCount-1:_===a.unifiedLineStart+a.unifiedLineCount-1),x=(s>0?o({type:f,metrics:this.metrics,hunkIndex:i,hunkSpecs:a?.hunkSpecs}):void 0)?.totalHeight??0;M+=x;let S=N%c===0,C=Math.floor(N/c);if(S&&(A[C]=M-(t+y+x),I!=null)){if(I<=0)return!0;I--}let w=this.getLineHeight(d===`split`?g:_,v);if(M>n-w&&M<r&&(P??=C),F==null&&M+w>j&&(F=C),I==null&&M>=r&&S&&(I=k),N++,M+=w,u>0||b&&p){let e=l({type:f,metrics:this.metrics});e!=null&&(M<r&&M+e.totalHeight>n&&(P??=C),F==null&&M+e.totalHeight>j&&(F=C),M+=e.totalHeight)}return!1}}),P==null)if(w)P=0,F=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:m-g-_};F??=P;let te=Math.round(F-O/2),ne=Math.max(0,Math.ceil(h/c)-O),re=Math.max(0,Math.min(te,ne)),ie=re*c,ae=te<0?D+te*c:D,oe=A[re]??0,se=ie===0?0:v+oe,ce=re+ae/c,le=ce<A.length?b-A[ce]:b-(M-t-y);return{startingLine:ie,totalLines:ae,bufferBefore:se,bufferAfter:Math.max(0,le)}}};function Or(e){let t;for(let n of e){if(n==null)continue;let e=n.children[1];if(e instanceof HTMLElement)for(let n of e.children)n instanceof HTMLElement&&n.dataset.lineAnnotation===Ne&&(t=Math.max(t??0,n.getBoundingClientRect().height))}return t}function kr(e){let t=Array.from(e).sort((e,t)=>e[0]-t[0]),n=[],r=[0],i=0;for(let[e,a]of t)n.push(e),i+=a,r.push(i);return{lineIndexes:n,prefixTotals:r}}function Ar({lineIndexes:e,prefixTotals:t},n,r){if(n>=r||e.length===0)return 0;let i=jr(e,n);return(t[jr(e,r)]??0)-(t[i]??0)}function jr(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>1,a=e[i];if(a==null)throw Error(`VirtualizedFileDiff: invalid prefix index`);a<t?n=i+1:r=i}return n}function Mr(e){return Math.ceil(e/Tr)*Tr}function Nr(e,t){let n=0;for(let r of e)r<t&&n++;return n}function Pr({diffStyle:e,hunk:t,rowCount:n}){if(n<=0||!t.noEOFCRAdditions&&!t.noEOFCRDeletions)return[];let r=t.hunkContent.at(-1);if(r==null)return[];if(r.type===`context`)return[n-1];let i=Math.max(r.deletions,r.additions),a=r.deletions+r.additions;if(e===`split`)return i>0&&(t.noEOFCRAdditions||t.noEOFCRDeletions)?[n-1]:[];let o=[],s=n-a;return r.deletions>0&&t.noEOFCRDeletions&&o.push(s+r.deletions-1),r.additions>0&&t.noEOFCRAdditions&&o.push(n-1),o}function Fr(e,t){return(e.diffStyle??`split`)!==(t.diffStyle??`split`)||(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.collapsed??!1)!==(t.collapsed??!1)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.diffIndicators??`bars`)!==(t.diffIndicators??`bars`)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||!!e.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)||e.unsafeCSS!==t.unsafeCSS}function Ir(e,t){return(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||!!e.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function Lr(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function Rr(e){return typeof e==`function`?`custom`:e??`line-info`}function zr(e,t){return e==null||t==null?e==null&&t==null:N(e,t)}function Br(e,t){let[n,r]=e.split(`,`).map(Number);return t===`split`?r:n}function Vr({hunkIndex:e,lineIndex:t,conflictIndex:n}){return`merge-conflict-action-${e}-${t}-${n}`}function Hr(e,t){let n=t.hunks[e.hunkIndex];if(n!=null)return{hunkIndex:e.hunkIndex,lineIndex:Ur(n,e.startContentIndex)}}function Ur(e,t){let n=e.unifiedLineStart;for(let r=0;r<t;r++){let t=e.hunkContent[r];n+=t.type===`context`?t.lines:t.deletions+t.additions}return n}var $=e();function Wr({fileDiff:e,actions:t,renderCustomHeader:n,renderHeaderPrefix:r,renderHeaderFilenameSuffix:i,renderHeaderMetadata:a,renderAnnotation:o,renderGutterUtility:s,renderMergeConflictUtility:c,lineAnnotations:l,getHoveredLine:u,getInstance:d}){let f=n?.(e),p=r?.(e),m=i?.(e),h=a?.(e);return(0,$.jsxs)($.Fragment,{children:[f==null?(0,$.jsxs)($.Fragment,{children:[p!=null&&(0,$.jsx)(`div`,{slot:`header-prefix`,children:p}),m!=null&&(0,$.jsx)(`div`,{slot:`header-filename-suffix`,children:m}),h!=null&&(0,$.jsx)(`div`,{slot:`header-metadata`,children:h})]}):(0,$.jsx)(`div`,{slot:ce,children:f}),o!=null&&l?.map((e,t)=>(0,$.jsx)(`div`,{slot:V(e),children:o(e)},t)),t!=null&&c!=null&&d!=null&&t.map(t=>{if(t==null)return;let n=Gr(t,e);return(0,$.jsx)(`div`,{slot:n,style:de,children:c(t,d)},n)}),s!=null&&(0,$.jsx)(`div`,{slot:`gutter-utility-slot`,style:je,children:s(u)})]})}function Gr(e,t){let n=Hr(e,t);return n==null?void 0:Vr({hunkIndex:n.hunkIndex,lineIndex:n.lineIndex,conflictIndex:e.conflictIndex})}function Kr(e,t=`diff-panel`){if(!e)return null;let n=e.trim();if(n.length===0)return null;try{let e=pt(n,xe(n,t)).flatMap(e=>e.files);return e.length>0?{kind:`files`,files:e}:{kind:`raw`,text:n,reason:`Unsupported diff format. Showing raw patch.`}}catch{return{kind:`raw`,text:n,reason:`Failed to parse patch. Showing raw patch.`}}}function qr(e){let t=e.name??e.prevName??``;return t.startsWith(`a/`)||t.startsWith(`b/`)?t.slice(2):t}function Jr(e){return e.cacheKey??`${e.prevName??`none`}:${e.name}`}function Yr(e,t){return[...e].toSorted((e,n)=>{let r=e.checkpointTurnCount??t[e.turnId]??0,i=n.checkpointTurnCount??t[n.turnId]??0;return r===i?n.completedAt.localeCompare(e.completedAt):i-r})}function Xr(e){let t=Yr(e.summaries,e.inferredCheckpointTurnCountByTurnId),n=e.selectedTurnId===null?void 0:t.find(t=>t.turnId===e.selectedTurnId)??t[0],r=n&&(n.checkpointTurnCount??e.inferredCheckpointTurnCountByTurnId[n.turnId]),i=typeof r==`number`?{fromTurnCount:Math.max(0,r-1),toTurnCount:r}:null,a=t.map(t=>t.checkpointTurnCount??e.inferredCheckpointTurnCountByTurnId[t.turnId]).filter(e=>typeof e==`number`),o=a.length>0?Math.max(...a):void 0,s=typeof o==`number`&&o>0?o:void 0,c=!n&&typeof s==`number`?{fromTurnCount:0,toTurnCount:s}:null,l=n||t.length===0?null:`conversation:${t.map(e=>e.turnId).join(`,`)}`;return{orderedTurnDiffSummaries:t,selectedTurn:n,selectedCheckpointTurnCount:r,selectedCheckpointRange:i,conversationCheckpointTurnCount:s,conversationCheckpointRange:c,activeCheckpointRange:n?i:c,conversationCacheScope:l}}function Zr(e){return{emptyDiffMessage:e?`No net changes were captured for this turn.`:`No full-thread patch is available for these checkpoint summaries. Select a turn or a changed file to inspect captured changes.`}}function Qr(e){let t=e.edgeThreshold??4,n=Math.max(0,e.scrollWidth-e.clientWidth);return{canScrollLeft:e.scrollLeft>t,canScrollRight:e.scrollLeft<n-t}}function $r(e){return e.scrollWidth<=e.clientWidth+1?!1:Math.abs(e.deltaY)>Math.abs(e.deltaX)}function ei(e){return e.hasActiveThread?e.isGitRepo?e.turnSummaryCount===0?{kind:`no-completed-turns`}:e.hasRenderablePatch?{kind:`renderable`,error:e.checkpointDiffError}:e.isLoadingCheckpointDiff?{kind:`loading`,error:e.checkpointDiffError}:{kind:`empty`,error:e.checkpointDiffError,message:e.hasNoNetChanges?e.emptyDiffMessage:`No diff is available for this range.`}:{kind:`not-git-repo`}:{kind:`no-thread`}}export{Xr as a,$r as c,gr as d,An as f,qe as h,Zr as i,Wr as l,Je as m,Kr as n,qr as o,Ye as p,ei as r,Qr as s,Jr as t,Dr as u};
|
|
21
|
+
//# sourceMappingURL=DiffPanel.logic-D5i9QswQ.js.map
|