@seaveyon/harness-switch 0.25.0 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/harness-switch.js +17037 -17022
- package/package.json +1 -1
- package/public/assets/38.4f37f008.js +1 -0
- package/public/assets/403.83e8a5aa.js +1 -0
- package/public/assets/703.74dabcc4.js +1 -0
- package/public/assets/780.6c88bbeb.js +203 -0
- package/public/assets/886.215586f6.js +1 -0
- package/public/assets/911.fae0dbda.js +1 -0
- package/public/assets/{826.55f3327b.js → 952.906cea7c.js} +1 -1
- package/public/assets/997.79084a9d.js +1 -0
- package/public/assets/main.16a7e7ef.js +62 -0
- package/public/assets/main.99eb8e7b.css +2 -0
- package/public/index.html +1 -1
- package/public/assets/1044.39aafe87.js +0 -1
- package/public/assets/1045.21280f56.js +0 -1
- package/public/assets/1050.46b86852.js +0 -1
- package/public/assets/1064.d2226313.js +0 -1
- package/public/assets/109.d185b844.js +0 -1
- package/public/assets/117.fbce1498.js +0 -1
- package/public/assets/1216.f58f116a.js +0 -1
- package/public/assets/1266.b0b77ece.js +0 -1
- package/public/assets/1274.36c97e4b.js +0 -1
- package/public/assets/1284.6d1b1fa9.js +0 -1
- package/public/assets/1297.5aa40a92.js +0 -1
- package/public/assets/1337.91282e33.js +0 -1
- package/public/assets/1348.3156645b.js +0 -1
- package/public/assets/1446.08d331b6.js +0 -1
- package/public/assets/1473.b0f70164.js +0 -1
- package/public/assets/1495.98d34a19.js +0 -1
- package/public/assets/1498.a7a38ca7.js +0 -1
- package/public/assets/1506.50339f62.js +0 -1
- package/public/assets/1541.3def363d.js +0 -1
- package/public/assets/1558.a7617461.js +0 -1
- package/public/assets/1565.2f21c8e1.js +0 -1
- package/public/assets/1680.4e882493.js +0 -1
- package/public/assets/1706.b445c403.js +0 -1
- package/public/assets/1811.132227bb.js +0 -1
- package/public/assets/1822.9d44e9b8.js +0 -1
- package/public/assets/1852.561dcf77.js +0 -1
- package/public/assets/1875.f9da64a1.js +0 -1
- package/public/assets/193.86e5680f.js +0 -1
- package/public/assets/1942.edb657de.js +0 -1
- package/public/assets/197.be0123ad.js +0 -1
- package/public/assets/1972.b1548051.js +0 -1
- package/public/assets/198.2702464a.js +0 -1
- package/public/assets/1981.4e7751ba.js +0 -1
- package/public/assets/2048.e0b5be0d.js +0 -1
- package/public/assets/2067.6433a4bd.js +0 -1
- package/public/assets/2082.b2643ed0.js +0 -1
- package/public/assets/2185.248c6b44.js +0 -1
- package/public/assets/2202.e80e4d18.js +0 -1
- package/public/assets/2227.cf7e7a88.js +0 -1
- package/public/assets/2234.f03ed50e.js +0 -1
- package/public/assets/2247.8cd63431.js +0 -1
- package/public/assets/2301.5b08aa31.js +0 -1
- package/public/assets/231.073ec786.js +0 -1
- package/public/assets/233.9eea8428.js +0 -1
- package/public/assets/2332.bec77738.js +0 -1
- package/public/assets/234.e1ec501c.js +0 -1
- package/public/assets/2368.6d60e76e.js +0 -1
- package/public/assets/2378.a09f27ac.js +0 -1
- package/public/assets/2411.1a1e84d8.js +0 -1
- package/public/assets/2426.12abe760.js +0 -1
- package/public/assets/2536.d03279a1.js +0 -1
- package/public/assets/2605.3ae8a730.js +0 -1
- package/public/assets/2645.52e9596b.js +0 -1
- package/public/assets/2707.6df3e122.js +0 -1
- package/public/assets/2725.9a21dc87.js +0 -1
- package/public/assets/2743.d8ff9d1a.js +0 -1
- package/public/assets/2748.a74a539c.js +0 -1
- package/public/assets/2751.3761b15d.js +0 -1
- package/public/assets/278.06c0a585.js +0 -1
- package/public/assets/2810.0805c8d3.js +0 -1
- package/public/assets/2816.52f328bf.js +0 -1
- package/public/assets/2872.712f11ad.js +0 -1
- package/public/assets/2881.812773b3.js +0 -1
- package/public/assets/2895.412a0fef.js +0 -1
- package/public/assets/2918.ca9f8ee6.js +0 -1
- package/public/assets/2948.812bfd61.js +0 -1
- package/public/assets/3008.0e0072bf.js +0 -1
- package/public/assets/3084.812f46dd.js +0 -1
- package/public/assets/311.ff658c78.js +0 -1
- package/public/assets/3115.de6d897d.js +0 -1
- package/public/assets/312.6893cc70.js +0 -1
- package/public/assets/3121.abf15015.js +0 -1
- package/public/assets/3123.bb6961b4.js +0 -1
- package/public/assets/3168.f70fdbe1.js +0 -1
- package/public/assets/3260.b9830b0a.js +0 -1
- package/public/assets/331.5979e79c.js +0 -1
- package/public/assets/3323.33607bff.js +0 -1
- package/public/assets/333.62f29c23.js +0 -1
- package/public/assets/3339.55ba3289.js +0 -1
- package/public/assets/3370.ac044cd4.js +0 -1
- package/public/assets/3381.ebf520a0.js +0 -1
- package/public/assets/3384.97088998.js +0 -1
- package/public/assets/3420.d26395e2.js +0 -1
- package/public/assets/3432.9a6cbc9d.js +0 -1
- package/public/assets/3474.c3b0a117.js +0 -1
- package/public/assets/3502.713d8997.js +0 -1
- package/public/assets/3520.8332b3b9.js +0 -1
- package/public/assets/3663.7e96a229.js +0 -1
- package/public/assets/3707.9a1cc57e.js +0 -1
- package/public/assets/3712.ccdacc8b.js +0 -1
- package/public/assets/3724.c7124c16.js +0 -1
- package/public/assets/379.3eba2174.js +0 -1
- package/public/assets/3793.2f8f8fa2.js +0 -1
- package/public/assets/3808.61543a59.js +0 -1
- package/public/assets/3809.ea90d219.js +0 -1
- package/public/assets/382.df49ab73.js +0 -1
- package/public/assets/3844.ad345570.js +0 -1
- package/public/assets/3853.0041121c.js +0 -1
- package/public/assets/3886.4758be08.js +0 -1
- package/public/assets/3911.67d83e56.js +0 -1
- package/public/assets/3945.02b410f7.js +0 -1
- package/public/assets/4025.faefbdf9.js +0 -1
- package/public/assets/4049.274b3781.js +0 -1
- package/public/assets/4058.9bd8b6fd.js +0 -1
- package/public/assets/4087.f5f2aa77.js +0 -1
- package/public/assets/4145.591efba1.js +0 -1
- package/public/assets/4179.0e70c02d.js +0 -1
- package/public/assets/4261.24d2c946.js +0 -1
- package/public/assets/4301.d36b09ac.js +0 -1
- package/public/assets/438.c9ddabb1.js +0 -1
- package/public/assets/4405.195b8807.js +0 -1
- package/public/assets/4429.20a43aee.js +0 -1
- package/public/assets/4445.0593f53c.js +0 -1
- package/public/assets/4447.1f4c2594.js +0 -1
- package/public/assets/4458.b54836f5.js +0 -1
- package/public/assets/4489.e05c3f02.js +0 -1
- package/public/assets/4496.59f9e494.js +0 -1
- package/public/assets/4498.53895790.js +0 -1
- package/public/assets/452.bf34842d.js +0 -1
- package/public/assets/4525.202e71f0.js +0 -1
- package/public/assets/459.d0de752e.js +0 -1
- package/public/assets/4609.539adc7e.js +0 -1
- package/public/assets/4613.2c9412fc.js +0 -1
- package/public/assets/465.6d0c9900.js +0 -1
- package/public/assets/4655.817d8c16.js +0 -1
- package/public/assets/4704.5bd5cd1f.js +0 -1
- package/public/assets/4705.1b7400d1.js +0 -1
- package/public/assets/4785.2c122907.js +0 -1
- package/public/assets/4795.5b28b5a2.js +0 -1
- package/public/assets/4796.38fc127d.js +0 -1
- package/public/assets/4798.061be689.js +0 -1
- package/public/assets/4846.2f6655eb.js +0 -1
- package/public/assets/485.3fe4cb47.js +0 -1
- package/public/assets/4885.c0812b9f.js +0 -1
- package/public/assets/4952.bb1279bd.js +0 -1
- package/public/assets/4983.565b5198.js +0 -1
- package/public/assets/4992.abfa216e.js +0 -1
- package/public/assets/4994.5eac32c7.js +0 -1
- package/public/assets/4996.46cad67b.js +0 -1
- package/public/assets/5068.3fa2fa23.js +0 -1
- package/public/assets/5072.7adfff93.js +0 -1
- package/public/assets/5108.62165adf.js +0 -1
- package/public/assets/5280.bc09c97b.js +0 -1
- package/public/assets/5281.73e94011.js +0 -1
- package/public/assets/5294.b2f2f0bd.js +0 -1
- package/public/assets/5319.e6dcabf9.js +0 -1
- package/public/assets/5393.e6c80ec4.js +0 -1
- package/public/assets/5398.d0384b7e.js +0 -1
- package/public/assets/5415.c896e0e1.js +0 -1
- package/public/assets/544.64addbc4.js +0 -1
- package/public/assets/5453.08deb63c.js +0 -1
- package/public/assets/5458.0095414b.js +0 -1
- package/public/assets/5462.17536a21.js +0 -1
- package/public/assets/5466.7acd94a7.js +0 -1
- package/public/assets/5518.57996485.js +0 -1
- package/public/assets/5530.828452d4.js +0 -1
- package/public/assets/5542.9162530c.js +0 -1
- package/public/assets/5593.0776f2d3.js +0 -1
- package/public/assets/5596.8a7ddea5.js +0 -1
- package/public/assets/5631.f6c57eaf.js +0 -1
- package/public/assets/5646.1b33e69c.js +0 -1
- package/public/assets/5661.164c0709.js +0 -1
- package/public/assets/5678.c096f6c9.js +0 -1
- package/public/assets/5687.587f0e75.js +0 -1
- package/public/assets/5703.5e666028.js +0 -1
- package/public/assets/5708.164057e0.js +0 -1
- package/public/assets/5712.cc503220.js +0 -1
- package/public/assets/575.e898fd86.js +0 -1
- package/public/assets/5752.e018032d.js +0 -1
- package/public/assets/5813.cc59df28.js +0 -1
- package/public/assets/5865.012fa536.js +0 -1
- package/public/assets/5879.47b8e3c2.js +0 -1
- package/public/assets/590.8c02fbf9.js +0 -1
- package/public/assets/5917.87e0acee.js +0 -1
- package/public/assets/5959.c0de70a1.js +0 -1
- package/public/assets/5970.31600f7b.js +0 -1
- package/public/assets/6005.fb7dbdae.js +0 -1
- package/public/assets/6024.c3f22f35.js +0 -1
- package/public/assets/6070.6f66b5fa.js +0 -1
- package/public/assets/6084.26b44499.js +0 -1
- package/public/assets/6085.cb855236.js +0 -1
- package/public/assets/6093.bebbe3da.js +0 -1
- package/public/assets/6106.39b87fca.js +0 -1
- package/public/assets/6122.f064356d.js +0 -1
- package/public/assets/6150.5cb126a5.js +0 -203
- package/public/assets/6157.7eeb3515.js +0 -1
- package/public/assets/616.a5acd2aa.js +0 -1
- package/public/assets/6226.dd8f1fd9.js +0 -1
- package/public/assets/6231.c10ba8f9.js +0 -1
- package/public/assets/6254.69f98e64.js +0 -1
- package/public/assets/6308.9f7b0778.js +0 -1
- package/public/assets/6309.fd92f229.js +0 -1
- package/public/assets/6378.d0087d79.js +0 -1
- package/public/assets/6380.6a320a57.js +0 -1
- package/public/assets/6427.80120ca0.js +0 -1
- package/public/assets/6468.cd796686.js +0 -1
- package/public/assets/655.2424b6f0.js +0 -1
- package/public/assets/6551.1316a8b4.js +0 -1
- package/public/assets/6563.f0ab8ea9.js +0 -1
- package/public/assets/658.d1870bbc.js +0 -1
- package/public/assets/659.43d1bd18.js +0 -1
- package/public/assets/6629.d5835f7b.js +0 -1
- package/public/assets/670.cc579966.js +0 -1
- package/public/assets/6729.711b6a33.js +0 -1
- package/public/assets/6739.5df85504.js +0 -1
- package/public/assets/6766.b3b93d6b.js +0 -1
- package/public/assets/6781.8330074c.js +0 -1
- package/public/assets/6829.f83cf943.js +0 -1
- package/public/assets/6855.c3b857c6.js +0 -1
- package/public/assets/6883.55fcdbea.js +0 -1
- package/public/assets/6900.abab0925.js +0 -1
- package/public/assets/6956.8307b311.js +0 -1
- package/public/assets/6959.7c488de5.js +0 -1
- package/public/assets/698.ebc84dc0.js +0 -1
- package/public/assets/7015.a05d0b78.js +0 -1
- package/public/assets/702.98bd9103.js +0 -1
- package/public/assets/703.285f3139.js +0 -1
- package/public/assets/7091.027a641c.js +0 -1
- package/public/assets/7104.9c59e320.js +0 -1
- package/public/assets/7113.0dfbe544.js +0 -1
- package/public/assets/7135.e9ab3841.js +0 -1
- package/public/assets/7143.612c372b.js +0 -1
- package/public/assets/7198.dc23f6fa.js +0 -1
- package/public/assets/7228.5b31dd65.js +0 -1
- package/public/assets/7234.bec30557.js +0 -1
- package/public/assets/7330.b15282a7.js +0 -1
- package/public/assets/7342.6f18177c.js +0 -1
- package/public/assets/7350.e46146b3.js +0 -1
- package/public/assets/7372.863b3f51.js +0 -1
- package/public/assets/7387.78fae2d9.js +0 -1
- package/public/assets/7403.acdec0cd.js +0 -1
- package/public/assets/7404.c90b9555.js +0 -1
- package/public/assets/7454.61df5c53.js +0 -1
- package/public/assets/7459.91247a0c.js +0 -1
- package/public/assets/7620.1317e4da.js +0 -1
- package/public/assets/7655.a8e05941.js +0 -1
- package/public/assets/7662.5c5fd466.js +0 -1
- package/public/assets/7698.68eab02c.js +0 -1
- package/public/assets/7714.6a6656ee.js +0 -1
- package/public/assets/7774.b546561d.js +0 -1
- package/public/assets/7822.264595e9.js +0 -1
- package/public/assets/7827.9a988ed6.js +0 -1
- package/public/assets/7858.565180cd.js +0 -1
- package/public/assets/7880.23c4af6f.js +0 -1
- package/public/assets/7921.796cf6f2.js +0 -1
- package/public/assets/7950.9222be47.js +0 -1
- package/public/assets/7992.1bbe27a2.js +0 -1
- package/public/assets/7993.3e415bcd.js +0 -1
- package/public/assets/8012.1df6c7ba.js +0 -1
- package/public/assets/8014.1618a26d.js +0 -1
- package/public/assets/8095.3b776dc1.js +0 -1
- package/public/assets/8115.01697474.js +0 -1
- package/public/assets/8134.2dbefad3.js +0 -1
- package/public/assets/8173.98e9cda8.js +0 -1
- package/public/assets/8178.4448a8c8.js +0 -1
- package/public/assets/8189.726f5bba.js +0 -1
- package/public/assets/8250.6a31d3db.js +0 -1
- package/public/assets/8252.46abb10d.js +0 -1
- package/public/assets/8286.7165c5ae.js +0 -1
- package/public/assets/829.57aaa21f.js +0 -1
- package/public/assets/8295.510e74b2.js +0 -1
- package/public/assets/8306.ffe7fef6.js +0 -1
- package/public/assets/8336.071bb524.js +0 -1
- package/public/assets/8346.cfd200d8.js +0 -1
- package/public/assets/8349.8746a8e4.js +0 -1
- package/public/assets/8375.0bf25482.js +0 -1
- package/public/assets/8387.7849a364.js +0 -1
- package/public/assets/8408.7b3b0706.js +0 -1
- package/public/assets/8423.da4adde4.js +0 -1
- package/public/assets/8437.67cbb62b.js +0 -1
- package/public/assets/8439.4ab411cf.js +0 -1
- package/public/assets/8447.805e1fbb.js +0 -1
- package/public/assets/8481.30bb3786.js +0 -1
- package/public/assets/8531.0e8a1bcd.js +0 -1
- package/public/assets/855.c45d80d8.js +0 -1
- package/public/assets/857.47395203.js +0 -1
- package/public/assets/8601.e90cd434.js +0 -1
- package/public/assets/8671.f9b853f6.js +0 -1
- package/public/assets/8696.2db4dd40.js +0 -1
- package/public/assets/8698.d8c25bfd.js +0 -1
- package/public/assets/8725.2a97b2e0.js +0 -1
- package/public/assets/8767.f7dbaf81.js +0 -1
- package/public/assets/877.0d1df971.js +0 -1
- package/public/assets/8799.b2bc36a0.js +0 -1
- package/public/assets/8805.e166d436.js +0 -1
- package/public/assets/8861.8e37cb89.js +0 -1
- package/public/assets/8943.d35181ef.js +0 -1
- package/public/assets/9020.b1614bfe.js +0 -1
- package/public/assets/9048.8a6be463.js +0 -1
- package/public/assets/9060.f88d7ff2.js +0 -1
- package/public/assets/9109.e2cef4ae.js +0 -1
- package/public/assets/9120.0baa1b3f.js +0 -1
- package/public/assets/9172.9b1d2d6a.js +0 -1
- package/public/assets/920.5f971a4e.js +0 -1
- package/public/assets/9279.7ff451d0.js +0 -1
- package/public/assets/9285.c26079c7.js +0 -1
- package/public/assets/9297.7162de0e.js +0 -1
- package/public/assets/9328.a33ba701.js +0 -1
- package/public/assets/940.5806c487.js +0 -1
- package/public/assets/9403.d4200316.js +0 -1
- package/public/assets/9412.5849ed28.js +0 -1
- package/public/assets/9420.c4e70fab.js +0 -1
- package/public/assets/9467.1a7a6c92.js +0 -1
- package/public/assets/9502.c84dc29b.js +0 -1
- package/public/assets/9556.97e5f142.js +0 -1
- package/public/assets/9557.b10d5e41.js +0 -1
- package/public/assets/9597.c517cbfd.js +0 -1
- package/public/assets/96.fdb82714.js +0 -1
- package/public/assets/9619.35683308.js +0 -1
- package/public/assets/9623.437474fc.js +0 -1
- package/public/assets/9663.1210b76e.js +0 -1
- package/public/assets/9671.40a11985.js +0 -1
- package/public/assets/969.ce9121b3.js +0 -1
- package/public/assets/9695.84356bbf.js +0 -1
- package/public/assets/9728.4f98e0ce.js +0 -1
- package/public/assets/9770.df634bdf.js +0 -1
- package/public/assets/9842.6faee06c.js +0 -1
- package/public/assets/9886.1c62a8ff.js +0 -1
- package/public/assets/9888.e3c97777.js +0 -1
- package/public/assets/9918.7ac5f09c.js +0 -1
- package/public/assets/9927.89711a15.js +0 -1
- package/public/assets/9940.70581af3.js +0 -1
- package/public/assets/9990.cf02a3de.js +0 -1
- package/public/assets/main.1dd9982a.js +0 -62
- package/public/assets/main.830c7494.css +0 -2
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_seaveyon_harness_switch_web=self.webpackChunk_seaveyon_harness_switch_web||[]).push([["780"],{9507(e,t,n){let i,r,o;n.d(t,{T:()=>nY});let a="diffs-container";(()=>{try{return!1}catch{return!1}})();let l=/(?=^diff --git)/gm,s=/(?<=\n)/,d=/^(---|\+\+\+)\s+([^\t\r\n]+)/,u=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,h=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,c=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,f="header-prefix",p="header-filename-suffix",g="header-metadata",m="header-custom",b={dark:"pierre-dark",light:"pierre-light"},v="--diffs-scrollbar-gutter-measured",y={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8};({...y,hunkLineCount:1});let C=Object.freeze({fromStart:0,fromEnd:0}),S={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},k={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0};function x(e,t){return e-(0!==t)+t}function w(e){let t=e.length;return 10===e.charCodeAt(t-1)&&(t--,13===e.charCodeAt(t-1)&&t--),e.slice(0,t)}let L=new TextEncoder,A=new TextDecoder("utf-8",{ignoreBOM:!0}),E=/[\uD800-\uDFFF]/,R=new Uint8Array(1024);function _(e){if(0===e.length)return e;if(E.test(e))return JSON.parse(JSON.stringify(e));let t=3*e.length;R.length<t&&(R=new Uint8Array(t));let{written:n}=L.encodeInto(e,R);return A.decode(R.subarray(0,n))}let T=/\s+/g;function I(e){return e.replace(T,"")}function M(e){let t=P(e);for(let e=0;e<t.length;e++)t[e]=_(t[e]);return t}function P(e){if(0===e.length)return[""];let t=[],n=0;for(;;){let i=e.indexOf("\n",n);if(-1===i)break;t.push(e.slice(n,i+1)),n=i+1}return n<e.length&&t.push(e.slice(n)),t}function N(e,t){let n=t,i=0;for(;n<e.length;n++){let t=e.charCodeAt(n)-48;if(t<0||t>9)break;i=10*i+t}if(n!==t)return{value:i,endIndex:n}}function D(e,t,n){let i=e.indexOf(t,n);return -1===i?-1:i+1}function H(e){return null==e?e:_(e)}function O(e){let t=e.slice(1);return _(""===t?"\n":t)}function $(e,t,n){return"change"===e?{type:"change",additions:0,deletions:0,additionLineIndex:n,deletionLineIndex:t}:{type:"context",lines:0,additionLineIndex:n,deletionLineIndex:t}}class F{diff(e,t,n={}){let i;"function"==typeof n?(i=n,n={}):"callback"in n&&(i=n.callback);let r=this.castInput(e,n),o=this.castInput(t,n),a=this.removeEmpty(this.tokenize(r,n)),l=this.removeEmpty(this.tokenize(o,n));return this.diffWithOptionsObj(a,l,n,i)}diffWithOptionsObj(e,t,n,i){var r;let o=e=>(e=this.postProcess(e,n),i)?void setTimeout(function(){i(e)},0):e,a=t.length,l=e.length,s=1,d=a+l;null!=n.maxEditLength&&(d=Math.min(d,n.maxEditLength));let u=null!=(r=n.timeout)?r:1/0,h=Date.now()+u,c=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(c[0],t,e,0,n);if(c[0].oldPos+1>=l&&f+1>=a)return o(this.buildValues(c[0].lastComponent,t,e));let p=-1/0,g=1/0,m=()=>{for(let i=Math.max(p,-s);i<=Math.min(g,s);i+=2){let r,s=c[i-1],d=c[i+1];s&&(c[i-1]=void 0);let u=!1;if(d){let e=d.oldPos-i;u=d&&0<=e&&e<a}let h=s&&s.oldPos+1<l;if(!u&&!h){c[i]=void 0;continue}if(r=!h||u&&s.oldPos<d.oldPos?this.addToPath(d,!0,!1,0,n):this.addToPath(s,!1,!0,1,n),f=this.extractCommon(r,t,e,i,n),r.oldPos+1>=l&&f+1>=a)return o(this.buildValues(r.lastComponent,t,e))||!0;c[i]=r,r.oldPos+1>=l&&(g=Math.min(g,i-1)),f+1>=a&&(p=Math.max(p,i+1))}s++};if(i)!function e(){setTimeout(function(){if(s>d||Date.now()>h)return i(void 0);m()||e()},0)}();else for(;s<=d&&Date.now()<=h;){let e=m();if(e)return e}}addToPath(e,t,n,i,r){let o=e.lastComponent;return o&&!r.oneChangePerToken&&o.added===t&&o.removed===n?{oldPos:e.oldPos+i,lastComponent:{count:o.count+1,added:t,removed:n,previousComponent:o.previousComponent}}:{oldPos:e.oldPos+i,lastComponent:{count:1,added:t,removed:n,previousComponent:o}}}extractCommon(e,t,n,i,r){let o=t.length,a=n.length,l=e.oldPos,s=l-i,d=0;for(;s+1<o&&l+1<a&&this.equals(n[l+1],t[s+1],r);)s++,l++,d++,r.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return d&&!r.oneChangePerToken&&(e.lastComponent={count:d,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=l,s}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join("")}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let i,r=[];for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let o=r.length,a=0,l=0,s=0;for(;a<o;a++){let e=r[a];if(e.removed)e.value=this.join(n.slice(s,s+e.count)),s+=e.count;else{if(!e.added&&this.useLongestToken){let i=t.slice(l,l+e.count);i=i.map(function(e,t){let i=n[s+t];return i.length>e.length?i:e}),e.value=this.join(i)}else e.value=this.join(t.slice(l,l+e.count));l+=e.count,e.added||(s+=e.count)}}return r}}let z=new class extends F{constructor(){super(...arguments),this.tokenize=U}equals(e,t,n){return n.ignoreWhitespace?(n.newlineIsToken&&e.includes("\n")||(e=e.trim()),n.newlineIsToken&&t.includes("\n")||(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith("\n")&&(e=e.slice(0,-1)),t.endsWith("\n")&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function U(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,"\n"));let n=[],i=e.split(/(\n|\r\n)/);i[i.length-1]||i.pop();for(let e=0;e<i.length;e++){let r=i[e];e%2&&!t.newlineIsToken?n[n.length-1]+=r:n.push(r)}return n}function B(e){if(!function(e){for(let t=0;t<e.length;t++)if(e[t]<" "||e[t]>"~"||'"'===e[t]||"\\"===e[t])return!0;return!1}(e))return e;let t='"',n=new TextEncoder().encode(e),i=0;for(;i<n.length;){let e=n[i];7===e?t+="\\a":8===e?t+="\\b":9===e?t+="\\t":10===e?t+="\\n":11===e?t+="\\v":12===e?t+="\\f":13===e?t+="\\r":34===e?t+='\\"':92===e?t+="\\\\":e>=32&&e<=126?t+=String.fromCharCode(e):t+="\\"+e.toString(8).padStart(3,"0"),i++}return t+'"'}let G={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function j(e,t,n,i,r,o,a){var l;let s;void 0===(s=a?"function"==typeof a?{callback:a}:a:{}).context&&(s.context=4);let d=s.context;if(s.newlineIsToken)throw Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(!s.callback)return u(z.diff(n,i,s));{let{callback:e}=s;l=Object.assign(Object.assign({},s),{callback:t=>{e(u(t))}}),z.diff(n,i,l)}function u(n){if(!n)return;function i(e){return e.map(function(e){return" "+e})}n.push({value:"",lines:[]});let a=[],l=0,s=0,u=[],h=1,c=1;for(let e=0;e<n.length;e++){let t=n[e],r=t.lines||function(e){let t=e.endsWith("\n"),n=e.split("\n").map(e=>e+"\n");return t?n.pop():n.push(n.pop().slice(0,-1)),n}(t.value);if(t.lines=r,t.added||t.removed){if(!l){let t=n[e-1];l=h,s=c,t&&(l-=(u=d>0?i(t.lines.slice(-d)):[]).length,s-=u.length)}for(let e of r)u.push((t.added?"+":"-")+e);t.added?c+=r.length:h+=r.length}else{if(l)if(r.length<=2*d&&e<n.length-2)for(let e of i(r))u.push(e);else{let e=Math.min(r.length,d);for(let t of i(r.slice(0,e)))u.push(t);let t={oldStart:l,oldLines:h-l+e,newStart:s,newLines:c-s+e,lines:u};a.push(t),l=0,s=0,u=[]}h+=r.length,c+=r.length}}for(let e of a)for(let t=0;t<e.lines.length;t++)e.lines[t].endsWith("\n")?e.lines[t]=e.lines[t].slice(0,-1):(e.lines.splice(t+1,0,"\"),t++);return{oldFileName:e,newFileName:t,oldHeader:r,newHeader:o,hunks:a}}}function W(e,t){var n,i,r,o,a,l;if(t||(t=G),Array.isArray(e)){if(e.length>1&&!t.includeFileHeaders&&!e.every(e=>e.isGit))throw Error("Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)");return e.map(e=>W(e,t)).join("\n")}let s=[];if(e.isGit){if(t=G,!e.oldFileName)throw Error("oldFileName must be specified for Git patches");if(!e.newFileName)throw Error("newFileName must be specified for Git patches");let d=e.oldFileName,u=e.newFileName;e.isCreate&&"/dev/null"===d?d=u.replace(/^b\//,"a/"):e.isDelete&&"/dev/null"===u&&(u=d.replace(/^a\//,"b/")),s.push("diff --git "+B(d)+" "+B(u)),e.isDelete&&s.push("deleted file mode "+(null!=(n=e.oldMode)?n:"100644")),e.isCreate&&s.push("new file mode "+(null!=(i=e.newMode)?i:"100644")),e.oldMode&&e.newMode&&!e.isDelete&&!e.isCreate&&(s.push("old mode "+e.oldMode),s.push("new mode "+e.newMode)),e.isRename&&(s.push("rename from "+B((null!=(r=e.oldFileName)?r:"").replace(/^a\//,""))),s.push("rename to "+B((null!=(o=e.newFileName)?o:"").replace(/^b\//,"")))),e.isCopy&&(s.push("copy from "+B((null!=(a=e.oldFileName)?a:"").replace(/^a\//,""))),s.push("copy to "+B((null!=(l=e.newFileName)?l:"").replace(/^b\//,""))))}else t.includeIndex&&e.oldFileName==e.newFileName&&void 0!==e.oldFileName&&s.push("Index: "+e.oldFileName),t.includeUnderline&&s.push("===================================================================");let d=e.hunks.length>0;t.includeFileHeaders&&void 0!==e.oldFileName&&void 0!==e.newFileName&&(!e.isGit||d)&&(s.push("--- "+B(e.oldFileName)+(e.oldHeader?" "+e.oldHeader:"")),s.push("+++ "+B(e.newFileName)+(e.newHeader?" "+e.newHeader:"")));for(let t=0;t<e.hunks.length;t++){let n=e.hunks[t],i=0===n.oldLines?n.oldStart-1:n.oldStart,r=0===n.newLines?n.newStart-1:n.newStart;for(let e of(s.push("@@ -"+i+","+n.oldLines+" +"+r+","+n.newLines+" @@"),n.lines))s.push(e)}return s.join("\n")+"\n"}function V(e,t,n,i=!1){let r,o;if(null===e&&null===t)throw Error("parseDiffFromFile: You must pass oldFile, newFile, or both");let a=e??q(),s=t??q(),f=function(e,t){try{return function(e,{cacheKey:t,isGitDiff:n=l.test(e),oldFile:i,newFile:r,throwOnError:o=!1}={}){let a,s=0,f=function(e){if(0===e.length)return[""];let t=`
|
|
2
|
+
@@ `,n=e.startsWith("@@ ")?0:D(e,t,0);if(-1===n)return[e];let i=[];n>0&&i.push(e.slice(0,n));let r=n;for(;;){let n=D(e,t,r+1);if(-1===n)break;i.push(e.slice(r,n)),r=n}return i.push(e.slice(r)),i}(e),p=null==i||null==r,g=0,m=0;for(let e of f){var b,v,y;let l,f,C=P(e),S=C[0];if(null==S){if(o)throw Error("parsePatchContent: invalid hunk");console.error("parsePatchContent: invalid hunk",e);continue}let k=function(e){var t;let n;if(!e.startsWith("@@ -"))return;let i=4,r=N(e,4);if(null==r)return;let o=r.value;i=r.endIndex;let a=1;if(","===e[i]){let t=N(e,i+1);if(null==t)return;a=t.value,i=t.endIndex}if(" "!==e[i]||"+"!==e[i+1])return;let l=N(e,i+=2);if(null==l)return;let s=l.value;i=l.endIndex;let d=1;if(","===e[i]){let t=N(e,i+1);if(null==t)return;d=t.value,i=t.endIndex}if(" "!==e[i]||"@"!==e[i+1]||"@"!==e[i+2])return;let u=i+3;return" "===e[u]&&(n=(t=e.slice(u+1)).endsWith("\r\n")?t.slice(0,-2):t.endsWith("\n")?t.slice(0,-1):t),{additionCount:d,additionStart:s,deletionCount:a,deletionStart:o,hunkContext:n}}(S),L=0,A=0;if(null==k||null==a){if(null!=a){if(o)throw Error("parsePatchContent: Invalid hunk");console.error("parsePatchContent: Invalid hunk",e);continue}for(let e of(1===(a={name:"",type:"change",hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:p,additionLines:p||null==i||null==r?[]:M(r.contents),deletionLines:p||null==i||null==r?[]:M(i.contents),cacheKey:H(t)}).additionLines.length&&r?.contents===""&&(a.additionLines.length=0),1===a.deletionLines.length&&i?.contents===""&&(a.deletionLines.length=0),C)){if(e.startsWith("diff --git")){let t=e.trim().match(h),n=t?.[1]??t?.[2],i=t?.[3]??t?.[4];if(null==n||null==i){if(o)throw Error("parsePatchContent: invalid git diff header");console.error("parsePatchContent: invalid git diff header",e);continue}a.name=_(i.trim()),n!==i&&(a.prevName=_(n.trim()));continue}let t=e.startsWith("---")||e.startsWith("+++")?e.match(n?u:d):null;if(null!=t){let[,e,n]=t;if("---"===e&&"/dev/null"!==n){let e=_(n.trim());a.prevName=e,a.name=e}else"+++"===e&&"/dev/null"!==n&&(a.name=_(n.trim()))}else if(n){if(e.startsWith("new mode ")&&(a.mode=_(e.slice(8).trim())),e.startsWith("old mode ")&&(a.prevMode=_(e.slice(8).trim())),e.startsWith("new file mode")&&(a.type="new",a.mode=_(e.slice(13).trim())),e.startsWith("deleted file mode")&&(a.type="deleted",a.mode=_(e.slice(17).trim())),e.startsWith("similarity index")&&(e.startsWith("similarity index 100%")?a.type="rename-pure":a.type="rename-changed"),e.startsWith("index ")){let[,t,n,i]=e.trim().match(c)??[];null!=t&&(a.prevObjectId=_(t)),null!=n&&(a.newObjectId=_(n)),null!=i&&(a.mode=_(i))}e.startsWith("rename from ")&&(a.prevName=_(e.slice(12).trim())),e.startsWith("rename to ")&&(a.name=_(e.slice(10).trim()))}}continue}for(;C.length>0&&("\n"===C[C.length-1]||"\r"===C[C.length-1]||"\r\n"===C[C.length-1]||""===C[C.length-1]);)C.pop();let{additionStart:E,deletionStart:R}=k;g=p?g:R-1,m=p?m:E-1;let T={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:k.additionCount,additionStart:E,additionLines:L,deletionCount:k.deletionCount,deletionStart:R,deletionLines:A,deletionLineIndex:g,additionLineIndex:m,hunkContent:[],hunkContext:H(k.hunkContext),hunkSpecs:_(S),noEOFCRAdditions:!1,noEOFCRDeletions:!1},I=0,D=0;for(let e=1;e<C.length;e++){let t=C[e];if(I>=T.additionCount&&D>=T.deletionCount&&!t.startsWith("\\")){if(o&&function(e){let t=e[0];return"+"===t||"-"===t||" "===t}(t)&&!function(e){if(!e.startsWith("--"))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(" "!==n&&" "!==n&&"\n"!==n&&"\r"!==n)return!1}return!0}(t))throw Error("parsePatchContent: hunk has more lines than expected");break}let n=t[0];if("+"!==n&&"-"!==n&&" "!==n&&"\\"!==n){if(o)throw Error("parsePatchContent: invalid hunk line");console.error(`parseLineType: Invalid firstChar: "${n}", full line: "${t}"`),console.error("processFile: invalid rawLine:",t);continue}let i=(b=n," "===b?"context":"\\"===b?"metadata":"+"===b?"addition":"deletion");if("addition"===i){if(o&&I>=T.additionCount)throw Error("parsePatchContent: hunk has too many addition lines");let e=O(t);(null==l||"change"!==l.type)&&(l=$("change",g,m),T.hunkContent.push(l)),m++,I++,p&&a.additionLines.push(e),l.additions++,L++,f="addition"}else if("deletion"===i){if(o&&D>=T.deletionCount)throw Error("parsePatchContent: hunk has too many deletion lines");let e=O(t);(null==l||"change"!==l.type)&&(l=$("change",g,m),T.hunkContent.push(l)),g++,D++,p&&a.deletionLines.push(e),l.deletions++,A++,f="deletion"}else if("context"===i){if(o&&(D>=T.deletionCount||I>=T.additionCount))throw Error("parsePatchContent: hunk has too many context lines");let e=O(t);(null==l||"context"!==l.type)&&(l=$("context",g,m),T.hunkContent.push(l)),m++,g++,I++,D++,p&&(a.deletionLines.push(e),a.additionLines.push(e)),l.lines++,f="context"}else if("metadata"===i&&null!=l){if("context"===l.type?(T.noEOFCRAdditions=!0,T.noEOFCRDeletions=!0):"deletion"===f?T.noEOFCRDeletions=!0:"addition"===f&&(T.noEOFCRAdditions=!0),p&&("addition"===f||"context"===f)){let e=a.additionLines.length-1;e>=0&&(a.additionLines[e]=w(a.additionLines[e]))}if(p&&("deletion"===f||"context"===f)){let e=a.deletionLines.length-1;e>=0&&(a.deletionLines[e]=w(a.deletionLines[e]))}}}if(o&&(I!==T.additionCount||D!==T.deletionCount))throw Error("parsePatchContent: hunk line count mismatch");for(let e of(T.additionLines=L,T.deletionLines=A,T.collapsedBefore=Math.max((v=T.additionStart,y=T.additionCount,v-(0!==y)-s),0),a.hunks.push(T),s=x(T.additionStart,T.additionCount),T.hunkContent))"context"===e.type?(T.splitLineCount+=e.lines,T.unifiedLineCount+=e.lines):(T.splitLineCount+=Math.max(e.additions,e.deletions),T.unifiedLineCount+=e.deletions+e.additions);T.splitLineStart=a.splitLineCount+T.collapsedBefore,T.unifiedLineStart=a.unifiedLineCount+T.collapsedBefore,a.splitLineCount+=T.collapsedBefore+T.splitLineCount,a.unifiedLineCount+=T.collapsedBefore+T.unifiedLineCount}if(null!=a){if(o&&p&&!n&&0===a.hunks.length)throw Error("parsePatchContent: unified file has no hunks");if(a.hunks.length>0&&!p&&a.additionLines.length>0&&a.deletionLines.length>0){let e=a.hunks[a.hunks.length-1],t=x(e.additionStart,e.additionCount),n=Math.max(a.additionLines.length-t,0);a.splitLineCount+=n,a.unifiedLineCount+=n}n||(null!=a.prevName&&a.name!==a.prevName?a.hunks.length>0?a.type="rename-changed":a.type="rename-pure":(null==i||""===i.contents)&&null!=r&&""!==r.contents?a.type="new":null!=i&&""!==i.contents&&(null==r||""===r.contents)&&(a.type="deleted")),"rename-pure"!==a.type&&"rename-changed"!==a.type&&(a.prevName=void 0);var C=a;for(let e of C.hunks){for(let t=0;t<e.hunkContent.length;t++){let n=e.hunkContent[t];if("change"!==n.type)continue;let i=function(e,t){let{deletions:n,additions:i,deletionLineIndex:r,additionLineIndex:o}=t,a=Math.min(n,i),l=Math.abs(i-n);if(0===a||0===l||a*(l+1)>4096)return null;let s=[];for(let t=0;t<n;t++)s.push(I(e.deletionLines[r+t]??""));let d=[];for(let t=0;t<i;t++)d.push(I(e.additionLines[o+t]??""));let u=i>n,h=0,c=-1;for(let e=0;e<=l;e++){let t=0;for(let n=0;n<a;n++)t+=function(e,t){if(e===t)return 1;let n=Math.max(e.length,t.length),i=Math.min(e.length,t.length);if(0===i)return 0;let r=0;for(;r<i&&e[r]===t[r];)r++;let o=0;for(;o<i-r&&e[e.length-1-o]===t[t.length-1-o];)o++;return(r+o)/n}(s[n+(u?0:e)],d[n+(u?e:0)]);0===e?c=t+.5*a:t>c&&(c=t,h=e)}if(0===h)return null;let f=[],p=(e,t,n,i)=>{(e>0||t>0)&&f.push({type:"change",deletions:e,additions:t,deletionLineIndex:n,additionLineIndex:i})};return u?(p(0,h,r,o),p(a,a,r,o+h),p(0,i-a-h,r+a,o+h+a)):(p(h,0,r,o),p(a,a,r+h,o),p(n-a-h,0,r+h+a,o+a)),f}(C,n);null!=i&&(e.hunkContent.splice(t,1,...i),t+=i.length-1)}!function(e,t){let{hunkContent:n}=e;for(let e=1;e<n.length;e++){let i=n[e],r=n[e-1];if("change"!==i.type||i.additions>0&&i.deletions>0||"context"!==r.type)continue;let o=i.additions>0,a=o?t.additionLines:t.deletionLines,l=o?i.additionLineIndex:i.deletionLineIndex,s=o?i.additions:i.deletions,d=a[l]??"";if(""!==d.trim())continue;let u=!0;for(let e=1;e<s;e++)if(a[l+e]!==d){u=!1;break}if(!u)continue;let h=0;for(;h<r.lines&&t.additionLines[r.additionLineIndex+r.lines-1-h]===d;)h++;if(0===h||1===e&&h===r.lines)continue;i.additionLineIndex-=h,i.deletionLineIndex-=h;let c=i.additionLineIndex+i.additions,f=i.deletionLineIndex+i.deletions,p=n[e+1];p?.type==="context"?(p.lines+=h,p.additionLineIndex=c,p.deletionLineIndex=f):n.splice(e+1,0,{type:"context",lines:h,additionLineIndex:c,deletionLineIndex:f}),r.lines-=h,0===r.lines&&(n.splice(e-1,1),e--)}}(e,C)}return a}}(e,t)}finally{1024!==R.length&&(R=new Uint8Array(1024))}}(function(e,t,n,i,r,o,a){if("function"==typeof a&&(a={callback:a}),null==a?void 0:a.callback){let{callback:l}=a;j(e,t,n,i,r,o,Object.assign(Object.assign({},a),{callback:e=>{e?l(W(e,a.headerOptions)):l(void 0)}}))}else{let l=j(e,t,n,i,r,o,a);if(!l)return;return W(l,null==a?void 0:a.headerOptions)}}(a.name,s.name,a.contents,s.contents,a.header,s.header,n),{cacheKey:(r=e?.cacheKey??e?.name,o=t?.cacheKey??t?.name,null!=r&&null!=o?r+":"+o:r??o),oldFile:a,newFile:s,throwOnError:i});if(null==f)throw Error("parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?");null===e?(f.type="new",f.prevName=void 0):null===t&&(f.type="deleted",f.prevName=void 0);let p=t?.lang??(null===t?e?.lang:void 0);return null!=p&&(f.lang=p),f}function q(){return{name:"/dev/null",contents:""}}function K(e){return`annotation-${"side"in e?`${e.side}-`:""}${e.lineNumber}`}let X={position:"absolute",top:0,bottom:0,textAlign:"center",whiteSpace:"normal",touchAction:"none"},Y={display:"contents"};function Z(){return null}var Q=n(1085);function J(e,t,n){if(e===t||null==e||null==t)return e===t;let i=new Set(n),r=Object.keys(e),o=new Set(Object.keys(t));for(let n of r)if(o.delete(n),!i.has(n)&&(!(n in t)||e[n]!==t[n]))return!1;for(let e of Array.from(o))if(!i.has(e))return!1;return!0}function ee(e,t){return null==e||null==t||"string"==typeof e||"string"==typeof t?e===t:e.dark===t.dark&&e.light===t.light}function et(e,t){let n=e?.theme??b,i=t?.theme??b,r=en(e),o=en(t);return ee(n,i)&&J(e,t,["theme","parseDiffOptions"])&&J(r,o)}function en(e){if(null!=e&&"parseDiffOptions"in e)return e.parseDiffOptions}let ei=new Set,er=null;function eo(e){ei.add(e),er??=requestAnimationFrame(el)}function ea(e){ei.delete(e)&&0===ei.size&&null!=er&&(cancelAnimationFrame(er),er=null)}function el(e){let t=new Set(ei);for(let n of(ei.clear(),t))try{n(e)}catch(e){console.error(e)}er=ei.size>0?requestAnimationFrame(el):null}function es(e){return{...y,...e}}function ed(e,t){var n,i;let r=(n=e,i=t,n.paddingTop??(i?n.spacing:0));return t?r:e.diffHeaderHeight+r}function eu(e){return e.paddingBottom??e.spacing}function eh(e){var t;return[(t=e.additionStart,t-(0!==e.additionCount)+1),x(e.additionStart,e.additionCount)+1]}function ec({isPartial:e,rangeSize:t,expandedHunks:n,hunkIndex:i,collapsedContextThreshold:r}){let o=Math.max(t,0);if(0===o||e)return{fromStart:0,fromEnd:0,rangeSize:o,collapsedLines:o,renderAll:!1};if(!0===n||o<=r)return{fromStart:o,fromEnd:0,rangeSize:o,collapsedLines:0,renderAll:!0};let a=n?.get(i),l=Math.min(Math.max(a?.fromStart??0,0),o),s=Math.min(Math.max(a?.fromEnd??0,0),o),d=l+s,u=d>=o;return{fromStart:u?o:l,fromEnd:u?0:s,rangeSize:o,collapsedLines:Math.max(o-d,0),renderAll:u}}function ef({fileDiff:e,errorPrefix:t}){let n=e.hunks[e.hunks.length-1];if(null==n||e.isPartial||0===e.additionLines.length||0===e.deletionLines.length)return 0;let i=e.additionLines.length-x(n.additionStart,n.additionCount),r=e.deletionLines.length-x(n.deletionStart,n.deletionCount);if(i<=0&&r<=0)return 0;if(i!==r)throw Error(`${t}: trailing context mismatch (additions=${i}, deletions=${r}) for ${e.name}`);return Math.min(i,r)}function ep({fileDiff:e,hunkIndex:t,expandedHunks:n,collapsedContextThreshold:i,errorPrefix:r}){if(t!==e.hunks.length-1)return;let o=ef({fileDiff:e,errorPrefix:r});if(o<=0)return;if(!0===n||o<=i)return{fromStart:o,fromEnd:0,rangeSize:o,collapsedLines:0,renderAll:!0};let a=n?.get(e.hunks.length),l=Math.min(Math.max(a?.fromStart??0,0),o);return{fromStart:l,fromEnd:0,rangeSize:o,collapsedLines:o-l,renderAll:l>=o}}function eg({fileDiff:e,lineNumber:t,expandedHunks:n,collapsedContextThreshold:i}){if(!0===n||e.isPartial)return!0;for(let[r,o]of e.hunks.entries()){let[a,l]=eh(o);if(t<a){let l=ec({isPartial:e.isPartial,rangeSize:o.collapsedBefore,expandedHunks:n,hunkIndex:r,collapsedContextThreshold:i}),s=a-l.rangeSize;return l.renderAll||t<s+l.fromStart||t>=a-l.fromEnd}if(t<l)return!0}let r=ep({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:n,collapsedContextThreshold:i,errorPrefix:"isAdditionLineRenderable"});if(null==r||r.renderAll)return!0;let[,o]=eh(e.hunks[e.hunks.length-1]);return t<o+r.fromStart||t>=o+r.rangeSize}function em({type:e,metrics:t}){return t.hunkSeparatorHeight??function(e){switch(e){case"simple":return 4;case"metadata":case"line-info":case"line-info-basic":case"custom":return 32}}(e)}function eb({type:e,metrics:t}){return"simple"===e||"metadata"===e||"line-info-basic"===e?0:t.spacing}function ev({type:e,metrics:t,hunkIndex:n,hunkSpecs:i}){if(!function({type:e,hunkIndex:t,hunkSpecs:n}){switch(e){case"simple":return t>0;case"metadata":return null!=n;case"line-info":case"line-info-basic":case"custom":return!0}}({type:e,hunkIndex:n,hunkSpecs:i}))return;let r=em({type:e,metrics:t}),o=eb({type:e,metrics:t}),a=n>0?o:0;return{height:r,gapBefore:a,gapAfter:o,totalHeight:a+r+o}}function ey({type:e,metrics:t}){if("simple"===e||"metadata"===e)return;let n=em({type:e,metrics:t}),i=eb({type:e,metrics:t});return{height:n,gapBefore:i,gapAfter:0,totalHeight:i+n}}function eC(e,t){let n=V({name:e.prevName??e.name,contents:e.deletionLines.join("")},{name:e.name,contents:e.additionLines.join(""),lang:e.lang},t);return{hunks:n.hunks,splitLineCount:n.splitLineCount,unifiedLineCount:n.unifiedLineCount,additionLines:n.additionLines,deletionLines:n.deletionLines,type:n.type}}function eS(e,t){return t.length>0&&t.length<e.deletionLines.length&&function(e){for(let t of e)if(t.trim().length>0)return!1;return!0}(t)}function ek(e,t,n){var i;let r,o,a=e.deletionLines.join(""),l=(i=t.length,(o=Array.from({length:r=Math.max(i,1)},(e,t)=>`${" ".repeat(t+1)}
|
|
3
|
+
`).join(""))===a&&(o=Array.from({length:r},(e,t)=>`\u0000${" ".repeat(t)}
|
|
4
|
+
`).join("")),o),s=V({name:e.prevName??e.name,contents:a},{name:e.name,contents:l,lang:e.lang},n);return{hunks:s.hunks,splitLineCount:s.splitLineCount,unifiedLineCount:s.unifiedLineCount,additionLines:t,deletionLines:s.deletionLines,type:s.type}}function ex(e,t){return ek(e,[""],t)}function ew(e,t){if(0===e.additionLines.length)return ex(e,t);if(eS(e,e.additionLines))return ek(e,e.additionLines,t);let n=e.additionLines,i=eC(e,t);return eL(i,n),i}function eL(e,t){if(!(t.length>1&&""===t.at(-1)))return;let n=t.length-e.additionLines.length;if(n<=0)return;let i=e.additionLines.length,r=e.hunks.at(-1);if(null!=r&&x(r.additionStart,r.additionCount)===i){for(let o of r.hunkContent)if("change"===o.type&&o.additions<o.deletions&&o.additionLineIndex+o.additions===i){e.additionLines=t,o.additions+=n,r.additionCount+=n,r.additionLines+=n,eT(e);return}}}function eA(e,t){return Object.assign(e,t),t}function eE(e,t){let n=e.hunks[t];if(null==n)return;if(t!==e.hunks.length-1){n.noEOFCRAdditions=!1,n.noEOFCRDeletions=!1;return}let i=e.additionLines.at(-1),r=e.deletionLines.at(-1);n.noEOFCRAdditions=null!=i&&""!==i&&!i.endsWith("\n"),n.noEOFCRDeletions=null!=r&&""!==r&&!r.endsWith("\n")}function eR(e,t,n){return{...e,additionLineIndex:e.additionLineIndex+t,deletionLineIndex:e.deletionLineIndex+n}}function e_(e){let t=0,n=0;for(let i of e.hunkContent)"context"===i.type?(t+=i.lines,n+=i.lines):(t+=Math.max(i.additions,i.deletions),n+=i.additions+i.deletions);e.splitLineCount=t,e.unifiedLineCount=n}function eT(e){let t=0,n=0,i=0;for(let o of e.hunks){var r;o.collapsedBefore=Math.max((r=o.additionStart,r-(0!==o.additionCount)-i),0),o.splitLineStart=t+o.collapsedBefore,o.unifiedLineStart=n+o.collapsedBefore,e_(o),t+=o.collapsedBefore+o.splitLineCount,n+=o.collapsedBefore+o.unifiedLineCount,i=x(o.additionStart,o.additionCount)}if(e.hunks.length>0){let i=e.hunks[e.hunks.length-1],r=Math.max(e.additionLines.length-x(i.additionStart,i.additionCount),0);t+=r,n+=r}e.splitLineCount=t,e.unifiedLineCount=n}let eI=new WeakMap;function eM(e,t){let n=e.hunks,i=e.additionLines,r=i.length>1&&""===i[i.length-1]?i.slice(0,-1):i,o=r===i?e:{...e,additionLines:r},a=function(e,t,n){let i=e.map((e,t)=>{let n=e$(e);return{deletionStart:n,deletionEnd:n+e.deletionCount,blocks:[],previousSpan:{firstIndex:t,lastIndex:t}}}),r=[],o=0;for(let e of t){var a,l,s,d,u;let t=e.deletionLineIndex,h=t+e.deletions;for(;o<i.length&&i[o].deletionEnd<t;)r.push(i[o]),o++;let c=r.length>0&&(a=t,l=h,a<=(s=r[r.length-1]).deletionEnd&&l>=s.deletionStart)?r.pop():void 0;for(;o<i.length&&i[o].deletionStart<=h;){d=c,u=i[o],c=null==d?u:(d.deletionStart=Math.min(d.deletionStart,u.deletionStart),d.deletionEnd=Math.max(d.deletionEnd,u.deletionEnd),d.blocks.push(...u.blocks),null!=u.previousSpan&&(d.previousSpan??={...u.previousSpan},d.previousSpan.firstIndex=Math.min(d.previousSpan.firstIndex,u.previousSpan.firstIndex),d.previousSpan.lastIndex=Math.max(d.previousSpan.lastIndex,u.previousSpan.lastIndex)),d),o++}if(null==c){let a=t,l=h;if((0===e.deletions||0===e.additions)&&n>e.deletions){let e=r[r.length-1]?.deletionEnd??0,s=i[o]?.deletionStart??n;t>e?a--:h<s&&l++}c={deletionStart:a,deletionEnd:l,blocks:[],previousSpan:void 0}}c.deletionStart=Math.min(c.deletionStart,t),c.deletionEnd=Math.max(c.deletionEnd,h),c.blocks.push(e),r.push(c)}for(;o<i.length;)r.push(i[o]),o++;return r}(n,function(e,t){if(null==function(e,t){let n=Math.min(e.length,t.length),i=0;for(;i<n&&e[i]===t[i];)i++;let r=e.length,o=t.length;for(;r>i&&o>i&&e[r-1]===t[o-1];)r--,o--;if(i!==r||i!==o)return{start:i,deletionEnd:r,additionEnd:o}}(e.deletionLines,e.additionLines))return[];let n=V({name:e.prevName??e.name,contents:e.deletionLines.join("")},{name:e.name,contents:e.additionLines.join(""),lang:e.lang},t),i=[],r=0,o=0;for(let e of n.hunks){let t=e.additionCount>0?e.additionLineIndex-r:e.deletionLineIndex-o;for(let n of(r+=t,o+=t,e.hunkContent)){if("context"===n.type){r+=n.lines,o+=n.lines;continue}let e=eR(n,0,0);0===e.additions&&(e.additionLineIndex=r),0===e.deletions&&(e.deletionLineIndex=o),i.push(e),r+=e.additions,o+=e.deletions}}return i}(o,t),e.deletionLines.length),l=function(e,t){let n=[],i=0,r=0;for(let e of t){let t=e.deletionStart-i;if(t<0)throw Error("buildRegionHunks: overlapping old-side regions");i+=t;let o=r+=t,a=[];for(let t of e.blocks){let e=t.deletionLineIndex-i,n=t.additionLineIndex-r;if(e<0||e!==n)throw Error("buildRegionHunks: canonical block context mismatch");eD(a,e,r,i),i+=e,r+=n,a.push({...t}),i+=t.deletions,r+=t.additions}let l=e.deletionEnd-i;if(l<0)throw Error("buildRegionHunks: block exceeds its old-side region");eD(a,l,r,i),i+=l,r+=l,n.push(function(e,t){let n=e.additionEnd-e.additionStart,i=e.deletionEnd-e.deletionStart,r=0,o=0;for(let e of t)"change"===e.type&&(r+=e.additions,o+=e.deletions);let a={collapsedBefore:0,additionStart:eF(e.additionStart,n),additionCount:n,additionLines:r,additionLineIndex:function(e,t){return 0===t?e-1:e}(e.additionStart,n),deletionStart:eF(e.deletionStart,i),deletionCount:i,deletionLines:o,deletionLineIndex:function(e,t){return 0===t?e-1:e}(e.deletionStart,i),hunkContent:t,hunkSpecs:`@@ -${eF(e.deletionStart,i)},${i} +${eF(e.additionStart,n)},${n} @@`,splitLineStart:0,splitLineCount:0,unifiedLineStart:0,unifiedLineCount:0,noEOFCRAdditions:!1,noEOFCRDeletions:!1};return e_(a),a}({additionStart:o,additionEnd:r,deletionStart:e.deletionStart,deletionEnd:e.deletionEnd},a))}if(e.deletionLines.length-i!=e.additionLines.length-r)throw Error("buildRegionHunks: trailing context mismatch");return n}(o,a);if(e.additionLines=r,e.hunks=l,e.editSessionDirty=!0,function(e){eT(e);for(let t=0;t<e.hunks.length;t++)eE(e,t)}(e),eL(e,i),function(e,t){if(e.length!==t.length)return!0;for(let n=0;n<e.length;n++){let i=e[n],r=t[n];if(e$(i)!==e$(r)||i.deletionCount!==r.deletionCount||eO(i)!==eO(r)||i.additionCount!==r.additionCount||i.splitLineCount!==r.splitLineCount||!function(e,t){let n=eH(e),i=eH(t);for(;;){let e=n.next(),t=i.next();if(!0===e.done||!0===t.done)return e.done===t.done;if(e.value[0]!==t.value[0]||e.value[1]!==t.value[1])return!1}}(i,r))return!0}return!1}(n,e.hunks))return{regions:a.map(e=>e.previousSpan)}}function eP(e){return e?.type==="change"&&(0===e.additions||0===e.deletions)}function eN(e,t){return!0===e.editSessionDirty&&(e.editSessionDirty=void 0,Object.assign(e,e.additionLines.length<=1&&""===e.additionLines.join("")?eC(e,t):ew(e,t)),!0)}function eD(e,t,n,i){t>0&&e.push({type:"context",lines:t,additionLineIndex:n,deletionLineIndex:i})}function*eH(e){for(let t of e.hunkContent){if("context"===t.type){for(let e=0;e<t.lines;e++)yield[t.deletionLineIndex+e,t.additionLineIndex+e];continue}let e=Math.max(t.deletions,t.additions);for(let n=0;n<e;n++)yield[n<t.deletions?t.deletionLineIndex+n:void 0,n<t.additions?t.additionLineIndex+n:void 0]}}function eO(e){var t;return t=e.additionStart,t-(0!==e.additionCount)}function e$(e){var t;return t=e.deletionStart,t-(0!==e.deletionCount)}function eF(e,t){return 0===t?e:e+1}function ez(e){if("u">typeof HTMLStyleElement&&e instanceof HTMLStyleElement)return!0;let t=e.tagName??e.nodeName;return"string"==typeof t&&"style"===t.toLowerCase()}function eU(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function eB(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function eG(e){return{type:"text",value:e}}function ej({tagName:e,children:t=[],properties:n={}}){return{type:"element",tagName:e,properties:n,children:t}}function eW({name:e,width:t=16,height:n=16,properties:i}){return ej({tagName:"svg",properties:{width:t,height:n,viewBox:"0 0 16 16",...i},children:[ej({tagName:"use",properties:{href:`#${e.replace(/^#/,"")}`}})]})}function eV(e){return ej({tagName:"div",properties:{"data-gutter":""},children:e})}function eq(e,t,n){return ej({tagName:"div",properties:{"data-gutter-buffer":t,"data-buffer-size":n,"data-line-type":"annotation"===t?void 0:e,style:"annotation"===t?`grid-row: span ${n};`:`grid-row: span ${n};min-height:calc(${n} * 1lh);`}})}function eK(e){for(let t of e)if(t instanceof HTMLElement&&(t.hasAttribute("data-utility-button")||t.hasAttribute("data-gutter-utility-slot")||"gutter-utility-slot"===t.getAttribute("slot")||"gutter-utility-slot"===t.getAttribute("name")))return!0;return!1}var eX=n(70),eY=class{mode;options;hoveredLine;hoveredToken;pre;gutterUtilityLine;gutterUtilityContainer;gutterUtilityButton;gutterUtilitySlot;interactiveLinesAttr=!1;interactiveLineNumbersAttr=!1;hasPointerListeners=!1;hasDocumentPointerListeners=!1;selectedRange=null;selectedRangeHighlightSide;selectedRangeLineNumberOnly=!1;editorActiveLine=null;editorActiveLineSide;editorLineNumberOnly=!1;proposedSelectedRange;renderedSelectedLinesState;renderedEditorActiveLineState;selectionAnchor;pointerSession={mode:"idle"};constructor(e,t){this.mode=e,this.options=t}setOptions(e){this.options=e}cleanUp(){this.pre?.removeEventListener("click",this.handlePointerClick),this.pre?.removeEventListener("pointerdown",this.handlePointerDown),this.pre?.removeEventListener("pointermove",this.handlePointerMove),this.pre?.removeEventListener("pointerleave",this.handlePointerLeave),this.pre?.removeAttribute("data-interactive-lines"),this.pre?.removeAttribute("data-interactive-line-numbers"),this.pre=void 0,this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.clearHoveredLine(),this.clearHoveredToken(),this.detachDocumentPointerListeners(),this.clearPointerSession(),ea(this.renderSelection),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1,this.setSelectionDirty()}setup(e){this.setSelectionDirty();let{usesCustomGutterUtility:t=!1,enableGutterUtility:n=!1}=this.options;this.pre!==e&&(this.cleanUp(),this.pre=e),n?this.ensureGutterUtilityNode(t):null!=this.gutterUtilityContainer&&(this.gutterUtilityContainer.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,"gutterSelecting"===this.pointerSession.mode&&(this.clearPointerSession(),this.detachDocumentPointerListeners())),this.syncPointerListeners(e),this.updateInteractiveLineAttributes(),this.renderSelection(),this.placeUtility()}setSelectionDirty(){this.renderedSelectedLinesState=void 0,this.renderedEditorActiveLineState=void 0}isSelectionDirty(){return void 0===this.renderedSelectedLinesState||void 0===this.renderedEditorActiveLineState}setSelection(e,t){let n=!(e===this.selectedRange||eB(e??void 0,this.selectedRange??void 0)),i=t?.lineNumberOnly??!1,r=t?.activeLineSide!==this.selectedRangeHighlightSide||i!==this.selectedRangeLineNumberOnly;(this.isSelectionDirty()||n||r)&&(this.proposedSelectedRange=void 0,this.selectedRange=e,this.selectedRangeHighlightSide=t?.activeLineSide,this.selectedRangeLineNumberOnly=i,this.renderSelection(),this.placeUtility(),n&&t?.notify!==!1&&this.notifySelectionCommitted(e))}setEditorActiveLine(e,{lineNumberOnly:t=!1,side:n}={}){let i=e!==this.editorActiveLine,r=n!==this.editorActiveLineSide||t!==this.editorLineNumberOnly;(this.isSelectionDirty()||i||r)&&(this.editorActiveLine=e,this.editorActiveLineSide=n,this.editorLineNumberOnly=t,this.renderSelection())}getSelection(){return this.selectedRange}getHoveredLine=()=>{let e=this.gutterUtilityLine??this.hoveredLine;if(null!=e){if("diff"===this.mode&&"diff-line"===e.type)return{lineNumber:e.lineNumber,side:e.annotationSide};if("file"===this.mode&&"line"===e.type)return{lineNumber:e.lineNumber}}};handlePointerClick=e=>{let{onHunkExpand:t,onLineClick:n,onLineNumberClick:i,onTokenClick:r,onMergeConflictActionClick:o}=this.options;null==t&&null==n&&null==i&&null==o&&null==r||null!=this.options.onGutterUtilityClick&&eK(e.composedPath())||(e3(this.options.__debugPointerEvents,"click","FileDiff.DEBUG.handlePointerClick:",e),this.handlePointerEvent({eventType:"click",event:e}))};handlePointerMove=e=>{if("mouse"!==e.pointerType)return;let{lineHoverHighlight:t="disabled",onLineEnter:n,onLineLeave:i,onTokenEnter:r,onTokenLeave:o,enableGutterUtility:a=!1}=this.options;("disabled"!==t||a||null!=n||null!=i||null!=r||null!=o)&&(e3(this.options.__debugPointerEvents,"move","FileDiff.DEBUG.handlePointerMove:",e),this.handlePointerEvent({eventType:"move",event:e}))};handlePointerLeave=e=>{let{__debugPointerEvents:t}=this.options;(e3(t,"move","FileDiff.DEBUG.handlePointerLeave: no event"),null==this.hoveredLine&&null==this.hoveredToken)?e3(t,"move","FileDiff.DEBUG.handlePointerLeave: returned early, no hovered line or token"):(null!=this.hoveredToken&&(this.options.onTokenLeave?.(this.hoveredToken,e),this.clearHoveredToken()),null!=this.hoveredLine&&(this.options.onLineLeave?.({...this.hoveredLine,event:e}),this.clearHoveredLine()),this.placeUtility())};handlePointerEvent({eventType:e,event:t}){let{__debugPointerEvents:n}=this.options,i=t.composedPath();e3(n,e,"FileDiff.DEBUG.handlePointerEvent:",{eventType:e,composedPath:i});let r=this.resolvePointerTarget(i);e3(n,e,"FileDiff.DEBUG.handlePointerEvent: resolvePointerTarget result:",r);let{onLineClick:o,onLineNumberClick:a,onLineEnter:l,onLineLeave:s,onTokenClick:d,onTokenEnter:u,onTokenLeave:h,onHunkExpand:c,onMergeConflictActionClick:f}=this.options;switch(e){case"move":{let e=e0(r)&&this.hoveredLine?.lineElement===r.lineElement;!(eJ(r)&&this.hoveredToken?.tokenElement===r.tokenElement)&&(null!=this.hoveredToken&&(h?.(this.hoveredToken,t),this.clearHoveredToken()),eJ(r)&&(this.setHoveredToken(this.toTokenEventBaseProps(r)),u?.(this.hoveredToken,t))),e||(null!=this.hoveredLine&&(s?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),e0(r)?(this.setHoveredLine(this.toEventBaseProps(r)),this.placeUtility(),l?.({...this.hoveredLine,event:t})):this.placeUtility());break}case"click":{var p,g;if(null==r)break;if("kind"in(p=r)&&"merge-conflict-action"===p.kind&&null!=f){f(r);break}if("type"in(g=r)&&"line-info"===g.type&&null!=c){c(r.hunkIndex,r.all||t.shiftKey?"both":r.direction,r.all||t.shiftKey?1/0:void 0);break}if(!e0(r))break;eJ(r)&&null!=d&&d(this.toTokenEventBaseProps(r),t);let e=this.toEventBaseProps(r);null!=a&&r.numberColumn?a({...e,event:t}):null!=o&&o({...e,event:t})}}}syncPointerListeners(e){let{__debugPointerEvents:t,lineHoverHighlight:n="disabled",onLineClick:i,onLineNumberClick:r,onLineEnter:o,onLineLeave:a,onTokenClick:l,onTokenEnter:s,onTokenLeave:d,onHunkExpand:u,onMergeConflictActionClick:h,enableGutterUtility:c=!1,enableLineSelection:f=!1,onGutterUtilityClick:p}=this.options,g=null!=p,m="disabled"!==n||null!=i||null!=r||null!=o||null!=a||null!=l||null!=s||null!=d||null!=u||null!=h||c||f||g;if(m&&!this.hasPointerListeners){let n;e.addEventListener("click",this.handlePointerClick),e.addEventListener("pointerdown",this.handlePointerDown),e.addEventListener("pointermove",this.handlePointerMove),e.addEventListener("pointerleave",this.handlePointerLeave),this.hasPointerListeners=!0,e3(t,"click","FileDiff.DEBUG.attachEventListeners: Attaching click events for:",(n=[],("both"===t||"click"===t)&&(null!=i&&n.push("onLineClick"),null!=r&&n.push("onLineNumberClick"),null!=u&&n.push("expandable hunk separators"),null!=h&&n.push("merge conflict actions")),n)),e3(t,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer move event"),e3(t,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer leave event")}else!m&&this.hasPointerListeners&&(e.removeEventListener("click",this.handlePointerClick),e.removeEventListener("pointerdown",this.handlePointerDown),e.removeEventListener("pointermove",this.handlePointerMove),e.removeEventListener("pointerleave",this.handlePointerLeave),this.hasPointerListeners=!1);let b="selecting"===this.pointerSession.mode||"pendingSingleLineUnselect"===this.pointerSession.mode,v="gutterSelecting"===this.pointerSession.mode;(!f&&b||!g&&v)&&(this.clearPointerSession(),this.detachDocumentPointerListeners(),this.selectionAnchor=void 0,this.clearPendingSingleLineState())}updateInteractiveLineAttributes(){if(null==this.pre)return;let{onLineClick:e,onLineNumberClick:t,enableLineSelection:n=!1}=this.options,i=null!=e,r=null!=t||n;i&&!this.interactiveLinesAttr?(this.pre.setAttribute("data-interactive-lines",""),this.interactiveLinesAttr=!0):!i&&this.interactiveLinesAttr&&(this.pre.removeAttribute("data-interactive-lines"),this.interactiveLinesAttr=!1),r&&!this.interactiveLineNumbersAttr?(this.pre.setAttribute("data-interactive-line-numbers",""),this.interactiveLineNumbersAttr=!0):!r&&this.interactiveLineNumbersAttr&&(this.pre.removeAttribute("data-interactive-line-numbers"),this.interactiveLineNumbersAttr=!1)}handlePointerDown=e=>{if("mouse"===e.pointerType&&0!==e.button||null==this.pre||"idle"!==this.pointerSession.mode)return;let t=e.composedPath();eK(t)&&null!=this.options.onGutterUtilityClick?this.startGutterSelectionFromPointerDown(e):("mouse"!==e.pointerType&&this.revealUtilityFromGutterPath(t),this.startLineSelectionFromPointerDown(e))};startLineSelectionFromPointerDown(e){let{enableLineSelection:t=!1}=this.options;if(!t)return;let n=this.resolveSelectionInfo(e,{source:"event-path",requireNumberColumn:!0});if(null==n)return;let{pre:i}=this;if(null==i)return;let{lineNumber:r,eventSide:o,lineIndex:a}=n;if(e.shiftKey&&null!=this.selectedRange){let t=this.getIndexesFromSelection(this.selectedRange,"split"===i.getAttribute("data-diff-type"));if(null==t)return;let n=t.start<=t.end?a>=t.start:a<=t.end;this.selectionAnchor={lineNumber:n?this.selectedRange.start:this.selectedRange.end,side:n?this.selectedRange.side:this.selectedRange.endSide??this.selectedRange.side},this.updateSelection(r,o,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:"selecting",pointerId:e.pointerId},this.attachDocumentPointerListeners();return}if(this.selectedRange?.start===r&&this.selectedRange?.end===r){let t={lineNumber:r,side:o};this.selectionAnchor=t,this.pointerSession={mode:"pendingSingleLineUnselect",pointerId:e.pointerId,anchor:t,pending:t},this.attachDocumentPointerListeners();return}!0===this.options.controlledSelection?this.proposedSelectedRange=null:this.selectedRange=null,this.placeUtility(),this.selectionAnchor={lineNumber:r,side:o},this.updateSelection(r,o,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:"selecting",pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e){let{onGutterUtilityClick:t}=this.options;if(null==t)return;let n=this.currentSelectionEnds(),i=n?.bottom??this.resolveSelectionPoint(e,{source:"event-path",excludeUtility:!1}),r=n?.top??i;null!=i&&null!=r&&(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:"gutterSelecting",pointerId:e.pointerId,anchor:r,current:i},this.selectionAnchor={lineNumber:r.lineNumber,side:r.side},this.updateSelection(i.lineNumber,i.side,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.attachDocumentPointerListeners())}handleDocumentPointerMove=e=>{switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionPoint(e,{source:"coordinates-first"});if(null==t)return;this.pointerSession.current=t,this.updateSelection(t.lineNumber,t.side);return}case"selecting":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionInfo(e,{source:"coordinates-first",requireNumberColumn:!1});if(null==t||null==this.selectionAnchor)return;this.updateSelection(t.lineNumber,t.eventSide);return}case"pendingSingleLineUnselect":{var t;if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let n=this.resolveSelectionInfo(e,{source:"coordinates-first",requireNumberColumn:!1});if(null==n||null==this.selectionAnchor)return;let i={lineNumber:n.lineNumber,side:n.eventSide};if(t=this.pointerSession.pending,t.lineNumber===i.lineNumber&&t.side===i.side)return;this.updateSelection(n.lineNumber,n.eventSide,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.notifySelectionChangeDelta(),this.pointerSession={mode:"selecting",pointerId:e.pointerId};return}}};handleDocumentPointerUp=e=>{let{onGutterUtilityClick:t}=this.options;switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":{let{pointerSession:n}=this;if(e.pointerId!==n.pointerId)return;e.preventDefault();let i=this.resolveSelectionPoint(e,{source:"coordinates-first"});null!=i&&(n.current=i,this.updateSelection(i.lineNumber,i.side));let r=this.buildSelectedLineRange(n.anchor,n.current);t?.({...r}),this.selectionAnchor=void 0,this.notifySelectionEnd(r),this.notifySelectionCommitted(r),this.clearProposedSelection(),this.clearPointerSession(),this.detachDocumentPointerListeners();return}case"pendingSingleLineUnselect":if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.updateSelection(null,void 0,!1),this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.detachDocumentPointerListeners(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection();return;case"selecting":if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.selectionAnchor=void 0,this.detachDocumentPointerListeners(),this.clearPointerSession(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection()}};handleDocumentPointerCancel=e=>{switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":case"selecting":case"pendingSingleLineUnselect":if("pointerId"in this.pointerSession&&e.pointerId!==this.pointerSession.pointerId)return;this.selectionAnchor=void 0,this.clearProposedSelection(),this.clearPendingSingleLineState(),this.clearPointerSession(),this.detachDocumentPointerListeners()}};clearHoveredLine(){null!=this.hoveredLine&&(this.hoveredLine.lineElement.removeAttribute("data-hovered"),this.hoveredLine.numberElement.removeAttribute("data-hovered"),this.hoveredLine=void 0)}setHoveredLine(e){let{lineHoverHighlight:t="disabled"}=this.options;null!=this.hoveredLine&&this.clearHoveredLine(),this.hoveredLine=e,"disabled"!==t&&(("both"===t||"line"===t)&&this.hoveredLine.lineElement.setAttribute("data-hovered",""),("both"===t||"number"===t)&&this.hoveredLine.numberElement.setAttribute("data-hovered",""))}clearHoveredToken(){null!=this.hoveredToken&&(this.hoveredToken=void 0)}setHoveredToken(e){null!=this.hoveredToken&&this.clearHoveredToken(),this.hoveredToken=e}ensureGutterUtilityNode(e){if(null==this.gutterUtilityContainer&&(this.gutterUtilityContainer=document.createElement("div"),this.gutterUtilityContainer.setAttribute("data-gutter-utility-slot","")),e)null!=this.gutterUtilityButton&&(this.gutterUtilityButton.remove(),this.gutterUtilityButton=void 0),null==this.gutterUtilitySlot&&(this.gutterUtilitySlot=document.createElement("slot"),this.gutterUtilitySlot.name="gutter-utility-slot"),this.gutterUtilitySlot.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilitySlot);else{if(this.gutterUtilitySlot?.remove(),this.gutterUtilitySlot=void 0,null==this.gutterUtilityButton){let e=document.createElement("div");e.innerHTML=(0,eX.V)(ej({tagName:"button",properties:{"data-utility-button":"",type:"button"},children:[eW({name:"diffs-icon-plus",properties:{"data-icon":""}})]}));let t=e.firstElementChild;if(!(t instanceof HTMLButtonElement))throw Error("InteractionManager.ensureGutterUtilityNode: Node element should be a button");t.remove(),this.gutterUtilityButton=t}this.gutterUtilityButton.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilityButton)}}revealUtilityFromGutterPath(e){if(this.placeUtilityFromSelection())return;let t=this.resolvePointerTarget(e);eQ(t)&&t.numberColumn&&this.showUtilityOnLine(this.toEventBaseProps(t))}placeUtility(){if(!this.placeUtilityFromSelection()){if(null!=this.hoveredLine)return void this.showUtilityOnLine(this.hoveredLine);this.hideUtility()}}placeUtilityFromSelection(){let e=this.currentSelectionEnds();if(null==e)return!1;let t=this.targetForSelectionPoint(e.bottom);return null==t?this.hideUtility():this.showUtilityOnLine(this.toEventBaseProps(t)),!0}showUtilityOnLine(e){null!=this.gutterUtilityContainer&&(this.gutterUtilityLine=e,e.numberElement.appendChild(this.gutterUtilityContainer))}hideUtility(){this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0}currentSelectionEnds(){let e=this.getCurrentSelectionRange();return null==e?void 0:this.selectionEnds(e)}selectionEnds(e){let t={lineNumber:e.start,side:e.side},n={lineNumber:e.end,side:e.endSide??e.side},i=this.selectionPointRowIndex(t),r=this.selectionPointRowIndex(n);if(null!=i&&null!=r)return i>r?{top:n,bottom:t}:{top:t,bottom:n}}selectionPointRowIndex(e){let t=this.getLineIndex(e.lineNumber,e.side);if(null!=t)return this.isSplitDiff()?t[1]:t[0]}targetForSelectionPoint(e){if(null==this.pre)return;let t=this.getLineIndex(e.lineNumber,e.side);if(null==t)return;let n="diff"===this.mode?`${t[0]},${t[1]}`:`${t[0]}`;for(let t of this.pre.querySelectorAll(`[data-column-number="${e.lineNumber}"][data-line-index="${n}"]`)){if(!(t instanceof HTMLElement))continue;let n=this.resolvePointerTarget(e8(t));if(eQ(n)&&("diff"!==this.mode||null==e.side||n.side===e.side))return n}}attachDocumentPointerListeners(){this.hasDocumentPointerListeners||(document.addEventListener("pointermove",this.handleDocumentPointerMove),document.addEventListener("pointerup",this.handleDocumentPointerUp),document.addEventListener("pointercancel",this.handleDocumentPointerCancel),this.hasDocumentPointerListeners=!0)}detachDocumentPointerListeners(){this.hasDocumentPointerListeners&&(document.removeEventListener("pointermove",this.handleDocumentPointerMove),document.removeEventListener("pointerup",this.handleDocumentPointerUp),document.removeEventListener("pointercancel",this.handleDocumentPointerCancel),this.hasDocumentPointerListeners=!1)}clearPointerSession(){this.pointerSession={mode:"idle"}}clearPendingSingleLineState(){"pendingSingleLineUnselect"===this.pointerSession.mode&&(this.pointerSession={mode:"idle"})}selectionInfoFromPath(e,t){let n=this.resolvePointerTarget(e);if(eQ(n)&&(!t||n.numberColumn)&&null!=n.splitLineIndex)return{lineIndex:n.splitLineIndex,lineNumber:n.lineNumber,eventSide:"diff"===this.mode?n.side:void 0}}resolveSelectionInfo(e,t){let n=this.resolveSelectionPath(e,t);return null!=n?this.selectionInfoFromPath(n,t.requireNumberColumn):void 0}selectionPointFromPath(e){let t=this.resolvePointerTarget(e);if(eQ(t))return{lineNumber:t.lineNumber,side:"diff"===this.mode?t.side:void 0}}resolveSelectionPoint(e,t){let n=this.resolveSelectionPath(e,t);return null!=n?this.selectionPointFromPath(n):void 0}resolveSelectionPath(e,t){let n=!1!==t.excludeUtility;switch(t.source){case"event-path":return this.pathFromEventPath(e.composedPath(),n);case"coordinates-first":{let t=this.pathFromCoordinates(e,n);if(void 0!==t)return t??void 0;return this.pathFromEventPath(e.composedPath(),n)}}}pathFromCoordinates(e,t){let n=this.hitTest(e);if(void 0!==n)return null===n?null:this.pathFromElement(n,t)??null}pathFromEventPath(e,t){if(!(t&&eK(e))){for(let n of e)if(n instanceof Element)return this.pathFromElement(n,t)}}pathFromElement(e,t){let n=e8(e);if(t&&eK(n))return;let i=function(e){let t=e.closest("[data-line], [data-column-number]");if(t instanceof HTMLElement)return t;let n=e.closest('[data-line-annotation], [data-gutter-buffer="annotation"]');if(!(n instanceof HTMLElement))return;let i=n.previousElementSibling;return i instanceof HTMLElement&&(i.hasAttribute("data-line")||i.hasAttribute("data-column-number"))?i:void 0}(e);return null!=i?e8(i):this.pathFromAnnotationSlot(e)}pathFromAnnotationSlot(e){let t=function(e){if(null==e)return;let t=/^annotation-(?:(additions|deletions)-)?(\d+)$/.exec(e);if(null==t)return;let n=Number.parseInt(t[2],10);if(Number.isFinite(n)&&!(n<=0))return{lineNumber:n,side:t[1]}}(function(e){let t=e.closest('[slot^="annotation-"]');if(t instanceof HTMLElement)return t.getAttribute("slot")??void 0;if(e instanceof HTMLElement){let t=e.getAttribute("name")??void 0;return null!=t&&t.startsWith("annotation-")?t:void 0}}(e));if(null==t)return;let n=this.targetForSelectionPoint(t);return null!=n?e8(n.lineElement):void 0}hitTest(e){if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;let t=this.pre?.getRootNode(),n=e2(t)?t:e2(document)?document:void 0;if(null!=n)return n.elementFromPoint(e.clientX,e.clientY)}getLineIndex(e,t){let{getLineIndex:n}=this.options;return null!=n?n(e,t):[e-1,e-1]}getCurrentSelectionRange(){return void 0!==this.proposedSelectedRange?this.proposedSelectedRange:this.selectedRange}clearProposedSelection(){this.proposedSelectedRange=void 0}updateSelection(e,t,n=!0){let i,r=this.getCurrentSelectionRange();if(null==e)i=null;else{let n=this.selectionAnchor?.side??t,r=this.selectionAnchor?.lineNumber??e;i=this.buildSelectionRange(r,e,n,t)}!eB(r??void 0,i??void 0)&&(this.selectedRangeHighlightSide=void 0,this.selectedRangeLineNumberOnly=!1,!0===this.options.controlledSelection?this.proposedSelectedRange=i:(this.selectedRange=i,eo(this.renderSelection)),this.placeUtility(),n&&this.notifySelectionChangeDelta())}getIndexesFromSelection(e,t){if(null==this.pre)return;let n=this.getLineIndex(e.start,e.side),i=this.getLineIndex(e.end,e.endSide??e.side);return null!=n&&null!=i?{start:t?n[1]:n[0],end:t?i[1]:i[0]}:void 0}getSelectionRenderState(){return{selectedLines:{range:this.selectedRange,highlightSide:this.selectedRangeHighlightSide,lineNumberOnly:this.selectedRangeLineNumberOnly},editorActiveLine:{range:null==this.editorActiveLine?null:{start:this.editorActiveLine,end:this.editorActiveLine,side:this.editorActiveLineSide},highlightSide:this.editorActiveLineSide,lineNumberOnly:this.editorLineNumberOnly}}}resolveLineRenderRange(e,t,n){if(null==e.range)return;let i=this.getIndexesFromSelection(e.range,t);if(null==i)throw console.error({rowRange:i,range:e.range}),Error(`InteractionManager.renderSelection: No valid ${n} rowRange`);return i}getLineRenderColumns(e,t,n,i){if(null==this.pre||null==t&&null==i)return[];let{children:r}=this.pre;if(r.length>2)throw console.error(r),Error("InteractionManager.renderSelection: Somehow there are more than 2 code elements...");let o=[];for(let a of r){let r=a.hasAttribute("data-deletions")?"deletions":a.hasAttribute("data-additions")?"additions":void 0,l=null!=e&&null!=t&&(null==e.highlightSide||null==r||e.highlightSide===r),s=null!=n&&null!=i&&(null==n.highlightSide||null==r||n.highlightSide===r);if(!l&&!s)continue;let[d,u]=a.children;if(!(d instanceof HTMLElement)||!(u instanceof HTMLElement))throw Error("InteractionManager.renderSelection: missing gutter or content element");if(u.children.length!==d.children.length)throw Error("InteractionManager.renderSelection: gutter and content children dont match, something is wrong");o.push({content:u,gutter:d,renderEditorActiveLine:s,renderSelectedLines:l})}return o}renderSelection=()=>{ea(this.renderSelection);let e=this.getSelectionRenderState();if(null==this.pre)return;let{editorActiveLine:t,selectedLines:n}=e,i=!e5(this.renderedSelectedLinesState,n),r=!e5(this.renderedEditorActiveLineState,t);if(!i&&!r)return;i&&(this.renderedSelectedLinesState=void 0),r&&(this.renderedEditorActiveLineState=void 0);let o="split"===this.pre.getAttribute("data-diff-type"),a=i?this.resolveLineRenderRange(n,o,"selected-lines"):void 0,l=r?this.resolveLineRenderRange(t,o,"editor-active-line"):void 0,s=this.getLineRenderColumns(i?n:void 0,a,r?t:void 0,l),d=null==n.range||s.some(e=>e.renderSelectedLines),u=null==t.range||s.some(e=>e.renderEditorActiveLine);if(i)for(let e of this.pre.querySelectorAll("[data-selected-line]"))e.removeAttribute("data-selected-line");if(r)for(let e of this.pre.querySelectorAll("[data-editor-active-line]"))e.removeAttribute("data-editor-active-line");let h=null==a?void 0:Math.min(a.start,a.end),c=null==a?void 0:Math.max(a.start,a.end),f=h===c,p=l?.start;for(let e of s){let{content:i,gutter:r,renderEditorActiveLine:a,renderSelectedLines:l}=e,s=Math.max(l?c??-1/0:-1/0,a?p??-1/0:-1/0),d=i.children.length;for(let e=0;e<d;e++){let d=i.children[e],u=r.children[e];if(!(d instanceof HTMLElement)||!(u instanceof HTMLElement))continue;let g=this.parseLineIndex(d,o);if((g??0)>s)break;if(null!=g){if(l&&null!=h&&null!=c&&g>=h&&g<=c){let e=f?"single":g===h?"first":g===c?"last":"";u.setAttribute("data-selected-line",e),!n.lineNumberOnly&&(d.setAttribute("data-selected-line",e),u.nextSibling instanceof HTMLElement&&d.nextSibling instanceof HTMLElement&&(d.nextSibling.hasAttribute("data-line-annotation")||d.nextSibling.hasAttribute("data-merge-conflict-actions"))&&(f?(e="last",d.setAttribute("data-selected-line","first")):g===h?e="":g===c&&d.setAttribute("data-selected-line",""),d.nextSibling.setAttribute("data-selected-line",e),u.nextSibling.setAttribute("data-selected-line",e)))}a&&g===p&&(u.setAttribute("data-editor-active-line",""),t.lineNumberOnly||d.setAttribute("data-editor-active-line",""))}}}i&&d&&(this.renderedSelectedLinesState=n),r&&u&&(this.renderedEditorActiveLineState=t)};notifySelectionCommitted(e){this.options.onLineSelected?.(e)}notifySelectionChangeDelta(){this.options.onLineSelectionChange?.(this.getCurrentSelectionRange()??null)}notifySelectionStart(e){this.options.onLineSelectionStart?.(e)}notifySelectionEnd(e){this.options.onLineSelectionEnd?.(e)}toEventBaseProps(e){return"file"===this.mode?{type:"line",lineElement:e.lineElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn,numberElement:e.numberElement}:{type:"diff-line",annotationSide:e.side,lineType:e.lineType,lineElement:e.lineElement,numberElement:e.numberElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn}}toTokenEventBaseProps({lineCharEnd:e,lineCharStart:t,lineNumber:n,side:i,tokenElement:r,tokenText:o}){return"file"===this.mode?{type:"token",lineCharEnd:e,lineCharStart:t,lineNumber:n,tokenElement:r,tokenText:o}:{type:"token",lineCharEnd:e,lineCharStart:t,lineNumber:n,side:i,tokenElement:r,tokenText:o}}buildSelectedLineRange(e,t){return this.buildSelectionRange(e.lineNumber,t.lineNumber,e.side,t.side)}buildSelectionRange(e,t,n,i){return{start:e,end:t,...null!=n?{side:n}:{},...n!==i&&null!=i?{endSide:i}:{}}}resolvePointerTarget(e){let t,n,i,r,o,a,l,s,d,u,h=!1;for(let f of e){if(!(f instanceof HTMLElement))continue;if(null==u&&f.hasAttribute("data-merge-conflict-action")){var c;let e=f.getAttribute("data-merge-conflict-action")??void 0,t=f.getAttribute("data-merge-conflict-conflict-index")??void 0,n=null!=t?Number.parseInt(t,10):NaN;("current"===(c=e)||"incoming"===c||"both"===c)&&Number.isFinite(n)&&(u={kind:"merge-conflict-action",resolution:e,conflictIndex:n})}if(null==a&&f.hasAttribute("data-char")){a=f;let e=f.getAttribute("data-char");if(null!=e){let t=Number.parseInt(e,10);if(!Number.isNaN(t)){let e=f.textContent??"",n=t+e.length;(""!==e.trim()||!0===this.options.enableTokenInteractionsOnWhitespace)&&(l={tokenElement:a,lineCharStart:t,lineCharEnd:n,tokenText:e});continue}}}let e=null==o?f.getAttribute("data-column-number")??void 0:void 0;if(null!=e){o=f,d=Number.parseInt(e,10),h=!0,t=e7(f),r=f.getAttribute("data-line-index")??void 0;continue}let p=null==i?f.getAttribute("data-line")??void 0:void 0;if(null!=p){i=f,d=Number.parseInt(p,10),t=e7(f),r=f.getAttribute("data-line-index")??void 0;continue}if(null==s&&(f.hasAttribute("data-expand-button")||f.hasAttribute("data-unmodified-lines"))){s={hunkIndex:void 0,direction:f.hasAttribute("data-expand-up")?"up":f.hasAttribute("data-expand-down")?"down":"both",all:f.hasAttribute("data-expand-all-button")};continue}let g=null!=s?f.getAttribute("data-expand-index")??void 0:void 0;if(null!=s&&null!=g){let e=Number.parseInt(g,10);Number.isNaN(e)||(s.hunkIndex=e);continue}if(null==n&&f.hasAttribute("data-code")){n=f;break}}if(null!=u)return u;if(s?.hunkIndex!=null)return{type:"line-info",hunkIndex:s.hunkIndex,direction:s.direction,all:s.all};if(i??=null!=r?e1(n,`[data-line][data-line-index="${r}"]`):void 0,o??=null!=r?e1(n,`[data-column-number][data-line-index="${r}"]`):void 0,null==n||null==i||null==o||null==t||null==d||Number.isNaN(d))return;let f=this.parseLineIndex(i,this.isSplitDiff());return null!=l?"file"===this.mode?{kind:"token",lineType:t,lineElement:i,lineNumber:d,numberColumn:h,numberElement:o,side:void 0,splitLineIndex:f,...l}:{kind:"token",lineType:t,lineElement:i,lineNumber:d,numberColumn:h,numberElement:o,side:e6(t,n),splitLineIndex:f,...l}:"file"===this.mode?{kind:"line",lineType:t,lineElement:i,lineNumber:d,numberColumn:h,numberElement:o,side:void 0,splitLineIndex:f}:{kind:"line",lineType:t,lineElement:i,lineNumber:d,numberColumn:h,numberElement:o,side:e6(t,n),splitLineIndex:f}}isSplitDiff(){return this.pre?.getAttribute("data-diff-type")==="split"}parseLineIndex(e,t){let n=(e.getAttribute("data-line-index")??"").split(",").map(e=>Number.parseInt(e,10)).filter(e=>!Number.isNaN(e));return t&&2===n.length?n[1]:t?void 0:n[0]}};function eZ({enableTokenInteractionsOnWhitespace:e,enableGutterUtility:t,lineHoverHighlight:n,onGutterUtilityClick:i,onLineClick:r,onLineEnter:o,onLineLeave:a,onLineNumberClick:l,onTokenClick:s,onTokenEnter:d,onTokenLeave:u,renderGutterUtility:h,__debugPointerEvents:c,enableLineSelection:f,controlledSelection:p,onLineSelected:g,onLineSelectionStart:m,onLineSelectionChange:b,onLineSelectionEnd:v},y,C,S){return{enableTokenInteractionsOnWhitespace:e,enableGutterUtility:function({enableGutterUtility:e,renderGutterUtility:t,onGutterUtilityClick:n}){if(null!=n&&null!=t)throw Error("Cannot use both 'onGutterUtilityClick' and 'renderGutterUtility'. Use only one gutter utility API.");return e??!1}({enableGutterUtility:t,renderGutterUtility:h,onGutterUtilityClick:i}),usesCustomGutterUtility:null!=h,lineHoverHighlight:n,onGutterUtilityClick:i,onHunkExpand:y,onMergeConflictActionClick:S,onLineClick:r,onLineEnter:o,onLineLeave:a,onLineNumberClick:l,onTokenClick:s,onTokenEnter:d,onTokenLeave:u,__debugPointerEvents:c,enableLineSelection:f,controlledSelection:p,onLineSelected:g,onLineSelectionStart:m,onLineSelectionChange:b,onLineSelectionEnd:v,getLineIndex:C}}function eQ(e){return null!=e&&"kind"in e&&"line"===e.kind}function eJ(e){return null!=e&&"kind"in e&&"token"===e.kind}function e0(e){return eQ(e)||eJ(e)}function e1(e,t){let n=e?.querySelector(t);return n instanceof HTMLElement?n:void 0}function e8(e){let t=[],n=e;for(;null!=n;)t.push(n),n=n.parentNode;return t}function e2(e){return null!=e&&"function"==typeof e.elementFromPoint}function e5(e,t){var n,i;return e?.highlightSide===t.highlightSide&&e?.lineNumberOnly===t.lineNumberOnly&&((n=e?.range??null)===(i=t.range)||eB(n??void 0,i??void 0))}function e6(e,t){switch(e){case"change-deletion":return"deletions";case"change-addition":return"additions";default:return t.hasAttribute("data-deletions")?"deletions":"additions"}}function e7(e){let t=e.getAttribute("data-line-type");if(null!=t)switch(t){case"change-deletion":case"change-addition":case"context":case"context-expanded":return t;default:return}}function e3(e="none",t,...n){switch(e){case"none":return;case"both":break;case"click":if("click"!==t)return;break;case"move":if("move"!==t)return}console.log(...n)}var e4=class e{static resizeObserver;static managersByElement=new Map;static getResizeObserver(){let t=e.resizeObserver??new ResizeObserver(e.handleSharedResizeEntries);return e.resizeObserver=t,t}static handleSharedResizeEntries(t){let n=new Map;for(let i of t){let t=e.managersByElement.get(i.target);if(null==t)continue;let r=n.get(t);null==r?n.set(t,[i]):r.push(i)}for(let[e,t]of n)e.handleResizeEntries(t)}observedNodes=new Map;setup(e,{disableAnnotations:t,columnVariables:n="apply"}){var i,r,o,a;let l=new Set,s="apply"===n,d=0,u=new Map(this.observedNodes);for(let t of(this.observedNodes.clear(),e.children)){if(2===d)break;let e=(()=>{if(t instanceof HTMLElement&&"CODE"===t.tagName)return t})();if(null==e)continue;d++;let n=u.get(e);if(null!=n&&"code"!==n.type)throw Error("ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible");let o=e.firstElementChild;o instanceof HTMLElement||(o=null),null!=n?(this.observedNodes.set(e,n),u.delete(e),n.numberElement!==o?(null!=n.numberElement&&(this.unobserve(n.numberElement),u.delete(n.numberElement)),null!=o&&(this.observe(o),u.delete(o),this.observedNodes.set(o,n)),n.numberElement=o,n.numberWidth=0):null!=n.numberElement?(u.delete(n.numberElement),this.observedNodes.set(n.numberElement,n)):n.numberWidth=0,i=n,r=s,i.applyColumnVariables!==r&&(i.applyColumnVariables=r,r?e9(i,{codeWidthChanged:!0,numberWidthChanged:!0}):te(i))):(n={type:"code",codeElement:e,numberElement:o,codeWidth:"auto",numberWidth:0,applyColumnVariables:s},this.observedNodes.set(e,n),this.observe(e),null!=o&&(this.observedNodes.set(o,n),this.observe(o)))}if(d>1&&!t){let t=e.querySelectorAll('[data-line-annotation*=","]'),n=new Map;for(let e of t){if(!(e instanceof HTMLElement))continue;let t=e.getAttribute("data-line-annotation")??"";if(!/^-?\d+,-?\d+$/.test(t)){console.error("DiffFileRenderer.setupResizeObserver: Invalid element or annotation",{lineAnnotation:t,element:e});continue}let i=n.get(t);null==i&&(i=[],n.set(t,i)),i.push(e)}for(let[e,t]of n){if(2!==t.length){console.error("DiffFileRenderer.setupResizeObserver: Bad Pair",e,t);continue}let[n,i]=t,r=n.firstElementChild,o=i.firstElementChild;if(!(n instanceof HTMLElement)||!(i instanceof HTMLElement)||!(r instanceof HTMLElement)||!(o instanceof HTMLElement))continue;let a=u.get(r);if(null!=a){this.observedNodes.set(r,a),this.observedNodes.set(o,a),u.delete(r),u.delete(o);continue}let s=r.getBoundingClientRect().height,d=o.getBoundingClientRect().height;a={type:"annotations",column1:{container:n,child:r,childHeight:s},column2:{container:i,child:o,childHeight:d},currentHeight:"auto"},l.add({child1:r,child2:o,item:a,newHeight:Math.max(s,d)})}for(let e of l)this.applyNewHeight(e.item,e.newHeight),this.observedNodes.set(e.child1,e.item),this.observedNodes.set(e.child2,e.item),this.observe(e.child1),this.observe(e.child2);l.clear()}for(let[e,t]of u){this.unobserve(e),"code"===t.type?(o=t).codeElement.isConnected&&te(o):((a=t).column1.container.isConnected&&a.column1.container.style.removeProperty("--diffs-annotation-min-height"),a.column2.container.isConnected&&a.column2.container.style.removeProperty("--diffs-annotation-min-height"))}u.clear()}cleanUp(){for(let e of this.observedNodes.keys())this.unobserve(e);this.observedNodes.clear()}observe(t){let{managersByElement:n}=e,i=n.get(t);if(i!==this){if(null!=i&&i!==this)throw Error("ResizeManager.observe: element is already owned by another ResizeManager");n.set(t,this),e.getResizeObserver().observe(t)}}unobserve(t){let{managersByElement:n,resizeObserver:i}=e,r=n.get(t);if(null!=r){if(r!==this)throw Error("ResizeManager.unobserve: element is owned by another ResizeManager");n.delete(t),i?.unobserve(t),null!=i&&0===n.size&&(i.disconnect(),e.resizeObserver=void 0)}}handleResizeEntries(e){let t=new Map,n=new Set;for(let i of e){let{target:e,borderBoxSize:r,contentBoxSize:o}=i;if(!(e instanceof HTMLElement)){console.error("ResizeManager.handleResizeEntries: Invalid element for ResizeObserver",i);continue}let a=this.observedNodes.get(e);if(null==a){console.error("ResizeManager.handleResizeEntries: Not a valid observed node",i);continue}if("annotations"===a.type){let t=e===a.column1.child?a.column1:e===a.column2.child?a.column2:void 0;if(null==t){console.error("ResizeManager.handleResizeEntries: Couldn't find a column for",{item:a,target:e});continue}t.childHeight=r[0].blockSize,n.add(a)}else if("code"===a.type){let n=t.get(a)??{},i=o[0].inlineSize;e===a.codeElement?n.codeInlineSize=i:e===a.numberElement&&(n.numberInlineSize=i),t.set(a,n)}}this.applyAnnotationUpdates(n),n.clear(),this.applyColumnUpdates(t),t.clear()}applyAnnotationUpdates(e){for(let t of e)this.applyNewHeight(t,Math.max(t.column1.childHeight,t.column2.childHeight))}applyColumnUpdates=e=>{for(let[t,n]of e){let e=null!=n.codeInlineSize?function(e){let t=Math.max(Math.floor(e),0);return 0===t?"auto":t}(n.codeInlineSize):t.codeWidth,i=null!=n.numberInlineSize?Math.max(Math.ceil(n.numberInlineSize),0):t.numberWidth,r=e!==t.codeWidth,o=i!==t.numberWidth;(r||o)&&(t.codeWidth=e,t.numberWidth=i,t.applyColumnVariables&&e9(t,{codeWidthChanged:r,numberWidthChanged:o}))}};applyNewHeight(e,t){t!==e.currentHeight&&(e.currentHeight=Math.max(t,0),e.column1.container.style.setProperty("--diffs-annotation-min-height",`${e.currentHeight}px`),e.column2.container.style.setProperty("--diffs-annotation-min-height",`${e.currentHeight}px`))}};function e9(e,{codeWidthChanged:t,numberWidthChanged:n}){let{codeElement:i,codeWidth:r,numberWidth:o}=e;if(t&&i.style.setProperty("--diffs-column-width",`${"number"==typeof r?`${r}px`:"auto"}`),n&&i.style.setProperty("--diffs-column-number-width",`${0===o?"auto":`${o}px`}`),t||n&&"auto"!==r){let e="number"==typeof r?Math.max(r-o,0):0;i.style.setProperty("--diffs-column-content-width",`${e>0?`${e}px`:"auto"}`)}}function te(e){e.codeElement.style.removeProperty("--diffs-column-content-width"),e.codeElement.style.removeProperty("--diffs-column-number-width"),e.codeElement.style.removeProperty("--diffs-column-width")}function tt(e,t){return null==e||null==t?e===t:e.startingLine===t.startingLine&&e.totalLines===t.totalLines&&e.bufferBefore===t.bufferBefore&&e.bufferAfter===t.bufferAfter}let tn=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
5
|
+
<symbol id="diffs-icon-arrow-right-short" viewBox="0 0 16 16">
|
|
6
|
+
<path d="M8.47 4.22a.75.75 0 0 0 0 1.06l1.97 1.97H3.75a.75.75 0 0 0 0 1.5h6.69l-1.97 1.97a.75.75 0 1 0 1.06 1.06l3.25-3.25a.75.75 0 0 0 0-1.06L9.53 4.22a.75.75 0 0 0-1.06 0"/>
|
|
7
|
+
</symbol>
|
|
8
|
+
<symbol id="diffs-icon-brand-github" viewBox="0 0 16 16">
|
|
9
|
+
<path d="M8 0c4.42 0 8 3.58 8 8a8.01 8.01 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27s-1.36.09-2 .27c-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8"/>
|
|
10
|
+
</symbol>
|
|
11
|
+
<symbol id="diffs-icon-chevron" viewBox="0 0 16 16">
|
|
12
|
+
<path d="M1.47 4.47a.75.75 0 0 1 1.06 0L8 9.94l5.47-5.47a.75.75 0 1 1 1.06 1.06l-6 6a.75.75 0 0 1-1.06 0l-6-6a.75.75 0 0 1 0-1.06"/>
|
|
13
|
+
</symbol>
|
|
14
|
+
<symbol id="diffs-icon-chevrons-narrow" viewBox="0 0 10 16">
|
|
15
|
+
<path d="M4.47 2.22a.75.75 0 0 1 1.06 0l3.25 3.25a.75.75 0 0 1-1.06 1.06L5 3.81 2.28 6.53a.75.75 0 0 1-1.06-1.06zM1.22 9.47a.75.75 0 0 1 1.06 0L5 12.19l2.72-2.72a.75.75 0 0 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0l-3.25-3.25a.75.75 0 0 1 0-1.06"/>
|
|
16
|
+
</symbol>
|
|
17
|
+
<symbol id="diffs-icon-diff-split" viewBox="0 0 16 16">
|
|
18
|
+
<path d="M14 0H8.5v16H14a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2m-1.5 6.5v1h1a.5.5 0 0 1 0 1h-1v1a.5.5 0 0 1-1 0v-1h-1a.5.5 0 0 1 0-1h1v-1a.5.5 0 0 1 1 0"/><path d="M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h5.5V0zm.5 7.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1" opacity=".3"/>
|
|
19
|
+
</symbol>
|
|
20
|
+
<symbol id="diffs-icon-diff-unified" viewBox="0 0 16 16">
|
|
21
|
+
<path fill-rule="evenodd" d="M16 14a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V8.5h16zm-8-4a.5.5 0 0 0-.5.5v1h-1a.5.5 0 0 0 0 1h1v1a.5.5 0 0 0 1 0v-1h1a.5.5 0 0 0 0-1h-1v-1A.5.5 0 0 0 8 10" clip-rule="evenodd"/><path fill-rule="evenodd" d="M14 0a2 2 0 0 1 2 2v5.5H0V2a2 2 0 0 1 2-2zM6.5 3.5a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1z" clip-rule="evenodd" opacity=".4"/>
|
|
22
|
+
</symbol>
|
|
23
|
+
<symbol id="diffs-icon-expand" viewBox="0 0 16 16">
|
|
24
|
+
<path d="M3.47 5.47a.75.75 0 0 1 1.06 0L8 8.94l3.47-3.47a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 0 1 0-1.06"/>
|
|
25
|
+
</symbol>
|
|
26
|
+
<symbol id="diffs-icon-expand-all" viewBox="0 0 16 16">
|
|
27
|
+
<path d="M11.47 9.47a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 1 1 1.06-1.06L8 12.94zM7.526 1.418a.75.75 0 0 1 1.004.052l4 4a.75.75 0 1 1-1.06 1.06L8 3.06 4.53 6.53a.75.75 0 1 1-1.06-1.06l4-4z"/>
|
|
28
|
+
</symbol>
|
|
29
|
+
<symbol id="diffs-icon-file-code" viewBox="0 0 16 16">
|
|
30
|
+
<path d="M10.75 0c.199 0 .39.08.53.22l3.5 3.5c.14.14.22.331.22.53v9A2.75 2.75 0 0 1 12.25 16h-8.5A2.75 2.75 0 0 1 1 13.25V2.75A2.75 2.75 0 0 1 3.75 0zm-7 1.5c-.69 0-1.25.56-1.25 1.25v10.5c0 .69.56 1.25 1.25 1.25h8.5c.69 0 1.25-.56 1.25-1.25V5h-1.25A2.25 2.25 0 0 1 10 2.75V1.5z"/><path d="M7.248 6.19a.75.75 0 0 1 .063 1.058L5.753 9l1.558 1.752a.75.75 0 0 1-1.122.996l-2-2.25a.75.75 0 0 1 0-.996l2-2.25a.75.75 0 0 1 1.06-.063M8.69 7.248a.75.75 0 1 1 1.12-.996l2 2.25a.75.75 0 0 1 0 .996l-2 2.25a.75.75 0 1 1-1.12-.996L10.245 9z"/>
|
|
31
|
+
</symbol>
|
|
32
|
+
<symbol id="diffs-icon-plus" viewBox="0 0 16 16">
|
|
33
|
+
<path d="M8 3a.75.75 0 0 1 .75.75v3.5h3.5a.75.75 0 0 1 0 1.5h-3.5v3.5a.75.75 0 0 1-1.5 0v-3.5h-3.5a.75.75 0 0 1 0-1.5h3.5v-3.5A.75.75 0 0 1 8 3"/>
|
|
34
|
+
</symbol>
|
|
35
|
+
<symbol id="diffs-icon-symbol-added" viewBox="0 0 16 16">
|
|
36
|
+
<path d="M8 4a.75.75 0 0 1 .75.75v2.5h2.5a.75.75 0 0 1 0 1.5h-2.5v2.5a.75.75 0 0 1-1.5 0v-2.5h-2.5a.75.75 0 0 1 0-1.5h2.5v-2.5A.75.75 0 0 1 8 4"/><path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/>
|
|
37
|
+
</symbol>
|
|
38
|
+
<symbol id="diffs-icon-symbol-deleted" viewBox="0 0 16 16">
|
|
39
|
+
<path d="M4 8a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 0 1.5h-6.5A.75.75 0 0 1 4 8"/><path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/>
|
|
40
|
+
</symbol>
|
|
41
|
+
<symbol id="diffs-icon-symbol-diffstat" viewBox="0 0 16 16">
|
|
42
|
+
<path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/><path d="M8.75 4.296a.75.75 0 0 0-1.5 0V6.25h-2a.75.75 0 0 0 0 1.5h2v1.5h1.5v-1.5h2a.75.75 0 0 0 0-1.5h-2zM5.25 10a.75.75 0 0 0 0 1.5h5.5a.75.75 0 0 0 0-1.5z"/>
|
|
43
|
+
</symbol>
|
|
44
|
+
<symbol id="diffs-icon-symbol-ignored" viewBox="0 0 16 16">
|
|
45
|
+
<path d="M1.5 8c0 1.613.088 2.806.288 3.704.196.88.478 1.381.802 1.706s.826.607 1.706.802c.898.2 2.091.288 3.704.288s2.806-.088 3.704-.288c.88-.195 1.381-.478 1.706-.802s.607-.826.802-1.706c.2-.898.288-2.091.288-3.704s-.088-2.806-.288-3.704c-.195-.88-.478-1.381-.802-1.706s-.826-.606-1.706-.802C10.806 1.588 9.613 1.5 8 1.5s-2.806.088-3.704.288c-.88.196-1.381.478-1.706.802s-.606.826-.802 1.706C1.588 5.194 1.5 6.387 1.5 8M0 8c0-6.588 1.412-8 8-8s8 1.412 8 8-1.412 8-8 8-8-1.412-8-8m11.53-2.47a.75.75 0 0 0-1.06-1.06l-6 6a.75.75 0 1 0 1.06 1.06z"/>
|
|
46
|
+
</symbol>
|
|
47
|
+
<symbol id="diffs-icon-symbol-modified" viewBox="0 0 16 16">
|
|
48
|
+
<path d="M1.5 8c0 1.613.088 2.806.288 3.704.196.88.478 1.381.802 1.706s.826.607 1.706.802c.898.2 2.091.288 3.704.288s2.806-.088 3.704-.288c.88-.195 1.381-.478 1.706-.802s.607-.826.802-1.706c.2-.898.288-2.091.288-3.704s-.088-2.806-.288-3.704c-.195-.88-.478-1.381-.802-1.706s-.826-.606-1.706-.802C10.806 1.588 9.613 1.5 8 1.5s-2.806.088-3.704.288c-.88.196-1.381.478-1.706.802s-.606.826-.802 1.706C1.588 5.194 1.5 6.387 1.5 8M0 8c0-6.588 1.412-8 8-8s8 1.412 8 8-1.412 8-8 8-8-1.412-8-8m8 3a3 3 0 1 0 0-6 3 3 0 0 0 0 6"/>
|
|
49
|
+
</symbol>
|
|
50
|
+
<symbol id="diffs-icon-symbol-moved" viewBox="0 0 16 16">
|
|
51
|
+
<path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/><path d="M8.495 4.695a.75.75 0 0 0-.05 1.06L10.486 8l-2.041 2.246a.75.75 0 0 0 1.11 1.008l2.5-2.75a.75.75 0 0 0 0-1.008l-2.5-2.75a.75.75 0 0 0-1.06-.051m-4 0a.75.75 0 0 0-.05 1.06l2.044 2.248-1.796 1.995a.75.75 0 0 0 1.114 1.004l2.25-2.5a.75.75 0 0 0-.002-1.007l-2.5-2.75a.75.75 0 0 0-1.06-.05"/>
|
|
52
|
+
</symbol>
|
|
53
|
+
<symbol id="diffs-icon-symbol-ref" viewBox="0 0 16 16">
|
|
54
|
+
<path d="M1.5 8c0 1.613.088 2.806.288 3.704.196.88.478 1.381.802 1.706.286.286.71.54 1.41.73V1.86c-.7.19-1.124.444-1.41.73-.324.325-.606.826-.802 1.706C1.588 5.194 1.5 6.387 1.5 8m4 6.397c.697.07 1.522.103 2.5.103 1.613 0 2.806-.088 3.704-.288.88-.195 1.381-.478 1.706-.802s.607-.826.802-1.706c.2-.898.288-2.091.288-3.704s-.088-2.806-.288-3.704c-.195-.88-.478-1.381-.802-1.706s-.826-.606-1.706-.802C10.806 1.588 9.613 1.5 8 1.5c-.978 0-1.803.033-2.5.103zM0 8c0-6.588 1.412-8 8-8s8 1.412 8 8-1.412 8-8 8-8-1.412-8-8m7-2a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1z"/>
|
|
55
|
+
</symbol>
|
|
56
|
+
</svg>`,ti={};function tr(e){if(null!=i)return i;let t=e.host;if("u">typeof HTMLElement&&t instanceof HTMLElement&&!t.isConnected)return;let n=document.createElement("div");n.setAttribute("data-code",""),n.setAttribute("data-diffs-scrollbar-measure","true");let r=document.createElement("div");return r.style.position="relative",r.style.width="200%",r.style.height="200%",n.appendChild(r),e.appendChild(n),i=Math.max(n.offsetHeight-n.clientHeight,0),n.remove(),i}function to(e){return`${v}: ${null==e?"var(--diffs-scrollbar-gutter-fallback)":`${e}px`};`}let ta="@layer base, theme, rendered, unsafe;",tl=RegExp(`${v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*:\\s*[^;]+;`);function ts({code:e,pre:t,columnType:n,rowSpan:i,containerSize:r=!1}={}){return null==e&&((e=document.createElement("code")).setAttribute("data-code",""),null!=n&&e.setAttribute(`data-${n}`,""),t?.appendChild(e)),null!=i?e.style.setProperty("grid-row",`span ${i}`):e.style.removeProperty("grid-row"),r?e.setAttribute("data-container-size",""):e.removeAttribute("data-container-size"),e}function td(e,t){let n=e?.offsetHeight??0;if(null==e||0===n)return void t();e.style.minHeight=`${n}px`;try{t(),e.offsetHeight}finally{e.style.minHeight=""}}if("u">typeof HTMLElement&&null==customElements.get("diffs-container")){let e;class t extends HTMLElement{constructor(){if(super(),null!=this.shadowRoot)return;const t=this.attachShadow({mode:"open"});null==e&&(e=new CSSStyleSheet).replaceSync('@layer base {\n :host {\n --diffs-font-fallback: "SF Mono", Monaco, Consolas, "Ubuntu Mono", "Liberation Mono",\n "Courier New", monospace;\n --diffs-header-font-fallback: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",\n "Noto Sans", "Liberation Sans", Arial, sans-serif;\n --diffs-mixer: light-dark(#000, #fff);\n --diffs-gap-fallback: 8px;\n --diffs-scrollbar-gutter-fallback: 6px;\n --diffs-scrollbar-gutter: var(--diffs-scrollbar-gutter-override, var(--diffs-scrollbar-gutter-measured, var(--diffs-scrollbar-gutter-fallback)));\n --diffs-added-light: #0dbe4e;\n --diffs-added-dark: #5ecc71;\n --diffs-modified-light: #009fff;\n --diffs-modified-dark: #69b1ff;\n --diffs-deleted-light: #ff2e3f;\n --diffs-deleted-dark: #ff6762;\n --diffs-warning-light: #d5a910;\n --diffs-warning-dark: #ffd452;\n color-scheme: light dark;\n font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));\n font-size: var(--diffs-font-size, 13px);\n line-height: var(--diffs-line-height, 20px);\n font-feature-settings: var(--diffs-font-features);\n --diffs-bg: light-dark(var(--diffs-light-bg, #fff), var(--diffs-dark-bg, #000));\n --diffs-bg-buffer: var(--diffs-bg-buffer-override, light-dark(color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer))));\n --diffs-bg-context: var(--diffs-bg-context-override, light-dark(color-mix(in lab, var(--diffs-bg) 98.5%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-bg) 92.5%, var(--diffs-mixer))));\n --diffs-bg-context-gutter: var(--diffs-bg-context-gutter-override, light-dark(color-mix(in lab, var(--diffs-bg-context) 90%, var(--diffs-bg)), color-mix(in lab, var(--diffs-bg-context) 45%, var(--diffs-bg))));\n --diffs-bg-separator: var(--diffs-bg-separator-override, light-dark(color-mix(in lab, var(--diffs-bg) 96%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-bg) 85%, var(--diffs-mixer))));\n --diffs-fg: light-dark(var(--diffs-light, #000), var(--diffs-dark, #fff));\n --diffs-fg-number: var(--diffs-fg-number-override, light-dark(color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg)), color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg))));\n --diffs-fg-conflict-marker: var(--diffs-fg-conflict-marker-override, var(--diffs-fg-number));\n --diffs-deletion-base: var(--diffs-deletion-color-override, light-dark(var(--diffs-light-deletion-color, var(--diffs-deletion-color, var(--diffs-deleted-light))), var(--diffs-dark-deletion-color, var(--diffs-deletion-color, var(--diffs-deleted-dark)))));\n --diffs-addition-base: var(--diffs-addition-color-override, light-dark(var(--diffs-light-addition-color, var(--diffs-addition-color, var(--diffs-added-light))), var(--diffs-dark-addition-color, var(--diffs-addition-color, var(--diffs-added-dark)))));\n --diffs-modified-base: var(--diffs-modified-color-override, light-dark(var(--diffs-light-modified-color, var(--diffs-modified-color, var(--diffs-modified-light))), var(--diffs-dark-modified-color, var(--diffs-modified-color, var(--diffs-modified-dark)))));\n --diffs-bg-deletion: var(--diffs-bg-deletion-override, light-dark(color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-deletion-base)), color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-deletion-base))));\n --diffs-bg-deletion-emphasis: var(--diffs-bg-deletion-emphasis-override, light-dark(rgb(from var(--diffs-deletion-base) r g b / .15), rgb(from var(--diffs-deletion-base) r g b / .2)));\n --diffs-bg-addition: var(--diffs-bg-addition-override, light-dark(color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-addition-base)), color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-addition-base))));\n --diffs-bg-addition-emphasis: var(--diffs-bg-addition-emphasis-override, light-dark(rgb(from var(--diffs-addition-base) r g b / .15), rgb(from var(--diffs-addition-base) r g b / .2)));\n --diffs-selection-base: var(--diffs-modified-base);\n --diffs-selection-number-fg: light-dark(color-mix(in lab, var(--diffs-selection-base) 65%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-selection-base) 75%, var(--diffs-mixer)));\n background-color: var(--diffs-bg);\n color: var(--diffs-fg);\n display: block;\n }\n\n pre, code, [data-error-wrapper] {\n isolation: isolate;\n font-family: var(--diffs-font-family, var(--diffs-font-fallback));\n outline: none;\n margin: 0;\n padding: 0;\n display: block;\n }\n\n pre, code {\n background-color: var(--diffs-bg);\n }\n\n code {\n contain: content;\n }\n\n input, button {\n font-family: inherit;\n font-size: inherit;\n line-height: inherit;\n }\n\n *, :before, :after {\n box-sizing: border-box;\n }\n\n [data-icon-sprite] {\n display: none;\n }\n\n [data-diffs-header], [data-separator] {\n font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));\n }\n\n [data-diffs-header][data-sticky] {\n z-index: 1;\n background-color: var(--diffs-bg);\n position: sticky;\n top: 0;\n }\n\n [data-file-info] {\n color: var(--fg);\n background-color: color-mix(in lab, var(--bg) 98%, var(--fg));\n border-block: 1px solid color-mix(in lab, var(--bg) 95%, var(--fg));\n padding: 10px;\n font-weight: 700;\n }\n\n [data-diff], [data-file] {\n --diffs-grid-number-column-width: minmax(min-content, max-content);\n --diffs-code-grid: var(--diffs-grid-number-column-width) 1fr;\n\n &[data-dehydrated] {\n --diffs-code-grid: var(--diffs-grid-number-column-width) minmax(0, 1fr);\n }\n\n &:hover [data-code]::-webkit-scrollbar-thumb {\n background-color: var(--diffs-bg-context);\n }\n }\n\n @supports (-webkit-touch-callout: none) {\n :host {\n --diffs-scrollbar-gutter-fallback: 0px;\n }\n }\n\n [data-line] span {\n color: light-dark(var(--diffs-token-light, var(--diffs-light)), var(--diffs-token-dark, var(--diffs-dark)));\n background-color: light-dark(var(--diffs-token-light-bg, inherit), var(--diffs-token-dark-bg, inherit));\n font-weight: light-dark(var(--diffs-token-light-font-weight, inherit), var(--diffs-token-dark-font-weight, inherit));\n font-style: light-dark(var(--diffs-token-light-font-style, inherit), var(--diffs-token-dark-font-style, inherit));\n text-decoration: light-dark(var(--diffs-token-light-text-decoration, inherit), var(--diffs-token-dark-text-decoration, inherit));\n }\n\n [data-line], [data-gutter-buffer], [data-column-number], [data-line-annotation], [data-no-newline], [data-merge-conflict], [data-merge-conflict-actions], [data-editor-overlay] {\n --diffs-computed-decoration-bg: var(--diffs-bg);\n --diffs-computed-diff-line-bg: var(--diffs-computed-decoration-bg);\n --diffs-computed-selected-line-bg: var(--diffs-computed-diff-line-bg);\n --diffs-computed-editor-active-line-bg: var(--diffs-computed-selected-line-bg);\n --diffs-computed-hovered-line-bg: var(--diffs-computed-editor-active-line-bg);\n --diffs-hover-mix-target: var(--diffs-bg-hover-override, var(--diffs-mixer));\n --diffs-line-bg: var(--diffs-computed-hovered-line-bg);\n color: var(--diffs-fg);\n background-color: var(--diffs-line-bg, var(--diffs-bg));\n }\n\n [data-line], [data-no-newline] {\n &[data-decoration-bg] {\n --mix-deco-light: 92%;\n --mix-deco-dark: 85%;\n\n &[data-decoration-bg-depth="2"] {\n --mix-deco-light: 88%;\n --mix-deco-dark: 80%;\n }\n\n &[data-decoration-bg-depth="3"] {\n --mix-deco-light: 85%;\n --mix-deco-dark: 78%;\n }\n\n --diffs-hover-mix-target: var(--diffs-decoration-bg);\n --diffs-computed-decoration-bg: light-dark(color-mix(in lab,\n var(--diffs-bg) var(--mix-deco-light),\n var(--diffs-decoration-bg)), color-mix(in lab,\n var(--diffs-bg) var(--mix-deco-dark),\n var(--diffs-decoration-bg)));\n }\n }\n\n [data-line-annotation], [data-gutter-buffer="annotation"] {\n --diffs-annotation-bg: var(--diffs-bg-context);\n --diffs-computed-decoration-bg: var(--diffs-annotation-bg);\n --diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);\n }\n\n [data-merge-conflict-actions], [data-gutter-buffer="merge-conflict-action"], [data-gutter-buffer="merge-conflict-marker-base"], [data-gutter-buffer="merge-conflict-marker-separator"], [data-merge-conflict="marker-base"], [data-merge-conflict="marker-separator"] {\n --diffs-computed-decoration-bg: var(--diffs-bg-context);\n --diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);\n }\n\n [data-gutter-buffer="merge-conflict-marker-start"], [data-merge-conflict="marker-start"] {\n --diffs-computed-decoration-bg: light-dark(color-mix(in lab,\n var(--diffs-bg) 78%,\n var(--conflict-bg-current-header-override, var(--diffs-addition-base))), color-mix(in lab,\n var(--diffs-bg) 68%,\n var(--conflict-bg-current-header-override, var(--diffs-addition-base))));\n --diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);\n }\n\n [data-gutter-buffer="merge-conflict-marker-end"], [data-merge-conflict="marker-end"] {\n --diffs-computed-decoration-bg: light-dark(color-mix(in lab,\n var(--diffs-bg) 78%,\n var(--conflict-bg-incoming-header-override, var(--diffs-modified-base))), color-mix(in lab,\n var(--diffs-bg) 68%,\n var(--conflict-bg-incoming-header-override, var(--diffs-modified-base))));\n --diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);\n }\n\n [data-has-merge-conflict] [data-line-annotation], [data-has-merge-conflict] [data-gutter-buffer="annotation"] {\n --diffs-computed-decoration-bg: var(--diffs-bg);\n --diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);\n }\n\n :where([data-background]) {\n & [data-gutter-buffer], & [data-column-number] {\n --mix-light: 91%;\n --mix-dark: 85%;\n }\n\n & [data-line], & [data-no-newline] {\n --mix-light: 88%;\n --mix-dark: 80%;\n }\n\n & [data-gutter-buffer], & [data-column-number], & [data-line], & [data-no-newline] {\n --diffs-diff-line-mix-target: var(--diffs-bg);\n\n &[data-line-type="change-deletion"] {\n --diffs-diff-line-mix-target: var(--diffs-bg-deletion-override, var(--diffs-deletion-base));\n --diffs-hover-mix-target: var(--diffs-diff-line-mix-target);\n\n &:where([data-gutter-buffer], [data-column-number]) {\n color: var(--diffs-fg-number-deletion-override, var(--diffs-deletion-base));\n --diffs-diff-line-mix-target: var(--diffs-bg-deletion-number-override, var(--diffs-deletion-base));\n }\n\n --diffs-computed-diff-line-bg: light-dark(color-mix(in lab,\n var(--diffs-computed-decoration-bg) var(--mix-light),\n var(--diffs-diff-line-mix-target)), color-mix(in lab,\n var(--diffs-computed-decoration-bg) var(--mix-dark),\n var(--diffs-diff-line-mix-target)));\n }\n\n &[data-line-type="change-addition"] {\n --diffs-diff-line-mix-target: var(--diffs-bg-addition-override, var(--diffs-addition-base));\n --diffs-hover-mix-target: var(--diffs-diff-line-mix-target);\n\n &:where([data-gutter-buffer], [data-column-number]) {\n color: var(--diffs-fg-number-addition-override, var(--diffs-addition-base));\n --diffs-diff-line-mix-target: var(--diffs-bg-addition-number-override, var(--diffs-addition-base));\n }\n\n --diffs-computed-diff-line-bg: light-dark(color-mix(in lab,\n var(--diffs-computed-decoration-bg) var(--mix-light),\n var(--diffs-diff-line-mix-target)), color-mix(in lab,\n var(--diffs-computed-decoration-bg) var(--mix-dark),\n var(--diffs-diff-line-mix-target)));\n }\n\n &[data-merge-conflict="current"] {\n --diffs-diff-line-mix-target: var(--conflict-bg-current-override, var(--diffs-addition-base));\n --diffs-hover-mix-target: var(--diffs-diff-line-mix-target);\n\n &:where([data-gutter-buffer], [data-column-number]) {\n color: var(--diffs-fg-number-addition-override, var(--diffs-addition-base));\n --diffs-diff-line-mix-target: var(--conflict-bg-current-number-override, var(--diffs-addition-base));\n }\n\n --diffs-computed-diff-line-bg: light-dark(color-mix(in lab,\n var(--diffs-computed-decoration-bg) var(--mix-light),\n var(--diffs-diff-line-mix-target)), color-mix(in lab,\n var(--diffs-computed-decoration-bg) var(--mix-dark),\n var(--diffs-diff-line-mix-target)));\n }\n\n &[data-merge-conflict="incoming"] {\n --diffs-diff-line-mix-target: var(--conflict-bg-incoming-override, var(--diffs-modified-base));\n --diffs-hover-mix-target: var(--diffs-diff-line-mix-target);\n\n &:where([data-gutter-buffer], [data-column-number]) {\n color: var(--diffs-modified-base);\n --diffs-diff-line-mix-target: var(--conflict-bg-incoming-number-override, var(--diffs-modified-base));\n }\n\n --diffs-computed-diff-line-bg: light-dark(color-mix(in lab,\n var(--diffs-computed-decoration-bg) var(--mix-light),\n var(--diffs-diff-line-mix-target)), color-mix(in lab,\n var(--diffs-computed-decoration-bg) var(--mix-dark),\n var(--diffs-diff-line-mix-target)));\n }\n }\n }\n\n [data-gutter-buffer], [data-column-number], [data-line], [data-line-annotation], [data-merge-conflict], [data-merge-conflict-actions], [data-no-newline], [data-editor-overlay] {\n --diffs-selection-mix-target: var(--diffs-bg-selection-override, var(--diffs-selection-base));\n --diffs-selection-emphasis-mix-target: var(--diffs-selection-mix-target);\n\n &:where([data-editor-overlay]), &:where([data-line], [data-line-annotation], [data-merge-conflict], [data-merge-conflict-actions], [data-no-newline])[data-selected-line] {\n --mix-selection-light: 82%;\n --mix-selection-dark: 75%;\n --diffs-hover-mix-target: var(--diffs-selection-mix-target);\n }\n\n &:where([data-gutter-buffer][data-selected-line], [data-column-number]:is([data-selected-line], [data-editor-active-line])) {\n --mix-selection-light: 75%;\n --mix-selection-dark: 60%;\n --diffs-selection-mix-target: var(--diffs-bg-selection-number-override, var(--diffs-selection-base));\n --diffs-hover-mix-target: var(--diffs-selection-mix-target);\n }\n\n &:where([data-line][data-selected-line]):is([data-line-type="change-addition"], [data-line-type="change-deletion"]) {\n --diffs-selection-emphasis-mix-target: light-dark(color-mix(in lab,\n var(--diffs-diff-line-mix-target, var(--diffs-selection-mix-target))\n var(--mix-selection-light),\n var(--diffs-selection-mix-target)), var(--diffs-selection-mix-target));\n }\n\n &:where([data-editor-overlay]), &[data-selected-line] {\n --diffs-computed-selected-line-bg: light-dark(color-mix(in lab,\n var(--diffs-computed-diff-line-bg) var(--mix-selection-light),\n var(--diffs-selection-mix-target)), color-mix(in lab,\n var(--diffs-computed-diff-line-bg) var(--mix-selection-dark),\n var(--diffs-selection-mix-target)));\n }\n }\n\n [data-line][data-editor-active-line], [data-column-number][data-editor-active-line] {\n --diffs-computed-editor-active-line-bg: color-mix(in lab,\n var(--diffs-computed-selected-line-bg)\n var(--diffs-editor-active-line-source-mix, 100%),\n var(--diffs-selection-emphasis-mix-target));\n }\n\n @media (pointer: fine) {\n [data-line][data-hovered], [data-gutter-buffer][data-hovered], [data-column-number][data-hovered], [data-line-annotation][data-hovered], [data-no-newline][data-hovered], [data-merge-conflict][data-hovered], [data-merge-conflict-actions][data-hovered], [data-editor-overlay][data-hovered] {\n --diffs-computed-hovered-line-bg: light-dark(color-mix(in lab,\n var(--diffs-computed-editor-active-line-bg) 97%,\n var(--diffs-hover-mix-target)), color-mix(in lab,\n var(--diffs-computed-editor-active-line-bg) 91%,\n var(--diffs-hover-mix-target)));\n }\n }\n\n [data-gutter-buffer][data-selected-line], [data-column-number]:is([data-selected-line], [data-editor-active-line]) {\n color: var(--diffs-selection-number-fg);\n }\n\n [data-no-newline] {\n user-select: none;\n\n & span {\n opacity: .6;\n }\n }\n\n [data-diff-type="split"][data-overflow="scroll"] {\n grid-template-columns: 1fr 1fr;\n display: grid;\n\n & [data-additions] {\n border-left: 1px solid var(--diffs-bg);\n }\n\n & [data-deletions] {\n border-right: 1px solid var(--diffs-bg);\n }\n }\n\n [data-code] {\n grid-auto-flow: dense;\n grid-template-columns: var(--diffs-code-grid);\n overflow: var(--diffs-overflow-override, scroll) clip;\n overscroll-behavior-x: none;\n tab-size: var(--diffs-tab-size, 2);\n padding-top: var(--diffs-gap-block, var(--diffs-gap-fallback));\n padding-bottom: max(0px,\n calc(var(--diffs-gap-block, var(--diffs-gap-fallback)) -\n var(--diffs-scrollbar-gutter)));\n scrollbar-gutter: stable;\n align-self: flex-start;\n display: grid;\n }\n\n [data-diffs-scrollbar-measure] {\n opacity: 0;\n pointer-events: none;\n scrollbar-gutter: auto;\n grid-template-columns: none;\n width: 100px;\n height: 100px;\n padding: 0;\n position: absolute;\n top: -200px;\n left: -200px;\n }\n\n [data-container-size] {\n container-type: inline-size;\n }\n\n [data-code]::-webkit-scrollbar {\n width: 0;\n height: var(--diffs-scrollbar-gutter);\n }\n\n [data-code]::-webkit-scrollbar-track {\n background: none;\n }\n\n [data-code]::-webkit-scrollbar-thumb {\n background-color: #0000;\n background-clip: content-box;\n border: 1px solid #0000;\n border-radius: 3px;\n }\n\n [data-code]::-webkit-scrollbar-corner {\n background-color: #0000;\n }\n\n @supports ((-moz-appearance: none)) {\n [data-code] {\n scrollbar-width: thin;\n scrollbar-color: var(--diffs-bg-context) transparent;\n padding-bottom: var(--diffs-gap-block, var(--diffs-gap-fallback));\n }\n }\n\n [data-diffs-header] ~ [data-diff], [data-diffs-header] ~ [data-file] {\n & [data-code], &[data-overflow="wrap"], &[data-dehydrated][data-diff-type="split"][data-overflow="scroll"] {\n padding-top: 0;\n }\n }\n\n [data-gutter] {\n grid-template-rows: subgrid;\n grid-template-columns: subgrid;\n z-index: 3;\n background-color: var(--diffs-bg);\n grid-column: 1;\n display: grid;\n position: relative;\n\n & [data-gutter-buffer], & [data-column-number] {\n border-right: var(--diffs-gap-style, 2px solid var(--diffs-bg));\n }\n }\n\n [data-content] {\n grid-template-rows: subgrid;\n grid-template-columns: subgrid;\n background-color: var(--diffs-bg);\n grid-column: 2;\n min-width: 0;\n display: grid;\n }\n\n [data-diff-type="split"][data-overflow="wrap"], [data-dehydrated][data-diff-type="split"][data-overflow="scroll"] {\n grid-auto-flow: dense;\n grid-template-columns: repeat(2, var(--diffs-code-grid));\n padding-block: var(--diffs-gap-block, var(--diffs-gap-fallback));\n display: grid;\n\n & [data-code] {\n display: contents;\n }\n\n & [data-deletions] {\n & [data-gutter] {\n grid-column: 1;\n }\n\n & [data-content] {\n border-right: 1px solid var(--diffs-bg);\n grid-column: 2;\n }\n }\n\n & [data-additions] {\n & [data-gutter] {\n border-left: 1px solid var(--diffs-bg);\n grid-column: 3;\n }\n\n & [data-content] {\n grid-column: 4;\n }\n }\n }\n\n [data-dehydrated][data-diff-type="split"][data-overflow="scroll"] [data-content] {\n overflow: clip;\n }\n\n [data-overflow="scroll"] [data-gutter] {\n position: sticky;\n left: 0;\n }\n\n [data-interactive-lines] [data-line] {\n cursor: pointer;\n }\n\n [data-interactive-line-numbers] [data-column-number] {\n cursor: pointer;\n touch-action: none;\n }\n\n [data-content-buffer], [data-gutter-buffer] {\n user-select: none;\n min-height: 1lh;\n position: relative;\n }\n\n [data-gutter-buffer] {\n padding-left: 2ch;\n padding-right: 1ch;\n\n &:before {\n content: "";\n min-width: var(--diffs-min-number-column-width, var(--diffs-min-number-column-width-default, 3ch));\n display: block;\n }\n }\n\n [data-gutter-buffer="annotation"] {\n --diffs-annotation-bg: var(--diffs-bg-context-gutter);\n min-height: 0;\n }\n\n [data-gutter-buffer="buffer"] {\n --diffs-line-bg: var(--diffs-bg-context-gutter);\n }\n\n [data-content-buffer] {\n background-position: 5px 0;\n background-size: 8px 8px;\n background-origin: border-box;\n background-image: repeating-linear-gradient(-45deg,\n transparent,\n transparent calc(3px * 1.414),\n var(--diffs-bg-buffer) calc(3px * 1.414),\n var(--diffs-bg-buffer) calc(4px * 1.414));\n grid-column: 1;\n }\n\n [data-separator] {\n box-sizing: content-box;\n background-color: var(--diffs-bg);\n }\n\n [data-separator="simple"] {\n min-height: 4px;\n }\n\n [data-separator="line-info"], [data-separator="line-info-basic"], [data-separator="metadata"], [data-separator="simple"] {\n background-color: var(--diffs-bg-separator);\n }\n\n [data-separator="line-info"], [data-separator="line-info-basic"], [data-separator="metadata"] {\n height: 32px;\n position: relative;\n }\n\n [data-separator-wrapper] {\n user-select: none;\n fill: currentColor;\n background-color: var(--diffs-bg);\n align-items: center;\n height: 100%;\n display: flex;\n position: absolute;\n inset-inline: 0;\n }\n\n [data-content] [data-separator-wrapper] {\n display: none;\n }\n\n [data-separator="metadata"] [data-separator-wrapper] {\n background-color: var(--diffs-bg-separator);\n height: 100%;\n color: var(--diffs-fg-number);\n white-space: nowrap;\n text-overflow: ellipsis;\n min-width: min-content;\n padding-inline: 1ch;\n inset-inline: 100% auto;\n overflow: hidden;\n }\n\n [data-separator="line-info"] {\n margin-block: var(--diffs-gap-block, var(--diffs-gap-fallback));\n\n & [data-separator-wrapper] {\n min-width: 16px;\n }\n }\n\n [data-separator="line-info-basic"], [data-separator="metadata"] {\n margin-block: 0;\n }\n\n [data-separator="line-info"][data-separator-first] {\n margin-top: 0;\n }\n\n [data-separator="line-info"][data-separator-last] {\n margin-bottom: 0;\n }\n\n [data-expand-index] [data-separator-wrapper] {\n grid-template-columns: 32px auto;\n display: grid;\n }\n\n [data-expand-index] [data-separator-wrapper][data-separator-multi-button] {\n grid-template-columns: 32px 32px auto;\n }\n\n [data-expand-button], [data-separator-content] {\n background-color: var(--diffs-bg-separator);\n flex: none;\n align-items: center;\n display: flex;\n }\n\n [data-expand-index] [data-separator-content]:hover {\n cursor: pointer;\n text-decoration: underline;\n }\n\n [data-expand-button] {\n cursor: pointer;\n min-width: 32px;\n color: var(--diffs-fg-number);\n border-right: 2px solid var(--diffs-bg);\n flex-shrink: 0;\n justify-content: center;\n align-self: stretch;\n\n &:hover {\n color: var(--diffs-fg);\n }\n\n &[data-expand-all-button] {\n display: none;\n }\n }\n\n [data-expand-down] [data-icon] {\n transform: scaleY(-1);\n }\n\n [data-separator-content] {\n height: 100%;\n color: var(--diffs-fg-number);\n flex: auto;\n justify-content: flex-start;\n padding: 0 1ch;\n overflow: hidden;\n }\n\n [data-separator="line-info"], [data-separator="line-info-basic"] {\n & [data-separator-content] {\n user-select: none;\n height: 100%;\n overflow: clip;\n }\n }\n\n [data-unmodified-lines] {\n text-overflow: ellipsis;\n white-space: nowrap;\n flex: 0 auto;\n min-width: 0;\n display: block;\n overflow: hidden;\n }\n\n @supports (width: 1cqi) {\n [data-unified] {\n & [data-separator="line-info"] [data-separator-wrapper] {\n padding-inline: var(--diffs-gap-inline, var(--diffs-gap-fallback));\n width: 100cqi;\n\n & [data-separator-content] {\n border-radius: 6px;\n }\n }\n\n & [data-separator="line-info"][data-expand-index] [data-separator-wrapper] [data-separator-content] {\n border-top-left-radius: unset;\n border-bottom-left-radius: unset;\n }\n }\n\n [data-gutter] {\n & [data-separator="line-info"] [data-separator-wrapper] {\n padding-left: var(--diffs-gap-inline, var(--diffs-gap-fallback));\n }\n\n & [data-separator="line-info"] [data-separator-content] {\n border-top-left-radius: 6px;\n border-bottom-left-radius: 6px;\n }\n\n & [data-separator="line-info"][data-expand-index] [data-separator-content] {\n border-top-left-radius: unset;\n border-bottom-left-radius: unset;\n }\n }\n\n [data-additions] {\n & [data-content] [data-separator="line-info"] {\n background-color: var(--diffs-bg);\n\n & [data-separator-wrapper] {\n display: none;\n }\n }\n\n & [data-gutter] [data-separator="line-info"] [data-separator-wrapper] {\n background-color: var(--diffs-bg-separator);\n border-top-right-radius: 6px;\n border-bottom-right-radius: 6px;\n height: 100%;\n display: block;\n\n & [data-separator-content], & [data-expand-button] {\n display: none;\n }\n }\n }\n\n [data-overflow="scroll"] [data-additions] [data-gutter] [data-separator="line-info"] [data-separator-wrapper] {\n width: calc(100cqi - var(--diffs-gap-inline, var(--diffs-gap-fallback)));\n }\n\n [data-overflow="wrap"] [data-additions] [data-content] [data-separator="line-info"] [data-separator-wrapper] {\n background-color: var(--diffs-bg-separator);\n height: 100%;\n margin-right: var(--diffs-gap-inline, var(--diffs-gap-fallback));\n border-top-right-radius: 6px;\n border-bottom-right-radius: 6px;\n display: block;\n\n & [data-separator-content], & [data-expand-button] {\n display: none;\n }\n }\n\n [data-separator="line-info"] [data-separator-wrapper] {\n & [data-expand-both], & [data-expand-down], & [data-expand-up] {\n border-top-left-radius: 6px;\n border-bottom-left-radius: 6px;\n }\n }\n\n @media (pointer: fine) {\n [data-separator="line-info"] [data-separator-wrapper] {\n &[data-separator-multi-button] {\n & [data-expand-up] {\n border-top-left-radius: 6px;\n border-bottom-left-radius: unset;\n }\n\n & [data-expand-down] {\n border-bottom-left-radius: 6px;\n border-top-left-radius: unset;\n }\n }\n }\n }\n }\n\n @media (pointer: coarse) {\n [data-separator="line-info-basic"] [data-separator-wrapper][data-separator-multi-button] {\n grid-template-columns: 34px 34px auto;\n\n & [data-separator-content] {\n grid-column: unset;\n grid-row: unset;\n }\n }\n\n @supports (width: 1cqi) {\n [data-separator="line-info"] [data-separator-wrapper] {\n & [data-expand-both], & [data-expand-down], & [data-expand-up] {\n border-top-left-radius: 6px;\n border-bottom-left-radius: 6px;\n }\n\n &[data-separator-multi-button] {\n & [data-expand-up] {\n border-top-left-radius: 6px;\n border-bottom-left-radius: 6px;\n }\n\n & [data-expand-down] {\n border-bottom-left-radius: unset;\n border-top-left-radius: unset;\n }\n }\n }\n }\n }\n\n @media (pointer: fine) {\n [data-separator-wrapper][data-separator-multi-button] {\n grid-template-rows: 50% 50%;\n display: grid;\n\n & [data-separator-content] {\n grid-area: 1 / 2 / -1;\n min-width: min-content;\n }\n\n & [data-expand-button] {\n grid-column: 1;\n }\n }\n\n [data-separator="line-info"] [data-separator-wrapper], [data-separator="line-info"] [data-separator-wrapper][data-separator-multi-button] {\n grid-template-columns: 34px auto;\n }\n\n [data-separator="line-info-basic"][data-expand-index] [data-separator-wrapper] {\n grid-template-columns: 100% auto;\n }\n\n [data-separator="line-info"], [data-separator="line-info-basic"] {\n & [data-separator-multi-button] {\n & [data-expand-up] {\n border-bottom: 1px solid var(--diffs-bg);\n border-right: 2px solid var(--diffs-bg);\n }\n\n & [data-expand-down] {\n border-top: 1px solid var(--diffs-bg);\n border-right: 2px solid var(--diffs-bg);\n }\n }\n }\n }\n\n [data-additions] [data-gutter] [data-separator-wrapper], [data-additions] [data-separator="line-info-basic"] [data-separator-wrapper], [data-content] [data-separator-wrapper] {\n display: none;\n }\n\n [data-line-annotation] {\n min-height: var(--diffs-annotation-min-height, 0);\n z-index: 2;\n }\n\n [data-merge-conflict-actions] {\n z-index: 2;\n }\n\n [data-separator="custom"] {\n grid-template-columns: subgrid;\n display: grid;\n }\n\n [data-line], [data-column-number], [data-no-newline] {\n padding-inline: 1ch;\n position: relative;\n }\n\n [data-indicators="classic"] [data-line] {\n padding-inline-start: 2ch;\n }\n\n [data-indicators="classic"] {\n & [data-line-type="change-addition"], & [data-line-type="change-deletion"] {\n &[data-no-newline], &[data-line] {\n &:before {\n user-select: none;\n width: 1ch;\n height: 1lh;\n display: inline-block;\n position: absolute;\n top: 0;\n left: 0;\n }\n }\n }\n\n & [data-line-type="change-addition"] {\n &[data-line], &[data-no-newline] {\n &:before {\n content: "+";\n color: var(--diffs-addition-base);\n }\n }\n }\n\n & [data-line-type="change-deletion"] {\n &[data-line], &[data-no-newline] {\n &:before {\n content: "-";\n color: var(--diffs-deletion-base);\n }\n }\n }\n }\n\n [data-indicators="bars"] {\n & [data-line-type="change-deletion"], & [data-line-type="change-addition"] {\n &[data-column-number] {\n &:before {\n content: "";\n user-select: none;\n contain: strict;\n width: 4px;\n height: 100%;\n display: block;\n position: absolute;\n top: 0;\n left: 0;\n }\n }\n }\n\n & [data-line-type="change-deletion"] {\n &[data-column-number] {\n &:before {\n background-image: linear-gradient(0deg,\n var(--diffs-bg-deletion) 50%,\n var(--diffs-deletion-base) 50%);\n background-repeat: repeat;\n background-size: 2px 2px;\n background-size: calc(1lh / round(1lh / 2px))\n calc(1lh / round(1lh / 2px));\n }\n }\n }\n\n & [data-line-type="change-addition"] {\n &[data-column-number] {\n &:before {\n background-color: var(--diffs-addition-base);\n }\n }\n }\n }\n\n [data-overflow="wrap"] {\n & [data-line] {\n white-space: pre-wrap;\n word-break: break-word;\n }\n\n & [data-annotation-content] {\n word-break: break-word;\n }\n }\n\n [data-overflow="scroll"] [data-line] {\n white-space: pre;\n min-height: 1lh;\n }\n\n [data-column-number] {\n box-sizing: content-box;\n text-align: right;\n user-select: none;\n color: var(--diffs-fg-number);\n padding-left: 2ch;\n }\n\n [data-line-number-content] {\n min-width: var(--diffs-min-number-column-width, var(--diffs-min-number-column-width-default, 3ch));\n z-index: 1;\n display: inline-block;\n position: relative;\n }\n\n [data-disable-line-numbers] {\n & [data-gutter-buffer], & [data-column-number] {\n min-width: 4px;\n padding: 0;\n\n &:before {\n min-width: 0;\n }\n }\n\n & [data-line-number-content] {\n display: none;\n }\n\n & [data-gutter-utility-slot] {\n right: unset;\n justify-content: flex-start;\n left: 0;\n }\n\n &[data-indicators="bars"] [data-gutter-utility-slot] {\n left: 6px;\n }\n }\n\n [data-file][data-disable-line-numbers] {\n & [data-gutter-buffer], & [data-column-number] {\n border-right: 0;\n min-width: 0;\n }\n }\n\n [data-diff-span] {\n box-decoration-break: clone;\n border-radius: 3px;\n }\n\n [data-line-type="change-addition"] [data-diff-span] {\n background-color: var(--diffs-bg-addition-emphasis);\n }\n\n [data-line-type="change-deletion"] [data-diff-span] {\n background-color: var(--diffs-bg-deletion-emphasis);\n }\n\n [data-merge-conflict="marker-start"], [data-merge-conflict="marker-base"], [data-merge-conflict="marker-separator"], [data-merge-conflict="marker-end"] {\n color: var(--diffs-fg);\n padding-left: 1ch;\n }\n\n [data-merge-conflict="marker-start"], [data-merge-conflict="marker-end"] {\n align-items: center;\n display: flex;\n\n &:after {\n color: var(--diffs-fg-conflict-marker);\n font-size: .75rem;\n font-style: normal;\n line-height: 1.25rem;\n font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));\n padding-left: 1ch;\n }\n }\n\n [data-merge-conflict="marker-start"]:after {\n content: "(Current Change)";\n }\n\n [data-merge-conflict="marker-end"]:after {\n content: "(Incoming Change)";\n }\n\n [data-merge-conflict-actions-content] {\n min-height: 1.75rem;\n font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));\n color: var(--diffs-fg);\n align-items: center;\n gap: .25rem;\n padding-inline: .5rem;\n font-size: .75rem;\n line-height: 1.2;\n display: flex;\n }\n\n [data-merge-conflict-action] {\n appearance: none;\n color: var(--diffs-fg-number);\n font: inherit;\n cursor: pointer;\n background: none;\n border: 0;\n padding: 0;\n font-style: normal;\n }\n\n [data-merge-conflict-action]:hover {\n color: var(--diffs-fg);\n }\n\n [data-merge-conflict-action="current"]:hover {\n color: var(--diffs-addition-base);\n }\n\n [data-merge-conflict-action="incoming"]:hover {\n color: var(--diffs-modified-base);\n }\n\n [data-merge-conflict-action-separator] {\n color: var(--diffs-fg-number);\n opacity: .6;\n user-select: none;\n }\n\n [data-diffs-header="default"] {\n background-color: var(--diffs-bg);\n justify-content: space-between;\n align-items: center;\n gap: var(--diffs-gap-inline, var(--diffs-gap-fallback));\n min-height: calc(1lh + (var(--diffs-gap-block, var(--diffs-gap-fallback)) * 3));\n z-index: 2;\n flex-direction: row;\n padding-inline: 16px;\n display: flex;\n position: relative;\n top: 0;\n }\n\n [data-header-content] {\n align-items: center;\n gap: var(--diffs-gap-inline, var(--diffs-gap-fallback));\n white-space: nowrap;\n flex-direction: row;\n min-width: 0;\n display: flex;\n }\n\n [data-header-content] [data-prev-name], [data-header-content] [data-title] {\n text-overflow: ellipsis;\n white-space: nowrap;\n direction: rtl;\n min-width: 0;\n overflow: hidden;\n }\n\n [data-prev-name] {\n opacity: .7;\n }\n\n [data-rename-icon] {\n fill: currentColor;\n flex-grow: 0;\n flex-shrink: 0;\n }\n\n [data-diffs-header="default"] [data-metadata] {\n white-space: nowrap;\n align-items: center;\n gap: 1ch;\n display: flex;\n }\n\n [data-diffs-header="default"] [data-additions-count] {\n font-family: var(--diffs-font-family, var(--diffs-font-fallback));\n color: var(--diffs-addition-base);\n }\n\n [data-diffs-header="default"] [data-deletions-count] {\n font-family: var(--diffs-font-family, var(--diffs-font-fallback));\n color: var(--diffs-deletion-base);\n }\n\n [data-change-icon] {\n fill: currentColor;\n flex-shrink: 0;\n }\n\n [data-change-icon="change"], [data-change-icon="rename-pure"], [data-change-icon="rename-changed"] {\n color: var(--diffs-modified-base);\n }\n\n [data-change-icon="new"] {\n color: var(--diffs-addition-base);\n }\n\n [data-change-icon="deleted"] {\n color: var(--diffs-deletion-base);\n }\n\n [data-change-icon="file"] {\n opacity: .6;\n }\n\n [data-annotation-content] {\n z-index: 2;\n isolation: isolate;\n white-space: normal;\n align-self: flex-start;\n min-width: 0;\n display: flow-root;\n position: relative;\n }\n\n [data-overflow="scroll"] [data-annotation-content], [data-overflow="scroll"] [data-merge-conflict-actions-content] {\n width: var(--diffs-column-content-width, auto);\n left: var(--diffs-column-number-width, 0);\n position: sticky;\n }\n\n [data-annotation-slot] {\n text-wrap-mode: wrap;\n word-break: normal;\n white-space-collapse: collapse;\n }\n\n [data-gutter-utility-slot] {\n touch-action: none;\n justify-content: flex-end;\n display: flex;\n position: absolute;\n top: 0;\n bottom: 0;\n right: 0;\n }\n\n [data-utility-button] {\n appearance: none;\n cursor: pointer;\n width: 1lh;\n height: 1lh;\n font-size: var(--diffs-font-size, 13px);\n line-height: var(--diffs-line-height, 20px);\n background-color: var(--diffs-modified-base);\n color: var(--diffs-bg);\n fill: currentColor;\n z-index: 4;\n touch-action: none;\n border: none;\n border-radius: 4px;\n justify-content: center;\n align-items: center;\n margin-right: calc(-1lh + 1ch);\n padding: 0;\n display: flex;\n position: relative;\n\n &:before {\n content: "";\n display: block;\n position: absolute;\n inset: 0 0 0 -4px;\n }\n }\n\n [data-decoration-bar-stack] {\n pointer-events: none;\n isolation: isolate;\n z-index: 1;\n background-color: var(--diffs-decoration-bar-color, transparent);\n box-sizing: content-box;\n border-left: 2px solid var(--diffs-bg);\n border-right: 2px solid var(--diffs-bg);\n width: 6px;\n position: absolute;\n top: 0;\n bottom: 0;\n right: -2px;\n\n [data-decoration-bar-depth="1"] & {\n background-color: color-mix(in lab,\n var(--diffs-bg) 20%,\n var(--diffs-decoration-bar-color, transparent));\n }\n\n [data-decoration-bar-depth="2"] & {\n background-color: color-mix(in lab,\n var(--diffs-bg) 45%,\n var(--diffs-decoration-bar-color, transparent));\n }\n\n [data-decoration-bar-depth="3"] & {\n background-color: color-mix(in lab,\n var(--diffs-bg) 65%,\n var(--diffs-decoration-bar-color, transparent));\n }\n\n [data-decoration-bar-start] & {\n border-top-left-radius: 5px;\n border-top-right-radius: 5px;\n }\n\n [data-decoration-bar-end] & {\n z-index: 3;\n border-bottom-right-radius: 5px;\n border-bottom-left-radius: 5px;\n }\n }\n\n [data-placeholder] {\n contain: strict;\n }\n\n [data-error-wrapper] {\n padding: var(--diffs-gap-block, var(--diffs-gap-fallback))\n var(--diffs-gap-inline, var(--diffs-gap-fallback));\n scrollbar-width: none;\n max-height: 400px;\n overflow: auto;\n\n & [data-error-message] {\n color: var(--diffs-deletion-base);\n font-size: 18px;\n font-weight: bold;\n }\n\n & [data-error-stack] {\n color: var(--diffs-fg-number);\n }\n }\n}\n\n@layer theme, rendered, unsafe;\n'),t.adoptedStyleSheets=[e]}connectedCallback(){tr(this.shadowRoot??this.attachShadow({mode:"open"}))}}customElements.define(a,t)}async function tu(e,t=300){let n;try{await Promise.race([e(),new Promise(e=>{n=setTimeout(e,t)})])}finally{null!=n&&clearTimeout(n)}}function th({oldFile:e,newFile:t},n){if(void 0!==e||void 0!==t){if(void 0===e||void 0===t)throw Error(`${n}: Pass null for an intentionally missing oldFile or newFile side`);if(null===e&&null===t)throw Error(`${n}: You must pass oldFile, newFile, or both`);return{oldFile:e,newFile:t}}}function tc(e){return""!==e?e.split(s):[]}function tf(e,t,n){let i="clone"===e?{...t,hunks:t.hunks.map(e=>({...e,hunkContent:e.hunkContent.map(e=>({...e}))})),deletionLines:[...t.deletionLines],additionLines:[...t.additionLines]}:t;if(!i.isPartial)throw Error("hydratePartialDiff: fileDiff must be partial");switch(i.type){case"change":case"rename-changed":return function(e,t,n){let i=tc(t.contents),r=tc(n.contents),{hunks:o,splitLineCount:a,unifiedLineCount:l}=function(e,t){let n=0,i=0,r=0,o=[];for(let t of e){var a;let e=Math.max(t.additionStart-1,0),l=Math.max(t.deletionStart-1,0),s=e,d=l,u=0,h=0,c=0,f=0,p=[];for(let e of t.hunkContent){if("context"===e.type){p.push({...e,additionLineIndex:s,deletionLineIndex:d}),s+=e.lines,d+=e.lines,c+=e.lines,f+=e.lines;continue}p.push({...e,additionLineIndex:s,deletionLineIndex:d}),s+=e.additions,d+=e.deletions,u+=e.additions,h+=e.deletions,c+=Math.max(e.additions,e.deletions),f+=e.additions+e.deletions}let g=Math.max((a=t.additionStart,a-(0!==t.additionCount)-r),0);o.push({...t,collapsedBefore:g,additionLineIndex:e,deletionLineIndex:l,additionLines:u,deletionLines:h,hunkContent:p,splitLineStart:n+g,unifiedLineStart:i+g,splitLineCount:c,unifiedLineCount:f}),n+=g+c,i+=g+f,r=x(t.additionStart,t.additionCount)}if(o.length>0){let e=o[o.length-1],r=Math.max(t-x(e.additionStart,e.additionCount),0);n+=r,i+=r}return{hunks:o,splitLineCount:n,unifiedLineCount:i}}(e.hunks,r.length);return e.hunks=o,e.splitLineCount=a,e.unifiedLineCount=l,e.isPartial=!1,e.deletionLines=i,e.additionLines=r,tg(e,t,n),e}(i,function(e,t){if(null==t.oldFile)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile`);return t.oldFile}(i,n),tp(i,n));case"rename-pure":{let e=tp(i,n);var r=i,o=n;if(null!==o.oldFile)throw Error(`hydratePartialDiff: ${r.type} diff for ${r.name} requires oldFile to be null`);let t=tc(e.contents);return i.isPartial=!1,i.deletionLines=t,i.additionLines=t,tg(i,null,e),i}}throw Error(`hydratePartialDiff: ${i.type} diffs cannot be hydrated from loaded files`)}function tp(e,t){if(null==t.newFile)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires newFile`);return t.newFile}function tg(e,t,n){var i,r;let o=null!=e.cacheKey?`${e.cacheKey}:hydrated`:(i=t,r=n,null!=i&&null!=r?null!=i.cacheKey&&null!=r.cacheKey?`${i.cacheKey}:${r.cacheKey}`:void 0:i?.cacheKey??r?.cacheKey);null==o?delete e.cacheKey:e.cacheKey=o}function tm({diff:e,diffStyle:t,startingLine:n=0,totalLines:i=1/0,expandedHunks:r,collapsedContextThreshold:o=1,callback:a}){let l=function({diff:e,diffStyle:t,startingLine:n,expandedHunks:i,collapsedContextThreshold:r}){if(n<=0||"both"===t)return{hunkIndex:0,splitCount:0,unifiedCount:0};let o=function({diff:e,expandedHunks:t,collapsedContextThreshold:n}){let i=0,r=0,o=e.hunks.length-1,a=[{splitCount:0,unifiedCount:0}];for(let l=0;l<e.hunks.length;l++){let s=e.hunks[l];if(null==s)throw Error("iterateOverDiff: invalid hunk summary index");let d=ec({isPartial:e.isPartial,rangeSize:s.collapsedBefore,expandedHunks:t,hunkIndex:l,collapsedContextThreshold:n}),u=d.fromStart+d.fromEnd;i+=u+s.splitLineCount,r+=u+s.unifiedLineCount;let h=l===o?ep({fileDiff:e,hunkIndex:l,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:"iterateOverDiff"}):void 0;if(null!=h){let e=h.fromStart+h.fromEnd;i+=e,r+=e}a.push({splitCount:i,unifiedCount:r})}return a}({diff:e,expandedHunks:i,collapsedContextThreshold:r}),a=0,l=e.hunks.length-1,s=e.hunks.length;for(;a<=l;){let e=a+l>>1,i=o[e+1];if(null==i)throw Error("iterateOverDiff: invalid hunk prefix index");("unified"===t?i.unifiedCount:i.splitCount)>n?(s=e,l=e-1):a=e+1}if(s>=e.hunks.length){let t=o[e.hunks.length];if(null==t)throw Error("iterateOverDiff: invalid terminal hunk prefix index");return{hunkIndex:e.hunks.length,splitCount:t.splitCount,unifiedCount:t.unifiedCount}}let d=o[s];if(null==d)throw Error("iterateOverDiff: invalid selected hunk prefix index");return{hunkIndex:s,splitCount:d.splitCount,unifiedCount:d.unifiedCount}}({diff:e,diffStyle:t,startingLine:n,expandedHunks:r,collapsedContextThreshold:o}),s={viewportStart:n,viewportEnd:n+i,isWindowedHighlight:n>0||i<1/0,splitCount:l.splitCount,unifiedCount:l.unifiedCount,finalHunkIndex:e.hunks.length-1,shouldBreak(){if(!s.isWindowedHighlight)return!1;let e=s.unifiedCount>=n+i,r=s.splitCount>=n+i;return"unified"===t?e:"split"===t?r:e&&r},shouldSkip(e,i){if(!s.isWindowedHighlight)return!1;let r=e>0&&s.unifiedCount+e<=n,o=i>0&&s.splitCount+i<=n;return"unified"===t?r:"split"===t?o:r&&o},incrementCounts(e,n){("unified"===t||"both"===t)&&(s.unifiedCount+=e),("split"===t||"both"===t)&&(s.splitCount+=n)},isInWindow(e,n){if(!s.isWindowedHighlight)return!0;let i=s.isInUnifiedWindow(e),r=s.isInSplitWindow(n);return"unified"===t?i:"split"===t?r:i||r},isInUnifiedWindow:e=>!s.isWindowedHighlight||s.unifiedCount>=n-e&&s.unifiedCount<n+i,isInSplitWindow:e=>!s.isWindowedHighlight||s.splitCount>=n-e&&s.splitCount<n+i,emit:(e,n=!1)=>(n||("unified"===t?s.incrementCounts(1,0):"split"===t?s.incrementCounts(0,1):s.incrementCounts(1,1)),a(e)??!1)};e:for(let n=l.hunkIndex;n<e.hunks.length;n++){var d,u;let i=e.hunks[n];if(null==i)throw Error("iterateOverDiff: invalid hunk index");if(s.shouldBreak())break;let a=(d=i.deletionStart,d-(0!==i.deletionCount)),l=(u=i.additionStart,u-(0!==i.additionCount)),f=e.isPartial||0!==i.deletionCount?i.deletionLineIndex:a,p=e.isPartial||0!==i.additionCount?i.additionLineIndex:l,g=ec({isPartial:e.isPartial,rangeSize:i.collapsedBefore,expandedHunks:r,hunkIndex:n,collapsedContextThreshold:o}),m=n===s.finalHunkIndex?ep({fileDiff:e,hunkIndex:n,expandedHunks:r,collapsedContextThreshold:o,errorPrefix:"iterateOverDiff"}):void 0,b=g.fromStart+g.fromEnd;function h(e,n){return null==m||m.collapsedLines<=0||m.fromStart+m.fromEnd>0?0:"unified"===t?e===i.unifiedLineStart+i.unifiedLineCount-1?m.collapsedLines:0:n===i.splitLineStart+i.splitLineCount-1?m.collapsedLines:0}let v=0===g.collapsedLines;function c(){return v?0:(v=!0,g.collapsedLines)}if(s.shouldSkip(b,b))s.incrementCounts(b,b),c();else{let e=i.unifiedLineStart-g.rangeSize,r=i.splitLineStart-g.rangeSize,o=f-g.rangeSize,d=p-g.rangeSize,u=a+1-g.rangeSize,h=l+1-g.rangeSize;if(tb(s,g.fromStart,t,t=>s.emit({hunkIndex:n,hunk:i,collapsedBefore:0,collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:u+t,lineIndex:o+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:r+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:r+t,lineIndex:d+t,lineNumber:h+t,noEOFCR:!1}}))||(e=i.unifiedLineStart-g.fromEnd,r=i.splitLineStart-g.fromEnd,o=f-g.fromEnd,d=p-g.fromEnd,u=a+1-g.fromEnd,h=l+1-g.fromEnd,tb(s,g.fromEnd,t,t=>s.emit({hunkIndex:n,hunk:i,collapsedBefore:c(),collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:u+t,lineIndex:o+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:r+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:r+t,lineIndex:d+t,lineNumber:h+t,noEOFCR:!1}}),()=>{c()})))break}let y=i.unifiedLineStart,C=i.splitLineStart,S=f,k=p,x=a+1,w=l+1,L=i.hunkContent.at(-1);for(let e of i.hunkContent){if(s.shouldBreak())break e;let r=e===L;if("context"===e.type){if(s.shouldSkip(e.lines,e.lines))s.incrementCounts(e.lines,e.lines),c();else if(tb(s,e.lines,t,t=>{let o=r&&t===e.lines-1,a=y+t,l=C+t;return s.emit({hunkIndex:n,hunk:i,collapsedBefore:c(),collapsedAfter:h(a,l),type:"context",deletionLine:{lineNumber:x+t,lineIndex:S+t,noEOFCR:o&&i.noEOFCRDeletions,unifiedLineIndex:a,splitLineIndex:l},additionLine:{unifiedLineIndex:a,splitLineIndex:l,lineIndex:k+t,lineNumber:w+t,noEOFCR:o&&i.noEOFCRAdditions}})},()=>{c()}))break e;y+=e.lines,C+=e.lines,S+=e.lines,k+=e.lines,x+=e.lines,w+=e.lines}else{let o=Math.max(e.deletions,e.additions),a=e.deletions+e.additions;if(!s.shouldSkip(a,o)){let l=function(e,t,n){if(!e.isWindowedHighlight)return[[0,"unified"===n?t.deletions+t.additions:Math.max(t.deletions,t.additions)]];let i="unified"===n?"unified":"split",r=[];function o(t,n){if(t+n<=e.viewportStart||t>=e.viewportEnd)return;let i=Math.max(0,e.viewportStart-t),r=Math.min(n,e.viewportEnd-t);return r>i?[i,r]:void 0}function a(e,n){if(null==e)return;let[o,a]="split"===i?e:"additions"===n?[e[0]+t.deletions,e[1]+t.deletions]:e;a>o&&r.push([o,a])}if("split"!==n&&(a(o(e.unifiedCount,t.deletions),"deletions"),a(o(e.unifiedCount+t.deletions,t.additions),"additions")),"unified"!==n&&(a(o(e.splitCount,t.deletions),"deletions"),a(o(e.splitCount,t.additions),"additions")),0===r.length)return r;r.sort((e,t)=>e[0]-t[0]);let l=[r[0]];for(let[e,t]of r.slice(1)){let n=l[l.length-1];e<=n[1]?n[1]=Math.max(n[1],t):l.push([e,t])}return l}(s,e,t);for(let[d,u]of((l[0]?.[0]??0)>0&&c(),l))for(let l=d;l<u;l++){let d=h(y+l,"unified"===t?C+(l<e.deletions?l:l-e.deletions):C+l);if(s.emit(function({hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:i,diffStyle:r,index:o,unifiedLineIndex:a,splitLineIndex:l,additionLineIndex:s,deletionLineIndex:d,additionLineNumber:u,deletionLineNumber:h,content:c,isLastContent:f,unifiedCount:p,splitCount:g}){let m=o<c.deletions?a+o:void 0,b="unified"===r?o>=c.deletions?a+o:void 0:o<c.additions?a+c.deletions+o:void 0,v="unified"===r?l+(o<c.deletions?o:o-c.deletions):l+o,y=o<c.deletions?d+o:void 0,C=o<c.deletions?h+o:void 0,S="unified"===r?o>=c.deletions?s+(o-c.deletions):void 0:o<c.additions?s+o:void 0,k="unified"===r?o>=c.deletions?u+(o-c.deletions):void 0:o<c.additions?u+o:void 0,x="unified"===r?f&&o===c.deletions-1&&t.noEOFCRDeletions:f&&o===g-1&&t.noEOFCRDeletions,w="unified"===r?f&&o===p-1&&t.noEOFCRAdditions:f&&o===g-1&&t.noEOFCRAdditions,L=null!=y&&null!=C&&null!=m?{lineNumber:C,lineIndex:y,noEOFCR:x,unifiedLineIndex:m,splitLineIndex:v}:void 0,A=null!=S&&null!=k&&null!=b?{unifiedLineIndex:b,splitLineIndex:v,lineIndex:S,lineNumber:k,noEOFCR:w}:void 0;if(null==L&&null!=A)return{type:"change",hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:i,deletionLine:void 0,additionLine:A};if(null!=L&&null==A)return{type:"change",hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:i,deletionLine:L,additionLine:void 0};if(null==L||null==A)throw Error("iterateOverDiff: missing change line data");return{type:"change",hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:i,deletionLine:L,additionLine:A}}({hunkIndex:n,hunk:i,collapsedBefore:c(),collapsedAfter:d,diffStyle:t,index:l,unifiedLineIndex:y,splitLineIndex:C,additionLineIndex:k,deletionLineIndex:S,additionLineNumber:w,deletionLineNumber:x,content:e,isLastContent:r,unifiedCount:a,splitCount:o}),!0))break e}}c(),s.incrementCounts(a,o),y+=a,C+=o,S+=e.deletions,k+=e.additions,x+=e.deletions,w+=e.additions}}if(null!=m){let{collapsedLines:n,fromStart:i,fromEnd:r}=m,o=i+r;if(tb(s,o,t,t=>{let i=t===o-1;return s.emit({hunkIndex:e.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:i?n:0,type:"context-expanded",deletionLine:{lineNumber:x+t,lineIndex:S+t,noEOFCR:!1,unifiedLineIndex:y+t,splitLineIndex:C+t},additionLine:{unifiedLineIndex:y+t,splitLineIndex:C+t,lineIndex:k+t,lineNumber:w+t,noEOFCR:!1}})},void 0,()=>s.shouldBreak()))break}}}function tb(e,t,n,i,r,o){let[a,l]=function(e,t,n){if(!e.isWindowedHighlight||t<=0)return[0,t];let i=[];function r(n){let r=Math.max(0,e.viewportStart-n),o=Math.min(t,e.viewportEnd-n);o>r&&i.push([r,o])}if("split"!==n&&r(e.unifiedCount),"unified"!==n&&r(e.splitCount),0===i.length)return[0,0];let o=i[0][0],a=i[0][1];for(let e=1;e<i.length;e++){let t=i[e];o=Math.min(o,t[0]),a=Math.max(a,t[1])}return[o,a]}(e,t,n);a>0&&(e.incrementCounts(a,a),r?.());let s=a;for(;s<t;){if(o?.()===!0)return!0;if(s>=l){e.incrementCounts(t-s,t-s);break}if(e.isInWindow(0,0)){if(!0===i(s))return!0}else e.incrementCounts(1,1);s++}return!1}var tv=class{isDeletionsScrolling=!1;isAdditionsScrolling=!1;timeoutId=-1;codeDeletions;codeAdditions;enabled=!1;cleanUp(){this.enabled&&(this.codeDeletions?.removeEventListener("scroll",this.handleDeletionsScroll),this.codeAdditions?.removeEventListener("scroll",this.handleAdditionsScroll),clearTimeout(this.timeoutId),this.codeDeletions=void 0,this.codeAdditions=void 0,this.enabled=!1)}setup(e,t,n){if(null==t||null==n)for(let i of e.children??[])i instanceof HTMLElement&&("deletions"in i.dataset?t=i:"additions"in i.dataset&&(n=i));null==n||null==t?this.cleanUp():(this.codeDeletions!==t&&(this.codeDeletions?.removeEventListener("scroll",this.handleDeletionsScroll),this.codeDeletions=t,t.addEventListener("scroll",this.handleDeletionsScroll,{passive:!0})),this.codeAdditions!==n&&(this.codeAdditions?.removeEventListener("scroll",this.handleAdditionsScroll),this.codeAdditions=n,n.addEventListener("scroll",this.handleAdditionsScroll,{passive:!0})),this.enabled=!0)}handleDeletionsScroll=()=>{this.isAdditionsScrolling||(this.isDeletionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isDeletionsScrolling=!1},300),this.codeAdditions?.scrollTo({left:this.codeDeletions?.scrollLeft}))};handleAdditionsScroll=()=>{this.isDeletionsScrolling||(this.isAdditionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isAdditionsScrolling=!1},300),this.codeDeletions?.scrollTo({left:this.codeAdditions?.scrollLeft}))}};function ty(e){return 0===e.startingLine&&e.totalLines===1/0&&0===e.bufferBefore&&0===e.bufferAfter}let tC=new Map,tS={"1c":"1c",abap:"abap",as:"actionscript-3",ada:"ada",adb:"ada",ads:"ada",adoc:"asciidoc",asciidoc:"asciidoc","component.html":"angular-html","component.ts":"angular-ts",conf:"nginx",htaccess:"apache",cls:"tex",trigger:"apex",apl:"apl",applescript:"applescript",scpt:"applescript",ara:"ara",asm:"asm",s:"riscv",astro:"astro",awk:"awk",bal:"ballerina",sh:"zsh",bash:"zsh",bat:"cmd",cmd:"cmd",be:"berry",beancount:"beancount",bib:"bibtex",bicep:"bicep","blade.php":"blade",bsl:"bsl",c:"c",h:"objective-cpp",cs:"csharp",cpp:"cpp",hpp:"cpp",cc:"cpp",cxx:"cpp",hh:"cpp",cdc:"cdc",cairo:"cairo",clar:"clarity",clj:"clojure",cljs:"clojure",cljc:"clojure",soy:"soy",cmake:"cmake","CMakeLists.txt":"cmake",cob:"cobol",cbl:"cobol",cobol:"cobol",CODEOWNERS:"codeowners",ql:"ql",coffee:"coffeescript",lisp:"lisp",cl:"lisp",lsp:"lisp",log:"log",v:"verilog",cql:"cql",cr:"crystal",css:"css",csv:"csv",cue:"cue",cypher:"cypher",cyp:"cypher",d:"d",dart:"dart",dax:"dax",desktop:"desktop",diff:"diff",patch:"diff",Dockerfile:"dockerfile",dockerfile:"dockerfile",env:"dotenv",dm:"dream-maker",edge:"edge",el:"emacs-lisp",ex:"elixir",exs:"elixir",elm:"elm",erb:"erb",erl:"erlang",hrl:"erlang",f:"fortran-fixed-form",for:"fortran-fixed-form",fs:"fsharp",fsi:"fsharp",fsx:"fsharp",f03:"f03",f08:"f08",f18:"f18",f77:"f77",f90:"fortran-free-form",f95:"fortran-free-form",fnl:"fennel",fish:"fish",ftl:"ftl",tres:"gdresource",res:"gdresource",gd:"gdscript",gdshader:"gdshader",gs:"genie",feature:"gherkin",COMMIT_EDITMSG:"git-commit","git-rebase-todo":"git-rebase",gjs:"glimmer-js",gleam:"gleam",gts:"glimmer-ts",glsl:"glsl",vert:"glsl",frag:"glsl",shader:"shaderlab",gp:"gnuplot",plt:"gnuplot",gnuplot:"gnuplot",go:"go",graphql:"graphql",gql:"graphql",groovy:"groovy",gvy:"groovy",hack:"hack",haml:"haml",hbs:"handlebars",handlebars:"handlebars",hs:"haskell",lhs:"haskell",hx:"haxe",hcl:"hcl",hjson:"hjson",hlsl:"hlsl",fx:"hlsl",html:"html",htm:"html",http:"http",rest:"http",hxml:"hxml",hy:"hy",imba:"imba",ini:"ini",cfg:"ini",jade:"pug",pug:"pug",java:"java",js:"javascript",mjs:"javascript",cjs:"javascript",jinja:"jinja",jinja2:"jinja",j2:"jinja",jison:"jison",jl:"julia",json:"json",json5:"json5",jsonc:"jsonc",jsonl:"jsonl",jsonnet:"jsonnet",libsonnet:"jsonnet",jssm:"jssm",jsx:"jsx",kt:"kotlin",kts:"kts",kql:"kusto",tex:"tex",ltx:"tex",lean:"lean4",less:"less",liquid:"liquid",lit:"lit",ll:"llvm",logo:"logo",lua:"lua",luau:"luau",Makefile:"makefile",mk:"makefile",makefile:"makefile",md:"markdown",markdown:"markdown",marko:"marko",m:"wolfram",mat:"matlab",mdc:"mdc",mdx:"mdx",wiki:"wikitext",mediawiki:"wikitext",mmd:"mermaid",mermaid:"mermaid",mips:"mipsasm",mojo:"mojo","\uD83D\uDD25":"mojo",move:"move",nar:"narrat",nf:"nextflow",nim:"nim",nims:"nim",nimble:"nim",nix:"nix",nu:"nushell",mm:"objective-cpp",ml:"ocaml",mli:"ocaml",mll:"ocaml",mly:"ocaml",pas:"pascal",p:"pascal",pl:"prolog",pm:"perl",t:"perl",raku:"raku",p6:"raku",pl6:"raku",php:"php",phtml:"php",pls:"plsql",sql:"sql",po:"po",polar:"polar",pcss:"postcss",pot:"pot",potx:"potx",pq:"powerquery",pqm:"powerquery",ps1:"powershell",psm1:"powershell",psd1:"powershell",prisma:"prisma",pro:"prolog",P:"prolog",properties:"properties",proto:"protobuf",pp:"puppet",purs:"purescript",py:"python",pyw:"python",pyi:"python",qml:"qml",qmldir:"qmldir",qss:"qss",r:"r",R:"r",rkt:"racket",rktl:"racket",razor:"razor",cshtml:"razor",rb:"ruby",rbw:"ruby",reg:"reg",regex:"regexp",rel:"rel",rs:"rust",rst:"rst",rake:"ruby",gemspec:"ruby",jbuilder:"ruby",builder:"ruby",rabl:"ruby",arb:"ruby",ru:"ruby",podspec:"ruby",Gemfile:"ruby",Rakefile:"ruby",Guardfile:"ruby",Capfile:"ruby",Berksfile:"ruby",Brewfile:"ruby",Vagrantfile:"ruby",Thorfile:"ruby",Appraisals:"ruby",Dangerfile:"ruby",sas:"sas",sass:"sass",scala:"scala",sc:"scala",scm:"scheme",ss:"scheme",sld:"scheme",scss:"scss",sdbl:"sdbl",shadergraph:"shader",st:"smalltalk",sol:"solidity",sparql:"sparql",rq:"sparql",spl:"splunk",config:"ssh-config",do:"stata",ado:"stata",dta:"stata",styl:"stylus",stylus:"stylus",svelte:"svelte",swift:"swift",sv:"system-verilog",svh:"system-verilog",service:"systemd",socket:"systemd",device:"systemd",timer:"systemd",talon:"talonscript",tasl:"tasl",tcl:"tcl",templ:"templ",tf:"tf",tfvars:"tfvars",toml:"toml",ts:"typescript",mts:"typescript",cts:"typescript",tsp:"typespec",tsv:"tsv",tsx:"tsx",ttl:"turtle",twig:"twig",typ:"typst",vv:"v",vala:"vala",vapi:"vala",vb:"vb",vbs:"vb",bas:"vb",vh:"verilog",vhd:"vhdl",vhdl:"vhdl",vim:"vimscript",vue:"vue","vine.ts":"vue-vine",vy:"vyper",wasm:"wasm",wat:"wasm",wy:"文言",wgsl:"wgsl",wit:"wit",wl:"wolfram",nb:"wolfram",xml:"xml",xsl:"xsl",xslt:"xsl",yaml:"yaml",yml:"yml",zs:"zenscript",zig:"zig",zsh:"zsh",sty:"tex"};function tk(e){if(tC.has(e))return tC.get(e)??"text";if(null!=tS[e])return tS[e];let t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(null!=t){if(tC.has(t[1]))return tC.get(t[1])??"text";if(null!=tS[t[1]])return tS[t[1]]??"text"}let n=e.match(/\.([^.]+)$/)?.[1]??"";return tC.has(n)?tC.get(n)??"text":tS[n]??"text"}function tx(e){let t=e.lang??tk(e.name),n=e.lang??(null!=e.prevName?tk(e.prevName):"text");return"text"===t&&"text"===n}function tw(e){let t=e[0];return null!=t&&t.length>0?t:void 0}function tL(e){return 0===e.startingLine&&e.totalLines>0}let tA=new Map,tE=new Map,tR=new Map,t_=new Set;function tT(e){for(let t of Array.isArray(e)?e:[e])if("text"!==t&&"ansi"!==t&&!t_.has(t))return!1;return!0}function tI(e,t){for(let n of e=Array.isArray(e)?e:[e]){if(t_.has(n.name))continue;let e=tA.get(n.name);null==e&&(e=n,tA.set(n.name,e)),t_.add(e.name),t.loadLanguageSync(e.data)}}function tM(){return"u">typeof WorkerGlobalScope&&"u">typeof self&&self instanceof WorkerGlobalScope}var tP=n(8355);async function tN(e){if(tM())throw Error(`resolveLanguage("${e}") cannot be called from a worker context. Languages must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);let t=tE.get(e);if(null!=t)return t;try{let t=tR.get(e);if(null==t&&Object.prototype.hasOwnProperty.call(tP.el,e)&&(t=tP.el[e]),null==t)throw Error(`resolveLanguage: "${e}" not found in bundled or custom languages`);let n=t().then(({default:t})=>{let n={name:e,data:t};return tA.has(e)||tA.set(e,n),n});return tE.set(e,n),await n}finally{tE.delete(e)}}var tD=class extends Error{constructor(e){super(`Theme "${e}" is already registered`),this.name="DuplicateThemeError"}},tH=class extends Error{constructor(e){super(`No loader registered for theme "${e}"`),this.name="UnregisteredThemeError"}},tO=class extends Error{constructor(e){super(`Theme "${e}" has not been resolved`),this.name="UnresolvedThemeError"}};let t$=function(){let e=new Map,t=new Map,n=new Map,i=0;function r(r){let o=t.get(r);if(void 0!==o)return Promise.resolve(o);let a=n.get(r);if(void 0!==a)return a;let l=e.get(r);if(void 0===l)return Promise.reject(new tH(r));let s=i,d=l().then(e=>{let o=null!==e&&"object"==typeof e&&"default"in e?e.default:e;return s===i&&t.set(r,o),n.get(r)===d&&n.delete(r),o}).catch(e=>{throw n.get(r)===d&&n.delete(r),e});return n.set(r,d),d}function o(e,n){t.set(e,n)}return{clearResolvedThemes:function(){i++,t.clear(),n.clear()},getResolvedOrResolveTheme:function(e){let n=t.get(e);return void 0!==n?n:r(e)},getResolvedTheme:function(e){return t.get(e)},getResolvedThemes:function(e){let n=[];for(let i of e){let e=t.get(i);if(void 0===e)throw new tO(i);n.push(e)}return n},hasRegisteredTheme:function(t){return e.has(t)},hasResolvedTheme:function(e){return t.has(e)},hasResolvedThemes:function(e){for(let n of e)if(!t.has(n))return!1;return!0},registerTheme:function(t,n){if(e.has(t))throw new tD(t);e.set(t,n)},registerThemeIfAbsent:function(t,n){return!e.has(t)&&(e.set(t,n),!0)},resolveTheme:r,resolveThemes:function(e){return Promise.all(e.map(e=>r(e)))},seedResolvedTheme:o,seedResolvedThemes:function(e){for(let[t,n]of e)o(t,n)}}}(),tF=new Set;function tz(e,t){for(let n of e=Array.isArray(e)?e:[e]){let e;if("string"==typeof n){if(null==(e=t$.getResolvedTheme(n)))throw Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else e=n,n=n.name,null==t$.getResolvedTheme(n)&&t$.seedResolvedTheme(n,e);tF.has(n)||(tF.add(n),t.loadThemeSync(e))}}var tU=n(1201);async function tB(e){!function(e){if(tM())throw Error(`Theme "${e}" cannot be resolved from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);if(t$.hasRegisteredTheme(e))return;let t=tU.Fb.getTheme(e);if(null!=t)return t$.registerThemeIfAbsent(t.name,t.load);throw Error(`No valid theme loader registered for "${e}"`)}(e);let t=await t$.resolveTheme(e);if(t.name!==e)throw Error(`resolvedTheme: themeName: ${e} does not match theme.name: ${t.name}`);return t}async function tG({themes:e,langs:t,preferredHighlighter:i="shiki-js"}){let o=!function(e=r){return null!=e&&"then"in e}(r??=(0,tP.O_)({themes:[],langs:["text"],engine:"shiki-wasm"===i?(0,tP.Mk)(n.e("997").then(n.bind(n,7220))):(0,tP.lf)()}))?r:await r;r=o;let a=[];for(let e of t){if("text"===e||"ansi"===e)continue;let t=tA.get(e)??tN(e);"then"in t?a.push(t):tI(t,o)}let l=[];for(let t of e){let e=t$.getResolvedTheme(t)??tB(t);"then"in e?l.push(e):tz(e,r)}return(a.length>0||l.length>0)&&await Promise.all([Promise.all(a).then(e=>{tI(e,o)}),Promise.all(l).then(e=>{tz(e,o)})]),o}for(let e of tU.gW.getThemes())t$.registerThemeIfAbsent(e.name,e.load);function tj(e=b){let t=[];return"string"==typeof e?t.push(e):(t.push(e.dark),t.push(e.light)),t}function tW(e){for(let t of tj(e))if(!tF.has(t))return!1;return!0}function tV(e,t){return e===t||e?.cacheKey!=null&&e.cacheKey===t?.cacheKey}function tq(e,t){return ee(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function tK(e){return ej({tagName:"div",properties:{"data-content-buffer":"","data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function tX(e){return ej({tagName:"div",children:[ej({tagName:"span",children:[eG("No newline at end of file")]})],properties:{"data-no-newline":"","data-line-type":e,"data-column-content":""}})}function tY(e){return ej({tagName:"div",children:[eW({name:"both"===e?"diffs-icon-expand-all":"diffs-icon-expand",properties:{"data-icon":""}})],properties:{role:"button","data-expand-button":"","data-expand-both":"both"===e?"":void 0,"data-expand-up":"up"===e?"":void 0,"data-expand-down":"down"===e?"":void 0}})}function tZ({type:e,content:t,expandIndex:n,chunked:i=!1,slotName:r,isFirstHunk:o,isLastHunk:a}){let l=0,s=[];if("metadata"===e&&null!=t&&s.push(ej({tagName:"div",children:[eG(t)],properties:{"data-separator-wrapper":""}})),("line-info"===e||"line-info-basic"===e)&&null!=t){let e=[];null!=n&&(i?(!o&&(e.push(tY("up")),l++),!a&&(e.push(tY("down")),l++)):(e.push(tY(o||a?o?"down":"up":"both")),l++)),e.push(ej({tagName:"div",children:[ej({tagName:"span",children:[eG(t)],properties:{"data-unmodified-lines":""}})],properties:{"data-separator-content":""}})),i&&null!=n&&e.push(ej({tagName:"div",children:[eG("Expand all")],properties:{role:"button","data-expand-button":"","data-expand-all-button":""}})),s.push(ej({tagName:"div",children:e,properties:{"data-separator-wrapper":"","data-separator-multi-button":l>1?"":void 0}}))}return"custom"===e&&null!=r&&s.push(ej({tagName:"slot",properties:{name:r}})),ej({tagName:"div",children:s,properties:{"data-separator":0===s.length?"simple":e,"data-expand-index":n,"data-separator-first":o?"":void 0,"data-separator-last":a?"":void 0}})}let tQ=Symbol("no-token"),tJ=Symbol("multiple-tokens");function t0(e){if("element"===e.type)for(let t of(e.properties["data-char"]=void 0,e.children))t0(t)}Symbol("highlighted-lines");let t1=function(e={}){let{classPrefix:t="__shiki_",classSuffix:n="",classReplacer:i=e=>e}=e,r=new Map;function o(e){return Object.entries(e).map(([e,t])=>`${e}:${t}`).join(";")}function a(e){let a=t+function(e,t=0){let n=0xdeadbeef^t,i=0x41c6ce57^t;for(let t=0,r;t<e.length;t++)n=Math.imul(n^(r=e.charCodeAt(t)),0x9e3779b1),i=Math.imul(i^r,0x5f356495);return n=Math.imul(n^n>>>16,0x85ebca6b)^Math.imul(i^i>>>13,0xc2b2ae35),(0x100000000*(2097151&(i=Math.imul(i^i>>>16,0x85ebca6b)^Math.imul(n^n>>>13,0xc2b2ae35)))+(n>>>0)).toString(36).slice(0,6)}("string"==typeof e?e:o(e))+n;return a=i(a),r.has(a)||r.set(a,"string"==typeof e?e:{...e}),a}return{name:"@shikijs/transformers:style-to-class",pre(e){if(!e.properties.style)return;let t=a(e.properties.style);delete e.properties.style,this.addClassToHast(e,t)},tokens(e){for(let t of e)for(let e of t){if(!e.htmlStyle)continue;let t=a(e.htmlStyle);e.htmlStyle={},e.htmlAttrs||={},e.htmlAttrs.class?e.htmlAttrs.class+=` ${t}`:e.htmlAttrs.class=t}},getClassRegistry:()=>r,getCSS(){let e="";for(let[t,n]of r.entries())e+=`.${t}{${"string"==typeof n?n:o(n)}}`;return e},clearRegistry(){r.clear()}}}({classPrefix:"hl-"}),t8={name:"token-style-normalizer",tokens(e){for(let t of e)for(let e of t){if(null!=e.htmlStyle)continue;let t={};null!=e.color&&(t.color=e.color),null!=e.bgColor&&(t["background-color"]=e.bgColor),null!=e.fontStyle&&0!==e.fontStyle&&((1&e.fontStyle)!=0&&(t["font-style"]="italic"),(2&e.fontStyle)!=0&&(t["font-weight"]="bold"),(4&e.fontStyle)!=0&&(t["text-decoration"]="underline")),Object.keys(t).length>0&&(e.htmlStyle=t)}}};function t2(e){return`--${"token"===e?"diffs-token":"diffs"}-`}let t5=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,t6=/^0(?:\.0+)?%?$/;function t7(e){if(null==e)return null;let t=function(e){let t,n=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})\b/i.exec(e.trim());if(null==n)return null;let i=n[1],r=1;return 3===i.length?t=i.split("").map(e=>e+e).join(""):6===i.length?t=i:(t=i.slice(0,6),r=parseInt(i.slice(6,8),16)/255),[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16),r]}(e);if(null==t)return null;let n=t[0]/255,i=t[1]/255,r=t[2]/255,o=e=>e<=.03928?e/12.92:((e+.055)/1.055)**2.4;return .2126*o(n)+.7152*o(i)+.0722*o(r)}function t3(e){if(null==e)return!1;let t=e.trim().toLowerCase();if("transparent"===t||t5.test(t))return!0;let n=function(e){let t=e.indexOf("(");if(t<=0||!e.endsWith(")"))return;let n=e.slice(0,t).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(n))return;let i=e.slice(t+1,-1).trim();if(0===i.length)return;let r=i.lastIndexOf("/");if(-1!==r)return i.slice(r+1).trim();if(/^(?:rgba|hsla)$/i.test(n)){let e=i.split(",");if(4===e.length)return e[3]?.trim()}}(t);return null!=n&&t6.test(n)}let t4=new WeakMap;function t9(e){var t,n;let i=t4.get(e);if(null!=i)return i;let r=e.colors??{},o={...r},a=r["editor.background"]??e.bg,l=r["editor.foreground"]??e.fg,s=r["sideBar.background"]??a,d=r["sideBar.foreground"]??l;ne(o,"editor.background",a),ne(o,"editor.foreground",l),ne(o,"sideBar.background",s),ne(o,"sideBar.foreground",d),ne(o,"input.background",r["input.background"]??s),ne(o,"sideBarSectionHeader.foreground",r["sideBarSectionHeader.foreground"]??d),ne(o,"list.activeSelectionForeground",r["list.activeSelectionForeground"]??d),ne(o,"gitDecoration.addedResourceForeground",nt(r["gitDecoration.addedResourceForeground"],r["terminal.ansiGreen"],r["editorGutter.addedBackground"])),ne(o,"gitDecoration.modifiedResourceForeground",nt(r["gitDecoration.modifiedResourceForeground"],r["terminal.ansiBlue"],r["editorGutter.modifiedBackground"])),ne(o,"gitDecoration.deletedResourceForeground",nt(r["gitDecoration.deletedResourceForeground"],r["terminal.ansiRed"],r["editorGutter.deletedBackground"]));let u=(t3(r["list.focusOutline"])?void 0:r["list.focusOutline"])??(t3(r.focusBorder)?void 0:r.focusBorder);null!=u?o["list.focusOutline"]=u:delete o["list.focusOutline"];let h=r["list.hoverBackground"];null!=h&&(t=h,null!=(n=s)&&t.toLowerCase()===n.toLowerCase()||function(e,t,n){if(null==t||null==n)return!1;let i=t7(e),r=t7(t),o=t7(n);return null!=i&&null!=r&&null!=o&&Math.abs(i-o)<Math.abs(i-r)}(h,s,d))&&delete o["list.hoverBackground"];let c=Object.freeze({...e,colors:Object.freeze(o)});return t4.set(e,c),c}function ne(e,t,n){null!=n&&""!==n&&(e[t]=n)}function nt(...e){for(let t of e)if(null!=t&&""!==t)return t}function nn(e,t){t=null!=t?`${t}-`:"";let n="",i=e.colors?.["gitDecoration.addedResourceForeground"]??e.colors?.["terminal.ansiGreen"];null!=i&&(n+=`${t2("global")}${t}addition-color:${i};`);let r=e.colors?.["gitDecoration.deletedResourceForeground"]??e.colors?.["terminal.ansiRed"];null!=r&&(n+=`${t2("global")}${t}deletion-color:${r};`);let o=e.colors?.["gitDecoration.modifiedResourceForeground"]??e.colors?.["terminal.ansiBlue"];return null!=o&&(n+=`${t2("global")}${t}modified-color:${o};`),n}function ni(e){let t=e.children[0];for(;null!=t;){if("element"===t.type&&"code"===t.tagName)return t.children;t="children"in t?t.children[0]:null}throw console.error(e),Error("getLineNodes: Unable to find children")}function nr({line:e,spanStart:t,spanLength:n}){return{start:{line:e,character:t},end:{line:e,character:t+n},properties:{"data-diff-span":""},alwaysWrap:!0}}function no({item:e,arr:t,enableJoin:n,isNeutral:i=!1,isLastItem:r=!1}){let o=t[t.length-1];if(null==o||r||!n)return void t.push([+!i,e.value]);let a=0===o[0];if(i===a||i&&1===e.value.length&&!a){o[1]+=e.value;return}t.push([+!i,e.value])}let na=new class extends F{};function nl(e,t){let n;for(n=0;n<e.length&&n<t.length&&e[n]==t[n];n++);return e.slice(0,n)}function ns(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return"";for(n=0;n<e.length&&n<t.length&&e[e.length-(n+1)]==t[t.length-(n+1)];n++);return e.slice(-n)}function nd(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function nu(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function nh(e,t){return nd(e,t,"")}function nc(e,t){return t.slice(0,function(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let i=t.length;e.length<t.length&&(i=e.length);let r=Array(i),o=0;r[0]=0;for(let e=1;e<i;e++){for(t[e]==t[o]?r[e]=r[o]:r[e]=o;o>0&&t[e]!=t[o];)o=r[o];t[e]==t[o]&&o++}o=0;for(let i=n;i<e.length;i++){for(;o>0&&e[i]!=t[o];)o=r[o];e[i]==t[o]&&o++}return o}(e,t))}function nf(e,t){let n=[];for(let i of Array.from(t.segment(e))){let e=i.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function np(e,t){let n;if(t)return nm(e,t)[1];for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function ng(e,t){if(t)return nm(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:""}function nm(e,t){if(!t)return[ng(e),np(e)];if("word"!=t.resolvedOptions().granularity)throw Error('The segmenter passed must have a granularity of "word"');let n=nf(e,t),i=n[0],r=n[n.length-1];return[/\s/.test(i)?i:"",/\s/.test(r)?r:""]}let nb="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",nv=RegExp(`[${nb}]+|\\s+|[^${nb}]`,"ug");function ny(e,t,n,i,r){var o,a,l,s;if(t&&n){let[l,s]=nm(t.value,r),[d,u]=nm(n.value,r);if(e){let i=nl(l,d);e.value=nu(e.value,d,i),t.value=nh(t.value,i),n.value=nh(n.value,i)}if(i){let e=ns(s,u);i.value=nd(i.value,u,e),o=t.value,t.value=nu(o,e,""),a=n.value,n.value=nu(a,e,"")}}else if(n){if(e){let e=ng(n.value,r);n.value=n.value.substring(e.length)}if(i){let e=ng(i.value,r);i.value=i.value.substring(e.length)}}else if(e&&i){let n=ng(i.value,r),[o,a]=nm(t.value,r),s=nl(n,o);t.value=nh(t.value,s);let d=ns(nh(n,s),a);l=t.value,t.value=nu(l,d,""),i.value=nd(i.value,n,d),e.value=nu(e.value,n,n.slice(0,n.length-d.length))}else if(i){let e=ng(i.value,r),n=nc(np(t.value,r),e);s=t.value,t.value=nu(s,n,"")}else if(e){let n=nc(np(e.value,r),ng(t.value,r));t.value=nh(t.value,n)}}new class extends F{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let i=t.intlSegmenter;if("word"!=i.resolvedOptions().granularity)throw Error('The segmenter passed must have a granularity of "word"');n=nf(e,i)}else n=e.match(nv)||[];let i=[],r=null;return n.forEach(e=>{/\s/.test(e)?null==r?i.push(e):i.push(i.pop()+e):null!=r&&/\s/.test(r)?i[i.length-1]==r?i.push(i.pop()+e):i.push(r+e):i.push(e),r=e}),i}join(e){return e.map((e,t)=>0==t?e:e.replace(/^\s+/,"")).join("")}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,i=null,r=null;return e.forEach(e=>{e.added?i=e:e.removed?r=e:((i||r)&&ny(n,r,i,e,t.intlSegmenter),n=e,i=null,r=null)}),(i||r)&&ny(n,r,i,null,t.intlSegmenter),e}};let nC=new class extends F{tokenize(e){let t=RegExp(`(\\r?\\n)|[${nb}]+|[^\\S\\n\\r]+|[^${nb}]`,"ug");return e.match(t)||[]}},nS={forcePlainText:!1},nk=-1;var nx=class{options;onRenderUpdate;workerManager;__id=`diff-hunks-renderer:${++nk}`;highlighter;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLang="text";renderCache;editSessionActive=!1;constructor(e={theme:b},t,n){this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=tW(e.theme??b)?function(){if(null!=r&&!("then"in r))return r}():void 0)}cleanUp(){this.recycle(),this.expandedHunks.clear(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.highlighter=void 0,this.diff=void 0,this.clearRenderCache(),this.additionAnnotations={},this.deletionAnnotations={},this.workerManager?.cleanUpTasks(this),this.endEditSession()}beginEditSession(){this.editSessionActive=!0;let e=this.diffCache;null==e||e.isPartial||0!==e.additionLines.length||(Object.assign(e,ex(e,this.options.parseDiffOptions)),this.markEditSessionPass(e),this.clearRenderCache())}endEditSession(){this.editSessionActive=!1}editorRenderReady(){return this.renderCache?.options.useTokenTransformer===!0&&this.renderCache.highlighted&&null!=this.renderCache.result}refreshHighlightedResult(){let{renderCache:e}=this;if(null==e||tx(e.diff)||nP(e.diff,this.getTokenizeMaxLength()))return Promise.resolve();let{diff:t}=e,{workerManager:n}=this;return this.editSessionActive||n?.isWorkingPool()!==!0||null==t.cacheKey?this.asyncHighlight(t).then(e=>this.applyRefreshedResult(t,e)).catch(e=>this.onHighlightError(e)):(n.evictDiffFromCache(t.cacheKey),n.primeDiffHighlightCache(t).then(()=>{this.applyRefreshedResult(t,n.getDiffResultCache(t))}).catch(e=>this.onHighlightError(e)))}applyRefreshedResult(e,t){if(null==t||null==this.renderCache||this.renderCache.diff!==e||this.editSessionActive)return;let{options:n}=this.getRenderOptions(e);tq(n,t.options)&&(this.renderCache={diff:e,options:t.options,highlighted:!0,result:t.result,renderRange:void 0},this.onRenderUpdate?.())}get diffCache(){return this.renderCache?.diff??this.diff}clearRenderCache(){let e=this.renderCache;this.renderCache=void 0,null!=e&&!0===e.isDirty&&null!=e.diff.cacheKey&&this.workerManager?.evictDiffFromCache(e.diff.cacheKey)}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}expandHunk(e,t,n=this.getOptionsWithDefaults().expansionLineCount){let i={...this.expandedHunks.get(e)??{fromStart:0,fromEnd:0}};("up"===t||"both"===t)&&(i.fromStart+=n),("down"===t||"both"===t)&&(i.fromEnd+=n),this.renderCache?.highlighted!==!0&&this.clearRenderCache(),this.expandedHunks.set(e,i)}getExpandedHunk(e){return this.expandedHunks.get(e)??C}getExpandedHunksMap(){return this.expandedHunks}setExpandedHunksMap(e){this.expandedHunks=e}setLineAnnotations(e){for(let t of(this.additionAnnotations={},this.deletionAnnotations={},e)){let e=(()=>{switch(t.side){case"deletions":return this.deletionAnnotations;case"additions":return this.additionAnnotations}})(),n=e[t.lineNumber]??[];e[t.lineNumber]=n,n.push(t)}}updateRenderCache(e,t,n=!1){if(null==this.renderCache)return!1;let{result:i,diff:r}=this.renderCache;if(null==i)return!1;if(r.isPartial)throw Error("Could not update render cache for partial diff");let o=i.code.additionLines,a=[],l=new Map;for(let[t,n]of e){let e=o[t]?.properties??{},i=n.map(e=>e[2]).join(""),s=t<r.additionLines.length,d=s?r.additionLines[t]??"":"",u=w(d);s&&(r.additionLines[t]=d.endsWith("\r\n")?i+"\r\n":d.endsWith("\r")?i+"\r":d.endsWith("\n")?i+"\n":i,u!==i&&(a.push(t),l.set(t,d)));o[t]={type:"element",tagName:"div",properties:{"data-line":e["data-line"]??t+1,"data-line-index":e["data-line-index"]??t,"data-line-type":e["data-line-type"]??"context"},children:n.map(([e,t,n])=>0===e&&""===t?""===n?{type:"element",tagName:"br",properties:{},children:[]}:{type:"text",value:n}:{type:"element",tagName:"span",properties:{"data-char":e,style:`color:${t};`},children:[{type:"text",value:n}]})}}let s=!1;if(a.length>0)if(this.editSessionActive&&!r.isPartial){if(!n)if(r.additionLines.length<=1&&""===r.additionLines.join(""))Object.assign(r,ex(r,this.options.parseDiffOptions)),this.markEditSessionPass(r),s=!0;else if(eS(r,r.additionLines))Object.assign(r,ek(r,r.additionLines,this.options.parseDiffOptions)),this.markEditSessionPass(r),s=!0;else{let e=function(e,t,n,i){let r,o=Array.from(new Set(t)).filter(t=>t>=0&&t<e.additionLines.length).sort((e,t)=>e-t);if(0===o.length)return;let{hunks:a}=e,l=0;for(let t of o){for(;l<a.length;){let e=a[l];if(t<eO(e)+e.additionCount)break;l++}let i=a[l],o=null==i?void 0:eO(i);if(null==o||t<o||null!=r&&r!==l)return eM(e,n);r=l}if(null!=r){if(function(e,t,n,i,r){if(null==i||r?.ignoreWhitespace===!0||r?.stripTrailingCr===!0)return!1;let o=function(e){let t=eI.get(e);if(t?.lines===e.deletionLines)return t.set;let n=new Set(e.deletionLines);return eI.set(e,{lines:e.deletionLines,set:n}),n}(e),a=e.hunks[n];if(a.hunkContent.some(eP))return!1;for(let n of t){let t=i.get(n),r=e.additionLines[n];if(null==t||null==r||o.has(t)||o.has(r))return!1;let l=!1;for(let e of a.hunkContent)if("change"===e.type&&e.additions===e.deletions&&n>=e.additionLineIndex&&n<e.additionLineIndex+e.additions){l=!0;break}if(!l)return!1}return!0}(e,o,r,i,n)){e.editSessionDirty=!0;return}return eM(e,n)}}(r,a,this.options.parseDiffOptions,l);this.applyExpansionRemap(e),s=null!=e}}else Object.assign(r,function(e,t,n){if(e.isPartial||e.deletionLines.length!==e.additionLines.length)return eA(e,eC(e,n));let i=Array.from(t);if(0===i.length)return eA(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type});for(let t of i){let i=e.additionLines[t],r=e.deletionLines[t];if(null==i||null==r||w(i)===w(r))return eA(e,eC(e,n))}let r=function(e,t){let n=new Set;for(let i of t){let t=function(e,t){for(let[n,i]of e.hunks.entries()){let e=i.additionLineIndex+i.additionCount;if(t>=i.additionLineIndex&&t<e)return n}}(e,i);if(null==t)return new Set;n.add(t)}return n}(e,i);if(0===r.size)return eA(e,eC(e,n));for(let t of r)if(!function(e,t,n){let i=e.hunks[t];if(null==i)return!1;let r=e.deletionLines.slice(i.deletionLineIndex,i.deletionLineIndex+i.deletionCount),o=e.additionLines.slice(i.additionLineIndex,i.additionLineIndex+i.additionCount),a=V({name:e.prevName??e.name,contents:r.join("")},{name:e.name,contents:o.join(""),lang:e.lang},{...n,context:0}),l=a.hunks[0];return null!=l&&1===a.hunks.length&&(function(e,t){let n=e.additionLineIndex,i=e.deletionLineIndex;e.hunkContent=t.hunkContent.map(e=>eR(e,n,i)),e.additionLineIndex=n+t.additionLineIndex,e.additionStart=e.additionStart+t.additionLineIndex,e.additionCount=t.additionCount,e.additionLines=t.additionLines,t.deletionLineIndex>=0&&(e.deletionLineIndex=i+t.deletionLineIndex,e.deletionStart=e.deletionStart+t.deletionLineIndex),e.deletionCount=t.deletionCount,e.deletionLines=t.deletionLines,e.noEOFCRAdditions=t.noEOFCRAdditions,e.noEOFCRDeletions=t.noEOFCRDeletions,e_(e)}(i,l),eE(e,t),!0)}(e,t,n))return eA(e,eC(e,n));return(eT(e),function(e){let t=e.hunks[e.hunks.length-1];if(null==t||e.isPartial||0===e.additionLines.length||0===e.deletionLines.length)return!1;let n=e.additionLines.length-x(t.additionStart,t.additionCount),i=e.deletionLines.length-x(t.deletionStart,t.deletionCount);return(!(n<=0)||!(i<=0))&&n!==i}(e))?eA(e,eC(e,n)):eA(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type})}(r,a,this.options.parseDiffOptions));return i.baseThemeType=t,this.renderCache.isDirty=!0,s}applyExpansionRemap(e){null!=e&&(this.expandedHunks=function(e,t){let n=new Map,{regions:i}=t;for(let t=0;t<=i.length;t++){let r=i[t-1],o=i[t],a=0===t?e.get(0):null==r?void 0:e.get(r.lastIndex+1),l=null==o?void 0:e.get(o.firstIndex),s=a?.fromStart??0,d=l?.fromEnd??0;(s>0||d>0)&&n.set(t,{fromStart:s,fromEnd:d})}return n}(this.expandedHunks,e))}applyDocumentChange(e){if(null==this.renderCache)return;let{diff:t,result:n}=this.renderCache;if(null==n)return;if(t.isPartial)throw Error("Could not apply document change for partial diff");let{additionLines:i}=t;t.additionLines=function(e,t){let n=[],i=function(e){for(let t of e){if(t.endsWith("\r\n"))return"\r\n";if(t.endsWith("\n"))break;if(t.endsWith("\r"))return"\r"}return"\n"}(t);for(let t=0;t<e.lineCount;t++){var r;let o=e.getLineText(t,!0);n.push(t<e.lineCount-1&&!((r=o).endsWith("\n")||r.endsWith("\r"))?o+i:o)}return n}(e,i),n.code.additionLines=function(e,t,n,i){let r=nI(e),o=nI(t),a=Math.min(r,o),l=0;for(;l<a&&e[l]===t[l];)l++;let s=0;for(;s<a-l&&e[r-1-s]===t[o-1-s];)s++;let d=Array(t.length);for(let e=0;e<l;e++)d[e]=n[e];for(let e=0;e<s;e++)d[o-1-e]=n[r-1-e];r<e.length&&o<t.length&&(d[t.length-1]=n[e.length-1]);for(let i=e.length;i<t.length;i++)d[i]??=n[i];for(let e=l;e<t.length;e++)d[e]??=nM(e,i.getLineText(e));return d}(i,t.additionLines,n.code.additionLines,e),t.additionLines.length<=1&&""===t.additionLines.join("")?(Object.assign(t,ex(t,this.options.parseDiffOptions)),n.code.additionLines[0]=nM(0,e.getLineText(0)),this.markEditSessionPass(t)):this.editSessionActive?this.applySessionDocumentChange(t):Object.assign(t,ew(t,this.options.parseDiffOptions)),this.renderCache.isDirty=!0}applySessionDocumentChange(e){let{parseDiffOptions:t}=this.options,n=e.additionLines;if(eS(e,n)){Object.assign(e,ek(e,n,t)),this.markEditSessionPass(e);return}this.applyExpansionRemap(eM(e,t))}markEditSessionPass(e){this.editSessionActive&&(e.editSessionDirty=!0)}getUnifiedLineDecoration({lineType:e}){return{gutterLineType:e,contentProperties:{"data-line-type":e}}}getSplitLineDecoration({side:e,type:t}){let n="change"===t?"deletions"===e?"change-deletion":"change-addition":t;return{gutterLineType:n,contentProperties:{"data-line-type":n}}}createAnnotationElement=e=>ej({tagName:"div",children:[ej({tagName:"div",children:e.annotations?.map(e=>ej({tagName:"slot",properties:{name:e}})),properties:{"data-annotation-content":""}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}});getOptionsWithDefaults(){let{diffIndicators:e="bars",diffStyle:t="split",disableBackground:n=!1,disableFileHeader:i=!1,disableLineNumbers:r=!1,disableVirtualizationBuffers:o=!1,collapsed:a=!1,expandUnchanged:l=!1,collapsedContextThreshold:s=1,expansionLineCount:d=100,hunkSeparators:u="line-info",lineDiffType:h="word-alt",maxLineDiffLength:c=1e3,overflow:f="scroll",stickyHeader:p=!1,theme:g=b,headerRenderMode:m="default",tokenizeMaxLineLength:v=1e3,tokenizeMaxLength:y=1e5,useTokenTransformer:C=!1,useCSSClasses:S=!1}=this.options;return{diffIndicators:e,diffStyle:t,disableBackground:n,disableFileHeader:i,disableLineNumbers:r,disableVirtualizationBuffers:o,collapsed:a,expandUnchanged:l,collapsedContextThreshold:s,expansionLineCount:d,hunkSeparators:u,lineDiffType:h,maxLineDiffLength:c,overflow:f,stickyHeader:p,theme:this.workerManager?.getDiffRenderOptions().theme??g,headerRenderMode:m,tokenizeMaxLineLength:v,tokenizeMaxLength:y,useTokenTransformer:C,useCSSClasses:S}}async initializeHighlighter(){return this.highlighter=await tG(function(e,{theme:t,preferredHighlighter:n="shiki-js"}){return{langs:[e??"text"],themes:tj(t),preferredHighlighter:n}}(this.computedLang,{theme:this.getLocalHighlightTheme(),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter})),this.highlighter}hydrate(e){if(null==e)return;this.diff=e;let{options:t}=this.getRenderOptions(e),n=nP(e,this.getTokenizeMaxLength()),i=this.workerManager?.getDiffResultCache(e);null==i||tq(t,i.options)||(i=void 0),this.renderCache??={diff:e,highlighted:!n&&!tx(e),options:t,result:n?void 0:i?.result,renderRange:void 0},this.editSessionActive||this.workerManager?.isWorkingPool()!==!0?null==this.highlighter&&(this.computedLang=e.lang??tk(e.name),this.initializeHighlighter()):null!=this.renderCache.result||n||this.workerManager.highlightDiffAST(this,this.diff)}getLocalHighlightTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??b}getEffectiveCodeOptions(){let e=this.workerManager?.isWorkingPool()===!0?this.workerManager.getDiffRenderOptions():void 0;return{theme:this.getLocalHighlightTheme(),tokenizeMaxLineLength:e?.tokenizeMaxLineLength??this.options.tokenizeMaxLineLength}}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0){let e=this.workerManager.getDiffRenderOptions();return this.editSessionActive&&!0!==e.useTokenTransformer?{...e,useTokenTransformer:!0}:e}let{theme:e,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:i}=this.getOptionsWithDefaults();return{theme:e,useTokenTransformer:this.editSessionActive||!0===this.options.useTokenTransformer,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:i}})();this.getOptionsWithDefaults();let{renderCache:n}=this;return n?.result!=null&&tV(e,n.diff)&&tq(t,n.options)?{options:t,forceHighlight:!1}:{options:t,forceHighlight:!0}}renderDiff(e=this.renderCache?.diff,t=S){if(null==e)return;let{expandUnchanged:n,collapsedContextThreshold:i}=this.getOptionsWithDefaults(),{options:r,forceHighlight:o}=this.getRenderOptions(e),a=this.getMatchingWorkerResultCache(e,r);null==a||this.hasHighlightedRenderCache(e,r)||(this.renderCache={diff:e,highlighted:!0,renderRange:void 0,...a},o=!1),this.renderCache??={diff:e,highlighted:!1,options:r,result:void 0,renderRange:void 0};let l=e.additionLines.length>0||e.deletionLines.length>0,s=!l||tx(e)||nP(e,this.getTokenizeMaxLength()),d=!tV(e,this.renderCache.diff),u=!tt(this.renderCache.renderRange,t);if(this.editSessionActive||this.workerManager?.isWorkingPool()!==!0){this.computedLang=e.lang??tk(e.name);let t=null!=this.highlighter&&tW(r.theme),n=null!=this.highlighter&&tT(this.computedLang),i=!s&&n;if(null!=this.highlighter&&t&&(o||s||!this.renderCache.highlighted&&i||null==this.renderCache.result)){let{result:t,options:r}=this.renderDiffWithHighlighter(e,this.highlighter,s||!n);this.renderCache={diff:e,options:r,highlighted:i,result:t,renderRange:void 0}}t&&(s||n)||this.asyncHighlight(e).then(({result:t,options:n})=>{null!=this.renderCache&&(this.renderCache.highlighted=!1),this.applyHighlightResult(e,t,n,!s)})}else{let a=null==this.renderCache.result&&this.renderCache.highlighted&&!s&&!d&&ty(t);a&&(this.renderCache.highlightPending=!0),!a&&(s||null==this.renderCache.result||!this.renderCache.highlighted&&(d||u))&&(this.renderCache.diff=e,this.renderCache.options=r,this.renderCache.highlighted=!1,(null==this.renderCache.result||d||u||o)&&(this.renderCache.result=this.workerManager.getPlainDiffAST(e,t.startingLine,t.totalLines,!!ty(t)||!!n||this.expandedHunks,i)),this.renderCache.renderRange=t),!s&&l&&(!this.renderCache.highlighted||o)&&this.workerManager.highlightDiffAST(this,e)}return null!=this.renderCache.result?this.processDiffResult(this.renderCache.diff,t,this.renderCache.result):void 0}async asyncRender(e,t=S){let{result:n}=await this.asyncHighlight(e);return this.processDiffResult(e,t,n)}createPreElement(e,t,n){let{diffIndicators:i,disableBackground:r,disableLineNumbers:o,overflow:a}=this.getOptionsWithDefaults();return ej({tagName:"pre",properties:function({diffIndicators:e,disableBackground:t,disableLineNumbers:n,overflow:i,split:r,totalLines:o,type:a,customProperties:l}){return{...l,"data-diff":"diff"===a?"":void 0,"data-file":"file"===a?"":void 0,"data-diff-type":"diff"===a?r?"split":"single":void 0,"data-overflow":i,"data-disable-line-numbers":n?"":void 0,"data-background":t?void 0:"","data-indicators":"bars"===e||"classic"===e?e:void 0,style:`--diffs-min-number-column-width-default:${`${o}`.length}ch;`}}({type:"diff",diffIndicators:i,disableBackground:r,disableLineNumbers:o,overflow:a,split:e,totalLines:t,customProperties:n})})}async asyncHighlight(e){let t=nP(e,this.getTokenizeMaxLength());this.computedLang=t?"text":e.lang??tk(e.name);let n=null!=this.highlighter&&tW(this.getLocalHighlightTheme()),i=t||null!=this.highlighter&&tT(this.computedLang);return null!=this.highlighter&&n&&i||(this.highlighter=await this.initializeHighlighter()),this.renderDiffWithHighlighter(e,this.highlighter,t)}renderDiffWithHighlighter(e,t,n=!1){let{options:i}=this.getRenderOptions(e),{collapsedContextThreshold:r}=this.getOptionsWithDefaults(),o=function(e,t,n,{forcePlainText:i,startingLine:r,totalLines:o,expandedHunks:a,collapsedContextThreshold:l=1}=nS){i?(r??=0,o??=1/0):(r=0,o=1/0);let s=r>0||o<1/0,d="string"==typeof n.theme?t.getTheme(n.theme).type:void 0,u=function({theme:e=b,highlighter:t,prefix:n}){let i="";if("string"==typeof e){let r=t.getTheme(e),o=t9(r);i+=`color:${o.fg};`,i+=`background-color:${o.bg};`,i+=`${t2("global")}fg:${o.fg};`,i+=`${t2("global")}bg:${o.bg};`,i+=nn(r,n)}else{let n=t.getTheme(e.dark),r=t9(n);i+=`${t2("global")}dark:${r.fg};`,i+=`${t2("global")}dark-bg:${r.bg};`,i+=nn(n,"dark"),r=t9(n=t.getTheme(e.light)),i+=`${t2("global")}light:${r.fg};`,i+=`${t2("global")}light-bg:${r.bg};`,i+=nn(n,"light")}return i}({theme:n.theme,highlighter:t}),h=i&&!s&&(e.unifiedLineCount>1e3||e.splitLineCount>1e3)?"none":n.lineDiffType,c={deletionLines:[],additionLines:[]},{maxLineDiffLength:f}=n,p=!i&&!e.isPartial,g=new Map;function m(e,t,n,i){if(s){let e=n.at(-1);(null==e||e.targetIndex+e.count!==t)&&(e={targetIndex:t,originalOffset:i.length,count:0},n.push(e)),e.count++}i.push(e)}for(let d of(tm({diff:e,diffStyle:"both",startingLine:r,totalLines:o,expandedHunks:!s||(i?a:void 0),collapsedContextThreshold:l,callback:({hunkIndex:t,additionLine:n,deletionLine:i,type:r})=>{let o,a,l=(o=p?0:t,a=g.get(o)??{deletionContent:{push(e){this.value+=e,this.length++},value:"",length:0},additionContent:{push(e){this.value+=e,this.length++},value:"",length:0},deletionInfo:[],additionInfo:[],deletionDecorations:[],additionDecorations:[],deletionSegments:[],additionSegments:[]},g.set(o,a),a),s=null!=n?n.splitLineIndex:i.splitLineIndex;"change"===r&&null!=n&&null!=i&&function({deletionLine:e,additionLine:t,deletionLineIndex:n,additionLineIndex:i,deletionDecorations:r,additionDecorations:o,lineDiffType:a,maxLineDiffLength:l}){var s,d,u,h;if(null==e||null==t||"none"===a||(e=w(e),t=w(t),e.length>l||t.length>l))return;let c="char"===a?(s=e,d=t,na.diff(s,d,void 0)):(u=e,h=t,nC.diff(u,h,void 0)),f=[],p=[],g="word-alt"===a,m=c.at(-1);for(let e of c){let t=e===m;e.added||e.removed?e.removed?no({item:e,arr:f,enableJoin:g,isLastItem:t}):no({item:e,arr:p,enableJoin:g,isLastItem:t}):(no({item:e,arr:f,enableJoin:g,isNeutral:!0,isLastItem:t}),no({item:e,arr:p,enableJoin:g,isNeutral:!0,isLastItem:t}))}let b=0;for(let e of f)1===e[0]&&r.push(nr({line:n,spanStart:b,spanLength:e[1].length})),b+=e[1].length;for(let e of(b=0,p))1===e[0]&&o.push(nr({line:i,spanStart:b,spanLength:e[1].length})),b+=e[1].length}({additionLine:e.additionLines[n.lineIndex],deletionLine:e.deletionLines[i.lineIndex],deletionLineIndex:l.deletionContent.length,additionLineIndex:l.additionContent.length,deletionDecorations:l.deletionDecorations,additionDecorations:l.additionDecorations,lineDiffType:h,maxLineDiffLength:f}),null!=i&&(m(e.deletionLines[i.lineIndex],i.lineIndex,l.deletionSegments,l.deletionContent),l.deletionInfo.push({type:"change"===r?"change-deletion":r,lineNumber:i.lineNumber,altLineNumber:"change"===r?void 0:n.lineNumber??void 0,lineIndex:`${i.unifiedLineIndex},${s}`})),null!=n&&(m(e.additionLines[n.lineIndex],n.lineIndex,l.additionSegments,l.additionContent),l.additionInfo.push({type:"change"===r?"change-addition":r,lineNumber:n.lineNumber,altLineNumber:"change"===r?void 0:i.lineNumber??void 0,lineIndex:`${n.unifiedLineIndex},${s}`}))}}),g.values())){if(0===d.deletionContent.length&&0===d.additionContent.length)continue;let r={name:e.prevName??e.name,contents:d.deletionContent.value},o={name:e.name,contents:d.additionContent.value},{deletionLines:a,additionLines:l}=function({deletionFile:e,additionFile:t,deletionInfo:n,additionInfo:i,highlighter:r,deletionDecorations:o,additionDecorations:a,languageOverride:l,options:{theme:s=b,...d}}){let u=l??tk(e.name),h=l??tk(t.name),{state:c,transformers:f}=function(e=!1,t=!1){let n={lineInfo:[]},i=[{line:e=>(delete e.properties.class,e),pre(t){let i=function(e){let t=e.children[0];for(;null!=t;){if("element"===t.type&&"code"===t.tagName)return t;t="children"in t?t.children[0]:null}}(t),r=[];if(null!=i){let t=1;for(let o of i.children)"element"===o.type&&(e&&function e(t){let n,i=function(e){let t=e.properties["data-char"];if("number"==typeof t)return t}(t);if(null!=i)return i;let r=tQ,o=[],a=[],l=()=>{if(0===a.length||null==n){a=[],n=void 0;return}if(1===a.length){let i=a[0];if(i?.type==="element"){var e,t;for(let r of(e=i,t=n,e.properties["data-char"]=t,i.children))t0(r)}else t0(i);o.push(i),a=[],n=void 0;return}for(let e of a)t0(e);o.push(ej({tagName:"span",properties:{"data-char":n},children:a})),a=[],n=void 0},s=e=>{if(e!==tQ){if(e===tJ){r=tJ;return}if(r===tQ){r=e;return}r!==e&&(r=tJ)}};for(let i of t.children){let t="element"===i.type?e(i):tQ;if(s(t),"number"!=typeof t){l(),o.push(i);continue}null!=n&&n!==t&&l(),n??=t,a.push(i)}return l(),t.children=o,r}(o),r.push(function(e,t,n){let i="function"==typeof n.lineInfo?n.lineInfo(t):n.lineInfo[t-1];if(null==i){let i=`processLine: line ${t}, contains no state.lineInfo`;throw console.error(i,{node:e,line:t,state:n}),Error(i)}return e.tagName="div",e.properties["data-line"]=i.lineNumber,e.properties["data-alt-line"]=i.altLineNumber,e.properties["data-line-type"]=i.type,e.properties["data-line-index"]=i.lineIndex,0===e.children.length&&e.children.push(eG("\n")),e}(o,t,n)),t++);i.children=r}return t},...e?{tokens(e){for(let t of e){let e=0;for(let n of t)n.__lineChar??=e,e+=n.content.length}},preprocess(e,t){t.mergeWhitespaces="never"},span(e,t,n,i,r){if(r?.offset!=null&&null!=r.content){let t=r.__lineChar;null!=t&&(e.properties["data-char"]=t)}return e}}:null}];return t&&i.push(t8,t1),e&&i.push({line:e=>("element"===e.type&&0===e.children.length&&e.children.push({type:"element",tagName:"br",properties:{},children:[]}),e)}),{state:n,transformers:i,toClass:t1}}(d.useTokenTransformer),p="string"==typeof s?{...d,lang:"text",theme:s,transformers:f,decorations:void 0,defaultColor:!1,cssVariablePrefix:t2("token"),tokenizeTimeLimit:0}:{...d,lang:"text",themes:s,transformers:f,decorations:void 0,defaultColor:!1,cssVariablePrefix:t2("token"),tokenizeTimeLimit:0};return{deletionLines:""===e.contents?[]:(p.lang=u,c.lineInfo=n,p.decorations=o,ni(r.codeToHast(w(e.contents),p))),additionLines:""===t.contents?[]:(p.lang=h,p.decorations=a,c.lineInfo=i,ni(r.codeToHast(w(t.contents),p)))}}({deletionFile:r,deletionInfo:d.deletionInfo,deletionDecorations:d.deletionDecorations,additionFile:o,additionInfo:d.additionInfo,additionDecorations:d.additionDecorations,highlighter:t,options:n,languageOverride:i?"text":e.lang});if(p){c.deletionLines=a,c.additionLines=l;continue}if(d.deletionSegments.length>0)for(let e of d.deletionSegments)for(let t=0;t<e.count;t++)c.deletionLines[e.targetIndex+t]=a[e.originalOffset+t];else c.deletionLines.push(...a);if(d.additionSegments.length>0)for(let e of d.additionSegments)for(let t=0;t<e.count;t++)c.additionLines[e.targetIndex+t]=l[e.originalOffset+t];else c.additionLines.push(...l)}return{code:c,themeStyles:u,baseThemeType:d}}(e,t,i,{forcePlainText:n,expandedHunks:!!n||void 0,collapsedContextThreshold:r});if(this.editSessionActive&&1===e.additionLines.length&&""===e.additionLines[0]&&null==o.code.additionLines[0]){let t;if(tm({diff:e,diffStyle:"both",expandedHunks:!!n||void 0,collapsedContextThreshold:r,callback:({additionLine:e})=>{if(e?.lineIndex===0)return t=e,!0}}),null==t)throw Error("DiffHunksRenderer: missing empty addition line");o.code.additionLines[0]=nM(0,"",t.unifiedLineIndex,t.splitLineIndex)}return{result:o,options:i}}onHighlightSuccess(e,t,n,i=!0){this.editSessionActive||this.applyHighlightResult(e,t,n,i)}applyHighlightResult(e,t,n,i=!0){if(null==this.renderCache)return;let r=!0===this.renderCache.highlightPending||!this.renderCache.highlighted||!tq(this.renderCache.options,n)||!tV(this.renderCache.diff,e);this.renderCache={diff:e,options:n,highlighted:i,result:t,renderRange:void 0},r&&this.onRenderUpdate?.()}getMatchingWorkerResultCache(e,t){if(this.editSessionActive)return;let n=this.workerManager?.getDiffResultCache(e);if(null!=n&&tq(t,n.options))return n}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&tV(e,n.diff)&&tq(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}processDiffResult(e,t,{code:n,themeStyles:i,baseThemeType:r}){var o,a;let l,{diffStyle:s,disableFileHeader:d,expandUnchanged:u,expansionLineCount:h,collapsedContextThreshold:c,hunkSeparators:f}=this.getOptionsWithDefaults(),p=this.renderCache?.isDirty??!1;this.diff=e;let g="unified"===s,m=(o=e,a=null!=this.options.loadDiffFiles,o.isPartial&&a&&("change"===o.type||"rename-changed"===o.type)),b=!e.isPartial||m,v=[],y=[],C=[],S=[],{additionLines:k,deletionLines:w}=n,L={rowCount:0,hunkSeparators:f,additionsContentAST:v,deletionsContentAST:y,unifiedContentAST:C,unifiedGutterAST:eV(),deletionsGutterAST:eV(),additionsGutterAST:eV(),expansionLineCount:h,hunkData:S,incrementRowCount(e=1){L.rowCount+=e},pushToGutter(e,t){switch(e){case"unified":L.unifiedGutterAST.children.push(t);break;case"deletions":L.deletionsGutterAST.children.push(t);break;case"additions":L.additionsGutterAST.children.push(t)}}},A=ef({fileDiff:e,errorPrefix:"DiffHunksRenderer.processDiffResult"}),E={size:0,side:void 0,increment(){this.size+=1},flush(){if("unified"!==s){if(this.size<=0||null==this.side){this.side=void 0,this.size=0;return}"additions"===this.side?(L.pushToGutter("additions",eq(void 0,"buffer",this.size)),v?.push(tK(this.size))):(L.pushToGutter("deletions",eq(void 0,"buffer",this.size)),y?.push(tK(this.size))),this.size=0,this.side=void 0}}},R=(e,t,n,i,r)=>{L.pushToGutter(e,function(e,t,n,i={}){return ej({tagName:"div",properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...i},children:null!=t?[ej({tagName:"span",properties:{"data-line-number-content":""},children:[eG(`${t}`)]})]:void 0})}(t,n,i,r))};function _(e){E.flush(),"unified"===s?n_("unified",e,L):(n_("deletions",e,L),n_("additions",e,L))}this.pushFileLevelAnnotations(e,s,t,L),tm({diff:e,diffStyle:s,startingLine:t.startingLine,totalLines:t.totalLines,expandedHunks:!!u||this.expandedHunks,collapsedContextThreshold:c,callback:({hunkIndex:t,hunk:n,collapsedBefore:i,collapsedAfter:r,additionLine:o,deletionLine:a,type:l})=>{let d=null!=a?a.splitLineIndex:o.splitLineIndex,u=null!=o?o.unifiedLineIndex:a.unifiedLineIndex;"split"===s&&"change"!==l&&E.flush(),i>0&&_({hunkIndex:t,collapsedLines:i,rangeSize:Math.max(n?.collapsedBefore??0,0),hunkSpecs:n?.hunkSpecs,isFirstHunk:0===t,isLastHunk:!1,isExpandable:b});let h="unified"===s?u:d,c={type:l,hunkIndex:t,lineIndex:h,unifiedLineIndex:u,splitLineIndex:d,deletionLine:a,additionLine:o};if("unified"===s){let n=this.getUnifiedInjectedRowsForLine?.(c);n?.before!=null&&nA(n.before,L);let i=null!=a?w[a.lineIndex]:void 0,r=null!=o?k[o.lineIndex]:void 0;if(null==i&&null==r){let t="DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong";throw console.error(t,{file:e.name}),Error(t)}let s="change"===l?null!=o?"change-addition":"change-deletion":l,f=this.getUnifiedLineDecoration({type:l,lineType:s,additionLineIndex:o?.lineIndex,deletionLineIndex:a?.lineIndex});R("unified",f.gutterLineType,null!=o?o.lineNumber:a.lineNumber,`${u},${d}`,f.gutterProperties),null!=r?r=nT(r,f.contentProperties,p&&null!=o?{"data-line":o.lineNumber,"data-line-index":`${u},${d}`}:void 0):null!=i&&(i=nT(i,f.contentProperties,p&&null!=a?{"data-line":a.lineNumber,"data-line-index":`${u},${d}`}:void 0)),nR({diffStyle:"unified",type:l,deletionLine:i,additionLine:r,unifiedSpan:this.getAnnotations("unified",a?.lineNumber,o?.lineNumber,t,h),createAnnotationElement:e=>this.createAnnotationElement(e),context:L}),n?.after!=null&&nA(n.after,L)}else{let n=this.getSplitInjectedRowsForLine?.(c);n?.before!=null&&nE(n.before,L,E);let i=null!=a?w[a.lineIndex]:void 0,r=null!=o?k[o.lineIndex]:void 0,s=this.getSplitLineDecoration({side:"deletions",type:l,lineIndex:a?.lineIndex}),u=this.getSplitLineDecoration({side:"additions",type:l,lineIndex:o?.lineIndex});if(null==i&&null==r){let t="DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong";throw console.error(t,{file:e.name}),Error(t)}let f=(()=>{if("change"===l){if(null==r)return"additions";else if(null==i)return"deletions"}})();null!=f?(null!=E.side&&E.side!==f&&E.flush(),E.side=f,E.increment()):"change"===l&&E.flush();let g=this.getAnnotations("split",a?.lineNumber,o?.lineNumber,t,h);if(null!=g&&E.size>0&&E.flush(),null!=a){let e=nT(i,s.contentProperties,p?{"data-line":a.lineNumber,"data-line-index":`${a.unifiedLineIndex},${d}`}:void 0);R("deletions",s.gutterLineType,a.lineNumber,`${a.unifiedLineIndex},${d}`,s.gutterProperties),null!=e&&(i=e)}if(null!=o){let e=nT(r,u.contentProperties,p?{"data-line":o.lineNumber,"data-line-index":`${o.unifiedLineIndex},${d}`}:void 0);R("additions",u.gutterLineType,o.lineNumber,`${o.unifiedLineIndex},${d}`,u.gutterProperties),null!=e&&(r=e)}nR({diffStyle:"split",type:l,additionLine:r,deletionLine:i,...g,createAnnotationElement:e=>this.createAnnotationElement(e),context:L}),n?.after!=null&&nE(n.after,L,E)}let g="split"===s&&null!=n&&d===n.splitLineStart+n.splitLineCount-1,v=t===e.hunks.length-1&&null!=n&&("split"===s?d===n.splitLineStart+n.splitLineCount-1:u===n.unifiedLineStart+n.unifiedLineCount-1),y=!!g&&n.noEOFCRDeletions,C=!!g&&n.noEOFCRAdditions,S=(a?.noEOFCR??!1)||y,x=(o?.noEOFCR??!1)||C;if(x||S){if("split"===s&&E.flush(),S){let e="context"===l||"context-expanded"===l?l:"change-deletion";"unified"===s?(L.unifiedContentAST.push(tX(e)),L.pushToGutter("unified",eq(e,"metadata",1))):(L.deletionsContentAST.push(tX(e)),L.pushToGutter("deletions",eq(e,"metadata",1)),x||(L.pushToGutter("additions",eq(void 0,"buffer",1)),L.additionsContentAST.push(tK(1))))}if(x){let e="context"===l||"context-expanded"===l?l:"change-addition";"unified"===s?(L.unifiedContentAST.push(tX(e)),L.pushToGutter("unified",eq(e,"metadata",1))):(L.additionsContentAST.push(tX(e)),L.pushToGutter("additions",eq(e,"metadata",1)),S||(L.pushToGutter("deletions",eq(void 0,"buffer",1)),L.deletionsContentAST.push(tK(1))))}L.incrementRowCount(1)}"simple"!==f&&"metadata"!==f&&(r>0||v&&m)&&_({hunkIndex:"context-expanded"===l?t:t+1,collapsedLines:v&&m?"unknown":r,rangeSize:A,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:b}),L.incrementRowCount(1)}}),"split"===s&&E.flush();let T=Math.max(null==(l=e.hunks.at(-1))?0:Math.max(x(l.additionStart,l.additionCount),x(l.deletionStart,l.deletionCount)),e.additionLines.length??0,e.deletionLines.length??0),I=t.bufferBefore>0||t.bufferAfter>0,M=!g&&"deleted"!==e.type,P=!g&&"new"!==e.type,N=L.rowCount>0||I;v=M&&N?v:void 0,y=P&&N?y:void 0,C=g&&N?C:void 0;let D=this.createPreElement(null!=y&&null!=v,T);return{unifiedGutterAST:g&&N?L.unifiedGutterAST.children:void 0,unifiedContentAST:C,deletionsGutterAST:P&&N?L.deletionsGutterAST.children:void 0,deletionsContentAST:y,additionsGutterAST:M&&N?L.additionsGutterAST.children:void 0,additionsContentAST:v,hunkData:S,preNode:D,themeStyles:i,baseThemeType:r,headerElement:d?void 0:this.renderHeader(this.diff),totalLines:T,rowCount:L.rowCount,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:""}}renderCodeAST(e,t){var n;let i="unified"===e?t.unifiedGutterAST:"deletions"===e?t.deletionsGutterAST:t.additionsGutterAST,r="unified"===e?t.unifiedContentAST:"deletions"===e?t.deletionsContentAST:t.additionsContentAST;if(null==i||null==r)return;let o=eV(i);return o.properties.style=`grid-row: span ${t.rowCount}`,[o,(n=t.rowCount,ej({tagName:"div",children:r,properties:{"data-content":"",style:`grid-row: span ${n}`}}))]}renderFullAST(e,t=[]){let n="line-info"===this.getOptionsWithDefaults().hunkSeparators,i=this.renderCodeAST("unified",e);if(null!=i)return t.push(ej({tagName:"code",children:i,properties:{"data-code":"","data-container-size":n?"":void 0,"data-unified":""}})),{...e.preNode,children:t};let r=this.renderCodeAST("deletions",e);null!=r&&t.push(ej({tagName:"code",children:r,properties:{"data-code":"","data-container-size":n?"":void 0,"data-deletions":""}}));let o=this.renderCodeAST("additions",e);return null!=o&&t.push(ej({tagName:"code",children:o,properties:{"data-code":"","data-container-size":n?"":void 0,"data-additions":""}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return(0,eX.V)(this.renderFullAST(e,t))}renderPartialHTML(e,t){return null==t?(0,eX.V)(e):(0,eX.V)(ej({tagName:"code",children:e,properties:{"data-code":"","data-container-size":"line-info"===this.getOptionsWithDefaults().hunkSeparators?"":void 0,[`data-${t}`]:""}}))}pushFileLevelAnnotations(e,t,n,i){if(!tL(n))return;let r="new"!==e.type?nw(tw(this.deletionAnnotations)):[],o="deleted"!==e.type?nw(tw(this.additionAnnotations)):[];if(0===r.length&&0===o.length)return;let{createAnnotationElement:a}=this;"unified"===t?nR({diffStyle:t,type:"context",unifiedSpan:{type:"annotation",hunkIndex:-1,lineIndex:-1,annotations:r.concat(o)},createAnnotationElement:a,context:i}):nR({diffStyle:t,type:"context",deletionSpan:{type:"annotation",hunkIndex:-1,lineIndex:-1,annotations:r},additionSpan:{type:"annotation",hunkIndex:-1,lineIndex:-1,annotations:o},createAnnotationElement:a,context:i})}getAnnotations(e,t,n,i,r){let o={type:"annotation",hunkIndex:i,lineIndex:r,annotations:[]};if(null!=t)for(let e of this.deletionAnnotations[t]??[])o.annotations.push(K(e));let a={type:"annotation",hunkIndex:i,lineIndex:r,annotations:[]};if(null!=n)for(let t of this.additionAnnotations[n]??[])("unified"===e?o:a).annotations.push(K(t));return"unified"===e?o.annotations.length>0?o:void 0:0!==a.annotations.length||0!==o.annotations.length?{deletionSpan:o,additionSpan:a}:void 0}renderHeader(e){let{headerRenderMode:t,stickyHeader:n}=this.getOptionsWithDefaults();return function({fileOrDiff:e,mode:t,stickyHeader:n}){let i="type"in e?e:void 0,r={"data-diffs-header":t,"data-change-type":i?.type,"data-sticky":n?"":void 0};return ej({tagName:"div",children:["custom"===t?ej({tagName:"slot",properties:{name:m}}):function({name:e,prevName:t,iconType:n}){let i=[ej({tagName:"slot",properties:{name:f}}),eW({name:function(e){switch(e){case"file":return"diffs-icon-file-code";case"change":return"diffs-icon-symbol-modified";case"new":return"diffs-icon-symbol-added";case"deleted":return"diffs-icon-symbol-deleted";case"rename-pure":case"rename-changed":return"diffs-icon-symbol-moved"}}(n),properties:{"data-change-icon":n}})];return null!=t&&(i.push(ej({tagName:"div",children:[ej({tagName:"bdi",children:[eG(t)]})],properties:{"data-prev-name":""}})),i.push(eW({name:"diffs-icon-arrow-right-short",properties:{"data-rename-icon":""}}))),i.push(ej({tagName:"div",children:[ej({tagName:"bdi",children:[eG(e)]})],properties:{"data-title":""}})),i.push(ej({tagName:"slot",properties:{name:p}})),ej({tagName:"div",children:i,properties:{"data-header-content":""}})}({name:e.name,prevName:"prevName"in e?e.prevName:void 0,iconType:i?.type??"file"}),..."custom"===t?[]:[function(e){let t=[];if(null!=e){let n=0,i=0;for(let t of e.hunks)n+=t.additionLines,i+=t.deletionLines;(i>0||0===n)&&t.push(ej({tagName:"span",children:[eG(`-${i}`)],properties:{"data-deletions-count":""}})),(n>0||0===i)&&t.push(ej({tagName:"span",children:[eG(`+${n}`)],properties:{"data-additions-count":""}}))}return t.push(ej({tagName:"slot",properties:{name:g}})),ej({tagName:"div",children:t,properties:{"data-metadata":""}})}(i)]],properties:r})}({fileOrDiff:e,mode:t,stickyHeader:n})}};function nw(e){return e?.map(e=>K(e))??[]}let nL=new Intl.PluralRules("en-US");function nA(e,t){for(let n of e)t.unifiedContentAST.push(n.content),t.pushToGutter("unified",n.gutter),t.incrementRowCount(1)}function nE(e,t,n){for(let{deletion:i,addition:r}of e){if(null==i&&null==r)continue;let e=null!=i&&null!=r?void 0:null==i?"deletions":"additions";(null==e||n.side!==e)&&n.flush(),null!=i&&(t.deletionsContentAST.push(i.content),t.pushToGutter("deletions",i.gutter)),null!=r&&(t.additionsContentAST.push(r.content),t.pushToGutter("additions",r.gutter)),null!=e&&(n.side=e,n.increment()),t.incrementRowCount(1)}}function nR({diffStyle:e,type:t,deletionLine:n,additionLine:i,unifiedSpan:r,deletionSpan:o,additionSpan:a,createAnnotationElement:l,context:s}){let d=!1;"unified"===e?(null!=i?s.unifiedContentAST.push(i):null!=n&&s.unifiedContentAST.push(n),null!=r&&(s.unifiedContentAST.push(l(r)),s.pushToGutter("unified",eq("change"===t?null!=n?"change-deletion":"change-addition":t,"annotation",1)),d=!0)):"split"===e&&(null!=n&&s.deletionsContentAST.push(n),null!=i&&s.additionsContentAST.push(i),null!=o&&(s.deletionsContentAST.push(l(o)),s.pushToGutter("deletions",eq("change"===t?null!=n?"change-deletion":"context":t,"annotation",1)),d=!0),null!=a&&(s.additionsContentAST.push(l(a)),s.pushToGutter("additions",eq("change"===t?null!=i?"change-addition":"context":t,"annotation",1)),d=!0)),d&&s.incrementRowCount(1)}function n_(e,{hunkIndex:t,collapsedLines:n,rangeSize:i,hunkSpecs:r,isFirstHunk:o,isLastHunk:a,isExpandable:l},s){if("number"==typeof n&&n<=0)return;let d="unified"===e?s.unifiedContentAST:"deletions"===e?s.deletionsContentAST:s.additionsContentAST;if("metadata"===s.hunkSeparators){null!=r&&(s.pushToGutter(e,tZ({type:"metadata",content:r,isFirstHunk:o,isLastHunk:a})),d.push(tZ({type:"metadata",content:r,isFirstHunk:o,isLastHunk:a})),"additions"!==e&&s.incrementRowCount(1));return}if("simple"===s.hunkSeparators){t>0&&(s.pushToGutter(e,tZ({type:"simple",isFirstHunk:o,isLastHunk:!1})),d.push(tZ({type:"simple",isFirstHunk:o,isLastHunk:!1})),"additions"!==e&&s.incrementRowCount(1));return}let u=`hunk-separator-${e}-${t}`,h=i>s.expansionLineCount,c=l?t:void 0,f="number"==typeof n?`${n} unmodified line${"one"===nL.select(n)?"":"s"}`:"More unchanged context may be available";s.pushToGutter(e,tZ({type:s.hunkSeparators,content:f,expandIndex:c,chunked:h,slotName:u,isFirstHunk:o,isLastHunk:a})),d.push(tZ({type:s.hunkSeparators,content:f,expandIndex:c,chunked:h,slotName:u,isFirstHunk:o,isLastHunk:a})),"additions"!==e&&s.incrementRowCount(1),s.hunkData.push({slotName:u,hunkIndex:t,lines:"number"==typeof n?n:0,lineCountKnown:"number"==typeof n,type:e,expandable:l?{up:!o,down:!a,chunked:h}:void 0})}function nT(e,t,n){return null==e||"element"!==e.type||null==t&&null==n?e:{...e,properties:{...e.properties,...t,...n}}}function nI(e){return e.length>0&&""===e[e.length-1]?e.length-1:e.length}function nM(e,t,n=e,i=e){return{type:"element",tagName:"div",properties:{"data-line":e+1,"data-line-index":`${n},${i}`,"data-line-type":"context"},children:[{type:"element",tagName:"span",properties:{"data-char":0},children:[{type:"text",value:t}]}]}}function nP(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}let nN=-1;var nD=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file-diff:${++nN}`;type="file-diff";fileContainer;spriteSVG;pre;codeUnified;codeDeletions;codeAdditions;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;headerElement;headerPrefix;headerFilenameSuffix;headerMetadata;headerCustom;separatorCache=new Map;errorWrapper;placeHolder;hunksRenderer;resizeManager;scrollSyncManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;deletionFile;additionFile;fileDiff;renderRange;pendingFiles;appliedPreAttributes;lastRenderedHeaderHTML;cachedHeaderHTML;lastRowCount;mounted=!1;enabled=!0;editor;refreshViewTimeout;lineStateRefreshPending=!1;deferredSelectedLines;deferredEditorActiveLine;constructor(e={theme:b},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new e4,this.scrollSyncManager=new tv,this.interactionManager=new eY("diff",eZ(e,"function"==typeof e.hunkSeparators||(e.hunkSeparators??"line-info")==="line-info"||"line-info-basic"===e.hunkSeparators?this.handleExpandHunk:void 0,this.getLineIndex)),this.workerManager?.subscribeToThemeChanges(this),this.enabled=!0}handleHighlightRender=()=>{this.rerender()};getHunksRendererOptions(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,useCSSClasses:e?.useCSSClasses,useTokenTransformer:e?.useTokenTransformer===!0||e?.onTokenClick!=null||e?.onTokenEnter!=null||e?.onTokenLeave!=null,tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,diffStyle:e?.diffStyle,diffIndicators:e?.diffIndicators,disableBackground:e?.disableBackground,hunkSeparators:"function"==typeof e?.hunkSeparators?"custom":e?.hunkSeparators,expandUnchanged:e?.expandUnchanged,loadDiffFiles:e?.loadDiffFiles,collapsedContextThreshold:e?.collapsedContextThreshold,lineDiffType:e?.lineDiffType,maxLineDiffLength:e?.maxLineDiffLength,expansionLineCount:e?.expansionLineCount,headerRenderMode:e?.renderCustomHeader!=null?"custom":"default"}}createHunksRenderer(e){return new nx(this.getHunksRendererOptions(e),this.handleHighlightRender,this.workerManager)}getLineIndex=(e,t="additions")=>{let n,i,r=this.fileDiffCache;if(null==r)return;let o=r.hunks.at(-1);e:for(let a of r.hunks){let r="deletions"===t?a.deletionStart:a.additionStart,l="deletions"===t?a.deletionCount:a.additionCount,s=r-(0!==l)+1,d=a.splitLineStart,u=a.unifiedLineStart;if(e<s){let t=s-e;n=Math.max(u-t,0),i=Math.max(d-t,0);break}if(e>=s+l){if(a===o){let t=e-(s+l);n=u+a.unifiedLineCount+t,i=d+a.splitLineCount+t;break}continue}for(let r of a.hunkContent)if("context"===r.type)if(e<s+r.lines){let t=e-s;i=d+t,n=u+t;break e}else s+=r.lines,d+=r.lines,u+=r.lines;else{let o="deletions"===t?r.deletions:r.additions;if(e<s+o){let o=e-s;n=u+("additions"===t?r.deletions:0)+o,i=d+o;break e}s+=o,d+=Math.max(r.deletions,r.additions),u+=r.deletions+r.additions}break}if(null!=n&&null!=i)return[n,i]};setOptions(e){null!=e&&(this.options=e,this.cachedHeaderHTML=void 0,this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(eZ(this.options,"function"==typeof this.options.hunkSeparators||(this.options.hunkSeparators??"line-info")==="line-info"||"line-info-basic"===this.options.hunkSeparators?this.handleExpandHunk:void 0,this.getLineIndex))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??"system")!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){if("string"==typeof this.options.theme||null==this.fileContainer||null==this.appliedThemeCSS)return!1;let t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType!==t&&(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return null!=this.appliedThemeCSS&&!ee(this.appliedThemeCSS.theme,this.options.theme??b)}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(e){this.lineAnnotations=e}canPartiallyRender(e,t,n){return!e&&!t&&!n&&"function"!=typeof this.options.hunkSeparators}setSelectedLines(e,t){this.lineStateRefreshPending?this.deferredSelectedLines=[e,t]:this.interactionManager.setSelection(e,t)}setEditorActiveLine(e,t){this.lineStateRefreshPending?this.deferredEditorActiveLine=[e,t]:this.interactionManager.setEditorActiveLine(e,{lineNumberOnly:t?.lineNumberOnly,side:t?.side??"additions"})}flushDeferredLineState(){let{deferredEditorActiveLine:e,deferredSelectedLines:t}=this;this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,null!=e&&this.setEditorActiveLine(...e),null!=t&&this.interactionManager.setSelection(...t)}flushManagers(){if(!this.managersDirty||null==this.pre){this.managersDirty=!1;return}let{diffStyle:e="split",overflow:t="scroll"}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:"wrap"===t,columnVariables:this.shouldApplyColumnVariables(t)?"apply":"measure"}),"scroll"===t&&"split"===e?this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions):this.scrollSyncManager.cleanUp(),this.managersDirty=!1}shouldApplyColumnVariables(e){return"function"==typeof this.options.hunkSeparators||"scroll"===e&&(this.lineAnnotations.length>0||this.pre?.hasAttribute("data-has-merge-conflict")===!0)}getCodeScrollLeft(){return Math.max(this.codeUnified?.scrollLeft??0,this.codeDeletions?.scrollLeft??0,this.codeAdditions?.scrollLeft??0)}setCodeScrollLeft(e){null!=this.codeUnified&&(this.codeUnified.scrollLeft=e),null!=this.codeAdditions&&(this.codeAdditions.scrollLeft=e),null!=this.codeDeletions&&(this.codeDeletions.scrollLeft=e)}__getEffectiveCodeOptions(){return{...this.options,...this.hunksRenderer.getEffectiveCodeOptions()}}cleanUp(e=!1){ea(this.handleEditSessionRender),this.emitPostRender(!0),this.editor?.cleanUp(e),this.editor=void 0,this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.pendingFiles=void 0,this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.clearAuxiliaryNodes(),this.annotationCache.clear(),this.pre=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.placeHolder?.remove(),this.placeHolder=void 0,this.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),this.errorWrapper?.remove(),this.errorWrapper=void 0,this.spriteSVG=void 0,this.lastRowCount=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,e?this.hunksRenderer.recycle():(this.hunksRenderer.cleanUp(),this.workerManager=void 0,this.fileDiff=void 0,this.deletionFile=void 0,this.additionFile=void 0),null!=this.refreshViewTimeout&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate({fileContainer:e,prerenderedHTML:t,preventEmit:n=!1,lineAnnotations:i,fileDiff:r,...o}){if(!this.enabled)throw Error("FileDiff.hydrate: attempting to call hydrate after cleaned up");if(null!=this.fileContainer)throw Error("FileDiff.hydrate: hydrate can only be called before the instance has rendered or hydrated");let a=th(o,"FileDiff.hydrate"),l=a?.oldFile,s=a?.newFile;this.hydrateElements(e,t),function(e,t,n=!1){return!n&&null==e&&t}(this.pre,function({fileDiff:e,oldFile:t,newFile:n}){return null!=e&&e.hunks.length>0||null!=t||null!=n}({fileDiff:r,oldFile:l,newFile:s}),this.options.collapsed)||function(e,t,n=!1){return null==e&&t&&!n}(this.headerElement,function({fileDiff:e,oldFile:t,newFile:n}){return null!=e||null!=t||null!=n}({fileDiff:r,oldFile:l,newFile:s}),this.options.disableFileHeader)?this.render({...o,fileContainer:e,lineAnnotations:i,fileDiff:r,preventEmit:!0}):this.hydrationSetup({fileDiff:r,lineAnnotations:i,...a}),n||this.emitPostRender()}hydrateElements(e,t){for(let n of(this.fileContainer!==e&&this.emitPostRender(!0),!function(e,t){if(null==t)return;let n=e.shadowRoot??e.attachShadow({mode:"open"});""===n.innerHTML&&(n.innerHTML=t)}(e,t),e.shadowRoot?.children??[])){if(n instanceof SVGElement){this.spriteSVG=n;continue}if(n instanceof HTMLElement){if(n instanceof HTMLPreElement){for(let e of(this.pre=n,n.children))e instanceof HTMLElement&&"code"===e.tagName.toLowerCase()&&("deletions"in e.dataset&&(this.codeDeletions=e),"additions"in e.dataset&&(this.codeAdditions=e),"unified"in e.dataset&&(this.codeUnified=e));continue}if("diffsHeader"in n.dataset){this.headerElement=n;continue}if(n instanceof HTMLStyleElement&&n.hasAttribute("data-theme-css")){this.themeCSSStyle=n;continue}if(n instanceof HTMLStyleElement&&n.hasAttribute("data-unsafe-css")){this.unsafeCSSStyle=n,this.appliedUnsafeCSS=n.textContent;continue}}}null!=this.pre&&(this.syncCodeNodesFromPre(this.pre),this.pre.removeAttribute("data-dehydrated")),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({fileDiff:e,oldFile:t,newFile:n,lineAnnotations:i}){this.lineAnnotations=i??this.lineAnnotations,this.additionFile=n,this.deletionFile=t,this.fileDiff=e??(void 0!==t&&void 0!==n?V(t,n,this.options.parseDiffOptions):void 0),null!=this.pre&&(this.syncInteractionOptions(),this.hunksRenderer.hydrate(this.fileDiff),this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}rerender(){this.enabled&&(null!=this.fileDiff||null!=this.additionFile||null!=this.deletionFile)&&this.render({forceRender:!0,renderRange:this.renderRange})}onThemeChange(){this.hunksRenderer.clearRenderCache(),this.rerender()}handleExpandHunk=(e,t,n)=>{this.expandHunk(e,t,n)};expandHunk=(e,t,n)=>{this.hunksRenderer.expandHunk(e,t,n),this.loadFilesIfNecessary(),this.rerender()};loadFilesIfNecessary(){var e;let{fileDiff:t,options:{loadDiffFiles:n}}=this;null!=t&&null!=n&&(e=t).isPartial&&("change"===e.type||"rename-changed"===e.type||"rename-pure"===e.type)&&this.pendingFiles?.fileDiff!==t&&(this.pendingFiles={fileDiff:t,promise:this.loadFilesForDiff(t,n)})}async loadFilesForDiff(e,t){try{let n=await t(e);if(!this.enabled||this.fileDiff!==e)return;await this.handleFilesLoaded(e,n)}catch(e){if(!0===this.options.disableErrorHandling)throw e;console.error(e)}finally{this.pendingFiles?.fileDiff===e&&(this.pendingFiles=void 0)}}async handleFilesLoaded(e,t){this.fileDiff!==e||!e.isPartial||(tf("merge",e,t),this.setHydratedState(t),await tu(()=>this.primeHighlightCache(e)),this.enabled&&this.fileDiff===e&&this.rerender())}setHydratedState(e){this.deletionFile=e.oldFile,this.additionFile=e.newFile,this.workerManager?.cleanUpTasks(this.hunksRenderer),this.hunksRenderer.clearRenderCache()}render({fileDiff:e,deferManagers:t=!1,forceRender:n=!1,preventEmit:i=!1,lineAnnotations:r,fileContainer:o,containerWrapper:a,renderRange:l,...s}){let d,u=th(s,"FileDiff.render"),h=u?.oldFile,c=u?.newFile;if(!this.enabled)throw Error("FileDiff.render: attempting to call render after cleaned up");null!=e&&void 0===e.cacheKey&&(e.cacheKey=null!=e.prevName?e.prevName+":"+e.name:e.name),this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:f=!1,themeType:p="system",expandUnchanged:g=!1}=this.options,m=f?void 0:l,b=this.hasThemeChanged(),v=null!=u,y=v&&(!nH(h,this.deletionFile)||!nH(c,this.additionFile)),C=null!=e&&e!==this.fileDiff,S=null!=r&&(r.length>0||this.lineAnnotations.length>0)&&r!==this.lineAnnotations;if(!f&&tt(m,this.renderRange)&&!n&&!S&&!b&&(null!=e&&e===this.fileDiff||null==e&&!y))return this.applyCachedThemeState(p);null==e&&v&&(y||null==this.fileDiff)&&(d=V(u.oldFile,u.newFile,this.options.parseDiffOptions));let{renderRange:x}=this;if(this.renderRange=m,v?(this.deletionFile=h,this.additionFile=c):null!=e&&(this.deletionFile=void 0,this.additionFile=void 0),null!=e?this.fileDiff=e:null!=d&&(C=!0,this.fileDiff=d),C&&(this.cachedHeaderHTML=void 0),null!=r&&this.setLineAnnotations(r),null==this.fileDiff)return!1;!0===this.fileDiff.editSessionDirty&&this.shouldSelfHealEditSession()&&(eN(this.fileDiff,this.options.parseDiffOptions),this.hunksRenderer.refreshHighlightedResult()),g&&this.loadFilesIfNecessary(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.hunksRenderer.setLineAnnotations(this.lineAnnotations);let{disableErrorHandling:w=!1,disableFileHeader:L=!1}=this.options;if(L&&(null!=this.headerElement&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),o=this.getOrCreateFileContainer(o,a),this.applyCachedThemeState(p),f){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.hunksRenderer.renderDiff(this.fileDiff,k);null!=e&&this.applyThemeState(o,e.themeStyles,p,e.baseThemeType),e?.headerElement!=null&&this.applyHeaderToDOM(e.headerElement,o),this.renderSeparators([]),this.injectUnsafeCSS()}catch(e){if(w)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,o)}return i||this.emitPostRender(),!0}try{let e=this.getOrCreatePreNode(o);if(!(this.canPartiallyRender(n,S,y||C||b)&&this.applyPartialRender({previousRenderRange:x,renderRange:m}))){let t=this.hunksRenderer.renderDiff(this.fileDiff,m);if(null==t)return this.workerManager?.isInitialized()===!1&&this.workerManager.initialize().then(()=>this.rerender()),!1;this.applyThemeState(o,t.themeStyles,p,t.baseThemeType),null!=t.headerElement&&this.applyHeaderToDOM(t.headerElement,o),null!=t.additionsContentAST||null!=t.deletionsContentAST||null!=t.unifiedContentAST?this.applyHunksToDOM(e,t):null!=this.pre&&(this.pre.remove(),this.pre=void 0),this.renderSeparators(t.hunkData)}this.applyBuffers(e,m),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,t||this.flushManagers(),null!=this.editor&&this.syncRenderViewToEditor()}catch(e){if(w)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,o)}return i||this.emitPostRender(),!0}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,null==t))return;this.options.onPostRender?.(t,this,"unmount");return}if(null==t)return;let i=this.mounted?"update":"mount";this.mounted=!0,n?.(t,this,i)}get fileDiffCache(){return this.hunksRenderer.diffCache??this.fileDiff}syncRenderViewToEditor(){let e=this.editor,t=this.fileContainer,n=this.fileDiffCache,i=this.lineAnnotations,r=this.computeEditorRenderRange(this.renderRange);null==e||null==t||null==n||n.isPartial||this.hunksRenderer.initializeHighlighter().then(o=>{this.enabled&&this.editor===e&&this.fileContainer===t&&this.fileDiffCache===n&&e.__syncRenderView(o,t,n,i,r)})}computeEditorRenderRange(e){let t,n,i=this.fileDiffCache;if(null==e||null==i||ty(e))return e;let{diffStyle:r="split",expandUnchanged:o=!1,collapsedContextThreshold:a=1}=this.options;return(tm({diff:i,diffStyle:r,startingLine:e.startingLine,totalLines:e.totalLines,expandedHunks:!!o||this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:a,callback:({additionLine:e})=>{null!=e&&(t??=e.lineNumber,n=e.lineNumber)}}),null==t||null==n)?{...e,startingLine:0,totalLines:0}:{...e,startingLine:t-1,totalLines:n-t+1}}attachEditor(e){if("file-diff"!==this.type)throw Error(`FileDiff.attachEditor: cannot attach an editor to a "${this.type}" diff`);return this.editor?.cleanUp(),this.editor=e,this.hunksRenderer.beginEditSession(),this.fileDiff?.isPartial===!0&&this.loadFilesIfNecessary(),this.hunksRenderer.editorRenderReady()?this.syncRenderViewToEditor():this.rerender(),e=>{this.editor=void 0,!0!==e&&this.finishEditSession()}}finishEditSession(){this.hunksRenderer.endEditSession(),this.completeEditSession()}completeEditSession(){let e=this.fileDiffCache;if(null==e||!0!==e.editSessionDirty)return!1;let{collapsedContextThreshold:t=1}=this.options,n=function(e,t,n){let i=[];if(e.isPartial)return i;for(let[r,o]of e.hunks.entries()){let a=ec({isPartial:e.isPartial,rangeSize:o.collapsedBefore,expandedHunks:t,hunkIndex:r,collapsedContextThreshold:n});if(a.rangeSize<=n)continue;let l=e$(o),s=l-a.rangeSize;a.fromStart>0&&i.push([s,s+a.fromStart]),a.fromEnd>0&&i.push([l-a.fromEnd,l])}let r=ep({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:"captureExpansionAnchors"});if(null!=r&&r.fromStart>0&&r.rangeSize>n){let t=e.hunks[e.hunks.length-1],n=e$(t)+t.deletionCount;i.push([n,n+r.fromStart])}return i}(e,this.hunksRenderer.getExpandedHunksMap(),t);return eN(e,this.options.parseDiffOptions),this.hunksRenderer.setExpandedHunksMap(function(e,t){let n=new Map;if(0===t.length)return n;let i=(e,i,r)=>{if(r<=i)return;let o=0,a=0;for(let[e,n]of t)n<=i||e>=r||(e<=i&&(o=Math.max(o,Math.min(n,r)-i)),n>=r&&(a=Math.max(a,r-Math.max(e,i))));(o>0||a>0)&&n.set(e,{fromStart:o,fromEnd:a})};for(let[t,n]of e.hunks.entries()){let e=e$(n);i(t,e-Math.max(n.collapsedBefore,0),e)}let r=e.hunks[e.hunks.length-1];return null!=r&&!e.isPartial&&e.deletionLines.length>0&&i(e.hunks.length,e$(r)+r.deletionCount,e.deletionLines.length),n}(e,n)),this.hunksRenderer.refreshHighlightedResult(),this.escalateEditSessionRender(),!0}applyDocumentChange(e,t){this.hunksRenderer.applyDocumentChange(e);let n=this.hunksRenderer.diffCache;if(null!=n){let e=this.fileDiff?.cacheKey;null!=e&&null==n.cacheKey&&(n.cacheKey=e),this.fileDiff=n}void 0!==t&&t!==this.lineAnnotations&&(this.setLineAnnotations(t),this.hunksRenderer.setLineAnnotations(this.lineAnnotations),this.renderAnnotations()),this.rerender(),this.interactionManager.setSelectionDirty()}updateRenderCache(e,t,n={}){let{shouldRefreshDiffsView:i,lineCountChangeInFlight:r}=n;if(this.hunksRenderer.updateRenderCache(e,t,r)){null!=this.refreshViewTimeout&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!0,this.escalateEditSessionRender();return}!0===i&&(null!=this.refreshViewTimeout&&clearTimeout(this.refreshViewTimeout),this.lineStateRefreshPending=!0,this.refreshViewTimeout=setTimeout(()=>{this.refreshViewTimeout=void 0,"split"===this.options.diffStyle?this.refreshSplitDiffView():this.refreshUnifiedDiffView(),this.flushDeferredLineState()},150))}isLineRenderable(e){let t=this.fileDiffCache;if(null==t)return!0;let{expandUnchanged:n=!1,collapsedContextThreshold:i=1}=this.options;return eg({fileDiff:t,lineNumber:e,expandedHunks:!!n||this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i})}getNearestRenderableLine(e,t){let n=this.fileDiffCache;if(null==n)return e;let{expandUnchanged:i=!1,collapsedContextThreshold:r=1}=this.options;return function({fileDiff:e,lineNumber:t,direction:n,expandedHunks:i,collapsedContextThreshold:r}){if(!0===i||e.isPartial)return t;let o=[],a=1;for(let[t,n]of e.hunks.entries()){let[l,s]=eh(n),d=ec({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:i,hunkIndex:t,collapsedContextThreshold:r}),u=l-d.rangeSize;d.renderAll?o.push([u,l]):(d.fromStart>0&&o.push([u,u+d.fromStart]),d.fromEnd>0&&o.push([l-d.fromEnd,l])),o.push([l,s]),a=s}let l=ep({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:i,collapsedContextThreshold:r,errorPrefix:"getNearestRenderableAdditionLine"});if(null!=l){let e=a;a=e+l.rangeSize,l.renderAll?o.push([e,a]):l.fromStart>0&&o.push([e,e+l.fromStart])}if(t>=a)return t;if("down"===n){for(let[e,n]of o)if(n>t)return Math.max(e,t);return}for(let e=o.length-1;e>=0;e--){let[n,i]=o[e];if(n<=t)return Math.min(i-1,t)}}({fileDiff:n,lineNumber:e,direction:t,expandedHunks:!!i||this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r})}revealLine(e){let t=this.fileDiffCache,{expandUnchanged:n=!1,collapsedContextThreshold:i=1,expansionLineCount:r=100}=this.options;if(null==t||t.isPartial||n)return!1;let o=this.hunksRenderer.getExpandedHunksMap();for(let[n,a]of t.hunks.entries()){let[l,s]=eh(a);if(e<l){let s=ec({isPartial:t.isPartial,rangeSize:a.collapsedBefore,expandedHunks:o,hunkIndex:n,collapsedContextThreshold:i}),d=l-s.rangeSize;if(s.renderAll||e<d+s.fromStart||e>=l-s.fromEnd)return!1;let u=e-(d+s.fromStart)+1,h=l-s.fromEnd-e;return u<=h?this.expandHunk(n,"up",u+r):this.expandHunk(n,"down",h+r),!0}if(e<s)return!1}let a=ep({fileDiff:t,hunkIndex:t.hunks.length-1,expandedHunks:o,collapsedContextThreshold:i,errorPrefix:"FileDiff.revealLine"});if(null==a||a.renderAll)return!1;let[,l]=eh(t.hunks[t.hunks.length-1]);return!(e<l+a.fromStart)&&!(e>=l+a.rangeSize)&&(this.expandHunk(t.hunks.length,"up",e-(l+a.fromStart)+1+r),!0)}shouldSelfHealEditSession(){return null==this.editor}escalateEditSessionRender(){eo(this.handleEditSessionRender)}handleEditSessionRender=()=>{this.rerender(),this.flushDeferredLineState()};removeRenderedCode(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.separatorCache.values())e.remove();for(let{element:e}of(this.separatorCache.clear(),this.annotationCache.values()))e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}renderPlaceholder(e){if(null==this.fileContainer)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),null==this.placeHolder){let e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:"open"});this.placeHolder=document.createElement("div"),this.placeHolder.dataset.placeholder="",e.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty("height",`${e}px`),!0}async primeHighlightCache(e=this.fileDiff){let{workerManager:t}=this;if(null==e||null==t||!t.isWorkingPool()||null==e.cacheKey||tx(e))return;let n=this.options.tokenizeMaxLength??1e5;Math.max(e.additionLines.length,e.deletionLines.length)>n||await t.primeDiffHighlightCache(e).catch(e=>{console.error(e)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.codeAdditions?.remove(),this.codeDeletions?.remove(),this.codeUnified?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.codeAdditions=void 0,this.codeDeletions=void 0,this.codeUnified=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderSeparators(e){let{hunkSeparators:t}=this.options;if(this.isContainerManaged||null==this.fileContainer||"function"!=typeof t){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();return}let n=new Map(this.separatorCache);for(let r of e){var i;let e=r.slotName,o=this.separatorCache.get(e);if(null==o||(i=o.hunkData,r.slotName!==i.slotName||r.hunkIndex!==i.hunkIndex||r.lines!==i.lines||r.lineCountKnown!==i.lineCountKnown||r.type!==i.type||r.expandable?.chunked!==i.expandable?.chunked||r.expandable?.up!==i.expandable?.up||r.expandable?.down!==i.expandable?.down)){o?.element.remove();let n=document.createElement("div");n.style.display="contents",n.slot=r.slotName;let i=t(r,this);null!=i&&n.appendChild(i),this.fileContainer.appendChild(n),o={element:n,hunkData:r},this.separatorCache.set(e,o)}n.delete(e)}for(let[e,{element:t}]of n.entries())this.separatorCache.delete(e),t.remove()}renderAnnotations(){if(this.isContainerManaged||null==this.fileContainer){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options;if(null!=t&&this.lineAnnotations.length>0)for(let[i,r]of this.lineAnnotations.entries()){var n;let o=`${i}-${K(r)}`,a=this.annotationCache.get(o);if(null==a||(n=a.annotation,r.lineNumber!==n.lineNumber||r.side!==n.side||r.metadata!==n.metadata)){a?.element.remove();let e=t(r);if(null==e)continue;(a={element:function(e){let t=document.createElement("div");return t.dataset.annotationSlot="",t.slot=e,t.style.whiteSpace="normal",t}(K(r)),annotation:r}).element.appendChild(e),this.fileContainer.appendChild(a.element),this.annotationCache.set(o,a)}e.delete(o)}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let e,{renderGutterUtility:t}=this.options;if(null==this.fileContainer||null==t){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=t(this.interactionManager.getHoveredLine);if(null!=n&&null!=this.gutterUtilityContent)return;if(null==n){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let i=((e=document.createElement("div")).slot="gutter-utility-slot",e.style.position="absolute",e.style.top="0",e.style.bottom="0",e.style.textAlign="center",e.style.whiteSpace="normal",e.style.touchAction="none",e);i.appendChild(n),this.fileContainer.appendChild(i),this.gutterUtilityContent=i}getOrCreateFileContainer(e,t){let{fileContainer:n}=this,i=e??n??document.createElement("diffs-container"),r=n!==i;return null!=n&&r&&this.editor?.__captureFocusForDOMReplacement(),r&&this.emitPostRender(!0),this.fileContainer=i,null!=n&&r&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),null!=t&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),r&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){let{shadowRoot:t}=e;if(null!=t)for(let e of t.children)e instanceof SVGElement?this.spriteSVG??=e:ez(e)&&e.hasAttribute("data-theme-css")?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):ez(e)&&e.hasAttribute("data-unsafe-css")&&(this.unsafeCSSStyle??=e,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){let t=e.shadowRoot??e.attachShadow({mode:"open"});if(null==this.spriteSVG){let e=document.createElement("div");e.innerHTML=tn;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t)}null!=this.spriteSVG&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:"open"});return null==this.pre?(this.pre=document.createElement("pre"),this.appliedPreAttributes=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(this.editor?.__captureFocusForDOMReplacement(),t.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodesFromPre(e){for(let t of(this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,Array.from(e.children)))t instanceof HTMLElement&&(t.hasAttribute("data-unified")?this.codeUnified=t:t.hasAttribute("data-deletions")?this.codeDeletions=t:t.hasAttribute("data-additions")&&(this.codeAdditions=t))}applyHeaderToDOM(e,t){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let{fileDiff:n}=this,i=this.cachedHeaderHTML??(0,eX.V)(e);if(this.cachedHeaderHTML=i,i!==this.lastRenderedHeaderHTML){let e=document.createElement("div");e.innerHTML=i;let n=e.firstElementChild;if(!(n instanceof HTMLElement))return;null!=this.headerElement?t.shadowRoot?.replaceChild(n,this.headerElement):t.shadowRoot?.prepend(n),this.headerElement=n,this.lastRenderedHeaderHTML=i}if(this.isContainerManaged||null==n)return;let{renderCustomHeader:r,renderHeaderPrefix:o,renderHeaderFilenameSuffix:a,renderHeaderMetadata:l}=this.options;if(null!=r){let e=r(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,m,e),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0;return}let s=o?.(n)??void 0,d=a?.(n)??void 0,u=l?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,f,s),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,p,d),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,g,u),this.headerCustom?.remove(),this.headerCustom=void 0}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,i){if(null==i)return void t?.remove();let r=t??this.createHeaderSlotElement(n);return null==t&&e.appendChild(r),this.replaceHeaderSlotContent(r,i),r}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement("div");return t.slot=e,t}injectUnsafeCSS(){let{unsafeCSS:e}=this.options,t=this.fileContainer?.shadowRoot;if(null!=t){if(null==e||""===e){null!=this.unsafeCSSStyle&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}if(this.unsafeCSSStyle?.parentNode!==t||this.appliedUnsafeCSS!==e){let n;this.unsafeCSSStyle??=((n=document.createElement("style")).setAttribute("data-unsafe-css",""),n),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=`${ta}
|
|
57
|
+
@layer unsafe {
|
|
58
|
+
${e}
|
|
59
|
+
}`,this.appliedUnsafeCSS=e}}}applyThemeState(e,t,n,i){let r=e.shadowRoot??e.attachShadow({mode:"open"}),o=i??n,a=this.options.theme??b,l="string"==typeof a?a:{...a},s=tr(r);if(this.themeCSSStyle?.parentNode===r&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===o&&this.appliedThemeCSS.scrollbarGutter===s){this.appliedThemeCSS.theme=l;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===r){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:l,themeStyles:t,themeType:o,baseThemeType:i,scrollbarGutter:s};return}this.themeCSSStyle=function({shadowRoot:e,currentNode:t,themeCSS:n}){let i;return""===n.trim()?void t?.remove():((t??=((i=document.createElement("style")).setAttribute("data-theme-css",""),i)).textContent=n,t.parentNode!==e&&e.appendChild(t),t)}({shadowRoot:r,currentNode:this.themeCSSStyle,themeCSS:function(e,t="system",n){return`${ta}
|
|
60
|
+
@layer rendered {
|
|
61
|
+
:host {${"system"===t?"":`
|
|
62
|
+
color-scheme: ${t};`}
|
|
63
|
+
${to(n)}
|
|
64
|
+
${e}
|
|
65
|
+
}
|
|
66
|
+
}`}(t,o,s)}),this.appliedThemeCSS=null!=this.themeCSSStyle?{theme:l,themeStyles:t,themeType:o,baseThemeType:i,scrollbarGutter:s}:void 0}hydrateMeasuredScrollbar(){let e=this.fileContainer?.shadowRoot;if(null!=e&&null!=this.themeCSSStyle){var t;let n;this.themeCSSStyle.textContent=(t=this.themeCSSStyle.textContent??"",n=to(tr(e)),t.replace(tl,n))}}shouldGuardRebuildScroll(){return null!=this.editor&&(o??="safari"in window&&"pushNotification"in window.safari||/^((?!chrome|android).)*safari/i.test(navigator.userAgent))}applyHunksToDOM(e,t){this.shouldGuardRebuildScroll()?td(e,()=>this.replaceCodeColumns(e,t)):this.replaceCodeColumns(e,t)}applyCodeColumnsInPlace(e,t,n){let i=this.getColumnPair(e);if(null==i)return!1;let r=nO(t[0]),o=nO(t[1]);return null!=r&&null!=o&&(i.gutter.innerHTML=(0,eX.V)(r),i.content.innerHTML=(0,eX.V)(o),n!==this.lastRowCount&&(i.gutter.style.setProperty("grid-row",`span ${n}`),i.content.style.setProperty("grid-row",`span ${n}`)),!0)}replaceCodeColumns(e,t){let{overflow:n="scroll"}=this.options,i=(this.options.hunkSeparators??"line-info")==="line-info",r="wrap"===n?t.rowCount:void 0;this.cleanupErrorWrapper(),this.applyPreNodeAttributes(e,t);let o=!1,a=[],l=this.hunksRenderer.renderCodeAST("unified",t),s=this.hunksRenderer.renderCodeAST("deletions",t),d=this.hunksRenderer.renderCodeAST("additions",t);this.editor?.__captureFocusForDOMReplacement(),null!=l?(o=null==this.codeUnified||null!=this.codeAdditions||null!=this.codeDeletions,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.codeUnified=ts({code:this.codeUnified,columnType:"unified",rowSpan:r,containerSize:i}),this.applyCodeColumnsInPlace(this.codeUnified,l,t.rowCount)||(this.codeUnified.innerHTML=this.hunksRenderer.renderPartialHTML(l)),a.push(this.codeUnified)):null!=s||null!=d?(null!=s?(o=null==this.codeDeletions||null!=this.codeUnified,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions=ts({code:this.codeDeletions,columnType:"deletions",rowSpan:r,containerSize:i}),this.applyCodeColumnsInPlace(this.codeDeletions,s,t.rowCount)||(this.codeDeletions.innerHTML=this.hunksRenderer.renderPartialHTML(s)),a.push(this.codeDeletions)):(this.codeDeletions?.remove(),this.codeDeletions=void 0),null!=d?(o=o||null==this.codeAdditions||null!=this.codeUnified,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeAdditions=ts({code:this.codeAdditions,columnType:"additions",rowSpan:r,containerSize:i}),this.applyCodeColumnsInPlace(this.codeAdditions,d,t.rowCount)||(this.codeAdditions.innerHTML=this.hunksRenderer.renderPartialHTML(d)),a.push(this.codeAdditions)):(this.codeAdditions?.remove(),this.codeAdditions=void 0)):(this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0),0===a.length?e.textContent="":o&&e.replaceChildren(...a),this.lastRowCount=t.rowCount}applyPartialRender({previousRenderRange:e,renderRange:t}){let{pre:n,codeUnified:i,codeAdditions:r,codeDeletions:o,options:{diffStyle:a="split"}}=this;if(null==n||null==e||null==t||!Number.isFinite(e.totalLines)||!Number.isFinite(t.totalLines)||null==this.lastRowCount)return!1;let l=this.getCodeColumns(a,i,o,r);if(null==l)return!1;let s=e.startingLine,d=t.startingLine,u=s+e.totalLines,h=d+t.totalLines,c=Math.max(s,d),f=Math.min(u,h);if(f<=c)return!1;let p=Math.max(0,c-s),g=Math.max(0,u-f),m=this.trimColumns({columns:l,trimStart:p,trimEnd:g,previousStart:s,overlapStart:c,overlapEnd:f,diffStyle:a});if(m<0)throw Error("FileDiff.applyPartialRender: failed to trim to overlap");if(this.lastRowCount<m)throw Error("FileDiff.applyPartialRender: trimmed beyond DOM row count");let b=this.lastRowCount-m,v=(e,t)=>{if(!(t<=0)&&null!=this.fileDiff)return this.hunksRenderer.renderDiff(this.fileDiff,{startingLine:e,totalLines:t,bufferBefore:0,bufferAfter:0})},y=v(d,Math.max(c-d,0));if(null==y&&d<c)return!1;let C=v(f,Math.max(h-f,0));if(null==C&&h>f)return!1;let S=(e,t)=>{if(null!=e){if("unified"!==a||Array.isArray(l))if("split"===a&&Array.isArray(l))this.insertPartialHTML(a,l,e,t);else throw Error("FileDiff.applyPartialRender.applyChunk: invalid chunk application");else this.insertPartialHTML(a,l,e,t);b+=e.rowCount}};return this.cleanupErrorWrapper(),S(y,"afterbegin"),S(C,"beforeend"),this.lastRowCount!==b&&(this.applyRowSpan(a,l,b),this.lastRowCount=b),!0}insertPartialHTML(e,t,n,i){if("unified"!==e||Array.isArray(t))if("split"===e&&Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST("deletions",n),r=this.hunksRenderer.renderCodeAST("additions",n);this.renderPartialColumn(t[0],e,i),this.renderPartialColumn(t[1],r,i)}else throw Error("FileDiff.insertPartialHTML: Invalid argument composition");else{let e=this.hunksRenderer.renderCodeAST("unified",n);this.renderPartialColumn(t,e,i)}}refreshSplitDiffView(){if("split"!==this.options.diffStyle)return;let e=this.hunksRenderer.renderDiff(this.fileDiff,this.renderRange);if(null==e)return;let t=this.getCodeColumns("split",this.codeUnified,this.codeDeletions,this.codeAdditions);if(!Array.isArray(t))return;let n=(t,n)=>{if(null==n)return;let i=this.hunksRenderer.renderCodeAST(t,e),r=nO(i?.[0]),o=nO(i?.[1]);for(let[e,t]of[[n.gutter,r],[n.content,o]])if(null!=t&&e.childElementCount===t.length)for(let n=0;n<t.length;n++){let i=e.children[n],r=t[n].properties["data-line-type"];null!=r&&i.dataset.lineType!==r&&(i.dataset.lineType=r)}};n("deletions",t[0]),n("additions",t[1])}refreshUnifiedDiffView(){if("unified"!==this.options.diffStyle)return;let e=this.hunksRenderer.renderDiff(this.fileDiff,this.renderRange);if(null==e)return;let t=this.getCodeColumns("unified",this.codeUnified,this.codeDeletions,this.codeAdditions);if(null==t||Array.isArray(t))return;let n=this.hunksRenderer.renderCodeAST("unified",e),i=nO(n?.[0]),r=nO(n?.[1]),o=()=>{for(let[e,n]of[[t.gutter,i],[t.content,r]])null!=n&&(e.innerHTML=(0,eX.V)(n));e.rowCount!==this.lastRowCount&&(this.applyRowSpan("unified",t,e.rowCount),this.lastRowCount=e.rowCount)};this.shouldGuardRebuildScroll()?td(this.pre,o):o(),this.renderSeparators(e.hunkData),this.managersDirty=!0,this.flushManagers(),this.syncRenderViewToEditor()}renderPartialColumn(e,t,n){if(null==e||null==t)return;let i=nO(t[0]),r=nO(t[1]);if(null==i||null==r)throw Error("FileDiff.insertPartialHTML: Unexpected AST structure");let o=r.at(0);"beforeend"===n&&o?.type==="element"&&"number"==typeof o.properties["data-buffer-size"]&&this.mergeBuffersIfNecessary(o.properties["data-buffer-size"],e.content.children[e.content.children.length-1],e.gutter.children[e.gutter.children.length-1],i,r,!0);let a=r.at(-1);"afterbegin"===n&&a?.type==="element"&&"number"==typeof a.properties["data-buffer-size"]&&this.mergeBuffersIfNecessary(a.properties["data-buffer-size"],e.content.children[0],e.gutter.children[0],i,r,!1),e.gutter.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(i)),e.content.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(r))}mergeBuffersIfNecessary(e,t,n,i,r,o){if(!(t instanceof HTMLElement)||!(n instanceof HTMLElement))return;let a=this.getBufferSize(t.dataset);null!=a&&(o?(i.shift(),r.shift()):(i.pop(),r.pop()),this.updateBufferSize(t,a+e),this.updateBufferSize(n,a+e))}applyRowSpan(e,t,n){let i=e=>{null!=e&&(e.gutter.style.setProperty("grid-row",`span ${n}`),e.content.style.setProperty("grid-row",`span ${n}`))};if("unified"!==e||Array.isArray(t))if("split"===e&&Array.isArray(t))i(t[0]),i(t[1]);else throw Error("dun fuuuuked up");else i(t)}trimColumnRows(e,t,n){let i=0,r=0,o=0,a=!1,l=n>=0;if(null==e)return 0;let s=Array.from(e.content.children),d=Array.from(e.gutter.children);if(s.length!==d.length)throw Error("FileDiff.trimColumnRows: columns do not match");for(;o<s.length&&(!(t<=0)||l||a);){let e=d[o],u=s[o];if(o++,!(e instanceof HTMLElement)||!(u instanceof HTMLElement))throw console.error({gutterElement:e,contentElement:u}),Error("FileDiff.trimColumnRows: invalid row elements");if(a&&(a=!1,"annotation"===e.dataset.gutterBuffer&&"lineAnnotation"in u.dataset||"metadata"===e.dataset.gutterBuffer&&"noNewline"in u.dataset)){e.remove(),u.remove(),r++;continue}if("lineIndex"in e.dataset&&"lineIndex"in u.dataset){(t>0||l&&i>=n)&&(e.remove(),u.remove(),t>0&&0==--t&&(a=!0),r++),i++;continue}if("separator"in e.dataset&&"separator"in u.dataset||"annotation"===e.dataset.gutterBuffer&&"lineAnnotation"in u.dataset||"metadata"===e.dataset.gutterBuffer&&"noNewline"in u.dataset){(t>0||l&&i>=n)&&(e.remove(),u.remove(),r++);continue}if("buffer"===e.dataset.gutterBuffer&&"contentBuffer"in u.dataset){let o=this.getBufferSize(u.dataset);if(null==o)throw Error("FileDiff.trimColumnRows: invalid element");if(t>0){let n=Math.min(t,o),i=o-n;i>0?(this.updateBufferSize(e,i),this.updateBufferSize(u,i),r+=n):(e.remove(),u.remove(),r+=o),0==(t-=n)&&0===i&&(a=!0)}else if(l){let t=i,a=i+o-1;if(n<=t)e.remove(),u.remove(),r+=o;else if(n<=a){let t=a-n+1,i=o-t;this.updateBufferSize(e,i),this.updateBufferSize(u,i),r+=t}}i+=o;continue}throw console.error({gutterElement:e,contentElement:u}),Error("FileDiff.trimColumnRows: unknown row elements")}return r}trimColumns({columns:e,diffStyle:t,overlapEnd:n,overlapStart:i,previousStart:r,trimEnd:o,trimStart:a}){let l=Math.max(0,i-r),s=n-r;if(s<0)throw Error("FileDiff.trimColumns: overlap ends before previous");let d=a>0,u=o>0;if(!d&&!u)return 0;let h=d?l:0,c=u?s:-1;if("unified"===t&&!Array.isArray(e))return this.trimColumnRows(e,h,c);if("split"===t&&Array.isArray(e)){let t=this.trimColumnRows(e[0],h,c),n=this.trimColumnRows(e[1],h,c);if(null!=e[0]&&null!=e[1]&&t!==n)throw Error("FileDiff.trimColumns: split columns out of sync");return null!=e[0]?t:n}throw console.error({diffStyle:t,columns:e}),Error("FileDiff.trimColumns: Invalid columns for diffType")}getBufferSize(e){let t=Number.parseInt(e?.bufferSize??"",10);return Number.isNaN(t)?void 0:t}updateBufferSize(e,t){e.dataset.bufferSize=`${t}`,e.style.setProperty("grid-row",`span ${t}`),e.style.setProperty("min-height",`calc(${t} * 1lh)`)}getColumnPair(e){if(null==e)return;let t=e.children[0],n=e.children[1];if(t instanceof HTMLElement&&n instanceof HTMLElement&&null!=t.dataset.gutter&&null!=n.dataset.content)return{gutter:t,content:n}}getCodeColumns(e,t,n,i){if("unified"===e)return this.getColumnPair(t);{let e=this.getColumnPair(n),t=this.getColumnPair(i);return null!=e||null!=t?[e,t]:void 0}}updateBuffers(e){null!=this.pre&&this.applyBuffers(this.pre,e)}applyBuffers(e,t){if(null==t||this.shouldDisableVirtualizationBuffers()){null!=this.bufferBefore&&(this.bufferBefore.remove(),this.bufferBefore=void 0),null!=this.bufferAfter&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(null==this.bufferBefore&&(this.bufferBefore=document.createElement("div"),this.bufferBefore.dataset.virtualizerBuffer="before",e.before(this.bufferBefore)),this.bufferBefore.style.setProperty("height",`${t.bufferBefore}px`),this.bufferBefore.style.setProperty("contain","strict")):null!=this.bufferBefore&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(null==this.bufferAfter&&(this.bufferAfter=document.createElement("div"),this.bufferAfter.dataset.virtualizerBuffer="after",e.after(this.bufferAfter)),this.bufferAfter.style.setProperty("height",`${t.bufferAfter}px`),this.bufferAfter.style.setProperty("contain","strict")):null!=this.bufferAfter&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyPreNodeAttributes(e,{additionsContentAST:t,deletionsContentAST:n,totalLines:i},r){var o;let{diffIndicators:a="bars",disableBackground:l=!1,disableLineNumbers:s=!1,overflow:d="scroll",diffStyle:u="split"}=this.options,h={type:"diff",diffIndicators:a,disableBackground:l,disableLineNumbers:s,overflow:d,split:"unified"!==u&&null!=t&&null!=n,totalLines:i,customProperties:r};o=this.appliedPreAttributes,(null==h||null==o?h!==o:!function(e=ti,t=ti){if(e===t)return!0;let n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(let i of n)if(e[i]!==t[i])return!1;return!0}(h.customProperties,o.customProperties)||h.type!==o.type||h.diffIndicators!==o.diffIndicators||h.disableBackground!==o.disableBackground||h.disableLineNumbers!==o.disableLineNumbers||h.overflow!==o.overflow||h.split!==o.split||h.totalLines!==o.totalLines)&&(!function(e,{type:t,diffIndicators:n,disableBackground:i,disableLineNumbers:r,overflow:o,split:a,totalLines:l,customProperties:s}){if(null!=s)for(let t in s){let n=s[t];null!=n&&e.setAttribute(t,`${n}`)}switch("diff"===t?(e.setAttribute("data-diff",""),e.removeAttribute("data-file")):(e.setAttribute("data-file",""),e.removeAttribute("data-diff")),n){case"bars":case"classic":e.setAttribute("data-indicators",n);break;case"none":e.removeAttribute("data-indicators")}r?e.setAttribute("data-disable-line-numbers",""):e.removeAttribute("data-disable-line-numbers"),i?e.removeAttribute("data-background"):e.setAttribute("data-background",""),"diff"===t?e.setAttribute("data-diff-type",a?"split":"single"):e.removeAttribute("data-diff-type"),e.setAttribute("data-overflow",o),e.style.setProperty("--diffs-min-number-column-width-default",`${`${l}`.length}ch`)}(e,h),this.appliedPreAttributes=h)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let n=t.shadowRoot??t.attachShadow({mode:"open"});this.errorWrapper??=document.createElement("div"),this.errorWrapper.dataset.errorWrapper="",this.errorWrapper.textContent="",n.appendChild(this.errorWrapper);let i=document.createElement("div");i.dataset.errorMessage="",i.innerText=e.message,this.errorWrapper.appendChild(i);let r=document.createElement("pre");r.dataset.errorStack="",r.innerText=e.stack??"No Error Stack",this.errorWrapper.appendChild(r)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function nH(e,t){return null==e||null==t?null==e&&null==t:eU(e,t)}function nO(e){if(null!=e&&"element"===e.type)return e.children??[]}let n$=-1;var nF=class extends nD{__id=`little-virtualized-file-diff:${++n$}`;top;height=0;metrics;cache={heightDeltas:new Map,measuredHeightDeltaTotal:0,estimatedSplitHeight:void 0,estimatedUnifiedHeight:void 0,checkpoints:[],totalLines:0,fileAnnotationHeight:0};isVisible=!1;isSetup=!1;virtualizer;layoutDirty=!0;forceRenderOverride;currentCollapsed;currentExpandUnchanged;pendingHydratedDiff;pendingExpansions;constructor(e,t,n,i,r=!1){super(e,i,r),this.virtualizer=t,this.metrics=es(n)}setMetrics(e,t=!1){let n=es(e);!t&&J(this.metrics,n)||(this.metrics=n,this.resetLayoutCache({includeEstimatedHeights:!0}))}setLineAnnotations(e){this.syncLineAnnotations(e)&&this.resetLayoutCache({includeEstimatedHeights:!1})}syncLineAnnotations(e){return null!=e&&e!==this.lineAnnotations&&(0!==e.length||0!==this.lineAnnotations.length)&&(super.setLineAnnotations(e),!0)}setFileAnnotationHeight(e){let t=this.cache.fileAnnotationHeight;return e!==t&&(this.cache.fileAnnotationHeight=e,this.cache.measuredHeightDeltaTotal+=e-t,!0)}hasFileAnnotations(e=this.fileDiff){var t;return null!=e&&(t=this.lineAnnotations,!!t?.some(e=>0===e.lineNumber))&&this.lineAnnotations.some(t=>0===t.lineNumber&&("new"===e.type?"additions"===t.side:"deleted"!==e.type||"deletions"===t.side))}getLineHeight(e,t=!1){return this.getEstimatedLineHeight(t)+(this.cache.heightDeltas.get(e)??0)}getEstimatedLineHeight(e=!1){return this.metrics.lineHeight*(e?2:1)}setOptions(e){var t,n,i,r;if(this.isAdvancedMode())throw Error("VirtualizedFileDiff.setOptions cannot be used inside CodeView. Update CodeView options instead.");if(null==e)return;let{options:o}=this,a=!et(o,e),l=a&&(t=o,n=e,(t.diffStyle??"split")!==(n.diffStyle??"split")||(t.overflow??"scroll")!==(n.overflow??"scroll")||(t.collapsed??!1)!==(n.collapsed??!1)||(t.disableLineNumbers??!1)!==(n.disableLineNumbers??!1)||(t.disableFileHeader??!1)!==(n.disableFileHeader??!1)||(t.diffIndicators??"bars")!==(n.diffIndicators??"bars")||(t.hunkSeparators??"line-info")!==(n.hunkSeparators??"line-info")||!!t.loadDiffFiles!=!!n.loadDiffFiles||(t.expandUnchanged??!1)!==(n.expandUnchanged??!1)||(t.collapsedContextThreshold??1)!==(n.collapsedContextThreshold??1)||t.unsafeCSS!==n.unsafeCSS);super.setOptions(e),l&&this.resetLayoutCache({forceSimpleRecompute:!0,includeEstimatedHeights:(i=o,r=e,(i.disableFileHeader??!1)!==(r.disableFileHeader??!1)||(i.hunkSeparators??"line-info")!==(r.hunkSeparators??"line-info")||!!i.loadDiffFiles!=!!r.loadDiffFiles||(i.expandUnchanged??!1)!==(r.expandUnchanged??!1)||(i.collapsedContextThreshold??1)!==(r.collapsedContextThreshold??1))}),a&&(this.forceRenderOverride=!0),a&&this.isSimpleMode()&&this.virtualizer.instanceChanged(this,l)}setThemeType(e){if(this.isAdvancedMode())throw Error("VirtualizedFileDiff.setThemeType cannot be used inside CodeView. Update CodeView options instead.");super.setThemeType(e)}resetLayoutCache({forceSimpleRecompute:e=!1,includeEstimatedHeights:t=!1,resetRenderRange:n=!0}={}){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heightDeltas.size>0&&this.cache.heightDeltas.clear(),0!==this.cache.measuredHeightDeltaTotal&&(this.cache.measuredHeightDeltaTotal=0),this.invalidateDerivedLayoutCache(t,n),e&&this.isSimpleMode()&&this.computeApproximateSize()}invalidateDerivedLayoutCache(e,t=!0){this.layoutDirty=!0,this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),0!==this.cache.totalLines&&(this.cache.totalLines=0),e&&(this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0),null!=this.renderRange&&t&&(this.renderRange=void 0)}reconcileHeights(){let e=!1,{overflow:t="scroll"}=this.options;if(null==this.fileContainer||null==this.fileDiff)return 0!==this.height&&(e=!0),this.height=0,e;if(this.top=this.getVirtualizedTop(),"scroll"===t&&0===this.lineAnnotations.length&&!this.isResizeDebuggingEnabled())return e;let n=this.getDiffStyle(),i="split"===n?[this.codeDeletions,this.codeAdditions]:[this.codeUnified],r=this.hasFileAnnotations(this.fileDiff);if(null!=this.renderRange&&r&&tL(this.renderRange)){let t=function(e){let t;for(let n of e){if(null==n)continue;let e=n.children[1];if(e instanceof HTMLElement)for(let n of e.children)n instanceof HTMLElement&&"-1,-1"===n.dataset.lineAnnotation&&(t=Math.max(t??0,n.getBoundingClientRect().height))}return t}(i)??0;this.setFileAnnotationHeight(t)&&(e=!0)}else!r&&this.setFileAnnotationHeight(0)&&(e=!0);for(let t of i){if(null==t)continue;let i=t.children[1];if(i instanceof HTMLElement)for(let t of i.children){if(!(t instanceof HTMLElement))continue;let i=t.dataset.lineIndex;if(null==i)continue;let r=function(e,t){let[n,i]=e.split(",").map(Number);return"split"===t?i:n}(i,n),o=t.getBoundingClientRect().height,a=!1;t.nextElementSibling instanceof HTMLElement&&("lineAnnotation"in t.nextElementSibling.dataset||"noNewline"in t.nextElementSibling.dataset)&&("noNewline"in t.nextElementSibling.dataset&&(a=!0),o+=t.nextElementSibling.getBoundingClientRect().height);let l=this.getEstimatedLineHeight(a),s=this.cache.heightDeltas.get(r)??0,d=o-l;d!==s&&(e=!0,this.cache.measuredHeightDeltaTotal+=d-s,0===d?this.cache.heightDeltas.delete(r):this.cache.heightDeltas.set(r,d))}}return(e||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),e}onRender=e=>null!=this.fileContainer&&(e&&(this.top=this.getVirtualizedTop()),this.render());flushManagers(){super.flushManagers(),this.lineStateRefreshPending&&this.flushDeferredLineState()}prepareCodeViewItem(e,t,n,i){let r=!tV(this.fileDiff,e),o=this.syncLineAnnotations(i),a=n?.resetDiffLayoutCache===!0||r||o,l=r||n?.resetDiffLayoutCache===!0&&n.includeEstimatedDiffHeights;n?.metrics!=null&&(this.metrics=es(n.metrics),a=!0,l=!0);let{collapsed:s=!1,expandUnchanged:d=!1}=this.options;return this.currentCollapsed!==s&&(this.currentCollapsed=s,a=!0),this.currentExpandUnchanged!==d&&(this.currentExpandUnchanged=d,a=!0,l=!0),a&&this.resetLayoutCache({includeEstimatedHeights:l}),this.fileDiff=e,this.top=t,this.computeApproximateSize(),this.height}getLinePosition(e,t="additions"){let n;if(null==this.fileDiff||e<1)return;let i=this.getLineIndex(e,t);if(null==i)return;let{disableFileHeader:r=!1,expandUnchanged:o=!1,collapsed:a=!1,collapsedContextThreshold:l=1}=this.options,s=this.getDiffStyle(),d=this.getHunkSeparatorType(),u="split"===s?i[1]:i[0];this.approximateLayoutCheckpoints();let h=ed(this.metrics,r),c=this.getLayoutCheckpointBeforeLineIndex(u),f=c?.top??h+this.cache.fileAnnotationHeight;return a?{top:h,height:0}:(tm({diff:this.fileDiff,diffStyle:s,startingLine:c?.renderedLineIndex??0,expandedHunks:!!o||this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:l,callback:({hunkIndex:e,hunk:t,collapsedBefore:i,collapsedAfter:r,deletionLine:o,additionLine:a})=>{let l="split"===s?a?.splitLineIndex??o?.splitLineIndex:a?.unifiedLineIndex??o?.unifiedLineIndex;if(null==l)throw Error("VirtualizedFileDiff.getLinePosition: missing line index data");if(i>0){let r=ev({type:d,metrics:this.metrics,hunkIndex:e,hunkSpecs:t?.hunkSpecs});if(null!=r){if(f+=r.gapBefore,u>=l-i&&u<l)return n={top:f,height:r.height},!0;f+=r.height+r.gapAfter}}let h=this.getLineHeight(l,(a?.noEOFCR??!1)||(o?.noEOFCR??!1));if(l===u)return n={top:f,height:h},!0;if(f+=h,r>0){let e=ey({type:d,metrics:this.metrics});if(null!=e){if(u>l&&u<=l+r)return n={top:f+e.gapBefore,height:e.height},!0;f+=e.totalHeight}}return!1}}),n)}getEditorViewport(){return"simple"===this.virtualizer.type?this.virtualizer.getRoot():this.virtualizer.getContainerElement()}getNumericScrollAnchor(e){let t;if(null==this.fileDiff)return;let{disableFileHeader:n=!1,expandUnchanged:i=!1,collapsed:r=!1,collapsedContextThreshold:o=1}=this.options;if(r)return;let a=this.getDiffStyle(),l=this.getHunkSeparatorType();this.approximateLayoutCheckpoints();let s=this.getLayoutCheckpointBeforeTop(e),d=s?.top??ed(this.metrics,n)+this.cache.fileAnnotationHeight;return tm({diff:this.fileDiff,diffStyle:a,startingLine:s?.renderedLineIndex??0,expandedHunks:!!i||this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:o,callback:({hunkIndex:n,hunk:i,collapsedBefore:r,collapsedAfter:o,deletionLine:s,additionLine:u})=>{let h="split"===a?u?.splitLineIndex??s?.splitLineIndex:u?.unifiedLineIndex??s?.unifiedLineIndex;if(null==h)throw Error("VirtualizedFileDiff.getNumericScrollAnchor: missing line index data");if(r>0){let e=ev({type:l,metrics:this.metrics,hunkIndex:n,hunkSpecs:i?.hunkSpecs});null!=e&&(d+=e.totalHeight)}if(d>=e&&(null!=s?t={lineNumber:s.lineNumber,side:"deletions",top:d}:null!=u&&(t={lineNumber:u.lineNumber,side:"additions",top:d}),null!=t))return!0;let c=this.getLineHeight(h,(u?.noEOFCR??!1)||(s?.noEOFCR??!1));if(d+=c,o>0){let e=ey({type:l,metrics:this.metrics});null!=e&&(d+=e.totalHeight)}return!1}}),t}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){if(null==this.top||null==this.fileDiff)return;if(!0===this.options.collapsed)return{topOffset:this.top,height:this.height};let t=null!=e?this.computeRenderRangeFromWindow(this.fileDiff,this.top,e):this.renderRange;if(null==t)return;let{bufferBefore:n,bufferAfter:i,totalLines:r}=t,o=0;if(0===r){let t=e??this.virtualizer.getWindowSpecs();this.top<t.top&&(o=i)}return{topOffset:this.top+n+o,height:this.height-(n+i)}}cleanUp(e=!1){null!=this.fileContainer&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||(this.resetLayoutCache({includeEstimatedHeights:!0}),this.pendingExpansions=void 0,this.pendingHydratedDiff=void 0),this.isSetup=!1,super.cleanUp(e)}expandHunk=(e,t,n)=>{null!=this.fileDiff&&(this.isAdvancedMode()?(this.pendingExpansions??=[],this.pendingExpansions.push({hunkIndex:e,direction:t,expansionLineCountOverride:n})):(this.hunksRenderer.expandHunk(e,t,n),this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()),this.loadFilesIfNecessary(),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))};async handleFilesLoaded(e,t){if(this.fileDiff===e&&e.isPartial){if(this.isAdvancedMode()){let n=tf("clone",e,t);if(await tu(()=>this.primeHighlightCache(n)),!this.enabled||this.fileDiff!==e)return;this.pendingHydratedDiff={expectedDiff:e,nextDiff:n,files:t}}else{if(tf("merge",e,t),this.setHydratedState(t),await tu(()=>this.primeHighlightCache(e)),!this.enabled||this.fileDiff!==e)return;this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}}consumeCodeViewLayoutChanges(e){let t,n=!1,{pendingExpansions:i,pendingHydratedDiff:r}=this;if(null!=i)for(let e of(this.pendingExpansions=void 0,i))this.hunksRenderer.expandHunk(e.hunkIndex,e.direction,e.expansionLineCountOverride),n=!0;return null!=r&&(this.pendingHydratedDiff=void 0,r.expectedDiff===e&&(this.setHydratedState(r.files),t=r.nextDiff)),null!=t?(this.forceRenderOverride=!0,this.resetLayoutCache({includeEstimatedHeights:!0})):n&&(this.forceRenderOverride=!0,this.invalidateDerivedLayoutCache(!0)),t}loadFilesIfNecessary(){if(null!=this.pendingHydratedDiff){if(this.pendingHydratedDiff.expectedDiff===this.fileDiff)return;this.pendingHydratedDiff=void 0}super.loadFilesIfNecessary()}isLineRenderable(e){if(super.isLineRenderable(e))return!0;let{pendingExpansions:t}=this,n=this.fileDiffCache;if(null==t||0===t.length||null==n)return!1;let{expansionLineCount:i=100,collapsedContextThreshold:r=1}=this.options,o=new Map(this.hunksRenderer.getExpandedHunksMap());for(let e of t){let t={...o.get(e.hunkIndex)??{fromStart:0,fromEnd:0}},n=e.expansionLineCountOverride??i;("up"===e.direction||"both"===e.direction)&&(t.fromStart+=n),("down"===e.direction||"both"===e.direction)&&(t.fromEnd+=n),o.set(e.hunkIndex,t)}return eg({fileDiff:n,lineNumber:e,expandedHunks:o,collapsedContextThreshold:r})}invalidateEditSessionLayout(){this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1}),this.isSimpleMode()||this.computeApproximateSize(!0),this.getSimpleVirtualizer()?.requestHeightReconcile(this)}escalateEditSessionRender(){this.invalidateEditSessionLayout(),this.enabled&&null!=this.fileDiff&&(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))}shouldSelfHealEditSession(){return!this.isAdvancedMode()&&super.shouldSelfHealEditSession()}setVisibility(e){this.isAdvancedMode()||null==this.fileContainer||(this.renderRange=void 0,e&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){this.enabled&&(null!=this.fileDiff||null!=this.additionFile||null!=this.deletionFile)&&(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!1))}applyDocumentChange(e,t,n=!1){let{renderRange:i}=this;if(this.getAdvancedVirtualizer()?.capturePendingLayoutAnchor(),super.applyDocumentChange(e,t),this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1}),this.isSimpleMode()){if(n&&void 0!==i&&void 0!==this.fileDiff){let e=this.virtualizer.getWindowSpecs(),t=this.computeRenderRangeFromWindow(this.fileDiff,this.top??0,e);t.bufferAfter!==i.bufferAfter&&this.updateBuffers(t)}}else this.computeApproximateSize(!0);this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}computeApproximateSize(e=!1,t=this.fileDiff){let n=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!n)return;let i=0===this.height;if(this.height=0,this.cache.checkpoints=[],this.cache.totalLines=0,null==t){this.layoutDirty=!1;return}let{disableFileHeader:r=!1,collapsed:o=!1}=this.options,a=ed(this.metrics,r);if(this.height+=a,o){this.layoutDirty=!1;return}this.height=this.getActiveEstimatedHeight(t)+this.cache.measuredHeightDeltaTotal,n&&!i&&this.validateComputedHeight(t),this.layoutDirty=!1}getActiveEstimatedHeight(e=this.fileDiff){this.ensureEstimatedDiffHeights(e);let t="split"===this.getDiffStyle()?this.cache.estimatedSplitHeight:this.cache.estimatedUnifiedHeight;if(null==t)throw Error("VirtualizedFileDiff.getActiveEstimatedHeight: missing estimated height");return t}ensureEstimatedDiffHeights(e=this.fileDiff){if(null==e){this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0;return}if(null!=this.cache.estimatedSplitHeight&&null!=this.cache.estimatedUnifiedHeight)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsedContextThreshold:i=1}=this.options,{splitHeight:r,unifiedHeight:o}=function({fileDiff:e,metrics:t,disableFileHeader:n,hunkSeparators:i,expandUnchanged:r,expandedHunks:o,collapsedContextThreshold:a,canHydratePartialDiff:l}){let s=ed(t,n),d=s,u=!!r||o,h=e.hunks.length-1;for(let n=0;n<e.hunks.length;n++){let r=e.hunks[n];if(null==r)throw Error("computeEstimatedDiffHeights: invalid hunk index");let o=ec({isPartial:e.isPartial,rangeSize:r.collapsedBefore,expandedHunks:u,hunkIndex:n,collapsedContextThreshold:a}),c=(o.fromStart+o.fromEnd)*t.lineHeight;if(s+=c,d+=c,o.collapsedLines>0){let e=ev({type:i,metrics:t,hunkIndex:n,hunkSpecs:r.hunkSpecs})?.totalHeight??0;s+=e,d+=e}s+=r.splitLineCount*t.lineHeight,d+=r.unifiedLineCount*t.lineHeight;let f=function(e){if(!e.noEOFCRAdditions&&!e.noEOFCRDeletions)return{split:0,unified:0};let t=e.hunkContent.at(-1);if(null==t)return{split:0,unified:0};if("context"===t.type){let e=+(t.lines>0);return{split:e,unified:e}}return function(e,t){let n=(t.deletions>0&&e.noEOFCRDeletions?1:0)+(t.additions>0&&e.noEOFCRAdditions?1:0),i=t.deletions>0&&e.noEOFCRDeletions,r=t.additions>0&&e.noEOFCRAdditions;return{split:i||r?1:0,unified:n}}(e,t)}(r);s+=f.split*t.lineHeight,d+=f.unified*t.lineHeight;let p=n===h?ep({fileDiff:e,hunkIndex:n,expandedHunks:u,collapsedContextThreshold:a,errorPrefix:"computeEstimatedDiffHeights"}):void 0;if(null!=p){let e=(p.fromStart+p.fromEnd)*t.lineHeight;if(s+=e,d+=e,p.collapsedLines>0){let e=ey({type:i,metrics:t})?.totalHeight??0;s+=e,d+=e}}else if(n===h&&e.isPartial&&l){let e=ey({type:i,metrics:t})?.totalHeight??0;s+=e,d+=e}}if(e.hunks.length>0){let e=eu(t);s+=e,d+=e}return{splitHeight:s,unifiedHeight:d}}({fileDiff:e,metrics:this.metrics,disableFileHeader:t,hunkSeparators:this.getHunkSeparatorType(),expandUnchanged:n,expandedHunks:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i,canHydratePartialDiff:nB(e,null!=this.options.loadDiffFiles)});this.cache.estimatedSplitHeight=r,this.cache.estimatedUnifiedHeight=o}validateComputedHeight(e=this.fileDiff){if(null==this.fileContainer||null==e)return;let t=this.fileContainer.getBoundingClientRect();t.height!==this.height?console.log("VirtualizedFileDiff.computeApproximateSize: computed height doesnt match",{name:e.name,elementHeight:t.height,computedHeight:this.height}):console.log("VirtualizedFileDiff.computeApproximateSize: computed height IS CORRECT")}render({fileContainer:e,fileDiff:t,forceRender:n=!1,lineAnnotations:i,...r}={}){let o=th(r,"VirtualizedFileDiff.render"),a=null!=o,l=o?.oldFile,s=o?.newFile,d=a&&(!nG(l,this.deletionFile)||!nG(s,this.additionFile)),u=t??this.fileDiff;null==t&&a&&(d||null==this.fileDiff)&&(u=V(o.oldFile,o.newFile,this.options.parseDiffOptions));let{forceRenderOverride:h,isSetup:c}=this;this.forceRenderOverride=void 0;let f=this.syncLineAnnotations(i);f&&this.resetLayoutCache({includeEstimatedHeights:!1});let p=null!=t&&t!==this.fileDiff,g=null!=u&&!tV(this.fileDiff,u);if(g&&this.resetLayoutCache({includeEstimatedHeights:!0}),e=this.getOrCreateFileContainer(e),null==u)return console.error("VirtualizedFileDiff.render: attempting to virtually render when we dont have the correct data"),!1;if(c)this.top??=this.getVirtualizedTop(),g&&(this.getSimpleVirtualizer()?.markDOMDirty(),this.computeApproximateSize(!1,u));else{this.computeApproximateSize(!1,u);let t=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(null==t)throw Error("VirtualizedFileDiff.render: simple virtualizer is not available");t.connect(e,this),this.isVisible=t.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode()&&(!(p||d)||!c))return this.fileDiff=u,null!=o&&(this.deletionFile=l,this.additionFile=s),g&&(this.cachedHeaderHTML=void 0),this.renderPlaceholder(this.height);let m=this.virtualizer.getWindowSpecs(),b=this.top??0,v=this.computeRenderRangeFromWindow(u,b,m),y=super.render({fileDiff:u,fileContainer:e,renderRange:v,lineAnnotations:i,forceRender:(h??n)||f||g,...o,...r});return this.isSimpleMode()&&y&&this.getSimpleVirtualizer()?.requestHeightReconcile(this),y}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}shouldGuardRebuildScroll(){return!1}isSimpleMode(){return"simple"===this.virtualizer.type}isAdvancedMode(){return"advanced"===this.virtualizer.type}getVirtualizedTop(){return"advanced"===this.virtualizer.type?this.virtualizer.getLocalTopForInstance(this):null!=this.fileContainer?this.virtualizer.getOffsetInScrollContainer(this.fileContainer):0}getSimpleVirtualizer(){return"simple"===this.virtualizer.type?this.virtualizer:void 0}getAdvancedVirtualizer(){return"advanced"===this.virtualizer.type?this.virtualizer:void 0}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}getDiffStyle(){return this.options.diffStyle??"split"}getHunkSeparatorType(){var e;return"function"==typeof(e=this.options.hunkSeparators)?"custom":e??"line-info"}approximateLayoutCheckpoints(e=this.fileDiff){if(!this.layoutDirty&&this.cache.checkpoints.length>0||null==e||0===e.hunks.length||!0===this.options.collapsed)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsedContextThreshold:i=1}=this.options,r=e.hunks.length-1,o=nB(e,null!=this.options.loadDiffFiles),a=this.getDiffStyle(),l=this.getHunkSeparatorType(),s=!!n||this.hunksRenderer.getExpandedHunksMap(),d=function(e){let t=Array.from(e).sort((e,t)=>e[0]-t[0]),n=[],i=[0],r=0;for(let[e,o]of t)n.push(e),r+=o,i.push(r);return{lineIndexes:n,prefixTotals:i}}(this.cache.heightDeltas),u=ed(this.metrics,t)+this.cache.fileAnnotationHeight,h=0,c=({rowCount:e,startLineIndex:t,preSeparatorHeight:n=0,postSeparatorHeight:i=0,metadataOffsets:r=[]})=>{if(e<=0)return;let o=h,a=h+e,l=3e3*Math.ceil(o/3e3);for(;l<a;){let e=l-o,i=u+(e>0?n:0)+e*this.metrics.lineHeight+function(e,t){let n=0;for(let i of e)i<t&&n++;return n}(r,e)*this.metrics.lineHeight+nz(d,t,t+e);this.cache.checkpoints.push({renderedLineIndex:l,lineIndex:t+e,top:i}),l+=3e3}u+=n+e*this.metrics.lineHeight+r.length*this.metrics.lineHeight+nz(d,t,t+e)+i,h=a};for(let t=0;t<e.hunks.length;t++){let n=e.hunks[t];if(null==n)throw Error("VirtualizedFileDiff.approximateLayoutCheckpoints: invalid hunk index");let d=ec({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:s,hunkIndex:t,collapsedContextThreshold:i}),u=d.collapsedLines>0?ev({type:l,metrics:this.metrics,hunkIndex:t,hunkSpecs:n.hunkSpecs})?.totalHeight??0:0;c({rowCount:d.fromStart,startLineIndex:("split"===a?n.splitLineStart:n.unifiedLineStart)-d.rangeSize});let h=u;c({rowCount:d.fromEnd,startLineIndex:("split"===a?n.splitLineStart:n.unifiedLineStart)-d.fromEnd,preSeparatorHeight:h}),d.fromEnd>0&&(h=0);let f=t===r?ep({fileDiff:e,hunkIndex:t,expandedHunks:s,collapsedContextThreshold:i,errorPrefix:"VirtualizedFileDiff"}):void 0,p=null!=f&&f.collapsedLines>0||t===r&&o?ey({type:l,metrics:this.metrics})?.totalHeight??0:0,g=null!=f?f.fromStart+f.fromEnd:0,m="split"===a?n.splitLineCount:n.unifiedLineCount,b="split"===a?n.splitLineStart:n.unifiedLineStart;c({rowCount:m,startLineIndex:b,preSeparatorHeight:h,postSeparatorHeight:0===g?p:0,metadataOffsets:function({diffStyle:e,hunk:t,rowCount:n}){if(n<=0||!t.noEOFCRAdditions&&!t.noEOFCRDeletions)return[];let i=t.hunkContent.at(-1);if(null==i)return[];if("context"===i.type)return[n-1];let r=Math.max(i.deletions,i.additions),o=i.deletions+i.additions;if("split"===e)return r>0&&(t.noEOFCRAdditions||t.noEOFCRDeletions)?[n-1]:[];let a=[];return i.deletions>0&&t.noEOFCRDeletions&&a.push(n-o+i.deletions-1),i.additions>0&&t.noEOFCRAdditions&&a.push(n-1),a}({diffStyle:a,hunk:n,rowCount:m})}),null!=f&&g>0&&c({rowCount:g,startLineIndex:b+m,postSeparatorHeight:p})}this.cache.totalLines=h}getLayoutCheckpointBeforeLineIndex(e){let t;if(e<=0||0===this.cache.checkpoints.length)return;let n=0,i=this.cache.checkpoints.length-1;for(;n<=i;){let r=n+i>>1,o=this.cache.checkpoints[r];if(null==o)throw Error("VirtualizedFileDiff: invalid checkpoint index");o.lineIndex<=e?(t=o,n=r+1):i=r-1}return t}getLayoutCheckpointBeforeTop(e,t){let n=0,i=this.cache.checkpoints.length-1,r=-1;for(;n<=i;){let t=n+i>>1,o=this.cache.checkpoints[t];if(null==o)throw Error("VirtualizedFileDiff: invalid checkpoint index");o.top<=e?(r=t,n=t+1):i=t-1}if(null==t)return r>=0?this.cache.checkpoints[r]:void 0;for(let e=r;e>=0;e--){let n=this.cache.checkpoints[e];if(null==n)throw Error("VirtualizedFileDiff: invalid checkpoint index");if(n.renderedLineIndex%t==0)return n}}getExpandedLineCount(e,t){let n=0;if(e.isPartial){for(let i of e.hunks)n+="split"===t?i.splitLineCount:i.unifiedLineCount;return n}let{expandUnchanged:i=!1,collapsedContextThreshold:r=1}=this.options,o=!!i||this.hunksRenderer.getExpandedHunksMap();for(let[i,a]of e.hunks.entries()){n+="split"===t?a.splitLineCount:a.unifiedLineCount;let l=Math.max(a.collapsedBefore,0),{fromStart:s,fromEnd:d,renderAll:u}=ec({isPartial:e.isPartial,rangeSize:l,expandedHunks:o,hunkIndex:i,collapsedContextThreshold:r});l>0&&(n+=u?l:s+d)}let a=ep({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:o,collapsedContextThreshold:r,errorPrefix:"VirtualizedFileDiff"});return null!=a&&(n+=a.fromStart+a.fromEnd),n}getLayoutLineCount(e,t){return Math.max(this.getExpandedLineCount(e,t),"split"===t?e.splitLineCount:e.unifiedLineCount,e.additionLines.length,e.deletionLines.length,this.cache.totalLines)}computeRenderRangeFromWindow(e,t,{top:n,bottom:i}){let r,o,a,{disableFileHeader:l=!1,expandUnchanged:s=!1,collapsedContextThreshold:d=1}=this.options,{hunkLineCount:u,lineHeight:h}=this.metrics,c=this.getDiffStyle(),f=this.getHunkSeparatorType(),p=nB(e,null!=this.options.loadDiffFiles),g=this.height,m=this.getLayoutLineCount(e,c),b=ed(this.metrics,l),v=e.hunks.length>0?eu(this.metrics):0,{fileAnnotationHeight:y}=this.cache,C=b+y,S=Math.max(0,g-b-y-v),k=this.hasFileAnnotations(e),x=t+b;if(t<n-g||t>i)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:g-b-v};if(m<=u||0===e.hunks.length)return{startingLine:0,totalLines:u,bufferBefore:0,bufferAfter:0};this.approximateLayoutCheckpoints(e),m=this.getLayoutLineCount(e,c);let w=Math.ceil(Math.ceil(Math.max(i-n,0)/h)/u)*u+u,L=w/u,A=[],E=(n+i)/2,R=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-w*h*2),u),_=t+(R?.top??C),T=R?.renderedLineIndex??0;if(tm({diff:e,diffStyle:c,startingLine:R?.renderedLineIndex??0,expandedHunks:!!s||this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:d,callback:({hunkIndex:l,hunk:s,collapsedBefore:d,collapsedAfter:h,deletionLine:g,additionLine:m})=>{let b=null!=m?m.splitLineIndex:g.splitLineIndex,v=null!=m?m.unifiedLineIndex:g.unifiedLineIndex,y=(m?.noEOFCR??!1)||(g?.noEOFCR??!1),S=l===e.hunks.length-1&&null!=s&&("split"===c?b===s.splitLineStart+s.splitLineCount-1:v===s.unifiedLineStart+s.unifiedLineCount-1),k=(d>0?ev({type:f,metrics:this.metrics,hunkIndex:l,hunkSpecs:s?.hunkSpecs}):void 0)?.totalHeight??0;_+=k;let x=T%u==0,w=Math.floor(T/u);if(x&&(A[w]=_-(t+C+k),null!=a)){if(a<=0)return!0;a--}let R=this.getLineHeight("split"===c?b:v,y);if(_>n-R&&_<i&&(r??=w),null==o&&_+R>E&&(o=w),null==a&&_>=i&&x&&(a=L),T++,_+=R,h>0||S&&p){let e=ey({type:f,metrics:this.metrics});null!=e&&(_<i&&_+e.totalHeight>n&&(r??=w),null==o&&_+e.totalHeight>E&&(o=w),_+=e.totalHeight)}return!1}}),null==r)if(!(y>0)||!k||!(x<i)||!(x+y>n))return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:g-b-v};else r=0,o=0;let I=Math.round((o??=r)-L/2),M=Math.max(0,Math.min(I,Math.max(0,Math.ceil(m/u)-L))),P=M*u,N=I<0?w+I*u:w,D=A[M]??0,H=M+N/u;return{startingLine:P,totalLines:N,bufferBefore:0===P?0:y+D,bufferAfter:Math.max(0,H<A.length?S-A[H]:S-(_-t-C))}}};function nz({lineIndexes:e,prefixTotals:t},n,i){if(n>=i||0===e.length)return 0;let r=nU(e,n);return(t[nU(e,i)]??0)-(t[r]??0)}function nU(e,t){let n=0,i=e.length;for(;n<i;){let r=n+i>>1,o=e[r];if(null==o)throw Error("VirtualizedFileDiff: invalid prefix index");o<t?n=r+1:i=r}return n}function nB(e,t){return e.isPartial&&t&&("change"===e.type||"rename-changed"===e.type)}function nG(e,t){return null==e||null==t?null==e&&null==t:eU(e,t)}var nj=n(4041);let nW=(0,nj.createContext)(void 0),nV=(0,nj.createContext)(void 0),nq=(0,nj.createContext)(void 0),nK="u"<typeof window?nj.useEffect:nj.useLayoutEffect;function nX({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:i}){return t||i||n?{...e,controlledSelection:t,renderCustomHeader:n?Z:e?.renderCustomHeader,renderGutterUtility:i?Z:e?.renderGutterUtility}:e}function nY({oldFile:e,newFile:t,options:n,editorOptions:i,metrics:r,lineAnnotations:o,selectedLines:l,className:s,style:d,prerenderedHTML:u,renderAnnotation:h,renderCustomHeader:c,renderHeaderPrefix:f,renderHeaderFilenameSuffix:p,renderHeaderMetadata:g,renderGutterUtility:b,disableWorkerPool:v=!1,edit:y=!1}){var C;let S=(0,nj.useMemo)(()=>V(e,t,n?.parseDiffOptions),[e,t,n?.parseDiffOptions]),{ref:k,getHoveredLine:x}=function({fileDiff:e,options:t,editorOptions:n,lineAnnotations:i,selectedLines:r,prerenderedHTML:o,metrics:a,hasGutterRenderUtility:l,hasCustomHeader:s,disableWorkerPool:d,edit:u}){var h;let c,f=(0,nj.useContext)(nq),p=void 0!==r,g=(0,nj.useContext)(nV),m=(0,nj.useContext)(nW),b=(0,nj.useRef)(null),v=(h=n=>{if(null!=n){if(null!=b.current)throw Error("useFileDiffInstance: An instance should not already exist when a node is created");null!=f?b.current=new nF(nX({controlledSelection:p,hasCustomHeader:s,hasGutterRenderUtility:l,options:t}),f,a,!d?g:void 0,!0):b.current=new nD(nX({controlledSelection:p,hasCustomHeader:s,hasGutterRenderUtility:l,options:t}),!d?g:void 0,!0),b.current.hydrate({fileDiff:e,fileContainer:n,lineAnnotations:i,prerenderedHTML:o})}else{if(null==b.current)throw Error("useFileDiffInstance: A FileDiff instance should exist when unmounting");b.current.cleanUp(),b.current=null}},c=(0,nj.useRef)(h),(0,nj.useInsertionEffect)(()=>void(c.current=h)),(0,nj.useCallback)((...e)=>c.current(...e),[]));return nK(()=>{let{current:n}=b;if(null==n)return;let o=nX({controlledSelection:p,hasCustomHeader:s,hasGutterRenderUtility:l,options:t}),a=void 0!==o&&!et(n.options,o);n.setOptions(o),n.render({forceRender:a,fileDiff:e,lineAnnotations:i}),void 0!==r&&n.setSelectedLines(r)}),nK(()=>{if(u&&null!=b.current){if(void 0===m)throw Error("FileDiff: EditContext is not attached");let e=m(n??{});if(null==e)throw Error("FileDiff: EditProvider.createEditor must return an editor instance");try{return e.edit(b.current)}catch(t){throw e.cleanUp(),t}}},[u]),{ref:v,getHoveredLine:(0,nj.useCallback)(()=>b.current?.getHoveredLine(),[])}}({fileDiff:S,options:n,editorOptions:i,metrics:r,lineAnnotations:o,selectedLines:l,prerenderedHTML:u,hasGutterRenderUtility:null!=b,hasCustomHeader:null!=c,disableWorkerPool:v,edit:y});return(0,Q.jsx)(a,{ref:k,className:s,style:d,children:(C=function({fileDiff:e,actions:t,renderCustomHeader:n,renderHeaderPrefix:i,renderHeaderFilenameSuffix:r,renderHeaderMetadata:o,renderAnnotation:a,renderGutterUtility:l,renderMergeConflictUtility:s,lineAnnotations:d,getHoveredLine:u,getInstance:h}){let c=n?.(e),f=i?.(e),p=r?.(e),g=o?.(e);return(0,Q.jsxs)(Q.Fragment,{children:[null!=c?(0,Q.jsx)("div",{slot:m,children:c}):(0,Q.jsxs)(Q.Fragment,{children:[null!=f&&(0,Q.jsx)("div",{slot:"header-prefix",children:f}),null!=p&&(0,Q.jsx)("div",{slot:"header-filename-suffix",children:p}),null!=g&&(0,Q.jsx)("div",{slot:"header-metadata",children:g})]}),null!=a&&d?.map((e,t)=>(0,Q.jsx)("div",{slot:K(e),children:a(e)},t)),null!=t&&null!=s&&null!=h&&t.map(t=>{var n;let i;if(null==t)return;let r=null!=(i=function(e,t){let n=t.hunks[e.hunkIndex];if(null!=n)return{hunkIndex:e.hunkIndex,lineIndex:function(e,t){let n=e.unifiedLineStart;for(let i=0;i<t;i++){let t=e.hunkContent[i];n+="context"===t.type?t.lines:t.deletions+t.additions}return n}(n,e.startContentIndex)}}(n=t,e))?function({hunkIndex:e,lineIndex:t,conflictIndex:n}){return`merge-conflict-action-${e}-${t}-${n}`}({hunkIndex:i.hunkIndex,lineIndex:i.lineIndex,conflictIndex:n.conflictIndex}):void 0;return(0,Q.jsx)("div",{slot:r,style:Y,children:s(t,h)},r)}),null!=l&&(0,Q.jsx)("div",{slot:"gutter-utility-slot",style:X,children:l(u)})]})}({fileDiff:S,renderCustomHeader:c,renderHeaderPrefix:f,renderHeaderFilenameSuffix:p,renderHeaderMetadata:g,renderAnnotation:h,lineAnnotations:o,renderGutterUtility:b,getHoveredLine:x}),"u"<typeof window&&null!=u?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)("template",{shadowrootmode:"open",dangerouslySetInnerHTML:{__html:u}}),C]}):(0,Q.jsx)(Q.Fragment,{children:C}))})}},4557(e,t,n){n.d(t,{u:()=>function e(t){var n,r,o;let a=[],l=new Set;for(let e of i(r=n=t.themes)||"string"==typeof(o=r).name&&"function"==typeof o.load?[n]:n)for(let t of i(e)?e.getThemes():[e]){if(l.has(t.name))throw Error(`Theme collection already contains theme "${t.name}"`);l.add(t.name),a.push(t)}let s=Object.freeze([...a]),d=Object.freeze(s.filter(e=>"light"===e.colorScheme)),u=Object.freeze(s.filter(e=>"dark"===e.colorScheme)),h=new Map(s.map(e=>[e.name,e])),c=Object.freeze(s.map(e=>e.name)),f=Object.freeze(d.map(e=>e.name)),p=Object.freeze(u.map(e=>e.name));function g(e){if(null==e)return s;let{colorScheme:t,collection:n}=e;return null==n?"light"===t?d:"dark"===t?u:s:s.filter(e=>e.collection===n&&(null==t||e.colorScheme===t))}return{getTheme:e=>h.get(e),getThemes:e=>g(e),getThemeNames:e=>e?.collection==null?e?.colorScheme==="light"?f:e?.colorScheme==="dark"?p:c:g(e).map(e=>e.name),hasTheme:e=>h.has(e),orderBy:t=>e({themes:s.map((e,t)=>({descriptor:e,index:t})).sort((e,n)=>{let i=t(e.descriptor,n.descriptor);return 0!==i?i:e.index-n.index}).map(e=>e.descriptor)}),pick(t){let n=[],i=new Set;for(let e of t){if(i.has(e))throw Error(`Theme collection pick already includes theme "${e}"`);i.add(e);let t=h.get(e);if(null==t)throw Error(`Theme collection does not contain theme "${e}"`);n.push(t)}return e({themes:n})},registerInto(e){for(let t of s)e.registerThemeIfAbsent(t.name,t.load)}}}});function i(e){return"function"==typeof e.getThemes}},1384(e,t,n){n.d(t,{CZ:()=>H,St:()=>D,tX:()=>p});var i=n(8336),r=n(2696),o=n(8823),a=n(70);let l=/\s+/g;function s(e,t){if(!t)return e;for(let n of(e.properties||={},e.properties.class||=[],"string"==typeof e.properties.class&&(e.properties.class=e.properties.class.split(l)),Array.isArray(e.properties.class)||(e.properties.class=[]),Array.isArray(t)?t:t.split(l)))n&&!e.properties.class.includes(n)&&e.properties.class.push(n);return e}let d=/:?lang=["']([^"']+)["']/g,u=/(?:```|~~~)([\w-]+)/g,h=/\\begin\{([\w-]+)\}/g,c=/<script\s+(?:type|lang)=["']([^"']+)["']/gi,f=/^\s*---\r?\n[\s\S]*?\r?\n---(?:\r?\n|\s*$)/;function p(e,t,n){let i=new Set;for(let t of e.matchAll(d)){let e=t[1].toLowerCase().trim();e&&i.add(e)}for(let t of e.matchAll(u)){let e=t[1].toLowerCase().trim();e&&i.add(e)}for(let t of e.matchAll(h)){let e=t[1].toLowerCase().trim();e&&i.add(e)}for(let t of e.matchAll(c)){let e=t[1].toLowerCase().trim(),n=e.includes("/")?e.split("/").pop():e;n&&i.add(n)}if(f.test(e)&&i.add("yaml"),!n)return[...i];let r=n.getBundledLanguages();return[...i].filter(e=>e&&r[e])}let g=["color","background-color"];function m(e){let t={};if(e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle){e.fontStyle&o.zz.Italic&&(t["font-style"]="italic"),e.fontStyle&o.zz.Bold&&(t["font-weight"]="bold");let n=[];e.fontStyle&o.zz.Underline&&n.push("underline"),e.fontStyle&o.zz.Strikethrough&&n.push("line-through"),n.length&&(t["text-decoration"]=n.join(" "))}return t}function b(e){return"string"==typeof e?e:Object.entries(e).map(([e,t])=>`${e}:${t}`).join(";")}let v=[function(){let e=new WeakMap;function t(t){if(!e.has(t.meta)){var n;let a,l=(n=t.source,{lines:a=(0,r.uz)(n,!0).map(([e])=>e),indexToPos:function(e){if(e===n.length)return{line:a.length-1,character:a.at(-1).length};let t=e,i=0;for(let e of a){if(t<e.length)break;t-=e.length,i++}return{line:i,character:t}},posToIndex:function(e,t){let n=0;for(let t=0;t<e;t++)n+=a[t].length;return n+t}});function o(e){if("number"==typeof e){if(e<0||e>t.source.length)throw new i.H(`Invalid decoration offset: ${e}. Code length: ${t.source.length}`);return{...l.indexToPos(e),offset:e}}{let t=l.lines[e.line];if(void 0===t)throw new i.H(`Invalid decoration position ${JSON.stringify(e)}. Lines length: ${l.lines.length}`);let n=e.character;if(n<0&&(n=t.length+n),n<0||n>t.length)throw new i.H(`Invalid decoration position ${JSON.stringify(e)}. Line ${e.line} length: ${t.length}`);return{...e,character:n,offset:l.posToIndex(e.line,n)}}}let s=(t.options.decorations||[]).map(e=>({...e,start:o(e.start),end:o(e.end)}));(function(e){for(let t=0;t<e.length;t++){let n=e[t];if(n.start.offset>n.end.offset)throw new i.H(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=t+1;r<e.length;r++){let t=e[r],o=n.start.offset<=t.start.offset&&t.start.offset<n.end.offset,a=n.start.offset<t.end.offset&&t.end.offset<=n.end.offset,l=t.start.offset<=n.start.offset&&n.start.offset<t.end.offset,s=t.start.offset<n.end.offset&&n.end.offset<=t.end.offset;if(o||a||l||s){if(o&&a||l&&s||l&&n.start.offset===n.end.offset||a&&t.start.offset===t.end.offset)continue;throw new i.H(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(t.start)} intersect.`)}}}})(s),e.set(t.meta,{decorations:s,converter:l,source:t.source})}return e.get(t.meta)}return{name:"shiki:decorations",tokens(e){if(this.options.decorations?.length){var n;let i;return(i=[...(n=t(this).decorations.flatMap(e=>[e.start.offset,e.end.offset]))instanceof Set?n:new Set(n)].sort((e,t)=>e-t)).length?e.map(e=>e.flatMap(e=>{let t=e.offset+e.content.length,n=function(e,t){let n=0,i=e.length;for(;n<i;){let r=n+(i-n>>1);e[r]<=t?n=r+1:i=r}return n}(i,e.offset),r=n;for(;r<i.length&&i[r]<t;)r++;if(n===r)return e;let o=i.slice(n,r);for(let t=0;t<o.length;t++)o[t]-=e.offset;let a=0,l=[];for(let t of o)t>a&&l.push({...e,content:e.content.slice(a,t),offset:e.offset+a}),a=t;return a<e.content.length&&l.push({...e,content:e.content.slice(a),offset:e.offset+a}),l})):e}},code(e){if(!this.options.decorations?.length)return;let n=t(this),r=[...e.children].filter(e=>"element"===e.type&&"span"===e.tagName);if(r.length!==n.converter.lines.length)throw new i.H(`Number of lines in code element (${r.length}) does not match the number of lines in the source (${n.converter.lines.length}). Failed to apply decorations.`);function o(e,t,n,o){let l=r[e],s="",d=-1,u=-1;if(0===t&&(d=0),0===n&&(u=0),n===1/0&&(u=l.children.length),-1===d||-1===u)for(let e=0;e<l.children.length;e++)s+=function e(t){return"text"===t.type?t.value:"element"===t.type?t.children.map(e).join(""):""}(l.children[e]),-1===d&&s.length===t&&(d=e+1),-1===u&&s.length===n&&(u=e+1);if(-1===d)throw new i.H(`Failed to find start index for decoration ${JSON.stringify(o.start)}`);if(-1===u)throw new i.H(`Failed to find end index for decoration ${JSON.stringify(o.end)}`);let h=l.children.slice(d,u);if(o.alwaysWrap||h.length!==l.children.length)if(o.alwaysWrap||1!==h.length||"element"!==h[0].type){let e={type:"element",tagName:"span",properties:{},children:h};a(e,o,"wrapper"),l.children.splice(d,h.length,e)}else a(h[0],o,"token");else a(l,o,"line")}function a(e,t,n){let i=t.properties||{},r=t.transform||(e=>e);return e.tagName=t.tagName||"span",e.properties={...e.properties,...i,class:e.properties.class},t.properties?.class&&s(e,t.properties.class),e=r(e,n)||e}let l=[];for(let e of n.decorations.sort((e,t)=>t.start.offset-e.start.offset||e.end.offset-t.end.offset)){let{start:t,end:n}=e;if(t.line===n.line)o(t.line,t.character,n.character,e);else if(t.line<n.line){o(t.line,t.character,1/0,e);for(let i=t.line+1;i<n.line;i++)l.unshift(()=>{var t;r[t=i]=a(r[t],e,"line")});o(n.line,0,n.character,e)}}l.forEach(e=>e())}}}()];function y(e){let t=function(e){let t=[],n=[],i=[];for(let r of e)switch(r.enforce){case"pre":t.push(r);break;case"post":n.push(r);break;default:i.push(r)}return{pre:t,post:n,normal:i}}(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...v]}var C=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],S={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function k(e){let t=e.shift();if("2"===t){let t=e.splice(0,3).map(e=>Number.parseInt(e));if(3!==t.length||t.some(e=>Number.isNaN(e)))return;return{type:"rgb",rgb:t}}if("5"===t){let t=e.shift();if(t)return{type:"table",index:Number(t)}}}var x={black:"#000000",red:"#bb0000",green:"#00bb00",yellow:"#bbbb00",blue:"#0000bb",magenta:"#ff00ff",cyan:"#00bbbb",white:"#eeeeee",brightBlack:"#555555",brightRed:"#ff5555",brightGreen:"#00ff00",brightYellow:"#ffff55",brightBlue:"#5555ff",brightMagenta:"#ff55ff",brightCyan:"#55ffff",brightWhite:"#ffffff"};let w=/#([0-9a-f]{3,8})/i,L=/var\((--[\w-]+-ansi-[\w-]+)\)/,A={black:"#000000",red:"#cd3131",green:"#0DBC79",yellow:"#E5E510",blue:"#2472C8",magenta:"#BC3FBC",cyan:"#11A8CD",white:"#E5E5E5",brightBlack:"#666666",brightRed:"#F14C4C",brightGreen:"#23D18B",brightYellow:"#F5F543",brightBlue:"#3B8EEA",brightMagenta:"#D670D6",brightCyan:"#29B8DB",brightWhite:"#FFFFFF"};function E(e,t,n={}){let i=e.resolveLangAlias(n.lang||"text"),{theme:a=e.getLoadedThemes()[0]}=n;if(!(0,r.Tu)(i)&&!(0,r.Mz)(a)&&"ansi"===i){let i,l,s,d,u,h,c,{theme:f}=e.setTheme(a);return i=(0,r.xv)(f,n),l=(0,r.uz)(t),s=function(e=x){let t;function n(e){return`#${e.map(e=>Math.max(0,Math.min(e,255)).toString(16).padStart(2,"0")).join("")}`}return{value:function(i){switch(i.type){case"named":return e[i.name];case"rgb":return n(i.rgb);case"table":var r;return r=i.index,function(){if(t)return t;t=[];for(let n=0;n<C.length;n++)t.push(e[C[n]]);let i=[0,95,135,175,215,255];for(let e=0;e<6;e++)for(let r=0;r<6;r++)for(let o=0;o<6;o++)t.push(n([i[e],i[r],i[o]]));let r=8;for(let e=0;e<24;e++,r+=10)t.push(n([r,r,r]));return t}()[r]}}}}(Object.fromEntries(C.map(e=>{let t=`terminal.ansi${e[0].toUpperCase()}${e.substring(1)}`;return[e,f.colors?.[t]||A[e]]}))),d=null,u=null,h=new Set,c={parse(e){let t=[],n=0;do{let i=function(e,t){let n=e.indexOf("\x1b",t);if(-1!==n&&"["===e[n+1]){let t=e.indexOf("m",n);if(-1!==t)return{sequence:e.substring(n+2,t).split(";"),startPosition:n,position:t+1}}return{position:e.length}}(e,n),r=i.sequence?e.substring(n,i.startPosition):e.substring(n);if(r.length>0&&t.push({value:r,foreground:d,background:u,decorations:new Set(h)}),i.sequence){let e=function(e){let t=[];for(;e.length>0;){let n=e.shift();if(!n)continue;let i=Number.parseInt(n);if(!Number.isNaN(i))if(0===i)t.push({type:"resetAll"});else if(i<=9)S[i]&&t.push({type:"setDecoration",value:S[i]});else if(i<=29){let e=S[i-20];e&&(t.push({type:"resetDecoration",value:e}),"dim"===e&&t.push({type:"resetDecoration",value:"bold"}))}else if(i<=37)t.push({type:"setForegroundColor",value:{type:"named",name:C[i-30]}});else if(38===i){let n=k(e);n&&t.push({type:"setForegroundColor",value:n})}else if(39===i)t.push({type:"resetForegroundColor"});else if(i<=47)t.push({type:"setBackgroundColor",value:{type:"named",name:C[i-40]}});else if(48===i){let n=k(e);n&&t.push({type:"setBackgroundColor",value:n})}else 49===i?t.push({type:"resetBackgroundColor"}):53===i?t.push({type:"setDecoration",value:"overline"}):55===i?t.push({type:"resetDecoration",value:"overline"}):i>=90&&i<=97?t.push({type:"setForegroundColor",value:{type:"named",name:C[i-90+8]}}):i>=100&&i<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:C[i-100+8]}})}return t}(i.sequence);for(let t of e)"resetAll"===t.type?(d=null,u=null,h.clear()):"resetForegroundColor"===t.type?d=null:"resetBackgroundColor"===t.type?u=null:"resetDecoration"===t.type&&h.delete(t.value);for(let t of e)"setForegroundColor"===t.type?d=t.value:"setBackgroundColor"===t.type?u=t.value:"setDecoration"===t.type&&h.add(t.value)}n=i.position}while(n<e.length);return t}},l.map(e=>c.parse(e[0]).map(t=>{let n,a;t.decorations.has("reverse")?(n=t.background?s.value(t.background):f.bg,a=t.foreground?s.value(t.foreground):f.fg):(n=t.foreground?s.value(t.foreground):f.fg,a=t.background?s.value(t.background):void 0),n=(0,r.HA)(n,i),a=(0,r.HA)(a,i),t.decorations.has("dim")&&(n=function(e){let t=e.match(w);if(t){let e=t[1];if(8===e.length){let t=Math.round(Number.parseInt(e.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${e.slice(0,6)}${t}`}if(6===e.length)return`#${e}80`;if(4===e.length){let t=e[0],n=e[1],i=e[2],r=e[3];return`#${t}${t}${n}${n}${i}${i}${Math.round(Number.parseInt(`${r}${r}`,16)/2).toString(16).padStart(2,"0")}`}else if(3===e.length){let t=e[0],n=e[1],i=e[2];return`#${t}${t}${n}${n}${i}${i}80`}}let n=e.match(L);return n?`var(${n[1]}-dim)`:e}(n));let l=o.zz.None;return t.decorations.has("bold")&&(l|=o.zz.Bold),t.decorations.has("italic")&&(l|=o.zz.Italic),t.decorations.has("underline")&&(l|=o.zz.Underline),t.decorations.has("strikethrough")&&(l|=o.zz.Strikethrough),{content:t.value,offset:e[1],color:n,bgColor:a,fontStyle:l}}))}return(0,r.at)(e,t,n)}function R(e,t,n){let o,a,l,s,d,u;if("themes"in n){let{defaultColor:h="light",cssVariablePrefix:c="--shiki-",colorsRendering:f="css-vars"}=n,p=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})).sort((e,t)=>e.color===h?-1:+(t.color===h));if(0===p.length)throw new i.H("`themes` option must not be empty");let b=(0,r.HX)(e,t,n,E);if(u=(0,r.hg)(b),h&&"light-dark()"!==h&&!p.some(e=>e.color===h))throw new i.H(`\`themes\` option must contain the defaultColor key \`${h}\``);let v=p.map(t=>e.getTheme(t.theme)),y=p.map(e=>e.color);l=b.map(e=>e.map(e=>(function(e,t,n,r,o="css-vars"){let a={content:e.content,explanation:e.explanation,offset:e.offset},l=t.map(t=>m(e.variants[t])),s=new Set(l.flatMap(e=>Object.keys(e))),d={},u=(e,i)=>{let r="color"===i?"":"background-color"===i?"-bg":`-${i}`;return n+t[e]+("color"===i?"":r)};return l.forEach((e,n)=>{for(let a of s){let s=e[a]||"inherit";if(0===n&&r&&g.includes(a))if("light-dark()"===r&&l.length>1){let e=t.findIndex(e=>"light"===e),r=t.findIndex(e=>"dark"===e);if(-1===e||-1===r)throw new i.H('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');let h=l[e][a]||"inherit",c=l[r][a]||"inherit";d[a]=`light-dark(${h}, ${c})`,"css-vars"===o&&(d[u(n,a)]=s)}else d[a]=s;else"css-vars"===o&&(d[u(n,a)]=s)}}),a.htmlStyle=d,a})(e,y,c,h,f))),u&&(0,r.cS)(l,u);let C=p.map(e=>(0,r.xv)(e.theme,n));a=_(p,v,C,c,h,"fg",f),o=_(p,v,C,c,h,"bg",f),s=`shiki-themes ${v.map(e=>e.name).join(" ")}`,d=h?void 0:[a,o].join(";")}else if("theme"in n){let i=(0,r.xv)(n.theme,n);l=E(e,t,n);let d=e.getTheme(n.theme);o=(0,r.HA)(d.bg,i),a=(0,r.HA)(d.fg,i),s=d.name,u=(0,r.hg)(l)}else throw new i.H("Invalid options, either `theme` or `themes` must be provided");return{tokens:l,fg:a,bg:o,themeName:s,rootStyle:d,grammarState:u}}function _(e,t,n,o,a,l,s){return e.map((d,u)=>{let h=(0,r.HA)(t[u][l],n[u])||"inherit",c=`${o+d.color}${"bg"===l?"-bg":""}:${h}`;if(0===u&&a){if("light-dark()"===a&&e.length>1){let o=e.findIndex(e=>"light"===e.color),a=e.findIndex(e=>"dark"===e.color);if(-1===o||-1===a)throw new i.H('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${(0,r.HA)(t[o][l],n[o])||"inherit"}, ${(0,r.HA)(t[a][l],n[a])||"inherit"});${c}`}return h}return"css-vars"===s?c:null}).filter(e=>!!e).join(";")}let T=/^\s+$/,I=/^(\s*)(.*?)(\s*)$/;function M(e,t,n,i={meta:{},options:n,codeToHast:(t,n)=>M(e,t,n),codeToTokens:(t,n)=>R(e,t,n)}){let a=t;for(let e of y(n))a=e.preprocess?.call(i,a,n)||a;let{tokens:l,fg:d,bg:u,themeName:h,rootStyle:c,grammarState:f}=R(e,a,n),{mergeWhitespaces:p=!0,mergeSameStyleTokens:g=!1}=n;!0===p?l=l.map(e=>{let t,n=[],i="";return e.forEach((r,a)=>{let l=!(r.fontStyle&&(r.fontStyle&o.zz.Underline||r.fontStyle&o.zz.Strikethrough));l&&T.test(r.content)&&e[a+1]?(void 0===t&&(t=r.offset),i+=r.content):i?(l?n.push({...r,offset:t,content:i+r.content}):n.push({content:i,offset:t},r),t=void 0,i=""):n.push(r)}),n}):"never"===p&&(l=l.map(e=>e.flatMap(e=>{if(T.test(e.content))return e;let t=e.content.match(I);if(!t)return e;let[,n,i,r]=t;if(!n&&!r)return e;let o=[{...e,offset:e.offset+n.length,content:i}];return n&&o.unshift({content:n,offset:e.offset}),r&&o.push({content:r,offset:e.offset+n.length+i.length}),o}))),g&&(l=l.map(e=>{let t=[];for(let n of e){if(0===t.length){t.push({...n});continue}let e=t.at(-1),i=b(e.htmlStyle||m(e)),r=b(n.htmlStyle||m(n)),a=e.fontStyle&&(e.fontStyle&o.zz.Underline||e.fontStyle&o.zz.Strikethrough),l=n.fontStyle&&(n.fontStyle&o.zz.Underline||n.fontStyle&o.zz.Strikethrough);a||l||i!==r?t.push({...n}):e.content+=n.content}return t}));let v={...i,get source(){return a}};for(let e of y(n))l=e.tokens?.call(v,l)||l;return function(e,t,n,i=(0,r.hg)(e)){let o=y(t),a=[],l={type:"root",children:[]},{structure:d="classic",tabindex:u="0"}=t,h={class:`shiki ${t.themeName||""}`};for(let[e,n]of(!1!==t.rootStyle&&(null!=t.rootStyle?h.style=t.rootStyle:h.style=`background-color:${t.bg};color:${t.fg}`),!1!==u&&null!=u&&(h.tabindex=u.toString()),Object.entries(t.meta||{})))e.startsWith("_")||(h[e]=n);let c={type:"element",tagName:"pre",properties:h,children:[],data:t.data},f={type:"element",tagName:"code",properties:{},children:a},p=[],g={...n,structure:d,addClassToHast:s,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return l},get pre(){return c},get code(){return f},get lines(){return p}};if(e.forEach((e,t)=>{t&&("inline"===d?l.children.push({type:"element",tagName:"br",properties:{},children:[]}):"classic"===d&&a.push({type:"text",value:"\n"}));let n={type:"element",tagName:"span",properties:{class:"line"},children:[]},i=0;for(let r of e){let e={type:"element",tagName:"span",properties:{...r.htmlAttrs},children:[{type:"text",value:r.content}]},a=b(r.htmlStyle||m(r));for(let l of(a&&(e.properties.style=a),o))e=l?.span?.call(g,e,t+1,i,n,r)||e;"inline"===d?l.children.push(e):"classic"===d&&n.children.push(e),i+=r.content.length}if("classic"===d){for(let e of o)n=e?.line?.call(g,n,t+1)||n;p.push(n),a.push(n)}else"inline"===d&&p.push(n)}),"classic"===d){for(let e of o)f=e?.code?.call(g,f)||f;for(let e of(c.children.push(f),o))c=e?.pre?.call(g,c)||c;l.children.push(c)}else if("inline"===d){let e=[],t={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(let n of l.children)"element"===n.type&&"br"===n.tagName?(e.push(t),t={type:"element",tagName:"span",properties:{class:"line"},children:[]}):("element"===n.type||"text"===n.type)&&t.children.push(n);e.push(t);let n={type:"element",tagName:"code",properties:{},children:e};for(let e of o)n=e?.code?.call(g,n)||n;l.children=[];for(let e=0;e<n.children.length;e++){e>0&&l.children.push({type:"element",tagName:"br",properties:{},children:[]});let t=n.children[e];"element"===t.type&&l.children.push(...t.children)}}let v=l;for(let e of o)v=e?.root?.call(g,v)||v;return i&&(0,r.cS)(v,i),v}(l,{...n,fg:d,bg:u,themeName:h,rootStyle:!1!==n.rootStyle&&(n.rootStyle??c)},v,f)}let P=a.V;async function N(e){let t=await (0,r.Q4)(e);return{getLastGrammarState:(...e)=>(0,r.r5)(t,...e),codeToTokensBase:(e,n)=>E(t,e,n),codeToTokensWithThemes:(e,n)=>(0,r.HX)(t,e,n),codeToTokens:(e,n)=>R(t,e,n),codeToHast:(e,n)=>M(t,e,n),codeToHtml:(e,n)=>(function(e,t,n){let i={meta:{},options:n,codeToHast:(t,n)=>M(e,t,n),codeToTokens:(t,n)=>R(e,t,n)},r=P(M(e,t,n,i));for(let e of y(n))r=e.postprocess?.call(i,r,n)||r;return r})(t,e,n),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}function D(e){let t=e.langs,n=e.themes,o=e.engine;return async function(e){function a(n){if("string"==typeof n){if(n=e.langAlias?.[n]||n,(0,r.sJ)(n))return[];let o=t[n];if(!o)throw new i.H(`Language \`${n}\` is not included in this bundle. You may want to load it from external source.`);return o}return n}function l(e){if((0,r.zH)(e))return"none";if("string"==typeof e){let t=n[e];if(!t)throw new i.H(`Theme \`${e}\` is not included in this bundle. You may want to load it from external source.`);return t}return e}let s=(e.themes??[]).map(e=>l(e)),d=(e.langs??[]).map(e=>a(e)),u=await N({engine:e.engine??o(),...e,themes:s,langs:d});return{...u,loadLanguage:(...e)=>u.loadLanguage(...e.map(a)),loadTheme:(...e)=>u.loadTheme(...e.map(l)),getBundledLanguages:()=>t,getBundledThemes:()=>n}}}function H(e,t){let n,i=async function(t={}){if(n){let e=await n;return await Promise.all([e.loadTheme(...t.themes||[]),e.loadLanguage(...t.langs||[])]),e}{n=e({...t,themes:[],langs:[]});let i=await n;return await Promise.all([i.loadTheme(...t.themes||[]),i.loadLanguage(...t.langs||[])]),i}};async function r(e,n){let r=await i({langs:[n.lang],themes:"theme"in n?[n.theme]:Object.values(n.themes)}),o=await t?.guessEmbeddedLanguages?.(e,n.lang,r);return o&&await r.loadLanguage(...o),r}return{getSingletonHighlighter:e=>i(e),codeToHtml:async(e,t)=>(await r(e,t)).codeToHtml(e,t),codeToHast:async(e,t)=>(await r(e,t)).codeToHast(e,t),codeToTokens:async(e,t)=>(await r(e,t)).codeToTokens(e,t),codeToTokensBase:async(e,t)=>(await r(e,t)).codeToTokensBase(e,t),codeToTokensWithThemes:async(e,t)=>(await r(e,t)).codeToTokensWithThemes(e,t),getLastGrammarState:async(e,t)=>(await i({langs:[t.lang],themes:[t.theme]})).getLastGrammarState(e,t)}}},7172(e,t,n){n.d(t,{l:()=>e7});var i=class{patterns;options;regexps;constructor(e,t={}){this.patterns=e,this.options=t;const{forgiving:n=!1,cache:i,regexConstructor:r}=t;if(!r)throw Error("Option `regexConstructor` is not provided");this.regexps=e.map(e=>{if("string"!=typeof e)return e;let t=i?.get(e);if(t){if(t instanceof RegExp)return t;if(n)return null;throw t}try{let t=r(e);return i?.set(e,t),t}catch(t){if(i?.set(e,t),n)return null;throw t}})}findNextMatchSync(e,t,n){let i="string"==typeof e?e:e.content,r=[];function o(e,t,n=0){return{index:e,captureIndices:t.indices.map(e=>null==e?{start:0xffffffff,end:0xffffffff,length:0}:{start:e[0]+n,end:e[1]+n,length:e[1]-e[0]})}}for(let e=0;e<this.regexps.length;e++){let n=this.regexps[e];if(n)try{n.lastIndex=t;let a=n.exec(i);if(!a)continue;if(a.index===t)return o(e,a,0);r.push([e,a,0])}catch(e){if(this.options.forgiving)continue;throw e}}if(r.length){let e=Math.min(...r.map(e=>e[1].index));for(let[t,n,i]of r)if(n.index===e)return o(t,n,i)}return null}};function r(e){if(1!=[...e].length)throw Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}let o=new Set(["alnum","alpha","ascii","blank","cntrl","digit","graph","lower","print","punct","space","upper","word","xdigit"]),a=String.raw;function l(e,t){if(null==e)throw Error(t??"Value expected");return e}let s=a`\[\^?`,d=`c.? | C(?:-.?)?|${a`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${a`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${a`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${a`o\{[^\}]*\}?`}|${a`\d{1,3}`}`,u=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,h=RegExp(a`
|
|
67
|
+
\\ (?:
|
|
68
|
+
${d}
|
|
69
|
+
| [gk]<[^>]*>?
|
|
70
|
+
| [gk]'[^']*'?
|
|
71
|
+
| .
|
|
72
|
+
)
|
|
73
|
+
| \( (?:
|
|
74
|
+
\? (?:
|
|
75
|
+
[:=!>({]
|
|
76
|
+
| <[=!]
|
|
77
|
+
| <[^>]*>
|
|
78
|
+
| '[^']*'
|
|
79
|
+
| ~\|?
|
|
80
|
+
| #(?:[^)\\]|\\.?)*
|
|
81
|
+
| [^:)]*[:)]
|
|
82
|
+
)?
|
|
83
|
+
| \*[^\)]*\)?
|
|
84
|
+
)?
|
|
85
|
+
| (?:${u.source})+
|
|
86
|
+
| ${s}
|
|
87
|
+
| .
|
|
88
|
+
`.replace(/\s+/g,""),"gsu"),c=RegExp(a`
|
|
89
|
+
\\ (?:
|
|
90
|
+
${d}
|
|
91
|
+
| .
|
|
92
|
+
)
|
|
93
|
+
| \[:(?:\^?\p{Alpha}+|\^):\]
|
|
94
|
+
| ${s}
|
|
95
|
+
| &&
|
|
96
|
+
| .
|
|
97
|
+
`.replace(/\s+/g,""),"gsu");function f(e,{inCharClass:t}){let n=e[1];if("c"===n||"C"===n){var i,o=e;let t="c"===o[1]?o[2]:o[3];if(!t||!/[A-Za-z]/.test(t))throw Error(`Unsupported control character "${o}"`);return m(r(t.toUpperCase())-64,o)}if("dDhHsSwW".includes(n)){let t;return v({d:"digit",h:"hex",s:"space",w:"word"}[t=(i=e)[1].toLowerCase()],i,{negate:i[1]!==t})}if(e.startsWith(a`\o{`))throw Error(`Incomplete, invalid, or unsupported octal code point "${e}"`);if(/^\\[pP]\{/.test(e)){if(3===e.length)throw Error(`Incomplete or invalid Unicode property "${e}"`);return function(e){let{p:t,neg:n,value:i}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(e).groups;return v("property",e,{value:i,negate:"P"===t&&!n||"p"===t&&!!n})}(e)}if(/^\\x[89A-Fa-f]\p{AHex}/u.test(e))try{let t=e.split(/\\x/).slice(1).map(e=>parseInt(e,16)),n=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(t)),i=new TextEncoder;return[...n].map(e=>{let t=[...i.encode(e)].map(e=>`\\x${e.toString(16)}`).join("");return m(r(e),t)})}catch{throw Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if("u"===n||"x"===n)return m(function(e){if(/^(?:\\u(?!\p{AHex}{4})|\\x(?!\p{AHex}{1,2}|\{\p{AHex}{1,8}\}))/u.test(e))throw Error(`Incomplete or invalid escape "${e}"`);return parseInt("{"===e[2]?/^\\x\{\s*(?<hex>\p{AHex}+)/u.exec(e).groups.hex:e.slice(2),16)}(e),e);if(k.has(n))return m(k.get(n),e);if(/\d/.test(n))return{type:"EscapedNumber",inCharClass:t,raw:e};if("\\"===e)throw Error(a`Incomplete escape "\"`);if("M"===n)throw Error(`Unsupported meta "${e}"`);if(2==[...e].length)return m(e.codePointAt(1),e);throw Error(`Unexpected escape "${e}"`)}function p(e,t){return{type:"Assertion",kind:e,raw:t}}function g(e){return{type:"Backreference",raw:e}}function m(e,t){return{type:"Character",value:e,raw:t}}function b(e,t){return{type:"CharacterClassOpen",negate:e,raw:t}}function v(e,t,n={}){return{type:"CharacterSet",kind:e,...n,raw:t}}function y(e,t,n={}){return"keep"===e?{type:"Directive",kind:e,raw:t}:{type:"Directive",kind:e,flags:l(n.flags),raw:t}}function C(e,t,n={}){return{type:"GroupOpen",kind:e,...n,raw:t}}let S=new Set(["COUNT","CMP","ERROR","FAIL","MAX","MISMATCH","SKIP","TOTAL_COUNT"]),k=new Map([["a",7],["b",8],["e",27],["f",12],["n",10],["r",13],["t",9],["v",11]]);function x(e){let t=null,n,i;if("{"===e[0]){let{minStr:r,maxStr:o}=/^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(e).groups;if(+r>1e5||o&&+o>1e5)throw Error("Quantifier value unsupported in Oniguruma");if((n=+r)>(i=void 0===o?+r:""===o?1/0:+o)&&(t="possessive",[n,i]=[i,n]),e.endsWith("?")){if("possessive"===t)throw Error('Unsupported possessive interval quantifier chain with "?"');t="lazy"}else t||(t="greedy")}else n=+("+"===e[0]),i="?"===e[0]?1:1/0,t="+"===e[1]?"possessive":"?"===e[1]?"lazy":"greedy";return{type:"Quantifier",kind:t,min:n,max:i,raw:e}}function w(e){let t={};return e.includes("i")&&(t.ignoreCase=!0),e.includes("m")&&(t.dotAll=!0),e.includes("x")&&(t.extended=!0),Object.keys(t).length?t:null}function L(e,t){if(!Array.isArray(e.body))throw Error("Expected node with body array");if(1!==e.body.length)return!1;let n=e.body[0];return!t||Object.keys(t).every(e=>t[e]===n[e])}let A=new Set(["AbsenceFunction","Backreference","CapturingGroup","Character","CharacterClass","CharacterSet","Group","Quantifier","Subroutine"]);function E(e,t={}){var n;let i={flags:"",normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}},s=function(e,t={}){let n={flags:"",...t,rules:{captureGroup:!1,singleline:!1,...t.rules}};if("string"!=typeof e)throw Error("String expected as pattern");let i=function(e){let t={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let n=0;n<e.length;n++){let i=e[n];if(!"imxDPSWy".includes(i))throw Error(`Invalid flag "${i}"`);if("y"===i){if(!/^y{[gw]}/.test(e.slice(n)))throw Error('Invalid or unspecified flag "y" mode');t.textSegmentMode="g"===e[n+2]?"grapheme":"word",n+=3;continue}t[({i:"ignoreCase",m:"dotAll",x:"extended",D:"digitIsAscii",P:"posixIsAscii",S:"spaceIsAscii",W:"wordIsAscii"})[i]]=!0}return t}(n.flags),l=[i.extended],s={captureGroup:n.rules.captureGroup,getCurrentModX:()=>l.at(-1),numOpenGroups:0,popModX(){l.pop()},pushModX(e){l.push(e)},replaceCurrentModX(e){l[l.length-1]=e},singleline:n.rules.singleline},d=[],k;for(h.lastIndex=0;k=h.exec(e);){let t=function(e,t,n,i){let[l,s]=n;if("["===n||"[^"===n){let e=function(e,t,n){let i=[b("^"===t[1],t)],a=1,l;for(c.lastIndex=n;l=c.exec(e);){let e=l[0];if("["===e[0]&&":"!==e[1])a++,i.push(b("^"===e[1],e));else if("]"===e){if("CharacterClassOpen"===i.at(-1).type)i.push(m(93,e));else if(a--,i.push({type:"CharacterClassClose",raw:e}),!a)break}else{let t=function(e){if("\\"===e[0])return f(e,{inCharClass:!0});if("["===e[0]){let t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!o.has(t.groups.name))throw Error(`Invalid POSIX class "${e}"`);return v("posix",e,{value:t.groups.name,negate:!!t.groups.negate})}return"-"===e?{type:"CharacterClassHyphen",raw:e}:"&&"===e?{type:"CharacterClassIntersector",raw:e}:m(r(e),e)}(e);Array.isArray(t)?i.push(...t):i.push(t)}}return{tokens:i,lastIndex:c.lastIndex||e.length}}(t,n,i);return{tokens:e.tokens,lastIndex:e.lastIndex}}if("\\"===l){if("AbBGyYzZ".includes(s))return{token:p(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:{type:"Subroutine",raw:n}}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:g(n)}}if("K"===s)return{token:y("keep",n)};if("N"===s||"R"===s)return{token:v("newline",n,{negate:"N"===s})};if("O"===s)return{token:v("any",n)};if("X"===s)return{token:v("text_segment",n)};let e=f(n,{inCharClass:!1});return Array.isArray(e)?{tokens:e}:{token:e}}if("("===l){if("*"===s)return{token:function(e){let t=/\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(e);if(!t)throw Error(`Incomplete or invalid named callout "${e}"`);let{name:n,tag:i,args:r}=t.groups;if(!n)throw Error(`Invalid named callout "${e}"`);if(""===i)throw Error(`Named callout tag with empty value not allowed "${e}"`);let o=r?r.split(",").filter(e=>""!==e).map(e=>/^[+-]?\d+$/.test(e)?+e:e):[],[a,l,s]=o,d=S.has(n)?n.toLowerCase():"custom";switch(d){case"fail":case"mismatch":case"skip":if(o.length>0)throw Error(`Named callout arguments not allowed "${o}"`);break;case"error":if(o.length>1)throw Error(`Named callout allows only one argument "${o}"`);if("string"==typeof a)throw Error(`Named callout argument must be a number "${a}"`);break;case"max":if(!o.length||o.length>2)throw Error(`Named callout must have one or two arguments "${o}"`);if("string"==typeof a&&!/^[A-Za-z_]\w*$/.test(a))throw Error(`Named callout argument one must be a tag or number "${a}"`);if(2===o.length&&("number"==typeof l||!/^[<>X]$/.test(l)))throw Error(`Named callout optional argument two must be '<', '>', or 'X' "${l}"`);break;case"count":case"total_count":if(o.length>1)throw Error(`Named callout allows only one argument "${o}"`);if(1===o.length&&("number"==typeof a||!/^[<>X]$/.test(a)))throw Error(`Named callout optional argument must be '<', '>', or 'X' "${a}"`);break;case"cmp":if(3!==o.length)throw Error(`Named callout must have three arguments "${o}"`);if("string"==typeof a&&!/^[A-Za-z_]\w*$/.test(a))throw Error(`Named callout argument one must be a tag or number "${a}"`);if("number"==typeof l||!/^(?:[<>!=]=|[<>])$/.test(l))throw Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${l}"`);if("string"==typeof s&&!/^[A-Za-z_]\w*$/.test(s))throw Error(`Named callout argument three must be a tag or number "${s}"`);break;case"custom":throw Error(`Undefined callout name "${n}"`);default:throw Error(`Unexpected named callout kind "${d}"`)}return{type:"NamedCallout",kind:d,tag:i??null,arguments:r?.split(",")??null,raw:e}}(n)};if("(?{"===n)throw Error(`Unsupported callout "${n}"`);if(n.startsWith("(?#")){if(")"!==t[i])throw Error('Unclosed comment group "(?#"');return{lastIndex:i+1}}if(/^\(\?[-imx]+[:)]$/.test(n))return{token:function(e,t){let{on:n,off:i}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(e).groups;i??="";let r=(t.getCurrentModX()||n.includes("x"))&&!i.includes("x"),o=w(n),a=w(i),l={};if(o&&(l.enable=o),a&&(l.disable=a),e.endsWith(")"))return t.replaceCurrentModX(r),y("flags",e,{flags:l});if(e.endsWith(":"))return t.pushModX(r),t.numOpenGroups++,C("group",e,{...(o||a)&&{flags:l}});throw Error(`Unexpected flag modifier "${e}"`)}(n,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,"("===n&&!e.captureGroup||"(?:"===n)return{token:C("group",n)};if("(?>"===n)return{token:C("atomic",n)};if("(?="===n||"(?!"===n||"(?<="===n||"(?<!"===n)return{token:C("<"===n[2]?"lookbehind":"lookahead",n,{negate:n.endsWith("!")})};if("("===n&&e.captureGroup||n.startsWith("(?<")&&n.endsWith(">")||n.startsWith("(?'")&&n.endsWith("'"))return{token:C("capturing",n,{..."("!==n&&{name:n.slice(3,-1)}})};if(n.startsWith("(?~")){if("(?~|"===n)throw Error(`Unsupported absence function kind "${n}"`);return{token:C("absence_repeater",n)}}throw"(?("===n?Error(`Unsupported conditional "${n}"`):Error(`Invalid or unsupported group option "${n}"`)}if(")"===n){if(e.popModX(),e.numOpenGroups--,e.numOpenGroups<0)throw Error('Unmatched ")"');return{token:{type:"GroupClose",raw:n}}}if(e.getCurrentModX()){if("#"===n){let e=t.indexOf(`
|
|
98
|
+
`,i);return{lastIndex:-1===e?t.length:e}}if(/^\s$/.test(n)){let e=/\s+/y;return e.lastIndex=i,{lastIndex:e.exec(t)?e.lastIndex:i}}}return"."===n?{token:v("dot",n)}:"^"===n||"$"===n?{token:p(e.singleline?({"^":a`\A`,$:a`\Z`})[n]:n,n)}:"|"===n?{token:{type:"Alternator",raw:n}}:u.test(n)?{tokens:function(e){let t,n=[],i=RegExp(u,"gy");for(;t=i.exec(e);){let e=t[0];if("{"===e[0]){let t=/^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(e);if(t){let{min:r,max:o}=t.groups;if(+r>+o&&e.endsWith("?")){i.lastIndex--,n.push(x(e.slice(0,-1)));continue}}}n.push(x(e))}return n}(n)}:{token:m(r(n),n)}}(s,e,k[0],h.lastIndex);t.tokens?d.push(...t.tokens):t.token&&d.push(t.token),void 0!==t.lastIndex&&(h.lastIndex=t.lastIndex)}let L=[],A=0;d.filter(e=>"GroupOpen"===e.type).forEach(e=>{"capturing"===e.kind?e.number=++A:"("===e.raw&&L.push(e)}),A||L.forEach((e,t)=>{e.kind="capturing",e.number=t+1});let E=A||L.length;return{tokens:d.map(e=>"EscapedNumber"===e.type?function(e,t){let{raw:n,inCharClass:i}=e,o=n.slice(1);if(!i&&("0"!==o&&1===o.length||"0"!==o[0]&&+o<=t))return[g(n)];let l=[],s=o.match(/^[0-7]+|\d/g);for(let e=0;e<s.length;e++){let t,i=s[e];if(0===e&&"8"!==i&&"9"!==i){if((t=parseInt(i,8))>127)throw Error(a`Octal encoded byte above 177 unsupported "${n}"`)}else t=r(i);l.push(m(t,(0===e?"\\":"")+i))}return l}(e,E):e).flat(),flags:i}}(e,{flags:i.flags,rules:{captureGroup:i.rules.captureGroup,singleline:i.rules.singleline}}),d=(e,t)=>{let n=s.tokens[k.nextIndex];switch(k.parent=e,k.nextIndex++,n.type){case"Alternator":return R();case"Assertion":return function({kind:e}){return _(l({"^":"line_start",$:"line_end","\\A":"string_start","\\b":"word_boundary","\\B":"word_boundary","\\G":"search_start","\\y":"text_segment_boundary","\\Y":"text_segment_boundary","\\z":"string_end","\\Z":"string_end_newline"}[e],`Unexpected assertion kind "${e}"`),{negate:e===a`\B`||e===a`\Y`})}(n);case"Backreference":return function({raw:e},t){let n=/^\\k[<']/.test(e),i=n?e.slice(3,-1):e.slice(1),r=(n,i=!1)=>{let r=t.capturingGroups.length,o=!1;if(n>r)if(t.skipBackrefValidation)o=!0;else throw Error(`Not enough capturing groups defined to the left "${e}"`);return t.hasNumberedRef=!0,T(i?r+1-n:n,{orphan:o})};if(n){let n=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(i);if(n)return r(+n.groups.num,!!n.groups.sign);if(/[-+]/.test(i))throw Error(`Invalid backref name "${e}"`);if(!t.namedGroupsByName.has(i))throw Error(`Group name not defined to the left "${e}"`);return T(i)}return r(+i)}(n,k);case"Character":return M(n.value,{useLastValid:!!t.isCheckingRangeEnd});case"CharacterClassHyphen":return function(e,t){let{tokens:n,walk:i}=e,o=e.parent,a=o.body.at(-1),l=n[e.nextIndex];if(!t.isCheckingRangeEnd&&a&&"CharacterClass"!==a.type&&"CharacterClassRange"!==a.type&&l&&"CharacterClassOpen"!==l.type&&"CharacterClassClose"!==l.type&&"CharacterClassIntersector"!==l.type){let e=i(o,{...t,isCheckingRangeEnd:!0});if("Character"===a.type&&"Character"===e.type)return o.body.pop(),function(e,t){if(t.value<e.value)throw Error("Character class range out of order");return{type:"CharacterClassRange",min:e,max:t}}(a,e);throw Error("Invalid character class range")}return M(r("-"))}(k,t);case"CharacterClassOpen":return function({negate:e},t,n){let{tokens:i,walk:r}=t,o=[P()],a=i[t.nextIndex],l=W(a);for(;"CharacterClassClose"!==l.type;){if("CharacterClassIntersector"===l.type)o.push(P()),t.nextIndex++;else{let e=o.at(-1);e.body.push(r(e,n))}l=W(i[t.nextIndex],a)}let s=P({negate:e});return 1===o.length?s.body=o[0].body:(s.kind="intersection",s.body=o.map(e=>1===e.body.length?e.body[0]:e)),t.nextIndex++,s}(n,k,t);case"CharacterSet":return function({kind:e,negate:t,value:n},i){let{normalizeUnknownPropertyNames:r,skipPropertyNameValidation:a,unicodePropertyMap:l}=i;if("property"===e){let i=j(n);if(!o.has(i)||l?.has(i))return F(n,{negate:t,normalizeUnknownPropertyNames:r,skipPropertyNameValidation:a,unicodePropertyMap:l});e="posix",n=i}return"posix"===e?function(e,t){let n=!!t?.negate;if(!o.has(e))throw Error(`Invalid POSIX class "${e}"`);return{type:"CharacterSet",kind:"posix",value:e,negate:n}}(n,{negate:t}):N(e,{negate:t})}(n,k);case"Directive":return function(e,t={}){if("keep"===e)return{type:"Directive",kind:e};if("flags"===e)return{type:"Directive",kind:e,flags:l(t.flags)};throw Error(`Unexpected directive kind "${e}"`)}(n.kind,{flags:n.flags});case"GroupOpen":return function(e,t,n){var i,r;let{tokens:o,capturingGroups:a,namedGroupsByName:l,skipLookbehindValidation:s,walk:d}=t,u=function({flags:e,kind:t,name:n,negate:i,number:r}){switch(t){case"absence_repeater":var o="repeater";!1;return{type:"AbsenceFunction",kind:o,body:z(void 0)};case"atomic":return D({atomic:!0});case"capturing":return I(r,{name:n});case"group":return D({flags:e});case"lookahead":case"lookbehind":return H({behind:"lookbehind"===t,negate:i});default:throw Error(`Unexpected group kind "${t}"`)}}(e),h="AbsenceFunction"===u.type,c=G(u),f=c&&u.negate;if("CapturingGroup"===u.type&&(a.push(u),u.name&&(i=u.name,r=[],l.has(i)||l.set(i,r),l.get(i)).push(u)),h&&n.isInAbsenceFunction)throw Error("Nested absence function not supported by Oniguruma");let p=V(o[t.nextIndex]);for(;"GroupClose"!==p.type;){if("Alternator"===p.type)u.body.push(R()),t.nextIndex++;else{let e=u.body.at(-1),t=d(e,{...n,isInAbsenceFunction:n.isInAbsenceFunction||h,isInLookbehind:n.isInLookbehind||c,isInNegLookbehind:n.isInNegLookbehind||f});if(e.body.push(t),(c||n.isInLookbehind)&&!s){let e="Lookbehind includes a pattern not allowed by Oniguruma";if(f||n.isInNegLookbehind){if(B(t)||"CapturingGroup"===t.type)throw Error(e)}else if(B(t)||G(t)&&t.negate)throw Error(e)}}p=V(o[t.nextIndex])}return t.nextIndex++,u}(n,k,t);case"NamedCallout":var i,d;return i=n.kind,d=n.tag,{type:"NamedCallout",kind:i,tag:d,arguments:n.arguments};case"Quantifier":return function({kind:e,min:t,max:n},i){let r=i.parent,o=r.body.at(-1);if(!o||!A.has(o.type))throw Error("Quantifier requires a repeatable token");let a=O(e,t,n,o);return r.body.pop(),a}(n,k);case"Subroutine":return function({raw:e},t){let{capturingGroups:n,subroutines:i}=t,r=e.slice(3,-1),o=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(r);if(o){let e=+o.groups.num,i=n.length;if(t.hasNumberedRef=!0,(r=({"":e,"+":i+e,"-":i+1-e})[o.groups.sign])<1)throw Error("Invalid subroutine number")}else"0"===r&&(r=0);let a=$(r);return i.push(a),a}(n,k);default:throw Error(`Unexpected token type "${n.type}"`)}},k={capturingGroups:[],hasNumberedRef:!1,namedGroupsByName:new Map,nextIndex:0,normalizeUnknownPropertyNames:i.normalizeUnknownPropertyNames,parent:null,skipBackrefValidation:i.skipBackrefValidation,skipLookbehindValidation:i.skipLookbehindValidation,skipPropertyNameValidation:i.skipPropertyNameValidation,subroutines:[],tokens:s.tokens,unicodePropertyMap:i.unicodePropertyMap,walk:d},L=(n={type:"Flags",...s.flags},{type:"Regex",body:z(void 0),flags:n}),U=L.body[0];for(;k.nextIndex<s.tokens.length;){let e=d(U,{});"Alternative"===e.type?(L.body.push(e),U=e):U.body.push(e)}let{capturingGroups:q,hasNumberedRef:K,namedGroupsByName:X,subroutines:Y}=k;if(K&&X.size&&!i.rules.captureGroup)throw Error("Numbered backref/subroutine not allowed when using named capture");for(let{ref:e}of Y)if("number"==typeof e){if(e>q.length)throw Error("Subroutine uses a group number that's not defined");e&&(q[e-1].isSubroutined=!0)}else if(X.has(e)){if(X.get(e).length>1)throw Error(a`Subroutine uses a duplicate group name "\g<${e}>"`);X.get(e)[0].isSubroutined=!0}else throw Error(a`Subroutine uses a group name that's not defined "\g<${e}>"`);return L}function R(e){return{type:"Alternative",body:U(e?.body)}}function _(e,t){let n={type:"Assertion",kind:e};return("word_boundary"===e||"text_segment_boundary"===e)&&(n.negate=!!t?.negate),n}function T(e,t){let n=!!t?.orphan;return{type:"Backreference",ref:e,...n&&{orphan:n}}}function I(e,t){var n;let i={name:void 0,isSubroutined:!1,...t};if(void 0!==i.name&&(n=i.name,!/^[\p{Alpha}\p{Pc}][^)]*$/u.test(n)))throw Error(`Group name "${i.name}" invalid in Oniguruma`);return{type:"CapturingGroup",number:e,...i.name&&{name:i.name},...i.isSubroutined&&{isSubroutined:i.isSubroutined},body:z(t?.body)}}function M(e,t){let n={useLastValid:!1,...t};if(e>1114111){let t=e.toString(16);if(n.useLastValid)e=1114111;else throw e>1310719?Error(`Invalid code point out of range "\\x{${t}}"`):Error(`Invalid code point out of range in JS "\\x{${t}}"`)}return{type:"Character",value:e}}function P(e){let t={kind:"union",negate:!1,...e};return{type:"CharacterClass",kind:t.kind,negate:t.negate,body:U(e?.body)}}function N(e,t){let n=!!t?.negate,i={type:"CharacterSet",kind:e};return("digit"===e||"hex"===e||"newline"===e||"space"===e||"word"===e)&&(i.negate=n),"text_segment"!==e&&("newline"!==e||n)||(i.variableLength=!0),i}function D(e){let t=e?.atomic,n=e?.flags;if(t&&n)throw Error("Atomic group cannot have flags");return{type:"Group",...t&&{atomic:t},...n&&{flags:n},body:z(e?.body)}}function H(e){let t={behind:!1,negate:!1,...e};return{type:"LookaroundAssertion",kind:t.behind?"lookbehind":"lookahead",negate:t.negate,body:z(e?.body)}}function O(e,t,n,i){if(t>n)throw Error("Invalid reversed quantifier range");return{type:"Quantifier",kind:e,min:t,max:n,body:i}}function $(e){return{type:"Subroutine",ref:e}}function F(e,t){let n={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t},i=n.unicodePropertyMap?.get(j(e));if(!i){if(n.normalizeUnknownPropertyNames)i=e.trim().replace(/[- _]+/g,"_").replace(/[A-Z][a-z]+(?=[A-Z])/g,"$&_").replace(/[A-Za-z]+/g,e=>e[0].toUpperCase()+e.slice(1).toLowerCase());else if(n.unicodePropertyMap&&!n.skipPropertyNameValidation)throw Error(a`Invalid Unicode property "\p{${e}}"`)}return{type:"CharacterSet",kind:"property",value:i??e,negate:n.negate}}function z(e){if(void 0===e)e=[R()];else if(!Array.isArray(e)||!e.length||!e.every(e=>"Alternative"===e.type))throw Error("Invalid body; expected array of one or more Alternative nodes");return e}function U(e){if(void 0===e)e=[];else if(!Array.isArray(e)||!e.every(e=>!!e.type))throw Error("Invalid body; expected array of nodes");return e}function B(e){return"LookaroundAssertion"===e.type&&"lookahead"===e.kind}function G(e){return"LookaroundAssertion"===e.type&&"lookbehind"===e.kind}function j(e){return e.replace(/[- _]+/g,"").toLowerCase()}function W(e,t){return l(e,`Unclosed character class${t?.type==="Character"&&93===t.value&&"]"===t.raw?' (started with "]")':""}`)}function V(e){return l(e,"Unclosed group")}function q(e,t,n=null){function i(e,t){for(let n=0;n<e.length;n++){let i=r(e[n],t,n,e);n=Math.max(-1,n+i)}}function r(o,a=null,s=null,d=null){let u=0,h=!1,c={node:o,parent:a,key:s,container:d,root:e,remove(){K(d).splice(Math.max(0,X(s)+u),1),u--,h=!0},removeAllNextSiblings:()=>K(d).splice(X(s)+1),removeAllPrevSiblings(){let e=X(s)+u;return u-=e,K(d).splice(0,Math.max(0,e))},replaceWith(e,t={}){let n=!!t.traverse;d?d[Math.max(0,X(s)+u)]=e:l(a,"Can't replace root node")[s]=e,n&&r(e,a,s,d),h=!0},replaceWithMultiple(e,t={}){let n=!!t.traverse;if(K(d).splice(Math.max(0,X(s)+u),1,...e),u+=e.length-1,n){let t=0;for(let n=0;n<e.length;n++)t+=r(e[n],a,X(s)+n+t,d)}h=!0},skip(){h=!0}},{type:f}=o,p=t["*"],g=t[f],m="function"==typeof p?p:p?.enter,b="function"==typeof g?g:g?.enter;if(m?.(c,n),b?.(c,n),!h)switch(f){case"AbsenceFunction":case"Alternative":case"CapturingGroup":case"CharacterClass":case"Group":case"LookaroundAssertion":i(o.body,o);break;case"Assertion":case"Backreference":case"Character":case"CharacterSet":case"Directive":case"Flags":case"NamedCallout":case"Subroutine":break;case"CharacterClassRange":r(o.min,o,"min"),r(o.max,o,"max");break;case"Quantifier":r(o.body,o,"body");break;case"Regex":i(o.body,o),r(o.flags,o,"flags");break;default:throw Error(`Unexpected node type "${f}"`)}return g?.exit?.(c,n),p?.exit?.(c,n),u}return r(e),e}function K(e){if(!Array.isArray(e))throw Error("Container expected");return e}function X(e){if("number"!=typeof e)throw Error("Numeric key expected");return e}let Y=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`,Z=Object.freeze({DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS"});function Q(e,t,n,i){let r=RegExp(String.raw`${t}|(?<$skip>\[\^?|\\?.)`,"gsu"),o=[!1],a=0,l="";for(let t of e.matchAll(r)){let{0:e,groups:{$skip:r}}=t;if(!r&&(!i||i===Z.DEFAULT==!a)){n instanceof Function?l+=n(t,{context:a?Z.CHAR_CLASS:Z.DEFAULT,negated:o[o.length-1]}):l+=n;continue}"["===e[0]?(a++,o.push("^"===e[1])):"]"===e&&a&&(a--,o.pop()),l+=e}return l}function J(e,t,n){return!!function(e,t,n=0,i){let r;if(!RegExp(t,"su").test(e))return null;let o=RegExp(`${t}|(?<$skip>\\\\?.)`,"gsu");o.lastIndex=n;let a=0;for(;r=o.exec(e);){let{0:e,groups:{$skip:t}}=r;if(!t&&(!i||i===Z.DEFAULT==!a))return r;"["===e?a++:"]"===e&&a&&a--,o.lastIndex==r.index&&o.lastIndex++}return null}(e,t,0,n)}let ee=RegExp(String.raw`(?<noncapturingStart>${Y})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,"gsu"),et=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,en=RegExp(String.raw`
|
|
99
|
+
\\(?: \d+
|
|
100
|
+
| c[A-Za-z]
|
|
101
|
+
| [gk]<[^>]+>
|
|
102
|
+
| [pPu]\{[^\}]+\}
|
|
103
|
+
| u[A-Fa-f\d]{4}
|
|
104
|
+
| x[A-Fa-f\d]{2}
|
|
105
|
+
)
|
|
106
|
+
| \((?: \? (?: [:=!>]
|
|
107
|
+
| <(?:[=!]|[^>]+>)
|
|
108
|
+
| [A-Za-z\-]+:
|
|
109
|
+
| \(DEFINE\)
|
|
110
|
+
))?
|
|
111
|
+
| (?<qBase>${et})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
|
|
112
|
+
| \\?.
|
|
113
|
+
`.replace(/\s+/g,""),"gsu"),ei=String.raw,er=ei`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`,eo=ei`\(\?R=(?<rDepth>[^\)]+)\)|${er}`,ea=ei`\(\?<(?![=!])(?<captureName>[^>]+)>`,el=ei`${ea}|(?<unnamed>\()(?!\?)`,es=RegExp(ei`${ea}|${eo}|\(\?|\\?.`,"gsu"),ed="Cannot use multiple overlapping recursions";function eu(e){let t=`Max depth must be integer between 2 and 100; used ${e}`;if(!/^[1-9]\d*$/.test(e)||(e*=1)<2||e>100)throw Error(t)}function eh(e,t,n,i,r,o,a){let l=new Set;i&&Q(e+t,ea,({groups:{captureName:e}})=>{l.add(e)},Z.DEFAULT);let s=[n,i?l:null,r,o,a];return`${e}${ec(`(?:${e}`,"forward",...s)}(?:)${ec(`${t})`,"backward",...s)}${t}`}function ec(e,t,n,i,r,o,a){let l=e=>"forward"===t?e+2:n-e+2-1,s="";for(let t=0;t<n;t++){let n=l(t);s+=Q(e,ei`${el}|\\k<(?<backref>[^>]+)>`,({0:e,groups:{captureName:t,unnamed:l,backref:s}})=>{if(s&&i&&!i.has(s))return e;let d=`_$${n}`;if(l||t){let n=a+o.length+1;return o.push(n),function(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}(r,n),l?e:`(?<${t}${d}>`}return ei`\k<${s}${d}>`},Z.DEFAULT)}return s}function ef(e,t,n,i,r,o){if(e.size&&i){let a=0;Q(t,el,()=>a++,Z.DEFAULT);let l=o-a+r,s=new Map;return e.forEach((e,t)=>{let r=(i-a*n)/n,o=a*n,d=t>l+a?t+i:t,u=[];for(let t of e)if(t<=l)u.push(t);else if(t>l+a+r)u.push(t+i);else if(t<=l+a)for(let e=0;e<=n;e++)u.push(t+a*e);else for(let e=0;e<=n;e++)u.push(t+o+r*e);s.set(d,u)}),s}return e}var ep=String.fromCodePoint,eg=String.raw,em={},eb=globalThis.RegExp;function ev(e,{enable:t,disable:n}){return{dotAll:!n?.dotAll&&!!(t?.dotAll||e.dotAll),ignoreCase:!n?.ignoreCase&&!!(t?.ignoreCase||e.ignoreCase)}}function ey(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}em.flagGroups=(()=>{try{new eb("(?i:)")}catch{return!1}return!0})(),em.unicodeSets=(()=>{try{new eb("[[]]","v")}catch{return!1}return!0})(),em.bugFlagVLiteralHyphenIsRange=!!em.unicodeSets&&(()=>{try{new eb(eg`[\d\-a]`,"v")}catch{return!0}return!1})(),em.bugNestedClassIgnoresNegation=em.unicodeSets&&new eb("[[^a]]","v").test("a");var eC={ES2025:2025,ES2024:2024,ES2018:2018},eS={auto:"auto",ES2025:"ES2025",ES2024:"ES2024",ES2018:"ES2018"};function ek(e={}){if("[object Object]"!==({}).toString.call(e))throw Error("Unexpected options");if(void 0!==e.target&&!eS[e.target])throw Error(`Unexpected target "${e.target}"`);let t={accuracy:"default",avoidSubclass:!1,flags:"",global:!1,hasIndices:!1,lazyCompileLength:1/0,target:"auto",verbose:!1,...e,rules:{allowOrphanBackrefs:!1,asciiWordBoundaries:!1,captureGroup:!1,recursionLimit:20,singleline:!1,...e.rules}};return"auto"===t.target&&(t.target=em.flagGroups?"ES2025":em.unicodeSets?"ES2024":"ES2018"),t}var ex=new Set([ep(304),ep(305)]),ew=eg`[\p{L}\p{M}\p{N}\p{Pc}]`;function eL(e){if(ex.has(e))return[e];let t=new Set,n=e.toLowerCase(),i=n.toUpperCase(),r=e_.get(n),o=eE.get(n),a=eR.get(n);return 1==[...i].length&&t.add(i),a&&t.add(a),r&&t.add(r),t.add(n),o&&t.add(o),[...t]}var eA=new Map(`C Other
|
|
114
|
+
Cc Control cntrl
|
|
115
|
+
Cf Format
|
|
116
|
+
Cn Unassigned
|
|
117
|
+
Co Private_Use
|
|
118
|
+
Cs Surrogate
|
|
119
|
+
L Letter
|
|
120
|
+
LC Cased_Letter
|
|
121
|
+
Ll Lowercase_Letter
|
|
122
|
+
Lm Modifier_Letter
|
|
123
|
+
Lo Other_Letter
|
|
124
|
+
Lt Titlecase_Letter
|
|
125
|
+
Lu Uppercase_Letter
|
|
126
|
+
M Mark Combining_Mark
|
|
127
|
+
Mc Spacing_Mark
|
|
128
|
+
Me Enclosing_Mark
|
|
129
|
+
Mn Nonspacing_Mark
|
|
130
|
+
N Number
|
|
131
|
+
Nd Decimal_Number digit
|
|
132
|
+
Nl Letter_Number
|
|
133
|
+
No Other_Number
|
|
134
|
+
P Punctuation punct
|
|
135
|
+
Pc Connector_Punctuation
|
|
136
|
+
Pd Dash_Punctuation
|
|
137
|
+
Pe Close_Punctuation
|
|
138
|
+
Pf Final_Punctuation
|
|
139
|
+
Pi Initial_Punctuation
|
|
140
|
+
Po Other_Punctuation
|
|
141
|
+
Ps Open_Punctuation
|
|
142
|
+
S Symbol
|
|
143
|
+
Sc Currency_Symbol
|
|
144
|
+
Sk Modifier_Symbol
|
|
145
|
+
Sm Math_Symbol
|
|
146
|
+
So Other_Symbol
|
|
147
|
+
Z Separator
|
|
148
|
+
Zl Line_Separator
|
|
149
|
+
Zp Paragraph_Separator
|
|
150
|
+
Zs Space_Separator
|
|
151
|
+
ASCII
|
|
152
|
+
ASCII_Hex_Digit AHex
|
|
153
|
+
Alphabetic Alpha
|
|
154
|
+
Any
|
|
155
|
+
Assigned
|
|
156
|
+
Bidi_Control Bidi_C
|
|
157
|
+
Bidi_Mirrored Bidi_M
|
|
158
|
+
Case_Ignorable CI
|
|
159
|
+
Cased
|
|
160
|
+
Changes_When_Casefolded CWCF
|
|
161
|
+
Changes_When_Casemapped CWCM
|
|
162
|
+
Changes_When_Lowercased CWL
|
|
163
|
+
Changes_When_NFKC_Casefolded CWKCF
|
|
164
|
+
Changes_When_Titlecased CWT
|
|
165
|
+
Changes_When_Uppercased CWU
|
|
166
|
+
Dash
|
|
167
|
+
Default_Ignorable_Code_Point DI
|
|
168
|
+
Deprecated Dep
|
|
169
|
+
Diacritic Dia
|
|
170
|
+
Emoji
|
|
171
|
+
Emoji_Component EComp
|
|
172
|
+
Emoji_Modifier EMod
|
|
173
|
+
Emoji_Modifier_Base EBase
|
|
174
|
+
Emoji_Presentation EPres
|
|
175
|
+
Extended_Pictographic ExtPict
|
|
176
|
+
Extender Ext
|
|
177
|
+
Grapheme_Base Gr_Base
|
|
178
|
+
Grapheme_Extend Gr_Ext
|
|
179
|
+
Hex_Digit Hex
|
|
180
|
+
IDS_Binary_Operator IDSB
|
|
181
|
+
IDS_Trinary_Operator IDST
|
|
182
|
+
ID_Continue IDC
|
|
183
|
+
ID_Start IDS
|
|
184
|
+
Ideographic Ideo
|
|
185
|
+
Join_Control Join_C
|
|
186
|
+
Logical_Order_Exception LOE
|
|
187
|
+
Lowercase Lower
|
|
188
|
+
Math
|
|
189
|
+
Noncharacter_Code_Point NChar
|
|
190
|
+
Pattern_Syntax Pat_Syn
|
|
191
|
+
Pattern_White_Space Pat_WS
|
|
192
|
+
Quotation_Mark QMark
|
|
193
|
+
Radical
|
|
194
|
+
Regional_Indicator RI
|
|
195
|
+
Sentence_Terminal STerm
|
|
196
|
+
Soft_Dotted SD
|
|
197
|
+
Terminal_Punctuation Term
|
|
198
|
+
Unified_Ideograph UIdeo
|
|
199
|
+
Uppercase Upper
|
|
200
|
+
Variation_Selector VS
|
|
201
|
+
White_Space space
|
|
202
|
+
XID_Continue XIDC
|
|
203
|
+
XID_Start XIDS`.split(/\s/).map(e=>[j(e),e])),eE=new Map([["s",ep(383)],[ep(383),"s"]]),eR=new Map([[ep(223),ep(7838)],[ep(107),ep(8490)],[ep(229),ep(8491)],[ep(969),ep(8486)]]),e_=new Map([eI(453),eI(456),eI(459),eI(498),...eM(8072,8079),...eM(8088,8095),...eM(8104,8111),eI(8124),eI(8140),eI(8188)]),eT=new Map([["alnum",eg`[\p{Alpha}\p{Nd}]`],["alpha",eg`\p{Alpha}`],["ascii",eg`\p{ASCII}`],["blank",eg`[\p{Zs}\t]`],["cntrl",eg`\p{Cc}`],["digit",eg`\p{Nd}`],["graph",eg`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],["lower",eg`\p{Lower}`],["print",eg`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],["punct",eg`[\p{P}\p{S}]`],["space",eg`\p{space}`],["upper",eg`\p{Upper}`],["word",eg`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],["xdigit",eg`\p{AHex}`]]);function eI(e){let t=ep(e);return[t.toLowerCase(),t]}function eM(e,t){return(function(e,t){let n=[];for(let i=e;i<=t;i++)n.push(i);return n})(e,t).map(e=>eI(e))}var eP=new Set(["Lower","Lowercase","Upper","Uppercase","Ll","Lowercase_Letter","Lt","Titlecase_Letter","Lu","Uppercase_Letter"]),eN={AbsenceFunction({node:e,parent:t,replaceWith:n}){let{body:i,kind:r}=e;if("repeater"===r){let e=D();e.body[0].body.push(H({negate:!0,body:i}),F("Any"));let r=D();r.body[0].body.push(O("greedy",0,1/0,e)),n(eV(r,t),{traverse:!0})}else throw Error('Unsupported absence function "(?~|"')},Alternative:{enter({node:e,parent:t,key:n},{flagDirectivesByAlt:i}){let r=e.body.filter(e=>"flags"===e.kind);for(let e=n+1;e<t.body.length;e++)ey(i,t.body[e],[]).push(...r)},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){let n=ez(t.get(e));if(n){let t=D({flags:n});t.body[0].body=e.body,e.body=[eV(t,e)]}}}},Assertion({node:e,parent:t,key:n,container:i,root:r,remove:o,replaceWith:a},l){let{kind:s,negate:d}=e,{asciiWordBoundaries:u,avoidSubclass:h,supportedGNodes:c,wordIsAscii:f}=l;if("text_segment_boundary"===s)throw Error(`Unsupported text segment boundary "\\${d?"Y":"y"}"`);if("line_end"===s)a(eV(H({body:[R({body:[_("string_end")]}),R({body:[M(10)]})]}),t));else if("line_start"===s)a(eV(eG(eg`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),t));else if("search_start"===s)if(c.has(e))r.flags.sticky=!0,o();else{var p;let e,r=i[n-1];if(r&&((e=["Character","CharacterClass","CharacterSet"]).includes((p=r).type)||"Quantifier"===p.type&&p.min&&e.includes(p.body.type)))a(eV(H({negate:!0}),t));else if(h)throw Error(eg`Uses "\G" in a way that requires a subclass`);else a(eW(_("string_start"),t)),l.strategy="clip_search"}else if("string_end"===s||"string_start"===s);else if("string_end_newline"===s)a(eV(eG(eg`(?=\n?\z)`),t));else if("word_boundary"===s){if(!f&&!u){let e=`(?:(?<=${ew})(?!${ew})|(?<!${ew})(?=${ew}))`,n=`(?:(?<=${ew})(?=${ew})|(?<!${ew})(?!${ew}))`;a(eV(eG(d?n:e),t))}}else throw Error(`Unexpected assertion kind "${s}"`)},Backreference({node:e},{jsGroupNameMap:t}){let{ref:n}=e;"string"!=typeof n||eB(n)||(e.ref=n=eF(n,t))},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:n}){let{name:i}=e;i&&!eB(i)&&(e.name=i=eF(i,t)),n.set(e.number,e),i&&n.set(i,e)},CharacterClassRange({node:e,parent:t,replaceWith:n}){"intersection"===t.kind&&n(eV(P({body:[e]}),t),{traverse:!0})},CharacterSet({node:e,parent:t,replaceWith:n},{accuracy:i,minTargetEs2024:r,digitIsAscii:o,spaceIsAscii:a,wordIsAscii:l}){let{kind:s,negate:d,value:u}=e;if(o&&("digit"===s||"digit"===u))return void n(eW(N("digit",{negate:d}),t));if(a&&("space"===s||"space"===u))return void n(eV(ej(eG("[ -\r ]"),d),t));if(l&&("word"===s||"word"===u))return void n(eW(N("word",{negate:d}),t));if("any"===s)n(eW(F("Any"),t));else if("digit"===s)n(eW(F("Nd",{negate:d}),t));else if("dot"===s);else if("text_segment"===s){if("strict"===i)throw Error(eg`Use of "\X" requires non-strict accuracy`);let e="\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?",o=eg`\p{RI}{2}|${e}(?:\u200D${e})*`;n(eV(eG(eg`(?>\r\n|${r?eg`\p{RGI_Emoji}`:o}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if("hex"===s)n(eW(F("AHex",{negate:d}),t));else if("newline"===s)n(eV(eG(d?"[^\n]":"(?>\r\n?|[\n\v\f\x85\u2028\u2029])"),t));else if("posix"===s)if(r||"graph"!==u&&"print"!==u)n(eV(ej(eG(eT.get(u)),d),t));else{if("strict"===i)throw Error(`POSIX class "${u}" requires min target ES2024 or non-strict accuracy`);let e={graph:"!-~",print:" -~"}[u];d&&(e=`\0-${ep(e.codePointAt(0)-1)}${ep(e.codePointAt(2)+1)}-\u{10FFFF}`),n(eV(eG(`[${e}]`),t))}else if("property"===s)eA.has(j(u))||(e.key="sc");else if("space"===s)n(eW(F("space",{negate:d}),t));else if("word"===s)n(eV(ej(eG(ew),d),t));else throw Error(`Unexpected character set kind "${s}"`)},Directive({node:e,parent:t,root:n,remove:i,replaceWith:r,removeAllPrevSiblings:o,removeAllNextSiblings:a}){let{kind:l,flags:s}=e;if("flags"===l)if(s.enable||s.disable){let e=D({flags:s});e.body[0].body=a(),r(eV(e,t),{traverse:!0})}else i();else if("keep"===l){let e=n.body[0],i=1===n.body.length&&L(e,{type:"Group"})&&1===e.body[0].body.length?e.body[0]:n;if(t.parent!==i||i.body.length>1)throw Error(eg`Uses "\K" in a way that's unsupported`);let a=H({behind:!0});a.body[0].body=o(),r(eV(a,t))}else throw Error(`Unexpected directive kind "${l}"`)},Flags({node:e,parent:t}){if(e.posixIsAscii)throw Error('Unsupported flag "P"');if("word"===e.textSegmentMode)throw Error('Unsupported flag "y{w}"');["digitIsAscii","extended","posixIsAscii","spaceIsAscii","wordIsAscii","textSegmentMode"].forEach(t=>delete e[t]),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:e.sticky??!1}),t.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;let{enable:t,disable:n}=e.flags;t?.extended&&delete t.extended,n?.extended&&delete n.extended,t?.dotAll&&n?.dotAll&&delete t.dotAll,t?.ignoreCase&&n?.ignoreCase&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,n&&!Object.keys(n).length&&delete e.flags.disable,e.flags.enable||e.flags.disable||delete e.flags},LookaroundAssertion({node:e},t){let{kind:n}=e;"lookbehind"===n&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:n}){let{kind:i}=e;if("fail"===i)n(eV(H({negate:!0}),t));else throw Error(`Unsupported named callout "(*${i.toUpperCase()}"`)},Quantifier({node:e}){if("Quantifier"===e.body.type){let t=D();t.body[0].body.push(e.body),e.body=eV(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){let n=[],i=!1,r=!1;for(let t of e.body)if(1===t.body.length&&"search_start"===t.body[0].kind)t.body.pop();else{let e=function e(t){let n=t.find(e=>"search_start"===e.kind||function(e,t){let n={negate:null,...t};return"LookaroundAssertion"===e.type&&(null===n.negate||e.negate===n.negate)&&1===e.body.length&&L(e.body[0],{type:"Assertion",kind:"search_start"})}(e,{negate:!1})||!function({type:e}){return"Assertion"===e||"Directive"===e||"LookaroundAssertion"===e}(e));if(!n)return null;if("search_start"===n.kind)return n;if("LookaroundAssertion"===n.type)return n.body[0].body[0];if("CapturingGroup"===n.type||"Group"===n.type){let t=[];for(let i of n.body){let n=e(i.body);if(!n)return null;Array.isArray(n)?t.push(...n):t.push(n)}return t}return null}(t.body);e?(i=!0,Array.isArray(e)?n.push(...e):n.push(e)):r=!0}i&&!r&&n.forEach(e=>t.add(e))},exit(e,{accuracy:t,passedLookbehind:n,strategy:i}){if("strict"===t&&n&&i)throw Error(eg`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;"string"!=typeof n||eB(n)||(e.ref=n=eF(n,t))}},eD={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:n}){let{orphan:i,ref:r}=e;i||n.set(e,[...t.get(r).map(({node:e})=>e)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:n,skip:i},{groupOriginByCopy:r,groupsByName:o,multiplexCapturesToLeftByRef:a,openRefs:l,reffedNodesByReferencer:s}){let d=r.get(e);if(d&&l.has(e.number)){let i=eW(e$(e.number),t);s.set(i,l.get(e.number)),n(i);return}l.set(e.number,e),a.set(e.number,[]),e.name&&ey(a,e.name,[]);let u=a.get(e.name??e.number);for(let t=0;t<u.length;t++){let n=u[t];if(d===n.node||d&&d===n.origin||e===n.origin){u.splice(t,1);break}}if(a.get(e.number).push({node:e,origin:d}),e.name&&a.get(e.name).push({node:e,origin:d}),e.name){let t=ey(o,e.name,new Map),n=!1;if(d)n=!0;else for(let e of t.values())if(!e.hasDuplicateNameToRemove){n=!0;break}o.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:n})}},exit({node:e},{openRefs:t}){t.get(e.number)===e&&t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=ev(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:n},i){let{isRecursive:r,ref:o}=e;if(r){let n=t;for(;(n=n.parent)&&("CapturingGroup"!==n.type||n.name!==o&&n.number!==o););i.reffedNodesByReferencer.set(e,n);return}let a=i.subroutineRefMap.get(o),l=0===o,s=l?e$(0):function e(t,n,i,r){let o=Array.isArray(t)?[]:{};for(let[a,l]of Object.entries(t))"parent"===a?o.parent=Array.isArray(i)?r:i:l&&"object"==typeof l?o[a]=e(l,n,o,i):("type"===a&&"CapturingGroup"===l&&n.set(o,n.get(t)??t),o[a]=l);return o}(a,i.groupOriginByCopy,null),d=s;if(!l){var u,h;let e=ez(function(e,t){let n=[];for(;e=e.parent;)(!t||t(e))&&n.push(e);return n}(a,e=>"Group"===e.type&&!!e.flags)),t=e?ev(i.globalFlags,e):i.globalFlags;u=t,h=i.currentFlags,(u.dotAll!==h.dotAll||u.ignoreCase!==h.ignoreCase)&&(d=D({flags:function({dotAll:e,ignoreCase:t}){let n={};return(e||t)&&(n.enable={},e&&(n.enable.dotAll=!0),t&&(n.enable.ignoreCase=!0)),e&&t||(n.disable={},e||(n.disable.dotAll=!0),t||(n.disable.ignoreCase=!0)),n}(t)})).body[0].body.push(s)}n(eV(d,t),{traverse:!l})}},eH={Backreference({node:e,parent:t,replaceWith:n},i){if(e.orphan){i.highestOrphanBackref=Math.max(i.highestOrphanBackref,e.ref);return}let r=i.reffedNodesByReferencer.get(e).filter(t=>(function(e,t){let n=t;do{if("Regex"===n.type)return!1;if("Alternative"===n.type)continue;if(n===e)return!1;for(let t of eU(n.parent)){if(t===n)break;if(t===e||function e(t,n){for(let i of eU(t)??[])if(i===n||e(i,n))return!0;return!1}(t,e))return!0}}while(n=n.parent);throw Error("Unexpected path")})(t,e));r.length?r.length>1?n(eV(D({atomic:!0,body:r.reverse().map(e=>R({body:[T(e.number)]}))}),t)):e.ref=r[0].number:n(eV(H({negate:!0}),t))},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){let n=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let t=0;t<n;t++){let t=I();e.body.at(-1).body.push(t)}}},Subroutine({node:e},t){e.isRecursive&&0!==e.ref&&(e.ref=t.reffedNodesByReferencer.get(e).number)}};function eO(e){q(e,{"*"({node:e,parent:t}){e.parent=t}})}function e$(e){let t=$(e);return t.isRecursive=!0,t}function eF(e,t){if(t.has(e))return t.get(e);let n=`$${t.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/ug,"_")}`;return t.set(e,n),n}function ez(e){let t=["dotAll","ignoreCase"],n={enable:{},disable:{}};return(e.forEach(({flags:e})=>{t.forEach(t=>{e.enable?.[t]&&(delete n.disable[t],n.enable[t]=!0),e.disable?.[t]&&(n.disable[t]=!0)})}),Object.keys(n.enable).length||delete n.enable,Object.keys(n.disable).length||delete n.disable,n.enable||n.disable)?n:null}function eU(e){if(!e)throw Error("Node expected");let{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function eB(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function eG(e,t){let n=E(e,{...t,unicodePropertyMap:eA}).body;return n.length>1||n[0].body.length>1?D({body:n}):n[0].body[0]}function ej(e,t){return e.negate=t,e}function eW(e,t){return e.parent=t,e}function eV(e,t){return eO(e),e.parent=t,e}var eq={"*":{enter({node:e},t){if(e2(e)){let n=t.getCurrentModI();t.pushModI(e.flags?ev({ignoreCase:n},e.flags).ignoreCase:n)}},exit({node:e},t){e2(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){e0(ep(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},n){t(),e1(e,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:e},t){"property"===e.kind&&eP.has(e.value)&&t.setHasCasedChar()}},eK={Alternative:({body:e},t,n)=>e.map(n).join(""),Assertion({kind:e,negate:t}){if("string_end"===e)return"$";if("string_start"===e)return"^";if("word_boundary"===e)return t?eg`\B`:eg`\b`;throw Error(`Unexpected assertion kind "${e}"`)},Backreference({ref:e},t){if("number"!=typeof e)throw Error("Unexpected named backref in transformed AST");if(!t.useFlagMods&&"strict"===t.accuracy&&t.currentFlags.ignoreCase&&!t.captureMap.get(e).ignoreCase)throw Error("Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy");return"\\"+e},CapturingGroup(e,t,n){let{body:i,name:r,number:o}=e,a={ignoreCase:t.currentFlags.ignoreCase},l=t.originMap.get(e);return l&&(a.hidden=!0,o>l.number&&(a.transferTo=l.number)),t.captureMap.set(o,a),`(${r?`?<${r}>`:""}${i.map(n).join("|")})`},Character({value:e},t){let n=ep(e),i=e8(e,{escDigit:"Backreference"===t.lastNode.type,inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(i!==n)return i;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&e0(n)){let e=eL(n);return t.inCharClass?e.join(""):e.length>1?`[${e.join("")}]`:e[0]}return n},CharacterClass(e,t,n){let{kind:i,negate:r,parent:o}=e,{body:a}=e;if("intersection"===i&&!t.useFlagV)throw Error("Use of character class intersection requires min target ES2024");em.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&a.some(e5)&&(a=[M(45),...a.filter(e=>!e5(e))]);let l=()=>`[${r?"^":""}${a.map(n).join("intersection"===i?"&&":"")}]`;if(!t.inCharClass){if((!t.useFlagV||em.bugNestedClassIgnoresNegation)&&!r){let t=a.filter(e=>"CharacterClass"===e.type&&"union"===e.kind&&e.negate);if(t.length){let i=D(),r=i.body[0];return i.parent=o,r.parent=i,e.body=a=a.filter(e=>!t.includes(e)),a.length?(e.parent=r,r.body.push(e)):i.body.pop(),t.forEach(e=>{let t=R({body:[e]});e.parent=t,t.parent=i,i.body.push(t)}),n(i)}}t.inCharClass=!0;let i=l();return t.inCharClass=!1,i}let s=a[0];if("union"===i&&!r&&s&&((!t.useFlagV||!t.verbose)&&"union"===o.kind&&!(em.bugFlagVLiteralHyphenIsRange&&t.useFlagV)||!t.verbose&&"intersection"===o.kind&&1===a.length&&"CharacterClassRange"!==s.type))return a.map(n).join("");if(!t.useFlagV&&"CharacterClass"===o.type)throw Error("Uses nested character class in a way that requires min target ES2024");return l()},CharacterClassRange(e,t){let n=e.min.value,i=e.max.value,r={escDigit:!1,inCharClass:!0,useFlagV:t.useFlagV},o=e8(n,r),a=e8(i,r),l=new Set;return t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&(function(e){let t=e.map(e=>e.codePointAt(0)).sort((e,t)=>e-t),n=[],i=null;for(let e=0;e<t.length;e++)t[e+1]===t[e]+1?i??=t[e]:null===i?n.push(t[e]):(n.push([i,t[e]]),i=null);return n})(e1(e)).forEach(e=>{l.add(Array.isArray(e)?`${e8(e[0],r)}-${e8(e[1],r)}`:e8(e,r))}),`${o}-${a}${[...l].join("")}`},CharacterSet({kind:e,negate:t,value:n,key:i},r){if("dot"===e)return r.currentFlags.dotAll?r.appliedGlobalFlags.dotAll||r.useFlagMods?".":"[^]":eg`[^\n]`;if("digit"===e)return t?eg`\D`:eg`\d`;if("property"===e){if(r.useAppliedIgnoreCase&&r.currentFlags.ignoreCase&&eP.has(n))throw Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${t?eg`\P`:eg`\p`}{${i?`${i}=`:""}${n}}`}if("word"===e)return t?eg`\W`:eg`\w`;throw Error(`Unexpected character set kind "${e}"`)},Flags:(e,t)=>(t.appliedGlobalFlags.ignoreCase?"i":"")+(e.dotAll?"s":"")+(e.sticky?"y":""),Group({atomic:e,body:t,flags:n,parent:i},r,o){let a=r.currentFlags;n&&(r.currentFlags=ev(a,n));let l=t.map(o).join("|"),s=r.verbose||1!==t.length||"Quantifier"===i.type||e||r.useFlagMods&&n?`(?${function(e,t,n){if(e)return">";let i="";if(t&&n){let{enable:e,disable:n}=t;i=(e?.ignoreCase?"i":"")+(e?.dotAll?"s":"")+(n?"-":"")+(n?.ignoreCase?"i":"")+(n?.dotAll?"s":"")}return`${i}:`}(e,n,r.useFlagMods)}${l})`:l;return r.currentFlags=a,s},LookaroundAssertion({body:e,kind:t,negate:n},i,r){let o=`${"lookahead"===t?"":"<"}${n?"!":"="}`;return`(?${o}${e.map(r).join("|")})`},Quantifier:(e,t,n)=>n(e.body)+function({kind:e,max:t,min:n}){return(n||1!==t?n||t!==1/0?1===n&&t===1/0?"+":n===t?`{${n}}`:`{${n},${t===1/0?"":t}}`:"*":"?")+({greedy:"",lazy:"?",possessive:"+"})[e]}(e),Subroutine({isRecursive:e,ref:t},n){if(!e)throw Error("Unexpected non-recursive subroutine in transformed AST");let i=n.recursionLimit;return 0===t?`(?R=${i})`:eg`\g<${t}&R=${i}>`}},eX=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),eY=new Set(["-","\\","]","^","["]),eZ=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),eQ=new Map([[9,eg`\t`],[10,eg`\n`],[11,eg`\v`],[12,eg`\f`],[13,eg`\r`],[8232,eg`\u2028`],[8233,eg`\u2029`],[65279,eg`\uFEFF`]]),eJ=/^\p{Cased}$/u;function e0(e){return eJ.test(e)}function e1(e,t){let n=!!t?.firstOnly,i=e.min.value,r=e.max.value,o=[];if(i<65&&(65535===r||r>=131071)||65536===i&&r>=131071)return o;for(let e=i;e<=r;e++){let t=ep(e);if(!e0(t))continue;let a=eL(t).filter(e=>{let t=e.codePointAt(0);return t<i||t>r});if(a.length&&(o.push(...a),n))break}return o}function e8(e,{escDigit:t,inCharClass:n,useFlagV:i}){var r;if(eQ.has(e))return eQ.get(e);if(e<32||e>126&&e<160||e>262143||t&&(r=e)>47&&r<58)return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,"0")}`;let o=ep(e);return((n?i?eZ:eY:eX).has(o)?"\\":"")+o}function e2({type:e}){return"CapturingGroup"===e||"Group"===e||"LookaroundAssertion"===e}function e5({type:e,value:t}){return"Character"===e&&45===t}var e6=class e extends RegExp{#e=new Map;#t=null;#n;#i=null;#r=null;rawOptions={};get source(){return this.#n||"(?:)"}constructor(t,n,i){const r=!!i?.lazyCompile;if(t instanceof RegExp){if(i)throw Error("Cannot provide options when copying a regexp");super(t,n),this.#n=t.source,t instanceof e&&(this.#e=t.#e,this.#i=t.#i,this.#r=t.#r,this.rawOptions=t.rawOptions)}else{const e={hiddenCaptures:[],strategy:null,transfers:[],...i};super(r?"":t,n),this.#n=t,this.#e=function(e,t){let n=new Map;for(let t of e)n.set(t,{hidden:!0});for(let[e,i]of t)for(let t of i)ey(n,t,{}).transferTo=e;return n}(e.hiddenCaptures,e.transfers),this.#r=e.strategy,this.rawOptions=i??{}}r||(this.#t=this)}exec(t){if(!this.#t){let{lazyCompile:t,...n}=this.rawOptions;this.#t=new e(this.#n,this.flags,n)}let n=this.global||this.sticky,i=this.lastIndex;if("clip_search"===this.#r&&n&&i){this.lastIndex=0;let e=this.#o(t.slice(i));return e&&(function(e,t,n,i){if(e.index+=t,e.input=n,i){let n=e.indices;for(let e=0;e<n.length;e++){let i=n[e];i&&(n[e]=[i[0]+t,i[1]+t])}let i=n.groups;i&&Object.keys(i).forEach(e=>{let n=i[e];n&&(i[e]=[n[0]+t,n[1]+t])})}}(e,i,t,this.hasIndices),this.lastIndex+=i),e}return this.#o(t)}#o(e){let t;this.#t.lastIndex=this.lastIndex;let n=super.exec.call(this.#t,e);if(this.lastIndex=this.#t.lastIndex,!n||!this.#e.size)return n;let i=[...n];n.length=1,this.hasIndices&&(t=[...n.indices],n.indices.length=1);let r=[0];for(let e=1;e<i.length;e++){let{hidden:o,transferTo:a}=this.#e.get(e)??{};if(o?r.push(null):(r.push(n.length),n.push(i[e]),this.hasIndices&&n.indices.push(t[e])),a&&void 0!==i[e]){let o=r[a];if(!o)throw Error(`Invalid capture transfer to "${o}"`);if(n[o]=i[e],this.hasIndices&&(n.indices[o]=t[e]),n.groups){this.#i||(this.#i=function(e){let t,n=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,i=new Map,r=0,o=0;for(;t=n.exec(e);){let{0:e,groups:{capture:n,name:a}}=t;"["===e?r++:r?"]"===e&&r--:n&&(o++,a&&i.set(o,a))}return i}(this.source));let r=this.#i.get(a);r&&(n.groups[r]=i[e],this.hasIndices&&(n.indices.groups[r]=t[e]))}}}return n}};function e7(e={}){let t={target:"auto",cache:new Map,...e};return t.regexConstructor||=e=>{let n;return(n=function(e,t){var n;let i,r,o,a,l=ek(t),s=(n=E(e,{flags:l.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:l.rules.captureGroup,singleline:l.rules.singleline},skipBackrefValidation:l.rules.allowOrphanBackrefs,unicodePropertyMap:eA}),i={accuracy:"default",asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:"ES2025",...{accuracy:l.accuracy,asciiWordBoundaries:l.rules.asciiWordBoundaries,avoidSubclass:l.avoidSubclass,bestEffortTarget:l.target}},eO(n),r={accuracy:i.accuracy,asciiWordBoundaries:i.asciiWordBoundaries,avoidSubclass:i.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:eC[i.bestEffortTarget]>=eC.ES2024,passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:n.flags.digitIsAscii,spaceIsAscii:n.flags.spaceIsAscii,wordIsAscii:n.flags.wordIsAscii},q(n,eN,r),a={currentFlags:o={dotAll:n.flags.dotAll,ignoreCase:n.flags.ignoreCase},prevFlags:null,globalFlags:o,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:r.subroutineRefMap},q(n,eD,a),q(n,eH,{groupsByName:a.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:a.reffedNodesByReferencer}),n._originMap=a.groupOriginByCopy,n._strategy=r.strategy,n),d=function(e,t){let n=ek(t),i=eC[n.target]>=eC.ES2024,r=eC[n.target]>=eC.ES2025,o=n.rules.recursionLimit;if(!Number.isInteger(o)||o<2||o>20)throw Error("Invalid recursionLimit; use 2-20");let a=null,l=null;if(!r){let t=[e.flags.ignoreCase];q(e,eq,{getCurrentModI:()=>t.at(-1),popModI(){t.pop()},pushModI(e){t.push(e)},setHasCasedChar(){t.at(-1)?a=!0:l=!0}})}let s={dotAll:e.flags.dotAll,ignoreCase:!!((e.flags.ignoreCase||a)&&!l)},d=e,u={accuracy:n.accuracy,appliedGlobalFlags:s,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:d,originMap:e._originMap,recursionLimit:o,useAppliedIgnoreCase:!!(!r&&a&&l),useFlagMods:r,useFlagV:i,verbose:n.verbose};function h(e){return u.lastNode=d,d=e,(function(e,t){if(null==e)throw Error(t??"Value expected");return e})(eK[e.type],`Unexpected node type "${e.type}"`)(e,u,h)}let c={pattern:e.body.map(h).join("|"),flags:h(e.flags),options:{...e.options}};return i||(delete c.options.force.v,c.options.disable.v=!0,c.options.unicodeSetsPlugin=null),c._captureTransfers=new Map,c._hiddenCaptures=[],u.captureMap.forEach((e,t)=>{e.hidden&&c._hiddenCaptures.push(t),e.transferTo&&ey(c._captureTransfers,e.transferTo,[]).push(t)}),c}(s,l),u=function(e,t){let n,{hiddenCaptures:i,mode:r}={hiddenCaptures:[],mode:"plugin",...t},o=t?.captureTransfers??new Map;if(!RegExp(eo,"su").test(e))return{pattern:e,captureTransfers:o,hiddenCaptures:i};if("plugin"===r&&J(e,ei`\(\?\(DEFINE\)`,Z.DEFAULT))throw Error("DEFINE groups cannot be used with recursion");let a=[],l=J(e,ei`\\[1-9]`,Z.DEFAULT),s=new Map,d=[],u=!1,h=0,c=0;for(es.lastIndex=0;n=es.exec(e);){let{0:t,groups:{captureName:f,rDepth:p,gRNameOrNum:g,gRDepth:m}}=n;if("["===t)h++;else if(h)"]"===t&&h--;else if(p){if(eu(p),u)throw Error(ed);if(l)throw Error(`${"external"===r?"Backrefs":"Numbered backrefs"} cannot be used with global recursion`);let t=e.slice(0,n.index),s=e.slice(es.lastIndex);if(J(s,eo,Z.DEFAULT))throw Error(ed);let d=p-1;e=eh(t,s,d,!1,i,a,c),o=ef(o,t,d,a.length,0,c);break}else if(g){eu(m);let h=!1;for(let e of d)if(e.name===g||e.num===+g){if(h=!0,e.hasRecursedWithin)throw Error(ed);break}if(!h)throw Error(ei`Recursive \g cannot be used outside the referenced group "${"external"===r?g:ei`\g<${g}&R=${m}>`}"`);let f=s.get(g),p=function(e,t){let n,i=/\\?./gsu;i.lastIndex=t;let r=e.length,o=0,a=1;for(;n=i.exec(e);){let[e]=n;if("["===e)o++;else if(o)"]"===e&&o--;else if("("===e)a++;else if(")"===e&&!--a){r=n.index;break}}return e.slice(t,r)}(e,f);if(l&&J(p,ei`${ea}|\((?!\?)`,Z.DEFAULT))throw Error(`${"external"===r?"Backrefs":"Numbered backrefs"} cannot be used with recursion of capturing groups`);let b=e.slice(f,n.index),v=p.slice(b.length+t.length),y=a.length,C=m-1,S=eh(b,v,C,!0,i,a,c);o=ef(o,b,C,a.length-y,y,c);let k=e.slice(0,f),x=e.slice(f+p.length);e=`${k}${S}${x}`,es.lastIndex+=S.length-t.length-b.length-v.length,d.forEach(e=>e.hasRecursedWithin=!0),u=!0}else if(f)c++,s.set(String(c),es.lastIndex),s.set(f,es.lastIndex),d.push({num:c,name:f});else if("("===t[0]){let e="("===t;e&&(c++,s.set(String(c),es.lastIndex)),d.push(e?{num:c}:{})}else")"===t&&d.pop()}return i.push(...a),{pattern:e,captureTransfers:o,hiddenCaptures:i}}(d.pattern,{captureTransfers:d._captureTransfers,hiddenCaptures:d._hiddenCaptures,mode:"external"}),h=function(e,t){let n,i=t?.hiddenCaptures??[],r=t?.captureTransfers??new Map;if(!/\(\?>/.test(e))return{pattern:e,captureTransfers:r,hiddenCaptures:i};let o="(?:(?=(",a=[0],l=[],s=0,d=0,u=NaN;do{let t;n=!1;let h=0,c=0,f=!1;for(ee.lastIndex=Number.isNaN(u)?0:u+o.length;t=ee.exec(e);){let{0:p,index:g,groups:{capturingStart:m,noncapturingStart:b}}=t;if("["===p)h++;else if(h)"]"===p&&h--;else if("(?>"!==p||f){if(f&&b)c++;else if(m)f?c++:(s++,a.push(s+d));else if(")"===p&&f){if(!c){let t=s+ ++d;e=`${e.slice(0,u)}${o}${e.slice(u+3,g)}))<$$${t}>)${e.slice(g+1)}`,n=!0,l.push(t);for(let e=0;e<i.length;e++)i[e]>=t&&i[e]++;if(r.size){let e=new Map;r.forEach((n,i)=>{e.set(i>=t?i+1:i,n.map(e=>e>=t?e+1:e))}),r=e}break}c--}}else u=g,f=!0}}while(n);return i.push(...l),{pattern:e=Q(e,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:e,groups:{backrefNum:t,wrappedBackrefNum:n}})=>{if(t){let n=+t;if(n>a.length-1)throw Error(`Backref "${e}" greater than number of captures`);return`\\${a[n]}`}return`\\${n}`},Z.DEFAULT),captureTransfers:r,hiddenCaptures:i}}(function(e){let t;if(!RegExp(`${et}\\+`).test(e))return{pattern:e};let n=[],i=null,r=null,o="",a=0;for(en.lastIndex=0;t=en.exec(e);){let{0:d,index:u,groups:{qBase:h,qMod:c,invalidQ:f}}=t;if("["===d)a||(r=u),a++;else if("]"===d)a?a--:r=null;else if(!a)if("+"===c&&o&&!o.startsWith("(")){if(f)throw Error(`Invalid quantifier "${d}"`);let t=-1;if(/^\{\d+\}$/.test(h)){var l,s;l=e,s=u+h.length,e=l.slice(0,s)+""+l.slice(s+c.length)}else{if(")"===o||"]"===o){let t=")"===o?i:r;if(null===t)throw Error(`Invalid unmatched "${o}"`);e=`${e.slice(0,t)}(?>${e.slice(t,u)}${h})${e.slice(u+d.length)}`}else e=`${e.slice(0,u-o.length)}(?>${o}${h})${e.slice(u+d.length)}`;t+=4}en.lastIndex+=t}else"("===d[0]?n.push(u):")"===d&&(i=n.length?n.pop():null);o=d}return{pattern:e}}(u.pattern).pattern,{captureTransfers:u.captureTransfers,hiddenCaptures:u.hiddenCaptures}),c={pattern:h.pattern,flags:`${l.hasIndices?"d":""}${l.global?"g":""}${d.flags}${d.options.disable.v?"u":"v"}`};if(l.avoidSubclass){if(l.lazyCompileLength!==1/0)throw Error("Lazy compilation requires subclass")}else{let e=h.hiddenCaptures.sort((e,t)=>e-t),t=Array.from(h.captureTransfers),n=s._strategy,i=c.pattern.length>=l.lazyCompileLength;(e.length||t.length||n||i)&&(c.options={...e.length&&{hiddenCaptures:e},...t.length&&{transfers:t},...n&&{strategy:n},...i&&{lazyCompile:i}})}return c}(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...{target:t.target}})).options?new e6(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)},{createScanner:e=>new i(e,t),createString:e=>({content:e})}}},2696(e,t,n){n.d(t,{HA:()=>a,HX:()=>P,Mz:()=>u,Q4:()=>k,Tu:()=>s,at:()=>_,cS:()=>w,fb:()=>g,hg:()=>L,r5:()=>T,sJ:()=>d,uz:()=>f,xv:()=>o,zH:()=>h});var i=n(8336),r=n(8823);function o(e,t){let n="string"==typeof e?{}:{...e.colorReplacements},i="string"==typeof e?e:e.name;for(let[e,r]of Object.entries(t?.colorReplacements||{}))"string"==typeof r?n[e]=r:e===i&&Object.assign(n,r);return n}function a(e,t){return e&&t?.[e?.toLowerCase()]||e}async function l(e){return Promise.resolve("function"==typeof e?e():e).then(e=>e.default||e)}function s(e){return!e||["plaintext","txt","text","plain"].includes(e)}function d(e){return"ansi"===e||s(e)}function u(e){return"none"===e}function h(e){return u(e)}let c=/(\r?\n)/g;function f(e,t=!1){if(0===e.length)return[["",0]];let n=e.split(c),i=0,r=[];for(let e=0;e<n.length;e+=2){let o=t?n[e]+(n[e+1]||""):n[e];r.push([o,i]),i+=n[e].length,i+=n[e+1]?.length||0}return r}let p="__shiki_resolved";function g(e){if(e?.[p])return e;let t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||="dark",t.colorReplacements={...t.colorReplacements},t.settings||=[];let{bg:n,fg:i}=t;if(!n||!i){let e=t.settings?t.settings.find(e=>!e.name&&!e.scope):void 0;e?.settings?.foreground&&(i=e.settings.foreground),e?.settings?.background&&(n=e.settings.background),!i&&t?.colors?.["editor.foreground"]&&(i=t.colors["editor.foreground"]),!n&&t?.colors?.["editor.background"]&&(n=t.colors["editor.background"]),i||(i="light"===t.type?"#333333":"#bbbbbb"),n||(n="light"===t.type?"#fffffe":"#1e1e1e"),t.fg=i,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let r=0,o=new Map;function a(e){if(o.has(e))return o.get(e);r+=1;let n=`#${r.toString(16).padStart(8,"0").toLowerCase()}`;return t.colorReplacements?.[`#${n}`]?a(e):(o.set(e,n),n)}for(let e of(t.settings=t.settings.map(e=>{let n=e.settings?.foreground&&!e.settings.foreground.startsWith("#"),i=e.settings?.background&&!e.settings.background.startsWith("#");if(!n&&!i)return e;let r={...e,settings:{...e.settings}};if(n){let n=a(e.settings.foreground);t.colorReplacements[n]=e.settings.foreground,r.settings.foreground=n}if(i){let n=a(e.settings.background);t.colorReplacements[n]=e.settings.background,r.settings.background=n}return r}),Object.keys(t.colors||{})))if(("editor.foreground"===e||"editor.background"===e||e.startsWith("terminal.ansi"))&&!t.colors[e]?.startsWith("#")){let n=a(t.colors[e]);t.colorReplacements[n]=t.colors[e],t.colors[e]=n}return Object.defineProperty(t,p,{enumerable:!1,writable:!1,value:!0}),t}async function m(e){return[...new Set((await Promise.all(e.filter(e=>!d(e)).map(async e=>await l(e).then(e=>Array.isArray(e)?e:[e])))).flat())]}async function b(e){return(await Promise.all(e.map(async e=>u(e)?null:g(await l(e))))).filter(e=>!!e)}function v(e,t){if(!t)return e;if(t[e]){let n=new Set([e]);for(;t[e];){if(e=t[e],n.has(e))throw new i.H(`Circular alias \`${[...n].join(" -> ")} -> ${e}\``);n.add(e)}}return e}var y=class extends r.OR{_resolver;_themes;_langs;_alias;_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;constructor(e,t,n,i={}){super(e),this._resolver=e,this._themes=t,this._langs=n,this._alias=i,this._themes.map(e=>this.loadTheme(e)),this.loadLanguages(this._langs)}getTheme(e){return"string"==typeof e?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){let t=g(e);return t.name&&(this._resolvedThemes.set(t.name,t),this._loadedThemesCache=null),t}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(e){let t=this._textmateThemeCache.get(e);t||(t=r.Sx.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=v(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;let t=new Set([...this._langMap.values()].filter(t=>t.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);let n={balancedBracketSelectors:e.balancedBracketSelectors||["*"],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);let i=this.loadGrammarWithConfiguration(e.scopeName,1,n);if(i.name=e.name,this._resolvedGrammars.set(e.name,i),e.aliases&&e.aliases.forEach(t=>{this._alias[t]=e.name}),this._loadedLanguagesCache=null,t.size)for(let e of t)this._resolvedGrammars.delete(e.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(e.scopeName),this._syncRegistry?._grammars?.delete(e.scopeName),this.loadLanguage(this._langMap.get(e.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(let t of e)this.resolveEmbeddedLanguages(t);let t=[...this._langGraph.entries()],n=t.filter(([e,t])=>!t);if(n.length){let e=t.filter(([e,t])=>!!t&&(t.embeddedLanguages||t.embeddedLangs)?.some(e=>n.map(([e])=>e).includes(e))).filter(e=>!n.includes(e));throw new i.H(`Missing languages ${n.map(([e])=>`\`${e}\``).join(", ")}, required by ${e.map(([e])=>`\`${e}\``).join(", ")}`)}for(let[e,n]of t)this._resolver.addLanguage(n);for(let[e,n]of t)this.loadLanguage(n)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(e){this._langMap.set(e.name,e),this._langGraph.set(e.name,e);let t=e.embeddedLanguages??e.embeddedLangs;if(t)for(let e of t)this._langGraph.set(e,this._langMap.get(e))}},C=class{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,t){this._onigLib={createOnigScanner:t=>e.createScanner(t),createOnigString:t=>e.createString(t)},t.forEach(e=>this.addLanguage(e))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(t=>{this._langs.set(t,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)})}getInjections(e){let t=e.split("."),n=[];for(let e=1;e<=t.length;e++){let i=t.slice(0,e).join(".");n=[...n,...this._injections.get(i)||[]]}return n}};let S=0;async function k(e){e.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[t,n,r]=await Promise.all([b(e.themes||[]),m(e.langs||[]),e.engine]);return function(e){let t;S+=1,!1!==e.warnings&&S>=10&&S%10==0&&console.warn(`[Shiki] ${S} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let n=!1;if(!e.engine)throw new i.H("`engine` option is required for synchronous mode");let r=(e.langs||[]).flat(1),o=(e.themes||[]).flat(1).map(g),a=new y(new C(e.engine,r),o,r,e.langAlias);function l(e){if("none"===e)return{bg:"",fg:"",name:"none",settings:[],type:"dark"};u();let t=a.getTheme(e);if(!t)throw new i.H(`Theme \`${e}\` not found, you may need to load it first`);return t}function s(...e){u(),a.loadLanguages(e.flat(1))}function d(...e){for(let t of(u(),e.flat(1)))a.loadTheme(t)}function u(){if(n)throw new i.H("Shiki instance has been disposed")}function h(){n||(n=!0,a.dispose(),S-=1)}return{setTheme:function(e){u();let n=l(e);return t!==e&&(a.setTheme(n),t=e),{theme:n,colorMap:a.getColorMap()}},getTheme:l,getLanguage:function(e){u();let t=a.getGrammar("string"==typeof e?e:e.name);if(!t)throw new i.H(`Language \`${e}\` not found, you may need to load it first`);return t},getLoadedThemes:function(){return u(),a.getLoadedThemes()},getLoadedLanguages:function(){return u(),a.getLoadedLanguages()},resolveLangAlias:function(t){return v(t,e.langAlias)},loadLanguage:async function(...e){return s(await m(e))},loadLanguageSync:s,loadTheme:async function(...e){return u(),d(await b(e))},loadThemeSync:d,dispose:h,[Symbol.dispose]:h}}({...e,themes:t,langs:n,engine:r})}let x=new WeakMap;function w(e,t){x.set(e,t)}function L(e){return x.get(e)}var A=class e{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,n){return new e(Object.fromEntries((Array.isArray(n)?n:[n]).map(e=>[e,r.DI])),t)}constructor(...e){if(2===e.length){const[t,n]=e;this.lang=n,this._stacks=t}else{const[t,n,i]=e;this.lang=n,this._stacks={[i]:t}}}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){var t;let n,i;return t=this._stacks[e],n=[],i=new Set,!function e(t){if(i.has(t))return;i.add(t);let r=t?.nameScopesList?.scopeName;r&&n.push(r),t.parent&&e(t.parent)}(t),n}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};let E=/,/,R=/ /;function _(e,t,n={}){var r,o;let a,l,{theme:d=e.getLoadedThemes()[0]}=n;if(s(e.resolveLangAlias(n.lang||"text"))||u(d))return f(t).map(e=>[{content:e[0],offset:e[1]}]);let{theme:h,colorMap:c}=e.setTheme(d),p=e.getLanguage(n.lang||"text");if(n.grammarState){if(n.grammarState.lang!==p.name)throw new i.H(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${p.name}"`);if(!n.grammarState.themes.includes(h.name))throw new i.H(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${h.name}"`)}return l=new A((a=I(t,r=p,o=h,c,n)).stateStack,r.name,o.name),w(a.tokens,l),a.tokens}function T(...e){if(2===e.length)return L(e[1]);let[t,n,r={}]=e,{lang:o="text",theme:a=t.getLoadedThemes()[0]}=r;if(s(o)||u(a))throw new i.H("Plain language does not have grammar state");if("ansi"===o)throw new i.H("ANSI language does not have grammar state");let{theme:l,colorMap:d}=t.setTheme(a),h=t.getLanguage(o);return new A(I(n,h,l,d,r).stateStack,h.name,l.name)}function I(e,t,n,l,s){let d=o(n,s),{tokenizeMaxLineLength:u=0,tokenizeTimeLimit:h=500,includeExplanation:c=!1}=s,p=f(e),g=s.grammarState?function(e,t){if(!(e instanceof A))throw new i.H("Invalid grammar state");return e.getInternalStack(t)}(s.grammarState,n.name)??r.DI:null!=s.grammarContextCode?I(s.grammarContextCode,t,n,l,{...s,grammarState:void 0,grammarContextCode:void 0}).stateStack:r.DI,m=[],b=[];for(let e=0,i=p.length;e<i;e++){let i,o,[s,f]=p[e];if(""===s){m=[],b.push([]);continue}if(u>0&&s.length>=u){m=[],b.push([{content:s,offset:f,color:"",fontStyle:0}]);continue}c&&"tokenType"!==c&&(i=t.tokenizeLine(s,g,h).tokens,o=0);let v=t.tokenizeLine2(s,g,h),y=v.tokens.length/2;for(let e=0;e<y;e++){let t=v.tokens[2*e],u=e+1<y?v.tokens[2*e+2]:s.length;if(t===u)continue;let h=v.tokens[2*e+1],p=a(l[r.j8.getForeground(h)],d),g=r.j8.getFontStyle(h),b={content:s.substring(t,u),offset:f+t,color:p,fontStyle:g};if("tokenType"===c)b.type=r.j8.getTokenType(h);else if(c){let e=[];if("scopeName"!==c)for(let t of n.settings){let n;switch(typeof t.scope){case"string":n=t.scope.split(E).map(e=>e.trim());break;case"object":n=t.scope;break;default:continue}e.push({settings:t,selectors:n.map(e=>e.split(R))})}b.explanation=[];let r=0;for(;t+r<u;){let t=i[o],n=s.substring(t.startIndex,t.endIndex);r+=n.length,b.explanation.push({content:n,scopes:"scopeName"===c?t.scopes.map(e=>({scopeName:e})):function(e,t){let n=[];for(let i=0,r=t.length;i<r;i++){let r=t[i];n[i]={scopeName:r,themeMatches:function(e,t,n){let i=[];for(let{selectors:r,settings:o}of e)for(let e of r)if(function(e,t,n){if(!M(e.at(-1),t))return!1;let i=e.length-2,r=n.length-1;for(;i>=0&&r>=0;)M(e[i],n[r])&&(i-=1),r-=1;return -1===i}(e,t,n)){i.push(o);break}return i}(e,r,t.slice(0,i))}}return n}(e,t.scopes)}),o+=1}}m.push(b)}b.push(m),m=[],g=v.ruleStack}return{tokens:b,stateStack:g}}function M(e,t){return e===t||t.substring(0,e.length)===e&&"."===t[e.length]}function P(e,t,n,i=_){let r=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})),o=r.map(r=>{let o=i(e,t,{...n,theme:r.theme});return{tokens:o,state:L(o),theme:"string"==typeof r.theme?r.theme:r.theme.name}}),a=function(...e){let t=e.map(()=>[]),n=e.length;for(let i=0;i<e[0].length;i++){let r=e.map(e=>e[i]),o=t.map(()=>[]);t.forEach((e,t)=>e.push(o[t]));let a=r.map(()=>0),l=r.map(e=>e[0]);for(;l.every(e=>e);){let e=Math.min(...l.map(e=>e.content.length));for(let t=0;t<n;t++){let n=l[t];n.content.length===e?(o[t].push(n),a[t]+=1,l[t]=r[t][a[t]]):(o[t].push({...n,content:n.content.slice(0,e)}),l[t]={...n,content:n.content.slice(e),offset:n.offset+e})}}}return t}(...o.map(e=>e.tokens)),l=a[0].map((e,t)=>e.map((e,i)=>{let o={content:e.content,variants:{},offset:e.offset};return"includeExplanation"in n&&n.includeExplanation&&(o.explanation=e.explanation),a.forEach((e,n)=>{let{content:a,explanation:l,offset:s,...d}=e[t][i];o.variants[r[n].color]=d}),o})),s=o[0].state?new A(Object.fromEntries(o.map(e=>[e.theme,e.state?.getInternalStack(e.theme)])),o[0].state.lang):void 0;return s&&w(l,s),l}},8336(e,t,n){n.d(t,{H:()=>i});var i=class extends Error{constructor(e){super(e),this.name="ShikiError"}}},8823(e,t,n){n.d(t,{DI:()=>ef,OR:()=>ec,Sx:()=>h,j8:()=>C,zz:()=>g});function i(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}var r,o=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,a=class{static hasCaptures(e){return null!==e&&(o.lastIndex=0,o.test(e))}static replaceCaptures(e,t,n){return e.replace(o,(e,i,r,o)=>{let a=n[parseInt(i||r,10)];if(!a)return e;{let e=t.substring(a.start,a.end);for(;"."===e[0];)e=e.substring(1);switch(o){case"downcase":return e.toLowerCase();case"upcase":return e.toUpperCase();default:return e}}})}};function l(e,t){if(null===e&&null===t)return 0;if(!e)return -1;if(!t)return 1;let n=e.length,i=t.length;if(n===i){for(let i=0;i<n;i++){var r,o;let n=(r=e[i],r<(o=t[i])?-1:+(r>o));if(0!==n)return n}return 0}return n-i}function s(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function d(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var u=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);let t=this.fn(e);return this.cache.set(e,t),t}},h=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(function(e){if(!e||!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],i=0;for(let e=0,r=t.length;e<r;e++){let r,o=t[e];if(!o.settings)continue;if("string"==typeof o.scope){let e=o.scope;r=(e=(e=e.replace(/^[,]+/,"")).replace(/[,]+$/,"")).split(",")}else r=Array.isArray(o.scope)?o.scope:[""];let a=-1;if("string"==typeof o.settings.fontStyle){a=0;let e=o.settings.fontStyle.split(" ");for(let t=0,n=e.length;t<n;t++)switch(e[t]){case"italic":a|=1;break;case"bold":a|=2;break;case"underline":a|=4;break;case"strikethrough":a|=8}}let l=null;"string"==typeof o.settings.foreground&&s(o.settings.foreground)&&(l=o.settings.foreground);let d=null;"string"==typeof o.settings.background&&s(o.settings.background)&&(d=o.settings.background);for(let t=0,o=r.length;t<o;t++){let o=r[t].trim().split(" "),s=o[o.length-1],u=null;o.length>1&&(u=o.slice(0,o.length-1)).reverse(),n[i++]=new p(s,u,e,a,l,d)}}return n}(e),t)}static createFromParsedTheme(e,t){return function(e,t){e.sort((e,t)=>{var n,i;let r=(n=e.scope,n<(i=t.scope)?-1:+(n>i));return 0!==r||0!==(r=l(e.parentScopes,t.parentScopes))?r:e.index-t.index});let n=0,i="#000000",r="#ffffff";for(;e.length>=1&&""===e[0].scope;){let t=e.shift();-1!==t.fontStyle&&(n=t.fontStyle),null!==t.foreground&&(i=t.foreground),null!==t.background&&(r=t.background)}let o=new m(t),a=new f(n,o.getId(i),o.getId(r)),s=new y(new v(0,null,-1,0,0),[]);for(let t=0,n=e.length;t<n;t++){let n=e[t];s.insert(0,n.scope,n.parentScopes,n.fontStyle,o.getId(n.foreground),o.getId(n.background))}return new h(o,a,s)}(e,t)}_cachedMatchRoot=new u(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(null===e)return this._defaults;let t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>(function(e,t){if(0===t.length)return!0;for(let r=0;r<t.length;r++){var n,i;let o=t[r],a=!1;if(">"===o){if(r===t.length-1)return!1;o=t[++r],a=!0}for(;e&&(n=e.scopeName,!((i=o)===n||n.startsWith(i)&&"."===n[i.length]));){if(a)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0})(e.parent,t.parentScopes));return n?new f(n.fontStyle,n.foreground,n.background):null}},c=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(let i of n)t=new e(t,i);return t}static from(...t){let n=null;for(let i=0;i<t.length;i++)n=new e(n,t[i]);return n}push(t){return new e(this,t)}getSegments(){let e=this,t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(" ")}extends(e){return this===e||null!==this.parent&&this.parent.extends(e)}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}},f=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}},p=class{constructor(e,t,n,i,r,o){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=i,this.foreground=r,this.background=o}},g=((r=g||{})[r.NotSet=-1]="NotSet",r[r.None=0]="None",r[r.Italic=1]="Italic",r[r.Bold=2]="Bold",r[r.Underline=4]="Underline",r[r.Strikethrough=8]="Strikethrough",r),m=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(null===e)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},b=Object.freeze([]),v=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,i,r){this.scopeDepth=e,this.parentScopes=t||b,this.fontStyle=n,this.foreground=i,this.background=r}clone(){return new e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let n=0,i=e.length;n<i;n++)t[n]=e[n].clone();return t}acceptOverwrite(e,t,n,i){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,-1!==t&&(this.fontStyle=t),0!==n&&(this.foreground=n),0!==i&&(this.background=i)}},y=class e{constructor(e,t=[],n={}){this._mainRule=e,this._children=n,this._rulesWithParentScopes=t}_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let n=0,i=0;for(;">"===e.parentScopes[n]&&n++,">"===t.parentScopes[i]&&i++,!(n>=e.parentScopes.length)&&!(i>=t.parentScopes.length);){let r=t.parentScopes[i].length-e.parentScopes[n].length;if(0!==r)return r;n++,i++}return t.parentScopes.length-e.parentScopes.length}match(t){if(""!==t){let e,n,i=t.indexOf(".");if(-1===i?(e=t,n=""):(e=t.substring(0,i),n=t.substring(i+1)),this._children.hasOwnProperty(e))return this._children[e].match(n)}let n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(e._cmpBySpecificity),n}insert(t,n,i,r,o,a){let l,s,d;if(""===n)return void this._doInsertHere(t,i,r,o,a);let u=n.indexOf(".");-1===u?(l=n,s=""):(l=n.substring(0,u),s=n.substring(u+1)),this._children.hasOwnProperty(l)?d=this._children[l]:(d=new e(this._mainRule.clone(),v.cloneArr(this._rulesWithParentScopes)),this._children[l]=d),d.insert(t+1,s,i,r,o,a)}_doInsertHere(e,t,n,i,r){if(null===t)return void this._mainRule.acceptOverwrite(e,n,i,r);for(let o=0,a=this._rulesWithParentScopes.length;o<a;o++){let a=this._rulesWithParentScopes[o];if(0===l(a.parentScopes,t))return void a.acceptOverwrite(e,n,i,r)}-1===n&&(n=this._mainRule.fontStyle),0===i&&(i=this._mainRule.foreground),0===r&&(r=this._mainRule.background),this._rulesWithParentScopes.push(new v(e,t,n,i,r))}},C=class e{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(t){let n=e.getLanguageId(t),i=e.getTokenType(t),r=e.getFontStyle(t);console.log({languageId:n,tokenType:i,fontStyle:r,foreground:e.getForeground(t),background:e.getBackground(t)})}static getLanguageId(e){return(255&e)>>>0}static getTokenType(e){return(768&e)>>>8}static containsBalancedBrackets(e){return(1024&e)!=0}static getFontStyle(e){return(30720&e)>>>11}static getForeground(e){return(0xff8000&e)>>>15}static getBackground(e){return(0xff000000&e)>>>24}static set(t,n,i,r,o,a,l){let s=e.getLanguageId(t),d=e.getTokenType(t),u=+!!e.containsBalancedBrackets(t),h=e.getFontStyle(t),c=e.getForeground(t),f=e.getBackground(t);return 0!==n&&(s=n),8!==i&&(d=i),null!==r&&(u=+!!r),-1!==o&&(h=o),0!==a&&(c=a),0!==l&&(f=l),(s|d<<8|u<<10|h<<11|c<<15|f<<24)>>>0}};function S(e,t){var n;let i,r,o=[],a=(n=e,r=(i=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g).exec(n),{next:()=>{if(!r)return null;let e=r[0];return r=i.exec(n),e}}),l=a.next();for(;null!==l;){let e=0;if(2===l.length&&":"===l.charAt(1)){switch(l.charAt(0)){case"R":e=1;break;case"L":e=-1;break;default:console.log(`Unknown priority ${l} in scope selector`)}l=a.next()}let t=d();if(o.push({matcher:t,priority:e}),","!==l)break;l=a.next()}return o;function s(){if("-"===l){l=a.next();let e=s();return t=>!!e&&!e(t)}if("("===l){l=a.next();let e=function(){let e=[],t=d();for(;t&&(e.push(t),"|"===l||","===l);){do l=a.next();while("|"===l||","===l);t=d()}return t=>e.some(e=>e(t))}();return")"===l&&(l=a.next()),e}if(k(l)){let e=[];do e.push(l),l=a.next();while(k(l));return n=>t(e,n)}return null}function d(){let e=[],t=s();for(;t;)e.push(t),t=s();return t=>e.every(e=>e(t))}}function k(e){return!!e&&!!e.match(/[\w\.:]+/)}function x(e){"function"==typeof e.dispose&&e.dispose()}var w=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},L=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},A=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){let t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},E=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new w(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new A;for(let n of e)!function(e,t,n,i){let r=n.lookup(e.scopeName);if(!r){if(e.scopeName===t)throw Error(`No grammar provided for <${t}>`);return}let o=n.lookup(t);e instanceof w?_({baseGrammar:o,selfGrammar:r},i):R(e.ruleName,{baseGrammar:o,selfGrammar:r,repository:r.repository},i);let a=n.injections(e.scopeName);if(a)for(let e of a)i.add(new w(e))}(n,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof w){if(this.seenFullScopeRequests.has(e.scopeName))continue;this.seenFullScopeRequests.add(e.scopeName),this.Q.push(e)}else{if(this.seenFullScopeRequests.has(e.scopeName)||this.seenPartialScopeRequests.has(e.toKey()))continue;this.seenPartialScopeRequests.add(e.toKey()),this.Q.push(e)}}};function R(e,t,n){t.repository&&t.repository[e]&&T([t.repository[e]],t,n)}function _(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&T(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&T(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function T(e,t,n){for(let r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let e=r.repository?i({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&T(r.patterns,{...t,repository:e},n);let o=r.include;if(!o)continue;let a=H(o);switch(a.kind){case 0:_({...t,selfGrammar:t.baseGrammar},n);break;case 1:_(t,n);break;case 2:R(a.ruleName,{...t,repository:e},n);break;case 3:case 4:let l=a.scopeName===t.selfGrammar.scopeName?t.selfGrammar:a.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(l){let i={baseGrammar:t.baseGrammar,selfGrammar:l,repository:e};4===a.kind?R(a.ruleName,i,n):_(i,n)}else 4===a.kind?n.add(new L(a.scopeName,a.ruleName)):n.add(new w(a.scopeName))}}}var I=class{kind=0},M=class{kind=1},P=class{constructor(e){this.ruleName=e}kind=2},N=class{constructor(e){this.scopeName=e}kind=3},D=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function H(e){if("$base"===e)return new I;if("$self"===e)return new M;let t=e.indexOf("#");return -1===t?new N(e):0===t?new P(e.substring(1)):new D(e.substring(0,t),e.substring(t+1))}var O=/\\(\d+)/,$=/\\(\d+)/g;Symbol("RuleId");var F=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,i){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=a.hasCaptures(this._name),this._contentName=i||null,this._contentNameIsCapturing=a.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${function e(t){let n=~t.lastIndexOf("/")||~t.lastIndexOf("\\");return 0===n?t:~n==t.length-1?e(t.substring(0,t.length-1)):t.substr(~n+1)}(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return this._nameIsCapturing&&null!==this._name&&null!==e&&null!==t?a.replaceCaptures(this._name,e,t):this._name}getContentName(e,t){return this._contentNameIsCapturing&&null!==this._contentName?a.replaceCaptures(this._contentName,e,t):this._contentName}},z=class extends F{retokenizeCapturedWithRuleId;constructor(e,t,n,i,r){super(e,t,n,i),this.retokenizeCapturedWithRuleId=r}dispose(){}collectPatterns(e,t){throw Error("Not supported!")}compile(e,t){throw Error("Not supported!")}compileAG(e,t,n,i){throw Error("Not supported!")}},U=class extends F{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,i,r){super(e,t,n,null),this._match=new V(i,this.id),this.captures=r,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,i){return this._getCachedCompiledPatterns(e).compileAG(e,n,i)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new q,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},B=class extends F{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,i,r){super(e,t,n,i),this.patterns=r.patterns,this.hasMissingPatterns=r.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(e,t){for(let n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,i){return this._getCachedCompiledPatterns(e).compileAG(e,n,i)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new q,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},G=class extends F{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,i,r,o,a,l,s,d){super(e,t,n,i),this._begin=new V(r,this.id),this.beginCaptures=o,this._end=new V(a||"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=l,this.applyEndPatternLast=s||!1,this.patterns=d.patterns,this.hasMissingPatterns=d.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,i){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,i)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){for(let t of(this._cachedCompiledPatterns=new q,this.patterns))e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},j=class extends F{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,i,r,o,a,l,s){super(e,t,n,i),this._begin=new V(r,this.id),this.beginCaptures=o,this.whileCaptures=l,this._while=new V(a,-2),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=s.patterns,this.hasMissingPatterns=s.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,i){return this._getCachedCompiledPatterns(e).compileAG(e,n,i)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns)for(let t of(this._cachedCompiledPatterns=new q,this.patterns))e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns);return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,i){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,i)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new q,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||""),this._cachedCompiledWhilePatterns}},W=class e{static createCaptureRule(e,t,n,i,r){return e.registerRule(e=>new z(t,e,n,i,r))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(o=>{if(t.id=o,t.match)return new U(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(void 0===t.begin){t.repository&&(r=i({},r,t.repository));let o=t.patterns;return void 0===o&&t.include&&(o=[{include:t.include}]),new B(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(o,n,r))}return t.while?new j(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,e._compileCaptures(t.whileCaptures||t.captures,n,r),e._compilePatterns(t.patterns,n,r)):new G(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,e._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,e._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,i){let r=[];if(t){let o=0;for(let e in t){if("$vscodeTextmateLocation"===e)continue;let t=parseInt(e,10);t>o&&(o=t)}for(let e=0;e<=o;e++)r[e]=null;for(let o in t){if("$vscodeTextmateLocation"===o)continue;let a=parseInt(o,10),l=0;t[o].patterns&&(l=e.getCompiledRuleId(t[o],n,i)),r[a]=e.createCaptureRule(n,t[o].$vscodeTextmateLocation,t[o].name,t[o].contentName,l)}}return r}static _compilePatterns(t,n,i){let r=[];if(t)for(let o=0,a=t.length;o<a;o++){let a=t[o],l=-1;if(a.include){let t=H(a.include);switch(t.kind){case 0:case 1:l=e.getCompiledRuleId(i[a.include],n,i);break;case 2:let r=i[t.ruleName];r&&(l=e.getCompiledRuleId(r,n,i));break;case 3:case 4:let o=t.scopeName,s=4===t.kind?t.ruleName:null,d=n.getExternalGrammar(o,i);if(d)if(s){let t=d.repository[s];t&&(l=e.getCompiledRuleId(t,n,d.repository))}else l=e.getCompiledRuleId(d.repository.$self,n,d.repository)}}else l=e.getCompiledRuleId(a,n,i);if(-1!==l){let e=n.getRule(l),t=!1;if((e instanceof B||e instanceof G||e instanceof j)&&e.hasMissingPatterns&&0===e.patterns.length&&(t=!0),t)continue;r.push(l)}}return{patterns:r,hasMissingPatterns:(t?t.length:0)!==r.length}}},V=class e{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&"string"==typeof e){const t=e.length;let n=0,i=[],r=!1;for(let o=0;o<t;o++)if("\\"===e.charAt(o)&&o+1<t){const t=e.charAt(o+1);"z"===t?(i.push(e.substring(n,o)),i.push("$(?!\\n)(?<!\\n)"),n=o+2):("A"===t||"G"===t)&&(r=!0),o++}this.hasAnchor=r,0===n?this.source=e:(i.push(e.substring(n,t)),this.source=i.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=t,"string"==typeof this.source?this.hasBackReferences=O.test(this.source):this.hasBackReferences=!1}clone(){return new e(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if("string"!=typeof this.source)throw Error("This method should only be called if the source is a string");let n=t.map(t=>e.substring(t.start,t.end));return $.lastIndex=0,this.source.replace($,(e,t)=>d(n[parseInt(t,10)]||""))}_buildAnchorCache(){let e,t,n,i;if("string"!=typeof this.source)throw Error("This method should only be called if the source is a string");let r=[],o=[],a=[],l=[];for(e=0,t=this.source.length;e<t;e++)n=this.source.charAt(e),r[e]=n,o[e]=n,a[e]=n,l[e]=n,"\\"===n&&e+1<t&&("A"===(i=this.source.charAt(e+1))?(r[e+1]="",o[e+1]="",a[e+1]="A",l[e+1]="A"):"G"===i?(r[e+1]="",o[e+1]="G",a[e+1]="",l[e+1]="G"):(r[e+1]=i,o[e+1]=i,a[e+1]=i,l[e+1]=i),e++);return{A0_G0:r.join(""),A0_G1:o.join(""),A1_G0:a.join(""),A1_G1:l.join("")}}resolveAnchors(e,t){if(!this.hasAnchor||!this._anchorCache||"string"!=typeof this.source)return this.source;if(e)if(t)return this._anchorCache.A1_G1;else return this._anchorCache.A1_G0;return t?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},q=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(e=>e.source);this._cached=new K(e,t,this._items.map(e=>e.ruleId))}return this._cached}compileAG(e,t,n){if(!this._hasAnchors)return this.compile(e);if(t)if(n)return this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1;else return this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0;return n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0)}_resolveAnchors(e,t,n){return new K(e,this._items.map(e=>e.resolveAnchors(t,n)),this._items.map(e=>e.ruleId))}},K=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){"function"==typeof this.scanner.dispose&&this.scanner.dispose()}toString(){let e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(" - "+this.rules[t]+": "+this.regExps[t]);return e.join("\n")}findNextMatchSync(e,t,n){let i=this.scanner.findNextMatchSync(e,t,n);return i?{ruleId:this.rules[i.index],captureIndices:i.captureIndices}:null}},X=class{constructor(e,t){this.languageId=e,this.tokenType=t}},Y=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new X(e,8),this._embeddedLanguagesMatcher=new Z(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return null===t?e._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new X(0,0);_getBasicScopeAttributes=new u(e=>new X(this._scopeToLanguage(e),this._toStandardTokenType(e)));_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(t){let n=t.match(e.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw Error("Unexpected match for standard token type!")}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},Z=class{values;scopesRegExp;constructor(e){if(0===e.length)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map(([e,t])=>d(e));t.sort(),t.reverse(),this.scopesRegExp=RegExp(`^((${t.join(")|(")}))($|\\.)`,"")}}match(e){if(!this.scopesRegExp)return;let t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}};"u">typeof process&&process.env.VSCODE_TEXTMATE_DEBUG;var Q=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function J(e,t,n,i,r,o,a,l){let s=t.content.length,d=!1,u=-1;if(a){let a=function(e,t,n,i,r,o){let a=r.beginRuleCapturedEOL?0:-1,l=[];for(let t=r;t;t=t.pop()){let n=t.getRule(e);n instanceof j&&l.push({rule:n,stack:t})}for(let f=l.pop();f;f=l.pop()){var s,d,u,h,c;let{ruleScanner:l,findOptions:p}=(s=f.rule,d=e,u=f.stack.endRule,h=n,c=i===a,{ruleScanner:s.compileWhileAG(d,u,h,c),findOptions:0}),g=l.findNextMatchSync(t,i,p);if(g){if(-2!==g.ruleId){r=f.stack.pop();break}g.captureIndices&&g.captureIndices.length&&(o.produce(f.stack,g.captureIndices[0].start),et(e,t,n,f.stack,o,f.rule.whileCaptures,g.captureIndices),o.produce(f.stack,g.captureIndices[0].end),a=g.captureIndices[0].end,g.captureIndices[0].end>i&&(i=g.captureIndices[0].end,n=!1))}else{r=f.stack.pop();break}}return{stack:r,linePos:i,anchorPosition:a,isFirstLine:n}}(e,t,n,i,r,o);r=a.stack,i=a.linePos,n=a.isFirstLine,u=a.anchorPosition}let h=Date.now();for(;!d;){if(0!==l&&Date.now()-h>l)return new Q(r,!0);!function(){let a=function(e,t,n,i,r,o){let a=function(e,t,n,i,r,o){let{ruleScanner:a,findOptions:l}=ee(r.getRule(e),e,r.endRule,n,i===o),s=a.findNextMatchSync(t,i,l);return s?{captureIndices:s.captureIndices,matchedRuleId:s.ruleId}:null}(e,t,n,i,r,o),l=e.getInjections();if(0===l.length)return a;let s=function(e,t,n,i,r,o,a){let l,s=Number.MAX_VALUE,d=null,u=0,h=o.contentNameScopesList.getScopeNames();for(let o=0,c=e.length;o<c;o++){let c=e[o];if(!c.matcher(h))continue;let{ruleScanner:f,findOptions:p}=ee(t.getRule(c.ruleId),t,null,i,r===a),g=f.findNextMatchSync(n,r,p);if(!g)continue;let m=g.captureIndices[0].start;if(!(m>=s)&&(s=m,d=g.captureIndices,l=g.ruleId,u=c.priority,s===r))break}return d?{priorityMatch:-1===u,captureIndices:d,matchedRuleId:l}:null}(l,e,t,n,i,r,o);if(!s)return a;if(!a)return s;let d=a.captureIndices[0].start,u=s.captureIndices[0].start;return u<d||s.priorityMatch&&u===d?s:a}(e,t,n,i,r,u);if(!a){o.produce(r,s),d=!0;return}let l=a.captureIndices,h=a.matchedRuleId,c=!!l&&l.length>0&&l[0].end>i;if(-1===h){let a=r.getRule(e);o.produce(r,l[0].start),r=r.withContentNameScopesList(r.nameScopesList),et(e,t,n,r,o,a.endCaptures,l),o.produce(r,l[0].end);let h=r;if(r=r.parent,u=h.getAnchorPos(),!c&&h.getEnterPos()===i){r=h,o.produce(r,s),d=!0;return}}else{let a=e.getRule(h);o.produce(r,l[0].start);let f=r,p=a.getName(t.content,l),g=r.contentNameScopesList.pushAttributed(p,e);if(r=r.push(h,i,u,l[0].end===s,null,g,g),a instanceof G){et(e,t,n,r,o,a.beginCaptures,l),o.produce(r,l[0].end),u=l[0].end;let i=a.getContentName(t.content,l),h=g.pushAttributed(i,e);if(r=r.withContentNameScopesList(h),a.endHasBackReferences&&(r=r.withEndRule(a.getEndWithResolvedBackReferences(t.content,l))),!c&&f.hasSameRuleAs(r)){r=r.pop(),o.produce(r,s),d=!0;return}}else if(a instanceof j){et(e,t,n,r,o,a.beginCaptures,l),o.produce(r,l[0].end),u=l[0].end;let i=a.getContentName(t.content,l),h=g.pushAttributed(i,e);if(r=r.withContentNameScopesList(h),a.whileHasBackReferences&&(r=r.withEndRule(a.getWhileWithResolvedBackReferences(t.content,l))),!c&&f.hasSameRuleAs(r)){r=r.pop(),o.produce(r,s),d=!0;return}}else if(et(e,t,n,r,o,a.captures,l),o.produce(r,l[0].end),r=r.pop(),!c){r=r.safePop(),o.produce(r,s),d=!0;return}}l[0].end>i&&(i=l[0].end,n=!1)}()}return new Q(r,!1)}function ee(e,t,n,i,r){return{ruleScanner:e.compileAG(t,n,i,r),findOptions:0}}function et(e,t,n,i,r,o,a){if(0===o.length)return;let l=t.content,s=Math.min(o.length,a.length),d=[],u=a[0].end;for(let t=0;t<s;t++){let s=o[t];if(null===s)continue;let h=a[t];if(0===h.length)continue;if(h.start>u)break;for(;d.length>0&&d[d.length-1].endPos<=h.start;)r.produceFromScopes(d[d.length-1].scopes,d[d.length-1].endPos),d.pop();if(d.length>0?r.produceFromScopes(d[d.length-1].scopes,h.start):r.produce(i,h.start),s.retokenizeCapturedWithRuleId){let t=s.getName(l,a),o=i.contentNameScopesList.pushAttributed(t,e),d=s.getContentName(l,a),u=o.pushAttributed(d,e),c=i.push(s.retokenizeCapturedWithRuleId,h.start,-1,!1,null,o,u),f=e.createOnigString(l.substring(0,h.end));J(e,f,n&&0===h.start,h.start,c,r,!1,0),x(f);continue}let c=s.getName(l,a);if(null!==c){let t=(d.length>0?d[d.length-1].scopes:i.contentNameScopesList).pushAttributed(c,e);d.push(new en(t,h.end))}}for(;d.length>0;)r.produceFromScopes(d[d.length-1].scopes,d[d.length-1].endPos),d.pop()}var en=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function ei(e,t,n,i,r){let o=S(t,er),a=W.getCompiledRuleId(n,i,r.repository);for(let n of o)e.push({debugSelector:t,matcher:n.matcher,ruleId:a,grammar:r,priority:n.priority})}function er(e,t){if(t.length<e.length)return!1;let n=0;return e.every(e=>{for(let i=n;i<t.length;i++)if(function(e,t){if(!e)return!1;if(e===t)return!0;let n=t.length;return e.length>n&&e.substr(0,n)===t&&"."===e[n]}(t[i],e))return n=i+1,!0;return!1})}var eo=class{constructor(e,t,n,i,r,o,a,l){if(this._rootScopeName=e,this.balancedBracketSelectors=o,this._onigLib=l,this._basicScopeAttributesProvider=new Y(n,i),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=a,this._grammar=ea(t,null),this._injections=null,this._tokenTypeMatchers=[],r)for(const e of Object.keys(r))for(const t of S(e,er))this._tokenTypeMatchers.push({matcher:t.matcher,type:r[e]})}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(let e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){let e=[],t=this._rootScopeName,n=({lookup:e=>e===this._rootScopeName?this._grammar:this.getExternalGrammar(e),injections:e=>this._grammarRepository.injections(e)}).lookup(t);if(n){let i=n.injections;if(i)for(let t in i)ei(e,t,i[t],this,n);let r=this._grammarRepository.injections(t);r&&r.forEach(t=>{let n=this.getExternalGrammar(t);if(n){let t=n.injectionSelector;t&&ei(e,t,n,this,n)}})}return e.sort((e,t)=>e.priority-t.priority),e}getInjections(){return null===this._injections&&(this._injections=this._collectInjections()),this._injections}registerRule(e){let t=++this._lastRuleId,n=e(t);return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[e]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){let n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=ea(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){let i=this._tokenize(e,t,!1,n);return{tokens:i.lineTokens.getResult(i.ruleStack,i.lineLength),ruleStack:i.ruleStack,stoppedEarly:i.stoppedEarly}}tokenizeLine2(e,t,n=0){let i=this._tokenize(e,t,!0,n);return{tokens:i.lineTokens.getBinaryResult(i.ruleStack,i.lineLength),ruleStack:i.ruleStack,stoppedEarly:i.stoppedEarly}}_tokenize(e,t,n,i){let r;if(-1===this._rootId&&(this._rootId=W.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections()),t&&t!==es.NULL)r=!1,t.reset();else{let e;r=!0;let n=this._basicScopeAttributesProvider.getDefaultAttributes(),i=this.themeProvider.getDefaults(),o=C.set(0,n.languageId,n.tokenType,null,i.fontStyle,i.foregroundId,i.backgroundId),a=this.getRule(this._rootId).getName(null,null);e=a?el.createRootAndLookUpScopeName(a,o,this):el.createRoot("unknown",o),t=new es(null,this._rootId,-1,-1,!1,null,e,e)}e+="\n";let o=this.createOnigString(e),a=o.content.length,l=new eu(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),s=J(this,o,r,0,t,l,!0,i);return x(o),{lineLength:a,lineTokens:l,ruleStack:s.stack,stoppedEarly:s.stoppedEarly}}};function ea(e,t){return(e=function e(t){return Array.isArray(t)?function(t){let n=[];for(let i=0,r=t.length;i<r;i++)n[i]=e(t[i]);return n}(t):t instanceof RegExp?t:"object"==typeof t?function(t){let n={};for(let i in t)n[i]=e(t[i]);return n}(t):t}(e)).repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var el=class e{constructor(e,t,n){this.parent=e,this.scopePath=t,this.tokenAttributes=n}static fromExtension(t,n){let i=t,r=t?.scopePath??null;for(let t of n)i=new e(i,r=c.push(r,t.scopeNames),t.encodedTokenAttributes);return i}static createRoot(t,n){return new e(null,new c(null,t),n)}static createRootAndLookUpScopeName(t,n,i){let r=i.getMetadataForScope(t),o=new c(null,t),a=i.themeProvider.themeMatch(o),l=e.mergeAttributes(n,r,a);return new e(null,o,l)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return e.equals(this,t)}static equals(e,t){for(;;){if(e===t||!e&&!t)return!0;if(!e||!t||e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}}static mergeAttributes(e,t,n){let i=-1,r=0,o=0;return null!==n&&(i=n.fontStyle,r=n.foregroundId,o=n.backgroundId),C.set(e,t.languageId,t.tokenType,null,i,r,o)}pushAttributed(t,n){if(null===t)return this;if(-1===t.indexOf(" "))return e._pushAttributed(this,t,n);let i=t.split(/ /g),r=this;for(let t of i)r=e._pushAttributed(r,t,n);return r}static _pushAttributed(t,n,i){let r=i.getMetadataForScope(n),o=t.scopePath.push(n),a=i.themeProvider.themeMatch(o),l=e.mergeAttributes(t.tokenAttributes,r,a);return new e(t,o,l)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push({encodedTokenAttributes:n.tokenAttributes,scopeNames:n.scopePath.getExtensionIfDefined(n.parent?.scopePath??null)}),n=n.parent;return n===e?t.reverse():void 0}},es=class e{constructor(e,t,n,i,r,o,a,l){this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=r,this.endRule=o,this.nameScopesList=a,this.contentNameScopesList=l,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=i}_stackElementBrand=void 0;static NULL=new e(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return null!==t&&e._equals(this,t)}static _equals(e,t){return e===t||!!this._structuralEquals(e,t)&&el.equals(e.contentNameScopesList,t.contentNameScopesList)}static _structuralEquals(e,t){for(;;){if(e===t||!e&&!t)return!0;if(!e||!t||e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){e._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,i,r,o,a,l){return new e(this,t,n,i,r,o,a,l)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){let e=[];return this._writeString(e,0),"["+e.join(",")+"]"}_writeString(e,t){return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,t}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(t){return this.endRule===t?this:new e(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let t=this;for(;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1}toStateStackFrame(){return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,n){let i=el.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,i,el.fromExtension(i,n.contentNameScopesList))}},ed=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>"*"===e?(this.allowAny=!0,[]):S(e,er).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>S(e,er).map(e=>e.matcher))}get matchesAlways(){return this.allowAny&&0===this.unbalancedBracketScopes.length}get matchesNever(){return 0===this.balancedBracketScopes.length&&!this.allowAny}match(e){for(let t of this.unbalancedBracketScopes)if(t(e))return!1;for(let t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},eu=class{constructor(e,t,n,i){this.balancedBracketSelectors=i,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let n=e?.tokenAttributes??0,i=!1;if(this.balancedBracketSelectors?.matchesAlways&&(i=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){let t=e?.getScopeNames()??[];for(let e of this._tokenTypeOverrides)e.matcher(t)&&(n=C.set(n,0,e.type,null,-1,0,0));this.balancedBracketSelectors&&(i=this.balancedBracketSelectors.match(t))}if(i&&(n=C.set(n,0,8,i,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===n){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(n),this._lastTokenEndIndex=t;return}let n=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),0===this._tokens.length&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),0===this._binaryTokens.length&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);let n=new Uint32Array(this._binaryTokens.length);for(let e=0,t=this._binaryTokens.length;e<t;e++)n[e]=this._binaryTokens[e];return n}},eh=class{constructor(e,t){this._onigLib=t,this._theme=e}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(let e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,i,r){if(!this._grammars.has(e)){let o=this._rawGrammars.get(e);if(!o)return null;this._grammars.set(e,new eo(e,o,t,n,i,r,this,this._onigLib))}return this._grammars.get(e)}},ec=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new eh(h.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(h.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,n){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:n})}loadGrammarWithConfiguration(e,t,n){return this._loadGrammar(e,t,n.embeddedLanguages,n.tokenTypes,new ed(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,i,r){let o=new E(this._syncRegistry,e);for(;o.Q.length>0;)o.Q.map(e=>this._loadSingleGrammar(e.scopeName)),o.processQueue();return this._grammarForScopeName(e,t,n,i,r)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){let t=this._options.loadGrammar(e);if(t){let n="function"==typeof this._options.getInjections?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,n)}}addGrammar(e,t=[],n=0,i=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,n,i)}_grammarForScopeName(e,t=0,n=null,i=null,r=null){return this._syncRegistry.grammarForScopeName(e,t,n,i,r)}},ef=es.NULL},70(e,t,n){let i;n.d(t,{V:()=>ew});var r={};n.r(r),n.d(r,{boolean:()=>h,booleanish:()=>c,commaOrSpaceSeparated:()=>b,commaSeparated:()=>m,number:()=>p,overloadedBoolean:()=>f,spaceSeparated:()=>g});let o=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class a{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}}function l(e,t){let n={},i={};for(let t of e)Object.assign(n,t.property),Object.assign(i,t.normal);return new a(n,i,t)}function s(e){return e.toLowerCase()}a.prototype.normal={},a.prototype.property={},a.prototype.space=void 0;class d{constructor(e,t){this.attribute=t,this.property=e}}d.prototype.attribute="",d.prototype.booleanish=!1,d.prototype.boolean=!1,d.prototype.commaOrSpaceSeparated=!1,d.prototype.commaSeparated=!1,d.prototype.defined=!1,d.prototype.mustUseProperty=!1,d.prototype.number=!1,d.prototype.overloadedBoolean=!1,d.prototype.property="",d.prototype.spaceSeparated=!1,d.prototype.space=void 0;let u=0,h=v(),c=v(),f=v(),p=v(),g=v(),m=v(),b=v();function v(){return 2**++u}let y=Object.keys(r);class C extends d{constructor(e,t,n,i){let o=-1;if(super(e,t),function(e,t,n){n&&(e[t]=n)}(this,"space",i),"number"==typeof n)for(;++o<y.length;){const e=y[o];!function(e,t,n){n&&(e[t]=n)}(this,y[o],(n&r[e])===r[e])}}}function S(e){let t={},n={};for(let[i,r]of Object.entries(e.properties)){let o=new C(i,e.transform(e.attributes||{},i),r,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(o.mustUseProperty=!0),t[i]=o,n[s(i)]=i,n[s(o.attribute)]=i}return new a(t,n,e.space)}C.prototype.defined=!0;let k=S({properties:{ariaActiveDescendant:null,ariaAtomic:c,ariaAutoComplete:null,ariaBusy:c,ariaChecked:c,ariaColCount:p,ariaColIndex:p,ariaColSpan:p,ariaControls:g,ariaCurrent:null,ariaDescribedBy:g,ariaDetails:null,ariaDisabled:c,ariaDropEffect:g,ariaErrorMessage:null,ariaExpanded:c,ariaFlowTo:g,ariaGrabbed:c,ariaHasPopup:null,ariaHidden:c,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:g,ariaLevel:p,ariaLive:null,ariaModal:c,ariaMultiLine:c,ariaMultiSelectable:c,ariaOrientation:null,ariaOwns:g,ariaPlaceholder:null,ariaPosInSet:p,ariaPressed:c,ariaReadOnly:c,ariaRelevant:null,ariaRequired:c,ariaRoleDescription:g,ariaRowCount:p,ariaRowIndex:p,ariaRowSpan:p,ariaSelected:c,ariaSetSize:p,ariaSort:null,ariaValueMax:p,ariaValueMin:p,ariaValueNow:p,ariaValueText:null,role:null},transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function x(e,t){return t in e?e[t]:t}function w(e,t){return x(e,t.toLowerCase())}let L=S({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:m,acceptCharset:g,accessKey:g,action:null,allow:null,allowFullScreen:h,allowPaymentRequest:h,allowUserMedia:h,alpha:h,alt:null,as:null,async:h,autoCapitalize:null,autoComplete:g,autoFocus:h,autoPlay:h,blocking:g,capture:null,charSet:null,checked:h,cite:null,className:g,closedBy:null,colorSpace:null,cols:p,colSpan:p,command:null,commandFor:null,content:null,contentEditable:c,controls:h,controlsList:g,coords:p|m,crossOrigin:null,data:null,dateTime:null,decoding:null,default:h,defer:h,dir:null,dirName:null,disabled:h,download:f,draggable:c,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:h,formTarget:null,headers:g,height:p,hidden:f,high:p,href:null,hrefLang:null,htmlFor:g,httpEquiv:g,id:null,imageSizes:null,imageSrcSet:null,inert:h,inputMode:null,integrity:null,is:null,isMap:h,itemId:null,itemProp:g,itemRef:g,itemScope:h,itemType:g,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:h,low:p,manifest:null,max:null,maxLength:p,media:null,method:null,min:null,minLength:p,multiple:h,muted:h,name:null,nonce:null,noModule:h,noValidate:h,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:h,optimum:p,pattern:null,ping:g,placeholder:null,playsInline:h,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:h,referrerPolicy:null,rel:g,required:h,reversed:h,rows:p,rowSpan:p,sandbox:g,scope:null,scoped:h,seamless:h,selected:h,shadowRootClonable:h,shadowRootCustomElementRegistry:h,shadowRootDelegatesFocus:h,shadowRootMode:null,shadowRootSerializable:h,shape:null,size:p,sizes:null,slot:null,span:p,spellCheck:c,src:null,srcDoc:null,srcLang:null,srcSet:null,start:p,step:null,style:null,tabIndex:p,target:null,title:null,translate:null,type:null,typeMustMatch:h,useMap:null,value:c,width:p,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:g,axis:null,background:null,bgColor:null,border:p,borderColor:null,bottomMargin:p,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:h,declare:h,event:null,face:null,frame:null,frameBorder:null,hSpace:p,leftMargin:p,link:null,longDesc:null,lowSrc:null,marginHeight:p,marginWidth:p,noResize:h,noHref:h,noShade:h,noWrap:h,object:null,profile:null,prompt:null,rev:null,rightMargin:p,rules:null,scheme:null,scrolling:c,standby:null,summary:null,text:null,topMargin:p,valueType:null,version:null,vAlign:null,vLink:null,vSpace:p,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:h,disablePictureInPicture:h,disableRemotePlayback:h,exportParts:m,part:g,prefix:null,property:null,results:p,security:null,unselectable:null},space:"html",transform:w}),A=S({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:b,accentHeight:p,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:p,amplitude:p,arabicForm:null,ascent:p,attributeName:null,attributeType:null,azimuth:p,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:p,by:null,calcMode:null,capHeight:p,className:g,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:p,diffuseConstant:p,direction:null,display:null,dur:null,divisor:p,dominantBaseline:null,download:h,dx:null,dy:null,edgeMode:null,editable:null,elevation:p,enableBackground:null,end:null,event:null,exponent:p,externalResourcesRequired:null,fill:null,fillOpacity:p,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:m,g2:m,glyphName:m,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:p,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:p,horizOriginX:p,horizOriginY:p,id:null,ideographic:p,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:p,k:p,k1:p,k2:p,k3:p,k4:p,kernelMatrix:b,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:p,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:p,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:p,overlineThickness:p,paintOrder:null,panose1:null,path:null,pathLength:p,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:g,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:p,pointsAtY:p,pointsAtZ:p,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:b,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:b,rev:b,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:b,requiredFeatures:b,requiredFonts:b,requiredFormats:b,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:p,specularExponent:p,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:p,strikethroughThickness:p,string:null,stroke:null,strokeDashArray:b,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:p,strokeOpacity:p,strokeWidth:null,style:null,surfaceScale:p,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:b,tabIndex:p,tableValues:null,target:null,targetX:p,targetY:p,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:b,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:p,underlineThickness:p,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:p,values:null,vAlphabetic:p,vMathematical:p,vectorEffect:null,vHanging:p,vIdeographic:p,version:null,vertAdvY:p,vertOriginX:p,vertOriginY:p,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:p,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:x}),E=S({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase()}),R=S({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:w}),_=S({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),T=l([k,L,E,R,_],"html"),I=l([k,A,E,R,_],"svg"),M={}.hasOwnProperty,P=/["&'<>`]/g,N=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,D=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,H=/[|\\{}()[\]^$+*?.]/g,O=new WeakMap,$=/[\dA-Fa-f]/,F=/\d/,z=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],U={nbsp:"\xa0",iexcl:"\xa1",cent:"\xa2",pound:"\xa3",curren:"\xa4",yen:"\xa5",brvbar:"\xa6",sect:"\xa7",uml:"\xa8",copy:"\xa9",ordf:"\xaa",laquo:"\xab",not:"\xac",shy:"\xad",reg:"\xae",macr:"\xaf",deg:"\xb0",plusmn:"\xb1",sup2:"\xb2",sup3:"\xb3",acute:"\xb4",micro:"\xb5",para:"\xb6",middot:"\xb7",cedil:"\xb8",sup1:"\xb9",ordm:"\xba",raquo:"\xbb",frac14:"\xbc",frac12:"\xbd",frac34:"\xbe",iquest:"\xbf",Agrave:"\xc0",Aacute:"\xc1",Acirc:"\xc2",Atilde:"\xc3",Auml:"\xc4",Aring:"\xc5",AElig:"\xc6",Ccedil:"\xc7",Egrave:"\xc8",Eacute:"\xc9",Ecirc:"\xca",Euml:"\xcb",Igrave:"\xcc",Iacute:"\xcd",Icirc:"\xce",Iuml:"\xcf",ETH:"\xd0",Ntilde:"\xd1",Ograve:"\xd2",Oacute:"\xd3",Ocirc:"\xd4",Otilde:"\xd5",Ouml:"\xd6",times:"\xd7",Oslash:"\xd8",Ugrave:"\xd9",Uacute:"\xda",Ucirc:"\xdb",Uuml:"\xdc",Yacute:"\xdd",THORN:"\xde",szlig:"\xdf",agrave:"\xe0",aacute:"\xe1",acirc:"\xe2",atilde:"\xe3",auml:"\xe4",aring:"\xe5",aelig:"\xe6",ccedil:"\xe7",egrave:"\xe8",eacute:"\xe9",ecirc:"\xea",euml:"\xeb",igrave:"\xec",iacute:"\xed",icirc:"\xee",iuml:"\xef",eth:"\xf0",ntilde:"\xf1",ograve:"\xf2",oacute:"\xf3",ocirc:"\xf4",otilde:"\xf5",ouml:"\xf6",divide:"\xf7",oslash:"\xf8",ugrave:"\xf9",uacute:"\xfa",ucirc:"\xfb",uuml:"\xfc",yacute:"\xfd",thorn:"\xfe",yuml:"\xff",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},B=["cent","copy","divide","gt","lt","not","para","times"],G={}.hasOwnProperty,j={};for(i in U)G.call(U,i)&&(j[U[i]]=i);let W=/[^\dA-Za-z]/;function V(e,t,n){var i,r;let o,a,l=(i=n.omitOptionalSemicolons,o="&#x"+e.toString(16).toUpperCase(),i&&t&&!$.test(String.fromCharCode(t))?o:o+";");if((n.useNamedReferences||n.useShortestReferences)&&(a=function(e,t,n,i){let r=String.fromCharCode(e);if(G.call(j,r)){let e=j[r],o="&"+e;return n&&z.includes(e)&&!B.includes(e)&&(!i||t&&61!==t&&W.test(String.fromCharCode(t)))?o:o+";"}return""}(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!a)&&n.useShortestReferences){let i,o=(r=n.omitOptionalSemicolons,i="&#"+String(e),r&&t&&!F.test(String.fromCharCode(t))?i:i+";");o.length<l.length&&(l=o)}return a&&(!n.useShortestReferences||a.length<l.length)?a:l}function q(e,t){let n;var i,r=e,o=Object.assign({format:V},t);if(r=r.replace(o.subset?(i=o.subset,(n=O.get(i))||(n=function(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(H,"\\$&"));return RegExp("(?:"+t.join("|")+")","g")}(i),O.set(i,n)),n):P,a),o.subset||o.escapeOnly)return r;return r.replace(N,function(e,t,n){return o.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,n.charCodeAt(t+2),o)}).replace(D,a);function a(e,t,n){return o.format(e.charCodeAt(0),n.charCodeAt(t+1),o)}}let K=/^>|^->|<!--|-->|--!>|<!-$/g,X=[">"],Y=["<",">"];function Z(e,t){let n=String(e);if("string"!=typeof t)throw TypeError("Expected character");let i=0,r=n.indexOf(t);for(;-1!==r;)i++,r=n.indexOf(t,r+t.length);return i}let Q=/[A-Z]/g,J=/-[a-z]/g,ee=/^data[-\w.:]+$/i;function et(e){return"-"+e.toLowerCase()}function en(e){return e.charAt(1).toUpperCase()}let ei=/[ \t\n\f\r]/g;function er(e){return"object"==typeof e?"text"===e.type&&eo(e.value):eo(e)}function eo(e){return""===e.replace(ei,"")}let ea=ed(1),el=ed(-1),es=[];function ed(e){return function(t,n,i){let r=t?t.children:es,o=(n||0)+e,a=r[o];if(!i)for(;a&&er(a);)o+=e,a=r[o];return a}}let eu={}.hasOwnProperty;function eh(e){return function(t,n,i){return eu.call(e,t.tagName)&&e[t.tagName](t,n,i)}}let ec=eh({body:function(e,t,n){let i=ea(n,t);return!i||"comment"!==i.type},caption:ef,colgroup:ef,dd:function(e,t,n){let i=ea(n,t);return!i||"element"===i.type&&("dt"===i.tagName||"dd"===i.tagName)},dt:function(e,t,n){let i=ea(n,t);return!!(i&&"element"===i.type&&("dt"===i.tagName||"dd"===i.tagName))},head:ef,html:function(e,t,n){let i=ea(n,t);return!i||"comment"!==i.type},li:function(e,t,n){let i=ea(n,t);return!i||"element"===i.type&&"li"===i.tagName},optgroup:function(e,t,n){let i=ea(n,t);return!i||"element"===i.type&&"optgroup"===i.tagName},option:function(e,t,n){let i=ea(n,t);return!i||"element"===i.type&&("option"===i.tagName||"optgroup"===i.tagName)},p:function(e,t,n){let i=ea(n,t);return i?"element"===i.type&&("address"===i.tagName||"article"===i.tagName||"aside"===i.tagName||"blockquote"===i.tagName||"details"===i.tagName||"div"===i.tagName||"dl"===i.tagName||"fieldset"===i.tagName||"figcaption"===i.tagName||"figure"===i.tagName||"footer"===i.tagName||"form"===i.tagName||"h1"===i.tagName||"h2"===i.tagName||"h3"===i.tagName||"h4"===i.tagName||"h5"===i.tagName||"h6"===i.tagName||"header"===i.tagName||"hgroup"===i.tagName||"hr"===i.tagName||"main"===i.tagName||"menu"===i.tagName||"nav"===i.tagName||"ol"===i.tagName||"p"===i.tagName||"pre"===i.tagName||"section"===i.tagName||"table"===i.tagName||"ul"===i.tagName):!n||"element"!==n.type||"a"!==n.tagName&&"audio"!==n.tagName&&"del"!==n.tagName&&"ins"!==n.tagName&&"map"!==n.tagName&&"noscript"!==n.tagName&&"video"!==n.tagName},rp:ep,rt:ep,tbody:function(e,t,n){let i=ea(n,t);return!i||"element"===i.type&&("tbody"===i.tagName||"tfoot"===i.tagName)},td:eg,tfoot:function(e,t,n){return!ea(n,t)},th:eg,thead:function(e,t,n){let i=ea(n,t);return!!(i&&"element"===i.type&&("tbody"===i.tagName||"tfoot"===i.tagName))},tr:function(e,t,n){let i=ea(n,t);return!i||"element"===i.type&&"tr"===i.tagName}});function ef(e,t,n){let i=ea(n,t,!0);return!i||"comment"!==i.type&&!("text"===i.type&&er(i.value.charAt(0)))}function ep(e,t,n){let i=ea(n,t);return!i||"element"===i.type&&("rp"===i.tagName||"rt"===i.tagName)}function eg(e,t,n){let i=ea(n,t);return!i||"element"===i.type&&("td"===i.tagName||"th"===i.tagName)}let em=eh({body:function(e){let t=ea(e,-1,!0);return!t||"comment"!==t.type&&!("text"===t.type&&er(t.value.charAt(0)))&&("element"!==t.type||"meta"!==t.tagName&&"link"!==t.tagName&&"script"!==t.tagName&&"style"!==t.tagName&&"template"!==t.tagName)},colgroup:function(e,t,n){let i=el(n,t),r=ea(e,-1,!0);return!(n&&i&&"element"===i.type&&"colgroup"===i.tagName&&ec(i,n.children.indexOf(i),n))&&!!(r&&"element"===r.type&&"col"===r.tagName)},head:function(e){let t=new Set;for(let n of e.children)if("element"===n.type&&("base"===n.tagName||"title"===n.tagName)){if(t.has(n.tagName))return!1;t.add(n.tagName)}let n=e.children[0];return!n||"element"===n.type},html:function(e){let t=ea(e,-1);return!t||"comment"!==t.type},tbody:function(e,t,n){let i=el(n,t),r=ea(e,-1);return!(n&&i&&"element"===i.type&&("thead"===i.tagName||"tbody"===i.tagName)&&ec(i,n.children.indexOf(i),n))&&!!(r&&"element"===r.type&&"tr"===r.tagName)}}),eb={name:[[" \n\f\r &/=>".split("")," \n\f\r \"&'/=>`".split("")],["\0 \n\f\r \"&'/<=>".split(""),"\0 \n\f\r \"&'/<=>`".split("")]],unquoted:[[" \n\f\r &>".split(""),"\0 \n\f\r \"&'<=>`".split("")],["\0 \n\f\r \"&'<=>`".split(""),"\0 \n\f\r \"&'<=>`".split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]},ev=["<","&"];function ey(e,t,n,i){return n&&"element"===n.type&&("script"===n.tagName||"style"===n.tagName)?e.value:q(e.value,Object.assign({},i.settings.characterReferences,{subset:ev}))}let eC=function(e,t){let n=t||{};function i(t,...n){let r=i.invalid,o=i.handlers;if(t&&M.call(t,e)){let n=String(t[e]);r=M.call(o,n)?o[n]:i.unknown}if(r)return r.call(this,t,...n)}return i.handlers=n.handlers||{},i.invalid=n.invalid,i.unknown=n.unknown,i}("type",{invalid:function(e){throw Error("Expected node, not `"+e+"`")},unknown:function(e){throw Error("Cannot compile unknown node `"+e.type+"`")},handlers:{comment:function(e,t,n,i){return i.settings.bogusComments?"<?"+q(e.value,Object.assign({},i.settings.characterReferences,{subset:X}))+">":"\x3c!--"+e.value.replace(K,function(e){return q(e,Object.assign({},i.settings.characterReferences,{subset:Y}))})+"--\x3e"},doctype:function(e,t,n,i){return"<!"+(i.settings.upperDoctype?"DOCTYPE":"doctype")+(i.settings.tightDoctype?"":" ")+"html>"},element:function(e,t,n,i){let r,o=i.schema,a="svg"!==o.space&&i.settings.omitOptionalTags,l="svg"===o.space?i.settings.closeEmptyElements:i.settings.voids.includes(e.tagName.toLowerCase()),u=[];"html"===o.space&&"svg"===e.tagName&&(i.schema=I);let h=function(e,t){let n,i=[],r=-1;if(t){for(n in t)if(null!==t[n]&&void 0!==t[n]){let r=function(e,t,n){let i,r=function(e,t){let n=s(t),i=t,r=d;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&"data"===n.slice(0,4)&&ee.test(t)){if("-"===t.charAt(4)){let e=t.slice(5).replace(J,en);i="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!J.test(e)){let n=e.replace(Q,et);"-"!==n.charAt(0)&&(n="-"+n),t="data"+n}}r=C}return new r(i,t)}(e.schema,t),o=e.settings.allowParseErrors&&"html"===e.schema.space?0:1,a=+!e.settings.allowDangerousCharacters,l=e.quote;if(r.overloadedBoolean&&(n===r.attribute||""===n)?n=!0:(r.boolean||r.overloadedBoolean)&&("string"!=typeof n||n===r.attribute||""===n)&&(n=!!n),null==n||!1===n||"number"==typeof n&&Number.isNaN(n))return"";let u=q(r.attribute,Object.assign({},e.settings.characterReferences,{subset:eb.name[o][a]}));return!0===n||(n=Array.isArray(n)?(r.commaSeparated?function(e,t){let n=t||{};return(""===e[e.length-1]?[...e,""]:e).join((n.padRight?" ":"")+","+(!1===n.padLeft?"":" ")).trim()}:function(e){return e.join(" ").trim()})(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?u:(e.settings.preferUnquoted&&(i=q(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:eb.unquoted[o][a]}))),i!==n&&(e.settings.quoteSmart&&Z(n,l)>Z(n,e.alternative)&&(l=e.alternative),i=l+q(n,Object.assign({},e.settings.characterReferences,{subset:("'"===l?eb.single:eb.double)[o][a],attribute:!0}))+l),u+(i?"="+i:i))}(e,n,t[n]);r&&i.push(r)}}for(;++r<i.length;){let t=e.settings.tightAttributes?i[r].charAt(i[r].length-1):void 0;r!==i.length-1&&'"'!==t&&"'"!==t&&(i[r]+=" ")}return i.join("")}(i,e.properties),c=i.all("html"===o.space&&"template"===e.tagName?e.content:e);return i.schema=o,c&&(l=!1),!h&&a&&em(e,t,n)||(u.push("<",e.tagName,h?" "+h:""),l&&("svg"===o.space||i.settings.closeSelfClosing)&&(r=h.charAt(h.length-1),(!i.settings.tightSelfClosing||"/"===r||r&&'"'!==r&&"'"!==r)&&u.push(" "),u.push("/")),u.push(">")),u.push(c),l||a&&ec(e,t,n)||u.push("</"+e.tagName+">"),u.join("")},raw:function(e,t,n,i){return i.settings.allowDangerousHtml?e.value:ey(e,t,n,i)},root:function(e,t,n,i){return i.all(e)},text:ey}}),eS={},ek={},ex=[];function ew(e,t){let n=t||eS,i=n.quote||'"';if('"'!==i&&"'"!==i)throw Error("Invalid quote `"+i+"`, expected `'` or `\"`");return({one:eL,all:eA,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||o,characterReferences:n.characterReferences||ek,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:"svg"===n.space?I:T,quote:i,alternative:'"'===i?"'":'"'}).one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function eL(e,t,n){return eC(e,t,n,this)}function eA(e){let t=[],n=e&&e.children||ex,i=-1;for(;++i<n.length;)t[i]=this.one(n[i],i,e);return t.join("")}},7576(e,t,n){n.d(t,{lf:()=>i.l});var i=n(7172)},4685(e,t,n){let i,r,o;n.d(t,{Mk:()=>A});var a={};n.r(a),n.d(a,{createOnigurumaEngine:()=>A,getDefaultWasmLoader:()=>L,loadWasm:()=>k,setDefaultWasmLoader:()=>w});var l=Object.defineProperty,s=Object.getOwnPropertyDescriptor,d=Object.getOwnPropertyNames,u=Object.prototype.hasOwnProperty,h=(e,t,n,i)=>{if(t&&"object"==typeof t||"function"==typeof t)for(var r,o=d(t),a=0,h=o.length;a<h;a++)r=o[a],u.call(e,r)||r===n||l(e,r,{get:(e=>t[e]).bind(null,r),enumerable:!(i=s(t,r))||i.enumerable});return e},c=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function f(){return"u">typeof performance?performance.now():Date.now()}let p=(e,t)=>e+(t-e%t)%t;async function g(e){let t,n,i={};function r(e){n=e,i.HEAPU8=new Uint8Array(e),i.HEAPU32=new Uint32Array(e)}let o="u">typeof TextDecoder?new TextDecoder("utf8"):void 0;function a(e,t){return e?function(e,t,n=1024){let i=t+n,r=t;for(;e[r]&&!(r>=i);)++r;if(r-t>16&&e.buffer&&o)return o.decode(e.subarray(t,r));let a="";for(;t<r;){let n=e[t++];if(!(128&n)){a+=String.fromCharCode(n);continue}let i=63&e[t++];if((224&n)==192){a+=String.fromCharCode((31&n)<<6|i);continue}let r=63&e[t++];if((n=(240&n)==224?(15&n)<<12|i<<6|r:(7&n)<<18|i<<12|r<<6|63&e[t++])<65536)a+=String.fromCharCode(n);else{let e=n-65536;a+=String.fromCharCode(55296|e>>10,56320|1023&e)}}return a}(i.HEAPU8,e,t):""}let l={emscripten_get_now:f,emscripten_memcpy_big:function(e,t,n){i.HEAPU8.copyWithin(e,t,t+n)},emscripten_resize_heap:function(e){let o=i.HEAPU8.length;if((e>>>=0)>0x80000000)return!1;for(let i=1;i<=4;i*=2){let a=o*(1+.2/i);if(a=Math.min(a,e+0x6000000),function(e){try{return t.grow(e-n.byteLength+65535>>>16),r(t.buffer),1}catch{}}(Math.min(0x80000000,p(Math.max(e,a),65536))))return!0}return!1},fd_write:()=>0};async function s(){let n=await e({env:l,wasi_snapshot_preview1:l});r((t=n.memory).buffer),Object.assign(i,n),i.UTF8ToString=a}return await s(),i}var m=Object.defineProperty,b=(e,t,n)=>{let i;return(i="symbol"!=typeof t?t+"":t)in e?m(e,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[i]=n};let v=null;class y{constructor(e){b(this,"utf16Length"),b(this,"utf8Length"),b(this,"utf16Value"),b(this,"utf8Value"),b(this,"utf16OffsetToUtf8"),b(this,"utf8OffsetToUtf16");const t=e.length,n=y._utf8ByteLength(e),i=n!==t,r=i?new Uint32Array(t+1):null;i&&(r[t]=n);const o=i?new Uint32Array(n+1):null;i&&(o[n]=t);const a=new Uint8Array(n);let l=0;for(let n=0;n<t;n++){const s=e.charCodeAt(n);let d=s,u=!1;if(s>=55296&&s<=56319&&n+1<t){const t=e.charCodeAt(n+1);t>=56320&&t<=57343&&(d=(s-55296<<10)+65536|t-56320,u=!0)}i&&(r[n]=l,u&&(r[n+1]=l),d<=127?o[l+0]=n:d<=2047?(o[l+0]=n,o[l+1]=n):d<=65535?(o[l+0]=n,o[l+1]=n,o[l+2]=n):(o[l+0]=n,o[l+1]=n,o[l+2]=n,o[l+3]=n)),d<=127?a[l++]=d:(d<=2047?a[l++]=192|(1984&d)>>>6:(d<=65535?a[l++]=224|(61440&d)>>>12:(a[l++]=240|(1835008&d)>>>18,a[l++]=128|(258048&d)>>>12),a[l++]=128|(4032&d)>>>6),a[l++]=128|(63&d)>>>0),u&&n++}this.utf16Length=t,this.utf8Length=n,this.utf16Value=e,this.utf8Value=a,this.utf16OffsetToUtf8=r,this.utf8OffsetToUtf16=o}static _utf8ByteLength(e){let t=0;for(let n=0,i=e.length;n<i;n++){let r=e.charCodeAt(n),o=r,a=!1;if(r>=55296&&r<=56319&&n+1<i){let t=e.charCodeAt(n+1);t>=56320&&t<=57343&&(o=(r-55296<<10)+65536|t-56320,a=!0)}o<=127?t+=1:o<=2047?t+=2:o<=65535?t+=3:t+=4,a&&n++}return t}createString(e){let t=e.omalloc(this.utf8Length);return e.HEAPU8.set(this.utf8Value,t),t}}let C=class e{constructor(t){if(b(this,"id",++e.LAST_ID),b(this,"_onigBinding"),b(this,"content"),b(this,"utf16Length"),b(this,"utf8Length"),b(this,"utf16OffsetToUtf8"),b(this,"utf8OffsetToUtf16"),b(this,"ptr"),!v)throw new c("Must invoke loadWasm first.");this._onigBinding=v,this.content=t;const n=new y(t);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!e._sharedPtrInUse?(e._sharedPtr||(e._sharedPtr=v.omalloc(1e4)),e._sharedPtrInUse=!0,v.HEAPU8.set(n.utf8Value,e._sharedPtr),this.ptr=e._sharedPtr):this.ptr=n.createString(v)}convertUtf8OffsetToUtf16(e){return this.utf8OffsetToUtf16?e<0?0:e>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[e]:e}convertUtf16OffsetToUtf8(e){return this.utf16OffsetToUtf8?e<0?0:e>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[e]:e}dispose(){this.ptr===e._sharedPtr?e._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};b(C,"LAST_ID",0),b(C,"_sharedPtr",0),b(C,"_sharedPtrInUse",!1);class S{constructor(e){if(b(this,"_onigBinding"),b(this,"_ptr"),!v)throw new c("Must invoke loadWasm first.");const t=[],n=[];for(let i=0,r=e.length;i<r;i++){const r=new y(e[i]);t[i]=r.createString(v),n[i]=r.utf8Length}const i=v.omalloc(4*e.length);v.HEAPU32.set(t,i/4);const r=v.omalloc(4*e.length);v.HEAPU32.set(n,r/4);const o=v.createOnigScanner(i,r,e.length);for(let n=0,i=e.length;n<i;n++)v.ofree(t[n]);v.ofree(r),v.ofree(i),0===o&&function(e){throw new c(e.UTF8ToString(e.getLastOnigError()))}(v),this._onigBinding=v,this._ptr=o}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(e,t,n){let i=0;if("number"==typeof n&&(i=n),"string"==typeof e){e=new C(e);let n=this._findNextMatchSync(e,t,!1,i);return e.dispose(),n}return this._findNextMatchSync(e,t,!1,i)}_findNextMatchSync(e,t,n,i){let r=this._onigBinding,o=r.findNextOnigScannerMatch(this._ptr,e.id,e.ptr,e.utf8Length,e.convertUtf16OffsetToUtf8(t),i);if(0===o)return null;let a=r.HEAPU32,l=o/4,s=a[l++],d=a[l++],u=[];for(let t=0;t<d;t++){let n=e.convertUtf8OffsetToUtf16(a[l++]),i=e.convertUtf8OffsetToUtf16(a[l++]);u[t]={start:n,end:i,length:i-n}}return{index:s,captureIndices:u}}}function k(e){return i||(i=async function(){v=await g(async t=>{let n=e;if("function"==typeof(n=await n)&&(n=await n(t)),"function"==typeof n&&(n=await n(t)),"function"==typeof n.instantiator)n=await n.instantiator(t);else if("function"==typeof n.default)n=await n.default(t);else{var i,r,o,a;if(void 0!==n.data&&(n=n.data),i=n,"u">typeof Response&&i instanceof Response){n="function"==typeof WebAssembly.instantiateStreaming?await (o=n,e=>WebAssembly.instantiateStreaming(o,e))(t):await (a=n,async e=>{let t=await a.arrayBuffer();return WebAssembly.instantiate(t,e)})(t)}else(r=n,"u">typeof ArrayBuffer&&(r instanceof ArrayBuffer||ArrayBuffer.isView(r))||"u">typeof Buffer&&Buffer.isBuffer?.(r)||"u">typeof SharedArrayBuffer&&r instanceof SharedArrayBuffer||"u">typeof Uint32Array&&r instanceof Uint32Array||n instanceof WebAssembly.Module)?n=await x(n)(t):"default"in n&&n.default instanceof WebAssembly.Module&&(n=await x(n.default)(t))}return"instance"in n&&(n=n.instance),"exports"in n&&(n=n.exports),n})}())}function x(e){return t=>WebAssembly.instantiate(e,t)}function w(e){r=e}function L(){return r}async function A(e){return e&&await k(e),{createScanner:e=>new S(e.map(e=>"string"==typeof e?e:e.source)),createString:e=>new C(e)}}h(((e,t)=>{let n={};for(var i in e)l(n,i,{get:e[i],enumerable:!0});return t||l(n,Symbol.toStringTag,{value:"Module"}),n})({}),a,"default"),o&&h(o,a,"default")}}]);
|