@ensocode/server 0.3.14 → 0.3.15-beta.234
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -1
- package/out/phone/assets/{EditDiff-7At9BpWJ.js → EditDiff-DlIQ0NvB.js} +1 -1
- package/out/phone/assets/{ReadFileView-CFkjh0Xx.js → ReadFileView-hlSV-q1S.js} +1 -1
- package/out/phone/assets/{abnfDiagram-VCTEODGH-D4384sfe.js → abnfDiagram-VCTEODGH-cWLl_02_.js} +1 -1
- package/out/phone/assets/architecture-7GRP2DOG-WvHUAPXe.js +1 -0
- package/out/phone/assets/{architectureDiagram-5GKGNRK7-CjzMXFHb.js → architectureDiagram-5GKGNRK7-QEXMUvv5.js} +1 -1
- package/out/phone/assets/{blockDiagram-I7D4REHJ-COX4_2NT.js → blockDiagram-I7D4REHJ-FzQ3vEDv.js} +1 -1
- package/out/phone/assets/{c4Diagram-7LVT6UL2-C0PHCrzg.js → c4Diagram-7LVT6UL2-6iRtBvvT.js} +1 -1
- package/out/phone/assets/channel-t2MFK_dg.js +1 -0
- package/out/phone/assets/{chunk-4HAMMTFA-BSqiGn28.js → chunk-4HAMMTFA-4eZjiClJ.js} +1 -1
- package/out/phone/assets/{chunk-75Z2AOVW-7eocu_Pa.js → chunk-75Z2AOVW-BTVSMC3k.js} +1 -1
- package/out/phone/assets/{chunk-DU6HZSFF-DMttOQUE.js → chunk-DU6HZSFF-Ca9U1rWL.js} +1 -1
- package/out/phone/assets/{chunk-F27PBJKO-BFNRrOvq.js → chunk-F27PBJKO-iUczI4_Q.js} +1 -1
- package/out/phone/assets/{chunk-GMAD6QVW-DPVV1Shj.js → chunk-GMAD6QVW-DlbCwmvq.js} +1 -1
- package/out/phone/assets/{chunk-GVQU2GXP-YataTcA_.js → chunk-GVQU2GXP-DlijzCAw.js} +1 -1
- package/out/phone/assets/{chunk-IMKFNOWR-DBQKd74U.js → chunk-IMKFNOWR-B1BOj8O6.js} +1 -1
- package/out/phone/assets/{chunk-L3NEJ4N5-DXfrfXkv.js → chunk-L3NEJ4N5-Fr_w5bRg.js} +1 -1
- package/out/phone/assets/{chunk-OSK3NFVY-DWr7pP6Q.js → chunk-OSK3NFVY-CccDEhXi.js} +1 -1
- package/out/phone/assets/{chunk-P2QGCYS3-C_qNKS0g.js → chunk-P2QGCYS3-Dn46j2El.js} +1 -1
- package/out/phone/assets/{chunk-POPQ4Y6H-BhJK3UtM.js → chunk-POPQ4Y6H-BQchiHrQ.js} +1 -1
- package/out/phone/assets/{chunk-PWAF6VOD-MmcwGVgC.js → chunk-PWAF6VOD-BENw9N2v.js} +1 -1
- package/out/phone/assets/{chunk-SHT3W25Y-BQHA3p2Q.js → chunk-SHT3W25Y-C93BlEB0.js} +1 -1
- package/out/phone/assets/{chunk-SVP7TREG-DbQH56Ci.js → chunk-SVP7TREG-wfL37BUq.js} +1 -1
- package/out/phone/assets/{chunk-TICWLB2K-pixKba1z.js → chunk-TICWLB2K-C9-wZ6kk.js} +1 -1
- package/out/phone/assets/classDiagram-ZZMXUADV-CM29lfur.js +1 -0
- package/out/phone/assets/classDiagram-v2-VYDZK3BY-CM29lfur.js +1 -0
- package/out/phone/assets/{codeHighlighter-CrZcFhK_.js → codeHighlighter-DQ-g-VWX.js} +1 -1
- package/out/phone/assets/{cynefin-OW5HDTMX-67ETi-0P.js → cynefin-OW5HDTMX-DamvwfM9.js} +1 -1
- package/out/phone/assets/{cynefinDiagram-5FMLGOSQ-C3wqlm_-.js → cynefinDiagram-5FMLGOSQ-Coz1le1N.js} +1 -1
- package/out/phone/assets/{dagre-GXQ25YYZ-DTC1fZsc.js → dagre-GXQ25YYZ-ByJC9Z6k.js} +1 -1
- package/out/phone/assets/desk-XkzvZXuU.js +70 -0
- package/out/phone/assets/{diagram-S7CK7UJ4-uqcU7OpS.js → diagram-S7CK7UJ4-BabBefXt.js} +1 -1
- package/out/phone/assets/{diagram-UQ7AKVKN-BQ6K9f6g.js → diagram-UQ7AKVKN-DEX56Otl.js} +1 -1
- package/out/phone/assets/{diagram-VSXAHHWV-CDzRWkI9.js → diagram-VSXAHHWV-GeNN1ZwW.js} +1 -1
- package/out/phone/assets/{diagram-VX7I27RA-CvI10CG1.js → diagram-VX7I27RA-DkclPqXj.js} +1 -1
- package/out/phone/assets/{diagram-Z3DM3KII-DM8G_CIZ.js → diagram-Z3DM3KII-CDKrxb7_.js} +1 -1
- package/out/phone/assets/{ebnfDiagram-PWID7BFC-BBbLoaIE.js → ebnfDiagram-PWID7BFC-B-lRq0nU.js} +1 -1
- package/out/phone/assets/{erDiagram-RLTQ6QDP-Dz98FGLq.js → erDiagram-RLTQ6QDP-2PdYpZdI.js} +1 -1
- package/out/phone/assets/eventmodeling-NTZA5JFV-DBO84WXk.js +1 -0
- package/out/phone/assets/flowDiagram-HODETNUW-89Bcp6BV.js +1 -0
- package/out/phone/assets/{ganttDiagram-EL5Y4UJY-BADRjlHl.js → ganttDiagram-EL5Y4UJY-XG84VKNq.js} +1 -1
- package/out/phone/assets/{gitGraph-4MIJSDKK-DQGKRsA2.js → gitGraph-4MIJSDKK-BqrA_WVv.js} +1 -1
- package/out/phone/assets/{gitGraphDiagram-WWUBYQGX-DrLRujhH.js → gitGraphDiagram-WWUBYQGX-BAIxr-mN.js} +1 -1
- package/out/phone/assets/{info-A6RAGUB7-b7IbwKqs.js → info-A6RAGUB7-DE-jKSbG.js} +1 -1
- package/out/phone/assets/{infoDiagram-27XIBGKW-BNbXaMmR.js → infoDiagram-27XIBGKW-BSTxH5Al.js} +1 -1
- package/out/phone/assets/{ishikawaDiagram-5VMMS53U-B3SG131F.js → ishikawaDiagram-5VMMS53U-zOO97Npq.js} +1 -1
- package/out/phone/assets/{journeyDiagram-3NMN7TZE-BoRfNykb.js → journeyDiagram-3NMN7TZE-dSMVlg_5.js} +1 -1
- package/out/phone/assets/{kanban-definition-UXKFOSKX-D0tKrJ8_.js → kanban-definition-UXKFOSKX-DHok-qdM.js} +1 -1
- package/out/phone/assets/{line-W1HWn4B7.js → line-C5TJMvf6.js} +1 -1
- package/out/phone/assets/main-Bk2Gcz5l.css +2 -0
- package/out/phone/assets/main-DNK2uR8l.js +277 -0
- package/out/phone/assets/{mermaid-parser.core-CpGE7UgS.js → mermaid-parser.core-CrJ82mWd.js} +3 -3
- package/out/phone/assets/{mermaid.core-wueTI3u_.js → mermaid.core-CkfKqc8K.js} +4 -4
- package/out/phone/assets/{mindmap-definition-YA3MSWOX-BDctzErY.js → mindmap-definition-YA3MSWOX-DD-W0NPL.js} +1 -1
- package/out/phone/assets/{packet-AYTQ26CC-C0YWsXol.js → packet-AYTQ26CC-DEZk6B2e.js} +1 -1
- package/out/phone/assets/{pegDiagram-XKGWAZYB-C97XjNI7.js → pegDiagram-XKGWAZYB-KND-JwT0.js} +1 -1
- package/out/phone/assets/{pie-WAS4IAKB-BxuJ1GKP.js → pie-WAS4IAKB-DS5oCOdm.js} +1 -1
- package/out/phone/assets/{pieDiagram-E7YTZNPT-SP4DeWDw.js → pieDiagram-E7YTZNPT-CfWh8T4Z.js} +1 -1
- package/out/phone/assets/{quadrantDiagram-AXDQQJYC-DDHL4rrG.js → quadrantDiagram-AXDQQJYC-CbquaKYM.js} +1 -1
- package/out/phone/assets/{radar-RG4KPBEZ-AzVB8zoH.js → radar-RG4KPBEZ-C0kqKhsd.js} +1 -1
- package/out/phone/assets/{railroad-74A4TZTK-CA2_A72l.js → railroad-74A4TZTK-C5WV19mk.js} +1 -1
- package/out/phone/assets/railroad-abnf-HS5TGJTU-BqkB5NuR.js +1 -0
- package/out/phone/assets/railroad-ebnf-LZEXJU2U-DF9ncZF9.js +1 -0
- package/out/phone/assets/railroad-peg-WCYAUIDC-CrvTMEVw.js +1 -0
- package/out/phone/assets/{railroadDiagram-O6MQD6OU-D5zpQ5kq.js → railroadDiagram-O6MQD6OU-CmkCOdfu.js} +1 -1
- package/out/phone/assets/{requirementDiagram-BXWQKSXE-DkQKt5hJ.js → requirementDiagram-BXWQKSXE-CrQKPUwx.js} +1 -1
- package/out/phone/assets/{sankeyDiagram-P5KCCOFB-xeXrVMVr.js → sankeyDiagram-P5KCCOFB-CBCG-Eyn.js} +1 -1
- package/out/phone/assets/{sequenceDiagram-WJ2MYXX4-BOiNtyS8.js → sequenceDiagram-WJ2MYXX4-D9oVD380.js} +1 -1
- package/out/phone/assets/shellUpdate-2rxcUhg5.js +5 -0
- package/out/phone/assets/{stateDiagram-D77RDMKH-Bs8LX9-n.js → stateDiagram-D77RDMKH-VNnCDAvS.js} +1 -1
- package/out/phone/assets/stateDiagram-v2-MP3YSRHH-Qadztnwb.js +1 -0
- package/out/phone/assets/{swimlanes-42K2YHIH-DQVYfgSI.js → swimlanes-42K2YHIH-DFtKlQwi.js} +1 -1
- package/out/phone/assets/swimlanesDiagram-VR7AAH4N-BG4PsK7t.js +8 -0
- package/out/phone/assets/{timeline-definition-24CTP7MA-BlpgdxeN.js → timeline-definition-24CTP7MA-BwrAy7Qu.js} +1 -1
- package/out/phone/assets/{treeView-Q6P3EWNA-D0PiggHr.js → treeView-Q6P3EWNA-BLyQtiYC.js} +1 -1
- package/out/phone/assets/{treemap-WGGIJYW6-DA07Kvo0.js → treemap-WGGIJYW6-gub1bjDX.js} +1 -1
- package/out/phone/assets/{vennDiagram-4TSXK5OY-BtvfF1a4.js → vennDiagram-4TSXK5OY-DayfmvoI.js} +1 -1
- package/out/phone/assets/{wardley-WFR3VGLG-Db-UrSZJ.js → wardley-WFR3VGLG-B5_pluIE.js} +1 -1
- package/out/phone/assets/{wardleyDiagram-VM6X3IG4-CaBnqFYM.js → wardleyDiagram-VM6X3IG4-CHS5ryk0.js} +1 -1
- package/out/phone/assets/{xychartDiagram-S5SC5T6Z-Bbzz9YwS.js → xychartDiagram-S5SC5T6Z-C21zSdz1.js} +1 -1
- package/out/phone/desk.html +3 -3
- package/out/phone/index.html +4 -4
- package/out/phone/sw.js +2 -2
- package/out/renderer/assets/EditDiff-DJaW24DH.js +1 -0
- package/out/renderer/assets/ReadFileView-B1RfgY1_.js +4 -0
- package/out/renderer/assets/SidePanel-CXOSOIj_.js +48 -0
- package/out/renderer/assets/abnfDiagram-VCTEODGH-DteC7eOG.js +1 -0
- package/out/renderer/assets/{arc-DXzwxP4j.js → arc-BafilblL.js} +1 -1
- package/out/renderer/assets/{architectureDiagram-5GKGNRK7-Bcykp-Fb.js → architectureDiagram-5GKGNRK7-BXxAIsNI.js} +2 -2
- package/out/renderer/assets/{blockDiagram-I7D4REHJ-P7zMiiL3.js → blockDiagram-I7D4REHJ-Bt4I5z76.js} +1 -1
- package/out/renderer/assets/{c4Diagram-7LVT6UL2-BVD9zEE8.js → c4Diagram-7LVT6UL2-Dg1rhQSn.js} +1 -1
- package/out/renderer/assets/channel-CpN2DlDo.js +1 -0
- package/out/renderer/assets/{chunk-2Q5K7J3B-BXj05DaP.js → chunk-2Q5K7J3B-Bea4O-pP.js} +1 -1
- package/out/renderer/assets/{chunk-5VM5RSS4-D-SpodcG.js → chunk-5VM5RSS4-9g4O6TgX.js} +1 -1
- package/out/renderer/assets/{chunk-F27PBJKO-ORLEQ9sv.js → chunk-F27PBJKO-CQFAhmZp.js} +1 -1
- package/out/renderer/assets/{chunk-IMKFNOWR-1lhHjr20.js → chunk-IMKFNOWR-DZKvnXil.js} +1 -1
- package/out/renderer/assets/{chunk-JWPE2WC7-BgmlC9Vl.js → chunk-JWPE2WC7-UkNkhirX.js} +1 -1
- package/out/renderer/assets/{chunk-POPQ4Y6H-DPEfkZnH.js → chunk-POPQ4Y6H-D3CSUp94.js} +1 -1
- package/out/renderer/assets/{chunk-SVP7TREG-7_S5Geoi.js → chunk-SVP7TREG-F3dgPzel.js} +1 -1
- package/out/renderer/assets/{chunk-TICWLB2K-BKi8yvLf.js → chunk-TICWLB2K-URu59zvj.js} +1 -1
- package/out/renderer/assets/{chunk-XXDRQBXY-PfB25f1D.js → chunk-XXDRQBXY-DRFxCPER.js} +1 -1
- package/out/renderer/assets/classDiagram-ZZMXUADV-D-KG_eK-.js +1 -0
- package/out/renderer/assets/classDiagram-v2-VYDZK3BY-D-KG_eK-.js +1 -0
- package/out/renderer/assets/cose-bilkent-JH36ORCC-Bx5VqEhK.js +1 -0
- package/out/renderer/assets/{cynefin-OW5HDTMX-Dr9W26Pe.js → cynefin-OW5HDTMX-YKYl0dFh.js} +1 -1
- package/out/renderer/assets/cynefinDiagram-5FMLGOSQ-DaHqCls4.js +62 -0
- package/out/renderer/assets/{dagre-GXQ25YYZ-Dt2pulYx.js → dagre-GXQ25YYZ-CRqSls6Q.js} +1 -1
- package/out/renderer/assets/{diagram-S7CK7UJ4-Bx-0FuVR.js → diagram-S7CK7UJ4-_oJhPbvH.js} +1 -1
- package/out/renderer/assets/diagram-UQ7AKVKN-B7P-4UYL.js +41 -0
- package/out/renderer/assets/{diagram-VSXAHHWV-CI0jUOHM.js → diagram-VSXAHHWV--0uBugR7.js} +1 -1
- package/out/renderer/assets/diagram-VX7I27RA-IaMWXRBT.js +24 -0
- package/out/renderer/assets/diagram-Z3DM3KII-BLCY3C4h.js +24 -0
- package/out/renderer/assets/ebnfDiagram-PWID7BFC-CUYHhexz.js +1 -0
- package/out/renderer/assets/{erDiagram-RLTQ6QDP-UjxTTQ7M.js → erDiagram-RLTQ6QDP-BIOsECZV.js} +1 -1
- package/out/renderer/assets/{flowDiagram-HODETNUW-BVuwOxKp.js → flowDiagram-HODETNUW-DjggEdce.js} +1 -1
- package/out/renderer/assets/ganttDiagram-EL5Y4UJY-Dik61bQB.js +292 -0
- package/out/renderer/assets/gitGraphDiagram-WWUBYQGX-BrPFNa7W.js +106 -0
- package/out/renderer/assets/index-CtOLwaEJ.css +1 -0
- package/out/renderer/assets/index-mVE4g58q.js +3003 -0
- package/out/renderer/assets/infoDiagram-27XIBGKW-ZfCvFQE5.js +2 -0
- package/out/renderer/assets/{ishikawaDiagram-5VMMS53U-B2YfGNEH.js → ishikawaDiagram-5VMMS53U-BhteuTmM.js} +1 -1
- package/out/renderer/assets/{journeyDiagram-3NMN7TZE-fUfanA7T.js → journeyDiagram-3NMN7TZE-BJyr-G3R.js} +1 -1
- package/out/renderer/assets/{kanban-definition-UXKFOSKX-DU0d3NVH.js → kanban-definition-UXKFOSKX-CJyl9IUl.js} +1 -1
- package/out/renderer/assets/{layout-C0hE7llw.js → layout-oTkojEy1.js} +1 -1
- package/out/renderer/assets/{linear-BXPh0BlC.js → linear-qICDecPr.js} +1 -1
- package/out/renderer/assets/{mermaid.core-DlBAsGZ7.js → mermaid.core-F0flUThf.js} +5 -5
- package/out/renderer/assets/{mindmap-definition-YA3MSWOX-DUIiyta9.js → mindmap-definition-YA3MSWOX-pG7PXlKk.js} +1 -1
- package/out/renderer/assets/pegDiagram-XKGWAZYB-CwO9p66t.js +1 -0
- package/out/renderer/assets/{pieDiagram-E7YTZNPT-DsaSjWfA.js → pieDiagram-E7YTZNPT-BpqTKO7A.js} +1 -1
- package/out/renderer/assets/{quadrantDiagram-AXDQQJYC-BpWn5xT_.js → quadrantDiagram-AXDQQJYC-Ci1QOcG6.js} +1 -1
- package/out/renderer/assets/railroadDiagram-O6MQD6OU-Be-ymk25.js +1 -0
- package/out/renderer/assets/{requirementDiagram-BXWQKSXE-CMIMPMzx.js → requirementDiagram-BXWQKSXE-Dotur23i.js} +1 -1
- package/out/renderer/assets/{sankeyDiagram-P5KCCOFB-CKqneOc7.js → sankeyDiagram-P5KCCOFB-BlTTRpKU.js} +1 -1
- package/out/renderer/assets/{sequenceDiagram-WJ2MYXX4-azbHkcGk.js → sequenceDiagram-WJ2MYXX4-C_llXVvH.js} +1 -1
- package/out/renderer/assets/{sessionChanges--o0RBCJW.js → sessionChanges-BpPkx6v0.js} +5 -5
- package/out/renderer/assets/sizeCapture-INFHLROL-xhuCXQI9.js +1 -0
- package/out/renderer/assets/stateDiagram-D77RDMKH-BfESnkCR.js +1 -0
- package/out/renderer/assets/stateDiagram-v2-MP3YSRHH-C7QWw0La.js +1 -0
- package/out/renderer/assets/swimlanes-42K2YHIH-DX8_KJTt.js +1 -0
- package/out/renderer/assets/swimlanesDiagram-VR7AAH4N-B7JGQCYf.js +8 -0
- package/out/renderer/assets/{timeline-definition-24CTP7MA-DdVDUmce.js → timeline-definition-24CTP7MA-DIoNEHAB.js} +1 -1
- package/out/renderer/assets/{vennDiagram-4TSXK5OY-DP6DTjdX.js → vennDiagram-4TSXK5OY-KrS4uyWo.js} +1 -1
- package/out/renderer/assets/{wardleyDiagram-VM6X3IG4-DYJsuZCs.js → wardleyDiagram-VM6X3IG4-D4i6zXyf.js} +1 -1
- package/out/renderer/assets/{xychartDiagram-S5SC5T6Z-CloAJCw-.js → xychartDiagram-S5SC5T6Z-DpCpSTPN.js} +1 -1
- package/out/renderer/index.html +2 -3
- package/out/renderer/web-preload.js +1 -1
- package/out/server/agent.js +258 -82
- package/out/server/chunks/{builtinOccupancy-Ci-Szozb.js → builtinOccupancy-zo5-z-s5.js} +6 -6
- package/out/server/chunks/{dispatchModel-DJxnHup9.js → dispatchModel-D7papgSj.js} +4 -3
- package/out/server/chunks/{gpuBackendInstall-snisWLXN.js → gpuBackendInstall-xFEdr70P.js} +2 -2
- package/out/server/chunks/{loadProvider-Uq3i7kKZ.js → loadProvider-ChfeR5km.js} +2 -2
- package/out/server/chunks/{menuSkills-BEtW-Is6.js → menuSkills-DC4qs2MC.js} +5 -4
- package/out/server/chunks/{projectCode-D9lgShsp.js → projectCode-BAgpkYYS.js} +2 -2
- package/out/server/chunks/{registry-R2KRdU8n.js → registry-G4AKEQtl.js} +3 -3
- package/out/server/chunks/{sendImage-CCjNsa-D.js → sendImage-BmenO8Vx.js} +208 -61
- package/out/server/chunks/{toolParams-DVs5d3F9.js → toolParams-0GakTs9V.js} +2 -2
- package/out/server/chunks/{web-BIJOMDlz.js → web-9MujZLkq.js} +30 -16
- package/out/server/chunks/{workflowPresets-DVbQh2el.js → workflowPresets-CTv2r-Sh.js} +242 -158
- package/out/server/index.js +1664 -732
- package/out/server/memory-service.js +12 -5
- package/package.json +1 -1
- package/out/phone/assets/architecture-7GRP2DOG-vDamN_Vr.js +0 -1
- package/out/phone/assets/channel-TsMJYH0f.js +0 -1
- package/out/phone/assets/classDiagram-ZZMXUADV-Bhtnzu97.js +0 -1
- package/out/phone/assets/classDiagram-v2-VYDZK3BY-Bhtnzu97.js +0 -1
- package/out/phone/assets/desk-B382G0e_.js +0 -52
- package/out/phone/assets/eventmodeling-NTZA5JFV-BGT2L4_J.js +0 -1
- package/out/phone/assets/flowDiagram-HODETNUW-CpTX9nm5.js +0 -1
- package/out/phone/assets/main-Bc8DQVa6.css +0 -2
- package/out/phone/assets/main-Bez4gfKe.js +0 -281
- package/out/phone/assets/railroad-abnf-HS5TGJTU-CTHhRGvc.js +0 -1
- package/out/phone/assets/railroad-ebnf-LZEXJU2U-CS68P4fL.js +0 -1
- package/out/phone/assets/railroad-peg-WCYAUIDC-BqCcrVdf.js +0 -1
- package/out/phone/assets/shellUpdate-C4yk9AaU.js +0 -1
- package/out/phone/assets/stateDiagram-v2-MP3YSRHH-nBP_YibA.js +0 -1
- package/out/phone/assets/swimlanesDiagram-VR7AAH4N-BkfzXxS-.js +0 -8
- package/out/renderer/assets/EditDiff-C9JBUR0o.js +0 -1
- package/out/renderer/assets/File-BIf-onMm.js +0 -1
- package/out/renderer/assets/ReadFileView-C5AKNlFU.js +0 -4
- package/out/renderer/assets/SidePanel-DkSc3og9.js +0 -48
- package/out/renderer/assets/Virtualizer-tZu4hGtC.js +0 -1345
- package/out/renderer/assets/abnfDiagram-VCTEODGH-DxBBUZxF.js +0 -1
- package/out/renderer/assets/channel-7bWV5QTy.js +0 -1
- package/out/renderer/assets/classDiagram-ZZMXUADV-mgQwYiWM.js +0 -1
- package/out/renderer/assets/classDiagram-v2-VYDZK3BY-mgQwYiWM.js +0 -1
- package/out/renderer/assets/cose-bilkent-JH36ORCC-C246yayw.js +0 -1
- package/out/renderer/assets/cynefinDiagram-5FMLGOSQ-B3Jtuns2.js +0 -62
- package/out/renderer/assets/cytoscape-fcose-CJat50hU.js +0 -1
- package/out/renderer/assets/cytoscape.esm-DzSz-X2X.js +0 -321
- package/out/renderer/assets/diagram-UQ7AKVKN-D-8o1p4p.js +0 -41
- package/out/renderer/assets/diagram-VX7I27RA-Byl54mOd.js +0 -24
- package/out/renderer/assets/diagram-Z3DM3KII-Kf_GIJ7p.js +0 -24
- package/out/renderer/assets/ebnfDiagram-PWID7BFC-BbOdw7R1.js +0 -1
- package/out/renderer/assets/ganttDiagram-EL5Y4UJY-BpBSO-4X.js +0 -292
- package/out/renderer/assets/gitGraphDiagram-WWUBYQGX-b72vZ1j2.js +0 -106
- package/out/renderer/assets/globals-2G408HiJ.css +0 -1
- package/out/renderer/assets/globals-BqVjlAT_.js +0 -673
- package/out/renderer/assets/index-AHhNcASr.js +0 -113
- package/out/renderer/assets/infoDiagram-27XIBGKW-CtnN4sif.js +0 -2
- package/out/renderer/assets/manifest-DoBt8euy.js +0 -525
- package/out/renderer/assets/pegDiagram-XKGWAZYB-yP15oXPx.js +0 -1
- package/out/renderer/assets/railroadDiagram-O6MQD6OU-BnXhwCom.js +0 -1
- package/out/renderer/assets/settings-D5R80op8.js +0 -28
- package/out/renderer/assets/sizeCapture-INFHLROL-C3uhIZ1e.js +0 -1
- package/out/renderer/assets/stateDiagram-D77RDMKH-CrGab2Ck.js +0 -1
- package/out/renderer/assets/stateDiagram-v2-MP3YSRHH-k_H7O8MU.js +0 -1
- package/out/renderer/assets/swimlanes-42K2YHIH-6aX1l7C2.js +0 -1
- package/out/renderer/assets/swimlanesDiagram-VR7AAH4N-D2XerlPy.js +0 -8
- package/out/renderer/settings.html +0 -23
|
@@ -1,525 +0,0 @@
|
|
|
1
|
-
import{aj as jn,ak as Si,al as Ei,am as Ti,an as ki,ao as Ai,ap as Mi,aq as Ri,ar as Bi,as as Ii,g as Pi,at as qn,au as Ni,av as et,c as Fe,aw as He,k as zt,j as I,ax as Oi,u as Re,r as Q,ay as Kn,az as $n,aA as Gn,aB as Yn,aC as Zn,aD as Jn,aE as Ue,aF as Di,aG as _i,aH as zi,aI as Fi,aJ as Hi,aK as Ft,aL as Ui,aM as Qn,aN as Xn,aO as dt,aP as Wi,aQ as Vi}from"./globals-BqVjlAT_.js";import{T as Nt,g as ji,P as We,Q as St,C as Ve,U as je}from"./Virtualizer-tZu4hGtC.js";const qi=[["path",{d:"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8",key:"14sh0y"}],["path",{d:"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z",key:"1970lx"}],["path",{d:"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1",key:"l4dndm"}]],Eo=jn("files",qi);const Ki=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],To=jn("link-2",Ki),$i={compositeOverBg:Ii,contrastRatio:Bi,deriveMutedFg:Ri,hoverWouldEraseText:Mi,isDarkSurface:Ai,isFullyTransparent:Si,pickReadableForeground:ki,relativeLuminance:Ti,surfacesMatch:Ei};var at={},Ht,qe;function Gi(){return qe||(qe=1,Ht=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),Ht}var Ut={},J={},Ke;function it(){if(Ke)return J;Ke=1;let t;const e=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return J.getSymbolSize=function(i){if(!i)throw new Error('"version" cannot be null or undefined');if(i<1||i>40)throw new Error('"version" should be in range from 1 to 40');return i*4+17},J.getSymbolTotalCodewords=function(i){return e[i]},J.getBCHDigit=function(n){let i=0;for(;n!==0;)i++,n>>>=1;return i},J.setToSJISFunction=function(i){if(typeof i!="function")throw new Error('"toSJISFunc" is not a valid function.');t=i},J.isKanjiModeEnabled=function(){return typeof t<"u"},J.toSJIS=function(i){return t(i)},J}var Wt={},$e;function Be(){return $e||($e=1,(function(t){t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2};function e(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+n)}}t.isValid=function(i){return i&&typeof i.bit<"u"&&i.bit>=0&&i.bit<4},t.from=function(i,s){if(t.isValid(i))return i;try{return e(i)}catch{return s}}})(Wt)),Wt}var Vt,Ge;function Yi(){if(Ge)return Vt;Ge=1;function t(){this.buffer=[],this.length=0}return t.prototype={get:function(e){const n=Math.floor(e/8);return(this.buffer[n]>>>7-e%8&1)===1},put:function(e,n){for(let i=0;i<n;i++)this.putBit((e>>>n-i-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(e){const n=Math.floor(this.length/8);this.buffer.length<=n&&this.buffer.push(0),e&&(this.buffer[n]|=128>>>this.length%8),this.length++}},Vt=t,Vt}var jt,Ye;function Zi(){if(Ye)return jt;Ye=1;function t(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}return t.prototype.set=function(e,n,i,s){const r=e*this.size+n;this.data[r]=i,s&&(this.reservedBit[r]=!0)},t.prototype.get=function(e,n){return this.data[e*this.size+n]},t.prototype.xor=function(e,n,i){this.data[e*this.size+n]^=i},t.prototype.isReserved=function(e,n){return this.reservedBit[e*this.size+n]},jt=t,jt}var qt={},Ze;function Ji(){return Ze||(Ze=1,(function(t){const e=it().getSymbolSize;t.getRowColCoords=function(i){if(i===1)return[];const s=Math.floor(i/7)+2,r=e(i),o=r===145?26:Math.ceil((r-13)/(2*s-2))*2,a=[r-7];for(let c=1;c<s-1;c++)a[c]=a[c-1]-o;return a.push(6),a.reverse()},t.getPositions=function(i){const s=[],r=t.getRowColCoords(i),o=r.length;for(let a=0;a<o;a++)for(let c=0;c<o;c++)a===0&&c===0||a===0&&c===o-1||a===o-1&&c===0||s.push([r[a],r[c]]);return s}})(qt)),qt}var Kt={},Je;function Qi(){if(Je)return Kt;Je=1;const t=it().getSymbolSize,e=7;return Kt.getPositions=function(i){const s=t(i);return[[0,0],[s-e,0],[0,s-e]]},Kt}var $t={},Qe;function Xi(){return Qe||(Qe=1,(function(t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const e={N1:3,N2:3,N3:40,N4:10};t.isValid=function(s){return s!=null&&s!==""&&!isNaN(s)&&s>=0&&s<=7},t.from=function(s){return t.isValid(s)?parseInt(s,10):void 0},t.getPenaltyN1=function(s){const r=s.size;let o=0,a=0,c=0,h=null,d=null;for(let l=0;l<r;l++){a=c=0,h=d=null;for(let f=0;f<r;f++){let u=s.get(l,f);u===h?a++:(a>=5&&(o+=e.N1+(a-5)),h=u,a=1),u=s.get(f,l),u===d?c++:(c>=5&&(o+=e.N1+(c-5)),d=u,c=1)}a>=5&&(o+=e.N1+(a-5)),c>=5&&(o+=e.N1+(c-5))}return o},t.getPenaltyN2=function(s){const r=s.size;let o=0;for(let a=0;a<r-1;a++)for(let c=0;c<r-1;c++){const h=s.get(a,c)+s.get(a,c+1)+s.get(a+1,c)+s.get(a+1,c+1);(h===4||h===0)&&o++}return o*e.N2},t.getPenaltyN3=function(s){const r=s.size;let o=0,a=0,c=0;for(let h=0;h<r;h++){a=c=0;for(let d=0;d<r;d++)a=a<<1&2047|s.get(h,d),d>=10&&(a===1488||a===93)&&o++,c=c<<1&2047|s.get(d,h),d>=10&&(c===1488||c===93)&&o++}return o*e.N3},t.getPenaltyN4=function(s){let r=0;const o=s.data.length;for(let c=0;c<o;c++)r+=s.data[c];return Math.abs(Math.ceil(r*100/o/5)-10)*e.N4};function n(i,s,r){switch(i){case t.Patterns.PATTERN000:return(s+r)%2===0;case t.Patterns.PATTERN001:return s%2===0;case t.Patterns.PATTERN010:return r%3===0;case t.Patterns.PATTERN011:return(s+r)%3===0;case t.Patterns.PATTERN100:return(Math.floor(s/2)+Math.floor(r/3))%2===0;case t.Patterns.PATTERN101:return s*r%2+s*r%3===0;case t.Patterns.PATTERN110:return(s*r%2+s*r%3)%2===0;case t.Patterns.PATTERN111:return(s*r%3+(s+r)%2)%2===0;default:throw new Error("bad maskPattern:"+i)}}t.applyMask=function(s,r){const o=r.size;for(let a=0;a<o;a++)for(let c=0;c<o;c++)r.isReserved(c,a)||r.xor(c,a,n(s,c,a))},t.getBestMask=function(s,r){const o=Object.keys(t.Patterns).length;let a=0,c=1/0;for(let h=0;h<o;h++){r(h),t.applyMask(h,s);const d=t.getPenaltyN1(s)+t.getPenaltyN2(s)+t.getPenaltyN3(s)+t.getPenaltyN4(s);t.applyMask(h,s),d<c&&(c=d,a=h)}return a}})($t)),$t}var Et={},Xe;function ti(){if(Xe)return Et;Xe=1;const t=Be(),e=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],n=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return Et.getBlocksCount=function(s,r){switch(r){case t.L:return e[(s-1)*4+0];case t.M:return e[(s-1)*4+1];case t.Q:return e[(s-1)*4+2];case t.H:return e[(s-1)*4+3];default:return}},Et.getTotalCodewordsCount=function(s,r){switch(r){case t.L:return n[(s-1)*4+0];case t.M:return n[(s-1)*4+1];case t.Q:return n[(s-1)*4+2];case t.H:return n[(s-1)*4+3];default:return}},Et}var Gt={},gt={},tn;function ts(){if(tn)return gt;tn=1;const t=new Uint8Array(512),e=new Uint8Array(256);return(function(){let i=1;for(let s=0;s<255;s++)t[s]=i,e[i]=s,i<<=1,i&256&&(i^=285);for(let s=255;s<512;s++)t[s]=t[s-255]})(),gt.log=function(i){if(i<1)throw new Error("log("+i+")");return e[i]},gt.exp=function(i){return t[i]},gt.mul=function(i,s){return i===0||s===0?0:t[e[i]+e[s]]},gt}var en;function es(){return en||(en=1,(function(t){const e=ts();t.mul=function(i,s){const r=new Uint8Array(i.length+s.length-1);for(let o=0;o<i.length;o++)for(let a=0;a<s.length;a++)r[o+a]^=e.mul(i[o],s[a]);return r},t.mod=function(i,s){let r=new Uint8Array(i);for(;r.length-s.length>=0;){const o=r[0];for(let c=0;c<s.length;c++)r[c]^=e.mul(s[c],o);let a=0;for(;a<r.length&&r[a]===0;)a++;r=r.slice(a)}return r},t.generateECPolynomial=function(i){let s=new Uint8Array([1]);for(let r=0;r<i;r++)s=t.mul(s,new Uint8Array([1,e.exp(r)]));return s}})(Gt)),Gt}var Yt,nn;function ns(){if(nn)return Yt;nn=1;const t=es();function e(n){this.genPoly=void 0,this.degree=n,this.degree&&this.initialize(this.degree)}return e.prototype.initialize=function(i){this.degree=i,this.genPoly=t.generateECPolynomial(this.degree)},e.prototype.encode=function(i){if(!this.genPoly)throw new Error("Encoder not initialized");const s=new Uint8Array(i.length+this.degree);s.set(i);const r=t.mod(s,this.genPoly),o=this.degree-r.length;if(o>0){const a=new Uint8Array(this.degree);return a.set(r,o),a}return r},Yt=e,Yt}var Zt={},Jt={},Qt={},sn;function ei(){return sn||(sn=1,Qt.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}),Qt}var q={},rn;function ni(){if(rn)return q;rn=1;const t="[0-9]+",e="[A-Z $%*+\\-./:]+";let n="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";n=n.replace(/u/g,"\\u");const i="(?:(?![A-Z0-9 $%*+\\-./:]|"+n+`)(?:.|[\r
|
|
2
|
-
]))+`;q.KANJI=new RegExp(n,"g"),q.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),q.BYTE=new RegExp(i,"g"),q.NUMERIC=new RegExp(t,"g"),q.ALPHANUMERIC=new RegExp(e,"g");const s=new RegExp("^"+n+"$"),r=new RegExp("^"+t+"$"),o=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return q.testKanji=function(c){return s.test(c)},q.testNumeric=function(c){return r.test(c)},q.testAlphanumeric=function(c){return o.test(c)},q}var on;function st(){return on||(on=1,(function(t){const e=ei(),n=ni();t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(r,o){if(!r.ccBits)throw new Error("Invalid mode: "+r);if(!e.isValid(o))throw new Error("Invalid version: "+o);return o>=1&&o<10?r.ccBits[0]:o<27?r.ccBits[1]:r.ccBits[2]},t.getBestModeForData=function(r){return n.testNumeric(r)?t.NUMERIC:n.testAlphanumeric(r)?t.ALPHANUMERIC:n.testKanji(r)?t.KANJI:t.BYTE},t.toString=function(r){if(r&&r.id)return r.id;throw new Error("Invalid mode")},t.isValid=function(r){return r&&r.bit&&r.ccBits};function i(s){if(typeof s!="string")throw new Error("Param is not a string");switch(s.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+s)}}t.from=function(r,o){if(t.isValid(r))return r;try{return i(r)}catch{return o}}})(Jt)),Jt}var an;function is(){return an||(an=1,(function(t){const e=it(),n=ti(),i=Be(),s=st(),r=ei(),o=7973,a=e.getBCHDigit(o);function c(f,u,p){for(let g=1;g<=40;g++)if(u<=t.getCapacity(g,p,f))return g}function h(f,u){return s.getCharCountIndicator(f,u)+4}function d(f,u){let p=0;return f.forEach(function(g){const m=h(g.mode,u);p+=m+g.getBitsLength()}),p}function l(f,u){for(let p=1;p<=40;p++)if(d(f,p)<=t.getCapacity(p,u,s.MIXED))return p}t.from=function(u,p){return r.isValid(u)?parseInt(u,10):p},t.getCapacity=function(u,p,g){if(!r.isValid(u))throw new Error("Invalid QR Code version");typeof g>"u"&&(g=s.BYTE);const m=e.getSymbolTotalCodewords(u),v=n.getTotalCodewordsCount(u,p),L=(m-v)*8;if(g===s.MIXED)return L;const b=L-h(g,u);switch(g){case s.NUMERIC:return Math.floor(b/10*3);case s.ALPHANUMERIC:return Math.floor(b/11*2);case s.KANJI:return Math.floor(b/13);case s.BYTE:default:return Math.floor(b/8)}},t.getBestVersionForData=function(u,p){let g;const m=i.from(p,i.M);if(Array.isArray(u)){if(u.length>1)return l(u,m);if(u.length===0)return 1;g=u[0]}else g=u;return c(g.mode,g.getLength(),m)},t.getEncodedBits=function(u){if(!r.isValid(u)||u<7)throw new Error("Invalid QR Code version");let p=u<<12;for(;e.getBCHDigit(p)-a>=0;)p^=o<<e.getBCHDigit(p)-a;return u<<12|p}})(Zt)),Zt}var Xt={},cn;function ss(){if(cn)return Xt;cn=1;const t=it(),e=1335,n=21522,i=t.getBCHDigit(e);return Xt.getEncodedBits=function(r,o){const a=r.bit<<3|o;let c=a<<10;for(;t.getBCHDigit(c)-i>=0;)c^=e<<t.getBCHDigit(c)-i;return(a<<10|c)^n},Xt}var te={},ee,ln;function rs(){if(ln)return ee;ln=1;const t=st();function e(n){this.mode=t.NUMERIC,this.data=n.toString()}return e.getBitsLength=function(i){return 10*Math.floor(i/3)+(i%3?i%3*3+1:0)},e.prototype.getLength=function(){return this.data.length},e.prototype.getBitsLength=function(){return e.getBitsLength(this.data.length)},e.prototype.write=function(i){let s,r,o;for(s=0;s+3<=this.data.length;s+=3)r=this.data.substr(s,3),o=parseInt(r,10),i.put(o,10);const a=this.data.length-s;a>0&&(r=this.data.substr(s),o=parseInt(r,10),i.put(o,a*3+1))},ee=e,ee}var ne,hn;function os(){if(hn)return ne;hn=1;const t=st(),e=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function n(i){this.mode=t.ALPHANUMERIC,this.data=i}return n.getBitsLength=function(s){return 11*Math.floor(s/2)+6*(s%2)},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(s){let r;for(r=0;r+2<=this.data.length;r+=2){let o=e.indexOf(this.data[r])*45;o+=e.indexOf(this.data[r+1]),s.put(o,11)}this.data.length%2&&s.put(e.indexOf(this.data[r]),6)},ne=n,ne}var ie,dn;function as(){if(dn)return ie;dn=1;const t=st();function e(n){this.mode=t.BYTE,typeof n=="string"?this.data=new TextEncoder().encode(n):this.data=new Uint8Array(n)}return e.getBitsLength=function(i){return i*8},e.prototype.getLength=function(){return this.data.length},e.prototype.getBitsLength=function(){return e.getBitsLength(this.data.length)},e.prototype.write=function(n){for(let i=0,s=this.data.length;i<s;i++)n.put(this.data[i],8)},ie=e,ie}var se,fn;function cs(){if(fn)return se;fn=1;const t=st(),e=it();function n(i){this.mode=t.KANJI,this.data=i}return n.getBitsLength=function(s){return s*13},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(i){let s;for(s=0;s<this.data.length;s++){let r=e.toSJIS(this.data[s]);if(r>=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw new Error("Invalid SJIS character: "+this.data[s]+`
|
|
3
|
-
Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),i.put(r,13)}},se=n,se}var re={exports:{}},un;function ls(){return un||(un=1,(function(t){var e={single_source_shortest_paths:function(n,i,s){var r={},o={};o[i]=0;var a=e.PriorityQueue.make();a.push(i,0);for(var c,h,d,l,f,u,p,g,m;!a.empty();){c=a.pop(),h=c.value,l=c.cost,f=n[h]||{};for(d in f)f.hasOwnProperty(d)&&(u=f[d],p=l+u,g=o[d],m=typeof o[d]>"u",(m||g>p)&&(o[d]=p,a.push(d,p),r[d]=h))}if(typeof s<"u"&&typeof o[s]>"u"){var v=["Could not find a path from ",i," to ",s,"."].join("");throw new Error(v)}return r},extract_shortest_path_from_predecessor_list:function(n,i){for(var s=[],r=i;r;)s.push(r),n[r],r=n[r];return s.reverse(),s},find_path:function(n,i,s){var r=e.single_source_shortest_paths(n,i,s);return e.extract_shortest_path_from_predecessor_list(r,s)},PriorityQueue:{make:function(n){var i=e.PriorityQueue,s={},r;n=n||{};for(r in i)i.hasOwnProperty(r)&&(s[r]=i[r]);return s.queue=[],s.sorter=n.sorter||i.default_sorter,s},default_sorter:function(n,i){return n.cost-i.cost},push:function(n,i){var s={value:n,cost:i};this.queue.push(s),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t.exports=e})(re)),re.exports}var gn;function hs(){return gn||(gn=1,(function(t){const e=st(),n=rs(),i=os(),s=as(),r=cs(),o=ni(),a=it(),c=ls();function h(v){return unescape(encodeURIComponent(v)).length}function d(v,L,b){const C=[];let T;for(;(T=v.exec(b))!==null;)C.push({data:T[0],index:T.index,mode:L,length:T[0].length});return C}function l(v){const L=d(o.NUMERIC,e.NUMERIC,v),b=d(o.ALPHANUMERIC,e.ALPHANUMERIC,v);let C,T;return a.isKanjiModeEnabled()?(C=d(o.BYTE,e.BYTE,v),T=d(o.KANJI,e.KANJI,v)):(C=d(o.BYTE_KANJI,e.BYTE,v),T=[]),L.concat(b,C,T).sort(function(S,E){return S.index-E.index}).map(function(S){return{data:S.data,mode:S.mode,length:S.length}})}function f(v,L){switch(L){case e.NUMERIC:return n.getBitsLength(v);case e.ALPHANUMERIC:return i.getBitsLength(v);case e.KANJI:return r.getBitsLength(v);case e.BYTE:return s.getBitsLength(v)}}function u(v){return v.reduce(function(L,b){const C=L.length-1>=0?L[L.length-1]:null;return C&&C.mode===b.mode?(L[L.length-1].data+=b.data,L):(L.push(b),L)},[])}function p(v){const L=[];for(let b=0;b<v.length;b++){const C=v[b];switch(C.mode){case e.NUMERIC:L.push([C,{data:C.data,mode:e.ALPHANUMERIC,length:C.length},{data:C.data,mode:e.BYTE,length:C.length}]);break;case e.ALPHANUMERIC:L.push([C,{data:C.data,mode:e.BYTE,length:C.length}]);break;case e.KANJI:L.push([C,{data:C.data,mode:e.BYTE,length:h(C.data)}]);break;case e.BYTE:L.push([{data:C.data,mode:e.BYTE,length:h(C.data)}])}}return L}function g(v,L){const b={},C={start:{}};let T=["start"];for(let w=0;w<v.length;w++){const S=v[w],E=[];for(let x=0;x<S.length;x++){const y=S[x],k=""+w+x;E.push(k),b[k]={node:y,lastCount:0},C[k]={};for(let A=0;A<T.length;A++){const M=T[A];b[M]&&b[M].node.mode===y.mode?(C[M][k]=f(b[M].lastCount+y.length,y.mode)-f(b[M].lastCount,y.mode),b[M].lastCount+=y.length):(b[M]&&(b[M].lastCount=y.length),C[M][k]=f(y.length,y.mode)+4+e.getCharCountIndicator(y.mode,L))}}T=E}for(let w=0;w<T.length;w++)C[T[w]].end=0;return{map:C,table:b}}function m(v,L){let b;const C=e.getBestModeForData(v);if(b=e.from(L,C),b!==e.BYTE&&b.bit<C.bit)throw new Error('"'+v+'" cannot be encoded with mode '+e.toString(b)+`.
|
|
4
|
-
Suggested mode is: `+e.toString(C));switch(b===e.KANJI&&!a.isKanjiModeEnabled()&&(b=e.BYTE),b){case e.NUMERIC:return new n(v);case e.ALPHANUMERIC:return new i(v);case e.KANJI:return new r(v);case e.BYTE:return new s(v)}}t.fromArray=function(L){return L.reduce(function(b,C){return typeof C=="string"?b.push(m(C,null)):C.data&&b.push(m(C.data,C.mode)),b},[])},t.fromString=function(L,b){const C=l(L,a.isKanjiModeEnabled()),T=p(C),w=g(T,b),S=c.find_path(w.map,"start","end"),E=[];for(let x=1;x<S.length-1;x++)E.push(w.table[S[x]].node);return t.fromArray(u(E))},t.rawSplit=function(L){return t.fromArray(l(L,a.isKanjiModeEnabled()))}})(te)),te}var pn;function ds(){if(pn)return Ut;pn=1;const t=it(),e=Be(),n=Yi(),i=Zi(),s=Ji(),r=Qi(),o=Xi(),a=ti(),c=ns(),h=is(),d=ss(),l=st(),f=hs();function u(w,S){const E=w.size,x=r.getPositions(S);for(let y=0;y<x.length;y++){const k=x[y][0],A=x[y][1];for(let M=-1;M<=7;M++)if(!(k+M<=-1||E<=k+M))for(let B=-1;B<=7;B++)A+B<=-1||E<=A+B||(M>=0&&M<=6&&(B===0||B===6)||B>=0&&B<=6&&(M===0||M===6)||M>=2&&M<=4&&B>=2&&B<=4?w.set(k+M,A+B,!0,!0):w.set(k+M,A+B,!1,!0))}}function p(w){const S=w.size;for(let E=8;E<S-8;E++){const x=E%2===0;w.set(E,6,x,!0),w.set(6,E,x,!0)}}function g(w,S){const E=s.getPositions(S);for(let x=0;x<E.length;x++){const y=E[x][0],k=E[x][1];for(let A=-2;A<=2;A++)for(let M=-2;M<=2;M++)A===-2||A===2||M===-2||M===2||A===0&&M===0?w.set(y+A,k+M,!0,!0):w.set(y+A,k+M,!1,!0)}}function m(w,S){const E=w.size,x=h.getEncodedBits(S);let y,k,A;for(let M=0;M<18;M++)y=Math.floor(M/3),k=M%3+E-8-3,A=(x>>M&1)===1,w.set(y,k,A,!0),w.set(k,y,A,!0)}function v(w,S,E){const x=w.size,y=d.getEncodedBits(S,E);let k,A;for(k=0;k<15;k++)A=(y>>k&1)===1,k<6?w.set(k,8,A,!0):k<8?w.set(k+1,8,A,!0):w.set(x-15+k,8,A,!0),k<8?w.set(8,x-k-1,A,!0):k<9?w.set(8,15-k-1+1,A,!0):w.set(8,15-k-1,A,!0);w.set(x-8,8,1,!0)}function L(w,S){const E=w.size;let x=-1,y=E-1,k=7,A=0;for(let M=E-1;M>0;M-=2)for(M===6&&M--;;){for(let B=0;B<2;B++)if(!w.isReserved(y,M-B)){let W=!1;A<S.length&&(W=(S[A]>>>k&1)===1),w.set(y,M-B,W),k--,k===-1&&(A++,k=7)}if(y+=x,y<0||E<=y){y-=x,x=-x;break}}}function b(w,S,E){const x=new n;E.forEach(function(B){x.put(B.mode.bit,4),x.put(B.getLength(),l.getCharCountIndicator(B.mode,w)),B.write(x)});const y=t.getSymbolTotalCodewords(w),k=a.getTotalCodewordsCount(w,S),A=(y-k)*8;for(x.getLengthInBits()+4<=A&&x.put(0,4);x.getLengthInBits()%8!==0;)x.putBit(0);const M=(A-x.getLengthInBits())/8;for(let B=0;B<M;B++)x.put(B%2?17:236,8);return C(x,w,S)}function C(w,S,E){const x=t.getSymbolTotalCodewords(S),y=a.getTotalCodewordsCount(S,E),k=x-y,A=a.getBlocksCount(S,E),M=x%A,B=A-M,W=Math.floor(x/A),K=Math.floor(k/A),Dt=K+1,xt=W-K,yt=new c(xt);let rt=0;const R=new Array(A),O=new Array(A);let _=0;const F=new Uint8Array(w.buffer);for(let ot=0;ot<A;ot++){const _t=ot<B?K:Dt;R[ot]=F.slice(rt,rt+_t),O[ot]=yt.encode(R[ot]),rt+=_t,_=Math.max(_,_t)}const j=new Uint8Array(x);let Z=0,$,G;for($=0;$<_;$++)for(G=0;G<A;G++)$<R[G].length&&(j[Z++]=R[G][$]);for($=0;$<xt;$++)for(G=0;G<A;G++)j[Z++]=O[G][$];return j}function T(w,S,E,x){let y;if(Array.isArray(w))y=f.fromArray(w);else if(typeof w=="string"){let W=S;if(!W){const K=f.rawSplit(w);W=h.getBestVersionForData(K,E)}y=f.fromString(w,W||40)}else throw new Error("Invalid data");const k=h.getBestVersionForData(y,E);if(!k)throw new Error("The amount of data is too big to be stored in a QR Code");if(!S)S=k;else if(S<k)throw new Error(`
|
|
5
|
-
The chosen QR Code version cannot contain this amount of data.
|
|
6
|
-
Minimum version required to store current data is: `+k+`.
|
|
7
|
-
`);const A=b(S,E,y),M=t.getSymbolSize(S),B=new i(M);return u(B,S),p(B),g(B,S),v(B,E,0),S>=7&&m(B,S),L(B,A),isNaN(x)&&(x=o.getBestMask(B,v.bind(null,B,E))),o.applyMask(x,B),v(B,E,x),{modules:B,version:S,errorCorrectionLevel:E,maskPattern:x,segments:y}}return Ut.create=function(S,E){if(typeof S>"u"||S==="")throw new Error("No input text");let x=e.M,y,k;return typeof E<"u"&&(x=e.from(E.errorCorrectionLevel,e.M),y=h.from(E.version),k=o.from(E.maskPattern),E.toSJISFunc&&t.setToSJISFunction(E.toSJISFunc)),T(S,y,x,k)},Ut}var oe={},ae={},mn;function ii(){return mn||(mn=1,(function(t){function e(n){if(typeof n=="number"&&(n=n.toString()),typeof n!="string")throw new Error("Color should be defined as hex string");let i=n.slice().replace("#","").split("");if(i.length<3||i.length===5||i.length>8)throw new Error("Invalid hex color: "+n);(i.length===3||i.length===4)&&(i=Array.prototype.concat.apply([],i.map(function(r){return[r,r]}))),i.length===6&&i.push("F","F");const s=parseInt(i.join(""),16);return{r:s>>24&255,g:s>>16&255,b:s>>8&255,a:s&255,hex:"#"+i.slice(0,6).join("")}}t.getOptions=function(i){i||(i={}),i.color||(i.color={});const s=typeof i.margin>"u"||i.margin===null||i.margin<0?4:i.margin,r=i.width&&i.width>=21?i.width:void 0,o=i.scale||4;return{width:r,scale:r?4:o,margin:s,color:{dark:e(i.color.dark||"#000000ff"),light:e(i.color.light||"#ffffffff")},type:i.type,rendererOpts:i.rendererOpts||{}}},t.getScale=function(i,s){return s.width&&s.width>=i+s.margin*2?s.width/(i+s.margin*2):s.scale},t.getImageWidth=function(i,s){const r=t.getScale(i,s);return Math.floor((i+s.margin*2)*r)},t.qrToImageData=function(i,s,r){const o=s.modules.size,a=s.modules.data,c=t.getScale(o,r),h=Math.floor((o+r.margin*2)*c),d=r.margin*c,l=[r.color.light,r.color.dark];for(let f=0;f<h;f++)for(let u=0;u<h;u++){let p=(f*h+u)*4,g=r.color.light;if(f>=d&&u>=d&&f<h-d&&u<h-d){const m=Math.floor((f-d)/c),v=Math.floor((u-d)/c);g=l[a[m*o+v]?1:0]}i[p++]=g.r,i[p++]=g.g,i[p++]=g.b,i[p]=g.a}}})(ae)),ae}var vn;function fs(){return vn||(vn=1,(function(t){const e=ii();function n(s,r,o){s.clearRect(0,0,r.width,r.height),r.style||(r.style={}),r.height=o,r.width=o,r.style.height=o+"px",r.style.width=o+"px"}function i(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}t.render=function(r,o,a){let c=a,h=o;typeof c>"u"&&(!o||!o.getContext)&&(c=o,o=void 0),o||(h=i()),c=e.getOptions(c);const d=e.getImageWidth(r.modules.size,c),l=h.getContext("2d"),f=l.createImageData(d,d);return e.qrToImageData(f.data,r,c),n(l,h,d),l.putImageData(f,0,0),h},t.renderToDataURL=function(r,o,a){let c=a;typeof c>"u"&&(!o||!o.getContext)&&(c=o,o=void 0),c||(c={});const h=t.render(r,o,c),d=c.type||"image/png",l=c.rendererOpts||{};return h.toDataURL(d,l.quality)}})(oe)),oe}var ce={},Cn;function us(){if(Cn)return ce;Cn=1;const t=ii();function e(s,r){const o=s.a/255,a=r+'="'+s.hex+'"';return o<1?a+" "+r+'-opacity="'+o.toFixed(2).slice(1)+'"':a}function n(s,r,o){let a=s+r;return typeof o<"u"&&(a+=" "+o),a}function i(s,r,o){let a="",c=0,h=!1,d=0;for(let l=0;l<s.length;l++){const f=Math.floor(l%r),u=Math.floor(l/r);!f&&!h&&(h=!0),s[l]?(d++,l>0&&f>0&&s[l-1]||(a+=h?n("M",f+o,.5+u+o):n("m",c,0),c=0,h=!1),f+1<r&&s[l+1]||(a+=n("h",d),d=0)):c++}return a}return ce.render=function(r,o,a){const c=t.getOptions(o),h=r.modules.size,d=r.modules.data,l=h+c.margin*2,f=c.color.light.a?"<path "+e(c.color.light,"fill")+' d="M0 0h'+l+"v"+l+'H0z"/>':"",u="<path "+e(c.color.dark,"stroke")+' d="'+i(d,h,c.margin)+'"/>',p='viewBox="0 0 '+l+" "+l+'"',m='<svg xmlns="http://www.w3.org/2000/svg" '+(c.width?'width="'+c.width+'" height="'+c.width+'" ':"")+p+' shape-rendering="crispEdges">'+f+u+`</svg>
|
|
8
|
-
`;return typeof a=="function"&&a(null,m),m},ce}var Ln;function gs(){if(Ln)return at;Ln=1;const t=Gi(),e=ds(),n=fs(),i=us();function s(r,o,a,c,h){const d=[].slice.call(arguments,1),l=d.length,f=typeof d[l-1]=="function";if(!f&&!t())throw new Error("Callback required as last argument");if(f){if(l<2)throw new Error("Too few arguments provided");l===2?(h=a,a=o,o=c=void 0):l===3&&(o.getContext&&typeof h>"u"?(h=c,c=void 0):(h=c,c=a,a=o,o=void 0))}else{if(l<1)throw new Error("Too few arguments provided");return l===1?(a=o,o=c=void 0):l===2&&!o.getContext&&(c=a,a=o,o=void 0),new Promise(function(u,p){try{const g=e.create(a,c);u(r(g,o,c))}catch(g){p(g)}})}try{const u=e.create(a,c);h(null,r(u,o,c))}catch(u){h(u)}}return at.create=e.create,at.toCanvas=s.bind(null,n.render),at.toDataURL=s.bind(null,n.renderToDataURL),at.toString=s.bind(null,function(r,o,a){return i.render(r,a)}),at}var ps=gs();const ko=Pi(ps),ms=100,vt=1,Ie=2,Pe=3;var si=class{#e=[];#t=[];#r;#n=!1;constructor(t){this.#r=Math.max(1,t?.maxEntries??ms)}get canUndo(){return this.#e.length>0}get canRedo(){return this.#t.length>0}clear(){this.#e.length=0,this.#t.length=0,this.#n=!1}clearRedo(){this.#t.length=0}push(t){this.#e.push(t),this.clearRedo(),this.#n=!0,this.#e.length>this.#r&&this.#e.shift()}setLastUndoSelectionsAfter(t){const e=this.#e[this.#e.length-1];e!==void 0&&(e.selectionsAfter=t.map(n=>({...n})))}setLastUndoLineAnnotations(t,e){const n=this.#e[this.#e.length-1];n!==void 0&&(n.lineAnnotationsBefore=t.slice(),n.lineAnnotationsAfter=e.slice())}peekUndo(){return this.#e[this.#e.length-1]}peekUndoForCoalescing(){return this.#n?this.peekUndo():void 0}replaceLastUndo(t){if(this.#e.length===0){this.push(t);return}this.#e[this.#e.length-1]=t,this.clearRedo(),this.#n=!0}popUndoToRedo(){const t=this.#e.pop();if(t!==void 0)return this.#t.push(t),this.#n=!1,t}popRedoToUndo(){const t=this.#t.pop();if(t!==void 0)return this.#e.push(t),this.#n=!1,t}};function vs(t,e,n,i,s,r,o,a){const c=[...e].sort((l,f)=>l.start-f.start),h=[];let d;if(s?.length===c.length){const l=[];for(const f of s){if(f.start.line!==f.end.line||f.start.character!==f.end.character)break;l.push(t.offsetAt(f.start))}if(l.length===c.length){l.sort((p,g)=>p-g);let f=!0,u=!0;for(let p=0;p<c.length;p++){const g=c[p];if(g.text.length>0||g.start===g.end){f=!1,u=!1;break}f&&=l[p]===g.end,u&&=l[p]===g.start}d=f?Ie:u?Pe:void 0}}for(let l=0,f=0;l<c.length;l++){const u=c[l],p=t.getTextSlice(u.start,u.end),g=u.start+f;h.push({start:g,end:g+u.text.length,text:p}),f+=u.text.length-(u.end-u.start)}return{forwardEdits:c.map(l=>({...l})),inverseEdits:h,versionBefore:n,versionAfter:i,selectionsBefore:s?.map(l=>({...l})),selectionsAfter:r?.map(l=>({...l})),lineAnnotationsBefore:o?.slice(),lineAnnotationsAfter:a?.slice(),coalescingMode:d}}function Cs(t,e){if(t===void 0||t.undoBoundary===!0||e.undoBoundary===!0||t.forwardEdits.length===0||t.forwardEdits.length!==t.inverseEdits.length||t.forwardEdits.length!==e.forwardEdits.length||e.forwardEdits.length!==e.inverseEdits.length)return!1;let n;for(let i=0;i<t.forwardEdits.length;i++){const s=t.forwardEdits[i],r=t.inverseEdits[i],o=e.forwardEdits[i],a=e.inverseEdits[i],c=ri(o.start,t.forwardEdits),h=s.start<=s.end&&s.text.length>0&&!s.text.includes(`
|
|
9
|
-
`)&&!r.text.includes(`
|
|
10
|
-
`),d=o.start===o.end&&o.text.length>0&&!o.text.includes(`
|
|
11
|
-
`)&&a.text.length===0;if(h&&d){if(o.start!==r.end||(n??=vt,n!==vt||t.coalescingMode!==void 0&&t.coalescingMode!==vt||e.coalescingMode!==void 0&&e.coalescingMode!==vt))return!1;continue}const l=s.text.length===0&&s.end>s.start&&r.text.length>0,f=o.text.length===0&&o.end>o.start&&a.text.length>0;if(l&&f){let u;if(c===s.end)u=Pe;else{if(c+(o.end-o.start)!==s.start)return!1;u=Ie}if(n??=u,n!==u||t.coalescingMode!==void 0&&t.coalescingMode!==u||e.coalescingMode!==void 0&&e.coalescingMode!==u)return!1;continue}return!1}return n!==void 0}function Ls(t,e){const n=[],i=[];let s;for(let r=0;r<t.forwardEdits.length;r++){const o=t.forwardEdits[r],a=t.inverseEdits[r],c=e.forwardEdits[r],h=e.inverseEdits[r],d=ri(c.start,t.forwardEdits);if(o.text.length>0){s??=vt,n.push({start:o.start,end:o.end,text:o.text+c.text}),i.push(a.text);continue}if(d===o.end){s??=Pe,n.push({start:o.start,end:d+(c.end-c.start),text:""}),i.push(a.text+h.text);continue}s??=Ie,n.push({start:Math.min(o.start,d),end:o.end,text:""}),i.push(h.text+a.text)}return{forwardEdits:n,inverseEdits:bs(n,i),versionBefore:t.versionBefore,versionAfter:e.versionAfter,selectionsBefore:t.selectionsBefore?.slice(),selectionsAfter:e.selectionsAfter?.slice(),lineAnnotationsBefore:t.lineAnnotationsBefore?.slice(),lineAnnotationsAfter:e.lineAnnotationsAfter?.slice(),coalescingMode:s}}function bs(t,e){const n=[];for(let i=0,s=0;i<t.length;i++){const r=t[i],o=r.start+s;n.push({start:o,end:o+r.text.length,text:e[i]}),s+=r.text.length-(r.end-r.start)}return n}function ri(t,e){let n=t;for(const i of e){const s=i.end-i.start,r=i.text.length,o=r-s;if(!(n<i.start)){if(n>=i.start+r){n-=o;continue}n=i.start+Math.min(n-i.start,s)}}return n}const ws=1e5,be=10,Mt=13,xs="`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?";var Ct=class{source;offset;length;lineOffsetStart;lineOffsetEnd;hasVirtualTrailingCRBreak;firstCharCode;lastCharCode;static Original=0;static Added=1;constructor(t,e,n,i,s,r,o,a){this.source=t,this.offset=e,this.length=n,this.lineOffsetStart=i,this.lineOffsetEnd=s,this.hasVirtualTrailingCRBreak=r,this.firstCharCode=o,this.lastCharCode=a}get lineBreakCount(){return this.lineOffsetEnd-this.lineOffsetStart+(this.hasVirtualTrailingCRBreak?1:0)}},bn=class{text;lineOffsets;constructor(t){this.text=t,this.lineOffsets=qn(t)}append(t){const e=this.text.length;for(let n=0;n<t.length;n++){const i=t.charCodeAt(n);i!==be&&i!==Mt||(i===Mt&&t.charCodeAt(n+1)===be&&n++,this.lineOffsets.push(e+n+1))}return this.text+=t,e}},Tt=class{piece;subtreeLength;subtreeLineBreakCount;subtreeFirstCharCode;subtreeLastCharCode;left=null;right=null;parent=null;priority=0;constructor(t,e=t.length,n=t.lineBreakCount,i=t.firstCharCode,s=t.lastCharCode){this.piece=t,this.subtreeLength=e,this.subtreeLineBreakCount=n,this.subtreeFirstCharCode=i,this.subtreeLastCharCode=s}updateSubtreeLength(){this.subtreeLength=(this.left?.subtreeLength??0)+this.piece.length+(this.right?.subtreeLength??0),this.subtreeLineBreakCount=(this.left?.subtreeLineBreakCount??0)+this.piece.lineBreakCount+(this.right?.subtreeLineBreakCount??0)-(X(this.left?.subtreeLastCharCode,this.piece.firstCharCode)?1:0)-(X(this.piece.lastCharCode,this.right?.subtreeFirstCharCode)?1:0),this.subtreeFirstCharCode=this.left?.subtreeFirstCharCode??this.piece.firstCharCode,this.subtreeLastCharCode=this.right?.subtreeLastCharCode??this.piece.lastCharCode}},ys=class{#e;#t=new bn("");#r=null;#n=0;#a=0;#l=null;#c=null;#p=null;#y=2654435769;constructor(t){this.#e=new bn(t);const e=this.#E(Ct.Original,0,t.length);this.#r=e.length>0?this.#$(e):null,this.#n=this.#r?.subtreeLength??0,this.#a=(this.#r?.subtreeLineBreakCount??0)+1}get lineCount(){return this.#a}getText(t){if(t===void 0)return this.#P();const e=this.offsetAt(t.start),n=this.offsetAt(t.end);return this.getTextSlice(e,n)}getLineText(t,e=!1){if(this.#l!==null&&this.#l[0]===t&&this.#l[1]===e)return this.#l[2];const n=this.#S(t);if(n===void 0)throw new Error(`Line index out of range: ${t}`);const i=this.getTextSlice(n[0],n[1],!e);return this.#l=[t,e,i],this.#c=[t,e,i.length],i}getLineLength(t,e=!1){const n=this.#c,i=this.#l;if(n!==null&&n[0]===t&&n[1]===e)return n[2];if(i!==null&&i[0]===t&&i[1]===e){const c=i[2].length;return this.#c=[t,e,c],c}const s=this.#S(t);if(s===void 0)throw new Error(`Line index out of range: ${t}`);const[r,o]=s;let a=o-r;if(!e)for(;a>0&&le(this.charAt(r+a-1).charCodeAt(0));)a--;return this.#c=[t,e,a],a}getTextSlice(t,e,n=!1){if(t>=e)return"";const i=V(t,0,this.#n),s=V(e,i,this.#n);if(i>=s)return"";const r=this.#b(i);if(r===void 0)return"";const o=[];let[a,c]=r,h=s-i;for(;a!==null&&h>0;){const d=Math.min(a.piece.length-c,h),l=this.#v(a.piece.source),f=a.piece.offset+c;let u=f+d;if(n)for(;u>f&&le(l.text.charCodeAt(u-1));)u--;o.push(l.text.slice(f,u)),h-=d,c=0,a=this.#m(a)}return o.join("")}charAt(t){const e=this.#b(t);if(e===void 0)return"";const[n,i]=e;return this.#v(n.piece.source).text.charAt(n.piece.offset+i)}includes(t){if(t.length===0)return!0;const e=wn(t);let n=0,i=!1;return this.#L(s=>{for(let r=s.start;r<s.end;r++){const o=s.text.charCodeAt(r);for(;n>0&&o!==t.charCodeAt(n);)n=e[n-1];if(o===t.charCodeAt(n)&&n++,n===t.length)return i=!0,!1}return!0}),i}findNextNonOverlappingSubstring(t,e){if(t.length===0||t.length>this.#n)return;const n=Ss(e,this.#n),i=n.reduce((h,[,d])=>Math.max(h,d),0),s=wn(t);let r=0,o=0,a,c;return this.#L(h=>{for(let d=h.start;d<h.end;d++){const l=h.text.charCodeAt(d);for(;r>0&&l!==t.charCodeAt(r);)r=s[r-1];if(l===t.charCodeAt(r)&&r++,r===t.length){const f=o-t.length+1;if(!Es(n,f,f+t.length)){if(f>=i)return c=f,!1;a??=f}r=s[r-1]}o++}return!0}),c??a}search(t){if(t.text.length===0||this.#n===0)return[];if(t.text.includes(`
|
|
12
|
-
`)||t.text.includes("\r")||t.regex&&(t.text.includes("\\n")||t.text.includes("\\r")))return[];let e;try{e=oi(t.text,t.regex,t.caseSensitive)}catch{return[]}return this.#u(e,t.wholeWord,ws)}#u(t,e,n){const i=[],s=this.#P(),r=s.length,o=qn(s);for(let a=0;a<o.length;a++){const c=o[a];let h=o[a+1]??r;for(;h>c&&le(s.charCodeAt(h-1));)h--;const d=s.slice(c,h);t.lastIndex=0;let l;for(;(l=t.exec(d))!==null;){const f=l.index,u=l[0];if(u.length===0){t.lastIndex=yn(d,f);continue}const p=c+f;if((!e||Ms(s,p,u.length))&&(i.push([p,p+u.length]),i.length>=n))return i;f===t.lastIndex&&(t.lastIndex=yn(d,f))}}return i}insert(t,e){if(t.length===0)return;const n=V(e,0,this.#n);this.#g(n,n,t),this.#M()}delete(t,e){if(e<=0||this.#n===0)return;const n=V(t,0,this.#n),i=V(n+e,n,this.#n);n!==i&&(this.#g(n,i,""),this.#M())}applyEdits(t){if(t.length!==0){for(let e=t.length-1;e>=0;e--){const n=t[e],i=V(n.start,0,this.#n),s=V(n.end,i,this.#n);this.#g(i,s,n.text)}this.#M()}}positionAt(t){const e=V(t,0,this.#n);if(this.#n===0)return{line:0,character:0};const n=this.#T(e),i=e-(n===0?0:this.#H(n-1));return this.#p=[n,i,e],{line:n,character:i}}positionsAt(t){const e=Array.from({length:t.length});if(t.length===0)return e;if(this.#n===0)return e.fill({line:0,character:0});for(let n=0;n<t.length;n++)e[n]=this.positionAt(t[n]);return e}offsetAt(t){if(t.line<0||this.#n===0)return 0;if(t.line>=this.#a)throw new Error(`Line index out of range: ${t.line}`);const e=this.#p;if(e!==null&&e[0]===t.line&&e[1]===t.character)return e[2];const n=this.#S(t.line);if(n===void 0)throw new Error(`Line index out of range: ${t.line}`);const i=V(t.character,0,n[1]-n[0]);return n[0]+i}#b(t){if(t<0||t>=this.#n)return;let e=this.#r,n=t;for(;e!==null;){const i=e.left?.subtreeLength??0;if(n<i){e=e.left;continue}if(n-=i,n<e.piece.length)return[e,n];n-=e.piece.length,e=e.right}}#m(t){if(t.right!==null){let n=t.right;for(;n.left!==null;)n=n.left;return n}let e=t;for(;e.parent!==null&&e===e.parent.right;)e=e.parent;return e.parent}#S(t){if(t<0)throw new Error(`Line index out of range: ${t}`);if(this.#n===0){if(t===0)return[0,0];throw new Error(`Line index out of range: ${t}`)}if(t>=this.#a)throw new Error(`Line index out of range: ${t}`);return[t===0?0:this.#H(t-1),t<this.#a-1?this.#H(t):this.#n]}#T(t){let e=this.#r,n=V(t,0,this.#n),i=0;for(;e!==null;){const s=e.left?.subtreeLength??0;if(n<s){e=e.left;continue}if(i+=(e.left?.subtreeLineBreakCount??0)-(X(e.left?.subtreeLastCharCode,e.piece.firstCharCode)?1:0),n-=s,n<=e.piece.length){const r=this.#v(e.piece.source),o=Math.min(he(r.lineOffsets,e.piece.offset+n),e.piece.lineOffsetEnd);return i+=o-e.piece.lineOffsetStart,n===e.piece.length&&e.piece.hasVirtualTrailingCRBreak&&i++,n===e.piece.length&&X(e.piece.lastCharCode,this.#m(e)?.piece.firstCharCode)&&i--,i}i+=e.piece.lineBreakCount-(X(e.piece.lastCharCode,e.right?.subtreeFirstCharCode)?1:0),n-=e.piece.length,e=e.right}return this.#a-1}#H(t){let e=this.#r,n=t,i=0,s;for(;e!==null;){const r=(e.left?.subtreeLineBreakCount??0)-(X(e.left?.subtreeLastCharCode,e.piece.firstCharCode)?1:0);if(n<r){s=e.piece.firstCharCode,e=e.left;continue}const o=e.left?.subtreeLength??0;i+=o,n-=r;const a=e.right?.subtreeFirstCharCode??s,c=e.piece.lineBreakCount-(X(e.piece.lastCharCode,a)?1:0);if(n<c)return i+this.#o(e.piece,n);i+=e.piece.length,n-=c,e=e.right}return this.#n}#o(t,e){return e<t.lineOffsetEnd-t.lineOffsetStart?this.#v(t.source).lineOffsets[t.lineOffsetStart+e]-t.offset:t.length}#P(){const t=[];return this.#L(e=>{t.push(e.text.slice(e.start,e.end))}),t.join("")}#L(t){this.#U(this.#r,e=>{const n=this.#v(e.piece.source);return t({text:n.text,lineOffsets:n.lineOffsets,lineOffsetStart:e.piece.lineOffsetStart,lineOffsetEnd:e.piece.lineOffsetEnd,start:e.piece.offset,end:e.piece.offset+e.piece.length})})}#v(t){return t===Ct.Original?this.#e:this.#t}#E(t,e,n){const i=this.#v(t),s=e+n,r=he(i.lineOffsets,e),o=he(i.lineOffsets,s),a=i.text.charCodeAt(s-1);return new Ct(t,e,n,r,o,a===Mt&&i.lineOffsets[o-1]!==s,i.text.charCodeAt(e),a)}#g(t,e,n){if(t===e&&n.length===0)return;const[i,s]=this.#W(this.#r,t),r=this.#x(s,e-t);let o;if(n.length>0){const a=this.#E(Ct.Added,this.#t.append(n),n.length);o=this.#O(this.#h(i,a),r)}else{const[a,c]=this.#V(r);o=a===void 0?i:this.#O(this.#h(i,a),c)}o!==null&&(o.parent=null),this.#r=o,this.#n=o?.subtreeLength??0,this.#a=(o?.subtreeLineBreakCount??0)+1}#M(){this.#l=null,this.#c=null,this.#p=null}#C(){return this.#y=Math.imul(this.#y,1664525)+1013904223>>>0,this.#y}#$(t){const e=new Tt(t);return e.priority=this.#C(),e}#k(t,e){t.left=e,e!==null&&(e.parent=t)}#I(t,e){t.right=e,e!==null&&(e.parent=t)}#W(t,e){if(t===null)return[null,null];if(e<=0)return[null,t];if(e>=t.subtreeLength)return[t,null];const n=t.left?.subtreeLength??0;if(e<=n){const[a,c]=this.#W(t.left,e);return this.#k(t,c),t.updateSubtreeLength(),[a,t]}const i=t.piece.length;if(e>=n+i){const[a,c]=this.#W(t.right,e-n-i);return this.#I(t,a),t.updateSubtreeLength(),[t,c]}const s=e-n,r=new Tt(this.#E(t.piece.source,t.piece.offset,s)),o=new Tt(this.#E(t.piece.source,t.piece.offset+s,i-s));return r.priority=t.priority,o.priority=t.priority,this.#k(r,t.left),this.#I(o,t.right),r.updateSubtreeLength(),o.updateSubtreeLength(),[r,o]}#x(t,e){if(t===null||e>=t.subtreeLength)return null;if(e<=0)return t;const n=t.left?.subtreeLength??0;if(e<=n)return this.#k(t,this.#x(t.left,e)),t.updateSubtreeLength(),t;const i=n+t.piece.length;if(e>=i)return this.#x(t.right,e-i);const s=e-n,r=new Tt(this.#E(t.piece.source,t.piece.offset+s,t.piece.length-s));return r.priority=t.priority,this.#I(r,t.right),r.updateSubtreeLength(),r}#O(t,e){return t===null?e:e===null?t:t.priority>=e.priority?(this.#I(t,this.#O(t.right,e)),t.updateSubtreeLength(),t):(this.#k(e,this.#O(t,e.left)),e.updateSubtreeLength(),e)}#h(t,e){if(t===null)return this.#$(e);let n=t;for(;n.right!==null;)n=n.right;if(Ts(n.piece,e)){n.piece=ks(n.piece,e);for(let i=n;i!==null&&(i.updateSubtreeLength(),i!==t);)i=i.parent;return t}return this.#O(t,this.#$(e))}#V(t){if(t===null)return[void 0,null];if(t.left===null)return[t.piece,t.right];const[e,n]=this.#V(t.left);return this.#k(t,n),t.updateSubtreeLength(),[e,t]}#U(t,e){return t===null?!0:!this.#U(t.left,e)||e(t)===!1?!1:this.#U(t.right,e)}};function le(t){return t===10||t===13}function V(t,e,n){return Math.min(Math.max(t,e),n)}function wn(t){const e=Array.from({length:t.length}).fill(0);let n=0;for(let i=1;i<t.length;i++){const s=t.charCodeAt(i);for(;n>0&&s!==t.charCodeAt(n);)n=e[n-1];s===t.charCodeAt(n)&&n++,e[i]=n}return e}function Ss(t,e){const n=[];for(const[s,r]of t){const o=V(s,0,e),a=V(r,o,e);o<a&&n.push([o,a])}n.sort((s,r)=>s[0]-r[0]);const i=[];for(const s of n){const r=i[i.length-1];if(r!==void 0&&s[0]<=r[1]){r[1]=Math.max(r[1],s[1]);continue}i.push(s)}return i}function Es(t,e,n){let i=0,s=t.length;for(;i<s;){const o=i+Math.floor((s-i)/2);t[o][1]<=e?i=o+1:s=o}const r=t[i];return r!==void 0&&r[0]<n}function Ts(t,e){return t.source===e.source&&t.offset+t.length===e.offset&&!X(t.lastCharCode,e.firstCharCode)}function ks(t,e){return new Ct(t.source,t.offset,t.length+e.length,t.lineOffsetStart,e.lineOffsetEnd,e.hasVirtualTrailingCRBreak,t.firstCharCode,e.lastCharCode)}function X(t,e){return t===Mt&&e===be}function he(t,e){let n=0,i=t.length;for(;n<i;){const s=n+Math.floor((i-n)/2);t[s]<=e?n=s+1:i=s}return n}function As(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function xn(t){if(t<=32||t===127)return!0;const e=String.fromCharCode(t);return xs.includes(e)}function Ms(t,e,n){const i=e<=0||xn(t.charCodeAt(e-1)),s=e+n>=t.length||xn(t.charCodeAt(e+n));return i&&s}function oi(t,e,n){const i=e?t:As(t);return new RegExp(i,`g${n?"":"i"}${e?"m":""}`)}function Rs(t,e){return t.replace(/\$([$&]|\d+)/g,(n,i)=>i==="$"?"$":i==="&"?e[0]??"":e[Number(i)]??"")}function Bs(t,e,n,i,s,r){if(!i.regex)return i.replaceText;const o=t(s),a=n(o.line),c=s-e({line:o.line,character:0});let h;try{h=oi(i.text,!0,i.caseSensitive)}catch{return i.replaceText}h.lastIndex=c;const d=h.exec(a);return d===null||d.index!==c||d[0].length!==r-s?i.replaceText:Rs(i.replaceText,d)}function yn(t,e){if(e+1<t.length){const n=t.charCodeAt(e),i=t.charCodeAt(e+1);if(n>=55296&&n<=56319&&i>=56320&&i<=57343)return e+2}return e+1}var Is=class we{#e;#t;#r;#n;#a;#l;constructor(e,n,i="text",s=0,r=new si){this.#e=new URL(e,"file://").toString(),this.#t=i,this.#r=s,this.#n=new ys(n),this.#a=r;const o=this.#n.getLineText(0,!0);o.endsWith(`\r
|
|
13
|
-
`)?this.#l=`\r
|
|
14
|
-
`:o.endsWith("\r")?this.#l="\r":this.#l=`
|
|
15
|
-
`}get uri(){return this.#e}get languageId(){return this.#t}get version(){return this.#r}get lineCount(){return this.#n.lineCount}get eol(){return this.#l}get canUndo(){return this.#a.canUndo}get canRedo(){return this.#a.canRedo}positionAt(e){return this.normalizePosition(this.#n.positionAt(e))}positionsAt(e){const n=this.#n.positionsAt(e);for(let i=0;i<n.length;i++)n[i]=this.normalizePosition(n[i]);return n}offsetAt(e){return this.#n.offsetAt(this.normalizePosition(e))}getText(e){return e===void 0?this.#n.getText():this.#n.getText({start:this.normalizePosition(e.start),end:this.normalizePosition(e.end)})}getLineText(e,n){return this.#n.getLineText(e,n)}normalizeEol(e){return e.replace(/\r\n|\r|\n/g,this.eol)}getLineLength(e,n){return this.#n.getLineLength(e,n)}charAt(e){return typeof e=="number"?this.#n.charAt(e):this.#n.charAt(this.offsetAt(e))}getTextSlice(e,n){return this.#n.getTextSlice(e,n)}findNextNonOverlappingSubstring(e,n){return this.#n.findNextNonOverlappingSubstring(e,n)}search(e){return this.#n.search(e)}applyEdits(e,n=!0,i,s,r=!1){if(e.length!==0)return this.#c(this.#m(this.resolveEdits(e)),n,i,s,r)}resolveEdits(e){return e.map(n=>this.#y(n))}applyResolvedEdits(e,n=!0,i,s,r=!1){if(e.length!==0)return this.#c(this.#m(e.map(o=>this.#u(o))),n,i,s,r)}#c(e,n,i,s,r){const o=vs(this,e,this.#r,this.#r+1,n?i:void 0,n?s:void 0);n&&r&&(o.undoBoundary=!0);const a=this.#a.peekUndoForCoalescing(),c=this.#S(e);return this.#r++,c.lineDelta===0&&Cs(a,o)?this.#a.replaceLastUndo(Ls(a,o)):this.#a.push(o),c}setLastUndoSelectionsAfter(e){this.#a.setLastUndoSelectionsAfter(e)}setLastUndoLineAnnotations(e,n){this.#a.setLastUndoLineAnnotations(e,n)}undo(){const e=this.#a.popUndoToRedo();if(e===void 0)return;const n=this.#S(e.inverseEdits);if(n===void 0)return;this.#r=e.versionBefore;const i=e.selectionsBefore?.slice();return[n,i,e.lineAnnotationsBefore?.slice(),i===void 0?e.inverseEdits.map(s=>({...s})):void 0]}redo(){const e=this.#a.popRedoToUndo();if(e===void 0)return;const n=this.#S(e.forwardEdits);if(n===void 0)return;this.#r=e.versionAfter;const i=e.selectionsAfter?.slice();return[n,i,e.lineAnnotationsAfter?.slice(),i===void 0?e.forwardEdits.map(s=>({...s})):void 0]}normalizePosition(e){const n=we.#p(e.line,this.lineCount-1);return{line:n,character:we.#p(e.character,this.getLineLength(n))}}static#p(e,n){return Number.isNaN(e)?0:Math.max(0,Math.min(Math.floor(e),n))}#y(e){let n=this.offsetAt(e.range.start),i=this.offsetAt(e.range.end);if(n>i){const s=n;n=i,i=s}return this.#u({start:n,end:i,text:e.newText})}#u(e){let{start:n,end:i}=e;const s=n===i;return this.#b(n)&&n--,s?i=n:this.#b(i)&&i++,{start:n,end:i,text:e.text}}#b(e){const n=this.#n.charAt(e-1).charCodeAt(0),i=this.#n.charAt(e).charCodeAt(0);return n>=55296&&n<=56319&&i>=56320&&i<=57343}#m(e){const n=[...e].sort((i,s)=>{const r=i.start-s.start;return r===0?i.end-s.end:r});for(let i=0;i<n.length-1;i++)if(n[i].end>n[i+1].start)throw new Error("Overlapping text edits are not supported");return n}#S(e){const n=this.#n.lineCount,i=this.positionsAt(e.flatMap(h=>[h.start,h.end])),s=this.#T(e,i),r=i[0],o=i[i.length-1],a=o.line===n-1&&o.character===this.#n.getLineLength(o.line);this.#n.applyEdits(e);const c=this.#n.lineCount;return{changes:e.map((h,d)=>({...h,range:{start:i[d*2],end:i[d*2+1]}})),startLine:s.startLine,startCharacter:r.character,endCharacter:o.character,endLine:Math.min(s.endLine,Math.max(0,c-1)),endedAtDocumentEnd:a,previousLineCount:n,lineCount:c,lineDelta:c-n,changedLineRanges:s.ranges,changedLineChanges:s.changes}}#T(e,n){let i=1/0,s=0,r=0;const o=[],a=[],c=this.#n.lineCount-1,h=this.#n.getLineLength(c);for(let d=0;d<e.length;d++){const l=e[d],f=n[d*2],u=n[d*2+1],p=f.line,g=u.line,m=Ni(l.text),v=p+r,L=v+m,b=m-(g-p);i=Math.min(i,p),s=Math.max(s,L);const C=o[o.length-1];C!==void 0&&v<=C[1]+1?o[o.length-1]=[C[0],Math.max(C[1],L)]:o.push([v,L]),a.push([v,L,b,f.character,u.character,g===c&&u.character===h]),r+=b}return i===1/0?{startLine:0,endLine:0,ranges:[[0,0]],changes:[[0,0,0,0,0,!1]]}:{startLine:i,endLine:s,ranges:o,changes:a}}};function bt({metaKey:t,ctrlKey:e},n=Nt()){return n?t&&!e:e&&!t}function Ps(t){if(Nt()&&t.ctrlKey&&!t.altKey&&!t.metaKey)switch(t.key){case"a":return"start";case"e":return"end";case"p":return"up";case"n":return"down";case"f":return"right";case"b":return"left"}if(!t.altKey&&!t.ctrlKey&&!t.metaKey){if(t.key==="ArrowUp")return"up";if(t.key==="ArrowDown")return"down";if(t.key==="ArrowLeft")return"left";if(t.key==="ArrowRight")return"right";if(t.key==="Home")return"start";if(t.key==="End")return"end"}if(bt(t)){if(t.key==="ArrowLeft")return"textStart";if(t.key==="ArrowRight")return"end"}}const Sn=new WeakMap,Ns=ai([{bindings:{Tab:"indent","shift+Tab":"outdent","cmdOrCtrl+[":"indentLess","cmdOrCtrl+]":"indentMore","cmdOrCtrl+z":"undo","cmdOrCtrl+shift+z":"redo","cmdOrCtrl+a":"selectAll","cmdOrCtrl+d":"findNextMatch","cmdOrCtrl+f":"openSearchPanel","cmdOrCtrl+alt+f":"openSearchReplacePanel","alt+ArrowUp":"moveLineUp","alt+ArrowDown":"moveLineDown","shift+alt+ArrowUp":"copyLineUp","shift+alt+ArrowDown":"copyLineDown",Escape:"simplifySelection","cmdOrCtrl+Enter":"insertBlankLine","cmdOrCtrl+/":"toggleComment","shift+alt+a":"toggleBlockComment","cmdOrCtrl+Home":"moveCursorToDocStart","cmdOrCtrl+End":"moveCursorToDocEnd","cmdOrCtrl+shift+Home":"expandSelectionDocStart","cmdOrCtrl+shift+End":"expandSelectionDocEnd"}},{platform:"mac",bindings:{"ctrl+k":"deleteHardLineForward","ctrl+alt+p":"moveLineUp","ctrl+alt+n":"moveLineDown","cmd+ArrowUp":"moveCursorToDocStart","cmd+ArrowDown":"moveCursorToDocEnd","cmd+shift+ArrowUp":"expandSelectionDocStart","cmd+shift+ArrowDown":"expandSelectionDocEnd"}},{platform:"windows",bindings:{"ctrl+y":"redo"}},{platform:"linux",bindings:{"ctrl+y":"redo","ctrl+alt+p":"moveLineUp","ctrl+alt+n":"moveLineDown"}}]),Os={Backquote:"`",Minus:"-",Equal:"=",Comma:",",Period:".",Slash:"/",Semicolon:";",Quote:"'",BracketLeft:"[",BracketRight:"]",Backslash:"\\",Space:"Space"};function ai(t){let e=Sn.get(t);if(e===void 0){e={mac:new Map,windows:new Map,linux:new Map};for(const n of t)for(const i of Object.keys(n.bindings)){const s=n.bindings[i];if(s===void 0)continue;const r=i.split("+"),o=r.pop();for(const a of["mac","windows","linux"]){if(n.platform!==void 0&&n.platform!==a)continue;let c=0;for(const d of r)d==="alt"?c|=1:d==="ctrl"?c|=2:d==="cmd"?c|=4:d==="shift"?c|=8:d==="cmdOrCtrl"&&(c|=a==="mac"?4:2);let h=e[a].get(c);h===void 0&&(h=new Map,e[a].set(c,h)),h.set(o,s)}}Sn.set(t,e)}return e}function Ds(t,e,n=Nt()){const i=t.key===" "?"Space":t.key.length===1?t.key.toLowerCase():t.key,s=t.code??"",r=s.startsWith("Key")&&s.length===4?s.slice(3).toLowerCase():s.startsWith("Digit")&&s.length===6?s.slice(5):Os[s],o=n?"mac":globalThis.navigator?.platform.includes("Linux")===!0?"linux":"windows",a=(t.altKey?1:0)|(t.ctrlKey?2:0)|(t.metaKey?4:0)|(t.shiftKey?8:0);if(e!==void 0){const h=ai(e)[o].get(a),d=h?.get(i)??(r===void 0?void 0:h?.get(r));if(d!==void 0)return d}const c=Ns[o].get(a);return c?.get(i)??(r===void 0?void 0:c?.get(r))}function xe(t,e=Nt()){if(!t.altKey&&bt(t,e)&&((t.key.length===1?t.key.toLowerCase():t.key)==="g"||t.code==="KeyG"))return t.shiftKey?"previous":"next"}var _s=`::selection {
|
|
16
|
-
background-color: #0000;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
[data-deleted-text-selection] [data-deletions] ::selection, [data-deleted-text-selection] [data-line-type="change-deletion"] ::selection {
|
|
20
|
-
background-color: var(--diffs-editor-selection-bg);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
@keyframes blinking {
|
|
24
|
-
0% {
|
|
25
|
-
opacity: 1;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
50% {
|
|
29
|
-
opacity: 0;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
100% {
|
|
33
|
-
opacity: 1;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
:host, [data-code], [data-content], [data-diff-type="split"][data-overflow="wrap"] {
|
|
38
|
-
position: relative;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
[data-code] {
|
|
42
|
-
container-type: inline-size;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
[data-content] {
|
|
46
|
-
cursor: text;
|
|
47
|
-
caret-color: var(--diffs-bg-caret);
|
|
48
|
-
background-color: #0000;
|
|
49
|
-
outline: none;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
[data-line] {
|
|
53
|
-
cursor: text;
|
|
54
|
-
background-color: #0000;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
[data-line]:after {
|
|
58
|
-
content: "";
|
|
59
|
-
z-index: -20;
|
|
60
|
-
background-color: var(--diffs-line-bg);
|
|
61
|
-
pointer-events: none;
|
|
62
|
-
position: absolute;
|
|
63
|
-
inset: 0;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
[data-line][data-editor-active-line]:after {
|
|
67
|
-
box-shadow: inset 0 0 0 1px var(--diffs-editor-line-highlight-border);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
[data-editor-overlay] {
|
|
71
|
-
display: contents;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
[data-caret], [data-selection-range], [data-match-range], [data-bracket-match-range], [data-marker-range] {
|
|
75
|
-
height: 1lh;
|
|
76
|
-
line-height: var(--diffs-line-height);
|
|
77
|
-
pointer-events: none;
|
|
78
|
-
position: absolute;
|
|
79
|
-
top: 0;
|
|
80
|
-
left: 0;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
[data-caret] {
|
|
84
|
-
background-color: var(--diffs-bg-caret-override, var(--diffs-editor-cursor-fg, light-dark(color-mix(in lab, var(--diffs-fg) 50%, var(--diffs-bg)), color-mix(in lab, var(--diffs-fg) 75%, var(--diffs-bg)))));
|
|
85
|
-
visibility: hidden;
|
|
86
|
-
width: 2px;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
@media (prefers-reduced-motion: no-preference) {
|
|
90
|
-
[data-caret] {
|
|
91
|
-
animation: 1.2s .8s infinite blinking;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
[data-selection-range] {
|
|
96
|
-
z-index: -10;
|
|
97
|
-
background-color: var(--diffs-editor-selection-bg);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
[data-selection-corner] {
|
|
101
|
-
background-color: var(--diffs-selection-corner-bg, var(--diffs-bg));
|
|
102
|
-
width: 100%;
|
|
103
|
-
height: 100%;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
[data-match-range] {
|
|
107
|
-
z-index: -10;
|
|
108
|
-
background-color: var(--diffs-editor-match-bg, var(--diffs-editor-selection-bg));
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
[data-match-range]:not([data-focus]) {
|
|
112
|
-
background-color: var(--diffs-editor-match-highlight-bg, light-dark(#ff963288, #ff963266));
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
[data-bracket-match-range] {
|
|
116
|
-
z-index: -9;
|
|
117
|
-
box-sizing: border-box;
|
|
118
|
-
border-bottom: 1px solid
|
|
119
|
-
var(--diffs-editor-bracket-match-border, color-mix(in lab, var(--diffs-fg) 60%, transparent));
|
|
120
|
-
background-color: var(--diffs-editor-bracket-match-bg, color-mix(in lab, var(--diffs-fg) 5%, transparent));
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
[data-rtl] {
|
|
124
|
-
border-top-left-radius: 3px;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
[data-rtr] {
|
|
128
|
-
border-top-right-radius: 3px;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
[data-rbl] {
|
|
132
|
-
border-bottom-left-radius: 3px;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
[data-rbr] {
|
|
136
|
-
border-bottom-right-radius: 3px;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
[data-marker-range] {
|
|
140
|
-
z-index: 1;
|
|
141
|
-
background-color: var(--diffs-marker-bg);
|
|
142
|
-
mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI2IiBoZWlnaHQ9IjMiPjxwYXRoIGQ9Im0wIDIuNSBsMiAtMS41IGwxIDAgbDIgMS41IGwxIDAiIHN0cm9rZT0iI2ZmZiIgZmlsbD0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIi8+PC9zdmc+");
|
|
143
|
-
mask-position: 0 100%;
|
|
144
|
-
mask-size: 6px 3px;
|
|
145
|
-
mask-repeat: repeat-x;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
[data-marker-error] {
|
|
149
|
-
--diffs-marker-contrast: light-dark(#fff, #000);
|
|
150
|
-
--diffs-marker-bg: var(--diffs-editor-error-fg, var(--diffs-deletion-base));
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
[data-marker-warning] {
|
|
154
|
-
--diffs-marker-contrast: #000;
|
|
155
|
-
--diffs-marker-bg: var(--diffs-editor-warning-fg, light-dark(var(--diffs-warning-light), var(--diffs-warning-dark)));
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
[data-marker-info] {
|
|
159
|
-
--diffs-marker-contrast: #000;
|
|
160
|
-
--diffs-marker-bg: var(--diffs-editor-info-fg, var(--diffs-modified-base));
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
[data-marker-hint] {
|
|
164
|
-
--diffs-marker-contrast: light-dark(#fff, #000);
|
|
165
|
-
--diffs-marker-bg: var(--diffs-editor-hint-fg, var(--diffs-fg-number));
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
@media (width >= 480px) {
|
|
169
|
-
[data-content] {
|
|
170
|
-
caret-color: #0000;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
[data-content]:focus ~ [data-editor-overlay] [data-caret] {
|
|
174
|
-
visibility: visible;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
[data-editor-widget] {
|
|
179
|
-
--diffs-widget-fg: var(--diffs-fg);
|
|
180
|
-
--diffs-widget-bg: color-mix(in lab, var(--diffs-fg) 4%, var(--diffs-bg));
|
|
181
|
-
--diffs-widget-border: color-mix(in lab, var(--diffs-fg) 20%, transparent);
|
|
182
|
-
--diffs-widget-shadow: inset 0 0 0 1px var(--diffs-bg), 0 4px 8px #00000013,
|
|
183
|
-
0 6px 18px #00000013;
|
|
184
|
-
z-index: 100;
|
|
185
|
-
width: fit-content;
|
|
186
|
-
max-width: calc(100% - 24px);
|
|
187
|
-
font: 14px/20px var(--diffs-header-font-fallback);
|
|
188
|
-
border: 1px solid var(--diffs-widget-border);
|
|
189
|
-
background-color: var(--diffs-widget-bg);
|
|
190
|
-
box-shadow: var(--diffs-widget-shadow);
|
|
191
|
-
background-clip: padding-box;
|
|
192
|
-
border-radius: 9px;
|
|
193
|
-
position: absolute;
|
|
194
|
-
top: 0;
|
|
195
|
-
left: 0;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
[data-marker-popover], [data-selection-action-popover] {
|
|
199
|
-
--popover-gap: var(--diffs-popover-gap, var(--diffs-gap-fallback, 8px));
|
|
200
|
-
--popover-viewport-left: 0px;
|
|
201
|
-
--popover-viewport-right: 100cqw;
|
|
202
|
-
--popover-viewport-top: -99999px;
|
|
203
|
-
--popover-viewport-bottom: 99999px;
|
|
204
|
-
--popover-min-left: calc(var(--popover-viewport-left) + var(--gutter-width, 0px) + var(--popover-gap));
|
|
205
|
-
--popover-available-width: max(0px,
|
|
206
|
-
calc(var(--popover-viewport-right) - var(--popover-min-left) -
|
|
207
|
-
var(--popover-gap)));
|
|
208
|
-
max-width: min(640px, var(--popover-available-width));
|
|
209
|
-
translate: clamp(var(--popover-min-left),
|
|
210
|
-
var(--popover-x, var(--popover-min-left)),
|
|
211
|
-
calc(var(--popover-viewport-right) - var(--popover-gap) - 100%))
|
|
212
|
-
/* Clamp into the scrollport so a popover with no fitting side stays in view. */
|
|
213
|
-
clamp(var(--popover-viewport-top),
|
|
214
|
-
calc(var(--popover-y, 0px) + var(--popover-y-shift, 0px)),
|
|
215
|
-
calc(var(--popover-viewport-bottom) - var(--popover-gap) - 100%));
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
[data-marker-popover] {
|
|
219
|
-
--diffs-widget-bg: var(--diffs-marker-bg);
|
|
220
|
-
--diffs-widget-shadow: 0 4px 8px #00000026, 0 6px 18px #00000026;
|
|
221
|
-
min-width: min(180px, var(--popover-available-width));
|
|
222
|
-
overflow-wrap: anywhere;
|
|
223
|
-
color: var(--diffs-marker-contrast);
|
|
224
|
-
white-space: normal;
|
|
225
|
-
pointer-events: auto;
|
|
226
|
-
border: 0;
|
|
227
|
-
padding: 8px 12px;
|
|
228
|
-
|
|
229
|
-
@supports (color: contrast-color(red)) {
|
|
230
|
-
color: contrast-color(var(--diffs-marker-bg, var(--diffs-bg)));
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
& [data-marker-message] {
|
|
234
|
-
white-space: normal;
|
|
235
|
-
overflow-wrap: anywhere;
|
|
236
|
-
|
|
237
|
-
& code {
|
|
238
|
-
white-space: normal;
|
|
239
|
-
color: inherit;
|
|
240
|
-
background-color: #0000;
|
|
241
|
-
display: inline;
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
[data-selection-action-popover] {
|
|
247
|
-
pointer-events: auto;
|
|
248
|
-
flex-wrap: wrap;
|
|
249
|
-
align-items: center;
|
|
250
|
-
gap: 4px;
|
|
251
|
-
width: max-content;
|
|
252
|
-
padding: 4px;
|
|
253
|
-
display: flex;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
[data-search-panel] {
|
|
257
|
-
z-index: 100;
|
|
258
|
-
flex-direction: column;
|
|
259
|
-
justify-content: right;
|
|
260
|
-
width: 100%;
|
|
261
|
-
height: 0;
|
|
262
|
-
display: flex;
|
|
263
|
-
position: sticky;
|
|
264
|
-
top: 16px;
|
|
265
|
-
right: 16px;
|
|
266
|
-
container: search-panel / inline-size;
|
|
267
|
-
|
|
268
|
-
& [data-editor-widget] {
|
|
269
|
-
z-index: 100;
|
|
270
|
-
flex-shrink: 0;
|
|
271
|
-
align-items: stretch;
|
|
272
|
-
gap: 8px;
|
|
273
|
-
min-width: 260px;
|
|
274
|
-
max-width: 100%;
|
|
275
|
-
margin-inline: auto 16px;
|
|
276
|
-
padding: 4px;
|
|
277
|
-
display: flex;
|
|
278
|
-
position: relative;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
& svg {
|
|
282
|
-
fill: currentColor;
|
|
283
|
-
width: 12px;
|
|
284
|
-
height: 12px;
|
|
285
|
-
display: block;
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
[data-search-grid] {
|
|
290
|
-
grid-template-columns: auto auto auto;
|
|
291
|
-
grid-template-areas: "find matches nav"
|
|
292
|
-
"replace actions .";
|
|
293
|
-
align-items: center;
|
|
294
|
-
gap: 4px 6px;
|
|
295
|
-
width: 100%;
|
|
296
|
-
display: grid;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
[data-input-box][data-find] {
|
|
300
|
-
grid-area: find;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
[data-search-nav] {
|
|
304
|
-
grid-area: nav;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
[data-input-box][data-replace] {
|
|
308
|
-
grid-area: replace;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
[data-replace-actions] {
|
|
312
|
-
grid-area: actions;
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
[data-search-grid][data-mode="find"] {
|
|
316
|
-
grid-template-areas: "find matches nav";
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
[data-search-grid][data-mode="find"] [data-replace-cell] {
|
|
320
|
-
display: none;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
@container search-panel (width < 400px) {
|
|
324
|
-
[data-search-panel] [data-editor-widget] {
|
|
325
|
-
padding: 10px;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
[data-search-grid][data-mode="replace"] {
|
|
329
|
-
grid-template-columns: auto 1fr auto;
|
|
330
|
-
grid-template-areas: "find find find"
|
|
331
|
-
"replace replace replace"
|
|
332
|
-
"nav matches actions";
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
[data-search-grid][data-mode="find"] {
|
|
336
|
-
grid-template-columns: auto 1fr auto;
|
|
337
|
-
grid-template-areas: "find find find"
|
|
338
|
-
"nav matches matches";
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
[data-replace-actions] {
|
|
342
|
-
justify-self: end;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
[data-search-grid] [data-input-box] {
|
|
346
|
-
width: auto;
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
[data-input-box] {
|
|
351
|
-
align-items: center;
|
|
352
|
-
width: 200px;
|
|
353
|
-
display: flex;
|
|
354
|
-
position: relative;
|
|
355
|
-
|
|
356
|
-
& input {
|
|
357
|
-
width: 100%;
|
|
358
|
-
min-width: 0;
|
|
359
|
-
color: var(--diffs-fg);
|
|
360
|
-
background-color: var(--diffs-bg);
|
|
361
|
-
border: 1px solid color-mix(in lab, var(--diffs-fg) 12%, var(--diffs-bg));
|
|
362
|
-
border-radius: 6px;
|
|
363
|
-
outline: none;
|
|
364
|
-
flex-grow: 1;
|
|
365
|
-
padding-inline: 6px;
|
|
366
|
-
font-size: 13px;
|
|
367
|
-
line-height: 24px;
|
|
368
|
-
|
|
369
|
-
&::selection {
|
|
370
|
-
background-color: color-mix(in lab, var(--diffs-fg) 8%, var(--diffs-bg));
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
&:focus-visible {
|
|
374
|
-
outline: 1px solid var(--diffs-modified-base);
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
&[data-find] input {
|
|
379
|
-
padding-inline-end: 72px;
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
& [data-search-icon] {
|
|
383
|
-
--diffs-search-icon-size: 20px;
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
[data-search-toggles] {
|
|
388
|
-
align-items: center;
|
|
389
|
-
gap: 1px;
|
|
390
|
-
display: flex;
|
|
391
|
-
position: absolute;
|
|
392
|
-
top: 50%;
|
|
393
|
-
right: 4px;
|
|
394
|
-
transform: translateY(-50%);
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
[data-matches] {
|
|
398
|
-
white-space: nowrap;
|
|
399
|
-
min-width: 50px;
|
|
400
|
-
color: color-mix(in lab, var(--diffs-fg) 50%, var(--diffs-bg));
|
|
401
|
-
flex-shrink: 0;
|
|
402
|
-
grid-area: matches;
|
|
403
|
-
font-size: 12px;
|
|
404
|
-
font-weight: 500;
|
|
405
|
-
line-height: 20px;
|
|
406
|
-
|
|
407
|
-
&[data-no-matches] {
|
|
408
|
-
color: color-mix(in lab, var(--diffs-fg) 35%, var(--diffs-bg));
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
[data-replace-actions], [data-search-nav] {
|
|
413
|
-
align-items: center;
|
|
414
|
-
display: flex;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
[data-search-icon] {
|
|
418
|
-
appearance: none;
|
|
419
|
-
width: var(--diffs-search-icon-size, 24px);
|
|
420
|
-
height: var(--diffs-search-icon-size, 24px);
|
|
421
|
-
color: color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg));
|
|
422
|
-
border-radius: var(--diffs-search-icon-radius, 4px);
|
|
423
|
-
cursor: pointer;
|
|
424
|
-
background: none;
|
|
425
|
-
border: 0;
|
|
426
|
-
flex-shrink: 0;
|
|
427
|
-
justify-content: center;
|
|
428
|
-
align-items: center;
|
|
429
|
-
margin: 0;
|
|
430
|
-
padding: 0;
|
|
431
|
-
transition: background-color .1s ease-in-out, color .1s ease-in-out;
|
|
432
|
-
display: flex;
|
|
433
|
-
|
|
434
|
-
&:disabled {
|
|
435
|
-
opacity: .25;
|
|
436
|
-
cursor: default;
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
&:not(:disabled):hover {
|
|
440
|
-
color: var(--diffs-fg);
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
&:focus-visible {
|
|
444
|
-
outline: 1px solid var(--diffs-modified-base);
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
&[aria-pressed="true"] {
|
|
448
|
-
color: var(--diffs-modified-base);
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
[data-search-close] {
|
|
453
|
-
--diffs-search-icon-size: 20px;
|
|
454
|
-
--diffs-search-icon-radius: 50%;
|
|
455
|
-
color: var(--diffs-widget-bg);
|
|
456
|
-
background-color: color-mix(in lab,
|
|
457
|
-
var(--diffs-widget-fg) 50%,
|
|
458
|
-
var(--diffs-bg));
|
|
459
|
-
position: absolute;
|
|
460
|
-
top: 0;
|
|
461
|
-
right: 0;
|
|
462
|
-
transform: translate(50%, -50%);
|
|
463
|
-
|
|
464
|
-
&:not(:disabled):hover {
|
|
465
|
-
opacity: 1;
|
|
466
|
-
color: var(--diffs-widget-bg);
|
|
467
|
-
background-color: var(--diffs-widget-fg);
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
`;const zs="//",Fs=["/*","*/"],Hs={sql:{lineComment:"--"},ruby:{lineComment:"#",blockComment:["=begin","=end"]},rst:{lineComment:".."},coffeescript:{lineComment:"#",blockComment:["###","###"]},cmd:{lineComment:"@REM"},julia:{lineComment:"#",blockComment:["#=","=#"]},yaml:{lineComment:"#"},yml:{lineComment:"#"},markdown:{lineComment:null,blockComment:["<!--","-->"]},zsh:{lineComment:"#"},makefile:{lineComment:"#"},handlebars:{lineComment:null,blockComment:["{{!--","--}}"]},ini:{lineComment:";",blockComment:[";"," "]},powershell:{lineComment:"#",blockComment:["<#","#>"]},vb:{lineComment:"'"},xml:{lineComment:null,blockComment:["<!--","-->"]},lua:{lineComment:"--",blockComment:["--[[","]]"]},html:{lineComment:null,blockComment:["<!--","-->"]},diff:{lineComment:"#",blockComment:["#"," "]},r:{lineComment:"#"},fsharp:{blockComment:["(*","*)"]},pug:{lineComment:"//-"},perl:{lineComment:"#"},tex:{lineComment:"%"},clojure:{lineComment:";;"},css:{lineComment:null},python:{lineComment:"#",blockComment:['"""','"""']},dotenv:{lineComment:"#"},dockerfile:{lineComment:"#"},razor:{lineComment:null,blockComment:["<!--","-->"]},prompt:{lineComment:null,blockComment:["<!--","-->"]}};function Us(t,e){const n={...Hs[t],...e?.[t]};return{lineComment:n.lineComment===void 0?zs:n.lineComment,blockComment:n.blockComment??Fs}}function Ws(t,e,n){const i=[],s=new Set;for(const a of e){let c=a.end.line;a.start.line<c&&a.end.character===0&&c--;const h=i.length;let d=1/0;for(let l=a.start.line;l<=c;l++){if(s.has(l))continue;s.add(l);const f=t.getLineText(l),u=f.length-f.trimStart().length,p=u===f.length;p||(d=Math.min(d,u)),i.push({line:l,comment:f.slice(u,u+n.length)===n?u:-1,empty:p,indent:u,single:!1})}if(d!==1/0)for(let l=h;l<i.length;l++)i[l].empty||(i[l].indent=d);i.length===h+1&&(i[h].single=!0)}const r=i.some(a=>a.comment<0&&(!a.empty||a.single)),o=[];if(r){for(const a of i){if(a.empty&&!a.single)continue;const c={line:a.line,character:a.indent};o.push({range:{start:c,end:c},newText:n+" "})}return o}for(const a of i){if(a.comment<0)continue;const c=t.getLineText(a.line),h=a.comment,d=h+n.length+(c[h+n.length]===" "?1:0);o.push({range:{start:{line:a.line,character:h},end:{line:a.line,character:d}},newText:""})}return o}const pt=50;function Vs(t,e,n,i,s){const r=Math.max(0,i-pt),o=t.getTextSlice(r,i),a=t.getTextSlice(s,s+pt),c=o.length-o.trimEnd().length,h=a.length-a.trimStart().length,d=o.length-c;if(o.slice(d-e.length,d)===e&&a.slice(h,h+n.length)===n)return{open:{start:i-c-e.length,end:i-c+(c>0?1:0),text:""},close:{start:s+h-(h>0?1:0),end:s+h+n.length,text:""},contentStart:i,contentEnd:s};const l=s-i<=pt*2?t.getTextSlice(i,s):void 0,f=l??t.getTextSlice(i,i+pt),u=l??t.getTextSlice(s-pt,s),p=f.length-f.trimStart().length,g=s-(u.length-u.trimEnd().length)-n.length;if(f.slice(p,p+e.length)!==e||t.getTextSlice(g,g+n.length)!==n)return;const m=i+p,v=m+e.length+(/\s/.test(f[e.length+p]??"")?1:0),L=g-(/\s/.test(t.getTextSlice(g-1,g))?1:0);return{open:{start:m,end:v,text:""},close:{start:L,end:g+n.length,text:""},contentStart:v,contentEnd:L}}function En(t,e,n,i){let s=0,r=e.length;for(;s<r;){const a=s+r>>>1;e[a].end<t?s=a+1:r=a}let o=n[s];for(let a=s;a<e.length;a++){const c=e[a];if(t<c.start)break;if(c.start===c.end&&t===c.start){if(i<0)break;o+=c.text.length;continue}if(t>c.end){o+=c.text.length-(c.end-c.start);continue}return t===c.end?c.start+o+c.text.length:c.start+o+(i>0?c.text.length:0)}return t+o}function js(t,e,[n,i],s=!1){const r=e.map(l=>{let{start:f,end:u}=l;if(s){let p=u.line;f.line<p&&u.character===0&&p--;const g=t.getLineText(f.line),m=g.length-g.trimStart().length;f={line:f.line,character:m},u={line:p,character:t.getLineLength(p)}}return{from:t.offsetAt(f),to:t.offsetAt(u),direction:l.direction,comment:void 0}});if(s&&r.length>1){r.sort((f,u)=>{const p=f.from-u.from;return p!==0?p:f.to-u.to});let l=0;for(let f=1;f<r.length;f++){const u=r[l],p=r[f];p.from<=u.to?u.to=Math.max(u.to,p.to):r[++l]=p}r.length=l+1}for(const l of r)l.comment=Vs(t,n,i,l.from,l.to);const o=r.every(l=>l.comment!==void 0),a=[];for(const l of r){const f=l.comment;if(o&&f!==void 0){a.push(f.open,f.close);continue}if(f===void 0){if(l.from===l.to){a.push({start:l.from,end:l.to,text:n+" "+i});continue}a.push({start:l.from,end:l.from,text:n+" "},{start:l.to,end:l.to,text:" "+i})}}if(a.length===0)return;a.sort((l,f)=>{const u=l.start-f.start;return u!==0?u:l.end-f.end});const c=a.map(l=>({range:{start:t.positionAt(l.start),end:t.positionAt(l.end)},newText:l.text}));if(s)return{edits:c,nextSelectionOffsets:[]};const h=r.map(l=>{const f=l.comment;return o&&f!==void 0?{start:f.contentStart,end:f.contentEnd,startAssociation:1,endAssociation:-1}:f!==void 0?{start:l.from,end:l.to,startAssociation:1,endAssociation:1}:l.from===l.to?{start:l.from,end:l.to,startAssociation:-1,endAssociation:-1,collapsedInset:n.length+1}:{start:l.from,end:l.to,startAssociation:1,endAssociation:-1}}),d=new Array(a.length+1);d[0]=0;for(let l=0;l<a.length;l++){const f=a[l];d[l+1]=d[l]+f.text.length-(f.end-f.start)}return{edits:c,nextSelectionOffsets:h.map((l,f)=>{const u=En(l.start,a,d,l.startAssociation)+(l.collapsedInset??0);return[u,l.collapsedInset===void 0?En(l.end,a,d,l.endAssociation):u,r[f].direction]})}}function P(t,e,n){const{style:i,dataset:s,children:r,...o}=e??{},a=document.createElement(t);return Object.assign(a,o),i!==void 0&&(typeof i=="string"?a.style.cssText=i:Object.assign(a.style,i)),s!==void 0&&(typeof s=="string"?a.dataset[s]="":Array.isArray(s)?s.forEach(c=>{a.dataset[c]=""}):Object.assign(a.dataset,s)),r!==void 0&&a.replaceChildren(...r),n!==void 0&&n.appendChild(a),a}function N(t,e,n,i){return t.addEventListener(e,n,i),()=>t.removeEventListener(e,n,i)}function U(t,e="line"){const n=t.dataset[e];if(n===void 0)return;const i=parseInt(n,10);if(!Number.isNaN(i))return i}function Tn(t,e){if(t.nodeType===3){const n=t.textContent?.length??0;return Math.max(0,Math.min(e,n))}return t.nodeType===1?Math.max(0,Math.min(e,t.childNodes.length)):0}function qs(t,e){return Object.assign(t,e)}function Ks(t,e){let n;return function(...i){clearTimeout(n),n=setTimeout(()=>t.apply(this,i),e)}}function ct(t,e=1e3){return Math.round(t*e)/e}function $s(t){return t.endsWith(`
|
|
471
|
-
`)||t.endsWith("\r")}function ci(t){if(!(typeof Intl>"u"||typeof Intl.Segmenter!="function"))return new Intl.Segmenter(void 0,t)}let kn,An=!1;function ft(){return An||(kn=ci({granularity:"grapheme"}),An=!0),kn}function Gs(t){const e=t.ownerDocument;let n=t.parentElement;for(;n!=null&&n!==e.body&&n!==e.documentElement;){const i=n.ownerDocument.defaultView?.getComputedStyle(n).overflowY;if(i==="auto"||i==="scroll"||i==="overlay")return n;n=n.parentElement}return e}function Ot(t,e){const n=Ys(t);if(n.length===0)return;const i=[];let s=!1;for(const r of e){if(r.side==="deletions"||r.lineNumber<=0){i.push(r);continue}let o=r.lineNumber-1,a=t.previousLineCount,c=!1;for(const d of n){const l=Math.max(1,a+d.lineDelta),f=Zs(o,d,l);if(f===void 0){c=!0,o=void 0;break}(f!==o||Qs(o,d))&&(c=!0),o=f,a=l}if(o===void 0){s=!0;continue}const h=o+1;if(c){i.push(h===r.lineNumber?r:{...r,lineNumber:h}),s=!0;continue}i.push(r)}return s?i:void 0}function Ys(t){if(t.changedLineChanges!==void 0)return t.changedLineChanges.flatMap(([i,s,r,o=0,a=0,c=!1])=>{if(r===0)return[];const h=Math.max(0,s-i);return[{startLine:i,startCharacter:o,endLine:i+Math.max(0,h-r),deletesEndLine:r<0&&c,insertedLineBreaks:h,lineDelta:r}]});if(t.lineDelta===0)return t.changedLineRanges.flatMap(([i,s])=>{const r=s-i;return r<=0?[]:[{startLine:i,startCharacter:0,endLine:i,deletesEndLine:!1,insertedLineBreaks:r,lineDelta:r}]});const e=Math.max(0,-t.lineDelta),n=t.endedAtDocumentEnd&&t.startLine+e===t.previousLineCount-1;return[{startLine:t.startLine,startCharacter:t.startCharacter,endLine:t.startLine+e,deletesEndLine:n,insertedLineBreaks:Math.max(0,t.lineDelta),lineDelta:t.lineDelta}]}function Zs(t,e,n){if(t<e.startLine)return t;if(t>e.endLine||e.endLine>e.startLine&&t===e.endLine&&!e.deletesEndLine)return t+e.lineDelta;if(e.startLine===e.endLine)return e.startCharacter===0?t+e.insertedLineBreaks:t;if(Js(t,e))return;const i=Math.min(Math.max(0,t-e.startLine),e.insertedLineBreaks);return Xs(e.startLine+i,n)}function Js(t,e){return!(e.lineDelta>=0||t<e.startLine||t>e.endLine||t===e.startLine&&e.startCharacter>0||t===e.endLine&&!e.deletesEndLine)}function Qs(t,e){return e.lineDelta===0||t<e.startLine||t>e.endLine?!1:!(e.endLine>e.startLine&&t===e.endLine&&!e.deletesEndLine)}function Xs(t,e){return Math.max(0,Math.min(t,Math.max(0,e-1)))}function tr(t,e,n){const i=new Map,s=new Map;for(const d of t){const l=d.lineNumber;i.has(l)||i.set(l,[]),s.has(l)||s.set(l,[]),(d.side==="deletions"?s:i).get(l).push(ji(d))}const r=e.parentElement?.previousElementSibling;let o,a;if(r!=null&&r instanceof HTMLElement&&r.dataset.deletions!==void 0)for(const d of r.children){const l=d,{gutter:f,content:u}=l.dataset;f!==void 0?o=l:u!==void 0&&(a=l)}Mn(e,n),a!==void 0&&Mn(a,o);const c=Rn(i,e,n);if(a===void 0)return;const h=Rn(s,a,o);requestAnimationFrame(()=>{er(i,s,c,h)})}function Mn(t,e){const n=[];for(let i=1;i<t.childElementCount;i++){const s=t.children[i];s.dataset.lineAnnotation!==void 0&&(n.push(s),e!==void 0&&n.push(e.children[i]))}for(const i of n)i.remove()}function Rn(t,e,n){const i=new Map;for(const s of e.children){const r=U(s);if(r!==void 0){const o=t.get(r);if(o!==void 0){const a=P("div",{dataset:{lineAnnotation:"0,"+(r-1)},children:[P("div",{dataset:"annotationContent",children:o.map(c=>P("slot",{name:c}))})]});s.after(a),i.set(r,a)}}}if(n!==void 0)for(const s of n.children){const r=U(s,"columnNumber");if(r!==void 0&&t.has(r)){const o=P("div",{dataset:{gutterBuffer:"annotation",bufferSize:"1"},style:{gridRow:"span 1"}});s.after(o)}}return i}function er(t,e,n,i){const s=new Map;for(const[r,o]of t.entries()){const a=i.get(r);if(o.length===0&&a!==void 0){const c=Bn(a);c>0&&s.set(r,c)}}for(const[r,o]of e.entries()){const a=n.get(r);if(o.length===0&&a!==void 0){const c=Bn(a);c>0&&s.set(r,c)}}In(t,n,s),In(e,i,s)}function Bn(t){const e=t.firstElementChild;return e instanceof HTMLElement?e.getBoundingClientRect().height:0}function In(t,e,n){for(const[i,s]of e.entries()){const r=t.get(i),o=n.get(i);r?.length===0&&o!==void 0&&s.style.setProperty("--diffs-annotation-min-height",`${o}px`)}}var nr=class{#e;#t;#r;#n;#a;#l;#c=0;#p=0;#y=0;#u=!0;#b;#m=new Map;#S;#T;constructor(t){this.#S=t.hasActivePopover,this.#T=t.updateActivePopover}setViewportElements(t,e){const n=this.#e!==t||this.#t!==e;this.#e=t,n&&(this.#t=e,this.#u=!0,this.#b?.forEach(i=>i()),this.#b=void 0)}cleanUp(){this.#t=void 0,this.#e=void 0,this.#r=void 0,this.#n=void 0,this.#a=void 0,this.#l=void 0,this.#c=0,this.#p=0,this.#y=0,this.#u=!0,this.#b?.forEach(t=>t()),this.#b=void 0,this.#m.clear()}resetPlacement(t="default"){this.#m.delete(t)}setPlacement(t,e="default"){this.#m.set(e,t)}choosePlacement(t){const{preferred:e,fallback:n,viewport:i,popoverHeight:s,atDocumentEdge:r,placementKey:o="default"}=t,a=this.#m.get(o);let c;if(i!==void 0&&s>0){const h=(d,l=0)=>d.top>=i.top+l&&d.bottom<=i.bottom-l;a==="fallback"&&h(n)&&!h(e,4)||!h(e)&&h(n)?c="fallback":c="preferred"}else c=r?"fallback":"preferred";return this.#m.set(o,c),c}getPlacementBounds(){const t=this.#P();if(t===void 0)return;const e=this.#L();let n,i;if(e!==void 0?(n=e.top,i=e.bottom):(n=0,i=window.innerHeight),n=Math.max(n,t.top),i=Math.min(i,t.bottom),i<=n)return;const s=this.#c,r=this.#p,o=this.#y>0?this.#y:t.width,a=e!==void 0?e.left:0,c=e!==void 0?e.right:window.innerWidth,h=s,d=s+o,l=Math.max(h,a-t.left+s),f=Math.min(d,c-t.left+s);return{top:n-t.top+r,bottom:i-t.top+r,left:l,right:Math.max(l,f)}}#H(){const t=this.#e;if(t===void 0)return;if(this.#n===t&&(this.#r===void 0||this.#r.isConnected))return this.#r;let e=t.parentElement;for(;e!==null;){const n=getComputedStyle(e).overflowY;if(n==="auto"||n==="scroll"||n==="overlay")return this.#r=e,this.#n=t,e;e=e.parentElement}this.#r=void 0,this.#n=t}#o(){if(!this.#u)return;this.#v();const t=this.#t;this.#a=t?.getBoundingClientRect(),this.#c=t?.scrollLeft??0,this.#p=t?.scrollTop??0,this.#y=t?.clientWidth??0,this.#l=this.#H()?.getBoundingClientRect(),this.#u=!1}#P(){return this.#o(),this.#a}#L(){return this.#o(),this.#l}#v(){if(this.#b!==void 0)return;let t;const e=()=>{this.#u=!0,!(!this.#S()||t!==void 0)&&(t=requestAnimationFrame(()=>{t=void 0,this.#T()}))},n=this.#H(),i=this.#t;this.#b=[n!==void 0?N(n,"scroll",e,{passive:!0}):N(window,"scroll",e,{passive:!0}),...i!==void 0?[N(i,"scroll",e,{passive:!0})]:[],N(window,"resize",e,{passive:!0}),()=>{t!==void 0&&(cancelAnimationFrame(t),t=void 0)}]}};function li(t,{gutterWidth:e,placeAbove:n,viewport:i,x:s,y:r}){if(t.style.setProperty("--gutter-width",e+"px"),t.style.setProperty("--popover-x",s+"px"),t.style.setProperty("--popover-y",r+"px"),t.style.setProperty("--popover-y-shift",n?"-100%":"0px"),i===void 0){t.style.removeProperty("--popover-viewport-left"),t.style.removeProperty("--popover-viewport-right"),t.style.removeProperty("--popover-viewport-top"),t.style.removeProperty("--popover-viewport-bottom");return}t.style.setProperty("--popover-viewport-left",i.left+"px"),t.style.setProperty("--popover-viewport-right",i.right+"px"),t.style.setProperty("--popover-viewport-top",i.top+"px"),t.style.setProperty("--popover-viewport-bottom",i.bottom+"px")}const hi=new Map([["'","'"],['"','"'],["`","`"],["{","}"],["[","]"],["<",">"],["(",")"]]),ir=new Set(["'",'"',"`"]),sr=new Set(["{","[","(","<"]);function rr(t,e=0){const n=zn(t.startContainer,t.startOffset),i=zn(t.endContainer,t.endOffset);if(!(n===null||i===null))return{start:n,end:i,direction:e}}function or(t,e,n,i){if(t===void 0)return[[],e];const{start:s,end:r}=e,o=[];let a={...e};const c=s.line!==r.line;let h=r.line;s.line<r.line&&r.character===0&&h--;for(let d=s.line;d<=h;d++){const l=t.getLineText(d);if(l===void 0||c&&l.trim().length===0)continue;const f=l.startsWith(" ")?" ":" ".repeat(n);let u=0,p=f;if(i){if(l.startsWith(" "))u=1;else if(l.startsWith(" ")){const m=l.length-l.trimStart().length;u=Math.min(f.length,m)}if(u===0)continue;p=""}o.push({range:{start:{line:d,character:0},end:{line:d,character:u}},newText:p});const g=p.length-u;d===s.line&&(a={...a,start:{...s,character:Math.max(0,s.character+g)}}),d===r.line&&(a={...a,end:{...r,character:Math.max(0,r.character+g)}})}return[o,a]}function di(t,e,n,i={}){const s=t.lineCount;return e.map(r=>{let{line:o,character:a}=n==="up"||n==="left"?r.start:r.end;if(n==="textStart"||n==="start"||n==="end"){const h=H(r);o=h.line,a=h.character;const d=fi(t,o,a,i);if(n==="textStart"){const l=t.getLineText(o).slice(d.start,d.end),f=d.start+vi(l);a=a===f?d.start:f}else a=n==="start"?d.start:d.end}else if(n==="up"){const h=Pn(t,o,a,-1,i);h!==void 0?(o=h.line,a=h.character):o>0&&(o=i.resolveRenderableLine==null?o-1:i.resolveRenderableLine(o-1,"up")??o)}else if(n==="down"){const h=Pn(t,o,a,1,i);if(h!==void 0)o=h.line,a=h.character;else{const d=Math.max(s-1,0);o<d&&(o=i.resolveRenderableLine==null?o+1:Math.min(i.resolveRenderableLine(o+1,"down")??o,d))}}else if(z(r)){const h=t.getLineLength(o);if(a=Math.min(a,h),n==="left"){if(a>0)a=Bt(t,o,a,!1);else if(o>0){const d=i.resolveRenderableLine==null?o-1:i.resolveRenderableLine(o-1,"up");d!==void 0&&(o=d,a=t.getLineLength(o))}}else if(a<h)a=Bt(t,o,a,!0);else if(o<s-1){const d=i.resolveRenderableLine==null?o+1:i.resolveRenderableLine(o+1,"down");d!==void 0&&(o=Math.min(d,s-1),a=0)}}const c={line:o,character:a};return{start:c,end:c,direction:0}})}function Pn(t,e,n,i,s){if(s.getSoftLineOffsets===void 0)return;const r=fi(t,e,n,s),o=r.index+i;let a=e,c;if(o>=0&&o<r.count)c=Rt(t,a,o,s);else{const u=e+i;if(u<0||u>=t.lineCount)return{line:e,character:n};const p=s.resolveRenderableLine==null?u:s.resolveRenderableLine(u,i<0?"up":"down");if(p===void 0)return{line:e,character:n};a=Math.min(p,t.lineCount-1);const g=cr(t,a,s);c=Rt(t,a,i<0?g-1:0,s)}const h=Math.max(0,n-r.start),d=c.start+h,l=c.index===c.count-1?d:Math.min(d,c.end),f=t.getLineText(a);return{line:a,character:l>f.length?l:ar(f,l)}}function ar(t,e){if(e<=0||e>=t.length)return e;const n=ft();if(n!==void 0){for(const s of n.segment(t)){if(e<=s.index)return e;const r=s.index+s.segment.length;if(e<r)return r}return e}let i=0;for(const s of t){if(e<=i)return e;const r=i+s.length;if(e<r)return r;i=r}return e}function fi(t,e,n,i){const s=t.getLineLength(e),r=i.getSoftLineOffsets?.(e);if(r===void 0||r.length<2)return{start:0,end:s,index:0,count:1};for(let o=0;o+1<r.length;o++){const a=Rt(t,e,o,i);if(n>=a.start&&n<=a.end)return a}return Rt(t,e,n<(r[0]??0)?0:r.length-2,i)}function cr(t,e,n){const i=n.getSoftLineOffsets?.(e);return i===void 0||i.length<2?1:i.length-1}function Rt(t,e,n,i){const s=t.getLineLength(e),r=i.getSoftLineOffsets?.(e);if(r===void 0||r.length<2)return{start:0,end:s,index:0,count:1};const o=r.length-1,a=Math.max(0,Math.min(n,o-1)),c=Math.max(0,Math.min(s,r[a]??0));return{start:c,end:Math.max(c,Math.min(s,r[a+1]??s)),index:a,count:o}}function lr(t,e,n,i={}){return e.map(s=>{const r=s.direction===-1?s.start:s.end,[o]=di(t,[{start:r,end:r,direction:0}],n,i);return ye(s,o)})}function hr(t,e,n,i,s=2,r=!1){if(e[e.length-1]===void 0)return{nextSelections:[]};const o=[];for(const C of e)o.push(C.start,C.end);const a=o.map(C=>t.offsetAt(C)),c=a[(e.length-1)*2],h=a[(e.length-1)*2+1],d=[];let l=!0;for(let C=0;C<e.length;C++){const T={index:C,start:a[C*2],end:a[C*2+1]},w=d[d.length-1];w!==void 0&&(T.start<w.start||T.start===w.start&&T.end<w.end)&&(l=!1),d.push(T)}l||d.sort((C,T)=>{const w=C.start-T.start;if(w!==0)return w;const S=C.end-T.end;return S!==0?S:C.index-T.index});const f=ke(t,n,s),u=[],p=Array.from({length:e.length});let g=0,m;const v=()=>{if(m===void 0)return;const C=ke(t,{start:m.start,end:m.end,text:f.text},s),T=mi(t,C.text,C.start);u.push({start:C.start,end:C.end,text:T});const w=[m.start+g+T.length,m.start+g+T.length];for(const S of m.indices)p[S]=w;g+=T.length-(C.end-C.start),m=void 0};for(const C of d){const T=Math.max(0,C.start+(f.start-c)),w=Math.max(T,C.end+(f.end-h));if(m!==void 0&&T<m.end){m.end=Math.max(m.end,w),m.indices.push(C.index);continue}v(),m={start:T,end:w,indices:[C.index]}}v();const L=t.applyResolvedEdits(u,!0,e,void 0,r),b=De(t,p.map(C=>{if(C===void 0)throw new Error("Missing next selection offsets");return C}));if(t.setLastUndoSelectionsAfter(b),L!==void 0&&i!==void 0){const C=Ot(L,i);C!==void 0&&t.setLastUndoLineAnnotations(i,C)}return{nextSelections:b,change:L}}function dr(t,e){if(e.length!==t.length+2)return;const n=hi.get(e[0]);if(!(n===void 0||e[e.length-1]!==n||e.slice(1,-1)!==t))return 1}function fr(t,e,n,i){const s=e.start+n,r=s+i.length;if(e.end-e.start>0){const o=t.getTextSlice(e.start,e.end),a=dr(o,i)??i.indexOf(o);if(a!==-1&&a+o.length<=i.length){const c=s+a;return[c,c+o.length]}}return[r,r]}function wt(t,e,n,i,s=!1,r="selection"){if(e.length!==n.length)throw new Error("Selection text replacements must match the selection count");const o=[];for(const g of e)o.push(g.start,g.end);const a=o.map(g=>t.offsetAt(g)),c=[];let h=!0;for(let g=0;g<e.length;g++){const m={index:g,start:a[g*2],end:a[g*2+1]},v=c[c.length-1];v!==void 0&&(m.start<v.start||m.start===v.start&&m.end<v.end)&&(h=!1),c.push(m)}h||c.sort((g,m)=>{const v=g.start-m.start;if(v!==0)return v;const L=g.end-m.end;return L!==0?L:g.index-m.index});const d=n.every(g=>g==="");let l;const f=Array.from({length:e.length});if(d){l=[];let g=!1;for(const m of c){if(f[m.index]=[m.end,m.end],m.start>=m.end)continue;g=!0;const v=l[l.length-1];v!==void 0&&m.start<v.end?l[l.length-1]={start:v.start,end:Math.max(v.end,m.end),text:""}:l.push({start:m.start,end:m.end,text:""})}if(!g)return{nextSelections:e};for(const m of c){const v=m.end;let L=0,b=v;for(const C of l){if(v<=C.start)break;if(v>=C.end){L-=C.end-C.start;continue}b=C.start+L;break}b===v&&(b+=L),f[m.index]=[b,b]}}else{l=[];let g=0,m=-1;for(let v=0;v<c.length;v++){const L=c[v];if(L.start<m)throw new Error("Overlapping multi-selection edits are not supported");m=L.end;const b=mi(t,n[r==="document"?v:L.index],L.start);l.push({start:L.start,end:L.end,text:b}),f[L.index]=fr(t,L,g,b),g+=b.length-(L.end-L.start)}}const u=t.applyResolvedEdits(l,!0,e,void 0,s),p=De(t,f.map(g=>{if(g===void 0)throw new Error("Missing next selection offsets");return g}));if(t.setLastUndoSelectionsAfter(p),u!==void 0&&i!==void 0){const g=Ot(u,i);g!==void 0&&t.setLastUndoLineAnnotations(i,g)}return{nextSelections:p,change:u}}function ur(t,e){return t==="never"?!1:t==="brackets"?sr.has(e):t==="quotes"?ir.has(e):!0}function gr(t,e,n,i){if(n.length!==1||e.length===0)return;const s=hi.get(n);if(s===void 0||!ur(i,n))return;const r=[];for(const o of e){if(z(o))return;r.push(n+t.getText(o)+s)}return r}function pr(t,e,n){const i=[],s=[];for(const a of e){const[c,h]=Nr(t,a);if(!z(a)){s.push([c,h]);continue}const{line:d,character:l}=a.start,f=c,u=t.getLineText(d),p=u.length,g=f-l,m=Te(u);let v;if(l>0&&l<p){const L=Lt(u,l,!1,m),b=Lt(u,l,!0,m);v={start:g+L,end:g+b,text:u.slice(l,b)+u.slice(L,l)},s.push([g+b,g+b])}else if(l===p&&m.length>=2){const L=m[m.length-1],b=m[m.length-2];v={start:g+b,end:f,text:u.slice(L,p)+u.slice(b,L)},s.push([f,f])}else if(l===0&&d>0&&p>0){const L=d-1,b=t.getLineText(L),C=b.length,T=t.offsetAt({line:L,character:C}),w=C>0?Lt(b,C,!1,Te(b)):C,S=Lt(u,0,!0,m),E=T-(C-w),x=u.slice(0,S)+t.getTextSlice(T,f)+b.slice(w,C);v={start:E,end:f+S,text:x};const y=E+x.length;s.push([y,y])}else{s.push([c,h]);continue}i.push(v)}if(i.length===0)return{nextSelections:e};i.sort((a,c)=>a.start-c.start);for(let a=1;a<i.length;a++)if(i[a].start<i[a-1].end)throw new Error("Overlapping multi-selection edits are not supported");const r=t.applyResolvedEdits(i,!0,e),o=De(t,s);if(t.setLastUndoSelectionsAfter(o),r!==void 0&&n!==void 0){const a=Ot(r,n);a!==void 0&&t.setLastUndoLineAnnotations(n,a)}return{nextSelections:o,change:r}}function mr(t,e,n){const i=e.map(s=>{const r=Or(t,s);return{start:r.start,end:r.end,direction:0}});return wt(t,i,i.map(()=>""),n)}function vr(t,e,n,i){const s=e.map(r=>{if(!z(r))return{start:r.start,end:r.end,direction:0};const o=H(r),{line:a,character:c}=o,h=n?.(a,c)??0;if(c>h)return{start:{line:a,character:h},end:{line:a,character:c},direction:0};if(a===0)return{start:o,end:o,direction:0};const d=t.getLineLength(a-1);return{start:{line:a-1,character:d},end:{line:a,character:0},direction:0}});return wt(t,s,s.map(()=>""),i)}function Cr(t,e,n){const i=e.map(s=>{const[r,o]=Pr(t,s);return{start:r,end:o,direction:0}});return wt(t,i,i.map(()=>""),n)}function Lr(t,e,n){if(!z(e))return[e.start,e.end];const i=H(e);let{line:s,character:r}=i;const o=t.getLineLength(s),a=t.lineCount;if(r=Math.min(r,o),n)return r<o?[{line:s,character:r},{line:s,character:Bt(t,s,r,!0)}]:s<a-1?[{line:s,character:o},{line:s+1,character:0}]:[i,i];if(r>0)return[{line:s,character:Bt(t,s,r,!1)},{line:s,character:r}];if(s>0){const c=t.getLineLength(s-1);return[{line:s-1,character:c},{line:s,character:0}]}return[i,i]}function br(t,e,n,i,s=2){const r=e.map(o=>{let[a,c]=Lr(t,o,n);if(!n&&z(o)){const h=ke(t,{start:t.offsetAt(a),end:t.offsetAt(c),text:""},s);a=t.positionAt(h.start),c=t.positionAt(h.end)}return{start:a,end:c,direction:0}});return wt(t,r,r.map(()=>""),i)}function z(t){return t.start.line===t.end.line&&t.start.character===t.end.character}function H(t){const{start:e,end:n,direction:i}=t;return i===-1?e:n}function mt(t){return t==="context"||t==="context-expanded"||t==="change-addition"}function Ne(t,e){const n=z(t),i=z(e);return n&&i?D(t.start,e.start)===0:n?D(e.start,t.start)<=0&&D(t.start,e.end)<=0:i?D(t.start,e.start)<=0&&D(e.start,t.end)<=0:D(t.start,e.end)<0&&D(e.start,t.end)<0}function D(t,e){return t.line!==e.line?t.line-e.line:t.character-e.character}function Oe(t,e,n){const i=e===n?0:e<n?1:-1,s=Math.min(e,n),r=Math.max(e,n);return{start:t.positionAt(s),end:t.positionAt(r),direction:i}}function Nn(t,e){let n=0;for(const i of e){if(t<i.start)break;if(t>=i.end)n+=i.text.length-(i.end-i.start);else return i.start+n+i.text.length}return t+n}function de(t,e,n,i){return e.map((s,r)=>{const[o,a]=n[r],c=Nn(o,i),h=Nn(a,i);return Oe(t,s.direction===-1?h:c,s.direction===-1?c:h)})}function ye(t,e){const n=t.direction===-1?t.end:t.start,i=D(n,e.start),s=D(n,e.end);let r=e.end;i<=0?r=e.end:s>=0?r=e.start:r=i===0?e.end:e.start;const o=D(n,r);return{start:o<=0?n:r,end:o<=0?r:n,direction:o===0?0:o<0?1:-1}}function ui(t,e){const n=D(e.start,t.start)<0,i=D(e.end,t.end)>0;return n&&!i?{start:e.start,end:t.end,direction:-1}:i&&!n?{start:t.start,end:e.end,direction:1}:t.direction===-1?{start:e.start,end:t.end,direction:D(e.start,t.end)===0?0:-1}:{start:t.start,end:e.end,direction:D(t.start,e.end)===0?0:1}}function wr(t,e){return gi(t.map(n=>ui(n,e)))}function gi(t){if(t.length<=1)return t;const e=t.map((s,r)=>({index:r,selection:s})).sort((s,r)=>{const o=D(s.selection.start,r.selection.start);if(o!==0)return o;const a=D(s.selection.end,r.selection.end);return a!==0?a:s.index-r.index}),n=[];let i=e[0];for(const s of e.slice(1)){if(Ne(i.selection,s.selection)){const r=s.index>i.index?s:i,o=D(s.selection.start,i.selection.start)<0?s.selection.start:i.selection.start,a=D(s.selection.end,i.selection.end)>0?s.selection.end:i.selection.end;let c=r.selection.direction;c===0&&D(o,a)!==0&&(c=D(r.selection.start,o)===0?-1:1),i={index:r.index,selection:{direction:c,end:a,start:o}};continue}n.push(i),i=s}return n.push(i),n.sort((s,r)=>s.index-r.index).map(({selection:s})=>s)}function On(t){const e=t.map(i=>{let s=i.end.line;return i.end.character===0&&D(i.start,i.end)!==0&&s--,{startLine:i.start.line,endLine:Math.max(i.start.line,s)}}).sort((i,s)=>{const r=i.startLine-s.startLine;return r!==0?r:i.endLine-s.endLine}),n=[];for(const i of e){const s=n.at(-1);s!==void 0&&i.startLine<=s.endLine+1?s.endLine=Math.max(s.endLine,i.endLine):n.push({...i})}return n}function xr(t,e,n,i){const s=r=>{const o=r.line+e;if(o>=n){const a=Math.max(0,n-1);return{line:a,character:i(a)}}return o<0?{line:0,character:0}:{line:o,character:r.character}};return{start:s(t.start),end:s(t.end),direction:t.direction}}function yr(t,e){if(e.length===0)return;const n=e.map(c=>z(c)?Ee(t,c):c),i=n.map(c=>t.getText(c)),s=i[0];if(s.length===0||i.some(c=>c!==s))return;const r=n.map(c=>[t.offsetAt(c.start),t.offsetAt(c.end)]),o=t.findNextNonOverlappingSubstring(s,r);if(o===void 0)return n.some((c,h)=>{const d=e[h];return D(c.start,d.start)!==0||D(c.end,d.end)!==0||c.direction!==d.direction})?n:void 0;const a=Oe(t,o,o+s.length);return[...n,a]}function Sr(t){const e=t.lineCount-1;return{start:{line:0,character:0},end:{line:e,character:t.getLineLength(e)},direction:1}}function Dn(t,e,n){let i=0;if(e){const o=t.lineCount-1;i=n===!0&&o>0&&t.getLineLength(o)===0?o-1:o}const s=e?t.getLineLength(i):0,r={line:i,character:s};return{start:r,end:r,direction:1}}function Er(t,e){if(z(e)){const s=e.start.line;return{start:t.offsetAt({line:s,character:0}),end:s<t.lineCount-1?t.offsetAt({line:s+1,character:0}):t.offsetAt({line:s,character:t.getLineLength(s)})}}const n=t.offsetAt(e.start),i=t.offsetAt(e.end);return n<=i?{start:n,end:i}:{start:i,end:n}}function pi(t,e){return e.map(n=>Er(t,n)).sort((n,i)=>{const s=n.start-i.start;return s!==0?s:n.end-i.end})}function Tr(t,e){return pi(t,e).map(({start:n,end:i})=>t.getTextSlice(n,i))}function Se(t,e){const n=pi(t,e),i=t.eol;let s="",r=-1;for(const o of n)if(!(o.end<=o.start)){if(o.start<=r){o.end>r&&(s+=t.getTextSlice(r,o.end),r=o.end);continue}s.length>0&&!$s(s)&&(s+=i),s+=t.getTextSlice(o.start,o.end),r=o.end}return s}function kr(t,e){if(z(e))return Ar(t,e);const[n,i]=D(e.start,e.end)<=0?[e.start,e.end]:[e.end,e.start];return{start:t.offsetAt(n),end:t.offsetAt(i),text:""}}function Ar(t,e){const n=e.start.line,i=t.offsetAt({line:n,character:0}),s=t.offsetAt({line:n,character:t.getLineLength(n)});return n<t.lineCount-1?{start:i,end:t.offsetAt({line:n+1,character:0}),text:""}:n>0?{start:t.offsetAt({line:n-1,character:t.getLineLength(n-1)}),end:s,text:""}:{start:i,end:s,text:""}}function Mr(t){const e=[];for(const{edit:n}of t){if(n.start>=n.end)continue;const i=e.at(-1);i!==void 0&&n.start<=i.end?e[e.length-1]={start:i.start,end:Math.max(i.end,n.end),text:""}:e.push(n)}return e}function Rr(t,e){const n=Array.from({length:t.length});let i=0,s=0;for(const r of t){for(;i<e.length&&r.edit.start>e[i].end;){const a=e[i];s-=a.end-a.start,i++}const o=e[i];o!==void 0&&r.edit.start>=o.start&&r.edit.start<=o.end?n[r.index]=o.start+s:n[r.index]=r.edit.start+s}return n}function Br(t,e){const n=[...e.map((s,r)=>({index:r,edit:kr(t,s)}))].sort((s,r)=>{const o=s.edit.start-r.edit.start;if(o!==0)return o;const a=s.edit.end-r.edit.end;return a!==0?a:s.index-r.index}),i=Mr(n);return{text:Se(t,e),edits:i,nextSelectionOffsets:Rr(n,i)}}function _n(t,e){const n=Math.max(0,e),i=Ci(t);let s=null;for(const a of i){s=a;const c=Y(a);if(n<=c+(a.textContent?.length??0)){const h=Fn(a,n<c?0:n-c);if(h!==null)return h}}if(s!==null){const a=Fn(s,s.textContent?.length??0);return a!==null?a:[s,0]}let r=0,o=null;for(const a of t.childNodes){if(a.nodeType===1&&a.tagName==="BR")return[a,0];if(a.nodeType!==3)continue;o=a;const c=tt(o.textContent,o.textContent?.length??0);if(n<=r+c)return[o,tt(o.textContent,n-r)];r+=c}return o!==null?[o,tt(o.textContent,o.textContent?.length??0)]:[t,0]}function Ee(t,e){const{line:n,character:i}=e.start,s=t.getLineText(n),r=Ir(s,Math.max(0,Math.min(i,s.length)));return r===void 0?e:{start:{line:n,character:r.start},end:{line:n,character:r.end},direction:1}}function Ir(t,e){const n=ci({granularity:"word"});if(n!==void 0){for(const r of n.segment(t)){if(r.isWordLike!==!0)continue;const o=r.index,a=o+r.segment.length;if(e>=o&&e<=a)return{start:o,end:a}}return}const i=/[\p{Alphabetic}\p{Number}_]+/gu;let s;for(;(s=i.exec(t))!==null;){const r=s.index,o=r+s[0].length;if(e>=r&&e<=o)return{start:r,end:o}}}function Pr(t,e){if(!z(e))return[e.start,e.end];const n=H(e),{line:i,character:s}=n;if(s===0){if(i===0)return[n,n];const h=t.getLineLength(i-1);return[{line:i-1,character:h},{line:i,character:0}]}const r=t.getLineText(i),o=Te(r);let a=s,c;for(;a>0;){const h=Lt(r,a,!1,o),d=r.slice(h,a),l=/\S/.test(d)?new RegExp("\\p{Alphabetic}|\\p{Number}|_","u").test(d)?1:2:0;if(c!==void 0&&l!==c)break;(l!==0||a!==s)&&(c=l),a=h}return[{line:i,character:a},{line:i,character:s}]}function Lt(t,e,n,i){if(n){for(const s of i)if(s>e)return s;return t.length}for(let s=i.length-1;s>=0;s--){const r=i[s];if(r<e)return r}return 0}function Te(t){const e=[0],n=ft();if(n!==void 0){for(const s of n.segment(t))s.index>0&&e.push(s.index);return e}let i=0;for(const s of t)i>0&&e.push(i),i+=s.length;return e}function Bt(t,e,n,i){const s=t.getLineLength(e);if(i){if(n>=s)return s;const d=t.offsetAt({line:e,character:0}),l=t.getTextSlice(d+n,d+s),f=ft();if(f!==void 0){for(const u of f.segment(l))return n+u.segment.length;return s}for(const u of l)return n+u.length;return s}if(n<=0)return 0;const r=t.offsetAt({line:e,character:0}),o=t.getTextSlice(r,r+n);let a=0;const c=ft();if(c!==void 0){for(const d of c.segment(o))a=d.index;return a}let h=0;for(const d of o)a=h,h+=d.length;return a}function Nr(t,e){const n=e.direction===-1;return[t.offsetAt(n?e.end:e.start),t.offsetAt(H(e))]}function Or(t,e){if(!z(e))return{start:e.start,end:e.end};const{line:n,character:i}=e.start,s=t.getLineText(n).length;return i<s?{start:{line:n,character:i},end:{line:n,character:s}}:n<t.lineCount-1?{start:{line:n,character:i},end:{line:n+1,character:0}}:{start:{line:n,character:i},end:{line:n,character:i}}}function mi(t,e,n){if(e!==`
|
|
472
|
-
`&&e!=="\r"&&e!==`\r
|
|
473
|
-
`)return e;const i=t.positionAt(n).line,s=t.getLineText(i),r=vi(s);return r===0?e:e+s.slice(0,r)}function vi(t){let e=0;for(;e<t.length;e++){const n=t.charCodeAt(e);if(n!==32&&n!==9)break}return e}function De(t,e){const n=[];for(const[s,r]of e)n.push(Math.min(s,r),Math.max(s,r));const i=t.positionsAt(n);return e.map(([s,r],o)=>{const a=s===r?0:s<r?1:-1;return{start:i[o*2],end:i[o*2+1],direction:a}})}function ke(t,e,n){if(e.text!==""||e.start!==e.end-1)return e;const i=t.positionAt(e.end);if(i.character===0)return e;const s=t.getLineText(i.line),r=s.slice(0,i.character);if(/[^ \t]/.test(r)||s[i.character-1]===" ")return e;const o=Math.max(0,i.character-n),a=s.slice(o,i.character);return a.length===n&&/^ +$/.test(a)?{...e,start:e.end-a.length}:e}function zn(t,e){let n=t.nodeType===1?t:t.parentElement;for(;n!==null&&It(n)===void 0;)n=n.parentElement;if(n===null)return null;const i=It(n);if(i===void 0)return null;if(t.nodeType===3)return t.parentElement===null?null:Ae(t.parentElement)!==null?{line:i,character:ht(t,e)}:{line:i,character:fe(n,t)+tt(t.textContent,e)};if(t.nodeType===1){const s=t;if(s.tagName==="DIV"){let r=0;for(let o=0;o<e;o++)r=ht(s.childNodes[o]);return{line:i,character:r}}if(s.tagName==="BR")return{line:i,character:0};if(s.tagName==="SPAN"){if(e<s.childNodes.length){const r=s.childNodes[e];if(r?.nodeType===1){const o=Y(r);if(o!==void 0)return{line:i,character:o};const a=Ae(r),c=a===null?void 0:Y(a);if(c!==void 0)return{line:i,character:c}}}return{line:i,character:e>0?ht(s.childNodes[e-1]):fe(n,s)}}return{line:i,character:fe(n,s)}}return null}function Ci(t){const e=[];for(const n of t.childNodes){if(n.nodeType!==1)continue;const i=n;if(i.tagName==="SPAN"){if(Y(i)!==void 0){e.push(i);continue}for(const s of i.childNodes)s.nodeType===1&&Y(s)!==void 0&&e.push(s)}}return e}function Fn(t,e){let n=Math.max(0,e);const i=[{container:t,index:0}];for(;i.length>0;){const s=i[i.length-1];if(s.index>=s.container.childNodes.length){i.pop();continue}const r=s.container.childNodes[s.index];if(s.index++,r.nodeType===3){const o=tt(r.textContent,r.textContent?.length??0);if(n<=o)return[r,n];n-=o}else r.nodeType===1&&i.push({container:r,index:0})}return null}function Li(t,e){let n=0;const i=[{container:t,index:0}];for(;i.length>0;){const s=i[i.length-1];if(s.index>=s.container.childNodes.length){i.pop();continue}const r=s.container.childNodes[s.index];if(r===e)return n;s.index++,r.nodeType===3?n+=tt(r.textContent,r.textContent?.length??0):r.nodeType===1&&i.push({container:r,index:0})}return n}function Dr(t,e){let n=e;for(;n!==null;){if(n===t)return!0;n=n.parentElement}return!1}function fe(t,e){if(e.parentElement===t){let s=0;const r=Array.prototype.indexOf.call(t.childNodes,e);for(let o=0;o<r;o++)s=ht(t.childNodes[o]);return s}for(const s of Ci(t))if(Dr(s,e))return Y(s)+(e.nodeType===3?Li(s,e):0);let n=0,i=e.nodeType===1?e:e.parentElement;for(;i!==null&&i.parentElement!==null&&It(i.parentElement)===void 0;){const s=i.parentElement,r=Array.prototype.indexOf.call(s.childNodes,i);for(let o=0;o<r;o++)n=ht(s.childNodes[o]);i=s}return n}function Ae(t){let e=t;for(;e!==null;){if(It(e)!==void 0)return null;if(Y(e)!==void 0)return e;e=e.parentElement}return null}function ht(t,e){if(t===void 0)return 0;if(t.nodeType===3){const r=t.parentElement;if(r===null)return 0;const o=Ae(r);if(o===null)return 0;const a=Y(o);if(a===void 0)return 0;const c=e===void 0?tt(t.textContent,t.textContent?.length??0):tt(t.textContent,e);return a+Li(o,t)+c}if(t.nodeType!==1)return 0;const n=t;if(n.tagName!=="SPAN"&&n.tagName!=="BR")return 0;const i=Y(n);if(i!==void 0)return i+(n.textContent?.length??0);let s=0;for(const r of n.childNodes)s=Math.max(s,ht(r));return s}function It(t){const{line:e,lineType:n}=t.dataset;if(e!==void 0&&n!=="change-deletion"){const i=parseInt(e,10);if(!Number.isNaN(i))return i-1}}function Y(t){const{char:e}=t.dataset;if(e!==void 0){const n=parseInt(e,10);if(!Number.isNaN(n))return n}}function tt(t,e){const n=t??"",i=n.search(/[\r\n]/);return Math.min(e,i===-1?n.length:i)}const _r=300,zr=100,ue="marker-popover";var Fr=class{#e;#t=[];#r=0;#n;#a;#l;#c;#p;#y;#u;#b=!1;constructor(t){this.#e=t}get markers(){return this.#t}isPopoverVisible(){return this.#u!==void 0}updatePopoverPosition(){const t=this.#u,e=this.#n;if(t===void 0||e===void 0)return;const n=this.#t[t];if(n===void 0){this.removePopover();return}this.#L(e,n.start.line,n.start.character)}setMarkers(t,e){this.#r=e.lineCount,this.#t=t.map(n=>({...n,start:e.normalizePosition(n.start),end:e.normalizePosition(n.end)})),this.removePopover()}listenHover(t){this.#l?.forEach(e=>e()),this.#l=void 0,this.#t.length!==0&&(this.#l=[N(t,"mouseover",e=>{if(this.#e.isMouseDown())return;const n=e.composedPath()[0];if(n===void 0)return;const i=this.#m(n);i!==void 0?this.#H(i):(this.#S(),this.#o())}),N(t,"mouseleave",()=>{this.#S(),this.#o()})])}removePopover(){this.#S(),this.#T(),this.#v()}cleanup(){this.#l?.forEach(t=>t()),this.#l=void 0,this.removePopover(),this.#t=[]}#m(t){const e=t.closest("[data-line]");if(e==null)return;const n=U(e);if(n===void 0)return;let i;if(t.tagName==="SPAN"){const r=t.dataset.char;if(r===void 0||(i=parseInt(r,10),Number.isNaN(i)))return}else if(t.tagName==="BR")i=0;else return;const s={line:n-1,character:i};for(let r=this.#t.length-1;r>=0;r--)if(Ne({start:s,end:s},this.#t[r]))return r}#S(){this.#c!==void 0&&(clearTimeout(this.#c),this.#c=void 0),this.#y=void 0}#T(){this.#p!==void 0&&(clearTimeout(this.#p),this.#p=void 0)}#H(t){if(t===this.#u||t===this.#y){this.#T();return}if(this.#S(),this.#T(),this.#n!==void 0){this.#E(t);return}this.#y=t,this.#c=setTimeout(()=>{this.#c=void 0,this.#y=void 0,this.#E(t)},_r)}#o(){this.#b||(this.#T(),this.#p=setTimeout(()=>{this.#p=void 0,this.#b||this.removePopover()},zr))}#P(t,e,n,i,s=this.#e.popoverManager.getPlacementBounds()){li(t,{gutterWidth:this.#e.getGutterWidth(),placeAbove:i,viewport:s,x:e,y:n})}#L(t,e,n){const{getCharX:i,getLineY:s,getLineHeight:r,popoverManager:o}=this.#e,[a,c]=i(e,n),h=r(),d=s(e)+c*h,l=t.offsetHeight,f={top:d+h,bottom:d+h+l},u={top:d-l,bottom:d},p=e>=this.#r-3,g=o.getPlacementBounds(),m=o.choosePlacement({preferred:f,fallback:u,viewport:g,popoverHeight:l,atDocumentEdge:p,placementKey:ue})==="fallback";this.#P(t,a,m?d:d+h,m,g)}#v(){this.#a?.forEach(t=>t()),this.#a=void 0,this.#n?.remove(),this.#n=void 0,this.#u=void 0,this.#b=!1,this.#e.popoverManager.resetPlacement(ue)}#E(t){if(t===this.#u)return;const e=this.#e.getOverlayElement();if(t>=this.#t.length||e==null)return;const{start:n,message:i,severity:s}=this.#t[t],{line:r,character:o}=n,a=this.#n;if(this.#e.popoverManager.resetPlacement(ue),a!==void 0){Ur(a,s);const c=a.firstElementChild;c?.dataset.markerMessage!==void 0&&(typeof i=="string"?c.textContent=i:i instanceof HTMLElement?c.replaceChildren(i):c.innerHTML=i.html),this.#L(a,r,o),this.#u=t;return}this.#n=P("div",{dataset:{editorWidget:"",markerPopover:"",[Pt(s)]:""},children:[P("div",{dataset:"markerMessage",...typeof i=="string"?{textContent:i}:i instanceof HTMLElement?{children:[i]}:{innerHTML:i.html}})]},e),this.#L(this.#n,r,o),this.#u=t,this.#a=[N(this.#n,"mouseenter",()=>{this.#b=!0,this.#T()}),N(this.#n,"mouseleave",()=>{this.#b=!1,this.#o()})]}};const Hr=["error","warning","info","hint"];function Ur(t,e){for(const n of Hr)delete t.dataset[Pt(n)];t.dataset[Pt(e)]=""}function Pt(t){switch(t){case"error":return"markerError";case"warning":return"markerWarning";case"info":return"markerInfo";case"hint":return"markerHint"}}const _e=new Map([["(",")"],["[","]"],["{","}"]]),bi=new Map([..._e].map(([t,e])=>[e,t])),wi=1e3,xi=5e4;function Wr(t,e,n){const i=Vr(t,e,t.normalizePosition(n));if(i===void 0)return;const s=_e.get(i.char),r=bi.get(i.char);if(s!==void 0)return Un(i,qr(t,e,i,s));if(r!==void 0)return Un(Kr(t,e,i,r),i)}function Vr(t,e,n){const i=jr(n);if(i!==void 0){const s=Hn(t,e,i);if(s!==void 0)return s}return Hn(t,e,n)}function jr(t){if(t.character>0)return{line:t.line,character:t.character-1}}function Hn(t,e,n){const i=t.getLineText(n.line)[n.character];if(!(i===void 0||!_e.has(i)&&!bi.has(i)||$r(e,n)))return{...n,char:i}}function qr(t,e,n,i){let s=0,r=0,o=0;for(let a=n.line;a<t.lineCount;a++){if(r>=wi)return;r++;const c=t.getLineText(a),h=e.getStringCommentRegexpRangesInLine(a),d={index:0},l=a===n.line?n.character:0;for(let f=l;f<c.length;f++){if(o>=xi)return;if(o++,Yr(h,f,d))continue;const u=c[f];if(u===n.char)s++;else if(u===i&&(s--,s===0))return{line:a,character:f,char:u}}}}function Kr(t,e,n,i){let s=0,r=0,o=0;for(let a=n.line;a>=0;a--){if(r>=wi)return;r++;const c=t.getLineText(a),h=e.getStringCommentRegexpRangesInLine(a),d={index:h===null?-1:h.length-1},l=a===n.line?n.character:c.length-1;for(let f=l;f>=0;f--){if(o>=xi)return;if(o++,Zr(h,f,d))continue;const u=c[f];if(u===n.char)s++;else if(u===i&&(s--,s===0))return{line:a,character:f,char:u}}}}function $r(t,e){return Gr(t.getStringCommentRegexpRangesInLine(e.line),e.character)}function Gr(t,e){if(t===null)return!1;for(const[n,i]of t){if(e<n)return!1;if(e<i)return!0}return!1}function Yr(t,e,n){if(t===null)return!1;for(;n.index<t.length&&e>=t[n.index][1];)n.index++;const i=t[n.index];return i!==void 0&&e>=i[0]}function Zr(t,e,n){if(t===null)return!1;for(;n.index>=0&&e<t[n.index][0];)n.index--;const i=t[n.index];return i!==void 0&&e<i[1]}function Un(t,e){if(!(t===void 0||e===void 0))return[Wn(t),Wn(e)]}function Wn(t){return{start:{line:t.line,character:t.character},end:{line:t.line,character:t.character+1}}}const Jr=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
474
|
-
<symbol id="diffs-editor-icon-close" viewBox="0 0 16 16">
|
|
475
|
-
<path fill="currentColor" d="M3.21967 3.21967C3.51256 2.92678 3.98744 2.92678 4.28033 3.21967L8 6.93934L11.7197 3.21967C12.0126 2.92678 12.4874 2.92678 12.7803 3.21967C13.0732 3.51256 13.0732 3.98744 12.7803 4.28033L9.06066 8L12.7803 11.7197C13.0732 12.0126 13.0732 12.4874 12.7803 12.7803C12.4874 13.0732 12.0126 13.0732 11.7197 12.7803L8 9.06066L4.28033 12.7803C3.98744 13.0732 3.51256 13.0732 3.21967 12.7803C2.92678 12.4874 2.92678 12.0126 3.21967 11.7197L6.93934 8L3.21967 4.28033C2.92678 3.98744 2.92678 3.51256 3.21967 3.21967Z"></path>
|
|
476
|
-
</symbol>
|
|
477
|
-
<symbol id="diffs-editor-icon-arrow-up" viewBox="0 0 16 16">
|
|
478
|
-
<path fill="currentColor" transform="rotate(-90 8 8)" d="M8.46967 2.21967C8.17678 2.51256 8.17678 2.98744 8.46967 3.28033L12.4393 7.25H1.75C1.33579 7.25 1 7.58579 1 8C1 8.41421 1.33579 8.75 1.75 8.75H12.4393L8.46967 12.7197C8.17678 13.0126 8.17678 13.4874 8.46967 13.7803C8.76256 14.0732 9.23744 14.0732 9.53033 13.7803L14.7803 8.53033C15.0732 8.23744 15.0732 7.76256 14.7803 7.46967L9.53033 2.21967C9.23744 1.92678 8.76256 1.92678 8.46967 2.21967Z"></path>
|
|
479
|
-
</symbol>
|
|
480
|
-
<symbol id="diffs-editor-icon-arrow-down" viewBox="0 0 16 16">
|
|
481
|
-
<path fill="currentColor" transform="rotate(90 8 8)" d="M8.46967 2.21967C8.17678 2.51256 8.17678 2.98744 8.46967 3.28033L12.4393 7.25H1.75C1.33579 7.25 1 7.58579 1 8C1 8.41421 1.33579 8.75 1.75 8.75H12.4393L8.46967 12.7197C8.17678 13.0126 8.17678 13.4874 8.46967 13.7803C8.76256 14.0732 9.23744 14.0732 9.53033 13.7803L14.7803 8.53033C15.0732 8.23744 15.0732 7.76256 14.7803 7.46967L9.53033 2.21967C9.23744 1.92678 8.76256 1.92678 8.46967 2.21967Z"></path>
|
|
482
|
-
</symbol>
|
|
483
|
-
<symbol id="diffs-editor-icon-case" viewBox="0 0 16 16">
|
|
484
|
-
<path fill="currentColor" d="M12.2969 12.9969C10.7109 12.9969 9.61719 12.0125 9.61719 10.5047C9.61719 9.06719 10.6172 8.16094 12.5 8.15312H14.6641V7.31719C14.6641 6.23906 14.0391 5.64531 12.9297 5.64531C11.875 5.64531 11.2734 6.18437 11.1953 7.00469H9.92969C10.0156 5.56719 10.9922 4.52031 12.9766 4.52031C14.7266 4.52031 16 5.47344 16 7.2V12.8641H14.7109V11.8406H14.6719C14.2578 12.5047 13.5078 12.9969 12.2969 12.9969ZM12.6562 11.8797C13.8047 11.8797 14.6641 11.1609 14.6641 10.1375V9.18437H12.6016C11.4766 9.18437 10.9922 9.71562 10.9922 10.4578C10.9922 11.4266 11.7969 11.8797 12.6562 11.8797Z"></path>
|
|
485
|
-
<path fill="currentColor" d="M1.42188 12.8641H0L3.79688 2H5.1875L8.98438 12.8641H7.54688L6.46875 9.66094H2.5L1.42188 12.8641ZM4.50781 3.60938H4.46875L2.86719 8.55937H6.10156L4.50781 3.60938Z"></path>
|
|
486
|
-
</symbol>
|
|
487
|
-
<symbol id="diffs-editor-icon-whole-word" viewBox="0 0 16 16">
|
|
488
|
-
<path fill="currentColor" d="M11.4089 9.99449C11.1417 9.99449 10.8961 9.95595 10.6722 9.87887C10.4519 9.80179 10.2605 9.69167 10.098 9.54852C9.93551 9.40537 9.81453 9.23469 9.73508 9.03648H9.67007V9.91191H8.5V2H9.70258V5.01721H9.76758C9.81092 4.86671 9.88314 4.7309 9.98426 4.60977C10.089 4.48497 10.2136 4.37853 10.358 4.29043C10.5025 4.19867 10.6668 4.13076 10.851 4.08672C11.0352 4.039 11.2302 4.01514 11.436 4.01514C11.8802 4.01514 12.2648 4.11792 12.5898 4.32347C12.9149 4.52535 13.164 4.81532 13.3374 5.19339C13.5107 5.57146 13.5974 6.02478 13.5974 6.55334V7.45079C13.5974 7.97568 13.5089 8.429 13.332 8.81074C13.1586 9.1888 12.9076 9.48061 12.579 9.68617C12.2504 9.89172 11.8604 9.99449 11.4089 9.99449ZM11.0785 8.99243C11.353 8.99243 11.5859 8.92636 11.7773 8.79422C11.9723 8.66208 12.1204 8.46937 12.2215 8.2161C12.3226 7.95916 12.3732 7.65267 12.3732 7.29663V6.73503C12.3732 6.37164 12.3208 6.06332 12.2161 5.81005C12.115 5.55311 11.9669 5.35673 11.7719 5.22092C11.5769 5.08511 11.3385 5.01721 11.0568 5.01721C10.7824 5.01721 10.5422 5.08328 10.3364 5.21542C10.1341 5.34389 9.97704 5.52925 9.86509 5.77151C9.75675 6.01009 9.70258 6.2964 9.70258 6.63042V7.47281C9.70258 7.77013 9.76036 8.03441 9.87592 8.26566C9.99509 8.49323 10.1576 8.67125 10.3635 8.79972C10.5729 8.92819 10.8113 8.99243 11.0785 8.99243Z"></path>
|
|
489
|
-
<path fill="currentColor" d="M4.70482 9.99449C4.15229 9.99449 3.70087 9.83482 3.35057 9.51548C3.00388 9.19247 2.83054 8.75935 2.83054 8.2161C2.83054 7.70223 3.00207 7.28745 3.34515 6.97178C3.69184 6.65244 4.19562 6.49277 4.8565 6.49277H6.30284V5.94769C6.30284 5.61367 6.20533 5.36774 6.01032 5.20991C5.81531 5.04841 5.55349 4.96765 5.22485 4.96765C5.00817 4.96765 4.82941 4.99702 4.68857 5.05575C4.54773 5.11081 4.43758 5.18789 4.35813 5.28699C4.27868 5.38243 4.22271 5.49621 4.19021 5.62835H3.04722C3.06527 5.3861 3.12305 5.16586 3.22056 4.96765C3.32168 4.76577 3.46252 4.59326 3.64309 4.4501C3.82727 4.30328 4.05297 4.19133 4.32021 4.11425C4.59106 4.03716 4.90525 3.99862 5.26277 3.99862C5.67086 3.99862 6.04463 4.06286 6.38409 4.19133C6.72356 4.31613 6.99441 4.52168 7.19665 4.80798C7.39888 5.09429 7.5 5.4797 7.5 5.96421V9.9064H6.35701V9.1521H6.30284C6.21978 9.29892 6.10783 9.43657 5.96698 9.56504C5.82614 9.69351 5.65099 9.79812 5.44153 9.87887C5.23569 9.95595 4.99012 9.99449 4.70482 9.99449ZM5.07318 9.04749C5.3043 9.04749 5.51196 8.99977 5.69613 8.90434C5.88031 8.80523 6.02657 8.67309 6.13491 8.50791C6.24686 8.34274 6.30284 8.1537 6.30284 7.94081V7.31314H5.04609C4.69579 7.31314 4.43939 7.39206 4.27688 7.5499C4.11798 7.70773 4.03853 7.90961 4.03853 8.15554C4.03853 8.4602 4.14326 8.68594 4.35272 8.83276C4.56578 8.97591 4.80594 9.04749 5.07318 9.04749Z"></path>
|
|
490
|
-
<path fill="currentColor" d="M2.5 12.5L13.5 12.5C14.3284 12.5 15 11.8284 15 11V9.5C15 9.22386 15.2239 9 15.5 9C15.7761 9 16 9.22386 16 9.5V11C16 12.3807 14.8807 13.5 13.5 13.5L2.5 13.5C1.11929 13.5 -7.56324e-07 12.3807 0 11L6.55675e-08 9.5C3.58362e-07 9.22386 0.223858 9 0.5 9C0.776142 9 1 9.22386 1 9.5L1 11C0.999999 11.8284 1.67157 12.5 2.5 12.5Z"></path>
|
|
491
|
-
</symbol>
|
|
492
|
-
<symbol id="diffs-editor-icon-regex" viewBox="0 0 16 16">
|
|
493
|
-
<path fill="currentColor" d="M8.60788 6.59074C8.78227 6.46701 9.02141 6.60508 9.00146 6.81797L8.77564 9.22666C8.76189 9.37331 8.87726 9.5 9.02455 9.5H9.97548C10.1228 9.5 10.2381 9.37331 10.2244 9.22667L9.99858 6.81801C9.97862 6.60513 10.2178 6.46706 10.3922 6.59079L12.3652 7.99066C12.4853 8.07589 12.6527 8.03932 12.7264 7.91177L13.2018 7.08823C13.2755 6.96068 13.2234 6.79742 13.0896 6.73601L10.8907 5.72723C10.6963 5.63807 10.6963 5.36193 10.8907 5.27277L13.0896 4.264C13.2234 4.20258 13.2755 4.03932 13.2018 3.91177L12.7263 3.08824C12.6527 2.96068 12.4853 2.92411 12.3652 3.00934L10.3922 4.40921C10.2178 4.53294 9.97862 4.39486 9.99858 4.18198L10.2244 1.77334C10.2381 1.62669 10.1228 1.5 9.97548 1.5H9.02455C8.87726 1.5 8.76189 1.62669 8.77564 1.77334L9.00146 4.18203C9.02141 4.39491 8.78227 4.53298 8.60788 4.40926L6.63479 3.00934C6.51466 2.92411 6.34726 2.96068 6.27362 3.08823L5.79815 3.91177C5.72451 4.03932 5.77654 4.20258 5.91041 4.26399L8.10929 5.27277C8.30363 5.36193 8.30363 5.63807 8.10929 5.72723L5.91041 6.73601C5.77653 6.79742 5.7245 6.96068 5.79814 7.08824L6.27361 7.91177C6.34725 8.03932 6.51466 8.07589 6.63478 7.99066L8.60788 6.59074Z"></path>
|
|
494
|
-
<path fill="currentColor" d="M4 11C3.44772 11 3 11.4477 3 12V13C3 13.5523 3.44772 14 4 14H5C5.55228 14 6 13.5523 6 13V12C6 11.4477 5.55228 11 5 11H4Z"></path>
|
|
495
|
-
</symbol>
|
|
496
|
-
<symbol id="diffs-editor-icon-replace" viewBox="0 0 16 16">
|
|
497
|
-
<path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M5.28033 5.71967C5.57322 6.01256 5.57322 6.48744 5.28033 6.78033L3.56066 8.5H11.75C12.7165 8.5 13.5 7.7165 13.5 6.75V2.75C13.5 2.33579 13.8358 2 14.25 2C14.6642 2 15 2.33579 15 2.75V6.75C15 8.54493 13.5449 10 11.75 10H3.56066L5.28033 11.7197C5.57322 12.0126 5.57322 12.4874 5.28033 12.7803C4.98744 13.0732 4.51256 13.0732 4.21967 12.7803L1.21967 9.78033C0.926777 9.48744 0.926777 9.01256 1.21967 8.71967L4.21967 5.71967C4.51256 5.42678 4.98744 5.42678 5.28033 5.71967Z"></path>
|
|
498
|
-
</symbol>
|
|
499
|
-
<symbol id="diffs-editor-icon-replace-all" viewBox="0 0 16 16">
|
|
500
|
-
<path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M10.7197 0.21967C11.0126 -0.0732233 11.4874 -0.0732233 11.7803 0.21967L14.7803 3.21967C15.0732 3.51256 15.0732 3.98744 14.7803 4.28033L11.7803 7.28033C11.4874 7.57322 11.0126 7.57322 10.7197 7.28033C10.4268 6.98744 10.4268 6.51256 10.7197 6.21967L12.4393 4.5H4.25C3.2835 4.5 2.5 5.2835 2.5 6.25V6.875C2.5 7.28921 2.16421 7.625 1.75 7.625C1.33579 7.625 1 7.28921 1 6.875V6.25C1 4.45507 2.45508 3 4.25 3H12.4393L10.7197 1.28033C10.4268 0.987437 10.4268 0.512563 10.7197 0.21967ZM5.28033 8.71967C5.57322 9.01256 5.57322 9.48744 5.28033 9.78033L3.56066 11.5H11.75C12.7165 11.5 13.5 10.7165 13.5 9.75V9.125C13.5 8.71079 13.8358 8.375 14.25 8.375C14.6642 8.375 15 8.71079 15 9.125V9.75C15 11.5449 13.5449 13 11.75 13H3.56066L5.28033 14.7197C5.57322 15.0126 5.57322 15.4874 5.28033 15.7803C4.98744 16.0732 4.51256 16.0732 4.21967 15.7803L1.21967 12.7803C0.926777 12.4874 0.926777 12.0126 1.21967 11.7197L4.21967 8.71967C4.51256 8.42678 4.98744 8.42678 5.28033 8.71967Z"></path>
|
|
501
|
-
</symbol>
|
|
502
|
-
</svg>`,Qr=()=>{const t=document.createElement("div");t.innerHTML=Jr;const e=t.firstElementChild;if(e===null||!(e instanceof SVGSVGElement))throw new Error("Failed to create sprite element");return e},Xr=(t,e=16)=>`<svg width="${e}" height="${e}" aria-hidden="true" focusable="false">
|
|
503
|
-
<use href="#diffs-editor-icon-${t}"></use>
|
|
504
|
-
</svg>`;var to=class{#e;#t;#r;#n;#a;#l;constructor(t){const{textDocument:e,containerElement:n,defaultQuery:i,mode:s="find",initialMatch:r,scrollToMatch:o,applyReplace:a,onUpdate:c,onClose:h}=t,d={text:i,replaceText:"",caseSensitive:!1,wholeWord:!1,regex:!1},l={all:[],current:void 0},f=P("div",{dataset:{matches:"",noMatches:""},textContent:"No results"}),u=R=>{l.all=d.text!==""?e.search(d):[];const O=l.all.length===0;if(W.disabled=O,K.disabled=O,O){f.textContent="No results",f.dataset.noMatches="",l.current=void 0,c([]);return}if(delete f.dataset.noMatches,R?.syncSelection===!1){p(c(l.all,{syncSelection:!1}));return}p(c(l.all))};this.#r=u;const p=R=>{if(R===void 0)f.textContent=`${l.all.length} results`;else{const[O,_]=R;f.textContent=`${l.all.findIndex(F=>F[0]===O&&F[1]===_)+1} of ${l.all.length}`}l.current=R},g=(R,O)=>{d[R]=O,u()},m=(R=!1,O=!1)=>{const _=l.all;let F=_[0];if(_.length>0)if(R){const j=l.current?.[0]??0;F=_.at(-1);for(const Z of _)if(Z[1]<=j)F=Z;else break}else{const j=l.current?.[1]??0;for(const Z of _)if(Z[0]>=j){F=Z;break}}F!==void 0&&(p(F),o(F,O)),l.current=F};this.#a=R=>m(R,!0);const v=(R,O)=>({start:R,end:O,text:Bs(_=>e.positionAt(_),_=>e.offsetAt(_),_=>e.getLineText(_),d,R,O)}),L=()=>{if(d.text===""||l.all.length===0)return;let R=l.current;if(R===void 0&&(m(!1,!0),R=l.current,R===void 0))return;const[O,_]=R,F=v(O,_);a([F]),o([O+F.text.length,O+F.text.length],!0),l.current=void 0,u()},b=()=>{d.text===""||l.all.length===0||(a(l.all.map(([R,O])=>v(R,O))),l.current=void 0,u())},C=()=>{this.cleanup(),h()};this.#l=C;const T=R=>P("button",{type:"button",title:R.label,ariaLabel:R.label,dataset:{searchIcon:"",...R.dataset},innerHTML:Xr(R.icon,R.size??16),onclick:R.onClick}),w=(R,O,_)=>{const F=T({icon:R,label:O,size:14,onClick:()=>{const j=!d[_];F.ariaPressed=String(j),g(_,j)}});return F.ariaPressed=String(d[_]),F},S=w("case","Match Case","caseSensitive"),E=w("whole-word","Whole Word","wholeWord"),x=w("regex","Regexp","regex"),y=P("input",{type:"text",placeholder:"Replace",dataset:"replace",value:"",oninput:R=>{d.replaceText=R.target.value},onkeydown:R=>{if(R.isComposing)return;const O=xe(R);R.key==="Escape"?(R.preventDefault(),C()):R.key==="Enter"?(R.preventDefault(),L()):O!==void 0&&(R.preventDefault(),m(O==="previous",!0))}});this.#t=P("input",{type:"text",placeholder:"Search",dataset:"search",value:i,oninput:R=>{d.text=R.target.value,l.current=void 0,u()},onkeydown:R=>{const O=xe(R);R.key==="Escape"?(R.preventDefault(),C()):R.key==="Enter"?(R.preventDefault(),m(R.shiftKey,!0)):O!==void 0?(R.preventDefault(),m(O==="previous",!0)):bt(R)&&(R.key==="f"||R.code==="KeyF")&&(R.preventDefault(),rt(R.altKey?"replace":"find"))}});const k=P("div",{dataset:"searchToggles",children:[S,E,x]}),A=P("div",{dataset:{inputBox:"",find:""},children:[this.#t,k]}),M=P("div",{dataset:{inputBox:"",replace:"",replaceCell:""},children:[y]}),B=P("div",{dataset:{replaceActions:"",replaceCell:""},children:[T({icon:"replace",label:"Replace",onClick:L}),T({icon:"replace-all",label:"Replace All",onClick:b})]}),W=T({icon:"arrow-up",label:"Previous",onClick:()=>{m(!0)}}),K=T({icon:"arrow-down",label:"Next",onClick:()=>{m()}});W.disabled=!0,K.disabled=!0;const Dt=P("div",{dataset:"searchNav",children:[W,K]}),xt=T({icon:"close",label:"Close",onClick:C,dataset:{searchClose:""}}),yt=P("div",{dataset:{searchGrid:"",mode:s},children:[A,M,B,f,Dt,xt]}),rt=R=>{yt.dataset.mode=R,this.#t.focus(),this.#t.select()};this.#n=rt,this.#e=P("div",{dataset:"searchPanel",children:[P("div",{dataset:"editorWidget",children:[yt]})]}),l.current=r,n.before(this.#e),requestAnimationFrame(()=>{r!==void 0?u():c([]),this.#t.select()})}focus(){this.#t.focus()}navigate(t){this.#a?.(t)}updateMatches(t){this.#r?.(t)}setMode(t){this.#n?.(t)}close(){this.#l?.()}cleanup(){this.#e.remove()}},eo=class{#e;#t;#r;constructor(t,e,n){this.#e=P("div",{dataset:{editorWidget:"",selectionActionPopover:""},contentEditable:"false",children:[t]},e),this.#t=this.#e.offsetHeight,this.#r=new ResizeObserver(()=>{const i=this.#e.offsetHeight;i!==this.#t&&(this.#t=i,n())}),this.#r.observe(this.#e)}reposition(t,e,n,i,s,r){this.#e.style.visibility=s?"":"hidden",li(this.#e,{gutterWidth:n,placeAbove:i,viewport:r,x:t,y:e})}get height(){return this.#t}cleanup(){this.#r.disconnect(),this.#e.remove()}};function ut(t){return{selections:t.selections?.map(e=>({start:{...e.start},end:{...e.end},direction:e.direction})),view:t.view===void 0?void 0:{...t.view}}}function no(t){return typeof t=="object"?t:t==="indexedDB"?new oo:new io}var io=class{#e=new Map;get(t){const e=this.#e.get(t);return e===void 0?void 0:ut(e)}set(t,e){this.#e.set(t,ut(e))}};const so="pierre-diffs-editor-state",ro=1,lt="states";var oo=class{#e=ao();async get(t){const e=await this.#e;if(e===void 0)return;const n=await Me(e.transaction(lt,"readonly").objectStore(lt).get(t));return n===void 0?void 0:ut(n)}async set(t,e){const n=await this.#e;n!==void 0&&await Me(n.transaction(lt,"readwrite").objectStore(lt).put(ut(e),t))}};function ao(){try{const t=globalThis.indexedDB;if(t===void 0)return Promise.resolve(void 0);const e=t.open(so,ro);return e.onupgradeneeded=()=>{const n=e.result;n.objectStoreNames.contains(lt)||n.createObjectStore(lt)},Me(e)}catch{return Promise.resolve(void 0)}}function Me(t){return new Promise((e,n)=>{t.onsuccess=()=>e(t.result),t.onerror=()=>n(t.error)})}const co=4096,lo=new RegExp("\\p{Mark}","u");var ho=class{#e;#t;#r;#n=new Map;ch=-1;tabSize=2;lineHeight=20;paddingTop=0;init(t){if(this.#e===t&&this.#t!==void 0&&this.ch!==-1)return;if(this.#e=t,this.#t??=document.createElement("canvas").getContext("2d")??void 0,this.#t===void 0)throw new Error("Could not get canvas context");const e=t.parentElement;if(e!==null){const{paddingTop:c}=getComputedStyle(e);c.endsWith("px")&&(this.paddingTop=parseFloat(c.slice(0,-2)))}const{fontSize:n,fontFamily:i,tabSize:s,lineHeight:r}=getComputedStyle(t);r.endsWith("px")?this.lineHeight=parseFloat(r.slice(0,-2)):n.endsWith("px")&&(this.lineHeight=ct(parseFloat(n.slice(0,-2))*parseFloat(r)));const o=n+" "+i;(this.#r!==o||this.ch===-1)&&(this.#r=o,this.#t.font=o,this.ch=this.canvasMeasureTextWidth("0"),this.clearTextWidthCache());const a=parseInt(s,10);Number.isNaN(a)||(this.tabSize=a)}remeasureCharacterWidth(){if(this.#t===void 0||this.#r===void 0)return!1;this.#t.font=this.#r;const t=this.canvasMeasureTextWidth("0"),e=t!==this.ch;e&&(this.ch=t);const n=this.#l();return e||n}measureTextWidth(t){if(!t.includes(" "))return this.#a(t);if(this.#t===void 0)throw new Error("Metrics not initialized");const e=At(t,this.tabSize);if(e!==-1)return e*this.ch;let n=0,i=0;const s=this.tabSize*this.ch;for(let r=0;r<t.length;r++)if(t.charCodeAt(r)===9){if(r>i&&(n+=this.#a(t.slice(i,r))),s>0){const o=n%s;n+=o===0?s:s-o}i=r+1}return i<t.length&&(n+=this.#a(t.slice(i))),ct(n)}#a(t){return ze(t)?this.domMeasureTextWidth(t):this.canvasMeasureTextWidth(t)}canvasMeasureTextWidth(t){if(this.#t===void 0)throw new Error("Metrics not initialized");return ct(this.#t.measureText(t).width)}domMeasureTextWidth(t){if(this.#e===void 0)throw new Error("Metrics not initialized");const e=t+"|"+this.#r,n=this.#n.get(e);if(n!==void 0)return n;const i=P("span",{style:{position:"absolute",top:"0",left:"0",visibility:"hidden",pointerEvents:"none",whiteSpace:"pre",font:"inherit"},textContent:t},this.#e);let s;try{s=ct(i.getBoundingClientRect().width)}finally{i.remove()}if(this.#n.size>=co){const r=this.#n.keys().next().value;r!==void 0&&this.#n.delete(r)}return this.#n.set(e,s),s}clearTextWidthCache(){this.#l()}#l(){const t=this.#n.size>0;return this.#n.clear(),t}};function ze(t){for(let e=0;e<t.length;e++){const n=t.charCodeAt(e);if(n>=55296&&n<=57343||n===8205||n===65038||n===65039||n>127&&lo.test(t.charAt(e)))return!0}return!1}function fo(t,e){const n=Math.max(0,Math.min(e,t.length));if(n===0||n===t.length||!ze(t))return n;const i=ft();if(i!==void 0){for(const r of i.segment(t)){const o=r.index,a=o+r.segment.length;if(n>o&&n<a)return a;if(n<=o)break}return n}let s=0;for(const r of t){const o=s+r.length;if(n>s&&n<o)return o;if(n<=s)break;s=o}return n}function uo(t){if(!ze(t))return;const e=[0],n=ft();if(n!==void 0){for(const s of n.segment(t))e.push(s.index+s.segment.length);return e}let i=0;for(const s of t)i+=s.length,e.push(i);return e}function At(t,e){let n=0;for(let i=0;i<t.length;i++){const s=t.charCodeAt(i);if(s>127)return-1;n+=s===9?e-n%e:1}return n}const ge=500;let go=0;var po=class{#e;#t;#r;#n="dark";#a="";#l;#c;#p;#y;#u;#b;#m;#S;#T;#H=!1;#o=[et];#P=[];#L=0;#v=[];#E=-1;#g=!0;#M=!1;#C=0;#$=++go;#k=-1;#I=-1;#W;#x=0;#O=[];#h=!1;#V=Ks(async t=>{if(this.#H)return;const{startingLine:e=0,totalLines:n=1/0}=t??{},i=Math.min(n===1/0?1/0:e+n,this.#c.lineCount);if(this.#t===void 0&&!kt(this.#c.languageId)){if(await this.#e.loadLanguage(this.#c.languageId),this.#H)return;this.#t=this.#e.getLanguage(this.#c.languageId)}this.#D(),this.#N(i)},500);#U=({data:t})=>{if(typeof t!="object"||t===null)return;const{type:e,tokenizerId:n,jobId:i}=t;e==="tokenize"&&n===this.#$&&typeof i=="number"&&i===this.#C&&(this.#k>=0?this.#B(i):this.#vt(i))};get themeType(){return this.#n}getStringCommentRegexpRangesInLine(t){if(!this.#m||t<0||t>=this.#c.lineCount||(this.#A(),this.#t===void 0))return null;if(this.#O[t]===void 0){this.#R(t);const e=this.#o[t]??et,n=this.#_(t,e);this.#o[t+1]=n.state}return this.#O[t]??null}constructor({codeOptions:t,highlighter:e,textDocument:n,matchBrackets:i,setStyle:s,onDeferTokenize:r,onThemeChange:o,__debug:a}){const{themeType:c="system",theme:h=Fe,tokenizeMaxLineLength:d=1e3}=t;this.#r=window.matchMedia("(prefers-color-scheme: dark)");let l;if(c==="system"?l=this.#Z():l=c,typeof h!="string"&&c==="system"){const f=new MutationObserver(u=>{for(const{type:p,attributeName:g}of u)if(p==="attributes"&&g!==null&&(g==="class"||g.startsWith("data-"))){const m=this.#Z();this.#Y(h[m],m);break}});f.observe(document.documentElement,{attributes:!0}),f.observe(document.body,{attributes:!0}),this.#T=[N(this.#r,"change",()=>{const u=this.#Z();this.#Y(h[u],u)}),()=>f.disconnect()]}this.#e=e,this.#c=n,this.#p=d,this.#y=s,this.#u=r,this.#b=o,this.#m=i!==!1,this.#S=a??!1,this.#A(),this.#l=[],this.#f(typeof h=="string"?h:h[l],typeof h=="string"?void 0:l)}#Y(t,e){t===this.#a&&e===this.#n||(this.#f(t,e),this.stopBackgroundTokenize(),this.#o=[et],this.#P=[],this.#L=0,this.#v=[],this.#t!==void 0&&this.#c.lineCount>0&&this.#w(0),this.#b?.())}#Z(){try{if(typeof document<"u"&&typeof getComputedStyle=="function"&&document.body!=null){const t=getComputedStyle(document.body).colorScheme.split(/\s+/),e=t.includes("dark");if(e!==t.includes("light"))return e?"dark":"light"}}catch{}return this.#r.matches?"dark":"light"}syncTheme(t){const{themeType:e="system",theme:n=Fe}=t;if(typeof n=="string"){const r=this.#e.getTheme(n).type;if(n===this.#a&&r===this.#n)return;this.#Y(n,r);return}const i=e==="system"?this.#Z():e,s=n[i];i===this.#n&&s===this.#a||this.#Y(s,i)}#f(t,e){const{theme:n,colorMap:i}=this.#e.setTheme(t),{colors:s={}}=this.#e.getTheme(t),r=s["editor.selectionBackground"],o=s["editor.lineHighlightBackground"],a=o!=null&&o.trim()!==""&&!$i.isFullyTransparent(o)?o:void 0,c=s["editor.lineHighlightBorder"]??(a==null?"color-mix(in lab, var(--diffs-bg) 70%, var(--diffs-fg))":"transparent"),h=a==null?"100%":"85%",d=s["editorCursor.foreground"],l=s["editor.findMatchBackground"],f=s["editor.findMatchHighlightBackground"],u=s["editorBracketMatch.background"],p=s["editorBracketMatch.border"],g=s["editorHint.foreground"],m=s["editorInfo.foreground"],v=s["editorWarning.foreground"],L=s["editorError.foreground"];this.#y(`:host {
|
|
505
|
-
--diffs-editor-selection-bg: ${r??"var(--diffs-line-bg)"};
|
|
506
|
-
--diffs-editor-line-highlight-border: ${c};
|
|
507
|
-
--diffs-editor-active-line-source-mix: ${h};
|
|
508
|
-
--diffs-editor-match-bg: ${l??"initial"};
|
|
509
|
-
--diffs-editor-match-highlight-bg: ${f??"initial"};
|
|
510
|
-
--diffs-editor-bracket-match-bg: ${u??"initial"};
|
|
511
|
-
--diffs-editor-bracket-match-border: ${p??"initial"};
|
|
512
|
-
--diffs-editor-cursor-fg: ${d??"initial"};
|
|
513
|
-
--diffs-editor-hint-fg: ${g??"initial"};
|
|
514
|
-
--diffs-editor-info-fg: ${m??"initial"};
|
|
515
|
-
--diffs-editor-warning-fg: ${v??"initial"};
|
|
516
|
-
--diffs-editor-error-fg: ${L??"initial"};
|
|
517
|
-
}`),this.#a=t,this.#n=e??n.type,this.#l=i}#D(){if(this.#a==="")return;const{colorMap:t}=this.#e.setTheme(this.#a);this.#l=t}cleanUp(){this.#H=!0,this.stopBackgroundTokenize(),this.#j(),this.#T?.forEach(t=>t()),this.#T=void 0}tokenize(t,e,n=!1){if(this.#A(),this.#D(),this.#t===void 0&&!kt(this.#c.languageId))throw new Error(`Grammar for language "${this.#c.languageId}" not loaded`);this.#m&&(this.#O.length=Math.min(this.#O.length,t.startLine));const{lineCount:i}=this.#c,{startingLine:s=0,totalLines:r=1/0}=e??{},o=r===1/0?i:Math.min(s+r,i),a=t.startLine,c=Math.max(s,a),h=e!==void 0&&r!==1/0&&t.lineDelta>0&&a<o&&t.endLine>=o,d=t.lineDelta===0&&(t.changedLineChanges?.every(([,,x])=>x===0)??!0),l=n&&t.lineDelta!==0&&a>=s,f=d||e===void 0||a>=c,u=t.changedLineRanges??[[a,t.endLine]];this.#P=[],this.#L=0,this.#v=[];let p=-1;if(a<c)for(const[x,y]of u)x<c&&(p=Math.max(p,Math.min(y,c-1)));const g=p>=a&&(d||t.lineDelta<0);d?this.#R(a):(this.#F(t),(e===void 0||a>=c)&&this.#R(c));let m=0,v=u[m][1],L,b=0,C=d?u[m][0]:c,T=!1;const w=new Map,S=g?new Map:void 0;if(S!==void 0&&!d){const x=Math.min(p+1,c,o);if(x>a){this.#R(x);let y=a,k=this.#o[y]??et;for(;y<x;y++){const A=this.#_(y,k);k=A.state,S.set(y,A.resolvedTokens)}this.#o[x]=k}}let E=this.#o[C]??et;for(;C<o;){const x=d?this.#o[C+1]:l?this.#J(C+1):void 0;f&&(this.#o[C]=E);const{resolvedTokens:y,state:k}=this.#_(C,E);if(E=k,C>=c?w.set(C,y):S?.set(C,y),f&&(this.#o[C+1]=E),T=C>=v&&(d||l)&&x!==void 0&&E.equals(x),T){m++;const A=u[m];if(A===void 0)break;if(A[0]>=o){L=A[0],b=m;break}let M=this.#o[A[0]];if(l)for(let B=C+2;B<=A[0]&&(M=this.#J(B),M!==void 0);B++)this.#o[B]=M;M===void 0?(v=A[1],C++):(C=A[0],E=M,v=A[1]),T=!1;continue}C++}if(f&&(C<o?this.#o[C+1]=E:this.#o[C]=E),T&&l&&L===void 0){for(let x=C+2;x<=i;x++){const y=this.#J(x);if(y===void 0)break;this.#o[x]=y}this.#P=[],this.#L=0,this.#v=[]}if(S!==void 0&&S.size>0&&this.#u(S,this.#n),L!==void 0)this.#w(L,u,b);else if(!T&&C<i){const x=h&&a>=c?o:a<c&&!d?a:C;this.#w(x,u,m)}return w}prebuildStateStack(t){this.#A(),this.#V(t)}stopBackgroundTokenize(){this.#I=-1,!this.#g&&(this.#g=!0,this.#M=!1,this.#E=-1,this.#k=-1,this.#W=void 0,this.#x=0,this.#P=[],this.#L=0,this.#v=[],this.#j())}pauseBackgroundTokenize(){this.#g||this.#M||(this.#S&&console.log("[diffs/editor] background tokenization paused",{jobId:this.#C}),this.#M=!0)}resumeBackgroundTokenize(){this.#g||!this.#M||this.#t===void 0||this.#E<0||(this.#S&&console.log("[diffs/editor] background tokenization resumed",{jobId:this.#C}),this.#M=!1,this.#X(this.#C))}#A(){this.#t===void 0&&!kt(this.#c.languageId)&&this.#e.getLoadedLanguages().includes(this.#c.languageId)&&(this.#t=this.#e.getLanguage(this.#c.languageId))}#s(){this.#h||(globalThis.addEventListener("message",this.#U),this.#h=!0)}#j(){this.#h&&(globalThis.removeEventListener("message",this.#U),this.#h=!1)}#X(t){globalThis.postMessage({type:"tokenize",tokenizerId:this.#$,jobId:t})}#w(t,e,n=0){if(kt(this.#c.languageId))return;const i=++this.#C;this.#S&&console.log("[diffs/editor] background tokenization scheduled",{jobId:i,startLine:t,changedLineRanges:e,changedRangeIndex:n}),this.#g=!1,this.#M=!1,this.#E=t,this.#k>=0&&(this.#I=Math.max(this.#I,this.#k)),this.#k=-1,this.#W=e,this.#x=n,this.#s(),this.#X(i)}#N(t){if(this.#t===void 0||this.#o.length>t)return;if(!this.#g){this.#k>=0?this.#k=Math.max(this.#k,t):this.#I=Math.max(this.#I,t);return}const e=++this.#C;this.#g=!1,this.#M=!1,this.#E=this.#o.length-1,this.#k=t,this.#I=-1,this.#W=void 0,this.#x=0,this.#s(),this.#X(e)}#_(t,e){const n=this.#c.getLineText(t);if(n.length>this.#p)return console.warn(`[diffs] Line(${t}) too long to tokenize: ${n.length}`),this.#z(t,null),{resolvedTokens:[[0,"",n]],state:e};if(this.#t===void 0||n===""||n.trim()==="")return this.#z(t,null),{resolvedTokens:[[0,"",n]],state:e};const i=pe(this.#t,this.#l,n,e,ge,this.#m);return this.#z(t,i.bracketIgnoredRanges),{resolvedTokens:i.resolvedTokens,state:i.ruleStack}}#z(t,e){this.#m&&(this.#O[t]=e)}#F(t){const e=t.changedLineChanges??[[t.startLine,t.endLine,t.lineDelta]],n=t.startLine+1;n<=this.#o.length-n?(this.#P=this.#o,this.#L=0,this.#o=this.#o.slice(0,n)):(this.#L=n,this.#P=this.#o.slice(n),this.#o.length=Math.min(this.#o.length,n)),this.#v=e}#J(t){let e=t;for(let n=this.#v.length-1;n>=0;n--){const[i,s,r]=this.#v[n];if(r!==0){if(e>s)e-=r;else if(e>i)return this.#o[t]}}return this.#P[e-this.#L]??this.#o[t]}#R(t,e){const n=Math.min(Math.max(0,t),this.#c.lineCount);if(this.#o.length>n||this.#t===void 0)return!0;const i=e===void 0?0:performance.now();let s=this.#o.length-1,r=this.#o[s]??et;for(;s<n;){this.#o[s]=r;const o=this.#c.getLineText(s);if(o.length<=this.#p&&o!==""&&o.trim()!==""){const a=pe(this.#t,this.#l,o,r,ge,this.#m,!1);this.#z(s,a.bracketIgnoredRanges),r=a.ruleStack}else this.#z(s,null);if(s++,this.#o[s]=r,e!==void 0&&performance.now()-i>e)break}return s>=n}#B(t){if(this.#g||this.#M||this.#t===void 0||t!==this.#C)return;this.#D();const e=this.#R(this.#k,1);if(!(this.#g||this.#M||t!==this.#C)){if(e){this.stopBackgroundTokenize();return}this.#E=this.#o.length-1,this.#X(t)}}#vt(t){if(this.#g||this.#M||this.#t===void 0||t!==this.#C)return;this.#D();const e=performance.now(),n=new Map,i=this.#c.lineCount,s=this.#W;let r=this.#E,o=this.#o[r]??et,a=!1,c=this.#x,h=s?.[c]?.[1];for(;r<i;){this.#o[r]=o;const d=h!==void 0?this.#J(r+1):void 0,l=this.#c.getLineText(r);if(l.length>this.#p)console.warn(`[diffs] Line(${r}) too long to tokenize: ${l.length}`),n.set(r,[[0,"",l]]),this.#z(r,null);else if(l===""||l.trim()==="")n.set(r,[[0,"",l]]),this.#z(r,null);else{const f=pe(this.#t,this.#l,l,o,ge,this.#m);n.set(r,f.resolvedTokens),this.#z(r,f.bracketIgnoredRanges),o=f.ruleStack}if(this.#o[r+1]=o,a=h!==void 0&&r>=h&&d!==void 0&&o.equals(d),r++,a){c++;const f=s?.[c];if(f===void 0)break;if(h=f[1],this.#o[f[0]]===void 0)a=!1;else{r=f[0],o=this.#o[r]??o,a=!1;continue}}if(performance.now()-e>1)break}if(this.#u(n,this.#n),!(this.#g||this.#M||t!==this.#C)){if(a||r>=i){const d=this.#I;this.stopBackgroundTokenize(),d>=0&&this.#N(d);return}this.#E=r,this.#x=c,this.#X(t)}}};function pe(t,e,n,i,s,r=!0,o=!0){const a=t.tokenizeLine2(n,i,s);a.stoppedEarly&&console.warn(`[diffs] Time limit reached when tokenizing line: ${n.substring(0,100)}`);const c=a.tokens,h=c.length/2,d=[],l=[];if(!o&&!r)return{ruleStack:a.ruleStack,resolvedTokens:d,bracketIgnoredRanges:l};for(let f=0;f<h;f++){const u=c[2*f],p=f+1<h?c[2*f+2]:n.length;if(u===p)continue;const g=c[2*f+1];if(o){const m=He.getForeground(g);d.push([u,e[m],n.slice(u,p)])}r&&He.getTokenType(g)>0&&l.push([u,p])}return{ruleStack:a.ruleStack,resolvedTokens:d,bracketIgnoredRanges:l}}function me(t){return t.map(([e,n,i])=>e===0&&n===""?i===""?P("br"):i:P("span",{dataset:{char:e.toString()},style:`color:${n};`,textContent:i}))}function kt(t){return t==="text"||t==="ansi"}function mo(t){const e=t.getSelection?.();if(e==null||e.rangeCount===0)return;const n=e.getRangeAt(0);return{collapsed:n.collapsed,startContainer:n.startContainer,startOffset:n.startOffset,endContainer:n.endContainer,endOffset:n.endOffset}}function nt(t){if(typeof t.cacheKey!="string"||t.cacheKey.length===0)throw new Error(`Editor persistState requires a non-empty file.cacheKey for "${t.name}". Provide a unique, stable cacheKey for every editable file.`);return t.cacheKey}function ve(t){return typeof t=="object"&&t!==null&&"then"in t&&typeof t.then=="function"}const vo=2,Co=1e4,Ce="selection-action",Le="application/vnd.pierre.diffs-selections+json";var Ao=class{#e;#t=new ho;#r;#n;#a=new Map;#l;#c;#p=new Map;#y;#u=0;#b=!1;#m;#S;#T;#H;#o={generation:0,callback:void 0,delivered:!1};#P;#L;#v;#E=new Map;#g=new Map;#M=new Map;#C;#$;#k;#I;#W;#x;#O;#h;#V;#U;#Y;#Z;#f;#D;#A;#s;#j;#X;#w;#N;#_;#z=!0;#F=!1;#J=!1;#R=!1;#B;#vt=!1;#Ct=!1;#st=!1;#Pt=!1;#G;#Lt="";#bt;#Nt;#i;#Q;#tt;#ht;#St=!1;#dt=!1;#at=!1;#Ot=!1;#ft;#Ce=(t,e)=>{if(this.#f?.updateRenderCache(t,e),this.#j!==void 0&&this.#j.totalLines!==1/0){const{startingLine:n,totalLines:i}=this.#j,s=Math.min(n+i,this.#s?.lineCount??0);for(const[r,o]of t)if(r>=n&&r<s){const a=this.#lt(r);a!==void 0&&a.replaceChildren(...me(o))}}};constructor(t={}){this.#e=t}setOptions(t){const e=this.#e.persistStateStorage??"inMemory",n={...this.#e,...t};if(n.persistState===!0&&this.#f?.type==="file"){const i=this.#f.__getCurrentFile?.()??this.#D;i!==void 0&&nt(i)}this.#e=n,this.#e.persistState!==!0&&(this.#a.clear(),this.#u++,this.#b=!1),(this.#e.persistStateStorage??"inMemory")!==e&&(this.#u++,this.#l=void 0,this.#c=void 0,this.#p.clear())}edit(t){if(this.#e.persistState===!0&&t.type==="file"){const e=t.__getCurrentFile?.();e!==void 0&&nt(e)}return this.#_t(),this.#f=t,this.#Se(),this.#H=t.attachEditor(this),()=>this.cleanUp()}applyEdits(t,e=!0){const n=this.#s;if(n==null)throw new Error("Editor is not attached");const i=this.#R,s=this.#i,r=s?.map(h=>[n.offsetAt(h.start),n.offsetAt(h.end)]),o=s===void 0?void 0:n.resolveEdits(t).sort((h,d)=>h.start-d.start),a=n.applyEdits(t,e,s);if(a===void 0)return;let c;s!==void 0&&r!==void 0&&o!==void 0&&(c=de(n,s,r,o),e&&n.setLastUndoSelectionsAfter(c)),this.#K(a,c,this.#it(a),{skipFocus:!i})}get canUndo(){return this.#s?.canUndo??!1}get canRedo(){return this.#s?.canRedo??!1}undo(){this.#Ft("undo")}redo(){this.#Ft("redo")}getFile(){const t=this.#D,e=this.#s;if(t===void 0||e===void 0)return;const n={...t};return Object.defineProperty(n,"contents",{enumerable:!0,get:()=>e.getText()}),n}getText(){return this.#s?.getText()??""}getState(){const t=this.#f;return{selections:this.#i,view:t!=null?{scrollLeft:t.getCodeScrollLeft(),scrollTop:this.#ye()}:void 0}}setState({selections:t,view:e}){if(this.#f===void 0||this.#s===void 0)throw new Error("Editor is not attached");if(this.#z=!1,this.#d(t??[]),e!=null){this.#f.setCodeScrollLeft(e.scrollLeft),e.scrollTop!==void 0&&this.#Jt(e.scrollTop);return}this.#nt()}setSelections(t){const e=this.#s;if(e===void 0)throw new Error("Text document is not initialized");const n=t.map(s=>{let r=e.normalizePosition(s.start),o=e.normalizePosition(s.end),a=s.direction==="none"?0:s.direction==="backward"?-1:1;return D(r,o)>0&&([r,o]=[o,r],a!==0&&(a=a===1?-1:1)),{direction:a,start:r,end:o}});this.#z=!1,this.#d(n);const i=n.at(-1);i!==void 0&&this.#ct(H(i).line),this.#nt()}setMarkers(t){const e=this.#s;if(e===void 0)throw new Error("Text document is not initialized");if(t.length===0){this.#w?.cleanup(),this.#w=void 0,this.#d(this.#i??[]);return}this.#w??=new Fr({popoverManager:this.#Tt(),getLineHeight:()=>this.#t.lineHeight,getOverlayElement:()=>this.#V,getGutterWidth:()=>this.#ot(),getCharX:(n,i)=>this.#mt(n,i),getLineY:n=>this.#pt(n),isMouseDown:()=>this.#st||this.#Ct}),this.#w.setMarkers(t,e),this.#h!==void 0&&this.#w.listenHover(this.#h),this.#d(this.#i??[])}focus(t){const e=t?.preventScroll??!1,n=t?.lineNumber;if(n==="first-visible"||typeof n=="number"){const s=this.#s;if(s==null||this.#f==null)return;const r=n==="first-visible"?this.#Pe(t?.offset):n;if(r==null)return;const o=s.normalizePosition({line:r-1,character:n==="first-visible"?0:t?.character??0});this.#Ne(o,e);return}const i=this.#i?.at(-1);if(i!==void 0){const s=i.direction===-1?i.end:i.start;this.#q(s,e)}else this.#q(void 0,e)}blur(){this.#B=void 0,this.#R=!1,this.#F=!1,this.#h?.blur()}cleanUp(t=!1){this.#_t(),t||(this.#o.delivered=!1);const e=this.#f!=null,n=this.#e.persistState===!0;this.#u++,this.#$t(),e&&(this.#b=n),We(this.#Xt),this.#r?.cleanUp(),this.#r=void 0,t||(this.#s=void 0,this.#D=void 0),this.#S?.forEach(i=>i()),this.#S=void 0,this.#m?.forEach(i=>i()),this.#m=void 0,this.#T?.forEach(i=>i()),this.#T=void 0,this.#H?.(t),this.#H=void 0,this.#L=void 0,this.#v=void 0,this.#E.clear(),this.#g.clear(),this.#M.clear(),this.#C=void 0,this.#$?.remove(),this.#$=void 0,this.#k?.remove(),this.#k=void 0,this.#I?.remove(),this.#I=void 0,this.#W?.remove(),this.#W=void 0,this.#x=void 0,this.#n?.cleanUp(),this.#n=void 0,this.#O=void 0,this.#h?.removeAttribute("contentEditable"),this.#h=void 0,this.#B=void 0,this.#R=!1,this.#V?.remove(),this.#V=void 0,this.#Z?.disconnect(),this.#Z=void 0,this.#Ot=!1,this.#ft!==void 0&&(cancelAnimationFrame(this.#ft),this.#ft=void 0),this.#Zt(),this.#f=void 0}__prepareFile(t){if(this.#e.persistState!==!0)return t;const e=nt(t),n=this.#D,i=t.lang??zt(t.name);n!==void 0&&(nt(n)!==e||n.name!==t.name||this.#s?.languageId!==i)&&(this.#u++,this.#$t());const s=this.#qt(t,e);return s===void 0||s.getText()===t.contents?t:{...t,contents:s.getText()}}__postponeBgTokenizeToNextFrame(){const t=this.#r;t!==void 0&&(t.pauseBackgroundTokenize(),requestAnimationFrame(()=>{t.resumeBackgroundTokenize()}))}__captureFocusForDOMReplacement(){const t=this.#h,e=this.#x?.shadowRoot?.activeElement;t!=null&&(this.#R||e===t||e!=null&&t.contains(e))&&(this.#B={})}__syncRenderView=(t,e,n,i,s)=>{const r=this.#f;if(r==null)return;const o=e.shadowRoot;if(o==null){console.error("[editor] Could not find the shadow root.");return}let a,c,h;for(const p of o.querySelectorAll("[data-code]"))if(p.dataset.deletions===void 0){a=p;for(const g of p.children){const m=g,{gutter:v,content:L}=m.dataset;v!==void 0?c=m:L!==void 0&&(h=m)}break}if(a===void 0||h===void 0){this.#B=void 0;return}this.#Tt().setViewportElements(e,a),this.#x!==e&&(this.#x=e,this.#$!==void 0&&e.appendChild(this.#$),this.#k!==void 0&&o.appendChild(this.#k),this.#I!==void 0&&o.appendChild(this.#I),this.#W!==void 0&&o.prepend(this.#W));const d=this.#s===void 0||this.#D===void 0||this.#D.name!==n.name||this.#D.lang!==n.lang||this.#D.cacheKey!==n.cacheKey,l=this.#e.persistState===!0?nt(n):void 0;let f;if(d){this.#_t();let p="";"contents"in n?p=n.contents:p=n.additionLines.join("");const g=new si({maxEntries:this.#e.historyMaxEntries}),{name:m,lang:v,cacheKey:L}=n,b=v??zt(n.name),C=l!==void 0?this.#qt(n,l):void 0,T=r.type==="file"||C?.getText()===p?C:void 0,w=T??new Is(n.name,p,b,0,g);this.#D={name:m,lang:v,cacheKey:L},this.#s=w,l!==void 0&&(this.#a.set(l,w),f={cacheKey:l,textDocument:w}),this.#r?.cleanUp(),this.#r=void 0,this.#Zt(),this.#g.clear(),this.#i=this.#Nt,this.#e.__debug===!0&&console.log(T!==void 0?"[diffs/editor] cached text document reused for":"[diffs/editor] text document rebuilt from",n.name)}f===void 0&&this.#b&&l!==void 0&&this.#s!==void 0&&(f={cacheKey:l,textDocument:this.#s});const u=this.#s;if(this.#r==null&&u!=null&&(this.#r=new po({highlighter:t,textDocument:u,codeOptions:this.#f?.__getEffectiveCodeOptions()??{},matchBrackets:this.#e.matchBrackets,onDeferTokenize:this.#Ce,onThemeChange:()=>this.#De(),setStyle:p=>{this.#I.textContent=p},__debug:this.#e.__debug})),this.#h!==h&&(this.#O=c,this.#h=qs(h,{contentEditable:"true",role:"textbox",ariaMultiLine:"true",autocapitalize:"off",writingSuggestions:"off",autocorrect:!1,spellcheck:!1,translate:!1}),this.#V!==void 0&&h.after(this.#V),this.#t.init(h),this.#Be(),this.#Ee(h,c),this.#h!==void 0&&this.#e.__debug===!0&&console.log("[diffs/editor] full re-render triggered !!!")),this.#B!=null&&(this.#B.target=h),h.ariaLabel!==n.name&&(h.ariaLabel=n.name),i!==void 0&&i.length>0||this.#et)for(const p of this.#h.children){const g=p,{lineAnnotation:m,lineType:v,separator:L}=g.dataset;(m!==void 0||L!==void 0||v==="change-deletion")&&g.setAttribute("contenteditable","false")}if(this.#Dt(),this.#r?.syncTheme(this.#f?.__getEffectiveCodeOptions()??{}),this.#A=i,this.#j=s,this.#X=s?.totalLines,this.#r?.prebuildStateStack(s),this.#w?.removePopover(),(this.#i!==void 0||this.#Q!==void 0||this.#w!==void 0)&&this.#d(this.#i??[]),this.#Nt!==void 0&&this.#Y!==void 0?(this.#Nt=void 0,this.#nt(!1,"center")):this.#tt!==void 0?this.#Ut(this.#tt,this.#ht,this.#dt):this.#B!==void 0?this.#Ht():this.#i!==void 0&&this.#i.length>0&&this.#R&&!this.#at&&this.focus({preventScroll:!0}),this.#at&&this.#N?.focus(),this.#e.__debug===!0&&s!==void 0){const{startingLine:p,totalLines:g}=s;console.log("[diffs/editor] render file:",n.name,"RenderRange:",p+"-"+(p+g),"of",this.#s?.lineCount,"lines")}f!==void 0&&(this.#b=!1,this.#Le(f.cacheKey,f.textDocument)),this.#xe(r)};#qt(t,e){const n=this.#a.get(e),i=t.lang??zt(t.name);return n?.languageId===i?n:void 0}#Kt(){const t=this.#e.persistStateStorage??"inMemory";return(this.#l===void 0||this.#c!==t)&&(this.#l=no(t),this.#c=t),this.#l}#$t(){const t=this.#D,e=this.#s;if(this.#e.persistState!==!0||this.#f===void 0||t===void 0||e===void 0)return;const n=nt(t);this.#a.set(n,e);let i;try{i=this.#Kt()}catch{return}const s=ut(this.getState()),r=this.#y;if(r?.cacheKey===n&&r.textDocument===e){if(this.#y=void 0,e.version===r.documentVersion&&this.#i===r.selections&&s.view?.scrollLeft===r.view?.scrollLeft&&s.view?.scrollTop===r.view?.scrollTop)return;this.#Gt(i,n,s,r.completion);return}this.#Gt(i,n,s)}#Gt(t,e,n,i){const s=this.#p.get(e);if(i!==void 0||s!==void 0){let o=i??Promise.resolve();s!==void 0&&(o=o.then(()=>s)),this.#Yt(e,o.then(()=>t.set(e,n)));return}let r;try{r=t.set(e,n)}catch{return}ve(r)&&this.#Yt(e,r)}#Yt(t,e){const n=e.catch(()=>{});this.#p.set(t,n),n.finally(()=>{this.#p.get(t)===n&&this.#p.delete(t)})}#Le(t,e){const n=++this.#u,i=e.version,s=this.#i,r=this.getState().view;let o;const a=l=>{const f=this.getState().view;if(n!==this.#u||this.#s!==e||e.version!==i||this.#i!==s||f?.scrollLeft!==r?.scrollLeft||this.#D===void 0||nt(this.#D)!==t)return;const u=o?.userScrolled()===!0;if(l===void 0){this.#f?.setCodeScrollLeft(0),u||this.#Jt(0);return}const p=ut(l);u&&p.view!==void 0&&(p.view={scrollLeft:p.view.scrollLeft}),this.setState(p)},c=()=>{let l;try{l=this.#Kt().get(t)}catch{return}if(ve(l))return l.then(a).catch(()=>{});try{a(l)}catch{}},h=this.#p.get(t),d=h===void 0?c():h.then(c);if(ve(d)){o=this.#be();const l={cacheKey:t,textDocument:e,documentVersion:i,selections:s,view:r,completion:d.catch(()=>{})};this.#y=l,l.completion.finally(()=>{o?.dispose(),this.#y===l&&(this.#y=void 0)})}}#be(){const t=this.#kt();if(!(t instanceof HTMLElement))return;let e=!1;const n=["wheel","touchstart","mousedown"],i=()=>{for(const r of n)t.removeEventListener(r,s,{capture:!0})},s=()=>{e=!0,i()};for(const r of n)t.addEventListener(r,s,{capture:!0,passive:!0});return{userScrolled:()=>e,dispose:i}}#wt(t){return this.#f?.isLineRenderable?.(t+1)??!0}get#we(){const t=this.#f;if(t?.getNearestRenderableLine!=null)return(e,n)=>{const i=t.getNearestRenderableLine(e+1,n);return i==null?void 0:i-1}}#ct(t){this.#wt(t)||this.#f?.revealLine?.(t+1)}get#Et(){return this.#f?.options.diffStyle??"split"}get#et(){return this.#f?.type==="file-diff"}get#rt(){return this.#f?.options.overflow==="wrap"}#Tt(){return this.#n??=new nr({hasActivePopover:()=>this.#_!==void 0||this.#w?.isPopoverVisible()===!0,updateActivePopover:()=>{this.#Wt(),this.#w?.updatePopoverPosition()}})}#Dt(){this.#E.clear(),this.#M.clear(),this.#C=void 0}#Zt(){this.#yt(null),this.#L=void 0,this.#v=void 0,this.#F=!1,this.#J=!1,this.#U?.forEach(t=>t.remove()),this.#U=void 0,this.#i=void 0,this.#bt=void 0,this.#tt=void 0,this.#w?.cleanup(),this.#w=void 0,this.#N?.cleanup(),this.#N=void 0,this.#_?.cleanup(),this.#_=void 0,this.#z=!0}#_t(){const t=this.#o;t.generation++,t.callback!=null&&(We(t.callback),t.callback=void 0)}#xe(t){const e=this.#o,n=this.#s;if(e.delivered||e.callback!=null||n==null)return;const{generation:i}=e,s=()=>{if(e.callback!==s||(e.callback=void 0,i!==e.generation||this.#f!==t||this.#s!==n))return;const r=this.#h,o=this.#x?.shadowRoot;r==null||o==null||!o.contains(r)||(e.delivered=!0,this.#e.onAttach?.(this,t))};e.callback=s,St(s)}#kt(){const t=this.#f?.getEditorViewport?.();if(t!==void 0)return t;const e=this.#x;if(!(this.#f==null||e==null))return Gs(e)}#ye(){const t=this.#kt();return t instanceof HTMLElement?t.scrollTop:t?.defaultView?.scrollY??0}#Jt(t){const e=this.#kt();e instanceof HTMLElement?e.scrollTop=t:e instanceof Document&&e.defaultView?.scrollTo({top:t})}#Se(){this.#$=P("style",{dataset:"editorGlobalCss",textContent:`
|
|
518
|
-
[data-annotation-slot] {
|
|
519
|
-
user-select: none;
|
|
520
|
-
-webkit-user-select: none;
|
|
521
|
-
}
|
|
522
|
-
`}),this.#k=P("style",{dataset:"editorCss",textContent:_s}),this.#I=P("style",{dataset:"editorThemeCss"}),this.#W=Qr(),this.#V=P("div",{dataset:"editorOverlay"});const t=n=>{const i=n.composedPath()[0];return i instanceof Node&&this.#h?.contains(i)===!0},e=()=>{this.#B!=null&&(this.#B=void 0,this.#R=!1,this.#F=!1)};this.#S=[N(document,"focusin",n=>{t(n)||e()},{passive:!0}),N(document,"pointerdown",n=>{t(n)||queueMicrotask(e)},{capture:!0,passive:!0}),N(document,"selectionchange",()=>{const n=this.#x?.shadowRoot;if(this.#F||this.#J||n==null||!this.#R||this.#i!==void 0&&this.#i.length>1&&!this.#st)return;const i=document.getSelection();if(i==null)return;const s=typeof i.getComposedRanges=="function"?i.getComposedRanges({shadowRoots:[n]})?.[0]:mo(n);if(s===void 0||!this.#$e(s))return;let r=rr(s,0);if(r!==void 0){if(this.#st&&this.#Pt&&this.#i!==void 0&&this.#i.length>0){const o=this.#i.at(-1);this.#d([ui(o,r)]);return}if(this.#st)this.#G!==void 0?r=ye(this.#G,r):this.#G=r;else if(this.#G!==void 0)r.direction=ye(this.#G,r).direction;else if(this.#i!==void 0&&this.#i.length===1){const o=this.#i[0];D(o.start,r.start)===0&&D(o.end,r.end)===0&&(r.direction=o.direction)}this.#bt!==void 0?this.#d([...this.#bt.filter(o=>!Ne(o,r)),r]):this.#d([r])}},{passive:!0}),N(document,"pointerup",n=>{n.pointerType==="mouse"&&(this.#T?.forEach(i=>i()),this.#T=void 0,this.#Ct&&(this.#Ct=!1,this.#q()),this.#F=!1,this.#st=!1,this.#Pt=!1,this.#G=void 0,this.#bt=void 0,this.#e.enabledSelectionAction===!0&&this.#i!==void 0&&this.#i.length>0&&!z(this.#i.at(-1))&&this.#d(this.#i))},{passive:!0}),N(document,"keydown",n=>{n.key==="Shift"&&(this.#G=this.#i?.at(-1))},{passive:!0}),N(document,"keyup",n=>{n.key==="Shift"&&(this.#G=void 0)},{passive:!0})]}#zt(t){this.#T?.forEach(e=>e()),this.#T=t}#Qt(){return this.#f?.options.enableLineSelection===!0}#At(){this.#J=this.#i!==void 0}#Ee(t,e){const{onFocus:n,onBlur:i}=this.#e,s=o=>{const a=o.composedPath()[0];return a!==void 0&&(a===t||t.contains(a))};this.#m?.forEach(o=>o()),this.#m=[N(t,"focus",()=>{this.#R=!0,n?.(),!this.#st&&!this.#F&&this.#i!==void 0&&this.#i.length>0&&this.#xt(this.#i.at(-1))},{passive:!0}),N(t,"blur",()=>{this.#B?.target===t&&(this.#B=void 0,this.#F=!1),this.#R=!1,i?.()},{passive:!0}),N(t,"pointerdown",o=>{if(this.#z=!0,this.#J=!1,o.pointerType==="mouse"){if(this.#Oe(o)){this.#Rt(!0),this.#i!==void 0&&this.#d([]);return}if(this.#Rt(!1),this.#w?.removePopover(),Ve()&&this.#A!==void 0&&this.#A.length>0){const a=[...t.querySelectorAll("[data-line-annotation]")].map(c=>[N(c,"mouseenter",()=>{this.#F=!0}),N(c,"mouseleave",()=>{this.#F=!1})]).flat();this.#zt(a)}if(this.#st=!0,this.#G=void 0,o.button===0&&bt(o)&&(this.#bt=this.#i?.map(a=>({...a}))),o.shiftKey){const a=this.#i?.at(-1);if(a!==void 0){const c=a.direction===-1?a.end:a.start;this.#xt({start:c,end:c,direction:0})}this.#Pt=!0}}},{passive:!0}),N(t,"keydown",o=>{if(!s(o))return;this.#z=!0,this.#J=!1;const a=Ds(o,this.#e.keymap);if(a!==void 0){o.preventDefault(),a==="simplifySelection"&&(this.#N?.close(),this.#N=void 0,this.#at=!1,this.#_?.cleanup(),this.#_=void 0),this.#Ft(a);return}const c=Ps(o),h=this.#s;if(this.#i!==void 0&&this.#i.length>0&&c!==void 0&&h!==void 0){const d={getSoftLineOffsets:this.#rt?l=>this.#jt(l):void 0,resolveRenderableLine:this.#we};o.shiftKey?this.#d(lr(h,this.#i,c,d)):this.#d(di(h,this.#i,c,d)),this.#nt(),o.preventDefault();return}if((o.key.length===1?o.key.toLowerCase():o.key)==="v"&&bt(o)){if(o.repeat&&this.#et){o.preventDefault();return}if(this.#e.clipboard!==void 0){o.preventDefault(),St(this.#Xt);return}}if(this.#N!==void 0){const d=xe(o);if(d!==void 0){o.preventDefault(),this.#N.navigate(d==="previous");return}}}),N(t,"copy",o=>{s(o)&&(o.preventDefault(),this.#ce()?o.clipboardData?.setData("text",this.#le()):this.#ge(o.clipboardData,this.#He(),this.#ue()))}),N(t,"cut",o=>{if(s(o))if(o.preventDefault(),this.#ce())o.clipboardData?.setData("text",this.#le());else{const a=this.#ue();this.#ge(o.clipboardData,this.#Ue(),a)}}),N(t,"paste",o=>{if(!s(o))return;o.preventDefault();const a=o.clipboardData,c=this.#s;if(a===null||c===void 0)return;let h=a.getData("text");const d=this.#i?.length??0;if(d>1){const l=a.getData(Le);if(l!==void 0)try{const f=JSON.parse(l);Array.isArray(f)&&f.length===d&&(h=f)}catch{}}this.#gt(Array.isArray(h)?h.map(l=>c.normalizeEol(l)):c.normalizeEol(h),void 0,!0,"document")}),N(t,"beforeinput",o=>{s(o)&&o.inputType!=="insertCompositionText"&&(o.preventDefault(),this.#ee(o.inputType,o.data))}),N(t,"drop",o=>{s(o)&&o.preventDefault()}),N(t,"compositionstart",o=>{s(o)&&(this.#vt=!0,this.#F=!0)},{passive:!0}),N(t,"compositionend",o=>{if(!s(o))return;this.#F=!1;const a=this.#vt;this.#vt=!1,(o.data!==""||!a)&&this.#ee("insertText",o.data)},{passive:!0})];const r=this.#x?.shadowRoot?.querySelector("[data-deletions]");if(r!=null&&this.#m.push(N(r,"pointerdown",o=>{const a=o.composedPath();if(je(a)){this.#At();return}const c=a[0],h=c instanceof HTMLElement?c.closest("[data-column-number]"):null;if(h instanceof HTMLElement){if(this.#Qt()){this.#At();return}if(this.#ae(h,r,o.pointerType==="mouse"))return}this.#Rt(!0),this.#i!==void 0&&this.#d([])},{passive:!0})),e!==void 0){const o=(c,h=!1)=>{let d=c;return d?.dataset.lineNumberContent!==void 0?d=d.parentElement??void 0:h&&d?.tagName==="SPAN"&&(d=d.closest("[data-line]")),d},a=c=>{if(c===void 0)return;const h=c.dataset.lineType,d=U(c)??U(c,"columnNumber");if(!(d===void 0||h===void 0||!mt(h)))return d-1};this.#m.push(N(e,"pointerdown",c=>{const h=c.composedPath();if(je(h)){this.#At();return}const d=o(h[0]);if(d!==void 0&&this.#Qt()){this.#At();return}if(d?.dataset.lineType==="change-deletion"){const p=d.closest("[data-code]");p!=null&&this.#ae(d,p,c.pointerType==="mouse");return}if(c.pointerType!=="mouse")return;const l=this.#s,f=a(d);if(f===void 0||l===void 0)return;this.#z=!0,this.#w?.removePopover();const u=this.#se(f,f,l);this.#Ct=!0,this.#G=u,this.#d([u]),this.#xt(u),this.#q(),this.#zt([N(document,"mousemove",p=>{if(!this.#Ct)return;const g=this.#s,m=a(o(p.composedPath()[0],!0));if(m===void 0||g===void 0)return;const v=this.#G?.start.line??m,L=this.#se(v,m,g);this.#G??=L,this.#d([L]),this.#q(L.direction===-1?L.start:L.end)},{passive:!0})])},{passive:!0}))}this.#w?.listenHover(t),this.#Z?.disconnect(),this.#Z=new ResizeObserver(this.#Re),this.#Z.observe(t),this.#Z.observe(t.parentElement),this.#te(t)}#Xt=async()=>{const t=this.#e.clipboard;if(t!==void 0){let e=await t.readText();const n=this.#i?.length??0;if(n>1){const s=await t.readText(Le);try{const r=JSON.parse(s);Array.isArray(r)&&r.length===n&&(e=r)}catch{}}const i=this.#s;i!==void 0&&this.#gt(Array.isArray(e)?e.map(s=>i.normalizeEol(s)):i.normalizeEol(e),void 0,!0,"document")}};#te(t){this.#et&&this.#Et==="split"&&this.#rt&&(this.#P={top:t.offsetTop,left:t.offsetLeft-this.#ot()},this.#e.__debug===!0&&console.log("[diffs/editor] content offset:",this.#P))}get#ut(){if(this.#et&&this.#Et==="split"&&this.#rt)return this.#P}#Ft(t){const e=this.#s;if(e!==void 0)switch(t){case"openSearchPanel":this.#fe("find");break;case"openSearchReplacePanel":this.#fe("replace");break;case"findNextMatch":{const n=this.#i;if(n===void 0)break;if(n.some(z)){const i=n.map(s=>z(s)?Ee(e,s):s);this.#d(i),this.focus()}else{const i=yr(e,n);if(i!==void 0){this.#d(i);const s=i.at(-1);s!==void 0&&this.#ct(H(s).line),this.#nt()}}break}case"moveLineUp":case"moveLineDown":this.#Me(t==="moveLineUp"?-1:1);break;case"copyLineUp":case"copyLineDown":this.#ke(t==="copyLineUp"?-1:1);break;case"simplifySelection":{const n=this.#i,i=n?.at(-1);if(n===void 0||i===void 0)break;if(n.length>1)this.#d([i]),this.#q(H(i));else if(!z(i)){const s=H(i);this.#d([{start:s,end:s,direction:0}]),this.#q(s)}break}case"insertBlankLine":this.#Ae();break;case"deleteHardLineForward":this.#qe();break;case"toggleComment":case"toggleBlockComment":{const n=this.#i;if(n===void 0)break;const{lineComment:i,blockComment:s}=Us(e.languageId,this.#e.languageCommentConfig);if(t==="toggleComment"&&i!==null){this.#Mt(Ws(e,n,i));break}const r=t==="toggleComment",o=js(e,n,s,r);o!==void 0&&this.#Mt(o.edits,r?void 0:a=>o.nextSelectionOffsets.map(([c,h,d])=>({start:a.positionAt(c),end:a.positionAt(h),direction:d})));break}case"indent":case"outdent":case"indentLess":case"indentMore":if(this.#i!==void 0){const n=[],i=[],s=new Set,r=[];for(const a of this.#i){const c=a.start.line,h=t==="outdent"||t==="indentLess",d=t==="indentLess"||t==="indentMore";if(c!==a.end.line||h||d){const l=or(e,a,this.#t.tabSize,h);for(const f of l[0]){const u=f.range.start.line;s.has(u)||(s.add(u),n.push(f))}i.push(l[1])}else{const l=e.charAt({line:c,character:0})===" "?" ":" ".repeat(this.#t.tabSize);n.push({range:a,newText:l}),r.push({line:c,startCharacter:a.start.character,addedLength:l.length-(a.end.character-a.start.character),selectionIndex:i.length});const f={line:a.start.line,character:a.start.character+l.length};i.push({start:f,end:f,direction:0})}}for(const a of r){let c=0;for(const h of r)h.line===a.line&&h.startCharacter<a.startCharacter&&(c+=h.addedLength);if(c!==0){const h=i[a.selectionIndex],d={line:a.line,character:h.start.character+c};i[a.selectionIndex]={start:d,end:d,direction:0}}}const o=e.applyEdits(n,!0,this.#i,i);o!==void 0&&this.#K(o,i)}break;case"selectAll":{const n=Sr(e);this.#d([n]),this.focus();const i=this.#me(),s=i[0]?.[0],r=i.at(-1)?.[1];s!==void 0&&r!==void 0&&(this.#J=!0,this.#xt({start:{line:s,character:0},end:{line:r,character:e.getLineLength(r)},direction:1}));break}case"moveCursorToDocStart":case"moveCursorToDocEnd":{const n=Dn(e,t==="moveCursorToDocEnd",this.#et);this.#d([n]),this.#ct(H(n).line),this.#nt()}break;case"expandSelectionDocStart":case"expandSelectionDocEnd":{const n=t==="expandSelectionDocEnd",i=this.#i;if(i!==void 0){const s=Dn(e,n,this.#et);this.#d(wr(i,s)),this.#ct(H(s).line),this.#nt()}}break;case"undo":case"redo":this.#Te(t);break}}#Te(t){const e=this.#s;if(e===void 0||t==="undo"&&!e.canUndo||t==="redo"&&!e.canRedo)return;const n=this.#i,i=n?.map(d=>[e.offsetAt(d.start),e.offsetAt(d.end)]),s=t==="undo"?e.undo():e.redo();if(s===void 0)return;const[r,o,a,c]=s,h=o??(n!==void 0&&i!==void 0&&c!==void 0?de(e,n,i,c):void 0);this.#K(r,h,a)}#Mt(t,e){const n=this.#s,i=this.#i;if(n===void 0||i===void 0)return;const s=e===void 0,r=s?i.map(h=>[n.offsetAt(h.start),n.offsetAt(h.end)]):void 0,o=s?t.map(h=>{const d=n.offsetAt(h.range.start),l=n.offsetAt(h.range.end);return{start:Math.min(d,l),end:Math.max(d,l),text:h.newText}}).sort((h,d)=>{const l=h.start-d.start;return l!==0?l:h.end-d.end}):void 0,a=n.applyEdits(t,!0,i,void 0,!0);if(a===void 0)return;const c=s?de(n,i,r,o):e(n);n.setLastUndoSelectionsAfter(c),this.#K(a,c,this.#it(a))}#ke(t){const e=this.#s,n=this.#i;if(e===void 0||n===void 0)return;const i=On(n);if(i.length===0)return;const s=[];let r=0;const o=[];for(const c of i){s.push(r);const h=c.endLine-c.startLine+1;r+=h;const d=e.getText({start:{line:c.startLine,character:0},end:{line:c.endLine,character:e.getLineLength(c.endLine)}});if(t>0){const l={line:c.startLine,character:0};o.push({range:{start:l,end:l},newText:d+e.eol})}else if(c.endLine<e.lineCount-1){const l={line:c.endLine+1,character:0};o.push({range:{start:l,end:l},newText:d+e.eol})}else{const l={line:c.endLine,character:e.getLineLength(c.endLine)};o.push({range:{start:l,end:l},newText:e.eol+d})}}const a=n.map(c=>{const h=c.start.line;let d=0,l=i.length-1;for(;d<=l;){const g=d+l>>>1,m=i[g];if(h<m.startLine)l=g-1;else if(h>m.endLine)d=g+1;else{d=g;break}}const f=Math.max(0,d<=l?d:l),u=i[f],p=s[f]+(t>0?u.endLine-u.startLine+1:0);return{start:{...c.start,line:c.start.line+p},end:{...c.end,line:c.end.line+p},direction:c.direction}});this.#Mt(o,()=>a)}#Ae(){const t=this.#s,e=this.#i;if(t===void 0||e===void 0)return;const n=e.map(c=>H(c).line),i=Array.from(new Set(n)).sort((c,h)=>c-h),s=new Map,r=new Map,o=[];for(let c=0;c<i.length;c++){const h=i[c],d=t.getLineText(h),l=/^\s*/.exec(d)?.[0]??"";s.set(h,c),r.set(h,l);const f={line:h,character:t.getLineLength(h)};o.push({range:{start:f,end:f},newText:t.eol+l})}const a=e.map((c,h)=>{const d=n[h],l={line:d+1+s.get(d),character:r.get(d).length};return{start:l,end:l,direction:0}});this.#Mt(o,()=>a)}#Me(t){const e=this.#s,n=this.#i;if(e===void 0||n===void 0)return;const i=On(n);if(i.length===0||t<0&&i[0].startLine===0||t>0&&i.at(-1).endLine>=e.lineCount-1)return;const s=e.lineCount,r=f=>f<s-1?{line:f+1,character:0}:{line:f,character:e.getLineLength(f)},o=(f,u)=>{const p=f.map(g=>e.getLineText(g)).join(e.eol);return u?p+e.eol:p},a=[];if(t<0)for(const f of i){const u=f.startLine-1,p=[];for(let g=f.startLine;g<=f.endLine;g++)p.push(g);a.push({range:{start:{line:u,character:0},end:r(f.endLine)},newText:o([...p,u],f.endLine<s-1)})}else for(let f=i.length-1;f>=0;f--){const u=i[f],p=u.endLine+1,g=[];for(let m=u.startLine;m<=u.endLine;m++)g.push(m);a.push({range:{start:{line:u.startLine,character:0},end:r(p)},newText:o([p,...g],p<s-1)})}const c=i.at(-1),h=t>0&&c.endLine===s-2?e.getLineLength(c.endLine):e.getLineLength(s-1),d=n.map(f=>xr(f,t,s,u=>u===s-1?h:e.getLineLength(u))),l=e.applyEdits(a,!0,n,d,!0);l!==void 0&&this.#K(l,d)}#Re=()=>{const t=this.#A?.length??0,e=this.#L,n=this.#v;this.#L=void 0,this.#v=void 0;const i=this.#ot()!==e,s=this.#Vt()!==n;!i&&!s||(this.#M.clear(),this.#C=void 0,this.#t.clearTextWidthCache(),s&&(this.#g.clear(),(this.#rt||t>0)&&this.#E.clear()),(this.#i!==void 0||this.#Q!==void 0||this.#w!==void 0)&&(this.#d(this.#i??[]),this.#i!==void 0&&this.#R&&this.focus()),this.#w?.removePopover(),this.#te(this.#h))};#Be(){if(this.#Ot)return;const t=document.fonts;t!==void 0&&(this.#Ot=!0,t.ready.then(()=>{this.#h===void 0||!this.#t.remeasureCharacterWidth()||(this.#L=void 0,this.#v=void 0,this.#Dt(),this.#g.clear(),(this.#i!==void 0||this.#Q!==void 0||this.#w!==void 0)&&this.#d(this.#i??[]),this.#w?.removePopover())}))}#Ie(t,e,n=this.#j,i){const s=this.#r,r=this.#f,o=this.#s,a=this.#O,c=this.#h;if(s===void 0||r===void 0||o===void 0||c===void 0)return;s.stopBackgroundTokenize();const h=performance.now(),d=s.tokenize(t,n,!this.#et),l=performance.now();if(d.size>0){const u=c.children,p=new Set;for(const g of d.keys())this.#wt(g)&&p.add(g);for(let g=0;g<u.length;g++){const m=u[g];if(m!==void 0){const v=U(m),L=m.dataset.lineType;if(v===void 0||L==="change-deletion")continue;const b=v-1;if(p.has(b)){const C=d.get(b);if(m.replaceChildren(...me(C)),p.delete(b),p.size===0)break}}}if(p.size>0){let g=0;for(let m=u.length-1;m>=0;m--){const v=u[m],L=U(v);if(L!==void 0&&v.dataset.lineType!=="change-deletion"){g=L;break}}for(const m of p){if(m<g)continue;const v=d.get(m),L=String(m+1);P("div",{dataset:{line:L,lineType:"context",lineIndex:m.toString()},children:me(v)},c),a!==void 0&&P("div",{dataset:{lineType:"context",columnNumber:L,lineIndex:m.toString()},children:[P("span",{dataset:{lineNumberContent:""},textContent:L})]},a)}}}if(t.lineDelta<0)for(const u of[c.children,a?.children??[]])for(let p=u.length-1;p>=0;p--){const g=u[p],m=U(g)??U(g,"columnNumber"),v=g.dataset.lineType;if(!(m===void 0||v==="change-deletion")){if(m-1<t.lineCount)break;g.remove()}}const f=t.lineDelta!==0;if(f){let u=c.children.length;for(const p of c.children){const{bufferSize:g}=p.dataset;g!==void 0&&(u+=parseInt(g)-1)}c.style.gridRow="span "+u,a!==void 0&&(a.style.gridRow="span "+u)}r.updateRenderCache(d,s.themeType,{shouldRefreshDiffsView:this.#et&&!f,lineCountChangeInFlight:f}),f&&r.applyDocumentChange(o,e,i),(f||this.#et&&this.#Et==="unified")&&this.#Dt(),e!==void 0&&(this.#A=e,tr(e,c,a)),this.#e.__debug===!0&&console.log(`[diffs/editor] re-render in: ${ct(performance.now()-l)}ms,`,`tokenize in: ${ct(l-h)}ms (${d.size} dirty lines)`)}#ee(t,e){switch(t){case"insertText":{const n=e??"",i=this.#s,s=this.#i,r=i!==void 0&&s!==void 0?gr(i,s,n,this.#e.autoSurround):void 0;this.#gt(r??n);break}case"insertCompositionText":break;case"insertLineBreak":case"insertParagraph":this.#gt(this.#s?.eol??`
|
|
523
|
-
`);break;case"deleteContentBackward":this.#pe();break;case"deleteContentForward":this.#pe(!0);break;case"deleteSoftLineBackward":case"deleteHardLineBackward":this.#Ve();break;case"deleteWordBackward":this.#je();break;case"insertTranspose":this.#Ke();break;default:console.warn(`[diffs] Unknown input type: ${t}`,e);break}}#q(t,e=!0,n){this.#R=!0,t!==void 0?(this.#F=!0,this.#xt({start:t,end:t,direction:0}),St(()=>{if(n?.()===!1||!this.#R){this.#F=!1;return}this.#h?.focus({preventScroll:e}),St(()=>{this.#F=!1})})):n?.()!==!1?this.#h?.focus({preventScroll:e}):this.#R=!1}#Ht(t){const e=this.#B;if(e==null)return;if(this.#at){this.#B=void 0,this.#R=!1,this.#F=!1;return}const n=this.#h;if(n==null||!this.#ne(n)){this.#B=void 0,this.#R=!1;return}const i=()=>{if(this.#B!==e)return!1;const o=this.#ne(n);return this.#B=void 0,o};if(t!=null){this.#q(t,!0,i);return}const s=this.#i?.at(-1);if(s==null){this.#q(void 0,!0,i);return}const r=s.direction===-1?s.end:s.start;this.#q(r,!0,i)}#ne(t){const e=this.#x,n=e?.shadowRoot;if(e==null||n==null||this.#h!==t||!n.contains(t))return!1;const{activeElement:i}=n;if(i===t||i!=null&&t.contains(i))return!0;if(i!=null)return!1;const{ownerDocument:s}=e,{activeElement:r}=s;return r==null||r===s.body||r===s.documentElement||r===e}#Pe(t=0){const e=this.#h,n=this.#x;if(this.#s==null||e==null||n==null)return;const i=this.#kt();if(i===void 0)return;let s,r;if(i instanceof HTMLElement){const a=i.getBoundingClientRect();s=a.top,r=a.bottom}else s=0,r=i.defaultView?.innerHeight??0;const o=n.shadowRoot?.querySelector("[data-diffs-header][data-sticky]");if(o!=null&&(s=Math.max(s,o.getBoundingClientRect().bottom)),Number.isFinite(t)&&(s+=Math.max(0,t)),!(r<=s))for(const a of e.children){const c=a,h=U(c),d=c.dataset.lineType;if(h==null||d==null||!mt(d))continue;const l=c.getBoundingClientRect();if(!(l.bottom<=l.top)&&l.top>=s&&l.top<r)return h}}#Ne(t,e){const n={start:t,end:t,direction:0};this.#z=!1,this.#d([n]),this.#ct(t.line),e?this.#q(t,!0):this.#nt()}#xt(t){const e=window.getSelection();if(e===null)return;let{start:n,end:i,direction:s}=t;D(n,i)>0&&([n,i]=[i,n]);const r=this.#lt(n.line),o=this.#lt(i.line);if(r===void 0||o===void 0)return;let[a,c]=_n(r,n.character),[h,d]=_n(o,i.character);s===-1&&([a,c,h,d]=[h,d,a,c]);try{e.setBaseAndExtent(a,Tn(a,c),h,Tn(h,d))}catch(l){console.error("[diffs/editor] failed to update window selection:",l)}}#nt(t=!1,e="nearest"){const n=this.#i?.at(-1);if(n===void 0)return;const i=this.#Y;if(i!==void 0){if(i.scrollIntoView({block:e,inline:"nearest"}),!t){const s=n.direction===-1?n.end:n.start;this.#B!==void 0?this.#Ht(s):this.#q(s)}}else{const s=H(n);this.#Ut(s.line,s.character,t)}}#ie(){const t=this.#N!==void 0?48:0,e=this.#ot()+this.#t.ch;return`${t}px ${this.#t.ch}px 0 ${e}px`}#Ut(t,e=0,n=!1){this.__postponeBgTokenizeToNextFrame();const i=P("div",{style:{position:"absolute",left:"0",width:"2px",height:this.#t.lineHeight+"px",scrollMargin:this.#ie()}});if(this.#lt(t)!==void 0){const[s,r]=this.#mt(t,e),o=this.#pt(t)+r*this.#t.lineHeight;if(i.style.top=o+"px",i.style.left=s+"px",this.#V?.appendChild(i),i.scrollIntoView({block:"center",inline:"nearest"}),!n){const a={line:t,character:e};this.#B!==void 0?this.#Ht(a):this.#q(a)}this.#tt=void 0,this.#ht=void 0,this.#St=!1,this.#dt=!1}else{const s=this.#f?.getLinePosition?.(t+1);if(s!==void 0)i.style.top=s.top+"px",this.#x?.shadowRoot?.appendChild(i),i.scrollIntoView({block:"center",inline:"nearest"}),s.height>0&&this.#wt(t)?(this.#tt=t,this.#ht=e,this.#dt=n):(this.#tt=void 0,this.#ht=void 0,this.#dt=!1);else{let r=0;if(this.#tt===t&&this.#h!==void 0)for(let a=this.#h.childElementCount-1;a>=0;a--){const c=this.#h.children[a],h=c.dataset.lineType,d=U(c);if(h!==void 0&&mt(h)&&d!==void 0){r=(t-(d-1))*this.#t.lineHeight;break}}const o=((this.#A??[]).filter(a=>a.lineNumber<t).length+t)*this.#t.lineHeight+r;i.style.top=o+"px",this.#x?.shadowRoot?.appendChild(i),i.scrollIntoView({block:"center",inline:"nearest"}),this.#tt===t&&(r===0||this.#St)||!this.#wt(t)?(this.#tt=void 0,this.#ht=void 0,this.#St=!1,this.#dt=!1):(this.#tt=t,this.#ht=e,this.#St=r!==0,this.#dt=n)}}i.remove()}#se(t,e,n){const i=r=>({line:r,character:0}),s=r=>({line:r,character:n.getLineText(r).length});return e<t?{start:i(e),end:s(t),direction:-1}:{start:i(t),end:s(e),direction:1}}#Oe(t){const e=t.composedPath()[0];return e instanceof HTMLElement&&e.closest("[data-line]")?.getAttribute("data-line-type")==="change-deletion"}#re(t,e,n){const i=[...n.querySelectorAll("[data-content] > [data-line]")],s=i.indexOf(t),r=i.indexOf(e),[o,a]=r<s?[e,t]:[t,e],c=window.getSelection();if(c!==null){const l=document.createRange();l.setStart(o,0),l.setEnd(a,a.childNodes.length),c.removeAllRanges(),c.addRange(l)}this.#Rt(!0),this.#d([]),this.#yt(U(e)??null,!0,"deletions");const h=Math.min(s,r),d=Math.max(s,r);this.#Lt=h<0?"":i.slice(h,d+1).filter(l=>l.getAttribute("data-line-type")==="change-deletion").map(l=>l.textContent??"").join(`
|
|
524
|
-
`)}#oe(t,e){const n=t.parentElement;if(n==null||e==null)return;const i=[...n.children].indexOf(t),s=e.children[i];return s instanceof HTMLElement?s:void 0}#ae(t,e,n){const i=e.querySelector("[data-content]"),s=this.#oe(t,i);return s===void 0?!1:(this.#re(s,s,e),n&&this.#zt([N(document,"mousemove",r=>{const o=r.composedPath()[0],a=o instanceof HTMLElement?o.closest("[data-column-number]"):null;if(a instanceof HTMLElement&&e.contains(a)){const c=this.#oe(a,i);c!==void 0&&this.#re(s,c,e)}},{passive:!0})]),!0)}#ce(){return this.#x?.shadowRoot?.querySelector("pre")?.hasAttribute("data-deleted-text-selection")??!1}#le(){return this.#Lt!==""?this.#Lt:window.getSelection()?.toString()??""}#Rt(t){const e=this.#x?.shadowRoot?.querySelector("pre");e!=null&&(t?(e.setAttribute("data-deleted-text-selection",""),this.#yt(null),this.#Lt=""):(e.removeAttribute("data-deleted-text-selection"),this.#Lt=""))}#yt(t,e=!1,n="additions"){try{this.#f?.setEditorActiveLine(t,{lineNumberOnly:e,side:n})}catch{}}#De(){this.#ft===void 0&&(this.#ft=requestAnimationFrame(()=>{this.#ft=void 0,(this.#i!==void 0||this.#Q!==void 0||this.#w!==void 0)&&this.#d(this.#i??[])}))}#d(t){if(this.__postponeBgTokenizeToNextFrame(),this.#Y=void 0,this.#yt(null),t.length===0&&this.#Q===void 0&&this.#w===void 0){this.#i=void 0,this.#U?.forEach(s=>s.remove()),this.#U?.clear(),this.#_?.cleanup(),this.#_=void 0;return}const e=document.createDocumentFragment(),n={fragment:e,elements:new Map};if(t.length>0){const s=gi(t),r=s.at(-1);this.#i=s;const o=s.some(h=>!z(h)),a=H(r).line+1;this.#yt(a,o);for(const h of s)z(h)||this.#Bt(n,"selection",h),this.#ze(n,h,h===r);const c=this.#e.matchBrackets!==!1&&this.#s!==void 0&&this.#r!==void 0&&z(r)?Wr(this.#s,this.#r,r.start):void 0;if(c!==void 0)for(const h of c)this.#Bt(n,"bracketMatch",h)}const i=this.#s;if(this.#Q!==void 0&&i!==void 0){const s=this.#Q,r=this.#j,o=r!==void 0&&Number.isFinite(r.totalLines)||this.#et&&this.#f?.options.expandUnchanged!==!0?this.#me():void 0,a=this.#i?.at(-1),c=a!==void 0?i.offsetAt(a.start):-1,h=a!==void 0?i.offsetAt(a.end):-1;let d=0;const l=o?.length??1;for(let f=0;f<l;f++){let u=1/0;const p=o?.[f];if(p!==void 0){const[g,m]=p,v=i.offsetAt({line:g,character:0}),L=m+1;u=L<i.lineCount?i.offsetAt({line:L,character:0}):i.offsetAt({line:L-1,character:i.getLineLength(L-1)});let b=d,C=s.length;for(;b<C;){const T=b+Math.floor((C-b)/2);s[T][1]<=v?b=T+1:C=T}d=b}for(;d<s.length;d++){const[g,m]=s[d];if(g>=u)break;const v={start:i.positionAt(g),end:i.positionAt(m)},L=c===g&&h===m;this.#Bt(n,"match",v,L?"focus":void 0)}}}if(this.#w!==void 0&&i!==void 0)for(const s of this.#w.markers)this.#Bt(n,"marker",s,Pt(s.severity));this.#V?.appendChild(e),this.#U?.forEach(s=>s.remove()),this.#U?.clear(),this.#U=n.elements,this.#Wt()}#Bt(t,e,n,i){if(this.#s===void 0)return;const{start:s,end:r}=n;let o=s.line,a=r.line+1;if(this.#j!==void 0){const{startingLine:c,totalLines:h}=this.#j;o=Math.max(o,c),a=Math.min(a,c+h)}for(let c=o;c<a;c++){if(!this.#It(c))continue;const h=c===r.line,d=c===s.line?s.character:0,l=h?r.character:this.#s.getLineLength(c);if(this.#rt){const g=this.#Vt(),m=this.#s.getLineText(c);if(2*this.#t.ch+this.#t.measureTextWidth(m)>g){this.#_e(t,c,m,d,l,h,e,i);continue}}let f=0,u=0,p=0;d===0?f=this.#ot()+this.#t.ch+(this.#ut?.left??0):f=this.#mt(c,d)[0],!h&&e==="selection"&&(p=this.#t.ch),d===l?u=p:u=this.#mt(c,l)[0]-f+p,this.#de(t,e,c,0,f,u,i)}}#_e(t,e,n,i,s,r,o,a){const c=this.#jt(e),h=c.length-1,d=this.#ot()+this.#t.ch+(this.#ut?.left??0);for(let l=0;l<h;l++){const f=c[l],u=c[l+1],p=Math.max(i,f),g=Math.min(s,u);if(p>g)continue;const m=this.#he(n,f,p),v=d+m;let L=0;!r&&l===h-1&&o==="selection"&&(L=this.#t.ch);const b=p===g?L:this.#he(n,f,g)-m+L;this.#de(t,o,e,l,v,b,a)}}#he(t,e,n){if(n<=e)return 0;const i=t.slice(e,n),s=At(i,this.#t.tabSize);return s!==-1?s*this.#t.ch:this.#t.measureTextWidth(i)}#de(t,e,n,i,s,r,o){if(r===0)return;const{ch:a,lineHeight:c}=this.#t,h=this.#pt(n)+i*c,d=`${e}-${n}/${i}-${s}-${r} ${o??""}`,l=this.#U,f=(this.#e.roundedSelection??!0)&&e==="selection",u=(m,v,L,b)=>{const C=this.#pt(m)+v*c,T=this.#lt(m);let w="initial";T!==void 0&&(T.dataset.lineType==="change-addition"||T.dataset.selectedLine!==void 0)&&(w=getComputedStyle(T).getPropertyValue("--diffs-line-bg"));const S=`width:${a}px;transform:translateX(${L}px) translateY(${C}px);--diffs-selection-corner-bg:${w}`,E={selectionCorner:"",[b]:""},x=`${e}-block-${m}/${v}-${L}-1ch`;let y=x+"-"+b;if(b==="rbl"){const A=x+"-rtl",M=t.elements.get(A);M!==void 0&&(M.remove(),t.elements.delete(A),y+="-rtl",E.rtl="")}let k=t.elements.get(y);k===void 0&&(l?.has(y)===!0?(k=l.get(y),k.style.cssText=S,l.delete(y)):k=P("div",{dataset:"selectionRange",style:{cssText:S},children:[P("div",{dataset:E})]},t.fragment),t.elements.set(y,k))},p=m=>{const v=s+r,L=m.dataset,b=t.previousSelectionRange;if((b===void 0||b.line!==n||b.wrapLine!==i)&&(t.previousSelectionRange={element:m,line:n,wrapLine:i,left:s,width:r}),b===void 0||v<=b.left)["rtl","rtr","rbl","rbr"].forEach(C=>{L[C]=""});else{const C=b.line,T=b.wrapLine,w=b.left,S=b.element.dataset,E=w+b.width;w>s&&u(C,T,w-a,"rbr"),delete S.rbl,delete L.rtl,delete L.rtr,v>=E&&delete S.rbr,v>E&&(u(C,T,E,"rbl"),L.rtr=""),v<E&&u(n,i,v,"rtl"),s<w&&(L.rtl=""),L.rbl="",L.rbr=""}};let g=t.elements.get(d);if(g!==void 0){f&&p(g);return}l?.has(d)===!0?(g=l.get(d),l.delete(d)):g=P("div",{dataset:o?[e+"Range",o]:e+"Range"},t.fragment),g.style.width=`${r}px`,g.style.transform=`translateX(${s}px) translateY(${h}px)`,f&&p(g),t.elements.set(d,g)}#ze(t,e,n){const{line:i,character:s}=H(e);if(!this.#It(i))return;const[r,o]=this.#mt(i,s),a="caret-"+i+"/"+o+":"+s;if(t.elements.has(a))return;const c=P("div",{dataset:"caret",style:{transform:`translateX(${r-1}px) translateY(${this.#pt(i)+o*this.#t.lineHeight}px)`}},t.fragment);t.elements.set(a,c),n&&(c.style.scrollMargin=this.#ie(),this.#Y=c)}#Wt(){const t=this.#i?.at(-1),e=this.#V,n=this.#s,i=this.#e.renderSelectionAction,s=()=>{this.#_?.cleanup(),this.#_=void 0};if(this.#e.enabledSelectionAction!==!0||i===void 0||t===void 0||z(t)||this.#st||e===void 0||n===void 0){s();return}const r=H(t);if(!this.#It(r.line)){s();return}if(this.#_===void 0){if(!this.#z)return;const x=()=>this.#i?.at(-1)??t,y=i({textDocument:n,get selection(){return x()},applyEdits:k=>this.applyEdits(k),getSelectionText:()=>this.#s?.getText(x())??"",replaceSelectionText:k=>{this.#gt(k,[x()])},close:()=>{s(),this.#nt()}});this.#_=new eo(y,e,()=>this.#Wt()),this.#Tt().resetPlacement(Ce)}const o=this.#t.lineHeight,a=t.direction===-1,c={placeAbove:a,anchor:r},h=a?{placeAbove:!1,anchor:t.end}:{placeAbove:!0,anchor:t.start},d=this.#_.height,l=x=>{const[y,k]=this.#mt(x.anchor.line,x.anchor.character),A=this.#pt(x.anchor.line)+k*o,M=x.placeAbove?A:A+o,B=x.placeAbove?M-d:M;return{top:B,bottom:B+d,left:y,anchorTop:M,rowTop:A}},f=l(c),u=n.lineCount,p=a?r.line<3:r.line>=u-3,g=this.#It(h.anchor.line)?l(h):void 0,m=this.#Tt(),v=m.getPlacementBounds(),L=g!==void 0&&m.choosePlacement({preferred:f,fallback:g,viewport:v,popoverHeight:d,atDocumentEdge:p,placementKey:Ce})==="fallback";g===void 0&&m.setPlacement("preferred",Ce);const{placeAbove:b}=L?h:c,{left:C,anchorTop:T}=L&&g!==void 0?g:f,w=a?f.rowTop:g?.rowTop??-1/0,S=(a?g?.rowTop??1/0:f.rowTop)+(t.end.line>t.start.line&&t.end.character===0?0:o),E=v===void 0||S>v.top&&w<v.bottom;this.#_.reposition(C,T,this.#ot(),b,E,v)}#fe(t){if(this.#N!==void 0){this.#N.setMode(t);return}this.#Fe(t)}#Fe(t){this.#N?.cleanup();const e=this.#s,n=this.#x?.shadowRoot?.querySelector("pre"),i=this.#i;if(e===void 0||n==null)return;let s="",r;if(i!==void 0&&i.length>0){let c=i.at(-1);if(z(c)){c=Ee(e,c),this.#d([...i.slice(0,-1),c]);const h=e.getText(c);h!==""&&!h.includes(`
|
|
525
|
-
`)&&(s=h,r=[e.offsetAt(c.start),e.offsetAt(c.end)])}}const o=([c,h],d)=>{const l=Oe(e,c,h);this.#d([l]),this.#ct(H(l).line),this.#nt(!0),this.#at=d},a=new to({textDocument:e,containerElement:n,defaultQuery:s,mode:t,initialMatch:r,scrollToMatch:o,applyReplace:c=>{if(c.length===0)return;const h=e.applyEdits(c.map(d=>({range:{start:e.positionAt(d.start),end:e.positionAt(d.end)},newText:d.text})),!0,this.#i);h!==void 0&&this.#K(h,void 0,this.#it(h),{skipSearchRefresh:!0})},onUpdate:(c,h)=>{if(c.length===0){this.#Q=void 0,this.#d(this.#i??[]);return}if(this.#Q=c,h?.syncSelection===!1){this.#d(this.#i??[]);const u=this.#i?.at(-1);if(u!==void 0){const p=e.offsetAt(u.start),g=e.offsetAt(u.end);for(const m of c)if(m[0]===p&&m[1]===g)return m}return}const d=this.#i?.at(-1);let l=0,f;d!==void 0&&(l=e.offsetAt(d.start));for(const u of c)if(u[0]>=l){f=u;break}return f!==void 0?o(f,!0):this.#d(this.#i??[]),f},onClose:()=>{this.#N=void 0,this.#at=!1,this.#Q=void 0,this.#d(this.#i??[])}});this.#N=a,this.#at=!1}#He(){const t=this.#s,e=this.#i;return t===void 0||e===void 0?"":Se(t,e)}#ue(){const t=this.#s,e=this.#i;return t===void 0||e===void 0?[]:Tr(t,e)}#ge(t,e,n){t!==null&&(t.setData("text",e),n.length>1&&t.setData(Le,JSON.stringify(n)))}#Ue(){const t=this.#s,e=this.#i;if(t===void 0||e===void 0||e.length===0)return"";if(e.some(i=>z(i))){const i=Br(t,e);return this.#We(i.edits,i.nextSelectionOffsets),i.text}const n=Se(t,e);return this.#gt("",void 0,!0),n}#We(t,e){const n=this.#s,i=this.#i;if(n===void 0||i===void 0||t.length===0)return;const s=n.applyResolvedEdits(t,!0,i,void 0,!0);if(s===void 0)return;const r=e.map(o=>{const a=n.positionAt(o);return{start:a,end:a,direction:0}});n.setLastUndoSelectionsAfter(r),this.#K(s,r,this.#it(s))}#gt(t,e=this.#i,n=!1,i="selection"){if(e===void 0)return;const s=this.#s,r=e.at(-1);if(s===void 0||r===void 0)return;const{nextSelections:o,change:a}=Array.isArray(t)&&t.length===e.length?wt(s,e,t,this.#A,n,i):hr(s,e,{start:s.offsetAt(r.start),end:s.offsetAt(r.end),text:Array.isArray(t)?t.join(s.eol):t},this.#A,void 0,n);a!==void 0&&this.#K(a,o,this.#it(a))}#pe(t=!1){const e=this.#i,n=this.#s;if(e===void 0||n===void 0)return;const{nextSelections:i,change:s}=br(n,e,t,this.#A,this.#t.tabSize);s!==void 0&&this.#K(s,i,this.#it(s))}#Ve(){const t=this.#i,e=this.#s;if(t===void 0||e===void 0)return;const{nextSelections:n,change:i}=vr(e,t,this.#rt?(s,r)=>{const o=this.#jt(s);for(let a=0;a+1<o.length;a++){const c=o[a],h=o[a+1];if(r>=c&&r<=h)return c}return 0}:void 0,this.#A);i!==void 0&&this.#K(i,n,this.#it(i))}#je(){const t=this.#i,e=this.#s;if(t===void 0||e===void 0)return;const{nextSelections:n,change:i}=Cr(e,t,this.#A);i!==void 0&&this.#K(i,n,this.#it(i))}#qe(){const t=this.#i,e=this.#s;if(t===void 0||e===void 0)return;const{nextSelections:n,change:i}=mr(e,t,this.#A);i!==void 0&&this.#K(i,n,this.#it(i))}#Ke(){const t=this.#i,e=this.#s;if(t===void 0||e===void 0)return;const{nextSelections:n,change:i}=pr(e,t,this.#A);i!==void 0&&this.#K(i,n,this.#it(i))}#K(t,e,n,i){const s=this.getFile(),r=this.#e.onChange;if(s!==void 0&&r!==void 0){const c=n??this.#A;r(s,c,{changes:t.changes,file:s,lineAnnotations:c})}if(t.lineDelta!==0||this.#rt)for(const c of this.#E.keys())c>=t.startLine&&this.#E.delete(c);if(this.#g.size>0)if(t.lineDelta===0&&(t.changedLineRanges.length===1||t.changedLineChanges?.every(([,,c])=>c===0)===!0))for(const[c,h]of t.changedLineRanges)for(let d=c;d<=h;d++)this.#g.delete(d);else for(const c of this.#g.keys())c>=t.startLine&&this.#g.delete(c);this.#C=void 0;let o=this.#j,a;if(o!==void 0&&e!==void 0&&e.length>0){const c=e.at(-1),h=o.startingLine+o.totalLines;if(c.end.line>=h){const d=c.end.line-o.startingLine+1,l=this.#X===void 0||this.#X===1/0?1/0:this.#X*vo;t.startLine<=h&&d<=l&&this.#wt(c.end.line)?(c.end.line>h&&(a=!0),o={...o,totalLines:d},this.#j=o):a=!0}}if(this.#Ie(t,n,o,a),i?.skipSearchRefresh!==!0&&this.#N!==void 0&&this.#Q!==void 0&&this.#N.updateMatches({syncSelection:!1}),e!==void 0&&(this.#d(e),i?.skipFocus!==!0)){const c=e.at(-1);if(c!==void 0&&this.#ct(H(c).line),this.#Y!==void 0)requestAnimationFrame(()=>{this.#Y?.scrollIntoView({block:"nearest",inline:"nearest"})});else if(e.length>0){const h=H(e.at(-1));this.#Ut(h.line,h.character)}this.focus({preventScroll:!0})}}#it(t){if(this.#A!==void 0){const e=Ot(t,this.#A);if(e!==void 0)return this.#s?.setLastUndoLineAnnotations(this.#A,e),e}}#me(){const t=this.#h;if(t===void 0)return[];const e=[];for(const n of t.children){const i=n,s=i.dataset.lineType,r=U(i);if(r===void 0||s===void 0||!mt(s))continue;const o=r-1,a=e.at(-1);a!==void 0&&o<=a[1]+1?a[1]=Math.max(a[1],o):e.push([o,o])}return e}#lt(t){let e=this.#M.get(t);if(e!==void 0)return e??void 0;const n=this.#j;if(n!==void 0&&(t<n.startingLine||t>=n.startingLine+n.totalLines))return;const i=this.#h;if(i!==void 0){if(n!==void 0){const{startingLine:s}=n,{children:r}=i;for(let o=t-s;o<=r.length;o++){const a=r[o];if(a===void 0)break;const c=U(a),h=a.dataset.lineType;if(c!==void 0&&c===t+1&&h!==void 0&&mt(h)){e=a;break}}}return e??=i.querySelector(`[data-line="${t+1}"]`+(this.#Et==="unified"?':not([data-line-type="change-deletion"])':"")),e!==void 0&&this.#M.set(t,e),e??void 0}}#ot(){if(this.#O===void 0)return 0;if(this.#L===void 0){const t=this.#h?.parentElement?.style.getPropertyValue("--diffs-column-number-width");t!==void 0&&t.length>2&&t.endsWith("px")?this.#L=parseInt(t.slice(0,-2),10):this.#L=this.#O.offsetWidth}return this.#L}#Vt(){if(this.#h===void 0)return 0;if(this.#v===void 0){const t=this.#h.parentElement?.style.getPropertyValue("--diffs-column-content-width");t!==void 0&&t.length>2&&t.endsWith("px")?this.#v=parseFloat(t.slice(0,-2)):this.#v=this.#h.offsetWidth}return this.#v}#pt(t){const e=this.#E.get(t);if(e!==void 0)return e;const n=this.#lt(t);if(n===void 0)return-1;let i=n.offsetTop+this.#t.paddingTop;return i+=this.#ut?.top??0,this.#E.set(t,i),i}#mt(t,e){if(this.#C!==void 0&&this.#C[0]===t&&this.#C[1]===e)return[this.#C[2],this.#C[3]];const n=this.#s?.getLineText(t),i=this.#ot()+this.#t.ch;if(n===void 0||n.length===0||e<=0)return[i+(this.#ut?.left??0),0];const s=fo(n,Math.min(e,n.length)),r=n.slice(0,s),o=At(r,this.#t.tabSize);let a=0,c=0;if(o!==-1?a=i+o*this.#t.ch:a=i+this.#t.measureTextWidth(r),this.#rt){const h=this.#Vt();if(2*this.#t.ch+this.#t.measureTextWidth(n)>h){const d=this.#ve(t);if(d==null)return[a+(this.#ut?.left??0),0];for(let l=0;l+1<d.length;l++){const f=d[l];if(s<=d[l+1]){c=l;const u=n.slice(f,s),p=At(u,this.#t.tabSize);p!==-1?a=i+p*this.#t.ch:a=i+this.#t.measureTextWidth(u);break}}}a+=this.#ut?.left??0}return this.#C!==void 0?(this.#C[0]=t,this.#C[1]=e,this.#C[2]=a,this.#C[3]=c):this.#C=[t,e,a,c],[a,c]}#ve(t){const e=this.#g.get(t);if(e!==void 0)return e;this.#g.size>=Co&&this.#g.clear();const n=this.#s?.getLineText(t);if(n===void 0||n.length===0){const c=new Uint32Array([0]);return this.#g.set(t,c),c}const i=this.#h;if(i==null||!i.isConnected)return;const s=P("div",{style:{position:"absolute",top:"0",left:"0",width:"100%",boxSizing:"border-box",visibility:"hidden",pointerEvents:"none",whiteSpace:"pre-wrap",wordBreak:"break-word",font:"inherit",paddingInline:"1ch",tabSize:this.#t.tabSize.toString()},textContent:n},i),r=s.firstChild,o=document.createRange(),a=[];try{const c=s.getBoundingClientRect();if(c.width===0)return;const h=uo(n),d=c.left+this.#t.ch,l=h===void 0?n.length:h.length-1,f=v=>h===void 0?v:h[v],u=v=>(o.setStart(r,f(v)),o.setEnd(r,f(v+1)),o.getBoundingClientRect());a.push(0);let p=u(0).top,g=1;for(;g<l;){let v=g,L=l;for(;v<L;){const w=v+L>>1;u(w).top>p?L=w:v=w+1}if(v>=l)break;const{left:b,top:C}=u(v),T=Ve()&&b-d>this.#t.ch/2;a.push(f(T?v-1:v)),p=C,g=v+1}const m=new Uint32Array(a.length+1);for(let v=0;v<a.length;v++)m[v]=a[v];return m[a.length]=n.length,this.#g.set(t,m),m}finally{s.remove()}}#jt(t){const e=this.#ve(t);if(e!==void 0)return e;const n=this.#s?.getLineText(t)?.length??0;return Uint32Array.of(0,n)}#$e({startContainer:t,endContainer:e}){const n=this.#h;return n===void 0?!1:n.contains(t)&&n.contains(e)}#It(t){const e=this.#s?.lineCount??0;return t<0||t>=e?!1:this.#lt(t)!==void 0}};const Mo="group/row relative transition-colors hover:bg-foreground/5 has-[:focus-visible]:bg-foreground/5";function Lo({className:t,...e}){return I.jsx("div",{"data-slot":"hover-actions",className:Oi("pointer-events-none absolute inset-y-0 right-0 flex items-center gap-0.5 rounded-r-[inherit] pr-1 pl-8 opacity-0 transition-opacity duration-100","bg-linear-to-l from-[color-mix(in_oklab,var(--background),var(--foreground)_5%)] from-60% to-transparent","group-hover/row:pointer-events-auto group-hover/row:opacity-100 group-has-[:focus-visible]/row:pointer-events-auto group-has-[:focus-visible]/row:opacity-100",t),...e})}function yi(t){return t?t==="keyboard":!!document.activeElement?.matches(":focus-visible")}function bo(t){return{title:t.title,content:t.content,unitType:t.unitType,importance:String(t.importance)}}function wo(t){if(!t.content.trim())return{error:"Content cannot be empty."};const e=Number(t.importance);return t.importance.trim()===""||!(e>=0&&e<=1)?{error:"Importance must be between 0 and 1."}:{patch:{title:t.title,content:t.content,unitType:t.unitType,importance:e}}}function Vn(t){const e=t.slice(0,5).map(n=>`“${n}”`);return t.length>5?`${e.join("、")}…`:e.join("、")}function xo(t,e){const n=[],i=t.deleted.filter(s=>s.role==="history");i.length>0&&n.push(e("Also deletes {{count}} older versions it replaced: {{titles}}",{count:String(i.length),titles:Vn(i.map(s=>s.title))})),t.bridges.length>0&&n.push(e("The older and newer versions around it are linked directly, so the history stays continuous.")),t.relations.length>0&&n.push(e("Removes the relation links to {{titles}}; those memories are kept.",{titles:Vn(t.relations.map(s=>s.title))}));for(const s of t.crystalsUpdated)n.push(e("Crystal {{title}} loses this source and keeps {{count}} sources.",{title:`“${s.title}”`,count:String(s.remaining)}));for(const s of t.crystalsDemoted)n.push(e("Crystal {{title}} would be left with {{count}} sources, so it becomes a normal memory. Its content is kept.",{title:`“${s.title}”`,count:String(s.remaining)}));return t.releasedSources>0&&n.push(e("This is a crystal: its {{count}} source memories are kept, only the links are removed.",{count:String(t.releasedSources)})),n.length===0&&n.push(e("No other memories are affected.")),n}function Ro({id:t,onEdit:e,onDelete:n,className:i}){const{t:s}=Re();return I.jsxs(Lo,{className:i,children:[I.jsx(dt,{variant:"ghost",size:"icon-xs","aria-label":s("Edit"),title:s("Edit"),"data-memory-action":"row-edit",className:"text-muted-foreground hover:text-foreground",onClick:()=>e(t),children:I.jsx(Wi,{})}),I.jsx(dt,{variant:"ghost",size:"icon-xs","aria-label":s("Delete permanently"),title:s("Delete permanently"),"data-memory-action":"row-delete",className:"text-destructive/80 hover:bg-destructive/8 hover:text-destructive",onClick:()=>n(t),children:I.jsx(Vi,{})})]})}function Bo({memoryId:t,onClose:e,onSaved:n}){const{t:i}=Re(),[s,r]=Q.useState(null),[o,a]=Q.useState(null),[c,h]=Q.useState(!1),d=Q.useRef(e);d.current=e,Q.useEffect(()=>{if(r(null),a(null),!t)return;let f=!0;return window.electronAPI.memory.detail(t).then(u=>{f&&(u?r(bo(u)):d.current())}),()=>{f=!1}},[t]);const l=async()=>{if(!t||!s)return;const f=wo(s);if("error"in f)return a(i(f.error));h(!0);const u=await window.electronAPI.memory.update(t,f.patch);if(h(!1),!u.ok)return a(u.error??i("Could not save the memory."));e(),n?.(t)};return I.jsx(Kn,{open:t!==null&&s!==null,onOpenChange:f=>!f&&!c&&e(),children:I.jsx($n,{finalFocus:yi,children:s&&I.jsxs(I.Fragment,{children:[I.jsxs(Gn,{children:[I.jsx(Yn,{children:i("Edit memory")}),I.jsx(Zn,{children:i("Search indexes are rebuilt from the new text right away.")})]}),I.jsxs(Jn,{className:"space-y-3","data-memory-edit":t??"",children:[I.jsxs("label",{className:"block space-y-1",children:[I.jsx("span",{className:"text-muted-foreground text-xs",children:i("Memory title")}),I.jsx(Ue,{value:s.title,"data-memory-field":"title",onChange:f=>r({...s,title:f.target.value})})]}),I.jsxs("label",{className:"block space-y-1",children:[I.jsx("span",{className:"text-muted-foreground text-xs",children:i("Content")}),I.jsx(Di,{value:s.content,rows:6,"data-memory-field":"content",onChange:f=>r({...s,content:f.target.value})})]}),I.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[I.jsxs("div",{className:"space-y-1",children:[I.jsx("span",{className:"text-muted-foreground text-xs",children:i("Type")}),I.jsxs(_i,{value:s.unitType,items:Ft.map(f=>({value:f,label:f})),onValueChange:f=>{const u=Ft.find(p=>p===f);u&&r({...s,unitType:u})},children:[I.jsx(zi,{size:"sm","data-memory-field":"unitType",children:I.jsx(Fi,{})}),I.jsx(Hi,{children:Ft.map(f=>I.jsx(Ui,{value:f,children:f},f))})]})]}),I.jsxs("label",{className:"block space-y-1",children:[I.jsx("span",{className:"text-muted-foreground text-xs",children:i("Importance (0–1)")}),I.jsx(Ue,{type:"number",min:0,max:1,step:.05,size:"sm",value:s.importance,"data-memory-field":"importance",onChange:f=>r({...s,importance:f.target.value})})]})]}),o&&I.jsx("p",{className:"text-destructive text-xs",children:o})]}),I.jsxs(Qn,{children:[I.jsx(Xn,{render:I.jsx(dt,{variant:"outline",size:"sm",disabled:c}),children:i("Cancel")}),I.jsx(dt,{size:"sm",disabled:c,"data-memory-action":"save",onClick:()=>{l()},children:i("Save")})]})]})})})}function Io({ids:t,onClose:e,onDeleted:n}){const{t:i}=Re(),[s,r]=Q.useState(void 0),[o,a]=Q.useState(!1);Q.useEffect(()=>{if(r(void 0),!t)return;let h=!0;return window.electronAPI.memory.deletePreview([...t]).then(d=>{h&&r(d)}),()=>{h=!1}},[t]);const c=async()=>{if(t){a(!0);try{for(const h of t)await window.electronAPI.memory.delete(h)}finally{a(!1)}e(),n?.(t)}};return I.jsx(Kn,{open:t!==null,onOpenChange:h=>!h&&!o&&e(),children:I.jsxs($n,{finalFocus:yi,children:[I.jsxs(Gn,{children:[I.jsx(Yn,{children:t&&t.length>1?i("Delete {{count}} memories permanently?",{count:String(t.length)}):i("Delete this memory permanently?")}),I.jsx(Zn,{children:i("This cannot be undone. Archiving keeps the memory out of search while preserving it.")})]}),I.jsx(Jn,{"data-memory-delete-impact":"",children:s===void 0?I.jsx("p",{className:"text-muted-foreground text-xs",children:i("Checking what this affects…")}):s===null?I.jsx("p",{className:"text-muted-foreground text-xs",children:i("Memory not found.")}):I.jsx("ul",{className:"list-disc space-y-1 ps-4 text-xs",children:xo(s,i).map(h=>I.jsx("li",{children:h},h))})}),I.jsxs(Qn,{children:[I.jsx(Xn,{render:I.jsx(dt,{variant:"outline",size:"sm",disabled:o}),children:i("Cancel")}),I.jsx(dt,{variant:"destructive",size:"sm","data-memory-action":"confirm-delete",disabled:o||!s,onClick:()=>{c()},children:i("Delete permanently")})]})]})})}function Po(t){if(t==="session"||t==="title")return t;if(typeof t!="string"||t.length>512)return null;const e=t.indexOf("::");return e<=0||e+2>=t.length?null:{providerId:t.slice(0,e),modelId:t.slice(e+2)}}function No(t){return typeof t=="string"?t:`${t.providerId}::${t.modelId}`}function Oo(t){return typeof t!="string"||t.length===0||t.length>256||t.includes("\\")||t.includes("\0")||t.startsWith("/")||/^[a-zA-Z]:/.test(t)?!1:t.split("/").every(e=>e!=="..")}export{Ao as E,Eo as F,Lo as H,To as L,Bo as M,ko as Q,Io as a,Ro as b,Mo as c,No as f,Oo as i,Po as p,yi as r};
|