@quixomatic/rpf 0.1.0 → 0.3.0
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/CHANGELOG.md +87 -0
- package/README.md +13 -5
- package/assets/dev-host/THIRD_PARTY_NOTICES.txt +2937 -0
- package/assets/dev-host/boot.js +250 -0
- package/assets/dev-host/boot.js.LEGAL.txt +48 -0
- package/assets/dev-host/chunks/accordion-O6VUPQ32.js +2 -0
- package/assets/dev-host/chunks/alert-PRAGKG5L.js +2 -0
- package/assets/dev-host/chunks/alert-dialog-SCBXM23J.js +2 -0
- package/assets/dev-host/chunks/avatar-WXPKQ3Z5.js +2 -0
- package/assets/dev-host/chunks/badge-KCMWGERA.js +2 -0
- package/assets/dev-host/chunks/breadcrumb-IJQJQ5JV.js +2 -0
- package/assets/dev-host/chunks/button-4JMBKYN4.js +2 -0
- package/assets/dev-host/chunks/calendar-XXLCAUPG.js +2 -0
- package/assets/dev-host/chunks/card-EY3LK2GB.js +2 -0
- package/assets/dev-host/chunks/chart-2PHC6UIE.js +2 -0
- package/assets/dev-host/chunks/chart-blocks-PZPCWCNT.js +2 -0
- package/assets/dev-host/chunks/chart-frame-MNUFXAPU.js +3 -0
- package/assets/dev-host/chunks/charts-SKK6UTYU.js +85 -0
- package/assets/dev-host/chunks/charts-SKK6UTYU.js.LEGAL.txt +48 -0
- package/assets/dev-host/chunks/chat-TTESCYES.js +2 -0
- package/assets/dev-host/chunks/checkbox-Y2UGSRR4.js +2 -0
- package/assets/dev-host/chunks/chunk-2IZ44WWI.js +2 -0
- package/assets/dev-host/chunks/chunk-2L7NK6SJ.js +2 -0
- package/assets/dev-host/chunks/chunk-33RMFA4P.js +2 -0
- package/assets/dev-host/chunks/chunk-3H6F4X7R.js +2 -0
- package/assets/dev-host/chunks/chunk-3UDEYJRG.js +2 -0
- package/assets/dev-host/chunks/chunk-4E74H7FZ.js +2 -0
- package/assets/dev-host/chunks/chunk-4UUMO65R.js +2 -0
- package/assets/dev-host/chunks/chunk-57M36GYM.js +2 -0
- package/assets/dev-host/chunks/chunk-5EK7QOB6.js +2 -0
- package/assets/dev-host/chunks/chunk-5YMOXSSM.js +2 -0
- package/assets/dev-host/chunks/chunk-5ZMYWE5S.js +2 -0
- package/assets/dev-host/chunks/chunk-6ARM5VDH.js +2 -0
- package/assets/dev-host/chunks/chunk-7OCTAHT6.js +2 -0
- package/assets/dev-host/chunks/chunk-7TG23VIV.js +2 -0
- package/assets/dev-host/chunks/chunk-AAL6V4Y3.js +2 -0
- package/assets/dev-host/chunks/chunk-APP2HKWR.js +8 -0
- package/assets/dev-host/chunks/chunk-AVSRGCSF.js +2 -0
- package/assets/dev-host/chunks/chunk-AZWODE64.js +2 -0
- package/assets/dev-host/chunks/chunk-B4MRCKT4.js +2 -0
- package/assets/dev-host/chunks/chunk-BB4IX5QA.js +2 -0
- package/assets/dev-host/chunks/chunk-BH6FGVDP.js +2 -0
- package/assets/dev-host/chunks/chunk-BJZOPTWR.js +2 -0
- package/assets/dev-host/chunks/chunk-CCXMDKVL.js +2 -0
- package/assets/dev-host/chunks/chunk-CJ5CECQT.js +1 -0
- package/assets/dev-host/chunks/chunk-CLVPTZ4G.js +2 -0
- package/assets/dev-host/chunks/chunk-CT4EH2K2.js +8 -0
- package/assets/dev-host/chunks/chunk-CT4EH2K2.js.LEGAL.txt +12 -0
- package/assets/dev-host/chunks/chunk-CWDPAB6V.js +2 -0
- package/assets/dev-host/chunks/chunk-D7BPK3AE.js +1 -0
- package/assets/dev-host/chunks/chunk-DG6LRRQT.js +2 -0
- package/assets/dev-host/chunks/chunk-DR47HKIK.js +2 -0
- package/assets/dev-host/chunks/chunk-E75HEEMN.js +2 -0
- package/assets/dev-host/chunks/chunk-EDEL6XSO.js +2 -0
- package/assets/dev-host/chunks/chunk-EGZKG2B2.js +2 -0
- package/assets/dev-host/chunks/chunk-F353PAEY.js +2 -0
- package/assets/dev-host/chunks/chunk-F5MKIWPQ.js +2 -0
- package/assets/dev-host/chunks/chunk-FJRWQRLM.js +2 -0
- package/assets/dev-host/chunks/chunk-FROPNHO5.js +2 -0
- package/assets/dev-host/chunks/chunk-FTWKUXER.js +2 -0
- package/assets/dev-host/chunks/chunk-FZPMZMFU.js +2 -0
- package/assets/dev-host/chunks/chunk-GN3SYBEC.js +2 -0
- package/assets/dev-host/chunks/chunk-GQYRJYJV.js +2 -0
- package/assets/dev-host/chunks/chunk-GWDGPUGM.js +2 -0
- package/assets/dev-host/chunks/chunk-GX72R347.js +2 -0
- package/assets/dev-host/chunks/chunk-GZJCEDUU.js +4 -0
- package/assets/dev-host/chunks/chunk-H6TI5TWN.js +2 -0
- package/assets/dev-host/chunks/chunk-HFUDOYIP.js +16 -0
- package/assets/dev-host/chunks/chunk-IAEAQCYR.js +2 -0
- package/assets/dev-host/chunks/chunk-IJQ26FTX.js +15 -0
- package/assets/dev-host/chunks/chunk-IJQ26FTX.js.LEGAL.txt +12 -0
- package/assets/dev-host/chunks/chunk-IQ2XSDFU.js +3 -0
- package/assets/dev-host/chunks/chunk-IQ2XSDFU.js.LEGAL.txt +146 -0
- package/assets/dev-host/chunks/chunk-IWEJRU22.js +2 -0
- package/assets/dev-host/chunks/chunk-JIAVZ3V7.js +3 -0
- package/assets/dev-host/chunks/chunk-K7LVVFGH.js +1 -0
- package/assets/dev-host/chunks/chunk-KAZVAX35.js +2 -0
- package/assets/dev-host/chunks/chunk-KCTKD6GV.js +2 -0
- package/assets/dev-host/chunks/chunk-KNOE7TZW.js +2 -0
- package/assets/dev-host/chunks/chunk-KOQLDUOI.js +2 -0
- package/assets/dev-host/chunks/chunk-KPP4HYUV.js +2 -0
- package/assets/dev-host/chunks/chunk-KSVOOYUA.js +2 -0
- package/assets/dev-host/chunks/chunk-KVMUXFPB.js +2 -0
- package/assets/dev-host/chunks/chunk-LTVKSGLG.js +2 -0
- package/assets/dev-host/chunks/chunk-LYT7LQS3.js +2 -0
- package/assets/dev-host/chunks/chunk-M7A47ZSM.js +2 -0
- package/assets/dev-host/chunks/chunk-MGLBTOXD.js +6 -0
- package/assets/dev-host/chunks/chunk-ML6HCGK5.js +2 -0
- package/assets/dev-host/chunks/chunk-MQ67DRDE.js +2 -0
- package/assets/dev-host/chunks/chunk-MTHCFDUE.js +2 -0
- package/assets/dev-host/chunks/chunk-NI6ZJ6DH.js +2 -0
- package/assets/dev-host/chunks/chunk-NJX7QY3Z.js +2 -0
- package/assets/dev-host/chunks/chunk-NZ73KS2Y.js +2 -0
- package/assets/dev-host/chunks/chunk-OW6AVFQA.js +2 -0
- package/assets/dev-host/chunks/chunk-OXJ6LWKI.js +3 -0
- package/assets/dev-host/chunks/chunk-OXJ6LWKI.js.LEGAL.txt +12 -0
- package/assets/dev-host/chunks/chunk-PHK25MY7.js +2 -0
- package/assets/dev-host/chunks/chunk-PQMY72VV.js +2 -0
- package/assets/dev-host/chunks/chunk-PWFHIE6D.js +2 -0
- package/assets/dev-host/chunks/chunk-PYWKHILP.js +2 -0
- package/assets/dev-host/chunks/chunk-QFN6XL4O.js +2 -0
- package/assets/dev-host/chunks/chunk-R5KQ2GRA.js +2 -0
- package/assets/dev-host/chunks/chunk-RCNX6LVJ.js +3 -0
- package/assets/dev-host/chunks/chunk-RCNX6LVJ.js.LEGAL.txt +12 -0
- package/assets/dev-host/chunks/chunk-SFI7YWVR.js +2 -0
- package/assets/dev-host/chunks/chunk-SLZI4G3N.js +2 -0
- package/assets/dev-host/chunks/chunk-SVQCDOZ3.js +2 -0
- package/assets/dev-host/chunks/chunk-T4Y5HG5P.js +4 -0
- package/assets/dev-host/chunks/chunk-T7JFBQSG.js +2 -0
- package/assets/dev-host/chunks/chunk-TIJLEKZ2.js +2 -0
- package/assets/dev-host/chunks/chunk-TNLYU77Y.js +2 -0
- package/assets/dev-host/chunks/chunk-TQPXDAVH.js +2 -0
- package/assets/dev-host/chunks/chunk-UH726PMV.js +7 -0
- package/assets/dev-host/chunks/chunk-UH726PMV.js.LEGAL.txt +12 -0
- package/assets/dev-host/chunks/chunk-URJZKT45.js +2 -0
- package/assets/dev-host/chunks/chunk-URWVHIIJ.js +2 -0
- package/assets/dev-host/chunks/chunk-UUJ5X322.js +2 -0
- package/assets/dev-host/chunks/chunk-UWANBOC6.js +2 -0
- package/assets/dev-host/chunks/chunk-UXUS6DNI.js +2 -0
- package/assets/dev-host/chunks/chunk-VKXVJGG5.js +6 -0
- package/assets/dev-host/chunks/chunk-VSM3ZOBU.js +2 -0
- package/assets/dev-host/chunks/chunk-WLBNJ4K3.js +2 -0
- package/assets/dev-host/chunks/chunk-WRHZYADJ.js +2 -0
- package/assets/dev-host/chunks/chunk-WT34MBTN.js +2 -0
- package/assets/dev-host/chunks/chunk-X34AFUS2.js +2 -0
- package/assets/dev-host/chunks/chunk-XE5RQ73V.js +2 -0
- package/assets/dev-host/chunks/chunk-XGLVZEGD.js +2 -0
- package/assets/dev-host/chunks/chunk-XIXCIQKJ.js +2 -0
- package/assets/dev-host/chunks/chunk-Z76KXEPD.js +2 -0
- package/assets/dev-host/chunks/code-block-H2ETQV3M.js +2 -0
- package/assets/dev-host/chunks/code-editor-2JYERJLS.js +2 -0
- package/assets/dev-host/chunks/collapsible-4ZOFMWLB.js +2 -0
- package/assets/dev-host/chunks/color-UDQWYS2D.js +2 -0
- package/assets/dev-host/chunks/color-picker-RRCCLR54.js +2 -0
- package/assets/dev-host/chunks/combobox-U4455OMJ.js +2 -0
- package/assets/dev-host/chunks/contrast-badge-KDF65X7J.js +2 -0
- package/assets/dev-host/chunks/core.esm-WYAV6XZS.js +2 -0
- package/assets/dev-host/chunks/date-range-picker-WJYHAHRM.js +2 -0
- package/assets/dev-host/chunks/dialog-I6AGHWB3.js +2 -0
- package/assets/dev-host/chunks/dist-T43K2TRF.js +2 -0
- package/assets/dev-host/chunks/dropdown-menu-LSOMXDWG.js +2 -0
- package/assets/dev-host/chunks/empty-NLQODUSK.js +2 -0
- package/assets/dev-host/chunks/esm-L33CRTOD.js +5 -0
- package/assets/dev-host/chunks/font-picker-3TLYYZJH.js +2 -0
- package/assets/dev-host/chunks/frame-HA7UIYZF.js +2 -0
- package/assets/dev-host/chunks/heading-7M24WKK6.js +2 -0
- package/assets/dev-host/chunks/hover-card-HSHOQPOI.js +2 -0
- package/assets/dev-host/chunks/icon-NZIMARLZ.js +2 -0
- package/assets/dev-host/chunks/image-R7XGYKVH.js +2 -0
- package/assets/dev-host/chunks/index-fn-BUQBI34R.js +5 -0
- package/assets/dev-host/chunks/index.esm-SPI7ZXRT.js +6 -0
- package/assets/dev-host/chunks/index.esm-SPI7ZXRT.js.LEGAL.txt +25 -0
- package/assets/dev-host/chunks/input-YECXNM53.js +2 -0
- package/assets/dev-host/chunks/input-group-GFKXSZM7.js +2 -0
- package/assets/dev-host/chunks/kbd-V25ZMVCM.js +2 -0
- package/assets/dev-host/chunks/label-LJT4V2CT.js +2 -0
- package/assets/dev-host/chunks/label-value-6Z6ATP55.js +2 -0
- package/assets/dev-host/chunks/legacy-4ICQWPOE.js +2 -0
- package/assets/dev-host/chunks/logo-AAMBHX2W.js +2 -0
- package/assets/dev-host/chunks/number-field-6TCQAVTR.js +2 -0
- package/assets/dev-host/chunks/pill-7L57ZNRJ.js +2 -0
- package/assets/dev-host/chunks/popover-3P6YNKH3.js +2 -0
- package/assets/dev-host/chunks/portal-code-Z5G6AEMM.js +25 -0
- package/assets/dev-host/chunks/portal-rte-7B6VXIZO.js +163 -0
- package/assets/dev-host/chunks/progress-RBCJRVM7.js +2 -0
- package/assets/dev-host/chunks/radio-group-NJWXZCX3.js +2 -0
- package/assets/dev-host/chunks/resizable-XF4P6OKR.js +2 -0
- package/assets/dev-host/chunks/rich-text-7OMYZ564.js +2 -0
- package/assets/dev-host/chunks/rich-text-editor-T6KWD4P3.js +2 -0
- package/assets/dev-host/chunks/scroll-row-LMI7JCFR.js +2 -0
- package/assets/dev-host/chunks/select-F3MZWTTS.js +2 -0
- package/assets/dev-host/chunks/separator-JRJYKM4Z.js +2 -0
- package/assets/dev-host/chunks/sheet-EXRT4MFB.js +2 -0
- package/assets/dev-host/chunks/side-panel-IBHLEANN.js +2 -0
- package/assets/dev-host/chunks/sidebar-VKQMQMF2.js +2 -0
- package/assets/dev-host/chunks/skeleton-KIRVQ4EO.js +2 -0
- package/assets/dev-host/chunks/slider-XKYDL5MR.js +2 -0
- package/assets/dev-host/chunks/sortable.esm-3VPY5PX7.js +2 -0
- package/assets/dev-host/chunks/split-button-WP6LALDS.js +2 -0
- package/assets/dev-host/chunks/stepper-KR6PXZHW.js +2 -0
- package/assets/dev-host/chunks/switch-P6NJELJJ.js +2 -0
- package/assets/dev-host/chunks/tabs-PFPRJNVZ.js +2 -0
- package/assets/dev-host/chunks/textarea-2JXA5XWS.js +2 -0
- package/assets/dev-host/chunks/toggle-group-PS7JN2JM.js +2 -0
- package/assets/dev-host/chunks/tooltip-S4RBC3O4.js +2 -0
- package/assets/dev-host/chunks/tree-NQF6ZJLH.js +2 -0
- package/assets/dev-host/chunks/utilities.esm-YYZNDLV4.js +2 -0
- package/assets/dev-host/css/shadcn-tailwind.css +637 -0
- package/assets/dev-host/css/tw-animate.css +1 -0
- package/assets/dev-host/kit-candidates.json +1 -0
- package/assets/dev-host/kit-manifest.json +435 -0
- package/assets/forge-app/THIRD_PARTY_NOTICES.txt +5283 -0
- package/assets/forge-app/app/assets/_forge-shiki-langs-BtmKnsX8.js +2 -0
- package/assets/forge-app/app/assets/andromeeda-CWX9QkEw.js +1 -0
- package/assets/forge-app/app/assets/appendItems-D8y87kIw.js +10 -0
- package/assets/forge-app/app/assets/aurora-x-C7LW0A0Z.js +1 -0
- package/assets/forge-app/app/assets/ayu-dark-UyEq0fEv.js +1 -0
- package/assets/forge-app/app/assets/ayu-light-BGLrZRfL.js +1 -0
- package/assets/forge-app/app/assets/ayu-mirage-DU2uuvme.js +1 -0
- package/assets/forge-app/app/assets/catppuccin-frappe-Ba2J56Xe.js +1 -0
- package/assets/forge-app/app/assets/catppuccin-latte-Du_f_kXm.js +1 -0
- package/assets/forge-app/app/assets/catppuccin-macchiato-DAr1oMDX.js +1 -0
- package/assets/forge-app/app/assets/catppuccin-mocha-F6YLrtz0.js +1 -0
- package/assets/forge-app/app/assets/core-pm_tYnN8.js +12 -0
- package/assets/forge-app/app/assets/css-C8fQr_0Q.js +1 -0
- package/assets/forge-app/app/assets/dark-plus-2IOGu4uA.js +1 -0
- package/assets/forge-app/app/assets/diff-view-KCzB8C4U.js +28 -0
- package/assets/forge-app/app/assets/diff-woXpYk--.js +1 -0
- package/assets/forge-app/app/assets/dracula-DZjgIiCY.js +1 -0
- package/assets/forge-app/app/assets/dracula-soft-Buj7Kmgw.js +1 -0
- package/assets/forge-app/app/assets/engine-javascript-C4Jk_eU2.js +141 -0
- package/assets/forge-app/app/assets/engine-oniguruma-D--T0LcV.js +1 -0
- package/assets/forge-app/app/assets/everforest-dark-Lvcw1Pr0.js +1 -0
- package/assets/forge-app/app/assets/everforest-light-YrYDdHjZ.js +1 -0
- package/assets/forge-app/app/assets/file-panel-BKKQ3JJL.js +1199 -0
- package/assets/forge-app/app/assets/formatCSSVariablePrefix-KRh9vnZf.js +1 -0
- package/assets/forge-app/app/assets/github-dark-CdJXf8Kw.js +1 -0
- package/assets/forge-app/app/assets/github-dark-default-BqPxBNAT.js +1 -0
- package/assets/forge-app/app/assets/github-dark-dimmed-DyY5b2F0.js +1 -0
- package/assets/forge-app/app/assets/github-dark-high-contrast-xd2ezW53.js +1 -0
- package/assets/forge-app/app/assets/github-light-CX58plA4.js +1 -0
- package/assets/forge-app/app/assets/github-light-default-DKbnGXTT.js +1 -0
- package/assets/forge-app/app/assets/github-light-high-contrast-uBB_OJ7x.js +1 -0
- package/assets/forge-app/app/assets/gruvbox-dark-hard-4xwr00-8.js +1 -0
- package/assets/forge-app/app/assets/gruvbox-dark-medium-CpS6Oukh.js +1 -0
- package/assets/forge-app/app/assets/gruvbox-dark-soft-CgQlpZ36.js +1 -0
- package/assets/forge-app/app/assets/gruvbox-light-hard-o8ZwY_jI.js +1 -0
- package/assets/forge-app/app/assets/gruvbox-light-medium-BOAI5TwH.js +1 -0
- package/assets/forge-app/app/assets/gruvbox-light-soft-DYjh34qH.js +1 -0
- package/assets/forge-app/app/assets/highlights-dvwIMyOh.js +7 -0
- package/assets/forge-app/app/assets/horizon-BJ3G7U7Q.js +1 -0
- package/assets/forge-app/app/assets/horizon-bright-onknclPd.js +1 -0
- package/assets/forge-app/app/assets/houston-CzdgljLR.js +1 -0
- package/assets/forge-app/app/assets/html-wSbaAAK3.js +1 -0
- package/assets/forge-app/app/assets/index-BwYJlfwT.css +1 -0
- package/assets/forge-app/app/assets/index-DgB2FK2g.js +291 -0
- package/assets/forge-app/app/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
- package/assets/forge-app/app/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
- package/assets/forge-app/app/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
- package/assets/forge-app/app/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
- package/assets/forge-app/app/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
- package/assets/forge-app/app/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
- package/assets/forge-app/app/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
- package/assets/forge-app/app/assets/javascript-BgS3c2Ky.js +1 -0
- package/assets/forge-app/app/assets/json-qhed-kSA.js +1 -0
- package/assets/forge-app/app/assets/jsonc-CYpm1nAK.js +1 -0
- package/assets/forge-app/app/assets/jsx-Bz0zcwM4.js +1 -0
- package/assets/forge-app/app/assets/kanagawa-dragon-BQVheBBo.js +1 -0
- package/assets/forge-app/app/assets/kanagawa-lotus-CPemrbqC.js +1 -0
- package/assets/forge-app/app/assets/kanagawa-wave-CoCEno9V.js +1 -0
- package/assets/forge-app/app/assets/laserwave-B5bEuTwe.js +1 -0
- package/assets/forge-app/app/assets/lib-BOh9Tw1y.js +1 -0
- package/assets/forge-app/app/assets/light-plus-BZZlmvcU.js +1 -0
- package/assets/forge-app/app/assets/loader-DUZOP7q_.js +1 -0
- package/assets/forge-app/app/assets/markdown-BYOwaDjH.js +1 -0
- package/assets/forge-app/app/assets/material-theme-aeHmkUm6.js +1 -0
- package/assets/forge-app/app/assets/material-theme-darker-0axHxn5k.js +1 -0
- package/assets/forge-app/app/assets/material-theme-lighter-BsSyB7lm.js +1 -0
- package/assets/forge-app/app/assets/material-theme-ocean-BVrhCaVf.js +1 -0
- package/assets/forge-app/app/assets/material-theme-palenight-C7ZR4CGM.js +1 -0
- package/assets/forge-app/app/assets/min-dark-BKaXaz6D.js +1 -0
- package/assets/forge-app/app/assets/min-light-CF3GufC7.js +1 -0
- package/assets/forge-app/app/assets/monokai-CkP2YA7x.js +1 -0
- package/assets/forge-app/app/assets/night-owl-BWMbd2rn.js +1 -0
- package/assets/forge-app/app/assets/night-owl-light-C_TsrL-a.js +1 -0
- package/assets/forge-app/app/assets/nord-62p94tpv.js +1 -0
- package/assets/forge-app/app/assets/one-dark-pro-DUBUnUMB.js +1 -0
- package/assets/forge-app/app/assets/one-light-CqcpbeDc.js +1 -0
- package/assets/forge-app/app/assets/pierre-dark-CFuQzxDG.js +1 -0
- package/assets/forge-app/app/assets/pierre-dark-DMS-zpcK.js +1 -0
- package/assets/forge-app/app/assets/pierre-dark-protanopia-deuteranopia-BSiWRjoV.js +1 -0
- package/assets/forge-app/app/assets/pierre-dark-protanopia-deuteranopia-Ddq4E1VN.js +1 -0
- package/assets/forge-app/app/assets/pierre-dark-soft-BMbLOt5W.js +1 -0
- package/assets/forge-app/app/assets/pierre-dark-soft-BUesjllf.js +1 -0
- package/assets/forge-app/app/assets/pierre-dark-tritanopia-BGSLfXJy.js +1 -0
- package/assets/forge-app/app/assets/pierre-dark-tritanopia-CX9_YYVl.js +1 -0
- package/assets/forge-app/app/assets/pierre-dark-vibrant-Dlj8tZff.js +1 -0
- package/assets/forge-app/app/assets/pierre-dark-vibrant-bYj7HUnF.js +1 -0
- package/assets/forge-app/app/assets/pierre-light-BHq6aQNU.js +1 -0
- package/assets/forge-app/app/assets/pierre-light-DGR1TxHn.js +1 -0
- package/assets/forge-app/app/assets/pierre-light-protanopia-deuteranopia-ChtB5hGy.js +1 -0
- package/assets/forge-app/app/assets/pierre-light-protanopia-deuteranopia-xNu39ZI5.js +1 -0
- package/assets/forge-app/app/assets/pierre-light-soft-BmBpKxVJ.js +1 -0
- package/assets/forge-app/app/assets/pierre-light-soft-DTxn6Rur.js +1 -0
- package/assets/forge-app/app/assets/pierre-light-tritanopia-DF_s91q9.js +1 -0
- package/assets/forge-app/app/assets/pierre-light-tritanopia-DyKDz8Fz.js +1 -0
- package/assets/forge-app/app/assets/pierre-light-vibrant-BEba13rj.js +1 -0
- package/assets/forge-app/app/assets/pierre-light-vibrant-DsCzsubQ.js +1 -0
- package/assets/forge-app/app/assets/plastic-baAbzXTu.js +1 -0
- package/assets/forge-app/app/assets/poimandres-64TexMzA.js +1 -0
- package/assets/forge-app/app/assets/red-cnNTP7m6.js +1 -0
- package/assets/forge-app/app/assets/rose-pine-Dcg36Rqi.js +1 -0
- package/assets/forge-app/app/assets/rose-pine-dawn-Sx7X9we0.js +1 -0
- package/assets/forge-app/app/assets/rose-pine-moon-CoglSunF.js +1 -0
- package/assets/forge-app/app/assets/shellscript-CLZ0U2zV.js +1 -0
- package/assets/forge-app/app/assets/shiki-BghTRNDM.js +2 -0
- package/assets/forge-app/app/assets/slack-dark-C86YGzJx.js +1 -0
- package/assets/forge-app/app/assets/slack-ochin-DPmXYTYk.js +1 -0
- package/assets/forge-app/app/assets/snazzy-light-BD8dOedc.js +1 -0
- package/assets/forge-app/app/assets/solarized-dark-Bs7TdbJI.js +1 -0
- package/assets/forge-app/app/assets/solarized-light-DXYdl5LH.js +1 -0
- package/assets/forge-app/app/assets/stream-tokenizer-BzA0VElt.js +4 -0
- package/assets/forge-app/app/assets/synthwave-84-JFh1mrS8.js +1 -0
- package/assets/forge-app/app/assets/terminal-view-BdvNEDWd.js +16 -0
- package/assets/forge-app/app/assets/terminal-view-BrP-ENHg.css +1 -0
- package/assets/forge-app/app/assets/themes-D3CUotbU.js +2 -0
- package/assets/forge-app/app/assets/tokyo-night-BLjaCl8e.js +1 -0
- package/assets/forge-app/app/assets/tsx-udAQXfEw.js +1 -0
- package/assets/forge-app/app/assets/typescript-bsJCZSQ-.js +1 -0
- package/assets/forge-app/app/assets/useNextRenderData-BaDffqa5.js +149 -0
- package/assets/forge-app/app/assets/utils-C9Glzetk.js +2 -0
- package/assets/forge-app/app/assets/vesper-DZzlHXr_.js +1 -0
- package/assets/forge-app/app/assets/vitesse-black-BRf870Fc.js +1 -0
- package/assets/forge-app/app/assets/vitesse-dark-B9ZPQf4u.js +1 -0
- package/assets/forge-app/app/assets/vitesse-light-1s3aLQn3.js +1 -0
- package/assets/forge-app/app/assets/wasm-4KdTHw0F.js +1 -0
- package/assets/forge-app/app/assets/yaml-rwi0_p6S.js +1 -0
- package/assets/forge-app/app/favicon.svg +1 -0
- package/assets/forge-app/app/index.html +23 -0
- package/assets/forge-app/server.mjs +86999 -0
- package/dist/cli.mjs +7724 -3293
- package/package.json +9 -3
- package/skills/react-portal/SKILL.md +3 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={name:`Dark Plus`,appearance:`dark`,style:{background:`#1e1e1eff`,text:`#d4d4d4ff`,"editor.background":`#1e1e1eff`,"editor.foreground":`#d4d4d4ff`,"editor.active_line.background":`#d4d4d40a`,"editor.document_highlight.bracket_background":`#d4d4d41a`,"search.match_background":`#d4d4d433`,players:[{cursor:`#d4d4d4ff`,background:`#d4d4d426`,selection:`#d4d4d433`},{cursor:`#d4b455ff`,background:`#d4b45526`,selection:`#d4b4554d`},{cursor:`#94d455ff`,background:`#94d45526`,selection:`#94d4554d`},{cursor:`#55d475ff`,background:`#55d47526`,selection:`#55d4754d`},{cursor:`#55d4d4ff`,background:`#55d4d426`,selection:`#55d4d44d`},{cursor:`#5575d4ff`,background:`#5575d426`,selection:`#5575d44d`},{cursor:`#9455d4ff`,background:`#9455d426`,selection:`#9455d44d`},{cursor:`#d455b4ff`,background:`#d455b426`,selection:`#d455b44d`}],error:`#f44747ff`,warning:`#cca700ff`,info:`#3794ffff`,hint:`#969696ff`,"terminal.ansi.black":`#000000ff`,"terminal.ansi.red":`#cd3131ff`,"terminal.ansi.green":`#0dbc79ff`,"terminal.ansi.yellow":`#e5e510ff`,"terminal.ansi.blue":`#2472c8ff`,"terminal.ansi.magenta":`#bc3fbcff`,"terminal.ansi.cyan":`#11a8cdff`,"terminal.ansi.white":`#e5e5e5ff`,"terminal.ansi.bright_black":`#666666ff`,"terminal.ansi.bright_red":`#f14c4cff`,"terminal.ansi.bright_green":`#23d18bff`,"terminal.ansi.bright_yellow":`#f5f543ff`,"terminal.ansi.bright_blue":`#3b8eeaff`,"terminal.ansi.bright_magenta":`#d670d6ff`,"terminal.ansi.bright_cyan":`#29b8dbff`,"terminal.ansi.bright_white":`#e5e5e5ff`,syntax:{comment:{color:`#6a9955ff`},"comment.doc":{color:`#6a9955ff`},string:{color:`#ce9178ff`},"string.regex":{color:`#d16969ff`},"string.escape":{color:`#d7ba7dff`},link_text:{color:`#ce9178ff`},number:{color:`#b5cea8ff`},boolean:{color:`#569cd6ff`},"constant.builtin":{color:`#569cd6ff`},constant:{color:`#4FC1FF`},variable:{color:`#9cdcfeff`},"variable.special":{color:`#569cd6ff`},"variable.parameter":{color:`#9cdcfeff`},keyword:{color:`#569cd6ff`},operator:{color:`#d4d4d4ff`},type:{color:`#4ec9b0ff`},"type.builtin":{color:`#4ec9b0ff`},function:{color:`#dcdcaaff`},"function.builtin":{color:`#dcdcaaff`},tag:{color:`#569cd6ff`},attribute:{color:`#9cdcfeff`},"punctuation.special":{color:`#569cd6ff`},"punctuation.bracket":{color:`#d4d4d4ff`},"punctuation.delimiter":{color:`#d4d4d4ff`},"punctuation.list_marker":{color:`#6796e6ff`},punctuation:{color:`#d4d4d4ff`},preproc:{color:`#569cd6ff`},title:{color:`#569cd6ff`,font_weight:700},"emphasis.strong":{color:`#569cd6ff`,font_weight:700},emphasis:{color:`#c586c0ff`,font_style:`italic`},"text.literal":{color:`#ce9178ff`},enum:{color:`#4ec9b0ff`},property:{color:`#9cdcfeff`},label:{color:`#C8C8C8`},constructor:{color:`#dcdcaaff`},namespace:{color:`#4ec9b0ff`},"diff.minus":{color:`#ce9178ff`},"diff.plus":{color:`#b5cea8ff`},embedded:{color:`#d4d4d4ff`},selector:{color:`#d7ba7dff`},"selector.pseudo":{color:`#D7BA7D`},variant:{color:`#4fc1ffff`},"string.special":{color:`#ce9178ff`},"punctuation.markup":{color:`#d4d4d4ff`},primary:{color:`#d4d4d4ff`},link_uri:{color:`#d4d4d4ff`},hint:{color:`#d4d4d466`},predictive:{color:`#d4d4d466`},"string.special.symbol":{color:`#d4d4d4ff`},"keyword.control":{color:`#C586C0`},"keyword.import":{color:`#C586C0`},"tag.doctype":{color:`#d4d4d4ff`},"punctuation.bracket.html":{color:`#808080`},"punctuation.bracket.jsx":{color:`#808080`},"punctuation.delimiter.html":{color:`#808080`},"punctuation.delimiter.jsx":{color:`#808080`},"tag.component.jsx":{color:`#4EC9B0`}},created:`#81b88b`,deleted:`#c74e39`,modified:`#E2C08D`},id:`dark-plus`};export{e as default};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import{A as e,B as t,E as n,F as r,G as i,H as a,Ht as o,K as s,N as c,P as l,T as u,U as d,V as f,W as p,_ as m,b as h,cn as g,g as _,j as v,pn as y,q as b,s as x,un as S,v as C,y as w,z as T}from"./index-DgB2FK2g.js";import{$ as E,At as D,B as O,Bt as k,C as A,Ct as j,D as M,Dt as N,E as P,Et as F,F as ee,Ft as te,G as I,H as ne,Ht as re,I as ie,It as L,J as ae,K as oe,L as se,Lt as ce,M as le,Mt as ue,N as de,Nt as fe,O as pe,Ot as me,P as he,Pt as ge,Q as _e,R as ve,Rt as ye,S as be,St as xe,T as Se,Tt as Ce,U as we,Ut as Te,V as Ee,Vt as De,W as Oe,Wt as ke,X as Ae,Y as je,Z as Me,_ as Ne,_t as Pe,a as Fe,at as Ie,b as Le,bt as Re,c as ze,ct as Be,dt as Ve,et as He,f as Ue,ft as We,gt as Ge,h as Ke,ht as qe,j as Je,jt as Ye,k as Xe,l as Ze,lt as Qe,m as $e,mt as et,n as tt,nt,o as rt,ot as it,p as at,pt as ot,q as R,r as st,s as ct,st as lt,t as ut,u as dt,ut as ft,w as pt,x as mt,xt as ht,yt as gt,z as _t,zt as vt}from"./useNextRenderData-BaDffqa5.js";import{a as yt,f as bt,g as xt,i as St,l as Ct,m as wt,n as Tt,p as z,r as Et,t as Dt,u as Ot}from"./appendItems-D8y87kIw.js";function B(e,t){return e-(t===0?0:1)}function V(e,t){return B(e,t)+t}function kt(e,t,n){if(e==null)return;let r=e.hunks.at(-1),i,a;e:for(let o of e.hunks){let e=n===`deletions`?o.deletionStart:o.additionStart,s=n===`deletions`?o.deletionCount:o.additionCount,c=B(e,s)+1,l=o.splitLineStart,u=o.unifiedLineStart;if(t<c){let e=c-t;i=Math.max(u-e,0),a=Math.max(l-e,0);break}if(t>=c+s){if(o===r){let e=t-(c+s);i=u+o.unifiedLineCount+e,a=l+o.splitLineCount+e;break}}else{for(let e of o.hunkContent)if(e.type===`context`){if(t<c+e.lines){let e=t-c;a=l+e,i=u+e;break e}c+=e.lines,l+=e.lines,u+=e.lines}else{let r=n===`deletions`?e.deletions:e.additions;if(t<c+r){let r=t-c;i=u+(n===`additions`?e.deletions:0)+r,a=l+r;break e}c+=r,l+=Math.max(e.deletions,e.additions),u+=e.deletions+e.additions}break}}if(i!=null&&a!=null)return[i,a]}function At(e,t){let n=t===`additions`?e.additionLines:e.deletionLines;if(n.length===0)return!1;if(e.isPartial){let n=e.hunks.at(-1);return n!=null&&!(t===`additions`?n.noEOFCRAdditions:n.noEOFCRDeletions)}return n.at(-1)?.endsWith(`
|
|
2
|
+
`)===!0}function jt(e){return[B(e.additionStart,e.additionCount)+1,V(e.additionStart,e.additionCount)+1]}function Mt(e){return[B(e.deletionStart,e.deletionCount)+1,V(e.deletionStart,e.deletionCount)+1]}function Nt(e,t){return t===`additions`?jt(e):Mt(e)}function Pt(e,t,n){let r={fromStart:e?.fromStart??0,fromEnd:e?.fromEnd??0};return(t===`up`||t===`both`)&&(r.fromStart+=n),(t===`down`||t===`both`)&&(r.fromEnd+=n),r}function H({isPartial:e,rangeSize:t,expandedHunks:n,hunkIndex:r,collapsedContextThreshold:i}){let a=Math.max(t,0);if(a===0||e)return{fromStart:0,fromEnd:0,rangeSize:a,collapsedLines:a,renderAll:!1};if(n===!0||a<=i)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(r),s=Math.min(Math.max(o?.fromStart??0,0),a),c=Math.min(Math.max(o?.fromEnd??0,0),a),l=s+c,u=l>=a;return{fromStart:u?a:s,fromEnd:u?0:c,rangeSize:a,collapsedLines:Math.max(a-l,0),renderAll:u}}function Ft({fileDiff:e,errorPrefix:t}){let n=e.hunks[e.hunks.length-1];if(n==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return 0;let r=e.additionLines.length-V(n.additionStart,n.additionCount),i=e.deletionLines.length-V(n.deletionStart,n.deletionCount);if(r<=0&&i<=0)return 0;if(r!==i)throw Error(`${t}: trailing context mismatch (additions=${r}, deletions=${i}) for ${e.name}`);return Math.min(r,i)}function U({fileDiff:e,hunkIndex:t,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:i}){if(t!==e.hunks.length-1)return;let a=Ft({fileDiff:e,errorPrefix:i});if(a<=0)return;if(n===!0||a<=r)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(e.hunks.length),s=Math.min(Math.max(o?.fromStart??0,0),a);return{fromStart:s,fromEnd:0,rangeSize:a,collapsedLines:a-s,renderAll:s>=a}}function It({fileDiff:e,lineNumber:t,side:n,expandedHunks:r,collapsedContextThreshold:i}){if(r===!0||e.isPartial)return!1;for(let[a,o]of e.hunks.entries()){let[s,c]=Nt(o,n);if(t<s){let n=H({isPartial:e.isPartial,rangeSize:o.collapsedBefore,expandedHunks:r,hunkIndex:a,collapsedContextThreshold:i}),c=s-n.rangeSize;return!n.renderAll&&t>=c+n.fromStart&&t<s-n.fromEnd}if(t<c)return!1}let a=U({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:r,collapsedContextThreshold:i,errorPrefix:`isDiffLineInCollapsedContext`});if(a==null||a.renderAll)return!1;let[,o]=Nt(e.hunks[e.hunks.length-1],n);return t>=o+a.fromStart&&t<o+a.rangeSize}function Lt({fileDiff:e,lineNumber:t,direction:n,expandedHunks:r,collapsedContextThreshold:i}){if(r===!0||e.isPartial)return t;let a=[],o=1;for(let[t,n]of e.hunks.entries()){let[s,c]=jt(n),l=H({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:r,hunkIndex:t,collapsedContextThreshold:i}),u=s-l.rangeSize;l.renderAll?a.push([u,s]):(l.fromStart>0&&a.push([u,u+l.fromStart]),l.fromEnd>0&&a.push([s-l.fromEnd,s])),a.push([s,c]),o=c}let s=U({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:r,collapsedContextThreshold:i,errorPrefix:`getNearestRenderableAdditionLine`});if(s!=null){let e=o;o=e+s.rangeSize,s.renderAll?a.push([e,o]):s.fromStart>0&&a.push([e,e+s.fromStart])}if(t>=o)return t;if(n===`down`){for(let[e,n]of a)if(n>t)return Math.max(e,t)}else for(let e=a.length-1;e>=0;e--){let[n,r]=a[e];if(n<=t)return Math.min(r-1,t)}}function Rt({type:e,metrics:t}){return t.hunkSeparatorHeight??Ye(e)}function zt({type:e,metrics:t}){return e===`simple`||e===`metadata`||e===`line-info-basic`?0:t.spacing}function Bt({type:e,hunkIndex:t,hunkSpecs:n}){switch(e){case`simple`:return t>0;case`metadata`:return n!=null;case`line-info`:case`line-info-basic`:case`custom`:return!0}}function Vt(e){return e!==`simple`&&e!==`metadata`}function Ht({type:e,metrics:t,hunkIndex:n,hunkSpecs:r}){if(!Bt({type:e,hunkIndex:n,hunkSpecs:r}))return;let i=Rt({type:e,metrics:t}),a=zt({type:e,metrics:t}),o=n>0?a:0,s=a;return{height:i,gapBefore:o,gapAfter:s,totalHeight:o+i+s}}function Ut({type:e,metrics:t}){if(!Vt(e))return;let n=Rt({type:e,metrics:t}),r=zt({type:e,metrics:t});return{height:n,gapBefore:r,gapAfter:0,totalHeight:r+n}}function W(e){throw Error(`DiffRowCursor: row has no ${e} line`)}var Wt=0,Gt=1,Kt=2,qt=3,Jt=4,Yt=5,Xt=6,Zt=7,Qt=class{diff;diffStyle;expandedHunks;collapsedContextThreshold;includeTrailingNewline;startingLine;windowEnd;unifiedCount=0;splitCount=0;rowType=`context`;rowHunkIndex=0;rowHunk=void 0;rowHasDeletion=!1;rowHasAddition=!1;index=-1;end=0;secondStretchFirst=0;secondStretchEnd=0;deletionIndexStart=0;deletionNumberStart=0;deletionUnifiedStart=0;additionIndexStart=0;additionNumberStart=0;additionUnifiedStart=0;splitStart=0;firstRowCollapsedBefore=0;collapsedAfterValue=0;collapsedAfterRow=-1;deletionNoEOFCRRow=-1;additionNoEOFCRRow=-1;part=Wt;walkHunkIndex=0;walkHunk=void 0;contentIndex=0;pendingCollapsed=0;leadingStartRows=0;leadingEndRows=0;leadingRangeSize=0;trailingRows=-1;trailingCollapsed=0;unifiedAt=0;splitAt=0;deletionIndexAt=0;additionIndexAt=0;deletionNumberAt=0;additionNumberAt=0;collapsedAfterAt=-1;constructor({diff:e,diffStyle:t,startingLine:n=0,totalLines:r=1/0,expandedHunks:i,collapsedContextThreshold:a=1,includeTrailingNewline:o=!1}){this.diff=e,this.diffStyle=t,this.startingLine=n,this.windowEnd=n+r,this.expandedHunks=i,this.collapsedContextThreshold=a,this.includeTrailingNewline=o,r===0?this.part=Zt:n>0&&this.findStartingHunk()}next(){let{index:e,end:t}=this,n=e+1;return n<t?(this.index=n,!0):this.nextRun()}get type(){return this.rowType}get hunkIndex(){return this.rowHunkIndex}get hunk(){return this.rowHunk}get hasDeletion(){return this.rowHasDeletion}get hasAddition(){return this.rowHasAddition}get deletionLineIndex(){let{rowHasDeletion:e,deletionIndexStart:t,index:n}=this;return e||W(`deletion`),t+n}get deletionLineNumber(){let{rowHasDeletion:e,deletionNumberStart:t,index:n}=this;return e||W(`deletion`),t+n}get deletionUnifiedLineIndex(){let{rowHasDeletion:e,deletionUnifiedStart:t,index:n}=this;return e||W(`deletion`),t+n}get deletionNoEOFCR(){let{rowHasDeletion:e,deletionNoEOFCRRow:t,index:n}=this;return e||W(`deletion`),n===t}get additionLineIndex(){let{rowHasAddition:e,additionIndexStart:t,index:n}=this;return e||W(`addition`),t+n}get additionLineNumber(){let{rowHasAddition:e,additionNumberStart:t,index:n}=this;return e||W(`addition`),t+n}get additionUnifiedLineIndex(){let{rowHasAddition:e,additionUnifiedStart:t,index:n}=this;return e||W(`addition`),t+n}get additionNoEOFCR(){let{rowHasAddition:e,additionNoEOFCRRow:t,index:n}=this;return e||W(`addition`),n===t}get unifiedLineIndex(){let{rowHasAddition:e,additionUnifiedStart:t,deletionUnifiedStart:n,index:r}=this;return(e?t:n)+r}get splitLineIndex(){let{splitStart:e,index:t}=this;return e+t}get collapsedBefore(){let{index:e,firstRowCollapsedBefore:t}=this;return e===0?t:0}get collapsedAfter(){let{index:e,collapsedAfterRow:t,collapsedAfterValue:n}=this;return e===t?n:0}findStartingHunk(){let{diff:e,diffStyle:t,startingLine:n}=this,r=e.hunks.length-1,i=0;for(let a of e.hunks){let e=this.getLeadingRegion(a,i),o=e.fromStart+e.fromEnd;if(i===r){let e=this.getTrailingRegion();o+=(e?.fromStart??0)+(e?.fromEnd??0),this.hasTrailingNewlineRow(e?.collapsedLines??0)&&o++}let s=o+a.unifiedLineCount,c=o+a.splitLineCount,{unifiedCount:l,splitCount:u}=this;if((t===`split`?u+c:l+s)>n)break;this.unifiedCount+=s,this.splitCount+=c,i++}this.walkHunkIndex=i}getLeadingRegion(e,t){let{diff:n,expandedHunks:r,collapsedContextThreshold:i}=this;return H({isPartial:n.isPartial,rangeSize:e.collapsedBefore,expandedHunks:r,hunkIndex:t,collapsedContextThreshold:i})}getTrailingRegion(){let{diff:e,expandedHunks:t,collapsedContextThreshold:n}=this;return U({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:`DiffRowCursor`})}hasTrailingNewlineRow(e){let{diff:t,includeTrailingNewline:n}=this;return n&&e===0&&At(t,`additions`)}clipRun(e,t,n,r){let{diffStyle:i,startingLine:a,windowEnd:o}=this;if(a===0&&o===1/0)return this.index=0,this.end=e,e>0;if(i!==`both`){let r=i===`unified`?t:n;return this.index=Math.max(0,a-r),this.end=Math.min(e,o-r),this.index<this.end}let s=Math.max(0,a-t),c=Math.min(e,o-t),l=Math.max(0,a-n),u=Math.min(e,o-n),d=0,f=0;if(l<u&&(s<c?l<=c?c=Math.max(c,u):(d=l,f=u):(s=l,c=u)),r!=null){let t=Math.max(0,a-r),n=Math.min(e,o-r);t<n&&(s<c?n>=s?s=t:(d=s,f=c,s=t,c=n):(s=t,c=n))}return s>=c?!1:(this.index=s,this.end=c,d<f&&(this.secondStretchFirst=d,this.secondStretchEnd=f),!0)}isPastWindow(){let{diffStyle:e,unifiedCount:t,splitCount:n,windowEnd:r}=this;return e===`unified`?t>=r:(e===`split`||t>=r)&&n>=r}nextRun(){let{diff:e,secondStretchFirst:t,secondStretchEnd:n}=this;if(t<n)return this.index=t,this.end=n,this.secondStretchFirst=0,this.secondStretchEnd=0,!0;for(;;){if(this.part===Zt||this.isPastWindow())return this.part=Zt,!1;switch(this.part){case Wt:{let t=e.hunks[this.walkHunkIndex];if(t==null)return this.part=Zt,!1;this.enterHunk(t),this.part=Gt;break}case Gt:if(this.part=Kt,this.leadingStartRows>0&&this.startExpandedRun(this.leadingStartRows,this.leadingRangeSize,0))return!0;break;case Kt:if(this.part=qt,this.leadingEndRows>0&&this.startExpandedRun(this.leadingEndRows,this.leadingEndRows,this.takePendingCollapsed()))return!0;this.startingLine>0&&this.skipBlocksBeforeWindow();break;case qt:{let{walkHunk:e}=this;if(e==null)throw Error(`DiffRowCursor: missing hunk`);let t=e.hunkContent[this.contentIndex];if(t==null){this.part=Yt;break}let n=this.contentIndex===e.hunkContent.length-1;if(t.type===`context`){if(this.contentIndex++,this.startContextRun(e,t,n))return!0;break}if(this.part=Jt,this.startChangeRun(e,t,n,!1))return!0;break}case Jt:{let{walkHunk:e}=this;if(e==null)throw Error(`DiffRowCursor: missing hunk`);let t=e.hunkContent[this.contentIndex];if(t==null||t.type!==`change`)throw Error(`DiffRowCursor: missing change content`);let n=this.contentIndex===e.hunkContent.length-1;this.part=qt,this.contentIndex++;let r=this.startChangeRun(e,t,n,!0),{deletions:i,additions:a}=t;if(this.unifiedCount+=i+a,this.splitCount+=Math.max(i,a),this.unifiedAt+=i+a,this.splitAt+=Math.max(i,a),this.deletionIndexAt+=i,this.additionIndexAt+=a,this.deletionNumberAt+=i,this.additionNumberAt+=a,r)return!0;break}case Yt:if(this.part=Xt,this.trailingRows>0&&this.startTrailingRun())return!0;break;case Xt:{let t=this.walkHunkIndex===e.hunks.length-1;if(this.walkHunkIndex++,this.part=Wt,t&&this.hasTrailingNewlineRow(this.trailingCollapsed)&&this.startTrailingNewlineRun())return!0;break}}}}skipBlocksBeforeWindow(){let{walkHunk:e,diffStyle:t,startingLine:n,unifiedCount:r}=this;if(e==null)throw Error(`DiffRowCursor: missing hunk`);for(;this.contentIndex<e.hunkContent.length;){let r=e.hunkContent[this.contentIndex],i=r.type===`context`?r.lines:r.deletions,a=r.type===`context`?r.lines:r.additions,o=r.type===`context`?r.lines:i+a,s=Math.max(i,a),{unifiedCount:c,splitCount:l}=this;if((t===`split`?l+s:c+o)>n)break;this.unifiedCount+=o,this.splitCount+=s,this.unifiedAt+=o,this.splitAt+=s,this.deletionIndexAt+=i,this.additionIndexAt+=a,this.deletionNumberAt+=i,this.additionNumberAt+=a,this.contentIndex++}this.unifiedCount>r&&(this.pendingCollapsed=0)}enterHunk(e){let{diff:t,diffStyle:n,walkHunkIndex:r}=this,i=B(e.deletionStart,e.deletionCount),a=B(e.additionStart,e.additionCount),o=this.getLeadingRegion(e,r),s=r===t.hunks.length-1?this.getTrailingRegion():void 0;this.walkHunk=e,this.contentIndex=0,this.leadingStartRows=o.fromStart,this.leadingEndRows=o.fromEnd,this.leadingRangeSize=o.rangeSize,this.pendingCollapsed=o.collapsedLines,this.trailingRows=s==null?-1:s.fromStart+s.fromEnd,this.trailingCollapsed=s?.collapsedLines??0,this.unifiedAt=e.unifiedLineStart,this.splitAt=e.splitLineStart,this.deletionIndexAt=!t.isPartial&&e.deletionCount===0?i:e.deletionLineIndex,this.additionIndexAt=!t.isPartial&&e.additionCount===0?a:e.additionLineIndex,this.deletionNumberAt=i+1,this.additionNumberAt=a+1,this.collapsedAfterAt=s!=null&&s.collapsedLines>0&&s.fromStart+s.fromEnd===0?n===`unified`?e.unifiedLineStart+e.unifiedLineCount-1:e.splitLineStart+e.splitLineCount-1:-1}takePendingCollapsed(){let{pendingCollapsed:e}=this;return this.pendingCollapsed=0,e}startExpandedRun(e,t,n){let{unifiedCount:r,splitCount:i,walkHunkIndex:a,walkHunk:o,deletionIndexAt:s,deletionNumberAt:c,additionIndexAt:l,additionNumberAt:u,unifiedAt:d,splitAt:f}=this;return this.rowType=`context-expanded`,this.rowHunkIndex=a,this.rowHunk=o,this.rowHasDeletion=!0,this.rowHasAddition=!0,this.deletionIndexStart=s-t,this.deletionNumberStart=c-t,this.deletionUnifiedStart=d-t,this.additionIndexStart=l-t,this.additionNumberStart=u-t,this.additionUnifiedStart=d-t,this.splitStart=f-t,this.firstRowCollapsedBefore=n,this.collapsedAfterRow=-1,this.deletionNoEOFCRRow=-1,this.additionNoEOFCRRow=-1,this.unifiedCount+=e,this.splitCount+=e,this.clipRun(e,r,i)}startContextRun(e,t,n){let{lines:r}=t,{diffStyle:i,unifiedCount:a,splitCount:o,walkHunkIndex:s,deletionIndexAt:c,deletionNumberAt:l,additionIndexAt:u,additionNumberAt:d,unifiedAt:f,splitAt:p}=this,m=r>0;return m&&(this.rowType=`context`,this.rowHunkIndex=s,this.rowHunk=e,this.rowHasDeletion=!0,this.rowHasAddition=!0,this.deletionIndexStart=c,this.deletionNumberStart=l,this.deletionUnifiedStart=f,this.additionIndexStart=u,this.additionNumberStart=d,this.additionUnifiedStart=f,this.splitStart=p,this.firstRowCollapsedBefore=this.takePendingCollapsed(),this.setCollapsedAfterRow(i===`unified`?f:p),this.deletionNoEOFCRRow=n&&e.noEOFCRDeletions?r-1:-1,this.additionNoEOFCRRow=n&&e.noEOFCRAdditions?r-1:-1),this.unifiedCount+=r,this.splitCount+=r,this.unifiedAt+=r,this.splitAt+=r,this.deletionIndexAt+=r,this.additionIndexAt+=r,this.deletionNumberAt+=r,this.additionNumberAt+=r,m&&this.clipRun(r,a,o)}startChangeRun(e,t,n,r){let{deletions:i,additions:a}=t,{diffStyle:o,unifiedCount:s,splitCount:c,walkHunkIndex:l,deletionIndexAt:u,deletionNumberAt:d,additionIndexAt:f,additionNumberAt:p,unifiedAt:m,splitAt:h}=this,g=o===`unified`,_=Math.min(i,a),v=g?r?i:0:r?_:0,y=g?r?a:i:r?Math.max(i,a)-_:_;if(y<=0)return!1;let b=g?!r:!r||i>a,x=g?r:!r||a>i;this.rowType=`change`,this.rowHunkIndex=l,this.rowHunk=e,this.rowHasDeletion=b,this.rowHasAddition=x;let S=g?0:v;this.deletionIndexStart=u+S,this.deletionNumberStart=d+S,this.deletionUnifiedStart=m+S,this.additionIndexStart=f+S,this.additionNumberStart=p+S,this.additionUnifiedStart=m+i+S,this.splitStart=h+S,this.firstRowCollapsedBefore=this.takePendingCollapsed(),this.setCollapsedAfterRow(g?m+v:h+v);let C=g||r||i===a;this.deletionNoEOFCRRow=n&&b&&C&&e.noEOFCRDeletions?y-1:-1,this.additionNoEOFCRRow=n&&x&&C&&e.noEOFCRAdditions?y-1:-1;let w=s+v,T=s+i+S;return this.clipRun(y,b?w:T,c+v,b&&x?T:void 0)}startTrailingRun(){let{diff:e,trailingRows:t,trailingCollapsed:n,unifiedCount:r,splitCount:i,deletionIndexAt:a,deletionNumberAt:o,additionIndexAt:s,additionNumberAt:c,unifiedAt:l,splitAt:u}=this;return this.rowType=`context-expanded`,this.rowHunkIndex=e.hunks.length,this.rowHunk=void 0,this.rowHasDeletion=!0,this.rowHasAddition=!0,this.deletionIndexStart=a,this.deletionNumberStart=o,this.deletionUnifiedStart=l,this.additionIndexStart=s,this.additionNumberStart=c,this.additionUnifiedStart=l,this.splitStart=u,this.firstRowCollapsedBefore=0,this.collapsedAfterValue=n,this.collapsedAfterRow=t-1,this.deletionNoEOFCRRow=-1,this.additionNoEOFCRRow=-1,this.unifiedCount+=t,this.splitCount+=t,this.clipRun(t,r,i)}startTrailingNewlineRun(){let{diff:e,trailingRows:t,unifiedCount:n,splitCount:r,deletionIndexAt:i,deletionNumberAt:a,additionIndexAt:o,additionNumberAt:s,unifiedAt:c,splitAt:l}=this,u=Math.max(t,0),d=At(e,`deletions`),f=o+u,p=i+u;return this.rowType=d?`context`:`change`,this.rowHunkIndex=e.hunks.length,this.rowHunk=void 0,this.rowHasDeletion=d,this.rowHasAddition=!0,this.deletionIndexStart=p,this.deletionNumberStart=a+u,this.deletionUnifiedStart=c+u,this.additionIndexStart=f,this.additionNumberStart=s+u,this.additionUnifiedStart=c+u,this.splitStart=l+u,this.firstRowCollapsedBefore=0,this.collapsedAfterRow=-1,this.deletionNoEOFCRRow=-1,this.additionNoEOFCRRow=-1,this.unifiedCount++,this.splitCount++,this.clipRun(1,n,r)}setCollapsedAfterRow(e){let{collapsedAfterAt:t,trailingCollapsed:n}=this;t===-1?this.collapsedAfterRow=-1:(this.collapsedAfterValue=n,this.collapsedAfterRow=t-e)}};function G(e,t){return e?.cacheKey!=null||t?.cacheKey!=null?e?.cacheKey===t?.cacheKey:e===t}function $t(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}var en=1;function tn(e,...t){return`ck${en}:${JSON.stringify([e,...t])}`}function nn(e){return e===``?[]:e.split(b)}function rn(e,t,n,r={}){let i=e===`clone`?$e(t):t;if(!i.isPartial)throw Error(`hydratePartialDiff: fileDiff must be partial`);switch(i.type){case`change`:case`rename-changed`:return an(i,sn(i,n),cn(i,n),r);case`rename-pure`:{let e=cn(i,n);ln(i,n);let t=nn(e.contents);return i.isPartial=!1,i.deletionLines=t,i.additionLines=t,i.deletionCharacterCount=e.contents.length,i.additionCharacterCount=e.contents.length,dn(i,null,e,r),i}}throw Error(`hydratePartialDiff: ${i.type} diffs cannot be hydrated from loaded files`)}function an(e,t,n,r){let i=nn(t.contents),a=nn(n.contents),{hunks:o,splitLineCount:s,unifiedLineCount:c}=on(e.hunks,a.length);return e.hunks=o,e.splitLineCount=s,e.unifiedLineCount=c,e.isPartial=!1,e.deletionLines=i,e.additionLines=a,e.deletionCharacterCount=t.contents.length,e.additionCharacterCount=n.contents.length,dn(e,t,n,r),e}function on(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,p=[];for(let e of t.hunkContent)e.type===`context`?(p.push({...e,additionLineIndex:s,deletionLineIndex:c}),s+=e.lines,c+=e.lines,d+=e.lines,f+=e.lines):(p.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 m=Math.max(B(t.additionStart,t.additionCount)-i,0);a.push({...t,collapsedBefore:m,additionLineIndex:e,deletionLineIndex:o,additionLines:l,deletionLines:u,hunkContent:p,splitLineStart:n+m,unifiedLineStart:r+m,splitLineCount:d,unifiedLineCount:f}),n+=m+d,r+=m+f,i=V(t.additionStart,t.additionCount)}if(a.length>0){let e=a[a.length-1],i=V(e.additionStart,e.additionCount),o=Math.max(t-i,0);n+=o,r+=o}return{hunks:a,splitLineCount:n,unifiedLineCount:r}}function sn(e,t){if(t.oldFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile`);return t.oldFile}function cn(e,t){if(t.newFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires newFile`);return t.newFile}function ln(e,t){if(t.oldFile!==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile to be null`)}function un(e,t,n,r){return e.cacheKey==null?fn(t,n,r):`${e.cacheKey}:hydrated`}function dn(e,t,n,r){let i=un(e,t,n,r);i==null?delete e.cacheKey:e.cacheKey=i}function fn(e,t,n){return e!=null&&t!=null?e.cacheKey!=null&&t.cacheKey!=null?tn(n.disableLineMatching===!0?`hydrated-files-raw`:`hydrated-files`,e.cacheKey,t.cacheKey):void 0:e?.cacheKey??t?.cacheKey}var pn=new TextEncoder,mn=new TextDecoder(`utf-8`,{ignoreBOM:!0}),hn=/[\uD800-\uDFFF]/,gn=1024,_n=new Uint8Array(gn);function vn(){_n.length!==gn&&(_n=new Uint8Array(gn))}function K(e){if(e.length===0)return e;if(hn.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;_n.length<t&&(_n=new Uint8Array(t));let{written:n}=pn.encodeInto(e,_n);return mn.decode(_n.subarray(0,n))}var yn=new TextDecoder(`utf-8`,{ignoreBOM:!0}),bn={'"':`"`,"\\":`\\`,a:`\x07`,b:`\b`,t:` `,n:`
|
|
3
|
+
`,v:`\v`,f:`\f`,r:`\r`};function xn(e){if(e[0]!==`"`)return;let t=``,n=1;for(;n<e.length;){let r=e[n];if(r===`"`)return{fileName:t,rawLength:n+1};if(r!==`\\`){t+=r,n++;continue}let i=bn[e[n+1]];if(i!=null){t+=i,n+=2;continue}let a=[];do{let t=Sn(e,n+1);if(t==null)return;a.push(t),n+=4}while(e[n]===`\\`&&e[n+1]>=`0`&&e[n+1]<=`7`);t+=yn.decode(new Uint8Array(a))}}function Sn(e,t){let n=e.charCodeAt(t)-48,r=e.charCodeAt(t+1)-48,i=e.charCodeAt(t+2)-48;if(n>=0&&n<=3&&r>=0&&r<=7&&i>=0&&i<=7)return n*64+r*8+i}var Cn=4096,wn=.5;function Tn(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=Dn(e,r);i!=null&&(t.hunkContent.splice(n,1,...i),n+=i.length-1)}}function En(e,t,n){let{hunkContent:r}=e;for(let e=1;e<r.length;e++){let i=r[e],a=r[e-1];if(i.type!==`change`||i.additions>0&&i.deletions>0||a.type!==`context`)continue;let o=i.additions>0,s=o?t.additionLines:t.deletionLines,c=o?i.additionLineIndex:i.deletionLineIndex,l=o?i.additions:i.deletions,u=s[c]??``;if(u.trim()!==``)continue;let d=!0;for(let e=1;e<l;e++)if(s[c+e]!==u){d=!1;break}if(!d)continue;let f=0;for(;f<a.lines&&t.additionLines[a.additionLineIndex+a.lines-1-f]===u;)f++;if(f===0||e===1&&f===a.lines||n!=null&&(f=n(i,f),f===0))continue;i.additionLineIndex-=f,i.deletionLineIndex-=f;let p=i.additionLineIndex+i.additions,m=i.deletionLineIndex+i.deletions,h=r[e+1];h?.type===`context`?(h.lines+=f,h.additionLineIndex=p,h.deletionLineIndex=m):r.splice(e+1,0,{type:`context`,lines:f,additionLineIndex:p,deletionLineIndex:m}),a.lines-=f,a.lines===0&&(r.splice(e-1,1),e--)}}function Dn(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)>Cn)return null;let c=[];for(let t=0;t<n;t++)c.push(kn(e.deletionLines[i+t]??``));let l=[];for(let t=0;t<r;t++)l.push(kn(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+=An(c[n+(u?0:e)],l[n+(u?e:0)]);e===0?f=t+o*wn: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 On=/\s+/g;function kn(e){return e.replace(On,``)}function An(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}var jn=/^diff --git ("a\/(?:[^"\\]|\\.)*"|a\/.+?) ("b\/(?:[^"\\]|\\.)*"|b\/.+?)$/;function Mn(e,t){try{return Nn(e,t)}finally{vn()}}function Nn(e,{cacheKey:t,disableLineMatching:n=!1,isGitDiff:r=a.test(e),oldFile:i,newFile:o,throwOnError:c=!1}={}){let l=0,u=Hn(e,`@@ `),d,p=i==null||o==null,m=0,h=0;for(let e of u){let n=In(e),a=n[0];if(a==null){if(c)throw Error(`parsePatchContent: invalid hunk`);console.error(`parsePatchContent: invalid hunk`,e);continue}let u=zn(a),g=0,_=0;if(u==null||d==null){if(d!=null){if(c)throw Error(`parsePatchContent: Invalid hunk`);console.error(`parsePatchContent: Invalid hunk`,e);continue}d={name:``,type:`change`,hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:p,additionLines:!p&&i!=null&&o!=null?Fn(o.contents):[],deletionLines:!p&&i!=null&&o!=null?Fn(i.contents):[],additionCharacterCount:!p&&i!=null&&o!=null?o.contents.length:0,deletionCharacterCount:!p&&i!=null&&o!=null?i.contents.length:0,cacheKey:Wn(t)},d.additionLines.length===1&&o?.contents===``&&(d.additionLines.length=0),d.deletionLines.length===1&&i?.contents===``&&(d.deletionLines.length=0);for(let e of n){if(e.startsWith(`diff --git`)){let t=e.trim().match(jn);if(t==null){if(c)throw Error(`parsePatchContent: invalid git diff header`);console.error(`parsePatchContent: invalid git diff header`,e);continue}let n=Pn(t[1],!0),r=Pn(t[2],!0);d.name=K(r),n!==r&&(d.prevName=K(n));continue}let t=e.startsWith(`---`)||e.startsWith(`+++`)?e.match(f):null;if(t!=null){let[,e,n]=t,i=Pn(n,r);if(e===`---`&&i!==`/dev/null`){let e=K(i);d.prevName=e,d.name=e}else e===`+++`&&i!==`/dev/null`&&(d.name=K(i))}else if(r){if(e.startsWith(`new mode `)&&(d.mode=K(e.slice(8).trim())),e.startsWith(`old mode `)&&(d.prevMode=K(e.slice(8).trim())),e.startsWith(`new file mode`)&&(d.type=`new`,d.mode=K(e.slice(13).trim())),e.startsWith(`deleted file mode`)&&(d.type=`deleted`,d.mode=K(e.slice(17).trim())),e.startsWith(`similarity index`)&&(e.startsWith(`similarity index 100%`)?d.type=`rename-pure`:d.type=`rename-changed`),e.startsWith(`index `)){let[,t,n,r]=e.trim().match(s)??[];t!=null&&(d.prevObjectId=K(t)),n!=null&&(d.newObjectId=K(n)),r!=null&&(d.mode=K(r))}(e.startsWith(`rename from `)||e.startsWith(`copy from `))&&(d.prevName=K(Pn(e.slice(e.startsWith(`rename`)?12:10)))),(e.startsWith(`rename to `)||e.startsWith(`copy to `))&&(d.name=K(Pn(e.slice(e.startsWith(`rename`)?10:8))))}}continue}let v,y;for(;n.length>0&&(n[n.length-1]===`
|
|
4
|
+
`||n[n.length-1]===`\r`||n[n.length-1]===`\r
|
|
5
|
+
`||n[n.length-1]===``);)n.pop();let{additionStart:b,deletionStart:x}=u;m=p?m:x-1,h=p?h:b-1;let S={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:u.additionCount,additionStart:b,additionLines:g,deletionCount:u.deletionCount,deletionStart:x,deletionLines:_,deletionLineIndex:m,additionLineIndex:h,hunkContent:[],hunkContext:Wn(u.hunkContext),hunkSpecs:K(a),noEOFCRAdditions:!1,noEOFCRDeletions:!1},C=0,w=0;for(let e=1;e<n.length;e++){let t=n[e];if(C>=S.additionCount&&w>=S.deletionCount&&!t.startsWith(`\\`)){if(!Ln(t)||Rn(t))break;if(c)throw Error(`parsePatchContent: hunk has more lines than expected`)}let r=t[0];if(r!==`+`&&r!==`-`&&r!==` `&&r!==`\\`){if(c)throw Error(`parsePatchContent: invalid hunk line`);console.error(`parseLineType: Invalid firstChar: "${r}", full line: "${t}"`),console.error(`processFile: invalid rawLine:`,t);continue}let i=Gn(r);if(i===`addition`){if(c&&C>=S.additionCount)throw Error(`parsePatchContent: hunk has too many addition lines`);let e=Kn(t);(v==null||v.type!==`change`)&&(v=qn(`change`,m,h),S.hunkContent.push(v)),h++,C++,p&&(d.additionLines.push(e),d.additionCharacterCount+=e.length),v.additions++,g++,y=`addition`}else if(i===`deletion`){if(c&&w>=S.deletionCount)throw Error(`parsePatchContent: hunk has too many deletion lines`);let e=Kn(t);(v==null||v.type!==`change`)&&(v=qn(`change`,m,h),S.hunkContent.push(v)),m++,w++,p&&(d.deletionLines.push(e),d.deletionCharacterCount+=e.length),v.deletions++,_++,y=`deletion`}else if(i===`context`){if(c&&(w>=S.deletionCount||C>=S.additionCount))throw Error(`parsePatchContent: hunk has too many context lines`);let e=Kn(t);(v==null||v.type!==`context`)&&(v=qn(`context`,m,h),S.hunkContent.push(v)),h++,m++,C++,w++,p&&(d.deletionLines.push(e),d.additionLines.push(e),d.deletionCharacterCount+=e.length,d.additionCharacterCount+=e.length),v.lines++,y=`context`}else if(i===`metadata`&&v!=null){if(v.type===`context`?(S.noEOFCRAdditions=!0,S.noEOFCRDeletions=!0):y===`deletion`?S.noEOFCRDeletions=!0:y===`addition`&&(S.noEOFCRAdditions=!0),p&&(y===`addition`||y===`context`)){let e=d.additionLines.length-1;if(e>=0){let t=d.additionLines[e],n=Me(t);d.additionLines[e]=n,d.additionCharacterCount+=n.length-t.length}}if(p&&(y===`deletion`||y===`context`)){let e=d.deletionLines.length-1;if(e>=0){let t=d.deletionLines[e],n=Me(t);d.deletionLines[e]=n,d.deletionCharacterCount+=n.length-t.length}}}}if(C!==S.additionCount||w!==S.deletionCount){if(c)throw Error(`parsePatchContent: hunk line count mismatch`);console.error(`parsePatchContent: hunk line count mismatch: "${a.trimEnd()}", declared old/new ${S.deletionCount}/${S.additionCount}, parsed old/new ${w}/${C}`);let e=B(S.additionStart,S.additionCount)+(C===0?0:1),t=B(S.deletionStart,S.deletionCount)+(w===0?0:1);if(!p){let n=e-S.additionStart,r=t-S.deletionStart;S.additionLineIndex+=n,S.deletionLineIndex+=r;for(let e of S.hunkContent)e.additionLineIndex+=n,e.deletionLineIndex+=r}S.additionStart=e,S.deletionStart=t,S.additionCount=C,S.deletionCount=w}S.additionLines=g,S.deletionLines=_,S.collapsedBefore=Math.max(B(S.additionStart,S.additionCount)-l,0),d.hunks.push(S),l=V(S.additionStart,S.additionCount);for(let e of S.hunkContent)e.type===`context`?(S.splitLineCount+=e.lines,S.unifiedLineCount+=e.lines):(S.splitLineCount+=Math.max(e.additions,e.deletions),S.unifiedLineCount+=e.deletions+e.additions);S.splitLineStart=d.splitLineCount+S.collapsedBefore,S.unifiedLineStart=d.unifiedLineCount+S.collapsedBefore,d.splitLineCount+=S.collapsedBefore+S.splitLineCount,d.unifiedLineCount+=S.collapsedBefore+S.unifiedLineCount}if(d!=null){if(c&&p&&!r&&d.hunks.length===0)throw Error(`parsePatchContent: unified file has no hunks`);if(d.hunks.length>0&&!p&&d.additionLines.length>0&&d.deletionLines.length>0){let e=d.hunks[d.hunks.length-1],t=V(e.additionStart,e.additionCount),n=d.additionLines.length,r=Math.max(n-t,0);d.splitLineCount+=r,d.unifiedLineCount+=r}return r||(d.prevName!=null&&d.name!==d.prevName?d.hunks.length>0?d.type=`rename-changed`:d.type=`rename-pure`:(i==null||i.contents===``)&&o!=null&&o.contents!==``?d.type=`new`:i!=null&&i.contents!==``&&(o==null||o.contents===``)&&(d.type=`deleted`)),d.type!==`rename-pure`&&d.type!==`rename-changed`&&(d.prevName=void 0),n||Tn(d),d}}function Pn(e,t=!1){let n=e.trim(),r=n.startsWith(`"`)?xn(n)?.fileName??n:n;return t&&(r.startsWith(`a/`)||r.startsWith(`b/`))?r.slice(2):r}function Fn(e){let t=In(e);for(let e=0;e<t.length;e++)t[e]=K(t[e]);return t}function In(e){if(e.length===0)return[``];let t=[],n=0;for(;;){let r=e.indexOf(`
|
|
6
|
+
`,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 Ln(e){let t=e[0];return t===`+`||t===`-`||t===` `}function Rn(e){if(!e.startsWith(`--`))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==` `&&n!==` `&&n!==`
|
|
7
|
+
`&&n!==`\r`)return!1}return!0}function zn(e){if(!e.startsWith(`@@ -`))return;let t=4,n=Bn(e,t);if(n==null)return;let r=n.value;t=n.endIndex;let i=1;if(e[t]===`,`){let n=Bn(e,t+1);if(n==null)return;i=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`+`)return;t+=2;let a=Bn(e,t);if(a==null)return;let o=a.value;t=a.endIndex;let s=1;if(e[t]===`,`){let n=Bn(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=Vn(e.slice(l+1))),{additionCount:s,additionStart:o,deletionCount:i,deletionStart:r,hunkContext:c}}function Bn(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 Vn(e){return e.endsWith(`\r
|
|
8
|
+
`)?e.slice(0,-2):e.endsWith(`
|
|
9
|
+
`)?e.slice(0,-1):e}function Hn(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.startsWith(t)?0:Un(e,n,0);if(r===-1)return[e];let i=[];r>0&&i.push(e.slice(0,r));let a=r;for(;;){let t=Un(e,n,a+1);if(t===-1)break;i.push(e.slice(a,t)),a=t}return i.push(e.slice(a)),i}function Un(e,t,n){let r=e.indexOf(t,n);return r===-1?-1:r+1}function Wn(e){return e==null?e:K(e)}function Gn(e){return e===` `?`context`:e===`\\`?`metadata`:e===`+`?`addition`:`deletion`}function Kn(e){let t=e.slice(1);return K(t===``?`
|
|
10
|
+
`:t)}function qn(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 Jn=new TextEncoder,Yn=new TextDecoder(`utf-8`,{ignoreBOM:!0}),Xn=[`ignoreWhitespace`,`stripTrailingCr`,`context`,`headerOptions`],Zn,Qn,$n,er,q,J,tr=32<<20,nr;function rr(e){Zn=e,Qn=void 0}function ir(){let e=Qn??Zn(),{exports:t}=new WebAssembly.Instance(e,{});Qn=e,$n=t.memory,er=t.diff,fr();try{crypto.getRandomValues(q.subarray(1016,1024)),q[1016]|=1}catch{}}function ar(e,t,n){return cr(n,`diffChars`),lr(1,e,t)}function or(e,t,n){return cr(n,`diffWordsWithSpace`),lr(2,e,t)}function sr(e,t,n,r,i,a,o){if(o?.newlineIsToken??!1)throw Error(`newlineIsToken may not be used with patch-generation functions, only with diffing functions`);cr(o,`createTwoFilesPatch`,Xn);let s=o?.headerOptions,c=o?.context,l=c===void 0?4:c===null||c===!1?0:c;if(!(Number.isInteger(l)&&l>=0)&&l!==1/0)throw Error(`options.context must be a non-negative integer`);return lr(3,n,r,o,Math.min(l,0xfffffff),(s?(s.includeIndex??!1?1:0)|(s.includeUnderline??!1?2:0)|(s.includeFileHeaders??!1?4:0):7)|(e===void 0?0:8)|(t===void 0?0:16),[e===void 0?``:String(e),t===void 0?``:String(t),i?String(i):``,a?String(a):``])}function cr(e,t,n){if(typeof e==`function`)throw Error(`callbacks are not supported by @pierre/patches`);if(e!=null){for(let[r,i]of Object.entries(e))if(i!=null&&i!==!1&&!(n?.includes(r)??!1))throw Error(`options.${r} is not supported by @pierre/patches ${t}`)}}function lr(e,t,n,r,i=0,a=0,o){if(typeof t!=`string`||typeof n!=`string`)throw TypeError(`expected the texts to diff to be strings`);if((r?.stripTrailingCr??!1)&&(t=t.replaceAll(`\r
|
|
11
|
+
`,`
|
|
12
|
+
`),n=n.replaceAll(`\r
|
|
13
|
+
`,`
|
|
14
|
+
`)),t.length>=268435456||n.length>=268435456)throw Error(`out of memory`);Qn===void 0&&ir();let s=65600+(t.length+n.length)*3;if(o!==void 0)for(let e of o)s+=e.length*3;if(s>q.length){try{$n.grow(Math.ceil((s-q.length)/65536))}catch{throw Error(`out of memory`)}fr()}nr=!1;let c=ur(t,65536),l=ur(n,65536+c);if(o!==void 0){let e=65536+c+l;for(let t=0;t<4;t++){let n=ur(o[t],e);J.setUint32(28+t*4,n,!0),e+=n}}J.setUint32(0,e|a<<16|(c===t.length?1<<24:0)|(l===n.length?2<<24:0)|(r?.ignoreWhitespace??!1?4<<24:0),!0),J.setUint32(4,c,!0),J.setUint32(8,l,!0),J.setUint32(24,i,!0),er(),q.length===0&&fr();let u=J.getUint32(16,!0);if(q[1]===0){let e=Yn.decode(q.subarray(u,u+J.getUint32(12,!0)));throw pr(),Error(e)}let d;if(e===3){let e=q.subarray(u,u+J.getUint32(20,!0));d=``;let t=0;if(nr)for(let n=e.indexOf(237);n!==-1;n=e.indexOf(237,n+1))e[n+1]<160||(d+=Yn.decode(e.subarray(t,n))+String.fromCharCode(53248|(e[n+1]&63)<<6|e[n+2]&63),t=n+3);d+=Yn.decode(e.subarray(t))}else{let e=J.getUint32(12,!0);d=Array(e);for(let r=0;r<e;r++,u+=16){let e=q[u]===1;d[r]={count:J.getUint32(u+4,!0),added:q[u]===2,removed:e,value:(e?t:n).slice(J.getUint32(u+8,!0),J.getUint32(u+12,!0))}}}return pr(),d}function ur(e,t){if(e.length<256)return dr(e,t);let n=Jn.encodeInto(e,q.subarray(t)).written;return n===e.length||(e.isWellFormed?.()??!1)?n:dr(e,t)}function dr(e,t){let n=t;for(let t=0;t<e.length;t++){let r=e.codePointAt(t);r<128?q[n++]=r:(r<2048?q[n++]=192|r>>6:(r<65536?(q[n++]=224|r>>12,(r&63488)==55296&&(nr=!0)):(q[n++]=240|r>>18,q[n++]=128|r>>12&63,t++),q[n++]=128|r>>6&63),q[n++]=128|r&63)}return n-t}function fr(){q=new Uint8Array($n.buffer),J=new DataView($n.buffer)}function pr(){if(q.length>tr)try{ir()}catch{}}var mr=`AGFzbQEAAAABRgtgA39/fwF/YAF/AX9gAABgAn9/AX9gBX9/f39/AX9gAn9/AGAEf39/fwF/YAV/f39/fwBgAAF/YAZ/f39/f38Bf2ABfwADFBMCAQEDAAUEAQMGAAAHBAgJAAoCBQMBAAIGWxJ/AUEAC38BQQALfwFBAAt/AUEAC38BQQALfwFBAAt/AUEAC38BQQALfwFBAAt/AUEAC38BQQALfwFBAAt/AUEAC38BQQALfwFBAAt/AUEAC38BQQALfwFBAAsHEQIGbWVtb3J5AgAEZGlmZgASDAEECvMpExUAQQEkAEEMQQ02AgBBEEGACDYCAAs+ACAAQQFrQRB2QQFqPwBrIgBBAEoEQCAAPwBBAnZqQABBf0YEQCAAQABBf0YEQEEADwsLCz8AQRB0JAJBAQs5AQF/IwFBB2pBeHEiASAAaiIAIwFJBEAQAEEADwsgACMCSwRAIAAQAUUEQBAAQQAPCwsgACQBIAELPAEBf0G7CCECA0AgAkEBayICIAFBCnBBMGo6AAAgAUEKbiIBDQALIAAgAkG7CCACayIB/AoAACAAIAFqC2YAIAJBCEkEQCAAKQMAIAEpAwCFQn9BCCACa0EDdK2Ig1APCyAAIAJqQQhrIQIDQCAAKQMAIAEpAwBRBEAgAUEIaiEBIAIgAEEIaiIASw0BIAIpAwAgASACIABraikDAFEPCwtBAAuDAQECfwJAIAAtAAAiAkHCAWtBMksNACABIAJBGHRBf3NnIgEgAGpJDQAgACgCACEDIAEkBCACQf8AIAF2cSECA0AgA0EIdiIDQcABcUGAAUcNASADQT9xIAJBBnRyIQIgAUEBayIBQQFLDQALIAIkAw8LIAAtAABBgIDEAGokA0EBJAQLxAECAn8BeyAAIAEgAkECdGooAgBqIQUgACABIAIgA2pBAnRqKAIAaiEAIAQEQCAAIAVrDwsDQCAAIAVLBEBB//8DIQEgACAFayICQRBJBEBBASACdEEBayEBCyAGIAX9AAQAIgf9DMDAwMDAwMDAwMDAwMDAwMD9Tv0MgICAgICAgICAgICAgICAgP0j/WRB//8DcyABcWkgB/0M8PDw8PDw8PDw8PDw8PDw8P0s/WQgAXFpamohBiAFQRBqIQUMAQsLIAYLQwEBfyAAQaABRiAAQYAtRnIgAEGAQGoiAUEKTSABQShrQQFNcnIgAUEvRiABQd8ARnIgAEGA4ABGIABB//0DRnJycgsvAQF/IAAtAAAiAkGAAUkEQEEBJAQgAkEgRiACQQlrQQRNcg8LIAAgARAFIwMQBwupAgIEfwJ7IAAhBANAAkADQAJAIARBEGogAUsNACAE/QAEACII/WQNACADIAZBAnQiB2oiBSAI/YkBIgn9qQH9CwQAIAUgCf2qAf0LBBAgBSAI/YoBIgj9qQH9CwQgIAUgCP2qAf0LBDAgAiAHaiIFQUBrIQcgBCAAa/0R/QwAAAAAAQAAAAIAAAADAAAA/a4BIQgDQCAFIAj9CwQAIAj9DAQAAAAEAAAABAAAAAQAAAD9rgEhCCAHIAVBEGoiBUsNAAsgBkEQaiEGIARBEGohBAwBCwsgAiAGQQJ0aiAEIABrNgIAIAEgBE0NACAELQAAIgVBgAFJBEAgBSQDQQEkBAUgBCABEAULIAMgBkECdGojAzYCACAGQQFqIQYgBCMEaiEEDAELCyAGC8kBAQZ/IAAhBCACIQVBAyEHA0AgASAESwRAIAUgBCAAazYCACAELQAAIgZBgAFJBH8gBEEBaiEEIAYtAEAFIAQgARAFIAQjBGohBCMDIgNBIHJB9wFHIANBwAFrQZcETXEgA0HHBUdxIANBrQFGciADQd4Fa0EhTSADQYA8a0H/AU1yciADEAdBAXRyCyEDIAUgAyAIIAZBCkZxckUgAyAHR3JBAnRqIQUgAyEHIAZBDUYhCAwBCwsgBSABIABrNgIAIAUgAmtBAnYL0QEBBH8gACEEIAIiBUEANgIAA0AgASAESwRAIAT9AAQA/QwKCgoKCgoKCgoKCgoKCgoK/SP9ZCAE/QAEEP0MCgoKCgoKCgoKCgoKCgoKCv0j/WRBEHRyIQMgASAEayIGQSBJBEAgA0EBIAZ0QQFrcSEDCwNAIAMEQCAFQQRqIgUgBCAAa0EgaiADQQAgA2txZ2s2AgAgAyADQQFrcSEDDAELCyAEQSBqIQQMAQsLIAEgAGsiACAFKAIARwRAIAVBBGoiBSAANgIACyAFIAJrQQJ2C4UEAgZ/BH4gASEJIAFBBGohCCAEBEAgAyEJIAJBAnQQAiIIRQRADwsDQCACIAdLBEAgACABIAdBAnRqIgQoAgBqIQYgACAEKAIEaiEEA0AgBCAGSwRAIAYgBBAIBEAgBiMEaiEGDAILCwsDQAJAIAQgBk0NACAEIQUDQCAFQQFrIgUtAABBwAFxQYABRg0ACyAFIAQQCEUNACAFIQQMAQsLIAdBAnQiBSADaiAGIABrNgIAIAUgCGogBCAAazYCACAHQQFqIQcMAQsLCyMFIQojBiEHA0AgAgRAIAJBAWshAiAAIAgoAgBqIAAgCSgCAGoiAWshBSADAn8gASgCAEEBIAVBA3R0QQFrcSAFQRh0ciAFQQRJDQAaQgAhCyAFrSEMQfgHKQMAIQ0gASIEIAVBAWtBeHFqIQYDQCAEIAZJBEAgDCAEKQMAhSANfkIgiiALIQwhCyAEQQhqIQQMAQsLIAcgDCAGKQMAQn9BACAFa0EHcUEDdK2Ig4UgDX4gC4UiC0IgiCALhaciBEEQdiAEc3EhBANAAkAgCiAEQQN0aiIGKAIARQRAIAYgATYCACAGIAU2AgQMAQsgBigCBCAFRgRAIAYoAgAgASAFEAQNAQsgBEEBaiAHcSEEDAELCyAEQYCAgIB4cgs2AgAgCUEEaiEJIAhBBGohCCADQQRqIQMMAQsLC98DAQd/IxAgACAEayABakkEQCAAJAFBCBACIglFBEBBAA8LIwIhCiAJIgAgBGshCwNAIAIgA00EQCACKAIAQYCBgoR4RwRAIAJBBGoiBigCACEFA0ACQCAFRQRAIAZBADYCAAwBCyAFQXxxIgcoAgAiCEEDcUEDRgRAIAYgCEF8cTYCAAwBCyAKIABrQQhJBEAgACQBQQgQAkUEQEEADwsjAiEKCyAGIAAgC2siBjYCACAHIAZBA3I2AgAgBUEedEEBciAHKAIEIAVBA3EbIQYgCCEFA0ACQCAFRQ0AIAVBHnRBAXIgBUF8cSIIKAIEIAVBA3EbIgcgBnNBHnYNACAIKAIAIgVBA3FBA0YEQCAAIAVBfHEgC2oiBSgCADYCACAAIAYgBSgCBEH/////A3FqNgIEIABBCGohAAwDBSAGIAdB/////wNxaiEGDAILAAsLIAAgBjYCBCAAIgZBCGohAAwBCwsLIAJBCGohAgwBCwsgBCAJIAAgCWsiAvwKAAAgAiAEaiEAQYCAgAIgAkEBdCICIAJBgICAAk0bJBALIAEjAiAAa0sEQCAAJAEgARACRQRAQQAPCwsjAiQRIAEgBCMQaiAAayICSSACIwIgAGtJcQRAIAAgAmokEQsgAAv7BQIVfwF7QYCAgIABJBAjDCIOIw0iD2oiDEH8////AEsEQBAAQQAPCyAMQQJqQQR0IgpBEGoQAiIERQRAQQAPCyAEIAxBA3RqIgYhByAEIApqIQIjAiEQIAZBgIGChHg2AgAgBkGAgYKEeDYCECMKQQRqIRIjC0EEaiETQYCAgIB8IQRBgICAgAQhCkF/IQMDQCASIANBAnRqIgAoAgAgEyADIAFrQQJ0aiIRKAIARgRAIAAhCyAAIA4gA2tBAWsiDSAPIANrIAFqQQFrIhRKBH8gFAUgDQtBAnRqIg0DfyAAIA1JBH8gAP0ABAAgEf0ABAD9NyIV/aMBBH8gAEEQaiEAIBFBEGohEQwCBSAAQfwAaiAV/aQBIgBBAWogAEF/c3FnQQJ0awsFIAALCyIAIAAgDUsbIAtrQQJ2IgAEfyAAIANqIQMgAiAINgIAIAIgADYCBCACIghBCGoFIAILIQILIAMgAWtBAWogD04hCyADQQFqIA5OBEAgCwRAIAIkASAIDwsgCUEARyABQQFrIgAgCkhxBH8gACIKBSAFCyEFCyAHIAM2AgggByAINgIMIAsEQCAJQQBHIAFBAWoiACAESnEEQCAAIQQLCyABQQJqIQEDQCABIAVKBEAgCUEBaiIJIAxKBEAACyAGIAlBA3QiBWtBgIGChHg2AgAgBSAGakGAgYKEeDYCECAEQQAgCWsiAUoEQCAEIQELIAogCSIFSARAIAohBQsgCUEBakEEdCIAIBAgAmtLBEAgAiAAIAYgAUEDdGogBiAFQQN0akEQaiAGIAxBA3RqQSBqEA0iAkUEQEEADwsjESEQCwwBCyAGIAFBA3RqIgcoAgAhACAHQYCBgoR4NgIAIAcoAhAiCCABayAPSSILIABBAWogDkkiA3JFBEAgB0GAgYKEeDYCCCABQQJqIQEMAQsLIAggAEEBaiADRSALIAAgCEhxciIAGyEDIAIgByAAQQR0aigCBDYCACACIABBAWpqIQggAkEEaiECDAALAAvtAgEDfyAAIAE2AgACfyAAQQRqIgdBAWohAEEBIQgDQCADIAZLBEACfwJAIAIgBmotAAAiAUEHa0EGTQRAIAFBowhqLQAAIQEMAQsgAUEiRiABQdwARnINACABQSBrQd4ATQRAIAAgAToAACAAQQFqDAILQQAhCCABQe0BRiACIAZqLQABQaABT3EEQCAAQtzm1LnDy8ybNzcDACAAQdzk3KkDNgIIIAZBAmohBiAAQQxqDAILIABB3AA6AAAgACABQQZ2QTBqOgABIAAgAUEDdkEHcUEwajoAAiAAIAFBB3FBMGo6AAMgAEEEagwBC0EAIQggACABQQh0QdwAcjsBACAAQQJqCyEAIAZBAWohBgwBCwsgCARAIAcgAiAD/AoAACADIAdqDAELIAdBIjoAACAAQSI6AAAgAEEBagshACAFBEAgAEEJOgAAIABBAWoiACAEIAX8CgAAIAAgBWohAAsgAEEKOgAAIABBAWoLHAAgACABIAJFaxADIgBBLDoAACAAQQFqIAIQAwvhBgEXfyMPIgtBBGpBBnQjDCMNakEFdGpBBCgCAEEIKAIAampBJCgCAEEoKAIAakEcKAIAQSAoAgBqQQVsamoQAiIMRQRADwsgDCEBQSAoAgAhBEEkKAIAIQdBKCgCACEKIwdBCCgCAGoiBUEcKAIAIgJqIQZBAi0AACIJQRlxQRlGBEAgBSAGIAIQBCACIARGcQRAIAFCydyRq4bPjpAgNwMAIAFBB2oiASAFIAL8CgAAIAEgAmoiAUEKOgAAIAFBAWohAQsLIAlBAnEEQCABQT1BwwD8CwAgAUEKOgBDIAFBxABqIQELIAlBHHFBHEYEfyABQa3atIECIAUgAiAEIAZqIgEgBxAPQavWrIECIAYgBCABIAdqIAoQDwUgAQshAkEBIQVBASEGA0AgCCALTARAQQAhBCAIIAtIBEAjDiAIQQJ0aigCACEECyAEQf////8DcSEBIARBHnYEQCANRQRAQQEhDSADIAAgAyAAIANIGyIDayEWIAUgA2shDiAGIANrIQ8gCEEBayESCyAEQQBIBEAgASAGaiEGBSABIAVqIQULBSANIAggC0EBa0ggASAAQQF0THFFcQRAQQAhDSACQcCAgekCNgIAIAJBBGogDiAAIAEgACABSBsiEyAFIA5rahAQIgNBoNYAOwEAIANBAmogDyAGIA9rIBNqEBAiA0GggIHSADYCACADQQRqIQIgEiEDIBYhBCAOQQFrIQkgD0EBayEKA0BBACEHIAMgC0kEQCMOIANBAnRqKAIAIQcLIBMgB0H/////A3EgAyAIRhshF0GAgAQjByAHQQF0QQBIIhAbIRQDQCAEIBdIBEAgAkEtQStBICAHQQBIGyAQGzoAACMIIAlBAnRqIwkgCkECdGogEBsiESgCBCARKAIAayEVIAJBAWoiAiAUIBEoAgBqIBX8CgAAIAIgFWohAiAUIBEoAgRqQQFrLQAAQQpHBEAgAkGNCEEd/AoAACACQR1qIQILIAkgB0EATmohCSAKIBBFaiEKIARBAWohBAwBCwsgAyAIRwRAQQAhBCADQQFqIQMMAQsLCyABIAVqIQUgASAGaiEGCyABIQMgCEEBaiEIDAELCyACIAxGBEAgAkEKOgAAIAJBAWohAgtBECAMNgIAQRQgAiAMazYCAAvhBgENf0EAJABBAC0AACIEQQNGBEBBHCgCAEEgKAIAakEkKAIAQSgoAgBqaiEFCyAFQQgoAgAiAEEEKAIAIgJBgIAEaiIBaiIDakEgaiQBIAEkBwJAIwEQAUUgACACciAFckGAgICAAU9yBEAQAAwBCyACQQJqQQJ0EAIkCCAAQQJqQQJ0EAIkCSAEQQFGBEAgAkEBakECdBACJAogAEEBakECdBACJAsjAA0BQYCABCABIwgjChAJJAwgASADIwkjCxAJJA0FIwANASAEQQJGBEBBgIAEIAEjCBAKJAwgASADIwkQCiQNBUGAgAQgASMIEAskDCABIAMjCRALJA0LAn8jDCMNaiIAQYCAgMAASwRAEABBAAwBC0EBQSAgAEEBdEEBa0EPcmdrdCIAQQN0IgIQAiQFQQAjBUUNABojBUEAIAL8CwAgAEEBayQGQQELRQ0BIwxBAnQQAiQKIw1BAnQQAiQLIwANAUGAgAQjCCMMIwpBAy0AAEEEcSIAEAwgASMJIw0jCyAAEAwjAA0BC0EAIQAQDiICIQEDQCABBEAgAEEBaiEAIAFBfHEoAgAhAQwBCwsgAEEBakECdBACIgEEQCABIABBAnRqIgMiAEF/NgIAIAIhAQNAIAEEQCABQR50QQFyIAFBfHEoAgQgAUEDcRsiAiAAKAIAc0EedgRAIABBBGsiACACNgIABSAAIAAoAgAgAkH/////A3FqNgIACyABQXxxKAIAIQEMAQsLIAAkDiADIABrQQJ2JA8LIwANACAEQQNGBEBBGCgCABARBQJAQQAhAkEAIQAjD0EEdBACIgVFDQBBAy0AACEIIAUhAwNAIw8gCUsEQCMOIAlBAnRqKAIAIgFB/////wNxIQYgAUEediIHIAhBBHFyRSEKIAIhASAAIQQgB0ECRwRAQYCABCMIIAsgBiAIQQNBASAKG3EQBiABaiEBIAYgC2ohCwsgB0EBRwRAIAAgASACayMHIwkgDCAGIAogCEECcXIQBiAKG2ohBCAGIAxqIQwLIAMgBzYCACADIAY2AgQgAyACIAAgB0EBRiIAGzYCCCADIAEgBCAAGzYCDCABIQIgBCEAIANBEGohAyAJQQFqIQkMAQsLQQwjDzYCAEEQIAU2AgALCwtBASMARToAAAsLogEEAEH4Bws5FXxKf7l5N55vdXQgb2YgbWVtb3J5ClwgTm8gbmV3bGluZSBhdCBlbmQgb2YgZmlsZQphYnRudmZyAEHJAAsEAgACAgBB4AALAQIAQfAAC0sBAQEBAQEBAQEBAAAAAAAAAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAAAAAAEAAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQE=`;rr(()=>{let e=atob(mr),t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return new WebAssembly.Module(t)});var Y=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r)setTimeout(function(){r(e)},0);else return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h)d[r]=void 0;else{if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}},hr=new class extends Y{};function gr(e,t,n){return hr.diff(e,t,n)}function _r(e,t){let n=0;for(;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function vr(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function yr(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function br(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function xr(e,t){return yr(e,t,``)}function Sr(e,t){return br(e,t,``)}function Cr(e,t){return t.slice(0,wr(e,t))}function wr(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function Tr(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function Er(e,t){if(t)return Or(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function Dr(e,t){if(t)return Or(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function Or(e,t){if(!t)return[Dr(e),Er(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=Tr(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var kr=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,Ar=RegExp(`[${kr}]+|\\s+|[^${kr}]`,`ug`);new class extends Y{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=Tr(e,r)}else n=e.match(Ar)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&jr(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&jr(n,i,r,null,t.intlSegmenter),e}};function jr(e,t,n,r,i){if(t&&n){let[a,o]=Or(t.value,i),[s,c]=Or(n.value,i);if(e){let r=_r(a,s);e.value=br(e.value,s,r),t.value=xr(t.value,r),n.value=xr(n.value,r)}if(r){let e=vr(o,c);r.value=yr(r.value,c,e),t.value=Sr(t.value,e),n.value=Sr(n.value,e)}}else if(n){if(e){let e=Dr(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=Dr(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=Dr(r.value,i),[a,o]=Or(t.value,i),s=_r(n,a);t.value=xr(t.value,s);let c=vr(xr(n,s),o);t.value=Sr(t.value,c),r.value=yr(r.value,n,c),e.value=br(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=Dr(r.value,i),n=Cr(Er(t.value,i),e);t.value=Sr(t.value,n)}else if(e){let n=Cr(Er(e.value,i),Dr(t.value,i));t.value=xr(t.value,n)}}var Mr=new class extends Y{tokenize(e){let t=RegExp(`(\\r?\\n)|[${kr}]+|[^\\S\\n\\r]+|[^${kr}]`,`ug`);return e.match(t)||[]}};function Nr(e,t,n){return Mr.diff(e,t,n)}var Pr=new class extends Y{constructor(){super(...arguments),this.tokenize=Ir}equals(e,t,n){return n.ignoreWhitespace?(n.newlineIsToken&&e.includes(`
|
|
15
|
+
`)||(e=e.trim()),n.newlineIsToken&&t.includes(`
|
|
16
|
+
`)||(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
|
|
17
|
+
`)&&(e=e.slice(0,-1)),t.endsWith(`
|
|
18
|
+
`)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function Fr(e,t,n){return Pr.diff(e,t,n)}function Ir(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
19
|
+
`));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;e<r.length;e++){let i=r[e];e%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}function Lr(e){return e==`.`||e==`!`||e==`?`}new class extends Y{tokenize(e){let t=[],n=0;for(let r=0;r<e.length;r++){if(r==e.length-1){t.push(e.slice(n));break}if(Lr(e[r])&&e[r+1].match(/\s/)){for(t.push(e.slice(n,r+1)),r=n=r+1;e[r+1]?.match(/\s/);)r++;t.push(e.slice(n,r+1)),n=r+1}}return t}},new class extends Y{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends Y{constructor(){super(...arguments),this.tokenize=Ir}get useLongestToken(){return!0}castInput(e,t){let{undefinedReplacement:n,stringifyReplacer:r=(e,t)=>t===void 0?n:t}=t;return typeof e==`string`?e:JSON.stringify(Rr(e,null,null,r),null,` `)}equals(e,t,n){return super.equals(e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`),n)}};function Rr(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i===void 0?``:i,e));let a=0;for(;a<t.length;a+=1)if(t[a]===e)return n[a];let o;if(Object.prototype.toString.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=Rr(e[a],t,n,r,String(a));return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),typeof e==`object`&&e){t.push(e),o={},n.push(o);let i=[],s;for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&i.push(s);for(i.sort(),a=0;a<i.length;a+=1)s=i[a],o[s]=Rr(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends Y{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};function zr(e){for(let t=0;t<e.length;t++)if(e[t]<` `||e[t]>`~`||e[t]===`"`||e[t]===`\\`)return!0;return!1}function X(e){if(!zr(e))return e;let t=`"`,n=new TextEncoder().encode(e),r=0;for(;r<n.length;){let e=n[r];t+=e===7?`\\a`:e===8?`\\b`:e===9?`\\t`:e===10?`\\n`:e===11?`\\v`:e===12?`\\f`:e===13?`\\r`:e===34?`\\"`:e===92?`\\\\`:e>=32&&e<=126?String.fromCharCode(e):`\\`+e.toString(8).padStart(3,`0`),r++}return t+=`"`,t}var Br={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function Vr(e,t,n,r,i,a,o){let s;s=o?typeof o==`function`?{callback:o}:o:{},s.context===void 0&&(s.context=4);let c=s.context;if(s.newlineIsToken)throw Error(`newlineIsToken may not be used with patch-generation functions, only with diffing functions`);if(s.callback){let{callback:e}=s;Fr(n,r,Object.assign(Object.assign({},s),{callback:t=>{let n=l(t);e(n)}}))}else return l(Fr(n,r,s));function l(n){if(!n)return;n.push({value:``,lines:[]});function r(e){return e.map(function(e){return` `+e})}let o=[],s=0,l=0,u=[],d=1,f=1;for(let e=0;e<n.length;e++){let t=n[e],i=t.lines||Wr(t.value);if(t.lines=i,t.added||t.removed){if(!s){let t=n[e-1];s=d,l=f,t&&(u=c>0?r(t.lines.slice(-c)):[],s-=u.length,l-=u.length)}for(let e of i)u.push((t.added?`+`:`-`)+e);t.added?f+=i.length:d+=i.length}else{if(s){if(i.length<=c*2&&e<n.length-2)for(let e of r(i))u.push(e);else{let e=Math.min(i.length,c);for(let t of r(i.slice(0,e)))u.push(t);let t={oldStart:s,oldLines:d-s+e,newStart:l,newLines:f-l+e,lines:u};o.push(t),s=0,l=0,u=[]}}d+=i.length,f+=i.length}}for(let e of o)for(let t=0;t<e.lines.length;t++)e.lines[t].endsWith(`
|
|
20
|
+
`)?e.lines[t]=e.lines[t].slice(0,-1):(e.lines.splice(t+1,0,`\`),t++);return{oldFileName:e,newFileName:t,oldHeader:i,newHeader:a,hunks:o}}}function Hr(e,t){if(t||=Br,Array.isArray(e)){if(e.length>1&&!t.includeFileHeaders&&!e.every(e=>e.isGit))throw Error(`Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)`);return e.map(e=>Hr(e,t)).join(`
|
|
21
|
+
`)}let n=[];if(e.isGit){if(t=Br,!e.oldFileName)throw Error(`oldFileName must be specified for Git patches`);if(!e.newFileName)throw Error(`newFileName must be specified for Git patches`);let r=e.oldFileName,i=e.newFileName;e.isCreate&&r===`/dev/null`?r=i.replace(/^b\//,`a/`):e.isDelete&&i===`/dev/null`&&(i=r.replace(/^a\//,`b/`)),n.push(`diff --git `+X(r)+` `+X(i)),e.isDelete&&n.push(`deleted file mode `+(e.oldMode??`100644`)),e.isCreate&&n.push(`new file mode `+(e.newMode??`100644`)),e.oldMode&&e.newMode&&!e.isDelete&&!e.isCreate&&(n.push(`old mode `+e.oldMode),n.push(`new mode `+e.newMode)),e.isRename&&(n.push(`rename from `+X((e.oldFileName??``).replace(/^a\//,``))),n.push(`rename to `+X((e.newFileName??``).replace(/^b\//,``)))),e.isCopy&&(n.push(`copy from `+X((e.oldFileName??``).replace(/^a\//,``))),n.push(`copy to `+X((e.newFileName??``).replace(/^b\//,``))))}else t.includeIndex&&e.oldFileName==e.newFileName&&e.oldFileName!==void 0&&n.push(`Index: `+e.oldFileName),t.includeUnderline&&n.push(`===================================================================`);let r=e.hunks.length>0;t.includeFileHeaders&&e.oldFileName!==void 0&&e.newFileName!==void 0&&(!e.isGit||r)&&(n.push(`--- `+X(e.oldFileName)+(e.oldHeader?` `+e.oldHeader:``)),n.push(`+++ `+X(e.newFileName)+(e.newHeader?` `+e.newHeader:``)));for(let t=0;t<e.hunks.length;t++){let r=e.hunks[t],i=r.oldLines===0?r.oldStart-1:r.oldStart,a=r.newLines===0?r.newStart-1:r.newStart;n.push(`@@ -`+i+`,`+r.oldLines+` +`+a+`,`+r.newLines+` @@`);for(let e of r.lines)n.push(e)}return n.join(`
|
|
22
|
+
`)+`
|
|
23
|
+
`}function Ur(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;Vr(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?Hr(e,o.headerOptions):void 0)}}))}else{let s=Vr(e,t,n,r,i,a,o);return s?Hr(s,o?.headerOptions):void 0}}function Wr(e){let t=e.endsWith(`
|
|
24
|
+
`),n=e.split(`
|
|
25
|
+
`).map(e=>e+`
|
|
26
|
+
`);return t?n.pop():n.push(n.pop().slice(0,-1)),n}var Gr={jsdiff:{createTwoFilesPatch:Ur,diffChars:gr,diffWordsWithSpace:Nr},"@pierre/patches":{createTwoFilesPatch:sr,diffChars:ar,diffWordsWithSpace:or}},Kr;function qr(e){if(e===`jsdiff`)return e;if(Kr===void 0)try{ar(``,``),Kr=!0}catch(e){console.error(e),Kr=!1}return Kr?e:`jsdiff`}var Jr=`/dev/null`;function Yr(e,t,{preferredDiffLib:n=`jsdiff`,disableLineMatching:r,...i}={},a=!1){if(e===null&&t===null)throw Error(`parseDiffFromFile: You must pass oldFile, newFile, or both`);let o=e??Xr(),s=t??Xr(),c=[o.name,s.name,o.contents,s.contents,o.header,s.header,i],l=a?n:qr(n),u;try{u=Gr[l].createTwoFilesPatch(...c)}catch(e){if(a||l===`jsdiff`)throw e;console.error(e),u=Gr.jsdiff.createTwoFilesPatch(...c)}let d=Mn(u,{cacheKey:(()=>{let n=e?.cacheKey,i=t?.cacheKey;return n!=null&&i!=null?tn(r===!0?`diff-raw`:`diff`,n,i):void 0})(),oldFile:o,newFile:s,disableLineMatching:r,throwOnError:a});if(d==null)throw Error(`parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?`);e===null?(d.type=`new`,d.prevName=void 0):t===null&&(d.type=`deleted`,d.prevName=void 0);let f=t?.lang??(t===null?e?.lang:void 0);return f!=null&&(d.lang=f),d}function Xr(){return{name:Jr,contents:``}}var Zr=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));n==null||t==null?this.cleanUp():(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,behavior:`instant`}))};handleAdditionsScroll=()=>{this.isDeletionsScrolling||(this.isAdditionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isAdditionsScrolling=!1},300),this.codeDeletions?.scrollTo({left:this.codeAdditions?.scrollLeft,behavior:`instant`}))}};function Qr({item:e,arr:t,enableJoin:n,isNeutral:r=!1,isLastItem:i=!1}){let a=t[t.length-1];if(a==null||i||!n){t.push([+!r,e.value]);return}let o=a[0]===0;r===o||r&&e.value.length===1&&!o?a[1]+=e.value:t.push([+!r,e.value])}var $r=Object.freeze({deletion:Object.freeze([]),addition:Object.freeze([])});function ei(e,t,n,r,i=`jsdiff`){if(n===`none`||(e=Me(e),t=Me(t),e.length>r||t.length>r))return $r;let{diffChars:a,diffWordsWithSpace:o}=Gr[qr(i)],s=n===`char`?a(e,t):o(e,t);if(n===`word-line`)return ni(s);let c=[],l=[],u=n===`word-alt`,d=s.at(-1);for(let e of s){let t=e===d;!e.added&&!e.removed?(Qr({item:e,arr:c,enableJoin:u,isNeutral:!0,isLastItem:t}),Qr({item:e,arr:l,enableJoin:u,isNeutral:!0,isLastItem:t})):e.removed?Qr({item:e,arr:c,enableJoin:u,isLastItem:t}):Qr({item:e,arr:l,enableJoin:u,isLastItem:t})}return{deletion:ti(c),addition:ti(l)}}function ti(e){let t=[],n=0;for(let[r,i]of e)r===1&&t.push([n,n+i.length]),n+=i.length;return t}function ni(e){let t=0,n=0,r=-1,i=0,a=-1,o=0;for(let{value:s,added:c,removed:l}of e)l?(r===-1&&(r=t),t+=s.length,i=t):c?(a===-1&&(a=n),n+=s.length,o=n):(t+=s.length,n+=s.length);return{deletion:r===-1?[]:[[r,i]],addition:a===-1?[]:[[a,o]]}}var ri=Object.freeze([]),ii=class{lineDiffType;maxLineDiffLength;preferredDiffLib;#e=new Map;constructor(e,t,n=`jsdiff`){this.lineDiffType=e,this.maxLineDiffLength=t,this.preferredDiffLib=n}get(e,t,n){let r=this.#e.get(e);if(r!=null&&r.deletionText===t&&r.additionText===n)return r.ranges;let i;try{i=ei(t,n,this.lineDiffType,this.maxLineDiffLength,this.preferredDiffLib)}catch(e){if(this.preferredDiffLib===`jsdiff`)throw e;console.error(e),this.preferredDiffLib=`jsdiff`,i=ei(t,n,this.lineDiffType,this.maxLineDiffLength,this.preferredDiffLib)}return this.#e.set(e,{deletionText:t,additionText:n,ranges:i}),i}};function ai(e,t,n,r){let i=e.pairFor(t,n);if(i==null)return ri;let{deletionLines:a,additionLines:o}=e.diff,s=t===`deletions`?r.get(n,a[n],o[i]):r.get(i,a[i],o[n]);return t===`deletions`?s.deletion:s.addition}function oi(e,t){if(t.length===0)return e;let n=[];if(ci(e.children,n),n.length===0)throw Error(`markRow: an empty row has no text to mark`);let r={type:`element`,tagName:e.tagName,properties:{...e.properties},children:[]},i=t.map(([e,t])=>({start:{line:0,character:e},end:{line:0,character:t},properties:{"data-diff-span":``},alwaysWrap:!0})),a=0;for(let e of n)a+=e.text.length;let o=new yt(r,i,0,a),s=0;for(let e of n){let{text:t}=e,n=s,r=n+t.length;for(;s<r;){o.moveTo(s);let i=Math.min(r,o.nextEdge);o.parent.children.push(si(e,s===n&&i===r?t:t.slice(s-n,i-n))),s=i}}return o.moveTo(s),n.some(e=>e.char!=null)&&Et(r),r}function si(e,t){if(e.properties==null)return{type:`text`,value:t};let n={...e.properties};return e.char!=null&&(n[`data-char`]=e.char),{type:`element`,tagName:`span`,properties:n,children:[{type:`text`,value:t}]}}function ci(e,t){for(let n of e){if(n.type===`text`){if(n.value===`
|
|
27
|
+
`&&e.length===1)continue;t.push({text:n.value,properties:void 0,char:void 0});continue}if(n.type!==`element`||n.tagName===`br`)continue;if(n.tagName!==`span`)throw Error(`markRow: unexpected <${n.tagName}> in a base row`);if(n.properties[`data-diff-span`]!=null||n.children.some(e=>e.type!==`text`))throw Error(`markRow: a base row has no wrapper spans`);let r={...n.properties},i=r[`data-char`];delete r[`data-char`];let a=``;for(let e of n.children)e.type===`text`&&(a+=e.value);t.push({text:a,properties:r,char:typeof i==`number`?i:void 0})}}function li(e){return z({tagName:`div`,properties:{"data-content-buffer":``,"data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function ui(e){return z({tagName:`div`,children:[z({tagName:`span`,children:[xt(L.t(`noNewlineAtEndOfFile`))]})],properties:{"data-no-newline":``,"data-line-type":e,"data-column-content":``}})}function di(e){return z({tagName:`div`,children:[wt({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 fi({type:e,content:t,expandIndex:n,chunked:r=!1,slotName:i,isFirstHunk:a,isLastHunk:o}){let s=0,c=[];if(e===`metadata`&&t!=null&&c.push(z({tagName:`div`,children:[xt(t)],properties:{"data-separator-wrapper":``}})),(e===`line-info`||e===`line-info-basic`)&&t!=null){let e=[];n!=null&&(r?(a||(e.push(di(`up`)),s++),o||(e.push(di(`down`)),s++)):(e.push(di(!a&&!o?`both`:a?`down`:`up`)),s++)),e.push(z({tagName:`div`,children:[z({tagName:`span`,children:[xt(t)],properties:{"data-unmodified-lines":``}})],properties:{"data-separator-content":``}})),r&&n!=null&&e.push(z({tagName:`div`,children:[xt(L.t(`expandAll`))],properties:{role:`button`,"data-expand-button":``,"data-expand-all-button":``}})),c.push(z({tagName:`div`,children:e,properties:{"data-separator-wrapper":``,"data-separator-multi-button":s>1?``:void 0}}))}return e===`custom`&&i!=null&&c.push(z({tagName:`slot`,properties:{name:i}})),z({tagName:`div`,children:c,properties:{"data-separator":c.length===0?`simple`:e,"data-expand-index":n,"data-separator-first":a?``:void 0,"data-separator-last":o?``:void 0}})}function pi(e,t){return`hunk-separator-${e}-${t}`}function mi(e){let t=e.at(-1);return t==null?0:Math.max(V(t.additionStart,t.additionCount),V(t.deletionStart,t.deletionCount))}function hi(e){let{splitLineIndex:t}=e,n,r;if(e.hasDeletion){let{deletionLineIndex:r,deletionLineNumber:i,deletionUnifiedLineIndex:a,deletionNoEOFCR:o}=e;n={lineIndex:r,lineNumber:i,unifiedLineIndex:a,splitLineIndex:t,noEOFCR:o}}if(e.hasAddition){let{additionLineIndex:n,additionLineNumber:i,additionUnifiedLineIndex:a,additionNoEOFCR:o}=e;r={lineIndex:n,lineNumber:i,unifiedLineIndex:a,splitLineIndex:t,noEOFCR:o}}if(n!=null)return r==null?{deletionLine:n}:{deletionLine:n,additionLine:r};if(r!=null)return{additionLine:r};throw Error(`DiffLayout: row has no lines`)}function gi(e,t){return e.host===t.host&&e.model===t.model&&e.rows===t.rows&&e.expandedHunks===t.expandedHunks&&e.deletionAnnotations===t.deletionAnnotations&&e.additionAnnotations===t.additionAnnotations&&e.annotationSlotName===t.annotationSlotName&&e.includeTrailingNewline===t.includeTrailingNewline&&e.showNoNewlineMarkers===t.showNoNewlineMarkers&&ot(e.renderRange,t.renderRange)}var _i=Object.freeze([]),vi=class{options;lineCuts;#e;#t=new Be;#n=new WeakMap;#r=new Map;#i=new Map;#a;#o;constructor(e,t){this.options=e,this.lineCuts=t,this.#e=new ii(e.lineDiffType,e.maxLineDiffLength,e.preferredDiffLib)}setOptions(e){let t=this.options;(e.lineDiffType!==t.lineDiffType||e.maxLineDiffLength!==t.maxLineDiffLength||e.preferredDiffLib!==t.preferredDiffLib)&&(this.#e=new ii(e.lineDiffType,e.maxLineDiffLength,e.preferredDiffLib)),(e.diffStyle!==t.diffStyle||e.expandUnchanged!==t.expandUnchanged||e.expansionLineCount!==t.expansionLineCount||e.collapsedContextThreshold!==t.collapsedContextThreshold||e.hunkSeparators!==t.hunkSeparators||e.lineDiffType!==t.lineDiffType||e.maxLineDiffLength!==t.maxLineDiffLength||e.preferredDiffLib!==t.preferredDiffLib||e.canHydrateContext!==t.canHydrateContext)&&this.invalidateLines(),this.options=e}markLines(e){let t=this.#o??=new Set;for(let n of e)t.add(n)}forgetLines(e){this.#t.forgetLines(e);for(let t of e)this.#r.delete(`a${t}`)}invalidateLines(){this.#r.clear(),this.#i.clear(),this.#a=void 0,this.#o=void 0}newFileLines(e){let t=this.#a;if(t!=null&&gi(t.input,e))return t.result.newFileLines;let{diffStyle:n,expandUnchanged:r,collapsedContextThreshold:i}=this.options,a,o,s=new Qt({diff:e.model.diff,diffStyle:n,startingLine:e.renderRange.startingLine,totalLines:e.renderRange.totalLines,expandedHunks:r?!0:e.expandedHunks,collapsedContextThreshold:i,includeTrailingNewline:e.includeTrailingNewline});for(;s.next();)if(s.hasAddition){let{additionLineNumber:e}=s;a??=e,o=e}return a==null||o==null?void 0:{first:a,last:o}}layout(e){let t=this.#o;this.#o=void 0;let n=this.#a;if(t!=null&&n!=null&&gi(n.input,e))return this.#s(n,t,e);this.lineCuts.startLayout();let{host:r,model:i,renderRange:a,expandedHunks:o,includeTrailingNewline:s,showNoNewlineMarkers:c}=e,{diff:l}=i,{diffStyle:u,expandUnchanged:d,expansionLineCount:f,collapsedContextThreshold:p,hunkSeparators:m,canHydrateContext:h}=this.options,g=u===`unified`,_=!l.isPartial||h,v=this.options.lineDiffType!==`none`;this.#r.clear(),this.#i.clear();let y={unified:Qe(),deletions:Qe(),additions:Qe()},b=[],x=0,S,C,w={size:0,side:void 0},T=()=>{if(g)return;let{size:e,side:t}=w;if(w.size=0,w.side=void 0,e<=0||t==null)return;let n=y[t];this.#t.fixedRow(n,yi(n),`${e}`,()=>({gutter:Ot(void 0,`buffer`,e),content:li(e)}))},E=e=>{T();let t=g?[`unified`]:[`deletions`,`additions`];for(let n of t)this.#c(y[n],n,e,m,f,b)&&n!==`additions`&&x++},D=(e,t,n,i)=>{this.#t.fixedRow(e,`ann:${t}`,`${i}|${n.hunkIndex},${n.lineIndex}|${n.annotations.join(`,`)}`,()=>({gutter:Ot(i,`annotation`,1),content:Ve(r.createAnnotationElement(n))}))};this.#f(e,y,D,()=>{x++});let O=Ft({fileDiff:l,errorPrefix:`DiffLayout.layout`}),k=new Qt({diff:l,diffStyle:u,startingLine:a.startingLine,totalLines:a.totalLines,expandedHunks:d?!0:o,collapsedContextThreshold:p,includeTrailingNewline:s});for(;k.next();){let{deletionLine:t,additionLine:n}=hi(k),{hunkIndex:a,hunk:o,collapsedBefore:s,collapsedAfter:u,type:d,splitLineIndex:f,unifiedLineIndex:p}=k;n!=null&&(S??=n.lineNumber,C=n.lineNumber),!g&&d!==`change`&&T(),s>0&&E({hunkIndex:a,collapsedLines:s,rangeSize:Math.max(o?.collapsedBefore??0,0),hunkSpecs:o?.hunkSpecs,isFirstHunk:a===0,isLastHunk:!1,isExpandable:_});let b=g?p:f,A={type:d,hunkIndex:a,lineIndex:b,unifiedLineIndex:p,splitLineIndex:f,deletionLine:t,additionLine:n},j=v&&d===`change`,M=n==null?`d${t.lineIndex}`:`a${i.lineId(n.lineIndex)}`,N=t==null?M:`d${t.lineIndex}`,P=M;if(g){let i=r.getUnifiedInjectedRowsForLine?.(A);i?.before!=null&&(x+=xi(y.unified,i.before,`${M}:before`));let o=d===`change`?n==null?`change-deletion`:`change-addition`:d,s=r.getUnifiedLineDecoration({type:d,lineType:o,additionLineIndex:n?.lineIndex,deletionLineIndex:t?.lineIndex}),c=`${p},${f}`;this.#l(e,y.unified,n==null?{column:`unified`,key:M,side:`deletions`,lineIndex:t.lineIndex,marked:j,contentProperties:s.contentProperties,lineNumber:t.lineNumber,altLineNumber:void 0,lineIndexText:c,gutterLineType:s.gutterLineType,gutterProperties:s.gutterProperties}:{column:`unified`,key:M,side:`additions`,lineIndex:n.lineIndex,marked:j,contentProperties:s.contentProperties,lineNumber:n.lineNumber,altLineNumber:d===`change`?void 0:t?.lineNumber,lineIndexText:c,gutterLineType:s.gutterLineType,gutterProperties:s.gutterProperties});let l=Ci(e,t?.lineNumber,n?.lineNumber,a,b);l!=null&&(D(y.unified,M,l,o),x++),i?.after!=null&&(x+=xi(y.unified,i.after,`${M}:after`))}else{let i=r.getSplitInjectedRowsForLine?.(A);i?.before!=null&&(x+=Si(y,i.before,`${M}:before`,w,T));let o=r.getSplitLineDecoration({side:`deletions`,type:d,lineIndex:t?.lineIndex}),s=r.getSplitLineDecoration({side:`additions`,type:d,lineIndex:n?.lineIndex}),c=d===`change`?n==null?`additions`:t==null?`deletions`:void 0:void 0;c==null?d===`change`&&T():(w.side!=null&&w.side!==c&&T(),w.side=c,w.size+=1);let l=wi(e,t?.lineNumber,n?.lineNumber,a,b);l!=null&&w.size>0&&T(),t!=null&&this.#l(e,y.deletions,{column:`deletions`,key:N,side:`deletions`,lineIndex:t.lineIndex,marked:j,contentProperties:o.contentProperties,lineNumber:t.lineNumber,altLineNumber:d===`change`?void 0:n?.lineNumber,lineIndexText:`${t.unifiedLineIndex},${f}`,gutterLineType:o.gutterLineType,gutterProperties:o.gutterProperties}),n!=null&&this.#l(e,y.additions,{column:`additions`,key:P,side:`additions`,lineIndex:n.lineIndex,marked:j,contentProperties:s.contentProperties,lineNumber:n.lineNumber,altLineNumber:d===`change`?void 0:t?.lineNumber,lineIndexText:`${n.unifiedLineIndex},${f}`,gutterLineType:s.gutterLineType,gutterProperties:s.gutterProperties}),l!=null&&(D(y.deletions,N,l.deletionSpan,d===`change`?t==null?`context`:`change-deletion`:d),D(y.additions,P,l.additionSpan,d===`change`?n==null?`context`:`change-addition`:d),x++),i?.after!=null&&(x+=Si(y,i.after,`${M}:after`,w,T))}let F=!g&&o!=null&&f===o.splitLineStart+o.splitLineCount-1,ee=a===l.hunks.length-1&&o!=null&&(g?p===o.unifiedLineStart+o.unifiedLineCount-1:f===o.splitLineStart+o.splitLineCount-1),te=(t?.noEOFCR??!1)||F&&o.noEOFCRDeletions,I=(n?.noEOFCR??!1)||F&&o.noEOFCRAdditions;if(c&&(I||te)){if(T(),te){let e=d===`context`||d===`context-expanded`?d:`change-deletion`;this.#t.fixedRow(g?y.unified:y.deletions,`eof:d`,e,()=>{let t=ui(e);return{gutter:Ot(e,`metadata`,1),content:e===`change-deletion`?Ve(t):t}}),!g&&!I&&this.#t.fixedRow(y.additions,yi(y.additions),`1`,()=>({gutter:Ot(void 0,`buffer`,1),content:li(1)}))}if(I&&!(g&&te&&d!==`change`)){let e=d===`context`||d===`context-expanded`?d:`change-addition`;this.#t.fixedRow(g?y.unified:y.additions,`eof:a`,e,()=>({gutter:Ot(e,`metadata`,1),content:ui(e)})),!g&&!te&&this.#t.fixedRow(y.deletions,yi(y.deletions),`1`,()=>({gutter:Ot(void 0,`buffer`,1),content:li(1)}))}x++}m!==`simple`&&m!==`metadata`&&(u>0||ee&&h)&&E({hunkIndex:d===`context-expanded`?a:a+1,collapsedLines:ee&&h?`unknown`:u,rangeSize:O,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:_}),x++}T();let A=Math.max(mi(l.hunks),i.lineCount,l.deletionLines.length),j=a.bufferBefore>0||a.bufferAfter>0,M=x>0||j,N=!g&&l.type!==`deleted`,P=!g&&l.type!==`new`,F={columns:{unified:g&&M?y.unified.specs:void 0,deletions:P&&M?y.deletions.specs:void 0,additions:N&&M?y.additions.specs:void 0},newFileLines:S==null||C==null?void 0:{first:S,last:C},patched:void 0,hunkData:b,rowCount:x,totalLines:A};return this.#a={input:e,result:F},F}#s(e,t,n){let{model:r}=n,i={...e.result.columns},a=new Set,o={unified:i.unified==null?void 0:[],deletions:i.deletions==null?void 0:[],additions:i.additions==null?void 0:[]},s=new Set,c=e=>{let t=this.#r.get(e),r=this.#i.get(e);if(t==null||r==null||s.has(e))return;s.add(e);let c=i[t.column];if(c==null)throw Error(`DiffLayout: a kept row is in a column that was not laid out`);a.has(t.column)||(c=c.slice(),i[t.column]=c,a.add(t.column));let l=this.#u(n,t);c[r]=l,o[t.column]?.push(l)};for(let e of t){if(e<0||e>=r.lineCount)continue;c(`a${r.lineId(e)}`);let t=r.pairFor(`additions`,e);t!=null&&c(`d${t}`)}let l={...e.result,columns:i,patched:o};return this.#a={input:n,result:l},l}#c(e,t,{hunkIndex:n,collapsedLines:r,rangeSize:i,hunkSpecs:a,isFirstHunk:o,isLastHunk:s,isExpandable:c},l,u,d){if(typeof r==`number`&&r<=0)return!1;if(l===`metadata`){if(a==null)return!1;let r=()=>fi({type:`metadata`,content:a,isFirstHunk:o,isLastHunk:s});return this.#t.fixedRow(e,`sep:${t}:${n}`,`metadata|${a}|${o}|${s}`,()=>({gutter:r(),content:Ve(r())})),!0}if(l===`simple`){if(n<=0)return!1;let r=()=>fi({type:`simple`,isFirstHunk:o,isLastHunk:!1});return this.#t.fixedRow(e,`sep:${t}:${n}`,`simple|${o}`,()=>({gutter:r(),content:Ve(r())})),!0}let f=pi(t,n),p=i>u,m=c?n:void 0,h=typeof r==`number`?L.t(`unmodifiedLines`,{count:r}):L.t(`unknownUnmodifiedLines`),g=()=>fi({type:l,content:h,expandIndex:m,chunked:p,slotName:f,isFirstHunk:o,isLastHunk:s});return this.#t.fixedRow(e,`sep:${f}`,`${l}|${h}|${m}|${p}|${o}|${s}`,()=>({gutter:g(),content:Ve(g())})),d.push({slotName:f,hunkIndex:n,lines:typeof r==`number`?r:0,lineCountKnown:typeof r==`number`,type:t,expandable:c?{up:!o,down:!s,chunked:p}:void 0}),!0}#l(e,t,n){this.#r.set(n.key,n),this.#i.set(n.key,t.specs.length),ft(t,this.#u(e,n))}#u(e,t){let{model:n,rows:r}=e,i=t.side===`additions`?r.additionRow(n,t.lineIndex):r.deletionRow(n,t.lineIndex),a=t.marked?ai(n,t.side,t.lineIndex,this.#e):_i,o=this.#d(i,a,t,e);return{key:t.key,gutter:this.#t.gutter(t.key,t.gutterLineType,t.lineNumber,t.lineIndexText,t.gutterProperties),content:o}}#d(e,t,n,{model:r}){let{side:i,lineIndex:a,lineNumber:o,altLineNumber:s,contentProperties:c,lineIndexText:l}=n,u=e;if(t.length>0){let n=this.#n.get(e);n!=null&&Ti(n.ranges,t)?u=n.row:(u=oi(e,t),this.#n.set(e,{ranges:t,row:u}))}let{lineCuts:d}=this,f=i===`additions`?d.additionRow(u,r,a,o,s):d.deletionRow(u,r,a,o,s);return this.#t.line(f,c,o,s,l,n.column===`unified`&&i===`deletions`)}#f(e,t,n,r){let{model:i,renderRange:a,deletionAnnotations:o,additionAnnotations:s}=e;if(!lt(a))return;let{diff:c}=i,l=t=>t?.map(t=>e.annotationSlotName(t))??[],u=c.type===`new`?[]:l(Ie(o)),d=c.type===`deleted`?[]:l(Ie(s));(u.length!==0||d.length!==0)&&(this.options.diffStyle===`unified`?n(t.unified,`file`,{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:u.concat(d)},`context`):(n(t.deletions,`file`,{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:u},`context`),n(t.additions,`file`,{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:d},`context`)),r())}};function yi(e){return`buf:${e.lastKey??`top`}`}function bi(e,t,n){return e.id==null?`inj:${t}:${n}`:`inj:${e.id}`}function xi(e,t,n){for(let[r,i]of t.entries())ft(e,{key:bi(i,n,r),gutter:i.gutter,content:i.content});return t.length}function Si(e,t,n,r,i){let a=0;for(let[o,{deletion:s,addition:c}]of t.entries()){if(s==null&&c==null)continue;let t=s!=null&&c!=null?void 0:s==null?`deletions`:`additions`;(t==null||r.side!==t)&&i(),s!=null&&ft(e.deletions,{key:bi(s,n,o),gutter:s.gutter,content:s.content}),c!=null&&ft(e.additions,{key:bi(c,n,o),gutter:c.gutter,content:c.content}),t!=null&&(r.side=t,r.size+=1),a++}return a}function Ci(e,t,n,r,i){let a=[];if(t!=null)for(let n of e.deletionAnnotations[t]??[])a.push(e.annotationSlotName(n));if(n!=null)for(let t of e.additionAnnotations[n]??[])a.push(e.annotationSlotName(t));return a.length>0?{type:`annotation`,hunkIndex:r,lineIndex:i,annotations:a}:void 0}function wi(e,t,n,r,i){let a={type:`annotation`,hunkIndex:r,lineIndex:i,annotations:[]},o={type:`annotation`,hunkIndex:r,lineIndex:i,annotations:[]};if(t!=null)for(let n of e.deletionAnnotations[t]??[])a.annotations.push(e.annotationSlotName(n));if(n!=null)for(let t of e.additionAnnotations[n]??[])o.annotations.push(e.annotationSlotName(t));if(a.annotations.length!==0||o.annotations.length!==0)return{deletionSpan:a,additionSpan:o}}function Ti(e,t){return e===t||e.length===t.length&&e.every((e,n)=>e[0]===t[n][0]&&e[1]===t[n][1])}function Ei(e,t){let n=Yr({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:e.deletionLines,additionCharacterCount:n.additionCharacterCount,deletionCharacterCount:n.deletionCharacterCount,type:n.type}}function Di(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 Oi(e){for(let t of e)if(t.trim().length>0)return!1;return!0}function ki(e,t){return t.length>0&&t.length<e.deletionLines.length&&Oi(t)}function Ai(e,t,n,r){let i=e.deletionLines.join(``),a=Di(t.length,i),o=Yr({name:e.prevName??e.name,contents:i},{name:e.name,contents:a,lang:e.lang},r);return{hunks:o.hunks,splitLineCount:o.splitLineCount,unifiedLineCount:o.unifiedLineCount,additionLines:t,deletionLines:e.deletionLines,additionCharacterCount:n,deletionCharacterCount:o.deletionCharacterCount,type:o.type}}function ji(e,t){return Ai(e,[``],0,t)}function Mi(e,t){return e.additionLines.length===0?ji(e,t):ki(e,e.additionLines)?Ai(e,e.additionLines,e.additionCharacterCount,t):Ei(e,t)}function Ni(e,t){let n=e.hunks[t];n!=null&&(n.noEOFCRAdditions=Pi(e.additionLines,n.additionLineIndex,n.additionCount),n.noEOFCRDeletions=Pi(e.deletionLines,n.deletionLineIndex,n.deletionCount))}function Pi(e,t,n){let r=e.at(-1);return t>=0&&t+n===e.length&&r!=null&&r!==``&&!r.endsWith(`
|
|
28
|
+
`)}function Fi(e,t,n){return{...e,additionLineIndex:e.additionLineIndex+t,deletionLineIndex:e.deletionLineIndex+n}}function Ii(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 Li(e){let t=0,n=0,r=0;for(let i of e.hunks)i.collapsedBefore=Math.max(B(i.additionStart,i.additionCount)-r,0),i.splitLineStart=t+i.collapsedBefore,i.unifiedLineStart=n+i.collapsedBefore,Ii(i),t+=i.collapsedBefore+i.splitLineCount,n+=i.collapsedBefore+i.unifiedLineCount,r=V(i.additionStart,i.additionCount);if(e.hunks.length>0){let r=e.hunks[e.hunks.length-1],i=Math.max(e.additionLines.length-V(r.additionStart,r.additionCount),0);t+=i,n+=i}e.splitLineCount=t,e.unifiedLineCount=n}var Ri=new WeakMap;function zi(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 Bi(e,t,n){let r=e.hunks,i=Zi(r,Yi(e,t,n),e.deletionLines.length);if(e.hunks=ea(e,i),e.editSessionDirty=!0,ua(e),ra(r,e.hunks))return{regions:i.map(e=>e.previousSpan)}}function Vi(e,t,n,r){let i=new Set(t),a=Array.from(i).filter(t=>t>=0&&t<e.additionLines.length).sort((e,t)=>e-t);if(a.length===0)return;let o=t=>i.has(t)?r?.get(t):e.additionLines[t],{hunks:s}=e,c,l=0;for(let t of a){for(;l<s.length;){let e=s[l];if(t<oa(e)+e.additionCount)break;l++}let r=s[l],i=r==null?void 0:oa(r);if(i==null||t<i||c!=null&&c!==l)return Bi(e,n,o);c=l}if(c!=null){if(Hi(e,a,c,r,n))e.editSessionDirty=!0;else return Bi(e,n,o)}}function Hi(e,t,n,r,i){if(r==null||i?.ignoreWhitespace===!0||i?.stripTrailingCr===!0)return!1;let a=Ui(e),o=e.hunks[n];if(o.hunkContent.some(Wi))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 Ui(e){let{deletionLines:t}=e,n=Ri.get(t);return n??(n=new Set(t),Ri.set(t,n)),n}function Wi(e){return e?.type===`change`&&(e.additions===0||e.deletions===0)}function Gi(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 Ki(e,t,n){let r=[];if(e.isPartial)return r;for(let[i,a]of e.hunks.entries()){let o=H({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:t,hunkIndex:i,collapsedContextThreshold:n});if(o.rangeSize<=n)continue;let s=sa(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=sa(t)+t.deletionCount;r.push([n,n+i.fromStart])}return r}function qi(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=sa(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,sa(i)+i.deletionCount,e.deletionLines.length),n}function Ji(e,t){return e.editSessionDirty===!0&&(delete e.editSessionDirty,Object.assign(e,e.additionLines.length<=1&&e.additionLines.join(``)===``?Ei(e,t):Mi(e,t)),!0)}function Yi(e,t,n){if(zi(e.deletionLines,e.additionLines)==null)return[];let r=Yr({name:e.prevName??e.name,contents:e.deletionLines.join(``)},{name:e.name,contents:e.additionLines.join(``),lang:e.lang},t),i,a=(t,a)=>{i??=Xi(e.hunks);for(let e=0;e<=a;e++){let o=i.get(t.deletionLineIndex-e);if(o!=null&&o.additions===t.additions&&o.deletions===t.deletions){if(t.additions>0&&n!=null){for(let e=0;e<t.additions;e++)if(n(o.additionLineIndex+e)!==r.additionLines[t.additionLineIndex+e])return a}return e}}return a},o=[],s=0,c=0;for(let e of r.hunks){En(e,r,a);let t=e.additionCount>0?e.additionLineIndex-s:e.deletionLineIndex-c;s+=t,c+=t;for(let t of e.hunkContent){if(t.type===`context`){s+=t.lines,c+=t.lines;continue}let e=Fi(t,0,0);e.additions===0&&(e.additionLineIndex=s),e.deletions===0&&(e.deletionLineIndex=c),o.push(e),s+=e.additions,c+=e.deletions}}return o}function Xi(e){let t=new Map;for(let n of e)for(let e of n.hunkContent)e.type===`change`&&(e.additions===0||e.deletions===0)&&t.set(e.deletionLineIndex,e);return t}function Zi(e,t,n){let r=e.map((e,t)=>{let n=sa(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&&Qi(t,o,i[i.length-1])?i.pop():void 0;for(;a<r.length&&r[a].deletionStart<=o;)s=$i(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 Qi(e,t,n){return e<=n.deletionEnd&&t>=n.deletionStart}function $i(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 ea(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`);na(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`);na(s,c,i,r),r+=c,i+=c,n.push(ta(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 ta(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:ca(t.additionStart,r),additionCount:r,additionLines:a,additionLineIndex:la(t.additionStart,r),deletionStart:ca(t.deletionStart,i),deletionCount:i,deletionLines:o,deletionLineIndex:la(t.deletionStart,i),hunkContent:n,hunkSpecs:`@@ -${ca(t.deletionStart,i)},${i} +${ca(t.additionStart,r)},${r} @@`,splitLineStart:0,splitLineCount:0,unifiedLineStart:0,unifiedLineCount:0,noEOFCRAdditions:!1,noEOFCRDeletions:!1};return Ii(s),s}function na(e,t,n,r){t>0&&e.push({type:`context`,lines:t,additionLineIndex:n,deletionLineIndex:r})}function ra(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(sa(r)!==sa(i)||r.deletionCount!==i.deletionCount||oa(r)!==oa(i)||r.additionCount!==i.additionCount||r.splitLineCount!==i.splitLineCount||!ia(r,i))return!0}return!1}function ia(e,t){let n=aa(e),r=aa(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*aa(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 oa(e){return B(e.additionStart,e.additionCount)}function sa(e){return B(e.deletionStart,e.deletionCount)}function ca(e,t){return t===0?e:e+1}function la(e,t){return t===0?e-1:e}function ua(e){Li(e);for(let t=0;t<e.hunks.length;t++)Ni(e,t)}var da=class e{static fromDiff(t){return new e(t,void 0)}static startEditSession(t,n={}){let{document:r,snapshot:i,parseDiffOptions:a}=n;if(t.isPartial)throw Error(`DiffModel.startEditSession: the diff must not be partial`);let o=Ce(t.additionLines.join(``)),s=r==null?void 0:Ce(r.contents),c=i!=null&&fa(i,t);if(i!=null&&!c)throw Error(`DiffModel.startEditSession: the retained session was diffed against a different old file`);if(s!=null&&s!==o&&!c)throw Error(`DiffModel.startEditSession: retained edits are missing their diff session state`);let l={...t};delete l.cacheKey,o!==t.additionLines.join(``)&&(l.additionLines=nn(o),l.additionCharacterCount=o.length,Bi(l,a),l.editSessionDirty=!0);let u=r==null||r.name===t.name&&r.lang===t.lang&&s===o;r!=null&&!u&&(l.name=r.name,l.lang=r.lang),c&&i!=null&&s!=null&&(l.additionLines=nn(s),l.additionCharacterCount=s.length,l.type=i.type,l.hunks=i.hunks,l.editSessionDirty=!0,Li(l));let d=new e(l,new _e(nt(l.additionLines.join(``))+1));return l.additionLines.length===0&&(Object.assign(l,ji(l,a)),l.editSessionDirty=!0),d}diff;#e;#t;#n;constructor(e,t){this.diff=e,this.#e=t,this.#t=e.additionLines}get live(){return this.#e!=null}get lineCount(){return this.#e?.lineCount??this.diff.additionLines.length}lineId(e){return this.#e?.idAt(e)??e}lineText(e){return this.diff.additionLines[e]??``}lineOf(e){return this.#e?.lineOf(e)??(e<this.diff.additionLines.length?e:void 0)}blockAt(e,t){let{starts:n,ends:r,blocks:i}=this.#i()[e],a=0,o=i.length;for(;a<o;){let e=a+o>>>1;r[e]<=t?a=e+1:o=e}return a<i.length&&n[a]<=t?i[a]:void 0}pairFor(e,t){let n=this.blockAt(e,t);if(n?.type!==`change`)return;let r=t-(e===`deletions`?n.deletionLineIndex:n.additionLineIndex);if(r>=Math.min(n.deletions,n.additions))return;let i=n.deletionLineIndex+r,a=n.additionLineIndex+r,{deletionLines:o,additionLines:s}=this.diff;if(o[i]!=null&&s[a]!=null)return e===`deletions`?a:i}editLineFor(e){for(let t of this.diff.hunks){let n=e-t.deletionStart;if(n<0||n>=t.deletionCount)continue;let r=t.deletionLineIndex+n,i=this.blockAt(`deletions`,r);if(i==null)throw Error(`DiffModel.editLineFor: old line ${e} is inside a hunk but outside its blocks`);return i.type===`context`?i.additionLineIndex+(r-i.deletionLineIndex):i.additionLineIndex}}applyChange(e,t,n={}){let r=this.#e;if(r==null)throw Error(`DiffModel.applyChange: the model is not live`);let i=r.applyChange(e),{diff:a}=this,{parseDiffOptions:o}=n,s=n.expandedHunks??new Map,c=e.lineDelta===0,{hunks:l}=a,u,d=!1;if(c){u=[];let n=new Map,r=a.additionLines.length;for(let[i,o]of He(t,e)){let e=i>0&&i===t.lineCount-1&&o===``;if(i<0||i>r||i===r&&(e||t.lineCount!==r+1))continue;let s=a.additionLines[i]??``;(e||s!==o)&&(a.additionLines===this.#t&&(a.additionLines=a.additionLines.slice()),e?a.additionLines.pop():a.additionLines[i]=o,a.additionCharacterCount+=o.length-s.length,u.push(i),n.set(i,s))}if(u.length>0){if(pa(a))this.#r(ji(a,o)),d=!0;else if(ki(a,a.additionLines))this.#r(Ai(a,a.additionLines,a.additionCharacterCount,o)),d=!0;else if(a.additionLines.length!==r){let e=Bi(a,o,e=>n.has(e)?n.get(e):a.additionLines[e]);s=ma(s,e),d=e!=null}else{let e=Vi(a,u,o,n);s=ma(s,e),d=e!=null}}}else{let n=a.additionLines,{lines:r,characterCount:i}=E(t);r.length>1&&r.at(-1)===``&&r.pop(),a.additionLines=r,a.additionCharacterCount=i,pa(a)?this.#r(ji(a,o)):ki(a,r)?this.#r(Ai(a,r,i,o)):s=ma(s,Bi(a,o,e=>n[e])),d=!0,u=[];for(let[t,n]of e.changedLineRanges){let e=Math.min(n,a.additionLines.length-1);for(let n=t;n<=e;n++)u.push(n)}}return this.#n=void 0,{changedLines:u,hunksChanged:a.hunks!==l,removedLineIds:i,lineDelta:e.lineDelta,regionsChanged:d,expandedHunks:s}}lineIds(){return this.#e?.ids()??Array.from({length:this.lineCount},(e,t)=>t)}snapshot(){let{diff:e}=this;return{oldFile:e.type===`new`?null:{name:e.prevName??e.name,lines:[...e.deletionLines]},type:e.type,hunks:Ke(e.hunks)}}get hasChanges(){return this.diff.editSessionDirty===!0}finish(e,t={}){let{diff:n}=this,{parseDiffOptions:r}=t,i=t.expandedHunks??new Map;if(n.editSessionDirty!==!0)return{changed:!1,expandedHunks:i};let a=Ki(n,i,e);return Ji(n,r),this.#n=void 0,{changed:!0,expandedHunks:qi(n,a)}}#r(e){let{diff:t}=this,n=t.type;Object.assign(t,e),t.type=n,t.editSessionDirty=!0,this.#n=void 0}#i(){let{hunks:e}=this.diff;if(this.#n?.hunks===e)return this.#n;let t={starts:[],ends:[],blocks:[]},n={starts:[],ends:[],blocks:[]};for(let r of e)for(let e of r.hunkContent){let r=e.type===`context`?e.lines:e.deletions,i=e.type===`context`?e.lines:e.additions;r>0&&(t.starts.push(e.deletionLineIndex),t.ends.push(e.deletionLineIndex+r),t.blocks.push(e)),i>0&&(n.starts.push(e.additionLineIndex),n.ends.push(e.additionLineIndex+i),n.blocks.push(e))}return this.#n={hunks:e,deletions:t,additions:n}}};function fa(e,t){let{oldFile:n}=e;return n==null?t.type===`new`:t.type!==`new`&&n.name===(t.prevName??t.name)&&n.lines.length===t.deletionLines.length&&n.lines.every((e,n)=>e===t.deletionLines[n])}function pa(e){return e.additionLines.length<=1&&e.additionLines.join(``)===``}function ma(e,t){return t==null?e:Gi(e,t)}function Z(e,t){return N(e.theme,t.theme)&&(e.preferredDiffLib??`jsdiff`)===(t.preferredDiffLib??`jsdiff`)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}var ha={forcePlainText:!1};function ga(e,t,n,{forcePlainText:r,lazyLineAST:i=!1,startingLine:a,totalLines:o,expandedHunks:s,collapsedContextThreshold:c=1}=ha){r?(a??=0,o??=1/0):(a=0,o=1/0);let l=a>0||o<1/0;i&&=!r&&!n.useTokenTransformer;let u=typeof n.theme==`string`?t.getTheme(n.theme).type:void 0,d=ye({theme:n.theme,highlighter:t}),f={deletionLines:[],additionLines:[]},p=!r&&!e.isPartial,m=r?s:void 0,h=new Map;function g(e){let t=p?0:e,n=h.get(t)??_a();return h.set(t,n),n}function _(e,t,n,r){if(l){let e=n.at(-1);(e==null||e.targetIndex+e.count!==t)&&(e={targetIndex:t,originalOffset:r.length,count:0},n.push(e)),e.count++}r.push(e)}let v=new Qt({diff:e,diffStyle:`both`,startingLine:a,totalLines:o,expandedHunks:!l||m,collapsedContextThreshold:c});for(;v.next();){let{hunkIndex:t,type:n,splitLineIndex:r}=v,i=g(t);if(v.hasDeletion){let{deletionLineIndex:t,deletionLineNumber:a,deletionUnifiedLineIndex:o}=v;_(e.deletionLines[t],t,i.deletionSegments,i.deletionContent),i.deletionInfo.push({type:n===`change`?`change-deletion`:n,lineNumber:a,altLineNumber:n===`change`?void 0:v.additionLineNumber,lineIndex:`${o},${r}`})}if(v.hasAddition){let{additionLineIndex:t,additionLineNumber:a,additionUnifiedLineIndex:o}=v;_(e.additionLines[t],t,i.additionSegments,i.additionContent),i.additionInfo.push({type:n===`change`?`change-addition`:n,lineNumber:a,altLineNumber:n===`change`?void 0:v.deletionLineNumber,lineIndex:`${o},${r}`})}}for(let a of h.values()){if(a.deletionContent.length===0&&a.additionContent.length===0)continue;let o={name:e.prevName??e.name,contents:a.deletionContent.value},s={name:e.name,contents:a.additionContent.value},{deletionLines:c,additionLines:l}=va({deletionFile:o,deletionInfo:a.deletionInfo,additionFile:s,additionInfo:a.additionInfo,highlighter:t,options:n,languageOverride:r?`text`:e.lang,lazyLineAST:i});if(p)f.deletionLines=c,f.additionLines=l;else for(let[e,t,n]of[[f.deletionLines,c,a.deletionSegments],[f.additionLines,l,a.additionSegments]])if(n.length>0)for(let r of n)for(let n=0;n<r.count;n++)e[r.targetIndex+n]=t[r.originalOffset+n];else if(i){let n=e.length;for(let r=0;r<t.length;r++)St(e,n+r,()=>t[r])}else Dt(e,t)}return{code:f,themeStyles:d,baseThemeType:u}}function _a(){return{deletionContent:{push(e){this.value+=e,this.length++},value:``,length:0},additionContent:{push(e){this.value+=e,this.length++},value:``,length:0},deletionInfo:[],additionInfo:[],deletionSegments:[],additionSegments:[]}}function va({lazyLineAST:e,deletionFile:t,additionFile:n,deletionInfo:r,additionInfo:i,highlighter:a,languageOverride:o,options:{theme:s,useTokenTransformer:c,tokenizeMaxLineLength:l}}){let u=(t,n)=>t.contents===``?[]:Tt(a.codeToTokens(Me(t.contents),we(o??R(t.name),s,l)).tokens,{state:{lineInfo:n},useTokenTransformer:c,lazyLineAST:e,cacheHtmlStyles:a.name===`highlights`});return{deletionLines:u(t,r),additionLines:u(n,i)}}function ya(e){let t=e.lang??R(e.name),n=e.lang??(e.prevName==null?`text`:R(e.prevName));return t===`text`&&n===`text`}var ba=-1,xa=class{options;annotationSlotName;onRenderUpdate;workerManager;__id=`diff-hunks-renderer:${++ba}`;diff;lineCuts=new te;expandedHunks=new Map;annotationList=[];deletionAnnotations={};additionAnnotations={};computedLangs=[`text`];renderCache;pendingHighlightResult;layout;rowSource;model;editSessionActive=!1;constructor(e={theme:l},t=I,n,r){this.options=e,this.annotationSlotName=t,this.onRenderUpdate=n,this.workerManager=r}cleanUp(){this.endEditSession(),this.recycle(),this.lineCuts.clear(),this.expandedHunks.clear(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.diff=void 0,this.editSessionActive?(this.workerManager?.cancelLocalThemeRender(this),this.renderCache!=null&&(this.renderCache.renderRange=void 0),this.pendingHighlightResult=void 0):this.clearRenderCache(),this.annotationList=[],this.additionAnnotations={},this.deletionAnnotations={},this.workerManager?.cleanUpTasks(this)}startEditSession(e,t={}){let n=da.startEditSession(e,{...t,parseDiffOptions:this.options.parseDiffOptions}),{rowSource:r}=this,i=this.promoteReadyResult(e)??this.renderCache;this.editSessionActive=!0,this.model=n,this.diff=n.diff,this.pendingHighlightResult=void 0;let{options:a}=this.getRenderOptions(n.diff);if(i?.result!=null&&i.highlighted&&n.diff.additionLines===e.additionLines&&G(i.diff,e)&&Z(i.options,a)){let{result:e}=i,t={ids:n.lineIds(),texts:n.diff.additionLines.slice()};this.renderCache={diff:n.diff,options:a,highlighted:!0,result:e,renderRange:i.renderRange,lines:t},r!=null&&r.result===e?(r.source.setHighlightRows({deletionRows:e.code.deletionLines,additionRows:e.code.additionLines,additionLines:t.texts,lineIds:t.ids}),this.layout?.invalidateLines(),r.model=n):this.rowSource=void 0}else i!=null&&i.options.useTokenTransformer!==!0&&ve(n.diff.name),this.renderCache=void 0,this.rowSource=void 0;return n.diff}promoteReadyResult(e){let{options:t}=this.getRenderOptions(e),n=this.getReadyRenderResult(e,t);return n==null?void 0:{...n,diff:e,renderRange:void 0}}applyChange(e,t,n){let r=this.requireSession(),i=r.applyChange(e,t,{parseDiffOptions:this.options.parseDiffOptions,expandedHunks:this.expandedHunks});return this.expandedHunks=i.expandedHunks,i.removedLineIds.length>0&&(this.editSessionRows(r).source.forgetLines(i.removedLineIds),this.layout?.forgetLines(i.removedLineIds)),i.lineDelta!==0||i.removedLineIds.length>0||i.regionsChanged||i.hunksChanged?this.layout?.invalidateLines():this.layout?.markLines(i.changedLines),n!=null&&this.setTokens(n),i}setTokens(e){let t=this.requireSession(),n=this.editSessionRows(t).source,r=[];for(let[i,a]of e)n.setTokens(t.lineId(i),a)&&r.push(i);return this.layout?.markLines(r),r}lineKey(e){let t=this.requireSession();return e>=0&&e<t.lineCount?`a${t.lineId(e)}`:void 0}lineOfKey(e){let t=this.requireSession();return e.startsWith(`a`)?t.lineOf(Number(e.slice(1))):void 0}editLineFor(e){return this.requireSession().editLineFor(e)}endEditSession(){let e=this.editSessionActive?this.model:void 0,t=!1;if(e!=null){let{collapsedContextThreshold:n}=this.getOptionsWithDefaults(),r=e.finish(n,{parseDiffOptions:this.options.parseDiffOptions,expandedHunks:this.expandedHunks});t=r.changed,this.expandedHunks=r.expandedHunks}return this.editSessionActive=!1,this.pendingHighlightResult=void 0,this.diff??this.clearRenderCache(),t}requireSession(){let{model:e}=this;if(!this.editSessionActive||e==null||!e.live)throw Error(`DiffHunksRenderer: no edit session is active`);return e}editSessionRows(e){let{rowSource:t}=this;if(t!=null&&t.model===e)return t;let n=new Ae({deletionRows:[],additionRows:[],additionLines:[],lineIds:[]});return this.rowSource={result:{code:{additionLines:[],deletionLines:[]},themeStyles:``,baseThemeType:void 0},source:n,model:e}}editorRenderReady(){let{renderCache:e,rowSource:t}=this;return e?.options.useTokenTransformer===!0&&e.highlighted&&e.result!=null&&t?.result===e.result}includesTrailingNewline(){return this.editSessionActive}hasTrailingNewlineRow(e){return this.includesTrailingNewline()&&At(e,`additions`)}showsNoNewlineMarkers(){return!this.editSessionActive}refreshHighlightedResult(){let{diff:e,renderCache:t,workerManager:n}=this;return e==null||t==null||!G(t.diff,e)||ya(e)||wa(e,this.getTokenizeMaxLength())?Promise.resolve():!this.editSessionActive&&n?.isWorkingPool()===!0&&e.cacheKey!=null?(n.evictDiffFromCache(e.cacheKey),n.primeDiffHighlightCache(e).then(()=>{this.applyRefreshedResult(e,n.getDiffResultCache(e))}).catch(e=>{Le(e)||this.onHighlightError(e)})):this.asyncHighlight(e).then(t=>this.applyRefreshedResult(e,t)).catch(e=>this.onHighlightError(e))}applyRefreshedResult(e,t){let{diff:n,renderCache:r}=this;if(t==null||n==null||r==null||!G(n,e)||!G(r.diff,e)||this.editSessionActive)return;let{options:i}=this.getRenderOptions(n);Z(i,t.options)&&(this.pendingHighlightResult={diff:n,options:t.options,highlighted:!0,result:t.result},this.onRenderUpdate?.())}get diffCache(){return this.renderCache?.diff??this.diff}waitForLocalTheme(e){let{workerManager:t,onRenderUpdate:n}=this;return n!=null&&t?.renderWhenLocalThemeLoads(this,n,e)===!0}clearRenderCache(){this.workerManager?.cancelLocalThemeRender(this),this.renderCache=void 0,this.pendingHighlightResult=void 0,this.layout=void 0,this.editSessionActive?this.rowSource?.source.forgetTokens():(this.rowSource=void 0,this.model=void 0)}expandLine(e){this.lineCuts.expand(e),this.layout?.invalidateLines()}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}expandHunk(e,t,n=this.getOptionsWithDefaults().expansionLineCount){this.expandedHunks.set(e,Pt(this.expandedHunks.get(e),t,n)),this.handleExpansionChange()}handleExpansionChange(){this.renderCache?.highlighted!==!0&&this.clearRenderCache(),this.layout?.invalidateLines()}getExpandedHunk(e){return this.expandedHunks.get(e)??v}getExpandedHunksMap(){return this.expandedHunks}setExpandedHunksMap(e){this.expandedHunks=e,this.handleExpansionChange()}setLineAnnotations(e){let{annotationList:t}=this;if(!(e===t||e.length===0&&t.length===0)){this.annotationList=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)}}}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){return We(e)}getOptionsWithDefaults(){let{diffIndicators:e=`bars`,diffStyle:t=`split`,disableBackground:n=!1,disableFileHeader:i=!1,disableLineNumbers:a=!1,disableVirtualizationBuffers:o=!1,collapsed:s=!1,expandUnchanged:c=!1,collapsedContextThreshold:u=1,expansionLineCount:d=100,hunkSeparators:f=`line-info`,lineDiffType:p=`word-alt`,maxLineDiffLength:m=1e3,overflow:h=`scroll`,stickyHeader:g=!1,theme:_=l,headerRenderMode:v=`default`,tokenizeMaxLineLength:y=1e3,tokenizeMaxLength:b=r,useTokenTransformer:x=!1,useCSSClasses:S=!1}=this.options;return{diffIndicators:e,diffStyle:t,disableBackground:n,disableFileHeader:i,disableLineNumbers:a,disableVirtualizationBuffers:o,collapsed:s,expandUnchanged:c,collapsedContextThreshold:u,expansionLineCount:d,hunkSeparators:f,lineDiffType:p,maxLineDiffLength:m,overflow:h,stickyHeader:g,theme:this.workerManager?.getDiffRenderOptions().theme??_,headerRenderMode:v,tokenizeMaxLineLength:y,tokenizeMaxLength:b,useTokenTransformer:x,useCSSClasses:S}}initializeHighlighter(e=this.computedLangs){return w(oe(e,{theme:this.getLocalHighlightTheme(),preferredHighlighter:ne(this.workerManager,this.options)}))}hydrate(e){if(e==null)return;this.diff=e;let{options:t}=this.getRenderOptions(e),r=wa(e,this.getTokenizeMaxLength()),i=this.workerManager?.getDiffResultCache(e);i!=null&&!Z(t,i.options)&&(i=void 0),this.renderCache??={diff:e,hydrated:!0,highlighted:!r&&!ya(e),options:t,result:r?void 0:i?.result,renderRange:void 0};let a=this.getHighlightWorkerManager(e);a==null?this.options.deferHydrationHighlight!==!0&&C({theme:this.getLocalHighlightTheme()})==null&&(this.computedLangs=Ca(e),this.initializeHighlighter().catch(e=>{e instanceof n||this.onHighlightError(e)})):this.renderCache.result==null&&!r&&a.highlightDiffAST(this,this.diff)}awaitsPoolHighlight(e){let t=this.getHighlightWorkerManager(e);if(t==null||e.cacheKey==null||t.didHighlightFail(e))return!1;let n=t.getDiffRenderOptions();return n.useTokenTransformer===!0&&(e.additionLines.length>0||e.deletionLines.length>0)&&!ya(e)&&!wa(e,this.getTokenizeMaxLength())&&!this.hasHighlightedRenderCache(e,n)&&this.getReadyRenderResult(e,n)==null}getHighlightWorkerManager(e){let{editSessionActive:t,workerManager:n}=this;return!t&&n?.isWorkingPool()===!0&&!n.shouldHighlightOnMainThread(e)?n:void 0}cacheHighlightResult(e,t){let{editSessionActive:n,workerManager:r}=this;!n&&r?.isWorkingPool()===!0&&r.setDiffResultCache(e.cacheKey,t)}getLocalHighlightTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??l}getLineCutLength(e=this.options){if(this.editSessionActive)return 1/0;let{tokenizeMaxLineLength:t=1e3}=this.getEffectiveCodeOptions(e);return t>0?t:1/0}getEffectiveCodeOptions(e=this.options){let t=this.workerManager?.getDiffRenderOptions();return{theme:t?.theme??this.options.theme??l,tokenizeMaxLineLength:t?.tokenizeMaxLineLength??e.tokenizeMaxLineLength}}getRenderOptions(e){let t=(()=>{if(this.workerManager!=null){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,preferredDiffLib:this.options.parseDiffOptions?.preferredDiffLib,maxLineDiffLength:r}})();this.getOptionsWithDefaults();let{renderCache:n}=this;return n?.result==null||!G(e,n.diff)||!Z(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}getDiffForNextRender(e){let{options:t}=this.getRenderOptions(e);if(this.getReadyRenderResult(e,t)!=null||this.renderCache==null)return e;if(G(this.renderCache.diff,e))return this.renderCache.diff;let n=!(e.additionLines.length>0||e.deletionLines.length>0)||ya(e)||wa(e,this.getTokenizeMaxLength());return this.canRenderDiff(e,t,n)?e:this.renderCache.diff}canRenderDiff(e,t,n){let{renderCache:r}=this;return r==null||G(r.diff,e)?!0:n?r.result==null&&r.hydrated!==!0||this.workerManager?.isWorkingPool()===!0&&!this.workerManager.shouldHighlightOnMainThread(e)||C({theme:t.theme})!=null:r.result==null&&r.hydrated!==!0?!0:this.getHighlightWorkerManager(e)==null?C({theme:t.theme})!=null:!r.highlighted}renderCollapsed(e){this.workerManager?.cancelLocalThemeRender(this),this.diff=e;let{renderCache:t}=this;t!=null&&(!G(t.diff,e)||t.hydrated===!0&&t.result==null)&&this.clearRenderCache();let r=this.getLocalHighlightTheme(),i=C({theme:r});if(i==null){this.initializeHighlighter([`text`]).then(()=>this.onRenderUpdate?.()).catch(e=>{e instanceof n||this.onHighlightError(e)});return}let{disableFileHeader:a=!1}=this.options;return{headerElement:a?void 0:this.renderHeader(e),themeStyles:ye({theme:r,highlighter:i}),baseThemeType:typeof r==`string`?i.getTheme(r).type:void 0}}renderDiff(e=this.diff,t=c){if(this.diff=e,e==null){this.pendingHighlightResult=void 0;return}let{expandUnchanged:r,collapsedContextThreshold:i}=this.getOptionsWithDefaults(),{options:a,forceHighlight:o}=this.getRenderOptions(e),s=this.getReadyRenderResult(e,a);this.pendingHighlightResult=void 0,s!=null&&(this.renderCache={...s,diff:e,renderRange:void 0,lines:this.lineSnapshot(e)},o=!1),this.renderCache??={diff:e,highlighted:!1,options:a,result:void 0,renderRange:void 0};let l=e.additionLines.length>0||e.deletionLines.length>0,u=!l||ya(e)||wa(e,this.getTokenizeMaxLength()),d=this.canRenderDiff(e,a,u),f=!G(e,this.renderCache.diff),p=!ot(this.renderCache.renderRange,t),m=this.getHighlightWorkerManager(e);if(m!=null){let n=this.renderCache.result==null&&this.renderCache.highlighted&&!u&&!f&&Oe(t);if(d&&!n&&(u||this.renderCache.result==null||!this.renderCache.highlighted&&(f||p))){if(this.renderCache.diff=e,this.renderCache.options=a,this.renderCache.highlighted=!1,this.renderCache.result==null||f||p||o){let n=m.getPlainDiffAST(e,t.startingLine,t.totalLines,Oe(t)||r?!0:this.expandedHunks,i);n??this.waitForLocalTheme();let{result:a}=this.renderCache,s=a!=null&&n!=null&&!f&&!o?Sa(a,n):n;s!==a&&(this.renderCache.lines=this.lineSnapshot(e)),this.renderCache.result=s}this.renderCache.renderRange=t}!u&&l&&(!this.renderCache.highlighted||o)&&m.highlightDiffAST(this,e)}else{this.computedLangs=Ca(e);let r=C(),i=r!=null&&h(a.theme,r),s=r!=null&&et(this.computedLangs,r),c=!u&&s,l=Number.isFinite(t.totalLines);if(d&&r!=null&&i&&(o||!this.renderCache.highlighted&&c||this.renderCache.result==null)){let{result:t,options:n}=this.renderDiffWithHighlighter(e,r,u||!s,l);this.renderCache={diff:e,options:n,highlighted:c,result:t,renderRange:void 0,lines:this.lineSnapshot(e)},c&&this.cacheHighlightResult(e,{result:t,options:n})}if(!i||!u&&!s){if(this.renderCache.result==null&&!this.renderCache.highlighted&&!this.editSessionActive&&this.waitForLocalTheme(u||s?[]:this.computedLangs))return;this.asyncHighlight(e,l).then(({result:t,options:n})=>{u||this.cacheHighlightResult(e,{result:t,options:n}),this.applyHighlightResult(e,t,n,!u)}).catch(e=>{e instanceof n||this.onHighlightError(e)})}}if(this.renderCache.result!=null)return this.workerManager?.cancelLocalThemeRender(this),this.layoutResult(this.renderCache.diff,t,this.renderCache.result,this.renderCache.lines);if(!this.editSessionActive)return;let{result:g}=this.editSessionRows(this.requireSession());return this.layoutResult(this.renderCache.diff,t,g,{ids:[],texts:[]})}async asyncRender(e,t=c){this.diff=e;let{result:n}=await this.asyncHighlight(e,Number.isFinite(t.totalLines));return this.layoutResult(e,t,n)}createPreElement(e,t,n){let{diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o}=this.getOptionsWithDefaults();return ae({type:`diff`,diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e,t=!1){let n=wa(e,this.getTokenizeMaxLength());this.computedLangs=n?[`text`]:Ca(e);let r=C(),i=r!=null&&h(this.getLocalHighlightTheme(),r),a=n||r!=null&&et(this.computedLangs,r);return r!=null&&i&&a||(r=await this.initializeHighlighter()),this.renderDiffWithHighlighter(e,r,n,t)}renderDiffWithHighlighter(e,t,n=!1,r=!1){let{options:i}=this.getRenderOptions(e),{collapsedContextThreshold:a}=this.getOptionsWithDefaults();return{result:ga(e,t,i,{forcePlainText:n,lazyLineAST:r,expandedHunks:n?!0:void 0,collapsedContextThreshold:a}),options:i}}onHighlightSuccess(e,t,n,r=!0){this.editSessionActive||this.applyHighlightResult(e,t,n,r)}applyHighlightResult(e,t,n,r=!0){let{diff:i,renderCache:a}=this;i!=null&&a!=null&&G(i,e)&&Z(n,this.getRenderOptions(i).options)&&(a.result!=null&&a.highlighted&&Z(a.options,n)&&G(a.diff,i)||(this.pendingHighlightResult={diff:i,options:n,highlighted:r,result:t},this.onRenderUpdate?.()))}getMatchingWorkerResultCache(e,t){if(this.editSessionActive)return;let n=this.workerManager?.getDiffResultCache(e);if(n!=null&&Z(t,n.options))return n}getReadyRenderResult(e,t){let{pendingHighlightResult:n}=this;if(n!=null&&G(n.diff,e)&&Z(n.options,t))return n;let r=this.getMatchingWorkerResultCache(e,t);if(!(r==null||this.hasHighlightedRenderCache(e,t)))return{diff:e,highlighted:!0,...r}}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&G(e,n.diff)&&Z(t,n.options)}onHighlightError(e){console.error(e)}onLocalFallback(){this.onRenderUpdate?.()}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}layoutWithOptions(e){let{diffStyle:t,expandUnchanged:n,expansionLineCount:r,collapsedContextThreshold:i,hunkSeparators:a}=this.getOptionsWithDefaults(),{lineDiffType:o,maxLineDiffLength:s,preferredDiffLib:c}=this.getRenderOptions(e).options,l={diffStyle:t,expandUnchanged:n,expansionLineCount:r,collapsedContextThreshold:i,hunkSeparators:a,lineDiffType:o,maxLineDiffLength:s,preferredDiffLib:c,canHydrateContext:Ta(e,this.options.loadDiffFiles!=null)},u=this.layout??=new vi(l,this.lineCuts);return u.setOptions(l),u}editorRenderRange(e,t){if(t==null||e==null||Oe(t))return t;let n=this.model?.diff===e?this.model:this.model=da.fromDiff(e),r=this.rowSource?.source??new Ae({deletionRows:[],additionRows:[],additionLines:[],lineIds:[]}),i=this.layoutWithOptions(e).newFileLines(this.layoutInput(n,r,t));return i==null?{...t,startingLine:0,totalLines:0}:{...t,startingLine:i.first-1,totalLines:i.last-i.first+1}}layoutInput(e,t,n){return this.lineCuts.setLimit(this.getLineCutLength()),{host:this,model:e,rows:t,renderRange:n,expandedHunks:this.expandedHunks,deletionAnnotations:this.deletionAnnotations,additionAnnotations:this.additionAnnotations,annotationSlotName:this.annotationSlotName,includeTrailingNewline:this.includesTrailingNewline(),showNoNewlineMarkers:this.showsNoNewlineMarkers()}}layoutResult(e,t,n,r){let{themeStyles:i,baseThemeType:a}=n,{disableFileHeader:o}=this.getOptionsWithDefaults(),s=this.layoutWithOptions(e),c=this.model?.diff===e?this.model:this.model=da.fromDiff(e),l=this.rowSource?.result,u=this.getRowSource(n,c,r),{columns:d,patched:f,hunkData:p,rowCount:m,totalLines:h}=s.layout(this.layoutInput(c,u,t));return{fileDiff:e,columns:d,allRowsChanged:l!==n,patched:f,hunkData:p,preNode:this.createPreElement(d.deletions!=null&&d.additions!=null,h),themeStyles:i,baseThemeType:a,headerElement:o?void 0:this.renderHeader(e),totalLines:h,rowCount:m,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter}}lineSnapshot(e){let{model:t}=this;if(t!=null&&t.diff===e&&t.live)return{ids:t.lineIds(),texts:e.additionLines.slice()}}getRowSource(e,t,n){let{rowSource:r}=this;if(r!=null&&r.result===e)return r.source;if(t.live&&n==null)throw Error(`DiffHunksRenderer: a highlight result for an edited diff has no line snapshot`);let i={deletionRows:e.code.deletionLines,additionRows:e.code.additionLines,additionLines:n?.texts??t.diff.additionLines,lineIds:n?.ids};if(r!=null&&t.live&&r.model===t)return r.source.setHighlightRows(i),this.layout?.invalidateLines(),r.result=e,r.source;let a=new Ae(i);return this.rowSource={result:e,source:a,model:t},a}renderCodeAST(e,t){let n=t.columns[e];if(n==null)return;let r=gt(n),i=bt(r.gutter);return i.properties.style=`grid-row: span ${t.rowCount}`,[i,_t(r.content,t.rowCount)]}renderFullAST(e,t=[]){let n=this.getOptionsWithDefaults().hunkSeparators===`line-info`,r=this.renderCodeAST(`unified`,e);if(r!=null)return t.push(z({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(z({tagName:`code`,children:i,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-deletions":``}}));let a=this.renderCodeAST(`additions`,e);return a!=null&&t.push(z({tagName:`code`,children:a,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-additions":``}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return Ct(this.renderFullAST(e,t))}renderPartialHTML(e,t){return Ct(t==null?e:z({tagName:`code`,children:e,properties:{"data-code":``,"data-container-size":this.getOptionsWithDefaults().hunkSeparators===`line-info`?``:void 0,[`data-${t}`]:``}}))}renderHeader(e){let{headerRenderMode:t,stickyHeader:n}=this.getOptionsWithDefaults();return je({fileOrDiff:e,mode:t,stickyHeader:n})}};function Sa(e,t){return O(e.code.deletionLines,t.code.deletionLines),O(e.code.additionLines,t.code.additionLines),e}function Ca(e){if(e.lang!=null)return[e.lang];let t=R(e.prevName??e.name),n=R(e.name);return t===n?[n]:[t,n]}function wa(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function Ta(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function Ea(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function Da(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 Oa(e,t=300){let n;try{await Promise.race([e(),new Promise(e=>{n=setTimeout(e,t)})])}finally{n!=null&&clearTimeout(n)}}function ka({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 Aa(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,deferHydrationHighlight:e?.deferHydrationHighlight,useCSSClasses:e?.useCSSClasses,useTokenTransformer:A(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,parseDiffOptions:e?.parseDiffOptions,collapsedContextThreshold:e?.collapsedContextThreshold,lineDiffType:e?.lineDiffType,maxLineDiffLength:e?.maxLineDiffLength,expansionLineCount:e?.expansionLineCount,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}function ja(e){return e.isPartial&&(e.type===`change`||e.type===`rename-changed`||e.type===`rename-pure`)}function Ma(e,t){if(e.isPartial||t.isPartial)throw Error(`FileDiff.shouldResetEditorForExternalDiff: diffs must be fully hydrated`);let n=e.lang??R(e.name),r=t.lang??R(t.name),i=e.type!==`new`,a=t.type!==`new`;return e.name!==t.name||n!==r||i!==a||e.deletionLines.length!==t.deletionLines.length||e.deletionLines.some((e,n)=>e!==t.deletionLines[n])}var Na=-1,Pa=class{options;workerManager;requestOwnerRender;static LoadedCustomComponent=!0;__id=`file-diff:${++Na}`;type=`file-diff`;fileContainer;spriteSVG;pre;codeColumns=new xe;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;get lineAnnotations(){return this.renderedData?.lineAnnotations??t}managersDirty=!1;appliedManagerSetup;deletionFile;additionFile;fileDiff;editSession;renderedData;pendingData;forceRenderOverride;renderRange;pendingFiles;pendingAttach;appliedPreAttributes;headerCache={lastRenderedHTML:void 0,html:void 0,fileDiff:void 0,messagesVersion:void 0};lastRowCount;columnReconcilers=new WeakMap;changedRowKeys=[];mounted=!1;enabled=!0;editor;constructor(e={theme:l},t,n){this.options=e,this.workerManager=t,this.requestOwnerRender=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new qe,this.scrollSyncManager=new Zr,this.interactionManager=new Ge(`diff`,Pe(e,this.expandLine,typeof e.hunkSeparators==`function`||(e.hunkSeparators??`line-info`)===`line-info`||e.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex)),this.enabled=!0}subscribeToChanges(){this.workerManager?.subscribeToThemeChanges(this),L.subscribe(this)}handleHighlightRender=()=>{this.rerender()};getTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??l}getHunksRendererOptions(e){return Aa(e)}createHunksRenderer(e){return new xa(this.getHunksRendererOptions(e),this.getAnnotationSlotName,this.handleHighlightRender,this.workerManager)}getLineIndex=(e,t=`additions`)=>this.getLineIndexForDiff(this.getDiffForLineIndex(),e,t);getDiffForLineIndex(){return this.getRenderedDiff()}getLineIndexForDiff(e,t,n){return kt(e,t,n)}setOptions(e){e!=null&&(e.unsafeCSS!==this.options.unsafeCSS&&this.editor?.__setSearchPanelUnsafeCSS(e.unsafeCSS),this.options=e,this.clearReusableHeader(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions(),this.managersDirty=!0)}syncInteractionOptions(){this.interactionManager.setOptions(Pe(this.options,this.expandLine,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.editSession==null?this.applyCachedThemeState(e):this.onThemeChange())}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&&!N(this.appliedThemeCSS.theme,this.getTheme())}getHoveredLine=()=>this.interactionManager.getHoveredLine();getAnnotationSlotName=e=>Se(this.editSession?.annotations,e,I);getLatestAnnotations(){return this.pendingData?.lineAnnotations??this.editSession?.annotations?.current??this.lineAnnotations}getAnnotationsForDiff(e){let{pendingData:t}=this;return t!=null&&G(e,t.fileDiff)?t.lineAnnotations:this.lineAnnotations}isNewAnnotations(e){let t=this.editSession?.annotations;return e===this.getLatestAnnotations()?!1:t==null||e!==t.provided&&e!==t.current}setLineAnnotations(e){let t=this.editSession?.annotations;if(t!=null){if(!this.isNewAnnotations(e))return;P(t,e,I)}let n=this.getWorkingDiff();n!=null&&(this.pendingData={fileDiff:n,lineAnnotations:e})}syncEditSessionAnnotationsFromEditor(e){let t=this.editSession?.annotations;return t==null||e===t.current?!1:(t.current=e,this.renderedData!=null&&(this.renderedData.lineAnnotations=e),this.pendingData=void 0,this.hunksRenderer.setLineAnnotations(e),this.renderAnnotations(),!0)}setSelectedLines(e,t){this.interactionManager.setSelection(e,t)}setEditorActiveLine(e,t){this.interactionManager.setEditorActiveLine(e,{lineNumberOnly:t?.lineNumberOnly,side:t?.side??`additions`})}flushManagers(){if(this.pre==null){this.managersDirty=!1;return}let{diffStyle:e=`split`,overflow:t=`scroll`}=this.options,n={overflow:t,diffStyle:e,disableAnnotations:t===`wrap`||this.lineAnnotations.length===0,columnVariables:this.shouldApplyColumnVariables(t)?`apply`:`measure`};(this.managersDirty||!ce(n,this.appliedManagerSetup))&&(this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:n.disableAnnotations,columnVariables:n.columnVariables}),t===`scroll`&&e===`split`?this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions):this.scrollSyncManager.cleanUp(),this.appliedManagerSetup=n,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)}get codeUnified(){return this.codeColumns.get(`unified`)}set codeUnified(e){this.codeColumns.set(`unified`,e)}get codeDeletions(){return this.codeColumns.get(`deletions`)}set codeDeletions(e){this.codeColumns.set(`deletions`,e)}get codeAdditions(){return this.codeColumns.get(`additions`)}set codeAdditions(e){this.codeColumns.set(`additions`,e)}getCodeScrollLeft(){return this.codeColumns.scrollLeft}setCodeScrollLeft(e){this.codeColumns.setScrollLeft(e)}__getEffectiveCodeOptions(){return{...this.options,...this.hunksRenderer.getEffectiveCodeOptions(),themeType:this.options.themeType}}cleanUp(e=!1){let{editor:t}=this;t?.__assertOutsideChangeCallback(`FileDiff.cleanUp`),Te(this.handleEditSessionRender),this.emitPostRender(!0),t?.cleanUp(e?`recycle`:`discard`),e||(this.editor=void 0),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),L.unsubscribe(this),this.renderRange=void 0,e||(this.pendingFiles=void 0,this.pendingAttach=void 0),this.isComponentManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.renderedData=void 0,this.pendingData=void 0),this.clearAuxiliaryNodes(),this.annotationCache.clear(),this.pre?.remove(),this.pre=void 0,this.codeColumns.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement?.remove(),this.headerElement=void 0,this.clearHeaderSlots(),this.placeHolder?.remove(),this.placeHolder=void 0,this.headerCache.lastRenderedHTML=void 0,e||this.clearReusableHeader(),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.editSession=void 0,this.deletionFile=void 0,this.additionFile=void 0),this.enabled=!1}virtualizedSetup(){this.enabled=!0}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=ka(a,`FileDiff.hydrate`),s=o?.oldFile,c=o?.newFile;this.hydrateElements(e,t);let l=this.editor!=null;l||za(this.pre,La({fileDiff:i,oldFile:s,newFile:c}),this.options.collapsed)||Ba(this.headerElement,Ra({fileDiff:i,oldFile:s,newFile:c}),this.options.disableFileHeader)?this.render({...a,fileContainer:e,lineAnnotations:r,fileDiff:i,forceRender:l||a.forceRender,preventEmit:!0}):this.hydrationSetup({fileDiff:i,lineAnnotations:r,...o}),n||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),de(e,t);for(let t of e.shadowRoot?.children??[])if(t instanceof SVGElement)this.spriteSVG=pe(t);else 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))}else`diffsHeader`in t.dataset?this.headerElement=t:t instanceof HTMLStyleElement&&t.hasAttribute(`data-theme-css`)?this.themeCSSStyle=t:t instanceof HTMLStyleElement&&t.hasAttribute(`data-unsafe-css`)&&(this.unsafeCSSStyle=t,this.appliedUnsafeCSS=t.textContent)}this.pre!=null&&(this.syncCodeNodesFromPre(this.pre),this.pre.removeAttribute(`data-dehydrated`)),this.fileContainer??this.subscribeToChanges(),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({fileDiff:e,oldFile:t,newFile:n,lineAnnotations:r}){let i=r??this.getLatestAnnotations();this.pendingData=void 0,this.additionFile=n,this.deletionFile=t,this.fileDiff=e??(t!==void 0&&n!==void 0?Yr(t,n,this.options.parseDiffOptions):void 0),this.renderedData=this.fileDiff==null?void 0:{fileDiff:this.fileDiff,lineAnnotations:i},this.fileDiff!=null&&this.adoptRenderData(this.fileDiff),this.pre!=null&&(this.syncInteractionOptions(),this.hunksRenderer.hydrate(this.fileDiff),this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}expandLine=e=>{this.hunksRenderer.expandLine(e),this.rerender()};rerender(){!this.enabled||this.getInputDiff()==null&&this.additionFile==null&&this.deletionFile==null||this.requestRender()||this.render({forceRender:!0,renderRange:this.renderRange})}requestRender(){let{requestOwnerRender:e}=this;return this.editSession!=null||e==null?!1:(this.forceRenderOverride=!0,e(),!0)}get isComponentManaged(){return this.requestOwnerRender!=null}onThemeChange(){this.hunksRenderer.clearRenderCache(),this.rerender()}onMessagesChange(){this.rerender()}handleExpandHunk=(e,t,n)=>{this.expandHunk(e,t,n)};expandHunk=(e,t,n)=>{this.loadFilesIfNecessary(),this.hunksRenderer.expandHunk(e,t,n),this.rerender()};loadFilesIfNecessary(){let e=this.getInputDiff(),{loadDiffFiles:t}=this.options;if(e==null||!ja(e)||this.pendingFiles?.fileDiff===e)return;if(t==null)throw Error(`FileDiff: loadDiffFiles is required to load full files for a partial diff`);let n=this.loadFilesForDiff(e,t),r=this.pendingFiles={fileDiff:e,promise:n};r.promise=n.finally(()=>{this.pendingFiles===r&&(this.pendingFiles=void 0)})}isReadyToEdit(){let e=this.getInputDiff();return e!=null&&!e.isPartial&&!this.hunksRenderer.awaitsPoolHighlight(e)}async prepareForEditing(){if(this.isReadyToEdit())return;let e=this.__prepareForEditing();if(e==null)throw Error(`FileDiff.prepareForEditing: a diff is required before editing`);if(await e,!this.isReadyToEdit())throw Error(`FileDiff.prepareForEditing: the diff is not ready to edit`)}__prepareForEditing(){let e=this.getInputDiff();if(e==null||this.isReadyToEdit())return;if(e.isPartial&&!ja(e))throw Error(`FileDiff: this partial diff cannot be hydrated; provide a complete diff to edit`);let{pendingAttach:t}=this;if(t?.fileDiff===e)return t.promise;let n={fileDiff:e,promise:this.prepareInputForEditing(e)};return this.pendingAttach=n,n.promise=n.promise.finally(()=>{this.pendingAttach===n&&(this.pendingAttach=void 0)}),n.promise}async prepareInputForEditing(e){e.isPartial&&(this.loadFilesIfNecessary(),await this.pendingFiles?.promise,!this.enabled||this.getInputDiff()!==e)||await this.awaitPoolHighlight(e)}async awaitPoolHighlight(e){this.hunksRenderer.awaitsPoolHighlight(e)&&(await this.primeHighlightCache(e),this.enabled&&this.getInputDiff()===e&&!this.hunksRenderer.awaitsPoolHighlight(e)&&this.rerender())}async loadFilesForDiff(e,t){try{let n=await t(e);if(this.getInputDiff()!==e)return;await this.handleFilesLoaded(e,n)}catch(e){if(this.options.disableErrorHandling===!0)throw e;console.error(e)}}async handleFilesLoaded(e,t){this.getInputDiff()===e&&e.isPartial&&(rn(`merge`,e,t,this.options.parseDiffOptions),this.setHydratedState(t),!this.installHydratedDiff(e)&&(await Oa(()=>this.primeHighlightCache(e)),!this.enabled||this.getInputDiff()!==e)||this.rerender())}installHydratedDiff(e){return this.editSession==null||this.getInputDiff()!==e?!1:(this.replaceEditSession(e,this.getLatestAnnotations()),!0)}replaceEditSession(e,t){let{editor:n,editSession:r}=this,i=r?.diff;this.installEditSession(e),n!=null&&i!=null&&n.__replaceDocument(Fa(e),Ma(i,e),t)}updateInputDiff(e,t){if(G(this.getInputDiff(),e))return!1;this.editor?.__assertOutsideChangeCallback(`FileDiff.render`),this.hunksRenderer.lineCuts.clear();let n=this.getLatestAnnotations();this.fileDiff=e;let{editSession:r}=this;return r?.annotations!=null&&t!=null&&(r.annotations=pt(t,I,r.annotations)),r!=null&&(e.isPartial?(r.inputDiff=e,this.loadFilesIfNecessary()):this.replaceEditSession(e,r.annotations?.current??t??n)),this.pendingData={fileDiff:this.editSession?.diff??e,lineAnnotations:this.editSession?.annotations?.current??t??n},!0}installEditSession(e,t,n){let r=this.hunksRenderer.startEditSession(e,{document:t,snapshot:n}),i=this.editSession?.annotations??pt(this.getLatestAnnotations(),I);this.editSession={diff:r,inputDiff:e,annotations:i},this.pendingData={fileDiff:r,lineAnnotations:i.current}}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}){if(!this.enabled)throw Error(`FileDiff.render: attempting to call render after cleaned up`);n=this.forceRenderOverride??n,this.forceRenderOverride=void 0;let l=ka(c,`FileDiff.render`),u=l?.oldFile,d=l?.newFile;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=_&&(!Ia(u,this.deletionFile)||!Ia(d,this.additionFile)),y=e!=null&&!G(e,this.getInputDiff()),b=i!=null&&(i.length>0||this.getLatestAnnotations().length>0)&&this.isNewAnnotations(i);if(!f&&ot(h,this.renderRange)&&!n&&!b&&!g&&(e!=null&&!y||e==null&&!v)){let e=this.applyCachedThemeState(p);return e&&this.finalizeRender(),e}let x;e==null&&_&&(v||this.getInputDiff()==null)&&(x=Yr(l.oldFile,l.newFile,this.options.parseDiffOptions)),(e!=null&&y||x!=null)&&this.editor?.__assertOutsideChangeCallback(`FileDiff.render`),this.renderRange=h,_?(this.deletionFile=u,this.additionFile=d):e!=null&&(this.deletionFile=void 0,this.additionFile=void 0),e!=null&&y?this.updateInputDiff(e,i):x!=null&&(y=!0,this.updateInputDiff(x,i)),y&&this.clearReusableHeader(),i!=null&&this.setLineAnnotations(i),b&&(this.managersDirty=!0);let S=this.getWorkingDiff();if(S==null)return!1;S.editSessionDirty===!0&&this.shouldSelfHealEditSession()&&(Ji(S,this.options.parseDiffOptions),this.hunksRenderer.refreshHighlightedResult()),m&&this.loadFilesIfNecessary(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.prepareRenderData(this.getDiffForNextRender(S));let{disableErrorHandling:C=!1,disableFileHeader:w=!1}=this.options;if(w&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.headerCache.lastRenderedHTML=void 0),this.clearHeaderSlots()),a=this.getOrCreateFileContainer(a,o),this.ensureSpriteSVG(a),this.applyCachedThemeState(p),f){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.hunksRenderer.renderCollapsed(S);e!=null&&this.applyThemeState(a,e.themeStyles,p,e.baseThemeType),e?.headerElement!=null&&this.applyHeaderToDOM(e.headerElement,a,S),this.renderSeparators([]),this.adoptRenderData(S),this.injectUnsafeCSS()}catch(e){if(C)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return this.finalizeRender(),r||this.emitPostRender(),!0}let T=this.editor==null?void 0:this.hunksRenderer.editorRenderRange(S,h),E=this.editor?.__prepareRender(T);E!=null&&this.hunksRenderer.setTokens(E);try{let e=this.getOrCreatePreNode(a),n=this.hunksRenderer.renderDiff(S,h);if(n==null)return!1;this.applyThemeState(a,n.themeStyles,p,n.baseThemeType),n.headerElement!=null&&this.applyHeaderToDOM(n.headerElement,a,n.fileDiff);let{unified:r,deletions:i,additions:o}=n.columns;r!=null||i!=null||o!=null?this.applyHunksToDOM(e,n):this.pre!=null&&(this.pre.remove(),this.pre=void 0),this.renderSeparators(n.hunkData),this.adoptRenderData(n.fileDiff),this.applyBuffers(e,h),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),t||this.flushManagers(),this.finalizeRender(),this.editor!=null&&this.syncRenderViewToEditor(T)}catch(e){if(C)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return r||this.emitPostRender(),!0}finalizeRender(){}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)}getInputDiff(){return this.fileDiff}getWorkingDiff(e=this.fileDiff){return this.editSession?.diff??e}getRenderedDiff(){return this.renderedData?.fileDiff}__getNextRenderData({fileDiff:e,lineAnnotations:t}){let n=this.editSession?.annotations;if(n!=null)return{fileDiff:e,lineAnnotations:t!=null&&this.isNewAnnotations(t)?t:n.provided};let r=this.getWorkingDiff(e)??e,i=this.getDiffForNextRender(r);return{fileDiff:i,lineAnnotations:t!=null&&G(i,r)?t:this.getAnnotationsForDiff(i)}}getDiffForNextRender(e){let{collapsed:t=!1}=this.options;return t?e:this.hunksRenderer.getDiffForNextRender(e)}prepareRenderData(e){this.hunksRenderer.setLineAnnotations(this.getAnnotationsForDiff(e))}adoptRenderData(e){let{pendingData:t}=this,n=t!=null&&G(e,t.fileDiff);this.renderedData={fileDiff:e,lineAnnotations:n?t.lineAnnotations:this.lineAnnotations},n&&(this.pendingData=void 0)}syncRenderViewToEditor(e=this.hunksRenderer.editorRenderRange(this.getWorkingDiff(),this.renderRange)){let{editor:t,fileContainer:r}=this,i=this.getLatestAnnotations(),a=this.getWorkingDiff();if(t==null||r==null||a==null||a.isPartial)return;let o=n=>{this.enabled&&this.editor===t&&this.fileContainer===r&&this.getWorkingDiff()===a&&t.__syncRenderView({highlighter:n,fileContainer:r,columns:this.editorColumns(),fileDiff:a,lineAnnotations:i,renderRange:e,domCurrent:this.hunksRenderer.editorRenderReady()})},s=this.getTheme(),c=a.lang??R(a.name),l=C({theme:s,lang:c});l==null?w({themes:u(s),langs:[`text`,c],preferredHighlighter:ne(this.workerManager,this.options)}).then(o).catch(e=>{e instanceof n||console.error(e)}):o(l)}__acceptEditorChange(e){let{lineAnnotations:t}=e;t!=null&&this.syncEditSessionAnnotationsFromEditor(t)}emitEditChange(e){let{onEditChange:t}=this.options;t?.(e)}__captureDocumentSessionState(e=!0){let t=this.editSession?.diff;if(!(t==null||t.isPartial))return{diffSession:{oldFile:t.type===`new`?null:{name:t.prevName??t.name,lines:e?[...t.deletionLines]:t.deletionLines},type:t.type,hunks:e?Ke(t.hunks):t.hunks},hasChanges:t.editSessionDirty===!0}}__attachEditor(e){if(this.type!==`file-diff`)throw Error(`FileDiff.__attachEditor: cannot attach an editor to a "${this.type}" diff`);if(this.editor!=null)throw Error(`FileDiff.__attachEditor: an editor is already attached`);if(!this.isReadyToEdit())throw Error(`FileDiff.__attachEditor: the component is not ready to edit; await prepareForEditing() first`);let t=()=>{this.editor=void 0,this.endEditSession()};try{return this.resumeEditorRendering(e),t}catch(e){throw t(),e}}__resumeEditor(e){if(this.editor!==e)throw Error(`FileDiff.__resumeEditor: editor association changed`);this.resumeEditorRendering(e)}resumeEditorRendering(e){let t=this.getInputDiff(),n=this.editSession==null&&t!=null&&!t.isPartial?t:void 0;n!=null&&this.installEditSession(n,e.__getDocumentContents(Fa(n)),e.__getDocumentSessionState()),this.editor=e,this.getInputDiff()?.isPartial===!0&&this.loadFilesIfNecessary();let r=this.editSession?.diff;r!=null&&this.hunksRenderer.editorRenderReady()&&this.hunksRenderer.diffCache===r&&this.adoptRenderData(r),this.renderChange(!0)}__completeEditSession(e,t){this.settleEditSession(t===`install`,e)}settleEditSession(e,t){let{editSession:n}=this;if(n==null)return;let{diff:r,inputDiff:i,annotations:a}=n,o=a?.provided??this.lineAnnotations;if(this.editor!=null)throw Error(`FileDiff.__completeEditSession: detach the editor before completing the session`);this.endEditSession();let s=a?.current,c,l=null,u=null,d=!1,f;if(t==null)throw Error(`FileDiff.__completeEditSession: editor is required for completion`);let p=$e(r),m={name:p.name,contents:p.additionLines.join(``)};p.lang!=null&&(m.lang=p.lang);let h={fileDiff:p,editor:t,originalFileDiff:i,oldFile:p.type===`new`?null:{name:p.prevName??p.name,contents:p.deletionLines.join(``)},newFile:m,lineAnnotations:s,originalLineAnnotations:o};Object.freeze(h);try{if(t.__emitEditComplete(h),this.options.onEditComplete?.(h)===`accept`){if(p.cacheKey!=null&&p.cacheKey===i.cacheKey)throw Error(`FileDiff.__completeEditSession: an accepted diff must not reuse the replaced diff cacheKey`);c=p,l=h.oldFile,u=h.newFile}}catch(e){d=!0,f=e}if(e&&c!=null&&(this.hunksRenderer.lineCuts.clear(),this.additionFile!=null&&(this.deletionFile=l,this.additionFile=u)),this.editSession=void 0,this.fileDiff=e&&c!=null?c:i,this.pendingData={fileDiff:this.fileDiff,lineAnnotations:e&&c!=null?s??o:o},e&&this.fileContainer!=null&&this.rerender(),d)throw f}endEditSession(){this.editSession!=null&&(this.hunksRenderer.endEditSession()&&this.hunksRenderer.refreshHighlightedResult(),this.escalateEditSessionRender(`exit`))}applyChange(e,t,n={}){if(this.editSession==null)throw Error(`FileDiff.applyChange: requires an active edit session`);let{tokens:r,lineAnnotations:i}=n,{lineDelta:a,removedLineIds:o,regionsChanged:s,hunksChanged:c}=this.hunksRenderer.applyChange(t,e,r);i!=null&&this.syncEditSessionAnnotationsFromEditor(i);let l=a!==0||o.length>0||s;return this.renderChange(l||c),this.fileContainer==null||this.editSession==null?{rebuiltLines:[]}:(l&&this.interactionManager.setSelectionDirty(),{rebuiltLines:this.takeRebuiltLines()})}renderChange(e){this.fileContainer!=null&&this.rerender()}applyTokens(e){this.editSession!=null&&this.hunksRenderer.setTokens(e).some(e=>this.lineElement(e)!=null)&&this.rerender()}recordRowsWritten({changed:e,attributesReset:t,gutterRewritten:n}){for(let t of e)this.changedRowKeys.push(t),Re(t)||(this.managersDirty=!0);t&&this.interactionManager.setSelectionDirty(),(t||n)&&(this.managersDirty=!0)}lineElement(e){let t=this.codeAdditions??this.codeUnified;if(t==null||this.editSession==null)return;let n=this.hunksRenderer.lineKey(e);return n==null?void 0:this.columnReconcilers.get(t)?.elementFor(n)?.content}editLineFor(e){return this.editSession==null?void 0:this.hunksRenderer.editLineFor(e)}takeRebuiltLines(){let e=this.changedRowKeys;this.changedRowKeys=[];let t=[];for(let n of e){let e=this.hunksRenderer.lineOfKey(n);e!=null&&t.push(e)}return t}isLineInCollapsedContext(e,t=`additions`,n=this.hunksRenderer.getExpandedHunksMap()){let r=this.getRenderedDiff()??this.getWorkingDiff();if(r==null)return!1;let{expandUnchanged:i=!1,collapsedContextThreshold:a=1}=this.options;return It({fileDiff:r,lineNumber:e,side:t,expandedHunks:i?!0:n,collapsedContextThreshold:a})}getNearestRenderableLine(e,t){let n=this.getRenderedDiff()??this.getWorkingDiff();if(n==null)return e;let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options;return Lt({fileDiff:n,lineNumber:e,direction:t,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i})}revealLine(e,t=`additions`){let n=this.getRenderedDiff()??this.getWorkingDiff(),{expandUnchanged:r=!1,collapsedContextThreshold:i=1,expansionLineCount:a=100}=this.options;if(n==null||n.isPartial||r)return!1;let o=this.hunksRenderer.getExpandedHunksMap();for(let[r,s]of n.hunks.entries()){let[c,l]=Nt(s,t);if(e<c){let t=H({isPartial:n.isPartial,rangeSize:s.collapsedBefore,expandedHunks:o,hunkIndex:r,collapsedContextThreshold:i}),l=c-t.rangeSize;if(t.renderAll||e<l+t.fromStart||e>=c-t.fromEnd)return!1;let u=e-(l+t.fromStart)+1,d=c-t.fromEnd-e;return u<=d?this.expandHunk(r,`up`,u+a):this.expandHunk(r,`down`,d+a),!0}if(e<l)return!1}let s=U({fileDiff:n,hunkIndex:n.hunks.length-1,expandedHunks:o,collapsedContextThreshold:i,errorPrefix:`FileDiff.revealLine`});if(s==null||s.renderAll)return!1;let[,c]=Nt(n.hunks[n.hunks.length-1],t);return e<c+s.fromStart||e>=c+s.rangeSize?!1:(this.expandHunk(n.hunks.length,`up`,e-(c+s.fromStart)+1+a),!0)}shouldSelfHealEditSession(){return this.editor==null}escalateEditSessionRender(e){ke(this.handleEditSessionRender)}handleEditSessionRender=()=>{this.rerender()};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.codeDeletions?.remove(),this.codeAdditions?.remove(),this.codeColumns.cleanUp(),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.editor?.__captureFocusForDOMReplacement(),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.setPlaceholderHeight(e)}setPlaceholderHeight(e){return this.placeHolder!=null&&(this.placeHolder.style.setProperty(`height`,`${e}px`),!0)}async primeHighlightCache(e=this.getInputDiff()){let{workerManager:t}=this;if(e==null||t==null||!t.isWorkingPool()||e.cacheKey==null||ya(e))return;let n=this.options.tokenizeMaxLength??1e5;Math.max(e.additionLines.length,e.deletionLines.length)>n||await t.primeDiffHighlightCache(e).catch(e=>{Le(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.codeColumns.cleanUp(),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.headerCache.lastRenderedHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderSeparators(e){let{hunkSeparators:t}=this.options;if(this.isComponentManaged||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||!Da(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.isComponentManaged||this.fileContainer==null){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderedData:t,options:{renderAnnotation:n}}=this;if(n!=null&&t!=null){let{fileDiff:r,lineAnnotations:i}=t;for(let[t,a]of i.entries()){let i=this.getAnnotationSlotName(a),o=`${t}-${i}`,s=this.annotationCache.get(o);if(s==null||s.fileDiff!==r||!Ea(a,s.annotation)){s?.element.remove();let e=n(a,r);if(e==null)continue;s={element:ie(i),annotation:a,fileDiff:r},s.element.appendChild(e),this.fileContainer.appendChild(s.element),this.annotationCache.set(o,s)}e.delete(o)}}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=ee();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),n??this.subscribeToChanges(),this.fileContainer=r,n!=null&&i&&(this.headerCache.lastRenderedHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),i&&this.adoptReusableShellElements(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:Xe(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):Xe(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`});this.spriteSVG??=M(),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.codeColumns.cleanUp(),t.appendChild(this.pre),this.managersDirty=!0):this.pre.parentNode!==t&&(this.editor?.__captureFocusForDOMReplacement(),t.appendChild(this.pre),this.appliedPreAttributes=void 0,this.managersDirty=!0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodesFromPre(e){this.codeColumns.cleanUp();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(t,n,r){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let{headerCache:{fileDiff:a,html:o,lastRenderedHTML:s,messagesVersion:c}}=this,l=this.editSession?.diff,{version:u}=L,f=(r!==l&&c===u&&G(a,r)?o:void 0)??Ct(t);if(this.headerCache.html=f,this.headerCache.fileDiff=r,this.headerCache.messagesVersion=u,f!==s){let e=document.createElement(`div`);e.innerHTML=f;let t=e.firstElementChild;if(!(t instanceof HTMLElement))return;this.headerElement==null?n.shadowRoot?.prepend(t):n.shadowRoot?.replaceChild(t,this.headerElement),this.headerElement=t,this.headerCache.lastRenderedHTML=f}if(this.isComponentManaged)return;let{renderCustomHeader:m,renderHeaderPrefix:h,renderHeaderFilenameSuffix:g,renderHeaderMetadata:_}=this.options;if(m!=null){let t=m(r)??void 0;this.headerCustom=this.upsertHeaderSlotElement(n,this.headerCustom,e,t),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0;return}let v=h?.(r)??void 0,y=g?.(r)??void 0,b=_?.(r)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(n,this.headerPrefix,i,v),this.headerFilenameSuffix=this.upsertHeaderSlotElement(n,this.headerFilenameSuffix,d,y),this.headerMetadata=this.upsertHeaderSlotElement(n,this.headerMetadata,p,b),this.headerCustom?.remove(),this.headerCustom=void 0}clearReusableHeader(){this.headerCache.html=void 0,this.headerCache.fileDiff=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;this.pre?.toggleAttribute(`data-custom-styles`,!!e);let t=this.fileContainer?.shadowRoot;t!=null&&(e==null||e===``?(this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0):(this.unsafeCSSStyle?.parentNode!==t||this.appliedUnsafeCSS!==e)&&(this.unsafeCSSStyle??=me(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=De(e),this.appliedUnsafeCSS=e))}applyThemeState(e,t,n,r){if(t===``)return;let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.getTheme(),s=typeof o==`string`?o:{...o},c=re(i);this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===a&&this.appliedThemeCSS.scrollbarGutter===c?this.appliedThemeCSS.theme=s:this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===i?(this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c}):(this.themeCSSStyle=mt({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:k(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=vt(this.themeCSSStyle.textContent??``,re(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&Je()}applyHunksToDOM(e,t){this.shouldGuardRebuildScroll()?be(e,()=>this.replaceCodeColumns(e,t)):this.replaceCodeColumns(e,t)}writeColumn(e,t,n,{rowCount:r,allRowsChanged:i}){let a=this.getColumnPair(e);a==null?(a=this.createColumns(e,r),this.managersDirty=!0):r!==this.lastRowCount&&(a.gutter.style.setProperty(`grid-row`,`span ${r}`),a.content.style.setProperty(`grid-row`,`span ${r}`));let o=this.columnReconcilers.get(e);if(o??(o=new ht(a.gutter,a.content),this.columnReconcilers.set(e,o),!i&&a.content.childElementCount>0&&o.adopt(t)),i){o.replaceAll(t);for(let e of t)this.changedRowKeys.push(e.key);this.interactionManager.setSelectionDirty(),this.managersDirty=!0}else this.recordRowsWritten(o.reconcile(t,n))}removeStaleRows(e,t){e!=null&&t!=null&&this.columnReconcilers.get(e)?.removeStale(t)}createColumns(e,t){let n=bt();n.properties.style=`grid-row: span ${t}`,e.innerHTML=Ct([n,_t([],t)]);let r=this.getColumnPair(e);if(r==null)throw Error(`FileDiff.createColumns: the columns did not parse`);return r}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),this.changedRowKeys=[];let a=!1,o=[],{unified:s,deletions:c,additions:l}=t.columns,{patched:u}=t;this.editor?.__captureFocusForDOMReplacement(),!t.allRowsChanged&&u==null&&(this.removeStaleRows(this.codeUnified,s),this.removeStaleRows(this.codeDeletions,c),this.removeStaleRows(this.codeAdditions,l)),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=he({code:this.codeDeletions,columnType:`deletions`,rowSpan:i,containerSize:r}),this.writeColumn(this.codeDeletions,c,u?.deletions,t),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=he({code:this.codeAdditions,columnType:`additions`,rowSpan:i,containerSize:r}),this.writeColumn(this.codeAdditions,l,u?.additions,t),o.push(this.codeAdditions))):(this.codeUnified?.remove(),this.codeDeletions?.remove(),this.codeAdditions?.remove(),this.codeColumns.cleanUp()):(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=he({code:this.codeUnified,columnType:`unified`,rowSpan:i,containerSize:r}),this.writeColumn(this.codeUnified,s,u?.unified,t),o.push(this.codeUnified)),o.length===0?e.textContent=``:a&&(e.replaceChildren(...o),this.managersDirty=!0),this.lastRowCount=t.rowCount}editorColumns(){let e=this.codeAdditions??this.codeUnified,t=this.getColumnPair(e);if(e!=null&&t!=null)return{code:e,gutter:t.gutter,content:t.content,deletions:this.getColumnPair(this.codeDeletions)}}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}}updateBuffers(e){this.pre!=null&&this.applyBuffers(this.pre,e)}applyBuffers(e,t){t==null||this.shouldDisableVirtualizationBuffers()?(this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)):(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,{columns:t,totalLines:n},r){let{diffIndicators:i=`bars`,disableBackground:a=!1,disableLineNumbers:o=!1,overflow:s=`scroll`,diffStyle:c=`split`}=this.options,l={type:`diff`,diffIndicators:i,disableBackground:a,disableLineNumbers:o,overflow:s,split:c!==`unified`&&t.additions!=null&&t.deletions!=null,totalLines:n,customProperties:r};se(l,this.appliedPreAttributes)||(le(e,l),this.appliedPreAttributes=l)}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 Fa(e){return{name:e.name,lang:e.lang,contents:e.additionLines.join(``)}}function Ia(e,t){return e==null||t==null?e==null&&t==null:$t(e,t)}function La({fileDiff:e,oldFile:t,newFile:n}){return e!=null&&e.hunks.length>0||t!=null||n!=null}function Ra({fileDiff:e,oldFile:t,newFile:n}){return e!=null||t!=null||n!=null}function za(e,t,n=!1){return!n&&e==null&&t}function Ba(e,t,n=!1){return e==null&&t&&!n}function Va({fileDiff:e,metrics:t,disableFileHeader:n,hunkSeparators:r,expandUnchanged:i,expandedHunks:a,collapsedContextThreshold:o,canHydratePartialDiff:s,includeTrailingNewline:c=!1,showNoNewlineMarkers:l=!0}){let u=fe(t,n),d=u,f=i?!0:a,p=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=H({isPartial:e.isPartial,rangeSize:i.collapsedBefore,expandedHunks:f,hunkIndex:n,collapsedContextThreshold:o}),m=(a.fromStart+a.fromEnd)*t.lineHeight;if(u+=m,d+=m,a.collapsedLines>0){let e=Ht({type:r,metrics:t,hunkIndex:n,hunkSpecs:i.hunkSpecs})?.totalHeight??0;u+=e,d+=e}if(u+=i.splitLineCount*t.lineHeight,d+=i.unifiedLineCount*t.lineHeight,l){let e=Ha(i);u+=e.split*t.lineHeight,d+=e.unified*t.lineHeight}let h=n===p?U({fileDiff:e,hunkIndex:n,expandedHunks:f,collapsedContextThreshold:o,errorPrefix:`computeEstimatedDiffHeights`}):void 0;if(h!=null){let e=(h.fromStart+h.fromEnd)*t.lineHeight;if(u+=e,d+=e,h.collapsedLines>0){let e=Ut({type:r,metrics:t})?.totalHeight??0;u+=e,d+=e}}else if(n===p&&e.isPartial&&s){let e=Ut({type:r,metrics:t})?.totalHeight??0;u+=e,d+=e}c&&n===p&&(h?.collapsedLines??0)===0&&At(e,`additions`)&&(u+=t.lineHeight,d+=t.lineHeight)}if(e.hunks.length>0){let e=ge(t);u+=e,d+=e}return{splitHeight:u,unifiedHeight:d}}function Ha(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 Ua(e,t)}function Ua(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 Wa=3e3,Ga=new Map,Ka=-1,qa=class extends Pa{__id=`little-virtualized-file-diff:${++Ka}`;renderType=`virtualized`;top;height=0;metrics;cache={heightDeltas:new Map,measuredHeightDeltaTotal:0,estimatedSplitHeight:void 0,estimatedUnifiedHeight:void 0,checkpoints:[],totalLines:0,fileAnnotationHeight:0,ghostTextRows:Ga};highestMeasuredRow=-1;unmeasured=!1;isVisible=!1;isSetup=!1;virtualizer;layoutDirty=!0;currentCollapsed;pendingHydratedDiff;pendingExpandedHunks;pendingRender;constructor(e,t,n,r,i){super(e,r,i),this.virtualizer=t,this.metrics=D(n)}setMetrics(e,t=!1){let n=D(e);(t||!ce(this.metrics,n))&&(this.metrics=n,this.resetMeasurements(),this.invalidateLayout({includeEstimatedHeights:!0}))}setLineAnnotations(e){this.syncLineAnnotations(e)&&(this.forceRenderOverride=!0)}syncLineAnnotations(e){return e==null||!this.isNewAnnotations(e)||e.length===0&&this.getLatestAnnotations().length===0?!1:(super.setLineAnnotations(e),this.managersDirty=!0,!0)}syncEditSessionAnnotationsFromEditor(e){return super.syncEditSessionAnnotationsFromEditor(e)?(this.forceRenderOverride=!0,!0):!1}setFileAnnotationHeight(e){let t=this.cache.fileAnnotationHeight;return e!==t&&(this.cache.fileAnnotationHeight=e,this.cache.measuredHeightDeltaTotal+=e-t,!0)}hasFileAnnotations(e){let t=this.getLayoutAnnotations();return it(t)?t.some(t=>t.lineNumber===0?e.type===`new`?t.side===`additions`:e.type!==`deleted`||t.side===`deletions`:!1):!1}getLineHeight(e,t,n=!1){let{cache:r}=this,i=this.getEstimatedLineHeight(n)+(r.heightDeltas.get(e)??0);return t==null||r.ghostTextRows.size===0?i:i+(r.ghostTextRows.get(t)??0)*this.metrics.lineHeight}ghostTextRowsHeight(){let e=0;for(let t of this.cache.ghostTextRows.values())e+=t;return e*this.metrics.lineHeight}ghostTextRowsByIndex(e){let t=this.getDiffStyle(),n=new Map;for(let[r,i]of this.cache.ghostTextRows){let a=this.getLineIndexForDiff(e,r+1,`additions`);a!=null&&n.set(t===`split`?a[1]:a[0],i)}return n}getEstimatedLineHeight(e=!1){let t=e?2:1;return this.metrics.lineHeight*t}hasNoNewlineMarker(e){return this.hunksRenderer.showsNoNewlineMarkers()&&(e.hasAddition&&e.additionNoEOFCR||e.hasDeletion&&e.deletionNoEOFCR)}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=!F(t,e),r=n&&to(t,e);super.setOptions(e),r&&(this.resetMeasurements(),this.invalidateLayout({forceSimpleRecompute:!0,includeEstimatedHeights:no(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)}resetMeasurements(){this.cache.fileAnnotationHeight=0,this.cache.heightDeltas.clear(),this.cache.measuredHeightDeltaTotal=0,this.highestMeasuredRow=-1,this.cache.ghostTextRows=Ga}dropMeasurementsPastEnd(){let e=this.getRenderedDiff(),{heightDeltas:t}=this.cache;if(e==null||t.size===0)return;let n=this.getDiffStyle(),r=Math.max(this.getExpandedLineCount(e,n),n===`split`?e.splitLineCount:e.unifiedLineCount,e.additionLines.length,e.deletionLines.length);for(let e=this.highestMeasuredRow;e>=r;e--){let n=t.get(e);n!=null&&(t.delete(e),this.cache.measuredHeightDeltaTotal-=n)}this.highestMeasuredRow=Math.min(this.highestMeasuredRow,r-1)}invalidateLayout({forceSimpleRecompute:e=!1,includeEstimatedHeights:t=!1,resetRenderRange:n=!0}={}){this.layoutDirty=!0,this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.cache.totalLines!==0&&(this.cache.totalLines=0),t&&(this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0),this.renderRange!=null&&n&&(this.renderRange=void 0),e&&this.isSimpleMode()&&this.computeApproximateSize()}applyGhostTextRows(e){if(this.cache.ghostTextRows===e)return!1;let t=!j(e,this.cache.ghostTextRows);return this.cache.ghostTextRows=e,t}reconcileHeights(){let e=!1;this.unmeasured=!1;let{options:{overflow:t=`scroll`}}=this,n=this.placeHolder==null?this.getRenderedDiff():this.getLayoutDiff();if(this.fileContainer==null||n==null)return this.height!==0&&(e=!0),this.height=0,e;this.top=this.getVirtualizedTop(),e=this.applyGhostTextRows(this.editor?.__getGhostTextRows()??Ga);let r=t!==`scroll`||this.lineAnnotations.length>0||typeof process<`u`&&!1;if(this.placeHolder!=null||!r&&this.cache.heightDeltas.size===0&&this.cache.fileAnnotationHeight===0)return e&&(this.computeApproximateSize(!0),this.setPlaceholderHeight(this.height)),e;let i=this.getDiffStyle(),a=i===`split`?[this.codeAdditions,this.codeDeletions]:[this.codeUnified],o=new Set;for(let t of a){if(t==null)continue;let n=t.children[1];if(!(n instanceof HTMLElement))continue;let a=i===`split`&&t===this.codeDeletions;for(let t of n.children){if(!(t instanceof HTMLElement))continue;let n=t.dataset.lineIndex;if(n==null)continue;let s=oo(n,i);if(a){if(o.has(s))continue}else i===`split`&&o.add(s);let c=this.cache.heightDeltas.get(s)??0;if(!r&&c===0)continue;let l=t.getBoundingClientRect().height;if(l===0){this.unmeasured=!0;break}let u=!1;t.nextElementSibling instanceof HTMLElement&&(`lineAnnotation`in t.nextElementSibling.dataset||`noNewline`in t.nextElementSibling.dataset)&&(`noNewline`in t.nextElementSibling.dataset&&(u=!0),l+=t.nextElementSibling.getBoundingClientRect().height);let d=this.getEstimatedLineHeight(u),f=l-d;f!==c&&(e=!0,this.cache.measuredHeightDeltaTotal+=f-c,f===0?this.cache.heightDeltas.delete(s):(this.cache.heightDeltas.set(s,f),this.highestMeasuredRow=Math.max(this.highestMeasuredRow,s)))}if(this.unmeasured)break}if(!this.unmeasured&&this.renderRange!=null&<(this.renderRange)){let t=Ja(a)??0;this.setFileAnnotationHeight(t)&&(e=!0)}return e&&this.computeApproximateSize(!0),e}onRender=e=>this.fileContainer!=null&&(e&&(this.top=this.getVirtualizedTop()),this.render());renderChange(e){e?this.escalateEditSessionRender(`change`):this.rerender()}applyChange(e,t,n){return Ne(t)&&this.getAdvancedVirtualizer()?.capturePendingLayoutAnchor(),super.applyChange(e,t,n)}updateCodeViewLayout(e,t,n,r){let i=!1,a=!1,{pendingExpandedHunks:o,pendingHydratedDiff:s,options:{collapsed:c=!1}}=this;s!=null&&(this.pendingHydratedDiff=void 0,G(s.expectedDiff,e)&&(Object.assign(e,s.nextDiff),this.setHydratedState(s.files),this.installHydratedDiff(e),this.forceRenderOverride=!0,i=!0,a=!0)),o!=null&&(this.pendingExpandedHunks=void 0,this.hunksRenderer.setExpandedHunksMap(o),this.forceRenderOverride=!0,a=!0);let l=this.updateInputDiff(e,r),{pendingRenderDiff:u,layoutDiffChanged:d,renderedDiffChanged:f,annotationsChanged:p}=this.updatePendingRender(e,r);return!this.forceRenderOverride&&(l||f||p)&&(this.forceRenderOverride=!0),(n?.resetDiffLayoutCache===!0||d)&&(i=!0),(d||n?.resetDiffLayoutCache===!0&&n.includeEstimatedDiffHeights)&&(a=!0),n?.metrics!=null&&(this.metrics=D(n.metrics),i=!0,a=!0),this.currentCollapsed!==c&&(this.currentCollapsed=c,i=!0),i?(this.resetMeasurements(),this.invalidateLayout({includeEstimatedHeights:a})):a&&this.invalidateLayout({includeEstimatedHeights:!0}),this.top=t,this.computeApproximateSize(!1,u),this.height}getLinePosition(e,t=`additions`){let n=this.getLayoutDiff();if(n==null||e<1)return;let r=this.getLineIndexForDiff(n,e,t);if(r==null)return;let{disableFileHeader:i=!1,expandUnchanged:a=!1,collapsed:o=!1,collapsedContextThreshold:s=1}=this.options,c=this.getDiffStyle(),l=this.getHunkSeparatorType(),u=c===`split`?r[1]:r[0];this.approximateLayoutCheckpoints(n);let d=fe(this.metrics,i),f=this.getLayoutCheckpointBeforeLineIndex(u),p=f?.top??d+this.cache.fileAnnotationHeight;if(o)return{top:ue(this.metrics,i),height:0};let m,h=new Qt({diff:n,diffStyle:c,startingLine:f?.renderedLineIndex??0,expandedHunks:a?!0:this.pendingExpandedHunks??this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:s,includeTrailingNewline:this.hunksRenderer.includesTrailingNewline()});for(;h.next();){let{hunkIndex:e,hunk:t,collapsedBefore:n,collapsedAfter:r}=h,i=c===`split`?h.splitLineIndex:h.unifiedLineIndex;if(n>0){let r=Ht({type:l,metrics:this.metrics,hunkIndex:e,hunkSpecs:t?.hunkSpecs});if(r!=null){if(p+=r.gapBefore,u>=i-n&&u<i){m={top:p,height:r.height};break}p+=r.height+r.gapAfter}}let a=this.getLineHeight(i,h.hasAddition?h.additionLineIndex:void 0,this.hasNoNewlineMarker(h));if(i===u){m={top:p,height:a};break}if(p+=a,r>0){let e=Ut({type:l,metrics:this.metrics});if(e!=null){if(u>i&&u<=i+r){m={top:p+e.gapBefore,height:e.height};break}p+=e.totalHeight}}}return m}getEditorViewport(){return this.virtualizer.type===`simple`?this.virtualizer.getRoot():this.virtualizer.getContainerElement()}scrollToLine(e,t,n){let{virtualizer:r}=this;this.isLineInCollapsedContext(e)?(r.cancelScroll(),n(`cancelled`)):r.type===`advanced`?r.scrollToInstanceLine(this,e,t,n):r.scrollSpanIntoView({align:t,onDone:n,resolveSpan:()=>{let t=this.getLinePosition(e);return t==null?void 0:{top:this.getVirtualizedTop()+t.top,height:t.height}}})}cancelScroll(e){this.virtualizer.cancelScroll(e)}getRenderedBounds(){let e=this.renderRange;if(!this.enabled||e==null||e.totalLines<=0)return;let t=this.getLayoutDiff();return{top:fe(this.metrics,this.options.disableFileHeader??!1)+(e.startingLine===0?this.cache.fileAnnotationHeight:e.bufferBefore),bottom:this.height-(t!=null&&t.hunks.length===0?0:ge(this.metrics))-e.bufferAfter}}getNumericScrollAnchor(e){let t=this.getLayoutDiff();if(t==null)return;let{disableFileHeader:n=!1,expandUnchanged:r=!1,collapsed:i=!1,collapsedContextThreshold:a=1}=this.options;if(i)return;let o=this.getDiffStyle(),s=this.getHunkSeparatorType();this.approximateLayoutCheckpoints(t);let c=this.getLayoutCheckpointBeforeTop(e),l=c?.top??fe(this.metrics,n)+this.cache.fileAnnotationHeight,u,d=new Qt({diff:t,diffStyle:o,startingLine:c?.renderedLineIndex??0,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:a,includeTrailingNewline:this.hunksRenderer.includesTrailingNewline()});for(;d.next();){let{hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i}=d,a=o===`split`?d.splitLineIndex:d.unifiedLineIndex;if(r>0){let e=Ht({type:s,metrics:this.metrics,hunkIndex:t,hunkSpecs:n?.hunkSpecs});e!=null&&(l+=e.totalHeight)}if(l>=e){u=d.hasDeletion?{lineNumber:d.deletionLineNumber,side:`deletions`,top:l}:{lineNumber:d.additionLineNumber,side:`additions`,top:l};break}let c=this.getLineHeight(a,d.hasAddition?d.additionLineIndex:void 0,this.hasNoNewlineMarker(d));if(l+=c,i>0){let e=Ut({type:s,metrics:this.metrics});e!=null&&(l+=e.totalHeight)}}return u}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){let t=this.getLayoutDiff();if(this.top==null||t==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};let n=e==null?this.renderRange:this.computeRenderRangeFromWindow(t,this.top,e);if(n==null)return;let{bufferBefore:r,bufferAfter:i,totalLines:a}=n,o=0;if(a===0){let t=e??this.virtualizer.getWindowSpecs();this.top<t.top&&(o=i)}return{topOffset:this.top+r+o,height:this.height-(r+i)}}cleanUp(e=!1){let t=this.cache.ghostTextRows.size>0;t&&(this.layoutDirty=!0);let n=e&&this.isAdvancedMode()&&this.fileContainer!=null&&(t||!G(this.getRenderedDiff(),this.getWorkingDiff()));this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||(this.resetMeasurements(),this.invalidateLayout({includeEstimatedHeights:!0}),this.pendingExpandedHunks=void 0,this.pendingHydratedDiff=void 0),this.pendingRender=void 0,this.isSetup=!1,super.cleanUp(e),n&&this.virtualizer.instanceChanged(this,!0)}expandHunk=(e,t,n)=>{if(this.getInputDiff()!=null){if(this.loadFilesIfNecessary(),this.isAdvancedMode()){let{expansionLineCount:r=100}=this.options,i=this.pendingExpandedHunks??=new Map(this.hunksRenderer.getExpandedHunksMap());i.set(e,Pt(i.get(e),t,n??r))}else this.hunksRenderer.expandHunk(e,t,n),this.resetMeasurements(),this.invalidateLayout({includeEstimatedHeights:!0}),this.computeApproximateSize();this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}};async handleFilesLoaded(e,t){if(this.getInputDiff()===e&&e.isPartial){if(this.isAdvancedMode()){let n=rn(`clone`,e,t,this.options.parseDiffOptions);if(await Oa(()=>this.primeHighlightCache(n)),this.getInputDiff()!==e)return;this.pendingHydratedDiff={expectedDiff:e,nextDiff:n,files:t}}else{if(rn(`merge`,e,t,this.options.parseDiffOptions),this.setHydratedState(t),!this.installHydratedDiff(e)&&(await Oa(()=>this.primeHighlightCache(e)),this.getInputDiff()!==e))return;this.resetMeasurements(),this.invalidateLayout({includeEstimatedHeights:!0}),this.computeApproximateSize()}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}}loadFilesIfNecessary(){if(this.pendingHydratedDiff!=null){if(this.pendingHydratedDiff.expectedDiff===this.getInputDiff())return;this.pendingHydratedDiff=void 0}super.loadFilesIfNecessary()}isLineInCollapsedContext(e,t=`additions`,n=this.pendingExpandedHunks??this.hunksRenderer.getExpandedHunksMap()){return super.isLineInCollapsedContext(e,t,n)}invalidateEditSessionLayout(){this.getSimpleVirtualizer()?.markDOMDirty(),this.invalidateLayout({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1}),this.getSimpleVirtualizer()?.requestHeightReconcile(this)}escalateEditSessionRender(e){e===`exit`?this.resetMeasurements():this.dropMeasurementsPastEnd(),this.invalidateEditSessionLayout(),this.enabled&&this.getInputDiff()!=null&&(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))}shouldSelfHealEditSession(){return!this.isAdvancedMode()&&super.shouldSelfHealEditSession()}getLineCutsForSearch(){let{hunksRenderer:e,options:t}=this;return{cutLength:e.getLineCutLength(t),expandedLines:e.lineCuts.expandedLines}}getDiffForSearch(){return this.getWorkingDiff()}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(){if(!this.enabled||this.getInputDiff()==null&&this.additionFile==null&&this.deletionFile==null)return;let e=this.getWorkingDiff(),t=e==null?void 0:this.getDiffForNextRender(e);this.isSimpleMode()&&(this.pendingRender=void 0),this.forceRenderOverride=!0,this.isSimpleMode()&&this.requestRender()||this.virtualizer.instanceChanged(this,!G(this.getRenderedDiff(),t))}get isComponentManaged(){return this.getAdvancedVirtualizer()?.isComponentManaged??super.isComponentManaged}syncGhostTextRows(){let e=this.getAdvancedVirtualizer();e==null?this.getSimpleVirtualizer()?.requestHeightReconcile(this):(e.capturePendingLayoutAnchor(),this.layoutDirty=!0,e.instanceChanged(this,!0))}computeApproximateSize(e=!1,t=this.getLayoutDiff()){if(!e&&!this.layoutDirty)return;if(this.height,this.height=0,this.cache.checkpoints=[],this.cache.totalLines=0,t==null){this.layoutDirty=!1;return}this.applyGhostTextRows(this.editor?.__getGhostTextRows()??Ga);let{disableFileHeader:n=!1,collapsed:r=!1}=this.options;r?(this.height+=ue(this.metrics,n),this.layoutDirty=!1):(this.height=this.getActiveEstimatedHeight(t)+this.cache.measuredHeightDeltaTotal+this.ghostTextRowsHeight(),this.layoutDirty=!1)}getLayoutDiff(){return this.pendingRender?.diff??this.getRenderedDiff()}getLayoutAnnotations(){let{pendingRender:e}=this;return e==null?this.lineAnnotations:this.getAnnotationsForDiff(e.diff)}getActiveEstimatedHeight(e=this.getLayoutDiff()){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.getLayoutDiff()){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}=Va({fileDiff:e,metrics:this.metrics,disableFileHeader:t,hunkSeparators:this.getHunkSeparatorType(),expandUnchanged:n,expandedHunks:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r,canHydratePartialDiff:ro(e,this.options.loadDiffFiles!=null),includeTrailingNewline:this.hunksRenderer.includesTrailingNewline(),showNoNewlineMarkers:this.hunksRenderer.showsNoNewlineMarkers()});this.cache.estimatedSplitHeight=i,this.cache.estimatedUnifiedHeight=a}validateComputedHeight(e=this.getLayoutDiff()){}render({fileContainer:e,fileDiff:t,forceRender:n=!1,lineAnnotations:r,...i}={}){let a=ka(i,`VirtualizedFileDiff.render`),o=a!=null,s=a?.oldFile,c=a?.newFile,l=o&&(!ao(s,this.deletionFile)||!ao(c,this.additionFile)),u=t??this.getInputDiff();t==null&&o&&(l||this.getInputDiff()==null)&&(u=Yr(a.oldFile,a.newFile,this.options.parseDiffOptions));let{forceRenderOverride:d,isSetup:f}=this;this.forceRenderOverride=void 0;let p=u!=null&&!G(this.getInputDiff(),u),m=p||l;if(e=this.getOrCreateFileContainer(e),u==null)return console.error(`VirtualizedFileDiff.render: attempting to virtually render when we dont have the correct data`),!1;p&&this.updateInputDiff(u,r);let{pendingRenderDiff:h,layoutDiffChanged:g,renderedDiffChanged:_,annotationsChanged:v}=this.pendingRender!=null&&this.pendingRender.workingDiff===(this.getWorkingDiff(u)??u)?{pendingRenderDiff:this.pendingRender.diff,layoutDiffChanged:!1,renderedDiffChanged:!1,annotationsChanged:this.syncLineAnnotations(r)}:this.updatePendingRender(u,r);if(g&&(this.resetMeasurements(),this.invalidateLayout({includeEstimatedHeights:!0})),f)this.top??=this.getVirtualizedTop(),this.layoutDirty&&this.isSimpleMode()&&(this.getSimpleVirtualizer()?.markDOMDirty(),this.computeApproximateSize(!1,h));else{this.computeApproximateSize(!1,h);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()&&(!m||!f))return a!=null&&(this.deletionFile=s,this.additionFile=c),p&&this.clearReusableHeader(),this.renderPlaceholder(this.height);let y=this.virtualizer.getWindowSpecs(),b=this.top??0,x=this.computeRenderRangeFromWindow(h,b,y);return super.render({fileDiff:u,fileContainer:e,renderRange:x,lineAnnotations:r,forceRender:(d??n)||v||_||p,...a,...i})}finalizeRender(){if(!G(this.getRenderedDiff(),this.pendingRender?.diff))throw Error(`VirtualizedFileDiff.render: rendered a different diff than its prepared layout`);this.pendingRender=void 0,this.isSimpleMode()&&this.getSimpleVirtualizer()?.requestHeightReconcile(this)}updatePendingRender(e,t){let n=this.getWorkingDiff(e)??e,r=this.getRenderedDiff(),{pendingRender:i}=this,a=i?.diff??r,o=this.getDiffForNextRender(n);return this.pendingRender={workingDiff:n,diff:o},{pendingRenderDiff:o,annotationsChanged:this.syncLineAnnotations(t),layoutDiffChanged:!G(a,o),renderedDiffChanged:!G(r,o)}}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}getDiffStyle(){return this.options.diffStyle??`split`}getHunkSeparatorType(){return io(this.options.hunkSeparators)}approximateLayoutCheckpoints(e){if(!this.layoutDirty&&this.cache.checkpoints.length>0||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=ro(e,this.options.loadDiffFiles!=null),o=this.getDiffStyle(),s=this.getHunkSeparatorType(),c=n?!0:this.hunksRenderer.getExpandedHunksMap(),l=Ya(this.cache.heightDeltas,this.ghostTextRowsByIndex(e),this.metrics.lineHeight),u=fe(this.metrics,t)+this.cache.fileAnnotationHeight,d=0,f=({rowCount:e,startLineIndex:t,preSeparatorHeight:n=0,postSeparatorHeight:r=0,metadataOffsets:i=[]})=>{if(e<=0)return;let a=d,o=d+e,s=Qa(a);for(;s<o;){let e=s-a,r=u+(e>0?n:0)+e*this.metrics.lineHeight+$a(i,e)*this.metrics.lineHeight+Xa(l,t,t+e);this.cache.checkpoints.push({renderedLineIndex:s,lineIndex:t+e,top:r}),s+=Wa}u+=n+e*this.metrics.lineHeight+i.length*this.metrics.lineHeight+Xa(l,t,t+e)+r,d=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 l=H({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:c,hunkIndex:t,collapsedContextThreshold:r}),u=l.collapsedLines>0?Ht({type:s,metrics:this.metrics,hunkIndex:t,hunkSpecs:n.hunkSpecs})?.totalHeight??0:0;f({rowCount:l.fromStart,startLineIndex:(o===`split`?n.splitLineStart:n.unifiedLineStart)-l.rangeSize});let d=u;f({rowCount:l.fromEnd,startLineIndex:(o===`split`?n.splitLineStart:n.unifiedLineStart)-l.fromEnd,preSeparatorHeight:d}),l.fromEnd>0&&(d=0);let p=t===i?U({fileDiff:e,hunkIndex:t,expandedHunks:c,collapsedContextThreshold:r,errorPrefix:`VirtualizedFileDiff`}):void 0,m=p!=null&&p.collapsedLines>0||t===i&&a?Ut({type:s,metrics:this.metrics})?.totalHeight??0:0,h=p==null?0:p.fromStart+p.fromEnd,g=o===`split`?n.splitLineCount:n.unifiedLineCount,_=o===`split`?n.splitLineStart:n.unifiedLineStart;f({rowCount:g,startLineIndex:_,preSeparatorHeight:d,postSeparatorHeight:h===0?m:0,metadataOffsets:this.hunksRenderer.showsNoNewlineMarkers()?eo({diffStyle:o,hunk:n,rowCount:g}):[]}),p!=null&&h>0&&f({rowCount:h,startLineIndex:_+g,postSeparatorHeight:m})}this.cache.totalLines=d}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}=H({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),e.hunks.length>0&&(o?.collapsedLines??0)===0&&this.hunksRenderer.hasTrailingNewlineRow(e)&&(n+=1),n}getLayoutLineCount(e,t){let n=this.getExpandedLineCount(e,t),r=(t===`split`?e.splitLineCount:e.unifiedLineCount)+ +!!this.hunksRenderer.hasTrailingNewlineRow(e);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:o=1}=this.options,{hunkLineCount:s,lineHeight:c}=this.metrics,l=this.getDiffStyle(),u=this.getHunkSeparatorType(),d=ro(e,this.options.loadDiffFiles!=null),f=this.height,p=this.getLayoutLineCount(e,l),m=fe(this.metrics,i),h=e.hunks.length>0?ge(this.metrics):0,{fileAnnotationHeight:g}=this.cache,_=m+g,v=Math.max(0,f-m-g-h),y=this.hasFileAnnotations(e),b=t+m,x=g>0&&y&&b<r&&b+g>n;if(t<n-f||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:f-m-h};if(p<=s||e.hunks.length===0)return{startingLine:0,totalLines:s,bufferBefore:0,bufferAfter:0};this.approximateLayoutCheckpoints(e),p=this.getLayoutLineCount(e,l);let S=Math.ceil(Math.max(r-n,0)/c),C=Math.ceil(S/s)*s+s,w=C/s,T=w,E=[],D=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-C*c*2),s),O=t+(D?.top??_),k=D?.renderedLineIndex??0,A,j,M=new Qt({diff:e,diffStyle:l,startingLine:D?.renderedLineIndex??0,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:o,includeTrailingNewline:this.hunksRenderer.includesTrailingNewline()});for(;M.next();){let{hunkIndex:i,hunk:a,collapsedBefore:o,collapsedAfter:c,splitLineIndex:f,unifiedLineIndex:p}=M,m=this.hasNoNewlineMarker(M),h=i===e.hunks.length-1&&a!=null&&(l===`split`?f===a.splitLineStart+a.splitLineCount-1:p===a.unifiedLineStart+a.unifiedLineCount-1),g=(o>0?Ht({type:u,metrics:this.metrics,hunkIndex:i,hunkSpecs:a?.hunkSpecs}):void 0)?.totalHeight??0;O+=g;let v=k%s===0,y=Math.floor(k/s);if(v&&(E[y]=O-(t+_+g),j!=null)){if(j<=0)break;j--}let b=this.getLineHeight(l===`split`?f:p,M.hasAddition?M.additionLineIndex:void 0,m);if(O>n-b&&O<r&&(A??=y),j==null&&O>=r&&v&&(j=T),k++,O+=b,c>0||h&&d){let e=Ut({type:u,metrics:this.metrics});e!=null&&(O<r&&O+e.totalHeight>n&&(A??=y),O+=e.totalHeight)}}if(A==null){if(x)A=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:f-m-h}}let N=Math.max(0,Math.ceil(p/s)-w),P=Math.min(A,N),F=P*s,ee=E[P]??0,te=F===0?0:g+ee,I=P+w,ne=I<E.length?v-E[I]:v-(O-t-_);return{startingLine:F,totalLines:C,bufferBefore:te,bufferAfter:Math.max(0,ne)}}};function Ja(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===`-1,-1`&&(t=Math.max(t??0,n.getBoundingClientRect().height))}return t}function Ya(e,t,n){let r=e;if(t.size>0){r=new Map(e);for(let[e,i]of t)r.set(e,(r.get(e)??0)+i*n)}let i=Array.from(r).sort((e,t)=>e[0]-t[0]),a=[],o=[0],s=0;for(let[e,t]of i)a.push(e),s+=t,o.push(s);return{lineIndexes:a,prefixTotals:o}}function Xa({lineIndexes:e,prefixTotals:t},n,r){if(n>=r||e.length===0)return 0;let i=Za(e,n);return(t[Za(e,r)]??0)-(t[i]??0)}function Za(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 Qa(e){return Math.ceil(e/Wa)*Wa}function $a(e,t){let n=0;for(let r of e)r<t&&n++;return n}function eo({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 to(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 no(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 ro(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function io(e){return typeof e==`function`?`custom`:e??`line-info`}function ao(e,t){return e==null||t==null?e==null&&t==null:$t(e,t)}function oo(e,t){let[n,r]=e.split(`,`).map(Number);return t===`split`?r:n}function so({hunkIndex:e,lineIndex:t,conflictIndex:n}){return`merge-conflict-action-${e}-${t}-${n}`}function co(e,t){let n=t.hunks[e.hunkIndex];if(n!=null)return{hunkIndex:e.hunkIndex,lineIndex:lo(n,e.startContentIndex)}}function lo(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 Q=g();function uo({fileDiff:t,actions:n,renderCustomHeader:r,renderHeaderPrefix:i,renderHeaderFilenameSuffix:a,renderHeaderMetadata:o,renderAnnotation:s,renderGutterUtility:c,renderMergeConflictUtility:l,lineAnnotations:u,getHoveredLine:d,getInstance:f,getAnnotationSlotName:p=I}){let m=r?.(t),h=i?.(t),g=a?.(t),_=o?.(t);return(0,Q.jsxs)(Q.Fragment,{children:[m==null?(0,Q.jsxs)(Q.Fragment,{children:[h!=null&&(0,Q.jsx)(`div`,{slot:`header-prefix`,children:h}),g!=null&&(0,Q.jsx)(`div`,{slot:`header-filename-suffix`,children:g}),_!=null&&(0,Q.jsx)(`div`,{slot:`header-metadata`,children:_})]}):(0,Q.jsx)(`div`,{slot:e,children:m}),s!=null&&u?.map((e,n)=>(0,Q.jsx)(`div`,{slot:p(e),children:s(e,t)},n)),n!=null&&l!=null&&f!=null&&n.map(e=>{if(e==null)return;let n=fo(e,t);return(0,Q.jsx)(`div`,{slot:n,style:Ze,children:l(e,f)},n)}),c!=null&&(0,Q.jsx)(`div`,{slot:`gutter-utility-slot`,style:ze,children:c(d)})]})}function fo(e,t){let n=co(e,t);return n==null?void 0:so({hunkIndex:n.hunkIndex,lineIndex:n.lineIndex,conflictIndex:e.conflictIndex})}var $=y(S(),1),po=typeof window>`u`?$.useEffect:$.useLayoutEffect;function mo({fileDiff:e,oldFile:n,newFile:r,options:i,editorOptions:a,editStateKey:o,lineAnnotations:s,selectedLines:c,prerenderedHTML:l,metrics:u,hasGutterRenderUtility:d,hasCustomHeader:f,disableWorkerPool:p,edit:m,onEditChange:h,onEditComplete:g}){let _=Fe(),v=c!==void 0,y=(0,$.useContext)(ct),b=Ue(),x=at(e=>h?.(e)),S=h==null?void 0:x,C=(0,$.useRef)(null),w=at(t=>{let i=g?.(t)??`reject`;return i===`accept`&&(C.current={fileDiff:{installed:t.fileDiff,stale:t.originalFileDiff},filePair:e==null?{fileDiff:t.fileDiff,installed:{oldFile:t.oldFile,newFile:t.newFile},stale:{oldFile:n??null,newFile:r??null}}:null,annotations:{installed:t.lineAnnotations,stale:t.originalLineAnnotations}}),i}),T=g==null?void 0:w,E=ho({acceptedCache:C,fileDiff:e,newFile:r,oldFile:n,parseDiffOptions:i?.parseDiffOptions}),D=(0,$.useRef)(null),O=tt(),k=_o(C,E,s),A=ut(D,k)??{fileDiff:E,lineAnnotations:s??t},j=st(),M=at(()=>{if(b==null)throw Error(`FileDiff: EditContext is not attached`);return b(`file-diff`,a??{},o)}),N=at(e=>{if(e!=null){if(D.current!=null)throw Error(`useFileDiffInstance: An instance should not already exist when a node is created`);_==null?D.current=new Pa(bo({controlledSelection:v,hasCustomHeader:f,hasGutterRenderUtility:d,onEditChange:S,onEditComplete:T,options:i}),p?void 0:y,O):D.current=new qa(bo({controlledSelection:v,hasCustomHeader:f,hasGutterRenderUtility:d,onEditChange:S,onEditComplete:T,options:i}),_,u,p?void 0:y,O),D.current.hydrate({fileDiff:E,fileContainer:e,lineAnnotations:s,prerenderedHTML:l})}else{if(D.current==null)throw Error(`useFileDiffInstance: A FileDiff instance should exist when unmounting`);D.current.cleanUp(),D.current=null,j.forget()}});po(()=>{let{current:e}=D;if(e==null)return;let t=bo({controlledSelection:v,hasCustomHeader:f,hasGutterRenderUtility:d,onEditChange:S,onEditComplete:T,options:i}),n=!F(e.options,t);e.setOptions(t),m||j.detach();let r=yo(E,s,C);if(e.render({forceRender:n,fileDiff:r.fileDiff,lineAnnotations:r.lineAnnotations}),c!==void 0&&e.setSelectedLines(c),m){if(b==null)throw Error(`FileDiff: EditContext is not attached`);j.attachWhenReady(e,()=>xo(e,M),O)}});let P=(0,$.useCallback)(()=>D.current?.getHoveredLine(),[]),ee=(0,$.useCallback)(e=>D.current?.getAnnotationSlotName(e)??I(e),[]);return{...A,ref:N,getHoveredLine:P,getAnnotationSlotName:ee}}function ho({acceptedCache:e,fileDiff:t,newFile:n,oldFile:r,parseDiffOptions:i}){return(0,$.useMemo)(()=>{if(t!=null)return t;let{current:a}=e,o=a?.filePair;if(a!=null&&o!=null){if(go(r,n,o.stale)||go(r,n,o.installed))return o.fileDiff;a.filePair=null}return Yr(r??null,n??null,i)},[e,t,r,n,i])}function go(e,t,n){return Ee(e??void 0,n.oldFile??void 0)&&Ee(t??void 0,n.newFile??void 0)}function _o(e,t,n){"use no memo";return vo(t,n,e.current)}function vo(e,t,n){return{fileDiff:n?.fileDiff!=null&&G(e,n.fileDiff.stale)?n.fileDiff.installed:e,lineAnnotations:n?.annotations!=null&&t===n.annotations.stale?n.annotations.installed:t}}function yo(e,t,n){let{current:r}=n,i=vo(e,t,r);return r==null||(r.fileDiff!=null&&!G(e,r.fileDiff.stale)&&(r.fileDiff=null),t!==r.annotations?.stale&&(r.annotations=null),r.fileDiff==null&&r.annotations==null&&r.filePair==null&&(n.current=null)),i}function bo({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r,onEditChange:i,onEditComplete:a}){return{...e,controlledSelection:t,renderCustomHeader:n?dt:e?.renderCustomHeader,renderGutterUtility:r?dt:e?.renderGutterUtility,onEditChange:i,onEditComplete:a}}function xo(e,t){let n=t();try{return n.edit(e)}catch(e){throw n.cleanUp(),e}}function So({oldFile:e,newFile:t,options:n,editorOptions:r,editStateKey:i,metrics:a,lineAnnotations:o,selectedLines:s,className:c,style:l,prerenderedHTML:u,renderAnnotation:d,renderCustomHeader:f,renderHeaderPrefix:p,renderHeaderFilenameSuffix:m,renderHeaderMetadata:h,renderGutterUtility:g,disableWorkerPool:_=!1,edit:v=!1,onEditChange:y,onEditComplete:b}){let{fileDiff:x,ref:S,getHoveredLine:C,getAnnotationSlotName:w,lineAnnotations:E}=mo({oldFile:e,newFile:t,options:n,editorOptions:r,editStateKey:i,metrics:a,lineAnnotations:o,selectedLines:s,prerenderedHTML:u,hasGutterRenderUtility:g!=null,hasCustomHeader:f!=null,disableWorkerPool:_,edit:v,onEditChange:y,onEditComplete:b}),D=uo({fileDiff:x,renderCustomHeader:f,renderHeaderPrefix:p,renderHeaderFilenameSuffix:m,renderHeaderMetadata:h,renderAnnotation:d,lineAnnotations:E,renderGutterUtility:g,getHoveredLine:C,getAnnotationSlotName:w});return(0,Q.jsx)(T,{ref:S,className:c,style:l,children:rt(D,u)})}function Co({path:e,oldText:t,newText:n,split:r,header:i=!1}){let a=o(),s=x();return(0,Q.jsx)(So,{oldFile:{name:e,contents:t,cacheKey:`old:${e}:${t.length}:${+!!s.ignoreWhitespace}`},newFile:{name:e,contents:n,cacheKey:`new:${e}:${n.length}:${+!!s.ignoreWhitespace}`},disableWorkerPool:!0,options:{diffStyle:r?`split`:`unified`,themeType:a?`dark`:`light`,theme:m(a),preferredHighlighter:_,overflow:`wrap`,disableFileHeader:!i,diffIndicators:`bars`,lineDiffType:`word`,hunkSeparators:`line-info`,parseDiffOptions:{ignoreWhitespace:s.ignoreWhitespace}}})}export{Co as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=[Object.freeze(JSON.parse(`{"displayName":"Diff","name":"diff","patterns":[{"captures":{"1":{"name":"punctuation.definition.separator.diff"}},"match":"^((\\\\*{15})|(={67})|(-{3}))$\\\\n?","name":"meta.separator.diff"},{"match":"^\\\\d+(,\\\\d+)*([acd])\\\\d+(,\\\\d+)*$\\\\n?","name":"meta.diff.range.normal"},{"captures":{"1":{"name":"punctuation.definition.range.diff"},"2":{"name":"meta.toc-list.line-number.diff"},"3":{"name":"punctuation.definition.range.diff"}},"match":"^(@@)\\\\s*(.+?)\\\\s*(@@)($\\\\n?)?","name":"meta.diff.range.unified"},{"captures":{"3":{"name":"punctuation.definition.range.diff"},"4":{"name":"punctuation.definition.range.diff"},"6":{"name":"punctuation.definition.range.diff"},"7":{"name":"punctuation.definition.range.diff"}},"match":"^(((-{3}) .+ (-{4}))|((\\\\*{3}) .+ (\\\\*{4})))$\\\\n?","name":"meta.diff.range.context"},{"match":"^diff --git a/.*$\\\\n?","name":"meta.diff.header.git"},{"match":"^diff (-|\\\\S+\\\\s+\\\\S+).*$\\\\n?","name":"meta.diff.header.command"},{"captures":{"4":{"name":"punctuation.definition.from-file.diff"},"6":{"name":"punctuation.definition.from-file.diff"},"7":{"name":"punctuation.definition.from-file.diff"}},"match":"^((((-{3}) .+)|((\\\\*{3}) .+))$\\\\n?|(={4}) .+(?= - ))","name":"meta.diff.header.from-file"},{"captures":{"2":{"name":"punctuation.definition.to-file.diff"},"3":{"name":"punctuation.definition.to-file.diff"},"4":{"name":"punctuation.definition.to-file.diff"}},"match":"(^(\\\\+{3}) .+$\\\\n?| (-) .* (={4})$\\\\n?)","name":"meta.diff.header.to-file"},{"captures":{"3":{"name":"punctuation.definition.inserted.diff"},"6":{"name":"punctuation.definition.inserted.diff"}},"match":"^(((>)( .*)?)|((\\\\+).*))$\\\\n?","name":"markup.inserted.diff"},{"captures":{"1":{"name":"punctuation.definition.changed.diff"}},"match":"^(!).*$\\\\n?","name":"markup.changed.diff"},{"captures":{"3":{"name":"punctuation.definition.deleted.diff"},"6":{"name":"punctuation.definition.deleted.diff"}},"match":"^(((<)( .*)?)|((-).*))$\\\\n?","name":"markup.deleted.diff"},{"begin":"^(#)","captures":{"1":{"name":"punctuation.definition.comment.diff"}},"end":"\\\\n","name":"comment.line.number-sign.diff"},{"match":"^index [0-9a-f]{7,40}\\\\.\\\\.[0-9a-f]{7,40}.*$\\\\n?","name":"meta.diff.index.git"},{"captures":{"1":{"name":"punctuation.separator.key-value.diff"},"2":{"name":"meta.toc-list.file-name.diff"}},"match":"^Index(:) (.+)$\\\\n?","name":"meta.diff.index"},{"match":"^Only in .*: .*$\\\\n?","name":"meta.diff.only-in"}],"scopeName":"source.diff"}`))];export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={name:`Dracula Theme`,appearance:`dark`,style:{background:`#b597e033`,text:`#f8f8f2ff`,"editor.background":`#282a36ff`,"editor.foreground":`#f8f8f2ff`,"editor.active_line.background":`#C9A8F933`,"editor.document_highlight.bracket_background":`#bd93f935`,"search.match_background":`#50fa7b50`,players:[{cursor:`#bd93f9ff`,background:`#bd93f9ff`,selection:`#bd93f933`},{cursor:`#50fa7bff`,background:`#50fa7bff`,selection:`#50fa7b33`},{cursor:`#ff79c6ff`,background:`#ff79c6ff`,selection:`#ff79c633`},{cursor:`#f1fa8cff`,background:`#f1fa8cff`,selection:`#f1fa8c33`},{cursor:`#8be9fdff`,background:`#8be9fdff`,selection:`#8be9fd33`},{cursor:`#ffb86cff`,background:`#ffb86cff`,selection:`#ffb86c33`},{cursor:`#ff5555ff`,background:`#ff5555ff`,selection:`#ff555533`}],error:`#e67373ff`,warning:`#e6e373ff`,info:`#73ece5ff`,hint:`#6272a4ff`,deleted:`#FF5555`,modified:`#8BE9FD`,"terminal.ansi.black":`#21222cff`,"terminal.ansi.red":`#ff5555ff`,"terminal.ansi.green":`#50fa7bff`,"terminal.ansi.yellow":`#f1fa8cff`,"terminal.ansi.blue":`#9580ffff`,"terminal.ansi.magenta":`#ff79c6ff`,"terminal.ansi.cyan":`#8be9fdff`,"terminal.ansi.white":`#f8f8f2ff`,"terminal.ansi.bright_black":`#919cbfff`,"terminal.ansi.bright_red":`#FF6E6Eff`,"terminal.ansi.bright_green":`#69FF94ff`,"terminal.ansi.bright_yellow":`#FFFFA5ff`,"terminal.ansi.bright_blue":`#D6ACFFff`,"terminal.ansi.bright_magenta":`#FF92DFff`,"terminal.ansi.bright_cyan":`#A4FFFFff`,"terminal.ansi.bright_white":`#ffffffff`,syntax:{attribute:{color:`#8be9fdff`},boolean:{color:`#ff79c6ff`},comment:{color:`#6272a4ff`},"comment.doc":{color:`#ff79c6ff`},constant:{color:`#bd93f9ff`},constructor:{color:`#ff79c6ff`},embedded:{color:`#f8f8f2ff`},emphasis:{color:`#f1fa8cff`,font_style:`italic`},"emphasis.strong":{color:`#ffb86cff`,font_weight:700},enum:{color:`#bd93f9ff`},function:{color:`#50fa7bff`},hint:{color:`#6272a4ff`,font_style:`italic`},keyword:{color:`#ff79c6ff`},label:{color:`#f8f8f2ff`},link_text:{color:`#ff79c6ff`,font_style:`normal`},link_uri:{color:`#8be9fdff`},number:{color:`#bd93f9ff`},operator:{color:`#ff79c6ff`},predictive:{color:`#c6c6c2ff`,font_style:`italic`},preproc:{color:`#6272a4ff`},primary:{color:`#f8f8f2ff`},property:{color:`#8be9fdff`},punctuation:{color:`#ff79c6ff`},"punctuation.bracket":{color:`#f8f8f2ff`},"punctuation.delimiter":{color:`#ff79c6ff`},"punctuation.list_marker":{color:`#8be9fdff`},"punctuation.special":{color:`#ff79c6ff`},string:{color:`#f1fa8cff`},"string.escape":{color:`#ff79c6ff`},"string.regex":{color:`#ff5555ff`},"string.special":{color:`#ff79c6ff`},"string.special.symbol":{color:`#bd93f9ff`},tag:{color:`#ff79c6ff`},"text.literal":{color:`#50fa7bff`},title:{color:`#bd93f9ff`,font_weight:600},type:{color:`#8be9fdff`},"type.interface":{color:`#8be9fdff`,font_style:`italic`},"type.super":{color:`#8be9fdff`,font_style:`italic`},variable:{color:`#f8f8f2ff`},"variable.member":{color:`#f8f8f2ff`},"variable.parameter":{color:`#ffb86cff`,font_style:`italic`},"variable.special":{color:`#bd93f9ff`,font_style:`italic`},variant:{color:`#bd93f9ff`},namespace:{color:`#8be9fdff`},selector:{color:`#FF79C6`},"diff.minus":{color:`#FF5555`},"diff.plus":{color:`#50FA7B`},"selector.class":{color:`#50FA7B`,font_style:`italic`},"selector.id":{color:`#50FA7B`,font_style:`italic`},"selector.pseudo":{color:`#50FA7B`,font_style:`italic`}}},id:`dracula`};export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={name:`Dracula Theme Soft`,appearance:`dark`,style:{background:`#282A36`,"editor.background":`#282A36`,text:`#f6f6f4`,"editor.foreground":`#f6f6f4`,"search.match_background":`#FFB86C80`,error:`#ee6666`,warning:`#97e1f1`,players:[{cursor:`#f6f6f4`,selection:`#44475A`}],deleted:`#ee6666`,modified:`#97e1f1`,"terminal.ansi.black":`#262626`,"terminal.ansi.red":`#ee6666`,"terminal.ansi.green":`#62e884`,"terminal.ansi.yellow":`#e7ee98`,"terminal.ansi.blue":`#bf9eee`,"terminal.ansi.magenta":`#f286c4`,"terminal.ansi.cyan":`#97e1f1`,"terminal.ansi.white":`#f6f6f4`,"terminal.ansi.bright_black":`#7b7f8b`,"terminal.ansi.bright_red":`#f07c7c`,"terminal.ansi.bright_green":`#78f09a`,"terminal.ansi.bright_yellow":`#f6f6ae`,"terminal.ansi.bright_blue":`#d6b4f7`,"terminal.ansi.bright_magenta":`#f49dda`,"terminal.ansi.bright_cyan":`#adf6f6`,"terminal.ansi.bright_white":`#ffffff`,syntax:{attribute:{color:`#62e884`,font_style:`italic`},comment:{color:`#7b7f8b`},"comment.doc":{color:`#7b7f8b`},constant:{color:`#bf9eee`},constructor:{color:`#f286c4`},emphasis:{color:`#e7ee98`,font_style:`italic`},"emphasis.strong":{color:`#FFB86C`,font_weight:700},function:{color:`#62e884`},keyword:{color:`#f286c4`},link_text:{color:`#97e1f1`},link_uri:{color:`#97e1f1`},number:{color:`#bf9eee`},string:{color:`#e7ee98`},"string.escape":{color:`#e7ee98`},"string.regex":{color:`#e7ee98`},"string.special":{color:`#e7ee98`},"string.special.symbol":{color:`#e7ee98`},tag:{color:`#f286c4`},"text.literal":{color:`#e7ee98`},type:{color:`#97e1f1`,font_style:`italic`},variable:{color:`#f6f6f4`},"variable.special":{color:`#bf9eee`,font_style:`italic`},boolean:{color:`#BF9EEE`},embedded:{color:`#f6f6f4`},label:{color:`#f6f6f4`},namespace:{color:`#97e1f1`,font_style:`italic`},operator:{color:`#F286C4`},predictive:{color:`#7b7f8b`},preproc:{color:`#f286c4`},primary:{color:`#f6f6f4`},property:{color:`#F6F6F4`},punctuation:{color:`#f6f6f4`},selector:{color:`#F286C4`},title:{color:`#BF9EEE`,font_weight:700},enum:{color:`#97E1F1`,font_style:`italic`},hint:{color:`#7b7f8b`},variant:{color:`#F6F6F4`},"diff.minus":{color:`#EE6666`},"diff.plus":{color:`#62E884`},"property.json_key":{color:`#97E1F1`},"selector.class":{color:`#62E884`,font_style:`italic`},"selector.id":{color:`#62E884`,font_style:`italic`},"selector.pseudo":{color:`#62E884`,font_style:`italic`}}},id:`dracula-soft`};export{e as default};
|