@performant-software/geospatial 3.1.13-beta.0 → 3.1.13-beta.1
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/index.cjs100.js +1 -1
- package/dist/index.cjs103.js +1 -1
- package/dist/index.cjs104.js +1 -1
- package/dist/index.cjs106.js +1 -1
- package/dist/index.cjs107.js +1 -1
- package/dist/index.cjs108.js +1 -1
- package/dist/index.cjs109.js +1 -1
- package/dist/index.cjs114.js +1 -1
- package/dist/index.cjs115.js +1 -1
- package/dist/index.cjs116.js +1 -1
- package/dist/index.cjs117.js +1 -1
- package/dist/index.cjs120.js +1 -1
- package/dist/index.cjs121.js +1 -1
- package/dist/index.cjs122.js +1 -1
- package/dist/index.cjs126.js +1 -1
- package/dist/index.cjs129.js +1 -1
- package/dist/index.cjs133.js +1 -1
- package/dist/index.cjs136.js +1 -1
- package/dist/index.cjs14.js +1 -1
- package/dist/index.cjs144.js +1 -1
- package/dist/index.cjs145.js +1 -1
- package/dist/index.cjs146.js +1 -1
- package/dist/index.cjs147.js +1 -1
- package/dist/index.cjs148.js +1 -1
- package/dist/index.cjs149.js +1 -1
- package/dist/index.cjs15.js +1 -1
- package/dist/index.cjs150.js +1 -1
- package/dist/index.cjs152.js +1 -1
- package/dist/index.cjs153.js +1 -1
- package/dist/index.cjs154.js +1 -1
- package/dist/index.cjs155.js +1 -1
- package/dist/index.cjs156.js +1 -1
- package/dist/index.cjs157.js +1 -1
- package/dist/index.cjs158.js +1 -1
- package/dist/index.cjs159.js +1 -1
- package/dist/index.cjs16.js +1 -1
- package/dist/index.cjs160.js +1 -1
- package/dist/index.cjs163.js +1 -1
- package/dist/index.cjs164.js +1 -1
- package/dist/index.cjs166.js +1 -1
- package/dist/index.cjs167.js +1 -1
- package/dist/index.cjs168.js +1 -1
- package/dist/index.cjs169.js +1 -1
- package/dist/index.cjs17.js +1 -1
- package/dist/index.cjs170.js +1 -1
- package/dist/index.cjs171.js +1 -1
- package/dist/index.cjs172.js +1 -1
- package/dist/index.cjs173.js +1 -1
- package/dist/index.cjs179.js +1 -1
- package/dist/index.cjs18.js +1 -1
- package/dist/index.cjs180.js +1 -1
- package/dist/index.cjs181.js +1 -1
- package/dist/index.cjs182.js +1 -1
- package/dist/index.cjs183.js +1 -1
- package/dist/index.cjs188.js +1 -1
- package/dist/index.cjs189.js +1 -1
- package/dist/index.cjs19.js +1 -1
- package/dist/index.cjs190.js +1 -1
- package/dist/index.cjs191.js +1 -1
- package/dist/index.cjs193.js +1 -1
- package/dist/index.cjs194.js +1 -1
- package/dist/index.cjs195.js +1 -1
- package/dist/index.cjs196.js +1 -1
- package/dist/index.cjs198.js +1 -1
- package/dist/index.cjs199.js +1 -1
- package/dist/index.cjs20.js +1 -1
- package/dist/index.cjs201.js +7 -1
- package/dist/index.cjs201.js.map +1 -1
- package/dist/index.cjs202.js +1 -1
- package/dist/index.cjs202.js.map +1 -1
- package/dist/index.cjs203.js +1 -1
- package/dist/index.cjs203.js.map +1 -1
- package/dist/index.cjs204.js +1 -1
- package/dist/index.cjs204.js.map +1 -1
- package/dist/index.cjs205.js +1 -1
- package/dist/index.cjs205.js.map +1 -1
- package/dist/index.cjs206.js +1 -1
- package/dist/index.cjs206.js.map +1 -1
- package/dist/index.cjs207.js +1 -1
- package/dist/index.cjs207.js.map +1 -1
- package/dist/index.cjs208.js +1 -1
- package/dist/index.cjs208.js.map +1 -1
- package/dist/index.cjs209.js +1 -1
- package/dist/index.cjs209.js.map +1 -1
- package/dist/index.cjs21.js +1 -1
- package/dist/index.cjs210.js +1 -1
- package/dist/index.cjs210.js.map +1 -1
- package/dist/index.cjs211.js +1 -1
- package/dist/index.cjs211.js.map +1 -1
- package/dist/index.cjs212.js +1 -1
- package/dist/index.cjs212.js.map +1 -1
- package/dist/index.cjs213.js +1 -1
- package/dist/index.cjs213.js.map +1 -1
- package/dist/index.cjs214.js +1 -1
- package/dist/index.cjs214.js.map +1 -1
- package/dist/index.cjs215.js +1 -1
- package/dist/index.cjs215.js.map +1 -1
- package/dist/index.cjs216.js +1 -1
- package/dist/index.cjs216.js.map +1 -1
- package/dist/index.cjs217.js +1 -1
- package/dist/index.cjs217.js.map +1 -1
- package/dist/index.cjs218.js +1 -1
- package/dist/index.cjs218.js.map +1 -1
- package/dist/index.cjs219.js +1 -1
- package/dist/index.cjs219.js.map +1 -1
- package/dist/index.cjs22.js +1 -1
- package/dist/index.cjs220.js +1 -1
- package/dist/index.cjs220.js.map +1 -1
- package/dist/index.cjs221.js +1 -1
- package/dist/index.cjs221.js.map +1 -1
- package/dist/index.cjs222.js +1 -1
- package/dist/index.cjs222.js.map +1 -1
- package/dist/index.cjs223.js +1 -1
- package/dist/index.cjs223.js.map +1 -1
- package/dist/index.cjs224.js +1 -1
- package/dist/index.cjs224.js.map +1 -1
- package/dist/index.cjs225.js +1 -1
- package/dist/index.cjs225.js.map +1 -1
- package/dist/index.cjs226.js +1 -1
- package/dist/index.cjs226.js.map +1 -1
- package/dist/index.cjs227.js +1 -1
- package/dist/index.cjs227.js.map +1 -1
- package/dist/index.cjs228.js +1 -1
- package/dist/index.cjs228.js.map +1 -1
- package/dist/index.cjs229.js +1 -1
- package/dist/index.cjs229.js.map +1 -1
- package/dist/index.cjs23.js +1 -1
- package/dist/index.cjs230.js +1 -1
- package/dist/index.cjs230.js.map +1 -1
- package/dist/index.cjs231.js +1 -1
- package/dist/index.cjs231.js.map +1 -1
- package/dist/index.cjs232.js +1 -1
- package/dist/index.cjs232.js.map +1 -1
- package/dist/index.cjs233.js +1 -1
- package/dist/index.cjs233.js.map +1 -1
- package/dist/index.cjs234.js +1 -1
- package/dist/index.cjs234.js.map +1 -1
- package/dist/index.cjs235.js +1 -1
- package/dist/index.cjs235.js.map +1 -1
- package/dist/index.cjs236.js +1 -7
- package/dist/index.cjs236.js.map +1 -1
- package/dist/index.cjs237.js +1 -1
- package/dist/index.cjs237.js.map +1 -1
- package/dist/index.cjs238.js +1 -1
- package/dist/index.cjs238.js.map +1 -1
- package/dist/index.cjs239.js +1 -1
- package/dist/index.cjs239.js.map +1 -1
- package/dist/index.cjs24.js +1 -1
- package/dist/index.cjs240.js +1 -1
- package/dist/index.cjs240.js.map +1 -1
- package/dist/index.cjs241.js +1 -1
- package/dist/index.cjs241.js.map +1 -1
- package/dist/index.cjs242.js +1 -1
- package/dist/index.cjs242.js.map +1 -1
- package/dist/index.cjs243.js +1 -1
- package/dist/index.cjs243.js.map +1 -1
- package/dist/index.cjs244.js +1 -1
- package/dist/index.cjs244.js.map +1 -1
- package/dist/index.cjs245.js +1 -1
- package/dist/index.cjs245.js.map +1 -1
- package/dist/index.cjs246.js +1 -1
- package/dist/index.cjs246.js.map +1 -1
- package/dist/index.cjs247.js +1 -1
- package/dist/index.cjs247.js.map +1 -1
- package/dist/index.cjs248.js +1 -1
- package/dist/index.cjs248.js.map +1 -1
- package/dist/index.cjs249.js +1 -1
- package/dist/index.cjs249.js.map +1 -1
- package/dist/index.cjs250.js +1 -1
- package/dist/index.cjs250.js.map +1 -1
- package/dist/index.cjs251.js +1 -1
- package/dist/index.cjs251.js.map +1 -1
- package/dist/index.cjs252.js +1 -1
- package/dist/index.cjs252.js.map +1 -1
- package/dist/index.cjs253.js +1 -1
- package/dist/index.cjs253.js.map +1 -1
- package/dist/index.cjs254.js +1 -1
- package/dist/index.cjs254.js.map +1 -1
- package/dist/index.cjs255.js +1 -1
- package/dist/index.cjs255.js.map +1 -1
- package/dist/index.cjs256.js +1 -1
- package/dist/index.cjs256.js.map +1 -1
- package/dist/index.cjs257.js +1 -1
- package/dist/index.cjs257.js.map +1 -1
- package/dist/index.cjs258.js +1 -1
- package/dist/index.cjs258.js.map +1 -1
- package/dist/index.cjs259.js +1 -1
- package/dist/index.cjs259.js.map +1 -1
- package/dist/index.cjs260.js +1 -1
- package/dist/index.cjs260.js.map +1 -1
- package/dist/index.cjs263.js +1 -1
- package/dist/index.cjs263.js.map +1 -1
- package/dist/index.cjs264.js +1 -1
- package/dist/index.cjs264.js.map +1 -1
- package/dist/index.cjs27.js +1 -1
- package/dist/index.cjs28.js +1 -1
- package/dist/index.cjs29.js +1 -1
- package/dist/index.cjs31.js +1 -1
- package/dist/index.cjs37.js +1 -1
- package/dist/index.cjs38.js +1 -1
- package/dist/index.cjs39.js +1 -1
- package/dist/index.cjs41.js +1 -1
- package/dist/index.cjs42.js +1 -1
- package/dist/index.cjs43.js +1 -1
- package/dist/index.cjs45.js +1 -1
- package/dist/index.cjs46.js +1 -1
- package/dist/index.cjs47.js +1 -1
- package/dist/index.cjs49.js +1 -1
- package/dist/index.cjs50.js +1 -1
- package/dist/index.cjs51.js +1 -1
- package/dist/index.cjs55.js +1 -1
- package/dist/index.cjs56.js +1 -1
- package/dist/index.cjs57.js +1 -1
- package/dist/index.cjs59.js +1 -1
- package/dist/index.cjs60.js +1 -1
- package/dist/index.cjs62.js +1 -1
- package/dist/index.cjs71.js +1 -743
- package/dist/index.cjs71.js.map +1 -1
- package/dist/index.cjs72.js +1 -1
- package/dist/index.cjs73.js +1 -1
- package/dist/index.cjs73.js.map +1 -1
- package/dist/index.cjs74.js +1 -1
- package/dist/index.cjs74.js.map +1 -1
- package/dist/index.cjs75.js +1 -9
- package/dist/index.cjs75.js.map +1 -1
- package/dist/index.cjs76.js +3 -11
- package/dist/index.cjs76.js.map +1 -1
- package/dist/index.cjs77.js +17 -1
- package/dist/index.cjs77.js.map +1 -1
- package/dist/index.cjs78.js +743 -1
- package/dist/index.cjs78.js.map +1 -1
- package/dist/index.cjs85.js +1 -1
- package/dist/index.cjs92.js +1 -1
- package/dist/index.cjs93.js +1 -1
- package/dist/index.cjs94.js +1 -1
- package/dist/index.cjs95.js +1 -1
- package/dist/index.cjs96.js +1 -1
- package/dist/index.cjs97.js +1 -1
- package/dist/index.cjs98.js +1 -1
- package/dist/index.cjs99.js +1 -1
- package/dist/index.es100.js +1 -1
- package/dist/index.es103.js +1 -1
- package/dist/index.es104.js +1 -1
- package/dist/index.es106.js +3 -3
- package/dist/index.es107.js +1 -1
- package/dist/index.es108.js +2 -2
- package/dist/index.es109.js +1 -1
- package/dist/index.es114.js +1 -1
- package/dist/index.es115.js +1 -1
- package/dist/index.es116.js +1 -1
- package/dist/index.es117.js +1 -1
- package/dist/index.es120.js +2 -2
- package/dist/index.es121.js +2 -2
- package/dist/index.es122.js +1 -1
- package/dist/index.es126.js +2 -2
- package/dist/index.es129.js +1 -1
- package/dist/index.es133.js +1 -1
- package/dist/index.es136.js +1 -1
- package/dist/index.es14.js +2 -2
- package/dist/index.es144.js +1 -1
- package/dist/index.es145.js +1 -1
- package/dist/index.es146.js +1 -1
- package/dist/index.es147.js +2 -2
- package/dist/index.es148.js +1 -1
- package/dist/index.es149.js +1 -1
- package/dist/index.es15.js +4 -4
- package/dist/index.es150.js +1 -1
- package/dist/index.es152.js +2 -2
- package/dist/index.es153.js +2 -2
- package/dist/index.es154.js +1 -1
- package/dist/index.es155.js +1 -1
- package/dist/index.es156.js +1 -1
- package/dist/index.es157.js +1 -1
- package/dist/index.es158.js +2 -2
- package/dist/index.es159.js +2 -2
- package/dist/index.es16.js +3 -3
- package/dist/index.es160.js +1 -1
- package/dist/index.es163.js +2 -2
- package/dist/index.es164.js +2 -2
- package/dist/index.es166.js +2 -2
- package/dist/index.es167.js +1 -1
- package/dist/index.es168.js +2 -2
- package/dist/index.es169.js +1 -1
- package/dist/index.es17.js +3 -3
- package/dist/index.es170.js +2 -2
- package/dist/index.es171.js +1 -1
- package/dist/index.es172.js +1 -1
- package/dist/index.es173.js +1 -1
- package/dist/index.es179.js +1 -1
- package/dist/index.es18.js +1 -1
- package/dist/index.es180.js +2 -2
- package/dist/index.es181.js +1 -1
- package/dist/index.es182.js +1 -1
- package/dist/index.es183.js +1 -1
- package/dist/index.es188.js +2 -2
- package/dist/index.es189.js +1 -1
- package/dist/index.es19.js +1 -1
- package/dist/index.es190.js +1 -1
- package/dist/index.es191.js +2 -2
- package/dist/index.es193.js +3 -3
- package/dist/index.es194.js +1 -1
- package/dist/index.es195.js +1 -1
- package/dist/index.es196.js +1 -1
- package/dist/index.es198.js +2 -2
- package/dist/index.es199.js +3 -3
- package/dist/index.es20.js +1 -1
- package/dist/index.es201.js +7505 -241
- package/dist/index.es201.js.map +1 -1
- package/dist/index.es202.js +2 -43
- package/dist/index.es202.js.map +1 -1
- package/dist/index.es203.js +8 -3
- package/dist/index.es203.js.map +1 -1
- package/dist/index.es204.js +4 -10
- package/dist/index.es204.js.map +1 -1
- package/dist/index.es205.js +4 -11
- package/dist/index.es205.js.map +1 -1
- package/dist/index.es206.js +3 -31
- package/dist/index.es206.js.map +1 -1
- package/dist/index.es207.js +3 -14
- package/dist/index.es207.js.map +1 -1
- package/dist/index.es208.js +8 -4
- package/dist/index.es208.js.map +1 -1
- package/dist/index.es209.js +17 -6
- package/dist/index.es209.js.map +1 -1
- package/dist/index.es21.js +1 -1
- package/dist/index.es210.js +20 -4
- package/dist/index.es210.js.map +1 -1
- package/dist/index.es211.js +13 -4
- package/dist/index.es211.js.map +1 -1
- package/dist/index.es212.js +15 -3
- package/dist/index.es212.js.map +1 -1
- package/dist/index.es213.js +6 -3
- package/dist/index.es213.js.map +1 -1
- package/dist/index.es214.js +7 -8
- package/dist/index.es214.js.map +1 -1
- package/dist/index.es215.js +6 -18
- package/dist/index.es215.js.map +1 -1
- package/dist/index.es216.js +20 -19
- package/dist/index.es216.js.map +1 -1
- package/dist/index.es217.js +8 -11
- package/dist/index.es217.js.map +1 -1
- package/dist/index.es218.js +9 -15
- package/dist/index.es218.js.map +1 -1
- package/dist/index.es219.js +4 -6
- package/dist/index.es219.js.map +1 -1
- package/dist/index.es22.js +1 -1
- package/dist/index.es220.js +10 -7
- package/dist/index.es220.js.map +1 -1
- package/dist/index.es221.js +7 -6
- package/dist/index.es221.js.map +1 -1
- package/dist/index.es222.js +19 -20
- package/dist/index.es222.js.map +1 -1
- package/dist/index.es223.js +9 -8
- package/dist/index.es223.js.map +1 -1
- package/dist/index.es224.js +18 -9
- package/dist/index.es224.js.map +1 -1
- package/dist/index.es225.js +4 -4
- package/dist/index.es225.js.map +1 -1
- package/dist/index.es226.js +17 -10
- package/dist/index.es226.js.map +1 -1
- package/dist/index.es227.js +11 -7
- package/dist/index.es227.js.map +1 -1
- package/dist/index.es228.js +3 -20
- package/dist/index.es228.js.map +1 -1
- package/dist/index.es229.js +4 -10
- package/dist/index.es229.js.map +1 -1
- package/dist/index.es23.js +1 -1
- package/dist/index.es230.js +242 -17
- package/dist/index.es230.js.map +1 -1
- package/dist/index.es231.js +42 -3
- package/dist/index.es231.js.map +1 -1
- package/dist/index.es232.js +3 -18
- package/dist/index.es232.js.map +1 -1
- package/dist/index.es233.js +10 -11
- package/dist/index.es233.js.map +1 -1
- package/dist/index.es234.js +10 -3
- package/dist/index.es234.js.map +1 -1
- package/dist/index.es235.js +30 -4
- package/dist/index.es235.js.map +1 -1
- package/dist/index.es236.js +13 -7506
- package/dist/index.es236.js.map +1 -1
- package/dist/index.es237.js +5 -2
- package/dist/index.es237.js.map +1 -1
- package/dist/index.es238.js +22 -18
- package/dist/index.es238.js.map +1 -1
- package/dist/index.es239.js +16 -22
- package/dist/index.es239.js.map +1 -1
- package/dist/index.es24.js +1 -1
- package/dist/index.es240.js +30 -7
- package/dist/index.es240.js.map +1 -1
- package/dist/index.es241.js +22 -3
- package/dist/index.es241.js.map +1 -1
- package/dist/index.es242.js +73 -4
- package/dist/index.es242.js.map +1 -1
- package/dist/index.es243.js +20 -24
- package/dist/index.es243.js.map +1 -1
- package/dist/index.es244.js +39 -15
- package/dist/index.es244.js.map +1 -1
- package/dist/index.es245.js +47 -28
- package/dist/index.es245.js.map +1 -1
- package/dist/index.es246.js +7 -21
- package/dist/index.es246.js.map +1 -1
- package/dist/index.es247.js +19 -73
- package/dist/index.es247.js.map +1 -1
- package/dist/index.es248.js +64 -19
- package/dist/index.es248.js.map +1 -1
- package/dist/index.es249.js +41 -39
- package/dist/index.es249.js.map +1 -1
- package/dist/index.es250.js +59 -45
- package/dist/index.es250.js.map +1 -1
- package/dist/index.es251.js +8 -7
- package/dist/index.es251.js.map +1 -1
- package/dist/index.es252.js +3 -20
- package/dist/index.es252.js.map +1 -1
- package/dist/index.es253.js +11 -64
- package/dist/index.es253.js.map +1 -1
- package/dist/index.es254.js +57 -40
- package/dist/index.es254.js.map +1 -1
- package/dist/index.es255.js +47 -61
- package/dist/index.es255.js.map +1 -1
- package/dist/index.es256.js +3 -9
- package/dist/index.es256.js.map +1 -1
- package/dist/index.es257.js +7 -3
- package/dist/index.es257.js.map +1 -1
- package/dist/index.es258.js +5 -12
- package/dist/index.es258.js.map +1 -1
- package/dist/index.es259.js +18 -57
- package/dist/index.es259.js.map +1 -1
- package/dist/index.es260.js +22 -49
- package/dist/index.es260.js.map +1 -1
- package/dist/index.es263.js +4 -69
- package/dist/index.es263.js.map +1 -1
- package/dist/index.es264.js +69 -4
- package/dist/index.es264.js.map +1 -1
- package/dist/index.es27.js +1 -1
- package/dist/index.es28.js +2 -2
- package/dist/index.es29.js +2 -2
- package/dist/index.es31.js +2 -2
- package/dist/index.es37.js +1 -1
- package/dist/index.es38.js +1 -1
- package/dist/index.es39.js +2 -2
- package/dist/index.es41.js +2 -2
- package/dist/index.es42.js +2 -2
- package/dist/index.es43.js +2 -2
- package/dist/index.es45.js +1 -1
- package/dist/index.es46.js +2 -2
- package/dist/index.es47.js +2 -2
- package/dist/index.es49.js +1 -1
- package/dist/index.es50.js +1 -1
- package/dist/index.es51.js +1 -1
- package/dist/index.es55.js +2 -2
- package/dist/index.es56.js +3 -3
- package/dist/index.es57.js +1 -1
- package/dist/index.es59.js +1 -1
- package/dist/index.es60.js +1 -1
- package/dist/index.es62.js +1 -1
- package/dist/index.es71.js +1954 -21313
- package/dist/index.es71.js.map +1 -1
- package/dist/index.es72.js +6 -2
- package/dist/index.es72.js.map +1 -1
- package/dist/index.es73.js +2 -8
- package/dist/index.es73.js.map +1 -1
- package/dist/index.es74.js +8 -2
- package/dist/index.es74.js.map +1 -1
- package/dist/index.es75.js +2 -26
- package/dist/index.es75.js.map +1 -1
- package/dist/index.es76.js +17 -580
- package/dist/index.es76.js.map +1 -1
- package/dist/index.es77.js +556 -1960
- package/dist/index.es77.js.map +1 -1
- package/dist/index.es78.js +21351 -5
- package/dist/index.es78.js.map +1 -1
- package/dist/index.es79.js +2 -2
- package/dist/index.es85.js +1 -1
- package/dist/index.es92.js +1 -1
- package/dist/index.es93.js +1 -1
- package/dist/index.es94.js +1 -1
- package/dist/index.es95.js +1 -1
- package/dist/index.es96.js +1 -1
- package/dist/index.es97.js +1 -1
- package/dist/index.es98.js +1 -1
- package/dist/index.es99.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs71.js
CHANGED
|
@@ -1,744 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const bc=require("./index.cjs72.js");/**
|
|
2
|
-
* MapLibre GL JS
|
|
3
|
-
* @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v5.6.1/LICENSE.txt
|
|
4
|
-
*/var mf=bc.__module.exports,Pd;function _f(){return Pd||(Pd=1,function(Id,gf){(function(Ka,es){Id.exports=es()})(mf,function(){var Ka={},es={};function wc(z,c,Di){if(es[z]=Di,z==="index"){var Tr="var sharedModule = {}; ("+es.shared+")(sharedModule); ("+es.worker+")(sharedModule);",Ri={};return es.shared(Ri),es.index(Ka,Ri),typeof window<"u"&&Ka.setWorkerUrl(window.URL.createObjectURL(new Blob([Tr],{type:"text/javascript"}))),Ka}}wc("shared",["exports"],function(z){function c(n,t,r,s){return new(r||(r=Promise))(function(l,d){function p(x){try{g(s.next(x))}catch(b){d(b)}}function m(x){try{g(s.throw(x))}catch(b){d(b)}}function g(x){var b;x.done?l(x.value):(b=x.value,b instanceof r?b:new r(function(T){T(b)})).then(p,m)}g((s=s.apply(n,t||[])).next())})}function Di(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Tr,Ri;function Sr(){if(Ri)return Tr;function n(t,r){this.x=t,this.y=r}return Ri=1,Tr=n,n.prototype={clone:function(){return new n(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,r){return this.clone()._rotateAround(t,r)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var r=t.x-this.x,s=t.y-this.y;return r*r+s*s},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,r){return Math.atan2(this.x*r-this.y*t,this.x*t+this.y*r)},_matMult:function(t){var r=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=r,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var r=Math.cos(t),s=Math.sin(t),l=s*this.x+r*this.y;return this.x=r*this.x-s*this.y,this.y=l,this},_rotateAround:function(t,r){var s=Math.cos(t),l=Math.sin(t),d=r.y+l*(this.x-r.x)+s*(this.y-r.y);return this.x=r.x+s*(this.x-r.x)-l*(this.y-r.y),this.y=d,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},n.convert=function(t){return t instanceof n?t:Array.isArray(t)?new n(t[0],t[1]):t},Tr}typeof SuppressedError=="function"&&SuppressedError;var Ge,fe,Le=Di(Sr()),Zr=function(){if(fe)return Ge;function n(t,r,s,l){this.cx=3*t,this.bx=3*(s-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*r,this.by=3*(l-r)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=r,this.p2x=s,this.p2y=l}return fe=1,Ge=n,n.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,r){if(r===void 0&&(r=1e-6),t<0)return 0;if(t>1)return 1;for(var s=t,l=0;l<8;l++){var d=this.sampleCurveX(s)-t;if(Math.abs(d)<r)return s;var p=this.sampleCurveDerivativeX(s);if(Math.abs(p)<1e-6)break;s-=d/p}var m=0,g=1;for(s=t,l=0;l<20&&(d=this.sampleCurveX(s),!(Math.abs(d-t)<r));l++)t>d?m=s:g=s,s=.5*(g-m)+m;return s},solve:function(t,r){return this.sampleCurveY(this.solveCurveX(t,r))}},Ge}(),Pr=Di(Zr);let Gr,qr;function ts(){return Gr==null&&(Gr=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Gr}function ci(){if(qr==null&&(qr=!1,ts())){const t=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(t){for(let s=0;s<5*5;s++){const l=4*s;t.fillStyle=`rgb(${l},${l+1},${l+2})`,t.fillRect(s%5,Math.floor(s/5),1,1)}const r=t.getImageData(0,0,5,5).data;for(let s=0;s<5*5*4;s++)if(s%4!=3&&r[s]!==s){qr=!0;break}}}return qr||!1}var Dt=1e-6,Pt=typeof Float32Array<"u"?Float32Array:Array;function Ki(){var n=new Pt(9);return Pt!=Float32Array&&(n[1]=0,n[2]=0,n[3]=0,n[5]=0,n[6]=0,n[7]=0),n[0]=1,n[4]=1,n[8]=1,n}function is(n){return n[0]=1,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=1,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=1,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n}function Ks(){var n=new Pt(3);return Pt!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0),n}function Mr(n){return Math.hypot(n[0],n[1],n[2])}function _n(n,t,r){var s=new Pt(3);return s[0]=n,s[1]=t,s[2]=r,s}function Ir(n,t,r){return n[0]=t[0]+r[0],n[1]=t[1]+r[1],n[2]=t[2]+r[2],n}function Li(n,t,r){return n[0]=t[0]*r,n[1]=t[1]*r,n[2]=t[2]*r,n}function Wr(n,t,r){var s=t[0],l=t[1],d=t[2],p=r[0],m=r[1],g=r[2];return n[0]=l*g-d*m,n[1]=d*p-s*g,n[2]=s*m-l*p,n}Math.hypot||(Math.hypot=function(){for(var n=0,t=arguments.length;t--;)n+=arguments[t]*arguments[t];return Math.sqrt(n)});var Ji,gn=Mr;function Hr(n,t,r){var s=t[0],l=t[1],d=t[2],p=t[3];return n[0]=r[0]*s+r[4]*l+r[8]*d+r[12]*p,n[1]=r[1]*s+r[5]*l+r[9]*d+r[13]*p,n[2]=r[2]*s+r[6]*l+r[10]*d+r[14]*p,n[3]=r[3]*s+r[7]*l+r[11]*d+r[15]*p,n}function Js(){var n=new Pt(4);return Pt!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0),n[3]=1,n}function yn(n,t,r,s){var l=.5*Math.PI/180;t*=l,r*=l,s*=l;var d=Math.sin(t),p=Math.cos(t),m=Math.sin(r),g=Math.cos(r),x=Math.sin(s),b=Math.cos(s);return n[0]=d*g*b-p*m*x,n[1]=p*m*b+d*g*x,n[2]=p*g*x-d*m*b,n[3]=p*g*b+d*m*x,n}function xn(){var n=new Pt(2);return Pt!=Float32Array&&(n[0]=0,n[1]=0),n}function Ti(n,t){var r=new Pt(2);return r[0]=n,r[1]=t,r}Ks(),Ji=new Pt(4),Pt!=Float32Array&&(Ji[0]=0,Ji[1]=0,Ji[2]=0,Ji[3]=0),Ks(),_n(1,0,0),_n(0,1,0),Js(),Js(),Ki(),xn();const ct=8192;function Ni(n,t,r){return t*(ct/(n.tileSize*Math.pow(2,r-n.tileID.overscaledZ)))}function Ui(n,t){return(n%t+t)%t}function Cr(n,t,r){return n*(1-r)+t*r}function Xr(n){if(n<=0)return 0;if(n>=1)return 1;const t=n*n,r=t*n;return 4*(n<.5?r:3*(n-t)+r-.75)}function vn(n,t,r,s){const l=new Pr(n,t,r,s);return d=>l.solve(d)}const Qs=vn(.25,.1,.25,1);function Ft(n,t,r){return Math.min(r,Math.max(t,n))}function rs(n,t,r){const s=r-t,l=((n-t)%s+s)%s+t;return l===t?r:l}function Si(n,...t){for(const r of t)for(const s in r)n[s]=r[s];return n}let ns=1;function Mt(n,t,r){const s={};for(const l in n)s[l]=t.call(this,n[l],l,n);return s}function Qi(n,t,r){const s={};for(const l in n)t.call(this,n[l],l,n)&&(s[l]=n[l]);return s}function Bi(n){return Array.isArray(n)?n.map(Bi):typeof n=="object"&&n?Mt(n,Bi):n}const bn={};function Yt(n){bn[n]||(typeof console<"u"&&console.warn(n),bn[n]=!0)}function Pi(n,t,r){return(r.y-n.y)*(t.x-n.x)>(t.y-n.y)*(r.x-n.x)}function _i(n){return typeof WorkerGlobalScope<"u"&&n!==void 0&&n instanceof WorkerGlobalScope}let Yr=null;function Ar(n){return typeof ImageBitmap<"u"&&n instanceof ImageBitmap}const ss="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Kr(n,t,r,s,l){return c(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const d=new VideoFrame(n,{timestamp:0});try{const p=d?.format;if(!p||!p.startsWith("BGR")&&!p.startsWith("RGB"))throw new Error(`Unrecognized format ${p}`);const m=p.startsWith("BGR"),g=new Uint8ClampedArray(s*l*4);if(yield d.copyTo(g,function(x,b,T,M,A){const E=4*Math.max(-b,0),D=(Math.max(0,T)-T)*M*4+E,F=4*M,U=Math.max(0,b),ee=Math.max(0,T);return{rect:{x:U,y:ee,width:Math.min(x.width,b+M)-U,height:Math.min(x.height,T+A)-ee},layout:[{offset:D,stride:F}]}}(n,t,r,s,l)),m)for(let x=0;x<g.length;x+=4){const b=g[x];g[x]=g[x+2],g[x+2]=b}return g}finally{d.close()}})}let lr,Jr;function cr(n,t,r,s){return n.addEventListener(t,r,s),{unsubscribe:()=>{n.removeEventListener(t,r,s)}}}function Mi(n){return n*Math.PI/180}function er(n){return n/Math.PI*180}const as={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},ea={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},hr="AbortError";function ne(){return new Error(hr)}const R={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function L(n){return R.REGISTERED_PROTOCOLS[n.substring(0,n.indexOf("://"))]}const j="global-dispatcher";class H extends Error{constructor(t,r,s,l){super(`AJAXError: ${r} (${t}): ${s}`),this.status=t,this.statusText=r,this.url=s,this.body=l}}const Q=()=>_i(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,re=function(n,t){if(/:\/\//.test(n.url)&&!/^https?:|^file:/.test(n.url)){const s=L(n.url);if(s)return s(n,t);if(_i(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:n,targetMapId:j},t)}if(!(/^file:/.test(r=n.url)||/^file:/.test(Q())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(s,l){return c(this,void 0,void 0,function*(){const d=new Request(s.url,{method:s.method||"GET",body:s.body,credentials:s.credentials,headers:s.headers,cache:s.cache,referrer:Q(),signal:l.signal});let p,m;s.type!=="json"||d.headers.has("Accept")||d.headers.set("Accept","application/json");try{p=yield fetch(d)}catch(x){throw new H(0,x.message,s.url,new Blob)}if(!p.ok){const x=yield p.blob();throw new H(p.status,p.statusText,s.url,x)}m=s.type==="arrayBuffer"||s.type==="image"?p.arrayBuffer():s.type==="json"?p.json():p.text();const g=yield m;if(l.signal.aborted)throw ne();return{data:g,cacheControl:p.headers.get("Cache-Control"),expires:p.headers.get("Expires")}})}(n,t);if(_i(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:n,mustQueue:!0,targetMapId:j},t)}var r;return function(s,l){return new Promise((d,p)=>{var m;const g=new XMLHttpRequest;g.open(s.method||"GET",s.url,!0),s.type!=="arrayBuffer"&&s.type!=="image"||(g.responseType="arraybuffer");for(const x in s.headers)g.setRequestHeader(x,s.headers[x]);s.type==="json"&&(g.responseType="text",!((m=s.headers)===null||m===void 0)&&m.Accept||g.setRequestHeader("Accept","application/json")),g.withCredentials=s.credentials==="include",g.onerror=()=>{p(new Error(g.statusText))},g.onload=()=>{if(!l.signal.aborted)if((g.status>=200&&g.status<300||g.status===0)&&g.response!==null){let x=g.response;if(s.type==="json")try{x=JSON.parse(g.response)}catch(b){return void p(b)}d({data:x,cacheControl:g.getResponseHeader("Cache-Control"),expires:g.getResponseHeader("Expires")})}else{const x=new Blob([g.response],{type:g.getResponseHeader("Content-Type")});p(new H(g.status,g.statusText,s.url,x))}},l.signal.addEventListener("abort",()=>{g.abort(),p(ne())}),g.send(s.body)})}(n,t)};function ce(n){if(!n||n.indexOf("://")<=0||n.indexOf("data:image/")===0||n.indexOf("blob:")===0)return!0;const t=new URL(n),r=window.location;return t.protocol===r.protocol&&t.host===r.host}function ie(n,t,r){r[n]&&r[n].indexOf(t)!==-1||(r[n]=r[n]||[],r[n].push(t))}function _e(n,t,r){if(r&&r[n]){const s=r[n].indexOf(t);s!==-1&&r[n].splice(s,1)}}class pe{constructor(t,r={}){Si(this,r),this.type=t}}class se extends pe{constructor(t,r={}){super("error",Si({error:t},r))}}class ye{on(t,r){return this._listeners=this._listeners||{},ie(t,r,this._listeners),{unsubscribe:()=>{this.off(t,r)}}}off(t,r){return _e(t,r,this._listeners),_e(t,r,this._oneTimeListeners),this}once(t,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},ie(t,r,this._oneTimeListeners),this):new Promise(s=>this.once(t,s))}fire(t,r){typeof t=="string"&&(t=new pe(t,r||{}));const s=t.type;if(this.listens(s)){t.target=this;const l=this._listeners&&this._listeners[s]?this._listeners[s].slice():[];for(const m of l)m.call(this,t);const d=this._oneTimeListeners&&this._oneTimeListeners[s]?this._oneTimeListeners[s].slice():[];for(const m of d)_e(s,m,this._oneTimeListeners),m.call(this,t);const p=this._eventedParent;p&&(Si(t,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),p.fire(t))}else t instanceof se&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,r){return this._eventedParent=t,this._eventedParentData=r,this}}var J={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};const Ce=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Ve(n,t){const r={};for(const s in n)s!=="ref"&&(r[s]=n[s]);return Ce.forEach(s=>{s in t&&(r[s]=t[s])}),r}function Ee(n,t){if(Array.isArray(n)){if(!Array.isArray(t)||n.length!==t.length)return!1;for(let r=0;r<n.length;r++)if(!Ee(n[r],t[r]))return!1;return!0}if(typeof n=="object"&&n!==null&&t!==null){if(typeof t!="object"||Object.keys(n).length!==Object.keys(t).length)return!1;for(const r in n)if(!Ee(n[r],t[r]))return!1;return!0}return n===t}function Be(n,t){n.push(t)}function $e(n,t,r){Be(r,{command:"addSource",args:[n,t[n]]})}function ft(n,t,r){Be(t,{command:"removeSource",args:[n]}),r[n]=!0}function lt(n,t,r,s){ft(n,r,s),$e(n,t,r)}function st(n,t,r){let s;for(s in n[r])if(Object.prototype.hasOwnProperty.call(n[r],s)&&s!=="data"&&!Ee(n[r][s],t[r][s]))return!1;for(s in t[r])if(Object.prototype.hasOwnProperty.call(t[r],s)&&s!=="data"&&!Ee(n[r][s],t[r][s]))return!1;return!0}function Ue(n,t,r,s,l,d){n=n||{},t=t||{};for(const p in n)Object.prototype.hasOwnProperty.call(n,p)&&(Ee(n[p],t[p])||r.push({command:d,args:[s,p,t[p],l]}));for(const p in t)Object.prototype.hasOwnProperty.call(t,p)&&!Object.prototype.hasOwnProperty.call(n,p)&&(Ee(n[p],t[p])||r.push({command:d,args:[s,p,t[p],l]}))}function it(n){return n.id}function Nt(n,t){return n[t.id]=t,n}class Se{constructor(t,r,s,l){this.message=(t?`${t}: `:"")+s,l&&(this.identifier=l),r!=null&&r.__line__&&(this.line=r.__line__)}}function Kt(n,...t){for(const r of t)for(const s in r)n[s]=r[s];return n}class yt extends Error{constructor(t,r){super(r),this.message=r,this.key=t}}class Er{constructor(t,r=[]){this.parent=t,this.bindings={};for(const[s,l]of r)this.bindings[s]=l}concat(t){return new Er(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}const Qr={kind:"null"},Ie={kind:"number"},He={kind:"string"},Xe={kind:"boolean"},Ii={kind:"color"},ta={kind:"projectionDefinition"},tr={kind:"object"},Ye={kind:"value"},ur={kind:"collator"},en={kind:"formatted"},zt={kind:"padding"},os={kind:"colorArray"},ls={kind:"numberArray"},dr={kind:"resolvedImage"},cs={kind:"variableAnchorOffsetCollection"};function Ci(n,t){return{kind:"array",itemType:n,N:t}}function xt(n){if(n.kind==="array"){const t=xt(n.itemType);return typeof n.N=="number"?`array<${t}, ${n.N}>`:n.itemType.kind==="value"?"array":`array<${t}>`}return n.kind}const hl=[Qr,Ie,He,Xe,Ii,ta,en,tr,Ci(Ye),zt,ls,os,dr,cs];function hs(n,t){if(t.kind==="error")return null;if(n.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!hs(n.itemType,t.itemType))&&(typeof n.N!="number"||n.N===t.N))return null}else{if(n.kind===t.kind)return null;if(n.kind==="value"){for(const r of hl)if(!hs(r,t))return null}}return`Expected ${xt(n)} but found ${xt(t)} instead.`}function ia(n,t){return t.some(r=>r.kind===n.kind)}function tn(n,t){return t.some(r=>r==="null"?n===null:r==="array"?Array.isArray(n):r==="object"?n&&!Array.isArray(n)&&typeof n=="object":r===typeof n)}function zr(n,t){return n.kind==="array"&&t.kind==="array"?n.itemType.kind===t.itemType.kind&&typeof n.N=="number":n.kind===t.kind}const ul=.96422,dl=.82521,pl=4/29,wn=6/29,fl=3*wn*wn,ml=wn*wn*wn,us=Math.PI/180,Tc=180/Math.PI;function _l(n){return(n%=360)<0&&(n+=360),n}function Tn([n,t,r,s]){let l,d;const p=Qa((.2225045*(n=Ja(n))+.7168786*(t=Ja(t))+.0606169*(r=Ja(r)))/1);n===t&&t===r?l=d=p:(l=Qa((.4360747*n+.3850649*t+.1430804*r)/ul),d=Qa((.0139322*n+.0971045*t+.7141733*r)/dl));const m=116*p-16;return[m<0?0:m,500*(l-p),200*(p-d),s]}function Ja(n){return n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function Qa(n){return n>ml?Math.pow(n,1/3):n/fl+pl}function gl([n,t,r,s]){let l=(n+16)/116,d=isNaN(t)?l:l+t/500,p=isNaN(r)?l:l-r/200;return l=1*na(l),d=ul*na(d),p=dl*na(p),[ra(3.1338561*d-1.6168667*l-.4906146*p),ra(-.9787684*d+1.9161415*l+.033454*p),ra(.0719453*d-.2289914*l+1.4052427*p),s]}function ra(n){return(n=n<=.00304?12.92*n:1.055*Math.pow(n,1/2.4)-.055)<0?0:n>1?1:n}function na(n){return n>wn?n*n*n:fl*(n-pl)}const ir=Object.hasOwn||function(n,t){return Object.prototype.hasOwnProperty.call(n,t)};function Ke(n,t){return ir(n,t)?n[t]:void 0}function pr(n){return parseInt(n.padEnd(2,n),16)/255}function fr(n,t){return rn(t?n/100:n,0,1)}function rn(n,t,r){return Math.min(Math.max(t,n),r)}function eo(n){return!n.some(Number.isNaN)}const to={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function Fi(n,t,r){return n+r*(t-n)}function mr(n,t,r){return n.map((s,l)=>Fi(s,t[l],r))}class Je{constructor(t,r,s,l=1,d=!0){this.r=t,this.g=r,this.b=s,this.a=l,d||(this.r*=l,this.g*=l,this.b*=l,l||this.overwriteGetter("rgb",[t,r,s,l]))}static parse(t){if(t instanceof Je)return t;if(typeof t!="string")return;const r=function(s){if((s=s.toLowerCase().trim())==="transparent")return[0,0,0,0];const l=Ke(to,s);if(l){const[p,m,g]=l;return[p/255,m/255,g/255,1]}if(s.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(s)){const p=s.length<6?1:2;let m=1;return[pr(s.slice(m,m+=p)),pr(s.slice(m,m+=p)),pr(s.slice(m,m+=p)),pr(s.slice(m,m+p)||"ff")]}if(s.startsWith("rgb")){const p=s.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(p){const[m,g,x,b,T,M,A,E,D,F,U,ee]=p,W=[b||" ",A||" ",F].join("");if(W===" "||W===" /"||W===",,"||W===",,,"){const C=[x,M,D].join(""),B=C==="%%%"?100:C===""?255:0;if(B){const X=[rn(+g/B,0,1),rn(+T/B,0,1),rn(+E/B,0,1),U?fr(+U,ee):1];if(eo(X))return X}}return}}const d=s.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(d){const[p,m,g,x,b,T,M,A,E]=d,D=[g||" ",b||" ",M].join("");if(D===" "||D===" /"||D===",,"||D===",,,"){const F=[+m,rn(+x,0,100),rn(+T,0,100),A?fr(+A,E):1];if(eo(F))return function([U,ee,W,C]){function B(X){const le=(X+U/30)%12,xe=ee*Math.min(W,1-W);return W-xe*Math.max(-1,Math.min(le-3,9-le,1))}return U=_l(U),ee/=100,W/=100,[B(0),B(8),B(4),C]}(F)}}}(t);return r?new Je(...r,!1):void 0}get rgb(){const{r:t,g:r,b:s,a:l}=this,d=l||1/0;return this.overwriteGetter("rgb",[t/d,r/d,s/d,l])}get hcl(){return this.overwriteGetter("hcl",function(t){const[r,s,l,d]=Tn(t),p=Math.sqrt(s*s+l*l);return[Math.round(1e4*p)?_l(Math.atan2(l,s)*Tc):NaN,p,r,d]}(this.rgb))}get lab(){return this.overwriteGetter("lab",Tn(this.rgb))}overwriteGetter(t,r){return Object.defineProperty(this,t,{value:r}),r}toString(){const[t,r,s,l]=this.rgb;return`rgba(${[t,r,s].map(d=>Math.round(255*d)).join(",")},${l})`}static interpolate(t,r,s,l="rgb"){switch(l){case"rgb":{const[d,p,m,g]=mr(t.rgb,r.rgb,s);return new Je(d,p,m,g,!1)}case"hcl":{const[d,p,m,g]=t.hcl,[x,b,T,M]=r.hcl;let A,E;if(isNaN(d)||isNaN(x))isNaN(d)?isNaN(x)?A=NaN:(A=x,m!==1&&m!==0||(E=b)):(A=d,T!==1&&T!==0||(E=p));else{let W=x-d;x>d&&W>180?W-=360:x<d&&d-x>180&&(W+=360),A=d+s*W}const[D,F,U,ee]=function([W,C,B,X]){return W=isNaN(W)?0:W*us,gl([B,Math.cos(W)*C,Math.sin(W)*C,X])}([A,E??Fi(p,b,s),Fi(m,T,s),Fi(g,M,s)]);return new Je(D,F,U,ee,!1)}case"lab":{const[d,p,m,g]=gl(mr(t.lab,r.lab,s));return new Je(d,p,m,g,!1)}}}}Je.black=new Je(0,0,0,1),Je.white=new Je(1,1,1,1),Je.transparent=new Je(0,0,0,0),Je.red=new Je(1,0,0,1);class ds{constructor(t,r,s){this.sensitivity=t?r?"variant":"case":r?"accent":"base",this.locale=s,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,r){return this.collator.compare(t,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const sa=["bottom","center","top"];class io{constructor(t,r,s,l,d,p){this.text=t,this.image=r,this.scale=s,this.fontStack=l,this.textColor=d,this.verticalAlign=p}}class si{constructor(t){this.sections=t}static fromString(t){return new si([new io(t,null,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(t=>t.text.length!==0||t.image&&t.image.name.length!==0)}static factory(t){return t instanceof si?t:si.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map(t=>t.text).join("")}}class Rt{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Rt)return t;if(typeof t=="number")return new Rt([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const r of t)if(typeof r!="number")return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new Rt(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,s){return new Rt(mr(t.values,r.values,s))}}class ai{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof ai)return t;if(typeof t=="number")return new ai([t]);if(Array.isArray(t)){for(const r of t)if(typeof r!="number")return;return new ai(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,s){return new ai(mr(t.values,r.values,s))}}class Ut{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Ut)return t;if(typeof t=="string"){const s=Je.parse(t);return s?new Ut([s]):void 0}if(!Array.isArray(t))return;const r=[];for(const s of t){if(typeof s!="string")return;const l=Je.parse(s);if(!l)return;r.push(l)}return new Ut(r)}toString(){return JSON.stringify(this.values)}static interpolate(t,r,s,l="rgb"){const d=[];if(t.values.length!=r.values.length)throw new Error(`colorArray: Arrays have mismatched length (${t.values.length} vs. ${r.values.length}), cannot interpolate.`);for(let p=0;p<t.values.length;p++)d.push(Je.interpolate(t.values[p],r.values[p],s,l));return new Ut(d)}}class vt extends Error{constructor(t){super(t),this.name="RuntimeError"}toJSON(){return this.message}}const aa=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class rt{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof rt)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let r=0;r<t.length;r+=2){const s=t[r],l=t[r+1];if(typeof s!="string"||!aa.has(s)||!Array.isArray(l)||l.length!==2||typeof l[0]!="number"||typeof l[1]!="number")return}return new rt(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,s){const l=t.values,d=r.values;if(l.length!==d.length)throw new vt(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${r.toString()}`);const p=[];for(let m=0;m<l.length;m+=2){if(l[m]!==d[m])throw new vt(`Cannot interpolate values containing mismatched anchors. from[${m}]: ${l[m]}, to[${m}]: ${d[m]}`);p.push(l[m]);const[g,x]=l[m+1],[b,T]=d[m+1];p.push([Fi(g,b,s),Fi(x,T,s)])}return new rt(p)}}class gi{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new gi({name:t,available:!1}):null}}class Ze{constructor(t,r,s){this.from=t,this.to=r,this.transition=s}static interpolate(t,r,s){return new Ze(t,r,s)}static parse(t){return t instanceof Ze?t:Array.isArray(t)&&t.length===3&&typeof t[0]=="string"&&typeof t[1]=="string"&&typeof t[2]=="number"?new Ze(t[0],t[1],t[2]):typeof t=="object"&&typeof t.from=="string"&&typeof t.to=="string"&&typeof t.transition=="number"?new Ze(t.from,t.to,t.transition):typeof t=="string"?new Ze(t,t,1):void 0}}function qe(n,t,r,s){return typeof n=="number"&&n>=0&&n<=255&&typeof t=="number"&&t>=0&&t<=255&&typeof r=="number"&&r>=0&&r<=255?s===void 0||typeof s=="number"&&s>=0&&s<=1?null:`Invalid rgba value [${[n,t,r,s].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof s=="number"?[n,t,r,s]:[n,t,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function nn(n){if(n===null||typeof n=="string"||typeof n=="boolean"||typeof n=="number"||n instanceof Ze||n instanceof Je||n instanceof ds||n instanceof si||n instanceof Rt||n instanceof ai||n instanceof Ut||n instanceof rt||n instanceof gi)return!0;if(Array.isArray(n)){for(const t of n)if(!nn(t))return!1;return!0}if(typeof n=="object"){for(const t in n)if(!nn(n[t]))return!1;return!0}return!1}function Ne(n){if(n===null)return Qr;if(typeof n=="string")return He;if(typeof n=="boolean")return Xe;if(typeof n=="number")return Ie;if(n instanceof Je)return Ii;if(n instanceof Ze)return ta;if(n instanceof ds)return ur;if(n instanceof si)return en;if(n instanceof Rt)return zt;if(n instanceof ai)return ls;if(n instanceof Ut)return os;if(n instanceof rt)return cs;if(n instanceof gi)return dr;if(Array.isArray(n)){const t=n.length;let r;for(const s of n){const l=Ne(s);if(r){if(r===l)continue;r=Ye;break}r=l}return Ci(r||Ye,t)}return tr}function sn(n){const t=typeof n;return n===null?"":t==="string"||t==="number"||t==="boolean"?String(n):n instanceof Je||n instanceof Ze||n instanceof si||n instanceof Rt||n instanceof ai||n instanceof Ut||n instanceof rt||n instanceof gi?n.toString():JSON.stringify(n)}class hi{constructor(t,r){this.type=t,this.value=r}static parse(t,r){if(t.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!nn(t[1]))return r.error("invalid value");const s=t[1];let l=Ne(s);const d=r.expectedType;return l.kind!=="array"||l.N!==0||!d||d.kind!=="array"||typeof d.N=="number"&&d.N!==0||(l=d),new hi(l,s)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const Sn={string:He,number:Ie,boolean:Xe,object:tr};class yi{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let s,l=1;const d=t[0];if(d==="array"){let m,g;if(t.length>2){const x=t[1];if(typeof x!="string"||!(x in Sn)||x==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);m=Sn[x],l++}else m=Ye;if(t.length>3){if(t[2]!==null&&(typeof t[2]!="number"||t[2]<0||t[2]!==Math.floor(t[2])))return r.error('The length argument to "array" must be a positive integer literal',2);g=t[2],l++}s=Ci(m,g)}else{if(!Sn[d])throw new Error(`Types doesn't contain name = ${d}`);s=Sn[d]}const p=[];for(;l<t.length;l++){const m=r.parse(t[l],l,Ye);if(!m)return null;p.push(m)}return new yi(s,p)}evaluate(t){for(let r=0;r<this.args.length;r++){const s=this.args[r].evaluate(t);if(!hs(this.type,Ne(s)))return s;if(r===this.args.length-1)throw new vt(`Expected value to be of type ${xt(this.type)}, but found ${xt(Ne(s))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const ro={"to-boolean":Xe,"to-color":Ii,"to-number":Ie,"to-string":He};class rr{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");const s=t[0];if(!ro[s])throw new Error(`Can't parse ${s} as it is not part of the known types`);if((s==="to-boolean"||s==="to-string")&&t.length!==2)return r.error("Expected one argument.");const l=ro[s],d=[];for(let p=1;p<t.length;p++){const m=r.parse(t[p],p,Ye);if(!m)return null;d.push(m)}return new rr(l,d)}evaluate(t){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(t);case"color":{let r,s;for(const l of this.args){if(r=l.evaluate(t),s=null,r instanceof Je)return r;if(typeof r=="string"){const d=t.parseColor(r);if(d)return d}else if(Array.isArray(r)&&(s=r.length<3||r.length>4?`Invalid rgba value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:qe(r[0],r[1],r[2],r[3]),!s))return new Je(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new vt(s||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"padding":{let r;for(const s of this.args){r=s.evaluate(t);const l=Rt.parse(r);if(l)return l}throw new vt(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"numberArray":{let r;for(const s of this.args){r=s.evaluate(t);const l=ai.parse(r);if(l)return l}throw new vt(`Could not parse numberArray from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"colorArray":{let r;for(const s of this.args){r=s.evaluate(t);const l=Ut.parse(r);if(l)return l}throw new vt(`Could not parse colorArray from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"variableAnchorOffsetCollection":{let r;for(const s of this.args){r=s.evaluate(t);const l=rt.parse(r);if(l)return l}throw new vt(`Could not parse variableAnchorOffsetCollection from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"number":{let r=null;for(const s of this.args){if(r=s.evaluate(t),r===null)return 0;const l=Number(r);if(!isNaN(l))return l}throw new vt(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return si.fromString(sn(this.args[0].evaluate(t)));case"resolvedImage":return gi.fromString(sn(this.args[0].evaluate(t)));case"projectionDefinition":return this.args[0].evaluate(t);default:return sn(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const yl=["Unknown","Point","LineString","Polygon"];class xl{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?yl[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let r=this._parseColorCache.get(t);return r||(r=Je.parse(t),this._parseColorCache.set(t,r)),r}}class ps{constructor(t,r,s=[],l,d=new Er,p=[]){this.registry=t,this.path=s,this.key=s.map(m=>`[${m}]`).join(""),this.scope=d,this.errors=p,this.expectedType=l,this._isConstant=r}parse(t,r,s,l,d={}){return r?this.concat(r,s,l)._parse(t,d):this._parse(t,d)}_parse(t,r){function s(l,d,p){return p==="assert"?new yi(d,[l]):p==="coerce"?new rr(d,[l]):l}if(t!==null&&typeof t!="string"&&typeof t!="boolean"&&typeof t!="number"||(t=["literal",t]),Array.isArray(t)){if(t.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const l=t[0];if(typeof l!="string")return this.error(`Expression name must be a string, but found ${typeof l} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const d=this.registry[l];if(d){let p=d.parse(t,this);if(!p)return null;if(this.expectedType){const m=this.expectedType,g=p.type;if(m.kind!=="string"&&m.kind!=="number"&&m.kind!=="boolean"&&m.kind!=="object"&&m.kind!=="array"||g.kind!=="value"){if(m.kind==="projectionDefinition"&&["string","array"].includes(g.kind)||["color","formatted","resolvedImage"].includes(m.kind)&&["value","string"].includes(g.kind)||["padding","numberArray"].includes(m.kind)&&["value","number","array"].includes(g.kind)||m.kind==="colorArray"&&["value","string","array"].includes(g.kind)||m.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(g.kind))p=s(p,m,r.typeAnnotation||"coerce");else if(this.checkSubtype(m,g))return null}else p=s(p,m,r.typeAnnotation||"assert")}if(!(p instanceof hi)&&p.type.kind!=="resolvedImage"&&this._isConstant(p)){const m=new xl;try{p=new hi(p.type,p.evaluate(m))}catch(g){return this.error(g.message),null}}return p}return this.error(`Unknown expression "${l}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(t===void 0?"'undefined' value invalid. Use null instead.":typeof t=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,r,s){const l=typeof t=="number"?this.path.concat(t):this.path,d=s?this.scope.concat(s):this.scope;return new ps(this.registry,this._isConstant,l,r||null,d,this.errors)}error(t,...r){const s=`${this.key}${r.map(l=>`[${l}]`).join("")}`;this.errors.push(new yt(s,t))}checkSubtype(t,r){const s=hs(t,r);return s&&this.error(s),s}}class fs{constructor(t,r){this.type=r.type,this.bindings=[].concat(t),this.result=r}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const r of this.bindings)t(r[1]);t(this.result)}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const s=[];for(let d=1;d<t.length-1;d+=2){const p=t[d];if(typeof p!="string")return r.error(`Expected string, but found ${typeof p} instead.`,d);if(/[^a-zA-Z0-9_]/.test(p))return r.error("Variable names must contain only alphanumeric characters or '_'.",d);const m=r.parse(t[d+1],d+1);if(!m)return null;s.push([p,m])}const l=r.parse(t[t.length-1],t.length-1,r.expectedType,s);return l?new fs(s,l):null}outputDefined(){return this.result.outputDefined()}}class $i{constructor(t,r){this.type=r.type,this.name=t,this.boundExpression=r}static parse(t,r){if(t.length!==2||typeof t[1]!="string")return r.error("'var' expression requires exactly one string literal argument.");const s=t[1];return r.scope.has(s)?new $i(s,r.scope.get(s)):r.error(`Unknown variable "${s}". Make sure "${s}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}}class $t{constructor(t,r,s){this.type=t,this.index=r,this.input=s}static parse(t,r){if(t.length!==3)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const s=r.parse(t[1],1,Ie),l=r.parse(t[2],2,Ci(r.expectedType||Ye));return s&&l?new $t(l.type.itemType,s,l):null}evaluate(t){const r=this.index.evaluate(t),s=this.input.evaluate(t);if(r<0)throw new vt(`Array index out of bounds: ${r} < 0.`);if(r>=s.length)throw new vt(`Array index out of bounds: ${r} > ${s.length-1}.`);if(r!==Math.floor(r))throw new vt(`Array index must be an integer, but found ${r} instead.`);return s[r]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class Pn{constructor(t,r){this.type=Xe,this.needle=t,this.haystack=r}static parse(t,r){if(t.length!==3)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const s=r.parse(t[1],1,Ye),l=r.parse(t[2],2,Ye);return s&&l?ia(s.type,[Xe,He,Ie,Qr,Ye])?new Pn(s,l):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${xt(s.type)} instead`):null}evaluate(t){const r=this.needle.evaluate(t),s=this.haystack.evaluate(t);if(!s)return!1;if(!tn(r,["boolean","string","number","null"]))throw new vt(`Expected first argument to be of type boolean, string, number or null, but found ${xt(Ne(r))} instead.`);if(!tn(s,["string","array"]))throw new vt(`Expected second argument to be of type array or string, but found ${xt(Ne(s))} instead.`);return s.indexOf(r)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class ms{constructor(t,r,s){this.type=Ie,this.needle=t,this.haystack=r,this.fromIndex=s}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const s=r.parse(t[1],1,Ye),l=r.parse(t[2],2,Ye);if(!s||!l)return null;if(!ia(s.type,[Xe,He,Ie,Qr,Ye]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${xt(s.type)} instead`);if(t.length===4){const d=r.parse(t[3],3,Ie);return d?new ms(s,l,d):null}return new ms(s,l)}evaluate(t){const r=this.needle.evaluate(t),s=this.haystack.evaluate(t);if(!tn(r,["boolean","string","number","null"]))throw new vt(`Expected first argument to be of type boolean, string, number or null, but found ${xt(Ne(r))} instead.`);let l;if(this.fromIndex&&(l=this.fromIndex.evaluate(t)),tn(s,["string"])){const d=s.indexOf(r,l);return d===-1?-1:[...s.slice(0,d)].length}if(tn(s,["array"]))return s.indexOf(r,l);throw new vt(`Expected second argument to be of type array or string, but found ${xt(Ne(s))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class Mn{constructor(t,r,s,l,d,p){this.inputType=t,this.type=r,this.input=s,this.cases=l,this.outputs=d,this.otherwise=p}static parse(t,r){if(t.length<5)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return r.error("Expected an even number of arguments.");let s,l;r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);const d={},p=[];for(let x=2;x<t.length-1;x+=2){let b=t[x];const T=t[x+1];Array.isArray(b)||(b=[b]);const M=r.concat(x);if(b.length===0)return M.error("Expected at least one branch label.");for(const E of b){if(typeof E!="number"&&typeof E!="string")return M.error("Branch labels must be numbers or strings.");if(typeof E=="number"&&Math.abs(E)>Number.MAX_SAFE_INTEGER)return M.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof E=="number"&&Math.floor(E)!==E)return M.error("Numeric branch labels must be integer values.");if(s){if(M.checkSubtype(s,Ne(E)))return null}else s=Ne(E);if(d[String(E)]!==void 0)return M.error("Branch labels must be unique.");d[String(E)]=p.length}const A=r.parse(T,x,l);if(!A)return null;l=l||A.type,p.push(A)}const m=r.parse(t[1],1,Ye);if(!m)return null;const g=r.parse(t[t.length-1],t.length-1,l);return g?m.type.kind!=="value"&&r.concat(1).checkSubtype(s,m.type)?null:new Mn(s,l,m,d,p,g):null}evaluate(t){const r=this.input.evaluate(t);return(Ne(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}}class Lt{constructor(t,r,s){this.type=t,this.branches=r,this.otherwise=s}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return r.error("Expected an odd number of arguments.");let s;r.expectedType&&r.expectedType.kind!=="value"&&(s=r.expectedType);const l=[];for(let p=1;p<t.length-1;p+=2){const m=r.parse(t[p],p,Xe);if(!m)return null;const g=r.parse(t[p+1],p+1,s);if(!g)return null;l.push([m,g]),s=s||g.type}const d=r.parse(t[t.length-1],t.length-1,s);if(!d)return null;if(!s)throw new Error("Can't infer output type");return new Lt(s,l,d)}evaluate(t){for(const[r,s]of this.branches)if(r.evaluate(t))return s.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[r,s]of this.branches)t(r),t(s);t(this.otherwise)}outputDefined(){return this.branches.every(([t,r])=>r.outputDefined())&&this.otherwise.outputDefined()}}class _s{constructor(t,r,s,l){this.type=t,this.input=r,this.beginIndex=s,this.endIndex=l}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const s=r.parse(t[1],1,Ye),l=r.parse(t[2],2,Ie);if(!s||!l)return null;if(!ia(s.type,[Ci(Ye),He,Ye]))return r.error(`Expected first argument to be of type array or string, but found ${xt(s.type)} instead`);if(t.length===4){const d=r.parse(t[3],3,Ie);return d?new _s(s.type,s,l,d):null}return new _s(s.type,s,l)}evaluate(t){const r=this.input.evaluate(t),s=this.beginIndex.evaluate(t);let l;if(this.endIndex&&(l=this.endIndex.evaluate(t)),tn(r,["string"]))return[...r].slice(s,l).join("");if(tn(r,["array"]))return r.slice(s,l);throw new vt(`Expected first argument to be of type array or string, but found ${xt(Ne(r))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function In(n,t){const r=n.length-1;let s,l,d=0,p=r,m=0;for(;d<=p;)if(m=Math.floor((d+p)/2),s=n[m],l=n[m+1],s<=t){if(m===r||t<l)return m;d=m+1}else{if(!(s>t))throw new vt("Input is not a number.");p=m-1}return 0}class Cn{constructor(t,r,s){this.type=t,this.input=r,this.labels=[],this.outputs=[];for(const[l,d]of s)this.labels.push(l),this.outputs.push(d)}static parse(t,r){if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");const s=r.parse(t[1],1,Ie);if(!s)return null;const l=[];let d=null;r.expectedType&&r.expectedType.kind!=="value"&&(d=r.expectedType);for(let p=1;p<t.length;p+=2){const m=p===1?-1/0:t[p],g=t[p+1],x=p,b=p+1;if(typeof m!="number")return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',x);if(l.length&&l[l.length-1][0]>=m)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',x);const T=r.parse(g,b,d);if(!T)return null;d=d||T.type,l.push([m,T])}return new Cn(d,s,l)}evaluate(t){const r=this.labels,s=this.outputs;if(r.length===1)return s[0].evaluate(t);const l=this.input.evaluate(t);if(l<=r[0])return s[0].evaluate(t);const d=r.length;return l>=r[d-1]?s[d-1].evaluate(t):s[In(r,l)].evaluate(t)}eachChild(t){t(this.input);for(const r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function Sc(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var kr,gs,no=function(){if(gs)return kr;function n(t,r,s,l){this.cx=3*t,this.bx=3*(s-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*r,this.by=3*(l-r)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=r,this.p2x=s,this.p2y=l}return gs=1,kr=n,n.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,r){if(r===void 0&&(r=1e-6),t<0)return 0;if(t>1)return 1;for(var s=t,l=0;l<8;l++){var d=this.sampleCurveX(s)-t;if(Math.abs(d)<r)return s;var p=this.sampleCurveDerivativeX(s);if(Math.abs(p)<1e-6)break;s-=d/p}var m=0,g=1;for(s=t,l=0;l<20&&(d=this.sampleCurveX(s),!(Math.abs(d-t)<r));l++)t>d?m=s:g=s,s=.5*(g-m)+m;return s},solve:function(t,r){return this.sampleCurveY(this.solveCurveX(t,r))}},kr}(),Pc=Sc(no);class ui{constructor(t,r,s,l,d){this.type=t,this.operator=r,this.interpolation=s,this.input=l,this.labels=[],this.outputs=[];for(const[p,m]of d)this.labels.push(p),this.outputs.push(m)}static interpolationFactor(t,r,s,l){let d=0;if(t.name==="exponential")d=An(r,t.base,s,l);else if(t.name==="linear")d=An(r,1,s,l);else if(t.name==="cubic-bezier"){const p=t.controlPoints;d=new Pc(p[0],p[1],p[2],p[3]).solve(An(r,1,s,l))}return d}static parse(t,r){let[s,l,d,...p]=t;if(!Array.isArray(l)||l.length===0)return r.error("Expected an interpolation type expression.",1);if(l[0]==="linear")l={name:"linear"};else if(l[0]==="exponential"){const x=l[1];if(typeof x!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);l={name:"exponential",base:x}}else{if(l[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(l[0])}`,1,0);{const x=l.slice(1);if(x.length!==4||x.some(b=>typeof b!="number"||b<0||b>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);l={name:"cubic-bezier",controlPoints:x}}}if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(d=r.parse(d,2,Ie),!d)return null;const m=[];let g=null;s!=="interpolate-hcl"&&s!=="interpolate-lab"||r.expectedType==os?r.expectedType&&r.expectedType.kind!=="value"&&(g=r.expectedType):g=Ii;for(let x=0;x<p.length;x+=2){const b=p[x],T=p[x+1],M=x+3,A=x+4;if(typeof b!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',M);if(m.length&&m[m.length-1][0]>=b)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',M);const E=r.parse(T,A,g);if(!E)return null;g=g||E.type,m.push([b,E])}return zr(g,Ie)||zr(g,ta)||zr(g,Ii)||zr(g,zt)||zr(g,ls)||zr(g,os)||zr(g,cs)||zr(g,Ci(Ie))?new ui(g,s,l,d,m):r.error(`Type ${xt(g)} is not interpolatable.`)}evaluate(t){const r=this.labels,s=this.outputs;if(r.length===1)return s[0].evaluate(t);const l=this.input.evaluate(t);if(l<=r[0])return s[0].evaluate(t);const d=r.length;if(l>=r[d-1])return s[d-1].evaluate(t);const p=In(r,l),m=ui.interpolationFactor(this.interpolation,l,r[p],r[p+1]),g=s[p].evaluate(t),x=s[p+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return Fi(g,x,m);case"color":return Je.interpolate(g,x,m);case"padding":return Rt.interpolate(g,x,m);case"colorArray":return Ut.interpolate(g,x,m);case"numberArray":return ai.interpolate(g,x,m);case"variableAnchorOffsetCollection":return rt.interpolate(g,x,m);case"array":return mr(g,x,m);case"projectionDefinition":return Ze.interpolate(g,x,m)}case"interpolate-hcl":switch(this.type.kind){case"color":return Je.interpolate(g,x,m,"hcl");case"colorArray":return Ut.interpolate(g,x,m,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return Je.interpolate(g,x,m,"lab");case"colorArray":return Ut.interpolate(g,x,m,"lab")}}}eachChild(t){t(this.input);for(const r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function An(n,t,r,s){const l=s-r,d=n-r;return l===0?0:t===1?d/l:(Math.pow(t,d)-1)/(Math.pow(t,l)-1)}const Ai={color:Je.interpolate,number:Fi,padding:Rt.interpolate,numberArray:ai.interpolate,colorArray:Ut.interpolate,variableAnchorOffsetCollection:rt.interpolate,array:mr};class xi{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let s=null;const l=r.expectedType;l&&l.kind!=="value"&&(s=l);const d=[];for(const m of t.slice(1)){const g=r.parse(m,1+d.length,s,void 0,{typeAnnotation:"omit"});if(!g)return null;s=s||g.type,d.push(g)}if(!s)throw new Error("No output type");const p=l&&d.some(m=>hs(l,m.type));return new xi(p?Ye:s,d)}evaluate(t){let r,s=null,l=0;for(const d of this.args)if(l++,s=d.evaluate(t),s&&s instanceof gi&&!s.available&&(r||(r=s.name),s=null,l===this.args.length&&(s=r)),s!==null)break;return s}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}function so(n,t){return n==="=="||n==="!="?t.kind==="boolean"||t.kind==="string"||t.kind==="number"||t.kind==="null"||t.kind==="value":t.kind==="string"||t.kind==="number"||t.kind==="value"}function ys(n,t,r,s){return s.compare(t,r)===0}function En(n,t,r){const s=n!=="=="&&n!=="!=";return class Md{constructor(d,p,m){this.type=Xe,this.lhs=d,this.rhs=p,this.collator=m,this.hasUntypedArgument=d.type.kind==="value"||p.type.kind==="value"}static parse(d,p){if(d.length!==3&&d.length!==4)return p.error("Expected two or three arguments.");const m=d[0];let g=p.parse(d[1],1,Ye);if(!g)return null;if(!so(m,g.type))return p.concat(1).error(`"${m}" comparisons are not supported for type '${xt(g.type)}'.`);let x=p.parse(d[2],2,Ye);if(!x)return null;if(!so(m,x.type))return p.concat(2).error(`"${m}" comparisons are not supported for type '${xt(x.type)}'.`);if(g.type.kind!==x.type.kind&&g.type.kind!=="value"&&x.type.kind!=="value")return p.error(`Cannot compare types '${xt(g.type)}' and '${xt(x.type)}'.`);s&&(g.type.kind==="value"&&x.type.kind!=="value"?g=new yi(x.type,[g]):g.type.kind!=="value"&&x.type.kind==="value"&&(x=new yi(g.type,[x])));let b=null;if(d.length===4){if(g.type.kind!=="string"&&x.type.kind!=="string"&&g.type.kind!=="value"&&x.type.kind!=="value")return p.error("Cannot use collator to compare non-string types.");if(b=p.parse(d[3],3,ur),!b)return null}return new Md(g,x,b)}evaluate(d){const p=this.lhs.evaluate(d),m=this.rhs.evaluate(d);if(s&&this.hasUntypedArgument){const g=Ne(p),x=Ne(m);if(g.kind!==x.kind||g.kind!=="string"&&g.kind!=="number")throw new vt(`Expected arguments for "${n}" to be (string, string) or (number, number), but found (${g.kind}, ${x.kind}) instead.`)}if(this.collator&&!s&&this.hasUntypedArgument){const g=Ne(p),x=Ne(m);if(g.kind!=="string"||x.kind!=="string")return t(d,p,m)}return this.collator?r(d,p,m,this.collator.evaluate(d)):t(d,p,m)}eachChild(d){d(this.lhs),d(this.rhs),this.collator&&d(this.collator)}outputDefined(){return!0}}}const ao=En("==",function(n,t,r){return t===r},ys),Mc=En("!=",function(n,t,r){return t!==r},function(n,t,r,s){return!ys(0,t,r,s)}),Ic=En("<",function(n,t,r){return t<r},function(n,t,r,s){return s.compare(t,r)<0}),Cc=En(">",function(n,t,r){return t>r},function(n,t,r,s){return s.compare(t,r)>0}),Ac=En("<=",function(n,t,r){return t<=r},function(n,t,r,s){return s.compare(t,r)<=0}),oa=En(">=",function(n,t,r){return t>=r},function(n,t,r,s){return s.compare(t,r)>=0});class la{constructor(t,r,s){this.type=ur,this.locale=s,this.caseSensitive=t,this.diacriticSensitive=r}static parse(t,r){if(t.length!==2)return r.error("Expected one argument.");const s=t[1];if(typeof s!="object"||Array.isArray(s))return r.error("Collator options argument must be an object.");const l=r.parse(s["case-sensitive"]!==void 0&&s["case-sensitive"],1,Xe);if(!l)return null;const d=r.parse(s["diacritic-sensitive"]!==void 0&&s["diacritic-sensitive"],1,Xe);if(!d)return null;let p=null;return s.locale&&(p=r.parse(s.locale,1,He),!p)?null:new la(l,d,p)}evaluate(t){return new ds(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}}class ca{constructor(t,r,s,l,d){this.type=He,this.number=t,this.locale=r,this.currency=s,this.minFractionDigits=l,this.maxFractionDigits=d}static parse(t,r){if(t.length!==3)return r.error("Expected two arguments.");const s=r.parse(t[1],1,Ie);if(!s)return null;const l=t[2];if(typeof l!="object"||Array.isArray(l))return r.error("NumberFormat options argument must be an object.");let d=null;if(l.locale&&(d=r.parse(l.locale,1,He),!d))return null;let p=null;if(l.currency&&(p=r.parse(l.currency,1,He),!p))return null;let m=null;if(l["min-fraction-digits"]&&(m=r.parse(l["min-fraction-digits"],1,Ie),!m))return null;let g=null;return l["max-fraction-digits"]&&(g=r.parse(l["max-fraction-digits"],1,Ie),!g)?null:new ca(s,d,p,m,g)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class xs{constructor(t){this.type=en,this.sections=t}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");const s=t[1];if(!Array.isArray(s)&&typeof s=="object")return r.error("First argument must be an image or text section.");const l=[];let d=!1;for(let p=1;p<=t.length-1;++p){const m=t[p];if(d&&typeof m=="object"&&!Array.isArray(m)){d=!1;let g=null;if(m["font-scale"]&&(g=r.parse(m["font-scale"],1,Ie),!g))return null;let x=null;if(m["text-font"]&&(x=r.parse(m["text-font"],1,Ci(He)),!x))return null;let b=null;if(m["text-color"]&&(b=r.parse(m["text-color"],1,Ii),!b))return null;let T=null;if(m["vertical-align"]){if(typeof m["vertical-align"]=="string"&&!sa.includes(m["vertical-align"]))return r.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${m["vertical-align"]}' instead.`);if(T=r.parse(m["vertical-align"],1,He),!T)return null}const M=l[l.length-1];M.scale=g,M.font=x,M.textColor=b,M.verticalAlign=T}else{const g=r.parse(t[p],1,Ye);if(!g)return null;const x=g.type.kind;if(x!=="string"&&x!=="value"&&x!=="null"&&x!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");d=!0,l.push({content:g,scale:null,font:null,textColor:null,verticalAlign:null})}}return new xs(l)}evaluate(t){return new si(this.sections.map(r=>{const s=r.content.evaluate(t);return Ne(s)===dr?new io("",s,null,null,null,r.verticalAlign?r.verticalAlign.evaluate(t):null):new io(sn(s),null,r.scale?r.scale.evaluate(t):null,r.font?r.font.evaluate(t).join(","):null,r.textColor?r.textColor.evaluate(t):null,r.verticalAlign?r.verticalAlign.evaluate(t):null)}))}eachChild(t){for(const r of this.sections)t(r.content),r.scale&&t(r.scale),r.font&&t(r.font),r.textColor&&t(r.textColor),r.verticalAlign&&t(r.verticalAlign)}outputDefined(){return!1}}class oo{constructor(t){this.type=dr,this.input=t}static parse(t,r){if(t.length!==2)return r.error("Expected two arguments.");const s=r.parse(t[1],1,He);return s?new oo(s):r.error("No image name provided.")}evaluate(t){const r=this.input.evaluate(t),s=gi.fromString(r);return s&&t.availableImages&&(s.available=t.availableImages.indexOf(r)>-1),s}eachChild(t){t(this.input)}outputDefined(){return!1}}class ha{constructor(t){this.type=Ie,this.input=t}static parse(t,r){if(t.length!==2)return r.error(`Expected 1 argument, but found ${t.length-1} instead.`);const s=r.parse(t[1],1);return s?s.type.kind!=="array"&&s.type.kind!=="string"&&s.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${xt(s.type)} instead.`):new ha(s):null}evaluate(t){const r=this.input.evaluate(t);if(typeof r=="string")return[...r].length;if(Array.isArray(r))return r.length;throw new vt(`Expected value to be of type string or array, but found ${xt(Ne(r))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const nr=8192;function Ec(n,t){const r=(180+n[0])/360,s=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+n[1]*Math.PI/360)))/360,l=Math.pow(2,t.z);return[Math.round(r*l*nr),Math.round(s*l*nr)]}function lo(n,t){const r=Math.pow(2,t.z);return[(l=(n[0]/nr+t.x)/r,360*l-180),(s=(n[1]/nr+t.y)/r,360/Math.PI*Math.atan(Math.exp((180-360*s)*Math.PI/180))-90)];var s,l}function vs(n,t){n[0]=Math.min(n[0],t[0]),n[1]=Math.min(n[1],t[1]),n[2]=Math.max(n[2],t[0]),n[3]=Math.max(n[3],t[1])}function bs(n,t){return!(n[0]<=t[0]||n[2]>=t[2]||n[1]<=t[1]||n[3]>=t[3])}function vl(n,t,r){const s=n[0]-t[0],l=n[1]-t[1],d=n[0]-r[0],p=n[1]-r[1];return s*p-d*l==0&&s*d<=0&&l*p<=0}function ws(n,t,r,s){return(l=[s[0]-r[0],s[1]-r[1]])[0]*(d=[t[0]-n[0],t[1]-n[1]])[1]-l[1]*d[0]!=0&&!(!ua(n,t,r,s)||!ua(r,s,n,t));var l,d}function bl(n,t,r){for(const s of r)for(let l=0;l<s.length-1;++l)if(ws(n,t,s[l],s[l+1]))return!0;return!1}function zn(n,t,r=!1){let s=!1;for(const m of t)for(let g=0;g<m.length-1;g++){if(vl(n,m[g],m[g+1]))return r;(d=m[g])[1]>(l=n)[1]!=(p=m[g+1])[1]>l[1]&&l[0]<(p[0]-d[0])*(l[1]-d[1])/(p[1]-d[1])+d[0]&&(s=!s)}var l,d,p;return s}function zc(n,t){for(const r of t)if(zn(n,r))return!0;return!1}function wl(n,t){for(const r of n)if(!zn(r,t))return!1;for(let r=0;r<n.length-1;++r)if(bl(n[r],n[r+1],t))return!1;return!0}function kc(n,t){for(const r of t)if(wl(n,r))return!0;return!1}function ua(n,t,r,s){const l=s[0]-r[0],d=s[1]-r[1],p=(n[0]-r[0])*d-l*(n[1]-r[1]),m=(t[0]-r[0])*d-l*(t[1]-r[1]);return p>0&&m<0||p<0&&m>0}function co(n,t,r){const s=[];for(let l=0;l<n.length;l++){const d=[];for(let p=0;p<n[l].length;p++){const m=Ec(n[l][p],r);vs(t,m),d.push(m)}s.push(d)}return s}function Tl(n,t,r){const s=[];for(let l=0;l<n.length;l++){const d=co(n[l],t,r);s.push(d)}return s}function Sl(n,t,r,s){if(n[0]<r[0]||n[0]>r[2]){const l=.5*s;let d=n[0]-r[0]>l?-s:r[0]-n[0]>l?s:0;d===0&&(d=n[0]-r[2]>l?-s:r[2]-n[0]>l?s:0),n[0]+=d}vs(t,n)}function ho(n,t,r,s){const l=Math.pow(2,s.z)*nr,d=[s.x*nr,s.y*nr],p=[];for(const m of n)for(const g of m){const x=[g.x+d[0],g.y+d[1]];Sl(x,t,r,l),p.push(x)}return p}function uo(n,t,r,s){const l=Math.pow(2,s.z)*nr,d=[s.x*nr,s.y*nr],p=[];for(const g of n){const x=[];for(const b of g){const T=[b.x+d[0],b.y+d[1]];vs(t,T),x.push(T)}p.push(x)}if(t[2]-t[0]<=l/2){(m=t)[0]=m[1]=1/0,m[2]=m[3]=-1/0;for(const g of p)for(const x of g)Sl(x,t,r,l)}var m;return p}class an{constructor(t,r){this.type=Xe,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(nn(t[1])){const s=t[1];if(s.type==="FeatureCollection"){const l=[];for(const d of s.features){const{type:p,coordinates:m}=d.geometry;p==="Polygon"&&l.push(m),p==="MultiPolygon"&&l.push(...m)}if(l.length)return new an(s,{type:"MultiPolygon",coordinates:l})}else if(s.type==="Feature"){const l=s.geometry.type;if(l==="Polygon"||l==="MultiPolygon")return new an(s,s.geometry)}else if(s.type==="Polygon"||s.type==="MultiPolygon")return new an(s,s)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return function(r,s){const l=[1/0,1/0,-1/0,-1/0],d=[1/0,1/0,-1/0,-1/0],p=r.canonicalID();if(s.type==="Polygon"){const m=co(s.coordinates,d,p),g=ho(r.geometry(),l,d,p);if(!bs(l,d))return!1;for(const x of g)if(!zn(x,m))return!1}if(s.type==="MultiPolygon"){const m=Tl(s.coordinates,d,p),g=ho(r.geometry(),l,d,p);if(!bs(l,d))return!1;for(const x of g)if(!zc(x,m))return!1}return!0}(t,this.geometries);if(t.geometryType()==="LineString")return function(r,s){const l=[1/0,1/0,-1/0,-1/0],d=[1/0,1/0,-1/0,-1/0],p=r.canonicalID();if(s.type==="Polygon"){const m=co(s.coordinates,d,p),g=uo(r.geometry(),l,d,p);if(!bs(l,d))return!1;for(const x of g)if(!wl(x,m))return!1}if(s.type==="MultiPolygon"){const m=Tl(s.coordinates,d,p),g=uo(r.geometry(),l,d,p);if(!bs(l,d))return!1;for(const x of g)if(!kc(x,m))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let Pl=class{constructor(n=[],t=(r,s)=>r<s?-1:r>s?1:0){if(this.data=n,this.length=this.data.length,this.compare=t,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(n){this.data.push(n),this._up(this.length++)}pop(){if(this.length===0)return;const n=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),n}peek(){return this.data[0]}_up(n){const{data:t,compare:r}=this,s=t[n];for(;n>0;){const l=n-1>>1,d=t[l];if(r(s,d)>=0)break;t[n]=d,n=l}t[n]=s}_down(n){const{data:t,compare:r}=this,s=this.length>>1,l=t[n];for(;n<s;){let d=1+(n<<1);const p=d+1;if(p<this.length&&r(t[p],t[d])<0&&(d=p),r(t[d],l)>=0)break;t[n]=t[d],n=d}t[n]=l}};function po(n,t,r=0,s=n.length-1,l=Dc){for(;s>r;){if(s-r>600){const g=s-r+1,x=t-r+1,b=Math.log(g),T=.5*Math.exp(2*b/3),M=.5*Math.sqrt(b*T*(g-T)/g)*(x-g/2<0?-1:1);po(n,t,Math.max(r,Math.floor(t-x*T/g+M)),Math.min(s,Math.floor(t+(g-x)*T/g+M)),l)}const d=n[t];let p=r,m=s;for(kn(n,r,t),l(n[s],d)>0&&kn(n,r,s);p<m;){for(kn(n,p,m),p++,m--;l(n[p],d)<0;)p++;for(;l(n[m],d)>0;)m--}l(n[r],d)===0?kn(n,r,m):(m++,kn(n,m,s)),m<=t&&(r=m+1),t<=m&&(s=m-1)}}function kn(n,t,r){const s=n[t];n[t]=n[r],n[r]=s}function Dc(n,t){return n<t?-1:n>t?1:0}function da(n,t){if(n.length<=1)return[n];const r=[];let s,l;for(const d of n){const p=Ml(d);p!==0&&(d.area=Math.abs(p),l===void 0&&(l=p<0),l===p<0?(s&&r.push(s),s=[d]):s.push(d))}if(s&&r.push(s),t>1)for(let d=0;d<r.length;d++)r[d].length<=t||(po(r[d],t,1,r[d].length-1,Rc),r[d]=r[d].slice(0,t));return r}function Rc(n,t){return t.area-n.area}function Ml(n){let t=0;for(let r,s,l=0,d=n.length,p=d-1;l<d;p=l++)r=n[l],s=n[p],t+=(s.x-r.x)*(r.y+s.y);return t}const Il=1/298.257223563,Cl=Il*(2-Il),Al=Math.PI/180;class fo{constructor(t){const r=6378.137*Al*1e3,s=Math.cos(t*Al),l=1/(1-Cl*(1-s*s)),d=Math.sqrt(l);this.kx=r*d*s,this.ky=r*d*l*(1-Cl)}distance(t,r){const s=this.wrap(t[0]-r[0])*this.kx,l=(t[1]-r[1])*this.ky;return Math.sqrt(s*s+l*l)}pointOnLine(t,r){let s,l,d,p,m=1/0;for(let g=0;g<t.length-1;g++){let x=t[g][0],b=t[g][1],T=this.wrap(t[g+1][0]-x)*this.kx,M=(t[g+1][1]-b)*this.ky,A=0;T===0&&M===0||(A=(this.wrap(r[0]-x)*this.kx*T+(r[1]-b)*this.ky*M)/(T*T+M*M),A>1?(x=t[g+1][0],b=t[g+1][1]):A>0&&(x+=T/this.kx*A,b+=M/this.ky*A)),T=this.wrap(r[0]-x)*this.kx,M=(r[1]-b)*this.ky;const E=T*T+M*M;E<m&&(m=E,s=x,l=b,d=g,p=A)}return{point:[s,l],index:d,t:Math.max(0,Math.min(1,p))}}wrap(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}}function at(n,t){return t[0]-n[0]}function pa(n){return n[1]-n[0]+1}function _r(n,t){return n[1]>=n[0]&&n[1]<t}function mo(n,t){if(n[0]>n[1])return[null,null];const r=pa(n);if(t){if(r===2)return[n,null];const l=Math.floor(r/2);return[[n[0],n[0]+l],[n[0]+l,n[1]]]}if(r===1)return[n,null];const s=Math.floor(r/2)-1;return[[n[0],n[0]+s],[n[0]+s+1,n[1]]]}function _o(n,t){if(!_r(t,n.length))return[1/0,1/0,-1/0,-1/0];const r=[1/0,1/0,-1/0,-1/0];for(let s=t[0];s<=t[1];++s)vs(r,n[s]);return r}function go(n){const t=[1/0,1/0,-1/0,-1/0];for(const r of n)for(const s of r)vs(t,s);return t}function El(n){return n[0]!==-1/0&&n[1]!==-1/0&&n[2]!==1/0&&n[3]!==1/0}function yo(n,t,r){if(!El(n)||!El(t))return NaN;let s=0,l=0;return n[2]<t[0]&&(s=t[0]-n[2]),n[0]>t[2]&&(s=n[0]-t[2]),n[1]>t[3]&&(l=n[1]-t[3]),n[3]<t[1]&&(l=t[1]-n[3]),r.distance([0,0],[s,l])}function on(n,t,r){const s=r.pointOnLine(t,n);return r.distance(n,s.point)}function xo(n,t,r,s,l){const d=Math.min(on(n,[r,s],l),on(t,[r,s],l)),p=Math.min(on(r,[n,t],l),on(s,[n,t],l));return Math.min(d,p)}function Lc(n,t,r,s,l){if(!_r(t,n.length)||!_r(s,r.length))return 1/0;let d=1/0;for(let p=t[0];p<t[1];++p){const m=n[p],g=n[p+1];for(let x=s[0];x<s[1];++x){const b=r[x],T=r[x+1];if(ws(m,g,b,T))return 0;d=Math.min(d,xo(m,g,b,T,l))}}return d}function Bc(n,t,r,s,l){if(!_r(t,n.length)||!_r(s,r.length))return NaN;let d=1/0;for(let p=t[0];p<=t[1];++p)for(let m=s[0];m<=s[1];++m)if(d=Math.min(d,l.distance(n[p],r[m])),d===0)return d;return d}function Fc(n,t,r){if(zn(n,t,!0))return 0;let s=1/0;for(const l of t){const d=l[0],p=l[l.length-1];if(d!==p&&(s=Math.min(s,on(n,[p,d],r)),s===0))return s;const m=r.pointOnLine(l,n);if(s=Math.min(s,r.distance(n,m.point)),s===0)return s}return s}function Oc(n,t,r,s){if(!_r(t,n.length))return NaN;for(let d=t[0];d<=t[1];++d)if(zn(n[d],r,!0))return 0;let l=1/0;for(let d=t[0];d<t[1];++d){const p=n[d],m=n[d+1];for(const g of r)for(let x=0,b=g.length,T=b-1;x<b;T=x++){const M=g[T],A=g[x];if(ws(p,m,M,A))return 0;l=Math.min(l,xo(p,m,M,A,s))}}return l}function zl(n,t){for(const r of n)for(const s of r)if(zn(s,t,!0))return!0;return!1}function jc(n,t,r,s=1/0){const l=go(n),d=go(t);if(s!==1/0&&yo(l,d,r)>=s)return s;if(bs(l,d)){if(zl(n,t))return 0}else if(zl(t,n))return 0;let p=1/0;for(const m of n)for(let g=0,x=m.length,b=x-1;g<x;b=g++){const T=m[b],M=m[g];for(const A of t)for(let E=0,D=A.length,F=D-1;E<D;F=E++){const U=A[F],ee=A[E];if(ws(T,M,U,ee))return 0;p=Math.min(p,xo(T,M,U,ee,r))}}return p}function kl(n,t,r,s,l,d){if(!d)return;const p=yo(_o(s,d),l,r);p<t&&n.push([p,d,[0,0]])}function fa(n,t,r,s,l,d,p){if(!d||!p)return;const m=yo(_o(s,d),_o(l,p),r);m<t&&n.push([m,d,p])}function ma(n,t,r,s,l=1/0){let d=Math.min(s.distance(n[0],r[0][0]),l);if(d===0)return d;const p=new Pl([[0,[0,n.length-1],[0,0]]],at),m=go(r);for(;p.length>0;){const g=p.pop();if(g[0]>=d)continue;const x=g[1],b=t?50:100;if(pa(x)<=b){if(!_r(x,n.length))return NaN;if(t){const T=Oc(n,x,r,s);if(isNaN(T)||T===0)return T;d=Math.min(d,T)}else for(let T=x[0];T<=x[1];++T){const M=Fc(n[T],r,s);if(d=Math.min(d,M),d===0)return 0}}else{const T=mo(x,t);kl(p,d,s,n,m,T[0]),kl(p,d,s,n,m,T[1])}}return d}function _a(n,t,r,s,l,d=1/0){let p=Math.min(d,l.distance(n[0],r[0]));if(p===0)return p;const m=new Pl([[0,[0,n.length-1],[0,r.length-1]]],at);for(;m.length>0;){const g=m.pop();if(g[0]>=p)continue;const x=g[1],b=g[2],T=t?50:100,M=s?50:100;if(pa(x)<=T&&pa(b)<=M){if(!_r(x,n.length)&&_r(b,r.length))return NaN;let A;if(t&&s)A=Lc(n,x,r,b,l),p=Math.min(p,A);else if(t&&!s){const E=n.slice(x[0],x[1]+1);for(let D=b[0];D<=b[1];++D)if(A=on(r[D],E,l),p=Math.min(p,A),p===0)return p}else if(!t&&s){const E=r.slice(b[0],b[1]+1);for(let D=x[0];D<=x[1];++D)if(A=on(n[D],E,l),p=Math.min(p,A),p===0)return p}else A=Bc(n,x,r,b,l),p=Math.min(p,A)}else{const A=mo(x,t),E=mo(b,s);fa(m,p,l,n,r,A[0],E[0]),fa(m,p,l,n,r,A[0],E[1]),fa(m,p,l,n,r,A[1],E[0]),fa(m,p,l,n,r,A[1],E[1])}}return p}function vo(n){return n.type==="MultiPolygon"?n.coordinates.map(t=>({type:"Polygon",coordinates:t})):n.type==="MultiLineString"?n.coordinates.map(t=>({type:"LineString",coordinates:t})):n.type==="MultiPoint"?n.coordinates.map(t=>({type:"Point",coordinates:t})):[n]}class ln{constructor(t,r){this.type=Ie,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(nn(t[1])){const s=t[1];if(s.type==="FeatureCollection")return new ln(s,s.features.map(l=>vo(l.geometry)).flat());if(s.type==="Feature")return new ln(s,vo(s.geometry));if("type"in s&&"coordinates"in s)return new ln(s,vo(s))}return r.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return function(r,s){const l=r.geometry(),d=l.flat().map(g=>lo([g.x,g.y],r.canonical));if(l.length===0)return NaN;const p=new fo(d[0][1]);let m=1/0;for(const g of s){switch(g.type){case"Point":m=Math.min(m,_a(d,!1,[g.coordinates],!1,p,m));break;case"LineString":m=Math.min(m,_a(d,!1,g.coordinates,!0,p,m));break;case"Polygon":m=Math.min(m,ma(d,!1,g.coordinates,p,m))}if(m===0)return m}return m}(t,this.geometries);if(t.geometryType()==="LineString")return function(r,s){const l=r.geometry(),d=l.flat().map(g=>lo([g.x,g.y],r.canonical));if(l.length===0)return NaN;const p=new fo(d[0][1]);let m=1/0;for(const g of s){switch(g.type){case"Point":m=Math.min(m,_a(d,!0,[g.coordinates],!1,p,m));break;case"LineString":m=Math.min(m,_a(d,!0,g.coordinates,!0,p,m));break;case"Polygon":m=Math.min(m,ma(d,!0,g.coordinates,p,m))}if(m===0)return m}return m}(t,this.geometries);if(t.geometryType()==="Polygon")return function(r,s){const l=r.geometry();if(l.length===0||l[0].length===0)return NaN;const d=da(l,0).map(g=>g.map(x=>x.map(b=>lo([b.x,b.y],r.canonical)))),p=new fo(d[0][0][0][1]);let m=1/0;for(const g of s)for(const x of d){switch(g.type){case"Point":m=Math.min(m,ma([g.coordinates],!1,x,p,m));break;case"LineString":m=Math.min(m,ma(g.coordinates,!0,x,p,m));break;case"Polygon":m=Math.min(m,jc(x,g.coordinates,p,m))}if(m===0)return m}return m}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class Ts{constructor(t){this.type=Ye,this.key=t}static parse(t,r){if(t.length!==2)return r.error(`Expected 1 argument, but found ${t.length-1} instead.`);const s=t[1];return s==null?r.error("Global state property must be defined."):typeof s!="string"?r.error(`Global state property must be string, but found ${typeof t[1]} instead.`):new Ts(s)}evaluate(t){var r;const s=(r=t.globals)===null||r===void 0?void 0:r.globalState;return s&&Object.keys(s).length!==0?Ke(s,this.key):null}eachChild(){}outputDefined(){return!1}}const Dn={"==":ao,"!=":Mc,">":Cc,"<":Ic,">=":oa,"<=":Ac,array:yi,at:$t,boolean:yi,case:Lt,coalesce:xi,collator:la,format:xs,image:oo,in:Pn,"index-of":ms,interpolate:ui,"interpolate-hcl":ui,"interpolate-lab":ui,length:ha,let:fs,literal:hi,match:Mn,number:yi,"number-format":ca,object:yi,slice:_s,step:Cn,string:yi,"to-boolean":rr,"to-color":rr,"to-number":rr,"to-string":rr,var:$i,within:an,distance:ln,"global-state":Ts};class Oi{constructor(t,r,s,l){this.name=t,this.type=r,this._evaluate=s,this.args=l}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,r){const s=t[0],l=Oi.definitions[s];if(!l)return r.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0);const d=Array.isArray(l)?l[0]:l.type,p=Array.isArray(l)?[[l[1],l[2]]]:l.overloads,m=p.filter(([x])=>!Array.isArray(x)||x.length===t.length-1);let g=null;for(const[x,b]of m){g=new ps(r.registry,ga,r.path,null,r.scope);const T=[];let M=!1;for(let A=1;A<t.length;A++){const E=t[A],D=Array.isArray(x)?x[A-1]:x.type,F=g.parse(E,1+T.length,D);if(!F){M=!0;break}T.push(F)}if(!M)if(Array.isArray(x)&&x.length!==T.length)g.error(`Expected ${x.length} arguments, but found ${T.length} instead.`);else{for(let A=0;A<T.length;A++){const E=Array.isArray(x)?x[A]:x.type,D=T[A];g.concat(A+1).checkSubtype(E,D.type)}if(g.errors.length===0)return new Oi(s,d,b,T)}}if(m.length===1)r.errors.push(...g.errors);else{const x=(m.length?m:p).map(([T])=>{return M=T,Array.isArray(M)?`(${M.map(xt).join(", ")})`:`(${xt(M.type)}...)`;var M}).join(" | "),b=[];for(let T=1;T<t.length;T++){const M=r.parse(t[T],1+b.length);if(!M)return null;b.push(xt(M.type))}r.error(`Expected arguments of type ${x}, but found (${b.join(", ")}) instead.`)}return null}static register(t,r){Oi.definitions=r;for(const s in r)t[s]=Oi}}function Dl(n,[t,r,s,l]){t=t.evaluate(n),r=r.evaluate(n),s=s.evaluate(n);const d=l?l.evaluate(n):1,p=qe(t,r,s,d);if(p)throw new vt(p);return new Je(t/255,r/255,s/255,d,!1)}function Rl(n,t){return n in t}function bo(n,t){const r=t[n];return r===void 0?null:r}function cn(n){return{type:n}}function ga(n){if(n instanceof $i)return ga(n.boundExpression);if(n instanceof Oi&&n.name==="error"||n instanceof la||n instanceof an||n instanceof ln||n instanceof Ts)return!1;const t=n instanceof rr||n instanceof yi;let r=!0;return n.eachChild(s=>{r=t?r&&ga(s):r&&s instanceof hi}),!!r&&ya(n)&&Rn(n,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function ya(n){if(n instanceof Oi&&(n.name==="get"&&n.args.length===1||n.name==="feature-state"||n.name==="has"&&n.args.length===1||n.name==="properties"||n.name==="geometry-type"||n.name==="id"||/^filter-/.test(n.name))||n instanceof an||n instanceof ln)return!1;let t=!0;return n.eachChild(r=>{t&&!ya(r)&&(t=!1)}),t}function Ss(n){if(n instanceof Oi&&n.name==="feature-state")return!1;let t=!0;return n.eachChild(r=>{t&&!Ss(r)&&(t=!1)}),t}function Rn(n,t){if(n instanceof Oi&&t.indexOf(n.name)>=0)return!1;let r=!0;return n.eachChild(s=>{r&&!Rn(s,t)&&(r=!1)}),r}function Ll(n){return{result:"success",value:n}}function Ln(n){return{result:"error",value:n}}function Bn(n){return n["property-type"]==="data-driven"||n["property-type"]==="cross-faded-data-driven"}function wo(n){return!!n.expression&&n.expression.parameters.indexOf("zoom")>-1}function To(n){return!!n.expression&&n.expression.interpolated}function Qe(n){return n instanceof Number?"number":n instanceof String?"string":n instanceof Boolean?"boolean":Array.isArray(n)?"array":n===null?"null":typeof n}function hn(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)&&Ne(n)===tr}function Bl(n){return n}function Fl(n,t){const r=n.stops&&typeof n.stops[0][0]=="object",s=r||!(r||n.property!==void 0),l=n.type||(To(t)?"exponential":"interval"),d=function(b){switch(b.type){case"color":return Je.parse;case"padding":return Rt.parse;case"numberArray":return ai.parse;case"colorArray":return Ut.parse;default:return null}}(t);if(d&&((n=Kt({},n)).stops&&(n.stops=n.stops.map(b=>[b[0],d(b[1])])),n.default=d(n.default?n.default:t.default)),n.colorSpace&&(p=n.colorSpace)!=="rgb"&&p!=="hcl"&&p!=="lab")throw new Error(`Unknown color space: "${n.colorSpace}"`);var p;const m=function(b){switch(b){case"exponential":return Ol;case"interval":return Nc;case"categorical":return Vc;case"identity":return jl;default:throw new Error(`Unknown function type "${b}"`)}}(l);let g,x;if(l==="categorical"){g=Object.create(null);for(const b of n.stops)g[b[0]]=b[1];x=typeof n.stops[0][0]}if(r){const b={},T=[];for(let E=0;E<n.stops.length;E++){const D=n.stops[E],F=D[0].zoom;b[F]===void 0&&(b[F]={zoom:F,type:n.type,property:n.property,default:n.default,stops:[]},T.push(F)),b[F].stops.push([D[0].value,D[1]])}const M=[];for(const E of T)M.push([b[E].zoom,Fl(b[E],t)]);const A={name:"linear"};return{kind:"composite",interpolationType:A,interpolationFactor:ui.interpolationFactor.bind(void 0,A),zoomStops:M.map(E=>E[0]),evaluate:({zoom:E},D)=>Ol({stops:M,base:n.base},t,E).evaluate(E,D)}}if(s){const b=l==="exponential"?{name:"exponential",base:n.base!==void 0?n.base:1}:null;return{kind:"camera",interpolationType:b,interpolationFactor:ui.interpolationFactor.bind(void 0,b),zoomStops:n.stops.map(T=>T[0]),evaluate:({zoom:T})=>m(n,t,T,g,x)}}return{kind:"source",evaluate(b,T){const M=T&&T.properties?T.properties[n.property]:void 0;return M===void 0?Ps(n.default,t.default):m(n,t,M,g,x)}}}function Ps(n,t,r){return n!==void 0?n:t!==void 0?t:r!==void 0?r:void 0}function Vc(n,t,r,s,l){return Ps(typeof r===l?s[r]:void 0,n.default,t.default)}function Nc(n,t,r){if(Qe(r)!=="number")return Ps(n.default,t.default);const s=n.stops.length;if(s===1||r<=n.stops[0][0])return n.stops[0][1];if(r>=n.stops[s-1][0])return n.stops[s-1][1];const l=In(n.stops.map(d=>d[0]),r);return n.stops[l][1]}function Ol(n,t,r){const s=n.base!==void 0?n.base:1;if(Qe(r)!=="number")return Ps(n.default,t.default);const l=n.stops.length;if(l===1||r<=n.stops[0][0])return n.stops[0][1];if(r>=n.stops[l-1][0])return n.stops[l-1][1];const d=In(n.stops.map(b=>b[0]),r),p=function(b,T,M,A){const E=A-M,D=b-M;return E===0?0:T===1?D/E:(Math.pow(T,D)-1)/(Math.pow(T,E)-1)}(r,s,n.stops[d][0],n.stops[d+1][0]),m=n.stops[d][1],g=n.stops[d+1][1],x=Ai[t.type]||Bl;return typeof m.evaluate=="function"?{evaluate(...b){const T=m.evaluate.apply(void 0,b),M=g.evaluate.apply(void 0,b);if(T!==void 0&&M!==void 0)return x(T,M,p,n.colorSpace)}}:x(m,g,p,n.colorSpace)}function jl(n,t,r){switch(t.type){case"color":r=Je.parse(r);break;case"formatted":r=si.fromString(r.toString());break;case"resolvedImage":r=gi.fromString(r.toString());break;case"padding":r=Rt.parse(r);break;case"colorArray":r=Ut.parse(r);break;case"numberArray":r=ai.parse(r);break;default:Qe(r)===t.type||t.type==="enum"&&t.values[r]||(r=void 0)}return Ps(r,n.default,t.default)}Oi.register(Dn,{error:[{kind:"error"},[He],(n,[t])=>{throw new vt(t.evaluate(n))}],typeof:[He,[Ye],(n,[t])=>xt(Ne(t.evaluate(n)))],"to-rgba":[Ci(Ie,4),[Ii],(n,[t])=>{const[r,s,l,d]=t.evaluate(n).rgb;return[255*r,255*s,255*l,d]}],rgb:[Ii,[Ie,Ie,Ie],Dl],rgba:[Ii,[Ie,Ie,Ie,Ie],Dl],has:{type:Xe,overloads:[[[He],(n,[t])=>Rl(t.evaluate(n),n.properties())],[[He,tr],(n,[t,r])=>Rl(t.evaluate(n),r.evaluate(n))]]},get:{type:Ye,overloads:[[[He],(n,[t])=>bo(t.evaluate(n),n.properties())],[[He,tr],(n,[t,r])=>bo(t.evaluate(n),r.evaluate(n))]]},"feature-state":[Ye,[He],(n,[t])=>bo(t.evaluate(n),n.featureState||{})],properties:[tr,[],n=>n.properties()],"geometry-type":[He,[],n=>n.geometryType()],id:[Ye,[],n=>n.id()],zoom:[Ie,[],n=>n.globals.zoom],"heatmap-density":[Ie,[],n=>n.globals.heatmapDensity||0],elevation:[Ie,[],n=>n.globals.elevation||0],"line-progress":[Ie,[],n=>n.globals.lineProgress||0],accumulated:[Ye,[],n=>n.globals.accumulated===void 0?null:n.globals.accumulated],"+":[Ie,cn(Ie),(n,t)=>{let r=0;for(const s of t)r+=s.evaluate(n);return r}],"*":[Ie,cn(Ie),(n,t)=>{let r=1;for(const s of t)r*=s.evaluate(n);return r}],"-":{type:Ie,overloads:[[[Ie,Ie],(n,[t,r])=>t.evaluate(n)-r.evaluate(n)],[[Ie],(n,[t])=>-t.evaluate(n)]]},"/":[Ie,[Ie,Ie],(n,[t,r])=>t.evaluate(n)/r.evaluate(n)],"%":[Ie,[Ie,Ie],(n,[t,r])=>t.evaluate(n)%r.evaluate(n)],ln2:[Ie,[],()=>Math.LN2],pi:[Ie,[],()=>Math.PI],e:[Ie,[],()=>Math.E],"^":[Ie,[Ie,Ie],(n,[t,r])=>Math.pow(t.evaluate(n),r.evaluate(n))],sqrt:[Ie,[Ie],(n,[t])=>Math.sqrt(t.evaluate(n))],log10:[Ie,[Ie],(n,[t])=>Math.log(t.evaluate(n))/Math.LN10],ln:[Ie,[Ie],(n,[t])=>Math.log(t.evaluate(n))],log2:[Ie,[Ie],(n,[t])=>Math.log(t.evaluate(n))/Math.LN2],sin:[Ie,[Ie],(n,[t])=>Math.sin(t.evaluate(n))],cos:[Ie,[Ie],(n,[t])=>Math.cos(t.evaluate(n))],tan:[Ie,[Ie],(n,[t])=>Math.tan(t.evaluate(n))],asin:[Ie,[Ie],(n,[t])=>Math.asin(t.evaluate(n))],acos:[Ie,[Ie],(n,[t])=>Math.acos(t.evaluate(n))],atan:[Ie,[Ie],(n,[t])=>Math.atan(t.evaluate(n))],min:[Ie,cn(Ie),(n,t)=>Math.min(...t.map(r=>r.evaluate(n)))],max:[Ie,cn(Ie),(n,t)=>Math.max(...t.map(r=>r.evaluate(n)))],abs:[Ie,[Ie],(n,[t])=>Math.abs(t.evaluate(n))],round:[Ie,[Ie],(n,[t])=>{const r=t.evaluate(n);return r<0?-Math.round(-r):Math.round(r)}],floor:[Ie,[Ie],(n,[t])=>Math.floor(t.evaluate(n))],ceil:[Ie,[Ie],(n,[t])=>Math.ceil(t.evaluate(n))],"filter-==":[Xe,[He,Ye],(n,[t,r])=>n.properties()[t.value]===r.value],"filter-id-==":[Xe,[Ye],(n,[t])=>n.id()===t.value],"filter-type-==":[Xe,[He],(n,[t])=>n.geometryType()===t.value],"filter-<":[Xe,[He,Ye],(n,[t,r])=>{const s=n.properties()[t.value],l=r.value;return typeof s==typeof l&&s<l}],"filter-id-<":[Xe,[Ye],(n,[t])=>{const r=n.id(),s=t.value;return typeof r==typeof s&&r<s}],"filter->":[Xe,[He,Ye],(n,[t,r])=>{const s=n.properties()[t.value],l=r.value;return typeof s==typeof l&&s>l}],"filter-id->":[Xe,[Ye],(n,[t])=>{const r=n.id(),s=t.value;return typeof r==typeof s&&r>s}],"filter-<=":[Xe,[He,Ye],(n,[t,r])=>{const s=n.properties()[t.value],l=r.value;return typeof s==typeof l&&s<=l}],"filter-id-<=":[Xe,[Ye],(n,[t])=>{const r=n.id(),s=t.value;return typeof r==typeof s&&r<=s}],"filter->=":[Xe,[He,Ye],(n,[t,r])=>{const s=n.properties()[t.value],l=r.value;return typeof s==typeof l&&s>=l}],"filter-id->=":[Xe,[Ye],(n,[t])=>{const r=n.id(),s=t.value;return typeof r==typeof s&&r>=s}],"filter-has":[Xe,[Ye],(n,[t])=>t.value in n.properties()],"filter-has-id":[Xe,[],n=>n.id()!==null&&n.id()!==void 0],"filter-type-in":[Xe,[Ci(He)],(n,[t])=>t.value.indexOf(n.geometryType())>=0],"filter-id-in":[Xe,[Ci(Ye)],(n,[t])=>t.value.indexOf(n.id())>=0],"filter-in-small":[Xe,[He,Ci(Ye)],(n,[t,r])=>r.value.indexOf(n.properties()[t.value])>=0],"filter-in-large":[Xe,[He,Ci(Ye)],(n,[t,r])=>function(s,l,d,p){for(;d<=p;){const m=d+p>>1;if(l[m]===s)return!0;l[m]>s?p=m-1:d=m+1}return!1}(n.properties()[t.value],r.value,0,r.value.length-1)],all:{type:Xe,overloads:[[[Xe,Xe],(n,[t,r])=>t.evaluate(n)&&r.evaluate(n)],[cn(Xe),(n,t)=>{for(const r of t)if(!r.evaluate(n))return!1;return!0}]]},any:{type:Xe,overloads:[[[Xe,Xe],(n,[t,r])=>t.evaluate(n)||r.evaluate(n)],[cn(Xe),(n,t)=>{for(const r of t)if(r.evaluate(n))return!0;return!1}]]},"!":[Xe,[Xe],(n,[t])=>!t.evaluate(n)],"is-supported-script":[Xe,[He],(n,[t])=>{const r=n.globals&&n.globals.isSupportedScript;return!r||r(t.evaluate(n))}],upcase:[He,[He],(n,[t])=>t.evaluate(n).toUpperCase()],downcase:[He,[He],(n,[t])=>t.evaluate(n).toLowerCase()],concat:[He,cn(Ye),(n,t)=>t.map(r=>sn(r.evaluate(n))).join("")],"resolved-locale":[He,[ur],(n,[t])=>t.evaluate(n).resolvedLocale()]});class xa{constructor(t,r){this.expression=t,this._warningHistory={},this._evaluator=new xl,this._defaultValue=r?function(s){if(s.type==="color"&&hn(s.default))return new Je(0,0,0,0);switch(s.type){case"color":return Je.parse(s.default)||null;case"padding":return Rt.parse(s.default)||null;case"numberArray":return ai.parse(s.default)||null;case"colorArray":return Ut.parse(s.default)||null;case"variableAnchorOffsetCollection":return rt.parse(s.default)||null;case"projectionDefinition":return Ze.parse(s.default)||null;default:return s.default===void 0?null:s.default}}(r):null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(t,r,s,l,d,p){return this._evaluator.globals=t,this._evaluator.feature=r,this._evaluator.featureState=s,this._evaluator.canonical=l,this._evaluator.availableImages=d||null,this._evaluator.formattedSection=p,this.expression.evaluate(this._evaluator)}evaluate(t,r,s,l,d,p){this._evaluator.globals=t,this._evaluator.feature=r||null,this._evaluator.featureState=s||null,this._evaluator.canonical=l,this._evaluator.availableImages=d||null,this._evaluator.formattedSection=p||null;try{const m=this.expression.evaluate(this._evaluator);if(m==null||typeof m=="number"&&m!=m)return this._defaultValue;if(this._enumValues&&!(m in this._enumValues))throw new vt(`Expected value to be one of ${Object.keys(this._enumValues).map(g=>JSON.stringify(g)).join(", ")}, but found ${JSON.stringify(m)} instead.`);return m}catch(m){return this._warningHistory[m.message]||(this._warningHistory[m.message]=!0,typeof console<"u"&&console.warn(m.message)),this._defaultValue}}}function va(n){return Array.isArray(n)&&n.length>0&&typeof n[0]=="string"&&n[0]in Dn}function ba(n,t){const r=new ps(Dn,ga,[],t?function(l){const d={color:Ii,string:He,number:Ie,enum:He,boolean:Xe,formatted:en,padding:zt,numberArray:ls,colorArray:os,projectionDefinition:ta,resolvedImage:dr,variableAnchorOffsetCollection:cs};return l.type==="array"?Ci(d[l.value]||Ye,l.length):d[l.type]}(t):void 0),s=r.parse(n,void 0,void 0,void 0,t&&t.type==="string"?{typeAnnotation:"coerce"}:void 0);return s?Ll(new xa(s,t)):Ln(r.errors)}class Ms{constructor(t,r){this.kind=t,this._styleExpression=r,this.isStateDependent=t!=="constant"&&!Ss(r.expression),this.globalStateRefs=On(r.expression)}evaluateWithoutErrorHandling(t,r,s,l,d,p){return this._styleExpression.evaluateWithoutErrorHandling(t,r,s,l,d,p)}evaluate(t,r,s,l,d,p){return this._styleExpression.evaluate(t,r,s,l,d,p)}}class wa{constructor(t,r,s,l){this.kind=t,this.zoomStops=s,this._styleExpression=r,this.isStateDependent=t!=="camera"&&!Ss(r.expression),this.globalStateRefs=On(r.expression),this.interpolationType=l}evaluateWithoutErrorHandling(t,r,s,l,d,p){return this._styleExpression.evaluateWithoutErrorHandling(t,r,s,l,d,p)}evaluate(t,r,s,l,d,p){return this._styleExpression.evaluate(t,r,s,l,d,p)}interpolationFactor(t,r,s){return this.interpolationType?ui.interpolationFactor(this.interpolationType,t,r,s):0}}function So(n,t){const r=ba(n,t);if(r.result==="error")return r;const s=r.value.expression,l=ya(s);if(!l&&!Bn(t))return Ln([new yt("","data expressions not supported")]);const d=Rn(s,["zoom"]);if(!d&&!wo(t))return Ln([new yt("","zoom expressions not supported")]);const p=Fn(s);return p||d?p instanceof yt?Ln([p]):p instanceof ui&&!To(t)?Ln([new yt("",'"interpolate" expressions cannot be used with this property')]):Ll(p?new wa(l?"camera":"composite",r.value,p.labels,p instanceof ui?p.interpolation:void 0):new Ms(l?"constant":"source",r.value)):Ln([new yt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Is{constructor(t,r){this._parameters=t,this._specification=r,Kt(this,Fl(this._parameters,this._specification))}static deserialize(t){return new Is(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function Fn(n){let t=null;if(n instanceof fs)t=Fn(n.result);else if(n instanceof xi){for(const r of n.args)if(t=Fn(r),t)break}else(n instanceof Cn||n instanceof ui)&&n.input instanceof Oi&&n.input.name==="zoom"&&(t=n);return t instanceof yt||n.eachChild(r=>{const s=Fn(r);s instanceof yt?t=s:!t&&s?t=new yt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&s&&t!==s&&(t=new yt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function On(n,t=new Set){return n instanceof Ts&&t.add(n.key),n.eachChild(r=>{On(r,t)}),t}function Cs(n){if(n===!0||n===!1)return!0;if(!Array.isArray(n)||n.length===0)return!1;switch(n[0]){case"has":return n.length>=2&&n[1]!=="$id"&&n[1]!=="$type";case"in":return n.length>=3&&(typeof n[1]!="string"||Array.isArray(n[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return n.length!==3||Array.isArray(n[1])||Array.isArray(n[2]);case"any":case"all":for(const t of n.slice(1))if(!Cs(t)&&typeof t!="boolean")return!1;return!0;default:return!0}}const Po={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Dr(n){if(n==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};Cs(n)||(n=Ta(n));const t=ba(n,Po);if(t.result==="error")throw new Error(t.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,s,l)=>t.value.evaluate(r,s,{},l),needGeometry:Vl(n),getGlobalStateRefs:()=>On(t.value.expression)}}function Uc(n,t){return n<t?-1:n>t?1:0}function Vl(n){if(!Array.isArray(n))return!1;if(n[0]==="within"||n[0]==="distance")return!0;for(let t=1;t<n.length;t++)if(Vl(n[t]))return!0;return!1}function Ta(n){if(!n)return!0;const t=n[0];return n.length<=1?t!=="any":t==="=="?Mo(n[1],n[2],"=="):t==="!="?As(Mo(n[1],n[2],"==")):t==="<"||t===">"||t==="<="||t===">="?Mo(n[1],n[2],t):t==="any"?(r=n.slice(1),["any"].concat(r.map(Ta))):t==="all"?["all"].concat(n.slice(1).map(Ta)):t==="none"?["all"].concat(n.slice(1).map(Ta).map(As)):t==="in"?Nl(n[1],n.slice(2)):t==="!in"?As(Nl(n[1],n.slice(2))):t==="has"?Ul(n[1]):t!=="!has"||As(Ul(n[1]));var r}function Mo(n,t,r){switch(n){case"$type":return[`filter-type-${r}`,t];case"$id":return[`filter-id-${r}`,t];default:return[`filter-${r}`,n,t]}}function Nl(n,t){if(t.length===0)return!1;switch(n){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(r=>typeof r!=typeof t[0])?["filter-in-large",n,["literal",t.sort(Uc)]]:["filter-in-small",n,["literal",t]]}}function Ul(n){switch(n){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",n]}}function As(n){return["!",n]}function Sa(n){const t=typeof n;if(t==="number"||t==="boolean"||t==="string"||n==null)return JSON.stringify(n);if(Array.isArray(n)){let l="[";for(const d of n)l+=`${Sa(d)},`;return`${l}]`}const r=Object.keys(n).sort();let s="{";for(let l=0;l<r.length;l++)s+=`${JSON.stringify(r[l])}:${Sa(n[r[l]])},`;return`${s}}`}function Pa(n){let t="";for(const r of Ce)t+=`/${Sa(n[r])}`;return t}function $l(n){const t=n.value;return t?[new Se(n.key,t,"constants have been deprecated as of v8")]:[]}function It(n){return n instanceof Number||n instanceof String||n instanceof Boolean?n.valueOf():n}function Rr(n){if(Array.isArray(n))return n.map(Rr);if(n instanceof Object&&!(n instanceof Number||n instanceof String||n instanceof Boolean)){const t={};for(const r in n)t[r]=Rr(n[r]);return t}return It(n)}function ji(n){const t=n.key,r=n.value,s=n.valueSpec||{},l=n.objectElementValidators||{},d=n.style,p=n.styleSpec,m=n.validateSpec;let g=[];const x=Qe(r);if(x!=="object")return[new Se(t,r,`object expected, ${x} found`)];for(const b in r){const T=b.split(".")[0],M=Ke(s,T)||s["*"];let A;if(Ke(l,T))A=l[T];else if(Ke(s,T))A=m;else if(l["*"])A=l["*"];else{if(!s["*"]){g.push(new Se(t,r[b],`unknown property "${b}"`));continue}A=m}g=g.concat(A({key:(t&&`${t}.`)+b,value:r[b],valueSpec:M,style:d,styleSpec:p,object:r,objectKey:b,validateSpec:m},r))}for(const b in s)l[b]||s[b].required&&s[b].default===void 0&&r[b]===void 0&&g.push(new Se(t,r,`missing required property "${b}"`));return g}function Ma(n){const t=n.value,r=n.valueSpec,s=n.style,l=n.styleSpec,d=n.key,p=n.arrayElementValidator||n.validateSpec;if(Qe(t)!=="array")return[new Se(d,t,`array expected, ${Qe(t)} found`)];if(r.length&&t.length!==r.length)return[new Se(d,t,`array length ${r.length} expected, length ${t.length} found`)];if(r["min-length"]&&t.length<r["min-length"])return[new Se(d,t,`array length at least ${r["min-length"]} expected, length ${t.length} found`)];let m={type:r.value,values:r.values};l.$version<7&&(m.function=r.function),Qe(r.value)==="object"&&(m=r.value);let g=[];for(let x=0;x<t.length;x++)g=g.concat(p({array:t,arrayIndex:x,value:t[x],valueSpec:m,validateSpec:n.validateSpec,style:s,styleSpec:l,key:`${d}[${x}]`}));return g}function Es(n){const t=n.key,r=n.value,s=n.valueSpec;let l=Qe(r);return l==="number"&&r!=r&&(l="NaN"),l!=="number"?[new Se(t,r,`number expected, ${l} found`)]:"minimum"in s&&r<s.minimum?[new Se(t,r,`${r} is less than the minimum value ${s.minimum}`)]:"maximum"in s&&r>s.maximum?[new Se(t,r,`${r} is greater than the maximum value ${s.maximum}`)]:[]}function jn(n){const t=n.valueSpec,r=It(n.value.type);let s,l,d,p={};const m=r!=="categorical"&&n.value.property===void 0,g=!m,x=Qe(n.value.stops)==="array"&&Qe(n.value.stops[0])==="array"&&Qe(n.value.stops[0][0])==="object",b=ji({key:n.key,value:n.value,valueSpec:n.styleSpec.function,validateSpec:n.validateSpec,style:n.style,styleSpec:n.styleSpec,objectElementValidators:{stops:function(A){if(r==="identity")return[new Se(A.key,A.value,'identity function may not have a "stops" property')];let E=[];const D=A.value;return E=E.concat(Ma({key:A.key,value:D,valueSpec:A.valueSpec,validateSpec:A.validateSpec,style:A.style,styleSpec:A.styleSpec,arrayElementValidator:T})),Qe(D)==="array"&&D.length===0&&E.push(new Se(A.key,D,"array must have at least one stop")),E},default:function(A){return A.validateSpec({key:A.key,value:A.value,valueSpec:t,validateSpec:A.validateSpec,style:A.style,styleSpec:A.styleSpec})}}});return r==="identity"&&m&&b.push(new Se(n.key,n.value,'missing required property "property"')),r==="identity"||n.value.stops||b.push(new Se(n.key,n.value,'missing required property "stops"')),r==="exponential"&&n.valueSpec.expression&&!To(n.valueSpec)&&b.push(new Se(n.key,n.value,"exponential functions not supported")),n.styleSpec.$version>=8&&(g&&!Bn(n.valueSpec)?b.push(new Se(n.key,n.value,"property functions not supported")):m&&!wo(n.valueSpec)&&b.push(new Se(n.key,n.value,"zoom functions not supported"))),r!=="categorical"&&!x||n.value.property!==void 0||b.push(new Se(n.key,n.value,'"property" property is required')),b;function T(A){let E=[];const D=A.value,F=A.key;if(Qe(D)!=="array")return[new Se(F,D,`array expected, ${Qe(D)} found`)];if(D.length!==2)return[new Se(F,D,`array length 2 expected, length ${D.length} found`)];if(x){if(Qe(D[0])!=="object")return[new Se(F,D,`object expected, ${Qe(D[0])} found`)];if(D[0].zoom===void 0)return[new Se(F,D,"object stop key must have zoom")];if(D[0].value===void 0)return[new Se(F,D,"object stop key must have value")];if(d&&d>It(D[0].zoom))return[new Se(F,D[0].zoom,"stop zoom values must appear in ascending order")];It(D[0].zoom)!==d&&(d=It(D[0].zoom),l=void 0,p={}),E=E.concat(ji({key:`${F}[0]`,value:D[0],valueSpec:{zoom:{}},validateSpec:A.validateSpec,style:A.style,styleSpec:A.styleSpec,objectElementValidators:{zoom:Es,value:M}}))}else E=E.concat(M({key:`${F}[0]`,value:D[0],validateSpec:A.validateSpec,style:A.style,styleSpec:A.styleSpec},D));return va(Rr(D[1]))?E.concat([new Se(`${F}[1]`,D[1],"expressions are not allowed in function stops.")]):E.concat(A.validateSpec({key:`${F}[1]`,value:D[1],valueSpec:t,validateSpec:A.validateSpec,style:A.style,styleSpec:A.styleSpec}))}function M(A,E){const D=Qe(A.value),F=It(A.value),U=A.value!==null?A.value:E;if(s){if(D!==s)return[new Se(A.key,U,`${D} stop domain type must match previous stop domain type ${s}`)]}else s=D;if(D!=="number"&&D!=="string"&&D!=="boolean")return[new Se(A.key,U,"stop domain value must be a number, string, or boolean")];if(D!=="number"&&r!=="categorical"){let ee=`number expected, ${D} found`;return Bn(t)&&r===void 0&&(ee+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Se(A.key,U,ee)]}return r!=="categorical"||D!=="number"||isFinite(F)&&Math.floor(F)===F?r!=="categorical"&&D==="number"&&l!==void 0&&F<l?[new Se(A.key,U,"stop domain values must appear in ascending order")]:(l=F,r==="categorical"&&F in p?[new Se(A.key,U,"stop domain values must be unique")]:(p[F]=!0,[])):[new Se(A.key,U,`integer expected, found ${F}`)]}}function Vn(n){const t=(n.expressionContext==="property"?So:ba)(Rr(n.value),n.valueSpec);if(t.result==="error")return t.value.map(s=>new Se(`${n.key}${s.key}`,n.value,s.message));const r=t.value.expression||t.value._styleExpression.expression;if(n.expressionContext==="property"&&n.propertyKey==="text-font"&&!r.outputDefined())return[new Se(n.key,n.value,`Invalid data expression for "${n.propertyKey}". Output values must be contained as literals within the expression.`)];if(n.expressionContext==="property"&&n.propertyType==="layout"&&!Ss(r))return[new Se(n.key,n.value,'"feature-state" data expressions are not supported with layout properties.')];if(n.expressionContext==="filter"&&!Ss(r))return[new Se(n.key,n.value,'"feature-state" data expressions are not supported with filters.')];if(n.expressionContext&&n.expressionContext.indexOf("cluster")===0){if(!Rn(r,["zoom","feature-state"]))return[new Se(n.key,n.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(n.expressionContext==="cluster-initial"&&!ya(r))return[new Se(n.key,n.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Io(n){const t=n.key,r=n.value,s=Qe(r);return s!=="string"?[new Se(t,r,`color expected, ${s} found`)]:Je.parse(String(r))?[]:[new Se(t,r,`color expected, "${r}" found`)]}function zs(n){const t=n.key,r=n.value,s=n.valueSpec,l=[];return Array.isArray(s.values)?s.values.indexOf(It(r))===-1&&l.push(new Se(t,r,`expected one of [${s.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(s.values).indexOf(It(r))===-1&&l.push(new Se(t,r,`expected one of [${Object.keys(s.values).join(", ")}], ${JSON.stringify(r)} found`)),l}function Co(n){return Cs(Rr(n.value))?Vn(Kt({},n,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Zl(n)}function Zl(n){const t=n.value,r=n.key;if(Qe(t)!=="array")return[new Se(r,t,`array expected, ${Qe(t)} found`)];const s=n.styleSpec;let l,d=[];if(t.length<1)return[new Se(r,t,"filter array must have at least 1 element")];switch(d=d.concat(zs({key:`${r}[0]`,value:t[0],valueSpec:s.filter_operator,style:n.style,styleSpec:n.styleSpec})),It(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&It(t[1])==="$type"&&d.push(new Se(r,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&d.push(new Se(r,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(l=Qe(t[1]),l!=="string"&&d.push(new Se(`${r}[1]`,t[1],`string expected, ${l} found`)));for(let p=2;p<t.length;p++)l=Qe(t[p]),It(t[1])==="$type"?d=d.concat(zs({key:`${r}[${p}]`,value:t[p],valueSpec:s.geometry_type,style:n.style,styleSpec:n.styleSpec})):l!=="string"&&l!=="number"&&l!=="boolean"&&d.push(new Se(`${r}[${p}]`,t[p],`string, number, or boolean expected, ${l} found`));break;case"any":case"all":case"none":for(let p=1;p<t.length;p++)d=d.concat(Zl({key:`${r}[${p}]`,value:t[p],style:n.style,styleSpec:n.styleSpec}));break;case"has":case"!has":l=Qe(t[1]),t.length!==2?d.push(new Se(r,t,`filter array for "${t[0]}" operator must have 2 elements`)):l!=="string"&&d.push(new Se(`${r}[1]`,t[1],`string expected, ${l} found`))}return d}function Gl(n,t){const r=n.key,s=n.validateSpec,l=n.style,d=n.styleSpec,p=n.value,m=n.objectKey,g=d[`${t}_${n.layerType}`];if(!g)return[];const x=m.match(/^(.*)-transition$/);if(t==="paint"&&x&&g[x[1]]&&g[x[1]].transition)return s({key:r,value:p,valueSpec:d.transition,style:l,styleSpec:d});const b=n.valueSpec||g[m];if(!b)return[new Se(r,p,`unknown property "${m}"`)];let T;if(Qe(p)==="string"&&Bn(b)&&!b.tokens&&(T=/^{([^}]+)}$/.exec(p)))return[new Se(r,p,`"${m}" does not support interpolation syntax
|
|
5
|
-
Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(T[1])} }\`.`)];const M=[];return n.layerType==="symbol"&&(m==="text-field"&&l&&!l.glyphs&&M.push(new Se(r,p,'use of "text-field" requires a style "glyphs" property')),m==="text-font"&&hn(Rr(p))&&It(p.type)==="identity"&&M.push(new Se(r,p,'"text-font" does not support identity functions'))),M.concat(s({key:n.key,value:p,valueSpec:b,style:l,styleSpec:d,expressionContext:"property",propertyType:t,propertyKey:m}))}function Nn(n){return Gl(n,"paint")}function Un(n){return Gl(n,"layout")}function vi(n){let t=[];const r=n.value,s=n.key,l=n.style,d=n.styleSpec;if(Qe(r)!=="object")return[new Se(s,r,`object expected, ${Qe(r)} found`)];r.type||r.ref||t.push(new Se(s,r,'either "type" or "ref" is required'));let p=It(r.type);const m=It(r.ref);if(r.id){const g=It(r.id);for(let x=0;x<n.arrayIndex;x++){const b=l.layers[x];It(b.id)===g&&t.push(new Se(s,r.id,`duplicate layer id "${r.id}", previously used at line ${b.id.__line__}`))}}if("ref"in r){let g;["type","source","source-layer","filter","layout"].forEach(x=>{x in r&&t.push(new Se(s,r[x],`"${x}" is prohibited for ref layers`))}),l.layers.forEach(x=>{It(x.id)===m&&(g=x)}),g?g.ref?t.push(new Se(s,r.ref,"ref cannot reference another ref layer")):p=It(g.type):t.push(new Se(s,r.ref,`ref layer "${m}" not found`))}else if(p!=="background")if(r.source){const g=l.sources&&l.sources[r.source],x=g&&It(g.type);g?x==="vector"&&p==="raster"?t.push(new Se(s,r.source,`layer "${r.id}" requires a raster source`)):x!=="raster-dem"&&p==="hillshade"||x!=="raster-dem"&&p==="color-relief"?t.push(new Se(s,r.source,`layer "${r.id}" requires a raster-dem source`)):x==="raster"&&p!=="raster"?t.push(new Se(s,r.source,`layer "${r.id}" requires a vector source`)):x!=="vector"||r["source-layer"]?x==="raster-dem"&&p!=="hillshade"&&p!=="color-relief"?t.push(new Se(s,r.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):p!=="line"||!r.paint||!r.paint["line-gradient"]||x==="geojson"&&g.lineMetrics||t.push(new Se(s,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new Se(s,r,`layer "${r.id}" must specify a "source-layer"`)):t.push(new Se(s,r.source,`source "${r.source}" not found`))}else t.push(new Se(s,r,'missing required property "source"'));return t=t.concat(ji({key:s,value:r,valueSpec:d.layer,style:n.style,styleSpec:n.styleSpec,validateSpec:n.validateSpec,objectElementValidators:{"*":()=>[],type:()=>n.validateSpec({key:`${s}.type`,value:r.type,valueSpec:d.layer.type,style:n.style,styleSpec:n.styleSpec,validateSpec:n.validateSpec,object:r,objectKey:"type"}),filter:Co,layout:g=>ji({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":x=>Un(Kt({layerType:p},x))}}),paint:g=>ji({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":x=>Nn(Kt({layerType:p},x))}})}})),t}function Zi(n){const t=n.value,r=n.key,s=Qe(t);return s!=="string"?[new Se(r,t,`string expected, ${s} found`)]:[]}const Ao={promoteId:function({key:n,value:t}){if(Qe(t)==="string")return Zi({key:n,value:t});{const r=[];for(const s in t)r.push(...Zi({key:`${n}.${s}`,value:t[s]}));return r}}};function ql(n){const t=n.value,r=n.key,s=n.styleSpec,l=n.style,d=n.validateSpec;if(!t.type)return[new Se(r,t,'"type" is required')];const p=It(t.type);let m;switch(p){case"vector":case"raster":return m=ji({key:r,value:t,valueSpec:s[`source_${p.replace("-","_")}`],style:n.style,styleSpec:s,objectElementValidators:Ao,validateSpec:d}),m;case"raster-dem":return m=function(g){var x;const b=(x=g.sourceName)!==null&&x!==void 0?x:"",T=g.value,M=g.styleSpec,A=M.source_raster_dem,E=g.style;let D=[];const F=Qe(T);if(T===void 0)return D;if(F!=="object")return D.push(new Se("source_raster_dem",T,`object expected, ${F} found`)),D;const U=It(T.encoding)==="custom",ee=["redFactor","greenFactor","blueFactor","baseShift"],W=g.value.encoding?`"${g.value.encoding}"`:"Default";for(const C in T)!U&&ee.includes(C)?D.push(new Se(C,T[C],`In "${b}": "${C}" is only valid when "encoding" is set to "custom". ${W} encoding found`)):A[C]?D=D.concat(g.validateSpec({key:C,value:T[C],valueSpec:A[C],validateSpec:g.validateSpec,style:E,styleSpec:M})):D.push(new Se(C,T[C],`unknown property "${C}"`));return D}({sourceName:r,value:t,style:n.style,styleSpec:s,validateSpec:d}),m;case"geojson":if(m=ji({key:r,value:t,valueSpec:s.source_geojson,style:l,styleSpec:s,validateSpec:d,objectElementValidators:Ao}),t.cluster)for(const g in t.clusterProperties){const[x,b]=t.clusterProperties[g],T=typeof x=="string"?[x,["accumulated"],["get",g]]:x;m.push(...Vn({key:`${r}.${g}.map`,value:b,expressionContext:"cluster-map"})),m.push(...Vn({key:`${r}.${g}.reduce`,value:T,expressionContext:"cluster-reduce"}))}return m;case"video":return ji({key:r,value:t,valueSpec:s.source_video,style:l,validateSpec:d,styleSpec:s});case"image":return ji({key:r,value:t,valueSpec:s.source_image,style:l,validateSpec:d,styleSpec:s});case"canvas":return[new Se(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return zs({key:`${r}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function Wl(n){const t=n.value,r=n.styleSpec,s=r.light,l=n.style;let d=[];const p=Qe(t);if(t===void 0)return d;if(p!=="object")return d=d.concat([new Se("light",t,`object expected, ${p} found`)]),d;for(const m in t){const g=m.match(/^(.*)-transition$/);d=d.concat(g&&s[g[1]]&&s[g[1]].transition?n.validateSpec({key:m,value:t[m],valueSpec:r.transition,validateSpec:n.validateSpec,style:l,styleSpec:r}):s[m]?n.validateSpec({key:m,value:t[m],valueSpec:s[m],validateSpec:n.validateSpec,style:l,styleSpec:r}):[new Se(m,t[m],`unknown property "${m}"`)])}return d}function $n(n){const t=n.value,r=n.styleSpec,s=r.sky,l=n.style,d=Qe(t);if(t===void 0)return[];if(d!=="object")return[new Se("sky",t,`object expected, ${d} found`)];let p=[];for(const m in t)p=p.concat(s[m]?n.validateSpec({key:m,value:t[m],valueSpec:s[m],style:l,styleSpec:r}):[new Se(m,t[m],`unknown property "${m}"`)]);return p}function Eo(n){const t=n.value,r=n.styleSpec,s=r.terrain,l=n.style;let d=[];const p=Qe(t);if(t===void 0)return d;if(p!=="object")return d=d.concat([new Se("terrain",t,`object expected, ${p} found`)]),d;for(const m in t)d=d.concat(s[m]?n.validateSpec({key:m,value:t[m],valueSpec:s[m],validateSpec:n.validateSpec,style:l,styleSpec:r}):[new Se(m,t[m],`unknown property "${m}"`)]);return d}function Ia(n){let t=[];const r=n.value,s=n.key;if(Array.isArray(r)){const l=[],d=[];for(const p in r)r[p].id&&l.includes(r[p].id)&&t.push(new Se(s,r,`all the sprites' ids must be unique, but ${r[p].id} is duplicated`)),l.push(r[p].id),r[p].url&&d.includes(r[p].url)&&t.push(new Se(s,r,`all the sprites' URLs must be unique, but ${r[p].url} is duplicated`)),d.push(r[p].url),t=t.concat(ji({key:`${s}[${p}]`,value:r[p],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:n.validateSpec}));return t}return Zi({key:s,value:r})}function Hl(n){return t=n.value,t&&t.constructor===Object?[]:[new Se(n.key,n.value,`object expected, ${Qe(n.value)} found`)];var t}const Ca={"*":()=>[],array:Ma,boolean:function(n){const t=n.value,r=n.key,s=Qe(t);return s!=="boolean"?[new Se(r,t,`boolean expected, ${s} found`)]:[]},number:Es,color:Io,constants:$l,enum:zs,filter:Co,function:jn,layer:vi,object:ji,source:ql,light:Wl,sky:$n,terrain:Eo,projection:function(n){const t=n.value,r=n.styleSpec,s=r.projection,l=n.style,d=Qe(t);if(t===void 0)return[];if(d!=="object")return[new Se("projection",t,`object expected, ${d} found`)];let p=[];for(const m in t)p=p.concat(s[m]?n.validateSpec({key:m,value:t[m],valueSpec:s[m],style:l,styleSpec:r}):[new Se(m,t[m],`unknown property "${m}"`)]);return p},projectionDefinition:function(n){const t=n.key;let r=n.value;r=r instanceof String?r.valueOf():r;const s=Qe(r);return s!=="array"||function(l){return Array.isArray(l)&&l.length===3&&typeof l[0]=="string"&&typeof l[1]=="string"&&typeof l[2]=="number"}(r)||function(l){return!!["interpolate","step","literal"].includes(l[0])}(r)?["array","string"].includes(s)?[]:[new Se(t,r,`projection expected, invalid type "${s}" found`)]:[new Se(t,r,`projection expected, invalid array ${JSON.stringify(r)} found`)]},string:Zi,formatted:function(n){return Zi(n).length===0?[]:Vn(n)},resolvedImage:function(n){return Zi(n).length===0?[]:Vn(n)},padding:function(n){const t=n.key,r=n.value;if(Qe(r)==="array"){if(r.length<1||r.length>4)return[new Se(t,r,`padding requires 1 to 4 values; ${r.length} values found`)];const s={type:"number"};let l=[];for(let d=0;d<r.length;d++)l=l.concat(n.validateSpec({key:`${t}[${d}]`,value:r[d],validateSpec:n.validateSpec,valueSpec:s}));return l}return Es({key:t,value:r,valueSpec:{}})},numberArray:function(n){const t=n.key,r=n.value;if(Qe(r)==="array"){const s={type:"number"};if(r.length<1)return[new Se(t,r,"array length at least 1 expected, length 0 found")];let l=[];for(let d=0;d<r.length;d++)l=l.concat(n.validateSpec({key:`${t}[${d}]`,value:r[d],validateSpec:n.validateSpec,valueSpec:s}));return l}return Es({key:t,value:r,valueSpec:{}})},colorArray:function(n){const t=n.key,r=n.value;if(Qe(r)==="array"){if(r.length<1)return[new Se(t,r,"array length at least 1 expected, length 0 found")];let s=[];for(let l=0;l<r.length;l++)s=s.concat(Io({key:`${t}[${l}]`,value:r[l]}));return s}return Io({key:t,value:r})},variableAnchorOffsetCollection:function(n){const t=n.key,r=n.value,s=Qe(r),l=n.styleSpec;if(s!=="array"||r.length<1||r.length%2!=0)return[new Se(t,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let d=[];for(let p=0;p<r.length;p+=2)d=d.concat(zs({key:`${t}[${p}]`,value:r[p],valueSpec:l.layout_symbol["text-anchor"]})),d=d.concat(Ma({key:`${t}[${p+1}]`,value:r[p+1],valueSpec:{length:2,value:"number"},validateSpec:n.validateSpec,style:n.style,styleSpec:l}));return d},sprite:Ia,state:Hl};function Aa(n){const t=n.value,r=n.valueSpec,s=n.styleSpec;return n.validateSpec=Aa,r.expression&&hn(It(t))?jn(n):r.expression&&va(Rr(t))?Vn(n):r.type&&Ca[r.type]?Ca[r.type](n):ji(Kt({},n,{valueSpec:r.type?s[r.type]:r}))}function Zn(n){const t=n.value,r=n.key,s=Zi(n);return s.length||(t.indexOf("{fontstack}")===-1&&s.push(new Se(r,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&&s.push(new Se(r,t,'"glyphs" url must include a "{range}" token'))),s}function Vi(n,t=J){let r=[];return r=r.concat(Aa({key:"",value:n,valueSpec:t.$root,styleSpec:t,style:n,validateSpec:Aa,objectElementValidators:{glyphs:Zn,"*":()=>[]}})),n.constants&&(r=r.concat($l({key:"constants",value:n.constants}))),Xl(r)}function Gi(n){return function(t){return n({...t,validateSpec:Aa})}}function Xl(n){return[].concat(n).sort((t,r)=>t.line-r.line)}function di(n){return function(...t){return Xl(n.apply(this,t))}}Vi.source=di(Gi(ql)),Vi.sprite=di(Gi(Ia)),Vi.glyphs=di(Gi(Zn)),Vi.light=di(Gi(Wl)),Vi.sky=di(Gi($n)),Vi.terrain=di(Gi(Eo)),Vi.state=di(Gi(Hl)),Vi.layer=di(Gi(vi)),Vi.filter=di(Gi(Co)),Vi.paintProperty=di(Gi(Nn)),Vi.layoutProperty=di(Gi(Un));const Gn=Vi,$c=Gn.light,Ea=Gn.sky,Zc=Gn.paintProperty,zo=Gn.layoutProperty;function ks(n,t){let r=!1;if(t&&t.length)for(const s of t)n.fire(new se(new Error(s.message))),r=!0;return r}class qn{constructor(t,r,s){const l=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const p=new Int32Array(this.arrayBuffer);t=p[0],this.d=(r=p[1])+2*(s=p[2]);for(let g=0;g<this.d*this.d;g++){const x=p[3+g],b=p[3+g+1];l.push(x===b?null:p.subarray(x,b))}const m=p[3+l.length+1];this.keys=p.subarray(p[3+l.length],m),this.bboxes=p.subarray(m),this.insert=this._insertReadonly}else{this.d=r+2*s;for(let p=0;p<this.d*this.d;p++)l.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=t,this.padding=s,this.scale=r/t,this.uid=0;const d=s/r*t;this.min=-d,this.max=t+d}insert(t,r,s,l,d){this._forEachCell(r,s,l,d,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(r),this.bboxes.push(s),this.bboxes.push(l),this.bboxes.push(d)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,r,s,l,d,p){this.cells[d].push(p)}query(t,r,s,l,d){const p=this.min,m=this.max;if(t<=p&&r<=p&&m<=s&&m<=l&&!d)return Array.prototype.slice.call(this.keys);{const g=[];return this._forEachCell(t,r,s,l,this._queryCell,g,{},d),g}}_queryCell(t,r,s,l,d,p,m,g){const x=this.cells[d];if(x!==null){const b=this.keys,T=this.bboxes;for(let M=0;M<x.length;M++){const A=x[M];if(m[A]===void 0){const E=4*A;(g?g(T[E+0],T[E+1],T[E+2],T[E+3]):t<=T[E+2]&&r<=T[E+3]&&s>=T[E+0]&&l>=T[E+1])?(m[A]=!0,p.push(b[A])):m[A]=!1}}}}_forEachCell(t,r,s,l,d,p,m,g){const x=this._convertToCellCoord(t),b=this._convertToCellCoord(r),T=this._convertToCellCoord(s),M=this._convertToCellCoord(l);for(let A=x;A<=T;A++)for(let E=b;E<=M;E++){const D=this.d*E+A;if((!g||g(this._convertFromCellCoord(A),this._convertFromCellCoord(E),this._convertFromCellCoord(A+1),this._convertFromCellCoord(E+1)))&&d.call(this,t,r,s,l,D,p,m,g))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const t=this.cells,r=3+this.cells.length+1+1;let s=0;for(let p=0;p<this.cells.length;p++)s+=this.cells[p].length;const l=new Int32Array(r+s+this.keys.length+this.bboxes.length);l[0]=this.extent,l[1]=this.n,l[2]=this.padding;let d=r;for(let p=0;p<t.length;p++){const m=t[p];l[3+p]=d,l.set(m,d),d+=m.length}return l[3+t.length]=d,l.set(this.keys,d),d+=this.keys.length,l[3+t.length+1]=d,l.set(this.bboxes,d),d+=this.bboxes.length,l.buffer}static serialize(t,r){const s=t.toArrayBuffer();return r&&r.push(s),{buffer:s}}static deserialize(t){return new qn(t.buffer)}}const sr={};function Ae(n,t,r={}){if(sr[n])throw new Error(`${n} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:n,writeable:!1}),sr[n]={klass:t,omit:r.omit||[],shallow:r.shallow||[]}}Ae("Object",Object),Ae("Set",Set),Ae("TransferableGridIndex",qn),Ae("Color",Je),Ae("Error",Error),Ae("AJAXError",H),Ae("ResolvedImage",gi),Ae("StylePropertyFunction",Is),Ae("StyleExpression",xa,{omit:["_evaluator"]}),Ae("ZoomDependentExpression",wa),Ae("ZoomConstantExpression",Ms),Ae("CompoundExpression",Oi,{omit:["_evaluate"]});for(const n in Dn)Dn[n]._classRegistryKey||Ae(`Expression_${n}`,Dn[n]);function ko(n){return n&&typeof ArrayBuffer<"u"&&(n instanceof ArrayBuffer||n.constructor&&n.constructor.name==="ArrayBuffer")}function Ds(n){return n.$name||n.constructor._classRegistryKey}function Do(n){return!function(t){if(t===null||typeof t!="object")return!1;const r=Ds(t);return!(!r||r==="Object")}(n)&&(n==null||typeof n=="boolean"||typeof n=="number"||typeof n=="string"||n instanceof Boolean||n instanceof Number||n instanceof String||n instanceof Date||n instanceof RegExp||n instanceof Blob||n instanceof Error||ko(n)||Ar(n)||ArrayBuffer.isView(n)||n instanceof ImageData)}function Rs(n,t){if(Do(n))return(ko(n)||Ar(n))&&t&&t.push(n),ArrayBuffer.isView(n)&&t&&t.push(n.buffer),n instanceof ImageData&&t&&t.push(n.data.buffer),n;if(Array.isArray(n)){const d=[];for(const p of n)d.push(Rs(p,t));return d}if(typeof n!="object")throw new Error("can't serialize object of type "+typeof n);const r=Ds(n);if(!r)throw new Error(`can't serialize object of unregistered class ${n.constructor.name}`);if(!sr[r])throw new Error(`${r} is not registered.`);const{klass:s}=sr[r],l=s.serialize?s.serialize(n,t):{};if(s.serialize){if(t&&l===t[t.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const d in n){if(!n.hasOwnProperty(d)||sr[r].omit.indexOf(d)>=0)continue;const p=n[d];l[d]=sr[r].shallow.indexOf(d)>=0?p:Rs(p,t)}n instanceof Error&&(l.message=n.message)}if(l.$name)throw new Error("$name property is reserved for worker serialization logic.");return r!=="Object"&&(l.$name=r),l}function Wn(n){if(Do(n))return n;if(Array.isArray(n))return n.map(Wn);if(typeof n!="object")throw new Error("can't deserialize object of type "+typeof n);const t=Ds(n)||"Object";if(!sr[t])throw new Error(`can't deserialize unregistered class ${t}`);const{klass:r}=sr[t];if(!r)throw new Error(`can't deserialize unregistered class ${t}`);if(r.deserialize)return r.deserialize(n);const s=Object.create(r.prototype);for(const l of Object.keys(n)){if(l==="$name")continue;const d=n[l];s[l]=sr[t].shallow.indexOf(l)>=0?d:Wn(d)}return s}class Ro{constructor(){this.first=!0}update(t,r){const s=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=s,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=s,!0):(this.lastFloorZoom>s?(this.lastIntegerZoom=s+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<s&&(this.lastIntegerZoom=s,this.lastIntegerZoomTime=r),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=s,!0))}}const et={"Latin-1 Supplement":n=>n>=128&&n<=255,"Hangul Jamo":n=>n>=4352&&n<=4607,Khmer:n=>n>=6016&&n<=6143,"General Punctuation":n=>n>=8192&&n<=8303,"Letterlike Symbols":n=>n>=8448&&n<=8527,"Number Forms":n=>n>=8528&&n<=8591,"Miscellaneous Technical":n=>n>=8960&&n<=9215,"Control Pictures":n=>n>=9216&&n<=9279,"Optical Character Recognition":n=>n>=9280&&n<=9311,"Enclosed Alphanumerics":n=>n>=9312&&n<=9471,"Geometric Shapes":n=>n>=9632&&n<=9727,"Miscellaneous Symbols":n=>n>=9728&&n<=9983,"Miscellaneous Symbols and Arrows":n=>n>=11008&&n<=11263,"Ideographic Description Characters":n=>n>=12272&&n<=12287,"CJK Symbols and Punctuation":n=>n>=12288&&n<=12351,Hiragana:n=>n>=12352&&n<=12447,Katakana:n=>n>=12448&&n<=12543,Kanbun:n=>n>=12688&&n<=12703,"CJK Strokes":n=>n>=12736&&n<=12783,"Enclosed CJK Letters and Months":n=>n>=12800&&n<=13055,"CJK Compatibility":n=>n>=13056&&n<=13311,"Yijing Hexagram Symbols":n=>n>=19904&&n<=19967,"CJK Unified Ideographs":n=>n>=19968&&n<=40959,"Hangul Syllables":n=>n>=44032&&n<=55215,"Private Use Area":n=>n>=57344&&n<=63743,"Vertical Forms":n=>n>=65040&&n<=65055,"CJK Compatibility Forms":n=>n>=65072&&n<=65103,"Small Form Variants":n=>n>=65104&&n<=65135,"Halfwidth and Fullwidth Forms":n=>n>=65280&&n<=65519};function Lo(n){for(const t of n)if(ka(t.charCodeAt(0)))return!0;return!1}function Yl(n){for(const t of n)if(!qc(t.charCodeAt(0)))return!1;return!0}function za(n){const t=n.map(r=>{try{return new RegExp(`\\p{sc=${r}}`,"u").source}catch{return null}}).filter(r=>r);return new RegExp(t.join("|"),"u")}const Gc=za(["Arab","Dupl","Mong","Ougr","Syrc"]);function qc(n){return!Gc.test(String.fromCodePoint(n))}const Bo=za(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function ka(n){return!(n!==746&&n!==747&&(n<4352||!(et["CJK Compatibility Forms"](n)&&!(n>=65097&&n<=65103)||et["CJK Compatibility"](n)||et["CJK Strokes"](n)||!(!et["CJK Symbols and Punctuation"](n)||n>=12296&&n<=12305||n>=12308&&n<=12319||n===12336)||et["Enclosed CJK Letters and Months"](n)||et["Ideographic Description Characters"](n)||et.Kanbun(n)||et.Katakana(n)&&n!==12540||!(!et["Halfwidth and Fullwidth Forms"](n)||n===65288||n===65289||n===65293||n>=65306&&n<=65310||n===65339||n===65341||n===65343||n>=65371&&n<=65503||n===65507||n>=65512&&n<=65519)||!(!et["Small Form Variants"](n)||n>=65112&&n<=65118||n>=65123&&n<=65126)||et["Vertical Forms"](n)||et["Yijing Hexagram Symbols"](n)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(n))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(n))||Bo.test(String.fromCodePoint(n)))))}function Fo(n){return!(ka(n)||function(t){return!!(et["Latin-1 Supplement"](t)&&(t===167||t===169||t===174||t===177||t===188||t===189||t===190||t===215||t===247)||et["General Punctuation"](t)&&(t===8214||t===8224||t===8225||t===8240||t===8241||t===8251||t===8252||t===8258||t===8263||t===8264||t===8265||t===8273)||et["Letterlike Symbols"](t)||et["Number Forms"](t)||et["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||t===9003||t>=9085&&t<=9114||t>=9150&&t<=9165||t===9167||t>=9169&&t<=9179||t>=9186&&t<=9215)||et["Control Pictures"](t)&&t!==9251||et["Optical Character Recognition"](t)||et["Enclosed Alphanumerics"](t)||et["Geometric Shapes"](t)||et["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||et["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||et["CJK Symbols and Punctuation"](t)||et.Katakana(t)||et["Private Use Area"](t)||et["CJK Compatibility Forms"](t)||et["Small Form Variants"](t)||et["Halfwidth and Fullwidth Forms"](t)||t===8734||t===8756||t===8757||t>=9984&&t<=10087||t>=10102&&t<=10131||t===65532||t===65533)}(n))}const Kl=za(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function Ls(n){return Kl.test(String.fromCodePoint(n))}function Wc(n,t){return!(!t&&Ls(n)||n>=2304&&n<=3583||n>=3840&&n<=4255||et.Khmer(n))}function Oo(n){for(const t of n)if(Ls(t.charCodeAt(0)))return!0;return!1}const Lr=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(n){this.pluginStatus=n.pluginStatus,this.pluginURL=n.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(n){if(Lr.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=n.applyArabicShaping,this.processBidirectionalText=n.processBidirectionalText,this.processStyledBidirectionalText=n.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}syncState(n,t){return c(this,void 0,void 0,function*(){if(this.isParsed())return this.getState();if(n.pluginStatus!=="loading")return this.setState(n),n;const r=n.pluginURL,s=new Promise(d=>{this.loadScriptResolve=d});t(r);const l=new Promise(d=>setTimeout(()=>d(),this.TIMEOUT));if(yield Promise.race([s,l]),this.isParsed()){const d={pluginStatus:"loaded",pluginURL:r};return this.setState(d),d}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${r}`)})}};class gt{constructor(t,r){this.zoom=t,r?(this.now=r.now||0,this.fadeDuration=r.fadeDuration||0,this.zoomHistory=r.zoomHistory||new Ro,this.transition=r.transition||{},this.globalState=r.globalState||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Ro,this.transition={},this.globalState={})}isSupportedScript(t){return function(r,s){for(const l of r)if(!Wc(l.charCodeAt(0),s))return!1;return!0}(t,Lr.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,r=t-Math.floor(t),s=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*s}:{fromScale:.5,toScale:1,t:1-(1-s)*r}}}class Bs{constructor(t,r){this.property=t,this.value=r,this.expression=function(s,l){if(hn(s))return new Is(s,l);if(va(s)){const d=So(s,l);if(d.result==="error")throw new Error(d.value.map(p=>`${p.key}: ${p.message}`).join(", "));return d.value}{let d=s;return l.type==="color"&&typeof s=="string"?d=Je.parse(s):l.type!=="padding"||typeof s!="number"&&!Array.isArray(s)?l.type!=="numberArray"||typeof s!="number"&&!Array.isArray(s)?l.type!=="colorArray"||typeof s!="string"&&!Array.isArray(s)?l.type==="variableAnchorOffsetCollection"&&Array.isArray(s)?d=rt.parse(s):l.type==="projectionDefinition"&&typeof s=="string"&&(d=Ze.parse(s)):d=Ut.parse(s):d=ai.parse(s):d=Rt.parse(s),{globalStateRefs:new Set,kind:"constant",evaluate:()=>d}}}(r===void 0?t.specification.default:r,t.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(t,r,s){return this.property.possiblyEvaluate(this,t,r,s)}}class Da{constructor(t){this.property=t,this.value=new Bs(t,void 0)}transitioned(t,r){return new Jl(this.property,this.value,r,Si({},t.transition,this.transition),t.now)}untransitioned(){return new Jl(this.property,this.value,null,{},0)}}class jo{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return Bi(this._values[t].value.value)}setValue(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Da(this._values[t].property)),this._values[t].value=new Bs(this._values[t].property,r===null?void 0:Bi(r))}getTransition(t){return Bi(this._values[t].transition)}setTransition(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Da(this._values[t].property)),this._values[t].transition=Bi(r)||void 0}serialize(){const t={};for(const r of Object.keys(this._values)){const s=this.getValue(r);s!==void 0&&(t[r]=s);const l=this.getTransition(r);l!==void 0&&(t[`${r}-transition`]=l)}return t}transitioned(t,r){const s=new Ql(this._properties);for(const l of Object.keys(this._values))s._values[l]=this._values[l].transitioned(t,r._values[l]);return s}untransitioned(){const t=new Ql(this._properties);for(const r of Object.keys(this._values))t._values[r]=this._values[r].untransitioned();return t}}class Jl{constructor(t,r,s,l,d){this.property=t,this.value=r,this.begin=d+l.delay||0,this.end=this.begin+l.duration||0,t.specification.transition&&(l.delay||l.duration)&&(this.prior=s)}possiblyEvaluate(t,r,s){const l=t.now||0,d=this.value.possiblyEvaluate(t,r,s),p=this.prior;if(p){if(l>this.end)return this.prior=null,d;if(this.value.isDataDriven())return this.prior=null,d;if(l<this.begin)return p.possiblyEvaluate(t,r,s);{const m=(l-this.begin)/(this.end-this.begin);return this.property.interpolate(p.possiblyEvaluate(t,r,s),d,Xr(m))}}return d}}class Ql{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,r,s){const l=new Ra(this._properties);for(const d of Object.keys(this._values))l._values[d]=this._values[d].possiblyEvaluate(t,r,s);return l}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class Hc{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}hasValue(t){return this._values[t].value!==void 0}getValue(t){return Bi(this._values[t].value)}setValue(t,r){this._values[t]=new Bs(this._values[t].property,r===null?void 0:Bi(r))}serialize(){const t={};for(const r of Object.keys(this._values)){const s=this.getValue(r);s!==void 0&&(t[r]=s)}return t}possiblyEvaluate(t,r,s){const l=new Ra(this._properties);for(const d of Object.keys(this._values))l._values[d]=this._values[d].possiblyEvaluate(t,r,s);return l}}class ar{constructor(t,r,s){this.property=t,this.value=r,this.parameters=s}isConstant(){return this.value.kind==="constant"}constantOr(t){return this.value.kind==="constant"?this.value.value:t}evaluate(t,r,s,l){return this.property.evaluate(this.value,this.parameters,t,r,s,l)}}class Ra{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class De{constructor(t){this.specification=t}possiblyEvaluate(t,r){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(r)}interpolate(t,r,s){const l=Ai[this.specification.type];return l?l(t,r,s):t}}class je{constructor(t,r){this.specification=t,this.overrides=r}possiblyEvaluate(t,r,s,l){return new ar(this,t.expression.kind==="constant"||t.expression.kind==="camera"?{kind:"constant",value:t.expression.evaluate(r,null,{},s,l)}:t.expression,r)}interpolate(t,r,s){if(t.value.kind!=="constant"||r.value.kind!=="constant")return t;if(t.value.value===void 0||r.value.value===void 0)return new ar(this,{kind:"constant",value:void 0},t.parameters);const l=Ai[this.specification.type];if(l){const d=l(t.value.value,r.value.value,s);return new ar(this,{kind:"constant",value:d},t.parameters)}return t}evaluate(t,r,s,l,d,p){return t.kind==="constant"?t.value:t.evaluate(r,s,l,d,p)}}class La extends je{possiblyEvaluate(t,r,s,l){if(t.value===void 0)return new ar(this,{kind:"constant",value:void 0},r);if(t.expression.kind==="constant"){const d=t.expression.evaluate(r,null,{},s,l),p=t.property.specification.type==="resolvedImage"&&typeof d!="string"?d.name:d,m=this._calculate(p,p,p,r);return new ar(this,{kind:"constant",value:m},r)}if(t.expression.kind==="camera"){const d=this._calculate(t.expression.evaluate({zoom:r.zoom-1}),t.expression.evaluate({zoom:r.zoom}),t.expression.evaluate({zoom:r.zoom+1}),r);return new ar(this,{kind:"constant",value:d},r)}return new ar(this,t.expression,r)}evaluate(t,r,s,l,d,p){if(t.kind==="source"){const m=t.evaluate(r,s,l,d,p);return this._calculate(m,m,m,r)}return t.kind==="composite"?this._calculate(t.evaluate({zoom:Math.floor(r.zoom)-1},s,l),t.evaluate({zoom:Math.floor(r.zoom)},s,l),t.evaluate({zoom:Math.floor(r.zoom)+1},s,l),r):t.value}_calculate(t,r,s,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:s,to:r}}interpolate(t){return t}}class Vo{constructor(t){this.specification=t}possiblyEvaluate(t,r,s,l){if(t.value!==void 0){if(t.expression.kind==="constant"){const d=t.expression.evaluate(r,null,{},s,l);return this._calculate(d,d,d,r)}return this._calculate(t.expression.evaluate(new gt(Math.floor(r.zoom-1),r)),t.expression.evaluate(new gt(Math.floor(r.zoom),r)),t.expression.evaluate(new gt(Math.floor(r.zoom+1),r)),r)}}_calculate(t,r,s,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:s,to:r}}interpolate(t){return t}}class Fs{constructor(t){this.specification=t}possiblyEvaluate(t,r,s,l){return!!t.expression.evaluate(r,null,{},s,l)}interpolate(){return!1}}class pi{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const r in t){const s=t[r];s.specification.overridable&&this.overridableProperties.push(r);const l=this.defaultPropertyValues[r]=new Bs(s,void 0),d=this.defaultTransitionablePropertyValues[r]=new Da(s);this.defaultTransitioningPropertyValues[r]=d.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=l.possiblyEvaluate({})}}}Ae("DataDrivenProperty",je),Ae("DataConstantProperty",De),Ae("CrossFadedDataDrivenProperty",La),Ae("CrossFadedProperty",Vo),Ae("ColorRampProperty",Fs);const ec="-transition";class Jt extends ye{constructor(t,r){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},t.type!=="custom"&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,t.type!=="background"&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter,this._featureFilter=Dr(t.filter)),r.layout&&(this._unevaluatedLayout=new Hc(r.layout)),r.paint)){this._transitionablePaint=new jo(r.paint);for(const s in t.paint)this.setPaintProperty(s,t.paint[s],{validate:!1});for(const s in t.layout)this.setLayoutProperty(s,t.layout[s],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Ra(r.paint)}}setFilter(t){this.filter=t,this._featureFilter=Dr(t)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return t==="visibility"?this.visibility:this._unevaluatedLayout.getValue(t)}getLayoutAffectingGlobalStateRefs(){const t=new Set;if(this._unevaluatedLayout)for(const r in this._unevaluatedLayout._values){const s=this._unevaluatedLayout._values[r];for(const l of s.getGlobalStateRefs())t.add(l)}for(const r of this._featureFilter.getGlobalStateRefs())t.add(r);return t}setLayoutProperty(t,r,s={}){r!=null&&this._validate(zo,`layers.${this.id}.layout.${t}`,t,r,s)||(t!=="visibility"?this._unevaluatedLayout.setValue(t,r):this.visibility=r)}getPaintProperty(t){return t.endsWith(ec)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,r,s={}){if(r!=null&&this._validate(Zc,`layers.${this.id}.paint.${t}`,t,r,s))return!1;if(t.endsWith(ec))return this._transitionablePaint.setTransition(t.slice(0,-11),r||void 0),!1;{const l=this._transitionablePaint._values[t],d=l.property.specification["property-type"]==="cross-faded-data-driven",p=l.value.isDataDriven(),m=l.value;this._transitionablePaint.setValue(t,r),this._handleSpecialPaintPropertyUpdate(t);const g=this._transitionablePaint._values[t].value;return g.isDataDriven()||p||d||this._handleOverridablePaintPropertyUpdate(t,m,g)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,r,s){return!1}isHidden(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||this.visibility==="none"}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,r){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,r)}serialize(){const t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),Qi(t,(r,s)=>!(r===void 0||s==="layout"&&!Object.keys(r).length||s==="paint"&&!Object.keys(r).length))}_validate(t,r,s,l,d={}){return(!d||d.validate!==!1)&&ks(this,t.call(Gn,{key:r,layerType:this.type,objectKey:s,value:l,styleSpec:J,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const r=this.paint.get(t);if(r instanceof ar&&Bn(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const tc={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class un{constructor(t,r){this._structArray=t,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class bt{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,r){return t._trim(),r&&(t.isTransferred=!0,r.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const r=Object.create(this.prototype);return r.arrayBuffer=t.arrayBuffer,r.length=t.length,r.capacity=t.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Ct(n,t=1){let r=0,s=0;return{members:n.map(l=>{const d=tc[l.type].BYTES_PER_ELEMENT,p=r=ic(r,Math.max(t,d)),m=l.components||1;return s=Math.max(s,d),r+=d*m,{name:l.name,type:l.type,components:m,offset:p}}),size:ic(r,Math.max(s,t)),alignment:t}}function ic(n,t){return Math.ceil(n/t)*t}class Br extends bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r){const s=this.length;return this.resize(s+1),this.emplace(s,t,r)}emplace(t,r,s){const l=2*t;return this.int16[l+0]=r,this.int16[l+1]=s,t}}Br.prototype.bytesPerElement=4,Ae("StructArrayLayout2i4",Br);class Fr extends bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,t,r,s)}emplace(t,r,s,l){const d=3*t;return this.int16[d+0]=r,this.int16[d+1]=s,this.int16[d+2]=l,t}}Fr.prototype.bytesPerElement=6,Ae("StructArrayLayout3i6",Fr);class No extends bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,s,l){const d=this.length;return this.resize(d+1),this.emplace(d,t,r,s,l)}emplace(t,r,s,l,d){const p=4*t;return this.int16[p+0]=r,this.int16[p+1]=s,this.int16[p+2]=l,this.int16[p+3]=d,t}}No.prototype.bytesPerElement=8,Ae("StructArrayLayout4i8",No);class Ba extends bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,s,l,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,t,r,s,l,d,p)}emplace(t,r,s,l,d,p,m){const g=6*t;return this.int16[g+0]=r,this.int16[g+1]=s,this.int16[g+2]=l,this.int16[g+3]=d,this.int16[g+4]=p,this.int16[g+5]=m,t}}Ba.prototype.bytesPerElement=12,Ae("StructArrayLayout2i4i12",Ba);class dn extends bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,s,l,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,t,r,s,l,d,p)}emplace(t,r,s,l,d,p,m){const g=4*t,x=8*t;return this.int16[g+0]=r,this.int16[g+1]=s,this.uint8[x+4]=l,this.uint8[x+5]=d,this.uint8[x+6]=p,this.uint8[x+7]=m,t}}dn.prototype.bytesPerElement=8,Ae("StructArrayLayout2i4ub8",dn);class Os extends bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r){const s=this.length;return this.resize(s+1),this.emplace(s,t,r)}emplace(t,r,s){const l=2*t;return this.float32[l+0]=r,this.float32[l+1]=s,t}}Os.prototype.bytesPerElement=8,Ae("StructArrayLayout2f8",Os);class Uo extends bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,s,l,d,p,m,g,x,b){const T=this.length;return this.resize(T+1),this.emplace(T,t,r,s,l,d,p,m,g,x,b)}emplace(t,r,s,l,d,p,m,g,x,b,T){const M=10*t;return this.uint16[M+0]=r,this.uint16[M+1]=s,this.uint16[M+2]=l,this.uint16[M+3]=d,this.uint16[M+4]=p,this.uint16[M+5]=m,this.uint16[M+6]=g,this.uint16[M+7]=x,this.uint16[M+8]=b,this.uint16[M+9]=T,t}}Uo.prototype.bytesPerElement=20,Ae("StructArrayLayout10ui20",Uo);class Fa extends bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,s,l,d,p,m,g,x,b,T,M){const A=this.length;return this.resize(A+1),this.emplace(A,t,r,s,l,d,p,m,g,x,b,T,M)}emplace(t,r,s,l,d,p,m,g,x,b,T,M,A){const E=12*t;return this.int16[E+0]=r,this.int16[E+1]=s,this.int16[E+2]=l,this.int16[E+3]=d,this.uint16[E+4]=p,this.uint16[E+5]=m,this.uint16[E+6]=g,this.uint16[E+7]=x,this.int16[E+8]=b,this.int16[E+9]=T,this.int16[E+10]=M,this.int16[E+11]=A,t}}Fa.prototype.bytesPerElement=24,Ae("StructArrayLayout4i4ui4i24",Fa);class $o extends bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,t,r,s)}emplace(t,r,s,l){const d=3*t;return this.float32[d+0]=r,this.float32[d+1]=s,this.float32[d+2]=l,t}}$o.prototype.bytesPerElement=12,Ae("StructArrayLayout3f12",$o);class h extends bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.uint32[1*t+0]=r,t}}h.prototype.bytesPerElement=4,Ae("StructArrayLayout1ul4",h);class e extends bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,s,l,d,p,m,g,x){const b=this.length;return this.resize(b+1),this.emplace(b,t,r,s,l,d,p,m,g,x)}emplace(t,r,s,l,d,p,m,g,x,b){const T=10*t,M=5*t;return this.int16[T+0]=r,this.int16[T+1]=s,this.int16[T+2]=l,this.int16[T+3]=d,this.int16[T+4]=p,this.int16[T+5]=m,this.uint32[M+3]=g,this.uint16[T+8]=x,this.uint16[T+9]=b,t}}e.prototype.bytesPerElement=20,Ae("StructArrayLayout6i1ul2ui20",e);class i extends bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,s,l,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,t,r,s,l,d,p)}emplace(t,r,s,l,d,p,m){const g=6*t;return this.int16[g+0]=r,this.int16[g+1]=s,this.int16[g+2]=l,this.int16[g+3]=d,this.int16[g+4]=p,this.int16[g+5]=m,t}}i.prototype.bytesPerElement=12,Ae("StructArrayLayout2i2i2i12",i);class a extends bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,s,l,d){const p=this.length;return this.resize(p+1),this.emplace(p,t,r,s,l,d)}emplace(t,r,s,l,d,p){const m=4*t,g=8*t;return this.float32[m+0]=r,this.float32[m+1]=s,this.float32[m+2]=l,this.int16[g+6]=d,this.int16[g+7]=p,t}}a.prototype.bytesPerElement=16,Ae("StructArrayLayout2f1f2i16",a);class o extends bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,s,l,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,t,r,s,l,d,p)}emplace(t,r,s,l,d,p,m){const g=16*t,x=4*t,b=8*t;return this.uint8[g+0]=r,this.uint8[g+1]=s,this.float32[x+1]=l,this.float32[x+2]=d,this.int16[b+6]=p,this.int16[b+7]=m,t}}o.prototype.bytesPerElement=16,Ae("StructArrayLayout2ub2f2i16",o);class u extends bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,t,r,s)}emplace(t,r,s,l){const d=3*t;return this.uint16[d+0]=r,this.uint16[d+1]=s,this.uint16[d+2]=l,t}}u.prototype.bytesPerElement=6,Ae("StructArrayLayout3ui6",u);class f extends bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,s,l,d,p,m,g,x,b,T,M,A,E,D,F,U){const ee=this.length;return this.resize(ee+1),this.emplace(ee,t,r,s,l,d,p,m,g,x,b,T,M,A,E,D,F,U)}emplace(t,r,s,l,d,p,m,g,x,b,T,M,A,E,D,F,U,ee){const W=24*t,C=12*t,B=48*t;return this.int16[W+0]=r,this.int16[W+1]=s,this.uint16[W+2]=l,this.uint16[W+3]=d,this.uint32[C+2]=p,this.uint32[C+3]=m,this.uint32[C+4]=g,this.uint16[W+10]=x,this.uint16[W+11]=b,this.uint16[W+12]=T,this.float32[C+7]=M,this.float32[C+8]=A,this.uint8[B+36]=E,this.uint8[B+37]=D,this.uint8[B+38]=F,this.uint32[C+10]=U,this.int16[W+22]=ee,t}}f.prototype.bytesPerElement=48,Ae("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",f);class _ extends bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,s,l,d,p,m,g,x,b,T,M,A,E,D,F,U,ee,W,C,B,X,le,xe,de,me,we,be){const Te=this.length;return this.resize(Te+1),this.emplace(Te,t,r,s,l,d,p,m,g,x,b,T,M,A,E,D,F,U,ee,W,C,B,X,le,xe,de,me,we,be)}emplace(t,r,s,l,d,p,m,g,x,b,T,M,A,E,D,F,U,ee,W,C,B,X,le,xe,de,me,we,be,Te){const ge=32*t,ke=16*t;return this.int16[ge+0]=r,this.int16[ge+1]=s,this.int16[ge+2]=l,this.int16[ge+3]=d,this.int16[ge+4]=p,this.int16[ge+5]=m,this.int16[ge+6]=g,this.int16[ge+7]=x,this.uint16[ge+8]=b,this.uint16[ge+9]=T,this.uint16[ge+10]=M,this.uint16[ge+11]=A,this.uint16[ge+12]=E,this.uint16[ge+13]=D,this.uint16[ge+14]=F,this.uint16[ge+15]=U,this.uint16[ge+16]=ee,this.uint16[ge+17]=W,this.uint16[ge+18]=C,this.uint16[ge+19]=B,this.uint16[ge+20]=X,this.uint16[ge+21]=le,this.uint16[ge+22]=xe,this.uint32[ke+12]=de,this.float32[ke+13]=me,this.float32[ke+14]=we,this.uint16[ge+30]=be,this.uint16[ge+31]=Te,t}}_.prototype.bytesPerElement=64,Ae("StructArrayLayout8i15ui1ul2f2ui64",_);class y extends bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.float32[1*t+0]=r,t}}y.prototype.bytesPerElement=4,Ae("StructArrayLayout1f4",y);class v extends bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,t,r,s)}emplace(t,r,s,l){const d=3*t;return this.uint16[6*t+0]=r,this.float32[d+1]=s,this.float32[d+2]=l,t}}v.prototype.bytesPerElement=12,Ae("StructArrayLayout1ui2f12",v);class w extends bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,t,r,s)}emplace(t,r,s,l){const d=4*t;return this.uint32[2*t+0]=r,this.uint16[d+2]=s,this.uint16[d+3]=l,t}}w.prototype.bytesPerElement=8,Ae("StructArrayLayout1ul2ui8",w);class P extends bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r){const s=this.length;return this.resize(s+1),this.emplace(s,t,r)}emplace(t,r,s){const l=2*t;return this.uint16[l+0]=r,this.uint16[l+1]=s,t}}P.prototype.bytesPerElement=4,Ae("StructArrayLayout2ui4",P);class S extends bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.uint16[1*t+0]=r,t}}S.prototype.bytesPerElement=2,Ae("StructArrayLayout1ui2",S);class I extends bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,s,l){const d=this.length;return this.resize(d+1),this.emplace(d,t,r,s,l)}emplace(t,r,s,l,d){const p=4*t;return this.float32[p+0]=r,this.float32[p+1]=s,this.float32[p+2]=l,this.float32[p+3]=d,t}}I.prototype.bytesPerElement=16,Ae("StructArrayLayout4f16",I);class k extends un{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new Le(this.anchorPointX,this.anchorPointY)}}k.prototype.size=20;class V extends e{get(t){return new k(this,t)}}Ae("CollisionBoxArray",V);class O extends un{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}O.prototype.size=48;class N extends f{get(t){return new O(this,t)}}Ae("PlacedSymbolArray",N);class $ extends un{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t){this._structArray.uint32[this._pos4+12]=t}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}$.prototype.size=64;class q extends _{get(t){return new $(this,t)}}Ae("SymbolInstanceArray",q);class Z extends y{getoffsetX(t){return this.float32[1*t+0]}}Ae("GlyphOffsetArray",Z);class Y extends Fr{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}Ae("SymbolLineVertexArray",Y);class K extends un{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}K.prototype.size=12;class G extends v{get(t){return new K(this,t)}}Ae("TextAnchorOffsetArray",G);class te extends un{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}}te.prototype.size=8;class he extends w{get(t){return new te(this,t)}}Ae("FeatureIndexArray",he);class ae extends Br{}class oe extends Br{}class ue extends Br{}class Me extends Ba{}class Pe extends dn{}class ve extends Os{}class ze extends Uo{}class We extends Fa{}class ot extends $o{}class wt extends h{}class ht extends i{}class Tt extends o{}class dt extends u{}class ut extends P{}const pt=Ct([{name:"a_pos",components:2,type:"Int16"}],4),{members:Qt}=pt;class nt{constructor(t=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=t}prepareSegment(t,r,s,l){const d=this.segments[this.segments.length-1];return t>nt.MAX_VERTEX_ARRAY_LENGTH&&Yt(`Max vertices per segment is ${nt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${nt.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!d||d.vertexLength+t>nt.MAX_VERTEX_ARRAY_LENGTH||d.sortKey!==l?this.createNewSegment(r,s,l):d}createNewSegment(t,r,s){const l={vertexOffset:t.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0,vaos:{}};return s!==void 0&&(l.sortKey=s),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(l),l}getOrCreateLatestSegment(t,r,s){return this.prepareSegment(0,t,r,s)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(const t of this.segments)for(const r in t.vaos)t.vaos[r].destroy()}static simpleSegment(t,r,s,l){return new nt([{vertexOffset:t,primitiveOffset:r,vertexLength:s,primitiveLength:l,vaos:{},sortKey:0}])}}function Zt(n,t){return 256*(n=Ft(Math.floor(n),0,255))+Ft(Math.floor(t),0,255)}nt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Ae("SegmentVector",nt);const ei=Ct([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var Or,jr,Vr,or={exports:{}},js={exports:{}},Vs={exports:{}},Hn=function(){if(Vr)return or.exports;Vr=1;var n=(Or||(Or=1,js.exports=function(r,s){var l,d,p,m,g,x,b,T;for(d=r.length-(l=3&r.length),p=s,g=3432918353,x=461845907,T=0;T<d;)b=255&r.charCodeAt(T)|(255&r.charCodeAt(++T))<<8|(255&r.charCodeAt(++T))<<16|(255&r.charCodeAt(++T))<<24,++T,p=27492+(65535&(m=5*(65535&(p=(p^=b=(65535&(b=(b=(65535&b)*g+(((b>>>16)*g&65535)<<16)&4294967295)<<15|b>>>17))*x+(((b>>>16)*x&65535)<<16)&4294967295)<<13|p>>>19))+((5*(p>>>16)&65535)<<16)&4294967295))+((58964+(m>>>16)&65535)<<16);switch(b=0,l){case 3:b^=(255&r.charCodeAt(T+2))<<16;case 2:b^=(255&r.charCodeAt(T+1))<<8;case 1:p^=b=(65535&(b=(b=(65535&(b^=255&r.charCodeAt(T)))*g+(((b>>>16)*g&65535)<<16)&4294967295)<<15|b>>>17))*x+(((b>>>16)*x&65535)<<16)&4294967295}return p^=r.length,p=2246822507*(65535&(p^=p>>>16))+((2246822507*(p>>>16)&65535)<<16)&4294967295,p=3266489909*(65535&(p^=p>>>13))+((3266489909*(p>>>16)&65535)<<16)&4294967295,(p^=p>>>16)>>>0}),js.exports),t=(jr||(jr=1,Vs.exports=function(r,s){for(var l,d=r.length,p=s^d,m=0;d>=4;)l=1540483477*(65535&(l=255&r.charCodeAt(m)|(255&r.charCodeAt(++m))<<8|(255&r.charCodeAt(++m))<<16|(255&r.charCodeAt(++m))<<24))+((1540483477*(l>>>16)&65535)<<16),p=1540483477*(65535&p)+((1540483477*(p>>>16)&65535)<<16)^(l=1540483477*(65535&(l^=l>>>24))+((1540483477*(l>>>16)&65535)<<16)),d-=4,++m;switch(d){case 3:p^=(255&r.charCodeAt(m+2))<<16;case 2:p^=(255&r.charCodeAt(m+1))<<8;case 1:p=1540483477*(65535&(p^=255&r.charCodeAt(m)))+((1540483477*(p>>>16)&65535)<<16)}return p=1540483477*(65535&(p^=p>>>13))+((1540483477*(p>>>16)&65535)<<16),(p^=p>>>15)>>>0}),Vs.exports);return or.exports=n,or.exports.murmur3=n,or.exports.murmur2=t,or.exports}(),bi=Di(Hn);class qi{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,r,s,l){this.ids.push(Nr(t)),this.positions.push(r,s,l)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const r=Nr(t);let s=0,l=this.ids.length-1;for(;s<l;){const p=s+l>>1;this.ids[p]>=r?l=p:s=p+1}const d=[];for(;this.ids[s]===r;)d.push({index:this.positions[3*s],start:this.positions[3*s+1],end:this.positions[3*s+2]}),s++;return d}static serialize(t,r){const s=new Float64Array(t.ids),l=new Uint32Array(t.positions);return pn(s,l,0,s.length-1),r&&r.push(s.buffer,l.buffer),{ids:s,positions:l}}static deserialize(t){const r=new qi;return r.ids=t.ids,r.positions=t.positions,r.indexed=!0,r}}function Nr(n){const t=+n;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:bi(String(n))}function pn(n,t,r,s){for(;r<s;){const l=n[r+s>>1];let d=r-1,p=s+1;for(;;){do d++;while(n[d]<l);do p--;while(n[p]>l);if(d>=p)break;Et(n,d,p),Et(t,3*d,3*p),Et(t,3*d+1,3*p+1),Et(t,3*d+2,3*p+2)}p-r<s-p?(pn(n,t,r,p),r=p+1):(pn(n,t,p+1,s),s=p)}}function Et(n,t,r){const s=n[t];n[t]=n[r],n[r]=s}Ae("FeaturePositionMap",qi);class mt{constructor(t,r){this.gl=t.gl,this.location=r}}class fi extends mt{constructor(t,r){super(t,r),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class Ot extends mt{constructor(t,r){super(t,r),this.current=[0,0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}}class rc extends mt{constructor(t,r){super(t,r),this.current=Je.transparent}set(t){t.r===this.current.r&&t.g===this.current.g&&t.b===this.current.b&&t.a===this.current.a||(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}}const Xc=new Float32Array(16);function Zo(n){return[Zt(255*n.r,255*n.g),Zt(255*n.b,255*n.a)]}class Ns{constructor(t,r,s){this.value=t,this.uniformNames=r.map(l=>`u_${l}`),this.type=s}setUniform(t,r,s){t.set(s.constantOr(this.value))}getBinding(t,r,s){return this.type==="color"?new rc(t,r):new fi(t,r)}}class Xn{constructor(t,r){this.uniformNames=r.map(s=>`u_${s}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=t.tlbr}setUniform(t,r,s,l){const d=l==="u_pattern_to"?this.patternTo:l==="u_pattern_from"?this.patternFrom:l==="u_pixel_ratio_to"?this.pixelRatioTo:l==="u_pixel_ratio_from"?this.pixelRatioFrom:null;d&&t.set(d)}getBinding(t,r,s){return s.substr(0,9)==="u_pattern"?new Ot(t,r):new fi(t,r)}}class gr{constructor(t,r,s,l){this.expression=t,this.type=s,this.maxValue=0,this.paintVertexAttributes=r.map(d=>({name:`a_${d}`,type:"Float32",components:s==="color"?2:1,offset:0})),this.paintVertexArray=new l}populatePaintArray(t,r,s,l,d){const p=this.paintVertexArray.length,m=this.expression.evaluate(new gt(0),r,{},l,[],d);this.paintVertexArray.resize(t),this._setPaintValue(p,t,m)}updatePaintArray(t,r,s,l){const d=this.expression.evaluate({zoom:0},s,l);this._setPaintValue(t,r,d)}_setPaintValue(t,r,s){if(this.type==="color"){const l=Zo(s);for(let d=t;d<r;d++)this.paintVertexArray.emplace(d,l[0],l[1])}else{for(let l=t;l<r;l++)this.paintVertexArray.emplace(l,s);this.maxValue=Math.max(this.maxValue,Math.abs(s))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class ti{constructor(t,r,s,l,d,p){this.expression=t,this.uniformNames=r.map(m=>`u_${m}_t`),this.type=s,this.useIntegerZoom=l,this.zoom=d,this.maxValue=0,this.paintVertexAttributes=r.map(m=>({name:`a_${m}`,type:"Float32",components:s==="color"?4:2,offset:0})),this.paintVertexArray=new p}populatePaintArray(t,r,s,l,d){const p=this.expression.evaluate(new gt(this.zoom),r,{},l,[],d),m=this.expression.evaluate(new gt(this.zoom+1),r,{},l,[],d),g=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(g,t,p,m)}updatePaintArray(t,r,s,l){const d=this.expression.evaluate({zoom:this.zoom},s,l),p=this.expression.evaluate({zoom:this.zoom+1},s,l);this._setPaintValue(t,r,d,p)}_setPaintValue(t,r,s,l){if(this.type==="color"){const d=Zo(s),p=Zo(l);for(let m=t;m<r;m++)this.paintVertexArray.emplace(m,d[0],d[1],p[0],p[1])}else{for(let d=t;d<r;d++)this.paintVertexArray.emplace(d,s,l);this.maxValue=Math.max(this.maxValue,Math.abs(s),Math.abs(l))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,r){const s=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,l=Ft(this.expression.interpolationFactor(s,this.zoom,this.zoom+1),0,1);t.set(l)}getBinding(t,r,s){return new fi(t,r)}}class yr{constructor(t,r,s,l,d,p){this.expression=t,this.type=r,this.useIntegerZoom=s,this.zoom=l,this.layerId=p,this.zoomInPaintVertexArray=new d,this.zoomOutPaintVertexArray=new d}populatePaintArray(t,r,s){const l=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(l,t,r.patterns&&r.patterns[this.layerId],s)}updatePaintArray(t,r,s,l,d){this._setPaintValues(t,r,s.patterns&&s.patterns[this.layerId],d)}_setPaintValues(t,r,s,l){if(!l||!s)return;const{min:d,mid:p,max:m}=s,g=l[d],x=l[p],b=l[m];if(g&&x&&b)for(let T=t;T<r;T++)this.zoomInPaintVertexArray.emplace(T,x.tl[0],x.tl[1],x.br[0],x.br[1],g.tl[0],g.tl[1],g.br[0],g.br[1],x.pixelRatio,g.pixelRatio),this.zoomOutPaintVertexArray.emplace(T,x.tl[0],x.tl[1],x.br[0],x.br[1],b.tl[0],b.tl[1],b.br[0],b.br[1],x.pixelRatio,b.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,ei.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,ei.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Go{constructor(t,r,s){this.binders={},this._buffers=[];const l=[];for(const d in t.paint._values){if(!s(d))continue;const p=t.paint.get(d);if(!(p instanceof ar&&Bn(p.property.specification)))continue;const m=qo(d,t.type),g=p.value,x=p.property.specification.type,b=p.property.useIntegerZoom,T=p.property.specification["property-type"],M=T==="cross-faded"||T==="cross-faded-data-driven";if(g.kind==="constant")this.binders[d]=M?new Xn(g.value,m):new Ns(g.value,m,x),l.push(`/u_${d}`);else if(g.kind==="source"||M){const A=Wo(d,x,"source");this.binders[d]=M?new yr(g,x,b,r,A,t.id):new gr(g,m,x,A),l.push(`/a_${d}`)}else{const A=Wo(d,x,"composite");this.binders[d]=new ti(g,m,x,b,r,A),l.push(`/z_${d}`)}}this.cacheKey=l.sort().join("")}getMaxValue(t){const r=this.binders[t];return r instanceof gr||r instanceof ti?r.maxValue:0}populatePaintArrays(t,r,s,l,d){for(const p in this.binders){const m=this.binders[p];(m instanceof gr||m instanceof ti||m instanceof yr)&&m.populatePaintArray(t,r,s,l,d)}}setConstantPatternPositions(t,r){for(const s in this.binders){const l=this.binders[s];l instanceof Xn&&l.setConstantPatternPositions(t,r)}}updatePaintArrays(t,r,s,l,d){let p=!1;for(const m in t){const g=r.getPositions(m);for(const x of g){const b=s.feature(x.index);for(const T in this.binders){const M=this.binders[T];if((M instanceof gr||M instanceof ti||M instanceof yr)&&M.expression.isStateDependent===!0){const A=l.paint.get(T);M.expression=A.value,M.updatePaintArray(x.start,x.end,b,t[m],d),p=!0}}}}return p}defines(){const t=[];for(const r in this.binders){const s=this.binders[r];(s instanceof Ns||s instanceof Xn)&&t.push(...s.uniformNames.map(l=>`#define HAS_UNIFORM_${l}`))}return t}getBinderAttributes(){const t=[];for(const r in this.binders){const s=this.binders[r];if(s instanceof gr||s instanceof ti)for(let l=0;l<s.paintVertexAttributes.length;l++)t.push(s.paintVertexAttributes[l].name);else if(s instanceof yr)for(let l=0;l<ei.members.length;l++)t.push(ei.members[l].name)}return t}getBinderUniforms(){const t=[];for(const r in this.binders){const s=this.binders[r];if(s instanceof Ns||s instanceof Xn||s instanceof ti)for(const l of s.uniformNames)t.push(l)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,r){const s=[];for(const l in this.binders){const d=this.binders[l];if(d instanceof Ns||d instanceof Xn||d instanceof ti){for(const p of d.uniformNames)if(r[p]){const m=d.getBinding(t,r[p],p);s.push({name:p,property:l,binding:m})}}}return s}setUniforms(t,r,s,l){for(const{name:d,property:p,binding:m}of r)this.binders[p].setUniform(m,l,s.get(p),d)}updatePaintBuffers(t){this._buffers=[];for(const r in this.binders){const s=this.binders[r];if(t&&s instanceof yr){const l=t.fromScale===2?s.zoomInPaintVertexBuffer:s.zoomOutPaintVertexBuffer;l&&this._buffers.push(l)}else(s instanceof gr||s instanceof ti)&&s.paintVertexBuffer&&this._buffers.push(s.paintVertexBuffer)}}upload(t){for(const r in this.binders){const s=this.binders[r];(s instanceof gr||s instanceof ti||s instanceof yr)&&s.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const r=this.binders[t];(r instanceof gr||r instanceof ti||r instanceof yr)&&r.destroy()}}}class Ur{constructor(t,r,s=()=>!0){this.programConfigurations={};for(const l of t)this.programConfigurations[l.id]=new Go(l,r,s);this.needsUpload=!1,this._featureMap=new qi,this._bufferOffset=0}populatePaintArrays(t,r,s,l,d,p){for(const m in this.programConfigurations)this.programConfigurations[m].populatePaintArrays(t,r,l,d,p);r.id!==void 0&&this._featureMap.add(r.id,s,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,r,s,l){for(const d of s)this.needsUpload=this.programConfigurations[d.id].updatePaintArrays(t,this._featureMap,r,d,l)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const r in this.programConfigurations)this.programConfigurations[r].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}function qo(n,t){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[n]||[n.replace(`${t}-`,"").replace(/-/g,"_")]}function Wo(n,t,r){const s={color:{source:Os,composite:I},number:{source:y,composite:Os}},l=function(d){return{"line-pattern":{source:ze,composite:ze},"fill-pattern":{source:ze,composite:ze},"fill-extrusion-pattern":{source:ze,composite:ze}}[d]}(n);return l&&l[r]||s[t][r]}Ae("ConstantBinder",Ns),Ae("CrossFadedConstantBinder",Xn),Ae("SourceExpressionBinder",gr),Ae("CrossFadedCompositeBinder",yr),Ae("CompositeExpressionBinder",ti),Ae("ProgramConfiguration",Go,{omit:["_buffers"]}),Ae("ProgramConfigurationSet",Ur);const Us=Math.pow(2,14)-1,jh=-Us-1;function $s(n){const t=ct/n.extent,r=n.loadGeometry();for(let s=0;s<r.length;s++){const l=r[s];for(let d=0;d<l.length;d++){const p=l[d],m=Math.round(p.x*t),g=Math.round(p.y*t);p.x=Ft(m,jh,Us),p.y=Ft(g,jh,Us),(m<p.x||m>p.x+1||g<p.y||g>p.y+1)&&Yt("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function Zs(n,t){return{type:n.type,id:n.id,properties:n.properties,geometry:t?$s(n):[]}}const Vh=-32768;function Ad(n,t,r,s,l){n.emplaceBack(Vh+8*t+s,Vh+8*r+l)}class Yc{constructor(t){this.zoom=t.zoom,this.globalState=t.globalState,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new oe,this.indexArray=new dt,this.segments=new nt,this.programConfigurations=new Ur(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,s){const l=this.layers[0],d=[];let p=null,m=!1,g=l.type==="heatmap";if(l.type==="circle"){const b=l;p=b.layout.get("circle-sort-key"),m=!p.isConstant(),g=g||b.paint.get("circle-pitch-alignment")==="map"}const x=g?r.subdivisionGranularity.circle:1;for(const{feature:b,id:T,index:M,sourceLayerIndex:A}of t){const E=this.layers[0]._featureFilter.needGeometry,D=Zs(b,E);if(!this.layers[0]._featureFilter.filter(new gt(this.zoom,{globalState:this.globalState}),D,s))continue;const F=m?p.evaluate(D,{},s):void 0,U={id:T,properties:b.properties,type:b.type,sourceLayerIndex:A,index:M,geometry:E?D.geometry:$s(b),patterns:{},sortKey:F};d.push(U)}m&&d.sort((b,T)=>b.sortKey-T.sortKey);for(const b of d){const{geometry:T,index:M,sourceLayerIndex:A}=b,E=t[M].feature;this.addFeature(b,T,M,s,x),r.featureIndex.insert(E,T,M,A,this.index)}}update(t,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Qt),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,r,s,l,d=1){let p;switch(d){case 1:p=[0,7];break;case 3:p=[0,2,5,7];break;case 5:p=[0,1,3,4,6,7];break;case 7:p=[0,1,2,3,4,5,6,7];break;default:throw new Error(`Invalid circle bucket granularity: ${d}; valid values are 1, 3, 5, 7.`)}const m=p.length;for(const g of r)for(const x of g){const b=x.x,T=x.y;if(b<0||b>=ct||T<0||T>=ct)continue;const M=this.segments.prepareSegment(m*m,this.layoutVertexArray,this.indexArray,t.sortKey),A=M.vertexLength;for(let E=0;E<m;E++)for(let D=0;D<m;D++)Ad(this.layoutVertexArray,b,T,p[D],p[E]);for(let E=0;E<m-1;E++)for(let D=0;D<m-1;D++){const F=A+E*m+D,U=A+(E+1)*m+D;this.indexArray.emplaceBack(F,U+1,F+1),this.indexArray.emplaceBack(F,U,U+1)}M.vertexLength+=m*m,M.primitiveLength+=(m-1)*(m-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,s,{},l)}}function Nh(n,t){for(let r=0;r<n.length;r++)if(Oa(t,n[r]))return!0;for(let r=0;r<t.length;r++)if(Oa(n,t[r]))return!0;return!!Kc(n,t)}function Ed(n,t,r){return!!Oa(n,t)||!!Jc(t,n,r)}function Uh(n,t){if(n.length===1)return Zh(t,n[0]);for(let r=0;r<t.length;r++){const s=t[r];for(let l=0;l<s.length;l++)if(Oa(n,s[l]))return!0}for(let r=0;r<n.length;r++)if(Zh(t,n[r]))return!0;for(let r=0;r<t.length;r++)if(Kc(n,t[r]))return!0;return!1}function zd(n,t,r){if(n.length>1){if(Kc(n,t))return!0;for(let s=0;s<t.length;s++)if(Jc(t[s],n,r))return!0}for(let s=0;s<n.length;s++)if(Jc(n[s],t,r))return!0;return!1}function Kc(n,t){if(n.length===0||t.length===0)return!1;for(let r=0;r<n.length-1;r++){const s=n[r],l=n[r+1];for(let d=0;d<t.length-1;d++)if(kd(s,l,t[d],t[d+1]))return!0}return!1}function kd(n,t,r,s){return Pi(n,r,s)!==Pi(t,r,s)&&Pi(n,t,r)!==Pi(n,t,s)}function Jc(n,t,r){const s=r*r;if(t.length===1)return n.distSqr(t[0])<s;for(let l=1;l<t.length;l++)if($h(n,t[l-1],t[l])<s)return!0;return!1}function $h(n,t,r){const s=t.distSqr(r);if(s===0)return n.distSqr(t);const l=((n.x-t.x)*(r.x-t.x)+(n.y-t.y)*(r.y-t.y))/s;return n.distSqr(l<0?t:l>1?r:r.sub(t)._mult(l)._add(t))}function Zh(n,t){let r,s,l,d=!1;for(let p=0;p<n.length;p++){r=n[p];for(let m=0,g=r.length-1;m<r.length;g=m++)s=r[m],l=r[g],s.y>t.y!=l.y>t.y&&t.x<(l.x-s.x)*(t.y-s.y)/(l.y-s.y)+s.x&&(d=!d)}return d}function Oa(n,t){let r=!1;for(let s=0,l=n.length-1;s<n.length;l=s++){const d=n[s],p=n[l];d.y>t.y!=p.y>t.y&&t.x<(p.x-d.x)*(t.y-d.y)/(p.y-d.y)+d.x&&(r=!r)}return r}function Dd(n,t,r){const s=r[0],l=r[2];if(n.x<s.x&&t.x<s.x||n.x>l.x&&t.x>l.x||n.y<s.y&&t.y<s.y||n.y>l.y&&t.y>l.y)return!1;const d=Pi(n,t,r[0]);return d!==Pi(n,t,r[1])||d!==Pi(n,t,r[2])||d!==Pi(n,t,r[3])}function Ho(n,t,r){const s=t.paint.get(n).value;return s.kind==="constant"?s.value:r.programConfigurations.get(t.id).getMaxValue(n)}function nc(n){return Math.sqrt(n[0]*n[0]+n[1]*n[1])}function sc(n,t,r,s,l){if(!t[0]&&!t[1])return n;const d=Le.convert(t)._mult(l);r==="viewport"&&d._rotate(-s);const p=[];for(let m=0;m<n.length;m++)p.push(n[m].sub(d));return p}let Gh,qh;Ae("CircleBucket",Yc,{omit:["layers"]});var Rd={get paint(){return qh=qh||new pi({"circle-radius":new je(J.paint_circle["circle-radius"]),"circle-color":new je(J.paint_circle["circle-color"]),"circle-blur":new je(J.paint_circle["circle-blur"]),"circle-opacity":new je(J.paint_circle["circle-opacity"]),"circle-translate":new De(J.paint_circle["circle-translate"]),"circle-translate-anchor":new De(J.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new De(J.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new De(J.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new je(J.paint_circle["circle-stroke-width"]),"circle-stroke-color":new je(J.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new je(J.paint_circle["circle-stroke-opacity"])})},get layout(){return Gh=Gh||new pi({"circle-sort-key":new je(J.layout_circle["circle-sort-key"])})}};class Ld extends Jt{constructor(t){super(t,Rd)}createBucket(t){return new Yc(t)}queryRadius(t){const r=t;return Ho("circle-radius",this,r)+Ho("circle-stroke-width",this,r)+nc(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:t,feature:r,featureState:s,geometry:l,transform:d,pixelsToTileUnits:p,unwrappedTileID:m,getElevation:g}){const x=sc(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-d.bearingInRadians,p),b=this.paint.get("circle-radius").evaluate(r,s)+this.paint.get("circle-stroke-width").evaluate(r,s),T=this.paint.get("circle-pitch-alignment")==="map",M=T?x:function(E,D,F,U){return E.map(ee=>Wh(ee,D,F,U))}(x,d,m,g),A=T?b*p:b;for(const E of l)for(const D of E){const F=T?D:Wh(D,d,m,g);let U=A;const ee=d.projectTileCoordinates(D.x,D.y,m,g).signedDistanceFromCamera;if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?U*=ee/d.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(U*=d.cameraToCenterDistance/ee),Ed(M,F,U))return!0}return!1}}function Wh(n,t,r,s){const l=t.projectTileCoordinates(n.x,n.y,r,s).point;return new Le((.5*l.x+.5)*t.width,(.5*-l.y+.5)*t.height)}class Hh extends Yc{}let Xh;Ae("HeatmapBucket",Hh,{omit:["layers"]});var Bd={get paint(){return Xh=Xh||new pi({"heatmap-radius":new je(J.paint_heatmap["heatmap-radius"]),"heatmap-weight":new je(J.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new De(J.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Fs(J.paint_heatmap["heatmap-color"]),"heatmap-opacity":new De(J.paint_heatmap["heatmap-opacity"])})}};function Qc(n,{width:t,height:r},s,l){if(l){if(l instanceof Uint8ClampedArray)l=new Uint8Array(l.buffer);else if(l.length!==t*r*s)throw new RangeError(`mismatched image size. expected: ${l.length} but got: ${t*r*s}`)}else l=new Uint8Array(t*r*s);return n.width=t,n.height=r,n.data=l,n}function Yh(n,{width:t,height:r},s){if(t===n.width&&r===n.height)return;const l=Qc({},{width:t,height:r},s);eh(n,l,{x:0,y:0},{x:0,y:0},{width:Math.min(n.width,t),height:Math.min(n.height,r)},s),n.width=t,n.height=r,n.data=l.data}function eh(n,t,r,s,l,d){if(l.width===0||l.height===0)return t;if(l.width>n.width||l.height>n.height||r.x>n.width-l.width||r.y>n.height-l.height)throw new RangeError("out of range source coordinates for image copy");if(l.width>t.width||l.height>t.height||s.x>t.width-l.width||s.y>t.height-l.height)throw new RangeError("out of range destination coordinates for image copy");const p=n.data,m=t.data;if(p===m)throw new Error("srcData equals dstData, so image is already copied");for(let g=0;g<l.height;g++){const x=((r.y+g)*n.width+r.x)*d,b=((s.y+g)*t.width+s.x)*d;for(let T=0;T<l.width*d;T++)m[b+T]=p[x+T]}return t}class Xo{constructor(t,r){Qc(this,t,1,r)}resize(t){Yh(this,t,1)}clone(){return new Xo({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,s,l,d){eh(t,r,s,l,d,1)}}class Ei{constructor(t,r){Qc(this,t,4,r)}resize(t){Yh(this,t,4)}replace(t,r){r?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new Ei({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,s,l,d){eh(t,r,s,l,d,4)}setPixel(t,r,s){const l=4*(t*this.width+r);this.data[l+0]=Math.round(255*s.r/s.a),this.data[l+1]=Math.round(255*s.g/s.a),this.data[l+2]=Math.round(255*s.b/s.a),this.data[l+3]=Math.round(255*s.a)}}function Kh(n){const t={},r=n.resolution||256,s=n.clips?n.clips.length:1,l=n.image||new Ei({width:r,height:s});if(Math.log(r)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${r}`);const d=(p,m,g)=>{t[n.evaluationKey]=g;const x=n.expression.evaluate(t);l.setPixel(p/4/r,m/4,x)};if(n.clips)for(let p=0,m=0;p<s;++p,m+=4*r)for(let g=0,x=0;g<r;g++,x+=4){const b=g/(r-1),{start:T,end:M}=n.clips[p];d(m,x,T*(1-b)+M*b)}else for(let p=0,m=0;p<r;p++,m+=4)d(0,m,p/(r-1));return l}Ae("AlphaImage",Xo),Ae("RGBAImage",Ei);const th="big-fb";class Fd extends Jt{createBucket(t){return new Hh(t)}constructor(t){super(t,Bd),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){t==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Kh({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(th)&&this.heatmapFbos.delete(th)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}}let Jh;var Od={get paint(){return Jh=Jh||new pi({"hillshade-illumination-direction":new De(J.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new De(J.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new De(J.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new De(J.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new De(J.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new De(J.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new De(J.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new De(J.paint_hillshade["hillshade-method"])})}};class jd extends Jt{constructor(t){super(t,Od),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let t=this.paint.get("hillshade-illumination-direction").values,r=this.paint.get("hillshade-illumination-altitude").values,s=this.paint.get("hillshade-highlight-color").values,l=this.paint.get("hillshade-shadow-color").values;const d=Math.max(t.length,r.length,s.length,l.length);t=t.concat(Array(d-t.length).fill(t.at(-1))),r=r.concat(Array(d-r.length).fill(r.at(-1))),s=s.concat(Array(d-s.length).fill(s.at(-1))),l=l.concat(Array(d-l.length).fill(l.at(-1)));const p=r.map(Mi);return{directionRadians:t.map(Mi),altitudeRadians:p,shadowColor:l,highlightColor:s}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}let Qh;var Vd={get paint(){return Qh=Qh||new pi({"color-relief-opacity":new De(J["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new Fs(J["paint_color-relief"]["color-relief-color"])})}};class ih{constructor(t,r,s,l){this.context=t,this.format=s,this.texture=t.gl.createTexture(),this.update(r,l)}update(t,r,s){const{width:l,height:d}=t,p=!(this.size&&this.size[0]===l&&this.size[1]===d||s),{context:m}=this,{gl:g}=m;if(this.useMipmap=!!(r&&r.useMipmap),g.bindTexture(g.TEXTURE_2D,this.texture),m.pixelStoreUnpackFlipY.set(!1),m.pixelStoreUnpack.set(1),m.pixelStoreUnpackPremultiplyAlpha.set(this.format===g.RGBA&&(!r||r.premultiply!==!1)),p)this.size=[l,d],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||Ar(t)?g.texImage2D(g.TEXTURE_2D,0,this.format,this.format,g.UNSIGNED_BYTE,t):g.texImage2D(g.TEXTURE_2D,0,this.format,l,d,0,this.format,g.UNSIGNED_BYTE,t.data);else{const{x,y:b}=s||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||Ar(t)?g.texSubImage2D(g.TEXTURE_2D,0,x,b,g.RGBA,g.UNSIGNED_BYTE,t):g.texSubImage2D(g.TEXTURE_2D,0,x,b,l,d,g.RGBA,g.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&g.generateMipmap(g.TEXTURE_2D),m.pixelStoreUnpackFlipY.setDefault(),m.pixelStoreUnpack.setDefault(),m.pixelStoreUnpackPremultiplyAlpha.setDefault()}bind(t,r,s){const{context:l}=this,{gl:d}=l;d.bindTexture(d.TEXTURE_2D,this.texture),s!==d.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(s=d.LINEAR),t!==this.filter&&(d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,t),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,s||t),this.filter=t),r!==this.wrap&&(d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,r),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,r),this.wrap=r)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}class eu{constructor(t,r,s,l=1,d=1,p=1,m=0){if(this.uid=t,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(s&&!["mapbox","terrarium","custom"].includes(s))return void Yt(`"${s}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=r.height;const g=this.dim=r.height-2;switch(this.data=new Uint32Array(r.data.buffer),s){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=l,this.greenFactor=d,this.blueFactor=p,this.baseShift=m;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let x=0;x<g;x++)this.data[this._idx(-1,x)]=this.data[this._idx(0,x)],this.data[this._idx(g,x)]=this.data[this._idx(g-1,x)],this.data[this._idx(x,-1)]=this.data[this._idx(x,0)],this.data[this._idx(x,g)]=this.data[this._idx(x,g-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(g,-1)]=this.data[this._idx(g-1,0)],this.data[this._idx(-1,g)]=this.data[this._idx(0,g-1)],this.data[this._idx(g,g)]=this.data[this._idx(g-1,g-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let x=0;x<g;x++)for(let b=0;b<g;b++){const T=this.get(x,b);T>this.max&&(this.max=T),T<this.min&&(this.min=T)}}get(t,r){const s=new Uint8Array(this.data.buffer),l=4*this._idx(t,r);return this.unpack(s[l],s[l+1],s[l+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,r){if(t<-1||t>=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(t+1)}unpack(t,r,s){return t*this.redFactor+r*this.greenFactor+s*this.blueFactor-this.baseShift}pack(t){return tu(t,this.getUnpackVector())}getPixels(){return new Ei({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,r,s){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let l=r*this.dim,d=r*this.dim+this.dim,p=s*this.dim,m=s*this.dim+this.dim;switch(r){case-1:l=d-1;break;case 1:d=l+1}switch(s){case-1:p=m-1;break;case 1:m=p+1}const g=-r*this.dim,x=-s*this.dim;for(let b=p;b<m;b++)for(let T=l;T<d;T++)this.data[this._idx(T,b)]=t.data[this._idx(T+g,b+x)]}}function tu(n,t){const r=t[0],s=t[1],l=t[2],d=t[3],p=Math.min(r,s,l),m=Math.round((n+d)/p);return{r:Math.floor(m*p/r)%256,g:Math.floor(m*p/s)%256,b:Math.floor(m*p/l)%256}}Ae("DEMData",eu);class Nd extends Jt{constructor(t){super(t,Vd)}_createColorRamp(t){const r={elevationStops:[],colorStops:[]},s=this._transitionablePaint._values["color-relief-color"].value.expression;if(s instanceof Ms&&s._styleExpression.expression instanceof ui){this.colorRampExpression=s;const p=s._styleExpression.expression;r.elevationStops=p.labels,r.colorStops=[];for(const m of r.elevationStops)r.colorStops.push(p.evaluate({globals:{elevation:m}}))}if(r.elevationStops.length<1&&(r.elevationStops=[0],r.colorStops=[Je.transparent]),r.elevationStops.length<2&&(r.elevationStops.push(r.elevationStops[0]+1),r.colorStops.push(r.colorStops[0])),r.elevationStops.length<=t)return r;const l={elevationStops:[],colorStops:[]},d=(r.elevationStops.length-1)/(t-1);for(let p=0;p<r.elevationStops.length-.5;p+=d)l.elevationStops.push(r.elevationStops[Math.round(p)]),l.colorStops.push(r.colorStops[Math.round(p)]);return Yt(`Too many colors in specification of ${this.id} color-relief layer, may not render properly.`),l}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(t,r,s){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;const l=this._createColorRamp(r),d=new Ei({width:l.colorStops.length,height:1}),p=new Ei({width:l.colorStops.length,height:1});for(let m=0;m<l.elevationStops.length;m++){const g=tu(l.elevationStops[m],s);p.setPixel(0,m,new Je(g.r/255,g.g/255,g.b/255,1)),d.setPixel(0,m,l.colorStops[m])}return this.colorRampTextures={elevationTexture:new ih(t,p,t.gl.RGBA),colorTexture:new ih(t,d,t.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return this.visibility!=="none"&&!!this.colorRampTextures}}const Ud=Ct([{name:"a_pos",components:2,type:"Int16"}],4),{members:$d}=Ud;function rh(n,t,r){const s=r.patternDependencies;let l=!1;for(const d of t){const p=d.paint.get(`${n}-pattern`);p.isConstant()||(l=!0);const m=p.constantOr(null);m&&(l=!0,s[m.to]=!0,s[m.from]=!0)}return l}function nh(n,t,r,s,l){const d=l.patternDependencies;for(const p of t){const m=p.paint.get(`${n}-pattern`).value;if(m.kind!=="constant"){let g=m.evaluate({zoom:s-1},r,{},l.availableImages),x=m.evaluate({zoom:s},r,{},l.availableImages),b=m.evaluate({zoom:s+1},r,{},l.availableImages);g=g&&g.name?g.name:g,x=x&&x.name?x.name:x,b=b&&b.name?b.name:b,d[g]=!0,d[x]=!0,d[b]=!0,r.patterns[p.id]={min:g,mid:x,max:b}}}return r}function iu(n,t,r,s,l){let d;if(l===function(p,m,g,x){let b=0;for(let T=m,M=g-x;T<g;T+=x)b+=(p[M]-p[T])*(p[T+1]+p[M+1]),M=T;return b}(n,t,r,s)>0)for(let p=t;p<r;p+=s)d=au(p/s|0,n[p],n[p+1],d);else for(let p=r-s;p>=t;p-=s)d=au(p/s|0,n[p],n[p+1],d);return d&&ja(d,d.next)&&(Qo(d),d=d.next),d}function Gs(n,t){if(!n)return n;t||(t=n);let r,s=n;do if(r=!1,s.steiner||!ja(s,s.next)&&kt(s.prev,s,s.next)!==0)s=s.next;else{if(Qo(s),s=t=s.prev,s===s.next)break;r=!0}while(r||s!==t);return t}function Yo(n,t,r,s,l,d,p){if(!n)return;!p&&d&&function(g,x,b,T){let M=g;do M.z===0&&(M.z=sh(M.x,M.y,x,b,T)),M.prevZ=M.prev,M.nextZ=M.next,M=M.next;while(M!==g);M.prevZ.nextZ=null,M.prevZ=null,function(A){let E,D=1;do{let F,U=A;A=null;let ee=null;for(E=0;U;){E++;let W=U,C=0;for(let X=0;X<D&&(C++,W=W.nextZ,W);X++);let B=D;for(;C>0||B>0&&W;)C!==0&&(B===0||!W||U.z<=W.z)?(F=U,U=U.nextZ,C--):(F=W,W=W.nextZ,B--),ee?ee.nextZ=F:A=F,F.prevZ=ee,ee=F;U=W}ee.nextZ=null,D*=2}while(E>1)}(M)}(n,s,l,d);let m=n;for(;n.prev!==n.next;){const g=n.prev,x=n.next;if(d?Gd(n,s,l,d):Zd(n))t.push(g.i,n.i,x.i),Qo(n),n=x.next,m=x.next;else if((n=x)===m){p?p===1?Yo(n=qd(Gs(n),t),t,r,s,l,d,2):p===2&&Wd(n,t,r,s,l,d):Yo(Gs(n),t,r,s,l,d,1);break}}}function Zd(n){const t=n.prev,r=n,s=n.next;if(kt(t,r,s)>=0)return!1;const l=t.x,d=r.x,p=s.x,m=t.y,g=r.y,x=s.y,b=Math.min(l,d,p),T=Math.min(m,g,x),M=Math.max(l,d,p),A=Math.max(m,g,x);let E=s.next;for(;E!==t;){if(E.x>=b&&E.x<=M&&E.y>=T&&E.y<=A&&Ko(l,m,d,g,p,x,E.x,E.y)&&kt(E.prev,E,E.next)>=0)return!1;E=E.next}return!0}function Gd(n,t,r,s){const l=n.prev,d=n,p=n.next;if(kt(l,d,p)>=0)return!1;const m=l.x,g=d.x,x=p.x,b=l.y,T=d.y,M=p.y,A=Math.min(m,g,x),E=Math.min(b,T,M),D=Math.max(m,g,x),F=Math.max(b,T,M),U=sh(A,E,t,r,s),ee=sh(D,F,t,r,s);let W=n.prevZ,C=n.nextZ;for(;W&&W.z>=U&&C&&C.z<=ee;){if(W.x>=A&&W.x<=D&&W.y>=E&&W.y<=F&&W!==l&&W!==p&&Ko(m,b,g,T,x,M,W.x,W.y)&&kt(W.prev,W,W.next)>=0||(W=W.prevZ,C.x>=A&&C.x<=D&&C.y>=E&&C.y<=F&&C!==l&&C!==p&&Ko(m,b,g,T,x,M,C.x,C.y)&&kt(C.prev,C,C.next)>=0))return!1;C=C.nextZ}for(;W&&W.z>=U;){if(W.x>=A&&W.x<=D&&W.y>=E&&W.y<=F&&W!==l&&W!==p&&Ko(m,b,g,T,x,M,W.x,W.y)&&kt(W.prev,W,W.next)>=0)return!1;W=W.prevZ}for(;C&&C.z<=ee;){if(C.x>=A&&C.x<=D&&C.y>=E&&C.y<=F&&C!==l&&C!==p&&Ko(m,b,g,T,x,M,C.x,C.y)&&kt(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function qd(n,t){let r=n;do{const s=r.prev,l=r.next.next;!ja(s,l)&&nu(s,r,r.next,l)&&Jo(s,l)&&Jo(l,s)&&(t.push(s.i,r.i,l.i),Qo(r),Qo(r.next),r=n=l),r=r.next}while(r!==n);return Gs(r)}function Wd(n,t,r,s,l,d){let p=n;do{let m=p.next.next;for(;m!==p.prev;){if(p.i!==m.i&&Jd(p,m)){let g=su(p,m);return p=Gs(p,p.next),g=Gs(g,g.next),Yo(p,t,r,s,l,d,0),void Yo(g,t,r,s,l,d,0)}m=m.next}p=p.next}while(p!==n)}function Hd(n,t){let r=n.x-t.x;return r===0&&(r=n.y-t.y,r===0)&&(r=(n.next.y-n.y)/(n.next.x-n.x)-(t.next.y-t.y)/(t.next.x-t.x)),r}function Xd(n,t){const r=function(l,d){let p=d;const m=l.x,g=l.y;let x,b=-1/0;if(ja(l,p))return p;do{if(ja(l,p.next))return p.next;if(g<=p.y&&g>=p.next.y&&p.next.y!==p.y){const D=p.x+(g-p.y)*(p.next.x-p.x)/(p.next.y-p.y);if(D<=m&&D>b&&(b=D,x=p.x<p.next.x?p:p.next,D===m))return x}p=p.next}while(p!==d);if(!x)return null;const T=x,M=x.x,A=x.y;let E=1/0;p=x;do{if(m>=p.x&&p.x>=M&&m!==p.x&&ru(g<A?m:b,g,M,A,g<A?b:m,g,p.x,p.y)){const D=Math.abs(g-p.y)/(m-p.x);Jo(p,l)&&(D<E||D===E&&(p.x>x.x||p.x===x.x&&Yd(x,p)))&&(x=p,E=D)}p=p.next}while(p!==T);return x}(n,t);if(!r)return t;const s=su(r,n);return Gs(s,s.next),Gs(r,r.next)}function Yd(n,t){return kt(n.prev,n,t.prev)<0&&kt(t.next,n,n.next)<0}function sh(n,t,r,s,l){return(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=(n-r)*l|0)|n<<8))|n<<4))|n<<2))|n<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-s)*l|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Kd(n){let t=n,r=n;do(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next;while(t!==n);return r}function ru(n,t,r,s,l,d,p,m){return(l-p)*(t-m)>=(n-p)*(d-m)&&(n-p)*(s-m)>=(r-p)*(t-m)&&(r-p)*(d-m)>=(l-p)*(s-m)}function Ko(n,t,r,s,l,d,p,m){return!(n===p&&t===m)&&ru(n,t,r,s,l,d,p,m)}function Jd(n,t){return n.next.i!==t.i&&n.prev.i!==t.i&&!function(r,s){let l=r;do{if(l.i!==r.i&&l.next.i!==r.i&&l.i!==s.i&&l.next.i!==s.i&&nu(l,l.next,r,s))return!0;l=l.next}while(l!==r);return!1}(n,t)&&(Jo(n,t)&&Jo(t,n)&&function(r,s){let l=r,d=!1;const p=(r.x+s.x)/2,m=(r.y+s.y)/2;do l.y>m!=l.next.y>m&&l.next.y!==l.y&&p<(l.next.x-l.x)*(m-l.y)/(l.next.y-l.y)+l.x&&(d=!d),l=l.next;while(l!==r);return d}(n,t)&&(kt(n.prev,n,t.prev)||kt(n,t.prev,t))||ja(n,t)&&kt(n.prev,n,n.next)>0&&kt(t.prev,t,t.next)>0)}function kt(n,t,r){return(t.y-n.y)*(r.x-t.x)-(t.x-n.x)*(r.y-t.y)}function ja(n,t){return n.x===t.x&&n.y===t.y}function nu(n,t,r,s){const l=oc(kt(n,t,r)),d=oc(kt(n,t,s)),p=oc(kt(r,s,n)),m=oc(kt(r,s,t));return l!==d&&p!==m||!(l!==0||!ac(n,r,t))||!(d!==0||!ac(n,s,t))||!(p!==0||!ac(r,n,s))||!(m!==0||!ac(r,t,s))}function ac(n,t,r){return t.x<=Math.max(n.x,r.x)&&t.x>=Math.min(n.x,r.x)&&t.y<=Math.max(n.y,r.y)&&t.y>=Math.min(n.y,r.y)}function oc(n){return n>0?1:n<0?-1:0}function Jo(n,t){return kt(n.prev,n,n.next)<0?kt(n,t,n.next)>=0&&kt(n,n.prev,t)>=0:kt(n,t,n.prev)<0||kt(n,n.next,t)<0}function su(n,t){const r=ah(n.i,n.x,n.y),s=ah(t.i,t.x,t.y),l=n.next,d=t.prev;return n.next=t,t.prev=n,r.next=l,l.prev=r,s.next=r,r.prev=s,d.next=s,s.prev=d,s}function au(n,t,r,s){const l=ah(n,t,r);return s?(l.next=s.next,l.prev=s,s.next.prev=l,s.next=l):(l.prev=l,l.next=l),l}function Qo(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function ah(n,t,r){return{i:n,x:t,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class Va{constructor(t,r){if(r>t)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=t,this._minGranularity=r}getGranularityForZoomLevel(t){return Math.max(Math.floor(this._baseZoomGranularity/(1<<t)),this._minGranularity,1)}}class lc{constructor(t){this.fill=t.fill,this.line=t.line,this.tile=t.tile,this.stencil=t.stencil,this.circle=t.circle}}lc.noSubdivision=new lc({fill:new Va(0,0),line:new Va(0,0),tile:new Va(0,0),stencil:new Va(0,0),circle:1}),Ae("SubdivisionGranularityExpression",Va),Ae("SubdivisionGranularitySetting",lc);const Na=-32768,el=32767;class Qd{constructor(t,r){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=t,this._granularityCellSize=ct/t,this._canonical=r}_getKey(t,r){return(t+=32768)<<16|r+32768}_vertexToIndex(t,r){if(t<-32768||r<-32768||t>32767||r>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");const s=0|Math.round(t),l=0|Math.round(r),d=this._getKey(s,l);if(this._vertexDictionary.has(d))return this._vertexDictionary.get(d);const p=this._vertexBuffer.length/2;return this._vertexDictionary.set(d,p),this._vertexBuffer.push(s,l),p}_subdivideTrianglesScanline(t){if(this._granularity<2)return function(l,d){const p=[];for(let m=0;m<d.length;m+=3){const g=d[m],x=d[m+1],b=d[m+2],T=l[2*g],M=l[2*g+1];(l[2*x]-T)*(l[2*b+1]-M)-(l[2*x+1]-M)*(l[2*b]-T)>0?(p.push(g),p.push(b),p.push(x)):(p.push(g),p.push(x),p.push(b))}return p}(this._vertexBuffer,t);const r=[],s=t.length;for(let l=0;l<s;l+=3){const d=[t[l+0],t[l+1],t[l+2]],p=[this._vertexBuffer[2*t[l+0]+0],this._vertexBuffer[2*t[l+0]+1],this._vertexBuffer[2*t[l+1]+0],this._vertexBuffer[2*t[l+1]+1],this._vertexBuffer[2*t[l+2]+0],this._vertexBuffer[2*t[l+2]+1]];let m=1/0,g=1/0,x=-1/0,b=-1/0;for(let D=0;D<3;D++){const F=p[2*D],U=p[2*D+1];m=Math.min(m,F),x=Math.max(x,F),g=Math.min(g,U),b=Math.max(b,U)}if(m===x||g===b)continue;const T=Math.floor(m/this._granularityCellSize),M=Math.ceil(x/this._granularityCellSize),A=Math.floor(g/this._granularityCellSize),E=Math.ceil(b/this._granularityCellSize);if(T!==M||A!==E)for(let D=A;D<E;D++){const F=this._scanlineGenerateVertexRingForCellRow(D,p,d);ep(this._vertexBuffer,F,r)}else r.push(...d)}return r}_scanlineGenerateVertexRingForCellRow(t,r,s){const l=t*this._granularityCellSize,d=l+this._granularityCellSize,p=[];for(let m=0;m<3;m++){const g=r[2*m],x=r[2*m+1],b=r[2*(m+1)%6],T=r[(2*(m+1)+1)%6],M=r[2*(m+2)%6],A=r[(2*(m+2)+1)%6],E=b-g,D=T-x,F=E===0,U=D===0,ee=(l-x)/D,W=(d-x)/D,C=Math.min(ee,W),B=Math.max(ee,W);if(!U&&(C>=1||B<=0)||U&&(x<l||x>d)){T>=l&&T<=d&&p.push(s[(m+1)%3]);continue}!U&&C>0&&p.push(this._vertexToIndex(g+E*C,x+D*C));const X=g+E*Math.max(C,0),le=g+E*Math.min(B,1);F||this._generateIntraEdgeVertices(p,g,x,b,T,X,le),!U&&B<1&&p.push(this._vertexToIndex(g+E*B,x+D*B)),(U||T>=l&&T<=d)&&p.push(s[(m+1)%3]),!U&&(T<=l||T>=d)&&this._generateInterEdgeVertices(p,g,x,b,T,M,A,le,l,d)}return p}_generateIntraEdgeVertices(t,r,s,l,d,p,m){const g=l-r,x=d-s,b=x===0,T=b?Math.min(r,l):Math.min(p,m),M=b?Math.max(r,l):Math.max(p,m),A=Math.floor(T/this._granularityCellSize)+1,E=Math.ceil(M/this._granularityCellSize)-1;if(b?r<l:p<m)for(let D=A;D<=E;D++){const F=D*this._granularityCellSize;t.push(this._vertexToIndex(F,s+x*(F-r)/g))}else for(let D=E;D>=A;D--){const F=D*this._granularityCellSize;t.push(this._vertexToIndex(F,s+x*(F-r)/g))}}_generateInterEdgeVertices(t,r,s,l,d,p,m,g,x,b){const T=d-s,M=p-l,A=m-d,E=(x-d)/A,D=(b-d)/A,F=Math.min(E,D),U=Math.max(E,D),ee=l+M*F;let W=Math.floor(Math.min(ee,g)/this._granularityCellSize)+1,C=Math.ceil(Math.max(ee,g)/this._granularityCellSize)-1,B=g<ee;const X=A===0;if(X&&(m===x||m===b))return;if(X||F>=1||U<=0){const xe=s-m,de=p+(r-p)*Math.min((x-m)/xe,(b-m)/xe);W=Math.floor(Math.min(de,g)/this._granularityCellSize)+1,C=Math.ceil(Math.max(de,g)/this._granularityCellSize)-1,B=g<de}const le=T>0?b:x;if(B)for(let xe=W;xe<=C;xe++)t.push(this._vertexToIndex(xe*this._granularityCellSize,le));else for(let xe=C;xe>=W;xe--)t.push(this._vertexToIndex(xe*this._granularityCellSize,le))}_generateOutline(t){const r=[];for(const s of t){const l=qs(s,this._granularity,!0),d=this._pointArrayToIndices(l),p=[];for(let m=1;m<d.length;m++)p.push(d[m-1]),p.push(d[m]);r.push(p)}return r}_handlePoles(t){let r=!1,s=!1;this._canonical&&(this._canonical.y===0&&(r=!0),this._canonical.y===(1<<this._canonical.z)-1&&(s=!0)),(r||s)&&this._fillPoles(t,r,s)}_ensureNoPoleVertices(){const t=this._vertexBuffer;for(let r=0;r<t.length;r+=2){const s=t[r+1];s===Na&&(t[r+1]=-32767),s===el&&(t[r+1]=32766)}}_generatePoleQuad(t,r,s,l,d,p){l>d!=(p===Na)?(t.push(r),t.push(s),t.push(this._vertexToIndex(l,p)),t.push(s),t.push(this._vertexToIndex(d,p)),t.push(this._vertexToIndex(l,p))):(t.push(s),t.push(r),t.push(this._vertexToIndex(l,p)),t.push(this._vertexToIndex(d,p)),t.push(s),t.push(this._vertexToIndex(l,p)))}_fillPoles(t,r,s){const l=this._vertexBuffer,d=ct,p=t.length;for(let m=2;m<p;m+=3){const g=t[m-2],x=t[m-1],b=t[m],T=l[2*g],M=l[2*g+1],A=l[2*x],E=l[2*x+1],D=l[2*b],F=l[2*b+1];r&&(M===0&&E===0&&this._generatePoleQuad(t,g,x,T,A,Na),E===0&&F===0&&this._generatePoleQuad(t,x,b,A,D,Na),F===0&&M===0&&this._generatePoleQuad(t,b,g,D,T,Na)),s&&(M===d&&E===d&&this._generatePoleQuad(t,g,x,T,A,el),E===d&&F===d&&this._generatePoleQuad(t,x,b,A,D,el),F===d&&M===d&&this._generatePoleQuad(t,b,g,D,T,el))}}_initializeVertices(t){for(let r=0;r<t.length;r+=2)this._vertexToIndex(t[r],t[r+1])}subdividePolygonInternal(t,r){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;const{flattened:s,holeIndices:l}=function(m){const g=[],x=[];for(const b of m)if(b.length!==0){b!==m[0]&&g.push(x.length/2);for(let T=0;T<b.length;T++)x.push(b[T].x),x.push(b[T].y)}return{flattened:x,holeIndices:g}}(t);let d;this._initializeVertices(s);try{const m=function(x,b,T=2){const M=b&&b.length,A=M?b[0]*T:x.length;let E=iu(x,0,A,T,!0);const D=[];if(!E||E.next===E.prev)return D;let F,U,ee;if(M&&(E=function(W,C,B,X){const le=[];for(let xe=0,de=C.length;xe<de;xe++){const me=iu(W,C[xe]*X,xe<de-1?C[xe+1]*X:W.length,X,!1);me===me.next&&(me.steiner=!0),le.push(Kd(me))}le.sort(Hd);for(let xe=0;xe<le.length;xe++)B=Xd(le[xe],B);return B}(x,b,E,T)),x.length>80*T){F=1/0,U=1/0;let W=-1/0,C=-1/0;for(let B=T;B<A;B+=T){const X=x[B],le=x[B+1];X<F&&(F=X),le<U&&(U=le),X>W&&(W=X),le>C&&(C=le)}ee=Math.max(W-F,C-U),ee=ee!==0?32767/ee:0}return Yo(E,D,T,F,U,ee,0),D}(s,l),g=this._convertIndices(s,m);d=this._subdivideTrianglesScanline(g)}catch(m){console.error(m)}let p=[];return r&&(p=this._generateOutline(t)),this._ensureNoPoleVertices(),this._handlePoles(d),{verticesFlattened:this._vertexBuffer,indicesTriangles:d,indicesLineList:p}}_convertIndices(t,r){const s=[];for(let l=0;l<r.length;l++)s.push(this._vertexToIndex(t[2*r[l]],t[2*r[l]+1]));return s}_pointArrayToIndices(t){const r=[];for(let s=0;s<t.length;s++){const l=t[s];r.push(this._vertexToIndex(l.x,l.y))}return r}}function ou(n,t,r,s=!0){return new Qd(r,t).subdividePolygonInternal(n,s)}function qs(n,t,r=!1){if(!n||n.length<1)return[];if(n.length<2)return[];const s=n[0],l=n[n.length-1],d=r&&(s.x!==l.x||s.y!==l.y);if(t<2)return d?[...n,n[0]]:[...n];const p=Math.floor(ct/t),m=[];m.push(new Le(n[0].x,n[0].y));const g=n.length,x=d?g:g-1;for(let b=0;b<x;b++){const T=n[b],M=b<g-1?n[b+1]:n[0],A=T.x,E=T.y,D=M.x,F=M.y,U=A!==D,ee=E!==F;if(!U&&!ee)continue;const W=D-A,C=F-E,B=Math.abs(W),X=Math.abs(C);let le=A,xe=E;for(;;){const me=W>0?(Math.floor(le/p)+1)*p:(Math.ceil(le/p)-1)*p,we=C>0?(Math.floor(xe/p)+1)*p:(Math.ceil(xe/p)-1)*p,be=Math.abs(le-me),Te=Math.abs(xe-we),ge=Math.abs(le-D),ke=Math.abs(xe-F),Oe=U?be/B:Number.POSITIVE_INFINITY,Fe=ee?Te/X:Number.POSITIVE_INFINITY;if((ge<=be||!U)&&(ke<=Te||!ee))break;if(Oe<Fe&&U||!ee){le=me,xe+=C*Oe;const Re=new Le(le,Math.round(xe));m[m.length-1].x===Re.x&&m[m.length-1].y===Re.y||m.push(Re)}else{le+=W*Fe,xe=we;const Re=new Le(Math.round(le),xe);m[m.length-1].x===Re.x&&m[m.length-1].y===Re.y||m.push(Re)}}const de=new Le(D,F);m[m.length-1].x===de.x&&m[m.length-1].y===de.y||m.push(de)}return m}function ep(n,t,r){if(t.length===0)throw new Error("Subdivision vertex ring is empty.");let s=0,l=n[2*t[0]];for(let g=1;g<t.length;g++){const x=n[2*t[g]];x<l&&(l=x,s=g)}const d=t.length;let p=s,m=(p+1)%d;for(;;){const g=p-1>=0?p-1:d-1,x=(m+1)%d,b=n[2*t[g]],T=n[2*t[x]],M=n[2*t[p]],A=n[2*t[p]+1],E=n[2*t[m]+1];let D=!1;if(b<T)D=!0;else if(b>T)D=!1;else{const F=E-A,U=-(n[2*t[m]]-M),ee=A<E?1:-1;((b-M)*F+(n[2*t[g]+1]-A)*U)*ee>((T-M)*F+(n[2*t[x]+1]-A)*U)*ee&&(D=!0)}if(D){const F=t[g],U=t[p],ee=t[m];F!==U&&F!==ee&&U!==ee&&r.push(ee,U,F),p--,p<0&&(p=d-1)}else{const F=t[x],U=t[p],ee=t[m];F!==U&&F!==ee&&U!==ee&&r.push(ee,U,F),m++,m>=d&&(m=0)}if(g===x)break}}function lu(n,t,r,s,l,d,p,m,g){const x=l.length/2,b=p&&m&&g;if(x<nt.MAX_VERTEX_ARRAY_LENGTH){const T=t.prepareSegment(x,r,s),M=T.vertexLength;for(let D=0;D<d.length;D+=3)s.emplaceBack(M+d[D],M+d[D+1],M+d[D+2]);let A,E;T.vertexLength+=x,T.primitiveLength+=d.length/3,b&&(E=p.prepareSegment(x,r,m),A=E.vertexLength,E.vertexLength+=x);for(let D=0;D<l.length;D+=2)n(l[D],l[D+1]);if(b)for(let D=0;D<g.length;D++){const F=g[D];for(let U=1;U<F.length;U+=2)m.emplaceBack(A+F[U-1],A+F[U]);E.primitiveLength+=F.length/2}}else(function(T,M,A,E,D,F){const U=[];for(let X=0;X<E.length/2;X++)U.push(-1);const ee={count:0};let W=0,C=T.getOrCreateLatestSegment(M,A),B=C.vertexLength;for(let X=2;X<D.length;X+=3){const le=D[X-2],xe=D[X-1],de=D[X];let me=U[le]<W,we=U[xe]<W,be=U[de]<W;C.vertexLength+((me?1:0)+(we?1:0)+(be?1:0))>nt.MAX_VERTEX_ARRAY_LENGTH&&(C=T.createNewSegment(M,A),W=ee.count,me=!0,we=!0,be=!0,B=0);const Te=tl(U,E,F,ee,le,me,C),ge=tl(U,E,F,ee,xe,we,C),ke=tl(U,E,F,ee,de,be,C);A.emplaceBack(B+Te-W,B+ge-W,B+ke-W),C.primitiveLength++}})(t,r,s,l,d,n),b&&function(T,M,A,E,D,F){const U=[];for(let X=0;X<E.length/2;X++)U.push(-1);const ee={count:0};let W=0,C=T.getOrCreateLatestSegment(M,A),B=C.vertexLength;for(let X=0;X<D.length;X++){const le=D[X];for(let xe=1;xe<D[X].length;xe+=2){const de=le[xe-1],me=le[xe];let we=U[de]<W,be=U[me]<W;C.vertexLength+((we?1:0)+(be?1:0))>nt.MAX_VERTEX_ARRAY_LENGTH&&(C=T.createNewSegment(M,A),W=ee.count,we=!0,be=!0,B=0);const Te=tl(U,E,F,ee,de,we,C),ge=tl(U,E,F,ee,me,be,C);A.emplaceBack(B+Te-W,B+ge-W),C.primitiveLength++}}}(p,r,m,l,g,n),t.forceNewSegmentOnNextPrepare(),p?.forceNewSegmentOnNextPrepare()}function tl(n,t,r,s,l,d,p){if(d){const m=s.count;return r(t[2*l],t[2*l+1]),n[l]=s.count,s.count++,p.vertexLength++,m}return n[l]}class oh{constructor(t){this.zoom=t.zoom,this.globalState=t.globalState,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new ue,this.indexArray=new dt,this.indexArray2=new ut,this.programConfigurations=new Ur(t.layers,t.zoom),this.segments=new nt,this.segments2=new nt,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,s){this.hasPattern=rh("fill",this.layers,r);const l=this.layers[0].layout.get("fill-sort-key"),d=!l.isConstant(),p=[];for(const{feature:m,id:g,index:x,sourceLayerIndex:b}of t){const T=this.layers[0]._featureFilter.needGeometry,M=Zs(m,T);if(!this.layers[0]._featureFilter.filter(new gt(this.zoom,{globalState:this.globalState}),M,s))continue;const A=d?l.evaluate(M,{},s,r.availableImages):void 0,E={id:g,properties:m.properties,type:m.type,sourceLayerIndex:b,index:x,geometry:T?M.geometry:$s(m),patterns:{},sortKey:A};p.push(E)}d&&p.sort((m,g)=>m.sortKey-g.sortKey);for(const m of p){const{geometry:g,index:x,sourceLayerIndex:b}=m;if(this.hasPattern){const T=nh("fill",this.layers,m,this.zoom,r);this.patternFeatures.push(T)}else this.addFeature(m,g,x,s,{},r.subdivisionGranularity);r.featureIndex.insert(t[x].feature,g,x,b,this.index)}}update(t,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,s)}addFeatures(t,r,s){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,s,t.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,$d),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,r,s,l,d,p){for(const m of da(r,500)){const g=ou(m,l,p.fill.getGranularityForZoomLevel(l.z)),x=this.layoutVertexArray;lu((b,T)=>{x.emplaceBack(b,T)},this.segments,this.layoutVertexArray,this.indexArray,g.verticesFlattened,g.indicesTriangles,this.segments2,this.indexArray2,g.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,s,d,l)}}let cu,hu;Ae("FillBucket",oh,{omit:["layers","patternFeatures"]});var tp={get paint(){return hu=hu||new pi({"fill-antialias":new De(J.paint_fill["fill-antialias"]),"fill-opacity":new je(J.paint_fill["fill-opacity"]),"fill-color":new je(J.paint_fill["fill-color"]),"fill-outline-color":new je(J.paint_fill["fill-outline-color"]),"fill-translate":new De(J.paint_fill["fill-translate"]),"fill-translate-anchor":new De(J.paint_fill["fill-translate-anchor"]),"fill-pattern":new La(J.paint_fill["fill-pattern"])})},get layout(){return cu=cu||new pi({"fill-sort-key":new je(J.layout_fill["fill-sort-key"])})}};class ip extends Jt{constructor(t){super(t,tp)}recalculate(t,r){super.recalculate(t,r);const s=this.paint._values["fill-outline-color"];s.value.kind==="constant"&&s.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new oh(t)}queryRadius(){return nc(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:t,geometry:r,transform:s,pixelsToTileUnits:l}){return Uh(sc(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-s.bearingInRadians,l),r)}isTileClipped(){return!0}}const rp=Ct([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),np=Ct([{name:"a_centroid",components:2,type:"Int16"}],4),{members:sp}=rp;var lh,uu,ch,du,hh,pu,fu,cc={};function mu(){if(uu)return lh;uu=1;var n=Sr();function t(l,d,p,m,g){this.properties={},this.extent=p,this.type=0,this._pbf=l,this._geometry=-1,this._keys=m,this._values=g,l.readFields(r,this,d)}function r(l,d,p){l==1?d.id=p.readVarint():l==2?function(m,g){for(var x=m.readVarint()+m.pos;m.pos<x;){var b=g._keys[m.readVarint()],T=g._values[m.readVarint()];g.properties[b]=T}}(p,d):l==3?d.type=p.readVarint():l==4&&(d._geometry=p.pos)}function s(l){for(var d,p,m=0,g=0,x=l.length,b=x-1;g<x;b=g++)m+=((p=l[b]).x-(d=l[g]).x)*(d.y+p.y);return m}return lh=t,t.types=["Unknown","Point","LineString","Polygon"],t.prototype.loadGeometry=function(){var l=this._pbf;l.pos=this._geometry;for(var d,p=l.readVarint()+l.pos,m=1,g=0,x=0,b=0,T=[];l.pos<p;){if(g<=0){var M=l.readVarint();m=7&M,g=M>>3}if(g--,m===1||m===2)x+=l.readSVarint(),b+=l.readSVarint(),m===1&&(d&&T.push(d),d=[]),d.push(new n(x,b));else{if(m!==7)throw new Error("unknown command "+m);d&&d.push(d[0].clone())}}return d&&T.push(d),T},t.prototype.bbox=function(){var l=this._pbf;l.pos=this._geometry;for(var d=l.readVarint()+l.pos,p=1,m=0,g=0,x=0,b=1/0,T=-1/0,M=1/0,A=-1/0;l.pos<d;){if(m<=0){var E=l.readVarint();p=7&E,m=E>>3}if(m--,p===1||p===2)(g+=l.readSVarint())<b&&(b=g),g>T&&(T=g),(x+=l.readSVarint())<M&&(M=x),x>A&&(A=x);else if(p!==7)throw new Error("unknown command "+p)}return[b,M,T,A]},t.prototype.toGeoJSON=function(l,d,p){var m,g,x=this.extent*Math.pow(2,p),b=this.extent*l,T=this.extent*d,M=this.loadGeometry(),A=t.types[this.type];function E(U){for(var ee=0;ee<U.length;ee++){var W=U[ee];U[ee]=[360*(W.x+b)/x-180,360/Math.PI*Math.atan(Math.exp((180-360*(W.y+T)/x)*Math.PI/180))-90]}}switch(this.type){case 1:var D=[];for(m=0;m<M.length;m++)D[m]=M[m][0];E(M=D);break;case 2:for(m=0;m<M.length;m++)E(M[m]);break;case 3:for(M=function(U){var ee=U.length;if(ee<=1)return[U];for(var W,C,B=[],X=0;X<ee;X++){var le=s(U[X]);le!==0&&(C===void 0&&(C=le<0),C===le<0?(W&&B.push(W),W=[U[X]]):W.push(U[X]))}return W&&B.push(W),B}(M),m=0;m<M.length;m++)for(g=0;g<M[m].length;g++)E(M[m][g])}M.length===1?M=M[0]:A="Multi"+A;var F={type:"Feature",geometry:{type:A,coordinates:M},properties:this.properties};return"id"in this&&(F.id=this.id),F},lh}function _u(){if(du)return ch;du=1;var n=mu();function t(s,l){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=s,this._keys=[],this._values=[],this._features=[],s.readFields(r,this,l),this.length=this._features.length}function r(s,l,d){s===15?l.version=d.readVarint():s===1?l.name=d.readString():s===5?l.extent=d.readVarint():s===2?l._features.push(d.pos):s===3?l._keys.push(d.readString()):s===4&&l._values.push(function(p){for(var m=null,g=p.readVarint()+p.pos;p.pos<g;){var x=p.readVarint()>>3;m=x===1?p.readString():x===2?p.readFloat():x===3?p.readDouble():x===4?p.readVarint64():x===5?p.readVarint():x===6?p.readSVarint():x===7?p.readBoolean():null}return m}(d))}return ch=t,t.prototype.feature=function(s){if(s<0||s>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[s];var l=this._pbf.readVarint()+this._pbf.pos;return new n(this._pbf,l,this.extent,this._keys,this._values)},ch}function gu(){return fu||(fu=1,cc.VectorTile=function(){if(pu)return hh;pu=1;var n=_u();function t(r,s,l){if(r===3){var d=new n(l,l.readVarint()+l.pos);d.length&&(s[d.name]=d)}}return hh=function(r,s){this.layers=r.readFields(t,{},s)},hh}(),cc.VectorTileFeature=mu(),cc.VectorTileLayer=_u()),cc}var il=Di(gu());const ap=il.VectorTileFeature.types,uh=Math.pow(2,13);function rl(n,t,r,s,l,d,p,m){n.emplaceBack(t,r,2*Math.floor(s*uh)+p,l*uh*2,d*uh*2,Math.round(m))}class dh{constructor(t){this.zoom=t.zoom,this.globalState=t.globalState,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Me,this.centroidVertexArray=new ae,this.indexArray=new dt,this.programConfigurations=new Ur(t.layers,t.zoom),this.segments=new nt,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,s){this.features=[],this.hasPattern=rh("fill-extrusion",this.layers,r);for(const{feature:l,id:d,index:p,sourceLayerIndex:m}of t){const g=this.layers[0]._featureFilter.needGeometry,x=Zs(l,g);if(!this.layers[0]._featureFilter.filter(new gt(this.zoom,{globalState:this.globalState}),x,s))continue;const b={id:d,sourceLayerIndex:m,index:p,geometry:g?x.geometry:$s(l),properties:l.properties,type:l.type,patterns:{}};this.hasPattern?this.features.push(nh("fill-extrusion",this.layers,b,this.zoom,r)):this.addFeature(b,b.geometry,p,s,{},r.subdivisionGranularity),r.featureIndex.insert(l,b.geometry,p,m,this.index,!0)}}addFeatures(t,r,s){for(const l of this.features){const{geometry:d}=l;this.addFeature(l,d,l.index,r,s,t.subdivisionGranularity)}}update(t,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,s)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,sp),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,np.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,r,s,l,d,p){for(const m of da(r,500)){const g={x:0,y:0,sampleCount:0},x=this.layoutVertexArray.length;this.processPolygon(g,l,t,m,p);const b=this.layoutVertexArray.length-x,T=Math.floor(g.x/g.sampleCount),M=Math.floor(g.y/g.sampleCount);for(let A=0;A<b;A++)this.centroidVertexArray.emplaceBack(T,M)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,s,d,l)}processPolygon(t,r,s,l,d){if(l.length<1||yu(l[0]))return;for(const T of l)T.length!==0&&op(t,T);const p={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},m=d.fill.getGranularityForZoomLevel(r.z),g=ap[s.type]==="Polygon";for(const T of l){if(T.length===0||yu(T))continue;const M=qs(T,m,g);this._generateSideFaces(M,p)}if(!g)return;const x=ou(l,r,m,!1),b=this.layoutVertexArray;lu((T,M)=>{rl(b,T,M,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,x.verticesFlattened,x.indicesTriangles)}_generateSideFaces(t,r){let s=0;for(let l=1;l<t.length;l++){const d=t[l],p=t[l-1];if(lp(d,p))continue;r.segment.vertexLength+4>nt.MAX_VERTEX_ARRAY_LENGTH&&(r.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const m=d.sub(p)._perp()._unit(),g=p.dist(d);s+g>32768&&(s=0),rl(this.layoutVertexArray,d.x,d.y,m.x,m.y,0,0,s),rl(this.layoutVertexArray,d.x,d.y,m.x,m.y,0,1,s),s+=g,rl(this.layoutVertexArray,p.x,p.y,m.x,m.y,0,0,s),rl(this.layoutVertexArray,p.x,p.y,m.x,m.y,0,1,s);const x=r.segment.vertexLength;this.indexArray.emplaceBack(x,x+2,x+1),this.indexArray.emplaceBack(x+1,x+2,x+3),r.segment.vertexLength+=4,r.segment.primitiveLength+=2}}}function op(n,t){for(let r=0;r<t.length;r++){const s=t[r];r===t.length-1&&t[0].x===s.x&&t[0].y===s.y||(n.x+=s.x,n.y+=s.y,n.sampleCount++)}}function lp(n,t){return n.x===t.x&&(n.x<0||n.x>ct)||n.y===t.y&&(n.y<0||n.y>ct)}function yu(n){return n.every(t=>t.x<0)||n.every(t=>t.x>ct)||n.every(t=>t.y<0)||n.every(t=>t.y>ct)}let xu;Ae("FillExtrusionBucket",dh,{omit:["layers","features"]});var cp={get paint(){return xu=xu||new pi({"fill-extrusion-opacity":new De(J["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new je(J["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new De(J["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new De(J["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new La(J["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new je(J["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new je(J["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new De(J["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class hp extends Jt{constructor(t){super(t,cp)}createBucket(t){return new dh(t)}queryRadius(){return nc(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:t,feature:r,featureState:s,geometry:l,transform:d,pixelsToTileUnits:p,pixelPosMatrix:m}){const g=sc(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-d.bearingInRadians,p),x=this.paint.get("fill-extrusion-height").evaluate(r,s),b=this.paint.get("fill-extrusion-base").evaluate(r,s),T=function(A,E){const D=[];for(const F of A){const U=[F.x,F.y,0,1];Hr(U,U,E),D.push(new Le(U[0]/U[3],U[1]/U[3]))}return D}(g,m),M=function(A,E,D,F){const U=[],ee=[],W=F[8]*E,C=F[9]*E,B=F[10]*E,X=F[11]*E,le=F[8]*D,xe=F[9]*D,de=F[10]*D,me=F[11]*D;for(const we of A){const be=[],Te=[];for(const ge of we){const ke=ge.x,Oe=ge.y,Fe=F[0]*ke+F[4]*Oe+F[12],Re=F[1]*ke+F[5]*Oe+F[13],tt=F[2]*ke+F[6]*Oe+F[14],At=F[3]*ke+F[7]*Oe+F[15],jt=tt+B,li=At+X,Hi=Fe+le,zi=Re+xe,ii=tt+de,St=At+me,qt=new Le((Fe+W)/li,(Re+C)/li);qt.z=jt/li,be.push(qt);const ri=new Le(Hi/St,zi/St);ri.z=ii/St,Te.push(ri)}U.push(be),ee.push(Te)}return[U,ee]}(l,b,x,m);return function(A,E,D){let F=1/0;Uh(D,E)&&(F=vu(D,E[0]));for(let U=0;U<E.length;U++){const ee=E[U],W=A[U];for(let C=0;C<ee.length-1;C++){const B=ee[C],X=[B,ee[C+1],W[C+1],W[C],B];Nh(D,X)&&(F=Math.min(F,vu(D,X)))}}return F!==1/0&&F}(M[0],M[1],T)}}function nl(n,t){return n.x*t.x+n.y*t.y}function vu(n,t){if(n.length===1){let r=0;const s=t[r++];let l;for(;!l||s.equals(l);)if(l=t[r++],!l)return 1/0;for(;r<t.length;r++){const d=t[r],p=n[0],m=l.sub(s),g=d.sub(s),x=p.sub(s),b=nl(m,m),T=nl(m,g),M=nl(g,g),A=nl(x,m),E=nl(x,g),D=b*M-T*T,F=(M*A-T*E)/D,U=(b*E-T*A)/D,ee=s.z*(1-F-U)+l.z*F+d.z*U;if(isFinite(ee))return ee}return 1/0}{let r=1/0;for(const s of t)r=Math.min(r,s.z);return r}}const up=Ct([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:dp}=up,pp=Ct([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:fp}=pp,mp=il.VectorTileFeature.types,_p=Math.cos(Math.PI/180*37.5),bu=Math.pow(2,14)/.5;class ph{constructor(t){this.zoom=t.zoom,this.globalState=t.globalState,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new Pe,this.layoutVertexArray2=new ve,this.indexArray=new dt,this.programConfigurations=new Ur(t.layers,t.zoom),this.segments=new nt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,s){this.hasPattern=rh("line",this.layers,r);const l=this.layers[0].layout.get("line-sort-key"),d=!l.isConstant(),p=[];for(const{feature:m,id:g,index:x,sourceLayerIndex:b}of t){const T=this.layers[0]._featureFilter.needGeometry,M=Zs(m,T);if(!this.layers[0]._featureFilter.filter(new gt(this.zoom,{globalState:this.globalState}),M,s))continue;const A=d?l.evaluate(M,{},s):void 0,E={id:g,properties:m.properties,type:m.type,sourceLayerIndex:b,index:x,geometry:T?M.geometry:$s(m),patterns:{},sortKey:A};p.push(E)}d&&p.sort((m,g)=>m.sortKey-g.sortKey);for(const m of p){const{geometry:g,index:x,sourceLayerIndex:b}=m;if(this.hasPattern){const T=nh("line",this.layers,m,this.zoom,r);this.patternFeatures.push(T)}else this.addFeature(m,g,x,s,{},r.subdivisionGranularity);r.featureIndex.insert(t[x].feature,g,x,b,this.index)}}update(t,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,s)}addFeatures(t,r,s){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,s,t.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,fp)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,dp),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,r,s,l,d,p){const m=this.layers[0].layout,g=m.get("line-join").evaluate(t,{}),x=m.get("line-cap"),b=m.get("line-miter-limit"),T=m.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const M of r)this.addLine(M,t,g,x,b,T,l,p);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,s,d,l)}addLine(t,r,s,l,d,p,m,g){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,t=qs(t,m?g.line.getGranularityForZoomLevel(m.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let W=0;W<t.length-1;W++)this.totalDistance+=t[W].dist(t[W+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const x=mp[r.type]==="Polygon";let b=t.length;for(;b>=2&&t[b-1].equals(t[b-2]);)b--;let T=0;for(;T<b-1&&t[T].equals(t[T+1]);)T++;if(b<(x?3:2))return;s==="bevel"&&(d=1.05);const M=this.overscaling<=16?122880/(512*this.overscaling):0,A=this.segments.prepareSegment(10*b,this.layoutVertexArray,this.indexArray);let E,D,F,U,ee;this.e1=this.e2=-1,x&&(E=t[b-2],ee=t[T].sub(E)._unit()._perp());for(let W=T;W<b;W++){if(F=W===b-1?x?t[T+1]:void 0:t[W+1],F&&t[W].equals(F))continue;ee&&(U=ee),E&&(D=E),E=t[W],ee=F?F.sub(E)._unit()._perp():U,U=U||ee;let C=U.add(ee);C.x===0&&C.y===0||C._unit();const B=U.x*ee.x+U.y*ee.y,X=C.x*ee.x+C.y*ee.y,le=X!==0?1/X:1/0,xe=2*Math.sqrt(2-2*X),de=X<_p&&D&&F,me=U.x*ee.y-U.y*ee.x>0;if(de&&W>T){const Te=E.dist(D);if(Te>2*M){const ge=E.sub(E.sub(D)._mult(M/Te)._round());this.updateDistance(D,ge),this.addCurrentVertex(ge,U,0,0,A),D=ge}}const we=D&&F;let be=we?s:x?"butt":l;if(we&&be==="round"&&(le<p?be="miter":le<=2&&(be="fakeround")),be==="miter"&&le>d&&(be="bevel"),be==="bevel"&&(le>2&&(be="flipbevel"),le<d&&(be="miter")),D&&this.updateDistance(D,E),be==="miter")C._mult(le),this.addCurrentVertex(E,C,0,0,A);else if(be==="flipbevel"){if(le>100)C=ee.mult(-1);else{const Te=le*U.add(ee).mag()/U.sub(ee).mag();C._perp()._mult(Te*(me?-1:1))}this.addCurrentVertex(E,C,0,0,A),this.addCurrentVertex(E,C.mult(-1),0,0,A)}else if(be==="bevel"||be==="fakeround"){const Te=-Math.sqrt(le*le-1),ge=me?Te:0,ke=me?0:Te;if(D&&this.addCurrentVertex(E,U,ge,ke,A),be==="fakeround"){const Oe=Math.round(180*xe/Math.PI/20);for(let Fe=1;Fe<Oe;Fe++){let Re=Fe/Oe;if(Re!==.5){const At=Re-.5;Re+=Re*At*(Re-1)*((1.0904+B*(B*(3.55645-1.43519*B)-3.2452))*At*At+(.848013+B*(.215638*B-1.06021)))}const tt=ee.sub(U)._mult(Re)._add(U)._unit()._mult(me?-1:1);this.addHalfVertex(E,tt.x,tt.y,!1,me,0,A)}}F&&this.addCurrentVertex(E,ee,-ge,-ke,A)}else if(be==="butt")this.addCurrentVertex(E,C,0,0,A);else if(be==="square"){const Te=D?1:-1;this.addCurrentVertex(E,C,Te,Te,A)}else be==="round"&&(D&&(this.addCurrentVertex(E,U,0,0,A),this.addCurrentVertex(E,U,1,1,A,!0)),F&&(this.addCurrentVertex(E,ee,-1,-1,A,!0),this.addCurrentVertex(E,ee,0,0,A)));if(de&&W<b-1){const Te=E.dist(F);if(Te>2*M){const ge=E.add(F.sub(E)._mult(M/Te)._round());this.updateDistance(E,ge),this.addCurrentVertex(ge,ee,0,0,A),E=ge}}}}addCurrentVertex(t,r,s,l,d,p=!1){const m=r.y*l-r.x,g=-r.y-r.x*l;this.addHalfVertex(t,r.x+r.y*s,r.y-r.x*s,p,!1,s,d),this.addHalfVertex(t,m,g,p,!0,-l,d),this.distance>bu/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,r,s,l,d,p))}addHalfVertex({x:t,y:r},s,l,d,p,m,g){const x=.5*(this.lineClips?this.scaledDistance*(bu-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(d?1:0),(r<<1)+(p?1:0),Math.round(63*s)+128,Math.round(63*l)+128,1+(m===0?0:m<0?-1:1)|(63&x)<<2,x>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const b=g.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,b,this.e2),g.primitiveLength++),p?this.e2=b:this.e1=b}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,r){this.distance+=t.dist(r),this.updateScaledDistance()}}let wu,Tu;Ae("LineBucket",ph,{omit:["layers","patternFeatures"]});var Su={get paint(){return Tu=Tu||new pi({"line-opacity":new je(J.paint_line["line-opacity"]),"line-color":new je(J.paint_line["line-color"]),"line-translate":new De(J.paint_line["line-translate"]),"line-translate-anchor":new De(J.paint_line["line-translate-anchor"]),"line-width":new je(J.paint_line["line-width"]),"line-gap-width":new je(J.paint_line["line-gap-width"]),"line-offset":new je(J.paint_line["line-offset"]),"line-blur":new je(J.paint_line["line-blur"]),"line-dasharray":new Vo(J.paint_line["line-dasharray"]),"line-pattern":new La(J.paint_line["line-pattern"]),"line-gradient":new Fs(J.paint_line["line-gradient"])})},get layout(){return wu=wu||new pi({"line-cap":new De(J.layout_line["line-cap"]),"line-join":new je(J.layout_line["line-join"]),"line-miter-limit":new De(J.layout_line["line-miter-limit"]),"line-round-limit":new De(J.layout_line["line-round-limit"]),"line-sort-key":new je(J.layout_line["line-sort-key"])})}};class gp extends je{possiblyEvaluate(t,r){return r=new gt(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(t,r)}evaluate(t,r,s,l){return r=Si({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(t,r,s,l)}}let hc;class yp extends Jt{constructor(t){super(t,Su),this.gradientVersion=0,hc||(hc=new gp(Su.paint.properties["line-width"].specification),hc.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if(t==="line-gradient"){const r=this.gradientExpression();this.stepInterpolant=!!function(s){return s._styleExpression!==void 0}(r)&&r._styleExpression.expression instanceof Cn,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,r){super.recalculate(t,r),this.paint._values["line-floorwidth"]=hc.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new ph(t)}queryRadius(t){const r=t,s=Pu(Ho("line-width",this,r),Ho("line-gap-width",this,r)),l=Ho("line-offset",this,r);return s/2+Math.abs(l)+nc(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:t,feature:r,featureState:s,geometry:l,transform:d,pixelsToTileUnits:p}){const m=sc(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-d.bearingInRadians,p),g=p/2*Pu(this.paint.get("line-width").evaluate(r,s),this.paint.get("line-gap-width").evaluate(r,s)),x=this.paint.get("line-offset").evaluate(r,s);return x&&(l=function(b,T){const M=[];for(let A=0;A<b.length;A++){const E=b[A],D=[];for(let F=0;F<E.length;F++){const U=E[F-1],ee=E[F],W=E[F+1],C=F===0?new Le(0,0):ee.sub(U)._unit()._perp(),B=F===E.length-1?new Le(0,0):W.sub(ee)._unit()._perp(),X=C._add(B)._unit(),le=X.x*B.x+X.y*B.y;le!==0&&X._mult(1/le),D.push(X._mult(T)._add(ee))}M.push(D)}return M}(l,x*p)),function(b,T,M){for(let A=0;A<T.length;A++){const E=T[A];if(b.length>=3){for(let D=0;D<E.length;D++)if(Oa(b,E[D]))return!0}if(zd(b,E,M))return!0}return!1}(m,l,g)}isTileClipped(){return!0}}function Pu(n,t){return t>0?t+2*n:n}const xp=Ct([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),vp=Ct([{name:"a_projected_pos",components:3,type:"Float32"}],4);Ct([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const bp=Ct([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);Ct([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const Mu=Ct([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),wp=Ct([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Tp(n,t,r){return n.sections.forEach(s=>{s.text=function(l,d,p){const m=d.layout.get("text-transform").evaluate(p,{});return m==="uppercase"?l=l.toLocaleUpperCase():m==="lowercase"&&(l=l.toLocaleLowerCase()),Lr.applyArabicShaping&&(l=Lr.applyArabicShaping(l)),l}(s.text,t,r)}),n}Ct([{name:"triangle",components:3,type:"Uint16"}]),Ct([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),Ct([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),Ct([{type:"Float32",name:"offsetX"}]),Ct([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Ct([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const sl={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Iu,fh,Cu,Gt=24,mh={};function Sp(){return Iu||(Iu=1,mh.read=function(n,t,r,s,l){var d,p,m=8*l-s-1,g=(1<<m)-1,x=g>>1,b=-7,T=r?l-1:0,M=r?-1:1,A=n[t+T];for(T+=M,d=A&(1<<-b)-1,A>>=-b,b+=m;b>0;d=256*d+n[t+T],T+=M,b-=8);for(p=d&(1<<-b)-1,d>>=-b,b+=s;b>0;p=256*p+n[t+T],T+=M,b-=8);if(d===0)d=1-x;else{if(d===g)return p?NaN:1/0*(A?-1:1);p+=Math.pow(2,s),d-=x}return(A?-1:1)*p*Math.pow(2,d-s)},mh.write=function(n,t,r,s,l,d){var p,m,g,x=8*d-l-1,b=(1<<x)-1,T=b>>1,M=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=s?0:d-1,E=s?1:-1,D=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(m=isNaN(t)?1:0,p=b):(p=Math.floor(Math.log(t)/Math.LN2),t*(g=Math.pow(2,-p))<1&&(p--,g*=2),(t+=p+T>=1?M/g:M*Math.pow(2,1-T))*g>=2&&(p++,g/=2),p+T>=b?(m=0,p=b):p+T>=1?(m=(t*g-1)*Math.pow(2,l),p+=T):(m=t*Math.pow(2,T-1)*Math.pow(2,l),p=0));l>=8;n[r+A]=255&m,A+=E,m/=256,l-=8);for(p=p<<l|m,x+=l;x>0;n[r+A]=255&p,A+=E,p/=256,x-=8);n[r+A-E]|=128*D}),mh}function Au(){if(Cu)return fh;Cu=1,fh=t;var n=Sp();function t(C){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(C)?C:new Uint8Array(C||0),this.pos=0,this.type=0,this.length=this.buf.length}t.Varint=0,t.Fixed64=1,t.Bytes=2,t.Fixed32=5;var r=4294967296,s=1/r,l=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function d(C){return C.type===t.Bytes?C.readVarint()+C.pos:C.pos+1}function p(C,B,X){return X?4294967296*B+(C>>>0):4294967296*(B>>>0)+(C>>>0)}function m(C,B,X){var le=B<=16383?1:B<=2097151?2:B<=268435455?3:Math.floor(Math.log(B)/(7*Math.LN2));X.realloc(le);for(var xe=X.pos-1;xe>=C;xe--)X.buf[xe+le]=X.buf[xe]}function g(C,B){for(var X=0;X<C.length;X++)B.writeVarint(C[X])}function x(C,B){for(var X=0;X<C.length;X++)B.writeSVarint(C[X])}function b(C,B){for(var X=0;X<C.length;X++)B.writeFloat(C[X])}function T(C,B){for(var X=0;X<C.length;X++)B.writeDouble(C[X])}function M(C,B){for(var X=0;X<C.length;X++)B.writeBoolean(C[X])}function A(C,B){for(var X=0;X<C.length;X++)B.writeFixed32(C[X])}function E(C,B){for(var X=0;X<C.length;X++)B.writeSFixed32(C[X])}function D(C,B){for(var X=0;X<C.length;X++)B.writeFixed64(C[X])}function F(C,B){for(var X=0;X<C.length;X++)B.writeSFixed64(C[X])}function U(C,B){return(C[B]|C[B+1]<<8|C[B+2]<<16)+16777216*C[B+3]}function ee(C,B,X){C[X]=B,C[X+1]=B>>>8,C[X+2]=B>>>16,C[X+3]=B>>>24}function W(C,B){return(C[B]|C[B+1]<<8|C[B+2]<<16)+(C[B+3]<<24)}return t.prototype={destroy:function(){this.buf=null},readFields:function(C,B,X){for(X=X||this.length;this.pos<X;){var le=this.readVarint(),xe=le>>3,de=this.pos;this.type=7&le,C(xe,B,this),this.pos===de&&this.skip(le)}return B},readMessage:function(C,B){return this.readFields(C,B,this.readVarint()+this.pos)},readFixed32:function(){var C=U(this.buf,this.pos);return this.pos+=4,C},readSFixed32:function(){var C=W(this.buf,this.pos);return this.pos+=4,C},readFixed64:function(){var C=U(this.buf,this.pos)+U(this.buf,this.pos+4)*r;return this.pos+=8,C},readSFixed64:function(){var C=U(this.buf,this.pos)+W(this.buf,this.pos+4)*r;return this.pos+=8,C},readFloat:function(){var C=n.read(this.buf,this.pos,!0,23,4);return this.pos+=4,C},readDouble:function(){var C=n.read(this.buf,this.pos,!0,52,8);return this.pos+=8,C},readVarint:function(C){var B,X,le=this.buf;return B=127&(X=le[this.pos++]),X<128?B:(B|=(127&(X=le[this.pos++]))<<7,X<128?B:(B|=(127&(X=le[this.pos++]))<<14,X<128?B:(B|=(127&(X=le[this.pos++]))<<21,X<128?B:function(xe,de,me){var we,be,Te=me.buf;if(we=(112&(be=Te[me.pos++]))>>4,be<128||(we|=(127&(be=Te[me.pos++]))<<3,be<128)||(we|=(127&(be=Te[me.pos++]))<<10,be<128)||(we|=(127&(be=Te[me.pos++]))<<17,be<128)||(we|=(127&(be=Te[me.pos++]))<<24,be<128)||(we|=(1&(be=Te[me.pos++]))<<31,be<128))return p(xe,we,de);throw new Error("Expected varint not more than 10 bytes")}(B|=(15&(X=le[this.pos]))<<28,C,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var C=this.readVarint();return C%2==1?(C+1)/-2:C/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var C=this.readVarint()+this.pos,B=this.pos;return this.pos=C,C-B>=12&&l?function(X,le,xe){return l.decode(X.subarray(le,xe))}(this.buf,B,C):function(X,le,xe){for(var de="",me=le;me<xe;){var we,be,Te,ge=X[me],ke=null,Oe=ge>239?4:ge>223?3:ge>191?2:1;if(me+Oe>xe)break;Oe===1?ge<128&&(ke=ge):Oe===2?(192&(we=X[me+1]))==128&&(ke=(31&ge)<<6|63&we)<=127&&(ke=null):Oe===3?(be=X[me+2],(192&(we=X[me+1]))==128&&(192&be)==128&&((ke=(15&ge)<<12|(63&we)<<6|63&be)<=2047||ke>=55296&&ke<=57343)&&(ke=null)):Oe===4&&(be=X[me+2],Te=X[me+3],(192&(we=X[me+1]))==128&&(192&be)==128&&(192&Te)==128&&((ke=(15&ge)<<18|(63&we)<<12|(63&be)<<6|63&Te)<=65535||ke>=1114112)&&(ke=null)),ke===null?(ke=65533,Oe=1):ke>65535&&(ke-=65536,de+=String.fromCharCode(ke>>>10&1023|55296),ke=56320|1023&ke),de+=String.fromCharCode(ke),me+=Oe}return de}(this.buf,B,C)},readBytes:function(){var C=this.readVarint()+this.pos,B=this.buf.subarray(this.pos,C);return this.pos=C,B},readPackedVarint:function(C,B){if(this.type!==t.Bytes)return C.push(this.readVarint(B));var X=d(this);for(C=C||[];this.pos<X;)C.push(this.readVarint(B));return C},readPackedSVarint:function(C){if(this.type!==t.Bytes)return C.push(this.readSVarint());var B=d(this);for(C=C||[];this.pos<B;)C.push(this.readSVarint());return C},readPackedBoolean:function(C){if(this.type!==t.Bytes)return C.push(this.readBoolean());var B=d(this);for(C=C||[];this.pos<B;)C.push(this.readBoolean());return C},readPackedFloat:function(C){if(this.type!==t.Bytes)return C.push(this.readFloat());var B=d(this);for(C=C||[];this.pos<B;)C.push(this.readFloat());return C},readPackedDouble:function(C){if(this.type!==t.Bytes)return C.push(this.readDouble());var B=d(this);for(C=C||[];this.pos<B;)C.push(this.readDouble());return C},readPackedFixed32:function(C){if(this.type!==t.Bytes)return C.push(this.readFixed32());var B=d(this);for(C=C||[];this.pos<B;)C.push(this.readFixed32());return C},readPackedSFixed32:function(C){if(this.type!==t.Bytes)return C.push(this.readSFixed32());var B=d(this);for(C=C||[];this.pos<B;)C.push(this.readSFixed32());return C},readPackedFixed64:function(C){if(this.type!==t.Bytes)return C.push(this.readFixed64());var B=d(this);for(C=C||[];this.pos<B;)C.push(this.readFixed64());return C},readPackedSFixed64:function(C){if(this.type!==t.Bytes)return C.push(this.readSFixed64());var B=d(this);for(C=C||[];this.pos<B;)C.push(this.readSFixed64());return C},skip:function(C){var B=7&C;if(B===t.Varint)for(;this.buf[this.pos++]>127;);else if(B===t.Bytes)this.pos=this.readVarint()+this.pos;else if(B===t.Fixed32)this.pos+=4;else{if(B!==t.Fixed64)throw new Error("Unimplemented type: "+B);this.pos+=8}},writeTag:function(C,B){this.writeVarint(C<<3|B)},realloc:function(C){for(var B=this.length||16;B<this.pos+C;)B*=2;if(B!==this.length){var X=new Uint8Array(B);X.set(this.buf),this.buf=X,this.length=B}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(C){this.realloc(4),ee(this.buf,C,this.pos),this.pos+=4},writeSFixed32:function(C){this.realloc(4),ee(this.buf,C,this.pos),this.pos+=4},writeFixed64:function(C){this.realloc(8),ee(this.buf,-1&C,this.pos),ee(this.buf,Math.floor(C*s),this.pos+4),this.pos+=8},writeSFixed64:function(C){this.realloc(8),ee(this.buf,-1&C,this.pos),ee(this.buf,Math.floor(C*s),this.pos+4),this.pos+=8},writeVarint:function(C){(C=+C||0)>268435455||C<0?function(B,X){var le,xe;if(B>=0?(le=B%4294967296|0,xe=B/4294967296|0):(xe=~(-B/4294967296),4294967295^(le=~(-B%4294967296))?le=le+1|0:(le=0,xe=xe+1|0)),B>=18446744073709552e3||B<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");X.realloc(10),function(de,me,we){we.buf[we.pos++]=127&de|128,de>>>=7,we.buf[we.pos++]=127&de|128,de>>>=7,we.buf[we.pos++]=127&de|128,de>>>=7,we.buf[we.pos++]=127&de|128,we.buf[we.pos]=127&(de>>>=7)}(le,0,X),function(de,me){var we=(7&de)<<4;me.buf[me.pos++]|=we|((de>>>=3)?128:0),de&&(me.buf[me.pos++]=127&de|((de>>>=7)?128:0),de&&(me.buf[me.pos++]=127&de|((de>>>=7)?128:0),de&&(me.buf[me.pos++]=127&de|((de>>>=7)?128:0),de&&(me.buf[me.pos++]=127&de|((de>>>=7)?128:0),de&&(me.buf[me.pos++]=127&de)))))}(xe,X)}(C,this):(this.realloc(4),this.buf[this.pos++]=127&C|(C>127?128:0),C<=127||(this.buf[this.pos++]=127&(C>>>=7)|(C>127?128:0),C<=127||(this.buf[this.pos++]=127&(C>>>=7)|(C>127?128:0),C<=127||(this.buf[this.pos++]=C>>>7&127))))},writeSVarint:function(C){this.writeVarint(C<0?2*-C-1:2*C)},writeBoolean:function(C){this.writeVarint(!!C)},writeString:function(C){C=String(C),this.realloc(4*C.length),this.pos++;var B=this.pos;this.pos=function(le,xe,de){for(var me,we,be=0;be<xe.length;be++){if((me=xe.charCodeAt(be))>55295&&me<57344){if(!we){me>56319||be+1===xe.length?(le[de++]=239,le[de++]=191,le[de++]=189):we=me;continue}if(me<56320){le[de++]=239,le[de++]=191,le[de++]=189,we=me;continue}me=we-55296<<10|me-56320|65536,we=null}else we&&(le[de++]=239,le[de++]=191,le[de++]=189,we=null);me<128?le[de++]=me:(me<2048?le[de++]=me>>6|192:(me<65536?le[de++]=me>>12|224:(le[de++]=me>>18|240,le[de++]=me>>12&63|128),le[de++]=me>>6&63|128),le[de++]=63&me|128)}return de}(this.buf,C,this.pos);var X=this.pos-B;X>=128&&m(B,X,this),this.pos=B-1,this.writeVarint(X),this.pos+=X},writeFloat:function(C){this.realloc(4),n.write(this.buf,C,this.pos,!0,23,4),this.pos+=4},writeDouble:function(C){this.realloc(8),n.write(this.buf,C,this.pos,!0,52,8),this.pos+=8},writeBytes:function(C){var B=C.length;this.writeVarint(B),this.realloc(B);for(var X=0;X<B;X++)this.buf[this.pos++]=C[X]},writeRawMessage:function(C,B){this.pos++;var X=this.pos;C(B,this);var le=this.pos-X;le>=128&&m(X,le,this),this.pos=X-1,this.writeVarint(le),this.pos+=le},writeMessage:function(C,B,X){this.writeTag(C,t.Bytes),this.writeRawMessage(B,X)},writePackedVarint:function(C,B){B.length&&this.writeMessage(C,g,B)},writePackedSVarint:function(C,B){B.length&&this.writeMessage(C,x,B)},writePackedBoolean:function(C,B){B.length&&this.writeMessage(C,M,B)},writePackedFloat:function(C,B){B.length&&this.writeMessage(C,b,B)},writePackedDouble:function(C,B){B.length&&this.writeMessage(C,T,B)},writePackedFixed32:function(C,B){B.length&&this.writeMessage(C,A,B)},writePackedSFixed32:function(C,B){B.length&&this.writeMessage(C,E,B)},writePackedFixed64:function(C,B){B.length&&this.writeMessage(C,D,B)},writePackedSFixed64:function(C,B){B.length&&this.writeMessage(C,F,B)},writeBytesField:function(C,B){this.writeTag(C,t.Bytes),this.writeBytes(B)},writeFixed32Field:function(C,B){this.writeTag(C,t.Fixed32),this.writeFixed32(B)},writeSFixed32Field:function(C,B){this.writeTag(C,t.Fixed32),this.writeSFixed32(B)},writeFixed64Field:function(C,B){this.writeTag(C,t.Fixed64),this.writeFixed64(B)},writeSFixed64Field:function(C,B){this.writeTag(C,t.Fixed64),this.writeSFixed64(B)},writeVarintField:function(C,B){this.writeTag(C,t.Varint),this.writeVarint(B)},writeSVarintField:function(C,B){this.writeTag(C,t.Varint),this.writeSVarint(B)},writeStringField:function(C,B){this.writeTag(C,t.Bytes),this.writeString(B)},writeFloatField:function(C,B){this.writeTag(C,t.Fixed32),this.writeFloat(B)},writeDoubleField:function(C,B){this.writeTag(C,t.Fixed64),this.writeDouble(B)},writeBooleanField:function(C,B){this.writeVarintField(C,!!B)}},fh}var Yn,_h=Di(Au());function Pp(n,t,r){n===1&&r.readMessage(Mp,t)}function Mp(n,t,r){if(n===3){const{id:s,bitmap:l,width:d,height:p,left:m,top:g,advance:x}=r.readMessage(Ip,{});t.push({id:s,bitmap:new Xo({width:d+6,height:p+6},l),metrics:{width:d,height:p,left:m,top:g,advance:x}})}}function Ip(n,t,r){n===1?t.id=r.readVarint():n===2?t.bitmap=r.readBytes():n===3?t.width=r.readVarint():n===4?t.height=r.readVarint():n===5?t.left=r.readSVarint():n===6?t.top=r.readSVarint():n===7&&(t.advance=r.readVarint())}function Eu(n){let t=0,r=0;for(const p of n)t+=p.w*p.h,r=Math.max(r,p.w);n.sort((p,m)=>m.h-p.h);const s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),r),h:1/0}];let l=0,d=0;for(const p of n)for(let m=s.length-1;m>=0;m--){const g=s[m];if(!(p.w>g.w||p.h>g.h)){if(p.x=g.x,p.y=g.y,d=Math.max(d,p.y+p.h),l=Math.max(l,p.x+p.w),p.w===g.w&&p.h===g.h){const x=s.pop();m<s.length&&(s[m]=x)}else p.h===g.h?(g.x+=p.w,g.w-=p.w):p.w===g.w?(g.y+=p.h,g.h-=p.h):(s.push({x:g.x+p.w,y:g.y,w:g.w-p.w,h:p.h}),g.y+=p.h,g.h-=p.h);break}}return{w:l,h:d,fill:t/(l*d)||0}}class gh{constructor(t,{pixelRatio:r,version:s,stretchX:l,stretchY:d,content:p,textFitWidth:m,textFitHeight:g}){this.paddedRect=t,this.pixelRatio=r,this.stretchX=l,this.stretchY=d,this.content=p,this.version=s,this.textFitWidth=m,this.textFitHeight=g}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class zu{constructor(t,r){const s={},l={};this.haveRenderCallbacks=[];const d=[];this.addImages(t,s,d),this.addImages(r,l,d);const{w:p,h:m}=Eu(d),g=new Ei({width:p||1,height:m||1});for(const x in t){const b=t[x],T=s[x].paddedRect;Ei.copy(b.data,g,{x:0,y:0},{x:T.x+1,y:T.y+1},b.data)}for(const x in r){const b=r[x],T=l[x].paddedRect,M=T.x+1,A=T.y+1,E=b.data.width,D=b.data.height;Ei.copy(b.data,g,{x:0,y:0},{x:M,y:A},b.data),Ei.copy(b.data,g,{x:0,y:D-1},{x:M,y:A-1},{width:E,height:1}),Ei.copy(b.data,g,{x:0,y:0},{x:M,y:A+D},{width:E,height:1}),Ei.copy(b.data,g,{x:E-1,y:0},{x:M-1,y:A},{width:1,height:D}),Ei.copy(b.data,g,{x:0,y:0},{x:M+E,y:A},{width:1,height:D})}this.image=g,this.iconPositions=s,this.patternPositions=l}addImages(t,r,s){for(const l in t){const d=t[l],p={x:0,y:0,w:d.data.width+2,h:d.data.height+2};s.push(p),r[l]=new gh(p,d),d.hasRenderCallback&&this.haveRenderCallbacks.push(l)}}patchUpdatedImages(t,r){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const s in t.updatedImages)this.patchUpdatedImage(this.iconPositions[s],t.getImage(s),r),this.patchUpdatedImage(this.patternPositions[s],t.getImage(s),r)}patchUpdatedImage(t,r,s){if(!t||!r||t.version===r.version)return;t.version=r.version;const[l,d]=t.tl;s.update(r.data,void 0,{x:l,y:d})}}Ae("ImagePosition",gh),Ae("ImageAtlas",zu),z.an=void 0,(Yn=z.an||(z.an={}))[Yn.none=0]="none",Yn[Yn.horizontal=1]="horizontal",Yn[Yn.vertical=2]="vertical",Yn[Yn.horizontalOnly=3]="horizontalOnly";class al{constructor(){this.scale=1,this.fontStack="",this.imageName=null,this.verticalAlign="bottom"}static forText(t,r,s){const l=new al;return l.scale=t||1,l.fontStack=r,l.verticalAlign=s||"bottom",l}static forImage(t,r){const s=new al;return s.imageName=t,s.verticalAlign=r||"bottom",s}}class Ua{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,r){const s=new Ua;for(let l=0;l<t.sections.length;l++){const d=t.sections[l];d.image?s.addImageSection(d):s.addTextSection(d,r)}return s}length(){return this.text.length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}getCharCode(t){return this.text.charCodeAt(t)}verticalizePunctuation(){this.text=function(t){let r="";for(let s=0;s<t.length;s++){const l=t.charCodeAt(s+1)||null,d=t.charCodeAt(s-1)||null;r+=l&&Fo(l)&&!sl[t[s+1]]||d&&Fo(d)&&!sl[t[s-1]]||!sl[t[s]]?t[s]:sl[t[s]]}return r}(this.text)}trim(){let t=0;for(let s=0;s<this.text.length&&dc[this.text.charCodeAt(s)];s++)t++;let r=this.text.length;for(let s=this.text.length-1;s>=0&&s>=t&&dc[this.text.charCodeAt(s)];s--)r--;this.text=this.text.substring(t,r),this.sectionIndex=this.sectionIndex.slice(t,r)}substring(t,r){const s=new Ua;return s.text=this.text.substring(t,r),s.sectionIndex=this.sectionIndex.slice(t,r),s.sections=this.sections,s}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((t,r)=>Math.max(t,this.sections[r].scale),0)}getMaxImageSize(t){let r=0,s=0;for(let l=0;l<this.length();l++){const d=this.getSection(l);if(d.imageName){const p=t[d.imageName];if(!p)continue;const m=p.displaySize;r=Math.max(r,m[0]),s=Math.max(s,m[1])}}return{maxImageWidth:r,maxImageHeight:s}}addTextSection(t,r){this.text+=t.text,this.sections.push(al.forText(t.scale,t.fontStack||r,t.verticalAlign));const s=this.sections.length-1;for(let l=0;l<t.text.length;++l)this.sectionIndex.push(s)}addImageSection(t){const r=t.image?t.image.name:"";if(r.length===0)return void Yt("Can't add FormattedSection with an empty image.");const s=this.getNextImageSectionCharCode();s?(this.text+=String.fromCharCode(s),this.sections.push(al.forImage(r,t.verticalAlign)),this.sectionIndex.push(this.sections.length-1)):Yt("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function uc(n,t,r,s,l,d,p,m,g,x,b,T,M,A,E){const D=Ua.fromFeature(n,l);let F;T===z.an.vertical&&D.verticalizePunctuation();const{processBidirectionalText:U,processStyledBidirectionalText:ee}=Lr;if(U&&D.sections.length===1){F=[];const B=U(D.toString(),yh(D,x,d,t,s,A));for(const X of B){const le=new Ua;le.text=X,le.sections=D.sections;for(let xe=0;xe<X.length;xe++)le.sectionIndex.push(0);F.push(le)}}else if(ee){F=[];const B=ee(D.text,D.sectionIndex,yh(D,x,d,t,s,A));for(const X of B){const le=new Ua;le.text=X[0],le.sectionIndex=X[1],le.sections=D.sections,F.push(le)}}else F=function(B,X){const le=[],xe=B.text;let de=0;for(const me of X)le.push(B.substring(de,me)),de=me;return de<xe.length&&le.push(B.substring(de,xe.length)),le}(D,yh(D,x,d,t,s,A));const W=[],C={positionedLines:W,text:D.toString(),top:b[1],bottom:b[1],left:b[0],right:b[0],writingMode:T,iconsInText:!1,verticalizable:!1};return function(B,X,le,xe,de,me,we,be,Te,ge,ke,Oe){let Fe=0,Re=0,tt=0,At=0;const jt=be==="right"?1:be==="left"?0:.5,li=Gt/Oe;let Hi=0;for(const St of de){St.trim();const qt=St.getMaxScale(),ri={positionedGlyphs:[],lineOffset:0};B.positionedLines[Hi]=ri;const ni=ri.positionedGlyphs;let wi=0;if(!St.length()){Re+=me,++Hi;continue}const Xi=zp(xe,St,li);for(let ki=0;ki<St.length();ki++){const Vt=St.getSection(ki),Ht=St.getSectionIndex(ki),Xt=St.getCharCode(ki),Bt=kp(Te,ke,Xt);let _t;if(Vt.imageName){if(B.iconsInText=!0,Vt.scale=Vt.scale*li,_t=Rp(Vt,Bt,qt,Xi,xe),!_t)continue;wi=Math.max(wi,_t.imageOffset)}else if(_t=Dp(Vt,Xt,Bt,Xi,X,le),!_t)continue;const{rect:xr,metrics:qa,baselineOffset:vr}=_t;ni.push({glyph:Xt,imageName:Vt.imageName,x:Fe,y:Re+vr+-17,vertical:Bt,scale:Vt.scale,fontStack:Vt.fontStack,sectionIndex:Ht,metrics:qa,rect:xr}),Bt?(B.verticalizable=!0,Fe+=(Vt.imageName?qa.advance:Gt)*Vt.scale+ge):Fe+=qa.advance*Vt.scale+ge}ni.length!==0&&(tt=Math.max(Fe-ge,tt),Lp(ni,0,ni.length-1,jt)),Fe=0,ri.lineOffset=Math.max(wi,(qt-1)*Gt);const Wt=me*qt+wi;Re+=Wt,At=Math.max(Wt,At),++Hi}const{horizontalAlign:zi,verticalAlign:ii}=xh(we);(function(St,qt,ri,ni,wi,Xi,Wt,ki,Vt){const Ht=(qt-ri)*wi;let Xt=0;Xt=Xi!==Wt?-ki*ni- -17:-ni*Vt*Wt+.5*Wt;for(const Bt of St)for(const _t of Bt.positionedGlyphs)_t.x+=Ht,_t.y+=Xt})(B.positionedLines,jt,zi,ii,tt,At,me,Re,de.length),B.top+=-ii*Re,B.bottom=B.top+Re,B.left+=-zi*tt,B.right=B.left+tt}(C,t,r,s,F,p,m,g,T,x,M,E),!function(B){for(const X of B)if(X.positionedGlyphs.length!==0)return!1;return!0}(W)&&C}const dc={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Cp={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},Ap={40:!0};function ku(n,t,r,s,l,d){if(t.imageName){const p=s[t.imageName];return p?p.displaySize[0]*t.scale*Gt/d+l:0}{const p=r[t.fontStack],m=p&&p[n];return m?m.metrics.advance*t.scale+l:0}}function Du(n,t,r,s){const l=Math.pow(n-t,2);return s?n<t?l/2:2*l:l+Math.abs(r)*r}function Ep(n,t,r){let s=0;return n===10&&(s-=1e4),r&&(s+=150),n!==40&&n!==65288||(s+=50),t!==41&&t!==65289||(s+=50),s}function Ru(n,t,r,s,l,d){let p=null,m=Du(t,r,l,d);for(const g of s){const x=Du(t-g.x,r,l,d)+g.badness;x<=m&&(p=g,m=x)}return{index:n,x:t,priorBreak:p,badness:m}}function Lu(n){return n?Lu(n.priorBreak).concat(n.index):[]}function yh(n,t,r,s,l,d){if(!n)return[];const p=[],m=function(T,M,A,E,D,F){let U=0;for(let ee=0;ee<T.length();ee++){const W=T.getSection(ee);U+=ku(T.getCharCode(ee),W,E,D,M,F)}return U/Math.max(1,Math.ceil(U/A))}(n,t,r,s,l,d),g=n.text.indexOf("")>=0;let x=0;for(let T=0;T<n.length();T++){const M=n.getSection(T),A=n.getCharCode(T);if(dc[A]||(x+=ku(A,M,s,l,t,d)),T<n.length()-1){const E=!((b=A)<11904)&&(!!et["CJK Compatibility Forms"](b)||!!et["CJK Compatibility"](b)||!!et["CJK Strokes"](b)||!!et["CJK Symbols and Punctuation"](b)||!!et["Enclosed CJK Letters and Months"](b)||!!et["Halfwidth and Fullwidth Forms"](b)||!!et["Ideographic Description Characters"](b)||!!et["Vertical Forms"](b)||Bo.test(String.fromCodePoint(b)));(Cp[A]||E||M.imageName||T!==n.length()-2&&Ap[n.getCharCode(T+1)])&&p.push(Ru(T+1,x,m,p,Ep(A,n.getCharCode(T+1),E&&g),!1))}}var b;return Lu(Ru(n.length(),x,m,p,0,!0))}function xh(n){let t=.5,r=.5;switch(n){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(n){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:t,verticalAlign:r}}function zp(n,t,r){const s=t.getMaxScale()*Gt,{maxImageWidth:l,maxImageHeight:d}=t.getMaxImageSize(n),p=Math.max(s,d*r);return{verticalLineContentWidth:Math.max(s,l*r),horizontalLineContentHeight:p}}function Bu(n){switch(n){case"top":return 0;case"center":return .5;default:return 1}}function kp(n,t,r){return!(n===z.an.horizontal||!t&&!ka(r)||t&&(dc[r]||(s=r,new RegExp("\\p{sc=Arab}","u").test(String.fromCodePoint(s)))));var s}function Dp(n,t,r,s,l,d){const p=d[n.fontStack],m=function(x,b,T,M){if(x&&x.rect)return x;const A=b[T.fontStack],E=A&&A[M];return E?{rect:null,metrics:E.metrics}:null}(p&&p[t],l,n,t);if(m===null)return null;let g;if(r)g=s.verticalLineContentWidth-n.scale*Gt;else{const x=Bu(n.verticalAlign);g=(s.horizontalLineContentHeight-n.scale*Gt)*x}return{rect:m.rect,metrics:m.metrics,baselineOffset:g}}function Rp(n,t,r,s,l){const d=l[n.imageName];if(!d)return null;const p=d.paddedRect,m=d.displaySize,g={width:m[0],height:m[1],left:1,top:-3,advance:t?m[1]:m[0]};let x;if(t)x=s.verticalLineContentWidth-m[1]*n.scale;else{const b=Bu(n.verticalAlign);x=(s.horizontalLineContentHeight-m[1]*n.scale)*b}return{rect:p,metrics:g,baselineOffset:x,imageOffset:(t?m[0]:m[1])*n.scale-Gt*r}}function Lp(n,t,r,s){if(s===0)return;const l=n[r],d=(n[r].x+l.metrics.advance*l.scale)*s;for(let p=t;p<=r;p++)n[p].x-=d}function Bp(n,t,r){const{horizontalAlign:s,verticalAlign:l}=xh(r),d=t[0]-n.displaySize[0]*s,p=t[1]-n.displaySize[1]*l;return{image:n,top:p,bottom:p+n.displaySize[1],left:d,right:d+n.displaySize[0]}}function Fu(n){var t,r;let s=n.left,l=n.top,d=n.right-s,p=n.bottom-l;const m=(t=n.image.textFitWidth)!==null&&t!==void 0?t:"stretchOrShrink",g=(r=n.image.textFitHeight)!==null&&r!==void 0?r:"stretchOrShrink",x=(n.image.content[2]-n.image.content[0])/(n.image.content[3]-n.image.content[1]);if(g==="proportional"){if(m==="stretchOnly"&&d/p<x||m==="proportional"){const b=Math.ceil(p*x);s*=b/d,d=b}}else if(m==="proportional"&&g==="stretchOnly"&&x!==0&&d/p>x){const b=Math.ceil(d/x);l*=b/p,p=b}return{x1:s,y1:l,x2:s+d,y2:l+p}}function Ou(n,t,r,s,l,d){const p=n.image;let m;if(p.content){const F=p.content,U=p.pixelRatio||1;m=[F[0]/U,F[1]/U,p.displaySize[0]-F[2]/U,p.displaySize[1]-F[3]/U]}const g=t.left*d,x=t.right*d;let b,T,M,A;r==="width"||r==="both"?(A=l[0]+g-s[3],T=l[0]+x+s[1]):(A=l[0]+(g+x-p.displaySize[0])/2,T=A+p.displaySize[0]);const E=t.top*d,D=t.bottom*d;return r==="height"||r==="both"?(b=l[1]+E-s[0],M=l[1]+D+s[2]):(b=l[1]+(E+D-p.displaySize[1])/2,M=b+p.displaySize[1]),{image:p,top:b,right:T,bottom:M,left:A,collisionPadding:m}}const fn=128,Kn=32640;function ju(n,t){const{expression:r}=t;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new gt(n+1))};if(r.kind==="source")return{kind:"source"};{const{zoomStops:s,interpolationType:l}=r;let d=0;for(;d<s.length&&s[d]<=n;)d++;d=Math.max(0,d-1);let p=d;for(;p<s.length&&s[p]<n+1;)p++;p=Math.min(s.length-1,p);const m=s[d],g=s[p];return r.kind==="composite"?{kind:"composite",minZoom:m,maxZoom:g,interpolationType:l}:{kind:"camera",minZoom:m,maxZoom:g,minSize:r.evaluate(new gt(m)),maxSize:r.evaluate(new gt(g)),interpolationType:l}}}function vh(n,t,r){let s="never";const l=n.get(t);return l?s=l:n.get(r)&&(s="always"),s}const Fp=il.VectorTileFeature.types,Op=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function pc(n,t,r,s,l,d,p,m,g,x,b,T,M){const A=m?Math.min(Kn,Math.round(m[0])):0,E=m?Math.min(Kn,Math.round(m[1])):0;n.emplaceBack(t,r,Math.round(32*s),Math.round(32*l),d,p,(A<<1)+(g?1:0),E,16*x,16*b,256*T,256*M)}function bh(n,t,r){n.emplaceBack(t.x,t.y,r),n.emplaceBack(t.x,t.y,r),n.emplaceBack(t.x,t.y,r),n.emplaceBack(t.x,t.y,r)}function jp(n){for(const t of n.sections)if(Oo(t.text))return!0;return!1}class wh{constructor(t){this.layoutVertexArray=new We,this.indexArray=new dt,this.programConfigurations=t,this.segments=new nt,this.dynamicLayoutVertexArray=new ot,this.opacityVertexArray=new wt,this.hasVisibleVertices=!1,this.placedSymbolArray=new N}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(t,r,s,l){this.isEmpty()||(s&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,xp.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,vp.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,Op,!0),this.opacityVertexBuffer.itemSize=1),(s||l)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}Ae("SymbolBuffers",wh);class Th{constructor(t,r,s){this.layoutVertexArray=new t,this.layoutAttributes=r,this.indexArray=new s,this.segments=new nt,this.collisionVertexArray=new Tt}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,bp.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Ae("CollisionBuffers",Th);class $a{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.globalState=t.globalState,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(p=>p.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=ju(this.zoom,r["text-size"]),this.iconSizeData=ju(this.zoom,r["icon-size"]);const s=this.layers[0].layout,l=s.get("symbol-sort-key"),d=s.get("symbol-z-order");this.canOverlap=vh(s,"text-overlap","text-allow-overlap")!=="never"||vh(s,"icon-overlap","icon-allow-overlap")!=="never"||s.get("text-ignore-placement")||s.get("icon-ignore-placement"),this.sortFeaturesByKey=d!=="viewport-y"&&!l.isConstant(),this.sortFeaturesByY=(d==="viewport-y"||d==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,s.get("symbol-placement")==="point"&&(this.writingModes=s.get("text-writing-mode").map(p=>z.an[p])),this.stateDependentLayerIds=this.layers.filter(p=>p.isStateDependent()).map(p=>p.id),this.sourceID=t.sourceID}createArrays(){this.text=new wh(new Ur(this.layers,this.zoom,t=>/^text/.test(t))),this.icon=new wh(new Ur(this.layers,this.zoom,t=>/^icon/.test(t))),this.glyphOffsetArray=new Z,this.lineVertexArray=new Y,this.symbolInstances=new q,this.textAnchorOffsets=new G}calculateGlyphDependencies(t,r,s,l,d){for(let p=0;p<t.length;p++)if(r[t.charCodeAt(p)]=!0,(s||l)&&d){const m=sl[t.charAt(p)];m&&(r[m.charCodeAt(0)]=!0)}}populate(t,r,s){const l=this.layers[0],d=l.layout,p=d.get("text-font"),m=d.get("text-field"),g=d.get("icon-image"),x=(m.value.kind!=="constant"||m.value.value instanceof si&&!m.value.value.isEmpty()||m.value.value.toString().length>0)&&(p.value.kind!=="constant"||p.value.value.length>0),b=g.value.kind!=="constant"||!!g.value.value||Object.keys(g.parameters).length>0,T=d.get("symbol-sort-key");if(this.features=[],!x&&!b)return;const M=r.iconDependencies,A=r.glyphDependencies,E=r.availableImages,D=new gt(this.zoom,{globalState:this.globalState});for(const{feature:F,id:U,index:ee,sourceLayerIndex:W}of t){const C=l._featureFilter.needGeometry,B=Zs(F,C);if(!l._featureFilter.filter(D,B,s))continue;let X,le;if(C||(B.geometry=$s(F)),x){const de=l.getValueAndResolveTokens("text-field",B,s,E),me=si.factory(de),we=this.hasRTLText=this.hasRTLText||jp(me);(!we||Lr.getRTLTextPluginStatus()==="unavailable"||we&&Lr.isParsed())&&(X=Tp(me,l,B))}if(b){const de=l.getValueAndResolveTokens("icon-image",B,s,E);le=de instanceof gi?de:gi.fromString(de)}if(!X&&!le)continue;const xe=this.sortFeaturesByKey?T.evaluate(B,{},s):void 0;if(this.features.push({id:U,text:X,icon:le,index:ee,sourceLayerIndex:W,geometry:B.geometry,properties:F.properties,type:Fp[F.type],sortKey:xe}),le&&(M[le.name]=!0),X){const de=p.evaluate(B,{},s).join(","),me=d.get("text-rotation-alignment")!=="viewport"&&d.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(z.an.vertical)>=0;for(const we of X.sections)if(we.image)M[we.image.name]=!0;else{const be=Lo(X.toString()),Te=we.fontStack||de,ge=A[Te]=A[Te]||{};this.calculateGlyphDependencies(we.text,ge,me,this.allowVerticalPlacement,be)}}}d.get("symbol-placement")==="line"&&(this.features=function(F){const U={},ee={},W=[];let C=0;function B(de){W.push(F[de]),C++}function X(de,me,we){const be=ee[de];return delete ee[de],ee[me]=be,W[be].geometry[0].pop(),W[be].geometry[0]=W[be].geometry[0].concat(we[0]),be}function le(de,me,we){const be=U[me];return delete U[me],U[de]=be,W[be].geometry[0].shift(),W[be].geometry[0]=we[0].concat(W[be].geometry[0]),be}function xe(de,me,we){const be=we?me[0][me[0].length-1]:me[0][0];return`${de}:${be.x}:${be.y}`}for(let de=0;de<F.length;de++){const me=F[de],we=me.geometry,be=me.text?me.text.toString():null;if(!be){B(de);continue}const Te=xe(be,we),ge=xe(be,we,!0);if(Te in ee&&ge in U&&ee[Te]!==U[ge]){const ke=le(Te,ge,we),Oe=X(Te,ge,W[ke].geometry);delete U[Te],delete ee[ge],ee[xe(be,W[Oe].geometry,!0)]=Oe,W[ke].geometry=null}else Te in ee?X(Te,ge,we):ge in U?le(Te,ge,we):(B(de),U[Te]=C-1,ee[ge]=C-1)}return W.filter(de=>de.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((F,U)=>F.sortKey-U.sortKey)}update(t,r,s){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,r,this.layers,s),this.icon.programConfigurations.updatePaintArrays(t,r,this.layers,s))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,r){const s=this.lineVertexArray.length;if(t.segment!==void 0){let l=t.dist(r[t.segment+1]),d=t.dist(r[t.segment]);const p={};for(let m=t.segment+1;m<r.length;m++)p[m]={x:r[m].x,y:r[m].y,tileUnitDistanceFromAnchor:l},m<r.length-1&&(l+=r[m+1].dist(r[m]));for(let m=t.segment||0;m>=0;m--)p[m]={x:r[m].x,y:r[m].y,tileUnitDistanceFromAnchor:d},m>0&&(d+=r[m-1].dist(r[m]));for(let m=0;m<r.length;m++){const g=p[m];this.lineVertexArray.emplaceBack(g.x,g.y,g.tileUnitDistanceFromAnchor)}}return{lineStartIndex:s,lineLength:this.lineVertexArray.length-s}}addSymbols(t,r,s,l,d,p,m,g,x,b,T,M){const A=t.indexArray,E=t.layoutVertexArray,D=t.segments.prepareSegment(4*r.length,E,A,this.canOverlap?p.sortKey:void 0),F=this.glyphOffsetArray.length,U=D.vertexLength,ee=this.allowVerticalPlacement&&m===z.an.vertical?Math.PI/2:0,W=p.text&&p.text.sections;for(let C=0;C<r.length;C++){const{tl:B,tr:X,bl:le,br:xe,tex:de,pixelOffsetTL:me,pixelOffsetBR:we,minFontScaleX:be,minFontScaleY:Te,glyphOffset:ge,isSDF:ke,sectionIndex:Oe}=r[C],Fe=D.vertexLength,Re=ge[1];pc(E,g.x,g.y,B.x,Re+B.y,de.x,de.y,s,ke,me.x,me.y,be,Te),pc(E,g.x,g.y,X.x,Re+X.y,de.x+de.w,de.y,s,ke,we.x,me.y,be,Te),pc(E,g.x,g.y,le.x,Re+le.y,de.x,de.y+de.h,s,ke,me.x,we.y,be,Te),pc(E,g.x,g.y,xe.x,Re+xe.y,de.x+de.w,de.y+de.h,s,ke,we.x,we.y,be,Te),bh(t.dynamicLayoutVertexArray,g,ee),A.emplaceBack(Fe,Fe+2,Fe+1),A.emplaceBack(Fe+1,Fe+2,Fe+3),D.vertexLength+=4,D.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(ge[0]),C!==r.length-1&&Oe===r[C+1].sectionIndex||t.programConfigurations.populatePaintArrays(E.length,p,p.index,{},M,W&&W[Oe])}t.placedSymbolArray.emplaceBack(g.x,g.y,F,this.glyphOffsetArray.length-F,U,x,b,g.segment,s?s[0]:0,s?s[1]:0,l[0],l[1],m,0,!1,0,T)}_addCollisionDebugVertex(t,r,s,l,d,p){return r.emplaceBack(0,0),t.emplaceBack(s.x,s.y,l,d,Math.round(p.x),Math.round(p.y))}addCollisionDebugVertices(t,r,s,l,d,p,m){const g=d.segments.prepareSegment(4,d.layoutVertexArray,d.indexArray),x=g.vertexLength,b=d.layoutVertexArray,T=d.collisionVertexArray,M=m.anchorX,A=m.anchorY;this._addCollisionDebugVertex(b,T,p,M,A,new Le(t,r)),this._addCollisionDebugVertex(b,T,p,M,A,new Le(s,r)),this._addCollisionDebugVertex(b,T,p,M,A,new Le(s,l)),this._addCollisionDebugVertex(b,T,p,M,A,new Le(t,l)),g.vertexLength+=4;const E=d.indexArray;E.emplaceBack(x,x+1),E.emplaceBack(x+1,x+2),E.emplaceBack(x+2,x+3),E.emplaceBack(x+3,x),g.primitiveLength+=4}addDebugCollisionBoxes(t,r,s,l){for(let d=t;d<r;d++){const p=this.collisionBoxArray.get(d);this.addCollisionDebugVertices(p.x1,p.y1,p.x2,p.y2,l?this.textCollisionBox:this.iconCollisionBox,p.anchorPoint,s)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Th(ht,Mu.members,ut),this.iconCollisionBox=new Th(ht,Mu.members,ut);for(let t=0;t<this.symbolInstances.length;t++){const r=this.symbolInstances.get(t);this.addDebugCollisionBoxes(r.textBoxStartIndex,r.textBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.iconBoxStartIndex,r.iconBoxEndIndex,r,!1),this.addDebugCollisionBoxes(r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex,r,!1)}}_deserializeCollisionBoxesForSymbol(t,r,s,l,d,p,m,g,x){const b={};for(let T=r;T<s;T++){const M=t.get(T);b.textBox={x1:M.x1,y1:M.y1,x2:M.x2,y2:M.y2,anchorPointX:M.anchorPointX,anchorPointY:M.anchorPointY},b.textFeatureIndex=M.featureIndex;break}for(let T=l;T<d;T++){const M=t.get(T);b.verticalTextBox={x1:M.x1,y1:M.y1,x2:M.x2,y2:M.y2,anchorPointX:M.anchorPointX,anchorPointY:M.anchorPointY},b.verticalTextFeatureIndex=M.featureIndex;break}for(let T=p;T<m;T++){const M=t.get(T);b.iconBox={x1:M.x1,y1:M.y1,x2:M.x2,y2:M.y2,anchorPointX:M.anchorPointX,anchorPointY:M.anchorPointY},b.iconFeatureIndex=M.featureIndex;break}for(let T=g;T<x;T++){const M=t.get(T);b.verticalIconBox={x1:M.x1,y1:M.y1,x2:M.x2,y2:M.y2,anchorPointX:M.anchorPointX,anchorPointY:M.anchorPointY},b.verticalIconFeatureIndex=M.featureIndex;break}return b}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){const s=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,s.textBoxStartIndex,s.textBoxEndIndex,s.verticalTextBoxStartIndex,s.verticalTextBoxEndIndex,s.iconBoxStartIndex,s.iconBoxEndIndex,s.verticalIconBoxStartIndex,s.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,r){const s=t.placedSymbolArray.get(r),l=s.vertexStartIndex+4*s.numGlyphs;for(let d=s.vertexStartIndex;d<l;d+=4)t.indexArray.emplaceBack(d,d+2,d+1),t.indexArray.emplaceBack(d+1,d+2,d+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const r=Math.sin(t),s=Math.cos(t),l=[],d=[],p=[];for(let m=0;m<this.symbolInstances.length;++m){p.push(m);const g=this.symbolInstances.get(m);l.push(0|Math.round(r*g.anchorX+s*g.anchorY)),d.push(g.featureIndex)}return p.sort((m,g)=>l[m]-l[g]||d[g]-d[m]),p}addToSortKeyRanges(t,r){const s=this.sortKeyRanges[this.sortKeyRanges.length-1];s&&s.sortKey===r?s.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const r of this.symbolInstanceIndexes){const s=this.symbolInstances.get(r);this.featureSortOrder.push(s.featureIndex),[s.rightJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.leftJustifiedTextSymbolIndex].forEach((l,d,p)=>{l>=0&&p.indexOf(l)===d&&this.addIndicesForPlacedSymbol(this.text,l)}),s.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,s.verticalPlacedTextSymbolIndex),s.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.placedIconSymbolIndex),s.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Vu,Nu;Ae("SymbolBucket",$a,{omit:["layers","collisionBoxArray","features","compareText"]}),$a.MAX_GLYPHS=65535,$a.addDynamicAttributes=bh;var Sh={get paint(){return Nu=Nu||new pi({"icon-opacity":new je(J.paint_symbol["icon-opacity"]),"icon-color":new je(J.paint_symbol["icon-color"]),"icon-halo-color":new je(J.paint_symbol["icon-halo-color"]),"icon-halo-width":new je(J.paint_symbol["icon-halo-width"]),"icon-halo-blur":new je(J.paint_symbol["icon-halo-blur"]),"icon-translate":new De(J.paint_symbol["icon-translate"]),"icon-translate-anchor":new De(J.paint_symbol["icon-translate-anchor"]),"text-opacity":new je(J.paint_symbol["text-opacity"]),"text-color":new je(J.paint_symbol["text-color"],{runtimeType:Ii,getOverride:n=>n.textColor,hasOverride:n=>!!n.textColor}),"text-halo-color":new je(J.paint_symbol["text-halo-color"]),"text-halo-width":new je(J.paint_symbol["text-halo-width"]),"text-halo-blur":new je(J.paint_symbol["text-halo-blur"]),"text-translate":new De(J.paint_symbol["text-translate"]),"text-translate-anchor":new De(J.paint_symbol["text-translate-anchor"])})},get layout(){return Vu=Vu||new pi({"symbol-placement":new De(J.layout_symbol["symbol-placement"]),"symbol-spacing":new De(J.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new De(J.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new je(J.layout_symbol["symbol-sort-key"]),"symbol-z-order":new De(J.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new De(J.layout_symbol["icon-allow-overlap"]),"icon-overlap":new De(J.layout_symbol["icon-overlap"]),"icon-ignore-placement":new De(J.layout_symbol["icon-ignore-placement"]),"icon-optional":new De(J.layout_symbol["icon-optional"]),"icon-rotation-alignment":new De(J.layout_symbol["icon-rotation-alignment"]),"icon-size":new je(J.layout_symbol["icon-size"]),"icon-text-fit":new De(J.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new De(J.layout_symbol["icon-text-fit-padding"]),"icon-image":new je(J.layout_symbol["icon-image"]),"icon-rotate":new je(J.layout_symbol["icon-rotate"]),"icon-padding":new je(J.layout_symbol["icon-padding"]),"icon-keep-upright":new De(J.layout_symbol["icon-keep-upright"]),"icon-offset":new je(J.layout_symbol["icon-offset"]),"icon-anchor":new je(J.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new De(J.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new De(J.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new De(J.layout_symbol["text-rotation-alignment"]),"text-field":new je(J.layout_symbol["text-field"]),"text-font":new je(J.layout_symbol["text-font"]),"text-size":new je(J.layout_symbol["text-size"]),"text-max-width":new je(J.layout_symbol["text-max-width"]),"text-line-height":new De(J.layout_symbol["text-line-height"]),"text-letter-spacing":new je(J.layout_symbol["text-letter-spacing"]),"text-justify":new je(J.layout_symbol["text-justify"]),"text-radial-offset":new je(J.layout_symbol["text-radial-offset"]),"text-variable-anchor":new De(J.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new je(J.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new je(J.layout_symbol["text-anchor"]),"text-max-angle":new De(J.layout_symbol["text-max-angle"]),"text-writing-mode":new De(J.layout_symbol["text-writing-mode"]),"text-rotate":new je(J.layout_symbol["text-rotate"]),"text-padding":new De(J.layout_symbol["text-padding"]),"text-keep-upright":new De(J.layout_symbol["text-keep-upright"]),"text-transform":new je(J.layout_symbol["text-transform"]),"text-offset":new je(J.layout_symbol["text-offset"]),"text-allow-overlap":new De(J.layout_symbol["text-allow-overlap"]),"text-overlap":new De(J.layout_symbol["text-overlap"]),"text-ignore-placement":new De(J.layout_symbol["text-ignore-placement"]),"text-optional":new De(J.layout_symbol["text-optional"])})}};class Uu{constructor(t){if(t.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:Qr,this.defaultValue=t}evaluate(t){if(t.formattedSection){const r=this.defaultValue.property.overrides;if(r&&r.hasOverride(t.formattedSection))return r.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Ae("FormatSectionOverride",Uu,{omit:["defaultValue"]});class fc extends Jt{constructor(t){super(t,Sh)}recalculate(t,r){if(super.recalculate(t,r),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const s=this.layout.get("text-writing-mode");if(s){const l=[];for(const d of s)l.indexOf(d)<0&&l.push(d);this.layout._values["text-writing-mode"]=l}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,r,s,l){const d=this.layout.get(t).evaluate(r,{},s,l),p=this._unevaluatedLayout._values[t];return p.isDataDriven()||va(p.value)||!d?d:function(m,g){return g.replace(/{([^{}]+)}/g,(x,b)=>m&&b in m?String(m[b]):"")}(r.properties,d)}createBucket(t){return new $a(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of Sh.paint.overridableProperties){if(!fc.hasPaintOverride(this.layout,t))continue;const r=this.paint.get(t),s=new Uu(r),l=new xa(s,r.property.specification);let d=null;d=r.value.kind==="constant"||r.value.kind==="source"?new Ms("source",l):new wa("composite",l,r.value.zoomStops),this.paint._values[t]=new ar(r.property,d,r.parameters)}}_handleOverridablePaintPropertyUpdate(t,r,s){return!(!this.layout||r.isDataDriven()||s.isDataDriven())&&fc.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,r){const s=t.get("text-field"),l=Sh.paint.properties[r];let d=!1;const p=m=>{for(const g of m)if(l.overrides&&l.overrides.hasOverride(g))return void(d=!0)};if(s.value.kind==="constant"&&s.value.value instanceof si)p(s.value.value.sections);else if(s.value.kind==="source"){const m=x=>{d||(x instanceof hi&&Ne(x.value)===en?p(x.value.sections):x instanceof xs?p(x.sections):x.eachChild(m))},g=s.value;g._styleExpression&&m(g._styleExpression.expression)}return d}}let $u;var Vp={get paint(){return $u=$u||new pi({"background-color":new De(J.paint_background["background-color"]),"background-pattern":new Vo(J.paint_background["background-pattern"]),"background-opacity":new De(J.paint_background["background-opacity"])})}};class Np extends Jt{constructor(t){super(t,Vp)}}let Zu;var Up={get paint(){return Zu=Zu||new pi({"raster-opacity":new De(J.paint_raster["raster-opacity"]),"raster-hue-rotate":new De(J.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new De(J.paint_raster["raster-brightness-min"]),"raster-brightness-max":new De(J.paint_raster["raster-brightness-max"]),"raster-saturation":new De(J.paint_raster["raster-saturation"]),"raster-contrast":new De(J.paint_raster["raster-contrast"]),"raster-resampling":new De(J.paint_raster["raster-resampling"]),"raster-fade-duration":new De(J.paint_raster["raster-fade-duration"])})}};class $p extends Jt{constructor(t){super(t,Up)}}class Zp extends Jt{constructor(t){super(t,{}),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=t}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class Gp{constructor(t){this._methodToThrottle=t,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const qp={once:!0},Ph=63710088e-1;class Jn{constructor(t,r){if(isNaN(t)||isNaN(r))throw new Error(`Invalid LngLat object: (${t}, ${r})`);if(this.lng=+t,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Jn(rs(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const r=Math.PI/180,s=this.lat*r,l=t.lat*r,d=Math.sin(s)*Math.sin(l)+Math.cos(s)*Math.cos(l)*Math.cos((t.lng-this.lng)*r);return Ph*Math.acos(Math.min(d,1))}static convert(t){if(t instanceof Jn)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new Jn(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new Jn(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const Gu=2*Math.PI*Ph;function qu(n){return Gu*Math.cos(n*Math.PI/180)}function Wu(n){return(180+n)/360}function Hu(n){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+n*Math.PI/360)))/360}function Xu(n,t){return n/qu(t)}function Mh(n){return 360/Math.PI*Math.atan(Math.exp((180-360*n)*Math.PI/180))-90}function Yu(n,t){return n*qu(Mh(t))}class ol{constructor(t,r,s=0){this.x=+t,this.y=+r,this.z=+s}static fromLngLat(t,r=0){const s=Jn.convert(t);return new ol(Wu(s.lng),Hu(s.lat),Xu(r,s.lat))}toLngLat(){return new Jn(360*this.x-180,Mh(this.y))}toAltitude(){return Yu(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Gu*(t=Mh(this.y),1/Math.cos(t*Math.PI/180));var t}}function Ku(n,t,r){var s=2*Math.PI*6378137/256/Math.pow(2,r);return[n*s-2*Math.PI*6378137/2,t*s-2*Math.PI*6378137/2]}class Ih{constructor(t,r,s){if(!function(l,d,p){return!(l<0||l>25||p<0||p>=Math.pow(2,l)||d<0||d>=Math.pow(2,l))}(t,r,s))throw new Error(`x=${r}, y=${s}, z=${t} outside of bounds. 0<=x<${Math.pow(2,t)}, 0<=y<${Math.pow(2,t)} 0<=z<=25 `);this.z=t,this.x=r,this.y=s,this.key=Za(0,t,t,r,s)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,r,s){const l=(p=this.y,m=this.z,g=Ku(256*(d=this.x),256*(p=Math.pow(2,m)-p-1),m),x=Ku(256*(d+1),256*(p+1),m),g[0]+","+g[1]+","+x[0]+","+x[1]);var d,p,m,g,x;const b=function(T,M,A){let E,D="";for(let F=T;F>0;F--)E=1<<F-1,D+=(M&E?1:0)+(A&E?2:0);return D}(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(s==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,r>1?"@2x":"").replace(/{quadkey}/g,b).replace(/{bbox-epsg-3857}/g,l)}isChildOf(t){const r=this.z-t.z;return r>0&&t.x===this.x>>r&&t.y===this.y>>r}getTilePoint(t){const r=Math.pow(2,this.z);return new Le((t.x*r-this.x)*ct,(t.y*r-this.y)*ct)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Ju{constructor(t,r){this.wrap=t,this.canonical=r,this.key=Za(t,r.z,r.z,r.x,r.y)}}class Wi{constructor(t,r,s,l,d){if(this.terrainRttPosMatrix32f=null,t<s)throw new Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${s}`);this.overscaledZ=t,this.wrap=r,this.canonical=new Ih(s,+l,+d),this.key=Za(r,t,s,l,d)}clone(){return new Wi(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const r=this.canonical.z-t;return t>this.canonical.z?new Wi(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Wi(t,this.wrap,t,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(t,r){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const s=this.canonical.z-t;return t>this.canonical.z?Za(this.wrap*+r,t,this.canonical.z,this.canonical.x,this.canonical.y):Za(this.wrap*+r,t,t,this.canonical.x>>s,this.canonical.y>>s)}isChildOf(t){if(t.wrap!==this.wrap)return!1;const r=this.canonical.z-t.canonical.z;return t.overscaledZ===0||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>r&&t.canonical.y===this.canonical.y>>r}children(t){if(this.overscaledZ>=t)return[new Wi(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const r=this.canonical.z+1,s=2*this.canonical.x,l=2*this.canonical.y;return[new Wi(r,this.wrap,r,s,l),new Wi(r,this.wrap,r,s+1,l),new Wi(r,this.wrap,r,s,l+1),new Wi(r,this.wrap,r,s+1,l+1)]}isLessThan(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new Wi(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new Wi(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Ju(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new ol(t.x-this.wrap,t.y))}}function Za(n,t,r,s,l){(n*=2)<0&&(n=-1*n-1);const d=1<<r;return(d*d*n+d*l+s).toString(36)+r.toString(36)+t.toString(36)}Ae("CanonicalTileID",Ih),Ae("OverscaledTileID",Wi,{omit:["terrainRttPosMatrix32f"]});class Ws{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(t){return this.minX=Math.min(this.minX,t.x),this.minY=Math.min(this.minY,t.y),this.maxX=Math.max(this.maxX,t.x),this.maxY=Math.max(this.maxY,t.y),this}expandBy(t){return this.minX-=t,this.minY-=t,this.maxX+=t,this.maxY+=t,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(t){return this.expandBy(-t)}map(t){const r=new Ws;return r.extend(t(new Le(this.minX,this.minY))),r.extend(t(new Le(this.maxX,this.minY))),r.extend(t(new Le(this.minX,this.maxY))),r.extend(t(new Le(this.maxX,this.maxY))),r}static fromPoints(t){const r=new Ws;for(const s of t)r.extend(s);return r}contains(t){return t.x>=this.minX&&t.x<=this.maxX&&t.y>=this.minY&&t.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(t){return!this.empty()&&!t.empty()&&t.minX>=this.minX&&t.maxX<=this.maxX&&t.minY>=this.minY&&t.maxY<=this.maxY}intersects(t){return!this.empty()&&!t.empty()&&t.minX<=this.maxX&&t.maxX>=this.minX&&t.minY<=this.maxY&&t.maxY>=this.minY}}class Qu{constructor(t){this._stringToNumber={},this._numberToString=[];for(let r=0;r<t.length;r++){const s=t[r];this._stringToNumber[s]=r,this._numberToString[r]=s}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class ed{constructor(t,r,s,l,d){this.type="Feature",this._vectorTileFeature=t,t._z=r,t._x=s,t._y=l,this.properties=t.properties,this.id=d}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={geometry:this.geometry};for(const r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&(t[r]=this[r]);return t}}class td{constructor(t,r){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new qn(ct,16,0),this.grid3D=new qn(ct,16,0),this.featureIndexArray=new he,this.promoteId=r}insert(t,r,s,l,d,p){const m=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(s,l,d);const g=p?this.grid3D:this.grid;for(let x=0;x<r.length;x++){const b=r[x],T=[1/0,1/0,-1/0,-1/0];for(let M=0;M<b.length;M++){const A=b[M];T[0]=Math.min(T[0],A.x),T[1]=Math.min(T[1],A.y),T[2]=Math.max(T[2],A.x),T[3]=Math.max(T[3],A.y)}T[0]<ct&&T[1]<ct&&T[2]>=0&&T[3]>=0&&g.insert(m,T[0],T[1],T[2],T[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new il.VectorTile(new _h(this.rawTileData)).layers,this.sourceLayerCoder=new Qu(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,r,s,l){this.loadVTLayers();const d=t.params,p=ct/t.tileSize/t.scale,m=Dr(d.filter),g=t.queryGeometry,x=t.queryPadding*p,b=Ws.fromPoints(g),T=this.grid.query(b.minX-x,b.minY-x,b.maxX+x,b.maxY+x),M=Ws.fromPoints(t.cameraQueryGeometry).expandBy(x),A=this.grid3D.query(M.minX,M.minY,M.maxX,M.maxY,(F,U,ee,W)=>function(C,B,X,le,xe){for(const me of C)if(B<=me.x&&X<=me.y&&le>=me.x&&xe>=me.y)return!0;const de=[new Le(B,X),new Le(B,xe),new Le(le,xe),new Le(le,X)];if(C.length>2){for(const me of de)if(Oa(C,me))return!0}for(let me=0;me<C.length-1;me++)if(Dd(C[me],C[me+1],de))return!0;return!1}(t.cameraQueryGeometry,F-x,U-x,ee+x,W+x));for(const F of A)T.push(F);T.sort(Wp);const E={};let D;for(let F=0;F<T.length;F++){const U=T[F];if(U===D)continue;D=U;const ee=this.featureIndexArray.get(U);let W=null;this.loadMatchingFeature(E,ee.bucketIndex,ee.sourceLayerIndex,ee.featureIndex,m,d.layers,d.availableImages,r,s,l,(C,B,X)=>(W||(W=$s(C)),B.queryIntersectsFeature({queryGeometry:g,feature:C,featureState:X,geometry:W,zoom:this.z,transform:t.transform,pixelsToTileUnits:p,pixelPosMatrix:t.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:t.getElevation})))}return E}loadMatchingFeature(t,r,s,l,d,p,m,g,x,b,T){const M=this.bucketLayerIDs[r];if(p&&!M.some(F=>p.has(F)))return;const A=this.sourceLayerCoder.decode(s),E=this.vtLayers[A].feature(l);if(d.needGeometry){const F=Zs(E,!0);if(!d.filter(new gt(this.tileID.overscaledZ),F,this.tileID.canonical))return}else if(!d.filter(new gt(this.tileID.overscaledZ),E))return;const D=this.getId(E,A);for(let F=0;F<M.length;F++){const U=M[F];if(p&&!p.has(U))continue;const ee=g[U];if(!ee)continue;let W={};D&&b&&(W=b.getState(ee.sourceLayer||"_geojsonTileLayer",D));const C=Si({},x[U]);C.paint=id(C.paint,ee.paint,E,W,m),C.layout=id(C.layout,ee.layout,E,W,m);const B=!T||T(E,ee,W);if(!B)continue;const X=new ed(E,this.z,this.x,this.y,D);X.layer=C;let le=t[U];le===void 0&&(le=t[U]=[]),le.push({featureIndex:l,feature:X,intersectionZ:B})}}lookupSymbolFeatures(t,r,s,l,d,p,m,g){const x={};this.loadVTLayers();const b=Dr(d);for(const T of t)this.loadMatchingFeature(x,s,l,T,b,p,m,g,r);return x}hasLayer(t){for(const r of this.bucketLayerIDs)for(const s of r)if(t===s)return!0;return!1}getId(t,r){var s;let l=t.id;return this.promoteId&&(l=t.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[r]],typeof l=="boolean"&&(l=Number(l)),l===void 0&&(!((s=t.properties)===null||s===void 0)&&s.cluster)&&this.promoteId&&(l=Number(t.properties.cluster_id))),l}}function id(n,t,r,s,l){return Mt(n,(d,p)=>{const m=t instanceof Ra?t.get(p):null;return m&&m.evaluate?m.evaluate(r,s,l):m})}function Wp(n,t){return t-n}function rd(n,t,r,s,l){const d=[];for(let p=0;p<n.length;p++){const m=n[p];let g;for(let x=0;x<m.length-1;x++){let b=m[x],T=m[x+1];b.x<t&&T.x<t||(b.x<t?b=new Le(t,b.y+(t-b.x)/(T.x-b.x)*(T.y-b.y))._round():T.x<t&&(T=new Le(t,b.y+(t-b.x)/(T.x-b.x)*(T.y-b.y))._round()),b.y<r&&T.y<r||(b.y<r?b=new Le(b.x+(r-b.y)/(T.y-b.y)*(T.x-b.x),r)._round():T.y<r&&(T=new Le(b.x+(r-b.y)/(T.y-b.y)*(T.x-b.x),r)._round()),b.x>=s&&T.x>=s||(b.x>=s?b=new Le(s,b.y+(s-b.x)/(T.x-b.x)*(T.y-b.y))._round():T.x>=s&&(T=new Le(s,b.y+(s-b.x)/(T.x-b.x)*(T.y-b.y))._round()),b.y>=l&&T.y>=l||(b.y>=l?b=new Le(b.x+(l-b.y)/(T.y-b.y)*(T.x-b.x),l)._round():T.y>=l&&(T=new Le(b.x+(l-b.y)/(T.y-b.y)*(T.x-b.x),l)._round()),g&&b.equals(g[g.length-1])||(g=[b],d.push(g)),g.push(T)))))}}return d}Ae("FeatureIndex",td,{omit:["rawTileData","sourceLayerCoder"]});class Qn extends Le{constructor(t,r,s,l){super(t,r),this.angle=s,l!==void 0&&(this.segment=l)}clone(){return new Qn(this.x,this.y,this.angle,this.segment)}}function nd(n,t,r,s,l){if(t.segment===void 0||r===0)return!0;let d=t,p=t.segment+1,m=0;for(;m>-r/2;){if(p--,p<0)return!1;m-=n[p].dist(d),d=n[p]}m+=n[p].dist(n[p+1]),p++;const g=[];let x=0;for(;m<r/2;){const b=n[p],T=n[p+1];if(!T)return!1;let M=n[p-1].angleTo(b)-b.angleTo(T);for(M=Math.abs((M+3*Math.PI)%(2*Math.PI)-Math.PI),g.push({distance:m,angleDelta:M}),x+=M;m-g[0].distance>s;)x-=g.shift().angleDelta;if(x>l)return!1;p++,m+=b.dist(T)}return!0}function sd(n){let t=0;for(let r=0;r<n.length-1;r++)t+=n[r].dist(n[r+1]);return t}function ad(n,t,r){return n?.6*t*r:0}function od(n,t){return Math.max(n?n.right-n.left:0,t?t.right-t.left:0)}function Hp(n,t,r,s,l,d){const p=ad(r,l,d),m=od(r,s)*d;let g=0;const x=sd(n)/2;for(let b=0;b<n.length-1;b++){const T=n[b],M=n[b+1],A=T.dist(M);if(g+A>x){const E=(x-g)/A,D=Ai.number(T.x,M.x,E),F=Ai.number(T.y,M.y,E),U=new Qn(D,F,M.angleTo(T),b);return U._round(),!p||nd(n,U,m,p,t)?U:void 0}g+=A}}function Xp(n,t,r,s,l,d,p,m,g){const x=ad(s,d,p),b=od(s,l),T=b*p,M=n[0].x===0||n[0].x===g||n[0].y===0||n[0].y===g;return t-T<t/4&&(t=T+t/4),ld(n,M?t/2*m%t:(b/2+2*d)*p*m%t,t,x,r,T,M,!1,g)}function ld(n,t,r,s,l,d,p,m,g){const x=d/2,b=sd(n);let T=0,M=t-r,A=[];for(let E=0;E<n.length-1;E++){const D=n[E],F=n[E+1],U=D.dist(F),ee=F.angleTo(D);for(;M+r<T+U;){M+=r;const W=(M-T)/U,C=Ai.number(D.x,F.x,W),B=Ai.number(D.y,F.y,W);if(C>=0&&C<g&&B>=0&&B<g&&M-x>=0&&M+x<=b){const X=new Qn(C,B,ee,E);X._round(),s&&!nd(n,X,d,s,l)||A.push(X)}}T+=U}return m||A.length||p||(A=ld(n,T/2,r,s,l,d,p,!0,g)),A}function cd(n,t,r,s){const l=[],d=n.image,p=d.pixelRatio,m=d.paddedRect.w-2,g=d.paddedRect.h-2;let x={x1:n.left,y1:n.top,x2:n.right,y2:n.bottom};const b=d.stretchX||[[0,m]],T=d.stretchY||[[0,g]],M=(ge,ke)=>ge+ke[1]-ke[0],A=b.reduce(M,0),E=T.reduce(M,0),D=m-A,F=g-E;let U=0,ee=A,W=0,C=E,B=0,X=D,le=0,xe=F;if(d.content&&s){const ge=d.content,ke=ge[2]-ge[0],Oe=ge[3]-ge[1];(d.textFitWidth||d.textFitHeight)&&(x=Fu(n)),U=mc(b,0,ge[0]),W=mc(T,0,ge[1]),ee=mc(b,ge[0],ge[2]),C=mc(T,ge[1],ge[3]),B=ge[0]-U,le=ge[1]-W,X=ke-ee,xe=Oe-C}const de=x.x1,me=x.y1,we=x.x2-de,be=x.y2-me,Te=(ge,ke,Oe,Fe)=>{const Re=_c(ge.stretch-U,ee,we,de),tt=gc(ge.fixed-B,X,ge.stretch,A),At=_c(ke.stretch-W,C,be,me),jt=gc(ke.fixed-le,xe,ke.stretch,E),li=_c(Oe.stretch-U,ee,we,de),Hi=gc(Oe.fixed-B,X,Oe.stretch,A),zi=_c(Fe.stretch-W,C,be,me),ii=gc(Fe.fixed-le,xe,Fe.stretch,E),St=new Le(Re,At),qt=new Le(li,At),ri=new Le(li,zi),ni=new Le(Re,zi),wi=new Le(tt/p,jt/p),Xi=new Le(Hi/p,ii/p),Wt=t*Math.PI/180;if(Wt){const Ht=Math.sin(Wt),Xt=Math.cos(Wt),Bt=[Xt,-Ht,Ht,Xt];St._matMult(Bt),qt._matMult(Bt),ni._matMult(Bt),ri._matMult(Bt)}const ki=ge.stretch+ge.fixed,Vt=ke.stretch+ke.fixed;return{tl:St,tr:qt,bl:ni,br:ri,tex:{x:d.paddedRect.x+1+ki,y:d.paddedRect.y+1+Vt,w:Oe.stretch+Oe.fixed-ki,h:Fe.stretch+Fe.fixed-Vt},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:wi,pixelOffsetBR:Xi,minFontScaleX:X/p/we,minFontScaleY:xe/p/be,isSDF:r}};if(s&&(d.stretchX||d.stretchY)){const ge=hd(b,D,A),ke=hd(T,F,E);for(let Oe=0;Oe<ge.length-1;Oe++){const Fe=ge[Oe],Re=ge[Oe+1];for(let tt=0;tt<ke.length-1;tt++)l.push(Te(Fe,ke[tt],Re,ke[tt+1]))}}else l.push(Te({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:m+1},{fixed:0,stretch:g+1}));return l}function mc(n,t,r){let s=0;for(const l of n)s+=Math.max(t,Math.min(r,l[1]))-Math.max(t,Math.min(r,l[0]));return s}function hd(n,t,r){const s=[{fixed:-1,stretch:0}];for(const[l,d]of n){const p=s[s.length-1];s.push({fixed:l-p.stretch,stretch:p.stretch}),s.push({fixed:l-p.stretch,stretch:p.stretch+(d-l)})}return s.push({fixed:t+1,stretch:r}),s}function _c(n,t,r,s){return n/t*r+s}function gc(n,t,r,s){return n-t*r/s}Ae("Anchor",Qn);class yc{constructor(t,r,s,l,d,p,m,g,x,b){var T;if(this.boxStartIndex=t.length,x){let M=p.top,A=p.bottom;const E=p.collisionPadding;E&&(M-=E[1],A+=E[3]);let D=A-M;D>0&&(D=Math.max(10,D),this.circleDiameter=D)}else{const M=!((T=p.image)===null||T===void 0)&&T.content&&(p.image.textFitWidth||p.image.textFitHeight)?Fu(p):{x1:p.left,y1:p.top,x2:p.right,y2:p.bottom};M.y1=M.y1*m-g[0],M.y2=M.y2*m+g[2],M.x1=M.x1*m-g[3],M.x2=M.x2*m+g[1];const A=p.collisionPadding;if(A&&(M.x1-=A[0]*m,M.y1-=A[1]*m,M.x2+=A[2]*m,M.y2+=A[3]*m),b){const E=new Le(M.x1,M.y1),D=new Le(M.x2,M.y1),F=new Le(M.x1,M.y2),U=new Le(M.x2,M.y2),ee=b*Math.PI/180;E._rotate(ee),D._rotate(ee),F._rotate(ee),U._rotate(ee),M.x1=Math.min(E.x,D.x,F.x,U.x),M.x2=Math.max(E.x,D.x,F.x,U.x),M.y1=Math.min(E.y,D.y,F.y,U.y),M.y2=Math.max(E.y,D.y,F.y,U.y)}t.emplaceBack(r.x,r.y,M.x1,M.y1,M.x2,M.y2,s,l,d)}this.boxEndIndex=t.length}}class Yp{constructor(t=[],r=(s,l)=>s<l?-1:s>l?1:0){if(this.data=t,this.length=this.data.length,this.compare=r,this.length>0)for(let s=(this.length>>1)-1;s>=0;s--)this._down(s)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;const t=this.data[0],r=this.data.pop();return--this.length>0&&(this.data[0]=r,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:r,compare:s}=this,l=r[t];for(;t>0;){const d=t-1>>1,p=r[d];if(s(l,p)>=0)break;r[t]=p,t=d}r[t]=l}_down(t){const{data:r,compare:s}=this,l=this.length>>1,d=r[t];for(;t<l;){let p=1+(t<<1);const m=p+1;if(m<this.length&&s(r[m],r[p])<0&&(p=m),s(r[p],d)>=0)break;r[t]=r[p],t=p}r[t]=d}}function Kp(n,t=1,r=!1){const s=Ws.fromPoints(n[0]),l=Math.min(s.width(),s.height());let d=l/2;const p=new Yp([],Jp),{minX:m,minY:g,maxX:x,maxY:b}=s;if(l===0)return new Le(m,g);for(let A=m;A<x;A+=l)for(let E=g;E<b;E+=l)p.push(new Ga(A+d,E+d,d,n));let T=function(A){let E=0,D=0,F=0;const U=A[0];for(let ee=0,W=U.length,C=W-1;ee<W;C=ee++){const B=U[ee],X=U[C],le=B.x*X.y-X.x*B.y;D+=(B.x+X.x)*le,F+=(B.y+X.y)*le,E+=3*le}return new Ga(D/E,F/E,0,A)}(n),M=p.length;for(;p.length;){const A=p.pop();(A.d>T.d||!T.d)&&(T=A,r&&console.log("found best %d after %d probes",Math.round(1e4*A.d)/1e4,M)),A.max-T.d<=t||(d=A.h/2,p.push(new Ga(A.p.x-d,A.p.y-d,d,n)),p.push(new Ga(A.p.x+d,A.p.y-d,d,n)),p.push(new Ga(A.p.x-d,A.p.y+d,d,n)),p.push(new Ga(A.p.x+d,A.p.y+d,d,n)),M+=4)}return r&&(console.log(`num probes: ${M}`),console.log(`best distance: ${T.d}`)),T.p}function Jp(n,t){return t.max-n.max}function Ga(n,t,r,s){this.p=new Le(n,t),this.h=r,this.d=function(l,d){let p=!1,m=1/0;for(let g=0;g<d.length;g++){const x=d[g];for(let b=0,T=x.length,M=T-1;b<T;M=b++){const A=x[b],E=x[M];A.y>l.y!=E.y>l.y&&l.x<(E.x-A.x)*(l.y-A.y)/(E.y-A.y)+A.x&&(p=!p),m=Math.min(m,$h(l,A,E))}}return(p?1:-1)*Math.sqrt(m)}(this.p,s),this.max=this.d+this.h*Math.SQRT2}var oi;z.aD=void 0,(oi=z.aD||(z.aD={}))[oi.center=1]="center",oi[oi.left=2]="left",oi[oi.right=3]="right",oi[oi.top=4]="top",oi[oi.bottom=5]="bottom",oi[oi["top-left"]=6]="top-left",oi[oi["top-right"]=7]="top-right",oi[oi["bottom-left"]=8]="bottom-left",oi[oi["bottom-right"]=9]="bottom-right";const Ch=Number.POSITIVE_INFINITY;function ud(n,t){return t[1]!==Ch?function(r,s,l){let d=0,p=0;switch(s=Math.abs(s),l=Math.abs(l),r){case"top-right":case"top-left":case"top":p=l-7;break;case"bottom-right":case"bottom-left":case"bottom":p=7-l}switch(r){case"top-right":case"bottom-right":case"right":d=-s;break;case"top-left":case"bottom-left":case"left":d=s}return[d,p]}(n,t[0],t[1]):function(r,s){let l=0,d=0;s<0&&(s=0);const p=s/Math.SQRT2;switch(r){case"top-right":case"top-left":d=p-7;break;case"bottom-right":case"bottom-left":d=7-p;break;case"bottom":d=7-s;break;case"top":d=s-7}switch(r){case"top-right":case"bottom-right":l=-p;break;case"top-left":case"bottom-left":l=p;break;case"left":l=s;break;case"right":l=-s}return[l,d]}(n,t[0])}function dd(n,t,r){var s;const l=n.layout,d=(s=l.get("text-variable-anchor-offset"))===null||s===void 0?void 0:s.evaluate(t,{},r);if(d){const m=d.values,g=[];for(let x=0;x<m.length;x+=2){const b=g[x]=m[x],T=m[x+1].map(M=>M*Gt);b.startsWith("top")?T[1]-=7:b.startsWith("bottom")&&(T[1]+=7),g[x+1]=T}return new rt(g)}const p=l.get("text-variable-anchor");if(p){let m;m=n._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[l.get("text-radial-offset").evaluate(t,{},r)*Gt,Ch]:l.get("text-offset").evaluate(t,{},r).map(x=>x*Gt);const g=[];for(const x of p)g.push(x,ud(x,m));return new rt(g)}return null}function Ah(n){switch(n){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Qp(n,t,r,s,l,d,p,m,g,x,b,T){let M=d.textMaxSize.evaluate(t,{});M===void 0&&(M=p);const A=n.layers[0].layout,E=A.get("icon-offset").evaluate(t,{},b),D=fd(r.horizontal),F=p/24,U=n.tilePixelRatio*F,ee=n.tilePixelRatio*M/24,W=n.tilePixelRatio*m,C=n.tilePixelRatio*A.get("symbol-spacing"),B=A.get("text-padding")*n.tilePixelRatio,X=function(Oe,Fe,Re,tt=1){const At=Oe.get("icon-padding").evaluate(Fe,{},Re),jt=At&&At.values;return[jt[0]*tt,jt[1]*tt,jt[2]*tt,jt[3]*tt]}(A,t,b,n.tilePixelRatio),le=A.get("text-max-angle")/180*Math.PI,xe=A.get("text-rotation-alignment")!=="viewport"&&A.get("symbol-placement")!=="point",de=A.get("icon-rotation-alignment")==="map"&&A.get("symbol-placement")!=="point",me=A.get("symbol-placement"),we=C/2,be=A.get("icon-text-fit");let Te;s&&be!=="none"&&(n.allowVerticalPlacement&&r.vertical&&(Te=Ou(s,r.vertical,be,A.get("icon-text-fit-padding"),E,F)),D&&(s=Ou(s,D,be,A.get("icon-text-fit-padding"),E,F)));const ge=b?T.line.getGranularityForZoomLevel(b.z):1,ke=(Oe,Fe)=>{Fe.x<0||Fe.x>=ct||Fe.y<0||Fe.y>=ct||function(Re,tt,At,jt,li,Hi,zi,ii,St,qt,ri,ni,wi,Xi,Wt,ki,Vt,Ht,Xt,Bt,_t,xr,qa,vr,rf){const Wa=Re.addToLineVertexArray(tt,At);let Hs,Ha,Xa,Ya,yd=0,xd=0,vd=0,bd=0,Fh=-1,Oh=-1;const mn={};let wd=bi("");if(Re.allowVerticalPlacement&&jt.vertical){const mi=ii.layout.get("text-rotate").evaluate(_t,{},vr)+90;Xa=new yc(St,tt,qt,ri,ni,jt.vertical,wi,Xi,Wt,mi),zi&&(Ya=new yc(St,tt,qt,ri,ni,zi,Vt,Ht,Wt,mi))}if(li){const mi=ii.layout.get("icon-rotate").evaluate(_t,{}),Yi=ii.layout.get("icon-text-fit")!=="none",Xs=cd(li,mi,qa,Yi),wr=zi?cd(zi,mi,qa,Yi):void 0;Ha=new yc(St,tt,qt,ri,ni,li,Vt,Ht,!1,mi),yd=4*Xs.length;const Ys=Re.iconSizeData;let $r=null;Ys.kind==="source"?($r=[fn*ii.layout.get("icon-size").evaluate(_t,{})],$r[0]>Kn&&Yt(`${Re.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):Ys.kind==="composite"&&($r=[fn*xr.compositeIconSizes[0].evaluate(_t,{},vr),fn*xr.compositeIconSizes[1].evaluate(_t,{},vr)],($r[0]>Kn||$r[1]>Kn)&&Yt(`${Re.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),Re.addSymbols(Re.icon,Xs,$r,Bt,Xt,_t,z.an.none,tt,Wa.lineStartIndex,Wa.lineLength,-1,vr),Fh=Re.icon.placedSymbolArray.length-1,wr&&(xd=4*wr.length,Re.addSymbols(Re.icon,wr,$r,Bt,Xt,_t,z.an.vertical,tt,Wa.lineStartIndex,Wa.lineLength,-1,vr),Oh=Re.icon.placedSymbolArray.length-1)}const Td=Object.keys(jt.horizontal);for(const mi of Td){const Yi=jt.horizontal[mi];if(!Hs){wd=bi(Yi.text);const wr=ii.layout.get("text-rotate").evaluate(_t,{},vr);Hs=new yc(St,tt,qt,ri,ni,Yi,wi,Xi,Wt,wr)}const Xs=Yi.positionedLines.length===1;if(vd+=pd(Re,tt,Yi,Hi,ii,Wt,_t,ki,Wa,jt.vertical?z.an.horizontal:z.an.horizontalOnly,Xs?Td:[mi],mn,Fh,xr,vr),Xs)break}jt.vertical&&(bd+=pd(Re,tt,jt.vertical,Hi,ii,Wt,_t,ki,Wa,z.an.vertical,["vertical"],mn,Oh,xr,vr));const nf=Hs?Hs.boxStartIndex:Re.collisionBoxArray.length,sf=Hs?Hs.boxEndIndex:Re.collisionBoxArray.length,af=Xa?Xa.boxStartIndex:Re.collisionBoxArray.length,of=Xa?Xa.boxEndIndex:Re.collisionBoxArray.length,lf=Ha?Ha.boxStartIndex:Re.collisionBoxArray.length,cf=Ha?Ha.boxEndIndex:Re.collisionBoxArray.length,hf=Ya?Ya.boxStartIndex:Re.collisionBoxArray.length,uf=Ya?Ya.boxEndIndex:Re.collisionBoxArray.length;let br=-1;const vc=(mi,Yi)=>mi&&mi.circleDiameter?Math.max(mi.circleDiameter,Yi):Yi;br=vc(Hs,br),br=vc(Xa,br),br=vc(Ha,br),br=vc(Ya,br);const Sd=br>-1?1:0;Sd&&(br*=rf/Gt),Re.glyphOffsetArray.length>=$a.MAX_GLYPHS&&Yt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),_t.sortKey!==void 0&&Re.addToSortKeyRanges(Re.symbolInstances.length,_t.sortKey);const df=dd(ii,_t,vr),[pf,ff]=function(mi,Yi){const Xs=mi.length,wr=Yi?.values;if(wr?.length>0)for(let Ys=0;Ys<wr.length;Ys+=2){const $r=wr[Ys+1];mi.emplaceBack(z.aD[wr[Ys]],$r[0],$r[1])}return[Xs,mi.length]}(Re.textAnchorOffsets,df);Re.symbolInstances.emplaceBack(tt.x,tt.y,mn.right>=0?mn.right:-1,mn.center>=0?mn.center:-1,mn.left>=0?mn.left:-1,mn.vertical||-1,Fh,Oh,wd,nf,sf,af,of,lf,cf,hf,uf,qt,vd,bd,yd,xd,Sd,0,wi,br,pf,ff)}(n,Fe,Oe,r,s,l,Te,n.layers[0],n.collisionBoxArray,t.index,t.sourceLayerIndex,n.index,U,[B,B,B,B],xe,g,W,X,de,E,t,d,x,b,p)};if(me==="line")for(const Oe of rd(t.geometry,0,0,ct,ct)){const Fe=qs(Oe,ge),Re=Xp(Fe,C,le,r.vertical||D,s,24,ee,n.overscaling,ct);for(const tt of Re)D&&ef(n,D.text,we,tt)||ke(Fe,tt)}else if(me==="line-center"){for(const Oe of t.geometry)if(Oe.length>1){const Fe=qs(Oe,ge),Re=Hp(Fe,le,r.vertical||D,s,24,ee);Re&&ke(Fe,Re)}}else if(t.type==="Polygon")for(const Oe of da(t.geometry,0)){const Fe=Kp(Oe,16);ke(qs(Oe[0],ge,!0),new Qn(Fe.x,Fe.y,0))}else if(t.type==="LineString")for(const Oe of t.geometry){const Fe=qs(Oe,ge);ke(Fe,new Qn(Fe[0].x,Fe[0].y,0))}else if(t.type==="Point")for(const Oe of t.geometry)for(const Fe of Oe)ke([Fe],new Qn(Fe.x,Fe.y,0))}function pd(n,t,r,s,l,d,p,m,g,x,b,T,M,A,E){const D=function(ee,W,C,B,X,le,xe,de){const me=B.layout.get("text-rotate").evaluate(le,{})*Math.PI/180,we=[];for(const be of W.positionedLines)for(const Te of be.positionedGlyphs){if(!Te.rect)continue;const ge=Te.rect||{};let ke=4,Oe=!0,Fe=1,Re=0;const tt=(X||de)&&Te.vertical,At=Te.metrics.advance*Te.scale/2;if(de&&W.verticalizable&&(Re=be.lineOffset/2-(Te.imageName?-(Gt-Te.metrics.width*Te.scale)/2:(Te.scale-1)*Gt)),Te.imageName){const Ht=xe[Te.imageName];Oe=Ht.sdf,Fe=Ht.pixelRatio,ke=1/Fe}const jt=X?[Te.x+At,Te.y]:[0,0];let li=X?[0,0]:[Te.x+At+C[0],Te.y+C[1]-Re],Hi=[0,0];tt&&(Hi=li,li=[0,0]);const zi=Te.metrics.isDoubleResolution?2:1,ii=(Te.metrics.left-ke)*Te.scale-At+li[0],St=(-Te.metrics.top-ke)*Te.scale+li[1],qt=ii+ge.w/zi*Te.scale/Fe,ri=St+ge.h/zi*Te.scale/Fe,ni=new Le(ii,St),wi=new Le(qt,St),Xi=new Le(ii,ri),Wt=new Le(qt,ri);if(tt){const Ht=new Le(-At,At- -17),Xt=-Math.PI/2,Bt=12-At,_t=new Le(22-Bt,-(Te.imageName?Bt:0)),xr=new Le(...Hi);ni._rotateAround(Xt,Ht)._add(_t)._add(xr),wi._rotateAround(Xt,Ht)._add(_t)._add(xr),Xi._rotateAround(Xt,Ht)._add(_t)._add(xr),Wt._rotateAround(Xt,Ht)._add(_t)._add(xr)}if(me){const Ht=Math.sin(me),Xt=Math.cos(me),Bt=[Xt,-Ht,Ht,Xt];ni._matMult(Bt),wi._matMult(Bt),Xi._matMult(Bt),Wt._matMult(Bt)}const ki=new Le(0,0),Vt=new Le(0,0);we.push({tl:ni,tr:wi,bl:Xi,br:Wt,tex:ge,writingMode:W.writingMode,glyphOffset:jt,sectionIndex:Te.sectionIndex,isSDF:Oe,pixelOffsetTL:ki,pixelOffsetBR:Vt,minFontScaleX:0,minFontScaleY:0})}return we}(0,r,m,l,d,p,s,n.allowVerticalPlacement),F=n.textSizeData;let U=null;F.kind==="source"?(U=[fn*l.layout.get("text-size").evaluate(p,{})],U[0]>Kn&&Yt(`${n.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):F.kind==="composite"&&(U=[fn*A.compositeTextSizes[0].evaluate(p,{},E),fn*A.compositeTextSizes[1].evaluate(p,{},E)],(U[0]>Kn||U[1]>Kn)&&Yt(`${n.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),n.addSymbols(n.text,D,U,m,d,p,x,t,g.lineStartIndex,g.lineLength,M,E);for(const ee of b)T[ee]=n.text.placedSymbolArray.length-1;return 4*D.length}function fd(n){for(const t in n)return n[t];return null}function ef(n,t,r,s){const l=n.compareText;if(t in l){const d=l[t];for(let p=d.length-1;p>=0;p--)if(s.dist(d[p])<r)return!0}else l[t]=[];return l[t].push(s),!1}const md=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Eh{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[r,s]=new Uint8Array(t,0,2);if(r!==219)throw new Error("Data does not appear to be in a KDBush format.");const l=s>>4;if(l!==1)throw new Error(`Got v${l} data when expected v1.`);const d=md[15&s];if(!d)throw new Error("Unrecognized array type.");const[p]=new Uint16Array(t,2,1),[m]=new Uint32Array(t,4,1);return new Eh(m,p,d,t)}constructor(t,r=64,s=Float64Array,l){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=s,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const d=md.indexOf(this.ArrayType),p=2*t*this.ArrayType.BYTES_PER_ELEMENT,m=t*this.IndexArrayType.BYTES_PER_ELEMENT,g=(8-m%8)%8;if(d<0)throw new Error(`Unexpected typed array class: ${s}.`);l&&l instanceof ArrayBuffer?(this.data=l,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+m+g,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+p+m+g),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+m+g,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+d]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=t)}add(t,r){const s=this._pos>>1;return this.ids[s]=s,this.coords[this._pos++]=t,this.coords[this._pos++]=r,s}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return zh(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,r,s,l){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:d,coords:p,nodeSize:m}=this,g=[0,d.length-1,0],x=[];for(;g.length;){const b=g.pop()||0,T=g.pop()||0,M=g.pop()||0;if(T-M<=m){for(let F=M;F<=T;F++){const U=p[2*F],ee=p[2*F+1];U>=t&&U<=s&&ee>=r&&ee<=l&&x.push(d[F])}continue}const A=M+T>>1,E=p[2*A],D=p[2*A+1];E>=t&&E<=s&&D>=r&&D<=l&&x.push(d[A]),(b===0?t<=E:r<=D)&&(g.push(M),g.push(A-1),g.push(1-b)),(b===0?s>=E:l>=D)&&(g.push(A+1),g.push(T),g.push(1-b))}return x}within(t,r,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:l,coords:d,nodeSize:p}=this,m=[0,l.length-1,0],g=[],x=s*s;for(;m.length;){const b=m.pop()||0,T=m.pop()||0,M=m.pop()||0;if(T-M<=p){for(let F=M;F<=T;F++)gd(d[2*F],d[2*F+1],t,r)<=x&&g.push(l[F]);continue}const A=M+T>>1,E=d[2*A],D=d[2*A+1];gd(E,D,t,r)<=x&&g.push(l[A]),(b===0?t-s<=E:r-s<=D)&&(m.push(M),m.push(A-1),m.push(1-b)),(b===0?t+s>=E:r+s>=D)&&(m.push(A+1),m.push(T),m.push(1-b))}return g}}function zh(n,t,r,s,l,d){if(l-s<=r)return;const p=s+l>>1;_d(n,t,p,s,l,d),zh(n,t,r,s,p-1,1-d),zh(n,t,r,p+1,l,1-d)}function _d(n,t,r,s,l,d){for(;l>s;){if(l-s>600){const x=l-s+1,b=r-s+1,T=Math.log(x),M=.5*Math.exp(2*T/3),A=.5*Math.sqrt(T*M*(x-M)/x)*(b-x/2<0?-1:1);_d(n,t,r,Math.max(s,Math.floor(r-b*M/x+A)),Math.min(l,Math.floor(r+(x-b)*M/x+A)),d)}const p=t[2*r+d];let m=s,g=l;for(ll(n,t,s,r),t[2*l+d]>p&&ll(n,t,s,l);m<g;){for(ll(n,t,m,g),m++,g--;t[2*m+d]<p;)m++;for(;t[2*g+d]>p;)g--}t[2*s+d]===p?ll(n,t,s,g):(g++,ll(n,t,g,l)),g<=r&&(s=g+1),r<=g&&(l=g-1)}}function ll(n,t,r,s){kh(n,r,s),kh(t,2*r,2*s),kh(t,2*r+1,2*s+1)}function kh(n,t,r){const s=n[t];n[t]=n[r],n[r]=s}function gd(n,t,r,s){const l=n-r,d=t-s;return l*l+d*d}var Dh;z.cw=void 0,(Dh=z.cw||(z.cw={})).create="create",Dh.load="load",Dh.fullLoad="fullLoad";let xc=null,cl=[];const Rh=1e3/60,Lh="loadTime",Bh="fullLoadTime",tf={mark(n){performance.mark(n)},frame(n){const t=n;xc!=null&&cl.push(t-xc),xc=t},clearMetrics(){xc=null,cl=[],performance.clearMeasures(Lh),performance.clearMeasures(Bh);for(const n in z.cw)performance.clearMarks(z.cw[n])},getPerformanceMetrics(){performance.measure(Lh,z.cw.create,z.cw.load),performance.measure(Bh,z.cw.create,z.cw.fullLoad);const n=performance.getEntriesByName(Lh)[0].duration,t=performance.getEntriesByName(Bh)[0].duration,r=cl.length,s=1/(cl.reduce((d,p)=>d+p,0)/r/1e3),l=cl.filter(d=>d>Rh).reduce((d,p)=>d+(p-Rh)/Rh,0);return{loadTime:n,fullLoadTime:t,fps:s,percentDroppedFrames:l/(r+l)*100,totalFrames:r}}};z.$=ct,z.A=Pt,z.B=function([n,t,r]){return t+=90,t*=Math.PI/180,r*=Math.PI/180,{x:n*Math.cos(t)*Math.sin(r),y:n*Math.sin(t)*Math.sin(r),z:n*Math.cos(r)}},z.C=Ai,z.D=De,z.E=ye,z.F=gt,z.G=Ea,z.H=function(n){if(Yr==null){const t=n.navigator?n.navigator.userAgent:null;Yr=!!n.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return Yr},z.I=gh,z.J=class{constructor(n,t){this.target=n,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Gp(()=>this.process()),this.subscription=cr(this.target,"message",r=>this.receive(r),!1),this.globalScope=_i(self)?n:window}registerMessageHandler(n,t){this.messageHandlers[n]=t}sendAsync(n,t){return new Promise((r,s)=>{const l=Math.round(1e18*Math.random()).toString(36).substring(0,10),d=t?cr(t.signal,"abort",()=>{d?.unsubscribe(),delete this.resolveRejects[l];const g={id:l,type:"<cancel>",origin:location.origin,targetMapId:n.targetMapId,sourceMapId:this.mapId};this.target.postMessage(g)},qp):null;this.resolveRejects[l]={resolve:g=>{d?.unsubscribe(),r(g)},reject:g=>{d?.unsubscribe(),s(g)}};const p=[],m=Object.assign(Object.assign({},n),{id:l,sourceMapId:this.mapId,origin:location.origin,data:Rs(n.data,p)});this.target.postMessage(m,{transfer:p})})}receive(n){const t=n.data,r=t.id;if(!(t.origin!=="file://"&&location.origin!=="file://"&&t.origin!=="resource://android"&&location.origin!=="resource://android"&&t.origin!==location.origin||t.targetMapId&&this.mapId!==t.targetMapId)){if(t.type==="<cancel>"){delete this.tasks[r];const s=this.abortControllers[r];return delete this.abortControllers[r],void(s&&s.abort())}if(_i(self)||t.mustQueue)return this.tasks[r]=t,this.taskQueue.push(r),void this.invoker.trigger();this.processTask(r,t)}}process(){if(this.taskQueue.length===0)return;const n=this.taskQueue.shift(),t=this.tasks[n];delete this.tasks[n],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(n,t)}processTask(n,t){return c(this,void 0,void 0,function*(){if(t.type==="<response>"){const l=this.resolveRejects[n];return delete this.resolveRejects[n],l?void(t.error?l.reject(Wn(t.error)):l.resolve(Wn(t.data))):void 0}if(!this.messageHandlers[t.type])return void this.completeTask(n,new Error(`Could not find a registered handler for ${t.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const r=Wn(t.data),s=new AbortController;this.abortControllers[n]=s;try{const l=yield this.messageHandlers[t.type](t.sourceMapId,r,s);this.completeTask(n,null,l)}catch(l){this.completeTask(n,l)}})}completeTask(n,t,r){const s=[];delete this.abortControllers[n];const l={id:n,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t?Rs(t):null,data:Rs(r,s)};this.target.postMessage(l,{transfer:s})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},z.K=j,z.L=function(){var n=new Pt(16);return Pt!=Float32Array&&(n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0),n[0]=1,n[5]=1,n[10]=1,n[15]=1,n},z.M=function(n,t,r){var s,l,d,p,m,g,x,b,T,M,A,E,D=r[0],F=r[1],U=r[2];return t===n?(n[12]=t[0]*D+t[4]*F+t[8]*U+t[12],n[13]=t[1]*D+t[5]*F+t[9]*U+t[13],n[14]=t[2]*D+t[6]*F+t[10]*U+t[14],n[15]=t[3]*D+t[7]*F+t[11]*U+t[15]):(l=t[1],d=t[2],p=t[3],m=t[4],g=t[5],x=t[6],b=t[7],T=t[8],M=t[9],A=t[10],E=t[11],n[0]=s=t[0],n[1]=l,n[2]=d,n[3]=p,n[4]=m,n[5]=g,n[6]=x,n[7]=b,n[8]=T,n[9]=M,n[10]=A,n[11]=E,n[12]=s*D+m*F+T*U+t[12],n[13]=l*D+g*F+M*U+t[13],n[14]=d*D+x*F+A*U+t[14],n[15]=p*D+b*F+E*U+t[15]),n},z.N=function(n,t,r){var s=r[0],l=r[1],d=r[2];return n[0]=t[0]*s,n[1]=t[1]*s,n[2]=t[2]*s,n[3]=t[3]*s,n[4]=t[4]*l,n[5]=t[5]*l,n[6]=t[6]*l,n[7]=t[7]*l,n[8]=t[8]*d,n[9]=t[9]*d,n[10]=t[10]*d,n[11]=t[11]*d,n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15],n},z.O=function(n,t,r){var s=t[0],l=t[1],d=t[2],p=t[3],m=t[4],g=t[5],x=t[6],b=t[7],T=t[8],M=t[9],A=t[10],E=t[11],D=t[12],F=t[13],U=t[14],ee=t[15],W=r[0],C=r[1],B=r[2],X=r[3];return n[0]=W*s+C*m+B*T+X*D,n[1]=W*l+C*g+B*M+X*F,n[2]=W*d+C*x+B*A+X*U,n[3]=W*p+C*b+B*E+X*ee,n[4]=(W=r[4])*s+(C=r[5])*m+(B=r[6])*T+(X=r[7])*D,n[5]=W*l+C*g+B*M+X*F,n[6]=W*d+C*x+B*A+X*U,n[7]=W*p+C*b+B*E+X*ee,n[8]=(W=r[8])*s+(C=r[9])*m+(B=r[10])*T+(X=r[11])*D,n[9]=W*l+C*g+B*M+X*F,n[10]=W*d+C*x+B*A+X*U,n[11]=W*p+C*b+B*E+X*ee,n[12]=(W=r[12])*s+(C=r[13])*m+(B=r[14])*T+(X=r[15])*D,n[13]=W*l+C*g+B*M+X*F,n[14]=W*d+C*x+B*A+X*U,n[15]=W*p+C*b+B*E+X*ee,n},z.P=Le,z.Q=function(n,t){const r={};for(let s=0;s<t.length;s++){const l=t[s];l in n&&(r[l]=n[l])}return r},z.R=Ei,z.S=Jn,z.T=ih,z.U=Hu,z.V=Wu,z.W=ts,z.X=ci,z.Y=Kr,z.Z=Wi,z._=c,z.a=R,z.a$=function(n,t,r){return n[0]=t[0]*r,n[1]=t[1]*r,n[2]=t[2]*r,n[3]=t[3]*r,n},z.a0=ol,z.a1=Ws,z.a2=25,z.a3=Ih,z.a4=n=>{const t=window.document.createElement("video");return t.muted=!0,new Promise(r=>{t.onloadstart=()=>{r(t)};for(const s of n){const l=window.document.createElement("source");ce(s)||(t.crossOrigin="Anonymous"),l.src=s,t.appendChild(l)}})},z.a5=Se,z.a6=function(){return ns++},z.a7=V,z.a8=$a,z.a9=Dr,z.aA=Gt,z.aB=Ni,z.aC=function(n,t,r,s,l=!1){if(!r[0]&&!r[1])return[0,0];const d=l?s==="map"?-n.bearingInRadians:0:s==="viewport"?n.bearingInRadians:0;if(d){const p=Math.sin(d),m=Math.cos(d);r=[r[0]*m-r[1]*p,r[0]*p+r[1]*m]}return[l?r[0]:Ni(t,r[0],n.zoom),l?r[1]:Ni(t,r[1],n.zoom)]},z.aE=vh,z.aF=Ah,z.aG=xh,z.aH=Eh,z.aI=Ct,z.aJ=lc,z.aK=ae,z.aL=nt,z.aM=dt,z.aN=rs,z.aO=er,z.aP=Yu,z.aQ=Li,z.aR=Ir,z.aS=function(n){var t=new Pt(3);return t[0]=n[0],t[1]=n[1],t[2]=n[2],t},z.aT=function(n,t,r){return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[2]-r[2],n},z.aU=function(n,t){var r=t[0],s=t[1],l=t[2],d=r*r+s*s+l*l;return d>0&&(d=1/Math.sqrt(d)),n[0]=t[0]*d,n[1]=t[1]*d,n[2]=t[2]*d,n},z.aV=Wr,z.aW=function(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]},z.aX=function(n,t,r){return n[0]=t[0]*r[0],n[1]=t[1]*r[1],n[2]=t[2]*r[2],n[3]=t[3]*r[3],n},z.aY=Mr,z.aZ=function(n,t,r){const s=t[0]*r[0]+t[1]*r[1]+t[2]*r[2];return s===0?null:(-(n[0]*r[0]+n[1]*r[1]+n[2]*r[2])-r[3])/s},z.a_=gn,z.aa=Zs,z.ab=ed,z.ac=function(n){const t={};if(n.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,s,l,d)=>{const p=l||d;return t[s]=!p||p.toLowerCase(),""}),t["max-age"]){const r=parseInt(t["max-age"],10);isNaN(r)?delete t["max-age"]:t["max-age"]=r}return t},z.ad=Mi,z.ae=function(n){return Math.pow(2,n)},z.af=is,z.ag=Ft,z.ah=85.051129,z.ai=Xu,z.aj=function(n){return Math.log(n)/Math.LN2},z.ak=function(n){var t=n[0],r=n[1];return t*t+r*r},z.al=function(n,t){const r=[];for(const s in n)s in t||r.push(s);return r},z.am=function(n,t){let r=0,s=0;if(n.kind==="constant")s=n.layoutSize;else if(n.kind!=="source"){const{interpolationType:l,minZoom:d,maxZoom:p}=n,m=l?Ft(ui.interpolationFactor(l,t,d,p),0,1):0;n.kind==="camera"?s=Ai.number(n.minSize,n.maxSize,m):r=m}return{uSizeT:r,uSize:s}},z.ao=function(n,{uSize:t,uSizeT:r},{lowerSize:s,upperSize:l}){return n.kind==="source"?s/fn:n.kind==="composite"?Ai.number(s/fn,l/fn,r):t},z.ap=function(n,t){var r=t[0],s=t[1],l=t[2],d=t[3],p=t[4],m=t[5],g=t[6],x=t[7],b=t[8],T=t[9],M=t[10],A=t[11],E=t[12],D=t[13],F=t[14],U=t[15],ee=r*m-s*p,W=r*g-l*p,C=r*x-d*p,B=s*g-l*m,X=s*x-d*m,le=l*x-d*g,xe=b*D-T*E,de=b*F-M*E,me=b*U-A*E,we=T*F-M*D,be=T*U-A*D,Te=M*U-A*F,ge=ee*Te-W*be+C*we+B*me-X*de+le*xe;return ge?(n[0]=(m*Te-g*be+x*we)*(ge=1/ge),n[1]=(l*be-s*Te-d*we)*ge,n[2]=(D*le-F*X+U*B)*ge,n[3]=(M*X-T*le-A*B)*ge,n[4]=(g*me-p*Te-x*de)*ge,n[5]=(r*Te-l*me+d*de)*ge,n[6]=(F*C-E*le-U*W)*ge,n[7]=(b*le-M*C+A*W)*ge,n[8]=(p*be-m*me+x*xe)*ge,n[9]=(s*me-r*be-d*xe)*ge,n[10]=(E*X-D*C+U*ee)*ge,n[11]=(T*C-b*X-A*ee)*ge,n[12]=(m*de-p*we-g*xe)*ge,n[13]=(r*we-s*de+l*xe)*ge,n[14]=(D*W-E*B-F*ee)*ge,n[15]=(b*B-T*W+M*ee)*ge,n):null},z.aq=xn,z.ar=function(n){return Math.hypot(n[0],n[1])},z.as=function(n){return n[0]=0,n[1]=0,n},z.at=function(n,t,r){return n[0]=t[0]*r,n[1]=t[1]*r,n},z.au=bh,z.av=Hr,z.aw=function(n,t,r,s){const l=t.y-n.y,d=t.x-n.x,p=s.y-r.y,m=s.x-r.x,g=p*d-m*l;if(g===0)return null;const x=(m*(n.y-r.y)-p*(n.x-r.x))/g;return new Le(n.x+x*d,n.y+x*l)},z.ax=rd,z.ay=Nh,z.az=function(n){let t=1/0,r=1/0,s=-1/0,l=-1/0;for(const d of n)t=Math.min(t,d.x),r=Math.min(r,d.y),s=Math.max(s,d.x),l=Math.max(l,d.y);return[t,r,s,l]},z.b=Ar,z.b$=wp,z.b0=function(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]},z.b1=Ju,z.b2=Za,z.b3=function(n,t,r,s,l){var d,p=1/Math.tan(t/2);return n[0]=p/r,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=p,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[11]=-1,n[12]=0,n[13]=0,n[15]=0,l!=null&&l!==1/0?(n[10]=(l+s)*(d=1/(s-l)),n[14]=2*l*s*d):(n[10]=-1,n[14]=-2*s),n},z.b4=function(n){var t=new Pt(16);return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],t},z.b5=function(n,t,r){var s=Math.sin(r),l=Math.cos(r),d=t[0],p=t[1],m=t[2],g=t[3],x=t[4],b=t[5],T=t[6],M=t[7];return t!==n&&(n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15]),n[0]=d*l+x*s,n[1]=p*l+b*s,n[2]=m*l+T*s,n[3]=g*l+M*s,n[4]=x*l-d*s,n[5]=b*l-p*s,n[6]=T*l-m*s,n[7]=M*l-g*s,n},z.b6=function(n,t,r){var s=Math.sin(r),l=Math.cos(r),d=t[4],p=t[5],m=t[6],g=t[7],x=t[8],b=t[9],T=t[10],M=t[11];return t!==n&&(n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15]),n[4]=d*l+x*s,n[5]=p*l+b*s,n[6]=m*l+T*s,n[7]=g*l+M*s,n[8]=x*l-d*s,n[9]=b*l-p*s,n[10]=T*l-m*s,n[11]=M*l-g*s,n},z.b7=function(){const n=new Float32Array(16);return is(n),n},z.b8=function(){const n=new Float64Array(16);return is(n),n},z.b9=function(){return new Float64Array(16)},z.bA=function(n){return n[0]=0,n[1]=0,n[2]=0,n},z.bB=function(n,t,r,s){const l=Math.sqrt(n*n+t*t),d=Math.sqrt(r*r+s*s);n/=l,t/=l,r/=d,s/=d;const p=Math.acos(n*r+t*s);return-t*r+n*s>0?p:-p},z.bC=function(n,t){const r=Ui(n,2*Math.PI),s=Ui(t,2*Math.PI);return Math.min(Math.abs(r-s),Math.abs(r-s+2*Math.PI),Math.abs(r-s-2*Math.PI))},z.bD=function(){const n={},t=J.$version;for(const r in J.$root){const s=J.$root[r];if(s.required){let l=null;l=r==="version"?t:s.type==="array"?[]:{},l!=null&&(n[r]=l)}}return n},z.bE=Ro,z.bF=Q,z.bG=function n(t,r){if(Array.isArray(t)){if(!Array.isArray(r)||t.length!==r.length)return!1;for(let s=0;s<t.length;s++)if(!n(t[s],r[s]))return!1;return!0}if(typeof t=="object"&&t!==null&&r!==null){if(typeof r!="object"||Object.keys(t).length!==Object.keys(r).length)return!1;for(const s in t)if(!n(t[s],r[s]))return!1;return!0}return t===r},z.bH=function(n){n=n.slice();const t=Object.create(null);for(let r=0;r<n.length;r++)t[n[r].id]=n[r];for(let r=0;r<n.length;r++)"ref"in n[r]&&(n[r]=Ve(n[r],t[n[r].ref]));return n},z.bI=function(n){if(n.type==="custom")return new Zp(n);switch(n.type){case"background":return new Np(n);case"circle":return new Ld(n);case"color-relief":return new Nd(n);case"fill":return new ip(n);case"fill-extrusion":return new hp(n);case"heatmap":return new Fd(n);case"hillshade":return new jd(n);case"line":return new yp(n);case"raster":return new $p(n);case"symbol":return new fc(n)}},z.bJ=Bi,z.bK=function(n,t){if(!n)return[{command:"setStyle",args:[t]}];let r=[];try{if(!Ee(n.version,t.version))return[{command:"setStyle",args:[t]}];Ee(n.center,t.center)||r.push({command:"setCenter",args:[t.center]}),Ee(n.state,t.state)||r.push({command:"setGlobalState",args:[t.state]}),Ee(n.centerAltitude,t.centerAltitude)||r.push({command:"setCenterAltitude",args:[t.centerAltitude]}),Ee(n.zoom,t.zoom)||r.push({command:"setZoom",args:[t.zoom]}),Ee(n.bearing,t.bearing)||r.push({command:"setBearing",args:[t.bearing]}),Ee(n.pitch,t.pitch)||r.push({command:"setPitch",args:[t.pitch]}),Ee(n.roll,t.roll)||r.push({command:"setRoll",args:[t.roll]}),Ee(n.sprite,t.sprite)||r.push({command:"setSprite",args:[t.sprite]}),Ee(n.glyphs,t.glyphs)||r.push({command:"setGlyphs",args:[t.glyphs]}),Ee(n.transition,t.transition)||r.push({command:"setTransition",args:[t.transition]}),Ee(n.light,t.light)||r.push({command:"setLight",args:[t.light]}),Ee(n.terrain,t.terrain)||r.push({command:"setTerrain",args:[t.terrain]}),Ee(n.sky,t.sky)||r.push({command:"setSky",args:[t.sky]}),Ee(n.projection,t.projection)||r.push({command:"setProjection",args:[t.projection]});const s={},l=[];(function(p,m,g,x){let b;for(b in m=m||{},p=p||{})Object.prototype.hasOwnProperty.call(p,b)&&(Object.prototype.hasOwnProperty.call(m,b)||ft(b,g,x));for(b in m)Object.prototype.hasOwnProperty.call(m,b)&&(Object.prototype.hasOwnProperty.call(p,b)?Ee(p[b],m[b])||(p[b].type==="geojson"&&m[b].type==="geojson"&&st(p,m,b)?Be(g,{command:"setGeoJSONSourceData",args:[b,m[b].data]}):lt(b,m,g,x)):$e(b,m,g))})(n.sources,t.sources,l,s);const d=[];n.layers&&n.layers.forEach(p=>{"source"in p&&s[p.source]?r.push({command:"removeLayer",args:[p.id]}):d.push(p)}),r=r.concat(l),function(p,m,g){m=m||[];const x=(p=p||[]).map(it),b=m.map(it),T=p.reduce(Nt,{}),M=m.reduce(Nt,{}),A=x.slice(),E=Object.create(null);let D,F,U,ee,W;for(let C=0,B=0;C<x.length;C++)D=x[C],Object.prototype.hasOwnProperty.call(M,D)?B++:(Be(g,{command:"removeLayer",args:[D]}),A.splice(A.indexOf(D,B),1));for(let C=0,B=0;C<b.length;C++)D=b[b.length-1-C],A[A.length-1-C]!==D&&(Object.prototype.hasOwnProperty.call(T,D)?(Be(g,{command:"removeLayer",args:[D]}),A.splice(A.lastIndexOf(D,A.length-B),1)):B++,ee=A[A.length-C],Be(g,{command:"addLayer",args:[M[D],ee]}),A.splice(A.length-C,0,D),E[D]=!0);for(let C=0;C<b.length;C++)if(D=b[C],F=T[D],U=M[D],!E[D]&&!Ee(F,U))if(Ee(F.source,U.source)&&Ee(F["source-layer"],U["source-layer"])&&Ee(F.type,U.type)){for(W in Ue(F.layout,U.layout,g,D,null,"setLayoutProperty"),Ue(F.paint,U.paint,g,D,null,"setPaintProperty"),Ee(F.filter,U.filter)||Be(g,{command:"setFilter",args:[D,U.filter]}),Ee(F.minzoom,U.minzoom)&&Ee(F.maxzoom,U.maxzoom)||Be(g,{command:"setLayerZoomRange",args:[D,U.minzoom,U.maxzoom]}),F)Object.prototype.hasOwnProperty.call(F,W)&&W!=="layout"&&W!=="paint"&&W!=="filter"&&W!=="metadata"&&W!=="minzoom"&&W!=="maxzoom"&&(W.indexOf("paint.")===0?Ue(F[W],U[W],g,D,W.slice(6),"setPaintProperty"):Ee(F[W],U[W])||Be(g,{command:"setLayerProperty",args:[D,W,U[W]]}));for(W in U)Object.prototype.hasOwnProperty.call(U,W)&&!Object.prototype.hasOwnProperty.call(F,W)&&W!=="layout"&&W!=="paint"&&W!=="filter"&&W!=="metadata"&&W!=="minzoom"&&W!=="maxzoom"&&(W.indexOf("paint.")===0?Ue(F[W],U[W],g,D,W.slice(6),"setPaintProperty"):Ee(F[W],U[W])||Be(g,{command:"setLayerProperty",args:[D,W,U[W]]}))}else Be(g,{command:"removeLayer",args:[D]}),ee=A[A.lastIndexOf(D)+1],Be(g,{command:"addLayer",args:[U,ee]})}(d,t.layers,r)}catch(s){console.warn("Unable to compute style diff:",s),r=[{command:"setStyle",args:[t]}]}return r},z.bL=function(n){const t=[],r=n.id;return r===void 0&&t.push({message:`layers.${r}: missing required property "id"`}),n.render===void 0&&t.push({message:`layers.${r}: missing required method "render"`}),n.renderingMode&&n.renderingMode!=="2d"&&n.renderingMode!=="3d"&&t.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),t},z.bM=Mt,z.bN=Qi,z.bO=class extends mt{constructor(n,t){super(n,t),this.current=0}set(n){this.current!==n&&(this.current=n,this.gl.uniform1i(this.location,n))}},z.bP=rc,z.bQ=class extends mt{constructor(n,t){super(n,t),this.current=Xc}set(n){if(n[12]!==this.current[12]||n[0]!==this.current[0])return this.current=n,void this.gl.uniformMatrix4fv(this.location,!1,n);for(let t=1;t<16;t++)if(n[t]!==this.current[t]){this.current=n,this.gl.uniformMatrix4fv(this.location,!1,n);break}}},z.bR=Ot,z.bS=class extends mt{constructor(n,t){super(n,t),this.current=[0,0,0]}set(n){n[0]===this.current[0]&&n[1]===this.current[1]&&n[2]===this.current[2]||(this.current=n,this.gl.uniform3f(this.location,n[0],n[1],n[2]))}},z.bT=class extends mt{constructor(n,t){super(n,t),this.current=[0,0]}set(n){n[0]===this.current[0]&&n[1]===this.current[1]||(this.current=n,this.gl.uniform2f(this.location,n[0],n[1]))}},z.bU=Ki,z.bV=function(n,t){var r=Math.sin(t),s=Math.cos(t);return n[0]=s,n[1]=r,n[2]=0,n[3]=-r,n[4]=s,n[5]=0,n[6]=0,n[7]=0,n[8]=1,n},z.bW=function(n,t,r){var s=t[0],l=t[1],d=t[2];return n[0]=s*r[0]+l*r[3]+d*r[6],n[1]=s*r[1]+l*r[4]+d*r[7],n[2]=s*r[2]+l*r[5]+d*r[8],n},z.bX=function(n,t,r,s,l,d,p){var m=1/(t-r),g=1/(s-l),x=1/(d-p);return n[0]=-2*m,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=-2*g,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=2*x,n[11]=0,n[12]=(t+r)*m,n[13]=(l+s)*g,n[14]=(p+d)*x,n[15]=1,n},z.bY=class extends mt{constructor(n,t){super(n,t),this.current=new Array}set(n){if(n!=this.current){this.current=n;const t=new Float32Array(4*n.length);for(let r=0;r<n.length;r++)t[4*r]=n[r].r,t[4*r+1]=n[r].g,t[4*r+2]=n[r].b,t[4*r+3]=n[r].a;this.gl.uniform4fv(this.location,t)}}},z.bZ=class extends mt{constructor(n,t){super(n,t),this.current=new Array}set(n){if(n!=this.current){this.current=n;const t=new Float32Array(n);this.gl.uniform1fv(this.location,t)}}},z.b_=class extends a{},z.ba=function(n,t,r){const s=new Float64Array(4);return yn(s,n,t-90,r),s},z.bb=function(n,t,r,s){var l,d,p,m,g,x=t[0],b=t[1],T=t[2],M=t[3],A=r[0],E=r[1],D=r[2],F=r[3];return(d=x*A+b*E+T*D+M*F)<0&&(d=-d,A=-A,E=-E,D=-D,F=-F),1-d>Dt?(l=Math.acos(d),p=Math.sin(l),m=Math.sin((1-s)*l)/p,g=Math.sin(s*l)/p):(m=1-s,g=s),n[0]=m*x+g*A,n[1]=m*b+g*E,n[2]=m*T+g*D,n[3]=m*M+g*F,n},z.bc=function(n){const t=new Float64Array(9);var r,s,l,d,p,m,g,x,b,T,M,A,E,D,F,U,ee,W;T=(l=(s=n)[0])*(g=l+l),M=(d=s[1])*g,E=(p=s[2])*g,D=p*(x=d+d),U=(m=s[3])*g,ee=m*x,W=m*(b=p+p),(r=t)[0]=1-(A=d*x)-(F=p*b),r[3]=M-W,r[6]=E+ee,r[1]=M+W,r[4]=1-T-F,r[7]=D-U,r[2]=E-ee,r[5]=D+U,r[8]=1-T-A;const C=er(-Math.asin(Ft(t[2],-1,1)));let B,X;return Math.hypot(t[5],t[8])<.001?(B=0,X=-er(Math.atan2(t[3],t[4]))):(B=er(t[5]===0&&t[8]===0?0:Math.atan2(t[5],t[8])),X=er(t[1]===0&&t[0]===0?0:Math.atan2(t[1],t[0]))),{roll:B,pitch:C+90,bearing:X}},z.bd=function(n,t){return n.roll==t.roll&&n.pitch==t.pitch&&n.bearing==t.bearing},z.be=Je,z.bf=fi,z.bg=Na,z.bh=el,z.bi=Va,z.bj=Cr,z.bk=Xr,z.bl=Ze,z.bm=function(n,t,r,s,l){return Cr(s,l,Ft((n-t)/(r-t),0,1))},z.bn=Ui,z.bo=function(){return new Float64Array(3)},z.bp=function(n,t,r,s){return n[0]=t[0]+r[0]*s,n[1]=t[1]+r[1]*s,n[2]=t[2]+r[2]*s,n},z.bq=yn,z.br=function(n,t,r){var s=r[0],l=r[1],d=r[2],p=t[0],m=t[1],g=t[2],x=l*g-d*m,b=d*p-s*g,T=s*m-l*p,M=l*T-d*b,A=d*x-s*T,E=s*b-l*x,D=2*r[3];return b*=D,T*=D,A*=2,E*=2,n[0]=p+(x*=D)+(M*=2),n[1]=m+b+A,n[2]=g+T+E,n},z.bs=function(n,t,r){const s=(l=[n[0],n[1],n[2],t[0],t[1],t[2],r[0],r[1],r[2]])[0]*((b=l[8])*(p=l[4])-(m=l[5])*(x=l[7]))+l[1]*(-b*(d=l[3])+m*(g=l[6]))+l[2]*(x*d-p*g);var l,d,p,m,g,x,b;if(s===0)return null;const T=Wr([],[t[0],t[1],t[2]],[r[0],r[1],r[2]]),M=Wr([],[r[0],r[1],r[2]],[n[0],n[1],n[2]]),A=Wr([],[n[0],n[1],n[2]],[t[0],t[1],t[2]]),E=Li([],T,-n[3]);return Ir(E,E,Li([],M,-t[3])),Ir(E,E,Li([],A,-r[3])),Li(E,E,1/s),E},z.bt=Ph,z.bu=function(){return new Float64Array(4)},z.bv=function(n,t,r,s){var l=[],d=[];return l[0]=t[0]-r[0],l[1]=t[1]-r[1],l[2]=t[2]-r[2],d[0]=l[0]*Math.cos(s)-l[1]*Math.sin(s),d[1]=l[0]*Math.sin(s)+l[1]*Math.cos(s),d[2]=l[2],n[0]=d[0]+r[0],n[1]=d[1]+r[1],n[2]=d[2]+r[2],n},z.bw=function(n,t,r,s){var l=[],d=[];return l[0]=t[0]-r[0],l[1]=t[1]-r[1],l[2]=t[2]-r[2],d[0]=l[0],d[1]=l[1]*Math.cos(s)-l[2]*Math.sin(s),d[2]=l[1]*Math.sin(s)+l[2]*Math.cos(s),n[0]=d[0]+r[0],n[1]=d[1]+r[1],n[2]=d[2]+r[2],n},z.bx=function(n,t,r,s){var l=[],d=[];return l[0]=t[0]-r[0],l[1]=t[1]-r[1],l[2]=t[2]-r[2],d[0]=l[2]*Math.sin(s)+l[0]*Math.cos(s),d[1]=l[1],d[2]=l[2]*Math.cos(s)-l[0]*Math.sin(s),n[0]=d[0]+r[0],n[1]=d[1]+r[1],n[2]=d[2]+r[2],n},z.by=function(n,t,r){var s=Math.sin(r),l=Math.cos(r),d=t[0],p=t[1],m=t[2],g=t[3],x=t[8],b=t[9],T=t[10],M=t[11];return t!==n&&(n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15]),n[0]=d*l-x*s,n[1]=p*l-b*s,n[2]=m*l-T*s,n[3]=g*l-M*s,n[8]=d*s+x*l,n[9]=p*s+b*l,n[10]=m*s+T*l,n[11]=g*s+M*l,n},z.bz=function(n,t){const r=Ui(n,360),s=Ui(t,360),l=s-r,d=s>r?l-360:l+360;return Math.abs(l)<Math.abs(d)?l:d},z.c=ne,z.c0=class extends u{},z.c1=th,z.c2=function(n){return n<=1?1:Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))},z.c3=Kh,z.c4=function(n,t,r){var s=t[0],l=t[1],d=t[2],p=r[3]*s+r[7]*l+r[11]*d+r[15];return n[0]=(r[0]*s+r[4]*l+r[8]*d+r[12])/(p=p||1),n[1]=(r[1]*s+r[5]*l+r[9]*d+r[13])/p,n[2]=(r[2]*s+r[6]*l+r[10]*d+r[14])/p,n},z.c5=class extends No{},z.c6=class extends S{},z.c7=function(n,t){return n[0]===t[0]&&n[1]===t[1]&&n[2]===t[2]&&n[3]===t[3]&&n[4]===t[4]&&n[5]===t[5]&&n[6]===t[6]&&n[7]===t[7]&&n[8]===t[8]&&n[9]===t[9]&&n[10]===t[10]&&n[11]===t[11]&&n[12]===t[12]&&n[13]===t[13]&&n[14]===t[14]&&n[15]===t[15]},z.c8=function(n,t){var r=n[0],s=n[1],l=n[2],d=n[3],p=n[4],m=n[5],g=n[6],x=n[7],b=n[8],T=n[9],M=n[10],A=n[11],E=n[12],D=n[13],F=n[14],U=n[15],ee=t[0],W=t[1],C=t[2],B=t[3],X=t[4],le=t[5],xe=t[6],de=t[7],me=t[8],we=t[9],be=t[10],Te=t[11],ge=t[12],ke=t[13],Oe=t[14],Fe=t[15];return Math.abs(r-ee)<=Dt*Math.max(1,Math.abs(r),Math.abs(ee))&&Math.abs(s-W)<=Dt*Math.max(1,Math.abs(s),Math.abs(W))&&Math.abs(l-C)<=Dt*Math.max(1,Math.abs(l),Math.abs(C))&&Math.abs(d-B)<=Dt*Math.max(1,Math.abs(d),Math.abs(B))&&Math.abs(p-X)<=Dt*Math.max(1,Math.abs(p),Math.abs(X))&&Math.abs(m-le)<=Dt*Math.max(1,Math.abs(m),Math.abs(le))&&Math.abs(g-xe)<=Dt*Math.max(1,Math.abs(g),Math.abs(xe))&&Math.abs(x-de)<=Dt*Math.max(1,Math.abs(x),Math.abs(de))&&Math.abs(b-me)<=Dt*Math.max(1,Math.abs(b),Math.abs(me))&&Math.abs(T-we)<=Dt*Math.max(1,Math.abs(T),Math.abs(we))&&Math.abs(M-be)<=Dt*Math.max(1,Math.abs(M),Math.abs(be))&&Math.abs(A-Te)<=Dt*Math.max(1,Math.abs(A),Math.abs(Te))&&Math.abs(E-ge)<=Dt*Math.max(1,Math.abs(E),Math.abs(ge))&&Math.abs(D-ke)<=Dt*Math.max(1,Math.abs(D),Math.abs(ke))&&Math.abs(F-Oe)<=Dt*Math.max(1,Math.abs(F),Math.abs(Oe))&&Math.abs(U-Fe)<=Dt*Math.max(1,Math.abs(U),Math.abs(Fe))},z.c9=function(n,t){return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15],n},z.cA=function(n){delete R.REGISTERED_PROTOCOLS[n]},z.cB=function(n,t){const r={};for(let l=0;l<n.length;l++){const d=t&&t[n[l].id]||Pa(n[l]);t&&(t[n[l].id]=d);let p=r[d];p||(p=r[d]=[]),p.push(n[l])}const s=[];for(const l in r)s.push(r[l]);return s},z.cC=Ae,z.cD=Qu,z.cE=td,z.cF=zu,z.cG=function(n){n.bucket.createArrays(),n.bucket.tilePixelRatio=ct/(512*n.bucket.overscaling),n.bucket.compareText={},n.bucket.iconsNeedLinear=!1;const t=n.bucket.layers[0],r=t.layout,s=t._unevaluatedLayout._values,l={layoutIconSize:s["icon-size"].possiblyEvaluate(new gt(n.bucket.zoom+1),n.canonical),layoutTextSize:s["text-size"].possiblyEvaluate(new gt(n.bucket.zoom+1),n.canonical),textMaxSize:s["text-size"].possiblyEvaluate(new gt(18))};if(n.bucket.textSizeData.kind==="composite"){const{minZoom:x,maxZoom:b}=n.bucket.textSizeData;l.compositeTextSizes=[s["text-size"].possiblyEvaluate(new gt(x),n.canonical),s["text-size"].possiblyEvaluate(new gt(b),n.canonical)]}if(n.bucket.iconSizeData.kind==="composite"){const{minZoom:x,maxZoom:b}=n.bucket.iconSizeData;l.compositeIconSizes=[s["icon-size"].possiblyEvaluate(new gt(x),n.canonical),s["icon-size"].possiblyEvaluate(new gt(b),n.canonical)]}const d=r.get("text-line-height")*Gt,p=r.get("text-rotation-alignment")!=="viewport"&&r.get("symbol-placement")!=="point",m=r.get("text-keep-upright"),g=r.get("text-size");for(const x of n.bucket.features){const b=r.get("text-font").evaluate(x,{},n.canonical).join(","),T=g.evaluate(x,{},n.canonical),M=l.layoutTextSize.evaluate(x,{},n.canonical),A=l.layoutIconSize.evaluate(x,{},n.canonical),E={horizontal:{},vertical:void 0},D=x.text;let F,U=[0,0];if(D){const C=D.toString(),B=r.get("text-letter-spacing").evaluate(x,{},n.canonical)*Gt,X=Yl(C)?B:0,le=r.get("text-anchor").evaluate(x,{},n.canonical),xe=dd(t,x,n.canonical);if(!xe){const be=r.get("text-radial-offset").evaluate(x,{},n.canonical);U=be?ud(le,[be*Gt,Ch]):r.get("text-offset").evaluate(x,{},n.canonical).map(Te=>Te*Gt)}let de=p?"center":r.get("text-justify").evaluate(x,{},n.canonical);const me=r.get("symbol-placement")==="point"?r.get("text-max-width").evaluate(x,{},n.canonical)*Gt:1/0,we=()=>{n.bucket.allowVerticalPlacement&&Lo(C)&&(E.vertical=uc(D,n.glyphMap,n.glyphPositions,n.imagePositions,b,me,d,le,"left",X,U,z.an.vertical,!0,M,T))};if(!p&&xe){const be=new Set;if(de==="auto")for(let ge=0;ge<xe.values.length;ge+=2)be.add(Ah(xe.values[ge]));else be.add(de);let Te=!1;for(const ge of be)if(!E.horizontal[ge])if(Te)E.horizontal[ge]=E.horizontal[0];else{const ke=uc(D,n.glyphMap,n.glyphPositions,n.imagePositions,b,me,d,"center",ge,X,U,z.an.horizontal,!1,M,T);ke&&(E.horizontal[ge]=ke,Te=ke.positionedLines.length===1)}we()}else{de==="auto"&&(de=Ah(le));const be=uc(D,n.glyphMap,n.glyphPositions,n.imagePositions,b,me,d,le,de,X,U,z.an.horizontal,!1,M,T);be&&(E.horizontal[de]=be),we(),Lo(C)&&p&&m&&(E.vertical=uc(D,n.glyphMap,n.glyphPositions,n.imagePositions,b,me,d,le,de,X,U,z.an.vertical,!1,M,T))}}let ee=!1;if(x.icon&&x.icon.name){const C=n.imageMap[x.icon.name];C&&(F=Bp(n.imagePositions[x.icon.name],r.get("icon-offset").evaluate(x,{},n.canonical),r.get("icon-anchor").evaluate(x,{},n.canonical)),ee=!!C.sdf,n.bucket.sdfIcons===void 0?n.bucket.sdfIcons=ee:n.bucket.sdfIcons!==ee&&Yt("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(C.pixelRatio!==n.bucket.pixelRatio||r.get("icon-rotate").constantOr(1)!==0)&&(n.bucket.iconsNeedLinear=!0))}const W=fd(E.horizontal)||E.vertical;n.bucket.iconsInText=!!W&&W.iconsInText,(W||F)&&Qp(n.bucket,x,E,F,n.imageMap,l,M,A,U,ee,n.canonical,n.subdivisionGranularity)}n.showCollisionBoxes&&n.bucket.generateCollisionDebugBuffers()},z.cH=ph,z.cI=oh,z.cJ=dh,z.cK=il,z.cL=_h,z.cM=class{constructor(n){this._marks={start:[n.url,"start"].join("#"),end:[n.url,"end"].join("#"),measure:n.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let n=performance.getEntriesByName(this._marks.measure);return n.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),n=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),n}},z.cN=function(n,t,r,s,l){return c(this,void 0,void 0,function*(){if(ci())try{return yield Kr(n,t,r,s,l)}catch{}return function(d,p,m,g,x){const b=d.width,T=d.height;lr&&Jr||(lr=new OffscreenCanvas(b,T),Jr=lr.getContext("2d",{willReadFrequently:!0})),lr.width=b,lr.height=T,Jr.drawImage(d,0,0,b,T);const M=Jr.getImageData(p,m,g,x);return Jr.clearRect(0,0,b,T),M.data}(n,t,r,s,l)})},z.cO=eu,z.cP=Di,z.cQ=Sr,z.cR=gu,z.cS=Au,z.cT=ba,z.cU=Lr,z.ca=n=>n.type==="symbol",z.cb=n=>n.type==="circle",z.cc=n=>n.type==="heatmap",z.cd=n=>n.type==="line",z.ce=n=>n.type==="fill",z.cf=n=>n.type==="fill-extrusion",z.cg=n=>n.type==="hillshade",z.ch=n=>n.type==="color-relief",z.ci=n=>n.type==="raster",z.cj=n=>n.type==="background",z.ck=n=>n.type==="custom",z.cl=vn,z.cm=function(n,t,r){const s=Ti(t.x-r.x,t.y-r.y),l=Ti(n.x-r.x,n.y-r.y);var d,p;return er(Math.atan2(s[0]*l[1]-s[1]*l[0],(d=s)[0]*(p=l)[0]+d[1]*p[1]))},z.cn=Qs,z.co=function(n,t){return ea[t]&&(n instanceof MouseEvent||n instanceof WheelEvent)},z.cp=function(n,t){return as[t]&&"touches"in n},z.cq=function(n){return as[n]||ea[n]},z.cr=function(n,t,r){var s=t[0],l=t[1];return n[0]=r[0]*s+r[4]*l+r[12],n[1]=r[1]*s+r[5]*l+r[13],n},z.cs=function(n,t){const{x:r,y:s}=ol.fromLngLat(t);return!(n<0||n>25||s<0||s>=1||r<0||r>=1)},z.ct=function(n,t){return n[0]=t[0],n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=t[1],n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=t[2],n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n},z.cu=class extends Fr{},z.cv=tf,z.cx=function(n){return n.message===hr},z.cy=H,z.cz=function(n,t){R.REGISTERED_PROTOCOLS[n]=t},z.d=ce,z.e=Si,z.f=n=>c(void 0,void 0,void 0,function*(){if(n.byteLength===0)return createImageBitmap(new ImageData(1,1));const t=new Blob([new Uint8Array(n)],{type:"image/png"});try{return createImageBitmap(t)}catch(r){throw new Error(`Could not load image because of ${r.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),z.g=L,z.h=n=>new Promise((t,r)=>{const s=new Image;s.onload=()=>{t(s),URL.revokeObjectURL(s.src),s.onload=null,window.requestAnimationFrame(()=>{s.src=ss})},s.onerror=()=>r(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const l=new Blob([new Uint8Array(n)],{type:"image/png"});s.src=n.byteLength?URL.createObjectURL(l):ss}),z.i=_i,z.j=(n,t)=>re(Si(n,{type:"json"}),t),z.k=se,z.l=pe,z.m=re,z.n=(n,t)=>re(Si(n,{type:"arrayBuffer"}),t),z.o=function(n){return new _h(n).readFields(Pp,[])},z.p=Eu,z.q=Xo,z.r=pi,z.s=cr,z.t=jo,z.u=et,z.v=J,z.w=Yt,z.x=$c,z.y=ks,z.z=Gn}),wc("worker",["./shared"],function(z){class c{constructor(R){this.keyCache={},R&&this.replace(R)}replace(R){this._layerConfigs={},this._layers={},this.update(R,[])}update(R,L){for(const H of R){this._layerConfigs[H.id]=H;const Q=this._layers[H.id]=z.bI(H);Q._featureFilter=z.a9(Q.filter),this.keyCache[H.id]&&delete this.keyCache[H.id]}for(const H of L)delete this.keyCache[H],delete this._layerConfigs[H],delete this._layers[H];this.familiesBySource={};const j=z.cB(Object.values(this._layerConfigs),this.keyCache);for(const H of j){const Q=H.map(se=>this._layers[se.id]),re=Q[0];if(re.visibility==="none")continue;const ce=re.source||"";let ie=this.familiesBySource[ce];ie||(ie=this.familiesBySource[ce]={});const _e=re.sourceLayer||"_geojsonTileLayer";let pe=ie[_e];pe||(pe=ie[_e]=[]),pe.push(Q)}}}class Di{constructor(R){const L={},j=[];for(const ce in R){const ie=R[ce],_e=L[ce]={};for(const pe in ie){const se=ie[+pe];if(!se||se.bitmap.width===0||se.bitmap.height===0)continue;const ye={x:0,y:0,w:se.bitmap.width+2,h:se.bitmap.height+2};j.push(ye),_e[pe]={rect:ye,metrics:se.metrics}}}const{w:H,h:Q}=z.p(j),re=new z.q({width:H||1,height:Q||1});for(const ce in R){const ie=R[ce];for(const _e in ie){const pe=ie[+_e];if(!pe||pe.bitmap.width===0||pe.bitmap.height===0)continue;const se=L[ce][_e].rect;z.q.copy(pe.bitmap,re,{x:0,y:0},{x:se.x+1,y:se.y+1},pe.bitmap)}}this.image=re,this.positions=L}}z.cC("GlyphAtlas",Di);class Tr{constructor(R){this.tileID=new z.Z(R.tileID.overscaledZ,R.tileID.wrap,R.tileID.canonical.z,R.tileID.canonical.x,R.tileID.canonical.y),this.uid=R.uid,this.zoom=R.zoom,this.pixelRatio=R.pixelRatio,this.tileSize=R.tileSize,this.source=R.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=R.showCollisionBoxes,this.collectResourceTiming=!!R.collectResourceTiming,this.returnDependencies=!!R.returnDependencies,this.promoteId=R.promoteId,this.inFlightDependencies=[],this.globalState=R.globalState}parse(R,L,j,H,Q){return z._(this,void 0,void 0,function*(){this.status="parsing",this.data=R,this.collisionBoxArray=new z.a7;const re=new z.cD(Object.keys(R.layers).sort()),ce=new z.cE(this.tileID,this.promoteId);ce.bucketLayerIDs=[];const ie={},_e={featureIndex:ce,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:j,subdivisionGranularity:Q},pe=L.familiesBySource[this.source];for(const Ue in pe){const it=R.layers[Ue];if(!it)continue;it.version===1&&z.w(`Vector tile source "${this.source}" layer "${Ue}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Nt=re.encode(Ue),Se=[];for(let Kt=0;Kt<it.length;Kt++){const yt=it.feature(Kt),Er=ce.getId(yt,Ue);Se.push({feature:yt,id:Er,index:Kt,sourceLayerIndex:Nt})}for(const Kt of pe[Ue]){const yt=Kt[0];yt.source!==this.source&&z.w(`layer.source = ${yt.source} does not equal this.source = ${this.source}`),yt.minzoom&&this.zoom<Math.floor(yt.minzoom)||yt.maxzoom&&this.zoom>=yt.maxzoom||yt.visibility!=="none"&&(Ri(Kt,this.zoom,j),(ie[yt.id]=yt.createBucket({index:ce.bucketLayerIDs.length,layers:Kt,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Nt,sourceID:this.source,globalState:this.globalState})).populate(Se,_e,this.tileID.canonical),ce.bucketLayerIDs.push(Kt.map(Er=>Er.id)))}}const se=z.bM(_e.glyphDependencies,Ue=>Object.keys(Ue).map(Number));this.inFlightDependencies.forEach(Ue=>Ue?.abort()),this.inFlightDependencies=[];let ye=Promise.resolve({});if(Object.keys(se).length){const Ue=new AbortController;this.inFlightDependencies.push(Ue),ye=H.sendAsync({type:"GG",data:{stacks:se,source:this.source,tileID:this.tileID,type:"glyphs"}},Ue)}const J=Object.keys(_e.iconDependencies);let Ce=Promise.resolve({});if(J.length){const Ue=new AbortController;this.inFlightDependencies.push(Ue),Ce=H.sendAsync({type:"GI",data:{icons:J,source:this.source,tileID:this.tileID,type:"icons"}},Ue)}const Ve=Object.keys(_e.patternDependencies);let Ee=Promise.resolve({});if(Ve.length){const Ue=new AbortController;this.inFlightDependencies.push(Ue),Ee=H.sendAsync({type:"GI",data:{icons:Ve,source:this.source,tileID:this.tileID,type:"patterns"}},Ue)}const[Be,$e,ft]=yield Promise.all([ye,Ce,Ee]),lt=new Di(Be),st=new z.cF($e,ft);for(const Ue in ie){const it=ie[Ue];it instanceof z.a8?(Ri(it.layers,this.zoom,j),z.cG({bucket:it,glyphMap:Be,glyphPositions:lt.positions,imageMap:$e,imagePositions:st.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:_e.subdivisionGranularity})):it.hasPattern&&(it instanceof z.cH||it instanceof z.cI||it instanceof z.cJ)&&(Ri(it.layers,this.zoom,j),it.addFeatures(_e,this.tileID.canonical,st.patternPositions))}return this.status="done",{buckets:Object.values(ie).filter(Ue=>!Ue.isEmpty()),featureIndex:ce,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:lt.image,imageAtlas:st,glyphMap:this.returnDependencies?Be:null,iconMap:this.returnDependencies?$e:null,glyphPositions:this.returnDependencies?lt.positions:null}})}}function Ri(ne,R,L){const j=new z.F(R);for(const H of ne)H.recalculate(j,L)}class Sr{constructor(R,L,j){this.actor=R,this.layerIndex=L,this.availableImages=j,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(R,L){return z._(this,void 0,void 0,function*(){const j=yield z.n(R.request,L);try{return{vectorTile:new z.cK.VectorTile(new z.cL(j.data)),rawData:j.data,cacheControl:j.cacheControl,expires:j.expires}}catch(H){const Q=new Uint8Array(j.data);let re=`Unable to parse the tile at ${R.request.url}, `;throw re+=Q[0]===31&&Q[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${H.message}`,new Error(re)}})}loadTile(R){return z._(this,void 0,void 0,function*(){const L=R.uid,j=!!(R&&R.request&&R.request.collectResourceTiming)&&new z.cM(R.request),H=new Tr(R);this.loading[L]=H;const Q=new AbortController;H.abort=Q;try{const re=yield this.loadVectorTile(R,Q);if(delete this.loading[L],!re)return null;const ce=re.rawData,ie={};re.expires&&(ie.expires=re.expires),re.cacheControl&&(ie.cacheControl=re.cacheControl);const _e={};if(j){const se=j.finish();se&&(_e.resourceTiming=JSON.parse(JSON.stringify(se)))}H.vectorTile=re.vectorTile;const pe=H.parse(re.vectorTile,this.layerIndex,this.availableImages,this.actor,R.subdivisionGranularity);this.loaded[L]=H,this.fetching[L]={rawTileData:ce,cacheControl:ie,resourceTiming:_e};try{const se=yield pe;return z.e({rawTileData:ce.slice(0)},se,ie,_e)}finally{delete this.fetching[L]}}catch(re){throw delete this.loading[L],H.status="done",this.loaded[L]=H,re}})}reloadTile(R){return z._(this,void 0,void 0,function*(){const L=R.uid;if(!this.loaded||!this.loaded[L])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const j=this.loaded[L];if(j.showCollisionBoxes=R.showCollisionBoxes,j.globalState=R.globalState,j.status==="parsing"){const H=yield j.parse(j.vectorTile,this.layerIndex,this.availableImages,this.actor,R.subdivisionGranularity);let Q;if(this.fetching[L]){const{rawTileData:re,cacheControl:ce,resourceTiming:ie}=this.fetching[L];delete this.fetching[L],Q=z.e({rawTileData:re.slice(0)},H,ce,ie)}else Q=H;return Q}if(j.status==="done"&&j.vectorTile)return j.parse(j.vectorTile,this.layerIndex,this.availableImages,this.actor,R.subdivisionGranularity)})}abortTile(R){return z._(this,void 0,void 0,function*(){const L=this.loading,j=R.uid;L&&L[j]&&L[j].abort&&(L[j].abort.abort(),delete L[j])})}removeTile(R){return z._(this,void 0,void 0,function*(){this.loaded&&this.loaded[R.uid]&&delete this.loaded[R.uid]})}}class Ge{constructor(){this.loaded={}}loadTile(R){return z._(this,void 0,void 0,function*(){const{uid:L,encoding:j,rawImageData:H,redFactor:Q,greenFactor:re,blueFactor:ce,baseShift:ie}=R,_e=H.width+2,pe=H.height+2,se=z.b(H)?new z.R({width:_e,height:pe},yield z.cN(H,-1,-1,_e,pe)):H,ye=new z.cO(L,se,j,Q,re,ce,ie);return this.loaded=this.loaded||{},this.loaded[L]=ye,ye})}removeTile(R){const L=this.loaded,j=R.uid;L&&L[j]&&delete L[j]}}var fe,Le,Zr=function(){if(Le)return fe;function ne(L,j){if(L.length!==0){R(L[0],j);for(var H=1;H<L.length;H++)R(L[H],!j)}}function R(L,j){for(var H=0,Q=0,re=0,ce=L.length,ie=ce-1;re<ce;ie=re++){var _e=(L[re][0]-L[ie][0])*(L[ie][1]+L[re][1]),pe=H+_e;Q+=Math.abs(H)>=Math.abs(_e)?H-pe+_e:_e-pe+H,H=pe}H+Q>=0!=!!j&&L.reverse()}return Le=1,fe=function L(j,H){var Q,re=j&&j.type;if(re==="FeatureCollection")for(Q=0;Q<j.features.length;Q++)L(j.features[Q],H);else if(re==="GeometryCollection")for(Q=0;Q<j.geometries.length;Q++)L(j.geometries[Q],H);else if(re==="Feature")L(j.geometry,H);else if(re==="Polygon")ne(j.coordinates,H);else if(re==="MultiPolygon")for(Q=0;Q<j.coordinates.length;Q++)ne(j.coordinates[Q],H);return j}}(),Pr=z.cP(Zr);const Gr=z.cK.VectorTileFeature.prototype.toGeoJSON;class qr{constructor(R){this._feature=R,this.extent=z.$,this.type=R.type,this.properties=R.tags,"id"in R&&!isNaN(R.id)&&(this.id=parseInt(R.id,10))}loadGeometry(){if(this._feature.type===1){const R=[];for(const L of this._feature.geometry)R.push([new z.P(L[0],L[1])]);return R}{const R=[];for(const L of this._feature.geometry){const j=[];for(const H of L)j.push(new z.P(H[0],H[1]));R.push(j)}return R}}toGeoJSON(R,L,j){return Gr.call(this,R,L,j)}}class ts{constructor(R){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=z.$,this.length=R.length,this._features=R}feature(R){return new qr(this._features[R])}}var ci,Dt,Pt,Ki={exports:{}},is=function(){if(Pt)return Ki.exports;Pt=1;var ne=z.cS(),R=function(){if(Dt)return ci;Dt=1;var pe=z.cQ(),se=z.cR().VectorTileFeature;function ye(Ce,Ve){this.options=Ve||{},this.features=Ce,this.length=Ce.length}function J(Ce,Ve){this.id=typeof Ce.id=="number"?Ce.id:void 0,this.type=Ce.type,this.rawGeometry=Ce.type===1?[Ce.geometry]:Ce.geometry,this.properties=Ce.tags,this.extent=Ve||4096}return ci=ye,ye.prototype.feature=function(Ce){return new J(this.features[Ce],this.options.extent)},J.prototype.loadGeometry=function(){var Ce=this.rawGeometry;this.geometry=[];for(var Ve=0;Ve<Ce.length;Ve++){for(var Ee=Ce[Ve],Be=[],$e=0;$e<Ee.length;$e++)Be.push(new pe(Ee[$e][0],Ee[$e][1]));this.geometry.push(Be)}return this.geometry},J.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var Ce=this.geometry,Ve=1/0,Ee=-1/0,Be=1/0,$e=-1/0,ft=0;ft<Ce.length;ft++)for(var lt=Ce[ft],st=0;st<lt.length;st++){var Ue=lt[st];Ve=Math.min(Ve,Ue.x),Ee=Math.max(Ee,Ue.x),Be=Math.min(Be,Ue.y),$e=Math.max($e,Ue.y)}return[Ve,Be,Ee,$e]},J.prototype.toGeoJSON=se.prototype.toGeoJSON,ci}();function L(pe){var se=new ne;return function(ye,J){for(var Ce in ye.layers)J.writeMessage(3,j,ye.layers[Ce])}(pe,se),se.finish()}function j(pe,se){var ye;se.writeVarintField(15,pe.version||1),se.writeStringField(1,pe.name||""),se.writeVarintField(5,pe.extent||4096);var J={keys:[],values:[],keycache:{},valuecache:{}};for(ye=0;ye<pe.length;ye++)J.feature=pe.feature(ye),se.writeMessage(2,H,J);var Ce=J.keys;for(ye=0;ye<Ce.length;ye++)se.writeStringField(3,Ce[ye]);var Ve=J.values;for(ye=0;ye<Ve.length;ye++)se.writeMessage(4,_e,Ve[ye])}function H(pe,se){var ye=pe.feature;ye.id!==void 0&&se.writeVarintField(1,ye.id),se.writeMessage(2,Q,pe),se.writeVarintField(3,ye.type),se.writeMessage(4,ie,ye)}function Q(pe,se){var ye=pe.feature,J=pe.keys,Ce=pe.values,Ve=pe.keycache,Ee=pe.valuecache;for(var Be in ye.properties){var $e=ye.properties[Be],ft=Ve[Be];if($e!==null){ft===void 0&&(J.push(Be),Ve[Be]=ft=J.length-1),se.writeVarint(ft);var lt=typeof $e;lt!=="string"&<!=="boolean"&<!=="number"&&($e=JSON.stringify($e));var st=lt+":"+$e,Ue=Ee[st];Ue===void 0&&(Ce.push($e),Ee[st]=Ue=Ce.length-1),se.writeVarint(Ue)}}}function re(pe,se){return(se<<3)+(7&pe)}function ce(pe){return pe<<1^pe>>31}function ie(pe,se){for(var ye=pe.loadGeometry(),J=pe.type,Ce=0,Ve=0,Ee=ye.length,Be=0;Be<Ee;Be++){var $e=ye[Be],ft=1;J===1&&(ft=$e.length),se.writeVarint(re(1,ft));for(var lt=J===3?$e.length-1:$e.length,st=0;st<lt;st++){st===1&&J!==1&&se.writeVarint(re(2,lt-1));var Ue=$e[st].x-Ce,it=$e[st].y-Ve;se.writeVarint(ce(Ue)),se.writeVarint(ce(it)),Ce+=Ue,Ve+=it}J===3&&se.writeVarint(re(7,1))}}function _e(pe,se){var ye=typeof pe;ye==="string"?se.writeStringField(1,pe):ye==="boolean"?se.writeBooleanField(7,pe):ye==="number"&&(pe%1!=0?se.writeDoubleField(3,pe):pe<0?se.writeSVarintField(6,pe):se.writeVarintField(5,pe))}return Ki.exports=L,Ki.exports.fromVectorTileJs=L,Ki.exports.fromGeojsonVt=function(pe,se){se=se||{};var ye={};for(var J in pe)ye[J]=new R(pe[J].features,se),ye[J].name=J,ye[J].version=se.version,ye[J].extent=se.extent;return L({layers:ye})},Ki.exports.GeoJSONWrapper=R,Ki.exports}(),Ks=z.cP(is);const Mr={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:ne=>ne},_n=Math.fround||(Ir=new Float32Array(1),ne=>(Ir[0]=+ne,Ir[0]));var Ir;class Li{constructor(R){this.options=Object.assign(Object.create(Mr),R),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(R){const{log:L,minZoom:j,maxZoom:H}=this.options;L&&console.time("total time");const Q=`prepare ${R.length} points`;L&&console.time(Q),this.points=R;const re=[];for(let ie=0;ie<R.length;ie++){const _e=R[ie];if(!_e.geometry)continue;const[pe,se]=_e.geometry.coordinates,ye=_n(gn(pe)),J=_n(Hr(se));re.push(ye,J,1/0,ie,-1,1),this.options.reduce&&re.push(0)}let ce=this.trees[H+1]=this._createTree(re);L&&console.timeEnd(Q);for(let ie=H;ie>=j;ie--){const _e=+Date.now();ce=this.trees[ie]=this._createTree(this._cluster(ce,ie)),L&&console.log("z%d: %d clusters in %dms",ie,ce.numItems,+Date.now()-_e)}return L&&console.timeEnd("total time"),this}getClusters(R,L){let j=((R[0]+180)%360+360)%360-180;const H=Math.max(-90,Math.min(90,R[1]));let Q=R[2]===180?180:((R[2]+180)%360+360)%360-180;const re=Math.max(-90,Math.min(90,R[3]));if(R[2]-R[0]>=360)j=-180,Q=180;else if(j>Q){const se=this.getClusters([j,H,180,re],L),ye=this.getClusters([-180,H,Q,re],L);return se.concat(ye)}const ce=this.trees[this._limitZoom(L)],ie=ce.range(gn(j),Hr(re),gn(Q),Hr(H)),_e=ce.data,pe=[];for(const se of ie){const ye=this.stride*se;pe.push(_e[ye+5]>1?Wr(_e,ye,this.clusterProps):this.points[_e[ye+3]])}return pe}getChildren(R){const L=this._getOriginId(R),j=this._getOriginZoom(R),H="No cluster with the specified id.",Q=this.trees[j];if(!Q)throw new Error(H);const re=Q.data;if(L*this.stride>=re.length)throw new Error(H);const ce=this.options.radius/(this.options.extent*Math.pow(2,j-1)),ie=Q.within(re[L*this.stride],re[L*this.stride+1],ce),_e=[];for(const pe of ie){const se=pe*this.stride;re[se+4]===R&&_e.push(re[se+5]>1?Wr(re,se,this.clusterProps):this.points[re[se+3]])}if(_e.length===0)throw new Error(H);return _e}getLeaves(R,L,j){const H=[];return this._appendLeaves(H,R,L=L||10,j=j||0,0),H}getTile(R,L,j){const H=this.trees[this._limitZoom(R)],Q=Math.pow(2,R),{extent:re,radius:ce}=this.options,ie=ce/re,_e=(j-ie)/Q,pe=(j+1+ie)/Q,se={features:[]};return this._addTileFeatures(H.range((L-ie)/Q,_e,(L+1+ie)/Q,pe),H.data,L,j,Q,se),L===0&&this._addTileFeatures(H.range(1-ie/Q,_e,1,pe),H.data,Q,j,Q,se),L===Q-1&&this._addTileFeatures(H.range(0,_e,ie/Q,pe),H.data,-1,j,Q,se),se.features.length?se:null}getClusterExpansionZoom(R){let L=this._getOriginZoom(R)-1;for(;L<=this.options.maxZoom;){const j=this.getChildren(R);if(L++,j.length!==1)break;R=j[0].properties.cluster_id}return L}_appendLeaves(R,L,j,H,Q){const re=this.getChildren(L);for(const ce of re){const ie=ce.properties;if(ie&&ie.cluster?Q+ie.point_count<=H?Q+=ie.point_count:Q=this._appendLeaves(R,ie.cluster_id,j,H,Q):Q<H?Q++:R.push(ce),R.length===j)break}return Q}_createTree(R){const L=new z.aH(R.length/this.stride|0,this.options.nodeSize,Float32Array);for(let j=0;j<R.length;j+=this.stride)L.add(R[j],R[j+1]);return L.finish(),L.data=R,L}_addTileFeatures(R,L,j,H,Q,re){for(const ce of R){const ie=ce*this.stride,_e=L[ie+5]>1;let pe,se,ye;if(_e)pe=Ji(L,ie,this.clusterProps),se=L[ie],ye=L[ie+1];else{const Ve=this.points[L[ie+3]];pe=Ve.properties;const[Ee,Be]=Ve.geometry.coordinates;se=gn(Ee),ye=Hr(Be)}const J={type:1,geometry:[[Math.round(this.options.extent*(se*Q-j)),Math.round(this.options.extent*(ye*Q-H))]],tags:pe};let Ce;Ce=_e||this.options.generateId?L[ie+3]:this.points[L[ie+3]].id,Ce!==void 0&&(J.id=Ce),re.features.push(J)}}_limitZoom(R){return Math.max(this.options.minZoom,Math.min(Math.floor(+R),this.options.maxZoom+1))}_cluster(R,L){const{radius:j,extent:H,reduce:Q,minPoints:re}=this.options,ce=j/(H*Math.pow(2,L)),ie=R.data,_e=[],pe=this.stride;for(let se=0;se<ie.length;se+=pe){if(ie[se+2]<=L)continue;ie[se+2]=L;const ye=ie[se],J=ie[se+1],Ce=R.within(ie[se],ie[se+1],ce),Ve=ie[se+5];let Ee=Ve;for(const Be of Ce){const $e=Be*pe;ie[$e+2]>L&&(Ee+=ie[$e+5])}if(Ee>Ve&&Ee>=re){let Be,$e=ye*Ve,ft=J*Ve,lt=-1;const st=(se/pe<<5)+(L+1)+this.points.length;for(const Ue of Ce){const it=Ue*pe;if(ie[it+2]<=L)continue;ie[it+2]=L;const Nt=ie[it+5];$e+=ie[it]*Nt,ft+=ie[it+1]*Nt,ie[it+4]=st,Q&&(Be||(Be=this._map(ie,se,!0),lt=this.clusterProps.length,this.clusterProps.push(Be)),Q(Be,this._map(ie,it)))}ie[se+4]=st,_e.push($e/Ee,ft/Ee,1/0,st,-1,Ee),Q&&_e.push(lt)}else{for(let Be=0;Be<pe;Be++)_e.push(ie[se+Be]);if(Ee>1)for(const Be of Ce){const $e=Be*pe;if(!(ie[$e+2]<=L)){ie[$e+2]=L;for(let ft=0;ft<pe;ft++)_e.push(ie[$e+ft])}}}}return _e}_getOriginId(R){return R-this.points.length>>5}_getOriginZoom(R){return(R-this.points.length)%32}_map(R,L,j){if(R[L+5]>1){const re=this.clusterProps[R[L+6]];return j?Object.assign({},re):re}const H=this.points[R[L+3]].properties,Q=this.options.map(H);return j&&Q===H?Object.assign({},Q):Q}}function Wr(ne,R,L){return{type:"Feature",id:ne[R+3],properties:Ji(ne,R,L),geometry:{type:"Point",coordinates:[(j=ne[R],360*(j-.5)),Js(ne[R+1])]}};var j}function Ji(ne,R,L){const j=ne[R+5],H=j>=1e4?`${Math.round(j/1e3)}k`:j>=1e3?Math.round(j/100)/10+"k":j,Q=ne[R+6],re=Q===-1?{}:Object.assign({},L[Q]);return Object.assign(re,{cluster:!0,cluster_id:ne[R+3],point_count:j,point_count_abbreviated:H})}function gn(ne){return ne/360+.5}function Hr(ne){const R=Math.sin(ne*Math.PI/180),L=.5-.25*Math.log((1+R)/(1-R))/Math.PI;return L<0?0:L>1?1:L}function Js(ne){const R=(180-360*ne)*Math.PI/180;return 360*Math.atan(Math.exp(R))/Math.PI-90}function yn(ne,R,L,j){let H=j;const Q=R+(L-R>>1);let re,ce=L-R;const ie=ne[R],_e=ne[R+1],pe=ne[L],se=ne[L+1];for(let ye=R+3;ye<L;ye+=3){const J=xn(ne[ye],ne[ye+1],ie,_e,pe,se);if(J>H)re=ye,H=J;else if(J===H){const Ce=Math.abs(ye-Q);Ce<ce&&(re=ye,ce=Ce)}}H>j&&(re-R>3&&yn(ne,R,re,j),ne[re+2]=H,L-re>3&&yn(ne,re,L,j))}function xn(ne,R,L,j,H,Q){let re=H-L,ce=Q-j;if(re!==0||ce!==0){const ie=((ne-L)*re+(R-j)*ce)/(re*re+ce*ce);ie>1?(L=H,j=Q):ie>0&&(L+=re*ie,j+=ce*ie)}return re=ne-L,ce=R-j,re*re+ce*ce}function Ti(ne,R,L,j){const H={id:ne??null,type:R,geometry:L,tags:j,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(R==="Point"||R==="MultiPoint"||R==="LineString")ct(H,L);else if(R==="Polygon")ct(H,L[0]);else if(R==="MultiLineString")for(const Q of L)ct(H,Q);else if(R==="MultiPolygon")for(const Q of L)ct(H,Q[0]);return H}function ct(ne,R){for(let L=0;L<R.length;L+=3)ne.minX=Math.min(ne.minX,R[L]),ne.minY=Math.min(ne.minY,R[L+1]),ne.maxX=Math.max(ne.maxX,R[L]),ne.maxY=Math.max(ne.maxY,R[L+1])}function Ni(ne,R,L,j){if(!R.geometry)return;const H=R.geometry.coordinates;if(H&&H.length===0)return;const Q=R.geometry.type,re=Math.pow(L.tolerance/((1<<L.maxZoom)*L.extent),2);let ce=[],ie=R.id;if(L.promoteId?ie=R.properties[L.promoteId]:L.generateId&&(ie=j||0),Q==="Point")Ui(H,ce);else if(Q==="MultiPoint")for(const _e of H)Ui(_e,ce);else if(Q==="LineString")Cr(H,ce,re,!1);else if(Q==="MultiLineString"){if(L.lineMetrics){for(const _e of H)ce=[],Cr(_e,ce,re,!1),ne.push(Ti(ie,"LineString",ce,R.properties));return}Xr(H,ce,re,!1)}else if(Q==="Polygon")Xr(H,ce,re,!0);else{if(Q!=="MultiPolygon"){if(Q==="GeometryCollection"){for(const _e of R.geometry.geometries)Ni(ne,{id:ie,geometry:_e,properties:R.properties},L,j);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const _e of H){const pe=[];Xr(_e,pe,re,!0),ce.push(pe)}}ne.push(Ti(ie,Q,ce,R.properties))}function Ui(ne,R){R.push(vn(ne[0]),Qs(ne[1]),0)}function Cr(ne,R,L,j){let H,Q,re=0;for(let ie=0;ie<ne.length;ie++){const _e=vn(ne[ie][0]),pe=Qs(ne[ie][1]);R.push(_e,pe,0),ie>0&&(re+=j?(H*pe-_e*Q)/2:Math.sqrt(Math.pow(_e-H,2)+Math.pow(pe-Q,2))),H=_e,Q=pe}const ce=R.length-3;R[2]=1,yn(R,0,ce,L),R[ce+2]=1,R.size=Math.abs(re),R.start=0,R.end=R.size}function Xr(ne,R,L,j){for(let H=0;H<ne.length;H++){const Q=[];Cr(ne[H],Q,L,j),R.push(Q)}}function vn(ne){return ne/360+.5}function Qs(ne){const R=Math.sin(ne*Math.PI/180),L=.5-.25*Math.log((1+R)/(1-R))/Math.PI;return L<0?0:L>1?1:L}function Ft(ne,R,L,j,H,Q,re,ce){if(j/=R,Q>=(L/=R)&&re<j)return ne;if(re<L||Q>=j)return null;const ie=[];for(const _e of ne){const pe=_e.geometry;let se=_e.type;const ye=H===0?_e.minX:_e.minY,J=H===0?_e.maxX:_e.maxY;if(ye>=L&&J<j){ie.push(_e);continue}if(J<L||ye>=j)continue;let Ce=[];if(se==="Point"||se==="MultiPoint")rs(pe,Ce,L,j,H);else if(se==="LineString")Si(pe,Ce,L,j,H,!1,ce.lineMetrics);else if(se==="MultiLineString")Mt(pe,Ce,L,j,H,!1);else if(se==="Polygon")Mt(pe,Ce,L,j,H,!0);else if(se==="MultiPolygon")for(const Ve of pe){const Ee=[];Mt(Ve,Ee,L,j,H,!0),Ee.length&&Ce.push(Ee)}if(Ce.length){if(ce.lineMetrics&&se==="LineString"){for(const Ve of Ce)ie.push(Ti(_e.id,se,Ve,_e.tags));continue}se!=="LineString"&&se!=="MultiLineString"||(Ce.length===1?(se="LineString",Ce=Ce[0]):se="MultiLineString"),se!=="Point"&&se!=="MultiPoint"||(se=Ce.length===3?"Point":"MultiPoint"),ie.push(Ti(_e.id,se,Ce,_e.tags))}}return ie.length?ie:null}function rs(ne,R,L,j,H){for(let Q=0;Q<ne.length;Q+=3){const re=ne[Q+H];re>=L&&re<=j&&Qi(R,ne[Q],ne[Q+1],ne[Q+2])}}function Si(ne,R,L,j,H,Q,re){let ce=ns(ne);const ie=H===0?Bi:bn;let _e,pe,se=ne.start;for(let Ee=0;Ee<ne.length-3;Ee+=3){const Be=ne[Ee],$e=ne[Ee+1],ft=ne[Ee+2],lt=ne[Ee+3],st=ne[Ee+4],Ue=H===0?Be:$e,it=H===0?lt:st;let Nt=!1;re&&(_e=Math.sqrt(Math.pow(Be-lt,2)+Math.pow($e-st,2))),Ue<L?it>L&&(pe=ie(ce,Be,$e,lt,st,L),re&&(ce.start=se+_e*pe)):Ue>j?it<j&&(pe=ie(ce,Be,$e,lt,st,j),re&&(ce.start=se+_e*pe)):Qi(ce,Be,$e,ft),it<L&&Ue>=L&&(pe=ie(ce,Be,$e,lt,st,L),Nt=!0),it>j&&Ue<=j&&(pe=ie(ce,Be,$e,lt,st,j),Nt=!0),!Q&&Nt&&(re&&(ce.end=se+_e*pe),R.push(ce),ce=ns(ne)),re&&(se+=_e)}let ye=ne.length-3;const J=ne[ye],Ce=ne[ye+1],Ve=H===0?J:Ce;Ve>=L&&Ve<=j&&Qi(ce,J,Ce,ne[ye+2]),ye=ce.length-3,Q&&ye>=3&&(ce[ye]!==ce[0]||ce[ye+1]!==ce[1])&&Qi(ce,ce[0],ce[1],ce[2]),ce.length&&R.push(ce)}function ns(ne){const R=[];return R.size=ne.size,R.start=ne.start,R.end=ne.end,R}function Mt(ne,R,L,j,H,Q){for(const re of ne)Si(re,R,L,j,H,Q,!1)}function Qi(ne,R,L,j){ne.push(R,L,j)}function Bi(ne,R,L,j,H,Q){const re=(Q-R)/(j-R);return Qi(ne,Q,L+(H-L)*re,1),re}function bn(ne,R,L,j,H,Q){const re=(Q-L)/(H-L);return Qi(ne,R+(j-R)*re,Q,1),re}function Yt(ne,R){const L=[];for(let j=0;j<ne.length;j++){const H=ne[j],Q=H.type;let re;if(Q==="Point"||Q==="MultiPoint"||Q==="LineString")re=Pi(H.geometry,R);else if(Q==="MultiLineString"||Q==="Polygon"){re=[];for(const ce of H.geometry)re.push(Pi(ce,R))}else if(Q==="MultiPolygon"){re=[];for(const ce of H.geometry){const ie=[];for(const _e of ce)ie.push(Pi(_e,R));re.push(ie)}}L.push(Ti(H.id,Q,re,H.tags))}return L}function Pi(ne,R){const L=[];L.size=ne.size,ne.start!==void 0&&(L.start=ne.start,L.end=ne.end);for(let j=0;j<ne.length;j+=3)L.push(ne[j]+R,ne[j+1],ne[j+2]);return L}function _i(ne,R){if(ne.transformed)return ne;const L=1<<ne.z,j=ne.x,H=ne.y;for(const Q of ne.features){const re=Q.geometry,ce=Q.type;if(Q.geometry=[],ce===1)for(let ie=0;ie<re.length;ie+=2)Q.geometry.push(Yr(re[ie],re[ie+1],R,L,j,H));else for(let ie=0;ie<re.length;ie++){const _e=[];for(let pe=0;pe<re[ie].length;pe+=2)_e.push(Yr(re[ie][pe],re[ie][pe+1],R,L,j,H));Q.geometry.push(_e)}}return ne.transformed=!0,ne}function Yr(ne,R,L,j,H,Q){return[Math.round(L*(ne*j-H)),Math.round(L*(R*j-Q))]}function Ar(ne,R,L,j,H){const Q=R===H.maxZoom?0:H.tolerance/((1<<R)*H.extent),re={features:[],numPoints:0,numSimplified:0,numFeatures:ne.length,source:null,x:L,y:j,z:R,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const ce of ne)ss(re,ce,Q,H);return re}function ss(ne,R,L,j){const H=R.geometry,Q=R.type,re=[];if(ne.minX=Math.min(ne.minX,R.minX),ne.minY=Math.min(ne.minY,R.minY),ne.maxX=Math.max(ne.maxX,R.maxX),ne.maxY=Math.max(ne.maxY,R.maxY),Q==="Point"||Q==="MultiPoint")for(let ce=0;ce<H.length;ce+=3)re.push(H[ce],H[ce+1]),ne.numPoints++,ne.numSimplified++;else if(Q==="LineString")Kr(re,H,ne,L,!1,!1);else if(Q==="MultiLineString"||Q==="Polygon")for(let ce=0;ce<H.length;ce++)Kr(re,H[ce],ne,L,Q==="Polygon",ce===0);else if(Q==="MultiPolygon")for(let ce=0;ce<H.length;ce++){const ie=H[ce];for(let _e=0;_e<ie.length;_e++)Kr(re,ie[_e],ne,L,!0,_e===0)}if(re.length){let ce=R.tags||null;if(Q==="LineString"&&j.lineMetrics){ce={};for(const _e in R.tags)ce[_e]=R.tags[_e];ce.mapbox_clip_start=H.start/H.size,ce.mapbox_clip_end=H.end/H.size}const ie={geometry:re,type:Q==="Polygon"||Q==="MultiPolygon"?3:Q==="LineString"||Q==="MultiLineString"?2:1,tags:ce};R.id!==null&&(ie.id=R.id),ne.features.push(ie)}}function Kr(ne,R,L,j,H,Q){const re=j*j;if(j>0&&R.size<(H?re:j))return void(L.numPoints+=R.length/3);const ce=[];for(let ie=0;ie<R.length;ie+=3)(j===0||R[ie+2]>re)&&(L.numSimplified++,ce.push(R[ie],R[ie+1])),L.numPoints++;H&&function(ie,_e){let pe=0;for(let se=0,ye=ie.length,J=ye-2;se<ye;J=se,se+=2)pe+=(ie[se]-ie[J])*(ie[se+1]+ie[J+1]);if(pe>0===_e)for(let se=0,ye=ie.length;se<ye/2;se+=2){const J=ie[se],Ce=ie[se+1];ie[se]=ie[ye-2-se],ie[se+1]=ie[ye-1-se],ie[ye-2-se]=J,ie[ye-1-se]=Ce}}(ce,Q),ne.push(ce)}const lr={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class Jr{constructor(R,L){const j=(L=this.options=function(Q,re){for(const ce in re)Q[ce]=re[ce];return Q}(Object.create(lr),L)).debug;if(j&&console.time("preprocess data"),L.maxZoom<0||L.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(L.promoteId&&L.generateId)throw new Error("promoteId and generateId cannot be used together.");let H=function(Q,re){const ce=[];if(Q.type==="FeatureCollection")for(let ie=0;ie<Q.features.length;ie++)Ni(ce,Q.features[ie],re,ie);else Ni(ce,Q.type==="Feature"?Q:{geometry:Q},re);return ce}(R,L);this.tiles={},this.tileCoords=[],j&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",L.indexMaxZoom,L.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),H=function(Q,re){const ce=re.buffer/re.extent;let ie=Q;const _e=Ft(Q,1,-1-ce,ce,0,-1,2,re),pe=Ft(Q,1,1-ce,2+ce,0,-1,2,re);return(_e||pe)&&(ie=Ft(Q,1,-ce,1+ce,0,-1,2,re)||[],_e&&(ie=Yt(_e,1).concat(ie)),pe&&(ie=ie.concat(Yt(pe,-1)))),ie}(H,L),H.length&&this.splitTile(H,0,0,0),j&&(H.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(R,L,j,H,Q,re,ce){const ie=[R,L,j,H],_e=this.options,pe=_e.debug;for(;ie.length;){H=ie.pop(),j=ie.pop(),L=ie.pop(),R=ie.pop();const se=1<<L,ye=cr(L,j,H);let J=this.tiles[ye];if(!J&&(pe>1&&console.time("creation"),J=this.tiles[ye]=Ar(R,L,j,H,_e),this.tileCoords.push({z:L,x:j,y:H}),pe)){pe>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",L,j,H,J.numFeatures,J.numPoints,J.numSimplified),console.timeEnd("creation"));const Nt=`z${L}`;this.stats[Nt]=(this.stats[Nt]||0)+1,this.total++}if(J.source=R,Q==null){if(L===_e.indexMaxZoom||J.numPoints<=_e.indexMaxPoints)continue}else{if(L===_e.maxZoom||L===Q)continue;if(Q!=null){const Nt=Q-L;if(j!==re>>Nt||H!==ce>>Nt)continue}}if(J.source=null,R.length===0)continue;pe>1&&console.time("clipping");const Ce=.5*_e.buffer/_e.extent,Ve=.5-Ce,Ee=.5+Ce,Be=1+Ce;let $e=null,ft=null,lt=null,st=null,Ue=Ft(R,se,j-Ce,j+Ee,0,J.minX,J.maxX,_e),it=Ft(R,se,j+Ve,j+Be,0,J.minX,J.maxX,_e);R=null,Ue&&($e=Ft(Ue,se,H-Ce,H+Ee,1,J.minY,J.maxY,_e),ft=Ft(Ue,se,H+Ve,H+Be,1,J.minY,J.maxY,_e),Ue=null),it&&(lt=Ft(it,se,H-Ce,H+Ee,1,J.minY,J.maxY,_e),st=Ft(it,se,H+Ve,H+Be,1,J.minY,J.maxY,_e),it=null),pe>1&&console.timeEnd("clipping"),ie.push($e||[],L+1,2*j,2*H),ie.push(ft||[],L+1,2*j,2*H+1),ie.push(lt||[],L+1,2*j+1,2*H),ie.push(st||[],L+1,2*j+1,2*H+1)}}getTile(R,L,j){R=+R,L=+L,j=+j;const H=this.options,{extent:Q,debug:re}=H;if(R<0||R>24)return null;const ce=1<<R,ie=cr(R,L=L+ce&ce-1,j);if(this.tiles[ie])return _i(this.tiles[ie],Q);re>1&&console.log("drilling down to z%d-%d-%d",R,L,j);let _e,pe=R,se=L,ye=j;for(;!_e&&pe>0;)pe--,se>>=1,ye>>=1,_e=this.tiles[cr(pe,se,ye)];return _e&&_e.source?(re>1&&(console.log("found parent tile z%d-%d-%d",pe,se,ye),console.time("drilling down")),this.splitTile(_e.source,pe,se,ye,R,L,j),re>1&&console.timeEnd("drilling down"),this.tiles[ie]?_i(this.tiles[ie],Q):null):null}}function cr(ne,R,L){return 32*((1<<ne)*L+R)+ne}function Mi(ne,R){return R?ne.properties[R]:ne.id}function er(ne,R){if(ne==null)return!0;if(ne.type==="Feature")return Mi(ne,R)!=null;if(ne.type==="FeatureCollection"){const L=new Set;for(const j of ne.features){const H=Mi(j,R);if(H==null||L.has(H))return!1;L.add(H)}return!0}return!1}function as(ne,R){const L=new Map;if(ne!=null)if(ne.type==="Feature")L.set(Mi(ne,R),ne);else for(const j of ne.features)L.set(Mi(j,R),j);return L}class ea extends Sr{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(R,L){return z._(this,void 0,void 0,function*(){const j=R.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const H=this._geoJSONIndex.getTile(j.z,j.x,j.y);if(!H)return null;const Q=new ts(H.features);let re=Ks(Q);return re.byteOffset===0&&re.byteLength===re.buffer.byteLength||(re=new Uint8Array(re)),{vectorTile:Q,rawData:re.buffer}})}loadData(R){return z._(this,void 0,void 0,function*(){var L;(L=this._pendingRequest)===null||L===void 0||L.abort();const j=!!(R&&R.request&&R.request.collectResourceTiming)&&new z.cM(R.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(R,this._pendingRequest),this._geoJSONIndex=R.cluster?new Li(function({superclusterOptions:re,clusterProperties:ce}){if(!ce||!re)return re;const ie={},_e={},pe={accumulated:null,zoom:0},se={properties:null},ye=Object.keys(ce);for(const J of ye){const[Ce,Ve]=ce[J],Ee=z.cT(Ve),Be=z.cT(typeof Ce=="string"?[Ce,["accumulated"],["get",J]]:Ce);ie[J]=Ee.value,_e[J]=Be.value}return re.map=J=>{se.properties=J;const Ce={};for(const Ve of ye)Ce[Ve]=ie[Ve].evaluate(pe,se);return Ce},re.reduce=(J,Ce)=>{se.properties=Ce;for(const Ve of ye)pe.accumulated=J[Ve],J[Ve]=_e[Ve].evaluate(pe,se)},re}(R)).load((yield this._pendingData).features):(H=yield this._pendingData,new Jr(H,R.geojsonVtOptions)),this.loaded={};const Q={};if(j){const re=j.finish();re&&(Q.resourceTiming={},Q.resourceTiming[R.source]=JSON.parse(JSON.stringify(re)))}return Q}catch(Q){if(delete this._pendingRequest,z.cx(Q))return{abandoned:!0};throw Q}var H})}getData(){return z._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(R){const L=this.loaded;return L&&L[R.uid]?super.reloadTile(R):this.loadTile(R)}loadAndProcessGeoJSON(R,L){return z._(this,void 0,void 0,function*(){let j=yield this.loadGeoJSON(R,L);if(delete this._pendingRequest,typeof j!="object")throw new Error(`Input data given to '${R.source}' is not a valid GeoJSON object.`);if(Pr(j,!0),R.filter){const H=z.cT(R.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(H.result==="error")throw new Error(H.value.map(re=>`${re.key}: ${re.message}`).join(", "));j={type:"FeatureCollection",features:j.features.filter(re=>H.value.evaluate({zoom:0},re))}}return j})}loadGeoJSON(R,L){return z._(this,void 0,void 0,function*(){const{promoteId:j}=R;if(R.request){const H=yield z.j(R.request,L);return this._dataUpdateable=er(H.data,j)?as(H.data,j):void 0,H.data}if(typeof R.data=="string")try{const H=JSON.parse(R.data);return this._dataUpdateable=er(H,j)?as(H,j):void 0,H}catch{throw new Error(`Input data given to '${R.source}' is not a valid GeoJSON object.`)}if(!R.dataDiff)throw new Error(`Input data given to '${R.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${R.source}`);return function(H,Q,re){var ce,ie,_e,pe;if(Q.removeAll&&H.clear(),Q.remove)for(const se of Q.remove)H.delete(se);if(Q.add)for(const se of Q.add){const ye=Mi(se,re);ye!=null&&H.set(ye,se)}if(Q.update)for(const se of Q.update){let ye=H.get(se.id);if(ye==null)continue;const J=!se.removeAllProperties&&(((ce=se.removeProperties)===null||ce===void 0?void 0:ce.length)>0||((ie=se.addOrUpdateProperties)===null||ie===void 0?void 0:ie.length)>0);if((se.newGeometry||se.removeAllProperties||J)&&(ye=Object.assign({},ye),H.set(se.id,ye),J&&(ye.properties=Object.assign({},ye.properties))),se.newGeometry&&(ye.geometry=se.newGeometry),se.removeAllProperties)ye.properties={};else if(((_e=se.removeProperties)===null||_e===void 0?void 0:_e.length)>0)for(const Ce of se.removeProperties)Object.prototype.hasOwnProperty.call(ye.properties,Ce)&&delete ye.properties[Ce];if(((pe=se.addOrUpdateProperties)===null||pe===void 0?void 0:pe.length)>0)for(const{key:Ce,value:Ve}of se.addOrUpdateProperties)ye.properties[Ce]=Ve}}(this._dataUpdateable,R.dataDiff,j),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(R){return z._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(R){return this._geoJSONIndex.getClusterExpansionZoom(R.clusterId)}getClusterChildren(R){return this._geoJSONIndex.getChildren(R.clusterId)}getClusterLeaves(R){return this._geoJSONIndex.getLeaves(R.clusterId,R.limit,R.offset)}}class hr{constructor(R){this.self=R,this.actor=new z.J(R),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(L,j)=>{if(this.externalWorkerSourceTypes[L])throw new Error(`Worker source with name "${L}" already registered.`);this.externalWorkerSourceTypes[L]=j},this.self.addProtocol=z.cz,this.self.removeProtocol=z.cA,this.self.registerRTLTextPlugin=L=>{z.cU.setMethods(L)},this.actor.registerMessageHandler("LDT",(L,j)=>this._getDEMWorkerSource(L,j.source).loadTile(j)),this.actor.registerMessageHandler("RDT",(L,j)=>z._(this,void 0,void 0,function*(){this._getDEMWorkerSource(L,j.source).removeTile(j)})),this.actor.registerMessageHandler("GCEZ",(L,j)=>z._(this,void 0,void 0,function*(){return this._getWorkerSource(L,j.type,j.source).getClusterExpansionZoom(j)})),this.actor.registerMessageHandler("GCC",(L,j)=>z._(this,void 0,void 0,function*(){return this._getWorkerSource(L,j.type,j.source).getClusterChildren(j)})),this.actor.registerMessageHandler("GCL",(L,j)=>z._(this,void 0,void 0,function*(){return this._getWorkerSource(L,j.type,j.source).getClusterLeaves(j)})),this.actor.registerMessageHandler("LD",(L,j)=>this._getWorkerSource(L,j.type,j.source).loadData(j)),this.actor.registerMessageHandler("GD",(L,j)=>this._getWorkerSource(L,j.type,j.source).getData()),this.actor.registerMessageHandler("LT",(L,j)=>this._getWorkerSource(L,j.type,j.source).loadTile(j)),this.actor.registerMessageHandler("RT",(L,j)=>this._getWorkerSource(L,j.type,j.source).reloadTile(j)),this.actor.registerMessageHandler("AT",(L,j)=>this._getWorkerSource(L,j.type,j.source).abortTile(j)),this.actor.registerMessageHandler("RMT",(L,j)=>this._getWorkerSource(L,j.type,j.source).removeTile(j)),this.actor.registerMessageHandler("RS",(L,j)=>z._(this,void 0,void 0,function*(){if(!this.workerSources[L]||!this.workerSources[L][j.type]||!this.workerSources[L][j.type][j.source])return;const H=this.workerSources[L][j.type][j.source];delete this.workerSources[L][j.type][j.source],H.removeSource!==void 0&&H.removeSource(j)})),this.actor.registerMessageHandler("RM",L=>z._(this,void 0,void 0,function*(){delete this.layerIndexes[L],delete this.availableImages[L],delete this.workerSources[L],delete this.demWorkerSources[L]})),this.actor.registerMessageHandler("SR",(L,j)=>z._(this,void 0,void 0,function*(){this.referrer=j})),this.actor.registerMessageHandler("SRPS",(L,j)=>this._syncRTLPluginState(L,j)),this.actor.registerMessageHandler("IS",(L,j)=>z._(this,void 0,void 0,function*(){this.self.importScripts(j)})),this.actor.registerMessageHandler("SI",(L,j)=>this._setImages(L,j)),this.actor.registerMessageHandler("UL",(L,j)=>z._(this,void 0,void 0,function*(){this._getLayerIndex(L).update(j.layers,j.removedIds)})),this.actor.registerMessageHandler("SL",(L,j)=>z._(this,void 0,void 0,function*(){this._getLayerIndex(L).replace(j)}))}_setImages(R,L){return z._(this,void 0,void 0,function*(){this.availableImages[R]=L;for(const j in this.workerSources[R]){const H=this.workerSources[R][j];for(const Q in H)H[Q].availableImages=L}})}_syncRTLPluginState(R,L){return z._(this,void 0,void 0,function*(){return yield z.cU.syncState(L,this.self.importScripts)})}_getAvailableImages(R){let L=this.availableImages[R];return L||(L=[]),L}_getLayerIndex(R){let L=this.layerIndexes[R];return L||(L=this.layerIndexes[R]=new c),L}_getWorkerSource(R,L,j){if(this.workerSources[R]||(this.workerSources[R]={}),this.workerSources[R][L]||(this.workerSources[R][L]={}),!this.workerSources[R][L][j]){const H={sendAsync:(Q,re)=>(Q.targetMapId=R,this.actor.sendAsync(Q,re))};switch(L){case"vector":this.workerSources[R][L][j]=new Sr(H,this._getLayerIndex(R),this._getAvailableImages(R));break;case"geojson":this.workerSources[R][L][j]=new ea(H,this._getLayerIndex(R),this._getAvailableImages(R));break;default:this.workerSources[R][L][j]=new this.externalWorkerSourceTypes[L](H,this._getLayerIndex(R),this._getAvailableImages(R))}}return this.workerSources[R][L][j]}_getDEMWorkerSource(R,L){return this.demWorkerSources[R]||(this.demWorkerSources[R]={}),this.demWorkerSources[R][L]||(this.demWorkerSources[R][L]=new Ge),this.demWorkerSources[R][L]}}return z.i(self)&&(self.worker=new hr(self)),hr}),wc("index",["exports","./shared"],function(z,c){var Di="5.6.1";function Tr(){var h=new c.A(4);return c.A!=Float32Array&&(h[1]=0,h[2]=0),h[0]=1,h[3]=1,h}let Ri,Sr;const Ge={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(h,e,i){const a=requestAnimationFrame(u=>{o(),e(u)}),{unsubscribe:o}=c.s(h.signal,"abort",()=>{o(),cancelAnimationFrame(a),i(c.c())},!1)},frameAsync(h){return new Promise((e,i)=>{this.frame(h,e,i)})},getImageData(h,e=0){return this.getImageCanvasContext(h).getImageData(-e,-e,h.width+2*e,h.height+2*e)},getImageCanvasContext(h){const e=window.document.createElement("canvas"),i=e.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("failed to create canvas 2d context");return e.width=h.width,e.height=h.height,i.drawImage(h,0,0,h.width,h.height),i},resolveURL:h=>(Ri||(Ri=document.createElement("a")),Ri.href=h,Ri.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(Sr==null&&(Sr=matchMedia("(prefers-reduced-motion: reduce)")),Sr.matches)}};class fe{static testProp(e){if(!fe.docStyle)return e[0];for(let i=0;i<e.length;i++)if(e[i]in fe.docStyle)return e[i];return e[0]}static create(e,i,a){const o=window.document.createElement(e);return i!==void 0&&(o.className=i),a&&a.appendChild(o),o}static createNS(e,i){return window.document.createElementNS(e,i)}static disableDrag(){fe.docStyle&&fe.selectProp&&(fe.userSelect=fe.docStyle[fe.selectProp],fe.docStyle[fe.selectProp]="none")}static enableDrag(){fe.docStyle&&fe.selectProp&&(fe.docStyle[fe.selectProp]=fe.userSelect)}static setTransform(e,i){e.style[fe.transformProp]=i}static addEventListener(e,i,a,o={}){e.addEventListener(i,a,"passive"in o?o:o.capture)}static removeEventListener(e,i,a,o={}){e.removeEventListener(i,a,"passive"in o?o:o.capture)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",fe.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",fe.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",fe.suppressClickInternal,!0)},0)}static getScale(e){const i=e.getBoundingClientRect();return{x:i.width/e.offsetWidth||1,y:i.height/e.offsetHeight||1,boundingClientRect:i}}static getPoint(e,i,a){const o=i.boundingClientRect;return new c.P((a.clientX-o.left)/i.x-e.clientLeft,(a.clientY-o.top)/i.y-e.clientTop)}static mousePos(e,i){const a=fe.getScale(e);return fe.getPoint(e,a,i)}static touchPos(e,i){const a=[],o=fe.getScale(e);for(let u=0;u<i.length;u++)a.push(fe.getPoint(e,o,i[u]));return a}static mouseButton(e){return e.button}static remove(e){e.parentNode&&e.parentNode.removeChild(e)}static sanitize(e){const i=new DOMParser().parseFromString(e,"text/html").body||document.createElement("body"),a=i.querySelectorAll("script");for(const o of a)o.remove();return fe.clean(i),i.innerHTML}static isPossiblyDangerous(e,i){const a=i.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(e)||!a.includes("javascript:")&&!a.includes("data:"))||!!e.startsWith("on")||void 0}static clean(e){const i=e.children;for(const a of i)fe.removeAttributes(a),fe.clean(a)}static removeAttributes(e){for(const{name:i,value:a}of e.attributes)fe.isPossiblyDangerous(i,a)&&e.removeAttribute(i)}}fe.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,fe.selectProp=fe.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),fe.transformProp=fe.testProp(["transform","WebkitTransform"]);const Le={supported:!1,testSupport:function(h){!Gr&&Pr&&(qr?ts(h):Zr=h)}};let Zr,Pr,Gr=!1,qr=!1;function ts(h){const e=h.createTexture();h.bindTexture(h.TEXTURE_2D,e);try{if(h.texImage2D(h.TEXTURE_2D,0,h.RGBA,h.RGBA,h.UNSIGNED_BYTE,Pr),h.isContextLost())return;Le.supported=!0}catch{}h.deleteTexture(e),Gr=!0}var ci;typeof document<"u"&&(Pr=document.createElement("img"),Pr.onload=()=>{Zr&&ts(Zr),Zr=null,qr=!0},Pr.onerror=()=>{Gr=!0,Zr=null},Pr.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(h){let e,i,a,o;h.resetRequestQueue=()=>{e=[],i=0,a=0,o={}},h.addThrottleControl=y=>{const v=a++;return o[v]=y,v},h.removeThrottleControl=y=>{delete o[y],f()},h.getImage=(y,v,w=!0)=>new Promise((P,S)=>{Le.supported&&(y.headers||(y.headers={}),y.headers.accept="image/webp,*/*"),c.e(y,{type:"image"}),e.push({abortController:v,requestParameters:y,supportImageRefresh:w,state:"queued",onError:I=>{S(I)},onSuccess:I=>{P(I)}}),f()});const u=y=>c._(this,void 0,void 0,function*(){y.state="running";const{requestParameters:v,supportImageRefresh:w,onError:P,onSuccess:S,abortController:I}=y,k=w===!1&&!c.i(self)&&!c.g(v.url)&&(!v.headers||Object.keys(v.headers).reduce((N,$)=>N&&$==="accept",!0));i++;const V=k?_(v,I):c.m(v,I);try{const N=yield V;delete y.abortController,y.state="completed",N.data instanceof HTMLImageElement||c.b(N.data)?S(N):N.data&&S({data:yield(O=N.data,typeof createImageBitmap=="function"?c.f(O):c.h(O)),cacheControl:N.cacheControl,expires:N.expires})}catch(N){delete y.abortController,P(N)}finally{i--,f()}var O}),f=()=>{const y=(()=>{for(const v of Object.keys(o))if(o[v]())return!0;return!1})()?c.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:c.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let v=i;v<y&&e.length>0;v++){const w=e.shift();w.abortController.signal.aborted?v--:u(w)}},_=(y,v)=>new Promise((w,P)=>{const S=new Image,I=y.url,k=y.credentials;k&&k==="include"?S.crossOrigin="use-credentials":(k&&k==="same-origin"||!c.d(I))&&(S.crossOrigin="anonymous"),v.signal.addEventListener("abort",()=>{S.src="",P(c.c())}),S.fetchPriority="high",S.onload=()=>{S.onerror=S.onload=null,w({data:S})},S.onerror=()=>{S.onerror=S.onload=null,v.signal.aborted||P(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))},S.src=I})}(ci||(ci={})),ci.resetRequestQueue();class Dt{constructor(e){this._transformRequestFn=e}transformRequest(e,i){return this._transformRequestFn&&this._transformRequestFn(e,i)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function Pt(h){const e=[];if(typeof h=="string")e.push({id:"default",url:h});else if(h&&h.length>0){const i=[];for(const{id:a,url:o}of h){const u=`${a}${o}`;i.indexOf(u)===-1&&(i.push(u),e.push({id:a,url:o}))}}return e}function Ki(h,e,i){try{const a=new URL(h);return a.pathname+=`${e}${i}`,a.toString()}catch{throw new Error(`Invalid sprite URL "${h}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}function is(h){const{userImage:e}=h;return!!(e&&e.render&&e.render())&&(h.data.replace(new Uint8Array(e.data.buffer)),!0)}class Ks extends c.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new c.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(const{ids:i,promiseResolve:a}of this.requestors)a(this._getImagesForIds(i));this.requestors=[]}}getImage(e){const i=this.images[e];if(i&&!i.data&&i.spriteData){const a=i.spriteData;i.data=new c.R({width:a.width,height:a.height},a.context.getImageData(a.x,a.y,a.width,a.height).data),i.spriteData=null}return i}addImage(e,i){if(this.images[e])throw new Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,i)&&(this.images[e]=i)}_validate(e,i){let a=!0;const o=i.data||i.spriteData;return this._validateStretch(i.stretchX,o&&o.width)||(this.fire(new c.k(new Error(`Image "${e}" has invalid "stretchX" value`))),a=!1),this._validateStretch(i.stretchY,o&&o.height)||(this.fire(new c.k(new Error(`Image "${e}" has invalid "stretchY" value`))),a=!1),this._validateContent(i.content,i)||(this.fire(new c.k(new Error(`Image "${e}" has invalid "content" value`))),a=!1),a}_validateStretch(e,i){if(!e)return!0;let a=0;for(const o of e){if(o[0]<a||o[1]<o[0]||i<o[1])return!1;a=o[1]}return!0}_validateContent(e,i){if(!e)return!0;if(e.length!==4)return!1;const a=i.spriteData,o=a&&a.width||i.data.width,u=a&&a.height||i.data.height;return!(e[0]<0||o<e[0]||e[1]<0||u<e[1]||e[2]<0||o<e[2]||e[3]<0||u<e[3]||e[2]<e[0]||e[3]<e[1])}updateImage(e,i,a=!0){const o=this.getImage(e);if(a&&(o.data.width!==i.data.width||o.data.height!==i.data.height))throw new Error(`size mismatch between old image (${o.data.width}x${o.data.height}) and new image (${i.data.width}x${i.data.height}).`);i.version=o.version+1,this.images[e]=i,this.updatedImages[e]=!0}removeImage(e){const i=this.images[e];delete this.images[e],delete this.patterns[e],i.userImage&&i.userImage.onRemove&&i.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e){return new Promise((i,a)=>{let o=!0;if(!this.isLoaded())for(const u of e)this.images[u]||(o=!1);this.isLoaded()||o?i(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:i})})}_getImagesForIds(e){const i={};for(const a of e){let o=this.getImage(a);o||(this.fire(new c.l("styleimagemissing",{id:a})),o=this.getImage(a)),o?i[a]={data:o.data.clone(),pixelRatio:o.pixelRatio,sdf:o.sdf,version:o.version,stretchX:o.stretchX,stretchY:o.stretchY,content:o.content,textFitWidth:o.textFitWidth,textFitHeight:o.textFitHeight,hasRenderCallback:!!(o.userImage&&o.userImage.render)}:c.w(`Image "${a}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return i}getPixelSize(){const{width:e,height:i}=this.atlasImage;return{width:e,height:i}}getPattern(e){const i=this.patterns[e],a=this.getImage(e);if(!a)return null;if(i&&i.position.version===a.version)return i.position;if(i)i.position.version=a.version;else{const o={w:a.data.width+2,h:a.data.height+2,x:0,y:0},u=new c.I(o,a);this.patterns[e]={bin:o,position:u}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){const i=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new c.T(e,this.atlasImage,i.RGBA),this.atlasTexture.bind(i.LINEAR,i.CLAMP_TO_EDGE)}_updatePatternAtlas(){const e=[];for(const u in this.patterns)e.push(this.patterns[u].bin);const{w:i,h:a}=c.p(e),o=this.atlasImage;o.resize({width:i||1,height:a||1});for(const u in this.patterns){const{bin:f}=this.patterns[u],_=f.x+1,y=f.y+1,v=this.getImage(u).data,w=v.width,P=v.height;c.R.copy(v,o,{x:0,y:0},{x:_,y},{width:w,height:P}),c.R.copy(v,o,{x:0,y:P-1},{x:_,y:y-1},{width:w,height:1}),c.R.copy(v,o,{x:0,y:0},{x:_,y:y+P},{width:w,height:1}),c.R.copy(v,o,{x:w-1,y:0},{x:_-1,y},{width:1,height:P}),c.R.copy(v,o,{x:0,y:0},{x:_+w,y},{width:1,height:P})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(const i of e){if(this.callbackDispatchedThisFrame[i])continue;this.callbackDispatchedThisFrame[i]=!0;const a=this.getImage(i);a||c.w(`Image with ID: "${i}" was not found`),is(a)&&this.updateImage(i,a)}}}const Mr=1e20;function _n(h,e,i,a,o,u,f,_,y){for(let v=e;v<e+a;v++)Ir(h,i*u+v,u,o,f,_,y);for(let v=i;v<i+o;v++)Ir(h,v*u+e,1,a,f,_,y)}function Ir(h,e,i,a,o,u,f){u[0]=0,f[0]=-Mr,f[1]=Mr,o[0]=h[e];for(let _=1,y=0,v=0;_<a;_++){o[_]=h[e+_*i];const w=_*_;do{const P=u[y];v=(o[_]-o[P]+w-P*P)/(_-P)/2}while(v<=f[y]&&--y>-1);y++,u[y]=_,f[y]=v,f[y+1]=Mr}for(let _=0,y=0;_<a;_++){for(;f[y+1]<_;)y++;const v=u[y],w=_-v;h[e+_*i]=o[v]+w*w}}class Li{constructor(e,i){this.requestManager=e,this.localIdeographFontFamily=i,this.entries={}}setURL(e){this.url=e}getGlyphs(e){return c._(this,void 0,void 0,function*(){const i=[];for(const u in e)for(const f of e[u])i.push(this._getAndCacheGlyphsPromise(u,f));const a=yield Promise.all(i),o={};for(const{stack:u,id:f,glyph:_}of a)o[u]||(o[u]={}),o[u][f]=_&&{id:_.id,bitmap:_.bitmap.clone(),metrics:_.metrics};return o})}_getAndCacheGlyphsPromise(e,i){return c._(this,void 0,void 0,function*(){let a=this.entries[e];a||(a=this.entries[e]={glyphs:{},requests:{},ranges:{}});let o=a.glyphs[i];if(o!==void 0)return{stack:e,id:i,glyph:o};if(o=this._tinySDF(a,e,i),o)return a.glyphs[i]=o,{stack:e,id:i,glyph:o};const u=Math.floor(i/256);if(256*u>65535)throw new Error("glyphs > 65535 not supported");if(a.ranges[u])return{stack:e,id:i,glyph:o};if(!this.url)throw new Error("glyphsUrl is not set");if(!a.requests[u]){const _=Li.loadGlyphRange(e,u,this.url,this.requestManager);a.requests[u]=_}const f=yield a.requests[u];for(const _ in f)this._doesCharSupportLocalGlyph(+_)||(a.glyphs[+_]=f[+_]);return a.ranges[u]=!0,{stack:e,id:i,glyph:f[i]||null}})}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&(new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}","u").test(String.fromCodePoint(e))||c.u["CJK Unified Ideographs"](e)||c.u["Hangul Syllables"](e)||c.u.Hiragana(e)||c.u.Katakana(e)||c.u["CJK Symbols and Punctuation"](e)||c.u["Halfwidth and Fullwidth Forms"](e))}_tinySDF(e,i,a){const o=this.localIdeographFontFamily;if(!o||!this._doesCharSupportLocalGlyph(a))return;let u=e.tinySDF;if(!u){let _="400";/bold/i.test(i)?_="900":/medium/i.test(i)?_="500":/light/i.test(i)&&(_="200"),u=e.tinySDF=new Li.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:o,fontWeight:_})}const f=u.draw(String.fromCharCode(a));return{id:a,bitmap:new c.q({width:f.width||60,height:f.height||60},f.data),metrics:{width:f.glyphWidth/2||24,height:f.glyphHeight/2||24,left:f.glyphLeft/2+.5||0,top:f.glyphTop/2-27.5||-8,advance:f.glyphAdvance/2||24,isDoubleResolution:!0}}}}Li.loadGlyphRange=function(h,e,i,a){return c._(this,void 0,void 0,function*(){const o=256*e,u=o+255,f=a.transformRequest(i.replace("{fontstack}",h).replace("{range}",`${o}-${u}`),"Glyphs"),_=yield c.n(f,new AbortController);if(!_||!_.data)throw new Error(`Could not load glyph range. range: ${e}, ${o}-${u}`);const y={};for(const v of c.o(_.data))y[v.id]=v;return y})},Li.TinySDF=class{constructor({fontSize:h=24,buffer:e=3,radius:i=8,cutoff:a=.25,fontFamily:o="sans-serif",fontWeight:u="normal",fontStyle:f="normal"}={}){this.buffer=e,this.cutoff=a,this.radius=i;const _=this.size=h+4*e,y=this._createCanvas(_),v=this.ctx=y.getContext("2d",{willReadFrequently:!0});v.font=`${f} ${u} ${h}px ${o}`,v.textBaseline="alphabetic",v.textAlign="left",v.fillStyle="black",this.gridOuter=new Float64Array(_*_),this.gridInner=new Float64Array(_*_),this.f=new Float64Array(_),this.z=new Float64Array(_+1),this.v=new Uint16Array(_)}_createCanvas(h){const e=document.createElement("canvas");return e.width=e.height=h,e}draw(h){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:a,actualBoundingBoxLeft:o,actualBoundingBoxRight:u}=this.ctx.measureText(h),f=Math.ceil(i),_=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(u-o))),y=Math.min(this.size-this.buffer,f+Math.ceil(a)),v=_+2*this.buffer,w=y+2*this.buffer,P=Math.max(v*w,0),S=new Uint8ClampedArray(P),I={data:S,width:v,height:w,glyphWidth:_,glyphHeight:y,glyphTop:f,glyphLeft:0,glyphAdvance:e};if(_===0||y===0)return I;const{ctx:k,buffer:V,gridInner:O,gridOuter:N}=this;k.clearRect(V,V,_,y),k.fillText(h,V,V+f);const $=k.getImageData(V,V,_,y);N.fill(Mr,0,P),O.fill(0,0,P);for(let q=0;q<y;q++)for(let Z=0;Z<_;Z++){const Y=$.data[4*(q*_+Z)+3]/255;if(Y===0)continue;const K=(q+V)*v+Z+V;if(Y===1)N[K]=0,O[K]=Mr;else{const G=.5-Y;N[K]=G>0?G*G:0,O[K]=G<0?G*G:0}}_n(N,0,0,v,w,v,this.f,this.v,this.z),_n(O,V,V,_,y,v,this.f,this.v,this.z);for(let q=0;q<P;q++){const Z=Math.sqrt(N[q])-Math.sqrt(O[q]);S[q]=Math.round(255-255*(Z/this.radius+this.cutoff))}return I}};class Wr{constructor(){this.specification=c.v.light.position}possiblyEvaluate(e,i){return c.B(e.expression.evaluate(i))}interpolate(e,i,a){return{x:c.C.number(e.x,i.x,a),y:c.C.number(e.y,i.y,a),z:c.C.number(e.z,i.z,a)}}}let Ji;class gn extends c.E{constructor(e){super(),Ji=Ji||new c.r({anchor:new c.D(c.v.light.anchor),position:new Wr,color:new c.D(c.v.light.color),intensity:new c.D(c.v.light.intensity)}),this._transitionable=new c.t(Ji),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,i={}){if(!this._validate(c.x,e,i))for(const a in e){const o=e[a];a.endsWith("-transition")?this._transitionable.setTransition(a.slice(0,-11),o):this._transitionable.setValue(a,o)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,i,a){return(!a||a.validate!==!1)&&c.y(this,e.call(c.z,{value:i,style:{glyphs:!0,sprite:!0},styleSpec:c.v}))}}const Hr=new c.r({"sky-color":new c.D(c.v.sky["sky-color"]),"horizon-color":new c.D(c.v.sky["horizon-color"]),"fog-color":new c.D(c.v.sky["fog-color"]),"fog-ground-blend":new c.D(c.v.sky["fog-ground-blend"]),"horizon-fog-blend":new c.D(c.v.sky["horizon-fog-blend"]),"sky-horizon-blend":new c.D(c.v.sky["sky-horizon-blend"]),"atmosphere-blend":new c.D(c.v.sky["atmosphere-blend"])});class Js extends c.E{constructor(e){super(),this._transitionable=new c.t(Hr),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new c.F(0))}setSky(e,i={}){if(!this._validate(c.G,e,i)){e||(e={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const a in e){const o=e[a];a.endsWith("-transition")?this._transitionable.setTransition(a.slice(0,-11),o):this._transitionable.setValue(a,o)}}}getSky(){return this._transitionable.serialize()}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,i,a={}){return a?.validate!==!1&&c.y(this,e.call(c.z,c.e({value:i,style:{glyphs:!0,sprite:!0},styleSpec:c.v})))}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}}class yn{constructor(e,i){this.width=e,this.height=i,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,i){const a=e.join(",")+String(i);return this.dashEntry[a]||(this.dashEntry[a]=this.addDash(e,i)),this.dashEntry[a]}getDashRanges(e,i,a){const o=[];let u=e.length%2==1?-e[e.length-1]*a:0,f=e[0]*a,_=!0;o.push({left:u,right:f,isDash:_,zeroLength:e[0]===0});let y=e[0];for(let v=1;v<e.length;v++){_=!_;const w=e[v];u=y*a,y+=w,f=y*a,o.push({left:u,right:f,isDash:_,zeroLength:w===0})}return o}addRoundDash(e,i,a){const o=i/2;for(let u=-a;u<=a;u++){const f=this.width*(this.nextRow+a+u);let _=0,y=e[_];for(let v=0;v<this.width;v++){v/y.right>1&&(y=e[++_]);const w=Math.abs(v-y.left),P=Math.abs(v-y.right),S=Math.min(w,P);let I;const k=u/a*(o+1);if(y.isDash){const V=o-Math.abs(k);I=Math.sqrt(S*S+V*V)}else I=o-Math.sqrt(S*S+k*k);this.data[f+v]=Math.max(0,Math.min(255,I+128))}}}addRegularDash(e){for(let _=e.length-1;_>=0;--_){const y=e[_],v=e[_+1];y.zeroLength?e.splice(_,1):v&&v.isDash===y.isDash&&(v.left=y.left,e.splice(_,1))}const i=e[0],a=e[e.length-1];i.isDash===a.isDash&&(i.left=a.left-this.width,a.right=i.right+this.width);const o=this.width*this.nextRow;let u=0,f=e[u];for(let _=0;_<this.width;_++){_/f.right>1&&(f=e[++u]);const y=Math.abs(_-f.left),v=Math.abs(_-f.right),w=Math.min(y,v);this.data[o+_]=Math.max(0,Math.min(255,(f.isDash?w:-w)+128))}}addDash(e,i){const a=i?7:0,o=2*a+1;if(this.nextRow+o>this.height)return c.w("LineAtlas out of space"),null;let u=0;for(let _=0;_<e.length;_++)u+=e[_];if(u!==0){const _=this.width/u,y=this.getDashRanges(e,this.width,_);i?this.addRoundDash(y,_,a):this.addRegularDash(y)}const f={y:(this.nextRow+a+.5)/this.height,height:2*a/this.height,width:u};return this.nextRow+=o,this.dirty=!0,f}bind(e){const i=e.gl;this.texture?(i.bindTexture(i.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,i.texSubImage2D(i.TEXTURE_2D,0,0,0,this.width,this.height,i.ALPHA,i.UNSIGNED_BYTE,this.data))):(this.texture=i.createTexture(),i.bindTexture(i.TEXTURE_2D,this.texture),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.REPEAT),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.REPEAT),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texImage2D(i.TEXTURE_2D,0,i.ALPHA,this.width,this.height,0,i.ALPHA,i.UNSIGNED_BYTE,this.data))}}const xn="maplibre_preloaded_worker_pool";class Ti{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<Ti.workerCount;)this.workers.push(new Worker(c.a.WORKER_URL));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.numActive()===0&&(this.workers.forEach(i=>{i.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[xn]}numActive(){return Object.keys(this.active).length}}const ct=Math.floor(Ge.hardwareConcurrency/2);let Ni,Ui;function Cr(){return Ni||(Ni=new Ti),Ni}Ti.workerCount=c.H(globalThis)?Math.max(Math.min(ct,3),1):1;class Xr{constructor(e,i){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=i;const a=this.workerPool.acquire(i);for(let o=0;o<a.length;o++){const u=new c.J(a[o],i);u.name=`Worker ${o}`,this.actors.push(u)}if(!this.actors.length)throw new Error("No actors found")}broadcast(e,i){const a=[];for(const o of this.actors)a.push(o.sendAsync({type:e,data:i}));return Promise.all(a)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){this.actors.forEach(i=>{i.remove()}),this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,i){for(const a of this.actors)a.registerMessageHandler(e,i)}}function vn(){return Ui||(Ui=new Xr(Cr(),c.K),Ui.registerMessageHandler("GR",(h,e,i)=>c.m(e,i))),Ui}function Qs(h,e){const i=c.L();return c.M(i,i,[1,1,0]),c.N(i,i,[.5*h.width,.5*h.height,1]),h.calculatePosMatrix?c.O(i,i,h.calculatePosMatrix(e.toUnwrapped())):i}function Ft(h,e,i,a,o,u,f){var _;const y=function(S,I,k){if(S)for(const V of S){const O=I[V];if(O&&O.source===k&&O.type==="fill-extrusion")return!0}else for(const V in I){const O=I[V];if(O.source===k&&O.type==="fill-extrusion")return!0}return!1}((_=o?.layers)!==null&&_!==void 0?_:null,e,h.id),v=u.maxPitchScaleFactor(),w=h.tilesIn(a,v,y);w.sort(rs);const P=[];for(const S of w)P.push({wrappedTileID:S.tileID.wrapped().key,queryResults:S.tile.queryRenderedFeatures(e,i,h._state,S.queryGeometry,S.cameraQueryGeometry,S.scale,o,u,v,Qs(h.transform,S.tileID),f?(I,k)=>f(S.tileID,I,k):void 0)});return function(S,I){for(const k in S)for(const V of S[k])Si(V,I);return S}(function(S){const I={},k={};for(const V of S){const O=V.queryResults,N=V.wrappedTileID,$=k[N]=k[N]||{};for(const q in O){const Z=O[q],Y=$[q]=$[q]||{},K=I[q]=I[q]||[];for(const G of Z)Y[G.featureIndex]||(Y[G.featureIndex]=!0,K.push(G))}}return I}(P),h)}function rs(h,e){const i=h.tileID,a=e.tileID;return i.overscaledZ-a.overscaledZ||i.canonical.y-a.canonical.y||i.wrap-a.wrap||i.canonical.x-a.canonical.x}function Si(h,e){const i=h.feature,a=e.getFeatureState(i.layer["source-layer"],i.id);i.source=i.layer.source,i.layer["source-layer"]&&(i.sourceLayer=i.layer["source-layer"]),i.state=a}function ns(h,e,i){return c._(this,void 0,void 0,function*(){let a=h;if(h.url?a=(yield c.j(e.transformRequest(h.url,"Source"),i)).data:yield Ge.frameAsync(i),!a)return null;const o=c.Q(c.e(a,h),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in a&&a.vector_layers&&(o.vectorLayerIds=a.vector_layers.map(u=>u.id)),o})}class Mt{constructor(e,i){e&&(i?this.setSouthWest(e).setNorthEast(i):Array.isArray(e)&&(e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof c.S?new c.S(e.lng,e.lat):c.S.convert(e),this}setSouthWest(e){return this._sw=e instanceof c.S?new c.S(e.lng,e.lat):c.S.convert(e),this}extend(e){const i=this._sw,a=this._ne;let o,u;if(e instanceof c.S)o=e,u=e;else{if(!(e instanceof Mt))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(Mt.convert(e)):this.extend(c.S.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(c.S.convert(e)):this;if(o=e._sw,u=e._ne,!o||!u)return this}return i||a?(i.lng=Math.min(o.lng,i.lng),i.lat=Math.min(o.lat,i.lat),a.lng=Math.max(u.lng,a.lng),a.lat=Math.max(u.lat,a.lat)):(this._sw=new c.S(o.lng,o.lat),this._ne=new c.S(u.lng,u.lat)),this}getCenter(){return new c.S((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new c.S(this.getWest(),this.getNorth())}getSouthEast(){return new c.S(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:i,lat:a}=c.S.convert(e);let o=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(o=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=a&&a<=this._ne.lat&&o}static convert(e){return e instanceof Mt?e:e&&new Mt(e)}static fromLngLat(e,i=0){const a=360*i/40075017,o=a/Math.cos(Math.PI/180*e.lat);return new Mt(new c.S(e.lng-o,e.lat-a),new c.S(e.lng+o,e.lat+a))}adjustAntiMeridian(){const e=new c.S(this._sw.lng,this._sw.lat),i=new c.S(this._ne.lng,this._ne.lat);return new Mt(e,e.lng>i.lng?new c.S(i.lng+360,i.lat):i)}}class Qi{constructor(e,i,a){this.bounds=Mt.convert(this.validateBounds(e)),this.minzoom=i||0,this.maxzoom=a||24}validateBounds(e){return Array.isArray(e)&&e.length===4?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(e){const i=Math.pow(2,e.z),a=Math.floor(c.V(this.bounds.getWest())*i),o=Math.floor(c.U(this.bounds.getNorth())*i),u=Math.ceil(c.V(this.bounds.getEast())*i),f=Math.ceil(c.U(this.bounds.getSouth())*i);return e.x>=a&&e.x<u&&e.y>=o&&e.y<f}}class Bi extends c.E{constructor(e,i,a,o){if(super(),this.id=e,this.dispatcher=a,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,c.e(this,c.Q(i,["url","scheme","tileSize","promoteId"])),this._options=c.e({type:"vector"},i),this._collectResourceTiming=i.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(o)}load(){return c._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new c.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const e=yield ns(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e&&(c.e(this,e),e.bounds&&(this.tileBounds=new Qi(e.bounds,this.minzoom,this.maxzoom)),this.fire(new c.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new c.l("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new c.k(e))}})}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.abort(),e(),this.load()}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return c.e({},this._options)}loadTile(e){return c._(this,void 0,void 0,function*(){const i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),a={request:this.map._requestManager.transformRequest(i,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,globalState:this.map.getGlobalState()};a.request.collectResourceTiming=this._collectResourceTiming;let o="RT";if(e.actor&&e.state!=="expired"){if(e.state==="loading")return new Promise((u,f)=>{e.reloadPromise={resolve:u,reject:f}})}else e.actor=this.dispatcher.getActor(),o="LT";e.abortController=new AbortController;try{const u=yield e.actor.sendAsync({type:o,data:a},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,u)}catch(u){if(delete e.abortController,e.aborted)return;if(u&&u.status!==404)throw u;this._afterTileLoadWorkerResponse(e,null)}})}_afterTileLoadWorkerResponse(e,i){if(i&&i.resourceTiming&&(e.resourceTiming=i.resourceTiming),i&&this.map._refreshExpiredTiles&&e.setExpiryData(i),e.loadVectorData(i,this.map.painter),e.reloadPromise){const a=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(a.resolve).catch(a.reject)}}abortTile(e){return c._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&(yield e.actor.sendAsync({type:"AT",data:{uid:e.uid,type:this.type,source:this.id}}))})}unloadTile(e){return c._(this,void 0,void 0,function*(){e.unloadVectorData(),e.actor&&(yield e.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class bn extends c.E{constructor(e,i,a,o){super(),this.id=e,this.dispatcher=a,this.setEventedParent(o),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=c.e({type:"raster"},i),c.e(this,c.Q(i,["url","scheme","tileSize"]))}load(){return c._(this,arguments,void 0,function*(e=!1){this._loaded=!1,this.fire(new c.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const i=yield ns(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,i&&(c.e(this,i),i.bounds&&(this.tileBounds=new Qi(i.bounds,this.minzoom,this.maxzoom)),this.fire(new c.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new c.l("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:e})))}catch(i){this._tileJSONRequest=null,this.fire(new c.k(i))}})}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(e){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),e(),this.load(!0)}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}serialize(){return c.e({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e){return c._(this,void 0,void 0,function*(){const i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{const a=yield ci.getImage(this.map._requestManager.transformRequest(i,"Tile"),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(a&&a.data){this.map._refreshExpiredTiles&&(a.cacheControl||a.expires)&&e.setExpiryData({cacheControl:a.cacheControl,expires:a.expires});const o=this.map.painter.context,u=o.gl,f=a.data;e.texture=this.map.painter.getTileTexture(f.width),e.texture?e.texture.update(f,{useMipmap:!0}):(e.texture=new c.T(o,f,u.RGBA,{useMipmap:!0}),e.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE,u.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(a){if(delete e.abortController,e.aborted)e.state="unloaded";else if(a)throw e.state="errored",a}})}abortTile(e){return c._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController)})}unloadTile(e){return c._(this,void 0,void 0,function*(){e.texture&&this.map.painter.saveTileTexture(e.texture)})}hasTransition(){return!1}}class Yt extends bn{constructor(e,i,a,o){super(e,i,a,o),this.type="raster-dem",this.maxzoom=22,this._options=c.e({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox",this.redFactor=i.redFactor,this.greenFactor=i.greenFactor,this.blueFactor=i.blueFactor,this.baseShift=i.baseShift}loadTile(e){return c._(this,void 0,void 0,function*(){const i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),a=this.map._requestManager.transformRequest(i,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{const o=yield ci.getImage(a,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(o&&o.data){const u=o.data;this.map._refreshExpiredTiles&&(o.cacheControl||o.expires)&&e.setExpiryData({cacheControl:o.cacheControl,expires:o.expires});const f=c.b(u)&&c.W()?u:yield this.readImageNow(u),_={type:this.type,uid:e.uid,source:this.id,rawImageData:f,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!e.actor||e.state==="expired"){e.actor=this.dispatcher.getActor();const y=yield e.actor.sendAsync({type:"LDT",data:_});e.dem=y,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}}catch(o){if(delete e.abortController,e.aborted)e.state="unloaded";else if(o)throw e.state="errored",o}})}readImageNow(e){return c._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&c.X()){const i=e.width+2,a=e.height+2;try{return new c.R({width:i,height:a},yield c.Y(e,-1,-1,i,a))}catch{}}return Ge.getImageData(e,1)})}_getNeighboringTiles(e){const i=e.canonical,a=Math.pow(2,i.z),o=(i.x-1+a)%a,u=i.x===0?e.wrap-1:e.wrap,f=(i.x+1+a)%a,_=i.x+1===a?e.wrap+1:e.wrap,y={};return y[new c.Z(e.overscaledZ,u,i.z,o,i.y).key]={backfilled:!1},y[new c.Z(e.overscaledZ,_,i.z,f,i.y).key]={backfilled:!1},i.y>0&&(y[new c.Z(e.overscaledZ,u,i.z,o,i.y-1).key]={backfilled:!1},y[new c.Z(e.overscaledZ,e.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},y[new c.Z(e.overscaledZ,_,i.z,f,i.y-1).key]={backfilled:!1}),i.y+1<a&&(y[new c.Z(e.overscaledZ,u,i.z,o,i.y+1).key]={backfilled:!1},y[new c.Z(e.overscaledZ,e.wrap,i.z,i.x,i.y+1).key]={backfilled:!1},y[new c.Z(e.overscaledZ,_,i.z,f,i.y+1).key]={backfilled:!1}),y}unloadTile(e){return c._(this,void 0,void 0,function*(){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state="unloaded",e.actor&&(yield e.actor.sendAsync({type:"RDT",data:{type:this.type,uid:e.uid,source:this.id}}))})}}class Pi extends c.E{constructor(e,i,a,o){super(),this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=a.getActor(),this.setEventedParent(o),this._data=i.data,this._options=c.e({},i),this._collectResourceTiming=i.collectResourceTiming,i.maxzoom!==void 0&&(this.maxzoom=i.maxzoom),i.type&&(this.type=i.type),i.attribution&&(this.attribution=i.attribution),this.promoteId=i.promoteId,i.clusterMaxZoom!==void 0&&this.maxzoom<=i.clusterMaxZoom&&c.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${i.clusterMaxZoom}".`),this.workerOptions=c.e({source:this.id,cluster:i.cluster||!1,geojsonVtOptions:{buffer:this._pixelsToTileUnits(i.buffer!==void 0?i.buffer:128),tolerance:this._pixelsToTileUnits(i.tolerance!==void 0?i.tolerance:.375),extent:c.$,maxZoom:this.maxzoom,lineMetrics:i.lineMetrics||!1,generateId:i.generateId||!1},superclusterOptions:{maxZoom:this._getClusterMaxZoom(i.clusterMaxZoom),minPoints:Math.max(2,i.clusterMinPoints||2),extent:c.$,radius:this._pixelsToTileUnits(i.clusterRadius||50),log:!1,generateId:i.generateId||!1},clusterProperties:i.clusterProperties,filter:i.filter},i.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}_pixelsToTileUnits(e){return e*(c.$/this.tileSize)}_getClusterMaxZoom(e){const i=e?Math.round(e):this.maxzoom-1;return Number.isInteger(e)||e===void 0||c.w(`Integer expected for option 'clusterMaxZoom': provided value "${e}" rounded to "${i}"`),i}load(){return c._(this,void 0,void 0,function*(){yield this._updateWorkerData()})}onAdd(e){this.map=e,this.load()}setData(e){return this._data=e,this._updateWorkerData(),this}updateData(e){return this._updateWorkerData(e),this}getData(){return c._(this,void 0,void 0,function*(){const e=c.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:e})})}getCoordinatesFromGeometry(e){return e.type==="GeometryCollection"?e.geometries.map(i=>i.coordinates).flat(1/0):e.coordinates.flat(1/0)}getBounds(){return c._(this,void 0,void 0,function*(){const e=new Mt,i=yield this.getData();let a;switch(i.type){case"FeatureCollection":a=i.features.map(o=>this.getCoordinatesFromGeometry(o.geometry)).flat(1/0);break;case"Feature":a=this.getCoordinatesFromGeometry(i.geometry);break;default:a=this.getCoordinatesFromGeometry(i)}if(a.length==0)return e;for(let o=0;o<a.length-1;o+=2)e.extend([a[o],a[o+1]]);return e})}setClusterOptions(e){return this.workerOptions.cluster=e.cluster,e&&(e.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=this._pixelsToTileUnits(e.clusterRadius)),e.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=this._getClusterMaxZoom(e.clusterMaxZoom))),this._updateWorkerData(),this}getClusterExpansionZoom(e){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:e,source:this.id}})}getClusterChildren(e){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:e,source:this.id}})}getClusterLeaves(e,i,a){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:e,limit:i,offset:a}})}_updateWorkerData(e){return c._(this,void 0,void 0,function*(){const i=c.e({type:this.type},this.workerOptions);e?i.dataDiff=e:typeof this._data=="string"?(i.request=this.map._requestManager.transformRequest(Ge.resolveURL(this._data),"Source"),i.request.collectResourceTiming=this._collectResourceTiming):i.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new c.l("dataloading",{dataType:"source"}));try{const a=yield this.actor.sendAsync({type:"LD",data:i});if(this._pendingLoads--,this._removed||a.abandoned)return void this.fire(new c.l("dataabort",{dataType:"source"}));let o=null;a.resourceTiming&&a.resourceTiming[this.id]&&(o=a.resourceTiming[this.id].slice(0));const u={dataType:"source"};this._collectResourceTiming&&o&&o.length>0&&c.e(u,{resourceTiming:o}),this.fire(new c.l("data",Object.assign(Object.assign({},u),{sourceDataType:"metadata"}))),this.fire(new c.l("data",Object.assign(Object.assign({},u),{sourceDataType:"content"})))}catch(a){if(this._pendingLoads--,this._removed)return void this.fire(new c.l("dataabort",{dataType:"source"}));this.fire(new c.k(a))}})}loaded(){return this._pendingLoads===0}loadTile(e){return c._(this,void 0,void 0,function*(){const i=e.actor?"RT":"LT";e.actor=this.actor;const a={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,globalState:this.map.getGlobalState()};e.abortController=new AbortController;const o=yield this.actor.sendAsync({type:i,data:a},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(o,this.map.painter,i==="RT")})}abortTile(e){return c._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0})}unloadTile(e){return c._(this,void 0,void 0,function*(){e.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return c.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}class _i extends c.E{constructor(e,i,a,o){super(),this.flippedWindingOrder=!1,this.id=e,this.dispatcher=a,this.coordinates=i.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(o),this.options=i}load(e){return c._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new c.l("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const i=yield ci.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,i&&i.data&&(this.image=i.data,e&&(this.coordinates=e),this._finishLoading())}catch(i){this._request=null,this._loaded=!0,this.fire(new c.k(i))}})}loaded(){return this._loaded}updateImage(e){return e.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=e.url,this.load(e.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new c.l("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(e){this.coordinates=e;const i=e.map(c.a0.fromLngLat);var a;return this.tileID=function(o){const u=c.a1.fromPoints(o),f=u.width(),_=u.height(),y=Math.max(f,_),v=Math.max(0,Math.floor(-Math.log(y)/Math.LN2)),w=Math.pow(2,v);return new c.a3(v,Math.floor((u.minX+u.maxX)/2*w),Math.floor((u.minY+u.maxY)/2*w))}(i),this.terrainTileRanges=this._getOverlappingTileRanges(i),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=i.map(o=>this.tileID.getTilePoint(o)._round()),this.flippedWindingOrder=((a=this.tileCoords)[1].x-a[0].x)*(a[2].y-a[0].y)-(a[1].y-a[0].y)*(a[2].x-a[0].x)<0,this.fire(new c.l("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const e=this.map.painter.context,i=e.gl;this.texture||(this.texture=new c.T(e,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let a=!1;for(const o in this.tiles){const u=this.tiles[o];u.state!=="loaded"&&(u.state="loaded",u.texture=this.texture,a=!0)}a&&this.fire(new c.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(e){return c._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(e){const{minX:i,minY:a,maxX:o,maxY:u}=c.a1.fromPoints(e),f={};for(let _=0;_<=c.a2;_++){const y=Math.pow(2,_),v=Math.floor(i*y),w=Math.floor(a*y),P=Math.floor(o*y),S=Math.floor(u*y);f[_]={minTileX:v,minTileY:w,maxTileX:P,maxTileY:S}}return f}}class Yr extends _i{constructor(e,i,a,o){super(e,i,a,o),this.roundZoom=!0,this.type="video",this.options=i}load(){return c._(this,void 0,void 0,function*(){this._loaded=!1;const e=this.options;this.urls=[];for(const i of e.urls)this.urls.push(this.map._requestManager.transformRequest(i,"Source").url);try{const i=yield c.a4(this.urls);if(this._loaded=!0,!i)return;this.video=i,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(i){this.fire(new c.k(i))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){const i=this.video.seekable;e<i.start(0)||e>i.end(0)?this.fire(new c.k(new c.a5(`sources.${this.id}`,null,`Playback for this video can be set only between the ${i.start(0)} and ${i.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const e=this.map.painter.context,i=e.gl;this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new c.T(e,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let a=!1;for(const o in this.tiles){const u=this.tiles[o];u.state!=="loaded"&&(u.state="loaded",u.texture=this.texture,a=!0)}a&&this.fire(new c.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class Ar extends _i{constructor(e,i,a,o){super(e,i,a,o),i.coordinates?Array.isArray(i.coordinates)&&i.coordinates.length===4&&!i.coordinates.some(u=>!Array.isArray(u)||u.length!==2||u.some(f=>typeof f!="number"))||this.fire(new c.k(new c.a5(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new c.k(new c.a5(`sources.${e}`,null,'missing required property "coordinates"'))),i.animate&&typeof i.animate!="boolean"&&this.fire(new c.k(new c.a5(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),i.canvas?typeof i.canvas=="string"||i.canvas instanceof HTMLCanvasElement||this.fire(new c.k(new c.a5(`sources.${e}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new c.k(new c.a5(`sources.${e}`,null,'missing required property "canvas"'))),this.options=i,this.animate=i.animate===void 0||i.animate}load(){return c._(this,void 0,void 0,function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new c.k(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())})}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const i=this.map.painter.context,a=i.gl;this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new c.T(i,this.canvas,a.RGBA,{premultiply:!0});let o=!1;for(const u in this.tiles){const f=this.tiles[u];f.state!=="loaded"&&(f.state="loaded",f.texture=this.texture,o=!0)}o&&this.fire(new c.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}}const ss={},Kr=h=>{switch(h){case"geojson":return Pi;case"image":return _i;case"raster":return bn;case"raster-dem":return Yt;case"vector":return Bi;case"video":return Yr;case"canvas":return Ar}return ss[h]},lr="RTLPluginLoaded";class Jr extends c.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=vn()}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch(i=>{throw this.status="error",i})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(e){return c._(this,arguments,void 0,function*(i,a=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=Ge.resolveURL(i),!this.url)throw new Error(`requested url ${i} is invalid`);if(this.status==="unavailable"){if(!a)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return c._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new c.l(lr))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let cr=null;function Mi(){return cr||(cr=new Jr),cr}class er{constructor(e,i){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=c.a6(),this.uses=0,this.tileSize=i,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(e){const i=e+this.timeAdded;i<this.fadeEndTime||(this.fadeEndTime=i)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,i,a){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(o,u){const f={};if(!u)return f;for(const _ of o){const y=_.layerIds.map(v=>u.getLayer(v)).filter(Boolean);if(y.length!==0){_.layers=y,_.stateDependentLayerIds&&(_.stateDependentLayers=_.stateDependentLayerIds.map(v=>y.filter(w=>w.id===v)[0]));for(const v of y)f[v.id]=_}}return f}(e.buckets,i?.style),this.hasSymbolBuckets=!1;for(const o in this.buckets){const u=this.buckets[o];if(u instanceof c.a8){if(this.hasSymbolBuckets=!0,!a)break;u.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const o in this.buckets){const u=this.buckets[o];if(u instanceof c.a8&&u.hasRTLText){this.hasRTLText=!0,Mi().lazyLoad();break}}this.queryPadding=0;for(const o in this.buckets){const u=this.buckets[o];this.queryPadding=Math.max(this.queryPadding,i.style.getLayer(o).queryRadius(u))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}else this.collisionBoxArray=new c.a7}unloadVectorData(){for(const e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(e){return this.buckets[e.id]}upload(e){for(const a in this.buckets){const o=this.buckets[a];o.uploadPending()&&o.upload(e)}const i=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new c.T(e,this.imageAtlas.image,i.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new c.T(e,this.glyphAtlasImage,i.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,i,a,o,u,f,_,y,v,w,P){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:o,cameraQueryGeometry:u,scale:f,tileSize:this.tileSize,pixelPosMatrix:w,transform:y,params:_,queryPadding:this.queryPadding*v,getElevation:P},e,i,a):{}}querySourceFeatures(e,i){const a=this.latestFeatureIndex;if(!a||!a.rawTileData)return;const o=a.loadVTLayers(),u=i&&i.sourceLayer?i.sourceLayer:"",f=o._geojsonTileLayer||o[u];if(!f)return;const _=c.a9(i&&i.filter),{z:y,x:v,y:w}=this.tileID.canonical,P={z:y,x:v,y:w};for(let S=0;S<f.length;S++){const I=f.feature(S);if(_.needGeometry){const O=c.aa(I,!0);if(!_.filter(new c.F(this.tileID.overscaledZ),O,this.tileID.canonical))continue}else if(!_.filter(new c.F(this.tileID.overscaledZ),I))continue;const k=a.getId(I,u),V=new c.ab(I,y,v,w,k);V.tile=P,e.push(V)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){const i=this.expirationTime;if(e.cacheControl){const a=c.ac(e.cacheControl);a["max-age"]&&(this.expirationTime=Date.now()+1e3*a["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){const a=Date.now();let o=!1;if(this.expirationTime>a)o=!1;else if(i)if(this.expirationTime<i)o=!0;else{const u=this.expirationTime-i;u?this.expirationTime=a+Math.max(u,3e4):o=!0}else o=!0;o?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(e,i){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(e).length===0)return;const a=this.latestFeatureIndex.loadVTLayers();for(const o in this.buckets){if(!i.style.hasLayer(o))continue;const u=this.buckets[o],f=u.layers[0].sourceLayer||"_geojsonTileLayer",_=a[f],y=e[f];if(!_||!y||Object.keys(y).length===0)continue;u.update(y,_,this.imageAtlas&&this.imageAtlas.patternPositions||{});const v=i&&i.style&&i.style.getLayer(o);v&&(this.queryPadding=Math.max(this.queryPadding,v.queryRadius(u)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<Ge.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=Ge.now()+e}setDependencies(e,i){const a={};for(const o of i)a[o]=!0;this.dependencies[e]=a}hasDependency(e,i){for(const a of e){const o=this.dependencies[a];if(o){for(const u of i)if(o[u])return!0}}return!1}}class as{constructor(e,i){this.max=e,this.onRemove=i,this.reset()}reset(){for(const e in this.data)for(const i of this.data[e])i.timeout&&clearTimeout(i.timeout),this.onRemove(i.value);return this.data={},this.order=[],this}add(e,i,a){const o=e.wrapped().key;this.data[o]===void 0&&(this.data[o]=[]);const u={value:i,timeout:void 0};if(a!==void 0&&(u.timeout=setTimeout(()=>{this.remove(e,u)},a)),this.data[o].push(u),this.order.push(o),this.order.length>this.max){const f=this._getAndRemoveByKey(this.order[0]);f&&this.onRemove(f)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){const i=this.data[e].shift();return i.timeout&&clearTimeout(i.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),i.value}getByKey(e){const i=this.data[e];return i?i[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,i){if(!this.has(e))return this;const a=e.wrapped().key,o=i===void 0?0:this.data[a].indexOf(i),u=this.data[a][o];return this.data[a].splice(o,1),u.timeout&&clearTimeout(u.timeout),this.data[a].length===0&&delete this.data[a],this.onRemove(u.value),this.order.splice(this.order.indexOf(a),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){const i=this._getAndRemoveByKey(this.order[0]);i&&this.onRemove(i)}return this}filter(e){const i=[];for(const a in this.data)for(const o of this.data[a])e(o.value)||i.push(o);for(const a of i)this.remove(a.value.tileID,a)}}class ea{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,i,a){const o=String(i);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][o]=this.stateChanges[e][o]||{},c.e(this.stateChanges[e][o],a),this.deletedStates[e]===null){this.deletedStates[e]={};for(const u in this.state[e])u!==o&&(this.deletedStates[e][u]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][o]===null){this.deletedStates[e][o]={};for(const u in this.state[e][o])a[u]||(this.deletedStates[e][o][u]=null)}else for(const u in a)this.deletedStates[e]&&this.deletedStates[e][o]&&this.deletedStates[e][o][u]===null&&delete this.deletedStates[e][o][u]}removeFeatureState(e,i,a){if(this.deletedStates[e]===null)return;const o=String(i);if(this.deletedStates[e]=this.deletedStates[e]||{},a&&i!==void 0)this.deletedStates[e][o]!==null&&(this.deletedStates[e][o]=this.deletedStates[e][o]||{},this.deletedStates[e][o][a]=null);else if(i!==void 0)if(this.stateChanges[e]&&this.stateChanges[e][o])for(a in this.deletedStates[e][o]={},this.stateChanges[e][o])this.deletedStates[e][o][a]=null;else this.deletedStates[e][o]=null;else this.deletedStates[e]=null}getState(e,i){const a=String(i),o=c.e({},(this.state[e]||{})[a],(this.stateChanges[e]||{})[a]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){const u=this.deletedStates[e][i];if(u===null)return{};for(const f in u)delete o[f]}return o}initializeTileState(e,i){e.setFeatureState(this.state,i)}coalesceChanges(e,i){const a={};for(const o in this.stateChanges){this.state[o]=this.state[o]||{};const u={};for(const f in this.stateChanges[o])this.state[o][f]||(this.state[o][f]={}),c.e(this.state[o][f],this.stateChanges[o][f]),u[f]=this.state[o][f];a[o]=u}for(const o in this.deletedStates){this.state[o]=this.state[o]||{};const u={};if(this.deletedStates[o]===null)for(const f in this.state[o])u[f]={},this.state[o][f]={};else for(const f in this.deletedStates[o]){if(this.deletedStates[o][f]===null)this.state[o][f]={};else for(const _ of Object.keys(this.deletedStates[o][f]))delete this.state[o][f][_];u[f]=this.state[o][f]}a[o]=a[o]||{},c.e(a[o],u)}if(this.stateChanges={},this.deletedStates={},Object.keys(a).length!==0)for(const o in e)e[o].setFeatureState(a,i)}}const hr=89.25;function ne(h,e){const i=c.ag(e.lat,-c.ah,c.ah);return new c.P(c.V(e.lng)*h,c.U(i)*h)}function R(h,e){return new c.a0(e.x/h,e.y/h).toLngLat()}function L(h){return h.cameraToCenterDistance*Math.min(.85*Math.tan(c.ad(90-h.pitch)),Math.tan(c.ad(hr-h.pitch)))}function j(h,e){const i=h.canonical,a=e/c.ae(i.z),o=i.x+Math.pow(2,i.z)*h.wrap,u=c.af(new Float64Array(16));return c.M(u,u,[o*a,i.y*a,0]),c.N(u,u,[a/c.$,a/c.$,1]),u}function H(h,e,i,a,o){const u=c.a0.fromLngLat(h,e),f=o*c.ai(1,h.lat),_=f*Math.cos(c.ad(i)),y=Math.sqrt(f*f-_*_),v=y*Math.sin(c.ad(-a)),w=y*Math.cos(c.ad(-a));return new c.a0(u.x+v,u.y+w,u.z+_)}function Q(h,e,i){const a=e.intersectsFrustum(h);if(!i||a===0)return a;const o=e.intersectsPlane(i);return o===0?0:a===2&&o===2?2:1}function re(h,e,i){let a=0;const o=(i-e)/10;for(let u=0;u<10;u++)a+=o*Math.pow(Math.cos(e+(u+.5)/10*(i-e)),h);return a}function ce(h,e){return function(i,a,o,u,f){const _=2*((h-1)/c.aj(Math.cos(c.ad(hr-f))/Math.cos(c.ad(hr)))-1),y=Math.acos(o/u),v=2*re(_-1,0,c.ad(f/2)),w=Math.min(c.ad(hr),y+c.ad(f/2)),P=re(_-1,Math.min(w,y-c.ad(f/2)),w),S=Math.atan(a/o),I=Math.hypot(a,o);let k=i;return k+=c.aj(u/I/Math.max(.5,Math.cos(c.ad(f/2)))),k+=_*c.aj(Math.cos(S))/2,k-=c.aj(Math.max(1,P/v/e))/2,k}}const ie=ce(9.314,3);function _e(h,e){const i=(e.roundZoom?Math.round:Math.floor)(h.zoom+c.aj(h.tileSize/e.tileSize));return Math.max(0,i)}function pe(h,e){const i=h.getCameraFrustum(),a=h.getClippingPlane(),o=h.screenPointToMercatorCoordinate(h.getCameraPoint()),u=c.a0.fromLngLat(h.center,h.elevation);o.z=u.z+Math.cos(h.pitchInRadians)*h.cameraToCenterDistance/h.worldSize;const f=h.getCoveringTilesDetailsProvider(),_=f.allowVariableZoom(h,e),y=_e(h,e),v=e.minzoom||0,w=e.maxzoom!==void 0?e.maxzoom:h.maxZoom,P=Math.min(Math.max(0,y),w),S=Math.pow(2,P),I=[S*o.x,S*o.y,0],k=[S*u.x,S*u.y,0],V=Math.hypot(u.x-o.x,u.y-o.y),O=Math.abs(u.z-o.z),N=Math.hypot(V,O),$=Y=>({zoom:0,x:0,y:0,wrap:Y,fullyVisible:!1}),q=[],Z=[];if(h.renderWorldCopies&&f.allowWorldCopies())for(let Y=1;Y<=3;Y++)q.push($(-Y)),q.push($(Y));for(q.push($(0));q.length>0;){const Y=q.pop(),K=Y.x,G=Y.y;let te=Y.fullyVisible;const he={x:K,y:G,z:Y.zoom},ae=f.getTileBoundingVolume(he,Y.wrap,h.elevation,e);if(!te){const Pe=Q(i,ae,a);if(Pe===0)continue;te=Pe===2}const oe=f.distanceToTile2d(o.x,o.y,he,ae);let ue=y;_&&(ue=(e.calculateTileZoom||ie)(h.zoom+c.aj(h.tileSize/e.tileSize),oe,O,N,h.fov)),ue=(e.roundZoom?Math.round:Math.floor)(ue),ue=Math.max(0,ue);const Me=Math.min(ue,w);if(Y.wrap=f.getWrap(u,he,Y.wrap),Y.zoom>=Me){if(Y.zoom<v)continue;const Pe=P-Y.zoom,ve=I[0]-.5-(K<<Pe),ze=I[1]-.5-(G<<Pe),We=e.reparseOverscaled?Math.max(Y.zoom,ue):Y.zoom;Z.push({tileID:new c.Z(Y.zoom===w?We:Y.zoom,Y.wrap,Y.zoom,K,G),distanceSq:c.ak([k[0]-.5-K,k[1]-.5-G]),tileDistanceToCamera:Math.sqrt(ve*ve+ze*ze)})}else for(let Pe=0;Pe<4;Pe++)q.push({zoom:Y.zoom+1,x:(K<<1)+Pe%2,y:(G<<1)+(Pe>>1),wrap:Y.wrap,fullyVisible:te})}return Z.sort((Y,K)=>Y.distanceSq-K.distanceSq).map(Y=>Y.tileID)}const se=c.a1.fromPoints([new c.P(0,0),new c.P(c.$,c.$)]);class ye extends c.E{constructor(e,i,a){super(),this.id=e,this.dispatcher=a,this.on("data",o=>this._dataHandler(o)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((o,u,f,_)=>{const y=new(Kr(u.type))(o,u,f,_);if(y.id!==o)throw new Error(`Expected Source id to be ${o} instead of ${y.id}`);return y})(e,i,a,this),this._tiles={},this._cache=new as(0,o=>this._unloadTile(o)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new ea,this._didEmitContent=!1,this._updated=!1}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(e)}onRemove(e){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(e)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const e in this._tiles){const i=this._tiles[e];if(i.state!=="loaded"&&i.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(e,i,a){return c._(this,void 0,void 0,function*(){try{yield this._source.loadTile(e),this._tileLoaded(e,i,a)}catch(o){e.state="errored",o.status!==404?this._source.fire(new c.k(o,{tile:e})):this.update(this.transform,this.terrain)}})}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new c.l("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const i in this._tiles){const a=this._tiles[i];a.upload(e),a.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(e=>e.tileID).sort(J).map(e=>e.key)}getRenderableIds(e){const i=[];for(const a in this._tiles)this._isIdRenderable(a,e)&&i.push(this._tiles[a]);return e?i.sort((a,o)=>{const u=a.tileID,f=o.tileID,_=new c.P(u.canonical.x,u.canonical.y)._rotate(-this.transform.bearingInRadians),y=new c.P(f.canonical.x,f.canonical.y)._rotate(-this.transform.bearingInRadians);return u.overscaledZ-f.overscaledZ||y.y-_.y||y.x-_.x}).map(a=>a.tileID.key):i.map(a=>a.tileID).sort(J).map(a=>a.key)}hasRenderableParent(e){const i=this.findLoadedParent(e,0);return!!i&&this._isIdRenderable(i.tileID.key)}_isIdRenderable(e,i){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(i||!this._tiles[e].holdingForFade())}reload(e){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const i in this._tiles)e?this._reloadTile(i,"expired"):this._tiles[i].state!=="errored"&&this._reloadTile(i,"reloading")}}_reloadTile(e,i){return c._(this,void 0,void 0,function*(){const a=this._tiles[e];a&&(a.state!=="loading"&&(a.state=i),yield this._loadTile(a,e,i))})}_tileLoaded(e,i,a){e.timeAdded=Ge.now(),a==="expired"&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(i,e),this.getSource().type==="raster-dem"&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new c.l("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){const i=this.getRenderableIds();for(let o=0;o<i.length;o++){const u=i[o];if(e.neighboringTiles&&e.neighboringTiles[u]){const f=this.getTileByID(u);a(e,f),a(f,e)}}function a(o,u){o.needsHillshadePrepare=!0,o.needsTerrainPrepare=!0;let f=u.tileID.canonical.x-o.tileID.canonical.x;const _=u.tileID.canonical.y-o.tileID.canonical.y,y=Math.pow(2,o.tileID.canonical.z),v=u.tileID.key;f===0&&_===0||Math.abs(_)>1||(Math.abs(f)>1&&(Math.abs(f+y)===1?f+=y:Math.abs(f-y)===1&&(f-=y)),u.dem&&o.dem&&(o.dem.backfillBorder(u.dem,f,_),o.neighboringTiles&&o.neighboringTiles[v]&&(o.neighboringTiles[v].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,i,a,o){for(const u in this._tiles){let f=this._tiles[u];if(o[u]||!f.hasData()||f.tileID.overscaledZ<=i||f.tileID.overscaledZ>a)continue;let _=f.tileID;for(;f&&f.tileID.overscaledZ>i+1;){const v=f.tileID.scaledTo(f.tileID.overscaledZ-1);f=this._tiles[v.key],f&&f.hasData()&&(_=v)}let y=_;for(;y.overscaledZ>i;)if(y=y.scaledTo(y.overscaledZ-1),e[y.key]||e[y.canonical.key]){o[_.key]=_;break}}}findLoadedParent(e,i){if(e.key in this._loadedParentTiles){const a=this._loadedParentTiles[e.key];return a&&a.tileID.overscaledZ>=i?a:null}for(let a=e.overscaledZ-1;a>=i;a--){const o=e.scaledTo(a),u=this._getLoadedTile(o);if(u)return u}}findLoadedSibling(e){return this._getLoadedTile(e)}_getLoadedTile(e){const i=this._tiles[e.key];return i&&i.hasData()?i:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){const i=Math.ceil(e.width/this._source.tileSize)+1,a=Math.ceil(e.height/this._source.tileSize)+1,o=Math.floor(i*a*(this._maxTileCacheZoomLevels===null?c.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),u=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,o):o;this._cache.setMaxSize(u)}handleWrapJump(e){const i=Math.round((e-(this._prevLng===void 0?e:this._prevLng))/360);if(this._prevLng=e,i){const a={};for(const o in this._tiles){const u=this._tiles[o];u.tileID=u.tileID.unwrapTo(u.tileID.wrap+i),a[u.tileID.key]=u}this._tiles=a;for(const o in this._timers)clearTimeout(this._timers[o]),delete this._timers[o];for(const o in this._tiles)this._setTileReloadTimer(o,this._tiles[o])}}_updateCoveredAndRetainedTiles(e,i,a,o,u,f){const _={},y={},v=Object.keys(e),w=Ge.now();for(const P of v){const S=e[P],I=this._tiles[P];if(!I||I.fadeEndTime!==0&&I.fadeEndTime<=w)continue;const k=this.findLoadedParent(S,i),V=this.findLoadedSibling(S),O=k||V||null;O&&(this._addTile(O.tileID),_[O.tileID.key]=O.tileID),y[P]=S}this._retainLoadedChildren(y,o,a,e);for(const P in _)e[P]||(this._coveredTiles[P]=!0,e[P]=_[P]);if(f){const P={},S={};for(const I of u)this._tiles[I.key].hasData()?P[I.key]=I:S[I.key]=I;for(const I in S){const k=S[I].children(this._source.maxzoom);this._tiles[k[0].key]&&this._tiles[k[1].key]&&this._tiles[k[2].key]&&this._tiles[k[3].key]&&(P[k[0].key]=e[k[0].key]=k[0],P[k[1].key]=e[k[1].key]=k[1],P[k[2].key]=e[k[2].key]=k[2],P[k[3].key]=e[k[3].key]=k[3],delete S[I])}for(const I in S){const k=S[I],V=this.findLoadedParent(k,this._source.minzoom),O=this.findLoadedSibling(k),N=V||O||null;if(N){P[N.tileID.key]=e[N.tileID.key]=N.tileID;for(const $ in P)P[$].isChildOf(N.tileID)&&delete P[$]}}for(const I in this._tiles)P[I]||(this._coveredTiles[I]=!0)}}update(e,i){if(!this._sourceLoaded||this._paused)return;let a;this.transform=e,this.terrain=i,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?a=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(w=>new c.Z(w.canonical.z,w.wrap,w.canonical.z,w.canonical.x,w.canonical.y)):(a=pe(e,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:i,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(a=a.filter(w=>this._source.hasTile(w)))):a=[];const o=_e(e,this._source),u=Math.max(o-ye.maxOverzooming,this._source.minzoom),f=Math.max(o+ye.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const w={};for(const P of a)if(P.canonical.z>this._source.minzoom){const S=P.scaledTo(P.canonical.z-1);w[S.key]=S;const I=P.scaledTo(Math.max(this._source.minzoom,Math.min(P.canonical.z,5)));w[I.key]=I}a=a.concat(Object.values(w))}const _=a.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,_&&this.fire(new c.l("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const y=this._updateRetainedTiles(a,o);Ce(this._source.type)&&this._updateCoveredAndRetainedTiles(y,u,f,o,a,i);for(const w in y)this._tiles[w].clearFadeHold();const v=c.al(this._tiles,y);for(const w of v){const P=this._tiles[w];P.hasSymbolBuckets&&!P.holdingForFade()?P.setHoldDuration(this.map._fadeDuration):P.hasSymbolBuckets&&!P.symbolFadeFinished()||this._removeTile(w)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,i){var a;const o={},u={},f=Math.max(i-ye.maxOverzooming,this._source.minzoom),_=Math.max(i+ye.maxUnderzooming,this._source.minzoom),y={};for(const v of e){const w=this._addTile(v);o[v.key]=v,w.hasData()||i<this._source.maxzoom&&(y[v.key]=v)}this._retainLoadedChildren(y,i,_,o);for(const v of e){let w=this._tiles[v.key];if(w.hasData())continue;if(i+1>this._source.maxzoom){const S=v.children(this._source.maxzoom)[0],I=this.getTile(S);if(I&&I.hasData()){o[S.key]=S;continue}}else{const S=v.children(this._source.maxzoom);if(o[S[0].key]&&o[S[1].key]&&o[S[2].key]&&o[S[3].key])continue}let P=w.wasRequested();for(let S=v.overscaledZ-1;S>=f;--S){const I=v.scaledTo(S);if(u[I.key])break;if(u[I.key]=!0,w=this.getTile(I),!w&&P&&(w=this._addTile(I)),w){const k=w.hasData();if((k||!(!((a=this.map)===null||a===void 0)&&a.cancelPendingTileRequestsWhileZooming)||P)&&(o[I.key]=I),P=w.wasRequested(),k)break}}}return o}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const e in this._tiles){const i=[];let a,o=this._tiles[e].tileID;for(;o.overscaledZ>0;){if(o.key in this._loadedParentTiles){a=this._loadedParentTiles[o.key];break}i.push(o.key);const u=o.scaledTo(o.overscaledZ-1);if(a=this._getLoadedTile(u),a)break;o=u}for(const u of i)this._loadedParentTiles[u]=a}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const e in this._tiles){const i=this._tiles[e].tileID,a=this._getLoadedTile(i);this._loadedSiblingTiles[i.key]=a}}_addTile(e){let i=this._tiles[e.key];if(i)return i;i=this._cache.getAndRemove(e),i&&(this._setTileReloadTimer(e.key,i),i.tileID=e,this._state.initializeTileState(i,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,i)));const a=i;return i||(i=new er(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(i,e.key,i.state)),i.uses++,this._tiles[e.key]=i,a||this._source.fire(new c.l("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i}_setTileReloadTimer(e,i){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);const a=i.getExpiryTimeout();a&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},a))}refreshTiles(e){for(const i in this._tiles)(this._isIdRenderable(i)||this._tiles[i].state=="errored")&&e.some(a=>a.equals(this._tiles[i].tileID.canonical))&&this._reloadTile(i,"expired")}_removeTile(e){const i=this._tiles[e];i&&(i.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),i.uses>0||(i.hasData()&&i.state!=="reloading"?this._cache.add(i.tileID,i,i.getExpiryTimeout()):(i.aborted=!0,this._abortTile(i),this._unloadTile(i))))}_dataHandler(e){const i=e.sourceDataType;e.dataType==="source"&&i==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&e.dataType==="source"&&i==="content"&&(this.reload(e.sourceDataChanged),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,i,a){const o=[],u=this.transform;if(!u)return o;const f=u.getCoveringTilesDetailsProvider().allowWorldCopies(),_=a?u.getCameraQueryGeometry(e):e,y=I=>u.screenPointToMercatorCoordinate(I,this.terrain),v=this.transformBbox(e,y,!f),w=this.transformBbox(_,y,!f),P=this.getIds(),S=c.a1.fromPoints(w);for(let I=0;I<P.length;I++){const k=this._tiles[P[I]];if(k.holdingForFade())continue;const V=f?[k.tileID]:[k.tileID.unwrapTo(-1),k.tileID.unwrapTo(0)],O=Math.pow(2,u.zoom-k.tileID.overscaledZ),N=i*k.queryPadding*c.$/k.tileSize/O;for(const $ of V){const q=S.map(Z=>$.getTilePoint(new c.a0(Z.x,Z.y)));if(q.expandBy(N),q.intersects(se)){const Z=v.map(K=>$.getTilePoint(K)),Y=w.map(K=>$.getTilePoint(K));o.push({tile:k,tileID:f?$:$.unwrapTo(0),queryGeometry:Z,cameraQueryGeometry:Y,scale:O})}}}return o}transformBbox(e,i,a){let o=e.map(i);if(a){const u=c.a1.fromPoints(e);u.shrinkBy(.001*Math.min(u.width(),u.height()));const f=u.map(i);c.a1.fromPoints(o).covers(f)||(o=o.map(_=>_.x>.5?new c.a0(_.x-1,_.y,_.z):_))}return o}getVisibleCoordinates(e){const i=this.getRenderableIds(e).map(a=>this._tiles[a].tileID);return this.transform&&this.transform.populateCache(i),i}hasTransition(){if(this._source.hasTransition())return!0;if(Ce(this._source.type)){const e=Ge.now();for(const i in this._tiles)if(this._tiles[i].fadeEndTime>=e)return!0}return!1}setFeatureState(e,i,a){this._state.updateState(e=e||"_geojsonTileLayer",i,a)}removeFeatureState(e,i,a){this._state.removeFeatureState(e=e||"_geojsonTileLayer",i,a)}getFeatureState(e,i){return this._state.getState(e=e||"_geojsonTileLayer",i)}setDependencies(e,i,a){const o=this._tiles[e];o&&o.setDependencies(i,a)}reloadTilesForDependencies(e,i){for(const a in this._tiles)this._tiles[a].hasDependency(e,i)&&this._reloadTile(a,"reloading");this._cache.filter(a=>!a.hasDependency(e,i))}}function J(h,e){const i=Math.abs(2*h.wrap)-+(h.wrap<0),a=Math.abs(2*e.wrap)-+(e.wrap<0);return h.overscaledZ-e.overscaledZ||a-i||e.canonical.y-h.canonical.y||e.canonical.x-h.canonical.x}function Ce(h){return h==="raster"||h==="image"||h==="video"}ye.maxOverzooming=10,ye.maxUnderzooming=3;class Ve{constructor(e,i){this.reset(e,i)}reset(e,i){this.points=e||[],this._distances=[0];for(let a=1;a<this.points.length;a++)this._distances[a]=this._distances[a-1]+this.points[a].dist(this.points[a-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(i||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(this.points.length===1)return this.points[0];e=c.ag(e,0,1);let i=1,a=this._distances[i];const o=e*this.paddedLength+this.padding;for(;a<o&&i<this._distances.length;)a=this._distances[++i];const u=i-1,f=this._distances[u],_=a-f,y=_>0?(o-f)/_:0;return this.points[u].mult(1-y).add(this.points[i].mult(y))}}function Ee(h,e){let i=!0;return h==="always"||h!=="never"&&e!=="never"||(i=!1),i}class Be{constructor(e,i,a){const o=this.boxCells=[],u=this.circleCells=[];this.xCellCount=Math.ceil(e/a),this.yCellCount=Math.ceil(i/a);for(let f=0;f<this.xCellCount*this.yCellCount;f++)o.push([]),u.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=i,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/i,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,i,a,o,u){this._forEachCell(i,a,o,u,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(i),this.bboxes.push(a),this.bboxes.push(o),this.bboxes.push(u)}insertCircle(e,i,a,o){this._forEachCell(i-o,a-o,i+o,a+o,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(i),this.circles.push(a),this.circles.push(o)}_insertBoxCell(e,i,a,o,u,f){this.boxCells[u].push(f)}_insertCircleCell(e,i,a,o,u,f){this.circleCells[u].push(f)}_query(e,i,a,o,u,f,_){if(a<0||e>this.width||o<0||i>this.height)return[];const y=[];if(e<=0&&i<=0&&this.width<=a&&this.height<=o){if(u)return[{key:null,x1:e,y1:i,x2:a,y2:o}];for(let v=0;v<this.boxKeys.length;v++)y.push({key:this.boxKeys[v],x1:this.bboxes[4*v],y1:this.bboxes[4*v+1],x2:this.bboxes[4*v+2],y2:this.bboxes[4*v+3]});for(let v=0;v<this.circleKeys.length;v++){const w=this.circles[3*v],P=this.circles[3*v+1],S=this.circles[3*v+2];y.push({key:this.circleKeys[v],x1:w-S,y1:P-S,x2:w+S,y2:P+S})}}else this._forEachCell(e,i,a,o,this._queryCell,y,{hitTest:u,overlapMode:f,seenUids:{box:{},circle:{}}},_);return y}query(e,i,a,o){return this._query(e,i,a,o,!1,null)}hitTest(e,i,a,o,u,f){return this._query(e,i,a,o,!0,u,f).length>0}hitTestCircle(e,i,a,o,u){const f=e-a,_=e+a,y=i-a,v=i+a;if(_<0||f>this.width||v<0||y>this.height)return!1;const w=[];return this._forEachCell(f,y,_,v,this._queryCellCircle,w,{hitTest:!0,overlapMode:o,circle:{x:e,y:i,radius:a},seenUids:{box:{},circle:{}}},u),w.length>0}_queryCell(e,i,a,o,u,f,_,y){const{seenUids:v,hitTest:w,overlapMode:P}=_,S=this.boxCells[u];if(S!==null){const k=this.bboxes;for(const V of S)if(!v.box[V]){v.box[V]=!0;const O=4*V,N=this.boxKeys[V];if(e<=k[O+2]&&i<=k[O+3]&&a>=k[O+0]&&o>=k[O+1]&&(!y||y(N))&&(!w||!Ee(P,N.overlapMode))&&(f.push({key:N,x1:k[O],y1:k[O+1],x2:k[O+2],y2:k[O+3]}),w))return!0}}const I=this.circleCells[u];if(I!==null){const k=this.circles;for(const V of I)if(!v.circle[V]){v.circle[V]=!0;const O=3*V,N=this.circleKeys[V];if(this._circleAndRectCollide(k[O],k[O+1],k[O+2],e,i,a,o)&&(!y||y(N))&&(!w||!Ee(P,N.overlapMode))){const $=k[O],q=k[O+1],Z=k[O+2];if(f.push({key:N,x1:$-Z,y1:q-Z,x2:$+Z,y2:q+Z}),w)return!0}}}return!1}_queryCellCircle(e,i,a,o,u,f,_,y){const{circle:v,seenUids:w,overlapMode:P}=_,S=this.boxCells[u];if(S!==null){const k=this.bboxes;for(const V of S)if(!w.box[V]){w.box[V]=!0;const O=4*V,N=this.boxKeys[V];if(this._circleAndRectCollide(v.x,v.y,v.radius,k[O+0],k[O+1],k[O+2],k[O+3])&&(!y||y(N))&&!Ee(P,N.overlapMode))return f.push(!0),!0}}const I=this.circleCells[u];if(I!==null){const k=this.circles;for(const V of I)if(!w.circle[V]){w.circle[V]=!0;const O=3*V,N=this.circleKeys[V];if(this._circlesCollide(k[O],k[O+1],k[O+2],v.x,v.y,v.radius)&&(!y||y(N))&&!Ee(P,N.overlapMode))return f.push(!0),!0}}}_forEachCell(e,i,a,o,u,f,_,y){const v=this._convertToXCellCoord(e),w=this._convertToYCellCoord(i),P=this._convertToXCellCoord(a),S=this._convertToYCellCoord(o);for(let I=v;I<=P;I++)for(let k=w;k<=S;k++)if(u.call(this,e,i,a,o,this.xCellCount*k+I,f,_,y))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,i,a,o,u,f){const _=o-e,y=u-i,v=a+f;return v*v>_*_+y*y}_circleAndRectCollide(e,i,a,o,u,f,_){const y=(f-o)/2,v=Math.abs(e-(o+y));if(v>y+a)return!1;const w=(_-u)/2,P=Math.abs(i-(u+w));if(P>w+a)return!1;if(v<=y||P<=w)return!0;const S=v-y,I=P-w;return S*S+I*I<=a*a}}function $e(h,e,i){const a=c.L();if(!h){const{vecSouth:P,vecEast:S}=lt(e),I=Tr();I[0]=S[0],I[1]=S[1],I[2]=P[0],I[3]=P[1],o=I,(w=(f=(u=I)[0])*(v=u[3])-(y=u[2])*(_=u[1]))&&(o[0]=v*(w=1/w),o[1]=-_*w,o[2]=-y*w,o[3]=f*w),a[0]=I[0],a[1]=I[1],a[4]=I[2],a[5]=I[3]}var o,u,f,_,y,v,w;return c.N(a,a,[1/i,1/i,1]),a}function ft(h,e,i,a){if(h){const o=c.L();if(!e){const{vecSouth:u,vecEast:f}=lt(i);o[0]=f[0],o[1]=f[1],o[4]=u[0],o[5]=u[1]}return c.N(o,o,[a,a,1]),o}return i.pixelsToClipSpaceMatrix}function lt(h){const e=Math.cos(h.rollInRadians),i=Math.sin(h.rollInRadians),a=Math.cos(h.pitchInRadians),o=Math.cos(h.bearingInRadians),u=Math.sin(h.bearingInRadians),f=c.aq();f[0]=-o*a*i-u*e,f[1]=-u*a*i+o*e;const _=c.ar(f);_<1e-9?c.as(f):c.at(f,f,1/_);const y=c.aq();y[0]=o*a*e-u*i,y[1]=u*a*e+o*i;const v=c.ar(y);return v<1e-9?c.as(y):c.at(y,y,1/v),{vecEast:y,vecSouth:f}}function st(h,e,i,a){let o;a?(o=[h,e,a(h,e),1],c.av(o,o,i)):(o=[h,e,0,1],en(o,o,i));const u=o[3];return{point:new c.P(o[0]/u,o[1]/u),signedDistanceFromCamera:u,isOccluded:!1}}function Ue(h,e){return .5+h/e*.5}function it(h,e){return h.x>=-e[0]&&h.x<=e[0]&&h.y>=-e[1]&&h.y<=e[1]}function Nt(h,e,i,a,o,u,f,_,y,v,w,P,S){const I=i?h.textSizeData:h.iconSizeData,k=c.am(I,e.transform.zoom),V=[256/e.width*2+1,256/e.height*2+1],O=i?h.text.dynamicLayoutVertexArray:h.icon.dynamicLayoutVertexArray;O.clear();const N=h.lineVertexArray,$=i?h.text.placedSymbolArray:h.icon.placedSymbolArray,q=e.transform.width/e.transform.height;let Z=!1;for(let Y=0;Y<$.length;Y++){const K=$.get(Y);if(K.hidden||K.writingMode===c.an.vertical&&!Z){ur(K.numGlyphs,O);continue}Z=!1;const G=new c.P(K.anchorX,K.anchorY),te={getElevation:S,pitchedLabelPlaneMatrix:a,lineVertexArray:N,pitchWithMap:u,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:e.transform,tileAnchorPoint:G,unwrappedTileID:y,width:v,height:w,translation:P},he=Xe(K.anchorX,K.anchorY,te);if(!it(he.point,V)){ur(K.numGlyphs,O);continue}const ae=Ue(e.transform.cameraToCenterDistance,he.signedDistanceFromCamera),oe=c.ao(I,k,K),ue=u?oe*e.transform.getPitchedTextCorrection(K.anchorX,K.anchorY,y)/ae:oe*ae,Me=yt({projectionContext:te,pitchedLabelPlaneMatrixInverse:o,symbol:K,fontSize:ue,flip:!1,keepUpright:f,glyphOffsetArray:h.glyphOffsetArray,dynamicLayoutVertexArray:O,aspectRatio:q,rotateToLine:_});Z=Me.useVertical,(Me.notEnoughRoom||Z||Me.needsFlipping&&yt({projectionContext:te,pitchedLabelPlaneMatrixInverse:o,symbol:K,fontSize:ue,flip:!0,keepUpright:f,glyphOffsetArray:h.glyphOffsetArray,dynamicLayoutVertexArray:O,aspectRatio:q,rotateToLine:_}).notEnoughRoom)&&ur(K.numGlyphs,O)}i?h.text.dynamicLayoutVertexBuffer.updateData(O):h.icon.dynamicLayoutVertexBuffer.updateData(O)}function Se(h,e,i,a,o,u,f,_){const y=u.glyphStartIndex+u.numGlyphs,v=u.lineStartIndex,w=u.lineStartIndex+u.lineLength,P=e.getoffsetX(u.glyphStartIndex),S=e.getoffsetX(y-1),I=tr(h*P,i,a,o,u.segment,v,w,_,f);if(!I)return null;const k=tr(h*S,i,a,o,u.segment,v,w,_,f);return k?_.projectionCache.anyProjectionOccluded?null:{first:I,last:k}:null}function Kt(h,e,i,a){return h===c.an.horizontal&&Math.abs(i.y-e.y)>Math.abs(i.x-e.x)*a?{useVertical:!0}:(h===c.an.vertical?e.y<i.y:e.x>i.x)?{needsFlipping:!0}:null}function yt(h){const{projectionContext:e,pitchedLabelPlaneMatrixInverse:i,symbol:a,fontSize:o,flip:u,keepUpright:f,glyphOffsetArray:_,dynamicLayoutVertexArray:y,aspectRatio:v,rotateToLine:w}=h,P=o/24,S=a.lineOffsetX*P,I=a.lineOffsetY*P;let k;if(a.numGlyphs>1){const V=a.glyphStartIndex+a.numGlyphs,O=a.lineStartIndex,N=a.lineStartIndex+a.lineLength,$=Se(P,_,S,I,u,a,w,e);if(!$)return{notEnoughRoom:!0};const q=He($.first.point.x,$.first.point.y,e,i),Z=He($.last.point.x,$.last.point.y,e,i);if(f&&!u){const Y=Kt(a.writingMode,q,Z,v);if(Y)return Y}k=[$.first];for(let Y=a.glyphStartIndex+1;Y<V-1;Y++){const K=tr(P*_.getoffsetX(Y),S,I,u,a.segment,O,N,e,w);if(!K)return{notEnoughRoom:!0};k.push(K)}k.push($.last)}else{if(f&&!u){const O=Ie(e.tileAnchorPoint.x,e.tileAnchorPoint.y,e).point,N=a.lineStartIndex+a.segment+1,$=new c.P(e.lineVertexArray.getx(N),e.lineVertexArray.gety(N)),q=Ie($.x,$.y,e),Z=q.signedDistanceFromCamera>0?q.point:Er(e.tileAnchorPoint,$,O,1,e),Y=He(O.x,O.y,e,i),K=He(Z.x,Z.y,e,i),G=Kt(a.writingMode,Y,K,v);if(G)return G}const V=tr(P*_.getoffsetX(a.glyphStartIndex),S,I,u,a.segment,a.lineStartIndex,a.lineStartIndex+a.lineLength,e,w);if(!V||e.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};k=[V]}for(const V of k)c.au(y,V.point,V.angle);return{}}function Er(h,e,i,a,o){const u=h.add(h.sub(e)._unit()),f=Ie(u.x,u.y,o).point,_=i.sub(f);return i.add(_._mult(a/_.mag()))}function Qr(h,e,i){const a=e.projectionCache;if(a.projections[h])return a.projections[h];const o=new c.P(e.lineVertexArray.getx(h),e.lineVertexArray.gety(h)),u=Ie(o.x,o.y,e);if(u.signedDistanceFromCamera>0)return a.projections[h]=u.point,a.anyProjectionOccluded=a.anyProjectionOccluded||u.isOccluded,u.point;const f=h-i.direction;return Er(i.distanceFromAnchor===0?e.tileAnchorPoint:new c.P(e.lineVertexArray.getx(f),e.lineVertexArray.gety(f)),o,i.previousVertex,i.absOffsetX-i.distanceFromAnchor+1,e)}function Ie(h,e,i){const a=h+i.translation[0],o=e+i.translation[1];let u;return i.pitchWithMap?(u=st(a,o,i.pitchedLabelPlaneMatrix,i.getElevation),u.isOccluded=!1):(u=i.transform.projectTileCoordinates(a,o,i.unwrappedTileID,i.getElevation),u.point.x=(.5*u.point.x+.5)*i.width,u.point.y=(.5*-u.point.y+.5)*i.height),u}function He(h,e,i,a){if(i.pitchWithMap){const o=[h,e,0,1];return c.av(o,o,a),i.transform.projectTileCoordinates(o[0]/o[3],o[1]/o[3],i.unwrappedTileID,i.getElevation).point}return{x:h/i.width*2-1,y:1-e/i.height*2}}function Xe(h,e,i){return i.transform.projectTileCoordinates(h,e,i.unwrappedTileID,i.getElevation)}function Ii(h,e,i){return h._unit()._perp()._mult(e*i)}function ta(h,e,i,a,o,u,f,_,y){if(_.projectionCache.offsets[h])return _.projectionCache.offsets[h];const v=i.add(e);if(h+y.direction<a||h+y.direction>=o)return _.projectionCache.offsets[h]=v,v;const w=Qr(h+y.direction,_,y),P=Ii(w.sub(i),f,y.direction),S=i.add(P),I=w.add(P);return _.projectionCache.offsets[h]=c.aw(u,v,S,I)||v,_.projectionCache.offsets[h]}function tr(h,e,i,a,o,u,f,_,y){const v=a?h-e:h+e;let w=v>0?1:-1,P=0;a&&(w*=-1,P=Math.PI),w<0&&(P+=Math.PI);let S,I=w>0?u+o:u+o+1;_.projectionCache.cachedAnchorPoint?S=_.projectionCache.cachedAnchorPoint:(S=Ie(_.tileAnchorPoint.x,_.tileAnchorPoint.y,_).point,_.projectionCache.cachedAnchorPoint=S);let k,V,O=S,N=S,$=0,q=0;const Z=Math.abs(v),Y=[];let K;for(;$+q<=Z;){if(I+=w,I<u||I>=f)return null;$+=q,N=O,V=k;const he={absOffsetX:Z,direction:w,distanceFromAnchor:$,previousVertex:N};if(O=Qr(I,_,he),i===0)Y.push(N),K=O.sub(N);else{let ae;const oe=O.sub(N);ae=oe.mag()===0?Ii(Qr(I+w,_,he).sub(O),i,w):Ii(oe,i,w),V||(V=N.add(ae)),k=ta(I,ae,O,u,f,V,i,_,he),Y.push(V),K=k.sub(V)}q=K.mag()}const G=K._mult((Z-$)/q)._add(V||N),te=P+Math.atan2(O.y-N.y,O.x-N.x);return Y.push(G),{point:G,angle:y?te:0,path:Y}}const Ye=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function ur(h,e){for(let i=0;i<h;i++){const a=e.length;e.resize(a+4),e.float32.set(Ye,3*a)}}function en(h,e,i){const a=e[0],o=e[1];return h[0]=i[0]*a+i[4]*o+i[12],h[1]=i[1]*a+i[5]*o+i[13],h[3]=i[3]*a+i[7]*o+i[15],h}const zt=100;class os{constructor(e,i=new Be(e.width+200,e.height+200,25),a=new Be(e.width+200,e.height+200,25)){this.transform=e,this.grid=i,this.ignoredGrid=a,this.pitchFactor=Math.cos(e.pitch*Math.PI/180)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+zt,this.screenBottomBoundary=e.height+zt,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,i,a,o,u,f,_,y,v,w,P,S){const I=this.projectAndGetPerspectiveRatio(e.anchorPointX+y[0],e.anchorPointY+y[1],u,w,S),k=a*I.perspectiveRatio;let V;if(f||_)V=this._projectCollisionBox(e,k,o,u,f,_,y,I,w,P,S);else{const K=I.x+(P?P.x*k:0),G=I.y+(P?P.y*k:0);V={allPointsOccluded:!1,box:[K+e.x1*k,G+e.y1*k,K+e.x2*k,G+e.y2*k]}}const[O,N,$,q]=V.box,Z=f?V.allPointsOccluded:I.isOccluded;let Y=Z;return Y||(Y=I.perspectiveRatio<this.perspectiveRatioCutoff),Y||(Y=!this.isInsideGrid(O,N,$,q)),Y||i!=="always"&&this.grid.hitTest(O,N,$,q,i,v)?{box:[O,N,$,q],placeable:!1,offscreen:!1,occluded:Z}:{box:[O,N,$,q],placeable:!0,offscreen:this.isOffscreen(O,N,$,q),occluded:Z}}placeCollisionCircles(e,i,a,o,u,f,_,y,v,w,P,S,I,k){const V=[],O=new c.P(i.anchorX,i.anchorY),N=this.getPerspectiveRatio(O.x,O.y,f,k),$=(v?u*this.transform.getPitchedTextCorrection(i.anchorX,i.anchorY,f)/N:u*N)/c.aA,q={getElevation:k,pitchedLabelPlaneMatrix:_,lineVertexArray:a,pitchWithMap:v,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:O,unwrappedTileID:f,width:this.transform.width,height:this.transform.height,translation:I},Z=Se($,o,i.lineOffsetX*$,i.lineOffsetY*$,!1,i,!1,q);let Y=!1,K=!1,G=!0;if(Z){const te=.5*P*N+S,he=new c.P(-100,-100),ae=new c.P(this.screenRightBoundary,this.screenBottomBoundary),oe=new Ve,ue=Z.first,Me=Z.last;let Pe=[];for(let We=ue.path.length-1;We>=1;We--)Pe.push(ue.path[We]);for(let We=1;We<Me.path.length;We++)Pe.push(Me.path[We]);const ve=2.5*te;if(v){const We=this.projectPathToScreenSpace(Pe,q);Pe=We.some(ot=>ot.signedDistanceFromCamera<=0)?[]:We.map(ot=>ot.point)}let ze=[];if(Pe.length>0){const We=Pe[0].clone(),ot=Pe[0].clone();for(let wt=1;wt<Pe.length;wt++)We.x=Math.min(We.x,Pe[wt].x),We.y=Math.min(We.y,Pe[wt].y),ot.x=Math.max(ot.x,Pe[wt].x),ot.y=Math.max(ot.y,Pe[wt].y);ze=We.x>=he.x&&ot.x<=ae.x&&We.y>=he.y&&ot.y<=ae.y?[Pe]:ot.x<he.x||We.x>ae.x||ot.y<he.y||We.y>ae.y?[]:c.ax([Pe],he.x,he.y,ae.x,ae.y)}for(const We of ze){oe.reset(We,.25*te);let ot=0;ot=oe.length<=.5*te?1:Math.ceil(oe.paddedLength/ve)+1;for(let wt=0;wt<ot;wt++){const ht=wt/Math.max(ot-1,1),Tt=oe.lerp(ht),dt=Tt.x+zt,ut=Tt.y+zt;V.push(dt,ut,te,0);const pt=dt-te,Qt=ut-te,nt=dt+te,Zt=ut+te;if(G=G&&this.isOffscreen(pt,Qt,nt,Zt),K=K||this.isInsideGrid(pt,Qt,nt,Zt),e!=="always"&&this.grid.hitTestCircle(dt,ut,te,e,w)&&(Y=!0,!y))return{circles:[],offscreen:!1,collisionDetected:Y}}}}return{circles:!y&&Y||!K||N<this.perspectiveRatioCutoff?[]:V,offscreen:G,collisionDetected:Y}}projectPathToScreenSpace(e,i){const a=function(o,u){const f=c.L();return c.ap(f,u.pitchedLabelPlaneMatrix),o.map(_=>{const y=st(_.x,_.y,f,u.getElevation),v=u.transform.projectTileCoordinates(y.point.x,y.point.y,u.unwrappedTileID,u.getElevation);return v.point.x=(.5*v.point.x+.5)*u.width,v.point.y=(.5*-v.point.y+.5)*u.height,v})}(e,i);return function(o){let u=0,f=0,_=0,y=0;for(let v=0;v<o.length;v++)o[v].isOccluded?(_=v+1,y=0):(y++,y>f&&(f=y,u=_));return o.slice(u,u+f)}(a)}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const i=[],a=new c.a1;for(const P of e){const S=new c.P(P.x+zt,P.y+zt);a.extend(S),i.push(S)}const{minX:o,minY:u,maxX:f,maxY:_}=a,y=this.grid.query(o,u,f,_).concat(this.ignoredGrid.query(o,u,f,_)),v={},w={};for(const P of y){const S=P.key;if(v[S.bucketInstanceId]===void 0&&(v[S.bucketInstanceId]={}),v[S.bucketInstanceId][S.featureIndex])continue;const I=[new c.P(P.x1,P.y1),new c.P(P.x2,P.y1),new c.P(P.x2,P.y2),new c.P(P.x1,P.y2)];c.ay(i,I)&&(v[S.bucketInstanceId][S.featureIndex]=!0,w[S.bucketInstanceId]===void 0&&(w[S.bucketInstanceId]=[]),w[S.bucketInstanceId].push(S.featureIndex))}return w}insertCollisionBox(e,i,a,o,u,f){(a?this.ignoredGrid:this.grid).insert({bucketInstanceId:o,featureIndex:u,collisionGroupID:f,overlapMode:i},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,i,a,o,u,f){const _=a?this.ignoredGrid:this.grid,y={bucketInstanceId:o,featureIndex:u,collisionGroupID:f,overlapMode:i};for(let v=0;v<e.length;v+=4)_.insertCircle(y,e[v],e[v+1],e[v+2])}projectAndGetPerspectiveRatio(e,i,a,o,u){if(u){let f;o?(f=[e,i,o(e,i),1],c.av(f,f,u)):(f=[e,i,0,1],en(f,f,u));const _=f[3];return{x:(f[0]/_+1)/2*this.transform.width+zt,y:(-f[1]/_+1)/2*this.transform.height+zt,perspectiveRatio:.5+this.transform.cameraToCenterDistance/_*.5,isOccluded:!1,signedDistanceFromCamera:_}}{const f=this.transform.projectTileCoordinates(e,i,a,o);return{x:(f.point.x+1)/2*this.transform.width+zt,y:(1-f.point.y)/2*this.transform.height+zt,perspectiveRatio:.5+this.transform.cameraToCenterDistance/f.signedDistanceFromCamera*.5,isOccluded:f.isOccluded,signedDistanceFromCamera:f.signedDistanceFromCamera}}}getPerspectiveRatio(e,i,a,o){const u=this.transform.projectTileCoordinates(e,i,a,o);return .5+this.transform.cameraToCenterDistance/u.signedDistanceFromCamera*.5}isOffscreen(e,i,a,o){return a<zt||e>=this.screenRightBoundary||o<zt||i>this.screenBottomBoundary}isInsideGrid(e,i,a,o){return a>=0&&e<this.gridRightBoundary&&o>=0&&i<this.gridBottomBoundary}getViewportMatrix(){const e=c.af([]);return c.M(e,e,[-100,-100,0]),e}_projectCollisionBox(e,i,a,o,u,f,_,y,v,w,P){let S=1,I=0,k=0,V=1;const O=e.anchorPointX+_[0],N=e.anchorPointY+_[1];if(f&&!u){const Pe=this.projectAndGetPerspectiveRatio(O+1,N,o,v,P),ve=Pe.x-y.x,ze=Math.atan((Pe.y-y.y)/ve)+(ve<0?Math.PI:0),We=Math.sin(ze),ot=Math.cos(ze);S=ot,I=We,k=-We,V=ot}else if(!f&&u){const Pe=lt(this.transform);S=Pe.vecEast[0],I=Pe.vecEast[1],k=Pe.vecSouth[0],V=Pe.vecSouth[1]}let $=y.x,q=y.y,Z=i;u&&($=O,q=N,Z=Math.pow(2,-(this.transform.zoom-a.overscaledZ)),Z*=this.transform.getPitchedTextCorrection(O,N,o),w||(Z*=c.ag(.5+y.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),w&&($+=S*w.x*Z+k*w.y*Z,q+=I*w.x*Z+V*w.y*Z);const Y=e.x1*Z,K=e.x2*Z,G=(Y+K)/2,te=e.y1*Z,he=e.y2*Z,ae=(te+he)/2,oe=[{offsetX:Y,offsetY:te},{offsetX:G,offsetY:te},{offsetX:K,offsetY:te},{offsetX:K,offsetY:ae},{offsetX:K,offsetY:he},{offsetX:G,offsetY:he},{offsetX:Y,offsetY:he},{offsetX:Y,offsetY:ae}];let ue=[];for(const{offsetX:Pe,offsetY:ve}of oe)ue.push(new c.P($+S*Pe+k*ve,q+I*Pe+V*ve));let Me=!1;if(u){const Pe=ue.map(ve=>this.projectAndGetPerspectiveRatio(ve.x,ve.y,o,v,P));Me=Pe.some(ve=>!ve.isOccluded),ue=Pe.map(ve=>new c.P(ve.x,ve.y))}else Me=!0;return{box:c.az(ue),allPointsOccluded:!Me}}}class ls{constructor(e,i,a,o){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?i:-i))):o&&a?1:0,this.placed=a}isHidden(){return this.opacity===0&&!this.placed}}class dr{constructor(e,i,a,o,u){this.text=new ls(e?e.text:null,i,a,u),this.icon=new ls(e?e.icon:null,i,o,u)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class cs{constructor(e,i,a){this.text=e,this.icon=i,this.skipFade=a}}class Ci{constructor(e,i,a,o,u){this.bucketInstanceId=e,this.featureIndex=i,this.sourceLayerIndex=a,this.bucketIndex=o,this.tileID=u}}class xt{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){const i=++this.maxGroupID;this.collisionGroups[e]={ID:i,predicate:a=>a.collisionGroupID===i}}return this.collisionGroups[e]}}function hl(h,e,i,a,o){const{horizontalAlign:u,verticalAlign:f}=c.aG(h);return new c.P(-(u-.5)*e+a[0]*o,-(f-.5)*i+a[1]*o)}class hs{constructor(e,i,a,o,u){this.transform=e.clone(),this.terrain=i,this.collisionIndex=new os(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=a,this.retainedQueryData={},this.collisionGroups=new xt(o),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=u,u&&(u.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){const i=this.terrain;return i?(a,o)=>i.getElevation(e,a,o):null}getBucketParts(e,i,a,o){const u=a.getBucket(i),f=a.latestFeatureIndex;if(!u||!f||i.id!==u.layerIds[0])return;const _=a.collisionBoxArray,y=u.layers[0].layout,v=u.layers[0].paint,w=Math.pow(2,this.transform.zoom-a.tileID.overscaledZ),P=a.tileSize/c.$,S=a.tileID.toUnwrapped(),I=y.get("text-rotation-alignment")==="map",k=c.aB(a,1,this.transform.zoom),V=c.aC(this.collisionIndex.transform,a,v.get("text-translate"),v.get("text-translate-anchor")),O=c.aC(this.collisionIndex.transform,a,v.get("icon-translate"),v.get("icon-translate-anchor")),N=$e(I,this.transform,k);this.retainedQueryData[u.bucketInstanceId]=new Ci(u.bucketInstanceId,f,u.sourceLayerIndex,u.index,a.tileID);const $={bucket:u,layout:y,translationText:V,translationIcon:O,unwrappedTileID:S,pitchedLabelPlaneMatrix:N,scale:w,textPixelRatio:P,holdingForFade:a.holdingForFade(),collisionBoxArray:_,partiallyEvaluatedTextSize:c.am(u.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(u.sourceID)};if(o)for(const q of u.sortKeyRanges){const{sortKey:Z,symbolInstanceStart:Y,symbolInstanceEnd:K}=q;e.push({sortKey:Z,symbolInstanceStart:Y,symbolInstanceEnd:K,parameters:$})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:u.symbolInstances.length,parameters:$})}attemptAnchorPlacement(e,i,a,o,u,f,_,y,v,w,P,S,I,k,V,O,N,$,q,Z){const Y=c.aD[e.textAnchor],K=[e.textOffset0,e.textOffset1],G=hl(Y,a,o,K,u),te=this.collisionIndex.placeCollisionBox(i,S,y,v,w,_,f,O,P.predicate,q,G,Z);if((!$||this.collisionIndex.placeCollisionBox($,S,y,v,w,_,f,N,P.predicate,q,G,Z).placeable)&&te.placeable){let he;if(this.prevPlacement&&this.prevPlacement.variableOffsets[I.crossTileID]&&this.prevPlacement.placements[I.crossTileID]&&this.prevPlacement.placements[I.crossTileID].text&&(he=this.prevPlacement.variableOffsets[I.crossTileID].anchor),I.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[I.crossTileID]={textOffset:K,width:a,height:o,anchor:Y,textBoxScale:u,prevAnchor:he},this.markUsedJustification(k,Y,I,V),k.allowVerticalPlacement&&(this.markUsedOrientation(k,V,I),this.placedOrientations[I.crossTileID]=V),{shift:G,placedGlyphBoxes:te}}}placeLayerBucketPart(e,i,a){const{bucket:o,layout:u,translationText:f,translationIcon:_,unwrappedTileID:y,pitchedLabelPlaneMatrix:v,textPixelRatio:w,holdingForFade:P,collisionBoxArray:S,partiallyEvaluatedTextSize:I,collisionGroup:k}=e.parameters,V=u.get("text-optional"),O=u.get("icon-optional"),N=c.aE(u,"text-overlap","text-allow-overlap"),$=N==="always",q=c.aE(u,"icon-overlap","icon-allow-overlap"),Z=q==="always",Y=u.get("text-rotation-alignment")==="map",K=u.get("text-pitch-alignment")==="map",G=u.get("icon-text-fit")!=="none",te=u.get("symbol-z-order")==="viewport-y",he=$&&(Z||!o.hasIconData()||O),ae=Z&&($||!o.hasTextData()||V);!o.collisionArrays&&S&&o.deserializeCollisionBoxes(S);const oe=this.retainedQueryData[o.bucketInstanceId].tileID,ue=this._getTerrainElevationFunc(oe),Me=this.transform.getFastPathSimpleProjectionMatrix(oe),Pe=(ve,ze,We)=>{var ot,wt;if(i[ve.crossTileID])return;if(P)return void(this.placements[ve.crossTileID]=new cs(!1,!1,!1));let ht=!1,Tt=!1,dt=!0,ut=null,pt={box:null,placeable:!1,offscreen:null,occluded:!1},Qt={placeable:!1},nt=null,Zt=null,ei=null,Or=0,jr=0,Vr=0;ze.textFeatureIndex?Or=ze.textFeatureIndex:ve.useRuntimeCollisionCircles&&(Or=ve.featureIndex),ze.verticalTextFeatureIndex&&(jr=ze.verticalTextFeatureIndex);const or=ze.textBox;if(or){const bi=Et=>{let mt=c.an.horizontal;if(o.allowVerticalPlacement&&!Et&&this.prevPlacement){const fi=this.prevPlacement.placedOrientations[ve.crossTileID];fi&&(this.placedOrientations[ve.crossTileID]=fi,mt=fi,this.markUsedOrientation(o,mt,ve))}return mt},qi=(Et,mt)=>{if(o.allowVerticalPlacement&&ve.numVerticalGlyphVertices>0&&ze.verticalTextBox){for(const fi of o.writingModes)if(fi===c.an.vertical?(pt=mt(),Qt=pt):pt=Et(),pt&&pt.placeable)break}else pt=Et()},Nr=ve.textAnchorOffsetStartIndex,pn=ve.textAnchorOffsetEndIndex;if(pn===Nr){const Et=(mt,fi)=>{const Ot=this.collisionIndex.placeCollisionBox(mt,N,w,oe,y,K,Y,f,k.predicate,ue,void 0,Me);return Ot&&Ot.placeable&&(this.markUsedOrientation(o,fi,ve),this.placedOrientations[ve.crossTileID]=fi),Ot};qi(()=>Et(or,c.an.horizontal),()=>{const mt=ze.verticalTextBox;return o.allowVerticalPlacement&&ve.numVerticalGlyphVertices>0&&mt?Et(mt,c.an.vertical):{box:null,offscreen:null}}),bi(pt&&pt.placeable)}else{let Et=c.aD[(wt=(ot=this.prevPlacement)===null||ot===void 0?void 0:ot.variableOffsets[ve.crossTileID])===null||wt===void 0?void 0:wt.anchor];const mt=(Ot,rc,Xc)=>{const Zo=Ot.x2-Ot.x1,Ns=Ot.y2-Ot.y1,Xn=ve.textBoxScale,gr=G&&q==="never"?rc:null;let ti=null,yr=N==="never"?1:2,Go="never";Et&&yr++;for(let Ur=0;Ur<yr;Ur++){for(let qo=Nr;qo<pn;qo++){const Wo=o.textAnchorOffsets.get(qo);if(Et&&Wo.textAnchor!==Et)continue;const Us=this.attemptAnchorPlacement(Wo,Ot,Zo,Ns,Xn,Y,K,w,oe,y,k,Go,ve,o,Xc,f,_,gr,ue);if(Us&&(ti=Us.placedGlyphBoxes,ti&&ti.placeable))return ht=!0,ut=Us.shift,ti}Et?Et=null:Go=N}return a&&!ti&&(ti={box:this.collisionIndex.placeCollisionBox(or,"always",w,oe,y,K,Y,f,k.predicate,ue,void 0,Me).box,offscreen:!1,placeable:!1,occluded:!1}),ti};qi(()=>mt(or,ze.iconBox,c.an.horizontal),()=>{const Ot=ze.verticalTextBox;return o.allowVerticalPlacement&&(!pt||!pt.placeable)&&ve.numVerticalGlyphVertices>0&&Ot?mt(Ot,ze.verticalIconBox,c.an.vertical):{box:null,occluded:!0,offscreen:null}}),pt&&(ht=pt.placeable,dt=pt.offscreen);const fi=bi(pt&&pt.placeable);if(!ht&&this.prevPlacement){const Ot=this.prevPlacement.variableOffsets[ve.crossTileID];Ot&&(this.variableOffsets[ve.crossTileID]=Ot,this.markUsedJustification(o,Ot.anchor,ve,fi))}}}if(nt=pt,ht=nt&&nt.placeable,dt=nt&&nt.offscreen,ve.useRuntimeCollisionCircles){const bi=o.text.placedSymbolArray.get(ve.centerJustifiedTextSymbolIndex),qi=c.ao(o.textSizeData,I,bi),Nr=u.get("text-padding");Zt=this.collisionIndex.placeCollisionCircles(N,bi,o.lineVertexArray,o.glyphOffsetArray,qi,y,v,a,K,k.predicate,ve.collisionCircleDiameter,Nr,f,ue),Zt.circles.length&&Zt.collisionDetected&&!a&&c.w("Collisions detected, but collision boxes are not shown"),ht=$||Zt.circles.length>0&&!Zt.collisionDetected,dt=dt&&Zt.offscreen}if(ze.iconFeatureIndex&&(Vr=ze.iconFeatureIndex),ze.iconBox){const bi=qi=>this.collisionIndex.placeCollisionBox(qi,q,w,oe,y,K,Y,_,k.predicate,ue,G&&ut?ut:void 0,Me);Qt&&Qt.placeable&&ze.verticalIconBox?(ei=bi(ze.verticalIconBox),Tt=ei.placeable):(ei=bi(ze.iconBox),Tt=ei.placeable),dt=dt&&ei.offscreen}const js=V||ve.numHorizontalGlyphVertices===0&&ve.numVerticalGlyphVertices===0,Vs=O||ve.numIconVertices===0;js||Vs?Vs?js||(Tt=Tt&&ht):ht=Tt&&ht:Tt=ht=Tt&&ht;const Hn=Tt&&ei.placeable;if(ht&&nt.placeable&&this.collisionIndex.insertCollisionBox(nt.box,N,u.get("text-ignore-placement"),o.bucketInstanceId,Qt&&Qt.placeable&&jr?jr:Or,k.ID),Hn&&this.collisionIndex.insertCollisionBox(ei.box,q,u.get("icon-ignore-placement"),o.bucketInstanceId,Vr,k.ID),Zt&&ht&&this.collisionIndex.insertCollisionCircles(Zt.circles,N,u.get("text-ignore-placement"),o.bucketInstanceId,Or,k.ID),a&&this.storeCollisionData(o.bucketInstanceId,We,ze,nt,ei,Zt),ve.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(o.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[ve.crossTileID]=new cs((ht||he)&&!nt?.occluded,(Tt||ae)&&!ei?.occluded,dt||o.justReloaded),i[ve.crossTileID]=!0};if(te){if(e.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const ve=o.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let ze=ve.length-1;ze>=0;--ze){const We=ve[ze];Pe(o.symbolInstances.get(We),o.collisionArrays[We],We)}}else for(let ve=e.symbolInstanceStart;ve<e.symbolInstanceEnd;ve++)Pe(o.symbolInstances.get(ve),o.collisionArrays[ve],ve);o.justReloaded=!1}storeCollisionData(e,i,a,o,u,f){if(a.textBox||a.iconBox){let _,y;this.collisionBoxArrays.has(e)?_=this.collisionBoxArrays.get(e):(_=new Map,this.collisionBoxArrays.set(e,_)),_.has(i)?y=_.get(i):(y={text:null,icon:null},_.set(i,y)),a.textBox&&(y.text=o.box),a.iconBox&&(y.icon=u.box)}if(f){let _=this.collisionCircleArrays[e];_===void 0&&(_=this.collisionCircleArrays[e]=[]);for(let y=0;y<f.circles.length;y+=4)_.push(f.circles[y+0]-zt),_.push(f.circles[y+1]-zt),_.push(f.circles[y+2]),_.push(f.collisionDetected?1:0)}}markUsedJustification(e,i,a,o){let u;u=o===c.an.vertical?a.verticalPlacedTextSymbolIndex:{left:a.leftJustifiedTextSymbolIndex,center:a.centerJustifiedTextSymbolIndex,right:a.rightJustifiedTextSymbolIndex}[c.aF(i)];const f=[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex,a.verticalPlacedTextSymbolIndex];for(const _ of f)_>=0&&(e.text.placedSymbolArray.get(_).crossTileID=u>=0&&_!==u?0:a.crossTileID)}markUsedOrientation(e,i,a){const o=i===c.an.horizontal||i===c.an.horizontalOnly?i:0,u=i===c.an.vertical?i:0,f=[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex];for(const _ of f)e.text.placedSymbolArray.get(_).placedOrientation=o;a.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).placedOrientation=u)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;const i=this.prevPlacement;let a=!1;this.prevZoomAdjustment=i?i.zoomAdjustment(this.transform.zoom):0;const o=i?i.symbolFadeChange(e):1,u=i?i.opacities:{},f=i?i.variableOffsets:{},_=i?i.placedOrientations:{};for(const y in this.placements){const v=this.placements[y],w=u[y];w?(this.opacities[y]=new dr(w,o,v.text,v.icon),a=a||v.text!==w.text.placed||v.icon!==w.icon.placed):(this.opacities[y]=new dr(null,o,v.text,v.icon,v.skipFade),a=a||v.text||v.icon)}for(const y in u){const v=u[y];if(!this.opacities[y]){const w=new dr(v,o,!1,!1);w.isHidden()||(this.opacities[y]=w,a=a||v.text.placed||v.icon.placed)}}for(const y in f)this.variableOffsets[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.variableOffsets[y]=f[y]);for(const y in _)this.placedOrientations[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.placedOrientations[y]=_[y]);if(i&&i.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");a?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=i?i.lastPlacementChangeTime:e)}updateLayerOpacities(e,i){const a={};for(const o of i){const u=o.getBucket(e);u&&o.latestFeatureIndex&&e.id===u.layerIds[0]&&this.updateBucketOpacities(u,o.tileID,a,o.collisionBoxArray)}}updateBucketOpacities(e,i,a,o){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();const u=e.layers[0],f=u.layout,_=new dr(null,0,!1,!1,!0),y=f.get("text-allow-overlap"),v=f.get("icon-allow-overlap"),w=u._unevaluatedLayout.hasValue("text-variable-anchor")||u._unevaluatedLayout.hasValue("text-variable-anchor-offset"),P=f.get("text-rotation-alignment")==="map",S=f.get("text-pitch-alignment")==="map",I=f.get("icon-text-fit")!=="none",k=new dr(null,0,y&&(v||!e.hasIconData()||f.get("icon-optional")),v&&(y||!e.hasTextData()||f.get("text-optional")),!0);!e.collisionArrays&&o&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(o);const V=(N,$,q)=>{for(let Z=0;Z<$/4;Z++)N.opacityVertexArray.emplaceBack(q);N.hasVisibleVertices=N.hasVisibleVertices||q!==us},O=this.collisionBoxArrays.get(e.bucketInstanceId);for(let N=0;N<e.symbolInstances.length;N++){const $=e.symbolInstances.get(N),{numHorizontalGlyphVertices:q,numVerticalGlyphVertices:Z,crossTileID:Y}=$;let K=this.opacities[Y];a[Y]?K=_:K||(K=k,this.opacities[Y]=K),a[Y]=!0;const G=$.numIconVertices>0,te=this.placedOrientations[$.crossTileID],he=te===c.an.vertical,ae=te===c.an.horizontal||te===c.an.horizontalOnly;if(q>0||Z>0){const ue=ml(K.text);V(e.text,q,he?us:ue),V(e.text,Z,ae?us:ue);const Me=K.text.isHidden();[$.rightJustifiedTextSymbolIndex,$.centerJustifiedTextSymbolIndex,$.leftJustifiedTextSymbolIndex].forEach(ze=>{ze>=0&&(e.text.placedSymbolArray.get(ze).hidden=Me||he?1:0)}),$.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get($.verticalPlacedTextSymbolIndex).hidden=Me||ae?1:0);const Pe=this.variableOffsets[$.crossTileID];Pe&&this.markUsedJustification(e,Pe.anchor,$,te);const ve=this.placedOrientations[$.crossTileID];ve&&(this.markUsedJustification(e,"left",$,ve),this.markUsedOrientation(e,ve,$))}if(G){const ue=ml(K.icon),Me=!(I&&$.verticalPlacedIconSymbolIndex&&he);$.placedIconSymbolIndex>=0&&(V(e.icon,$.numIconVertices,Me?ue:us),e.icon.placedSymbolArray.get($.placedIconSymbolIndex).hidden=K.icon.isHidden()),$.verticalPlacedIconSymbolIndex>=0&&(V(e.icon,$.numVerticalIconVertices,Me?us:ue),e.icon.placedSymbolArray.get($.verticalPlacedIconSymbolIndex).hidden=K.icon.isHidden())}const oe=O&&O.has(N)?O.get(N):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const ue=e.collisionArrays[N];if(ue){let Me=new c.P(0,0);if(ue.textBox||ue.verticalTextBox){let Pe=!0;if(w){const ve=this.variableOffsets[Y];ve?(Me=hl(ve.anchor,ve.width,ve.height,ve.textOffset,ve.textBoxScale),P&&Me._rotate(S?-this.transform.bearingInRadians:this.transform.bearingInRadians)):Pe=!1}if(ue.textBox||ue.verticalTextBox){let ve;ue.textBox&&(ve=he),ue.verticalTextBox&&(ve=ae),ia(e.textCollisionBox.collisionVertexArray,K.text.placed,!Pe||ve,oe.text,Me.x,Me.y)}}if(ue.iconBox||ue.verticalIconBox){const Pe=!!(!ae&&ue.verticalIconBox);let ve;ue.iconBox&&(ve=Pe),ue.verticalIconBox&&(ve=!Pe),ia(e.iconCollisionBox.collisionVertexArray,K.icon.placed,ve,oe.icon,I?Me.x:0,I?Me.y:0)}}}}if(e.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);e.bucketInstanceId in this.collisionCircleArrays&&(e.collisionCircleArray=this.collisionCircleArrays[e.bucketInstanceId],delete this.collisionCircleArrays[e.bucketInstanceId])}symbolFadeChange(e){return this.fadeDuration===0?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,i){const a=this.zoomAtLastRecencyCheck===i?1-this.zoomAdjustment(i):1;return this.zoomAtLastRecencyCheck=i,this.commitTime+this.fadeDuration*a>e}setStale(){this.stale=!0}}function ia(h,e,i,a,o,u){a&&a.length!==0||(a=[0,0,0,0]);const f=a[0]-zt,_=a[1]-zt,y=a[2]-zt,v=a[3]-zt;h.emplaceBack(e?1:0,i?1:0,o||0,u||0,f,_),h.emplaceBack(e?1:0,i?1:0,o||0,u||0,y,_),h.emplaceBack(e?1:0,i?1:0,o||0,u||0,y,v),h.emplaceBack(e?1:0,i?1:0,o||0,u||0,f,v)}const tn=Math.pow(2,25),zr=Math.pow(2,24),ul=Math.pow(2,17),dl=Math.pow(2,16),pl=Math.pow(2,9),wn=Math.pow(2,8),fl=Math.pow(2,1);function ml(h){if(h.opacity===0&&!h.placed)return 0;if(h.opacity===1&&h.placed)return 4294967295;const e=h.placed?1:0,i=Math.floor(127*h.opacity);return i*tn+e*zr+i*ul+e*dl+i*pl+e*wn+i*fl+e}const us=0;class Tc{constructor(e){this._sortAcrossTiles=e.layout.get("symbol-z-order")!=="viewport-y"&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,i,a,o,u){const f=this._bucketParts;for(;this._currentTileIndex<e.length;)if(i.getBucketParts(f,o,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,u())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,f.sort((_,y)=>_.sortKey-y.sortKey));this._currentPartIndex<f.length;)if(i.placeLayerBucketPart(f[this._currentPartIndex],this._seenCrossTileIDs,a),this._currentPartIndex++,u())return!0;return!1}}class _l{constructor(e,i,a,o,u,f,_,y){this.placement=new hs(e,i,f,_,y),this._currentPlacementIndex=a.length-1,this._forceFullPlacement=o,this._showCollisionBoxes=u,this._done=!1}isDone(){return this._done}continuePlacement(e,i,a){const o=Ge.now(),u=()=>!this._forceFullPlacement&&Ge.now()-o>2;for(;this._currentPlacementIndex>=0;){const f=i[e[this._currentPlacementIndex]],_=this.placement.collisionIndex.transform.zoom;if(f.type==="symbol"&&(!f.minzoom||f.minzoom<=_)&&(!f.maxzoom||f.maxzoom>_)){if(this._inProgressLayer||(this._inProgressLayer=new Tc(f)),this._inProgressLayer.continuePlacement(a[f.source],this.placement,this._showCollisionBoxes,f,u))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}const Tn=512/c.$/2;class Ja{constructor(e,i,a){this.tileID=e,this.bucketInstanceId=a,this._symbolsByKey={};const o=new Map;for(let u=0;u<i.length;u++){const f=i.get(u),_=f.key,y=o.get(_);y?y.push(f):o.set(_,[f])}for(const[u,f]of o){const _={positions:f.map(y=>({x:Math.floor(y.anchorX*Tn),y:Math.floor(y.anchorY*Tn)})),crossTileIDs:f.map(y=>y.crossTileID)};if(_.positions.length>128){const y=new c.aH(_.positions.length,16,Uint16Array);for(const{x:v,y:w}of _.positions)y.add(v,w);y.finish(),delete _.positions,_.index=y}this._symbolsByKey[u]=_}}getScaledCoordinates(e,i){const{x:a,y:o,z:u}=this.tileID.canonical,{x:f,y:_,z:y}=i.canonical,v=Tn/Math.pow(2,y-u),w=(_*c.$+e.anchorY)*v,P=o*c.$*Tn;return{x:Math.floor((f*c.$+e.anchorX)*v-a*c.$*Tn),y:Math.floor(w-P)}}findMatches(e,i,a){const o=this.tileID.canonical.z<i.canonical.z?1:Math.pow(2,this.tileID.canonical.z-i.canonical.z);for(let u=0;u<e.length;u++){const f=e.get(u);if(f.crossTileID)continue;const _=this._symbolsByKey[f.key];if(!_)continue;const y=this.getScaledCoordinates(f,i);if(_.index){const v=_.index.range(y.x-o,y.y-o,y.x+o,y.y+o).sort();for(const w of v){const P=_.crossTileIDs[w];if(!a[P]){a[P]=!0,f.crossTileID=P;break}}}else if(_.positions)for(let v=0;v<_.positions.length;v++){const w=_.positions[v],P=_.crossTileIDs[v];if(Math.abs(w.x-y.x)<=o&&Math.abs(w.y-y.y)<=o&&!a[P]){a[P]=!0,f.crossTileID=P;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:e})=>e)}}class Qa{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class gl{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){const i=Math.round((e-this.lng)/360);if(i!==0)for(const a in this.indexes){const o=this.indexes[a],u={};for(const f in o){const _=o[f];_.tileID=_.tileID.unwrapTo(_.tileID.wrap+i),u[_.tileID.key]=_}this.indexes[a]=u}this.lng=e}addBucket(e,i,a){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===i.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let u=0;u<i.symbolInstances.length;u++)i.symbolInstances.get(u).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});const o=this.usedCrossTileIDs[e.overscaledZ];for(const u in this.indexes){const f=this.indexes[u];if(Number(u)>e.overscaledZ)for(const _ in f){const y=f[_];y.tileID.isChildOf(e)&&y.findMatches(i.symbolInstances,e,o)}else{const _=f[e.scaledTo(Number(u)).key];_&&_.findMatches(i.symbolInstances,e,o)}}for(let u=0;u<i.symbolInstances.length;u++){const f=i.symbolInstances.get(u);f.crossTileID||(f.crossTileID=a.generate(),o[f.crossTileID]=!0)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new Ja(e,i.symbolInstances,i.bucketInstanceId),!0}removeBucketCrossTileIDs(e,i){for(const a of i.getCrossTileIDsLists())for(const o of a)delete this.usedCrossTileIDs[e][o]}removeStaleBuckets(e){let i=!1;for(const a in this.indexes){const o=this.indexes[a];for(const u in o)e[o[u].bucketInstanceId]||(this.removeBucketCrossTileIDs(a,o[u]),delete o[u],i=!0)}return i}}class ra{constructor(){this.layerIndexes={},this.crossTileIDs=new Qa,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,i,a){let o=this.layerIndexes[e.id];o===void 0&&(o=this.layerIndexes[e.id]=new gl);let u=!1;const f={};o.handleWrapJump(a);for(const _ of i){const y=_.getBucket(e);y&&e.id===y.layerIds[0]&&(y.bucketInstanceId||(y.bucketInstanceId=++this.maxBucketInstanceId),o.addBucket(_.tileID,y,this.crossTileIDs)&&(u=!0),f[y.bucketInstanceId]=!0)}return o.removeStaleBuckets(f)&&(u=!0),u}pruneUnusedLayers(e){const i={};e.forEach(a=>{i[a]=!0});for(const a in this.layerIndexes)i[a]||delete this.layerIndexes[a]}}var na="void main() {fragColor=vec4(1.0);}";const ir={prelude:Ke(`#ifdef GL_ES
|
|
6
|
-
precision mediump float;
|
|
7
|
-
#else
|
|
8
|
-
#if !defined(lowp)
|
|
9
|
-
#define lowp
|
|
10
|
-
#endif
|
|
11
|
-
#if !defined(mediump)
|
|
12
|
-
#define mediump
|
|
13
|
-
#endif
|
|
14
|
-
#if !defined(highp)
|
|
15
|
-
#define highp
|
|
16
|
-
#endif
|
|
17
|
-
#endif
|
|
18
|
-
out highp vec4 fragColor;`,`#ifdef GL_ES
|
|
19
|
-
precision highp float;
|
|
20
|
-
#else
|
|
21
|
-
#if !defined(lowp)
|
|
22
|
-
#define lowp
|
|
23
|
-
#endif
|
|
24
|
-
#if !defined(mediump)
|
|
25
|
-
#define mediump
|
|
26
|
-
#endif
|
|
27
|
-
#if !defined(highp)
|
|
28
|
-
#define highp
|
|
29
|
-
#endif
|
|
30
|
-
#endif
|
|
31
|
-
vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
|
|
32
|
-
);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+ c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+ c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+ c
|
|
33
|
-
);}
|
|
34
|
-
#ifdef TERRAIN3D
|
|
35
|
-
uniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;
|
|
36
|
-
#endif
|
|
37
|
-
const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {
|
|
38
|
-
#ifdef TERRAIN3D
|
|
39
|
-
highp float d=unpack(texture(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));
|
|
40
|
-
#else
|
|
41
|
-
return 1.0;
|
|
42
|
-
#endif
|
|
43
|
-
}float calculate_visibility(vec4 pos) {
|
|
44
|
-
#ifdef TERRAIN3D
|
|
45
|
-
vec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;
|
|
46
|
-
#else
|
|
47
|
-
return 1.0;
|
|
48
|
-
#endif
|
|
49
|
-
}float ele(vec2 pos) {
|
|
50
|
-
#ifdef TERRAIN3D
|
|
51
|
-
vec4 rgb=(texture(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;
|
|
52
|
-
#else
|
|
53
|
-
return 0.0;
|
|
54
|
-
#endif
|
|
55
|
-
}float get_elevation(vec2 pos) {
|
|
56
|
-
#ifdef TERRAIN3D
|
|
57
|
-
#ifdef GLOBE
|
|
58
|
-
if ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}
|
|
59
|
-
#endif
|
|
60
|
-
vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;
|
|
61
|
-
#else
|
|
62
|
-
return 0.0;
|
|
63
|
-
#endif
|
|
64
|
-
}const float PI=3.141592653589793;uniform mat4 u_projection_matrix;`),projectionMercator:Ke("","float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}"),projectionGlobe:Ke("",`#define GLOBE_RADIUS 6371008.8
|
|
65
|
-
uniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos
|
|
66
|
-
);}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float spherical_y=2.0*atan(exp(PI-(mercator_pos_y*PI*2.0)))-PI*0.5;return cos(spherical_y);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY);
|
|
67
|
-
if (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;vec2 spherical;spherical.x=mercator_pos.x*PI*2.0+PI;spherical.y=2.0*atan(exp(PI-(mercator_pos.y*PI*2.0)))-PI*0.5;float len=cos(spherical.y);vec3 pos=vec3(sin(spherical.x)*len,sin(spherical.y),cos(spherical.x)*len
|
|
68
|
-
);if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}`),background:Ke(`uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;
|
|
69
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
70
|
-
fragColor=vec4(1.0);
|
|
71
|
-
#endif
|
|
72
|
-
}`,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),backgroundPattern:Ke(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity;
|
|
73
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
74
|
-
fragColor=vec4(1.0);
|
|
75
|
-
#endif
|
|
76
|
-
}`,"uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:Ke(`in vec3 v_data;in float v_visibility;
|
|
77
|
-
#pragma mapbox: define highp vec4 color
|
|
78
|
-
#pragma mapbox: define mediump float radius
|
|
79
|
-
#pragma mapbox: define lowp float blur
|
|
80
|
-
#pragma mapbox: define lowp float opacity
|
|
81
|
-
#pragma mapbox: define highp vec4 stroke_color
|
|
82
|
-
#pragma mapbox: define mediump float stroke_width
|
|
83
|
-
#pragma mapbox: define lowp float stroke_opacity
|
|
84
|
-
void main() {
|
|
85
|
-
#pragma mapbox: initialize highp vec4 color
|
|
86
|
-
#pragma mapbox: initialize mediump float radius
|
|
87
|
-
#pragma mapbox: initialize lowp float blur
|
|
88
|
-
#pragma mapbox: initialize lowp float opacity
|
|
89
|
-
#pragma mapbox: initialize highp vec4 stroke_color
|
|
90
|
-
#pragma mapbox: initialize mediump float stroke_width
|
|
91
|
-
#pragma mapbox: initialize lowp float stroke_opacity
|
|
92
|
-
vec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;}
|
|
93
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
94
|
-
fragColor=vec4(1.0);
|
|
95
|
-
#endif
|
|
96
|
-
}`,`uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;uniform vec2 u_translate;in vec2 a_pos;out vec3 v_data;out float v_visibility;
|
|
97
|
-
#pragma mapbox: define highp vec4 color
|
|
98
|
-
#pragma mapbox: define mediump float radius
|
|
99
|
-
#pragma mapbox: define lowp float blur
|
|
100
|
-
#pragma mapbox: define lowp float opacity
|
|
101
|
-
#pragma mapbox: define highp vec4 stroke_color
|
|
102
|
-
#pragma mapbox: define mediump float stroke_width
|
|
103
|
-
#pragma mapbox: define lowp float stroke_opacity
|
|
104
|
-
void main(void) {
|
|
105
|
-
#pragma mapbox: initialize highp vec4 color
|
|
106
|
-
#pragma mapbox: initialize mediump float radius
|
|
107
|
-
#pragma mapbox: initialize lowp float blur
|
|
108
|
-
#pragma mapbox: initialize lowp float opacity
|
|
109
|
-
#pragma mapbox: initialize highp vec4 stroke_color
|
|
110
|
-
#pragma mapbox: initialize mediump float stroke_width
|
|
111
|
-
#pragma mapbox: initialize lowp float stroke_opacity
|
|
112
|
-
vec2 pos_raw=a_pos+32768.0;vec2 extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);vec2 circle_center=floor(pos_raw/8.0)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) {
|
|
113
|
-
#ifdef GLOBE
|
|
114
|
-
vec3 center_vector=projectToSphere(circle_center);
|
|
115
|
-
#endif
|
|
116
|
-
float angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else {
|
|
117
|
-
#ifdef GLOBE
|
|
118
|
-
vec4 projected_center=interpolateProjection(circle_center,center_vector,ele);
|
|
119
|
-
#else
|
|
120
|
-
vec4 projected_center=projectTileWithElevation(circle_center,ele);
|
|
121
|
-
#endif
|
|
122
|
-
corner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);}
|
|
123
|
-
#ifdef GLOBE
|
|
124
|
-
vec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);
|
|
125
|
-
#else
|
|
126
|
-
gl_Position=projectTileWithElevation(corner_position,ele);
|
|
127
|
-
#endif
|
|
128
|
-
} else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:Ke(na,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:Ke(`uniform highp float u_intensity;in vec2 v_extrude;
|
|
129
|
-
#pragma mapbox: define highp float weight
|
|
130
|
-
#define GAUSS_COEF 0.3989422804014327
|
|
131
|
-
void main() {
|
|
132
|
-
#pragma mapbox: initialize highp float weight
|
|
133
|
-
float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0);
|
|
134
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
135
|
-
fragColor=vec4(1.0);
|
|
136
|
-
#endif
|
|
137
|
-
}`,`uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;in vec2 a_pos;out vec2 v_extrude;
|
|
138
|
-
#pragma mapbox: define highp float weight
|
|
139
|
-
#pragma mapbox: define mediump float radius
|
|
140
|
-
const highp float ZERO=1.0/255.0/16.0;
|
|
141
|
-
#define GAUSS_COEF 0.3989422804014327
|
|
142
|
-
void main(void) {
|
|
143
|
-
#pragma mapbox: initialize highp float weight
|
|
144
|
-
#pragma mapbox: initialize mediump float radius
|
|
145
|
-
vec2 pos_raw=a_pos+32768.0;vec2 unscaled_extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 circle_center=floor(pos_raw/8.0);
|
|
146
|
-
#ifdef GLOBE
|
|
147
|
-
vec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0);
|
|
148
|
-
#else
|
|
149
|
-
gl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));
|
|
150
|
-
#endif
|
|
151
|
-
}`),heatmapTexture:Ke(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity;
|
|
152
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
153
|
-
fragColor=vec4(0.0);
|
|
154
|
-
#endif
|
|
155
|
-
}`,"uniform mat4 u_matrix;uniform vec2 u_world;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:Ke("in float v_placed;in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}","in vec2 a_anchor_pos;in vec2 a_placed;in vec2 a_box_real;uniform vec2 u_pixel_extrude_scale;out float v_placed;out float v_notUsed;void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:Ke("in float v_radius;in vec2 v_extrude;in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);fragColor=color*alpha*opacity_t;}","in vec2 a_pos;in float a_radius;in vec2 a_flags;uniform vec2 u_viewport_size;out float v_radius;out vec2 v_extrude;out float v_collision;void main() {float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),colorRelief:Ke(`#ifdef GL_ES
|
|
156
|
-
precision highp float;
|
|
157
|
-
#endif
|
|
158
|
-
uniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_stops;uniform sampler2D u_color_stops;uniform int u_color_ramp_size;uniform float u_opacity;in vec2 v_pos;float getElevation(vec2 coord) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}float getElevationStop(int stop) {float x=(float(stop)+0.5)/float(u_color_ramp_size);vec4 data=texture(u_elevation_stops,vec2(x,0))*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {float el=getElevation(v_pos);int r=(u_color_ramp_size-1);int l=0;float el_l=getElevationStop(l);float el_r=getElevationStop(r);while(r-l > 1){int m=(r+l)/2;float el_m=getElevationStop(m);if(el < el_m){r=m;el_r=el_m;}else
|
|
159
|
-
{l=m;el_l=el_m;}}float x=(float(l)+(el-el_l)/(el_r-el_l)+0.5)/float(u_color_ramp_size);fragColor=u_opacity*texture(u_color_stops,vec2(x,0));
|
|
160
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
161
|
-
fragColor=vec4(1.0);
|
|
162
|
-
#endif
|
|
163
|
-
}`,"uniform vec2 u_dimension;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_pos/8192.0)*scale+epsilon;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),debug:Ke("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}","in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}"),depth:Ke(na,`in vec2 a_pos;void main() {
|
|
164
|
-
#ifdef GLOBE
|
|
165
|
-
gl_Position=projectTileFor3D(a_pos,0.0);
|
|
166
|
-
#else
|
|
167
|
-
gl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);
|
|
168
|
-
#endif
|
|
169
|
-
}`),fill:Ke(`#pragma mapbox: define highp vec4 color
|
|
170
|
-
#pragma mapbox: define lowp float opacity
|
|
171
|
-
void main() {
|
|
172
|
-
#pragma mapbox: initialize highp vec4 color
|
|
173
|
-
#pragma mapbox: initialize lowp float opacity
|
|
174
|
-
fragColor=color*opacity;
|
|
175
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
176
|
-
fragColor=vec4(1.0);
|
|
177
|
-
#endif
|
|
178
|
-
}`,`uniform vec2 u_fill_translate;in vec2 a_pos;
|
|
179
|
-
#pragma mapbox: define highp vec4 color
|
|
180
|
-
#pragma mapbox: define lowp float opacity
|
|
181
|
-
void main() {
|
|
182
|
-
#pragma mapbox: initialize highp vec4 color
|
|
183
|
-
#pragma mapbox: initialize lowp float opacity
|
|
184
|
-
gl_Position=projectTile(a_pos+u_fill_translate,a_pos);}`),fillOutline:Ke(`in vec2 v_pos;
|
|
185
|
-
#ifdef GLOBE
|
|
186
|
-
in float v_depth;
|
|
187
|
-
#endif
|
|
188
|
-
#pragma mapbox: define highp vec4 outline_color
|
|
189
|
-
#pragma mapbox: define lowp float opacity
|
|
190
|
-
void main() {
|
|
191
|
-
#pragma mapbox: initialize highp vec4 outline_color
|
|
192
|
-
#pragma mapbox: initialize lowp float opacity
|
|
193
|
-
float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);
|
|
194
|
-
#ifdef GLOBE
|
|
195
|
-
if (v_depth > 1.0) {discard;}
|
|
196
|
-
#endif
|
|
197
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
198
|
-
fragColor=vec4(1.0);
|
|
199
|
-
#endif
|
|
200
|
-
}`,`uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos;
|
|
201
|
-
#ifdef GLOBE
|
|
202
|
-
out float v_depth;
|
|
203
|
-
#endif
|
|
204
|
-
#pragma mapbox: define highp vec4 outline_color
|
|
205
|
-
#pragma mapbox: define lowp float opacity
|
|
206
|
-
void main() {
|
|
207
|
-
#pragma mapbox: initialize highp vec4 outline_color
|
|
208
|
-
#pragma mapbox: initialize lowp float opacity
|
|
209
|
-
gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
|
|
210
|
-
#ifdef GLOBE
|
|
211
|
-
v_depth=gl_Position.z/gl_Position.w;
|
|
212
|
-
#endif
|
|
213
|
-
}`),fillOutlinePattern:Ke(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos;
|
|
214
|
-
#ifdef GLOBE
|
|
215
|
-
in float v_depth;
|
|
216
|
-
#endif
|
|
217
|
-
#pragma mapbox: define lowp float opacity
|
|
218
|
-
#pragma mapbox: define lowp vec4 pattern_from
|
|
219
|
-
#pragma mapbox: define lowp vec4 pattern_to
|
|
220
|
-
void main() {
|
|
221
|
-
#pragma mapbox: initialize lowp float opacity
|
|
222
|
-
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
223
|
-
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
224
|
-
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=mix(color1,color2,u_fade)*alpha*opacity;
|
|
225
|
-
#ifdef GLOBE
|
|
226
|
-
if (v_depth > 1.0) {discard;}
|
|
227
|
-
#endif
|
|
228
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
229
|
-
fragColor=vec4(1.0);
|
|
230
|
-
#endif
|
|
231
|
-
}`,`uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos;
|
|
232
|
-
#ifdef GLOBE
|
|
233
|
-
out float v_depth;
|
|
234
|
-
#endif
|
|
235
|
-
#pragma mapbox: define lowp float opacity
|
|
236
|
-
#pragma mapbox: define lowp vec4 pattern_from
|
|
237
|
-
#pragma mapbox: define lowp vec4 pattern_to
|
|
238
|
-
#pragma mapbox: define lowp float pixel_ratio_from
|
|
239
|
-
#pragma mapbox: define lowp float pixel_ratio_to
|
|
240
|
-
void main() {
|
|
241
|
-
#pragma mapbox: initialize lowp float opacity
|
|
242
|
-
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
243
|
-
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
244
|
-
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
245
|
-
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
246
|
-
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
|
|
247
|
-
#ifdef GLOBE
|
|
248
|
-
v_depth=gl_Position.z/gl_Position.w;
|
|
249
|
-
#endif
|
|
250
|
-
}`),fillPattern:Ke(`#ifdef GL_ES
|
|
251
|
-
precision highp float;
|
|
252
|
-
#endif
|
|
253
|
-
uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;
|
|
254
|
-
#pragma mapbox: define lowp float opacity
|
|
255
|
-
#pragma mapbox: define lowp vec4 pattern_from
|
|
256
|
-
#pragma mapbox: define lowp vec4 pattern_to
|
|
257
|
-
void main() {
|
|
258
|
-
#pragma mapbox: initialize lowp float opacity
|
|
259
|
-
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
260
|
-
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
261
|
-
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_fade)*opacity;
|
|
262
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
263
|
-
fragColor=vec4(1.0);
|
|
264
|
-
#endif
|
|
265
|
-
}`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;
|
|
266
|
-
#pragma mapbox: define lowp float opacity
|
|
267
|
-
#pragma mapbox: define lowp vec4 pattern_from
|
|
268
|
-
#pragma mapbox: define lowp vec4 pattern_to
|
|
269
|
-
#pragma mapbox: define lowp float pixel_ratio_from
|
|
270
|
-
#pragma mapbox: define lowp float pixel_ratio_to
|
|
271
|
-
void main() {
|
|
272
|
-
#pragma mapbox: initialize lowp float opacity
|
|
273
|
-
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
274
|
-
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
275
|
-
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
276
|
-
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
277
|
-
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:Ke(`in vec4 v_color;void main() {fragColor=v_color;
|
|
278
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
279
|
-
fragColor=vec4(1.0);
|
|
280
|
-
#endif
|
|
281
|
-
}`,`uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;in vec2 a_pos;in vec4 a_normal_ed;
|
|
282
|
-
#ifdef TERRAIN3D
|
|
283
|
-
in vec2 a_centroid;
|
|
284
|
-
#endif
|
|
285
|
-
out vec4 v_color;
|
|
286
|
-
#pragma mapbox: define highp float base
|
|
287
|
-
#pragma mapbox: define highp float height
|
|
288
|
-
#pragma mapbox: define highp vec4 color
|
|
289
|
-
void main() {
|
|
290
|
-
#pragma mapbox: initialize highp float base
|
|
291
|
-
#pragma mapbox: initialize highp float height
|
|
292
|
-
#pragma mapbox: initialize highp vec4 color
|
|
293
|
-
vec3 normal=a_normal_ed.xyz;
|
|
294
|
-
#ifdef TERRAIN3D
|
|
295
|
-
float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
|
|
296
|
-
#else
|
|
297
|
-
float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
|
|
298
|
-
#endif
|
|
299
|
-
base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;
|
|
300
|
-
#ifdef GLOBE
|
|
301
|
-
vec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
|
|
302
|
-
#else
|
|
303
|
-
gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
|
|
304
|
-
#endif
|
|
305
|
-
float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0);
|
|
306
|
-
#ifdef GLOBE
|
|
307
|
-
mat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);
|
|
308
|
-
#endif
|
|
309
|
-
directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:Ke(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting;
|
|
310
|
-
#pragma mapbox: define lowp float base
|
|
311
|
-
#pragma mapbox: define lowp float height
|
|
312
|
-
#pragma mapbox: define lowp vec4 pattern_from
|
|
313
|
-
#pragma mapbox: define lowp vec4 pattern_to
|
|
314
|
-
#pragma mapbox: define lowp float pixel_ratio_from
|
|
315
|
-
#pragma mapbox: define lowp float pixel_ratio_to
|
|
316
|
-
void main() {
|
|
317
|
-
#pragma mapbox: initialize lowp float base
|
|
318
|
-
#pragma mapbox: initialize lowp float height
|
|
319
|
-
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
320
|
-
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
321
|
-
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
322
|
-
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
323
|
-
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting;
|
|
324
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
325
|
-
fragColor=vec4(1.0);
|
|
326
|
-
#endif
|
|
327
|
-
}`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;in vec2 a_pos;in vec4 a_normal_ed;
|
|
328
|
-
#ifdef TERRAIN3D
|
|
329
|
-
in vec2 a_centroid;
|
|
330
|
-
#endif
|
|
331
|
-
#ifdef GLOBE
|
|
332
|
-
out vec3 v_sphere_pos;
|
|
333
|
-
#endif
|
|
334
|
-
out vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;
|
|
335
|
-
#pragma mapbox: define lowp float base
|
|
336
|
-
#pragma mapbox: define lowp float height
|
|
337
|
-
#pragma mapbox: define lowp vec4 pattern_from
|
|
338
|
-
#pragma mapbox: define lowp vec4 pattern_to
|
|
339
|
-
#pragma mapbox: define lowp float pixel_ratio_from
|
|
340
|
-
#pragma mapbox: define lowp float pixel_ratio_to
|
|
341
|
-
void main() {
|
|
342
|
-
#pragma mapbox: initialize lowp float base
|
|
343
|
-
#pragma mapbox: initialize lowp float height
|
|
344
|
-
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
345
|
-
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
346
|
-
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
347
|
-
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
348
|
-
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;
|
|
349
|
-
#ifdef TERRAIN3D
|
|
350
|
-
float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
|
|
351
|
-
#else
|
|
352
|
-
float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
|
|
353
|
-
#endif
|
|
354
|
-
base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;
|
|
355
|
-
#ifdef GLOBE
|
|
356
|
-
vec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
|
|
357
|
-
#else
|
|
358
|
-
gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
|
|
359
|
-
#endif
|
|
360
|
-
vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0
|
|
361
|
-
? a_pos
|
|
362
|
-
: vec2(edgedistance,elevation*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:Ke(`#ifdef GL_ES
|
|
363
|
-
precision highp float;
|
|
364
|
-
#endif
|
|
365
|
-
uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {vec2 epsilon=1.0/u_dimension;float tileSize=u_dimension.x-2.0;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))*tileSize/pow(2.0,exaggeration+(28.2562-u_zoom));fragColor=clamp(vec4(deriv.x/8.0+0.5,deriv.y/8.0+0.5,1.0,1.0),0.0,1.0);
|
|
366
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
367
|
-
fragColor=vec4(1.0);
|
|
368
|
-
#endif
|
|
369
|
-
}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:Ke(`uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES];
|
|
370
|
-
#define PI 3.141592653589793
|
|
371
|
-
#define STANDARD 0
|
|
372
|
-
#define COMBINED 1
|
|
373
|
-
#define IGOR 2
|
|
374
|
-
#define MULTIDIRECTIONAL 3
|
|
375
|
-
#define BASIC 4
|
|
376
|
-
float get_aspect(vec2 deriv){return deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);}void igor_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float aspect=get_aspect(deriv);float azimuth=u_azimuths[0]+PI;float slope_stength=atan(length(deriv))*2.0/PI;float aspect_strength=1.0-abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);float shadow_strength=slope_stength*aspect_strength;float highlight_strength=slope_stength*(1.0-aspect_strength);fragColor=u_shadows[0]*shadow_strength+u_highlights[0]*highlight_strength;}void standard_hillshade(vec2 deriv){float azimuth=u_azimuths[0]+PI;float slope=atan(0.625*length(deriv));float aspect=get_aspect(deriv);float intensity=u_exaggeration;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadows[0],u_highlights[0],shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;}void basic_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor=u_highlights[0]*(2.0*shade-1.0);}else
|
|
377
|
-
{fragColor=u_shadows[0]*(1.0-2.0*shade);}}void multidirectional_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;fragColor=vec4(0,0,0,0);for(int i=0; i < NUM_ILLUMINATION_SOURCES; i++){float cos_alt=cos(u_altitudes[i]);float sin_alt=sin(u_altitudes[i]);float cos_az=-cos(u_azimuths[i]);float sin_az=-sin(u_azimuths[i]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor+=u_highlights[i]*(2.0*shade-1.0)/float(NUM_ILLUMINATION_SOURCES);}else
|
|
378
|
-
{fragColor+=u_shadows[i]*(1.0-2.0*shade)/float(NUM_ILLUMINATION_SOURCES);}}}void combined_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=acos((sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv)));cang=clamp(cang,0.0,PI/2.0);float shade=cang*atan(length(deriv))*4.0/PI/PI;float highlight=(PI/2.0-cang)*atan(length(deriv))*4.0/PI/PI;fragColor=u_shadows[0]*shade+u_highlights[0]*highlight;}void main() {vec4 pixel=texture(u_image,v_pos);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));vec2 deriv=((pixel.rg*8.0)-4.0)/scaleFactor;if (u_method==BASIC) {basic_hillshade(deriv);} else if (u_method==COMBINED) {combined_hillshade(deriv);} else if (u_method==IGOR) {igor_hillshade(deriv);} else if (u_method==MULTIDIRECTIONAL) {multidirectional_hillshade(deriv);} else if (u_method==STANDARD) {standard_hillshade(deriv);} else {standard_hillshade(deriv);}
|
|
379
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
380
|
-
fragColor=vec4(1.0);
|
|
381
|
-
#endif
|
|
382
|
-
}`,"uniform mat4 u_matrix;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),line:Ke(`uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;
|
|
383
|
-
#ifdef GLOBE
|
|
384
|
-
in float v_depth;
|
|
385
|
-
#endif
|
|
386
|
-
#pragma mapbox: define highp vec4 color
|
|
387
|
-
#pragma mapbox: define lowp float blur
|
|
388
|
-
#pragma mapbox: define lowp float opacity
|
|
389
|
-
void main() {
|
|
390
|
-
#pragma mapbox: initialize highp vec4 color
|
|
391
|
-
#pragma mapbox: initialize lowp float blur
|
|
392
|
-
#pragma mapbox: initialize lowp float opacity
|
|
393
|
-
float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);fragColor=color*(alpha*opacity);
|
|
394
|
-
#ifdef GLOBE
|
|
395
|
-
if (v_depth > 1.0) {discard;}
|
|
396
|
-
#endif
|
|
397
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
398
|
-
fragColor=vec4(1.0);
|
|
399
|
-
#endif
|
|
400
|
-
}`,`
|
|
401
|
-
#define scale 0.015873016
|
|
402
|
-
in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar;
|
|
403
|
-
#ifdef GLOBE
|
|
404
|
-
out float v_depth;
|
|
405
|
-
#endif
|
|
406
|
-
#pragma mapbox: define highp vec4 color
|
|
407
|
-
#pragma mapbox: define lowp float blur
|
|
408
|
-
#pragma mapbox: define lowp float opacity
|
|
409
|
-
#pragma mapbox: define mediump float gapwidth
|
|
410
|
-
#pragma mapbox: define lowp float offset
|
|
411
|
-
#pragma mapbox: define mediump float width
|
|
412
|
-
void main() {
|
|
413
|
-
#pragma mapbox: initialize highp vec4 color
|
|
414
|
-
#pragma mapbox: initialize lowp float blur
|
|
415
|
-
#pragma mapbox: initialize lowp float opacity
|
|
416
|
-
#pragma mapbox: initialize mediump float gapwidth
|
|
417
|
-
#pragma mapbox: initialize lowp float offset
|
|
418
|
-
#pragma mapbox: initialize mediump float width
|
|
419
|
-
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
|
|
420
|
-
#ifdef GLOBE
|
|
421
|
-
v_depth=gl_Position.z/gl_Position.w;
|
|
422
|
-
#endif
|
|
423
|
-
#ifdef TERRAIN3D
|
|
424
|
-
v_gamma_scale=1.0;
|
|
425
|
-
#else
|
|
426
|
-
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
|
427
|
-
#endif
|
|
428
|
-
v_width2=vec2(outset,inset);}`),lineGradient:Ke(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;
|
|
429
|
-
#ifdef GLOBE
|
|
430
|
-
in float v_depth;
|
|
431
|
-
#endif
|
|
432
|
-
#pragma mapbox: define lowp float blur
|
|
433
|
-
#pragma mapbox: define lowp float opacity
|
|
434
|
-
void main() {
|
|
435
|
-
#pragma mapbox: initialize lowp float blur
|
|
436
|
-
#pragma mapbox: initialize lowp float opacity
|
|
437
|
-
float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);fragColor=color*(alpha*opacity);
|
|
438
|
-
#ifdef GLOBE
|
|
439
|
-
if (v_depth > 1.0) {discard;}
|
|
440
|
-
#endif
|
|
441
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
442
|
-
fragColor=vec4(1.0);
|
|
443
|
-
#endif
|
|
444
|
-
}`,`
|
|
445
|
-
#define scale 0.015873016
|
|
446
|
-
in vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;
|
|
447
|
-
#ifdef GLOBE
|
|
448
|
-
out float v_depth;
|
|
449
|
-
#endif
|
|
450
|
-
#pragma mapbox: define lowp float blur
|
|
451
|
-
#pragma mapbox: define lowp float opacity
|
|
452
|
-
#pragma mapbox: define mediump float gapwidth
|
|
453
|
-
#pragma mapbox: define lowp float offset
|
|
454
|
-
#pragma mapbox: define mediump float width
|
|
455
|
-
void main() {
|
|
456
|
-
#pragma mapbox: initialize lowp float blur
|
|
457
|
-
#pragma mapbox: initialize lowp float opacity
|
|
458
|
-
#pragma mapbox: initialize mediump float gapwidth
|
|
459
|
-
#pragma mapbox: initialize lowp float offset
|
|
460
|
-
#pragma mapbox: initialize mediump float width
|
|
461
|
-
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
|
|
462
|
-
#ifdef GLOBE
|
|
463
|
-
v_depth=gl_Position.z/gl_Position.w;
|
|
464
|
-
#endif
|
|
465
|
-
#ifdef TERRAIN3D
|
|
466
|
-
v_gamma_scale=1.0;
|
|
467
|
-
#else
|
|
468
|
-
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
|
469
|
-
#endif
|
|
470
|
-
v_width2=vec2(outset,inset);}`),linePattern:Ke(`#ifdef GL_ES
|
|
471
|
-
precision highp float;
|
|
472
|
-
#endif
|
|
473
|
-
uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width;
|
|
474
|
-
#ifdef GLOBE
|
|
475
|
-
in float v_depth;
|
|
476
|
-
#endif
|
|
477
|
-
#pragma mapbox: define lowp vec4 pattern_from
|
|
478
|
-
#pragma mapbox: define lowp vec4 pattern_to
|
|
479
|
-
#pragma mapbox: define lowp float pixel_ratio_from
|
|
480
|
-
#pragma mapbox: define lowp float pixel_ratio_to
|
|
481
|
-
#pragma mapbox: define lowp float blur
|
|
482
|
-
#pragma mapbox: define lowp float opacity
|
|
483
|
-
void main() {
|
|
484
|
-
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
485
|
-
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
486
|
-
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
487
|
-
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
488
|
-
#pragma mapbox: initialize lowp float blur
|
|
489
|
-
#pragma mapbox: initialize lowp float opacity
|
|
490
|
-
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity;
|
|
491
|
-
#ifdef GLOBE
|
|
492
|
-
if (v_depth > 1.0) {discard;}
|
|
493
|
-
#endif
|
|
494
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
495
|
-
fragColor=vec4(1.0);
|
|
496
|
-
#endif
|
|
497
|
-
}`,`
|
|
498
|
-
#define scale 0.015873016
|
|
499
|
-
#define LINE_DISTANCE_SCALE 2.0
|
|
500
|
-
in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;out float v_width;
|
|
501
|
-
#ifdef GLOBE
|
|
502
|
-
out float v_depth;
|
|
503
|
-
#endif
|
|
504
|
-
#pragma mapbox: define lowp float blur
|
|
505
|
-
#pragma mapbox: define lowp float opacity
|
|
506
|
-
#pragma mapbox: define lowp float offset
|
|
507
|
-
#pragma mapbox: define mediump float gapwidth
|
|
508
|
-
#pragma mapbox: define mediump float width
|
|
509
|
-
#pragma mapbox: define lowp float floorwidth
|
|
510
|
-
#pragma mapbox: define lowp vec4 pattern_from
|
|
511
|
-
#pragma mapbox: define lowp vec4 pattern_to
|
|
512
|
-
#pragma mapbox: define lowp float pixel_ratio_from
|
|
513
|
-
#pragma mapbox: define lowp float pixel_ratio_to
|
|
514
|
-
void main() {
|
|
515
|
-
#pragma mapbox: initialize lowp float blur
|
|
516
|
-
#pragma mapbox: initialize lowp float opacity
|
|
517
|
-
#pragma mapbox: initialize lowp float offset
|
|
518
|
-
#pragma mapbox: initialize mediump float gapwidth
|
|
519
|
-
#pragma mapbox: initialize mediump float width
|
|
520
|
-
#pragma mapbox: initialize lowp float floorwidth
|
|
521
|
-
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
522
|
-
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
523
|
-
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
524
|
-
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
525
|
-
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
|
|
526
|
-
#ifdef GLOBE
|
|
527
|
-
v_depth=gl_Position.z/gl_Position.w;
|
|
528
|
-
#endif
|
|
529
|
-
#ifdef TERRAIN3D
|
|
530
|
-
v_gamma_scale=1.0;
|
|
531
|
-
#else
|
|
532
|
-
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
|
533
|
-
#endif
|
|
534
|
-
v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:Ke(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;
|
|
535
|
-
#ifdef GLOBE
|
|
536
|
-
in float v_depth;
|
|
537
|
-
#endif
|
|
538
|
-
#pragma mapbox: define highp vec4 color
|
|
539
|
-
#pragma mapbox: define lowp float blur
|
|
540
|
-
#pragma mapbox: define lowp float opacity
|
|
541
|
-
#pragma mapbox: define mediump float width
|
|
542
|
-
#pragma mapbox: define lowp float floorwidth
|
|
543
|
-
void main() {
|
|
544
|
-
#pragma mapbox: initialize highp vec4 color
|
|
545
|
-
#pragma mapbox: initialize lowp float blur
|
|
546
|
-
#pragma mapbox: initialize lowp float opacity
|
|
547
|
-
#pragma mapbox: initialize mediump float width
|
|
548
|
-
#pragma mapbox: initialize lowp float floorwidth
|
|
549
|
-
float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture(u_image,v_tex_a).a;float sdfdist_b=texture(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity);
|
|
550
|
-
#ifdef GLOBE
|
|
551
|
-
if (v_depth > 1.0) {discard;}
|
|
552
|
-
#endif
|
|
553
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
554
|
-
fragColor=vec4(1.0);
|
|
555
|
-
#endif
|
|
556
|
-
}`,`
|
|
557
|
-
#define scale 0.015873016
|
|
558
|
-
#define LINE_DISTANCE_SCALE 2.0
|
|
559
|
-
in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;
|
|
560
|
-
#ifdef GLOBE
|
|
561
|
-
out float v_depth;
|
|
562
|
-
#endif
|
|
563
|
-
#pragma mapbox: define highp vec4 color
|
|
564
|
-
#pragma mapbox: define lowp float blur
|
|
565
|
-
#pragma mapbox: define lowp float opacity
|
|
566
|
-
#pragma mapbox: define mediump float gapwidth
|
|
567
|
-
#pragma mapbox: define lowp float offset
|
|
568
|
-
#pragma mapbox: define mediump float width
|
|
569
|
-
#pragma mapbox: define lowp float floorwidth
|
|
570
|
-
void main() {
|
|
571
|
-
#pragma mapbox: initialize highp vec4 color
|
|
572
|
-
#pragma mapbox: initialize lowp float blur
|
|
573
|
-
#pragma mapbox: initialize lowp float opacity
|
|
574
|
-
#pragma mapbox: initialize mediump float gapwidth
|
|
575
|
-
#pragma mapbox: initialize lowp float offset
|
|
576
|
-
#pragma mapbox: initialize mediump float width
|
|
577
|
-
#pragma mapbox: initialize lowp float floorwidth
|
|
578
|
-
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
|
|
579
|
-
#ifdef GLOBE
|
|
580
|
-
v_depth=gl_Position.z/gl_Position.w;
|
|
581
|
-
#endif
|
|
582
|
-
#ifdef TERRAIN3D
|
|
583
|
-
v_gamma_scale=1.0;
|
|
584
|
-
#else
|
|
585
|
-
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
|
586
|
-
#endif
|
|
587
|
-
v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),raster:Ke(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec2 v_pos0;in vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture(u_image0,v_pos0);vec4 color1=texture(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);
|
|
588
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
589
|
-
fragColor=vec4(1.0);
|
|
590
|
-
#endif
|
|
591
|
-
}`,`uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;in vec2 a_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 position=mix(mix(u_coords_top.xy,u_coords_top.zw,fractionalPos.x),mix(u_coords_bottom.xy,u_coords_bottom.zw,fractionalPos.x),fractionalPos.y);gl_Position=projectTile(position,position);v_pos0=((fractionalPos-0.5)/u_buffer_scale)+0.5;
|
|
592
|
-
#ifdef GLOBE
|
|
593
|
-
if (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;}
|
|
594
|
-
#endif
|
|
595
|
-
v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),symbolIcon:Ke(`uniform sampler2D u_texture;in vec2 v_tex;in float v_fade_opacity;
|
|
596
|
-
#pragma mapbox: define lowp float opacity
|
|
597
|
-
void main() {
|
|
598
|
-
#pragma mapbox: initialize lowp float opacity
|
|
599
|
-
lowp float alpha=opacity*v_fade_opacity;fragColor=texture(u_texture,v_tex)*alpha;
|
|
600
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
601
|
-
fragColor=vec4(1.0);
|
|
602
|
-
#endif
|
|
603
|
-
}`,`in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_tex;out float v_fade_opacity;
|
|
604
|
-
#pragma mapbox: define lowp float opacity
|
|
605
|
-
void main() {
|
|
606
|
-
#pragma mapbox: initialize lowp float opacity
|
|
607
|
-
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|
608
|
-
camera_to_anchor_distance/u_camera_to_center_distance :
|
|
609
|
-
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;
|
|
610
|
-
#ifdef GLOBE
|
|
611
|
-
if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
|
|
612
|
-
#endif
|
|
613
|
-
vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:Ke(`#define SDF_PX 8.0
|
|
614
|
-
uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;in vec2 v_data0;in vec3 v_data1;
|
|
615
|
-
#pragma mapbox: define highp vec4 fill_color
|
|
616
|
-
#pragma mapbox: define highp vec4 halo_color
|
|
617
|
-
#pragma mapbox: define lowp float opacity
|
|
618
|
-
#pragma mapbox: define lowp float halo_width
|
|
619
|
-
#pragma mapbox: define lowp float halo_blur
|
|
620
|
-
void main() {
|
|
621
|
-
#pragma mapbox: initialize highp vec4 fill_color
|
|
622
|
-
#pragma mapbox: initialize highp vec4 halo_color
|
|
623
|
-
#pragma mapbox: initialize lowp float opacity
|
|
624
|
-
#pragma mapbox: initialize lowp float halo_width
|
|
625
|
-
#pragma mapbox: initialize lowp float halo_blur
|
|
626
|
-
float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}fragColor=color*(alpha*opacity*fade_opacity);
|
|
627
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
628
|
-
fragColor=vec4(1.0);
|
|
629
|
-
#endif
|
|
630
|
-
}`,`in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_data0;out vec3 v_data1;
|
|
631
|
-
#pragma mapbox: define highp vec4 fill_color
|
|
632
|
-
#pragma mapbox: define highp vec4 halo_color
|
|
633
|
-
#pragma mapbox: define lowp float opacity
|
|
634
|
-
#pragma mapbox: define lowp float halo_width
|
|
635
|
-
#pragma mapbox: define lowp float halo_blur
|
|
636
|
-
void main() {
|
|
637
|
-
#pragma mapbox: initialize highp vec4 fill_color
|
|
638
|
-
#pragma mapbox: initialize highp vec4 halo_color
|
|
639
|
-
#pragma mapbox: initialize lowp float opacity
|
|
640
|
-
#pragma mapbox: initialize lowp float halo_width
|
|
641
|
-
#pragma mapbox: initialize lowp float halo_blur
|
|
642
|
-
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|
643
|
-
camera_to_anchor_distance/u_camera_to_center_distance :
|
|
644
|
-
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;
|
|
645
|
-
#ifdef GLOBE
|
|
646
|
-
if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
|
|
647
|
-
#endif
|
|
648
|
-
vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:Ke(`#define SDF_PX 8.0
|
|
649
|
-
#define SDF 1.0
|
|
650
|
-
#define ICON 0.0
|
|
651
|
-
uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;in vec4 v_data0;in vec4 v_data1;
|
|
652
|
-
#pragma mapbox: define highp vec4 fill_color
|
|
653
|
-
#pragma mapbox: define highp vec4 halo_color
|
|
654
|
-
#pragma mapbox: define lowp float opacity
|
|
655
|
-
#pragma mapbox: define lowp float halo_width
|
|
656
|
-
#pragma mapbox: define lowp float halo_blur
|
|
657
|
-
void main() {
|
|
658
|
-
#pragma mapbox: initialize highp vec4 fill_color
|
|
659
|
-
#pragma mapbox: initialize highp vec4 halo_color
|
|
660
|
-
#pragma mapbox: initialize lowp float opacity
|
|
661
|
-
#pragma mapbox: initialize lowp float halo_width
|
|
662
|
-
#pragma mapbox: initialize lowp float halo_blur
|
|
663
|
-
float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;fragColor=texture(u_texture_icon,tex_icon)*alpha;
|
|
664
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
665
|
-
fragColor=vec4(1.0);
|
|
666
|
-
#endif
|
|
667
|
-
return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);fragColor=color*(alpha*opacity*fade_opacity);
|
|
668
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
669
|
-
fragColor=vec4(1.0);
|
|
670
|
-
#endif
|
|
671
|
-
}`,`in vec4 a_pos_offset;in vec4 a_data;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec4 v_data0;out vec4 v_data1;
|
|
672
|
-
#pragma mapbox: define highp vec4 fill_color
|
|
673
|
-
#pragma mapbox: define highp vec4 halo_color
|
|
674
|
-
#pragma mapbox: define lowp float opacity
|
|
675
|
-
#pragma mapbox: define lowp float halo_width
|
|
676
|
-
#pragma mapbox: define lowp float halo_blur
|
|
677
|
-
void main() {
|
|
678
|
-
#pragma mapbox: initialize highp vec4 fill_color
|
|
679
|
-
#pragma mapbox: initialize highp vec4 halo_color
|
|
680
|
-
#pragma mapbox: initialize lowp float opacity
|
|
681
|
-
#pragma mapbox: initialize lowp float halo_width
|
|
682
|
-
#pragma mapbox: initialize lowp float halo_blur
|
|
683
|
-
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|
684
|
-
camera_to_anchor_distance/u_camera_to_center_distance :
|
|
685
|
-
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;
|
|
686
|
-
#ifdef GLOBE
|
|
687
|
-
if(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
|
|
688
|
-
#endif
|
|
689
|
-
vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:Ke("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}","in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:Ke("in float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {fragColor=pack(v_depth);}","in vec3 a_pos3d;uniform float u_ele_delta;out float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:Ke("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;in vec2 v_texture_pos;void main() {vec4 rgba=texture(u_texture,v_texture_pos);fragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","in vec3 a_pos3d;uniform float u_ele_delta;out vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);}"),projectionErrorMeasurement:Ke("in vec4 v_output_error_encoded;void main() {fragColor=v_output_error_encoded;}","in vec2 a_pos;uniform highp float u_input;uniform highp float u_output_expected;out vec4 v_output_error_encoded;void main() {float real_output=2.0*atan(exp(PI-(u_input*PI*2.0)))-PI*0.5;float error=real_output-u_output_expected;float abs_error=abs(error)*128.0;v_output_error_encoded.x=min(floor(abs_error*256.0),255.0)/255.0;abs_error-=v_output_error_encoded.x;v_output_error_encoded.y=min(floor(abs_error*65536.0),255.0)/255.0;abs_error-=v_output_error_encoded.x/255.0;v_output_error_encoded.z=min(floor(abs_error*16777216.0),255.0)/255.0;v_output_error_encoded.w=error >=0.0 ? 1.0 : 0.0;gl_Position=vec4(a_pos,0.0,1.0);}"),atmosphere:Ke(`in vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758
|
|
690
|
-
);color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}`,"in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}"),sky:Ke("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor=mix(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}","in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};function Ke(h,e){const i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,a=e.match(/in ([\w]+) ([\w]+)/g),o=h.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),u=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),f=u?u.concat(o):o,_={};return{fragmentSource:h=h.replace(i,(y,v,w,P,S)=>(_[S]=!0,v==="define"?`
|
|
691
|
-
#ifndef HAS_UNIFORM_u_${S}
|
|
692
|
-
in ${w} ${P} ${S};
|
|
693
|
-
#else
|
|
694
|
-
uniform ${w} ${P} u_${S};
|
|
695
|
-
#endif
|
|
696
|
-
`:`
|
|
697
|
-
#ifdef HAS_UNIFORM_u_${S}
|
|
698
|
-
${w} ${P} ${S} = u_${S};
|
|
699
|
-
#endif
|
|
700
|
-
`)),vertexSource:e=e.replace(i,(y,v,w,P,S)=>{const I=P==="float"?"vec2":"vec4",k=S.match(/color/)?"color":I;return _[S]?v==="define"?`
|
|
701
|
-
#ifndef HAS_UNIFORM_u_${S}
|
|
702
|
-
uniform lowp float u_${S}_t;
|
|
703
|
-
in ${w} ${I} a_${S};
|
|
704
|
-
out ${w} ${P} ${S};
|
|
705
|
-
#else
|
|
706
|
-
uniform ${w} ${P} u_${S};
|
|
707
|
-
#endif
|
|
708
|
-
`:k==="vec4"?`
|
|
709
|
-
#ifndef HAS_UNIFORM_u_${S}
|
|
710
|
-
${S} = a_${S};
|
|
711
|
-
#else
|
|
712
|
-
${w} ${P} ${S} = u_${S};
|
|
713
|
-
#endif
|
|
714
|
-
`:`
|
|
715
|
-
#ifndef HAS_UNIFORM_u_${S}
|
|
716
|
-
${S} = unpack_mix_${k}(a_${S}, u_${S}_t);
|
|
717
|
-
#else
|
|
718
|
-
${w} ${P} ${S} = u_${S};
|
|
719
|
-
#endif
|
|
720
|
-
`:v==="define"?`
|
|
721
|
-
#ifndef HAS_UNIFORM_u_${S}
|
|
722
|
-
uniform lowp float u_${S}_t;
|
|
723
|
-
in ${w} ${I} a_${S};
|
|
724
|
-
#else
|
|
725
|
-
uniform ${w} ${P} u_${S};
|
|
726
|
-
#endif
|
|
727
|
-
`:k==="vec4"?`
|
|
728
|
-
#ifndef HAS_UNIFORM_u_${S}
|
|
729
|
-
${w} ${P} ${S} = a_${S};
|
|
730
|
-
#else
|
|
731
|
-
${w} ${P} ${S} = u_${S};
|
|
732
|
-
#endif
|
|
733
|
-
`:`
|
|
734
|
-
#ifndef HAS_UNIFORM_u_${S}
|
|
735
|
-
${w} ${P} ${S} = unpack_mix_${k}(a_${S}, u_${S}_t);
|
|
736
|
-
#else
|
|
737
|
-
${w} ${P} ${S} = u_${S};
|
|
738
|
-
#endif
|
|
739
|
-
`}),staticAttributes:a,staticUniforms:f}}class pr{constructor(e,i,a){this.vertexBuffer=e,this.indexBuffer=i,this.segments=a}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}var fr=c.aI([{name:"a_pos",type:"Int16",components:2}]);const rn="#define PROJECTION_MERCATOR",eo="mercator";class to{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return eo}get shaderDefine(){return rn}get shaderPreludeCode(){return ir.projectionMercator}get vertexShaderPreludeCode(){return ir.projectionMercator.vertexSource}get subdivisionGranularity(){return c.aJ.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(e){}getMeshFromTileID(e,i,a,o,u){if(this._cachedMesh)return this._cachedMesh;const f=new c.aK;f.emplaceBack(0,0),f.emplaceBack(c.$,0),f.emplaceBack(0,c.$),f.emplaceBack(c.$,c.$);const _=e.createVertexBuffer(f,fr.members),y=c.aL.simpleSegment(0,0,4,2),v=new c.aM;v.emplaceBack(1,0,2),v.emplaceBack(1,2,3);const w=e.createIndexBuffer(v);return this._cachedMesh=new pr(_,w,y),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(e){}}class Fi{constructor(e=0,i=0,a=0,o=0){if(isNaN(e)||e<0||isNaN(i)||i<0||isNaN(a)||a<0||isNaN(o)||o<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=i,this.left=a,this.right=o}interpolate(e,i,a){return i.top!=null&&e.top!=null&&(this.top=c.C.number(e.top,i.top,a)),i.bottom!=null&&e.bottom!=null&&(this.bottom=c.C.number(e.bottom,i.bottom,a)),i.left!=null&&e.left!=null&&(this.left=c.C.number(e.left,i.left,a)),i.right!=null&&e.right!=null&&(this.right=c.C.number(e.right,i.right,a)),this}getCenter(e,i){const a=c.ag((this.left+e-this.right)/2,0,e),o=c.ag((this.top+i-this.bottom)/2,0,i);return new c.P(a,o)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new Fi(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function mr(h,e){if(!h.renderWorldCopies||h.lngRange)return;const i=e.lng-h.center.lng;e.lng+=i>180?-360:i<-180?360:0}function Je(h){return Math.max(0,Math.floor(h))}class ds{constructor(e,i,a,o,u,f){this._callbacks=e,this._tileSize=512,this._renderWorldCopies=f===void 0||!!f,this._minZoom=i||0,this._maxZoom=a||22,this._minPitch=o??0,this._maxPitch=u??60,this.setMaxBounds(),this._width=0,this._height=0,this._center=new c.S(0,0),this._elevation=0,this._zoom=0,this._tileZoom=Je(this._zoom),this._scale=c.ae(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new Fi,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(e,i,a){this._latRange=e.latRange,this._lngRange=e.lngRange,this._width=e.width,this._height=e.height,this._center=e.center,this._elevation=e.elevation,this._minElevationForCurrentTile=e.minElevationForCurrentTile,this._zoom=e.zoom,this._tileZoom=Je(this._zoom),this._scale=c.ae(this._zoom),this._bearingInRadians=e.bearingInRadians,this._fovInRadians=e.fovInRadians,this._pitchInRadians=e.pitchInRadians,this._rollInRadians=e.rollInRadians,this._unmodified=e.unmodified,this._edgeInsets=new Fi(e.padding.top,e.padding.bottom,e.padding.left,e.padding.right),this._minZoom=e.minZoom,this._maxZoom=e.maxZoom,this._minPitch=e.minPitch,this._maxPitch=e.maxPitch,this._renderWorldCopies=e.renderWorldCopies,this._cameraToCenterDistance=e.cameraToCenterDistance,this._nearZ=e.nearZ,this._farZ=e.farZ,this._autoCalculateNearFarZ=!a&&e.autoCalculateNearFarZ,i&&this._constrain(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(e){this._minElevationForCurrentTile=e}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(e){this._minZoom!==e&&(this._minZoom=e,this.setZoom(this.getConstrained(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.setZoom(this.getConstrained(this._center,this.zoom).zoom))}get minPitch(){return this._minPitch}setMinPitch(e){this._minPitch!==e&&(this._minPitch=e,this.setPitch(Math.max(this.pitch,e)))}get maxPitch(){return this._maxPitch}setMaxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.setPitch(Math.min(this.pitch,e)))}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(e){e===void 0?e=!0:e===null&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new c.P(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(e){const i=c.aN(e,-180,180)*Math.PI/180;var a,o,u,f,_,y,v,w,P;this._bearingInRadians!==i&&(this._unmodified=!1,this._bearingInRadians=i,this._calcMatrices(),this._rotationMatrix=Tr(),a=this._rotationMatrix,u=-this._bearingInRadians,f=(o=this._rotationMatrix)[0],_=o[1],y=o[2],v=o[3],w=Math.sin(u),P=Math.cos(u),a[0]=f*P+y*w,a[1]=_*P+v*w,a[2]=f*-w+y*P,a[3]=_*-w+v*P)}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(e){const i=c.ag(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==i&&(this._unmodified=!1,this._pitchInRadians=i,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(e){const i=e/180*Math.PI;this._rollInRadians!==i&&(this._unmodified=!1,this._rollInRadians=i,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return c.aO(this._fovInRadians)}setFov(e){e=c.ag(e,.1,150),this.fov!==e&&(this._unmodified=!1,this._fovInRadians=c.ad(e),this._calcMatrices())}get zoom(){return this._zoom}setZoom(e){const i=this.getConstrained(this._center,e).zoom;this._zoom!==i&&(this._unmodified=!1,this._zoom=i,this._tileZoom=Math.max(0,Math.floor(i)),this._scale=c.ae(i),this._constrain(),this._calcMatrices())}get center(){return this._center}setCenter(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(e){e!==this._elevation&&(this._elevation=e,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this._width,this._height)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(e,i){this._autoCalculateNearFarZ=!1,this._nearZ=e,this._farZ=i,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,i,a){this._unmodified=!1,this._edgeInsets.interpolate(e,i,a),this._constrain(),this._calcMatrices()}resize(e,i,a=!0){this._width=e,this._height=i,a&&this._constrain(),this._calcMatrices()}getMaxBounds(){return this._latRange&&this._latRange.length===2&&this._lngRange&&this._lngRange.length===2?new Mt([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]]):null}setMaxBounds(e){e?(this._lngRange=[e.getWest(),e.getEast()],this._latRange=[e.getSouth(),e.getNorth()],this._constrain()):(this._lngRange=null,this._latRange=[-c.ah,c.ah])}getConstrained(e,i){return this._callbacks.getConstrained(e,i)}getCameraQueryGeometry(e,i){if(i.length===1)return[i[0],e];{const{minX:a,minY:o,maxX:u,maxY:f}=c.a1.fromPoints(i).extend(e);return[new c.P(a,o),new c.P(u,o),new c.P(u,f),new c.P(a,f),new c.P(a,o)]}}_constrain(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;const e=this._unmodified,{center:i,zoom:a}=this.getConstrained(this.center,this.zoom);this.setCenter(i),this.setZoom(a),this._unmodified=e,this._constraining=!1}_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let e=c.af(new Float64Array(16));c.N(e,e,[this._width/2,-this._height/2,1]),c.M(e,e,[1,-1,0]),this._clipSpaceToPixelsMatrix=e,e=c.af(new Float64Array(16)),c.N(e,e,[1,-1,1]),c.M(e,e,[-1,-1,0]),c.N(e,e,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=e,this._cameraToCenterDistance=.5/Math.tan(this.fovInRadians/2)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(e,i,a,o){const u=a!==void 0?a:this.bearing,f=o=o!==void 0?o:this.pitch,_=c.a0.fromLngLat(e,i),y=-Math.cos(c.ad(f)),v=Math.sin(c.ad(f)),w=v*Math.sin(c.ad(u)),P=-v*Math.cos(c.ad(u));let S=this.elevation;const I=i-S;let k;y*I>=0||Math.abs(y)<.1?(k=1e4,S=i+k*y):k=-I/y;let V,O,N=c.aP(1,_.y),$=0;do{if($+=1,$>10)break;O=k/N,V=new c.a0(_.x+w*O,_.y+P*O),N=1/V.meterInMercatorCoordinateUnits()}while(Math.abs(k-O*N)>1e-12);return{center:V.toLngLat(),elevation:S,zoom:c.aj(this.height/2/Math.tan(this.fovInRadians/2)/O/this.tileSize)}}recalculateZoomAndCenter(e){if(this.elevation-e==0)return;const i=c.ai(1,this.center.lat)*this.worldSize,a=this.cameraToCenterDistance/i,o=c.a0.fromLngLat(this.center,this.elevation),u=H(this.center,this.elevation,this.pitch,this.bearing,a);this._elevation=e;const f=this.calculateCenterFromCameraLngLatAlt(u.toLngLat(),c.aP(u.z,o.y),this.bearing,this.pitch);this._elevation=f.elevation,this._center=f.center,this.setZoom(f.zoom)}getCameraPoint(){const e=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new c.P(e*Math.sin(this.rollInRadians),e*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){const e=c.ai(1,this.center.lat)*this.worldSize;return H(this.center,this.elevation,this.pitch,this.bearing,this.cameraToCenterDistance/e).toLngLat()}getMercatorTileCoordinates(e){if(!e)return[0,0,1,1];const i=e.canonical.z>=0?1<<e.canonical.z:Math.pow(2,e.canonical.z);return[e.canonical.x/i,e.canonical.y/i,1/i/c.$,1/i/c.$]}}class sa{constructor(e,i){this.min=e,this.max=i,this.center=c.aQ([],c.aR([],this.min,this.max),.5)}quadrant(e){const i=[e%2==0,e<2],a=c.aS(this.min),o=c.aS(this.max);for(let u=0;u<i.length;u++)a[u]=i[u]?this.min[u]:this.center[u],o[u]=i[u]?this.center[u]:this.max[u];return o[2]=this.max[2],new sa(a,o)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}intersectsFrustum(e){let i=!0;for(let a=0;a<e.planes.length;a++){const o=this.intersectsPlane(e.planes[a]);if(o===0)return 0;o===1&&(i=!1)}return i?2:e.aabb.min[0]>this.max[0]||e.aabb.min[1]>this.max[1]||e.aabb.min[2]>this.max[2]||e.aabb.max[0]<this.min[0]||e.aabb.max[1]<this.min[1]||e.aabb.max[2]<this.min[2]?0:1}intersectsPlane(e){let i=e[3],a=e[3];for(let o=0;o<3;o++)e[o]>0?(i+=e[o]*this.min[o],a+=e[o]*this.max[o]):(a+=e[o]*this.min[o],i+=e[o]*this.max[o]);return i>=0?2:a<0?0:1}}class io{distanceToTile2d(e,i,a,o){const u=o.distanceX([e,i]),f=o.distanceY([e,i]);return Math.hypot(u,f)}getWrap(e,i,a){return a}getTileBoundingVolume(e,i,a,o){var u,f;let _=a,y=a;if(o?.terrain){const w=new c.Z(e.z,i,e.z,e.x,e.y),P=o.terrain.getMinMaxElevation(w);_=(u=P.minElevation)!==null&&u!==void 0?u:a,y=(f=P.maxElevation)!==null&&f!==void 0?f:a}const v=1<<e.z;return new sa([i+e.x/v,e.y/v,_],[i+(e.x+1)/v,(e.y+1)/v,y])}allowVariableZoom(e,i){const a=e.fov*(Math.abs(Math.cos(e.rollInRadians))*e.height+Math.abs(Math.sin(e.rollInRadians))*e.width)/e.height,o=c.ag(78.5-a/2,0,60);return!!i.terrain||e.pitch>o}allowWorldCopies(){return!0}prepareNextFrame(){}}class si{constructor(e,i,a){this.points=e,this.planes=i,this.aabb=a}static fromInvProjectionMatrix(e,i=1,a=0,o,u){const f=u?[[6,5,4],[0,1,2],[0,3,7],[2,1,5],[3,2,6],[0,4,5]]:[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]],_=Math.pow(2,a),y=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(S=>function(I,k,V,O){const N=c.av([],I,k),$=1/N[3]/V*O;return c.aX(N,N,[$,$,1/N[3],$])}(S,e,i,_));o&&function(S,I,k,V){const O=V?4:0,N=V?0:4;let $=0;const q=[],Z=[];for(let G=0;G<4;G++){const te=c.aT([],S[G+N],S[G+O]),he=c.aY(te);c.aQ(te,te,1/he),q.push(he),Z.push(te)}for(let G=0;G<4;G++){const te=c.aZ(S[G+O],Z[G],k);$=te!==null&&te>=0?Math.max($,te):Math.max($,q[G])}const Y=function(G,te){const he=c.aT([],G[te[0]],G[te[1]]),ae=c.aT([],G[te[2]],G[te[1]]),oe=[0,0,0,0];return c.aU(oe,c.aV([],he,ae)),oe[3]=-c.aW(oe,G[te[0]]),oe}(S,I),K=function(G,te){const he=c.a_(G),ae=c.a$([],G,1/he),oe=c.aT([],te,c.aQ([],ae,c.aW(te,ae))),ue=c.a_(oe);if(ue>0){const Me=Math.sqrt(1-ae[3]*ae[3]),Pe=c.aQ([],ae,-ae[3]),ve=c.aR([],Pe,c.aQ([],oe,Me/ue));return c.b0(te,ve)}return null}(k,Y);if(K!==null){const G=K/c.aW(Z[0],Y);$=Math.min($,G)}for(let G=0;G<4;G++){const te=Math.min($,q[G]);S[G+N]=[S[G+O][0]+Z[G][0]*te,S[G+O][1]+Z[G][1]*te,S[G+O][2]+Z[G][2]*te,1]}}(y,f[0],o,u);const v=f.map(S=>{const I=c.aT([],y[S[0]],y[S[1]]),k=c.aT([],y[S[2]],y[S[1]]),V=c.aU([],c.aV([],I,k)),O=-c.aW(V,y[S[1]]);return V.concat(O)}),w=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],P=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(const S of y)for(let I=0;I<3;I++)w[I]=Math.min(w[I],S[I]),P[I]=Math.max(P[I],S[I]);return new si(y,v,new sa(w,P))}}class Rt{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,i,a){return this._helper.interpolatePadding(e,i,a)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,i,a=!0){this._helper.resize(e,i,a)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}overrideNearFarZ(e,i){this._helper.overrideNearFarZ(e,i)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e,i){}constructor(e,i,a,o,u){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this._helper=new ds({calcMatrices:()=>{this._calcMatrices()},getConstrained:(f,_)=>this.getConstrained(f,_)},e,i,a,o,u),this._coveringTilesDetailsProvider=new io}clone(){const e=new Rt;return e.apply(this),e}apply(e,i,a){this._helper.apply(e,i,a)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(e){const i=[new c.b1(0,e)];if(this._helper._renderWorldCopies){const a=this.screenPointToMercatorCoordinate(new c.P(0,0)),o=this.screenPointToMercatorCoordinate(new c.P(this._helper._width,0)),u=this.screenPointToMercatorCoordinate(new c.P(this._helper._width,this._helper._height)),f=this.screenPointToMercatorCoordinate(new c.P(0,this._helper._height)),_=Math.floor(Math.min(a.x,o.x,u.x,f.x)),y=Math.floor(Math.max(a.x,o.x,u.x,f.x)),v=1;for(let w=_-v;w<=y+v;w++)w!==0&&i.push(new c.b1(w,e))}return i}getCameraFrustum(){return si.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){const i=this.screenPointToLocation(this.centerPoint,e),a=e?e.getElevationForLngLatZoom(i,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(a)}setLocationAtPoint(e,i){const a=c.ai(this.elevation,this.center.lat),o=this.screenPointToMercatorCoordinateAtZ(i,a),u=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,a),f=c.a0.fromLngLat(e),_=new c.a0(f.x-(o.x-u.x),f.y-(o.y-u.y));this.setCenter(_?.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(e,i){return i?this.coordinatePoint(c.a0.fromLngLat(e),i.getElevationForLngLatZoom(e,this._helper._tileZoom),this._pixelMatrix3D):this.coordinatePoint(c.a0.fromLngLat(e))}screenPointToLocation(e,i){var a;return(a=this.screenPointToMercatorCoordinate(e,i))===null||a===void 0?void 0:a.toLngLat()}screenPointToMercatorCoordinate(e,i){if(i){const a=i.pointCoordinate(e);if(a!=null)return a}return this.screenPointToMercatorCoordinateAtZ(e)}screenPointToMercatorCoordinateAtZ(e,i){const a=i||0,o=[e.x,e.y,0,1],u=[e.x,e.y,1,1];c.av(o,o,this._pixelMatrixInverse),c.av(u,u,this._pixelMatrixInverse);const f=o[3],_=u[3],y=o[1]/f,v=u[1]/_,w=o[2]/f,P=u[2]/_,S=w===P?0:(a-w)/(P-w);return new c.a0(c.C.number(o[0]/f,u[0]/_,S)/this.worldSize,c.C.number(y,v,S)/this.worldSize,a)}coordinatePoint(e,i=0,a=this._pixelMatrix){const o=[e.x*this.worldSize,e.y*this.worldSize,i,1];return c.av(o,o,a),new c.P(o[0]/o[3],o[1]/o[3])}getBounds(){const e=Math.max(0,this._helper._height/2-L(this));return new Mt().extend(this.screenPointToLocation(new c.P(0,e))).extend(this.screenPointToLocation(new c.P(this._helper._width,e))).extend(this.screenPointToLocation(new c.P(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new c.P(0,this._helper._height)))}isPointOnMapSurface(e,i){return i?i.pointCoordinate(e)!=null:e.y>this.height/2-L(this)}calculatePosMatrix(e,i=!1,a){var o;const u=(o=e.key)!==null&&o!==void 0?o:c.b2(e.wrap,e.canonical.z,e.canonical.z,e.canonical.x,e.canonical.y),f=i?this._alignedPosMatrixCache:this._posMatrixCache;if(f.has(u)){const v=f.get(u);return a?v.f32:v.f64}const _=j(e,this.worldSize);c.O(_,i?this._alignedProjMatrix:this._viewProjMatrix,_);const y={f64:_,f32:new Float32Array(_)};return f.set(u,y),a?y.f32:y.f64}calculateFogMatrix(e){const i=e.key,a=this._fogMatrixCacheF32;if(a.has(i))return a.get(i);const o=j(e,this.worldSize);return c.O(o,this._fogMatrix,o),a.set(i,new Float32Array(o)),a.get(i)}getConstrained(e,i){i=c.ag(+i,this.minZoom,this.maxZoom);const a={center:new c.S(e.lng,e.lat),zoom:i};let o=this._helper._lngRange;if(!this._helper._renderWorldCopies&&o===null){const q=179.9999999999;o=[-q,q]}const u=this.tileSize*c.ae(a.zoom);let f=0,_=u,y=0,v=u,w=0,P=0;const{x:S,y:I}=this.size;if(this._helper._latRange){const q=this._helper._latRange;f=c.U(q[1])*u,_=c.U(q[0])*u,_-f<I&&(w=I/(_-f))}o&&(y=c.aN(c.V(o[0])*u,0,u),v=c.aN(c.V(o[1])*u,0,u),v<y&&(v+=u),v-y<S&&(P=S/(v-y)));const{x:k,y:V}=ne(u,e);let O,N;const $=Math.max(P||0,w||0);if($){const q=new c.P(P?(v+y)/2:k,w?(_+f)/2:V);return a.center=R(u,q).wrap(),a.zoom+=c.aj($),a}if(this._helper._latRange){const q=I/2;V-q<f&&(N=f+q),V+q>_&&(N=_-q)}if(o){const q=(y+v)/2;let Z=k;this._helper._renderWorldCopies&&(Z=c.aN(k,q-u/2,q+u/2));const Y=S/2;Z-Y<y&&(O=y+Y),Z+Y>v&&(O=v-Y)}if(O!==void 0||N!==void 0){const q=new c.P(O??k,N??V);a.center=R(u,q).wrap()}return a}calculateCenterFromCameraLngLatAlt(e,i,a,o){return this._helper.calculateCenterFromCameraLngLatAlt(e,i,a,o)}_calculateNearFarZIfNeeded(e,i,a){if(!this._helper.autoCalculateNearFarZ)return;const o=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),u=e-o*this._helper._pixelPerMeter/Math.cos(i),f=o<0?u:e,_=Math.PI/2+this.pitchInRadians,y=c.ad(this.fov)*(Math.abs(Math.cos(c.ad(this.roll)))*this.height+Math.abs(Math.sin(c.ad(this.roll)))*this.width)/this.height*(.5+a.y/this.height),v=Math.sin(y)*f/Math.sin(c.ag(Math.PI-_-y,.01,Math.PI-.01)),w=L(this),P=Math.atan(w/this._helper.cameraToCenterDistance),S=c.ad(.75),I=P>S?2*P*(.5+a.y/(2*w)):S,k=Math.sin(I)*f/Math.sin(c.ag(Math.PI-_-I,.01,Math.PI-.01)),V=Math.min(v,k);this._helper._farZ=1.01*(Math.cos(Math.PI/2-i)*V+f),this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;const e=this.centerOffset,i=ne(this.worldSize,this.center),a=i.x,o=i.y;this._helper._pixelPerMeter=c.ai(1,this.center.lat)*this.worldSize;const u=c.ad(Math.min(this.pitch,hr)),f=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(u));let _;this._calculateNearFarZIfNeeded(f,u,e),_=new Float64Array(16),c.b3(_,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),c.ap(this._invProjMatrix,_),_[8]=2*-e.x/this._helper._width,_[9]=2*e.y/this._helper._height,this._projectionMatrix=c.b4(_),c.N(_,_,[1,-1,1]),c.M(_,_,[0,0,-this._helper.cameraToCenterDistance]),c.b5(_,_,-this.rollInRadians),c.b6(_,_,this.pitchInRadians),c.b5(_,_,-this.bearingInRadians),c.M(_,_,[-a,-o,0]),this._mercatorMatrix=c.N([],_,[this.worldSize,this.worldSize,this.worldSize]),c.N(_,_,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=c.O(new Float64Array(16),this.clipSpaceToPixelsMatrix,_),c.M(_,_,[0,0,-this.elevation]),this._viewProjMatrix=_,this._invViewProjMatrix=c.ap([],_);const y=[0,0,-1,1];c.av(y,y,this._invViewProjMatrix),this._cameraPosition=[y[0]/y[3],y[1]/y[3],y[2]/y[3]],this._fogMatrix=new Float64Array(16),c.b3(this._fogMatrix,this.fovInRadians,this.width/this.height,f,this._helper._farZ),this._fogMatrix[8]=2*-e.x/this.width,this._fogMatrix[9]=2*e.y/this.height,c.N(this._fogMatrix,this._fogMatrix,[1,-1,1]),c.M(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),c.b5(this._fogMatrix,this._fogMatrix,-this.rollInRadians),c.b6(this._fogMatrix,this._fogMatrix,this.pitchInRadians),c.b5(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),c.M(this._fogMatrix,this._fogMatrix,[-a,-o,0]),c.N(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),c.M(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=c.O(new Float64Array(16),this.clipSpaceToPixelsMatrix,_);const v=this._helper._width%2/2,w=this._helper._height%2/2,P=Math.cos(this.bearingInRadians),S=Math.sin(-this.bearingInRadians),I=a-Math.round(a)+P*v+S*w,k=o-Math.round(o)+P*w+S*v,V=new Float64Array(_);if(c.M(V,V,[I>.5?I-1:I,k>.5?k-1:k,0]),this._alignedProjMatrix=V,_=c.ap(new Float64Array(16),this._pixelMatrix),!_)throw new Error("failed to invert matrix");this._pixelMatrixInverse=_,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;const e=this.screenPointToMercatorCoordinate(new c.P(0,0)),i=[e.x*this.worldSize,e.y*this.worldSize,0,1];return c.av(i,i,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){const e=c.ai(1,this.center.lat)*this.worldSize;return H(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/e).toLngLat()}lngLatToCameraDepth(e,i){const a=c.a0.fromLngLat(e),o=[a.x*this.worldSize,a.y*this.worldSize,i,1];return c.av(o,o,this._viewProjMatrix),o[2]/o[3]}getProjectionData(e){const{overscaledTileID:i,aligned:a,applyTerrainMatrix:o}=e,u=this._helper.getMercatorTileCoordinates(i),f=i?this.calculatePosMatrix(i,a,!0):null;let _;return _=i&&i.terrainRttPosMatrix32f&&o?i.terrainRttPosMatrix32f:f||c.b7(),{mainMatrix:_,tileMercatorCoords:u,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:_}}isLocationOccluded(e){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(e,i,a){return 1}transformLightDirection(e){return c.aS(e)}getRayDirectionFromPixel(e){throw new Error("Not implemented.")}projectTileCoordinates(e,i,a,o){const u=this.calculatePosMatrix(a);let f;o?(f=[e,i,o(e,i),1],c.av(f,f,u)):(f=[e,i,0,1],en(f,f,u));const _=f[3];return{point:new c.P(f[0]/_,f[1]/_),signedDistanceFromCamera:_,isOccluded:!1}}populateCache(e){for(const i of e)this.calculatePosMatrix(i)}getMatrixForModel(e,i){const a=c.a0.fromLngLat(e,i),o=a.meterInMercatorCoordinateUnits(),u=c.b8();return c.M(u,u,[a.x,a.y,a.z]),c.b5(u,u,Math.PI),c.b6(u,u,Math.PI/2),c.N(u,u,[-o,o,o]),u}getProjectionDataForCustomLayer(e=!0){const i=new c.Z(0,0,0,0,0),a=this.getProjectionData({overscaledTileID:i,applyGlobeMatrix:e}),o=j(i,this.worldSize);c.O(o,this._viewProjMatrix,o),a.tileMercatorCoords=[0,0,1,1];const u=[c.$,c.$,this.worldSize/this._helper.pixelsPerMeter],f=c.b9();return c.N(f,o,u),a.fallbackMatrix=f,a.mainMatrix=f,a}getFastPathSimpleProjectionMatrix(e){return this.calculatePosMatrix(e)}}function ai(){c.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function Ut(h){if(h.useSlerp)if(h.k<1){const e=c.ba(h.startEulerAngles.roll,h.startEulerAngles.pitch,h.startEulerAngles.bearing),i=c.ba(h.endEulerAngles.roll,h.endEulerAngles.pitch,h.endEulerAngles.bearing),a=new Float64Array(4);c.bb(a,e,i,h.k);const o=c.bc(a);h.tr.setRoll(o.roll),h.tr.setPitch(o.pitch),h.tr.setBearing(o.bearing)}else h.tr.setRoll(h.endEulerAngles.roll),h.tr.setPitch(h.endEulerAngles.pitch),h.tr.setBearing(h.endEulerAngles.bearing);else h.tr.setRoll(c.C.number(h.startEulerAngles.roll,h.endEulerAngles.roll,h.k)),h.tr.setPitch(c.C.number(h.startEulerAngles.pitch,h.endEulerAngles.pitch,h.k)),h.tr.setBearing(c.C.number(h.startEulerAngles.bearing,h.endEulerAngles.bearing,h.k))}function vt(h,e,i,a,o){const u=o.padding,f=ne(o.worldSize,i.getNorthWest()),_=ne(o.worldSize,i.getNorthEast()),y=ne(o.worldSize,i.getSouthEast()),v=ne(o.worldSize,i.getSouthWest()),w=c.ad(-a),P=f.rotate(w),S=_.rotate(w),I=y.rotate(w),k=v.rotate(w),V=new c.P(Math.max(P.x,S.x,k.x,I.x),Math.max(P.y,S.y,k.y,I.y)),O=new c.P(Math.min(P.x,S.x,k.x,I.x),Math.min(P.y,S.y,k.y,I.y)),N=V.sub(O),$=(o.width-(u.left+u.right+e.left+e.right))/N.x,q=(o.height-(u.top+u.bottom+e.top+e.bottom))/N.y;if(q<0||$<0)return void ai();const Z=Math.min(c.aj(o.scale*Math.min($,q)),h.maxZoom),Y=c.P.convert(h.offset),K=new c.P((e.left-e.right)/2,(e.top-e.bottom)/2).rotate(c.ad(a)),G=Y.add(K).mult(o.scale/c.ae(Z));return{center:R(o.worldSize,f.add(y).div(2).sub(G)),zoom:Z,bearing:a}}class aa{get useGlobeControls(){return!1}handlePanInertia(e,i){return{easingOffset:e,easingCenter:i.center}}handleMapControlsRollPitchBearingZoom(e,i){e.bearingDelta&&i.setBearing(i.bearing+e.bearingDelta),e.pitchDelta&&i.setPitch(i.pitch+e.pitchDelta),e.rollDelta&&i.setRoll(i.roll+e.rollDelta),e.zoomDelta&&i.setZoom(i.zoom+e.zoomDelta)}handleMapControlsPan(e,i,a){e.around.distSqr(i.centerPoint)<.01||i.setLocationAtPoint(a,e.around)}cameraForBoxAndBearing(e,i,a,o,u){return vt(e,i,a,o,u)}handleJumpToCenterZoom(e,i){e.zoom!==(i.zoom!==void 0?+i.zoom:e.zoom)&&e.setZoom(+i.zoom),i.center!==void 0&&e.setCenter(c.S.convert(i.center))}handleEaseTo(e,i){const a=e.zoom,o=e.padding,u={roll:e.roll,pitch:e.pitch,bearing:e.bearing},f={roll:i.roll===void 0?e.roll:i.roll,pitch:i.pitch===void 0?e.pitch:i.pitch,bearing:i.bearing===void 0?e.bearing:i.bearing},_=i.zoom!==void 0,y=!e.isPaddingEqual(i.padding);let v=!1;const w=_?+i.zoom:e.zoom;let P=e.centerPoint.add(i.offsetAsPoint);const S=e.screenPointToLocation(P),{center:I,zoom:k}=e.getConstrained(c.S.convert(i.center||S),w??a);mr(e,I);const V=ne(e.worldSize,S),O=ne(e.worldSize,I).sub(V),N=c.ae(k-a);return v=k!==a,{easeFunc:$=>{if(v&&e.setZoom(c.C.number(a,k,$)),c.bd(u,f)||Ut({startEulerAngles:u,endEulerAngles:f,tr:e,k:$,useSlerp:u.roll!=f.roll}),y&&(e.interpolatePadding(o,i.padding,$),P=e.centerPoint.add(i.offsetAsPoint)),i.around)e.setLocationAtPoint(i.around,i.aroundPoint);else{const q=c.ae(e.zoom-a),Z=k>a?Math.min(2,N):Math.max(.5,N),Y=Math.pow(Z,1-$),K=R(e.worldSize,V.add(O.mult($*Y)).mult(q));e.setLocationAtPoint(e.renderWorldCopies?K.wrap():K,P)}},isZooming:v,elevationCenter:I}}handleFlyTo(e,i){const a=i.zoom!==void 0,o=e.zoom,u=e.getConstrained(c.S.convert(i.center||i.locationAtOffset),a?+i.zoom:o),f=u.center,_=u.zoom;mr(e,f);const y=ne(e.worldSize,i.locationAtOffset),v=ne(e.worldSize,f).sub(y),w=v.mag(),P=c.ae(_-o);let S;if(i.minZoom!==void 0){const I=Math.min(+i.minZoom,o,_),k=e.getConstrained(f,I).zoom;S=c.ae(k-o)}return{easeFunc:(I,k,V,O)=>{e.setZoom(I===1?_:o+c.aj(k));const N=I===1?f:R(e.worldSize,y.add(v.mult(V)).mult(k));e.setLocationAtPoint(e.renderWorldCopies?N.wrap():N,O)},scaleOfZoom:P,targetCenter:f,scaleOfMinZoom:S,pixelPathLength:w}}}class rt{constructor(e,i,a){this.blendFunction=e,this.blendColor=i,this.mask=a}}rt.Replace=[1,0],rt.disabled=new rt(rt.Replace,c.be.transparent,[!1,!1,!1,!1]),rt.unblended=new rt(rt.Replace,c.be.transparent,[!0,!0,!0,!0]),rt.alphaBlended=new rt([1,771],c.be.transparent,[!0,!0,!0,!0]);const gi=2305;class Ze{constructor(e,i,a){this.enable=e,this.mode=i,this.frontFace=a}}Ze.disabled=new Ze(!1,1029,gi),Ze.backCCW=new Ze(!0,1029,gi),Ze.frontCCW=new Ze(!0,1028,gi);class qe{constructor(e,i,a){this.func=e,this.mask=i,this.range=a}}qe.ReadOnly=!1,qe.ReadWrite=!0,qe.disabled=new qe(519,qe.ReadOnly,[0,1]);const nn=7680;class Ne{constructor(e,i,a,o,u,f){this.test=e,this.ref=i,this.mask=a,this.fail=o,this.depthFail=u,this.pass=f}}Ne.disabled=new Ne({func:519,mask:0},0,0,nn,nn,nn);const sn=new WeakMap;function hi(h){var e;if(sn.has(h))return sn.get(h);{const i=(e=h.getParameter(h.VERSION))===null||e===void 0?void 0:e.startsWith("WebGL 2.0");return sn.set(h,i),i}}class Sn{get awaitingQuery(){return!!this._readbackQueue}constructor(e){this._readbackWaitFrames=4,this._measureWaitFrames=6,this._texWidth=1,this._texHeight=1,this._measuredError=0,this._updateCount=0,this._lastReadbackFrame=-1e3,this._readbackQueue=null,this._cachedRenderContext=e;const i=e.context,a=i.gl;this._texFormat=a.RGBA,this._texType=a.UNSIGNED_BYTE;const o=new c.aK;o.emplaceBack(-1,-1),o.emplaceBack(2,-1),o.emplaceBack(-1,2);const u=new c.aM;u.emplaceBack(0,1,2),this._fullscreenTriangle=new pr(i.createVertexBuffer(o,fr.members),i.createIndexBuffer(u),c.aL.simpleSegment(0,0,o.length,u.length)),this._resultBuffer=new Uint8Array(4),i.activeTexture.set(a.TEXTURE1);const f=a.createTexture();a.bindTexture(a.TEXTURE_2D,f),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.NEAREST),a.texImage2D(a.TEXTURE_2D,0,this._texFormat,this._texWidth,this._texHeight,0,this._texFormat,this._texType,null),this._fbo=i.createFramebuffer(this._texWidth,this._texHeight,!1,!1),this._fbo.colorAttachment.set(f),hi(a)&&(this._pbo=a.createBuffer(),a.bindBuffer(a.PIXEL_PACK_BUFFER,this._pbo),a.bufferData(a.PIXEL_PACK_BUFFER,4,a.STREAM_READ),a.bindBuffer(a.PIXEL_PACK_BUFFER,null))}destroy(){const e=this._cachedRenderContext.context.gl;this._fullscreenTriangle.destroy(),this._fbo.destroy(),e.deleteBuffer(this._pbo),this._fullscreenTriangle=null,this._fbo=null,this._pbo=null,this._resultBuffer=null}updateErrorLoop(e,i){const a=this._updateCount;return this._readbackQueue?a>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():a>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(e,i),this._updateCount++,this._measuredError}_bindFramebuffer(){const e=this._cachedRenderContext.context,i=e.gl;e.activeTexture.set(i.TEXTURE1),i.bindTexture(i.TEXTURE_2D,this._fbo.colorAttachment.get()),e.bindFramebuffer.set(this._fbo.framebuffer)}_renderErrorTexture(e,i){const a=this._cachedRenderContext.context,o=a.gl;if(this._bindFramebuffer(),a.viewport.set([0,0,this._texWidth,this._texHeight]),a.clear({color:c.be.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(a,o.TRIANGLES,qe.disabled,Ne.disabled,rt.unblended,Ze.disabled,((u,f)=>({u_input:u,u_output_expected:f}))(e,i),null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&hi(o)){o.bindBuffer(o.PIXEL_PACK_BUFFER,this._pbo),o.readBuffer(o.COLOR_ATTACHMENT0),o.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,0),o.bindBuffer(o.PIXEL_PACK_BUFFER,null);const u=o.fenceSync(o.SYNC_GPU_COMMANDS_COMPLETE,0);o.flush(),this._readbackQueue={frameNumberIssued:this._updateCount,sync:u}}else this._readbackQueue={frameNumberIssued:this._updateCount,sync:null}}_tryReadback(){const e=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&hi(e)){const i=e.clientWaitSync(this._readbackQueue.sync,0,0);if(i===e.WAIT_FAILED)return c.w("WebGL2 clientWaitSync failed."),this._readbackQueue=null,void(this._lastReadbackFrame=this._updateCount);if(i===e.TIMEOUT_EXPIRED)return;e.bindBuffer(e.PIXEL_PACK_BUFFER,this._pbo),e.getBufferSubData(e.PIXEL_PACK_BUFFER,0,this._resultBuffer,0,4),e.bindBuffer(e.PIXEL_PACK_BUFFER,null)}else this._bindFramebuffer(),e.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,this._resultBuffer);this._readbackQueue=null,this._measuredError=Sn._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount}static _parseRGBA8float(e){let i=0;return i+=e[0]/256,i+=e[1]/65536,i+=e[2]/16777216,e[3]<127&&(i=-i),i/128}}const yi=c.$/128;function ro(h,e){const i=h.granularity!==void 0?Math.max(h.granularity,1):1,a=i+(h.generateBorders?2:0),o=i+(h.extendToNorthPole||h.generateBorders?1:0)+(h.extendToSouthPole||h.generateBorders?1:0),u=a+1,f=o+1,_=h.generateBorders?-1:0,y=h.generateBorders||h.extendToNorthPole?-1:0,v=i+(h.generateBorders?1:0),w=i+(h.generateBorders||h.extendToSouthPole?1:0),P=u*f,S=a*o*6,I=u*f>65536;if(I&&e==="16bit")throw new Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");const k=I||e==="32bit",V=new Int16Array(2*P);let O=0;for(let q=y;q<=w;q++)for(let Z=_;Z<=v;Z++){let Y=Z/i*c.$;Z===-1&&(Y=-yi),Z===i+1&&(Y=c.$+yi);let K=q/i*c.$;q===-1&&(K=h.extendToNorthPole?c.bg:-yi),q===i+1&&(K=h.extendToSouthPole?c.bh:c.$+yi),V[O++]=Y,V[O++]=K}const N=k?new Uint32Array(S):new Uint16Array(S);let $=0;for(let q=0;q<o;q++)for(let Z=0;Z<a;Z++){const Y=Z+1+q*u,K=Z+(q+1)*u,G=Z+1+(q+1)*u;N[$++]=Z+q*u,N[$++]=K,N[$++]=Y,N[$++]=Y,N[$++]=K,N[$++]=G}return{vertices:V.buffer.slice(0),indices:N.buffer.slice(0),uses32bitIndices:k}}const rr=new c.aJ({fill:new c.bi(128,2),line:new c.bi(512,0),tile:new c.bi(128,32),stencil:new c.bi(128,1),circle:3});class yl{constructor(){this._tileMeshCache={},this._errorCorrectionUsable=0,this._errorMeasurementLastValue=0,this._errorCorrectionPreviousValue=0,this._errorMeasurementLastChangeTime=-1e3}get name(){return"vertical-perspective"}get transitionState(){return 1}get useSubdivision(){return!0}get shaderVariantName(){return"globe"}get shaderDefine(){return"#define GLOBE"}get shaderPreludeCode(){return ir.projectionGlobe}get vertexShaderPreludeCode(){return ir.projectionMercator.vertexSource}get subdivisionGranularity(){return rr}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(e){this._errorMeasurement||(this._errorMeasurement=new Sn(e));const i=c.U(this._errorQueryLatitudeDegrees),a=2*Math.atan(Math.exp(Math.PI-i*Math.PI*2))-.5*Math.PI,o=this._errorMeasurement.updateErrorLoop(i,a),u=Ge.now();o!==this._errorMeasurementLastValue&&(this._errorCorrectionPreviousValue=this._errorCorrectionUsable,this._errorMeasurementLastValue=o,this._errorMeasurementLastChangeTime=u);const f=Math.min(Math.max((u-this._errorMeasurementLastChangeTime)/1e3/.5,0),1);this._errorCorrectionUsable=c.bj(this._errorCorrectionPreviousValue,-this._errorMeasurementLastValue,c.bk(f))}_getMeshKey(e){return`${e.granularity.toString(36)}_${e.generateBorders?"b":""}${e.extendToNorthPole?"n":""}${e.extendToSouthPole?"s":""}`}getMeshFromTileID(e,i,a,o,u){const f=(u==="stencil"?rr.stencil:rr.tile).getGranularityForZoomLevel(i.z);return this._getMesh(e,{granularity:f,generateBorders:a,extendToNorthPole:i.y===0&&o,extendToSouthPole:i.y===(1<<i.z)-1&&o})}_getMesh(e,i){const a=this._getMeshKey(i);if(a in this._tileMeshCache)return this._tileMeshCache[a];const o=function(u,f){const _=ro(f,"16bit"),y=c.aK.deserialize({arrayBuffer:_.vertices,length:_.vertices.byteLength/2/2}),v=c.aM.deserialize({arrayBuffer:_.indices,length:_.indices.byteLength/2/3});return new pr(u.createVertexBuffer(y,fr.members),u.createIndexBuffer(v),c.aL.simpleSegment(0,0,y.length,v.length))}(e,i);return this._tileMeshCache[a]=o,o}recalculate(e){}hasTransition(){const e=Ge.now();let i=!1;return i=i||(e-this._errorMeasurementLastChangeTime)/1e3<.7,i=i||this._errorMeasurement&&this._errorMeasurement.awaitingQuery,i}setErrorQueryLatitudeDegrees(e){this._errorQueryLatitudeDegrees=e}}const xl=new c.r({type:new c.D(c.v.projection.type)});class ps extends c.E{constructor(e){super(),this._transitionable=new c.t(xl),this.setProjection(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new c.F(0)),this._mercatorProjection=new to,this._verticalPerspectiveProjection=new yl}get transitionState(){const e=this.properties.get("type");if(typeof e=="string"&&e==="mercator")return 0;if(typeof e=="string"&&e==="vertical-perspective")return 1;if(e instanceof c.bl){if(e.from==="vertical-perspective"&&e.to==="mercator")return 1-e.transition;if(e.from==="mercator"&&e.to==="vertical-perspective")return e.transition}return 1}get useGlobeRendering(){return this.transitionState>0}get latitudeErrorCorrectionRadians(){return this._verticalPerspectiveProjection.latitudeErrorCorrectionRadians}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return"globe"}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}updateGPUdependent(e){this._mercatorProjection.updateGPUdependent(e),this._verticalPerspectiveProjection.updateGPUdependent(e)}getMeshFromTileID(e,i,a,o,u){return this.currentProjection.getMeshFromTileID(e,i,a,o,u)}setProjection(e){this._transitionable.setValue("type",e?.type||"mercator")}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}setErrorQueryLatitudeDegrees(e){this._verticalPerspectiveProjection.setErrorQueryLatitudeDegrees(e),this._mercatorProjection.setErrorQueryLatitudeDegrees(e)}}function fs(h){const e=Pn(h.worldSize,h.center.lat);return 2*Math.PI*e}function $i(h,e,i,a,o){const u=1/(1<<o),f=e/c.$*u+a*u,_=c.bn((h/c.$*u+i*u)*Math.PI*2+Math.PI,2*Math.PI),y=2*Math.atan(Math.exp(Math.PI-f*Math.PI*2))-.5*Math.PI,v=Math.cos(y),w=new Float64Array(3);return w[0]=Math.sin(_)*v,w[1]=Math.sin(y),w[2]=Math.cos(_)*v,w}function $t(h){return function(e,i){const a=Math.cos(i),o=new Float64Array(3);return o[0]=Math.sin(e)*a,o[1]=Math.sin(i),o[2]=Math.cos(e)*a,o}(h.lng*Math.PI/180,h.lat*Math.PI/180)}function Pn(h,e){return h/(2*Math.PI)/Math.cos(e*Math.PI/180)}function ms(h){const e=Math.asin(h[1])/Math.PI*180,i=Math.sqrt(h[0]*h[0]+h[2]*h[2]);if(i>1e-6){const a=h[0]/i,o=Math.acos(h[2]/i),u=(a>0?o:-o)/Math.PI*180;return new c.S(c.aN(u,-180,180),e)}return new c.S(0,e)}function Mn(h){return Math.cos(h*Math.PI/180)}function Lt(h,e){const i=Mn(h),a=Mn(e);return c.aj(a/i)}function _s(h,e){const i=h.rotate(e.bearingInRadians),a=e.zoom+Lt(e.center.lat,0),o=c.bj(1/Mn(e.center.lat),1/Mn(Math.min(Math.abs(e.center.lat),60)),c.bm(a,7,3,0,1)),u=360/fs({worldSize:e.worldSize,center:{lat:e.center.lat}});return new c.S(e.center.lng-i.x*u*o,c.ag(e.center.lat+i.y*u,-c.ah,c.ah))}function In(h){const e=.5*h,i=Math.sin(e),a=Math.cos(e);return Math.log(i+a)-Math.log(a-i)}function Cn(h,e,i,a){const o=h.lat+i*a;if(Math.abs(i)>1){const u=(Math.sign(h.lat+i)!==Math.sign(h.lat)?-Math.abs(h.lat):Math.abs(h.lat))*Math.PI/180,f=Math.abs(h.lat+i)*Math.PI/180,_=In(u+a*(f-u)),y=In(u),v=In(f);return new c.S(h.lng+e*((_-y)/(v-y)),o)}return new c.S(h.lng+e*a,o)}class Sc{constructor(e){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=e}swapBuffers(){if(!this._hadAnyChanges)return;const e=this._cachePrevious;this._cachePrevious=this._cache,this._cache=e,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(e,i,a,o){const u=`${e.z}_${e.x}_${e.y}_${o?.terrain?"t":""}`,f=this._cache.get(u);if(f)return f;const _=this._cachePrevious.get(u);if(_)return this._cache.set(u,_),_;const y=this._boundingVolumeFactory(e,i,a,o);return this._cache.set(u,y),this._hadAnyChanges=!0,y}}class kr{constructor(e,i,a,o){this.min=a,this.max=o,this.points=e,this.planes=i}static fromAabb(e,i){const a=[];for(let o=0;o<8;o++)a.push([1&~o?e[0]:i[0],(o>>1&1)==1?i[1]:e[1],(o>>2&1)==1?i[2]:e[2]]);return new kr(a,[[-1,0,0,i[0]],[1,0,0,-e[0]],[0,-1,0,i[1]],[0,1,0,-e[1]],[0,0,-1,i[2]],[0,0,1,-e[2]]],e,i)}static fromCenterSizeAngles(e,i,a){const o=c.bq([],a[0],a[1],a[2]),u=c.br([],[i[0],0,0],o),f=c.br([],[0,i[1],0],o),_=c.br([],[0,0,i[2]],o),y=[...e],v=[...e];for(let P=0;P<8;P++)for(let S=0;S<3;S++){const I=e[S]+u[S]*(1&~P?-1:1)+f[S]*((P>>1&1)==1?1:-1)+_[S]*((P>>2&1)==1?1:-1);y[S]=Math.min(y[S],I),v[S]=Math.max(v[S],I)}const w=[];for(let P=0;P<8;P++){const S=[...e];c.aR(S,S,c.aQ([],u,1&~P?-1:1)),c.aR(S,S,c.aQ([],f,(P>>1&1)==1?1:-1)),c.aR(S,S,c.aQ([],_,(P>>2&1)==1?1:-1)),w.push(S)}return new kr(w,[[...u,-c.aW(u,w[0])],[...f,-c.aW(f,w[0])],[..._,-c.aW(_,w[0])],[-u[0],-u[1],-u[2],-c.aW(u,w[7])],[-f[0],-f[1],-f[2],-c.aW(f,w[7])],[-_[0],-_[1],-_[2],-c.aW(_,w[7])]],y,v)}intersectsFrustum(e){let i=!0;const a=this.points.length,o=this.planes.length,u=e.planes.length,f=e.points.length;for(let _=0;_<u;_++){const y=e.planes[_];let v=0;for(let w=0;w<a;w++){const P=this.points[w];y[0]*P[0]+y[1]*P[1]+y[2]*P[2]+y[3]>=0&&v++}if(v===0)return 0;v<a&&(i=!1)}if(i)return 2;for(let _=0;_<o;_++){const y=this.planes[_];let v=0;for(let w=0;w<f;w++){const P=e.points[w];y[0]*P[0]+y[1]*P[1]+y[2]*P[2]+y[3]>=0&&v++}if(v===0)return 0}return 1}intersectsPlane(e){const i=this.points.length;let a=0;for(let o=0;o<i;o++){const u=this.points[o];e[0]*u[0]+e[1]*u[1]+e[2]*u[2]+e[3]>=0&&a++}return a===i?2:a===0?0:1}}function gs(h,e,i){const a=h-e;return a<0?-a:Math.max(0,a-i)}function no(h,e,i,a,o){const u=h-i;let f;return f=u<0?Math.min(-u,1+u-o):u>1?Math.min(Math.max(u-o,0),1-u):0,Math.max(f,gs(e,a,o))}class Pc{constructor(){this._boundingVolumeCache=new Sc(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(e,i,a,o){const u=1<<a.z,f=1/u,_=a.x/u,y=a.y/u;let v=2;return v=Math.min(v,no(e,i,_,y,f)),v=Math.min(v,no(e,i,_+.5,-y-f,f)),v=Math.min(v,no(e,i,_+.5,2-y-f,f)),v}getWrap(e,i,a){const o=1<<i.z,u=1/o,f=i.x/o,_=gs(e.x,f,u),y=gs(e.x,f-1,u),v=gs(e.x,f+1,u),w=Math.min(_,y,v);return w===v?1:w===y?-1:0}allowVariableZoom(e,i){return _e(e,i)>4}allowWorldCopies(){return!1}getTileBoundingVolume(e,i,a,o){return this._boundingVolumeCache.getTileBoundingVolume(e,i,a,o)}_computeTileBoundingVolume(e,i,a,o){var u,f;let _=a,y=a;if(o?.terrain){const v=new c.Z(e.z,i,e.z,e.x,e.y),w=o.terrain.getMinMaxElevation(v);_=(u=w.minElevation)!==null&&u!==void 0?u:a,y=(f=w.maxElevation)!==null&&f!==void 0?f:a}if(_/=c.bt,y/=c.bt,_+=1,y+=1,e.z<=0)return kr.fromAabb([-y,-y,-y],[y,y,y]);if(e.z===1)return kr.fromAabb([e.x===0?-y:0,e.y===0?0:-y,-y],[e.x===0?0:y,e.y===0?y:0,y]);{const v=[$i(0,0,e.x,e.y,e.z),$i(c.$,0,e.x,e.y,e.z),$i(c.$,c.$,e.x,e.y,e.z),$i(0,c.$,e.x,e.y,e.z)],w=[];for(const oe of v)w.push(c.aQ([],oe,y));if(y!==_)for(const oe of v)w.push(c.aQ([],oe,_));e.y===0&&w.push([0,1,0]),e.y===(1<<e.z)-1&&w.push([0,-1,0]);const P=[1,1,1],S=[-1,-1,-1];for(const oe of w)for(let ue=0;ue<3;ue++)P[ue]=Math.min(P[ue],oe[ue]),S[ue]=Math.max(S[ue],oe[ue]);const I=$i(c.$/2,c.$/2,e.x,e.y,e.z),k=c.aV([],[0,1,0],I);c.aU(k,k);const V=c.aV([],I,k);c.aU(V,V);const O=c.aV([],v[2],v[1]);c.aU(O,O);const N=c.aV([],v[0],v[3]);c.aU(N,N),w.push(c.aQ([],I,y)),e.y>=(1<<e.z)/2&&w.push(c.aQ([],$i(c.$/2,0,e.x,e.y,e.z),y)),e.y<(1<<e.z)/2&&w.push(c.aQ([],$i(c.$/2,c.$,e.x,e.y,e.z),y));const $=ui(I,w),q=ui(V,w),Z=[-I[0],-I[1],-I[2],$.max],Y=[I[0],I[1],I[2],-$.min],K=[-V[0],-V[1],-V[2],q.max],G=[V[0],V[1],V[2],-q.min],te=[...O,0],he=[...N,0],ae=[];return e.y===0?ae.push(c.bs(he,te,Z),c.bs(he,te,Y)):ae.push(c.bs(K,te,Z),c.bs(K,te,Y),c.bs(K,he,Z),c.bs(K,he,Y)),e.y===(1<<e.z)-1?ae.push(c.bs(he,te,Z),c.bs(he,te,Y)):ae.push(c.bs(G,te,Z),c.bs(G,te,Y),c.bs(G,he,Z),c.bs(G,he,Y)),new kr(ae,[Z,Y,K,G,te,he],P,S)}}}function ui(h,e){let i=1/0,a=-1/0;for(const o of e){const u=c.aW(h,o);i=Math.min(i,u),a=Math.max(a,u)}return{min:i,max:a}}class An{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,i,a){return this._helper.interpolatePadding(e,i,a)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,i){this._helper.resize(e,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}overrideNearFarZ(e,i){this._helper.overrideNearFarZ(e,i)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e){}constructor(){this._cachedClippingPlane=c.bu(),this._projectionMatrix=c.b8(),this._globeViewProjMatrix32f=c.b7(),this._globeViewProjMatrixNoCorrection=c.b8(),this._globeViewProjMatrixNoCorrectionInverted=c.b8(),this._globeProjMatrixInverted=c.b8(),this._cameraPosition=c.bo(),this._globeLatitudeErrorCorrectionRadians=0,this._helper=new ds({calcMatrices:()=>{this._calcMatrices()},getConstrained:(e,i)=>this.getConstrained(e,i)}),this._coveringTilesDetailsProvider=new Pc}clone(){const e=new An;return e.apply(this),e}apply(e,i){this._globeLatitudeErrorCorrectionRadians=i||0,this._helper.apply(e)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){const e=c.bo();return e[0]=this._cameraPosition[0],e[1]=this._cameraPosition[1],e[2]=this._cameraPosition[2],e}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(e){const{overscaledTileID:i,applyGlobeMatrix:a}=e,o=this._helper.getMercatorTileCoordinates(i);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:o,clippingPlane:this._cachedClippingPlane,projectionTransition:a?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(e){const i=this.pitchInRadians,a=this.cameraToCenterDistance/e,o=Math.sin(i)*a,u=Math.cos(i)*a+1,f=1/Math.sqrt(o*o+u*u)*1;let _=-o,y=u;const v=Math.sqrt(_*_+y*y);_/=v,y/=v;const w=[0,_,y];c.bv(w,w,[0,0,0],-this.bearingInRadians),c.bw(w,w,[0,0,0],-1*this.center.lat*Math.PI/180),c.bx(w,w,[0,0,0],this.center.lng*Math.PI/180);const P=1/c.aY(w);return c.aQ(w,w,P),[...w,-f*P]}isLocationOccluded(e){return!this.isSurfacePointVisible($t(e))}transformLightDirection(e){const i=this._helper._center.lng*Math.PI/180,a=this._helper._center.lat*Math.PI/180,o=Math.cos(a),u=[Math.sin(i)*o,Math.sin(a),Math.cos(i)*o],f=[u[2],0,-u[0]],_=[0,0,0];c.aV(_,f,u),c.aU(f,f),c.aU(_,_);const y=[0,0,0];return c.aU(y,[f[0]*e[0]+_[0]*e[1]+u[0]*e[2],f[1]*e[0]+_[1]*e[1]+u[1]*e[2],f[2]*e[0]+_[2]*e[1]+u[2]*e[2]]),y}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(e,i,a){const o=function(_,y,v){const w=1/(1<<v.z);return new c.a0(_/c.$*w+v.x*w,y/c.$*w+v.y*w)}(e,i,a.canonical),u=(f=o.y,[c.bn(o.x*Math.PI*2+Math.PI,2*Math.PI),2*Math.atan(Math.exp(Math.PI-f*Math.PI*2))-.5*Math.PI]);var f;return this.getCircleRadiusCorrection()/Math.cos(u[1])}projectTileCoordinates(e,i,a,o){const u=a.canonical,f=$i(e,i,u.x,u.y,u.z),_=1+(o?o(e,i):0)/c.bt,y=[f[0]*_,f[1]*_,f[2]*_,1];c.av(y,y,this._globeViewProjMatrixNoCorrection);const v=this._cachedClippingPlane,w=v[0]*f[0]+v[1]*f[1]+v[2]*f[2]+v[3]<0;return{point:new c.P(y[0]/y[3],y[1]/y[3]),signedDistanceFromCamera:y[3],isOccluded:w}}_calcMatrices(){if(!this._helper._width||!this._helper._height)return;const e=Pn(this.worldSize,this.center.lat),i=c.b9(),a=c.b9();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*e),c.b3(i,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);const o=this.centerOffset;i[8]=2*-o.x/this._helper._width,i[9]=2*o.y/this._helper._height,this._projectionMatrix=c.b4(i),this._globeProjMatrixInverted=c.b9(),c.ap(this._globeProjMatrixInverted,i),c.M(i,i,[0,0,-this.cameraToCenterDistance]),c.b5(i,i,this.rollInRadians),c.b6(i,i,-this.pitchInRadians),c.b5(i,i,this.bearingInRadians),c.M(i,i,[0,0,-e]);const u=c.bo();u[0]=e,u[1]=e,u[2]=e,c.b6(a,i,this.center.lat*Math.PI/180),c.by(a,a,-this.center.lng*Math.PI/180),c.N(a,a,u),this._globeViewProjMatrixNoCorrection=a,c.b6(i,i,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),c.by(i,i,-this.center.lng*Math.PI/180),c.N(i,i,u),this._globeViewProjMatrix32f=new Float32Array(i),this._globeViewProjMatrixNoCorrectionInverted=c.b9(),c.ap(this._globeViewProjMatrixNoCorrectionInverted,a);const f=c.bo();this._cameraPosition=c.bo(),this._cameraPosition[2]=this.cameraToCenterDistance/e,c.bv(this._cameraPosition,this._cameraPosition,f,-this.rollInRadians),c.bw(this._cameraPosition,this._cameraPosition,f,this.pitchInRadians),c.bv(this._cameraPosition,this._cameraPosition,f,-this.bearingInRadians),c.aR(this._cameraPosition,this._cameraPosition,[0,0,1]),c.bw(this._cameraPosition,this._cameraPosition,f,-this.center.lat*Math.PI/180),c.bx(this._cameraPosition,this._cameraPosition,f,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(e);const _=c.b4(this._globeViewProjMatrixNoCorrectionInverted);c.N(_,_,[1,1,-1]),this._cachedFrustum=si.fromInvProjectionMatrix(_,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(e){c.w("calculateFogMatrix is not supported on globe projection.");const i=c.b9();return c.af(i),i}getVisibleUnwrappedCoordinates(e){return[new c.b1(0,e)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){e&&c.w("terrain is not fully supported on vertical perspective projection."),this._helper.recalculateZoomAndCenter(0)}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(e,i){if(!this._globeViewProjMatrixNoCorrection)return 1;const a=$t(e);c.aQ(a,a,1+i/c.bt);const o=c.bu();return c.av(o,[a[0],a[1],a[2],1],this._globeViewProjMatrixNoCorrection),o[2]/o[3]}populateCache(e){}getBounds(){const e=.5*this.width,i=.5*this.height,a=[new c.P(0,0),new c.P(e,0),new c.P(this.width,0),new c.P(this.width,i),new c.P(this.width,this.height),new c.P(e,this.height),new c.P(0,this.height),new c.P(0,i)],o=[];for(const P of a)o.push(this.unprojectScreenPoint(P));let u=0,f=0,_=0,y=0;const v=this.center;for(const P of o){const S=c.bz(v.lng,P.lng),I=c.bz(v.lat,P.lat);S<f&&(f=S),S>u&&(u=S),I<y&&(y=I),I>_&&(_=I)}const w=[v.lng+f,v.lat+y,v.lng+u,v.lat+_];return this.isSurfacePointOnScreen([0,1,0])&&(w[3]=90,w[0]=-180,w[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(w[1]=-90,w[0]=-180,w[2]=180),new Mt(w)}getConstrained(e,i){const a=c.ag(e.lat,-c.ah,c.ah),o=c.ag(+i,this.minZoom+Lt(0,a),this.maxZoom);return{center:new c.S(e.lng,a),zoom:o}}calculateCenterFromCameraLngLatAlt(e,i,a,o){return this._helper.calculateCenterFromCameraLngLatAlt(e,i,a,o)}setLocationAtPoint(e,i){const a=$t(this.unprojectScreenPoint(i)),o=$t(e),u=c.bo();c.bA(u);const f=c.bo();c.bx(f,a,u,-this.center.lng*Math.PI/180),c.bw(f,f,u,this.center.lat*Math.PI/180);const _=o[0]*o[0]+o[2]*o[2],y=f[0]*f[0];if(_<y)return;const v=Math.sqrt(_-y),w=-v,P=c.bB(o[0],o[2],f[0],v),S=c.bB(o[0],o[2],f[0],w),I=c.bo();c.bx(I,o,u,-P);const k=c.bB(I[1],I[2],f[1],f[2]),V=c.bo();c.bx(V,o,u,-S);const O=c.bB(V[1],V[2],f[1],f[2]),N=.5*Math.PI,$=k>=-N&&k<=N,q=O>=-N&&O<=N;let Z,Y;if($&&q){const he=this.center.lng*Math.PI/180,ae=this.center.lat*Math.PI/180;c.bC(P,he)+c.bC(k,ae)<c.bC(S,he)+c.bC(O,ae)?(Z=P,Y=k):(Z=S,Y=O)}else if($)Z=P,Y=k;else{if(!q)return;Z=S,Y=O}const K=Z/Math.PI*180,G=Y/Math.PI*180,te=this.center.lat;this.setCenter(new c.S(K,c.ag(G,-90,90))),this.setZoom(this.zoom+Lt(te,this.center.lat))}locationToScreenPoint(e,i){const a=$t(e);if(i){const o=i.getElevationForLngLatZoom(e,this._helper._tileZoom);c.aQ(a,a,1+o/c.bt)}return this._projectSurfacePointToScreen(a)}_projectSurfacePointToScreen(e){const i=c.bu();return c.av(i,[...e,1],this._globeViewProjMatrixNoCorrection),i[0]/=i[3],i[1]/=i[3],new c.P((.5*i[0]+.5)*this.width,(.5*-i[1]+.5)*this.height)}screenPointToMercatorCoordinate(e,i){if(i){const a=i.pointCoordinate(e);if(a)return a}return c.a0.fromLngLat(this.unprojectScreenPoint(e))}screenPointToLocation(e,i){var a;return(a=this.screenPointToMercatorCoordinate(e,i))===null||a===void 0?void 0:a.toLngLat()}isPointOnMapSurface(e,i){const a=this._cameraPosition,o=this.getRayDirectionFromPixel(e);return!!this.rayPlanetIntersection(a,o)}getRayDirectionFromPixel(e){const i=c.bu();i[0]=e.x/this.width*2-1,i[1]=-1*(e.y/this.height*2-1),i[2]=1,i[3]=1,c.av(i,i,this._globeViewProjMatrixNoCorrectionInverted),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3];const a=c.bo();a[0]=i[0]-this._cameraPosition[0],a[1]=i[1]-this._cameraPosition[1],a[2]=i[2]-this._cameraPosition[2];const o=c.bo();return c.aU(o,a),o}isSurfacePointVisible(e){const i=this._cachedClippingPlane;return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]+i[3]>=0}isSurfacePointOnScreen(e){if(!this.isSurfacePointVisible(e))return!1;const i=c.bu();return c.av(i,[...e,1],this._globeViewProjMatrixNoCorrection),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3],i[0]>-1&&i[0]<1&&i[1]>-1&&i[1]<1&&i[2]>-1&&i[2]<1}rayPlanetIntersection(e,i){const a=c.aW(e,i),o=c.bo(),u=c.bo();c.aQ(u,i,a),c.aT(o,e,u);const f=1-c.aW(o,o);if(f<0)return null;const _=c.aW(e,e)-1,y=-a+(a<0?1:-1)*Math.sqrt(f),v=_/y,w=y;return{tMin:Math.min(v,w),tMax:Math.max(v,w)}}unprojectScreenPoint(e){const i=this._cameraPosition,a=this.getRayDirectionFromPixel(e),o=this.rayPlanetIntersection(i,a);if(o){const w=c.bo();c.aR(w,i,[a[0]*o.tMin,a[1]*o.tMin,a[2]*o.tMin]);const P=c.bo();return c.aU(P,w),ms(P)}const u=this._cachedClippingPlane,f=u[0]*a[0]+u[1]*a[1]+u[2]*a[2],_=-c.b0(u,i)/f,y=c.bo();if(_>0)c.aR(y,i,[a[0]*_,a[1]*_,a[2]*_]);else{const w=c.bo();c.aR(w,i,[2*a[0],2*a[1],2*a[2]]);const P=c.b0(this._cachedClippingPlane,w);c.aT(y,w,[this._cachedClippingPlane[0]*P,this._cachedClippingPlane[1]*P,this._cachedClippingPlane[2]*P])}const v=function(w){const P=c.bo();return P[0]=w[0]*-w[3],P[1]=w[1]*-w[3],P[2]=w[2]*-w[3],{center:P,radius:Math.sqrt(1-w[3]*w[3])}}(u);return ms(function(w,P,S){const I=c.bo();c.aT(I,S,w);const k=c.bo();return c.bp(k,w,I,P/c.a_(I)),k}(v.center,v.radius,y))}getMatrixForModel(e,i){const a=c.S.convert(e),o=1/c.bt,u=c.b8();return c.by(u,u,a.lng/180*Math.PI),c.b6(u,u,-a.lat/180*Math.PI),c.M(u,u,[0,0,1+i/c.bt]),c.b6(u,u,.5*Math.PI),c.N(u,u,[o,o,o]),u}getProjectionDataForCustomLayer(e=!0){const i=this.getProjectionData({overscaledTileID:new c.Z(0,0,0,0,0),applyGlobeMatrix:e});return i.tileMercatorCoords=[0,0,1,1],i}getFastPathSimpleProjectionMatrix(e){}}class Ai{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,i,a){return this._helper.interpolatePadding(e,i,a)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,i,a=!0){this._helper.resize(e,i,a)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}overrideNearFarZ(e,i){this._helper.overrideNearFarZ(e,i)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(e,i){this._globeness=e,this._globeLatitudeErrorCorrectionRadians=i,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this._helper=new ds({calcMatrices:()=>{this._calcMatrices()},getConstrained:(e,i)=>this.getConstrained(e,i)}),this._globeness=1,this._mercatorTransform=new Rt,this._verticalPerspectiveTransform=new An}clone(){const e=new Ai;return e._globeness=this._globeness,e._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,e.apply(this),e}apply(e){this._helper.apply(e),this._mercatorTransform.apply(this),this._verticalPerspectiveTransform.apply(this,this._globeLatitudeErrorCorrectionRadians)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(e){const i=this._mercatorTransform.getProjectionData(e),a=this._verticalPerspectiveTransform.getProjectionData(e);return{mainMatrix:this.isGlobeRendering?a.mainMatrix:i.mainMatrix,clippingPlane:a.clippingPlane,tileMercatorCoords:a.tileMercatorCoords,projectionTransition:e.applyGlobeMatrix?this._globeness:0,fallbackMatrix:i.fallbackMatrix}}isLocationOccluded(e){return this.currentTransform.isLocationOccluded(e)}transformLightDirection(e){return this.currentTransform.transformLightDirection(e)}getPixelScale(){return c.bj(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return c.bj(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(e,i,a){const o=this._mercatorTransform.getPitchedTextCorrection(e,i,a),u=this._verticalPerspectiveTransform.getPitchedTextCorrection(e,i,a);return c.bj(o,u,this._globeness)}projectTileCoordinates(e,i,a,o){return this.currentTransform.projectTileCoordinates(e,i,a,o)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform.apply(this,this._globeLatitudeErrorCorrectionRadians),this._helper._nearZ=this._verticalPerspectiveTransform.nearZ,this._helper._farZ=this._verticalPerspectiveTransform.farZ,this._mercatorTransform.apply(this,!0,this.isGlobeRendering),this._helper._nearZ=this._mercatorTransform.nearZ,this._helper._farZ=this._mercatorTransform.farZ)}calculateFogMatrix(e){return this.currentTransform.calculateFogMatrix(e)}getVisibleUnwrappedCoordinates(e){return this.currentTransform.getVisibleUnwrappedCoordinates(e)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(e){this._mercatorTransform.recalculateZoomAndCenter(e),this._verticalPerspectiveTransform.recalculateZoomAndCenter(e)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(e,i){return this.currentTransform.lngLatToCameraDepth(e,i)}populateCache(e){this._mercatorTransform.populateCache(e),this._verticalPerspectiveTransform.populateCache(e)}getBounds(){return this.currentTransform.getBounds()}getConstrained(e,i){return this.currentTransform.getConstrained(e,i)}calculateCenterFromCameraLngLatAlt(e,i,a,o){return this._helper.calculateCenterFromCameraLngLatAlt(e,i,a,o)}setLocationAtPoint(e,i){if(!this.isGlobeRendering)return this._mercatorTransform.setLocationAtPoint(e,i),void this.apply(this._mercatorTransform);this._verticalPerspectiveTransform.setLocationAtPoint(e,i),this.apply(this._verticalPerspectiveTransform)}locationToScreenPoint(e,i){return this.currentTransform.locationToScreenPoint(e,i)}screenPointToMercatorCoordinate(e,i){return this.currentTransform.screenPointToMercatorCoordinate(e,i)}screenPointToLocation(e,i){return this.currentTransform.screenPointToLocation(e,i)}isPointOnMapSurface(e,i){return this.currentTransform.isPointOnMapSurface(e,i)}getRayDirectionFromPixel(e){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(e)}getMatrixForModel(e,i){return this.currentTransform.getMatrixForModel(e,i)}getProjectionDataForCustomLayer(e=!0){const i=this._mercatorTransform.getProjectionDataForCustomLayer(e);if(!this.isGlobeRendering)return i;const a=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(e);return a.fallbackMatrix=i.mainMatrix,a}getFastPathSimpleProjectionMatrix(e){return this.currentTransform.getFastPathSimpleProjectionMatrix(e)}}class xi{get useGlobeControls(){return!0}handlePanInertia(e,i){const a=_s(e,i);return Math.abs(a.lng-i.center.lng)>180&&(a.lng=i.center.lng+179.5*Math.sign(a.lng-i.center.lng)),{easingCenter:a,easingOffset:new c.P(0,0)}}handleMapControlsRollPitchBearingZoom(e,i){const a=e.around,o=i.screenPointToLocation(a);e.bearingDelta&&i.setBearing(i.bearing+e.bearingDelta),e.pitchDelta&&i.setPitch(i.pitch+e.pitchDelta),e.rollDelta&&i.setRoll(i.roll+e.rollDelta);const u=i.zoom;e.zoomDelta&&i.setZoom(i.zoom+e.zoomDelta);const f=i.zoom-u;if(f===0)return;const _=c.bz(i.center.lng,o.lng),y=_/(Math.abs(_/180)+1),v=c.bz(i.center.lat,o.lat),w=i.getRayDirectionFromPixel(a),P=i.cameraPosition,S=-1*c.aW(P,w),I=c.bo();c.aR(I,P,[w[0]*S,w[1]*S,w[2]*S]);const k=c.aY(I)-1,V=Math.exp(.5*-Math.max(k-.3,0)),O=Pn(i.worldSize,i.center.lat)/Math.min(i.width,i.height),N=c.bm(O,.9,.5,1,.25),$=(1-c.ae(-f))*Math.min(V,N),q=i.center.lat,Z=i.zoom,Y=new c.S(i.center.lng+y*$,c.ag(i.center.lat+v*$,-c.ah,c.ah));i.setLocationAtPoint(o,a);const K=i.center,G=c.bm(Math.abs(_),45,85,0,1),te=c.bm(O,.75,.35,0,1),he=Math.pow(Math.max(G,te),.25),ae=c.bz(K.lng,Y.lng),oe=c.bz(K.lat,Y.lat);i.setCenter(new c.S(K.lng+ae*he,K.lat+oe*he).wrap()),i.setZoom(Z+Lt(q,i.center.lat))}handleMapControlsPan(e,i,a){if(!e.panDelta)return;const o=i.center.lat,u=i.zoom;i.setCenter(_s(e.panDelta,i).wrap()),i.setZoom(u+Lt(o,i.center.lat))}cameraForBoxAndBearing(e,i,a,o,u){const f=vt(e,i,a,o,u),_=i.left/u.width*2-1,y=(u.width-i.right)/u.width*2-1,v=i.top/u.height*-2+1,w=(u.height-i.bottom)/u.height*-2+1,P=c.bz(a.getWest(),a.getEast())<0,S=P?a.getEast():a.getWest(),I=P?a.getWest():a.getEast(),k=Math.max(a.getNorth(),a.getSouth()),V=Math.min(a.getNorth(),a.getSouth()),O=S+.5*c.bz(S,I),N=k+.5*c.bz(k,V),$=u.clone();$.setCenter(f.center),$.setBearing(f.bearing),$.setPitch(0),$.setRoll(0),$.setZoom(f.zoom);const q=$.modelViewProjectionMatrix,Z=[$t(a.getNorthWest()),$t(a.getNorthEast()),$t(a.getSouthWest()),$t(a.getSouthEast()),$t(new c.S(I,N)),$t(new c.S(S,N)),$t(new c.S(O,k)),$t(new c.S(O,V))],Y=$t(f.center);let K=Number.POSITIVE_INFINITY;for(const G of Z)_<0&&(K=xi.getLesserNonNegativeNonNull(K,xi.solveVectorScale(G,Y,q,"x",_))),y>0&&(K=xi.getLesserNonNegativeNonNull(K,xi.solveVectorScale(G,Y,q,"x",y))),v>0&&(K=xi.getLesserNonNegativeNonNull(K,xi.solveVectorScale(G,Y,q,"y",v))),w<0&&(K=xi.getLesserNonNegativeNonNull(K,xi.solveVectorScale(G,Y,q,"y",w)));if(Number.isFinite(K)&&K!==0)return f.zoom=$.zoom+c.aj(K),f;ai()}handleJumpToCenterZoom(e,i){const a=e.center.lat,o=e.getConstrained(i.center?c.S.convert(i.center):e.center,e.zoom).center;e.setCenter(o.wrap());const u=i.zoom!==void 0?+i.zoom:e.zoom+Lt(a,o.lat);e.zoom!==u&&e.setZoom(u)}handleEaseTo(e,i){const a=e.zoom,o=e.center,u=e.padding,f={roll:e.roll,pitch:e.pitch,bearing:e.bearing},_={roll:i.roll===void 0?e.roll:i.roll,pitch:i.pitch===void 0?e.pitch:i.pitch,bearing:i.bearing===void 0?e.bearing:i.bearing},y=i.zoom!==void 0,v=!e.isPaddingEqual(i.padding);let w=!1;const P=i.center?c.S.convert(i.center):o,S=e.getConstrained(P,a).center;mr(e,S);const I=e.clone();I.setCenter(S),I.setZoom(y?+i.zoom:a+Lt(o.lat,P.lat)),I.setBearing(i.bearing);const k=new c.P(c.ag(e.centerPoint.x+i.offsetAsPoint.x,0,e.width),c.ag(e.centerPoint.y+i.offsetAsPoint.y,0,e.height));I.setLocationAtPoint(S,k);const V=(i.offset&&i.offsetAsPoint.mag())>0?I.center:S,O=y?+i.zoom:a+Lt(o.lat,V.lat),N=a+Lt(o.lat,0),$=O+Lt(V.lat,0),q=c.bz(o.lng,V.lng),Z=c.bz(o.lat,V.lat),Y=c.ae($-N);return w=O!==a,{easeFunc:K=>{if(c.bd(f,_)||Ut({startEulerAngles:f,endEulerAngles:_,tr:e,k:K,useSlerp:f.roll!=_.roll}),v&&e.interpolatePadding(u,i.padding,K),i.around)c.w("Easing around a point is not supported under globe projection."),e.setLocationAtPoint(i.around,i.aroundPoint);else{const G=$>N?Math.min(2,Y):Math.max(.5,Y),te=Math.pow(G,1-K),he=Cn(o,q,Z,K*te);e.setCenter(he.wrap())}if(w){const G=c.C.number(N,$,K)+Lt(0,e.center.lat);e.setZoom(G)}},isZooming:w,elevationCenter:V}}handleFlyTo(e,i){const a=i.zoom!==void 0,o=e.center,u=e.zoom,f=e.padding,_=!e.isPaddingEqual(i.padding),y=e.getConstrained(c.S.convert(i.center||i.locationAtOffset),u).center,v=a?+i.zoom:e.zoom+Lt(e.center.lat,y.lat),w=e.clone();w.setCenter(y),w.setZoom(v),w.setBearing(i.bearing);const P=new c.P(c.ag(e.centerPoint.x+i.offsetAsPoint.x,0,e.width),c.ag(e.centerPoint.y+i.offsetAsPoint.y,0,e.height));w.setLocationAtPoint(y,P);const S=w.center;mr(e,S);const I=function(Z,Y,K){const G=$t(Y),te=$t(K),he=c.aW(G,te),ae=Math.acos(he),oe=fs(Z);return ae/(2*Math.PI)*oe}(e,o,S),k=u+Lt(o.lat,0),V=v+Lt(S.lat,0),O=c.ae(V-k);let N;if(typeof i.minZoom=="number"){const Z=+i.minZoom+Lt(S.lat,0),Y=Math.min(Z,k,V)+Lt(0,S.lat),K=e.getConstrained(S,Y).zoom+Lt(S.lat,0);N=c.ae(K-k)}const $=c.bz(o.lng,S.lng),q=c.bz(o.lat,S.lat);return{easeFunc:(Z,Y,K,G)=>{const te=Cn(o,$,q,K);_&&e.interpolatePadding(f,i.padding,Z);const he=Z===1?S:te;e.setCenter(he.wrap());const ae=k+c.aj(Y);e.setZoom(Z===1?v:ae+Lt(0,he.lat))},scaleOfZoom:O,targetCenter:S,scaleOfMinZoom:N,pixelPathLength:I}}static solveVectorScale(e,i,a,o,u){const f=o==="x"?[a[0],a[4],a[8],a[12]]:[a[1],a[5],a[9],a[13]],_=[a[3],a[7],a[11],a[15]],y=e[0]*f[0]+e[1]*f[1]+e[2]*f[2],v=e[0]*_[0]+e[1]*_[1]+e[2]*_[2],w=i[0]*f[0]+i[1]*f[1]+i[2]*f[2],P=i[0]*_[0]+i[1]*_[1]+i[2]*_[2];return w+u*v===y+u*P||_[3]*(y-w)+f[3]*(P-v)+y*P==w*v?null:(w+f[3]-u*P-u*_[3])/(w-y-u*P+u*v)}static getLesserNonNegativeNonNull(e,i){return i!==null&&i>=0&&i<e?i:e}}class so{constructor(e){this._globe=e,this._mercatorCameraHelper=new aa,this._verticalPerspectiveCameraHelper=new xi}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(e,i){return this.currentHelper.handlePanInertia(e,i)}handleMapControlsRollPitchBearingZoom(e,i){return this.currentHelper.handleMapControlsRollPitchBearingZoom(e,i)}handleMapControlsPan(e,i,a){this.currentHelper.handleMapControlsPan(e,i,a)}cameraForBoxAndBearing(e,i,a,o,u){return this.currentHelper.cameraForBoxAndBearing(e,i,a,o,u)}handleJumpToCenterZoom(e,i){this.currentHelper.handleJumpToCenterZoom(e,i)}handleEaseTo(e,i){return this.currentHelper.handleEaseTo(e,i)}handleFlyTo(e,i){return this.currentHelper.handleFlyTo(e,i)}}const ys=(h,e)=>c.y(h,e&&e.filter(i=>i.identifier!=="source.canvas")),En=c.bD();class ao extends c.E{constructor(e,i={}){super(),this._rtlPluginLoaded=()=>{for(const a in this.sourceCaches){const o=this.sourceCaches[a].getSource().type;o!=="vector"&&o!=="geojson"||this.sourceCaches[a].reload()}},this.map=e,this.dispatcher=new Xr(Cr(),e._getMapId()),this.dispatcher.registerMessageHandler("GG",(a,o)=>this.getGlyphs(a,o)),this.dispatcher.registerMessageHandler("GI",(a,o)=>this.getImages(a,o)),this.imageManager=new Ks,this.imageManager.setEventedParent(this),this.glyphManager=new Li(e._requestManager,i.localIdeographFontFamily),this.lineAtlas=new yn(256,512),this.crossTileSymbolIndex=new ra,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new c.bE,this._loaded=!1,this._availableImages=[],this._globalState={},this._resetUpdates(),this.dispatcher.broadcast("SR",c.bF()),Mi().on(lr,this._rtlPluginLoaded),this.on("data",a=>{if(a.dataType!=="source"||a.sourceDataType!=="metadata")return;const o=this.sourceCaches[a.sourceId];if(!o)return;const u=o.getSource();if(u&&u.vectorLayerIds)for(const f in this._layers){const _=this._layers[f];_.source===u.id&&this._validateLayer(_)}})}setGlobalStateProperty(e,i){var a,o,u;this._checkLoaded();const f=i===null?(u=(o=(a=this.stylesheet.state)===null||a===void 0?void 0:a[e])===null||o===void 0?void 0:o.default)!==null&&u!==void 0?u:null:i;if(c.bG(f,this._globalState[e]))return this;this._globalState[e]=f;const _=this._findGlobalStateAffectedSources([e]);for(const y in this.sourceCaches)_.has(y)&&(this._reloadSource(y),this._changed=!0)}getGlobalState(){return this._globalState}setGlobalState(e){this._checkLoaded();const i=[];for(const o in e)!c.bG(this._globalState[o],e[o].default)&&(i.push(o),this._globalState[o]=e[o].default);const a=this._findGlobalStateAffectedSources(i);for(const o in this.sourceCaches)a.has(o)&&(this._reloadSource(o),this._changed=!0)}_findGlobalStateAffectedSources(e){if(e.length===0)return new Set;const i=new Set;for(const a in this._layers){const o=this._layers[a],u=o.getLayoutAffectingGlobalStateRefs();for(const f of e)u.has(f)&&i.add(o.source)}return i}loadURL(e,i={},a){this.fire(new c.l("dataloading",{dataType:"style"})),i.validate=typeof i.validate!="boolean"||i.validate;const o=this.map._requestManager.transformRequest(e,"Style");this._loadStyleRequest=new AbortController;const u=this._loadStyleRequest;c.j(o,this._loadStyleRequest).then(f=>{this._loadStyleRequest=null,this._load(f.data,i,a)}).catch(f=>{this._loadStyleRequest=null,f&&!u.signal.aborted&&this.fire(new c.k(f))})}loadJSON(e,i={},a){this.fire(new c.l("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,Ge.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,i.validate=i.validate!==!1,this._load(e,i,a)}).catch(()=>{})}loadEmpty(){this.fire(new c.l("dataloading",{dataType:"style"})),this._load(En,{validate:!1})}_load(e,i,a){var o,u,f;const _=i.transformStyle?i.transformStyle(a,e):e;if(!i.validate||!ys(this,c.z(_))){this._loaded=!0,this.stylesheet=_;for(const y in _.sources)this.addSource(y,_.sources[y],{validate:!1});_.sprite?this._loadSprite(_.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(_.glyphs),this._createLayers(),this.light=new gn(this.stylesheet.light),this._setProjectionInternal(((o=this.stylesheet.projection)===null||o===void 0?void 0:o.type)||"mercator"),this.sky=new Js(this.stylesheet.sky),this.map.setTerrain((u=this.stylesheet.terrain)!==null&&u!==void 0?u:null),this.setGlobalState((f=this.stylesheet.state)!==null&&f!==void 0?f:null),this.fire(new c.l("data",{dataType:"style"})),this.fire(new c.l("style.load"))}}_createLayers(){const e=c.bH(this.stylesheet.layers);this.dispatcher.broadcast("SL",e),this._order=e.map(i=>i.id),this._layers={},this._serializedLayers=null;for(const i of e){const a=c.bI(i);a.setEventedParent(this,{layer:{id:i.id}}),this._layers[i.id]=a}}_loadSprite(e,i=!1,a=void 0){let o;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(u,f,_,y){return c._(this,void 0,void 0,function*(){const v=Pt(u),w=_>1?"@2x":"",P={},S={};for(const{id:I,url:k}of v){const V=f.transformRequest(Ki(k,w,".json"),"SpriteJSON");P[I]=c.j(V,y);const O=f.transformRequest(Ki(k,w,".png"),"SpriteImage");S[I]=ci.getImage(O,y)}return yield Promise.all([...Object.values(P),...Object.values(S)]),function(I,k){return c._(this,void 0,void 0,function*(){const V={};for(const O in I){V[O]={};const N=Ge.getImageCanvasContext((yield k[O]).data),$=(yield I[O]).data;for(const q in $){const{width:Z,height:Y,x:K,y:G,sdf:te,pixelRatio:he,stretchX:ae,stretchY:oe,content:ue,textFitWidth:Me,textFitHeight:Pe}=$[q];V[O][q]={data:null,pixelRatio:he,sdf:te,stretchX:ae,stretchY:oe,content:ue,textFitWidth:Me,textFitHeight:Pe,spriteData:{width:Z,height:Y,x:K,y:G,context:N}}}}return V})}(P,S)})}(e,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(u=>{if(this._spriteRequest=null,u)for(const f in u){this._spritesImagesIds[f]=[];const _=this._spritesImagesIds[f]?this._spritesImagesIds[f].filter(y=>!(y in u)):[];for(const y of _)this.imageManager.removeImage(y),this._changedImages[y]=!0;for(const y in u[f]){const v=f==="default"?y:`${f}:${y}`;this._spritesImagesIds[f].push(v),v in this.imageManager.images?this.imageManager.updateImage(v,u[f][y],!1):this.imageManager.addImage(v,u[f][y]),i&&(this._changedImages[v]=!0)}}}).catch(u=>{this._spriteRequest=null,o=u,this.fire(new c.k(o))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),i&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.l("data",{dataType:"style"})),a&&a(o)})}_unloadSprite(){for(const e of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(e),this._changedImages[e]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.l("data",{dataType:"style"}))}_validateLayer(e){const i=this.sourceCaches[e.source];if(!i)return;const a=e.sourceLayer;if(!a)return;const o=i.getSource();(o.type==="geojson"||o.vectorLayerIds&&o.vectorLayerIds.indexOf(a)===-1)&&this.fire(new c.k(new Error(`Source layer "${a}" does not exist on source "${o.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const e in this.sourceCaches)if(!this.sourceCaches[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(e,i=!1){const a=this._serializedAllLayers();if(!e||e.length===0)return Object.values(i?c.bJ(a):a);const o=[];for(const u of e)if(a[u]){const f=i?c.bJ(a[u]):a[u];o.push(f)}return o}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};const i=Object.keys(this._layers);for(const a of i){const o=this._layers[a];o.type!=="custom"&&(e[a]=o.serialize())}return e}hasTransitions(){var e,i,a;if(!((e=this.light)===null||e===void 0)&&e.hasTransition()||!((i=this.sky)===null||i===void 0)&&i.hasTransition()||!((a=this.projection)===null||a===void 0)&&a.hasTransition())return!0;for(const o in this.sourceCaches)if(this.sourceCaches[o].hasTransition())return!0;for(const o in this._layers)if(this._layers[o].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(e){if(!this._loaded)return;const i=this._changed;if(i){const o=Object.keys(this._updatedLayers),u=Object.keys(this._removedLayers);(o.length||u.length)&&this._updateWorkerLayers(o,u);for(const f in this._updatedSources){const _=this._updatedSources[f];if(_==="reload")this._reloadSource(f);else{if(_!=="clear")throw new Error(`Invalid action ${_}`);this._clearSource(f)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const f in this._updatedPaintProps)this._layers[f].updateTransitions(e);this.light.updateTransitions(e),this.sky.updateTransitions(e),this._resetUpdates()}const a={};for(const o in this.sourceCaches){const u=this.sourceCaches[o];a[o]=u.used,u.used=!1}for(const o of this._order){const u=this._layers[o];u.recalculate(e,this._availableImages),!u.isHidden(e.zoom)&&u.source&&(this.sourceCaches[u.source].used=!0)}for(const o in a){const u=this.sourceCaches[o];!!a[o]!=!!u.used&&u.fire(new c.l("data",{sourceDataType:"visibility",dataType:"source",sourceId:o}))}this.light.recalculate(e),this.sky.recalculate(e),this.projection.recalculate(e),this.z=e.zoom,i&&this.fire(new c.l("data",{dataType:"style"}))}_updateTilesForChangedImages(){const e=Object.keys(this._changedImages);if(e.length){for(const i in this.sourceCaches)this.sourceCaches[i].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,i){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(e,!1),removedIds:i})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,i={}){var a;this._checkLoaded();const o=this.serialize();if(e=i.transformStyle?i.transformStyle(o,e):e,((a=i.validate)===null||a===void 0||a)&&ys(this,c.z(e)))return!1;(e=c.bJ(e)).layers=c.bH(e.layers);const u=c.bK(o,e),f=this._getOperationsToPerform(u);if(f.unimplemented.length>0)throw new Error(`Unimplemented: ${f.unimplemented.join(", ")}.`);if(f.operations.length===0)return!1;for(const _ of f.operations)_();return this.stylesheet=e,this._serializedLayers=null,!0}_getOperationsToPerform(e){const i=[],a=[];for(const o of e)switch(o.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":i.push(()=>this.addLayer.apply(this,o.args));break;case"removeLayer":i.push(()=>this.removeLayer.apply(this,o.args));break;case"setPaintProperty":i.push(()=>this.setPaintProperty.apply(this,o.args));break;case"setLayoutProperty":i.push(()=>this.setLayoutProperty.apply(this,o.args));break;case"setFilter":i.push(()=>this.setFilter.apply(this,o.args));break;case"addSource":i.push(()=>this.addSource.apply(this,o.args));break;case"removeSource":i.push(()=>this.removeSource.apply(this,o.args));break;case"setLayerZoomRange":i.push(()=>this.setLayerZoomRange.apply(this,o.args));break;case"setLight":i.push(()=>this.setLight.apply(this,o.args));break;case"setGeoJSONSourceData":i.push(()=>this.setGeoJSONSourceData.apply(this,o.args));break;case"setGlyphs":i.push(()=>this.setGlyphs.apply(this,o.args));break;case"setSprite":i.push(()=>this.setSprite.apply(this,o.args));break;case"setTerrain":i.push(()=>this.map.setTerrain.apply(this,o.args));break;case"setSky":i.push(()=>this.setSky.apply(this,o.args));break;case"setProjection":this.setProjection.apply(this,o.args);break;case"setGlobalState":i.push(()=>this.setGlobalState.apply(this,o.args));break;case"setTransition":i.push(()=>{});break;default:a.push(o.command)}return{operations:i,unimplemented:a}}addImage(e,i){if(this.getImage(e))return this.fire(new c.k(new Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,i),this._afterImageUpdated(e)}updateImage(e,i){this.imageManager.updateImage(e,i)}getImage(e){return this.imageManager.getImage(e)}removeImage(e){if(!this.getImage(e))return this.fire(new c.k(new Error(`An image named "${e}" does not exist.`)));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.l("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,i,a={}){if(this._checkLoaded(),this.sourceCaches[e]!==void 0)throw new Error(`Source "${e}" already exists.`);if(!i.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(i).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(i.type)>=0&&this._validate(c.z.source,`sources.${e}`,i,null,a))return;this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);const o=this.sourceCaches[e]=new ye(e,i,this.dispatcher);o.style=this,o.setEventedParent(this,()=>({isSourceLoaded:o.loaded(),source:o.serialize(),sourceId:e})),o.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error("There is no source with this ID");for(const a in this._layers)if(this._layers[a].source===e)return this.fire(new c.k(new Error(`Source "${e}" cannot be removed while layer "${a}" is using it.`)));const i=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],i.fire(new c.l("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),i.setEventedParent(null),i.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,i){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error(`There is no source with this ID=${e}`);const a=this.sourceCaches[e].getSource();if(a.type!=="geojson")throw new Error(`geojsonSource.type is ${a.type}, which is !== 'geojson`);a.setData(i),this._changed=!0}getSource(e){return this.sourceCaches[e]&&this.sourceCaches[e].getSource()}addLayer(e,i,a={}){this._checkLoaded();const o=e.id;if(this.getLayer(o))return void this.fire(new c.k(new Error(`Layer "${o}" already exists on this map.`)));let u;if(e.type==="custom"){if(ys(this,c.bL(e)))return;u=c.bI(e)}else{if("source"in e&&typeof e.source=="object"&&(this.addSource(o,e.source),e=c.bJ(e),e=c.e(e,{source:o})),this._validate(c.z.layer,`layers.${o}`,e,{arrayIndex:-1},a))return;u=c.bI(e),this._validateLayer(u),u.setEventedParent(this,{layer:{id:o}})}const f=i?this._order.indexOf(i):this._order.length;if(i&&f===-1)this.fire(new c.k(new Error(`Cannot add layer "${o}" before non-existing layer "${i}".`)));else{if(this._order.splice(f,0,o),this._layerOrderChanged=!0,this._layers[o]=u,this._removedLayers[o]&&u.source&&u.type!=="custom"){const _=this._removedLayers[o];delete this._removedLayers[o],_.type!==u.type?this._updatedSources[u.source]="clear":(this._updatedSources[u.source]="reload",this.sourceCaches[u.source].pause())}this._updateLayer(u),u.onAdd&&u.onAdd(this.map)}}moveLayer(e,i){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new c.k(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===i)return;const a=this._order.indexOf(e);this._order.splice(a,1);const o=i?this._order.indexOf(i):this._order.length;i&&o===-1?this.fire(new c.k(new Error(`Cannot move layer "${e}" before non-existing layer "${i}".`))):(this._order.splice(o,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();const i=this._layers[e];if(!i)return void this.fire(new c.k(new Error(`Cannot remove non-existing layer "${e}".`)));i.setEventedParent(null);const a=this._order.indexOf(e);this._order.splice(a,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=i,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],i.onRemove&&i.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,i,a){this._checkLoaded();const o=this.getLayer(e);o?o.minzoom===i&&o.maxzoom===a||(i!=null&&(o.minzoom=i),a!=null&&(o.maxzoom=a),this._updateLayer(o)):this.fire(new c.k(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,i,a={}){this._checkLoaded();const o=this.getLayer(e);if(o){if(!c.bG(o.filter,i))return i==null?(o.setFilter(void 0),void this._updateLayer(o)):void(this._validate(c.z.filter,`layers.${o.id}.filter`,i,null,a)||(o.setFilter(c.bJ(i)),this._updateLayer(o)))}else this.fire(new c.k(new Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return c.bJ(this.getLayer(e).filter)}setLayoutProperty(e,i,a,o={}){this._checkLoaded();const u=this.getLayer(e);u?c.bG(u.getLayoutProperty(i),a)||(u.setLayoutProperty(i,a,o),this._updateLayer(u)):this.fire(new c.k(new Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,i){const a=this.getLayer(e);if(a)return a.getLayoutProperty(i);this.fire(new c.k(new Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,i,a,o={}){this._checkLoaded();const u=this.getLayer(e);u?c.bG(u.getPaintProperty(i),a)||(u.setPaintProperty(i,a,o)&&this._updateLayer(u),this._changed=!0,this._updatedPaintProps[e]=!0,this._serializedLayers=null):this.fire(new c.k(new Error(`Cannot style non-existing layer "${e}".`)))}getPaintProperty(e,i){return this.getLayer(e).getPaintProperty(i)}setFeatureState(e,i){this._checkLoaded();const a=e.source,o=e.sourceLayer,u=this.sourceCaches[a];if(u===void 0)return void this.fire(new c.k(new Error(`The source '${a}' does not exist in the map's style.`)));const f=u.getSource().type;f==="geojson"&&o?this.fire(new c.k(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):f!=="vector"||o?(e.id===void 0&&this.fire(new c.k(new Error("The feature id parameter must be provided."))),u.setFeatureState(o,e.id,i)):this.fire(new c.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,i){this._checkLoaded();const a=e.source,o=this.sourceCaches[a];if(o===void 0)return void this.fire(new c.k(new Error(`The source '${a}' does not exist in the map's style.`)));const u=o.getSource().type,f=u==="vector"?e.sourceLayer:void 0;u!=="vector"||f?i&&typeof e.id!="string"&&typeof e.id!="number"?this.fire(new c.k(new Error("A feature id is required to remove its specific state property."))):o.removeFeatureState(f,e.id,i):this.fire(new c.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();const i=e.source,a=e.sourceLayer,o=this.sourceCaches[i];if(o!==void 0)return o.getSource().type!=="vector"||a?(e.id===void 0&&this.fire(new c.k(new Error("The feature id parameter must be provided."))),o.getFeatureState(a,e.id)):void this.fire(new c.k(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new c.k(new Error(`The source '${i}' does not exist in the map's style.`)))}getTransition(){return c.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const e=c.bM(this.sourceCaches,u=>u.serialize()),i=this._serializeByIds(this._order,!0),a=this.map.getTerrain()||void 0,o=this.stylesheet;return c.bN({version:o.version,name:o.name,metadata:o.metadata,light:o.light,sky:o.sky,center:o.center,zoom:o.zoom,bearing:o.bearing,pitch:o.pitch,sprite:o.sprite,glyphs:o.glyphs,transition:o.transition,projection:o.projection,sources:e,layers:i,terrain:a},u=>u!==void 0)}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&this.sourceCaches[e.source].getSource().type!=="raster"&&(this._updatedSources[e.source]="reload",this.sourceCaches[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){const i=f=>this._layers[f].type==="fill-extrusion",a={},o=[];for(let f=this._order.length-1;f>=0;f--){const _=this._order[f];if(i(_)){a[_]=f;for(const y of e){const v=y[_];if(v)for(const w of v)o.push(w)}}}o.sort((f,_)=>_.intersectionZ-f.intersectionZ);const u=[];for(let f=this._order.length-1;f>=0;f--){const _=this._order[f];if(i(_))for(let y=o.length-1;y>=0;y--){const v=o[y].feature;if(a[v.layer.id]<f)break;u.push(v),o.pop()}else for(const y of e){const v=y[_];if(v)for(const w of v)u.push(w.feature)}}return u}queryRenderedFeatures(e,i,a){i&&i.filter&&this._validate(c.z.filter,"queryRenderedFeatures.filter",i.filter,null,i);const o={};if(i&&i.layers){if(!(Array.isArray(i.layers)||i.layers instanceof Set))return this.fire(new c.k(new Error("parameters.layers must be an Array or a Set of strings"))),[];for(const v of i.layers){const w=this._layers[v];if(!w)return this.fire(new c.k(new Error(`The layer '${v}' does not exist in the map's style and cannot be queried for features.`))),[];o[w.source]=!0}}const u=[];i.availableImages=this._availableImages;const f=this._serializedAllLayers(),_=i.layers instanceof Set?i.layers:Array.isArray(i.layers)?new Set(i.layers):null,y=Object.assign(Object.assign({},i),{layers:_});for(const v in this.sourceCaches)i.layers&&!o[v]||u.push(Ft(this.sourceCaches[v],this._layers,f,e,y,a,this.map.terrain?(w,P,S)=>this.map.terrain.getElevation(w,P,S):void 0));return this.placement&&u.push(function(v,w,P,S,I,k,V){const O={},N=k.queryRenderedSymbols(S),$=[];for(const q of Object.keys(N).map(Number))$.push(V[q]);$.sort(rs);for(const q of $){const Z=q.featureIndex.lookupSymbolFeatures(N[q.bucketInstanceId],w,q.bucketIndex,q.sourceLayerIndex,I.filter,I.layers,I.availableImages,v);for(const Y in Z){const K=O[Y]=O[Y]||[],G=Z[Y];G.sort((te,he)=>{const ae=q.featureSortOrder;if(ae){const oe=ae.indexOf(te.featureIndex);return ae.indexOf(he.featureIndex)-oe}return he.featureIndex-te.featureIndex});for(const te of G)K.push(te)}}return function(q,Z,Y){for(const K in q)for(const G of q[K])Si(G,Y[Z[K].source]);return q}(O,v,P)}(this._layers,f,this.sourceCaches,e,y,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(u)}querySourceFeatures(e,i){i&&i.filter&&this._validate(c.z.filter,"querySourceFeatures.filter",i.filter,null,i);const a=this.sourceCaches[e];return a?function(o,u){const f=o.getRenderableIds().map(v=>o.getTileByID(v)),_=[],y={};for(let v=0;v<f.length;v++){const w=f[v],P=w.tileID.canonical.key;y[P]||(y[P]=!0,w.querySourceFeatures(_,u))}return _}(a,i):[]}getLight(){return this.light.getLight()}setLight(e,i={}){this._checkLoaded();const a=this.light.getLight();let o=!1;for(const f in e)if(!c.bG(e[f],a[f])){o=!0;break}if(!o)return;const u={now:Ge.now(),transition:c.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,i),this.light.updateTransitions(u)}getProjection(){var e;return(e=this.stylesheet)===null||e===void 0?void 0:e.projection}setProjection(e){if(this._checkLoaded(),this.projection){if(this.projection.name===e.type)return;this.projection.destroy(),delete this.projection}this.stylesheet.projection=e,this._setProjectionInternal(e.type)}getSky(){var e;return(e=this.stylesheet)===null||e===void 0?void 0:e.sky}setSky(e,i={}){this._checkLoaded();const a=this.getSky();let o=!1;if(!e&&!a)return;if(e&&!a)o=!0;else if(!e&&a)o=!0;else for(const f in e)if(!c.bG(e[f],a[f])){o=!0;break}if(!o)return;const u={now:Ge.now(),transition:c.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=e,this.sky.setSky(e,i),this.sky.updateTransitions(u)}_setProjectionInternal(e){const i=function(a){if(Array.isArray(a)){const o=new ps({type:a});return{projection:o,transform:new Ai,cameraHelper:new so(o)}}switch(a){case"mercator":return{projection:new to,transform:new Rt,cameraHelper:new aa};case"globe":{const o=new ps({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:o,transform:new Ai,cameraHelper:new so(o)}}case"vertical-perspective":return{projection:new yl,transform:new An,cameraHelper:new xi};default:return c.w(`Unknown projection name: ${a}. Falling back to mercator projection.`),{projection:new to,transform:new Rt,cameraHelper:new aa}}}(e);this.projection=i.projection,this.map.migrateProjection(i.transform,i.cameraHelper);for(const a in this.sourceCaches)this.sourceCaches[a].reload()}_validate(e,i,a,o,u={}){return(!u||u.validate!==!1)&&ys(this,e.call(c.z,c.e({key:i,style:this.serialize(),value:a,styleSpec:c.v},o)))}_remove(e=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),Mi().off(lr,this._rtlPluginLoaded);for(const i in this._layers)this._layers[i].setEventedParent(null);for(const i in this.sourceCaches){const a=this.sourceCaches[i];a.setEventedParent(null),a.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),e&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(e)}_clearSource(e){this.sourceCaches[e].clearTiles()}_reloadSource(e){this.sourceCaches[e].resume(),this.sourceCaches[e].reload()}_updateSources(e){for(const i in this.sourceCaches)this.sourceCaches[i].update(e,this.map.terrain)}_generateCollisionBoxes(){for(const e in this.sourceCaches)this._reloadSource(e)}_updatePlacement(e,i,a,o,u=!1){let f=!1,_=!1;const y={};for(const v of this._order){const w=this._layers[v];if(w.type!=="symbol")continue;if(!y[w.source]){const S=this.sourceCaches[w.source];y[w.source]=S.getRenderableIds(!0).map(I=>S.getTileByID(I)).sort((I,k)=>k.tileID.overscaledZ-I.tileID.overscaledZ||(I.tileID.isLessThan(k.tileID)?-1:1))}const P=this.crossTileSymbolIndex.addLayer(w,y[w.source],e.center.lng);f=f||P}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((u=u||this._layerOrderChanged||a===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(Ge.now(),e.zoom))&&(this.pauseablePlacement=new _l(e,this.map.terrain,this._order,u,i,a,o,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,y),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(Ge.now()),_=!0),f&&this.pauseablePlacement.placement.setStale()),_||f)for(const v of this._order){const w=this._layers[v];w.type==="symbol"&&this.placement.updateLayerOpacities(w,y[w.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(Ge.now())}_releaseSymbolFadeTiles(){for(const e in this.sourceCaches)this.sourceCaches[e].releaseSymbolFadeTiles()}getImages(e,i){return c._(this,void 0,void 0,function*(){const a=yield this.imageManager.getImages(i.icons);this._updateTilesForChangedImages();const o=this.sourceCaches[i.source];return o&&o.setDependencies(i.tileID.key,i.type,i.icons),a})}getGlyphs(e,i){return c._(this,void 0,void 0,function*(){const a=yield this.glyphManager.getGlyphs(i.stacks),o=this.sourceCaches[i.source];return o&&o.setDependencies(i.tileID.key,i.type,[""]),a})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,i={}){this._checkLoaded(),e&&this._validate(c.z.glyphs,"glyphs",e,null,i)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}addSprite(e,i,a={},o){this._checkLoaded();const u=[{id:e,url:i}],f=[...Pt(this.stylesheet.sprite),...u];this._validate(c.z.sprite,"sprite",f,null,a)||(this.stylesheet.sprite=f,this._loadSprite(u,!0,o))}removeSprite(e){this._checkLoaded();const i=Pt(this.stylesheet.sprite);if(i.find(a=>a.id===e)){if(this._spritesImagesIds[e])for(const a of this._spritesImagesIds[e])this.imageManager.removeImage(a),this._changedImages[a]=!0;i.splice(i.findIndex(a=>a.id===e),1),this.stylesheet.sprite=i.length>0?i:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.l("data",{dataType:"style"}))}else this.fire(new c.k(new Error(`Sprite "${e}" doesn't exists on this map.`)))}getSprite(){return Pt(this.stylesheet.sprite)}setSprite(e,i={},a){this._checkLoaded(),e&&this._validate(c.z.sprite,"sprite",e,null,i)||(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,a):(this._unloadSprite(),a&&a(null)))}}var Mc=c.aI([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Ic{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,i,a,o,u,f,_,y,v){this.context=e;let w=this.boundPaintVertexBuffers.length!==o.length;for(let P=0;!w&&P<o.length;P++)this.boundPaintVertexBuffers[P]!==o[P]&&(w=!0);!this.vao||this.boundProgram!==i||this.boundLayoutVertexBuffer!==a||w||this.boundIndexBuffer!==u||this.boundVertexOffset!==f||this.boundDynamicVertexBuffer!==_||this.boundDynamicVertexBuffer2!==y||this.boundDynamicVertexBuffer3!==v?this.freshBind(i,a,o,u,f,_,y,v):(e.bindVertexArray.set(this.vao),_&&_.bind(),u&&u.dynamicDraw&&u.bind(),y&&y.bind(),v&&v.bind())}freshBind(e,i,a,o,u,f,_,y){const v=e.numAttributes,w=this.context,P=w.gl;this.vao&&this.destroy(),this.vao=w.createVertexArray(),w.bindVertexArray.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=i,this.boundPaintVertexBuffers=a,this.boundIndexBuffer=o,this.boundVertexOffset=u,this.boundDynamicVertexBuffer=f,this.boundDynamicVertexBuffer2=_,this.boundDynamicVertexBuffer3=y,i.enableAttributes(P,e);for(const S of a)S.enableAttributes(P,e);f&&f.enableAttributes(P,e),_&&_.enableAttributes(P,e),y&&y.enableAttributes(P,e),i.bind(),i.setVertexAttribPointers(P,e,u);for(const S of a)S.bind(),S.setVertexAttribPointers(P,e,u);f&&(f.bind(),f.setVertexAttribPointers(P,e,u)),o&&o.bind(),_&&(_.bind(),_.setVertexAttribPointers(P,e,u)),y&&(y.bind(),y.setVertexAttribPointers(P,e,u)),w.currentNumAttributes=v}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const Cc=(h,e,i,a,o)=>({u_texture:0,u_ele_delta:h,u_fog_matrix:e,u_fog_color:i?i.properties.get("fog-color"):c.be.white,u_fog_ground_blend:i?i.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:o?0:i?i.calculateFogBlendOpacity(a):0,u_horizon_color:i?i.properties.get("horizon-color"):c.be.white,u_horizon_fog_blend:i?i.properties.get("horizon-fog-blend"):1,u_is_globe_mode:o?1:0}),Ac={mainMatrix:"u_projection_matrix",tileMercatorCoords:"u_projection_tile_mercator_coords",clippingPlane:"u_projection_clipping_plane",projectionTransition:"u_projection_transition",fallbackMatrix:"u_projection_fallback_matrix"};function oa(h){const e=[];for(let i=0;i<h.length;i++){if(h[i]===null)continue;const a=h[i].split(" ");e.push(a.pop())}return e}class la{constructor(e,i,a,o,u,f,_,y,v=[]){const w=e.gl;this.program=w.createProgram();const P=oa(i.staticAttributes),S=a?a.getBinderAttributes():[],I=P.concat(S),k=ir.prelude.staticUniforms?oa(ir.prelude.staticUniforms):[],V=_.staticUniforms?oa(_.staticUniforms):[],O=i.staticUniforms?oa(i.staticUniforms):[],N=a?a.getBinderUniforms():[],$=k.concat(V).concat(O).concat(N),q=[];for(const ae of $)q.indexOf(ae)<0&&q.push(ae);const Z=a?a.defines():[];hi(w)&&Z.unshift("#version 300 es"),u&&Z.push("#define OVERDRAW_INSPECTOR;"),f&&Z.push("#define TERRAIN3D;"),y&&Z.push(y),v&&Z.push(...v);let Y=Z.concat(ir.prelude.fragmentSource,_.fragmentSource,i.fragmentSource).join(`
|
|
740
|
-
`),K=Z.concat(ir.prelude.vertexSource,_.vertexSource,i.vertexSource).join(`
|
|
741
|
-
`);hi(w)||(Y=function(ae){return ae.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")}(Y),K=function(ae){return ae.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")}(K));const G=w.createShader(w.FRAGMENT_SHADER);if(w.isContextLost())return void(this.failedToCreate=!0);if(w.shaderSource(G,Y),w.compileShader(G),!w.getShaderParameter(G,w.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${w.getShaderInfoLog(G)}`);w.attachShader(this.program,G);const te=w.createShader(w.VERTEX_SHADER);if(w.isContextLost())return void(this.failedToCreate=!0);if(w.shaderSource(te,K),w.compileShader(te),!w.getShaderParameter(te,w.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${w.getShaderInfoLog(te)}`);w.attachShader(this.program,te),this.attributes={};const he={};this.numAttributes=I.length;for(let ae=0;ae<this.numAttributes;ae++)I[ae]&&(w.bindAttribLocation(this.program,ae,I[ae]),this.attributes[I[ae]]=ae);if(w.linkProgram(this.program),!w.getProgramParameter(this.program,w.LINK_STATUS))throw new Error(`Program failed to link: ${w.getProgramInfoLog(this.program)}`);w.deleteShader(te),w.deleteShader(G);for(let ae=0;ae<q.length;ae++){const oe=q[ae];if(oe&&!he[oe]){const ue=w.getUniformLocation(this.program,oe);ue&&(he[oe]=ue)}}this.fixedUniforms=o(e,he),this.terrainUniforms=((ae,oe)=>({u_depth:new c.bO(ae,oe.u_depth),u_terrain:new c.bO(ae,oe.u_terrain),u_terrain_dim:new c.bf(ae,oe.u_terrain_dim),u_terrain_matrix:new c.bQ(ae,oe.u_terrain_matrix),u_terrain_unpack:new c.bR(ae,oe.u_terrain_unpack),u_terrain_exaggeration:new c.bf(ae,oe.u_terrain_exaggeration)}))(e,he),this.projectionUniforms=((ae,oe)=>({u_projection_matrix:new c.bQ(ae,oe.u_projection_matrix),u_projection_tile_mercator_coords:new c.bR(ae,oe.u_projection_tile_mercator_coords),u_projection_clipping_plane:new c.bR(ae,oe.u_projection_clipping_plane),u_projection_transition:new c.bf(ae,oe.u_projection_transition),u_projection_fallback_matrix:new c.bQ(ae,oe.u_projection_fallback_matrix)}))(e,he),this.binderUniforms=a?a.getUniforms(e,he):[]}draw(e,i,a,o,u,f,_,y,v,w,P,S,I,k,V,O,N,$,q){const Z=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(a),e.setStencilMode(o),e.setColorMode(u),e.setCullFace(f),y){e.activeTexture.set(Z.TEXTURE2),Z.bindTexture(Z.TEXTURE_2D,y.depthTexture),e.activeTexture.set(Z.TEXTURE3),Z.bindTexture(Z.TEXTURE_2D,y.texture);for(const K in this.terrainUniforms)this.terrainUniforms[K].set(y[K])}if(v)for(const K in v)this.projectionUniforms[Ac[K]].set(v[K]);if(_)for(const K in this.fixedUniforms)this.fixedUniforms[K].set(_[K]);O&&O.setUniforms(e,this.binderUniforms,k,{zoom:V});let Y=0;switch(i){case Z.LINES:Y=2;break;case Z.TRIANGLES:Y=3;break;case Z.LINE_STRIP:Y=1}for(const K of I.get()){const G=K.vaos||(K.vaos={});(G[w]||(G[w]=new Ic)).bind(e,this,P,O?O.getPaintVertexBuffers():[],S,K.vertexOffset,N,$,q),Z.drawElements(i,K.primitiveLength*Y,Z.UNSIGNED_SHORT,K.primitiveOffset*Y*2)}}}function ca(h,e,i){const a=1/c.aB(i,1,e.transform.tileZoom),o=Math.pow(2,i.tileID.overscaledZ),u=i.tileSize*Math.pow(2,e.transform.tileZoom)/o,f=u*(i.tileID.canonical.x+i.tileID.wrap*o),_=u*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture.size,u_scale:[a,h.fromScale,h.toScale],u_fade:h.t,u_pixel_coord_upper:[f>>16,_>>16],u_pixel_coord_lower:[65535&f,65535&_]}}const xs=(h,e,i,a)=>{const o=h.style.light,u=o.properties.get("position"),f=[u.x,u.y,u.z],_=c.bU();o.properties.get("anchor")==="viewport"&&c.bV(_,h.transform.bearingInRadians),c.bW(f,f,_);const y=h.transform.transformLightDirection(f),v=o.properties.get("color");return{u_lightpos:f,u_lightpos_globe:y,u_lightintensity:o.properties.get("intensity"),u_lightcolor:[v.r,v.g,v.b],u_vertical_gradient:+e,u_opacity:i,u_fill_translate:a}},oo=(h,e,i,a,o,u,f)=>c.e(xs(h,e,i,a),ca(u,h,f),{u_height_factor:-Math.pow(2,o.overscaledZ)/f.tileSize/8}),ha=(h,e,i,a)=>c.e(ca(e,h,i),{u_fill_translate:a}),nr=(h,e)=>({u_world:h,u_fill_translate:e}),Ec=(h,e,i,a,o)=>c.e(ha(h,e,i,o),{u_world:a}),lo=(h,e,i,a,o)=>{const u=h.transform;let f,_,y=0;if(i.paint.get("circle-pitch-alignment")==="map"){const v=c.aB(e,1,u.zoom);f=!0,_=[v,v],y=v/(c.$*Math.pow(2,e.tileID.overscaledZ))*2*Math.PI*o}else f=!1,_=u.pixelsToGLUnits;return{u_camera_to_center_distance:u.cameraToCenterDistance,u_scale_with_map:+(i.paint.get("circle-pitch-scale")==="map"),u_pitch_with_map:+f,u_device_pixel_ratio:h.pixelRatio,u_extrude_scale:_,u_globe_extrude_scale:y,u_translate:a}},vs=h=>({u_pixel_extrude_scale:[1/h.width,1/h.height]}),bs=h=>({u_viewport_size:[h.width,h.height]}),vl=(h,e=1)=>({u_color:h,u_overlay:0,u_overlay_scale:e}),ws=(h,e,i,a)=>{const o=c.aB(h,1,e)/(c.$*Math.pow(2,h.tileID.overscaledZ))*2*Math.PI*a;return{u_extrude_scale:c.aB(h,1,e),u_intensity:i,u_globe_extrude_scale:o}},bl=(h,e,i,a)=>{const o=c.L();c.bX(o,0,h.width,h.height,0,0,1);const u=h.context.gl;return{u_matrix:o,u_world:[u.drawingBufferWidth,u.drawingBufferHeight],u_image:i,u_color_ramp:a,u_opacity:e.paint.get("heatmap-opacity")}},zn=(h,e,i)=>{const a=i.paint.get("hillshade-accent-color");let o;switch(i.paint.get("hillshade-method")){case"basic":o=4;break;case"combined":o=1;break;case"igor":o=2;break;case"multidirectional":o=3;break;default:o=0}const u=i.getIlluminationProperties();for(let f=0;f<u.directionRadians.length;f++)i.paint.get("hillshade-illumination-anchor")==="viewport"&&(u.directionRadians[f]+=h.transform.bearingInRadians);return{u_image:0,u_latrange:wl(0,e.tileID),u_exaggeration:i.paint.get("hillshade-exaggeration"),u_altitudes:u.altitudeRadians,u_azimuths:u.directionRadians,u_accent:a,u_method:o,u_highlights:u.highlightColor,u_shadows:u.shadowColor}},zc=(h,e)=>{const i=e.stride,a=c.L();return c.bX(a,0,c.$,-c.$,0,0,1),c.M(a,a,[0,-c.$,0]),{u_matrix:a,u_image:1,u_dimension:[i,i],u_zoom:h.overscaledZ,u_unpack:e.getUnpackVector()}};function wl(h,e){const i=Math.pow(2,e.canonical.z),a=e.canonical.y;return[new c.a0(0,a/i).toLngLat().lat,new c.a0(0,(a+1)/i).toLngLat().lat]}const kc=(h,e,i=0)=>({u_image:0,u_unpack:e.getUnpackVector(),u_dimension:[e.stride,e.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:i,u_opacity:h.paint.get("color-relief-opacity")}),ua=(h,e,i,a)=>{const o=h.transform;return{u_translation:uo(h,e,i),u_ratio:a/c.aB(e,1,o.zoom),u_device_pixel_ratio:h.pixelRatio,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},co=(h,e,i,a,o)=>c.e(ua(h,e,i,a),{u_image:0,u_image_height:o}),Tl=(h,e,i,a,o)=>{const u=h.transform,f=ho(e,u);return{u_translation:uo(h,e,i),u_texsize:e.imageAtlasTexture.size,u_ratio:a/c.aB(e,1,u.zoom),u_device_pixel_ratio:h.pixelRatio,u_image:0,u_scale:[f,o.fromScale,o.toScale],u_fade:o.t,u_units_to_pixels:[1/u.pixelsToGLUnits[0],1/u.pixelsToGLUnits[1]]}},Sl=(h,e,i,a,o,u)=>{const f=h.lineAtlas,_=ho(e,h.transform),y=i.layout.get("line-cap")==="round",v=f.getDash(o.from,y),w=f.getDash(o.to,y),P=v.width*u.fromScale,S=w.width*u.toScale;return c.e(ua(h,e,i,a),{u_patternscale_a:[_/P,-v.height/2],u_patternscale_b:[_/S,-w.height/2],u_sdfgamma:f.width/(256*Math.min(P,S)*h.pixelRatio)/2,u_image:0,u_tex_y_a:v.y,u_tex_y_b:w.y,u_mix:u.t})};function ho(h,e){return 1/c.aB(h,1,e.tileZoom)}function uo(h,e,i){return c.aC(h.transform,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const an=(h,e,i,a,o)=>{return{u_tl_parent:h,u_scale_parent:e,u_buffer_scale:1,u_fade_t:i.mix,u_opacity:i.opacity*a.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:a.paint.get("raster-brightness-min"),u_brightness_high:a.paint.get("raster-brightness-max"),u_saturation_factor:(f=a.paint.get("raster-saturation"),f>0?1-1/(1.001-f):-f),u_contrast_factor:(u=a.paint.get("raster-contrast"),u>0?1/(1-u):1+u),u_spin_weights:Pl(a.paint.get("raster-hue-rotate")),u_coords_top:[o[0].x,o[0].y,o[1].x,o[1].y],u_coords_bottom:[o[3].x,o[3].y,o[2].x,o[2].y]};var u,f};function Pl(h){h*=Math.PI/180;const e=Math.sin(h),i=Math.cos(h);return[(2*i+1)/3,(-Math.sqrt(3)*e-i+1)/3,(Math.sqrt(3)*e-i+1)/3]}const po=(h,e,i,a,o,u,f,_,y,v,w,P,S)=>{const I=f.transform;return{u_is_size_zoom_constant:+(h==="constant"||h==="source"),u_is_size_feature_constant:+(h==="constant"||h==="camera"),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:I.cameraToCenterDistance,u_pitch:I.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:I.width/I.height,u_fade_change:f.options.fadeDuration?f.symbolFadeChange:1,u_label_plane_matrix:_,u_coord_matrix:y,u_is_text:+w,u_pitch_with_map:+a,u_is_along_line:o,u_is_variable_anchor:u,u_texsize:P,u_texture:0,u_translation:v,u_pitched_scale:S}},kn=(h,e,i,a,o,u,f,_,y,v,w,P,S,I)=>{const k=f.transform;return c.e(po(h,e,i,a,o,u,f,_,y,v,w,P,I),{u_gamma_scale:a?Math.cos(k.pitch*Math.PI/180)*k.cameraToCenterDistance:1,u_device_pixel_ratio:f.pixelRatio,u_is_halo:1})},Dc=(h,e,i,a,o,u,f,_,y,v,w,P,S)=>c.e(kn(h,e,i,a,o,u,f,_,y,v,!0,w,0,S),{u_texsize_icon:P,u_texture_icon:1}),da=(h,e)=>({u_opacity:h,u_color:e}),Rc=(h,e,i,a,o)=>c.e(function(u,f,_,y){const v=_.imageManager.getPattern(u.from.toString()),w=_.imageManager.getPattern(u.to.toString()),{width:P,height:S}=_.imageManager.getPixelSize(),I=Math.pow(2,y.tileID.overscaledZ),k=y.tileSize*Math.pow(2,_.transform.tileZoom)/I,V=k*(y.tileID.canonical.x+y.tileID.wrap*I),O=k*y.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:v.tl,u_pattern_br_a:v.br,u_pattern_tl_b:w.tl,u_pattern_br_b:w.br,u_texsize:[P,S],u_mix:f.t,u_pattern_size_a:v.displaySize,u_pattern_size_b:w.displaySize,u_scale_a:f.fromScale,u_scale_b:f.toScale,u_tile_units_to_pixels:1/c.aB(y,1,_.transform.tileZoom),u_pixel_coord_upper:[V>>16,O>>16],u_pixel_coord_lower:[65535&V,65535&O]}}(i,o,e,a),{u_opacity:h}),Ml=(h,e)=>{},Il={fillExtrusion:(h,e)=>({u_lightpos:new c.bS(h,e.u_lightpos),u_lightpos_globe:new c.bS(h,e.u_lightpos_globe),u_lightintensity:new c.bf(h,e.u_lightintensity),u_lightcolor:new c.bS(h,e.u_lightcolor),u_vertical_gradient:new c.bf(h,e.u_vertical_gradient),u_opacity:new c.bf(h,e.u_opacity),u_fill_translate:new c.bT(h,e.u_fill_translate)}),fillExtrusionPattern:(h,e)=>({u_lightpos:new c.bS(h,e.u_lightpos),u_lightpos_globe:new c.bS(h,e.u_lightpos_globe),u_lightintensity:new c.bf(h,e.u_lightintensity),u_lightcolor:new c.bS(h,e.u_lightcolor),u_vertical_gradient:new c.bf(h,e.u_vertical_gradient),u_height_factor:new c.bf(h,e.u_height_factor),u_opacity:new c.bf(h,e.u_opacity),u_fill_translate:new c.bT(h,e.u_fill_translate),u_image:new c.bO(h,e.u_image),u_texsize:new c.bT(h,e.u_texsize),u_pixel_coord_upper:new c.bT(h,e.u_pixel_coord_upper),u_pixel_coord_lower:new c.bT(h,e.u_pixel_coord_lower),u_scale:new c.bS(h,e.u_scale),u_fade:new c.bf(h,e.u_fade)}),fill:(h,e)=>({u_fill_translate:new c.bT(h,e.u_fill_translate)}),fillPattern:(h,e)=>({u_image:new c.bO(h,e.u_image),u_texsize:new c.bT(h,e.u_texsize),u_pixel_coord_upper:new c.bT(h,e.u_pixel_coord_upper),u_pixel_coord_lower:new c.bT(h,e.u_pixel_coord_lower),u_scale:new c.bS(h,e.u_scale),u_fade:new c.bf(h,e.u_fade),u_fill_translate:new c.bT(h,e.u_fill_translate)}),fillOutline:(h,e)=>({u_world:new c.bT(h,e.u_world),u_fill_translate:new c.bT(h,e.u_fill_translate)}),fillOutlinePattern:(h,e)=>({u_world:new c.bT(h,e.u_world),u_image:new c.bO(h,e.u_image),u_texsize:new c.bT(h,e.u_texsize),u_pixel_coord_upper:new c.bT(h,e.u_pixel_coord_upper),u_pixel_coord_lower:new c.bT(h,e.u_pixel_coord_lower),u_scale:new c.bS(h,e.u_scale),u_fade:new c.bf(h,e.u_fade),u_fill_translate:new c.bT(h,e.u_fill_translate)}),circle:(h,e)=>({u_camera_to_center_distance:new c.bf(h,e.u_camera_to_center_distance),u_scale_with_map:new c.bO(h,e.u_scale_with_map),u_pitch_with_map:new c.bO(h,e.u_pitch_with_map),u_extrude_scale:new c.bT(h,e.u_extrude_scale),u_device_pixel_ratio:new c.bf(h,e.u_device_pixel_ratio),u_globe_extrude_scale:new c.bf(h,e.u_globe_extrude_scale),u_translate:new c.bT(h,e.u_translate)}),collisionBox:(h,e)=>({u_pixel_extrude_scale:new c.bT(h,e.u_pixel_extrude_scale)}),collisionCircle:(h,e)=>({u_viewport_size:new c.bT(h,e.u_viewport_size)}),debug:(h,e)=>({u_color:new c.bP(h,e.u_color),u_overlay:new c.bO(h,e.u_overlay),u_overlay_scale:new c.bf(h,e.u_overlay_scale)}),depth:Ml,clippingMask:Ml,heatmap:(h,e)=>({u_extrude_scale:new c.bf(h,e.u_extrude_scale),u_intensity:new c.bf(h,e.u_intensity),u_globe_extrude_scale:new c.bf(h,e.u_globe_extrude_scale)}),heatmapTexture:(h,e)=>({u_matrix:new c.bQ(h,e.u_matrix),u_world:new c.bT(h,e.u_world),u_image:new c.bO(h,e.u_image),u_color_ramp:new c.bO(h,e.u_color_ramp),u_opacity:new c.bf(h,e.u_opacity)}),hillshade:(h,e)=>({u_image:new c.bO(h,e.u_image),u_latrange:new c.bT(h,e.u_latrange),u_exaggeration:new c.bf(h,e.u_exaggeration),u_altitudes:new c.bZ(h,e.u_altitudes),u_azimuths:new c.bZ(h,e.u_azimuths),u_accent:new c.bP(h,e.u_accent),u_method:new c.bO(h,e.u_method),u_shadows:new c.bY(h,e.u_shadows),u_highlights:new c.bY(h,e.u_highlights)}),hillshadePrepare:(h,e)=>({u_matrix:new c.bQ(h,e.u_matrix),u_image:new c.bO(h,e.u_image),u_dimension:new c.bT(h,e.u_dimension),u_zoom:new c.bf(h,e.u_zoom),u_unpack:new c.bR(h,e.u_unpack)}),colorRelief:(h,e)=>({u_image:new c.bO(h,e.u_image),u_unpack:new c.bR(h,e.u_unpack),u_dimension:new c.bT(h,e.u_dimension),u_elevation_stops:new c.bO(h,e.u_elevation_stops),u_color_stops:new c.bO(h,e.u_color_stops),u_color_ramp_size:new c.bO(h,e.u_color_ramp_size),u_opacity:new c.bf(h,e.u_opacity)}),line:(h,e)=>({u_translation:new c.bT(h,e.u_translation),u_ratio:new c.bf(h,e.u_ratio),u_device_pixel_ratio:new c.bf(h,e.u_device_pixel_ratio),u_units_to_pixels:new c.bT(h,e.u_units_to_pixels)}),lineGradient:(h,e)=>({u_translation:new c.bT(h,e.u_translation),u_ratio:new c.bf(h,e.u_ratio),u_device_pixel_ratio:new c.bf(h,e.u_device_pixel_ratio),u_units_to_pixels:new c.bT(h,e.u_units_to_pixels),u_image:new c.bO(h,e.u_image),u_image_height:new c.bf(h,e.u_image_height)}),linePattern:(h,e)=>({u_translation:new c.bT(h,e.u_translation),u_texsize:new c.bT(h,e.u_texsize),u_ratio:new c.bf(h,e.u_ratio),u_device_pixel_ratio:new c.bf(h,e.u_device_pixel_ratio),u_image:new c.bO(h,e.u_image),u_units_to_pixels:new c.bT(h,e.u_units_to_pixels),u_scale:new c.bS(h,e.u_scale),u_fade:new c.bf(h,e.u_fade)}),lineSDF:(h,e)=>({u_translation:new c.bT(h,e.u_translation),u_ratio:new c.bf(h,e.u_ratio),u_device_pixel_ratio:new c.bf(h,e.u_device_pixel_ratio),u_units_to_pixels:new c.bT(h,e.u_units_to_pixels),u_patternscale_a:new c.bT(h,e.u_patternscale_a),u_patternscale_b:new c.bT(h,e.u_patternscale_b),u_sdfgamma:new c.bf(h,e.u_sdfgamma),u_image:new c.bO(h,e.u_image),u_tex_y_a:new c.bf(h,e.u_tex_y_a),u_tex_y_b:new c.bf(h,e.u_tex_y_b),u_mix:new c.bf(h,e.u_mix)}),raster:(h,e)=>({u_tl_parent:new c.bT(h,e.u_tl_parent),u_scale_parent:new c.bf(h,e.u_scale_parent),u_buffer_scale:new c.bf(h,e.u_buffer_scale),u_fade_t:new c.bf(h,e.u_fade_t),u_opacity:new c.bf(h,e.u_opacity),u_image0:new c.bO(h,e.u_image0),u_image1:new c.bO(h,e.u_image1),u_brightness_low:new c.bf(h,e.u_brightness_low),u_brightness_high:new c.bf(h,e.u_brightness_high),u_saturation_factor:new c.bf(h,e.u_saturation_factor),u_contrast_factor:new c.bf(h,e.u_contrast_factor),u_spin_weights:new c.bS(h,e.u_spin_weights),u_coords_top:new c.bR(h,e.u_coords_top),u_coords_bottom:new c.bR(h,e.u_coords_bottom)}),symbolIcon:(h,e)=>({u_is_size_zoom_constant:new c.bO(h,e.u_is_size_zoom_constant),u_is_size_feature_constant:new c.bO(h,e.u_is_size_feature_constant),u_size_t:new c.bf(h,e.u_size_t),u_size:new c.bf(h,e.u_size),u_camera_to_center_distance:new c.bf(h,e.u_camera_to_center_distance),u_pitch:new c.bf(h,e.u_pitch),u_rotate_symbol:new c.bO(h,e.u_rotate_symbol),u_aspect_ratio:new c.bf(h,e.u_aspect_ratio),u_fade_change:new c.bf(h,e.u_fade_change),u_label_plane_matrix:new c.bQ(h,e.u_label_plane_matrix),u_coord_matrix:new c.bQ(h,e.u_coord_matrix),u_is_text:new c.bO(h,e.u_is_text),u_pitch_with_map:new c.bO(h,e.u_pitch_with_map),u_is_along_line:new c.bO(h,e.u_is_along_line),u_is_variable_anchor:new c.bO(h,e.u_is_variable_anchor),u_texsize:new c.bT(h,e.u_texsize),u_texture:new c.bO(h,e.u_texture),u_translation:new c.bT(h,e.u_translation),u_pitched_scale:new c.bf(h,e.u_pitched_scale)}),symbolSDF:(h,e)=>({u_is_size_zoom_constant:new c.bO(h,e.u_is_size_zoom_constant),u_is_size_feature_constant:new c.bO(h,e.u_is_size_feature_constant),u_size_t:new c.bf(h,e.u_size_t),u_size:new c.bf(h,e.u_size),u_camera_to_center_distance:new c.bf(h,e.u_camera_to_center_distance),u_pitch:new c.bf(h,e.u_pitch),u_rotate_symbol:new c.bO(h,e.u_rotate_symbol),u_aspect_ratio:new c.bf(h,e.u_aspect_ratio),u_fade_change:new c.bf(h,e.u_fade_change),u_label_plane_matrix:new c.bQ(h,e.u_label_plane_matrix),u_coord_matrix:new c.bQ(h,e.u_coord_matrix),u_is_text:new c.bO(h,e.u_is_text),u_pitch_with_map:new c.bO(h,e.u_pitch_with_map),u_is_along_line:new c.bO(h,e.u_is_along_line),u_is_variable_anchor:new c.bO(h,e.u_is_variable_anchor),u_texsize:new c.bT(h,e.u_texsize),u_texture:new c.bO(h,e.u_texture),u_gamma_scale:new c.bf(h,e.u_gamma_scale),u_device_pixel_ratio:new c.bf(h,e.u_device_pixel_ratio),u_is_halo:new c.bO(h,e.u_is_halo),u_translation:new c.bT(h,e.u_translation),u_pitched_scale:new c.bf(h,e.u_pitched_scale)}),symbolTextAndIcon:(h,e)=>({u_is_size_zoom_constant:new c.bO(h,e.u_is_size_zoom_constant),u_is_size_feature_constant:new c.bO(h,e.u_is_size_feature_constant),u_size_t:new c.bf(h,e.u_size_t),u_size:new c.bf(h,e.u_size),u_camera_to_center_distance:new c.bf(h,e.u_camera_to_center_distance),u_pitch:new c.bf(h,e.u_pitch),u_rotate_symbol:new c.bO(h,e.u_rotate_symbol),u_aspect_ratio:new c.bf(h,e.u_aspect_ratio),u_fade_change:new c.bf(h,e.u_fade_change),u_label_plane_matrix:new c.bQ(h,e.u_label_plane_matrix),u_coord_matrix:new c.bQ(h,e.u_coord_matrix),u_is_text:new c.bO(h,e.u_is_text),u_pitch_with_map:new c.bO(h,e.u_pitch_with_map),u_is_along_line:new c.bO(h,e.u_is_along_line),u_is_variable_anchor:new c.bO(h,e.u_is_variable_anchor),u_texsize:new c.bT(h,e.u_texsize),u_texsize_icon:new c.bT(h,e.u_texsize_icon),u_texture:new c.bO(h,e.u_texture),u_texture_icon:new c.bO(h,e.u_texture_icon),u_gamma_scale:new c.bf(h,e.u_gamma_scale),u_device_pixel_ratio:new c.bf(h,e.u_device_pixel_ratio),u_is_halo:new c.bO(h,e.u_is_halo),u_translation:new c.bT(h,e.u_translation),u_pitched_scale:new c.bf(h,e.u_pitched_scale)}),background:(h,e)=>({u_opacity:new c.bf(h,e.u_opacity),u_color:new c.bP(h,e.u_color)}),backgroundPattern:(h,e)=>({u_opacity:new c.bf(h,e.u_opacity),u_image:new c.bO(h,e.u_image),u_pattern_tl_a:new c.bT(h,e.u_pattern_tl_a),u_pattern_br_a:new c.bT(h,e.u_pattern_br_a),u_pattern_tl_b:new c.bT(h,e.u_pattern_tl_b),u_pattern_br_b:new c.bT(h,e.u_pattern_br_b),u_texsize:new c.bT(h,e.u_texsize),u_mix:new c.bf(h,e.u_mix),u_pattern_size_a:new c.bT(h,e.u_pattern_size_a),u_pattern_size_b:new c.bT(h,e.u_pattern_size_b),u_scale_a:new c.bf(h,e.u_scale_a),u_scale_b:new c.bf(h,e.u_scale_b),u_pixel_coord_upper:new c.bT(h,e.u_pixel_coord_upper),u_pixel_coord_lower:new c.bT(h,e.u_pixel_coord_lower),u_tile_units_to_pixels:new c.bf(h,e.u_tile_units_to_pixels)}),terrain:(h,e)=>({u_texture:new c.bO(h,e.u_texture),u_ele_delta:new c.bf(h,e.u_ele_delta),u_fog_matrix:new c.bQ(h,e.u_fog_matrix),u_fog_color:new c.bP(h,e.u_fog_color),u_fog_ground_blend:new c.bf(h,e.u_fog_ground_blend),u_fog_ground_blend_opacity:new c.bf(h,e.u_fog_ground_blend_opacity),u_horizon_color:new c.bP(h,e.u_horizon_color),u_horizon_fog_blend:new c.bf(h,e.u_horizon_fog_blend),u_is_globe_mode:new c.bf(h,e.u_is_globe_mode)}),terrainDepth:(h,e)=>({u_ele_delta:new c.bf(h,e.u_ele_delta)}),terrainCoords:(h,e)=>({u_texture:new c.bO(h,e.u_texture),u_terrain_coords_id:new c.bf(h,e.u_terrain_coords_id),u_ele_delta:new c.bf(h,e.u_ele_delta)}),projectionErrorMeasurement:(h,e)=>({u_input:new c.bf(h,e.u_input),u_output_expected:new c.bf(h,e.u_output_expected)}),atmosphere:(h,e)=>({u_sun_pos:new c.bS(h,e.u_sun_pos),u_atmosphere_blend:new c.bf(h,e.u_atmosphere_blend),u_globe_position:new c.bS(h,e.u_globe_position),u_globe_radius:new c.bf(h,e.u_globe_radius),u_inv_proj_matrix:new c.bQ(h,e.u_inv_proj_matrix)}),sky:(h,e)=>({u_sky_color:new c.bP(h,e.u_sky_color),u_horizon_color:new c.bP(h,e.u_horizon_color),u_horizon:new c.bT(h,e.u_horizon),u_horizon_normal:new c.bT(h,e.u_horizon_normal),u_sky_horizon_blend:new c.bf(h,e.u_sky_horizon_blend),u_sky_blend:new c.bf(h,e.u_sky_blend)})};class Cl{constructor(e,i,a){this.context=e;const o=e.gl;this.buffer=o.createBuffer(),this.dynamicDraw=!!a,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?o.DYNAMIC_DRAW:o.STATIC_DRAW),this.dynamicDraw||delete i.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){const i=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),i.bufferSubData(i.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Al={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class fo{constructor(e,i,a,o){this.length=i.length,this.attributes=a,this.itemSize=i.bytesPerElement,this.dynamicDraw=o,this.context=e;const u=e.gl;this.buffer=u.createBuffer(),e.bindVertexBuffer.set(this.buffer),u.bufferData(u.ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?u.DYNAMIC_DRAW:u.STATIC_DRAW),this.dynamicDraw||delete i.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw new Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);const i=this.context.gl;this.bind(),i.bufferSubData(i.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,i){for(let a=0;a<this.attributes.length;a++){const o=i.attributes[this.attributes[a].name];o!==void 0&&e.enableVertexAttribArray(o)}}setVertexAttribPointers(e,i,a){for(let o=0;o<this.attributes.length;o++){const u=this.attributes[o],f=i.attributes[u.name];f!==void 0&&e.vertexAttribPointer(f,u.components,e[Al[u.type]],!1,this.itemSize,u.offset+this.itemSize*(a||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class at{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class pa extends at{getDefault(){return c.be.transparent}set(e){const i=this.current;(e.r!==i.r||e.g!==i.g||e.b!==i.b||e.a!==i.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class _r extends at{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class mo extends at{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class _o extends at{getDefault(){return[!0,!0,!0,!0]}set(e){const i=this.current;(e[0]!==i[0]||e[1]!==i[1]||e[2]!==i[2]||e[3]!==i[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class go extends at{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class El extends at{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class yo extends at{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){const i=this.current;(e.func!==i.func||e.ref!==i.ref||e.mask!==i.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}}class on extends at{getDefault(){const e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){const i=this.current;(e[0]!==i[0]||e[1]!==i[1]||e[2]!==i[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}}class xo extends at{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;e?i.enable(i.STENCIL_TEST):i.disable(i.STENCIL_TEST),this.current=e,this.dirty=!1}}class Lc extends at{getDefault(){return[0,1]}set(e){const i=this.current;(e[0]!==i[0]||e[1]!==i[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}}class Bc extends at{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;e?i.enable(i.DEPTH_TEST):i.disable(i.DEPTH_TEST),this.current=e,this.dirty=!1}}class Fc extends at{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class Oc extends at{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;e?i.enable(i.BLEND):i.disable(i.BLEND),this.current=e,this.dirty=!1}}class zl extends at{getDefault(){const e=this.gl;return[e.ONE,e.ZERO]}set(e){const i=this.current;(e[0]!==i[0]||e[1]!==i[1]||this.dirty)&&(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}}class jc extends at{getDefault(){return c.be.transparent}set(e){const i=this.current;(e.r!==i.r||e.g!==i.g||e.b!==i.b||e.a!==i.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class kl extends at{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}}class fa extends at{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;e?i.enable(i.CULL_FACE):i.disable(i.CULL_FACE),this.current=e,this.dirty=!1}}class ma extends at{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class _a extends at{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}class vo extends at{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}}class ln extends at{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class Ts extends at{getDefault(){const e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){const i=this.current;(e[0]!==i[0]||e[1]!==i[1]||e[2]!==i[2]||e[3]!==i[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class Dn extends at{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;i.bindFramebuffer(i.FRAMEBUFFER,e),this.current=e,this.dirty=!1}}class Oi extends at{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;i.bindRenderbuffer(i.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class Dl extends at{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;i.bindTexture(i.TEXTURE_2D,e),this.current=e,this.dirty=!1}}class Rl extends at{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;i.bindBuffer(i.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class bo extends at{getDefault(){return null}set(e){const i=this.gl;i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class cn extends at{getDefault(){return null}set(e){var i;if(e===this.current&&!this.dirty)return;const a=this.gl;hi(a)?a.bindVertexArray(e):(i=a.getExtension("OES_vertex_array_object"))===null||i===void 0||i.bindVertexArrayOES(e),this.current=e,this.dirty=!1}}class ga extends at{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;i.pixelStorei(i.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}}class ya extends at{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}}class Ss extends at{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}}class Rn extends at{constructor(e,i){super(e),this.context=e,this.parent=i}getDefault(){return null}}class Ll extends Rn{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const i=this.gl;i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class Ln extends Rn{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const i=this.gl;i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class Bn extends Rn{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const i=this.gl;i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.RENDERBUFFER,e),this.current=e,this.dirty=!1}}const wo="Framebuffer is not complete";class To{constructor(e,i,a,o,u){this.context=e,this.width=i,this.height=a;const f=e.gl,_=this.framebuffer=f.createFramebuffer();if(this.colorAttachment=new Ll(e,_),o)this.depthAttachment=u?new Bn(e,_):new Ln(e,_);else if(u)throw new Error("Stencil cannot be set without depth");if(f.checkFramebufferStatus(f.FRAMEBUFFER)!==f.FRAMEBUFFER_COMPLETE)throw new Error(wo)}destroy(){const e=this.context.gl,i=this.colorAttachment.get();if(i&&e.deleteTexture(i),this.depthAttachment){const a=this.depthAttachment.get();a&&e.deleteRenderbuffer(a)}e.deleteFramebuffer(this.framebuffer)}}class Qe{constructor(e){var i,a;if(this.gl=e,this.clearColor=new pa(this),this.clearDepth=new _r(this),this.clearStencil=new mo(this),this.colorMask=new _o(this),this.depthMask=new go(this),this.stencilMask=new El(this),this.stencilFunc=new yo(this),this.stencilOp=new on(this),this.stencilTest=new xo(this),this.depthRange=new Lc(this),this.depthTest=new Bc(this),this.depthFunc=new Fc(this),this.blend=new Oc(this),this.blendFunc=new zl(this),this.blendColor=new jc(this),this.blendEquation=new kl(this),this.cullFace=new fa(this),this.cullFaceSide=new ma(this),this.frontFace=new _a(this),this.program=new vo(this),this.activeTexture=new ln(this),this.viewport=new Ts(this),this.bindFramebuffer=new Dn(this),this.bindRenderbuffer=new Oi(this),this.bindTexture=new Dl(this),this.bindVertexBuffer=new Rl(this),this.bindElementBuffer=new bo(this),this.bindVertexArray=new cn(this),this.pixelStoreUnpack=new ga(this),this.pixelStoreUnpackPremultiplyAlpha=new ya(this),this.pixelStoreUnpackFlipY=new Ss(this),this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),hi(e)){this.HALF_FLOAT=e.HALF_FLOAT;const o=e.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(i=e.RGBA16F)!==null&&i!==void 0?i:o?.RGBA16F_EXT,this.RGB16F=(a=e.RGB16F)!==null&&a!==void 0?a:o?.RGB16F_EXT,e.getExtension("EXT_color_buffer_float")}else{e.getExtension("EXT_color_buffer_half_float"),e.getExtension("OES_texture_half_float_linear");const o=e.getExtension("OES_texture_half_float");this.HALF_FLOAT=o?.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(e,i){return new Cl(this,e,i)}createVertexBuffer(e,i,a){return new fo(this,e,i,a)}createRenderbuffer(e,i,a){const o=this.gl,u=o.createRenderbuffer();return this.bindRenderbuffer.set(u),o.renderbufferStorage(o.RENDERBUFFER,e,i,a),this.bindRenderbuffer.set(null),u}createFramebuffer(e,i,a,o){return new To(this,e,i,a,o)}clear({color:e,depth:i,stencil:a}){const o=this.gl;let u=0;e&&(u|=o.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),i!==void 0&&(u|=o.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(i),this.depthMask.set(!0)),a!==void 0&&(u|=o.STENCIL_BUFFER_BIT,this.clearStencil.set(a),this.stencilMask.set(255)),o.clear(u)}setCullFace(e){e.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}setColorMode(e){c.bG(e.blendFunction,rt.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){var e;return hi(this.gl)?this.gl.createVertexArray():(e=this.gl.getExtension("OES_vertex_array_object"))===null||e===void 0?void 0:e.createVertexArrayOES()}deleteVertexArray(e){var i;return hi(this.gl)?this.gl.deleteVertexArray(e):(i=this.gl.getExtension("OES_vertex_array_object"))===null||i===void 0?void 0:i.deleteVertexArrayOES(e)}unbindVAO(){this.bindVertexArray.set(null)}}let hn;function Bl(h,e,i,a,o){const u=h.context,f=h.transform,_=u.gl,y=h.useProgram("collisionBox"),v=[];let w=0,P=0;for(let N=0;N<a.length;N++){const $=a[N],q=e.getTile($).getBucket(i);if(!q)continue;const Z=o?q.textCollisionBox:q.iconCollisionBox,Y=q.collisionCircleArray;Y.length>0&&(v.push({circleArray:Y,circleOffset:P,coord:$}),w+=Y.length/4,P=w),Z&&y.draw(u,_.LINES,qe.disabled,Ne.disabled,h.colorModeForRenderPass(),Ze.disabled,vs(h.transform),h.style.map.terrain&&h.style.map.terrain.getTerrainData($),f.getProjectionData({overscaledTileID:$,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),i.id,Z.layoutVertexBuffer,Z.indexBuffer,Z.segments,null,h.transform.zoom,null,null,Z.collisionVertexBuffer)}if(!o||!v.length)return;const S=h.useProgram("collisionCircle"),I=new c.b_;I.resize(4*w),I._trim();let k=0;for(const N of v)for(let $=0;$<N.circleArray.length/4;$++){const q=4*$,Z=N.circleArray[q+0],Y=N.circleArray[q+1],K=N.circleArray[q+2],G=N.circleArray[q+3];I.emplace(k++,Z,Y,K,G,0),I.emplace(k++,Z,Y,K,G,1),I.emplace(k++,Z,Y,K,G,2),I.emplace(k++,Z,Y,K,G,3)}(!hn||hn.length<2*w)&&(hn=function(N){const $=2*N,q=new c.c0;q.resize($),q._trim();for(let Z=0;Z<$;Z++){const Y=6*Z;q.uint16[Y+0]=4*Z+0,q.uint16[Y+1]=4*Z+1,q.uint16[Y+2]=4*Z+2,q.uint16[Y+3]=4*Z+2,q.uint16[Y+4]=4*Z+3,q.uint16[Y+5]=4*Z+0}return q}(w));const V=u.createIndexBuffer(hn,!0),O=u.createVertexBuffer(I,c.b$.members,!0);for(const N of v){const $=bs(h.transform);S.draw(u,_.TRIANGLES,qe.disabled,Ne.disabled,h.colorModeForRenderPass(),Ze.disabled,$,h.style.map.terrain&&h.style.map.terrain.getTerrainData(N.coord),null,i.id,O,V,c.aL.simpleSegment(0,2*N.circleOffset,N.circleArray.length,N.circleArray.length/2),null,h.transform.zoom,null,null,null)}O.destroy(),V.destroy()}const Fl=c.af(new Float32Array(16));function Ps(h,e,i,a,o,u){const{horizontalAlign:f,verticalAlign:_}=c.aG(h);return new c.P((-(f-.5)*e/o+a[0])*u,(-(_-.5)*i/o+a[1])*u)}function Vc(h,e,i,a,o,u){const f=e.tileAnchorPoint.add(new c.P(e.translation[0],e.translation[1]));if(e.pitchWithMap){let _=a.mult(u);i||(_=_.rotate(-o));const y=f.add(_);return st(y.x,y.y,e.pitchedLabelPlaneMatrix,e.getElevation).point}if(i){const _=Ie(e.tileAnchorPoint.x+1,e.tileAnchorPoint.y,e).point.sub(h),y=Math.atan(_.y/_.x)+(_.x<0?Math.PI:0);return h.add(a.rotate(y))}return h.add(a)}function Nc(h,e,i,a,o,u,f,_,y,v,w,P){const S=h.text.placedSymbolArray,I=h.text.dynamicLayoutVertexArray,k=h.icon.dynamicLayoutVertexArray,V={};I.clear();for(let O=0;O<S.length;O++){const N=S.get(O),$=N.hidden||!N.crossTileID||h.allowVerticalPlacement&&!N.placedOrientation?null:a[N.crossTileID];if($){const q=new c.P(N.anchorX,N.anchorY),Z={getElevation:P,width:o.width,height:o.height,pitchedLabelPlaneMatrix:u,pitchWithMap:i,transform:o,tileAnchorPoint:q,translation:v,unwrappedTileID:w},Y=i?Xe(q.x,q.y,Z):Ie(q.x,q.y,Z),K=Ue(o.cameraToCenterDistance,Y.signedDistanceFromCamera);let G=c.ao(h.textSizeData,_,N)*K/c.aA;i&&(G*=h.tilePixelRatio/f);const{width:te,height:he,anchor:ae,textOffset:oe,textBoxScale:ue}=$,Me=Ps(ae,te,he,oe,ue,G),Pe=o.getPitchedTextCorrection(q.x+v[0],q.y+v[1],w),ve=Vc(Y.point,Z,e,Me,-o.bearingInRadians,Pe),ze=h.allowVerticalPlacement&&N.placedOrientation===c.an.vertical?Math.PI/2:0;for(let We=0;We<N.numGlyphs;We++)c.au(I,ve,ze);y&&N.associatedIconIndex>=0&&(V[N.associatedIconIndex]={shiftedAnchor:ve,angle:ze})}else ur(N.numGlyphs,I)}if(y){k.clear();const O=h.icon.placedSymbolArray;for(let N=0;N<O.length;N++){const $=O.get(N);if($.hidden)ur($.numGlyphs,k);else{const q=V[N];if(q)for(let Z=0;Z<$.numGlyphs;Z++)c.au(k,q.shiftedAnchor,q.angle);else ur($.numGlyphs,k)}}h.icon.dynamicLayoutVertexBuffer.updateData(k)}h.text.dynamicLayoutVertexBuffer.updateData(I)}function Ol(h,e,i){return i.iconsInText&&e?"symbolTextAndIcon":h?"symbolSDF":"symbolIcon"}function jl(h,e,i,a,o,u,f,_,y,v,w,P,S){const I=h.context,k=I.gl,V=h.transform,O=_==="map",N=y==="map",$=_!=="viewport"&&i.layout.get("symbol-placement")!=="point",q=O&&!N&&!$,Z=!i.layout.get("symbol-sort-key").isConstant();let Y=!1;const K=h.getDepthModeForSublayer(0,qe.ReadOnly),G=i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"),te=[],he=V.getCircleRadiusCorrection();for(const ae of a){const oe=e.getTile(ae),ue=oe.getBucket(i);if(!ue)continue;const Me=o?ue.text:ue.icon;if(!Me||!Me.segments.get().length||!Me.hasVisibleVertices)continue;const Pe=Me.programConfigurations.get(i.id),ve=o||ue.sdfIcons,ze=o?ue.textSizeData:ue.iconSizeData,We=N||V.pitch!==0,ot=h.useProgram(Ol(ve,o,ue),Pe),wt=c.am(ze,V.zoom),ht=h.style.map.terrain&&h.style.map.terrain.getTerrainData(ae);let Tt,dt,ut,pt,Qt=[0,0],nt=null;if(o)dt=oe.glyphAtlasTexture,ut=k.LINEAR,Tt=oe.glyphAtlasTexture.size,ue.iconsInText&&(Qt=oe.imageAtlasTexture.size,nt=oe.imageAtlasTexture,pt=We||h.options.rotating||h.options.zooming||ze.kind==="composite"||ze.kind==="camera"?k.LINEAR:k.NEAREST);else{const Et=i.layout.get("icon-size").constantOr(0)!==1||ue.iconsNeedLinear;dt=oe.imageAtlasTexture,ut=ve||h.options.rotating||h.options.zooming||Et||We?k.LINEAR:k.NEAREST,Tt=oe.imageAtlasTexture.size}const Zt=c.aB(oe,1,h.transform.zoom),ei=$e(O,h.transform,Zt),Or=c.L();c.ap(Or,ei);const jr=ft(N,O,h.transform,Zt),Vr=c.aC(V,oe,u,f),or=V.getProjectionData({overscaledTileID:ae,applyGlobeMatrix:!S,applyTerrainMatrix:!0}),js=G&&ue.hasTextData(),Vs=i.layout.get("icon-text-fit")!=="none"&&js&&ue.hasIconData();if($){const Et=h.style.map.terrain?(fi,Ot)=>h.style.map.terrain.getElevation(ae,fi,Ot):null,mt=i.layout.get("text-rotation-alignment")==="map";Nt(ue,h,o,ei,Or,N,v,mt,ae.toUnwrapped(),V.width,V.height,Vr,Et)}const Hn=o&&G||Vs,bi=$||Hn?Fl:N?ei:h.transform.clipSpaceToPixelsMatrix,qi=ve&&i.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Nr;Nr=ve?ue.iconsInText?Dc(ze.kind,wt,q,N,$,Hn,h,bi,jr,Vr,Tt,Qt,he):kn(ze.kind,wt,q,N,$,Hn,h,bi,jr,Vr,o,Tt,0,he):po(ze.kind,wt,q,N,$,Hn,h,bi,jr,Vr,o,Tt,he);const pn={program:ot,buffers:Me,uniformValues:Nr,projectionData:or,atlasTexture:dt,atlasTextureIcon:nt,atlasInterpolation:ut,atlasInterpolationIcon:pt,isSDF:ve,hasHalo:qi};if(Z&&ue.canOverlap){Y=!0;const Et=Me.segments.get();for(const mt of Et)te.push({segments:new c.aL([mt]),sortKey:mt.sortKey,state:pn,terrainData:ht})}else te.push({segments:Me.segments,sortKey:0,state:pn,terrainData:ht})}Y&&te.sort((ae,oe)=>ae.sortKey-oe.sortKey);for(const ae of te){const oe=ae.state;if(I.activeTexture.set(k.TEXTURE0),oe.atlasTexture.bind(oe.atlasInterpolation,k.CLAMP_TO_EDGE),oe.atlasTextureIcon&&(I.activeTexture.set(k.TEXTURE1),oe.atlasTextureIcon&&oe.atlasTextureIcon.bind(oe.atlasInterpolationIcon,k.CLAMP_TO_EDGE)),oe.isSDF){const ue=oe.uniformValues;oe.hasHalo&&(ue.u_is_halo=1,xa(oe.buffers,ae.segments,i,h,oe.program,K,w,P,ue,oe.projectionData,ae.terrainData)),ue.u_is_halo=0}xa(oe.buffers,ae.segments,i,h,oe.program,K,w,P,oe.uniformValues,oe.projectionData,ae.terrainData)}}function xa(h,e,i,a,o,u,f,_,y,v,w){const P=a.context;o.draw(P,P.gl.TRIANGLES,u,f,_,Ze.backCCW,y,w,v,i.id,h.layoutVertexBuffer,h.indexBuffer,e,i.paint,a.transform.zoom,h.programConfigurations.get(i.id),h.dynamicLayoutVertexBuffer,h.opacityVertexBuffer)}function va(h,e,i,a,o){const u=h.context,f=u.gl,_=Ne.disabled,y=new rt([f.ONE,f.ONE],c.be.transparent,[!0,!0,!0,!0]),v=e.getBucket(i);if(!v)return;const w=a.key;let P=i.heatmapFbos.get(w);P||(P=Ms(u,e.tileSize,e.tileSize),i.heatmapFbos.set(w,P)),u.bindFramebuffer.set(P.framebuffer),u.viewport.set([0,0,e.tileSize,e.tileSize]),u.clear({color:c.be.transparent});const S=v.programConfigurations.get(i.id),I=h.useProgram("heatmap",S,!o),k=h.transform.getProjectionData({overscaledTileID:e.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),V=h.style.map.terrain.getTerrainData(a);I.draw(u,f.TRIANGLES,qe.disabled,_,y,Ze.disabled,ws(e,h.transform.zoom,i.paint.get("heatmap-intensity"),1),V,k,i.id,v.layoutVertexBuffer,v.indexBuffer,v.segments,i.paint,h.transform.zoom,S)}function ba(h,e,i,a,o){const u=h.context,f=u.gl,_=h.transform;u.setColorMode(h.colorModeForRenderPass());const y=wa(u,e),v=i.key,w=e.heatmapFbos.get(v);if(!w)return;u.activeTexture.set(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,w.colorAttachment.get()),u.activeTexture.set(f.TEXTURE1),y.bind(f.LINEAR,f.CLAMP_TO_EDGE);const P=_.getProjectionData({overscaledTileID:i,applyTerrainMatrix:o,applyGlobeMatrix:!a});h.useProgram("heatmapTexture").draw(u,f.TRIANGLES,qe.disabled,Ne.disabled,h.colorModeForRenderPass(),Ze.disabled,bl(h,e,0,1),null,P,e.id,h.rasterBoundsBuffer,h.quadTriangleIndexBuffer,h.rasterBoundsSegments,e.paint,_.zoom),w.destroy(),e.heatmapFbos.delete(v)}function Ms(h,e,i){var a,o;const u=h.gl,f=u.createTexture();u.bindTexture(u.TEXTURE_2D,f),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,u.CLAMP_TO_EDGE),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,u.CLAMP_TO_EDGE),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,u.LINEAR),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,u.LINEAR);const _=(a=h.HALF_FLOAT)!==null&&a!==void 0?a:u.UNSIGNED_BYTE,y=(o=h.RGBA16F)!==null&&o!==void 0?o:u.RGBA;u.texImage2D(u.TEXTURE_2D,0,y,e,i,0,u.RGBA,_,null);const v=h.createFramebuffer(e,i,!1,!1);return v.colorAttachment.set(f),v}function wa(h,e){return e.colorRampTexture||(e.colorRampTexture=new c.T(h,e.colorRamp,h.gl.RGBA)),e.colorRampTexture}function So(h,e,i,a,o){if(!i||!a||!a.imageAtlas)return;const u=a.imageAtlas.patternPositions;let f=u[i.to.toString()],_=u[i.from.toString()];if(!f&&_&&(f=_),!_&&f&&(_=f),!f||!_){const y=o.getPaintProperty(e);f=u[y],_=u[y]}f&&_&&h.setConstantPatternPositions(f,_)}function Is(h,e,i,a,o,u,f,_){const y=h.context.gl,v="fill-pattern",w=i.paint.get(v),P=w&&w.constantOr(1),S=i.getCrossfadeParameters();let I,k,V,O,N;const $=h.transform,q=i.paint.get("fill-translate"),Z=i.paint.get("fill-translate-anchor");f?(k=P&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",I=y.LINES):(k=P?"fillPattern":"fill",I=y.TRIANGLES);const Y=w.constantOr(null);for(const K of a){const G=e.getTile(K);if(P&&!G.patternsLoaded())continue;const te=G.getBucket(i);if(!te)continue;const he=te.programConfigurations.get(i.id),ae=h.useProgram(k,he),oe=h.style.map.terrain&&h.style.map.terrain.getTerrainData(K);P&&(h.context.activeTexture.set(y.TEXTURE0),G.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),he.updatePaintBuffers(S)),So(he,v,Y,G,i);const ue=$.getProjectionData({overscaledTileID:K,applyGlobeMatrix:!_,applyTerrainMatrix:!0}),Me=c.aC($,G,q,Z);if(f){O=te.indexBuffer2,N=te.segments2;const ve=[y.drawingBufferWidth,y.drawingBufferHeight];V=k==="fillOutlinePattern"&&P?Ec(h,S,G,ve,Me):nr(ve,Me)}else O=te.indexBuffer,N=te.segments,V=P?ha(h,S,G,Me):{u_fill_translate:Me};const Pe=h.stencilModeForClipping(K);ae.draw(h.context,I,o,Pe,u,Ze.backCCW,V,oe,ue,i.id,te.layoutVertexBuffer,O,N,i.paint,h.transform.zoom,he)}}function Fn(h,e,i,a,o,u,f,_){const y=h.context,v=y.gl,w="fill-extrusion-pattern",P=i.paint.get(w),S=P.constantOr(1),I=i.getCrossfadeParameters(),k=i.paint.get("fill-extrusion-opacity"),V=P.constantOr(null),O=h.transform;for(const N of a){const $=e.getTile(N),q=$.getBucket(i);if(!q)continue;const Z=h.style.map.terrain&&h.style.map.terrain.getTerrainData(N),Y=q.programConfigurations.get(i.id),K=h.useProgram(S?"fillExtrusionPattern":"fillExtrusion",Y);S&&(h.context.activeTexture.set(v.TEXTURE0),$.imageAtlasTexture.bind(v.LINEAR,v.CLAMP_TO_EDGE),Y.updatePaintBuffers(I));const G=O.getProjectionData({overscaledTileID:N,applyGlobeMatrix:!_,applyTerrainMatrix:!0});So(Y,w,V,$,i);const te=c.aC(O,$,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),he=i.paint.get("fill-extrusion-vertical-gradient"),ae=S?oo(h,he,k,te,N,I,$):xs(h,he,k,te);K.draw(y,y.gl.TRIANGLES,o,u,f,Ze.backCCW,ae,Z,G,i.id,q.layoutVertexBuffer,q.indexBuffer,q.segments,i.paint,h.transform.zoom,Y,h.style.map.terrain&&q.centroidVertexBuffer)}}function On(h,e,i,a,o,u,f,_,y){var v;const w=h.style.projection,P=h.context,S=h.transform,I=P.gl,k=[`#define NUM_ILLUMINATION_SOURCES ${i.paint.get("hillshade-highlight-color").values.length}`],V=h.useProgram("hillshade",null,!1,k),O=!h.options.moving;for(const N of a){const $=e.getTile(N),q=$.fbo;if(!q)continue;const Z=w.getMeshFromTileID(P,N.canonical,_,!0,"raster"),Y=(v=h.style.map.terrain)===null||v===void 0?void 0:v.getTerrainData(N);P.activeTexture.set(I.TEXTURE0),I.bindTexture(I.TEXTURE_2D,q.colorAttachment.get());const K=S.getProjectionData({overscaledTileID:N,aligned:O,applyGlobeMatrix:!y,applyTerrainMatrix:!0});V.draw(P,I.TRIANGLES,u,o[N.overscaledZ],f,Ze.backCCW,zn(h,$,i),Y,K,i.id,Z.vertexBuffer,Z.indexBuffer,Z.segments)}}function Cs(h,e,i,a,o,u,f,_,y){var v;const w=h.style.projection,P=h.context,S=h.transform,I=P.gl,k=h.useProgram("colorRelief"),V=!h.options.moving;let O=!0,N=0;for(const $ of a){const q=e.getTile($),Z=q.dem;if(O){const ae=I.getParameter(I.MAX_TEXTURE_SIZE),{elevationTexture:oe,colorTexture:ue}=i.getColorRampTextures(P,ae,Z.getUnpackVector());P.activeTexture.set(I.TEXTURE1),oe.bind(I.NEAREST,I.CLAMP_TO_EDGE),P.activeTexture.set(I.TEXTURE4),ue.bind(I.LINEAR,I.CLAMP_TO_EDGE),O=!1,N=oe.size[0]}if(!Z||!Z.data)continue;const Y=Z.stride,K=Z.getPixels();if(P.activeTexture.set(I.TEXTURE0),P.pixelStoreUnpackPremultiplyAlpha.set(!1),q.demTexture=q.demTexture||h.getTileTexture(Y),q.demTexture){const ae=q.demTexture;ae.update(K,{premultiply:!1}),ae.bind(I.LINEAR,I.CLAMP_TO_EDGE)}else q.demTexture=new c.T(P,K,I.RGBA,{premultiply:!1}),q.demTexture.bind(I.LINEAR,I.CLAMP_TO_EDGE);const G=w.getMeshFromTileID(P,$.canonical,_,!0,"raster"),te=(v=h.style.map.terrain)===null||v===void 0?void 0:v.getTerrainData($),he=S.getProjectionData({overscaledTileID:$,aligned:V,applyGlobeMatrix:!y,applyTerrainMatrix:!0});k.draw(P,I.TRIANGLES,u,o[$.overscaledZ],f,Ze.backCCW,kc(i,q.dem,N),te,he,i.id,G.vertexBuffer,G.indexBuffer,G.segments)}}const Po=[new c.P(0,0),new c.P(c.$,0),new c.P(c.$,c.$),new c.P(0,c.$)];function Dr(h,e,i,a,o,u,f,_,y=!1,v=!1){const w=a[a.length-1].overscaledZ,P=h.context,S=P.gl,I=h.useProgram("raster"),k=h.transform,V=h.style.projection,O=h.colorModeForRenderPass(),N=!h.options.moving;for(const $ of a){const q=h.getDepthModeForSublayer($.overscaledZ-w,i.paint.get("raster-opacity")===1?qe.ReadWrite:qe.ReadOnly,S.LESS),Z=e.getTile($);Z.registerFadeDuration(i.paint.get("raster-fade-duration"));const Y=e.findLoadedParent($,0),K=e.findLoadedSibling($),G=Uc(Z,Y||K||null,e,i,h.transform,h.style.map.terrain);let te,he;const ae=i.paint.get("raster-resampling")==="nearest"?S.NEAREST:S.LINEAR;P.activeTexture.set(S.TEXTURE0),Z.texture.bind(ae,S.CLAMP_TO_EDGE,S.LINEAR_MIPMAP_NEAREST),P.activeTexture.set(S.TEXTURE1),Y?(Y.texture.bind(ae,S.CLAMP_TO_EDGE,S.LINEAR_MIPMAP_NEAREST),te=Math.pow(2,Y.tileID.overscaledZ-Z.tileID.overscaledZ),he=[Z.tileID.canonical.x*te%1,Z.tileID.canonical.y*te%1]):Z.texture.bind(ae,S.CLAMP_TO_EDGE,S.LINEAR_MIPMAP_NEAREST),Z.texture.useMipmap&&P.extTextureFilterAnisotropic&&h.transform.pitch>20&&S.texParameterf(S.TEXTURE_2D,P.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,P.extTextureFilterAnisotropicMax);const oe=h.style.map.terrain&&h.style.map.terrain.getTerrainData($),ue=k.getProjectionData({overscaledTileID:$,aligned:N,applyGlobeMatrix:!v,applyTerrainMatrix:!0}),Me=an(he||[0,0],te||1,G,i,_),Pe=V.getMeshFromTileID(P,$.canonical,u,f,"raster");I.draw(P,S.TRIANGLES,q,o?o[$.overscaledZ]:Ne.disabled,O,y?Ze.frontCCW:Ze.backCCW,Me,oe,ue,i.id,Pe.vertexBuffer,Pe.indexBuffer,Pe.segments)}}function Uc(h,e,i,a,o,u){const f=a.paint.get("raster-fade-duration");if(!u&&f>0){const _=Ge.now(),y=(_-h.timeAdded)/f,v=e?(_-e.timeAdded)/f:-1,w=i.getSource(),P=_e(o,{tileSize:w.tileSize,roundZoom:w.roundZoom}),S=!e||Math.abs(e.tileID.overscaledZ-P)>Math.abs(h.tileID.overscaledZ-P),I=S&&h.refreshedUponExpiration?1:c.ag(S?y:1-v,0,1);return h.refreshedUponExpiration&&y>=1&&(h.refreshedUponExpiration=!1),e?{opacity:1,mix:1-I}:{opacity:I,mix:0}}return{opacity:1,mix:0}}const Vl=new c.be(1,0,0,1),Ta=new c.be(0,1,0,1),Mo=new c.be(0,0,1,1),Nl=new c.be(1,0,1,1),Ul=new c.be(0,1,1,1);function As(h,e,i,a){Pa(h,0,e+i/2,h.transform.width,i,a)}function Sa(h,e,i,a){Pa(h,e-i/2,0,i,h.transform.height,a)}function Pa(h,e,i,a,o,u){const f=h.context,_=f.gl;_.enable(_.SCISSOR_TEST),_.scissor(e*h.pixelRatio,i*h.pixelRatio,a*h.pixelRatio,o*h.pixelRatio),f.clear({color:u}),_.disable(_.SCISSOR_TEST)}function $l(h,e,i){const a=h.context,o=a.gl,u=h.useProgram("debug"),f=qe.disabled,_=Ne.disabled,y=h.colorModeForRenderPass(),v="$debug",w=h.style.map.terrain&&h.style.map.terrain.getTerrainData(i);a.activeTexture.set(o.TEXTURE0);const P=e.getTileByID(i.key).latestRawTileData,S=Math.floor((P&&P.byteLength||0)/1024),I=e.getTile(i).tileSize,k=512/Math.min(I,512)*(i.overscaledZ/h.transform.zoom)*.5;let V=i.canonical.toString();i.overscaledZ!==i.canonical.z&&(V+=` => ${i.overscaledZ}`),function(N,$){N.initDebugOverlayCanvas();const q=N.debugOverlayCanvas,Z=N.context.gl,Y=N.debugOverlayCanvas.getContext("2d");Y.clearRect(0,0,q.width,q.height),Y.shadowColor="white",Y.shadowBlur=2,Y.lineWidth=1.5,Y.strokeStyle="white",Y.textBaseline="top",Y.font="bold 36px Open Sans, sans-serif",Y.fillText($,5,5),Y.strokeText($,5,5),N.debugOverlayTexture.update(q),N.debugOverlayTexture.bind(Z.LINEAR,Z.CLAMP_TO_EDGE)}(h,`${V} ${S}kB`);const O=h.transform.getProjectionData({overscaledTileID:i,applyGlobeMatrix:!0,applyTerrainMatrix:!0});u.draw(a,o.TRIANGLES,f,_,rt.alphaBlended,Ze.disabled,vl(c.be.transparent,k),null,O,v,h.debugBuffer,h.quadTriangleIndexBuffer,h.debugSegments),u.draw(a,o.LINE_STRIP,f,_,y,Ze.disabled,vl(c.be.red),w,O,v,h.debugBuffer,h.tileBorderIndexBuffer,h.debugSegments)}function It(h,e,i,a){const{isRenderingGlobe:o}=a,u=h.context,f=u.gl,_=h.transform,y=h.colorModeForRenderPass(),v=h.getDepthModeFor3D(),w=h.useProgram("terrain");u.bindFramebuffer.set(null),u.viewport.set([0,0,h.width,h.height]);for(const P of i){const S=e.getTerrainMesh(P.tileID),I=h.renderToTexture.getTexture(P),k=e.getTerrainData(P.tileID);u.activeTexture.set(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,I.texture);const V=e.getMeshFrameDelta(_.zoom),O=_.calculateFogMatrix(P.tileID.toUnwrapped()),N=Cc(V,O,h.style.sky,_.pitch,o),$=_.getProjectionData({overscaledTileID:P.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});w.draw(u,f.TRIANGLES,v,Ne.disabled,y,Ze.backCCW,N,k,$,"terrain",S.vertexBuffer,S.indexBuffer,S.segments)}}function Rr(h,e){if(!e.mesh){const i=new c.aK;i.emplaceBack(-1,-1),i.emplaceBack(1,-1),i.emplaceBack(1,1),i.emplaceBack(-1,1);const a=new c.aM;a.emplaceBack(0,1,2),a.emplaceBack(0,2,3),e.mesh=new pr(h.createVertexBuffer(i,fr.members),h.createIndexBuffer(a),c.aL.simpleSegment(0,0,i.length,a.length))}return e.mesh}class ji{constructor(e,i){this.context=new Qe(e),this.transform=i,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:c.af(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=ye.maxUnderzooming+ye.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new ra}resize(e,i,a){if(this.width=Math.floor(e*a),this.height=Math.floor(i*a),this.pixelRatio=a,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const o of this.style._order)this.style._layers[o].resize()}setup(){const e=this.context,i=new c.aK;i.emplaceBack(0,0),i.emplaceBack(c.$,0),i.emplaceBack(0,c.$),i.emplaceBack(c.$,c.$),this.tileExtentBuffer=e.createVertexBuffer(i,fr.members),this.tileExtentSegments=c.aL.simpleSegment(0,0,4,2);const a=new c.aK;a.emplaceBack(0,0),a.emplaceBack(c.$,0),a.emplaceBack(0,c.$),a.emplaceBack(c.$,c.$),this.debugBuffer=e.createVertexBuffer(a,fr.members),this.debugSegments=c.aL.simpleSegment(0,0,4,5);const o=new c.c5;o.emplaceBack(0,0,0,0),o.emplaceBack(c.$,0,c.$,0),o.emplaceBack(0,c.$,0,c.$),o.emplaceBack(c.$,c.$,c.$,c.$),this.rasterBoundsBuffer=e.createVertexBuffer(o,Mc.members),this.rasterBoundsSegments=c.aL.simpleSegment(0,0,4,2);const u=new c.aK;u.emplaceBack(0,0),u.emplaceBack(c.$,0),u.emplaceBack(0,c.$),u.emplaceBack(c.$,c.$),this.rasterBoundsBufferPosOnly=e.createVertexBuffer(u,fr.members),this.rasterBoundsSegmentsPosOnly=c.aL.simpleSegment(0,0,4,5);const f=new c.aK;f.emplaceBack(0,0),f.emplaceBack(1,0),f.emplaceBack(0,1),f.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(f,fr.members),this.viewportSegments=c.aL.simpleSegment(0,0,4,2);const _=new c.c6;_.emplaceBack(0),_.emplaceBack(1),_.emplaceBack(3),_.emplaceBack(2),_.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(_);const y=new c.aM;y.emplaceBack(1,0,2),y.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(y);const v=this.context.gl;this.stencilClearMode=new Ne({func:v.ALWAYS,mask:0},0,255,v.ZERO,v.ZERO,v.ZERO),this.tileExtentMesh=new pr(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){const e=this.context,i=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const a=c.L();c.bX(a,0,this.width,this.height,0,0,1),c.N(a,a,[i.drawingBufferWidth,i.drawingBufferHeight,0]);const o={mainMatrix:a,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:a};this.useProgram("clippingMask",null,!0).draw(e,i.TRIANGLES,qe.disabled,this.stencilClearMode,rt.disabled,Ze.disabled,null,null,o,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,i,a){if(this.currentStencilSource===e.source||!e.isTileClipped()||!i||!i.length)return;this.currentStencilSource=e.source,this.nextStencilID+i.length>256&&this.clearStencil();const o=this.context;o.setColorMode(rt.disabled),o.setDepthMode(qe.disabled);const u={};for(const f of i)u[f.key]=this.nextStencilID++;this._renderTileMasks(u,i,a,!0),this._renderTileMasks(u,i,a,!1),this._tileClippingMaskIDs=u}_renderTileMasks(e,i,a,o){const u=this.context,f=u.gl,_=this.style.projection,y=this.transform,v=this.useProgram("clippingMask");for(const w of i){const P=e[w.key],S=this.style.map.terrain&&this.style.map.terrain.getTerrainData(w),I=_.getMeshFromTileID(this.context,w.canonical,o,!0,"stencil"),k=y.getProjectionData({overscaledTileID:w,applyGlobeMatrix:!a,applyTerrainMatrix:!0});v.draw(u,f.TRIANGLES,qe.disabled,new Ne({func:f.ALWAYS,mask:0},P,255,f.KEEP,f.KEEP,f.REPLACE),rt.disabled,a?Ze.disabled:Ze.backCCW,null,S,k,"$clipping",I.vertexBuffer,I.indexBuffer,I.segments)}}_renderTilesDepthBuffer(){const e=this.context,i=e.gl,a=this.style.projection,o=this.transform,u=this.useProgram("depth"),f=this.getDepthModeFor3D(),_=pe(o,{tileSize:o.tileSize});for(const y of _){const v=this.style.map.terrain&&this.style.map.terrain.getTerrainData(y),w=a.getMeshFromTileID(this.context,y.canonical,!0,!0,"raster"),P=o.getProjectionData({overscaledTileID:y,applyGlobeMatrix:!0,applyTerrainMatrix:!0});u.draw(e,i.TRIANGLES,f,Ne.disabled,rt.disabled,Ze.backCCW,null,v,P,"$clipping",w.vertexBuffer,w.indexBuffer,w.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const e=this.nextStencilID++,i=this.context.gl;return new Ne({func:i.NOTEQUAL,mask:255},e,255,i.KEEP,i.KEEP,i.REPLACE)}stencilModeForClipping(e){const i=this.context.gl;return new Ne({func:i.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,i.KEEP,i.KEEP,i.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(e){const i=this.context.gl,a=e.sort((f,_)=>_.overscaledZ-f.overscaledZ),o=a[a.length-1].overscaledZ,u=a[0].overscaledZ-o+1;if(u>1){this.currentStencilSource=void 0,this.nextStencilID+u>256&&this.clearStencil();const f={};for(let _=0;_<u;_++)f[_+o]=new Ne({func:i.GEQUAL,mask:255},_+this.nextStencilID,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID+=u,[f,a]}return[{[o]:Ne.disabled},a]}stencilConfigForOverlapTwoPass(e){const i=this.context.gl,a=e.sort((f,_)=>_.overscaledZ-f.overscaledZ),o=a[a.length-1].overscaledZ,u=a[0].overscaledZ-o+1;if(this.clearStencil(),u>1){const f={},_={};for(let y=0;y<u;y++)f[y+o]=new Ne({func:i.GREATER,mask:255},u+1+y,255,i.KEEP,i.KEEP,i.REPLACE),_[y+o]=new Ne({func:i.GREATER,mask:255},1+y,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID=2*u+1,[f,_,a]}return this.nextStencilID=3,[{[o]:new Ne({func:i.GREATER,mask:255},2,255,i.KEEP,i.KEEP,i.REPLACE)},{[o]:new Ne({func:i.GREATER,mask:255},1,255,i.KEEP,i.KEEP,i.REPLACE)},a]}colorModeForRenderPass(){const e=this.context.gl;return this._showOverdrawInspector?new rt([e.CONSTANT_COLOR,e.ONE],new c.be(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?rt.unblended:rt.alphaBlended}getDepthModeForSublayer(e,i,a){if(!this.opaquePassEnabledForLayer())return qe.disabled;const o=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new qe(a||this.context.gl.LEQUAL,i,[o,o])}getDepthModeFor3D(){return new qe(this.context.gl.LEQUAL,qe.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,i){var a,o;this.style=e,this.options=i,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(Ge.now()),this.imageManager.beginFrame();const u=this.style._order,f=this.style.sourceCaches,_={},y={},v={},w={isRenderingToTexture:!1,isRenderingGlobe:((a=e.projection)===null||a===void 0?void 0:a.transitionState)>0};for(const S in f){const I=f[S];I.used&&I.prepare(this.context),_[S]=I.getVisibleCoordinates(!1),y[S]=_[S].slice().reverse(),v[S]=I.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let S=0;S<u.length;S++)if(this.style._layers[u[S]].is3D()){this.opaquePassCutoff=S;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const S of u){const I=this.style._layers[S];if(!I.hasOffscreenPass()||I.isHidden(this.transform.zoom))continue;const k=y[I.source];(I.type==="custom"||k.length)&&this.renderLayer(this,f[I.source],I,k,w)}if((o=this.style.projection)===null||o===void 0||o.updateGPUdependent({context:this.context,useProgram:S=>this.useProgram(S)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:i.showOverdrawInspector?c.be.black:c.be.transparent,depth:1}),this.clearStencil(),this.style.sky&&function(S,I){const k=S.context,V=k.gl,O=((K,G,te)=>{const he=Math.cos(G.rollInRadians),ae=Math.sin(G.rollInRadians),oe=L(G),ue=G.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:K.properties.get("sky-color"),u_horizon_color:K.properties.get("horizon-color"),u_horizon:[(G.width/2-oe*ae)*te,(G.height/2+oe*he)*te],u_horizon_normal:[-ae,he],u_sky_horizon_blend:K.properties.get("sky-horizon-blend")*G.height/2*te,u_sky_blend:ue}})(I,S.style.map.transform,S.pixelRatio),N=new qe(V.LEQUAL,qe.ReadWrite,[0,1]),$=Ne.disabled,q=S.colorModeForRenderPass(),Z=S.useProgram("sky"),Y=Rr(k,I);Z.draw(k,V.TRIANGLES,N,$,q,Ze.disabled,O,null,void 0,"sky",Y.vertexBuffer,Y.indexBuffer,Y.segments)}(this,this.style.sky),this._showOverdrawInspector=i.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=u.length-1;this.currentLayer>=0;this.currentLayer--){const S=this.style._layers[u[this.currentLayer]],I=f[S.source],k=_[S.source];this._renderTileClippingMasks(S,k,!1),this.renderLayer(this,I,S,k,w)}this.renderPass="translucent";let P=!1;for(this.currentLayer=0;this.currentLayer<u.length;this.currentLayer++){const S=this.style._layers[u[this.currentLayer]],I=f[S.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(S,w))continue;this.opaquePassEnabledForLayer()||P||(P=!0,w.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());const k=(S.type==="symbol"?v:y)[S.source];this._renderTileClippingMasks(S,_[S.source],!!this.renderToTexture),this.renderLayer(this,I,S,k,w)}if(w.isRenderingGlobe&&function(S,I,k){const V=S.context,O=V.gl,N=S.useProgram("atmosphere"),$=new qe(O.LEQUAL,qe.ReadOnly,[0,1]),q=S.transform,Z=function(ue,Me){const Pe=ue.properties.get("position"),ve=[-Pe.x,-Pe.y,-Pe.z],ze=c.af(new Float64Array(16));return ue.properties.get("anchor")==="map"&&(c.b5(ze,ze,Me.rollInRadians),c.b6(ze,ze,-Me.pitchInRadians),c.b5(ze,ze,Me.bearingInRadians),c.b6(ze,ze,Me.center.lat*Math.PI/180),c.by(ze,ze,-Me.center.lng*Math.PI/180)),c.c4(ve,ve,ze),ve}(k,S.transform),Y=q.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),K=I.properties.get("atmosphere-blend")*Y.projectionTransition;if(K===0)return;const G=Pn(q.worldSize,q.center.lat),te=q.inverseProjectionMatrix,he=new Float64Array(4);he[3]=1,c.av(he,he,q.modelViewProjectionMatrix),he[0]/=he[3],he[1]/=he[3],he[2]/=he[3],he[3]=1,c.av(he,he,te),he[0]/=he[3],he[1]/=he[3],he[2]/=he[3],he[3]=1;const ae=((ue,Me,Pe,ve,ze)=>({u_sun_pos:ue,u_atmosphere_blend:Me,u_globe_position:Pe,u_globe_radius:ve,u_inv_proj_matrix:ze}))(Z,K,[he[0],he[1],he[2]],G,te),oe=Rr(V,I);N.draw(V,O.TRIANGLES,$,Ne.disabled,rt.alphaBlended,Ze.disabled,ae,null,null,"atmosphere",oe.vertexBuffer,oe.indexBuffer,oe.segments)}(this,this.style.sky,this.style.light),this.options.showTileBoundaries){const S=function(I,k){let V=null;const O=Object.values(I._layers).flatMap(Z=>Z.source&&!Z.isHidden(k)?[I.sourceCaches[Z.source]]:[]),N=O.filter(Z=>Z.getSource().type==="vector"),$=O.filter(Z=>Z.getSource().type!=="vector"),q=Z=>{(!V||V.getSource().maxzoom<Z.getSource().maxzoom)&&(V=Z)};return N.forEach(Z=>q(Z)),V||$.forEach(Z=>q(Z)),V}(this.style,this.transform.zoom);S&&function(I,k,V){for(let O=0;O<V.length;O++)$l(I,k,V[O])}(this,S,S.getVisibleCoordinates())}this.options.showPadding&&function(S){const I=S.transform.padding;As(S,S.transform.height-(I.top||0),3,Vl),As(S,I.bottom||0,3,Ta),Sa(S,I.left||0,3,Mo),Sa(S,S.transform.width-(I.right||0),3,Nl);const k=S.transform.centerPoint;(function(V,O,N,$){Pa(V,O-1,N-10,2,20,$),Pa(V,O-10,N-1,20,2,$)})(S,k.x,S.transform.height-k.y,Ul)}(this),this.context.setDefault()}maybeDrawDepthAndCoords(e){if(!this.style||!this.style.map||!this.style.map.terrain)return;const i=this.terrainFacilitator.matrix,a=this.transform.modelViewProjectionMatrix;let o=this.terrainFacilitator.dirty;o||(o=e?!c.c7(i,a):!c.c8(i,a)),o||(o=this.style.map.terrain.sourceCache.anyTilesAfterTime(this.terrainFacilitator.renderTime)),o&&(c.c9(i,a),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(u,f){const _=u.context,y=_.gl,v=u.transform,w=rt.unblended,P=new qe(y.LEQUAL,qe.ReadWrite,[0,1]),S=f.sourceCache.getRenderableTiles(),I=u.useProgram("terrainDepth");_.bindFramebuffer.set(f.getFramebuffer("depth").framebuffer),_.viewport.set([0,0,u.width/devicePixelRatio,u.height/devicePixelRatio]),_.clear({color:c.be.transparent,depth:1});for(const k of S){const V=f.getTerrainMesh(k.tileID),O=f.getTerrainData(k.tileID),N=v.getProjectionData({overscaledTileID:k.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),$={u_ele_delta:f.getMeshFrameDelta(v.zoom)};I.draw(_,y.TRIANGLES,P,Ne.disabled,w,Ze.backCCW,$,O,N,"terrain",V.vertexBuffer,V.indexBuffer,V.segments)}_.bindFramebuffer.set(null),_.viewport.set([0,0,u.width,u.height])}(this,this.style.map.terrain),function(u,f){const _=u.context,y=_.gl,v=u.transform,w=rt.unblended,P=new qe(y.LEQUAL,qe.ReadWrite,[0,1]),S=f.getCoordsTexture(),I=f.sourceCache.getRenderableTiles(),k=u.useProgram("terrainCoords");_.bindFramebuffer.set(f.getFramebuffer("coords").framebuffer),_.viewport.set([0,0,u.width/devicePixelRatio,u.height/devicePixelRatio]),_.clear({color:c.be.transparent,depth:1}),f.coordsIndex=[];for(const V of I){const O=f.getTerrainMesh(V.tileID),N=f.getTerrainData(V.tileID);_.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,S.texture);const $={u_terrain_coords_id:(255-f.coordsIndex.length)/255,u_texture:0,u_ele_delta:f.getMeshFrameDelta(v.zoom)},q=v.getProjectionData({overscaledTileID:V.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});k.draw(_,y.TRIANGLES,P,Ne.disabled,w,Ze.backCCW,$,N,q,"terrain",O.vertexBuffer,O.indexBuffer,O.segments),f.coordsIndex.push(V.tileID.key)}_.bindFramebuffer.set(null),_.viewport.set([0,0,u.width,u.height])}(this,this.style.map.terrain))}renderLayer(e,i,a,o,u){a.isHidden(this.transform.zoom)||(a.type==="background"||a.type==="custom"||(o||[]).length)&&(this.id=a.id,c.ca(a)?function(f,_,y,v,w,P){if(f.renderPass!=="translucent")return;const{isRenderingToTexture:S}=P,I=Ne.disabled,k=f.colorModeForRenderPass();(y._unevaluatedLayout.hasValue("text-variable-anchor")||y._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(V,O,N,$,q,Z,Y,K,G){const te=O.transform,he=O.style.map.terrain,ae=q==="map",oe=Z==="map";for(const ue of V){const Me=$.getTile(ue),Pe=Me.getBucket(N);if(!Pe||!Pe.text||!Pe.text.segments.get().length)continue;const ve=c.am(Pe.textSizeData,te.zoom),ze=c.aB(Me,1,O.transform.zoom),We=$e(ae,O.transform,ze),ot=N.layout.get("icon-text-fit")!=="none"&&Pe.hasIconData();if(ve){const wt=Math.pow(2,te.zoom-Me.tileID.overscaledZ),ht=he?(Tt,dt)=>he.getElevation(ue,Tt,dt):null;Nc(Pe,ae,oe,G,te,We,wt,ve,ot,c.aC(te,Me,Y,K),ue.toUnwrapped(),ht)}}}(v,f,y,_,y.layout.get("text-rotation-alignment"),y.layout.get("text-pitch-alignment"),y.paint.get("text-translate"),y.paint.get("text-translate-anchor"),w),y.paint.get("icon-opacity").constantOr(1)!==0&&jl(f,_,y,v,!1,y.paint.get("icon-translate"),y.paint.get("icon-translate-anchor"),y.layout.get("icon-rotation-alignment"),y.layout.get("icon-pitch-alignment"),y.layout.get("icon-keep-upright"),I,k,S),y.paint.get("text-opacity").constantOr(1)!==0&&jl(f,_,y,v,!0,y.paint.get("text-translate"),y.paint.get("text-translate-anchor"),y.layout.get("text-rotation-alignment"),y.layout.get("text-pitch-alignment"),y.layout.get("text-keep-upright"),I,k,S),_.map.showCollisionBoxes&&(Bl(f,_,y,v,!0),Bl(f,_,y,v,!1))}(e,i,a,o,this.style.placement.variableOffsets,u):c.cb(a)?function(f,_,y,v,w){if(f.renderPass!=="translucent")return;const{isRenderingToTexture:P}=w,S=y.paint.get("circle-opacity"),I=y.paint.get("circle-stroke-width"),k=y.paint.get("circle-stroke-opacity"),V=!y.layout.get("circle-sort-key").isConstant();if(S.constantOr(1)===0&&(I.constantOr(1)===0||k.constantOr(1)===0))return;const O=f.context,N=O.gl,$=f.transform,q=f.getDepthModeForSublayer(0,qe.ReadOnly),Z=Ne.disabled,Y=f.colorModeForRenderPass(),K=[],G=$.getCircleRadiusCorrection();for(let te=0;te<v.length;te++){const he=v[te],ae=_.getTile(he),oe=ae.getBucket(y);if(!oe)continue;const ue=y.paint.get("circle-translate"),Me=y.paint.get("circle-translate-anchor"),Pe=c.aC($,ae,ue,Me),ve=oe.programConfigurations.get(y.id),ze=f.useProgram("circle",ve),We=oe.layoutVertexBuffer,ot=oe.indexBuffer,wt=f.style.map.terrain&&f.style.map.terrain.getTerrainData(he),ht={programConfiguration:ve,program:ze,layoutVertexBuffer:We,indexBuffer:ot,uniformValues:lo(f,ae,y,Pe,G),terrainData:wt,projectionData:$.getProjectionData({overscaledTileID:he,applyGlobeMatrix:!P,applyTerrainMatrix:!0})};if(V){const Tt=oe.segments.get();for(const dt of Tt)K.push({segments:new c.aL([dt]),sortKey:dt.sortKey,state:ht})}else K.push({segments:oe.segments,sortKey:0,state:ht})}V&&K.sort((te,he)=>te.sortKey-he.sortKey);for(const te of K){const{programConfiguration:he,program:ae,layoutVertexBuffer:oe,indexBuffer:ue,uniformValues:Me,terrainData:Pe,projectionData:ve}=te.state;ae.draw(O,N.TRIANGLES,q,Z,Y,Ze.backCCW,Me,Pe,ve,y.id,oe,ue,te.segments,y.paint,f.transform.zoom,he)}}(e,i,a,o,u):c.cc(a)?function(f,_,y,v,w){if(y.paint.get("heatmap-opacity")===0)return;const P=f.context,{isRenderingToTexture:S,isRenderingGlobe:I}=w;if(f.style.map.terrain){for(const k of v){const V=_.getTile(k);_.hasRenderableParent(k)||(f.renderPass==="offscreen"?va(f,V,y,k,I):f.renderPass==="translucent"&&ba(f,y,k,S,I))}P.viewport.set([0,0,f.width,f.height])}else f.renderPass==="offscreen"?function(k,V,O,N){const $=k.context,q=$.gl,Z=k.transform,Y=Ne.disabled,K=new rt([q.ONE,q.ONE],c.be.transparent,[!0,!0,!0,!0]);(function(G,te,he){const ae=G.gl;G.activeTexture.set(ae.TEXTURE1),G.viewport.set([0,0,te.width/4,te.height/4]);let oe=he.heatmapFbos.get(c.c1);oe?(ae.bindTexture(ae.TEXTURE_2D,oe.colorAttachment.get()),G.bindFramebuffer.set(oe.framebuffer)):(oe=Ms(G,te.width/4,te.height/4),he.heatmapFbos.set(c.c1,oe))})($,k,O),$.clear({color:c.be.transparent});for(let G=0;G<N.length;G++){const te=N[G];if(V.hasRenderableParent(te))continue;const he=V.getTile(te),ae=he.getBucket(O);if(!ae)continue;const oe=ae.programConfigurations.get(O.id),ue=k.useProgram("heatmap",oe),Me=Z.getProjectionData({overscaledTileID:te,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),Pe=Z.getCircleRadiusCorrection();ue.draw($,q.TRIANGLES,qe.disabled,Y,K,Ze.backCCW,ws(he,Z.zoom,O.paint.get("heatmap-intensity"),Pe),null,Me,O.id,ae.layoutVertexBuffer,ae.indexBuffer,ae.segments,O.paint,Z.zoom,oe)}$.viewport.set([0,0,k.width,k.height])}(f,_,y,v):f.renderPass==="translucent"&&function(k,V){const O=k.context,N=O.gl;O.setColorMode(k.colorModeForRenderPass());const $=V.heatmapFbos.get(c.c1);$&&(O.activeTexture.set(N.TEXTURE0),N.bindTexture(N.TEXTURE_2D,$.colorAttachment.get()),O.activeTexture.set(N.TEXTURE1),wa(O,V).bind(N.LINEAR,N.CLAMP_TO_EDGE),k.useProgram("heatmapTexture").draw(O,N.TRIANGLES,qe.disabled,Ne.disabled,k.colorModeForRenderPass(),Ze.disabled,bl(k,V,0,1),null,null,V.id,k.viewportBuffer,k.quadTriangleIndexBuffer,k.viewportSegments,V.paint,k.transform.zoom))}(f,y)}(e,i,a,o,u):c.cd(a)?function(f,_,y,v,w){if(f.renderPass!=="translucent")return;const{isRenderingToTexture:P}=w,S=y.paint.get("line-opacity"),I=y.paint.get("line-width");if(S.constantOr(1)===0||I.constantOr(1)===0)return;const k=f.getDepthModeForSublayer(0,qe.ReadOnly),V=f.colorModeForRenderPass(),O=y.paint.get("line-dasharray"),N=y.paint.get("line-pattern"),$=N.constantOr(1),q=y.paint.get("line-gradient"),Z=y.getCrossfadeParameters(),Y=$?"linePattern":O?"lineSDF":q?"lineGradient":"line",K=f.context,G=K.gl,te=f.transform;let he=!0;for(const ae of v){const oe=_.getTile(ae);if($&&!oe.patternsLoaded())continue;const ue=oe.getBucket(y);if(!ue)continue;const Me=ue.programConfigurations.get(y.id),Pe=f.context.program.get(),ve=f.useProgram(Y,Me),ze=he||ve.program!==Pe,We=f.style.map.terrain&&f.style.map.terrain.getTerrainData(ae),ot=N.constantOr(null);if(ot&&oe.imageAtlas){const ut=oe.imageAtlas,pt=ut.patternPositions[ot.to.toString()],Qt=ut.patternPositions[ot.from.toString()];pt&&Qt&&Me.setConstantPatternPositions(pt,Qt)}const wt=te.getProjectionData({overscaledTileID:ae,applyGlobeMatrix:!P,applyTerrainMatrix:!0}),ht=te.getPixelScale(),Tt=$?Tl(f,oe,y,ht,Z):O?Sl(f,oe,y,ht,O,Z):q?co(f,oe,y,ht,ue.lineClipsArray.length):ua(f,oe,y,ht);if($)K.activeTexture.set(G.TEXTURE0),oe.imageAtlasTexture.bind(G.LINEAR,G.CLAMP_TO_EDGE),Me.updatePaintBuffers(Z);else if(O&&(ze||f.lineAtlas.dirty))K.activeTexture.set(G.TEXTURE0),f.lineAtlas.bind(K);else if(q){const ut=ue.gradients[y.id];let pt=ut.texture;if(y.gradientVersion!==ut.version){let Qt=256;if(y.stepInterpolant){const nt=_.getSource().maxzoom,Zt=ae.canonical.z===nt?Math.ceil(1<<f.transform.maxZoom-ae.canonical.z):1;Qt=c.ag(c.c2(ue.maxLineLength/c.$*1024*Zt),256,K.maxTextureSize)}ut.gradient=c.c3({expression:y.gradientExpression(),evaluationKey:"lineProgress",resolution:Qt,image:ut.gradient||void 0,clips:ue.lineClipsArray}),ut.texture?ut.texture.update(ut.gradient):ut.texture=new c.T(K,ut.gradient,G.RGBA),ut.version=y.gradientVersion,pt=ut.texture}K.activeTexture.set(G.TEXTURE0),pt.bind(y.stepInterpolant?G.NEAREST:G.LINEAR,G.CLAMP_TO_EDGE)}const dt=f.stencilModeForClipping(ae);ve.draw(K,G.TRIANGLES,k,dt,V,Ze.disabled,Tt,We,wt,y.id,ue.layoutVertexBuffer,ue.indexBuffer,ue.segments,y.paint,f.transform.zoom,Me,ue.layoutVertexBuffer2),he=!1}}(e,i,a,o,u):c.ce(a)?function(f,_,y,v,w){const P=y.paint.get("fill-color"),S=y.paint.get("fill-opacity");if(S.constantOr(1)===0)return;const{isRenderingToTexture:I}=w,k=f.colorModeForRenderPass(),V=y.paint.get("fill-pattern"),O=f.opaquePassEnabledForLayer()&&!V.constantOr(1)&&P.constantOr(c.be.transparent).a===1&&S.constantOr(0)===1?"opaque":"translucent";if(f.renderPass===O){const N=f.getDepthModeForSublayer(1,f.renderPass==="opaque"?qe.ReadWrite:qe.ReadOnly);Is(f,_,y,v,N,k,!1,I)}if(f.renderPass==="translucent"&&y.paint.get("fill-antialias")){const N=f.getDepthModeForSublayer(y.getPaintProperty("fill-outline-color")?2:0,qe.ReadOnly);Is(f,_,y,v,N,k,!0,I)}}(e,i,a,o,u):c.cf(a)?function(f,_,y,v,w){const P=y.paint.get("fill-extrusion-opacity");if(P===0)return;const{isRenderingToTexture:S}=w;if(f.renderPass==="translucent"){const I=new qe(f.context.gl.LEQUAL,qe.ReadWrite,f.depthRangeFor3D);if(P!==1||y.paint.get("fill-extrusion-pattern").constantOr(1))Fn(f,_,y,v,I,Ne.disabled,rt.disabled,S),Fn(f,_,y,v,I,f.stencilModeFor3D(),f.colorModeForRenderPass(),S);else{const k=f.colorModeForRenderPass();Fn(f,_,y,v,I,Ne.disabled,k,S)}}}(e,i,a,o,u):c.cg(a)?function(f,_,y,v,w){if(f.renderPass!=="offscreen"&&f.renderPass!=="translucent")return;const{isRenderingToTexture:P}=w,S=f.context,I=f.style.projection.useSubdivision,k=f.getDepthModeForSublayer(0,qe.ReadOnly),V=f.colorModeForRenderPass();if(f.renderPass==="offscreen")(function(O,N,$,q,Z,Y,K){const G=O.context,te=G.gl;for(const he of $){const ae=N.getTile(he),oe=ae.dem;if(!oe||!oe.data||!ae.needsHillshadePrepare)continue;const ue=oe.dim,Me=oe.stride,Pe=oe.getPixels();if(G.activeTexture.set(te.TEXTURE1),G.pixelStoreUnpackPremultiplyAlpha.set(!1),ae.demTexture=ae.demTexture||O.getTileTexture(Me),ae.demTexture){const ze=ae.demTexture;ze.update(Pe,{premultiply:!1}),ze.bind(te.NEAREST,te.CLAMP_TO_EDGE)}else ae.demTexture=new c.T(G,Pe,te.RGBA,{premultiply:!1}),ae.demTexture.bind(te.NEAREST,te.CLAMP_TO_EDGE);G.activeTexture.set(te.TEXTURE0);let ve=ae.fbo;if(!ve){const ze=new c.T(G,{width:ue,height:ue,data:null},te.RGBA);ze.bind(te.LINEAR,te.CLAMP_TO_EDGE),ve=ae.fbo=G.createFramebuffer(ue,ue,!0,!1),ve.colorAttachment.set(ze.texture)}G.bindFramebuffer.set(ve.framebuffer),G.viewport.set([0,0,ue,ue]),O.useProgram("hillshadePrepare").draw(G,te.TRIANGLES,Z,Y,K,Ze.disabled,zc(ae.tileID,oe),null,null,q.id,O.rasterBoundsBuffer,O.quadTriangleIndexBuffer,O.rasterBoundsSegments),ae.needsHillshadePrepare=!1}})(f,_,v,y,k,Ne.disabled,V),S.viewport.set([0,0,f.width,f.height]);else if(f.renderPass==="translucent")if(I){const[O,N,$]=f.stencilConfigForOverlapTwoPass(v);On(f,_,y,$,O,k,V,!1,P),On(f,_,y,$,N,k,V,!0,P)}else{const[O,N]=f.getStencilConfigForOverlapAndUpdateStencilID(v);On(f,_,y,N,O,k,V,!1,P)}}(e,i,a,o,u):c.ch(a)?function(f,_,y,v,w){if(f.renderPass!=="translucent"||!v.length)return;const{isRenderingToTexture:P}=w,S=f.style.projection.useSubdivision,I=f.getDepthModeForSublayer(0,qe.ReadOnly),k=f.colorModeForRenderPass();if(S){const[V,O,N]=f.stencilConfigForOverlapTwoPass(v);Cs(f,_,y,N,V,I,k,!1,P),Cs(f,_,y,N,O,I,k,!0,P)}else{const[V,O]=f.getStencilConfigForOverlapAndUpdateStencilID(v);Cs(f,_,y,O,V,I,k,!1,P)}}(e,i,a,o,u):c.ci(a)?function(f,_,y,v,w){if(f.renderPass!=="translucent"||y.paint.get("raster-opacity")===0||!v.length)return;const{isRenderingToTexture:P}=w,S=_.getSource(),I=f.style.projection.useSubdivision;if(S instanceof _i)Dr(f,_,y,v,null,!1,!1,S.tileCoords,S.flippedWindingOrder,P);else if(I){const[k,V,O]=f.stencilConfigForOverlapTwoPass(v);Dr(f,_,y,O,k,!1,!0,Po,!1,P),Dr(f,_,y,O,V,!0,!0,Po,!1,P)}else{const[k,V]=f.getStencilConfigForOverlapAndUpdateStencilID(v);Dr(f,_,y,V,k,!1,!0,Po,!1,P)}}(e,i,a,o,u):c.cj(a)?function(f,_,y,v,w){const P=y.paint.get("background-color"),S=y.paint.get("background-opacity");if(S===0)return;const{isRenderingToTexture:I}=w,k=f.context,V=k.gl,O=f.style.projection,N=f.transform,$=N.tileSize,q=y.paint.get("background-pattern");if(f.isPatternMissing(q))return;const Z=!q&&P.a===1&&S===1&&f.opaquePassEnabledForLayer()?"opaque":"translucent";if(f.renderPass!==Z)return;const Y=Ne.disabled,K=f.getDepthModeForSublayer(0,Z==="opaque"?qe.ReadWrite:qe.ReadOnly),G=f.colorModeForRenderPass(),te=f.useProgram(q?"backgroundPattern":"background"),he=v||pe(N,{tileSize:$,terrain:f.style.map.terrain});q&&(k.activeTexture.set(V.TEXTURE0),f.imageManager.bind(f.context));const ae=y.getCrossfadeParameters();for(const oe of he){const ue=N.getProjectionData({overscaledTileID:oe,applyGlobeMatrix:!I,applyTerrainMatrix:!0}),Me=q?Rc(S,f,q,{tileID:oe,tileSize:$},ae):da(S,P),Pe=f.style.map.terrain&&f.style.map.terrain.getTerrainData(oe),ve=O.getMeshFromTileID(k,oe.canonical,!1,!0,"raster");te.draw(k,V.TRIANGLES,K,Y,G,Ze.backCCW,Me,Pe,ue,y.id,ve.vertexBuffer,ve.indexBuffer,ve.segments)}}(e,0,a,o,u):c.ck(a)&&function(f,_,y,v){const{isRenderingGlobe:w}=v,P=f.context,S=y.implementation,I=f.style.projection,k=f.transform,V=k.getProjectionDataForCustomLayer(w),O={farZ:k.farZ,nearZ:k.nearZ,fov:k.fov*Math.PI/180,modelViewProjectionMatrix:k.modelViewProjectionMatrix,projectionMatrix:k.projectionMatrix,shaderData:{variantName:I.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;
|
|
742
|
-
uniform mat4 u_projection_matrix;
|
|
743
|
-
${I.shaderPreludeCode.vertexSource}`,define:I.shaderDefine},defaultProjectionData:V},N=S.renderingMode?S.renderingMode:"2d";if(f.renderPass==="offscreen"){const $=S.prerender;$&&(f.setCustomLayerDefaults(),P.setColorMode(f.colorModeForRenderPass()),$.call(S,P.gl,O),P.setDirty(),f.setBaseState())}else if(f.renderPass==="translucent"){f.setCustomLayerDefaults(),P.setColorMode(f.colorModeForRenderPass()),P.setStencilMode(Ne.disabled);const $=N==="3d"?f.getDepthModeFor3D():f.getDepthModeForSublayer(0,qe.ReadOnly);P.setDepthMode($),S.render(P.gl,O),P.setDirty(),f.setBaseState(),P.bindFramebuffer.set(null)}}(e,0,a,u))}saveTileTexture(e){const i=this._tileTextures[e.size[0]];i?i.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){const i=this._tileTextures[e];return i&&i.length>0?i.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;const i=this.imageManager.getPattern(e.from.toString()),a=this.imageManager.getPattern(e.to.toString());return!i||!a}useProgram(e,i,a=!1,o=[]){this.cache=this.cache||{};const u=!!this.style.map.terrain,f=this.style.projection,_=a?ir.projectionMercator:f.shaderPreludeCode,y=a?rn:f.shaderDefine,v=e+(i?i.cacheKey:"")+`/${a?eo:f.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(u?"/terrain":"")+(o?`/${o.join("/")}`:"");return this.cache[v]||(this.cache[v]=new la(this.context,ir[e],i,Il[e],this._showOverdrawInspector,u,_,y,o)),this.cache[v]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new c.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:e,drawingBufferHeight:i}=this.context.gl;return this.width!==e||this.height!==i}}function Ma(h,e){let i,a=!1,o=null,u=null;const f=()=>{o=null,a&&(h.apply(u,i),o=setTimeout(f,e),a=!1)};return(..._)=>(a=!0,u=this,i=_,o||f(),o)}class Es{constructor(e){this._getCurrentHash=()=>{const i=window.location.hash.replace("#","");if(this._hashName){let a;return i.split("&").map(o=>o.split("=")).forEach(o=>{o[0]===this._hashName&&(a=o)}),(a&&a[1]||"").split("/")}return i.split("/")},this._onHashChange=()=>{const i=this._getCurrentHash();if(!this._isValidHash(i))return!1;const a=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(i[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+i[2],+i[1]],zoom:+i[0],bearing:a,pitch:+(i[4]||0)}),!0},this._updateHashUnthrottled=()=>{const i=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,i)},this._removeHash=()=>{const i=this._getCurrentHash();if(i.length===0)return;const a=i.join("/");let o=a;o.split("&").length>0&&(o=o.split("&")[0]),this._hashName&&(o=`${this._hashName}=${a}`);let u=window.location.hash.replace(o,"");u.startsWith("#&")?u=u.slice(0,1)+u.slice(2):u==="#"&&(u="");let f=window.location.href.replace(/(#.+)?$/,u);f=f.replace("&&","&"),window.history.replaceState(window.history.state,null,f)},this._updateHash=Ma(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(e){const i=this._map.getCenter(),a=Math.round(100*this._map.getZoom())/100,o=Math.ceil((a*Math.LN2+Math.log(512/360/.5))/Math.LN10),u=Math.pow(10,o),f=Math.round(i.lng*u)/u,_=Math.round(i.lat*u)/u,y=this._map.getBearing(),v=this._map.getPitch();let w="";if(w+=e?`/${f}/${_}/${a}`:`${a}/${_}/${f}`,(y||v)&&(w+="/"+Math.round(10*y)/10),v&&(w+=`/${Math.round(v)}`),this._hashName){const P=this._hashName;let S=!1;const I=window.location.hash.slice(1).split("&").map(k=>{const V=k.split("=")[0];return V===P?(S=!0,`${V}=${w}`):k}).filter(k=>k);return S||I.push(`${P}=${w}`),`#${I.join("&")}`}return`#${w}`}_isValidHash(e){if(e.length<3||e.some(isNaN))return!1;try{new c.S(+e[2],+e[1])}catch{return!1}const i=+e[0],a=+(e[3]||0),o=+(e[4]||0);return i>=this._map.getMinZoom()&&i<=this._map.getMaxZoom()&&a>=-180&&a<=180&&o>=this._map.getMinPitch()&&o<=this._map.getMaxPitch()}}const jn={linearity:.3,easing:c.cl(0,0,.3,1)},Vn=c.e({deceleration:2500,maxSpeed:1400},jn),Io=c.e({deceleration:20,maxSpeed:1400},jn),zs=c.e({deceleration:1e3,maxSpeed:360},jn),Co=c.e({deceleration:1e3,maxSpeed:90},jn),Zl=c.e({deceleration:1e3,maxSpeed:360},jn);class Gl{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:Ge.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,i=Ge.now();for(;e.length>0&&i-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,roll:0,pan:new c.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:u}of this._inertiaBuffer)i.zoom+=u.zoomDelta||0,i.bearing+=u.bearingDelta||0,i.pitch+=u.pitchDelta||0,i.roll+=u.rollDelta||0,u.panDelta&&i.pan._add(u.panDelta),u.around&&(i.around=u.around),u.pinchAround&&(i.pinchAround=u.pinchAround);const a=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,o={};if(i.pan.mag()){const u=Un(i.pan.mag(),a,c.e({},Vn,e||{})),f=i.pan.mult(u.amount/i.pan.mag()),_=this._map.cameraHelper.handlePanInertia(f,this._map.transform);o.center=_.easingCenter,o.offset=_.easingOffset,Nn(o,u)}if(i.zoom){const u=Un(i.zoom,a,Io);o.zoom=this._map.transform.zoom+u.amount,Nn(o,u)}if(i.bearing){const u=Un(i.bearing,a,zs);o.bearing=this._map.transform.bearing+c.ag(u.amount,-179,179),Nn(o,u)}if(i.pitch){const u=Un(i.pitch,a,Co);o.pitch=this._map.transform.pitch+u.amount,Nn(o,u)}if(i.roll){const u=Un(i.roll,a,Zl);o.roll=this._map.transform.roll+c.ag(u.amount,-179,179),Nn(o,u)}if(o.zoom||o.bearing){const u=i.pinchAround===void 0?i.around:i.pinchAround;o.around=u?this._map.unproject(u):this._map.getCenter()}return this.clear(),c.e(o,{noMoveStart:!0})}}function Nn(h,e){(!h.duration||h.duration<e.duration)&&(h.duration=e.duration,h.easing=e.easing)}function Un(h,e,i){const{maxSpeed:a,linearity:o,deceleration:u}=i,f=c.ag(h*o/(e/1e3),-a,a),_=Math.abs(f)/(u*o);return{easing:i.easing,duration:1e3*_,amount:f*(_/2)}}class vi extends c.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,a,o={}){a=a instanceof MouseEvent?a:new MouseEvent(e,a);const u=fe.mousePos(i.getCanvas(),a),f=i.unproject(u);super(e,c.e({point:u,lngLat:f,originalEvent:a},o)),this._defaultPrevented=!1,this.target=i}}class Zi extends c.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,a){const o=e==="touchend"?a.changedTouches:a.touches,u=fe.touchPos(i.getCanvasContainer(),o),f=u.map(y=>i.unproject(y)),_=u.reduce((y,v,w,P)=>y.add(v.div(P.length)),new c.P(0,0));super(e,{points:u,point:_,lngLats:f,lngLat:i.unproject(_),originalEvent:a}),this._defaultPrevented=!1}}class Ao extends c.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,a){super(e,{originalEvent:a}),this._defaultPrevented=!1}}class ql{constructor(e,i){this._map=e,this._clickTolerance=i.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new Ao(e.type,this._map,e))}mousedown(e,i){return this._mousedownPos=i,this._firePreventable(new vi(e.type,this._map,e))}mouseup(e){this._map.fire(new vi(e.type,this._map,e))}click(e,i){this._mousedownPos&&this._mousedownPos.dist(i)>=this._clickTolerance||this._map.fire(new vi(e.type,this._map,e))}dblclick(e){return this._firePreventable(new vi(e.type,this._map,e))}mouseover(e){this._map.fire(new vi(e.type,this._map,e))}mouseout(e){this._map.fire(new vi(e.type,this._map,e))}touchstart(e){return this._firePreventable(new Zi(e.type,this._map,e))}touchmove(e){this._map.fire(new Zi(e.type,this._map,e))}touchend(e){this._map.fire(new Zi(e.type,this._map,e))}touchcancel(e){this._map.fire(new Zi(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Wl{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new vi(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new vi("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new vi(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class $n{constructor(e){this._map=e}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(e){return this.transform.screenPointToLocation(c.P.convert(e),this._map.terrain)}}class Eo{constructor(e,i){this._map=e,this._tr=new $n(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=i.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,i){this.isEnabled()&&e.shiftKey&&e.button===0&&(fe.disableDrag(),this._startPos=this._lastPos=i,this._active=!0)}mousemoveWindow(e,i){if(!this._active)return;const a=i;if(this._lastPos.equals(a)||!this._box&&a.dist(this._startPos)<this._clickTolerance)return;const o=this._startPos;this._lastPos=a,this._box||(this._box=fe.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));const u=Math.min(o.x,a.x),f=Math.max(o.x,a.x),_=Math.min(o.y,a.y),y=Math.max(o.y,a.y);fe.setTransform(this._box,`translate(${u}px,${_}px)`),this._box.style.width=f-u+"px",this._box.style.height=y-_+"px"}mouseupWindow(e,i){if(!this._active||e.button!==0)return;const a=this._startPos,o=i;if(this.reset(),fe.suppressClick(),a.x!==o.x||a.y!==o.y)return this._map.fire(new c.l("boxzoomend",{originalEvent:e})),{cameraAnimation:u=>u.fitScreenCoordinates(a,o,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(fe.remove(this._box),this._box=null),fe.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,i){return this._map.fire(new c.l(e,{originalEvent:i}))}}function Ia(h,e){if(h.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${h.length}, points ${e.length}`);const i={};for(let a=0;a<h.length;a++)i[h[a].identifier]=e[a];return i}class Hl{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,i,a){(this.centroid||a.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=e.timeStamp),a.length===this.numTouches&&(this.centroid=function(o){const u=new c.P(0,0);for(const f of o)u._add(f);return u.div(o.length)}(i),this.touches=Ia(a,i)))}touchmove(e,i,a){if(this.aborted||!this.centroid)return;const o=Ia(a,i);for(const u in this.touches){const f=o[u];(!f||f.dist(this.touches[u])>30)&&(this.aborted=!0)}}touchend(e,i,a){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),a.length===0){const o=!this.aborted&&this.centroid;if(this.reset(),o)return o}}}class Ca{constructor(e){this.singleTap=new Hl(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,i,a){this.singleTap.touchstart(e,i,a)}touchmove(e,i,a){this.singleTap.touchmove(e,i,a)}touchend(e,i,a){const o=this.singleTap.touchend(e,i,a);if(o){const u=e.timeStamp-this.lastTime<500,f=!this.lastTap||this.lastTap.dist(o)<30;if(u&&f||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=o,this.count===this.numTaps)return this.reset(),o}}}class Aa{constructor(e){this._tr=new $n(e),this._zoomIn=new Ca({numTouches:1,numTaps:2}),this._zoomOut=new Ca({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,i,a){this._zoomIn.touchstart(e,i,a),this._zoomOut.touchstart(e,i,a)}touchmove(e,i,a){this._zoomIn.touchmove(e,i,a),this._zoomOut.touchmove(e,i,a)}touchend(e,i,a){const o=this._zoomIn.touchend(e,i,a),u=this._zoomOut.touchend(e,i,a),f=this._tr;return o?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:f.zoom+1,around:f.unproject(o)},{originalEvent:e})}):u?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:f.zoom-1,around:f.unproject(u)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Zn{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){const i=this._moveFunction(...e);if(i.bearingDelta||i.pitchDelta||i.rollDelta||i.around||i.panDelta)return this._active=!0,i}dragStart(e,i){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(i)?i[0]:i,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,i){if(!this.isEnabled())return;const a=this._lastPoint;if(!a)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);const o=Array.isArray(i)?i[0]:i;return!this._moved&&o.dist(a)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=o,this._move(a,o))}dragEnd(e){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(e)&&(this._moved&&fe.suppressClick(),this.reset(e))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const Vi=0,Gi=2,Xl={[Vi]:1,[Gi]:2};class di{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){const i=fe.mouseButton(e);this._eventButton=i}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!function(i,a){const o=Xl[a];return i.buttons===void 0||(i.buttons&o)!==o}(e,this._eventButton)}isValidEndEvent(e){return fe.mouseButton(e)===this._eventButton}}class Gn{constructor(){this._firstTouch=void 0}_isOneFingerTouch(e){return e.targetTouches.length===1}_isSameTouchEvent(e){return e.targetTouches[0].identifier===this._firstTouch}startMove(e){this._firstTouch=e.targetTouches[0].identifier}endMove(e){delete this._firstTouch}isValidStartEvent(e){return this._isOneFingerTouch(e)}isValidMoveEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}isValidEndEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}}class $c{constructor(e=new di({checkCorrectEvent:()=>!0}),i=new Gn){this.mouseMoveStateManager=e,this.oneFingerTouchMoveStateManager=i}_executeRelevantHandler(e,i,a){return e instanceof MouseEvent?i(e):typeof TouchEvent<"u"&&e instanceof TouchEvent?a(e):void 0}startMove(e){this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.startMove(i),i=>this.oneFingerTouchMoveStateManager.startMove(i))}endMove(e){this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.endMove(i),i=>this.oneFingerTouchMoveStateManager.endMove(i))}isValidStartEvent(e){return this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.isValidStartEvent(i),i=>this.oneFingerTouchMoveStateManager.isValidStartEvent(i))}isValidMoveEvent(e){return this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.isValidMoveEvent(i),i=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(i))}isValidEndEvent(e){return this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.isValidEndEvent(i),i=>this.oneFingerTouchMoveStateManager.isValidEndEvent(i))}}const Ea=h=>{h.mousedown=h.dragStart,h.mousemoveWindow=h.dragMove,h.mouseup=h.dragEnd,h.contextmenu=e=>{e.preventDefault()}};class Zc{constructor(e,i){this._clickTolerance=e.clickTolerance||1,this._map=i,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new c.P(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,i,a){return this._calculateTransform(e,i,a)}touchmove(e,i,a){if(this._active){if(!this._shouldBePrevented(a.length))return e.preventDefault(),this._calculateTransform(e,i,a);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e)}}touchend(e,i,a){this._calculateTransform(e,i,a),this._active&&this._shouldBePrevented(a.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,i,a){a.length>0&&(this._active=!0);const o=Ia(a,i),u=new c.P(0,0),f=new c.P(0,0);let _=0;for(const v in o){const w=o[v],P=this._touches[v];P&&(u._add(w),f._add(w.sub(P)),_++,o[v]=w)}if(this._touches=o,this._shouldBePrevented(_)||!f.mag())return;const y=f.div(_);return this._sum._add(y),this._sum.mag()<this._clickTolerance?void 0:{around:u.div(_),panDelta:y}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class zo{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,i,a){this._firstTwoTouches||a.length<2||(this._firstTwoTouches=[a[0].identifier,a[1].identifier],this._start([i[0],i[1]]))}touchmove(e,i,a){if(!this._firstTwoTouches)return;e.preventDefault();const[o,u]=this._firstTwoTouches,f=ks(a,i,o),_=ks(a,i,u);if(!f||!_)return;const y=this._aroundCenter?null:f.add(_).div(2);return this._move([f,_],y,e)}touchend(e,i,a){if(!this._firstTwoTouches)return;const[o,u]=this._firstTwoTouches,f=ks(a,i,o),_=ks(a,i,u);f&&_||(this._active&&fe.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&e.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function ks(h,e,i){for(let a=0;a<h.length;a++)if(h[a].identifier===i)return e[a]}function qn(h,e){return Math.log(h/e)/Math.LN2}class sr extends zo{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,i){const a=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(qn(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:qn(this._distance,a),pinchAround:i}}}function Ae(h,e){return 180*h.angleWith(e)/Math.PI}class ko extends zo{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,i,a){const o=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Ae(this._vector,o),pinchAround:i}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const i=25/(Math.PI*this._minDiameter)*360,a=Ae(e,this._startVector);return Math.abs(a)<i}}function Ds(h){return Math.abs(h.y)>Math.abs(h.x)}class Do extends zo{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,i,a){super.touchstart(e,i,a),this._currentTouchCount=a.length}_start(e){this._lastPoints=e,Ds(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,i,a){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const o=e[0].sub(this._lastPoints[0]),u=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(o,u,a.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(o.y+u.y)/2*-.5}):void 0}gestureBeginsVertically(e,i,a){if(this._valid!==void 0)return this._valid;const o=e.mag()>=2,u=i.mag()>=2;if(!o&&!u)return;if(!o||!u)return this._firstMove===void 0&&(this._firstMove=a),a-this._firstMove<100&&void 0;const f=e.y>0==i.y>0;return Ds(e)&&Ds(i)&&f}}const Rs={panStep:100,bearingStep:15,pitchStep:10};class Wn{constructor(e){this._tr=new $n(e);const i=Rs;this._panStep=i.panStep,this._bearingStep=i.bearingStep,this._pitchStep=i.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let i=0,a=0,o=0,u=0,f=0;switch(e.keyCode){case 61:case 107:case 171:case 187:i=1;break;case 189:case 109:case 173:i=-1;break;case 37:e.shiftKey?a=-1:(e.preventDefault(),u=-1);break;case 39:e.shiftKey?a=1:(e.preventDefault(),u=1);break;case 38:e.shiftKey?o=1:(e.preventDefault(),f=-1);break;case 40:e.shiftKey?o=-1:(e.preventDefault(),f=1);break;default:return}return this._rotationDisabled&&(a=0,o=0),{cameraAnimation:_=>{const y=this._tr;_.easeTo({duration:300,easeId:"keyboardHandler",easing:Ro,zoom:i?Math.round(y.zoom)+i*(e.shiftKey?2:1):y.zoom,bearing:y.bearing+a*this._bearingStep,pitch:y.pitch+o*this._pitchStep,offset:[-u*this._panStep,-f*this._panStep],center:y.center},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Ro(h){return h*(2-h)}const et=4.000244140625,Lo=1/450;class Yl{constructor(e,i){this._onTimeout=a=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(a)},this._map=e,this._tr=new $n(e),this._triggerRenderFrame=i,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=Lo}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&e.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return!!this._map.cooperativeGestures.isEnabled()&&!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e))}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);let i=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY;const a=Ge.now(),o=a-(this._lastWheelEventTime||0);this._lastWheelEventTime=a,i!==0&&i%et==0?this._type="wheel":i!==0&&Math.abs(i)<4?this._type="trackpad":o>400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(o*i)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),e.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=e,this._delta-=i,this._active||this._start(e)),e.preventDefault()}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const i=fe.mousePos(this._map.getCanvas(),e),a=this._tr;this._aroundPoint=this._aroundCenter?a.transform.locationToScreenPoint(c.S.convert(a.center)):i,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const e=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){const _=e.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=_),typeof this._targetZoom=="number"&&(this._targetZoom+=_)}if(this._delta!==0){const _=this._type==="wheel"&&Math.abs(this._delta)>et?this._wheelZoomRate:this._defaultZoomRate;let y=2/(1+Math.exp(-Math.abs(this._delta*_)));this._delta<0&&y!==0&&(y=1/y);const v=typeof this._targetZoom!="number"?e.scale:c.ae(this._targetZoom);this._targetZoom=e.getConstrained(e.getCameraLngLat(),c.aj(v*y)).zoom,this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const i=typeof this._targetZoom!="number"?e.zoom:this._targetZoom,a=this._startZoom,o=this._easing;let u,f=!1;if(this._type==="wheel"&&a&&o){const _=Ge.now()-this._lastWheelEventTime,y=Math.min((_+5)/200,1),v=o(y);u=c.C.number(a,i,v),y<1?this._frameId||(this._frameId=!0):f=!0}else u=i,f=!0;return this._active=!0,f&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=u,{noInertia:!0,needsRenderFrame:!f,zoomDelta:u-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let i=c.cn;if(this._prevEase){const a=this._prevEase,o=(Ge.now()-a.start)/a.duration,u=a.easing(o+.01)-a.easing(o),f=.27/Math.sqrt(u*u+1e-4)*.01,_=Math.sqrt(.0729-f*f);i=c.cl(f,_,.25,1)}return this._prevEase={start:Ge.now(),duration:e,easing:i},i}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class za{constructor(e,i){this._clickZoom=e,this._tapZoom=i}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class Gc{constructor(e){this._tr=new $n(e),this.reset()}reset(){this._active=!1}dblclick(e,i){return e.preventDefault(),{cameraAnimation:a=>{a.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(i)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class qc{constructor(){this._tap=new Ca({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(e,i,a){if(!this._swipePoint)if(this._tapTime){const o=i[0],u=e.timeStamp-this._tapTime<500,f=this._tapPoint.dist(o)<30;u&&f?a.length>0&&(this._swipePoint=o,this._swipeTouch=a[0].identifier):this.reset()}else this._tap.touchstart(e,i,a)}touchmove(e,i,a){if(this._tapTime){if(this._swipePoint){if(a[0].identifier!==this._swipeTouch)return;const o=i[0],u=o.y-this._swipePoint.y;return this._swipePoint=o,e.preventDefault(),this._active=!0,{zoomDelta:u/128}}}else this._tap.touchmove(e,i,a)}touchend(e,i,a){if(this._tapTime)this._swipePoint&&a.length===0&&this.reset();else{const o=this._tap.touchend(e,i,a);o&&(this._tapTime=e.timeStamp,this._tapPoint=o)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Bo{constructor(e,i,a){this._el=e,this._mousePan=i,this._touchPan=a}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class ka{constructor(e,i,a,o){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=i,this._mousePitch=a,this._mouseRoll=o}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}}class Fo{constructor(e,i,a,o){this._el=e,this._touchZoom=i,this._touchRotate=a,this._tapDragZoom=o,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class Kl{constructor(e,i){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=e,this._options=i,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=fe.create("div","maplibregl-cooperative-gesture-screen",e);let i=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(i=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const a=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),o=document.createElement("div");o.className="maplibregl-desktop-message",o.textContent=i,this._container.appendChild(o);const u=document.createElement("div");u.className="maplibregl-mobile-message",u.textContent=a,this._container.appendChild(u),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(fe.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(e){return e[this._bypassKey]}notifyGestureBlocked(e,i){this._enabled&&(this._map.fire(new c.l("cooperativegestureprevented",{gestureType:e,originalEvent:i})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Ls=h=>h.zoom||h.drag||h.roll||h.pitch||h.rotate;class Wc extends c.l{}function Oo(h){return h.panDelta&&h.panDelta.mag()||h.zoomDelta||h.bearingDelta||h.pitchDelta||h.rollDelta}class Lr{constructor(e,i){this.handleWindowEvent=o=>{this.handleEvent(o,`${o.type}Window`)},this.handleEvent=(o,u)=>{if(o.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const f=o.type==="renderFrame"?void 0:o,_={needsRenderFrame:!1},y={},v={};for(const{handlerName:S,handler:I,allowed:k}of this._handlers){if(!I.isEnabled())continue;let V;if(this._blockedByActive(v,k,S))I.reset();else if(I[u||o.type]){if(c.co(o,u||o.type)){const O=fe.mousePos(this._map.getCanvas(),o);V=I[u||o.type](o,O)}else if(c.cp(o,u||o.type)){const O=this._getMapTouches(o.touches),N=fe.touchPos(this._map.getCanvas(),O);V=I[u||o.type](o,N,O)}else c.cq(u||o.type)||(V=I[u||o.type](o));this.mergeHandlerResult(_,y,V,S,f),V&&V.needsRenderFrame&&this._triggerRenderFrame()}(V||I.isActive())&&(v[S]=I)}const w={};for(const S in this._previousActiveHandlers)v[S]||(w[S]=f);this._previousActiveHandlers=v,(Object.keys(w).length||Oo(_))&&(this._changes.push([_,y,w]),this._triggerRenderFrame()),(Object.keys(v).length||Oo(_))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:P}=_;P&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],P(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Gl(e),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(i);const a=this._el;this._listeners=[[a,"touchstart",{passive:!0}],[a,"touchmove",{passive:!1}],[a,"touchend",void 0],[a,"touchcancel",void 0],[a,"mousedown",void 0],[a,"mousemove",void 0],[a,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[a,"mouseover",void 0],[a,"mouseout",void 0],[a,"dblclick",void 0],[a,"click",void 0],[a,"keydown",{capture:!1}],[a,"keyup",void 0],[a,"wheel",{passive:!1}],[a,"contextmenu",void 0],[window,"blur",void 0]];for(const[o,u,f]of this._listeners)fe.addEventListener(o,u,o===document?this.handleWindowEvent:this.handleEvent,f)}destroy(){for(const[e,i,a]of this._listeners)fe.removeEventListener(e,i,e===document?this.handleWindowEvent:this.handleEvent,a)}_addDefaultHandlers(e){const i=this._map,a=i.getCanvasContainer();this._add("mapEvent",new ql(i,e));const o=i.boxZoom=new Eo(i,e);this._add("boxZoom",o),e.interactive&&e.boxZoom&&o.enable();const u=i.cooperativeGestures=new Kl(i,e.cooperativeGestures);this._add("cooperativeGestures",u),e.cooperativeGestures&&u.enable();const f=new Aa(i),_=new Gc(i);i.doubleClickZoom=new za(_,f),this._add("tapZoom",f),this._add("clickZoom",_),e.interactive&&e.doubleClickZoom&&i.doubleClickZoom.enable();const y=new qc;this._add("tapDragZoom",y);const v=i.touchPitch=new Do(i);this._add("touchPitch",v),e.interactive&&e.touchPitch&&i.touchPitch.enable(e.touchPitch);const w=()=>i.project(i.getCenter()),P=function({enable:Z,clickTolerance:Y,aroundCenter:K=!0,minPixelCenterThreshold:G=100,rotateDegreesPerPixelMoved:te=.8},he){const ae=new di({checkCorrectEvent:oe=>fe.mouseButton(oe)===0&&oe.ctrlKey||fe.mouseButton(oe)===2&&!oe.ctrlKey});return new Zn({clickTolerance:Y,move:(oe,ue)=>{const Me=he();if(K&&Math.abs(Me.y-oe.y)>G)return{bearingDelta:c.cm(new c.P(oe.x,ue.y),ue,Me)};let Pe=(ue.x-oe.x)*te;return K&&ue.y<Me.y&&(Pe=-Pe),{bearingDelta:Pe}},moveStateManager:ae,enable:Z,assignEvents:Ea})}(e,w),S=function({enable:Z,clickTolerance:Y,pitchDegreesPerPixelMoved:K=-.5}){const G=new di({checkCorrectEvent:te=>fe.mouseButton(te)===0&&te.ctrlKey||fe.mouseButton(te)===2});return new Zn({clickTolerance:Y,move:(te,he)=>({pitchDelta:(he.y-te.y)*K}),moveStateManager:G,enable:Z,assignEvents:Ea})}(e),I=function({enable:Z,clickTolerance:Y,rollDegreesPerPixelMoved:K=.3},G){const te=new di({checkCorrectEvent:he=>fe.mouseButton(he)===2&&he.ctrlKey});return new Zn({clickTolerance:Y,move:(he,ae)=>{const oe=G();let ue=(ae.x-he.x)*K;return ae.y<oe.y&&(ue=-ue),{rollDelta:ue}},moveStateManager:te,enable:Z,assignEvents:Ea})}(e,w);i.dragRotate=new ka(e,P,S,I),this._add("mouseRotate",P,["mousePitch"]),this._add("mousePitch",S,["mouseRotate","mouseRoll"]),this._add("mouseRoll",I,["mousePitch"]),e.interactive&&e.dragRotate&&i.dragRotate.enable();const k=function({enable:Z,clickTolerance:Y}){const K=new di({checkCorrectEvent:G=>fe.mouseButton(G)===0&&!G.ctrlKey});return new Zn({clickTolerance:Y,move:(G,te)=>({around:te,panDelta:te.sub(G)}),activateOnStart:!0,moveStateManager:K,enable:Z,assignEvents:Ea})}(e),V=new Zc(e,i);i.dragPan=new Bo(a,k,V),this._add("mousePan",k),this._add("touchPan",V,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&i.dragPan.enable(e.dragPan);const O=new ko,N=new sr;i.touchZoomRotate=new Fo(a,N,O,y),this._add("touchRotate",O,["touchPan","touchZoom"]),this._add("touchZoom",N,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&i.touchZoomRotate.enable(e.touchZoomRotate);const $=i.scrollZoom=new Yl(i,()=>this._triggerRenderFrame());this._add("scrollZoom",$,["mousePan"]),e.interactive&&e.scrollZoom&&i.scrollZoom.enable(e.scrollZoom);const q=i.keyboard=new Wn(i);this._add("keyboard",q),e.interactive&&e.keyboard&&i.keyboard.enable(),this._add("blockableMapEvent",new Wl(i))}_add(e,i,a){this._handlers.push({handlerName:e,handler:i,allowed:a}),this._handlersById[e]=i}stop(e){if(!this._updatingCamera){for(const{handler:i}of this._handlers)i.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(const{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Ls(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,i,a){for(const o in e)if(o!==a&&(!i||i.indexOf(o)<0))return!0;return!1}_getMapTouches(e){const i=[];for(const a of e)this._el.contains(a.target)&&i.push(a);return i}mergeHandlerResult(e,i,a,o,u){if(!a)return;c.e(e,a);const f={handlerName:o,originalEvent:a.originalEvent||u};a.zoomDelta!==void 0&&(i.zoom=f),a.panDelta!==void 0&&(i.drag=f),a.rollDelta!==void 0&&(i.roll=f),a.pitchDelta!==void 0&&(i.pitch=f),a.bearingDelta!==void 0&&(i.rotate=f)}_applyChanges(){const e={},i={},a={};for(const[o,u,f]of this._changes)o.panDelta&&(e.panDelta=(e.panDelta||new c.P(0,0))._add(o.panDelta)),o.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+o.zoomDelta),o.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+o.bearingDelta),o.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+o.pitchDelta),o.rollDelta&&(e.rollDelta=(e.rollDelta||0)+o.rollDelta),o.around!==void 0&&(e.around=o.around),o.pinchAround!==void 0&&(e.pinchAround=o.pinchAround),o.noInertia&&(e.noInertia=o.noInertia),c.e(i,u),c.e(a,f);this._updateMapTransform(e,i,a),this._changes=[]}_updateMapTransform(e,i,a){const o=this._map,u=o._getTransformForUpdate(),f=o.terrain;if(!(Oo(e)||f&&this._terrainMovement))return this._fireEvents(i,a,!0);o._stop(!0);let{panDelta:_,zoomDelta:y,bearingDelta:v,pitchDelta:w,rollDelta:P,around:S,pinchAround:I}=e;I!==void 0&&(S=I),S=S||o.transform.centerPoint,f&&!u.isPointOnMapSurface(S)&&(S=u.centerPoint);const k={panDelta:_,zoomDelta:y,rollDelta:P,pitchDelta:w,bearingDelta:v,around:S};this._map.cameraHelper.useGlobeControls&&!u.isPointOnMapSurface(S)&&(S=u.centerPoint);const V=S.distSqr(u.centerPoint)<.01?u.center:u.screenPointToLocation(_?S.sub(_):S);f?(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(k,u),this._terrainMovement||!i.drag&&!i.zoom?i.drag&&this._terrainMovement?u.setCenter(u.screenPointToLocation(u.centerPoint.sub(_))):this._map.cameraHelper.handleMapControlsPan(k,u,V):(this._terrainMovement=!0,this._map._elevationFreeze=!0,this._map.cameraHelper.handleMapControlsPan(k,u,V))):(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(k,u),this._map.cameraHelper.handleMapControlsPan(k,u,V)),o._applyUpdatedTransform(u),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(i,a,!0)}_fireEvents(e,i,a){const o=Ls(this._eventsInProgress),u=Ls(e),f={};for(const P in e){const{originalEvent:S}=e[P];this._eventsInProgress[P]||(f[`${P}start`]=S),this._eventsInProgress[P]=e[P]}!o&&u&&this._fireEvent("movestart",u.originalEvent);for(const P in f)this._fireEvent(P,f[P]);u&&this._fireEvent("move",u.originalEvent);for(const P in e){const{originalEvent:S}=e[P];this._fireEvent(P,S)}const _={};let y;for(const P in this._eventsInProgress){const{handlerName:S,originalEvent:I}=this._eventsInProgress[P];this._handlersById[S].isActive()||(delete this._eventsInProgress[P],y=i[S]||I,_[`${P}end`]=y)}for(const P in _)this._fireEvent(P,_[P]);const v=Ls(this._eventsInProgress),w=(o||u)&&!v;if(w&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const P=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&P.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(P)}if(a&&w){this._updatingCamera=!0;const P=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),S=I=>I!==0&&-this._bearingSnap<I&&I<this._bearingSnap;!P||!P.essential&&Ge.prefersReducedMotion?(this._map.fire(new c.l("moveend",{originalEvent:y})),S(this._map.getBearing())&&this._map.resetNorth()):(S(P.bearing||this._map.getBearing())&&(P.bearing=0),P.freezeElevation=!0,this._map.easeTo(P,{originalEvent:y})),this._updatingCamera=!1}}_fireEvent(e,i){this._map.fire(new c.l(e,i?{originalEvent:i}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new Wc("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class gt extends c.E{constructor(e,i,a){super(),this._renderFrameCallback=()=>{const o=Math.min((Ge.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(o)),o<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=a.bearingSnap,this.cameraHelper=i,this.on("moveend",()=>{delete this._requestedCameraState})}migrateProjection(e,i){e.apply(this.transform),this.transform=e,this.cameraHelper=i}getCenter(){return new c.S(this.transform.center.lng,this.transform.center.lat)}setCenter(e,i){return this.jumpTo({center:e},i)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,i){return this.jumpTo({elevation:e},i),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,i,a){return e=c.P.convert(e).mult(-1),this.panTo(this.transform.center,c.e({offset:e},i),a)}panTo(e,i,a){return this.easeTo(c.e({center:e},i),a)}getZoom(){return this.transform.zoom}setZoom(e,i){return this.jumpTo({zoom:e},i),this}zoomTo(e,i,a){return this.easeTo(c.e({zoom:e},i),a)}zoomIn(e,i){return this.zoomTo(this.getZoom()+1,e,i),this}zoomOut(e,i){return this.zoomTo(this.getZoom()-1,e,i),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,i){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new c.l("movestart",i)).fire(new c.l("move",i)).fire(new c.l("moveend",i))),this}getBearing(){return this.transform.bearing}setBearing(e,i){return this.jumpTo({bearing:e},i),this}getPadding(){return this.transform.padding}setPadding(e,i){return this.jumpTo({padding:e},i),this}rotateTo(e,i,a){return this.easeTo(c.e({bearing:e},i),a)}resetNorth(e,i){return this.rotateTo(0,c.e({duration:1e3},e),i),this}resetNorthPitch(e,i){return this.easeTo(c.e({bearing:0,pitch:0,roll:0,duration:1e3},e),i),this}snapToNorth(e,i){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,i):this}getPitch(){return this.transform.pitch}setPitch(e,i){return this.jumpTo({pitch:e},i),this}getRoll(){return this.transform.roll}setRoll(e,i){return this.jumpTo({roll:e},i),this}cameraForBounds(e,i){e=Mt.convert(e).adjustAntiMeridian();const a=i&&i.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),a,i)}_cameraForBoxAndBearing(e,i,a,o){const u={top:0,bottom:0,right:0,left:0};if(typeof(o=c.e({padding:u,offset:[0,0],maxZoom:this.transform.maxZoom},o)).padding=="number"){const v=o.padding;o.padding={top:v,bottom:v,right:v,left:v}}const f=c.e(u,o.padding);o.padding=f;const _=this.transform,y=new Mt(e,i);return this.cameraHelper.cameraForBoxAndBearing(o,f,y,a,_)}fitBounds(e,i,a){return this._fitInternal(this.cameraForBounds(e,i),i,a)}fitScreenCoordinates(e,i,a,o,u){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(c.P.convert(e)),this.transform.screenPointToLocation(c.P.convert(i)),a,o),o,u)}_fitInternal(e,i,a){return e?(delete(i=c.e(e,i)).padding,i.linear?this.easeTo(i,a):this.flyTo(i,a)):this}jumpTo(e,i){this.stop();const a=this._getTransformForUpdate();let o=!1,u=!1,f=!1;const _=a.zoom;this.cameraHelper.handleJumpToCenterZoom(a,e);const y=a.zoom!==_;return"elevation"in e&&a.elevation!==+e.elevation&&a.setElevation(+e.elevation),"bearing"in e&&a.bearing!==+e.bearing&&(o=!0,a.setBearing(+e.bearing)),"pitch"in e&&a.pitch!==+e.pitch&&(u=!0,a.setPitch(+e.pitch)),"roll"in e&&a.roll!==+e.roll&&(f=!0,a.setRoll(+e.roll)),e.padding==null||a.isPaddingEqual(e.padding)||a.setPadding(e.padding),this._applyUpdatedTransform(a),this.fire(new c.l("movestart",i)).fire(new c.l("move",i)),y&&this.fire(new c.l("zoomstart",i)).fire(new c.l("zoom",i)).fire(new c.l("zoomend",i)),o&&this.fire(new c.l("rotatestart",i)).fire(new c.l("rotate",i)).fire(new c.l("rotateend",i)),u&&this.fire(new c.l("pitchstart",i)).fire(new c.l("pitch",i)).fire(new c.l("pitchend",i)),f&&this.fire(new c.l("rollstart",i)).fire(new c.l("roll",i)).fire(new c.l("rollend",i)),this.fire(new c.l("moveend",i))}calculateCameraOptionsFromTo(e,i,a,o=0){const u=c.a0.fromLngLat(e,i),f=c.a0.fromLngLat(a,o),_=f.x-u.x,y=f.y-u.y,v=f.z-u.z,w=Math.hypot(_,y,v);if(w===0)throw new Error("Can't calculate camera options with same From and To");const P=Math.hypot(_,y),S=c.aj(this.transform.cameraToCenterDistance/w/this.transform.tileSize),I=180*Math.atan2(_,-y)/Math.PI;let k=180*Math.acos(P/w)/Math.PI;return k=v<0?90-k:90+k,{center:f.toLngLat(),elevation:o,zoom:S,pitch:k,bearing:I}}calculateCameraOptionsFromCameraLngLatAltRotation(e,i,a,o,u){const f=this.transform.calculateCenterFromCameraLngLatAlt(e,i,a,o);return{center:f.center,elevation:f.elevation,zoom:f.zoom,bearing:a,pitch:o,roll:u}}easeTo(e,i){this._stop(!1,e.easeId),((e=c.e({offset:[0,0],duration:500,easing:c.cn},e)).animate===!1||!e.essential&&Ge.prefersReducedMotion)&&(e.duration=0);const a=this._getTransformForUpdate(),o=this.getBearing(),u=a.pitch,f=a.roll,_="bearing"in e?this._normalizeBearing(e.bearing,o):o,y="pitch"in e?+e.pitch:u,v="roll"in e?this._normalizeBearing(e.roll,f):f,w="padding"in e?e.padding:a.padding,P=c.P.convert(e.offset);let S,I;e.around&&(S=c.S.convert(e.around),I=a.locationToScreenPoint(S));const k={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},V=this.cameraHelper.handleEaseTo(a,{bearing:_,pitch:y,roll:v,padding:w,around:S,aroundPoint:I,offsetAsPoint:P,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating=this._rotating||o!==_,this._pitching=this._pitching||y!==u,this._rolling=this._rolling||v!==f,this._padding=!a.isPaddingEqual(w),this._zooming=this._zooming||V.isZooming,this._easeId=e.easeId,this._prepareEase(i,e.noMoveStart,k),this.terrain&&this._prepareElevation(V.elevationCenter),this._ease(O=>{V.easeFunc(O),this.terrain&&!e.freezeElevation&&this._updateElevation(O),this._applyUpdatedTransform(a),this._fireMoveEvents(i)},O=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i,O)},e),this}_prepareEase(e,i,a={}){this._moving=!0,i||a.moving||this.fire(new c.l("movestart",e)),this._zooming&&!a.zooming&&this.fire(new c.l("zoomstart",e)),this._rotating&&!a.rotating&&this.fire(new c.l("rotatestart",e)),this._pitching&&!a.pitching&&this.fire(new c.l("pitchstart",e)),this._rolling&&!a.rolling&&this.fire(new c.l("rollstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));const i=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&i!==this._elevationTarget){const a=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(a-(i-(a*e+this._elevationStart))/(1-e)),this._elevationTarget=i}this.transform.setElevation(c.C.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};const i=e.getCameraLngLat(),a=e.getCameraAltitude(),o=this.terrain?this.terrain.getElevationForLngLatZoom(i,e.zoom):0;if(a<o){const u=this.calculateCameraOptionsFromTo(i,o,e.center,e.elevation);return{pitch:u.pitch,zoom:u.zoom}}return{}}_applyUpdatedTransform(e){const i=[];if(i.push(o=>this._elevateCameraIfInsideTerrain(o)),this.transformCameraUpdate&&i.push(o=>this.transformCameraUpdate(o)),!i.length)return;const a=e.clone();for(const o of i){const u=a.clone(),{center:f,zoom:_,roll:y,pitch:v,bearing:w,elevation:P}=o(u);f&&u.setCenter(f),P!==void 0&&u.setElevation(P),_!==void 0&&u.setZoom(_),y!==void 0&&u.setRoll(y),v!==void 0&&u.setPitch(v),w!==void 0&&u.setBearing(w),a.apply(u)}this.transform.apply(a)}_fireMoveEvents(e){this.fire(new c.l("move",e)),this._zooming&&this.fire(new c.l("zoom",e)),this._rotating&&this.fire(new c.l("rotate",e)),this._pitching&&this.fire(new c.l("pitch",e)),this._rolling&&this.fire(new c.l("roll",e))}_afterEase(e,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId;const a=this._zooming,o=this._rotating,u=this._pitching,f=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,a&&this.fire(new c.l("zoomend",e)),o&&this.fire(new c.l("rotateend",e)),u&&this.fire(new c.l("pitchend",e)),f&&this.fire(new c.l("rollend",e)),this.fire(new c.l("moveend",e))}flyTo(e,i){if(!e.essential&&Ge.prefersReducedMotion){const ue=c.Q(e,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(ue,i)}this.stop(),e=c.e({offset:[0,0],speed:1.2,curve:1.42,easing:c.cn},e);const a=this._getTransformForUpdate(),o=a.bearing,u=a.pitch,f=a.roll,_=a.padding,y="bearing"in e?this._normalizeBearing(e.bearing,o):o,v="pitch"in e?+e.pitch:u,w="roll"in e?this._normalizeBearing(e.roll,f):f,P="padding"in e?e.padding:a.padding,S=c.P.convert(e.offset);let I=a.centerPoint.add(S);const k=a.screenPointToLocation(I),V=this.cameraHelper.handleFlyTo(a,{bearing:y,pitch:v,roll:w,padding:P,locationAtOffset:k,offsetAsPoint:S,center:e.center,minZoom:e.minZoom,zoom:e.zoom});let O=e.curve;const N=Math.max(a.width,a.height),$=N/V.scaleOfZoom,q=V.pixelPathLength;typeof V.scaleOfMinZoom=="number"&&(O=Math.sqrt(N/V.scaleOfMinZoom/q*2));const Z=O*O;function Y(ue){const Me=($*$-N*N+(ue?-1:1)*Z*Z*q*q)/(2*(ue?$:N)*Z*q);return Math.log(Math.sqrt(Me*Me+1)-Me)}function K(ue){return(Math.exp(ue)-Math.exp(-ue))/2}function G(ue){return(Math.exp(ue)+Math.exp(-ue))/2}const te=Y(!1);let he=function(ue){return G(te)/G(te+O*ue)},ae=function(ue){return N*((G(te)*(K(Me=te+O*ue)/G(Me))-K(te))/Z)/q;var Me},oe=(Y(!0)-te)/O;if(Math.abs(q)<2e-6||!isFinite(oe)){if(Math.abs(N-$)<1e-6)return this.easeTo(e,i);const ue=$<N?-1:1;oe=Math.abs(Math.log($/N))/O,ae=()=>0,he=Me=>Math.exp(ue*O*Me)}return e.duration="duration"in e?+e.duration:1e3*oe/("screenSpeed"in e?+e.screenSpeed/O:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=o!==y,this._pitching=v!==u,this._rolling=w!==f,this._padding=!a.isPaddingEqual(P),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(V.targetCenter),this._ease(ue=>{const Me=ue*oe,Pe=1/he(Me),ve=ae(Me);this._rotating&&a.setBearing(c.C.number(o,y,ue)),this._pitching&&a.setPitch(c.C.number(u,v,ue)),this._rolling&&a.setRoll(c.C.number(f,w,ue)),this._padding&&(a.interpolatePadding(_,P,ue),I=a.centerPoint.add(S)),V.easeFunc(ue,Pe,ve,I),this.terrain&&!e.freezeElevation&&this._updateElevation(ue),this._applyUpdatedTransform(a),this._fireMoveEvents(i)},()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i)},e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,i){var a;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const o=this._onEaseEnd;delete this._onEaseEnd,o.call(this,i)}return e||(a=this.handlers)===null||a===void 0||a.stop(!1),this}_ease(e,i,a){a.animate===!1||a.duration===0?(e(1),i()):(this._easeStart=Ge.now(),this._easeOptions=a,this._onEaseFrame=e,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,i){e=c.aN(e,-180,180);const a=Math.abs(e-i);return Math.abs(e-360-i)<a&&(e-=360),Math.abs(e+360-i)<a&&(e+=360),e}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLatZoom(c.S.convert(e),this.transform.tileZoom):null}}const Bs={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Da{constructor(e=Bs){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=i=>{!i||i.sourceDataType!=="metadata"&&i.sourceDataType!=="visibility"&&i.dataType!=="style"&&i.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=fe.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=fe.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=fe.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){fe.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(e,i){const a=this._map._getUIString(`AttributionControl.${i}`);e.title=a,e.setAttribute("aria-label",a)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(o=>typeof o!="string"?"":o)):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){const o=this._map.style.stylesheet;this.styleOwner=o.owner,this.styleId=o.id}const i=this._map.style.sourceCaches;for(const o in i){const u=i[o];if(u.used||u.usedForTerrain){const f=u.getSource();f.attribution&&e.indexOf(f.attribution)<0&&e.push(f.attribution)}}e=e.filter(o=>String(o).trim()),e.sort((o,u)=>o.length-u.length),e=e.filter((o,u)=>{for(let f=u+1;f<e.length;f++)if(e[f].indexOf(o)>=0)return!1;return!0});const a=e.join(" | ");a!==this._attribHTML&&(this._attribHTML=a,e.length?(this._innerContainer.innerHTML=fe.sanitize(a),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class jo{constructor(e={}){this._updateCompact=()=>{const i=this._container.children;if(i.length){const a=i[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&a.classList.add("maplibregl-compact"):a.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=fe.create("div","maplibregl-ctrl");const i=fe.create("a","maplibregl-ctrl-logo");return i.target="_blank",i.rel="noopener nofollow",i.href="https://maplibre.org/",i.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),i.setAttribute("rel","noopener nofollow"),this._container.appendChild(i),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){fe.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Jl{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){const i=++this._id;return this._queue.push({callback:e,id:i,cancelled:!1}),i}remove(e){const i=this._currentlyRunning,a=i?this._queue.concat(i):this._queue;for(const o of a)if(o.id===e)return void(o.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const i=this._currentlyRunning=this._queue;this._queue=[];for(const a of i)if(!a.cancelled&&(a.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Ql=c.aI([{name:"a_pos3d",type:"Int16",components:3}]);class Hc extends c.E{constructor(e){super(),this._lastTilesetChange=Ge.now(),this.sourceCache=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=e._source.tileSize*2**this.deltaZoom,e.usedForTerrain=!0,e.tileSize=this.tileSize}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,i){this.sourceCache.update(e,i),this._renderableTilesKeys=[];const a={};for(const o of pe(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:i,calculateTileZoom:this.sourceCache._source.calculateTileZoom}))a[o.key]=!0,this._renderableTilesKeys.push(o.key),this._tiles[o.key]||(o.terrainRttPosMatrix32f=new Float64Array(16),c.bX(o.terrainRttPosMatrix32f,0,c.$,c.$,0,0,1),this._tiles[o.key]=new er(o,this.tileSize),this._lastTilesetChange=Ge.now());for(const o in this._tiles)a[o]||delete this._tiles[o]}freeRtt(e){for(const i in this._tiles){const a=this._tiles[i];(!e||a.tileID.equals(e)||a.tileID.isChildOf(e)||e.isChildOf(a.tileID))&&(a.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e,i){return i?this._getTerrainCoordsForTileRanges(e,i):this._getTerrainCoordsForRegularTile(e)}_getTerrainCoordsForRegularTile(e){const i={};for(const a of this._renderableTilesKeys){const o=this._tiles[a].tileID,u=e.clone(),f=c.b9();if(o.canonical.equals(e.canonical))c.bX(f,0,c.$,c.$,0,0,1);else if(o.canonical.isChildOf(e.canonical)){const _=o.canonical.z-e.canonical.z,y=o.canonical.x-(o.canonical.x>>_<<_),v=o.canonical.y-(o.canonical.y>>_<<_),w=c.$>>_;c.bX(f,0,w,w,0,0,1),c.M(f,f,[-y*w,-v*w,0])}else{if(!e.canonical.isChildOf(o.canonical))continue;{const _=e.canonical.z-o.canonical.z,y=e.canonical.x-(e.canonical.x>>_<<_),v=e.canonical.y-(e.canonical.y>>_<<_),w=c.$>>_;c.bX(f,0,c.$,c.$,0,0,1),c.M(f,f,[y*w,v*w,0]),c.N(f,f,[1/2**_,1/2**_,0])}}u.terrainRttPosMatrix32f=new Float32Array(f),i[a]=u}return i}_getTerrainCoordsForTileRanges(e,i){const a={};for(const o of this._renderableTilesKeys){const u=this._tiles[o].tileID;if(!this._isWithinTileRanges(u,i))continue;const f=e.clone(),_=c.b9();if(u.canonical.z===e.canonical.z){const y=e.canonical.x-u.canonical.x,v=e.canonical.y-u.canonical.y;c.bX(_,0,c.$,c.$,0,0,1),c.M(_,_,[y*c.$,v*c.$,0])}else if(u.canonical.z>e.canonical.z){const y=u.canonical.z-e.canonical.z,v=u.canonical.x-(u.canonical.x>>y<<y),w=u.canonical.y-(u.canonical.y>>y<<y),P=e.canonical.x-(u.canonical.x>>y),S=e.canonical.y-(u.canonical.y>>y),I=c.$>>y;c.bX(_,0,I,I,0,0,1),c.M(_,_,[-v*I+P*c.$,-w*I+S*c.$,0])}else{const y=e.canonical.z-u.canonical.z,v=e.canonical.x-(e.canonical.x>>y<<y),w=e.canonical.y-(e.canonical.y>>y<<y),P=(e.canonical.x>>y)-u.canonical.x,S=(e.canonical.y>>y)-u.canonical.y,I=c.$<<y;c.bX(_,0,I,I,0,0,1),c.M(_,_,[v*c.$+P*I,w*c.$+S*I,0])}f.terrainRttPosMatrix32f=new Float32Array(_),a[o]=f}return a}getSourceTile(e,i){const a=this.sourceCache._source;let o=e.overscaledZ-this.deltaZoom;if(o>a.maxzoom&&(o=a.maxzoom),o<a.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(o).key);let u=this.sourceCache.getTileByID(this._sourceTileCache[e.key]);if((!u||!u.dem)&&i)for(;o>=a.minzoom&&(!u||!u.dem);)u=this.sourceCache.getTileByID(e.scaledTo(o--).key);return u}anyTilesAfterTime(e=Date.now()){return this._lastTilesetChange>=e}_isWithinTileRanges(e,i){return i[e.canonical.z]&&e.canonical.x>=i[e.canonical.z].minTileX&&e.canonical.x<=i[e.canonical.z].maxTileX&&e.canonical.y>=i[e.canonical.z].minTileY&&e.canonical.y<=i[e.canonical.z].maxTileY}}class ar{constructor(e,i,a){this._meshCache={},this.painter=e,this.sourceCache=new Hc(i),this.options=a,this.exaggeration=typeof a.exaggeration=="number"?a.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,i,a,o=c.$){var u;if(!(i>=0&&i<o&&a>=0&&a<o))return 0;const f=this.getTerrainData(e),_=(u=f.tile)===null||u===void 0?void 0:u.dem;if(!_)return 0;const y=c.cr([],[i/o*c.$,a/o*c.$],f.u_terrain_matrix),v=[y[0]*_.dim,y[1]*_.dim],w=Math.floor(v[0]),P=Math.floor(v[1]),S=v[0]-w,I=v[1]-P;return _.get(w,P)*(1-S)*(1-I)+_.get(w+1,P)*S*(1-I)+_.get(w,P+1)*(1-S)*I+_.get(w+1,P+1)*S*I}getElevationForLngLatZoom(e,i){if(!c.cs(i,e.wrap()))return 0;const{tileID:a,mercatorX:o,mercatorY:u}=this._getOverscaledTileIDFromLngLatZoom(e,i);return this.getElevation(a,o%c.$,u%c.$,c.$)}getElevation(e,i,a,o=c.$){return this.getDEMElevation(e,i,a,o)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){const o=this.painter.context,u=new c.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new c.T(o,u,o.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new c.T(o,new c.R({width:1,height:1}),o.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(o.gl.NEAREST,o.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=c.af([])}const i=this.sourceCache.getSourceTile(e,!0);if(i&&i.dem&&(!i.demTexture||i.needsTerrainPrepare)){const o=this.painter.context;i.demTexture=this.painter.getTileTexture(i.dem.stride),i.demTexture?i.demTexture.update(i.dem.getPixels(),{premultiply:!1}):i.demTexture=new c.T(o,i.dem.getPixels(),o.gl.RGBA,{premultiply:!1}),i.demTexture.bind(o.gl.NEAREST,o.gl.CLAMP_TO_EDGE),i.needsTerrainPrepare=!1}const a=i&&i+i.tileID.key+e.key;if(a&&!this._demMatrixCache[a]){const o=this.sourceCache.sourceCache._source.maxzoom;let u=e.canonical.z-i.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=o?u=e.canonical.z-o:c.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const f=e.canonical.x-(e.canonical.x>>u<<u),_=e.canonical.y-(e.canonical.y>>u<<u),y=c.ct(new Float64Array(16),[1/(c.$<<u),1/(c.$<<u),0]);c.M(y,y,[f*c.$,_*c.$,0]),this._demMatrixCache[e.key]={matrix:y,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:i&&i.dem&&i.dem.dim||1,u_terrain_matrix:a?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:i&&i.dem&&i.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(i&&i.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:i}}getFramebuffer(e){const i=this.painter,a=i.width/devicePixelRatio,o=i.height/devicePixelRatio;return!this._fbo||this._fbo.width===a&&this._fbo.height===o||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new c.T(i.context,{width:a,height:o,data:null},i.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(i.context.gl.NEAREST,i.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new c.T(i.context,{width:a,height:o,data:null},i.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(i.context.gl.NEAREST,i.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=i.context.createFramebuffer(a,o,!0,!1),this._fbo.depthAttachment.set(i.context.createRenderbuffer(i.context.gl.DEPTH_COMPONENT16,a,o))),this._fbo.colorAttachment.set(e==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const i=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let u=0,f=0;u<this._coordsTextureSize;u++)for(let _=0;_<this._coordsTextureSize;_++,f+=4)i[f+0]=255&_,i[f+1]=255&u,i[f+2]=_>>8<<4|u>>8,i[f+3]=0;const a=new c.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(i.buffer)),o=new c.T(e,a,e.gl.RGBA,{premultiply:!1});return o.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=o,o}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);const i=new Uint8Array(4),a=this.painter.context,o=a.gl,u=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),f=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),_=Math.round(this.painter.height/devicePixelRatio);a.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),o.readPixels(u,_-f-1,1,1,o.RGBA,o.UNSIGNED_BYTE,i),a.bindFramebuffer.set(null);const y=i[0]+(i[2]>>4<<8),v=i[1]+((15&i[2])<<8),w=this.coordsIndex[255-i[3]],P=w&&this.sourceCache.getTileByID(w);if(!P)return null;const S=this._coordsTextureSize,I=(1<<P.tileID.canonical.z)*S;return new c.a0((P.tileID.canonical.x*S+y)/I+P.tileID.wrap,(P.tileID.canonical.y*S+v)/I,this.getElevation(P.tileID,y,v,S))}depthAtPoint(e){const i=new Uint8Array(4),a=this.painter.context,o=a.gl;return a.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),o.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,o.RGBA,o.UNSIGNED_BYTE,i),a.bindFramebuffer.set(null),(i[0]/16777216+i[1]/65536+i[2]/256+i[3])/256}getTerrainMesh(e){var i;const a=((i=this.painter.style.projection)===null||i===void 0?void 0:i.transitionState)>0,o=a&&e.canonical.y===0,u=a&&e.canonical.y===(1<<e.canonical.z)-1,f=`m_${o?"n":""}_${u?"s":""}`;if(this._meshCache[f])return this._meshCache[f];const _=this.painter.context,y=new c.cu,v=new c.aM,w=this.meshSize,P=c.$/w,S=w*w;for(let G=0;G<=w;G++)for(let te=0;te<=w;te++)y.emplaceBack(te*P,G*P,0);for(let G=0;G<S;G+=w+1)for(let te=0;te<w;te++)v.emplaceBack(te+G,w+te+G+1,w+te+G+2),v.emplaceBack(te+G,w+te+G+2,te+G+1);const I=y.length,k=I+(w+1),V=(w+1)*w,O=o?c.bg:0,N=o?0:1,$=u?c.bh:c.$,q=u?0:1;for(let G=0;G<=w;G++)y.emplaceBack(G*P,O,N);for(let G=0;G<=w;G++)y.emplaceBack(G*P,$,q);for(let G=0;G<w;G++)v.emplaceBack(V+G,k+G,k+G+1),v.emplaceBack(V+G,k+G+1,V+G+1),v.emplaceBack(0+G,I+G+1,I+G),v.emplaceBack(0+G,0+G+1,I+G+1);const Z=y.length,Y=Z+2*(w+1);for(const G of[0,1])for(let te=0;te<=w;te++)for(const he of[0,1])y.emplaceBack(G*c.$,te*P,he);for(let G=0;G<2*w;G+=2)v.emplaceBack(Z+G,Z+G+1,Z+G+3),v.emplaceBack(Z+G,Z+G+3,Z+G+2),v.emplaceBack(Y+G,Y+G+3,Y+G+1),v.emplaceBack(Y+G,Y+G+2,Y+G+3);const K=new pr(_.createVertexBuffer(y,Ql.members),_.createIndexBuffer(v),c.aL.simpleSegment(0,0,y.length,v.length));return this._meshCache[f]=K,K}getMeshFrameDelta(e){return 2*Math.PI*c.bt/Math.pow(2,Math.max(e,0))/5}getMinTileElevationForLngLatZoom(e,i){var a;const{tileID:o}=this._getOverscaledTileIDFromLngLatZoom(e,i);return(a=this.getMinMaxElevation(o).minElevation)!==null&&a!==void 0?a:0}getMinMaxElevation(e){const i=this.getTerrainData(e).tile,a={minElevation:null,maxElevation:null};return i&&i.dem&&(a.minElevation=i.dem.min*this.exaggeration,a.maxElevation=i.dem.max*this.exaggeration),a}_getOverscaledTileIDFromLngLatZoom(e,i){const a=c.a0.fromLngLat(e.wrap()),o=(1<<i)*c.$,u=a.x*o,f=a.y*o,_=Math.floor(u/c.$),y=Math.floor(f/c.$);return{tileID:new c.Z(i,0,i,_,y),mercatorX:u,mercatorY:f}}}class Ra{constructor(e,i,a){this._context=e,this._size=i,this._tileSize=a,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const e of this._objects)e.texture.destroy(),e.fbo.destroy()}_createObject(e){const i=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),a=new c.T(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return a.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),this._context.extTextureFilterAnisotropic&&this._context.gl.texParameterf(this._context.gl.TEXTURE_2D,this._context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this._context.extTextureFilterAnisotropicMax),i.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),i.colorAttachment.set(a.texture),{id:e,fbo:i,texture:a,stamp:-1,inUse:!1}}getObjectForId(e){return this._objects[e]}useObject(e){e.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(i=>e.id!==i),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(const i of this._recentlyUsed)if(!this._objects[i].inUse)return this._objects[i];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const e=this._createObject(this._objects.length);return this._objects.push(e),e}freeObject(e){e.inUse=!1}freeAllObjects(){for(const e of this._objects)this.freeObject(e)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(e=>!e.inUse)===!1}}const De={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};class je{constructor(e,i){this.painter=e,this.terrain=i,this.pool=new Ra(e.context,30,i.sourceCache.tileSize*i.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,i){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=e._order.filter(a=>!e._layers[a].isHidden(i)),this._coordsAscending={};for(const a in e.sourceCaches){this._coordsAscending[a]={};const o=e.sourceCaches[a].getVisibleCoordinates(),u=e.sourceCaches[a].getSource(),f=u instanceof _i?u.terrainTileRanges:null;for(const _ of o){const y=this.terrain.sourceCache.getTerrainCoords(_,f);for(const v in y)this._coordsAscending[a][v]||(this._coordsAscending[a][v]=[]),this._coordsAscending[a][v].push(y[v])}}this._coordsAscendingStr={};for(const a of e._order){const o=e._layers[a],u=o.source;if(De[o.type]&&!this._coordsAscendingStr[u]){this._coordsAscendingStr[u]={};for(const f in this._coordsAscending[u])this._coordsAscendingStr[u][f]=this._coordsAscending[u][f].map(_=>_.key).sort().join()}}for(const a of this._renderableTiles)for(const o in this._coordsAscendingStr){const u=this._coordsAscendingStr[o][a.tileID.key];u&&u!==a.rttCoords[o]&&(a.rtt=[])}}renderLayer(e,i){if(e.isHidden(this.painter.transform.zoom))return!1;const a=Object.assign(Object.assign({},i),{isRenderingToTexture:!0}),o=e.type,u=this.painter,f=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(De[o]&&(this._prevType&&De[this._prevType]||this._stacks.push([]),this._prevType=o,this._stacks[this._stacks.length-1].push(e.id),!f))return!0;if(De[this._prevType]||De[o]&&f){this._prevType=o;const _=this._stacks.length-1,y=this._stacks[_]||[];for(const v of this._renderableTiles){if(this.pool.isFull()&&(It(this.painter,this.terrain,this._rttTiles,a),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(v),v.rtt[_]){const P=this.pool.getObjectForId(v.rtt[_].id);if(P.stamp===v.rtt[_].stamp){this.pool.useObject(P);continue}}const w=this.pool.getOrCreateFreeObject();this.pool.useObject(w),this.pool.stampObject(w),v.rtt[_]={id:w.id,stamp:w.stamp},u.context.bindFramebuffer.set(w.fbo.framebuffer),u.context.clear({color:c.be.transparent,stencil:0}),u.currentStencilSource=void 0;for(let P=0;P<y.length;P++){const S=u.style._layers[y[P]],I=S.source?this._coordsAscending[S.source][v.tileID.key]:[v.tileID];u.context.viewport.set([0,0,w.fbo.width,w.fbo.height]),u._renderTileClippingMasks(S,I,!0),u.renderLayer(u,u.style.sourceCaches[S.source],S,I,a),S.source&&(v.rttCoords[S.source]=this._coordsAscendingStr[S.source][v.tileID.key])}}return It(this.painter,this.terrain,this._rttTiles,a),this._rttTiles=[],this.pool.freeAllObjects(),De[o]}return!1}}const La={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},Vo=Di,Fs={hash:!1,interactive:!0,bearingSnap:7,attributionControl:Bs,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:c.a.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0},pi={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class ec{constructor(e,i,a=!1){this.mousedown=u=>{this.startMove(u,fe.mousePos(this.element,u)),fe.addEventListener(window,"mousemove",this.mousemove),fe.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=u=>{this.move(u,fe.mousePos(this.element,u))},this.mouseup=u=>{this._rotatePitchHanlder.dragEnd(u),this.offTemp()},this.touchstart=u=>{u.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=fe.touchPos(this.element,u.targetTouches)[0],this.startMove(u,this._startPos),fe.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),fe.addEventListener(window,"touchend",this.touchend))},this.touchmove=u=>{u.targetTouches.length!==1?this.reset():(this._lastPos=fe.touchPos(this.element,u.targetTouches)[0],this.move(u,this._lastPos))},this.touchend=u=>{u.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this._rotatePitchHanlder.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=i;const o=new $c;this._rotatePitchHanlder=new Zn({clickTolerance:3,move:(u,f)=>{const _=i.getBoundingClientRect(),y=new c.P((_.bottom-_.top)/2,(_.right-_.left)/2);return{bearingDelta:c.cm(new c.P(u.x,f.y),f,y),pitchDelta:a?-.5*(f.y-u.y):void 0}},moveStateManager:o,enable:!0,assignEvents:()=>{}}),this.map=e,fe.addEventListener(i,"mousedown",this.mousedown),fe.addEventListener(i,"touchstart",this.touchstart,{passive:!1}),fe.addEventListener(i,"touchcancel",this.reset)}startMove(e,i){this._rotatePitchHanlder.dragStart(e,i),fe.disableDrag()}move(e,i){const a=this.map,{bearingDelta:o,pitchDelta:u}=this._rotatePitchHanlder.dragMove(e,i)||{};o&&a.setBearing(a.getBearing()+o),u&&a.setPitch(a.getPitch()+u)}off(){const e=this.element;fe.removeEventListener(e,"mousedown",this.mousedown),fe.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),fe.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),fe.removeEventListener(window,"touchend",this.touchend),fe.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){fe.enableDrag(),fe.removeEventListener(window,"mousemove",this.mousemove),fe.removeEventListener(window,"mouseup",this.mouseup),fe.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),fe.removeEventListener(window,"touchend",this.touchend)}}let Jt;function tc(h,e,i,a=!1){if(a||!i.getCoveringTilesDetailsProvider().allowWorldCopies())return h?.wrap();const o=new c.S(h.lng,h.lat);if(h=new c.S(h.lng,h.lat),e){const u=new c.S(h.lng-360,h.lat),f=new c.S(h.lng+360,h.lat),_=i.locationToScreenPoint(h).distSqr(e);i.locationToScreenPoint(u).distSqr(e)<_?h=u:i.locationToScreenPoint(f).distSqr(e)<_&&(h=f)}for(;Math.abs(h.lng-i.center.lng)>180;){const u=i.locationToScreenPoint(h);if(u.x>=0&&u.y>=0&&u.x<=i.width&&u.y<=i.height)break;h.lng>i.center.lng?h.lng-=360:h.lng+=360}return h.lng!==o.lng&&i.isPointOnMapSurface(i.locationToScreenPoint(h))?h:o}const un={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function bt(h,e,i){const a=h.classList;for(const o in un)a.remove(`maplibregl-${i}-anchor-${o}`);a.add(`maplibregl-${i}-anchor-${e}`)}class Ct extends c.E{constructor(e){if(super(),this._onKeyPress=i=>{const a=i.code,o=i.charCode||i.keyCode;a!=="Space"&&a!=="Enter"&&o!==32&&o!==13||this.togglePopup()},this._onMapClick=i=>{const a=i.originalEvent.target,o=this._element;this._popup&&(a===o||o.contains(a))&&this.togglePopup()},this._update=i=>{if(!this._map)return;const a=this._map.loaded()&&!this._map.isMoving();(i?.type==="terrain"||i?.type==="render"&&!a)&&this._map.once("render",this._update),this._lngLat=tc(this._lngLat,this._flatPos,this._map.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let o="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?o=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(o=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let u="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?u="rotateX(0deg)":this._pitchAlignment==="map"&&(u=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||i&&i.type!=="moveend"||(this._pos=this._pos.round()),fe.setTransform(this._element,`${un[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${u} ${o}`),Ge.frameAsync(new AbortController).then(()=>{this._updateOpacity(i&&i.type==="moveend")}).catch(()=>{})},this._onMove=i=>{if(!this._isDragging){const a=this._clickTolerance||this._map._clickTolerance;this._isDragging=i.point.dist(this._pointerdownPos)>=a}this._isDragging&&(this._pos=i.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new c.l("dragstart"))),this.fire(new c.l("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new c.l("dragend")),this._state="inactive"},this._addDragHandler=i=>{this._element.contains(i.originalEvent.target)&&(i.preventDefault(),this._positionDelta=i.point.sub(this._pos).add(this._offset),this._pointerdownPos=i.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._subpixelPositioning=e&&e.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&e.pitchAlignment!=="auto"?e.pitchAlignment:this._rotationAlignment,this.setOpacity(e?.opacity,e?.opacityWhenCovered),e&&e.element)this._element=e.element,this._offset=c.P.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=fe.create("div");const i=fe.createNS("http://www.w3.org/2000/svg","svg"),a=41,o=27;i.setAttributeNS(null,"display","block"),i.setAttributeNS(null,"height",`${a}px`),i.setAttributeNS(null,"width",`${o}px`),i.setAttributeNS(null,"viewBox",`0 0 ${o} ${a}`);const u=fe.createNS("http://www.w3.org/2000/svg","g");u.setAttributeNS(null,"stroke","none"),u.setAttributeNS(null,"stroke-width","1"),u.setAttributeNS(null,"fill","none"),u.setAttributeNS(null,"fill-rule","evenodd");const f=fe.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"fill-rule","nonzero");const _=fe.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"transform","translate(3.0, 29.0)"),_.setAttributeNS(null,"fill","#000000");const y=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const N of y){const $=fe.createNS("http://www.w3.org/2000/svg","ellipse");$.setAttributeNS(null,"opacity","0.04"),$.setAttributeNS(null,"cx","10.5"),$.setAttributeNS(null,"cy","5.80029008"),$.setAttributeNS(null,"rx",N.rx),$.setAttributeNS(null,"ry",N.ry),_.appendChild($)}const v=fe.createNS("http://www.w3.org/2000/svg","g");v.setAttributeNS(null,"fill",this._color);const w=fe.createNS("http://www.w3.org/2000/svg","path");w.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),v.appendChild(w);const P=fe.createNS("http://www.w3.org/2000/svg","g");P.setAttributeNS(null,"opacity","0.25"),P.setAttributeNS(null,"fill","#000000");const S=fe.createNS("http://www.w3.org/2000/svg","path");S.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),P.appendChild(S);const I=fe.createNS("http://www.w3.org/2000/svg","g");I.setAttributeNS(null,"transform","translate(6.0, 7.0)"),I.setAttributeNS(null,"fill","#FFFFFF");const k=fe.createNS("http://www.w3.org/2000/svg","g");k.setAttributeNS(null,"transform","translate(8.0, 8.0)");const V=fe.createNS("http://www.w3.org/2000/svg","circle");V.setAttributeNS(null,"fill","#000000"),V.setAttributeNS(null,"opacity","0.25"),V.setAttributeNS(null,"cx","5.5"),V.setAttributeNS(null,"cy","5.5"),V.setAttributeNS(null,"r","5.4999962");const O=fe.createNS("http://www.w3.org/2000/svg","circle");O.setAttributeNS(null,"fill","#FFFFFF"),O.setAttributeNS(null,"cx","5.5"),O.setAttributeNS(null,"cy","5.5"),O.setAttributeNS(null,"r","5.4999962"),k.appendChild(V),k.appendChild(O),f.appendChild(_),f.appendChild(v),f.appendChild(P),f.appendChild(I),f.appendChild(k),i.appendChild(f),i.setAttributeNS(null,"height",a*this._scale+"px"),i.setAttributeNS(null,"width",o*this._scale+"px"),this._element.appendChild(i),this._offset=c.P.convert(e&&e.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",i=>{i.preventDefault()}),this._element.addEventListener("mousedown",i=>{i.preventDefault()}),bt(this._element,this._anchor,"marker"),e&&e.className)for(const i of e.className.split(" "))this._element.classList.add(i);this._popup=null}addTo(e){return this.remove(),this._map=e,this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.on("terrain",this._update),e.on("projectiontransition",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),fe.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=c.S.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){const o=Math.abs(13.5)/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[o,-1*(38.1-13.5+o)],"bottom-right":[-o,-1*(38.1-13.5+o)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=e,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}getPopup(){return this._popup}togglePopup(){const e=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:e?(e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map)),this):this}_updateOpacity(e=!1){var i,a;const o=(i=this._map)===null||i===void 0?void 0:i.terrain,u=this._map.transform.isLocationOccluded(this._lngLat);if(!o||u){const I=u?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==I&&(this._element.style.opacity=I))}if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const f=this._map,_=f.terrain.depthAtPoint(this._pos),y=f.terrain.getElevationForLngLatZoom(this._lngLat,f.transform.tileZoom);if(f.transform.lngLatToCameraDepth(this._lngLat,y)-_<.006)return void(this._element.style.opacity=this._opacity);const v=-this._offset.y/f.transform.pixelsPerMeter,w=Math.sin(f.getPitch()*Math.PI/180)*v,P=f.terrain.depthAtPoint(new c.P(this._pos.x,this._pos.y-this._offset.y)),S=f.transform.lngLatToCameraDepth(this._lngLat,y+w)-P>.006;!((a=this._popup)===null||a===void 0)&&a.isOpen()&&S&&this._popup.remove(),this._element.style.opacity=S?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(e){return this._offset=c.P.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._map&&(e?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&e!=="auto"?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,i){return(this._opacity===void 0||e===void 0&&i===void 0)&&(this._opacity="1",this._opacityWhenCovered="0.2"),e!==void 0&&(this._opacity=e),i!==void 0&&(this._opacityWhenCovered=i),this._map&&this._updateOpacity(!0),this}}const ic={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Br=0,Fr=!1;const No={maxWidth:100,unit:"metric"};function Ba(h,e,i){const a=i&&i.maxWidth||100,o=h._container.clientHeight/2,u=h._container.clientWidth/2,f=h.unproject([u-a/2,o]),_=h.unproject([u+a/2,o]),y=Math.round(h.project(_).x-h.project(f).x),v=Math.min(a,y,h._container.clientWidth),w=f.distanceTo(_);if(i&&i.unit==="imperial"){const P=3.2808*w;P>5280?dn(e,v,P/5280,h._getUIString("ScaleControl.Miles")):dn(e,v,P,h._getUIString("ScaleControl.Feet"))}else i&&i.unit==="nautical"?dn(e,v,w/1852,h._getUIString("ScaleControl.NauticalMiles")):w>=1e3?dn(e,v,w/1e3,h._getUIString("ScaleControl.Kilometers")):dn(e,v,w,h._getUIString("ScaleControl.Meters"))}function dn(h,e,i,a){const o=function(u){const f=Math.pow(10,`${Math.floor(u)}`.length-1);let _=u/f;return _=_>=10?10:_>=5?5:_>=3?3:_>=2?2:_>=1?1:function(y){const v=Math.pow(10,Math.ceil(-Math.log(y)/Math.LN10));return Math.round(y*v)/v}(_),f*_}(i);h.style.width=e*(o/i)+"px",h.innerHTML=`${o} ${a}`}const Os={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0},Uo=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Fa(h){if(h){if(typeof h=="number"){const e=Math.round(Math.abs(h)/Math.SQRT2);return{center:new c.P(0,0),top:new c.P(0,h),"top-left":new c.P(e,e),"top-right":new c.P(-e,e),bottom:new c.P(0,-h),"bottom-left":new c.P(e,-e),"bottom-right":new c.P(-e,-e),left:new c.P(h,0),right:new c.P(-h,0)}}if(h instanceof c.P||Array.isArray(h)){const e=c.P.convert(h);return{center:e,top:e,"top-left":e,"top-right":e,bottom:e,"bottom-left":e,"bottom-right":e,left:e,right:e}}return{center:c.P.convert(h.center||[0,0]),top:c.P.convert(h.top||[0,0]),"top-left":c.P.convert(h["top-left"]||[0,0]),"top-right":c.P.convert(h["top-right"]||[0,0]),bottom:c.P.convert(h.bottom||[0,0]),"bottom-left":c.P.convert(h["bottom-left"]||[0,0]),"bottom-right":c.P.convert(h["bottom-right"]||[0,0]),left:c.P.convert(h.left||[0,0]),right:c.P.convert(h.right||[0,0])}}return Fa(new c.P(0,0))}const $o=Di;z.AJAXError=c.cy,z.Event=c.l,z.Evented=c.E,z.LngLat=c.S,z.MercatorCoordinate=c.a0,z.Point=c.P,z.addProtocol=c.cz,z.config=c.a,z.removeProtocol=c.cA,z.AttributionControl=Da,z.BoxZoomHandler=Eo,z.CanvasSource=Ar,z.CooperativeGesturesHandler=Kl,z.DoubleClickZoomHandler=za,z.DragPanHandler=Bo,z.DragRotateHandler=ka,z.EdgeInsets=Fi,z.FullscreenControl=class extends c.E{constructor(h={}){super(),this._onFullscreenChange=()=>{var e;let i=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((e=i?.shadowRoot)===null||e===void 0)&&e.fullscreenElement;)i=i.shadowRoot.fullscreenElement;i===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,h&&h.container&&(h.container instanceof HTMLElement?this._container=h.container:c.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(h){return this._map=h,this._container||(this._container=this._map.getContainer()),this._controlContainer=fe.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){fe.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const h=this._fullscreenButton=fe.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);fe.create("span","maplibregl-ctrl-icon",h).setAttribute("aria-hidden","true"),h.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const h=this._getTitle();this._fullscreenButton.setAttribute("aria-label",h),this._fullscreenButton.title=h}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new c.l("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new c.l("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},z.GeoJSONSource=Pi,z.GeolocateControl=class extends c.E{constructor(h){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new c.l("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(e),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new c.l("geolocate",e)),this._finish()}},this._updateCamera=e=>{const i=new c.S(e.coords.longitude,e.coords.latitude),a=e.coords.accuracy,o=this._map.getBearing(),u=c.e({bearing:o},this.options.fitBoundsOptions),f=Mt.fromLngLat(i,a);this._map.fitBounds(f,u,{geolocateSource:!0})},this._updateMarker=e=>{if(e){const i=new c.S(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=e=>{if(this._map){if(e.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(e.code===3&&Fr)return;this.options.trackUserLocation&&this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new c.l("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=fe.create("button","maplibregl-ctrl-geolocate",this._container),fe.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=e=>{if(this._map){if(e===!1){c.w("Geolocation support is not available so the GeolocateControl will be disabled.");const i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}else{const i=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=fe.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Ct({element:this._dotElement}),this._circleElement=fe.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Ct({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",i=>{i.geolocateSource||this._watchState!=="ACTIVE_LOCK"||i.originalEvent&&i.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new c.l("trackuserlocationend")),this.fire(new c.l("userlocationlostfocus")))})}},this.options=c.e({},ic,h)}onAdd(h){return this._map=h,this._container=fe.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return c._(this,arguments,void 0,function*(e=!1){if(Jt!==void 0&&!e)return Jt;if(window.navigator.permissions===void 0)return Jt=!!window.navigator.geolocation,Jt;try{Jt=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Jt=!!window.navigator.geolocation}return Jt})}().then(e=>this._finishSetupUI(e)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),fe.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Br=0,Fr=!1}_isOutOfMapMaxBounds(h){const e=this._map.getMaxBounds(),i=h.coords;return e&&(i.longitude<e.getWest()||i.longitude>e.getEast()||i.latitude<e.getSouth()||i.latitude>e.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const h=this._map.getBounds(),e=h.getSouthEast(),i=h.getNorthEast(),a=e.distanceTo(i),o=Math.ceil(this._accuracy/(a/this._map._container.clientHeight)*2);this._circleElement.style.width=`${o}px`,this._circleElement.style.height=`${o}px`}trigger(){if(!this._setup)return c.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new c.l("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Br--,Fr=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new c.l("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new c.l("trackuserlocationstart")),this.fire(new c.l("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let h;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Br++,Br>1?(h={maximumAge:6e5,timeout:0},Fr=!0):(h=this.options.positionOptions,Fr=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,h)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},z.GlobeControl=class{constructor(){this._toggleProjection=()=>{var h;const e=(h=this._map.getProjection())===null||h===void 0?void 0:h.type;this._map.setProjection(e!=="mercator"&&e?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var h;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),((h=this._map.getProjection())===null||h===void 0?void 0:h.type)==="globe"?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(h){return this._map=h,this._container=fe.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=fe.create("button","maplibregl-ctrl-globe",this._container),fe.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._container}onRemove(){fe.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},z.Hash=Es,z.ImageSource=_i,z.KeyboardHandler=Wn,z.LngLatBounds=Mt,z.LogoControl=jo,z.Map=class extends gt{constructor(h){var e,i;c.cv.mark(c.cw.create);const a=Object.assign(Object.assign(Object.assign({},Fs),h),{canvasContextAttributes:Object.assign(Object.assign({},Fs.canvasContextAttributes),h.canvasContextAttributes)});if(a.minZoom!=null&&a.maxZoom!=null&&a.minZoom>a.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(a.minPitch!=null&&a.maxPitch!=null&&a.minPitch>a.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(a.minPitch!=null&&a.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(a.maxPitch!=null&&a.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");const o=new Rt,u=new aa;if(a.minZoom!==void 0&&o.setMinZoom(a.minZoom),a.maxZoom!==void 0&&o.setMaxZoom(a.maxZoom),a.minPitch!==void 0&&o.setMinPitch(a.minPitch),a.maxPitch!==void 0&&o.setMaxPitch(a.maxPitch),a.renderWorldCopies!==void 0&&o.setRenderWorldCopies(a.renderWorldCopies),super(o,u,{bearingSnap:a.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new Jl,this._controls=[],this._mapId=c.a6(),this._contextLost=_=>{_.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new c.l("webglcontextlost",{originalEvent:_}))},this._contextRestored=_=>{this._setupPainter(),this.resize(),this._update(),this.fire(new c.l("webglcontextrestored",{originalEvent:_}))},this._onMapScroll=_=>{if(_.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=a.interactive,this._maxTileCacheSize=a.maxTileCacheSize,this._maxTileCacheZoomLevels=a.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},a.canvasContextAttributes),this._trackResize=a.trackResize===!0,this._bearingSnap=a.bearingSnap,this._centerClampedToGround=a.centerClampedToGround,this._refreshExpiredTiles=a.refreshExpiredTiles===!0,this._fadeDuration=a.fadeDuration,this._crossSourceCollisions=a.crossSourceCollisions===!0,this._collectResourceTiming=a.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},La),a.locale),this._clickTolerance=a.clickTolerance,this._overridePixelRatio=a.pixelRatio,this._maxCanvasSize=a.maxCanvasSize,this.transformCameraUpdate=a.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=a.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=ci.addThrottleControl(()=>this.isMoving()),this._requestManager=new Dt(a.transformRequest),typeof a.container=="string"){if(this._container=document.getElementById(a.container),!this._container)throw new Error(`Container '${a.container}' not found.`)}else{if(!(a.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=a.container}if(a.maxBounds&&this.setMaxBounds(a.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let _=!1;const y=Ma(v=>{this._trackResize&&!this._removed&&(this.resize(v),this.redraw())},50);this._resizeObserver=new ResizeObserver(v=>{_?y(v):_=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Lr(this,a),this._hash=a.hash&&new Es(typeof a.hash=="string"&&a.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:a.center,elevation:a.elevation,zoom:a.zoom,bearing:a.bearing,pitch:a.pitch,roll:a.roll}),a.bounds&&(this.resize(),this.fitBounds(a.bounds,c.e({},a.fitBoundsOptions,{duration:0}))));const f=typeof a.style=="string"||((i=(e=a.style)===null||e===void 0?void 0:e.projection)===null||i===void 0?void 0:i.type)!=="globe";this.resize(null,f),this._localIdeographFontFamily=a.localIdeographFontFamily,this._validateStyle=a.validateStyle,a.style&&this.setStyle(a.style,{localIdeographFontFamily:a.localIdeographFontFamily}),a.attributionControl&&this.addControl(new Da(typeof a.attributionControl=="boolean"?void 0:a.attributionControl)),a.maplibreLogo&&this.addControl(new jo,a.logoPosition),this.on("style.load",()=>{if(f||this._resizeTransform(),this.transform.unmodified){const _=c.Q(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(_)}}),this.on("data",_=>{this._update(_.dataType==="style"),this.fire(new c.l(`${_.dataType}data`,_))}),this.on("dataloading",_=>{this.fire(new c.l(`${_.dataType}dataloading`,_))}),this.on("dataabort",_=>{this.fire(new c.l("sourcedataabort",_))})}_getMapId(){return this._mapId}setGlobalStateProperty(h,e){return this.style.setGlobalStateProperty(h,e),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(h,e){if(e===void 0&&(e=h.getDefaultPosition?h.getDefaultPosition():"top-right"),!h||!h.onAdd)return this.fire(new c.k(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const i=h.onAdd(this);this._controls.push(h);const a=this._controlPositions[e];return e.indexOf("bottom")!==-1?a.insertBefore(i,a.firstChild):a.appendChild(i),this}removeControl(h){if(!h||!h.onRemove)return this.fire(new c.k(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const e=this._controls.indexOf(h);return e>-1&&this._controls.splice(e,1),h.onRemove(this),this}hasControl(h){return this._controls.indexOf(h)>-1}calculateCameraOptionsFromTo(h,e,i,a){return a==null&&this.terrain&&(a=this.terrain.getElevationForLngLatZoom(i,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(h,e,i,a)}resize(h,e=!0){const[i,a]=this._containerDimensions(),o=this._getClampedPixelRatio(i,a);if(this._resizeCanvas(i,a,o),this.painter.resize(i,a,o),this.painter.overLimit()){const f=this.painter.context.gl;this._maxCanvasSize=[f.drawingBufferWidth,f.drawingBufferHeight];const _=this._getClampedPixelRatio(i,a);this._resizeCanvas(i,a,_),this.painter.resize(i,a,_)}this._resizeTransform(e);const u=!this._moving;return u&&(this.stop(),this.fire(new c.l("movestart",h)).fire(new c.l("move",h))),this.fire(new c.l("resize",h)),u&&this.fire(new c.l("moveend",h)),this}_resizeTransform(h=!0){var e;const[i,a]=this._containerDimensions();this.transform.resize(i,a,h),(e=this._requestedCameraState)===null||e===void 0||e.resize(i,a,h)}_getClampedPixelRatio(h,e){const{0:i,1:a}=this._maxCanvasSize,o=this.getPixelRatio(),u=h*o,f=e*o;return Math.min(u>i?i/u:1,f>a?a/f:1)*o}getPixelRatio(){var h;return(h=this._overridePixelRatio)!==null&&h!==void 0?h:devicePixelRatio}setPixelRatio(h){this._overridePixelRatio=h,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(h){return this.transform.setMaxBounds(Mt.convert(h)),this._update()}setMinZoom(h){if((h=h??-2)>=-2&&h<=this.transform.maxZoom)return this.transform.setMinZoom(h),this._update(),this.getZoom()<h&&this.setZoom(h),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(h){if((h=h??22)>=this.transform.minZoom)return this.transform.setMaxZoom(h),this._update(),this.getZoom()>h&&this.setZoom(h),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(h){if((h=h??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(h>=0&&h<=this.transform.maxPitch)return this.transform.setMinPitch(h),this._update(),this.getPitch()<h&&this.setPitch(h),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(h){if((h=h??60)>180)throw new Error("maxPitch must be less than or equal to 180");if(h>=this.transform.minPitch)return this.transform.setMaxPitch(h),this._update(),this.getPitch()>h&&this.setPitch(h),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(h){return this.transform.setRenderWorldCopies(h),this._update()}project(h){return this.transform.locationToScreenPoint(c.S.convert(h),this.style&&this.terrain)}unproject(h){return this.transform.screenPointToLocation(c.P.convert(h),this.terrain)}isMoving(){var h;return this._moving||((h=this.handlers)===null||h===void 0?void 0:h.isMoving())}isZooming(){var h;return this._zooming||((h=this.handlers)===null||h===void 0?void 0:h.isZooming())}isRotating(){var h;return this._rotating||((h=this.handlers)===null||h===void 0?void 0:h.isRotating())}_createDelegatedListener(h,e,i){if(h==="mouseenter"||h==="mouseover"){let a=!1;return{layers:e,listener:i,delegates:{mousemove:u=>{const f=e.filter(y=>this.getLayer(y)),_=f.length!==0?this.queryRenderedFeatures(u.point,{layers:f}):[];_.length?a||(a=!0,i.call(this,new vi(h,this,u.originalEvent,{features:_}))):a=!1},mouseout:()=>{a=!1}}}}if(h==="mouseleave"||h==="mouseout"){let a=!1;return{layers:e,listener:i,delegates:{mousemove:f=>{const _=e.filter(y=>this.getLayer(y));(_.length!==0?this.queryRenderedFeatures(f.point,{layers:_}):[]).length?a=!0:a&&(a=!1,i.call(this,new vi(h,this,f.originalEvent)))},mouseout:f=>{a&&(a=!1,i.call(this,new vi(h,this,f.originalEvent)))}}}}{const a=o=>{const u=e.filter(_=>this.getLayer(_)),f=u.length!==0?this.queryRenderedFeatures(o.point,{layers:u}):[];f.length&&(o.features=f,i.call(this,o),delete o.features)};return{layers:e,listener:i,delegates:{[h]:a}}}}_saveDelegatedListener(h,e){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[h]=this._delegatedListeners[h]||[],this._delegatedListeners[h].push(e)}_removeDelegatedListener(h,e,i){if(!this._delegatedListeners||!this._delegatedListeners[h])return;const a=this._delegatedListeners[h];for(let o=0;o<a.length;o++){const u=a[o];if(u.listener===i&&u.layers.length===e.length&&u.layers.every(f=>e.includes(f))){for(const f in u.delegates)this.off(f,u.delegates[f]);return void a.splice(o,1)}}}on(h,e,i){if(i===void 0)return super.on(h,e);const a=typeof e=="string"?[e]:e,o=this._createDelegatedListener(h,a,i);this._saveDelegatedListener(h,o);for(const u in o.delegates)this.on(u,o.delegates[u]);return{unsubscribe:()=>{this._removeDelegatedListener(h,a,i)}}}once(h,e,i){if(i===void 0)return super.once(h,e);const a=typeof e=="string"?[e]:e,o=this._createDelegatedListener(h,a,i);for(const u in o.delegates){const f=o.delegates[u];o.delegates[u]=(..._)=>{this._removeDelegatedListener(h,a,i),f(..._)}}this._saveDelegatedListener(h,o);for(const u in o.delegates)this.once(u,o.delegates[u]);return this}off(h,e,i){return i===void 0?super.off(h,e):(this._removeDelegatedListener(h,typeof e=="string"?[e]:e,i),this)}queryRenderedFeatures(h,e){if(!this.style)return[];let i;const a=h instanceof c.P||Array.isArray(h),o=a?h:[[0,0],[this.transform.width,this.transform.height]];if(e=e||(a?{}:h)||{},o instanceof c.P||typeof o[0]=="number")i=[c.P.convert(o)];else{const u=c.P.convert(o[0]),f=c.P.convert(o[1]);i=[u,new c.P(f.x,u.y),f,new c.P(u.x,f.y),u]}return this.style.queryRenderedFeatures(i,e,this.transform)}querySourceFeatures(h,e){return this.style.querySourceFeatures(h,e)}setStyle(h,e){return(e=c.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},e)).diff!==!1&&e.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&h?(this._diffStyle(h,e),this):(this._localIdeographFontFamily=e.localIdeographFontFamily,this._updateStyle(h,e))}setTransformRequest(h){return this._requestManager.setTransformRequest(h),this}_getUIString(h){const e=this._locale[h];if(e==null)throw new Error(`Missing UI string '${h}'`);return e}_updateStyle(h,e){var i,a;if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(h,e));const o=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!h)),h?(this.style=new ao(this,e||{}),this.style.setEventedParent(this,{style:this.style}),typeof h=="string"?this.style.loadURL(h,e,o):this.style.loadJSON(h,e,o),this):((a=(i=this.style)===null||i===void 0?void 0:i.projection)===null||a===void 0||a.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new ao(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(h,e){if(typeof h=="string"){const i=this._requestManager.transformRequest(h,"Style");c.j(i,new AbortController).then(a=>{this._updateDiff(a.data,e)}).catch(a=>{a&&this.fire(new c.k(a))})}else typeof h=="object"&&this._updateDiff(h,e)}_updateDiff(h,e){try{this.style.setState(h,e)&&this._update(!0)}catch(i){c.w(`Unable to perform style diff: ${i.message||i.error||i}. Rebuilding the style from scratch.`),this._updateStyle(h,e)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():c.w("There is no style added to the map.")}addSource(h,e){return this._lazyInitEmptyStyle(),this.style.addSource(h,e),this._update(!0)}isSourceLoaded(h){const e=this.style&&this.style.sourceCaches[h];if(e!==void 0)return e.loaded();this.fire(new c.k(new Error(`There is no source with ID '${h}'`)))}setTerrain(h){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),h){const e=this.style.sourceCaches[h.source];if(!e)throw new Error(`cannot load terrain, because there exists no source with ID: ${h.source}`);this.terrain===null&&e.reload();for(const i in this.style._layers){const a=this.style._layers[i];a.type==="hillshade"&&a.source===h.source&&c.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality."),a.type==="color-relief"&&a.source===h.source&&c.w("You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new ar(this.painter,e,h),this.painter.renderToTexture=new je(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=i=>{var a;i.dataType==="style"?this.terrain.sourceCache.freeRtt():i.dataType==="source"&&i.tile&&(i.sourceId!==h.source||this._elevationFreeze||(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),((a=i.source)===null||a===void 0?void 0:a.type)==="image"?this.terrain.sourceCache.freeRtt():this.terrain.sourceCache.freeRtt(i.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0);return this.fire(new c.l("terrain",{terrain:h})),this}getTerrain(){var h,e;return(e=(h=this.terrain)===null||h===void 0?void 0:h.options)!==null&&e!==void 0?e:null}areTilesLoaded(){const h=this.style&&this.style.sourceCaches;for(const e in h){const i=h[e]._tiles;for(const a in i){const o=i[a];if(o.state!=="loaded"&&o.state!=="errored")return!1}}return!0}removeSource(h){return this.style.removeSource(h),this._update(!0)}getSource(h){return this.style.getSource(h)}setSourceTileLodParams(h,e,i){if(i){const a=this.getSource(i);if(!a)throw new Error(`There is no source with ID "${i}", cannot set LOD parameters`);a.calculateTileZoom=ce(Math.max(1,h),Math.max(1,e))}else for(const a in this.style.sourceCaches)this.style.sourceCaches[a].getSource().calculateTileZoom=ce(Math.max(1,h),Math.max(1,e));return this._update(!0),this}refreshTiles(h,e){const i=this.style.sourceCaches[h];if(!i)throw new Error(`There is no source cache with ID "${h}", cannot refresh tile`);e===void 0?i.reload(!0):i.refreshTiles(e.map(a=>new c.a3(a.z,a.x,a.y)))}addImage(h,e,i={}){const{pixelRatio:a=1,sdf:o=!1,stretchX:u,stretchY:f,content:_,textFitWidth:y,textFitHeight:v}=i;if(this._lazyInitEmptyStyle(),!(e instanceof HTMLImageElement||c.b(e))){if(e.width===void 0||e.height===void 0)return this.fire(new c.k(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:w,height:P,data:S}=e,I=e;return this.style.addImage(h,{data:new c.R({width:w,height:P},new Uint8Array(S)),pixelRatio:a,stretchX:u,stretchY:f,content:_,textFitWidth:y,textFitHeight:v,sdf:o,version:0,userImage:I}),I.onAdd&&I.onAdd(this,h),this}}{const{width:w,height:P,data:S}=Ge.getImageData(e);this.style.addImage(h,{data:new c.R({width:w,height:P},S),pixelRatio:a,stretchX:u,stretchY:f,content:_,textFitWidth:y,textFitHeight:v,sdf:o,version:0})}}updateImage(h,e){const i=this.style.getImage(h);if(!i)return this.fire(new c.k(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const a=e instanceof HTMLImageElement||c.b(e)?Ge.getImageData(e):e,{width:o,height:u,data:f}=a;if(o===void 0||u===void 0)return this.fire(new c.k(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(o!==i.data.width||u!==i.data.height)return this.fire(new c.k(new Error("The width and height of the updated image must be that same as the previous version of the image")));const _=!(e instanceof HTMLImageElement||c.b(e));return i.data.replace(f,_),this.style.updateImage(h,i),this}getImage(h){return this.style.getImage(h)}hasImage(h){return h?!!this.style.getImage(h):(this.fire(new c.k(new Error("Missing required image id"))),!1)}removeImage(h){this.style.removeImage(h)}loadImage(h){return ci.getImage(this._requestManager.transformRequest(h,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(h,e){return this._lazyInitEmptyStyle(),this.style.addLayer(h,e),this._update(!0)}moveLayer(h,e){return this.style.moveLayer(h,e),this._update(!0)}removeLayer(h){return this.style.removeLayer(h),this._update(!0)}getLayer(h){return this.style.getLayer(h)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(h,e,i){return this.style.setLayerZoomRange(h,e,i),this._update(!0)}setFilter(h,e,i={}){return this.style.setFilter(h,e,i),this._update(!0)}getFilter(h){return this.style.getFilter(h)}setPaintProperty(h,e,i,a={}){return this.style.setPaintProperty(h,e,i,a),this._update(!0)}getPaintProperty(h,e){return this.style.getPaintProperty(h,e)}setLayoutProperty(h,e,i,a={}){return this.style.setLayoutProperty(h,e,i,a),this._update(!0)}getLayoutProperty(h,e){return this.style.getLayoutProperty(h,e)}setGlyphs(h,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(h,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(h,e,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(h,e,i,a=>{a||this._update(!0)}),this}removeSprite(h){return this._lazyInitEmptyStyle(),this.style.removeSprite(h),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(h,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(h,e,i=>{i||this._update(!0)}),this}setLight(h,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(h,e),this._update(!0)}getLight(){return this.style.getLight()}setSky(h,e={}){return this._lazyInitEmptyStyle(),this.style.setSky(h,e),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(h,e){return this.style.setFeatureState(h,e),this._update()}removeFeatureState(h,e){return this.style.removeFeatureState(h,e),this._update()}getFeatureState(h){return this.style.getFeatureState(h)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let h=0,e=0;return this._container&&(h=this._container.clientWidth||400,e=this._container.clientHeight||300),[h,e]}_setupContainer(){const h=this._container;h.classList.add("maplibregl-map");const e=this._canvasContainer=fe.create("div","maplibregl-canvas-container",h);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=fe.create("canvas","maplibregl-canvas",e),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const i=this._containerDimensions(),a=this._getClampedPixelRatio(i[0],i[1]);this._resizeCanvas(i[0],i[1],a);const o=this._controlContainer=fe.create("div","maplibregl-control-container",h),u=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(f=>{u[f]=fe.create("div",`maplibregl-ctrl-${f} `,o)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(h,e,i){this._canvas.width=Math.floor(i*h),this._canvas.height=Math.floor(i*e),this._canvas.style.width=`${h}px`,this._canvas.style.height=`${e}px`}_setupPainter(){const h=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0});let e=null;this._canvas.addEventListener("webglcontextcreationerror",a=>{e={requestedAttributes:h},a&&(e.statusMessage=a.statusMessage,e.type=a.type)},{once:!0});let i=null;if(i=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,h):this._canvas.getContext("webgl2",h)||this._canvas.getContext("webgl",h),!i){const a="Failed to initialize WebGL";throw e?(e.message=a,new Error(JSON.stringify(e))):new Error(a)}this.painter=new ji(i,this.transform),Le.testSupport(i)}migrateProjection(h,e){super.migrateProjection(h,e),this.painter.transform=h,this.fire(new c.l("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(h){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||h,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(h){return this._update(),this._renderTaskQueue.add(h)}_cancelRenderFrame(h){this._renderTaskQueue.remove(h)}_render(h){var e,i,a,o,u;const f=this._idleTriggered?this._fadeDuration:0,_=((e=this.style.projection)===null||e===void 0?void 0:e.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(h),this._removed)return;let y=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const P=this.transform.zoom,S=Ge.now();this.style.zoomHistory.update(P,S);const I=new c.F(P,{now:S,fadeDuration:f,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition(),globalState:this.style.getGlobalState()}),k=I.crossFadingFactor();k===1&&k===this._crossFadingFactor||(y=!0,this._crossFadingFactor=k),this.style.update(I)}const v=((i=this.style.projection)===null||i===void 0?void 0:i.transitionState)>0!==_;(a=this.style.projection)===null||a===void 0||a.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState((o=this.style.projection)===null||o===void 0?void 0:o.transitionState,(u=this.style.projection)===null||u===void 0?void 0:u.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||v)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=this.style&&this.style._updatePlacement(this.transform,this.showCollisionBoxes,f,this._crossSourceCollisions,v),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:f,showPadding:this.showPadding}),this.fire(new c.l("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,c.cv.mark(c.cw.load),this.fire(new c.l("load"))),this.style&&(this.style.hasTransitions()||y)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const w=this._sourcesDirty||this._styleDirty||this._placementDirty;return w||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new c.l("idle")),!this._loaded||this._fullyLoaded||w||(this._fullyLoaded=!0,c.cv.mark(c.cw.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var h;this._hash&&this._hash.remove();for(const i of this._controls)i.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),ci.removeThrottleControl(this._imageQueueHandle),(h=this._resizeObserver)===null||h===void 0||h.disconnect();const e=this.painter.context.gl.getExtension("WEBGL_lose_context");e?.loseContext&&e.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),fe.remove(this._canvasContainer),fe.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),c.cv.clearMetrics(),this._removed=!0,this.fire(new c.l("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,Ge.frame(this._frameRequest,h=>{c.cv.frame(h),this._frameRequest=null;try{this._render(h)}catch(e){if(!c.cx(e)&&!function(i){return i.message===wo}(e))throw e}},()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(h){this._showTileBoundaries!==h&&(this._showTileBoundaries=h,this._update())}get showPadding(){return!!this._showPadding}set showPadding(h){this._showPadding!==h&&(this._showPadding=h,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(h){this._showCollisionBoxes!==h&&(this._showCollisionBoxes=h,h?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(h){this._showOverdrawInspector!==h&&(this._showOverdrawInspector=h,this._update())}get repaint(){return!!this._repaint}set repaint(h){this._repaint!==h&&(this._repaint=h,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(h){this._vertices=h,this._update()}get version(){return Vo}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(h){return this._lazyInitEmptyStyle(),this.style.setProjection(h),this._update(!0)}},z.MapMouseEvent=vi,z.MapTouchEvent=Zi,z.MapWheelEvent=Ao,z.Marker=Ct,z.NavigationControl=class{constructor(h){this._updateZoomButtons=()=>{const e=this._map.getZoom(),i=e===this._map.getMaxZoom(),a=e===this._map.getMinZoom();this._zoomInButton.disabled=i,this._zoomOutButton.disabled=a,this._zoomInButton.setAttribute("aria-disabled",i.toString()),this._zoomOutButton.setAttribute("aria-disabled",a.toString())},this._rotateCompassArrow=()=>{this._compassIcon.style.transform=this.options.visualizePitch&&this.options.visualizeRoll?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateZ(${-this._map.transform.roll}deg) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizeRoll?`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`:`rotate(${-this._map.transform.bearing}deg)`},this._setButtonTitle=(e,i)=>{const a=this._map._getUIString(`NavigationControl.${i}`);e.title=a,e.setAttribute("aria-label",a)},this.options=c.e({},pi,h),this._container=fe.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",e=>this._map.zoomIn({},{originalEvent:e})),fe.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",e=>this._map.zoomOut({},{originalEvent:e})),fe.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})}),this._compassIcon=fe.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(h){return this._map=h,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new ec(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){fe.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(h,e){const i=fe.create("button",h,this._container);return i.type="button",i.addEventListener("click",e),i}},z.Popup=class extends c.E{constructor(h){super(),this._updateOpacity=()=>{this.options.locationOccludedOpacity!==void 0&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:"")},this.remove=()=>(this._content&&fe.remove(this._content),this._container&&(fe.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new c.l("close"))),this),this._onMouseUp=e=>{this._update(e.point)},this._onMouseMove=e=>{this._update(e.point)},this._onDrag=e=>{this._update(e.point)},this._update=e=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=fe.create("div","maplibregl-popup",this._map.getContainer()),this._tip=fe.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const f of this.options.className.split(" "))this._container.classList.add(f);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=tc(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),this._trackPointer&&!e)return;const i=this._flatPos=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&e?e:this._map.transform.locationToScreenPoint(this._lngLat));let a=this.options.anchor;const o=Fa(this.options.offset);if(!a){const f=this._container.offsetWidth,_=this._container.offsetHeight;let y;y=i.y+o.bottom.y<_?["top"]:i.y>this._map.transform.height-_?["bottom"]:[],i.x<f/2?y.push("left"):i.x>this._map.transform.width-f/2&&y.push("right"),a=y.length===0?"bottom":y.join("-")}let u=i.add(o[a]);this.options.subpixelPositioning||(u=u.round()),fe.setTransform(this._container,`${un[a]} translate(${u.x}px,${u.y}px)`),bt(this._container,a,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=c.e(Object.create(Os),h)}addTo(h){return this._map&&this.remove(),this._map=h,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new c.l("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(h){return this._lngLat=c.S.convert(h),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(h){return this.setDOMContent(document.createTextNode(h))}setHTML(h){const e=document.createDocumentFragment(),i=document.createElement("body");let a;for(i.innerHTML=h;a=i.firstChild,a;)e.appendChild(a);return this.setDOMContent(e)}getMaxWidth(){var h;return(h=this._container)===null||h===void 0?void 0:h.style.maxWidth}setMaxWidth(h){return this.options.maxWidth=h,this._update(),this}setDOMContent(h){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=fe.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(h),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(h){return this._container&&this._container.classList.add(h),this}removeClassName(h){return this._container&&this._container.classList.remove(h),this}setOffset(h){return this.options.offset=h,this._update(),this}toggleClassName(h){if(this._container)return this._container.classList.toggle(h)}setSubpixelPositioning(h){this.options.subpixelPositioning=h}_createCloseButton(){this.options.closeButton&&(this._closeButton=fe.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const h=this._container.querySelector(Uo);h&&h.focus()}},z.RasterDEMTileSource=Yt,z.RasterTileSource=bn,z.ScaleControl=class{constructor(h){this._onMove=()=>{Ba(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,Ba(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},No),h)}getDefaultPosition(){return"bottom-left"}onAdd(h){return this._map=h,this._container=fe.create("div","maplibregl-ctrl maplibregl-ctrl-scale",h.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){fe.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},z.ScrollZoomHandler=Yl,z.Style=ao,z.TerrainControl=class{constructor(h){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=h}onAdd(h){return this._map=h,this._container=fe.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=fe.create("button","maplibregl-ctrl-terrain",this._container),fe.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){fe.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},z.TwoFingersTouchPitchHandler=Do,z.TwoFingersTouchRotateHandler=ko,z.TwoFingersTouchZoomHandler=sr,z.TwoFingersTouchZoomRotateHandler=Fo,z.VectorTileSource=Bi,z.VideoSource=Yr,z.addSourceType=(h,e)=>c._(void 0,void 0,void 0,function*(){if(Kr(h))throw new Error(`A source type called "${h}" already exists.`);((i,a)=>{ss[i]=a})(h,e)}),z.clearPrewarmedResources=function(){const h=Ni;h&&(h.isPreloaded()&&h.numActive()===1?(h.release(xn),Ni=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},z.createTileMesh=ro,z.getMaxParallelImageRequests=function(){return c.a.MAX_PARALLEL_IMAGE_REQUESTS},z.getRTLTextPluginStatus=function(){return Mi().getRTLTextPluginStatus()},z.getVersion=function(){return $o},z.getWorkerCount=function(){return Ti.workerCount},z.getWorkerUrl=function(){return c.a.WORKER_URL},z.importScriptInWorkers=function(h){return vn().broadcast("IS",h)},z.prewarm=function(){Cr().acquire(xn)},z.setMaxParallelImageRequests=function(h){c.a.MAX_PARALLEL_IMAGE_REQUESTS=h},z.setRTLTextPlugin=function(h,e){return Mi().setRTLTextPlugin(h,e)},z.setWorkerCount=function(h){Ti.workerCount=h},z.setWorkerUrl=function(h){c.a.WORKER_URL=h}});var Cd=Ka;return Cd})}(bc.__module)),bc.__module.exports}exports.__require=_f;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const bt=require("./index.cjs72.js"),Et=require("./index.cjs73.js");var io=Et.__module.exports,Wn;function ao(){return Wn||(Wn=1,function(Kn,so){(function(Je,de){Kn.exports=de()})(io,function(){var Je=function(e,t){var n={drag:[],click:[],mousemove:[],mousedown:[],mouseup:[],mouseout:[],keydown:[],keyup:[],touchstart:[],touchmove:[],touchend:[],tap:[]},r={on:function(i,a,l){if(n[i]===void 0)throw new Error("Invalid event type: "+i);n[i].push({selector:a,fn:l})},render:function(i){t.store.featureChanged(i)}},o=function(i,a){for(var l=n[i],d=l.length;d--;){var h=l[d];if(h.selector(a)){h.fn.call(r,a)||t.store.render(),t.ui.updateMapClasses();break}}};return e.start.call(r),{render:e.render,stop:function(){e.stop&&e.stop()},trash:function(){e.trash&&(e.trash(),t.store.render())},combineFeatures:function(){e.combineFeatures&&e.combineFeatures()},uncombineFeatures:function(){e.uncombineFeatures&&e.uncombineFeatures()},drag:function(i){o("drag",i)},click:function(i){o("click",i)},mousemove:function(i){o("mousemove",i)},mousedown:function(i){o("mousedown",i)},mouseup:function(i){o("mouseup",i)},mouseout:function(i){o("mouseout",i)},keydown:function(i){o("keydown",i)},keyup:function(i){o("keyup",i)},touchstart:function(i){o("touchstart",i)},touchmove:function(i){o("touchmove",i)},touchend:function(i){o("touchend",i)},tap:function(i){o("tap",i)}}};function de(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Qn(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){if(this instanceof r){var o=[null];o.push.apply(o,arguments);var i=Function.bind.apply(t,o);return new i}return t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}),n}var Tt={},er={RADIUS:6378137},Zt=er;function Wt(e){var t=0;if(e&&e.length>0){t+=Math.abs(Ct(e[0]));for(var n=1;n<e.length;n++)t-=Math.abs(Ct(e[n]))}return t}function Ct(e){var t,n,r,o,i,a,l=0,d=e.length;if(d>2){for(a=0;a<d;a++)a===d-2?(r=d-2,o=d-1,i=0):a===d-1?(r=d-1,o=0,i=1):(r=a,o=a+1,i=a+2),t=e[r],n=e[o],l+=(Ot(e[i][0])-Ot(t[0]))*Math.sin(Ot(n[1]));l=l*Zt.RADIUS*Zt.RADIUS/2}return l}function Ot(e){return e*Math.PI/180}Tt.geometry=function e(t){var n,r=0;switch(t.type){case"Polygon":return Wt(t.coordinates);case"MultiPolygon":for(n=0;n<t.coordinates.length;n++)r+=Wt(t.coordinates[n]);return r;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0;case"GeometryCollection":for(n=0;n<t.geometries.length;n++)r+=e(t.geometries[n]);return r}},Tt.ring=Ct;var q={CONTROL_BASE:"mapboxgl-ctrl",CONTROL_PREFIX:"mapboxgl-ctrl-",CONTROL_BUTTON:"mapbox-gl-draw_ctrl-draw-btn",CONTROL_BUTTON_LINE:"mapbox-gl-draw_line",CONTROL_BUTTON_POLYGON:"mapbox-gl-draw_polygon",CONTROL_BUTTON_POINT:"mapbox-gl-draw_point",CONTROL_BUTTON_TRASH:"mapbox-gl-draw_trash",CONTROL_BUTTON_COMBINE_FEATURES:"mapbox-gl-draw_combine",CONTROL_BUTTON_UNCOMBINE_FEATURES:"mapbox-gl-draw_uncombine",CONTROL_GROUP:"mapboxgl-ctrl-group",ATTRIBUTION:"mapboxgl-ctrl-attrib",ACTIVE_BUTTON:"active",BOX_SELECT:"mapbox-gl-draw_boxselect"},X={HOT:"mapbox-gl-draw-hot",COLD:"mapbox-gl-draw-cold"},N={ADD:"add",MOVE:"move",DRAG:"drag",POINTER:"pointer",NONE:"none"},Y={POLYGON:"polygon",LINE:"line_string",POINT:"point"},m={FEATURE:"Feature",POLYGON:"Polygon",LINE_STRING:"LineString",POINT:"Point",FEATURE_COLLECTION:"FeatureCollection",MULTI_PREFIX:"Multi",MULTI_POINT:"MultiPoint",MULTI_LINE_STRING:"MultiLineString",MULTI_POLYGON:"MultiPolygon"},T={DRAW_LINE_STRING:"draw_line_string",DRAW_POLYGON:"draw_polygon",DRAW_POINT:"draw_point",SIMPLE_SELECT:"simple_select",DIRECT_SELECT:"direct_select",STATIC:"static"},H={CREATE:"draw.create",DELETE:"draw.delete",UPDATE:"draw.update",SELECTION_CHANGE:"draw.selectionchange",MODE_CHANGE:"draw.modechange",ACTIONABLE:"draw.actionable",RENDER:"draw.render",COMBINE_FEATURES:"draw.combine",UNCOMBINE_FEATURES:"draw.uncombine"},St={MOVE:"move",CHANGE_COORDINATES:"change_coordinates"},B={FEATURE:"feature",MIDPOINT:"midpoint",VERTEX:"vertex"},j={ACTIVE:"true",INACTIVE:"false"},Kt=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate"],It=-85,tr=Object.freeze({__proto__:null,classes:q,sources:X,cursors:N,types:Y,geojsonTypes:m,modes:T,events:H,updateActions:St,meta:B,activeStates:j,interactions:Kt,LAT_MIN:-90,LAT_RENDERED_MIN:It,LAT_MAX:90,LAT_RENDERED_MAX:85,LNG_MIN:-270,LNG_MAX:270}),Qt={Point:0,LineString:1,MultiLineString:1,Polygon:2};function nr(e,t){var n=Qt[e.geometry.type]-Qt[t.geometry.type];return n===0&&e.geometry.type===m.POLYGON?e.area-t.area:n}function en(e){return e.map(function(t){return t.geometry.type===m.POLYGON&&(t.area=Tt.geometry({type:m.FEATURE,property:{},geometry:t.geometry})),t}).sort(nr).map(function(t){return delete t.area,t})}function tn(e,t){return t===void 0&&(t=0),[[e.point.x-t,e.point.y-t],[e.point.x+t,e.point.y+t]]}function Z(e){if(this._items={},this._nums={},this._length=e?e.length:0,e)for(var t=0,n=e.length;t<n;t++)this.add(e[t]),e[t]!==void 0&&(typeof e[t]=="string"?this._items[e[t]]=t:this._nums[e[t]]=t)}Z.prototype.add=function(e){return this.has(e)||(this._length++,typeof e=="string"?this._items[e]=this._length:this._nums[e]=this._length),this},Z.prototype.delete=function(e){return this.has(e)===!1||(this._length--,delete this._items[e],delete this._nums[e]),this},Z.prototype.has=function(e){return(typeof e=="string"||typeof e=="number")&&(this._items[e]!==void 0||this._nums[e]!==void 0)},Z.prototype.values=function(){var e=this,t=[];return Object.keys(this._items).forEach(function(n){t.push({k:n,v:e._items[n]})}),Object.keys(this._nums).forEach(function(n){t.push({k:JSON.parse(n),v:e._nums[n]})}),t.sort(function(n,r){return n.v-r.v}).map(function(n){return n.k})},Z.prototype.clear=function(){return this._length=0,this._items={},this._nums={},this};var rr=[B.FEATURE,B.MIDPOINT,B.VERTEX],xe={click:function(e,t,n){return nn(e,t,n,n.options.clickBuffer)},touch:function(e,t,n){return nn(e,t,n,n.options.touchBuffer)}};function nn(e,t,n,r){if(n.map===null)return[];var o=e?tn(e,r):t,i={};n.options.styles&&(i.layers=n.options.styles.map(function(h){return h.id}).filter(function(h){return n.map.getLayer(h)!=null}));var a=n.map.queryRenderedFeatures(o,i).filter(function(h){return rr.indexOf(h.properties.meta)!==-1}),l=new Z,d=[];return a.forEach(function(h){var g=h.properties.id;l.has(g)||(l.add(g),d.push(h))}),en(d)}function ze(e,t){var n=xe.click(e,null,t),r={mouse:N.NONE};return n[0]&&(r.mouse=n[0].properties.active===j.ACTIVE?N.MOVE:N.POINTER,r.feature=n[0].properties.meta),t.events.currentModeName().indexOf("draw")!==-1&&(r.mouse=N.ADD),t.ui.queueMapClasses(r),t.ui.updateMapClasses(),n[0]}function xt(e,t){var n=e.x-t.x,r=e.y-t.y;return Math.sqrt(n*n+r*r)}function Mt(e,t,n){n===void 0&&(n={});var r=n.fineTolerance!=null?n.fineTolerance:4,o=n.grossTolerance!=null?n.grossTolerance:12,i=n.interval!=null?n.interval:500;e.point=e.point||t.point,e.time=e.time||t.time;var a=xt(e.point,t.point);return a<r||a<o&&t.time-e.time<i}function Lt(e,t,n){n===void 0&&(n={});var r=n.tolerance!=null?n.tolerance:25,o=n.interval!=null?n.interval:250;return e.point=e.point||t.point,e.time=e.time||t.time,xt(e.point,t.point)<r&&t.time-e.time<o}var rn={exports:{}},Nt=rn.exports=function(e,t){if(t||(t=16),e===void 0&&(e=128),e<=0)return"0";for(var n=Math.log(Math.pow(2,e))/Math.log(t),r=2;n===1/0;r*=2)n=Math.log(Math.pow(2,e/r))/Math.log(t)*r;var o=n-Math.floor(n),i="";for(r=0;r<Math.floor(n);r++)i=Math.floor(Math.random()*t).toString(t)+i;if(o){var a=Math.pow(t,o);i=Math.floor(Math.random()*a).toString(t)+i}var l=parseInt(i,t);return l!==1/0&&l>=Math.pow(2,e)?Nt(e,t):i};Nt.rack=function(e,t,n){var r=function(i){var a=0;do{if(a++>10){if(!n)throw new Error("too many ID collisions, use more bits");e+=n}var l=Nt(e,t)}while(Object.hasOwnProperty.call(o,l));return o[l]=i,l},o=r.hats={};return r.get=function(i){return r.hats[i]},r.set=function(i,a){return r.hats[i]=a,r},r.bits=e||128,r.base=t||16,r};var Pt=de(rn.exports),G=function(e,t){this.ctx=e,this.properties=t.properties||{},this.coordinates=t.geometry.coordinates,this.id=t.id||Pt(),this.type=t.geometry.type};G.prototype.changed=function(){this.ctx.store.featureChanged(this.id)},G.prototype.incomingCoords=function(e){this.setCoordinates(e)},G.prototype.setCoordinates=function(e){this.coordinates=e,this.changed()},G.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.coordinates))},G.prototype.setProperty=function(e,t){this.properties[e]=t},G.prototype.toGeoJSON=function(){return JSON.parse(JSON.stringify({id:this.id,type:m.FEATURE,properties:this.properties,geometry:{coordinates:this.getCoordinates(),type:this.type}}))},G.prototype.internal=function(e){var t={id:this.id,meta:B.FEATURE,"meta:type":this.type,active:j.INACTIVE,mode:e};if(this.ctx.options.userProperties)for(var n in this.properties)t["user_"+n]=this.properties[n];return{type:m.FEATURE,properties:t,geometry:{coordinates:this.getCoordinates(),type:this.type}}};var me=function(e,t){G.call(this,e,t)};(me.prototype=Object.create(G.prototype)).isValid=function(){return typeof this.coordinates[0]=="number"&&typeof this.coordinates[1]=="number"},me.prototype.updateCoordinate=function(e,t,n){this.coordinates=arguments.length===3?[t,n]:[e,t],this.changed()},me.prototype.getCoordinate=function(){return this.getCoordinates()};var ie=function(e,t){G.call(this,e,t)};(ie.prototype=Object.create(G.prototype)).isValid=function(){return this.coordinates.length>1},ie.prototype.addCoordinate=function(e,t,n){this.changed();var r=parseInt(e,10);this.coordinates.splice(r,0,[t,n])},ie.prototype.getCoordinate=function(e){var t=parseInt(e,10);return JSON.parse(JSON.stringify(this.coordinates[t]))},ie.prototype.removeCoordinate=function(e){this.changed(),this.coordinates.splice(parseInt(e,10),1)},ie.prototype.updateCoordinate=function(e,t,n){var r=parseInt(e,10);this.coordinates[r]=[t,n],this.changed()};var W=function(e,t){G.call(this,e,t),this.coordinates=this.coordinates.map(function(n){return n.slice(0,-1)})};(W.prototype=Object.create(G.prototype)).isValid=function(){return this.coordinates.length!==0&&this.coordinates.every(function(e){return e.length>2})},W.prototype.incomingCoords=function(e){this.coordinates=e.map(function(t){return t.slice(0,-1)}),this.changed()},W.prototype.setCoordinates=function(e){this.coordinates=e,this.changed()},W.prototype.addCoordinate=function(e,t,n){this.changed();var r=e.split(".").map(function(o){return parseInt(o,10)});this.coordinates[r[0]].splice(r[1],0,[t,n])},W.prototype.removeCoordinate=function(e){this.changed();var t=e.split(".").map(function(r){return parseInt(r,10)}),n=this.coordinates[t[0]];n&&(n.splice(t[1],1),n.length<3&&this.coordinates.splice(t[0],1))},W.prototype.getCoordinate=function(e){var t=e.split(".").map(function(r){return parseInt(r,10)}),n=this.coordinates[t[0]];return JSON.parse(JSON.stringify(n[t[1]]))},W.prototype.getCoordinates=function(){return this.coordinates.map(function(e){return e.concat([e[0]])})},W.prototype.updateCoordinate=function(e,t,n){this.changed();var r=e.split("."),o=parseInt(r[0],10),i=parseInt(r[1],10);this.coordinates[o]===void 0&&(this.coordinates[o]=[]),this.coordinates[o][i]=[t,n]};var or={MultiPoint:me,MultiLineString:ie,MultiPolygon:W},Ye=function(e,t,n,r,o){var i=n.split("."),a=parseInt(i[0],10),l=i[1]?i.slice(1).join("."):null;return e[a][t](l,r,o)},$=function(e,t){if(G.call(this,e,t),delete this.coordinates,this.model=or[t.geometry.type],this.model===void 0)throw new TypeError(t.geometry.type+" is not a valid type");this.features=this._coordinatesToFeatures(t.geometry.coordinates)};function E(e){this.map=e.map,this.drawConfig=JSON.parse(JSON.stringify(e.options||{})),this._ctx=e}($.prototype=Object.create(G.prototype))._coordinatesToFeatures=function(e){var t=this,n=this.model.bind(this);return e.map(function(r){return new n(t.ctx,{id:Pt(),type:m.FEATURE,properties:{},geometry:{coordinates:r,type:t.type.replace("Multi","")}})})},$.prototype.isValid=function(){return this.features.every(function(e){return e.isValid()})},$.prototype.setCoordinates=function(e){this.features=this._coordinatesToFeatures(e),this.changed()},$.prototype.getCoordinate=function(e){return Ye(this.features,"getCoordinate",e)},$.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.features.map(function(e){return e.type===m.POLYGON?e.getCoordinates():e.coordinates})))},$.prototype.updateCoordinate=function(e,t,n){Ye(this.features,"updateCoordinate",e,t,n),this.changed()},$.prototype.addCoordinate=function(e,t,n){Ye(this.features,"addCoordinate",e,t,n),this.changed()},$.prototype.removeCoordinate=function(e){Ye(this.features,"removeCoordinate",e),this.changed()},$.prototype.getFeatures=function(){return this.features},E.prototype.setSelected=function(e){return this._ctx.store.setSelected(e)},E.prototype.setSelectedCoordinates=function(e){var t=this;this._ctx.store.setSelectedCoordinates(e),e.reduce(function(n,r){return n[r.feature_id]===void 0&&(n[r.feature_id]=!0,t._ctx.store.get(r.feature_id).changed()),n},{})},E.prototype.getSelected=function(){return this._ctx.store.getSelected()},E.prototype.getSelectedIds=function(){return this._ctx.store.getSelectedIds()},E.prototype.isSelected=function(e){return this._ctx.store.isSelected(e)},E.prototype.getFeature=function(e){return this._ctx.store.get(e)},E.prototype.select=function(e){return this._ctx.store.select(e)},E.prototype.deselect=function(e){return this._ctx.store.deselect(e)},E.prototype.deleteFeature=function(e,t){return t===void 0&&(t={}),this._ctx.store.delete(e,t)},E.prototype.addFeature=function(e){return this._ctx.store.add(e)},E.prototype.clearSelectedFeatures=function(){return this._ctx.store.clearSelected()},E.prototype.clearSelectedCoordinates=function(){return this._ctx.store.clearSelectedCoordinates()},E.prototype.setActionableState=function(e){e===void 0&&(e={});var t={trash:e.trash||!1,combineFeatures:e.combineFeatures||!1,uncombineFeatures:e.uncombineFeatures||!1};return this._ctx.events.actionable(t)},E.prototype.changeMode=function(e,t,n){return t===void 0&&(t={}),n===void 0&&(n={}),this._ctx.events.changeMode(e,t,n)},E.prototype.updateUIClasses=function(e){return this._ctx.ui.queueMapClasses(e)},E.prototype.activateUIButton=function(e){return this._ctx.ui.setActiveButton(e)},E.prototype.featuresAt=function(e,t,n){if(n===void 0&&(n="click"),n!=="click"&&n!=="touch")throw new Error("invalid buffer type");return xe[n](e,t,this._ctx)},E.prototype.newFeature=function(e){var t=e.geometry.type;return t===m.POINT?new me(this._ctx,e):t===m.LINE_STRING?new ie(this._ctx,e):t===m.POLYGON?new W(this._ctx,e):new $(this._ctx,e)},E.prototype.isInstanceOf=function(e,t){if(e===m.POINT)return t instanceof me;if(e===m.LINE_STRING)return t instanceof ie;if(e===m.POLYGON)return t instanceof W;if(e==="MultiFeature")return t instanceof $;throw new Error("Unknown feature class: "+e)},E.prototype.doRender=function(e){return this._ctx.store.featureChanged(e)},E.prototype.onSetup=function(){},E.prototype.onDrag=function(){},E.prototype.onClick=function(){},E.prototype.onMouseMove=function(){},E.prototype.onMouseDown=function(){},E.prototype.onMouseUp=function(){},E.prototype.onMouseOut=function(){},E.prototype.onKeyUp=function(){},E.prototype.onKeyDown=function(){},E.prototype.onTouchStart=function(){},E.prototype.onTouchMove=function(){},E.prototype.onTouchEnd=function(){},E.prototype.onTap=function(){},E.prototype.onStop=function(){},E.prototype.onTrash=function(){},E.prototype.onCombineFeature=function(){},E.prototype.onUncombineFeature=function(){},E.prototype.toDisplayFeatures=function(){throw new Error("You must overwrite toDisplayFeatures")};var on={drag:"onDrag",click:"onClick",mousemove:"onMouseMove",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseout:"onMouseOut",keyup:"onKeyUp",keydown:"onKeyDown",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd",tap:"onTap"},ir=Object.keys(on);function ar(e){var t=Object.keys(e);return function(n,r){r===void 0&&(r={});var o={},i=t.reduce(function(a,l){return a[l]=e[l],a},new E(n));return{start:function(){var a=this;o=i.onSetup(r),ir.forEach(function(l){var d,h=on[l],g=function(){return!1};e[h]&&(g=function(){return!0}),a.on(l,g,(d=h,function(p){return i[d](o,p)}))})},stop:function(){i.onStop(o)},trash:function(){i.onTrash(o)},combineFeatures:function(){i.onCombineFeatures(o)},uncombineFeatures:function(){i.onUncombineFeatures(o)},render:function(a,l){i.toDisplayFeatures(o,a,l)}}}}function Re(e){return[].concat(e).filter(function(t){return t!==void 0})}function sr(){var e=this;if(!(e.ctx.map&&e.ctx.map.getSource(X.HOT)!==void 0))return d();var t=e.ctx.events.currentModeName();e.ctx.ui.queueMapClasses({mode:t});var n=[],r=[];e.isDirty?r=e.getAllIds():(n=e.getChangedIds().filter(function(h){return e.get(h)!==void 0}),r=e.sources.hot.filter(function(h){return h.properties.id&&n.indexOf(h.properties.id)===-1&&e.get(h.properties.id)!==void 0}).map(function(h){return h.properties.id})),e.sources.hot=[];var o=e.sources.cold.length;e.sources.cold=e.isDirty?[]:e.sources.cold.filter(function(h){var g=h.properties.id||h.properties.parent;return n.indexOf(g)===-1});var i=o!==e.sources.cold.length||r.length>0;function a(h,g){var p=e.get(h).internal(t);e.ctx.events.currentModeRender(p,function(_){e.sources[g].push(_)})}if(n.forEach(function(h){return a(h,"hot")}),r.forEach(function(h){return a(h,"cold")}),i&&e.ctx.map.getSource(X.COLD).setData({type:m.FEATURE_COLLECTION,features:e.sources.cold}),e.ctx.map.getSource(X.HOT).setData({type:m.FEATURE_COLLECTION,features:e.sources.hot}),e._emitSelectionChange&&(e.ctx.map.fire(H.SELECTION_CHANGE,{features:e.getSelected().map(function(h){return h.toGeoJSON()}),points:e.getSelectedCoordinates().map(function(h){return{type:m.FEATURE,properties:{},geometry:{type:m.POINT,coordinates:h.coordinates}}})}),e._emitSelectionChange=!1),e._deletedFeaturesToEmit.length){var l=e._deletedFeaturesToEmit.map(function(h){return h.toGeoJSON()});e._deletedFeaturesToEmit=[],e.ctx.map.fire(H.DELETE,{features:l})}function d(){e.isDirty=!1,e.clearChangedIds()}d(),e.ctx.map.fire(H.RENDER,{})}function x(e){var t,n=this;this._features={},this._featureIds=new Z,this._selectedFeatureIds=new Z,this._selectedCoordinates=[],this._changedFeatureIds=new Z,this._deletedFeaturesToEmit=[],this._emitSelectionChange=!1,this._mapInitialConfig={},this.ctx=e,this.sources={hot:[],cold:[]},this.render=function(){t||(t=requestAnimationFrame(function(){t=null,sr.call(n)}))},this.isDirty=!1}function an(e,t){var n=e._selectedCoordinates.filter(function(r){return e._selectedFeatureIds.has(r.feature_id)});e._selectedCoordinates.length===n.length||t.silent||(e._emitSelectionChange=!0),e._selectedCoordinates=n}x.prototype.createRenderBatch=function(){var e=this,t=this.render,n=0;return this.render=function(){n++},function(){e.render=t,n>0&&e.render()}},x.prototype.setDirty=function(){return this.isDirty=!0,this},x.prototype.featureChanged=function(e){return this._changedFeatureIds.add(e),this},x.prototype.getChangedIds=function(){return this._changedFeatureIds.values()},x.prototype.clearChangedIds=function(){return this._changedFeatureIds.clear(),this},x.prototype.getAllIds=function(){return this._featureIds.values()},x.prototype.add=function(e){return this.featureChanged(e.id),this._features[e.id]=e,this._featureIds.add(e.id),this},x.prototype.delete=function(e,t){var n=this;return t===void 0&&(t={}),Re(e).forEach(function(r){n._featureIds.has(r)&&(n._featureIds.delete(r),n._selectedFeatureIds.delete(r),t.silent||n._deletedFeaturesToEmit.indexOf(n._features[r])===-1&&n._deletedFeaturesToEmit.push(n._features[r]),delete n._features[r],n.isDirty=!0)}),an(this,t),this},x.prototype.get=function(e){return this._features[e]},x.prototype.getAll=function(){var e=this;return Object.keys(this._features).map(function(t){return e._features[t]})},x.prototype.select=function(e,t){var n=this;return t===void 0&&(t={}),Re(e).forEach(function(r){n._selectedFeatureIds.has(r)||(n._selectedFeatureIds.add(r),n._changedFeatureIds.add(r),t.silent||(n._emitSelectionChange=!0))}),this},x.prototype.deselect=function(e,t){var n=this;return t===void 0&&(t={}),Re(e).forEach(function(r){n._selectedFeatureIds.has(r)&&(n._selectedFeatureIds.delete(r),n._changedFeatureIds.add(r),t.silent||(n._emitSelectionChange=!0))}),an(this,t),this},x.prototype.clearSelected=function(e){return e===void 0&&(e={}),this.deselect(this._selectedFeatureIds.values(),{silent:e.silent}),this},x.prototype.setSelected=function(e,t){var n=this;return t===void 0&&(t={}),e=Re(e),this.deselect(this._selectedFeatureIds.values().filter(function(r){return e.indexOf(r)===-1}),{silent:t.silent}),this.select(e.filter(function(r){return!n._selectedFeatureIds.has(r)}),{silent:t.silent}),this},x.prototype.setSelectedCoordinates=function(e){return this._selectedCoordinates=e,this._emitSelectionChange=!0,this},x.prototype.clearSelectedCoordinates=function(){return this._selectedCoordinates=[],this._emitSelectionChange=!0,this},x.prototype.getSelectedIds=function(){return this._selectedFeatureIds.values()},x.prototype.getSelected=function(){var e=this;return this._selectedFeatureIds.values().map(function(t){return e.get(t)})},x.prototype.getSelectedCoordinates=function(){var e=this;return this._selectedCoordinates.map(function(t){return{coordinates:e.get(t.feature_id).getCoordinate(t.coord_path)}})},x.prototype.isSelected=function(e){return this._selectedFeatureIds.has(e)},x.prototype.setFeatureProperty=function(e,t,n){this.get(e).setProperty(t,n),this.featureChanged(e)},x.prototype.storeMapConfig=function(){var e=this;Kt.forEach(function(t){e.ctx.map[t]&&(e._mapInitialConfig[t]=e.ctx.map[t].isEnabled())})},x.prototype.restoreMapConfig=function(){var e=this;Object.keys(this._mapInitialConfig).forEach(function(t){e._mapInitialConfig[t]?e.ctx.map[t].enable():e.ctx.map[t].disable()})},x.prototype.getInitialConfigValue=function(e){return this._mapInitialConfig[e]===void 0||this._mapInitialConfig[e]};var ur=function(){for(var e=arguments,t={},n=0;n<arguments.length;n++){var r=e[n];for(var o in r)cr.call(r,o)&&(t[o]=r[o])}return t},cr=Object.prototype.hasOwnProperty,pe=de(ur),lr=["mode","feature","mouse"];function dr(e){var t=null,n=null,r={onRemove:function(){return e.map.off("load",r.connect),clearInterval(n),r.removeLayers(),e.store.restoreMapConfig(),e.ui.removeButtons(),e.events.removeEventListeners(),e.ui.clearMapClasses(),e.boxZoomInitial&&e.map.boxZoom.enable(),e.map=null,e.container=null,e.store=null,t&&t.parentNode&&t.parentNode.removeChild(t),t=null,this},connect:function(){e.map.off("load",r.connect),clearInterval(n),r.addLayers(),e.store.storeMapConfig(),e.events.addEventListeners()},onAdd:function(o){var i=o.fire;return o.fire=function(a,l){var d=arguments;return i.length===1&&arguments.length!==1&&(d=[pe({},{type:a},l)]),i.apply(o,d)},e.map=o,e.events=function(a){var l=Object.keys(a.options.modes).reduce(function(c,y){return c[y]=ar(a.options.modes[y]),c},{}),d={},h={},g={},p=null,_=null;g.drag=function(c,y){y({point:c.point,time:new Date().getTime()})?(a.ui.queueMapClasses({mouse:N.DRAG}),_.drag(c)):c.originalEvent.stopPropagation()},g.mousedrag=function(c){g.drag(c,function(y){return!Mt(d,y)})},g.touchdrag=function(c){g.drag(c,function(y){return!Lt(h,y)})},g.mousemove=function(c){if((c.originalEvent.buttons!==void 0?c.originalEvent.buttons:c.originalEvent.which)===1)return g.mousedrag(c);var y=ze(c,a);c.featureTarget=y,_.mousemove(c)},g.mousedown=function(c){d={time:new Date().getTime(),point:c.point};var y=ze(c,a);c.featureTarget=y,_.mousedown(c)},g.mouseup=function(c){var y=ze(c,a);c.featureTarget=y,Mt(d,{point:c.point,time:new Date().getTime()})?_.click(c):_.mouseup(c)},g.mouseout=function(c){_.mouseout(c)},g.touchstart=function(c){if(a.options.touchEnabled){h={time:new Date().getTime(),point:c.point};var y=xe.touch(c,null,a)[0];c.featureTarget=y,_.touchstart(c)}},g.touchmove=function(c){if(a.options.touchEnabled)return _.touchmove(c),g.touchdrag(c)},g.touchend=function(c){if(c.originalEvent.preventDefault(),a.options.touchEnabled){var y=xe.touch(c,null,a)[0];c.featureTarget=y,Lt(h,{time:new Date().getTime(),point:c.point})?_.tap(c):_.touchend(c)}};var P=function(c){return!(c===8||c===46||c>=48&&c<=57)};function b(c,y,O){O===void 0&&(O={}),_.stop();var V=l[c];if(V===void 0)throw new Error(c+" is not valid");p=c;var F=V(a,y);_=Je(F,a),O.silent||a.map.fire(H.MODE_CHANGE,{mode:c}),a.store.setDirty(),a.store.render()}g.keydown=function(c){(c.srcElement||c.target).classList.contains("mapboxgl-canvas")&&(c.keyCode!==8&&c.keyCode!==46||!a.options.controls.trash?P(c.keyCode)?_.keydown(c):c.keyCode===49&&a.options.controls.point?b(T.DRAW_POINT):c.keyCode===50&&a.options.controls.line_string?b(T.DRAW_LINE_STRING):c.keyCode===51&&a.options.controls.polygon&&b(T.DRAW_POLYGON):(c.preventDefault(),_.trash()))},g.keyup=function(c){P(c.keyCode)&&_.keyup(c)},g.zoomend=function(){a.store.changeZoom()},g.data=function(c){if(c.dataType==="style"){var y=a.setup,O=a.map,V=a.options,F=a.store;V.styles.some(function(jt){return O.getLayer(jt.id)})||(y.addLayers(),F.setDirty(),F.render())}};var w={trash:!1,combineFeatures:!1,uncombineFeatures:!1};return{start:function(){p=a.options.defaultMode,_=Je(l[p](a),a)},changeMode:b,actionable:function(c){var y=!1;Object.keys(c).forEach(function(O){if(w[O]===void 0)throw new Error("Invalid action type");w[O]!==c[O]&&(y=!0),w[O]=c[O]}),y&&a.map.fire(H.ACTIONABLE,{actions:w})},currentModeName:function(){return p},currentModeRender:function(c,y){return _.render(c,y)},fire:function(c,y){g[c]&&g[c](y)},addEventListeners:function(){a.map.on("mousemove",g.mousemove),a.map.on("mousedown",g.mousedown),a.map.on("mouseup",g.mouseup),a.map.on("data",g.data),a.map.on("touchmove",g.touchmove),a.map.on("touchstart",g.touchstart),a.map.on("touchend",g.touchend),a.container.addEventListener("mouseout",g.mouseout),a.options.keybindings&&(a.container.addEventListener("keydown",g.keydown),a.container.addEventListener("keyup",g.keyup))},removeEventListeners:function(){a.map.off("mousemove",g.mousemove),a.map.off("mousedown",g.mousedown),a.map.off("mouseup",g.mouseup),a.map.off("data",g.data),a.map.off("touchmove",g.touchmove),a.map.off("touchstart",g.touchstart),a.map.off("touchend",g.touchend),a.container.removeEventListener("mouseout",g.mouseout),a.options.keybindings&&(a.container.removeEventListener("keydown",g.keydown),a.container.removeEventListener("keyup",g.keyup))},trash:function(c){_.trash(c)},combineFeatures:function(){_.combineFeatures()},uncombineFeatures:function(){_.uncombineFeatures()},getMode:function(){return p}}}(e),e.ui=function(a){var l={},d=null,h={mode:null,feature:null,mouse:null},g={mode:null,feature:null,mouse:null};function p(c){g=pe(g,c)}function _(){var c,y;if(a.container){var O=[],V=[];lr.forEach(function(F){g[F]!==h[F]&&(O.push(F+"-"+h[F]),g[F]!==null&&V.push(F+"-"+g[F]))}),O.length>0&&(c=a.container.classList).remove.apply(c,O),V.length>0&&(y=a.container.classList).add.apply(y,V),h=pe(h,g)}}function P(c,y){y===void 0&&(y={});var O=document.createElement("button");return O.className=q.CONTROL_BUTTON+" "+y.className,O.setAttribute("title",y.title),y.container.appendChild(O),O.addEventListener("click",function(V){if(V.preventDefault(),V.stopPropagation(),V.target===d)return b(),void y.onDeactivate();w(c),y.onActivate()},!0),O}function b(){d&&(d.classList.remove(q.ACTIVE_BUTTON),d=null)}function w(c){b();var y=l[c];y&&y&&c!=="trash"&&(y.classList.add(q.ACTIVE_BUTTON),d=y)}return{setActiveButton:w,queueMapClasses:p,updateMapClasses:_,clearMapClasses:function(){p({mode:null,feature:null,mouse:null}),_()},addButtons:function(){var c=a.options.controls,y=document.createElement("div");return y.className=q.CONTROL_GROUP+" "+q.CONTROL_BASE,c&&(c[Y.LINE]&&(l[Y.LINE]=P(Y.LINE,{container:y,className:q.CONTROL_BUTTON_LINE,title:"LineString tool "+(a.options.keybindings?"(l)":""),onActivate:function(){return a.events.changeMode(T.DRAW_LINE_STRING)},onDeactivate:function(){return a.events.trash()}})),c[Y.POLYGON]&&(l[Y.POLYGON]=P(Y.POLYGON,{container:y,className:q.CONTROL_BUTTON_POLYGON,title:"Polygon tool "+(a.options.keybindings?"(p)":""),onActivate:function(){return a.events.changeMode(T.DRAW_POLYGON)},onDeactivate:function(){return a.events.trash()}})),c[Y.POINT]&&(l[Y.POINT]=P(Y.POINT,{container:y,className:q.CONTROL_BUTTON_POINT,title:"Marker tool "+(a.options.keybindings?"(m)":""),onActivate:function(){return a.events.changeMode(T.DRAW_POINT)},onDeactivate:function(){return a.events.trash()}})),c.trash&&(l.trash=P("trash",{container:y,className:q.CONTROL_BUTTON_TRASH,title:"Delete",onActivate:function(){a.events.trash()}})),c.combine_features&&(l.combine_features=P("combineFeatures",{container:y,className:q.CONTROL_BUTTON_COMBINE_FEATURES,title:"Combine",onActivate:function(){a.events.combineFeatures()}})),c.uncombine_features&&(l.uncombine_features=P("uncombineFeatures",{container:y,className:q.CONTROL_BUTTON_UNCOMBINE_FEATURES,title:"Uncombine",onActivate:function(){a.events.uncombineFeatures()}}))),y},removeButtons:function(){Object.keys(l).forEach(function(c){var y=l[c];y.parentNode&&y.parentNode.removeChild(y),delete l[c]})}}}(e),e.container=o.getContainer(),e.store=new x(e),t=e.ui.addButtons(),e.options.boxSelect&&(e.boxZoomInitial=o.boxZoom.isEnabled(),o.boxZoom.disable(),o.dragPan.disable(),o.dragPan.enable()),o.loaded()?r.connect():(o.on("load",r.connect),n=setInterval(function(){o.loaded()&&r.connect()},16)),e.events.start(),t},addLayers:function(){e.map.addSource(X.COLD,{data:{type:m.FEATURE_COLLECTION,features:[]},type:"geojson"}),e.map.addSource(X.HOT,{data:{type:m.FEATURE_COLLECTION,features:[]},type:"geojson"}),e.options.styles.forEach(function(o){e.map.addLayer(o)}),e.store.setDirty(!0),e.store.render()},removeLayers:function(){e.options.styles.forEach(function(o){e.map.getLayer(o.id)&&e.map.removeLayer(o.id)}),e.map.getSource(X.COLD)&&e.map.removeSource(X.COLD),e.map.getSource(X.HOT)&&e.map.removeSource(X.HOT)}};return e.setup=r,r}var sn=[{id:"gl-draw-polygon-fill-inactive",type:"fill",filter:["all",["==","active","false"],["==","$type","Polygon"],["!=","mode","static"]],paint:{"fill-color":"#3bb2d0","fill-outline-color":"#3bb2d0","fill-opacity":.1}},{id:"gl-draw-polygon-fill-active",type:"fill",filter:["all",["==","active","true"],["==","$type","Polygon"]],paint:{"fill-color":"#fbb03b","fill-outline-color":"#fbb03b","fill-opacity":.1}},{id:"gl-draw-polygon-midpoint",type:"circle",filter:["all",["==","$type","Point"],["==","meta","midpoint"]],paint:{"circle-radius":3,"circle-color":"#fbb03b"}},{id:"gl-draw-polygon-stroke-inactive",type:"line",filter:["all",["==","active","false"],["==","$type","Polygon"],["!=","mode","static"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3bb2d0","line-width":2}},{id:"gl-draw-polygon-stroke-active",type:"line",filter:["all",["==","active","true"],["==","$type","Polygon"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#fbb03b","line-dasharray":[.2,2],"line-width":2}},{id:"gl-draw-line-inactive",type:"line",filter:["all",["==","active","false"],["==","$type","LineString"],["!=","mode","static"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3bb2d0","line-width":2}},{id:"gl-draw-line-active",type:"line",filter:["all",["==","$type","LineString"],["==","active","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#fbb03b","line-dasharray":[.2,2],"line-width":2}},{id:"gl-draw-polygon-and-line-vertex-stroke-inactive",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"],["!=","mode","static"]],paint:{"circle-radius":5,"circle-color":"#fff"}},{id:"gl-draw-polygon-and-line-vertex-inactive",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"],["!=","mode","static"]],paint:{"circle-radius":3,"circle-color":"#fbb03b"}},{id:"gl-draw-point-point-stroke-inactive",type:"circle",filter:["all",["==","active","false"],["==","$type","Point"],["==","meta","feature"],["!=","mode","static"]],paint:{"circle-radius":5,"circle-opacity":1,"circle-color":"#fff"}},{id:"gl-draw-point-inactive",type:"circle",filter:["all",["==","active","false"],["==","$type","Point"],["==","meta","feature"],["!=","mode","static"]],paint:{"circle-radius":3,"circle-color":"#3bb2d0"}},{id:"gl-draw-point-stroke-active",type:"circle",filter:["all",["==","$type","Point"],["==","active","true"],["!=","meta","midpoint"]],paint:{"circle-radius":7,"circle-color":"#fff"}},{id:"gl-draw-point-active",type:"circle",filter:["all",["==","$type","Point"],["!=","meta","midpoint"],["==","active","true"]],paint:{"circle-radius":5,"circle-color":"#fbb03b"}},{id:"gl-draw-polygon-fill-static",type:"fill",filter:["all",["==","mode","static"],["==","$type","Polygon"]],paint:{"fill-color":"#404040","fill-outline-color":"#404040","fill-opacity":.1}},{id:"gl-draw-polygon-stroke-static",type:"line",filter:["all",["==","mode","static"],["==","$type","Polygon"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#404040","line-width":2}},{id:"gl-draw-line-static",type:"line",filter:["all",["==","mode","static"],["==","$type","LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#404040","line-width":2}},{id:"gl-draw-point-static",type:"circle",filter:["all",["==","mode","static"],["==","$type","Point"]],paint:{"circle-radius":5,"circle-color":"#404040"}}];function $e(e){return function(t){var n=t.featureTarget;return!!n&&!!n.properties&&n.properties.meta===e}}function un(e){return!!e.originalEvent&&!!e.originalEvent.shiftKey&&e.originalEvent.button===0}function _e(e){return!!e.featureTarget&&!!e.featureTarget.properties&&e.featureTarget.properties.active===j.ACTIVE&&e.featureTarget.properties.meta===B.FEATURE}function At(e){return!!e.featureTarget&&!!e.featureTarget.properties&&e.featureTarget.properties.active===j.INACTIVE&&e.featureTarget.properties.meta===B.FEATURE}function qe(e){return e.featureTarget===void 0}function wt(e){return!!e.featureTarget&&!!e.featureTarget.properties&&e.featureTarget.properties.meta===B.FEATURE}function De(e){var t=e.featureTarget;return!!t&&!!t.properties&&t.properties.meta===B.VERTEX}function He(e){return!!e.originalEvent&&e.originalEvent.shiftKey===!0}function Xe(e){return e.keyCode===27}function Ze(e){return e.keyCode===13}var pr=Object.freeze({__proto__:null,isOfMetaType:$e,isShiftMousedown:un,isActiveFeature:_e,isInactiveFeature:At,noTarget:qe,isFeature:wt,isVertex:De,isShiftDown:He,isEscapeKey:Xe,isEnterKey:Ze,isTrue:function(){return!0}}),fr=Me;function Me(e,t){this.x=e,this.y=t}Me.prototype={clone:function(){return new Me(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,t){return this.clone()._rotateAround(e,t)},matMult:function(e){return this.clone()._matMult(e)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var t=e.x-this.x,n=e.y-this.y;return t*t+n*n},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult:function(e){var t=e[0]*this.x+e[1]*this.y,n=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=n,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var t=Math.cos(e),n=Math.sin(e),r=t*this.x-n*this.y,o=n*this.x+t*this.y;return this.x=r,this.y=o,this},_rotateAround:function(e,t){var n=Math.cos(e),r=Math.sin(e),o=t.x+n*(this.x-t.x)-r*(this.y-t.y),i=t.y+r*(this.x-t.x)+n*(this.y-t.y);return this.x=o,this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},Me.convert=function(e){return e instanceof Me?e:Array.isArray(e)?new Me(e[0],e[1]):e};var hr=de(fr);function Ft(e,t){var n=t.getBoundingClientRect();return new hr(e.clientX-n.left-(t.clientLeft||0),e.clientY-n.top-(t.clientTop||0))}function Le(e,t,n,r){return{type:m.FEATURE,properties:{meta:B.VERTEX,parent:e,coord_path:n,active:r?j.ACTIVE:j.INACTIVE},geometry:{type:m.POINT,coordinates:t}}}function cn(e,t,n){var r=t.geometry.coordinates,o=n.geometry.coordinates;if(r[1]>85||r[1]<It||o[1]>85||o[1]<It)return null;var i={lng:(r[0]+o[0])/2,lat:(r[1]+o[1])/2};return{type:m.FEATURE,properties:{meta:B.MIDPOINT,parent:e,lng:i.lng,lat:i.lat,coord_path:n.properties.coord_path},geometry:{type:m.POINT,coordinates:[i.lng,i.lat]}}}function We(e,t,n){t===void 0&&(t={}),n===void 0&&(n=null);var r,o=e.geometry,i=o.type,a=o.coordinates,l=e.properties&&e.properties.id,d=[];function h(p,_){var P="",b=null;p.forEach(function(w,c){var y=_!=null?_+"."+c:String(c),O=Le(l,w,y,g(y));if(t.midpoints&&b){var V=cn(l,b,O);V&&d.push(V)}b=O;var F=JSON.stringify(w);P!==F&&d.push(O),c===0&&(P=F)})}function g(p){return!!t.selectedPaths&&t.selectedPaths.indexOf(p)!==-1}return i===m.POINT?d.push(Le(l,a,n,g(n))):i===m.POLYGON?a.forEach(function(p,_){h(p,n!==null?n+"."+_:String(_))}):i===m.LINE_STRING?h(a,n):i.indexOf(m.MULTI_PREFIX)===0&&(r=i.replace(m.MULTI_PREFIX,""),a.forEach(function(p,_){var P={type:m.FEATURE,properties:e.properties,geometry:{type:r,coordinates:p}};d=d.concat(We(P,t,_))})),d}var ee={enable:function(e){setTimeout(function(){e.map&&e.map.doubleClickZoom&&e._ctx&&e._ctx.store&&e._ctx.store.getInitialConfigValue&&e._ctx.store.getInitialConfigValue("doubleClickZoom")&&e.map.doubleClickZoom.enable()},0)},disable:function(e){setTimeout(function(){e.map&&e.map.doubleClickZoom&&e.map.doubleClickZoom.disable()},0)}},Ke={exports:{}},ln=function(e){if(!e||!e.type)return null;var t=gr[e.type];if(!t)return null;if(t==="geometry")return{type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:e}]};if(t==="feature")return{type:"FeatureCollection",features:[e]};if(t==="featurecollection")return e},gr={Point:"geometry",MultiPoint:"geometry",LineString:"geometry",MultiLineString:"geometry",Polygon:"geometry",MultiPolygon:"geometry",GeometryCollection:"geometry",Feature:"feature",FeatureCollection:"featurecollection"},yr=de(ln),vr=Object.freeze({__proto__:null,default:function e(t){switch(t&&t.type||null){case"FeatureCollection":return t.features=t.features.reduce(function(n,r){return n.concat(e(r))},[]),t;case"Feature":return t.geometry?e(t.geometry).map(function(n){var r={type:"Feature",properties:JSON.parse(JSON.stringify(t.properties)),geometry:n};return t.id!==void 0&&(r.id=t.id),r}):[t];case"MultiPoint":return t.coordinates.map(function(n){return{type:"Point",coordinates:n}});case"MultiPolygon":return t.coordinates.map(function(n){return{type:"Polygon",coordinates:n}});case"MultiLineString":return t.coordinates.map(function(n){return{type:"LineString",coordinates:n}});case"GeometryCollection":return t.geometries.map(e).reduce(function(n,r){return n.concat(r)},[]);case"Point":case"Polygon":case"LineString":return[t]}}}),mr=ln,Qe=Qn(vr),_r=function(e){return function t(n){return Array.isArray(n)&&n.length&&typeof n[0]=="number"?[n]:n.reduce(function(r,o){return Array.isArray(o)&&Array.isArray(o[0])?r.concat(t(o)):(r.push(o),r)},[])}(e)};Qe instanceof Function||(Qe=Qe.default);var dn={exports:{}},br=dn.exports=function(e){return new K(e)};function K(e){this.value=e}function pn(e,t,n){var r=[],o=[],i=!0;return function a(l){var d=n?fn(l):l,h={},g=!0,p={node:d,node_:l,path:[].concat(r),parent:o[o.length-1],parents:o,key:r.slice(-1)[0],isRoot:r.length===0,level:r.length,circular:null,update:function(b,w){p.isRoot||(p.parent.node[p.key]=b),p.node=b,w&&(g=!1)},delete:function(b){delete p.parent.node[p.key],b&&(g=!1)},remove:function(b){hn(p.parent.node)?p.parent.node.splice(p.key,1):delete p.parent.node[p.key],b&&(g=!1)},keys:null,before:function(b){h.before=b},after:function(b){h.after=b},pre:function(b){h.pre=b},post:function(b){h.post=b},stop:function(){i=!1},block:function(){g=!1}};if(!i)return p;function _(){if(typeof p.node=="object"&&p.node!==null){p.keys&&p.node_===p.node||(p.keys=et(p.node)),p.isLeaf=p.keys.length==0;for(var b=0;b<o.length;b++)if(o[b].node_===l){p.circular=o[b];break}}else p.isLeaf=!0,p.keys=null;p.notLeaf=!p.isLeaf,p.notRoot=!p.isRoot}_();var P=t.call(p,p.node);return P!==void 0&&p.update&&p.update(P),h.before&&h.before.call(p,p.node),g&&(typeof p.node!="object"||p.node===null||p.circular||(o.push(p),_(),tt(p.keys,function(b,w){r.push(b),h.pre&&h.pre.call(p,p.node[b],b);var c=a(p.node[b]);n&&nt.call(p.node,b)&&(p.node[b]=c.node),c.isLast=w==p.keys.length-1,c.isFirst=w==0,h.post&&h.post.call(p,c),r.pop()}),o.pop()),h.after&&h.after.call(p,p.node)),p}(e).node}function fn(e){if(typeof e=="object"&&e!==null){var t;if(hn(e))t=[];else if(Ne(e)==="[object Date]")t=new Date(e.getTime?e.getTime():e);else if(function(o){return Ne(o)==="[object RegExp]"}(e))t=new RegExp(e);else if(function(o){return Ne(o)==="[object Error]"}(e))t={message:e.message};else if(function(o){return Ne(o)==="[object Boolean]"}(e))t=new Boolean(e);else if(function(o){return Ne(o)==="[object Number]"}(e))t=new Number(e);else if(function(o){return Ne(o)==="[object String]"}(e))t=new String(e);else if(Object.create&&Object.getPrototypeOf)t=Object.create(Object.getPrototypeOf(e));else if(e.constructor===Object)t={};else{var n=e.constructor&&e.constructor.prototype||e.__proto__||{},r=function(){};r.prototype=n,t=new r}return tt(et(e),function(o){t[o]=e[o]}),t}return e}K.prototype.get=function(e){for(var t=this.value,n=0;n<e.length;n++){var r=e[n];if(!t||!nt.call(t,r)){t=void 0;break}t=t[r]}return t},K.prototype.has=function(e){for(var t=this.value,n=0;n<e.length;n++){var r=e[n];if(!t||!nt.call(t,r))return!1;t=t[r]}return!0},K.prototype.set=function(e,t){for(var n=this.value,r=0;r<e.length-1;r++){var o=e[r];nt.call(n,o)||(n[o]={}),n=n[o]}return n[e[r]]=t,t},K.prototype.map=function(e){return pn(this.value,e,!0)},K.prototype.forEach=function(e){return this.value=pn(this.value,e,!1),this.value},K.prototype.reduce=function(e,t){var n=arguments.length===1,r=n?this.value:t;return this.forEach(function(o){this.isRoot&&n||(r=e.call(this,r,o))}),r},K.prototype.paths=function(){var e=[];return this.forEach(function(t){e.push(this.path)}),e},K.prototype.nodes=function(){var e=[];return this.forEach(function(t){e.push(this.node)}),e},K.prototype.clone=function(){var e=[],t=[];return function n(r){for(var o=0;o<e.length;o++)if(e[o]===r)return t[o];if(typeof r=="object"&&r!==null){var i=fn(r);return e.push(r),t.push(i),tt(et(r),function(a){i[a]=n(r[a])}),e.pop(),t.pop(),i}return r}(this.value)};var et=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};function Ne(e){return Object.prototype.toString.call(e)}var hn=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"},tt=function(e,t){if(e.forEach)return e.forEach(t);for(var n=0;n<e.length;n++)t(e[n],n,e)};tt(et(K.prototype),function(e){br[e]=function(t){var n=[].slice.call(arguments,1),r=new K(t);return r[e].apply(r,n)}});var nt=Object.hasOwnProperty||function(e,t){return t in e},Er=dn.exports,Tr=J;function J(e){if(!(this instanceof J))return new J(e);this._bbox=e||[1/0,1/0,-1/0,-1/0],this._valid=!!e}J.prototype.include=function(e){return this._valid=!0,this._bbox[0]=Math.min(this._bbox[0],e[0]),this._bbox[1]=Math.min(this._bbox[1],e[1]),this._bbox[2]=Math.max(this._bbox[2],e[0]),this._bbox[3]=Math.max(this._bbox[3],e[1]),this},J.prototype.equals=function(e){var t;return t=e instanceof J?e.bbox():e,this._bbox[0]==t[0]&&this._bbox[1]==t[1]&&this._bbox[2]==t[2]&&this._bbox[3]==t[3]},J.prototype.center=function(e){return this._valid?[(this._bbox[0]+this._bbox[2])/2,(this._bbox[1]+this._bbox[3])/2]:null},J.prototype.union=function(e){var t;return this._valid=!0,t=e instanceof J?e.bbox():e,this._bbox[0]=Math.min(this._bbox[0],t[0]),this._bbox[1]=Math.min(this._bbox[1],t[1]),this._bbox[2]=Math.max(this._bbox[2],t[2]),this._bbox[3]=Math.max(this._bbox[3],t[3]),this},J.prototype.bbox=function(){return this._valid?this._bbox:null},J.prototype.contains=function(e){if(!e)return this._fastContains();if(!this._valid)return null;var t=e[0],n=e[1];return this._bbox[0]<=t&&this._bbox[1]<=n&&this._bbox[2]>=t&&this._bbox[3]>=n},J.prototype.intersect=function(e){return this._valid?(t=e instanceof J?e.bbox():e,!(this._bbox[0]>t[2]||this._bbox[2]<t[0]||this._bbox[3]<t[1]||this._bbox[1]>t[3])):null;var t},J.prototype._fastContains=function(){if(!this._valid)return new Function("return null;");var e="return "+this._bbox[0]+"<= ll[0] &&"+this._bbox[1]+"<= ll[1] &&"+this._bbox[2]+">= ll[0] &&"+this._bbox[3]+">= ll[1]";return new Function("ll",e)},J.prototype.polygon=function(){return this._valid?{type:"Polygon",coordinates:[[[this._bbox[0],this._bbox[1]],[this._bbox[2],this._bbox[1]],[this._bbox[2],this._bbox[3]],[this._bbox[0],this._bbox[3]],[this._bbox[0],this._bbox[1]]]]}:null};var Cr=function(e){if(!e)return[];var t=Qe(mr(e)),n=[];return t.features.forEach(function(r){r.geometry&&(n=n.concat(_r(r.geometry.coordinates)))}),n},Or=Er,Sr=Tr,gn={features:["FeatureCollection"],coordinates:["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],geometry:["Feature"],geometries:["GeometryCollection"]},Ir=Object.keys(gn);function Rt(e){for(var t=Sr(),n=Cr(e),r=0;r<n.length;r++)t.include(n[r]);return t}Ke.exports=function(e){return Rt(e).bbox()},Ke.exports.polygon=function(e){return Rt(e).polygon()},Ke.exports.bboxify=function(e){return Or(e).map(function(t){t&&Ir.some(function(n){return!!t[n]&&gn[n].indexOf(t.type)!==-1})&&(t.bbox=Rt(t).bbox(),this.update(t))})};var xr=de(Ke.exports),rt=-90;function Dt(e,t){var n=rt,r=90,o=rt,i=90,a=270,l=-270;e.forEach(function(h){var g=xr(h),p=g[1],_=g[3],P=g[0],b=g[2];p>n&&(n=p),_<r&&(r=_),_>o&&(o=_),p<i&&(i=p),P<a&&(a=P),b>l&&(l=b)});var d=t;return n+d.lat>85&&(d.lat=85-n),o+d.lat>90&&(d.lat=90-o),r+d.lat<-85&&(d.lat=-85-r),i+d.lat<rt&&(d.lat=rt-i),a+d.lng<=-270&&(d.lng+=360*Math.ceil(Math.abs(d.lng)/360)),l+d.lng>=270&&(d.lng-=360*Math.ceil(Math.abs(d.lng)/360)),d}function kt(e,t){var n=Dt(e.map(function(r){return r.toGeoJSON()}),t);e.forEach(function(r){var o,i=r.getCoordinates(),a=function(d){var h={lng:d[0]+n.lng,lat:d[1]+n.lat};return[h.lng,h.lat]},l=function(d){return d.map(function(h){return a(h)})};r.type===m.POINT?o=a(i):r.type===m.LINE_STRING||r.type===m.MULTI_POINT?o=i.map(a):r.type===m.POLYGON||r.type===m.MULTI_LINE_STRING?o=i.map(l):r.type===m.MULTI_POLYGON&&(o=i.map(function(d){return d.map(function(h){return l(h)})})),r.incomingCoords(o)})}var D={onSetup:function(e){var t=this,n={dragMoveLocation:null,boxSelectStartLocation:null,boxSelectElement:void 0,boxSelecting:!1,canBoxSelect:!1,dragMoving:!1,canDragMove:!1,initiallySelectedFeatureIds:e.featureIds||[]};return this.setSelected(n.initiallySelectedFeatureIds.filter(function(r){return t.getFeature(r)!==void 0})),this.fireActionable(),this.setActionableState({combineFeatures:!0,uncombineFeatures:!0,trash:!0}),n},fireUpdate:function(){this.map.fire(H.UPDATE,{action:St.MOVE,features:this.getSelected().map(function(e){return e.toGeoJSON()})})},fireActionable:function(){var e=this,t=this.getSelected(),n=t.filter(function(l){return e.isInstanceOf("MultiFeature",l)}),r=!1;if(t.length>1){r=!0;var o=t[0].type.replace("Multi","");t.forEach(function(l){l.type.replace("Multi","")!==o&&(r=!1)})}var i=n.length>0,a=t.length>0;this.setActionableState({combineFeatures:r,uncombineFeatures:i,trash:a})},getUniqueIds:function(e){return e.length?e.map(function(t){return t.properties.id}).filter(function(t){return t!==void 0}).reduce(function(t,n){return t.add(n),t},new Z).values():[]},stopExtendedInteractions:function(e){e.boxSelectElement&&(e.boxSelectElement.parentNode&&e.boxSelectElement.parentNode.removeChild(e.boxSelectElement),e.boxSelectElement=null),this.map.dragPan.enable(),e.boxSelecting=!1,e.canBoxSelect=!1,e.dragMoving=!1,e.canDragMove=!1},onStop:function(){ee.enable(this)},onMouseMove:function(e,t){return wt(t)&&e.dragMoving&&this.fireUpdate(),this.stopExtendedInteractions(e),!0},onMouseOut:function(e){return!e.dragMoving||this.fireUpdate()}};D.onTap=D.onClick=function(e,t){return qe(t)?this.clickAnywhere(e,t):$e(B.VERTEX)(t)?this.clickOnVertex(e,t):wt(t)?this.clickOnFeature(e,t):void 0},D.clickAnywhere=function(e){var t=this,n=this.getSelectedIds();n.length&&(this.clearSelectedFeatures(),n.forEach(function(r){return t.doRender(r)})),ee.enable(this),this.stopExtendedInteractions(e)},D.clickOnVertex=function(e,t){this.changeMode(T.DIRECT_SELECT,{featureId:t.featureTarget.properties.parent,coordPath:t.featureTarget.properties.coord_path,startPos:t.lngLat}),this.updateUIClasses({mouse:N.MOVE})},D.startOnActiveFeature=function(e,t){this.stopExtendedInteractions(e),this.map.dragPan.disable(),this.doRender(t.featureTarget.properties.id),e.canDragMove=!0,e.dragMoveLocation=t.lngLat},D.clickOnFeature=function(e,t){var n=this;ee.disable(this),this.stopExtendedInteractions(e);var r=He(t),o=this.getSelectedIds(),i=t.featureTarget.properties.id,a=this.isSelected(i);if(!r&&a&&this.getFeature(i).type!==m.POINT)return this.changeMode(T.DIRECT_SELECT,{featureId:i});a&&r?(this.deselect(i),this.updateUIClasses({mouse:N.POINTER}),o.length===1&&ee.enable(this)):!a&&r?(this.select(i),this.updateUIClasses({mouse:N.MOVE})):a||r||(o.forEach(function(l){return n.doRender(l)}),this.setSelected(i),this.updateUIClasses({mouse:N.MOVE})),this.doRender(i)},D.onMouseDown=function(e,t){return _e(t)?this.startOnActiveFeature(e,t):this.drawConfig.boxSelect&&un(t)?this.startBoxSelect(e,t):void 0},D.startBoxSelect=function(e,t){this.stopExtendedInteractions(e),this.map.dragPan.disable(),e.boxSelectStartLocation=Ft(t.originalEvent,this.map.getContainer()),e.canBoxSelect=!0},D.onTouchStart=function(e,t){if(_e(t))return this.startOnActiveFeature(e,t)},D.onDrag=function(e,t){return e.canDragMove?this.dragMove(e,t):this.drawConfig.boxSelect&&e.canBoxSelect?this.whileBoxSelect(e,t):void 0},D.whileBoxSelect=function(e,t){e.boxSelecting=!0,this.updateUIClasses({mouse:N.ADD}),e.boxSelectElement||(e.boxSelectElement=document.createElement("div"),e.boxSelectElement.classList.add(q.BOX_SELECT),this.map.getContainer().appendChild(e.boxSelectElement));var n=Ft(t.originalEvent,this.map.getContainer()),r=Math.min(e.boxSelectStartLocation.x,n.x),o=Math.max(e.boxSelectStartLocation.x,n.x),i=Math.min(e.boxSelectStartLocation.y,n.y),a=Math.max(e.boxSelectStartLocation.y,n.y),l="translate("+r+"px, "+i+"px)";e.boxSelectElement.style.transform=l,e.boxSelectElement.style.WebkitTransform=l,e.boxSelectElement.style.width=o-r+"px",e.boxSelectElement.style.height=a-i+"px"},D.dragMove=function(e,t){e.dragMoving=!0,t.originalEvent.stopPropagation();var n={lng:t.lngLat.lng-e.dragMoveLocation.lng,lat:t.lngLat.lat-e.dragMoveLocation.lat};kt(this.getSelected(),n),e.dragMoveLocation=t.lngLat},D.onTouchEnd=D.onMouseUp=function(e,t){var n=this;if(e.dragMoving)this.fireUpdate();else if(e.boxSelecting){var r=[e.boxSelectStartLocation,Ft(t.originalEvent,this.map.getContainer())],o=this.featuresAt(null,r,"click"),i=this.getUniqueIds(o).filter(function(a){return!n.isSelected(a)});i.length&&(this.select(i),i.forEach(function(a){return n.doRender(a)}),this.updateUIClasses({mouse:N.MOVE}))}this.stopExtendedInteractions(e)},D.toDisplayFeatures=function(e,t,n){t.properties.active=this.isSelected(t.properties.id)?j.ACTIVE:j.INACTIVE,n(t),this.fireActionable(),t.properties.active===j.ACTIVE&&t.geometry.type!==m.POINT&&We(t).forEach(n)},D.onTrash=function(){this.deleteFeature(this.getSelectedIds()),this.fireActionable()},D.onCombineFeatures=function(){var e=this.getSelected();if(!(e.length===0||e.length<2)){for(var t=[],n=[],r=e[0].type.replace("Multi",""),o=0;o<e.length;o++){var i=e[o];if(i.type.replace("Multi","")!==r)return;i.type.includes("Multi")?i.getCoordinates().forEach(function(l){t.push(l)}):t.push(i.getCoordinates()),n.push(i.toGeoJSON())}if(n.length>1){var a=this.newFeature({type:m.FEATURE,properties:n[0].properties,geometry:{type:"Multi"+r,coordinates:t}});this.addFeature(a),this.deleteFeature(this.getSelectedIds(),{silent:!0}),this.setSelected([a.id]),this.map.fire(H.COMBINE_FEATURES,{createdFeatures:[a.toGeoJSON()],deletedFeatures:n})}this.fireActionable()}},D.onUncombineFeatures=function(){var e=this,t=this.getSelected();if(t.length!==0){for(var n=[],r=[],o=function(a){var l=t[a];e.isInstanceOf("MultiFeature",l)&&(l.getFeatures().forEach(function(d){e.addFeature(d),d.properties=l.properties,n.push(d.toGeoJSON()),e.select([d.id])}),e.deleteFeature(l.id,{silent:!0}),r.push(l.toGeoJSON()))},i=0;i<t.length;i++)o(i);n.length>1&&this.map.fire(H.UNCOMBINE_FEATURES,{createdFeatures:n,deletedFeatures:r}),this.fireActionable()}};var yn=$e(B.VERTEX),vn=$e(B.MIDPOINT),fe={fireUpdate:function(){this.map.fire(H.UPDATE,{action:St.CHANGE_COORDINATES,features:this.getSelected().map(function(e){return e.toGeoJSON()})})},fireActionable:function(e){this.setActionableState({combineFeatures:!1,uncombineFeatures:!1,trash:e.selectedCoordPaths.length>0})},startDragging:function(e,t){this.map.dragPan.disable(),e.canDragMove=!0,e.dragMoveLocation=t.lngLat},stopDragging:function(e){this.map.dragPan.enable(),e.dragMoving=!1,e.canDragMove=!1,e.dragMoveLocation=null},onVertex:function(e,t){this.startDragging(e,t);var n=t.featureTarget.properties,r=e.selectedCoordPaths.indexOf(n.coord_path);He(t)||r!==-1?He(t)&&r===-1&&e.selectedCoordPaths.push(n.coord_path):e.selectedCoordPaths=[n.coord_path];var o=this.pathsToCoordinates(e.featureId,e.selectedCoordPaths);this.setSelectedCoordinates(o)},onMidpoint:function(e,t){this.startDragging(e,t);var n=t.featureTarget.properties;e.feature.addCoordinate(n.coord_path,n.lng,n.lat),this.fireUpdate(),e.selectedCoordPaths=[n.coord_path]},pathsToCoordinates:function(e,t){return t.map(function(n){return{feature_id:e,coord_path:n}})},onFeature:function(e,t){e.selectedCoordPaths.length===0?this.startDragging(e,t):this.stopDragging(e)},dragFeature:function(e,t,n){kt(this.getSelected(),n),e.dragMoveLocation=t.lngLat},dragVertex:function(e,t,n){for(var r=e.selectedCoordPaths.map(function(l){return e.feature.getCoordinate(l)}),o=Dt(r.map(function(l){return{type:m.FEATURE,properties:{},geometry:{type:m.POINT,coordinates:l}}}),n),i=0;i<r.length;i++){var a=r[i];e.feature.updateCoordinate(e.selectedCoordPaths[i],a[0]+o.lng,a[1]+o.lat)}},clickNoTarget:function(){this.changeMode(T.SIMPLE_SELECT)},clickInactive:function(){this.changeMode(T.SIMPLE_SELECT)},clickActiveFeature:function(e){e.selectedCoordPaths=[],this.clearSelectedCoordinates(),e.feature.changed()},onSetup:function(e){var t=e.featureId,n=this.getFeature(t);if(!n)throw new Error("You must provide a featureId to enter direct_select mode");if(n.type===m.POINT)throw new TypeError("direct_select mode doesn't handle point features");var r={featureId:t,feature:n,dragMoveLocation:e.startPos||null,dragMoving:!1,canDragMove:!1,selectedCoordPaths:e.coordPath?[e.coordPath]:[]};return this.setSelectedCoordinates(this.pathsToCoordinates(t,r.selectedCoordPaths)),this.setSelected(t),ee.disable(this),this.setActionableState({trash:!0}),r},onStop:function(){ee.enable(this),this.clearSelectedCoordinates()},toDisplayFeatures:function(e,t,n){e.featureId===t.properties.id?(t.properties.active=j.ACTIVE,n(t),We(t,{map:this.map,midpoints:!0,selectedPaths:e.selectedCoordPaths}).forEach(n)):(t.properties.active=j.INACTIVE,n(t)),this.fireActionable(e)},onTrash:function(e){e.selectedCoordPaths.sort(function(t,n){return n.localeCompare(t,"en",{numeric:!0})}).forEach(function(t){return e.feature.removeCoordinate(t)}),this.fireUpdate(),e.selectedCoordPaths=[],this.clearSelectedCoordinates(),this.fireActionable(e),e.feature.isValid()===!1&&(this.deleteFeature([e.featureId]),this.changeMode(T.SIMPLE_SELECT,{}))},onMouseMove:function(e,t){var n=_e(t),r=yn(t),o=vn(t),i=e.selectedCoordPaths.length===0;return n&&i||r&&!i?this.updateUIClasses({mouse:N.MOVE}):this.updateUIClasses({mouse:N.NONE}),(r||n||o)&&e.dragMoving&&this.fireUpdate(),this.stopDragging(e),!0},onMouseOut:function(e){return e.dragMoving&&this.fireUpdate(),!0}};fe.onTouchStart=fe.onMouseDown=function(e,t){return yn(t)?this.onVertex(e,t):_e(t)?this.onFeature(e,t):vn(t)?this.onMidpoint(e,t):void 0},fe.onDrag=function(e,t){if(e.canDragMove===!0){e.dragMoving=!0,t.originalEvent.stopPropagation();var n={lng:t.lngLat.lng-e.dragMoveLocation.lng,lat:t.lngLat.lat-e.dragMoveLocation.lat};e.selectedCoordPaths.length>0?this.dragVertex(e,t,n):this.dragFeature(e,t,n),e.dragMoveLocation=t.lngLat}},fe.onClick=function(e,t){return qe(t)?this.clickNoTarget(e,t):_e(t)?this.clickActiveFeature(e,t):At(t)?this.clickInactive(e,t):void this.stopDragging(e)},fe.onTap=function(e,t){return qe(t)?this.clickNoTarget(e,t):_e(t)?this.clickActiveFeature(e,t):At(t)?this.clickInactive(e,t):void 0},fe.onTouchEnd=fe.onMouseUp=function(e){e.dragMoving&&this.fireUpdate(),this.stopDragging(e)};var ne={};function ot(e,t){return!!e.lngLat&&e.lngLat.lng===t[0]&&e.lngLat.lat===t[1]}ne.onSetup=function(){var e=this.newFeature({type:m.FEATURE,properties:{},geometry:{type:m.POINT,coordinates:[]}});return this.addFeature(e),this.clearSelectedFeatures(),this.updateUIClasses({mouse:N.ADD}),this.activateUIButton(Y.POINT),this.setActionableState({trash:!0}),{point:e}},ne.stopDrawingAndRemove=function(e){this.deleteFeature([e.point.id],{silent:!0}),this.changeMode(T.SIMPLE_SELECT)},ne.onTap=ne.onClick=function(e,t){this.updateUIClasses({mouse:N.MOVE}),e.point.updateCoordinate("",t.lngLat.lng,t.lngLat.lat),this.map.fire(H.CREATE,{features:[e.point.toGeoJSON()]}),this.changeMode(T.SIMPLE_SELECT,{featureIds:[e.point.id]})},ne.onStop=function(e){this.activateUIButton(),e.point.getCoordinate().length||this.deleteFeature([e.point.id],{silent:!0})},ne.toDisplayFeatures=function(e,t,n){var r=t.properties.id===e.point.id;if(t.properties.active=r?j.ACTIVE:j.INACTIVE,!r)return n(t)},ne.onTrash=ne.stopDrawingAndRemove,ne.onKeyUp=function(e,t){if(Xe(t)||Ze(t))return this.stopDrawingAndRemove(e,t)};var be={onSetup:function(){var e=this.newFeature({type:m.FEATURE,properties:{},geometry:{type:m.POLYGON,coordinates:[[]]}});return this.addFeature(e),this.clearSelectedFeatures(),ee.disable(this),this.updateUIClasses({mouse:N.ADD}),this.activateUIButton(Y.POLYGON),this.setActionableState({trash:!0}),{polygon:e,currentVertexPosition:0}},clickAnywhere:function(e,t){if(e.currentVertexPosition>0&&ot(t,e.polygon.coordinates[0][e.currentVertexPosition-1]))return this.changeMode(T.SIMPLE_SELECT,{featureIds:[e.polygon.id]});this.updateUIClasses({mouse:N.ADD}),e.polygon.updateCoordinate("0."+e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat),e.currentVertexPosition++,e.polygon.updateCoordinate("0."+e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat)},clickOnVertex:function(e){return this.changeMode(T.SIMPLE_SELECT,{featureIds:[e.polygon.id]})},onMouseMove:function(e,t){e.polygon.updateCoordinate("0."+e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat),De(t)&&this.updateUIClasses({mouse:N.POINTER})}};be.onTap=be.onClick=function(e,t){return De(t)?this.clickOnVertex(e,t):this.clickAnywhere(e,t)},be.onKeyUp=function(e,t){Xe(t)?(this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(T.SIMPLE_SELECT)):Ze(t)&&this.changeMode(T.SIMPLE_SELECT,{featureIds:[e.polygon.id]})},be.onStop=function(e){this.updateUIClasses({mouse:N.NONE}),ee.enable(this),this.activateUIButton(),this.getFeature(e.polygon.id)!==void 0&&(e.polygon.removeCoordinate("0."+e.currentVertexPosition),e.polygon.isValid()?this.map.fire(H.CREATE,{features:[e.polygon.toGeoJSON()]}):(this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(T.SIMPLE_SELECT,{},{silent:!0})))},be.toDisplayFeatures=function(e,t,n){var r=t.properties.id===e.polygon.id;if(t.properties.active=r?j.ACTIVE:j.INACTIVE,!r)return n(t);if(t.geometry.coordinates.length!==0){var o=t.geometry.coordinates[0].length;if(!(o<3)){if(t.properties.meta=B.FEATURE,n(Le(e.polygon.id,t.geometry.coordinates[0][0],"0.0",!1)),o>3){var i=t.geometry.coordinates[0].length-3;n(Le(e.polygon.id,t.geometry.coordinates[0][i],"0."+i,!1))}if(o<=4){var a=[[t.geometry.coordinates[0][0][0],t.geometry.coordinates[0][0][1]],[t.geometry.coordinates[0][1][0],t.geometry.coordinates[0][1][1]]];if(n({type:m.FEATURE,properties:t.properties,geometry:{coordinates:a,type:m.LINE_STRING}}),o===3)return}return n(t)}}},be.onTrash=function(e){this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(T.SIMPLE_SELECT)};var Ee={onSetup:function(e){var t,n,r=(e=e||{}).featureId,o="forward";if(r){if(!(t=this.getFeature(r)))throw new Error("Could not find a feature with the provided featureId");var i=e.from;if(i&&i.type==="Feature"&&i.geometry&&i.geometry.type==="Point"&&(i=i.geometry),i&&i.type==="Point"&&i.coordinates&&i.coordinates.length===2&&(i=i.coordinates),!i||!Array.isArray(i))throw new Error("Please use the `from` property to indicate which point to continue the line from");var a=t.coordinates.length-1;if(t.coordinates[a][0]===i[0]&&t.coordinates[a][1]===i[1])n=a+1,t.addCoordinate.apply(t,[n].concat(t.coordinates[a]));else{if(t.coordinates[0][0]!==i[0]||t.coordinates[0][1]!==i[1])throw new Error("`from` should match the point at either the start or the end of the provided LineString");o="backwards",n=0,t.addCoordinate.apply(t,[n].concat(t.coordinates[0]))}}else t=this.newFeature({type:m.FEATURE,properties:{},geometry:{type:m.LINE_STRING,coordinates:[]}}),n=0,this.addFeature(t);return this.clearSelectedFeatures(),ee.disable(this),this.updateUIClasses({mouse:N.ADD}),this.activateUIButton(Y.LINE),this.setActionableState({trash:!0}),{line:t,currentVertexPosition:n,direction:o}},clickAnywhere:function(e,t){if(e.currentVertexPosition>0&&ot(t,e.line.coordinates[e.currentVertexPosition-1])||e.direction==="backwards"&&ot(t,e.line.coordinates[e.currentVertexPosition+1]))return this.changeMode(T.SIMPLE_SELECT,{featureIds:[e.line.id]});this.updateUIClasses({mouse:N.ADD}),e.line.updateCoordinate(e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat),e.direction==="forward"?(e.currentVertexPosition++,e.line.updateCoordinate(e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat)):e.line.addCoordinate(0,t.lngLat.lng,t.lngLat.lat)},clickOnVertex:function(e){return this.changeMode(T.SIMPLE_SELECT,{featureIds:[e.line.id]})},onMouseMove:function(e,t){e.line.updateCoordinate(e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat),De(t)&&this.updateUIClasses({mouse:N.POINTER})}};Ee.onTap=Ee.onClick=function(e,t){if(De(t))return this.clickOnVertex(e,t);this.clickAnywhere(e,t)},Ee.onKeyUp=function(e,t){Ze(t)?this.changeMode(T.SIMPLE_SELECT,{featureIds:[e.line.id]}):Xe(t)&&(this.deleteFeature([e.line.id],{silent:!0}),this.changeMode(T.SIMPLE_SELECT))},Ee.onStop=function(e){ee.enable(this),this.activateUIButton(),this.getFeature(e.line.id)!==void 0&&(e.line.removeCoordinate(""+e.currentVertexPosition),e.line.isValid()?this.map.fire(H.CREATE,{features:[e.line.toGeoJSON()]}):(this.deleteFeature([e.line.id],{silent:!0}),this.changeMode(T.SIMPLE_SELECT,{},{silent:!0})))},Ee.onTrash=function(e){this.deleteFeature([e.line.id],{silent:!0}),this.changeMode(T.SIMPLE_SELECT)},Ee.toDisplayFeatures=function(e,t,n){var r=t.properties.id===e.line.id;if(t.properties.active=r?j.ACTIVE:j.INACTIVE,!r)return n(t);t.geometry.coordinates.length<2||(t.properties.meta=B.FEATURE,n(Le(e.line.id,t.geometry.coordinates[e.direction==="forward"?t.geometry.coordinates.length-2:1],""+(e.direction==="forward"?t.geometry.coordinates.length-2:1),!1)),n(t))};var mn={simple_select:D,direct_select:fe,draw_point:ne,draw_polygon:be,draw_line_string:Ee},Mr={defaultMode:T.SIMPLE_SELECT,keybindings:!0,touchEnabled:!0,clickBuffer:2,touchBuffer:25,boxSelect:!0,displayControlsDefault:!0,styles:sn,modes:mn,controls:{},userProperties:!1},Lr={point:!0,line_string:!0,polygon:!0,trash:!0,combine_features:!0,uncombine_features:!0},Nr={point:!1,line_string:!1,polygon:!1,trash:!1,combine_features:!1,uncombine_features:!1};function _n(e,t){return e.map(function(n){return n.source?n:pe(n,{id:n.id+"."+t,source:t==="hot"?X.HOT:X.COLD})})}var Ut={exports:{}};(function(e,t){var n="__lodash_hash_undefined__",r=9007199254740991,o="[object Arguments]",i="[object Array]",a="[object Boolean]",l="[object Date]",d="[object Error]",h="[object Function]",g="[object Map]",p="[object Number]",_="[object Object]",P="[object Promise]",b="[object RegExp]",w="[object Set]",c="[object String]",y="[object Symbol]",O="[object WeakMap]",V="[object ArrayBuffer]",F="[object DataView]",jt=/^\[object .+?Constructor\]$/,Fr=/^(?:0|[1-9]\d*)$/,M={};M["[object Float32Array]"]=M["[object Float64Array]"]=M["[object Int8Array]"]=M["[object Int16Array]"]=M["[object Int32Array]"]=M["[object Uint8Array]"]=M["[object Uint8ClampedArray]"]=M["[object Uint16Array]"]=M["[object Uint32Array]"]=!0,M[o]=M[i]=M[V]=M[a]=M[F]=M[l]=M[d]=M[h]=M[g]=M[p]=M[_]=M[b]=M[w]=M[c]=M[O]=!1;var Tn=typeof bt.commonjsGlobal=="object"&&bt.commonjsGlobal&&bt.commonjsGlobal.Object===Object&&bt.commonjsGlobal,Rr=typeof self=="object"&&self&&self.Object===Object&&self,ae=Tn||Rr||Function("return this")(),Cn=t&&!t.nodeType&&t,On=Cn&&e&&!e.nodeType&&e,Sn=On&&On.exports===Cn,Vt=Sn&&Tn.process,In=function(){try{return Vt&&Vt.binding&&Vt.binding("util")}catch{}}(),xn=In&&In.isTypedArray;function Dr(s,u){for(var f=-1,v=s==null?0:s.length;++f<v;)if(u(s[f],f,s))return!0;return!1}function kr(s){var u=-1,f=Array(s.size);return s.forEach(function(v,L){f[++u]=[L,v]}),f}function Ur(s){var u=-1,f=Array(s.size);return s.forEach(function(v){f[++u]=v}),f}var Mn,Ln,Nn,jr=Array.prototype,Vr=Function.prototype,at=Object.prototype,Bt=ae["__core-js_shared__"],Pn=Vr.toString,re=at.hasOwnProperty,An=(Mn=/[^.]+$/.exec(Bt&&Bt.keys&&Bt.keys.IE_PROTO||""))?"Symbol(src)_1."+Mn:"",wn=at.toString,Br=RegExp("^"+Pn.call(re).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Fn=Sn?ae.Buffer:void 0,st=ae.Symbol,Rn=ae.Uint8Array,Dn=at.propertyIsEnumerable,Gr=jr.splice,Te=st?st.toStringTag:void 0,kn=Object.getOwnPropertySymbols,Jr=Fn?Fn.isBuffer:void 0,zr=(Ln=Object.keys,Nn=Object,function(s){return Ln(Nn(s))}),Gt=Pe(ae,"DataView"),ke=Pe(ae,"Map"),Jt=Pe(ae,"Promise"),zt=Pe(ae,"Set"),Yt=Pe(ae,"WeakMap"),Ue=Pe(Object,"create"),Yr=Se(Gt),$r=Se(ke),qr=Se(Jt),Hr=Se(zt),Xr=Se(Yt),Un=st?st.prototype:void 0,$t=Un?Un.valueOf:void 0;function Ce(s){var u=-1,f=s==null?0:s.length;for(this.clear();++u<f;){var v=s[u];this.set(v[0],v[1])}}function se(s){var u=-1,f=s==null?0:s.length;for(this.clear();++u<f;){var v=s[u];this.set(v[0],v[1])}}function Oe(s){var u=-1,f=s==null?0:s.length;for(this.clear();++u<f;){var v=s[u];this.set(v[0],v[1])}}function ut(s){var u=-1,f=s==null?0:s.length;for(this.__data__=new Oe;++u<f;)this.add(s[u])}function he(s){var u=this.__data__=new se(s);this.size=u.size}function Zr(s,u){var f=dt(s),v=!f&&to(s),L=!f&&!v&&qt(s),C=!f&&!v&&!L&&qn(s),A=f||v||L||C,R=A?function(U,oe){for(var ue=-1,z=Array(U);++ue<U;)z[ue]=oe(ue);return z}(s.length,String):[],te=R.length;for(var k in s)!re.call(s,k)||A&&(k=="length"||L&&(k=="offset"||k=="parent")||C&&(k=="buffer"||k=="byteLength"||k=="byteOffset")||eo(k,te))||R.push(k);return R}function ct(s,u){for(var f=s.length;f--;)if(Jn(s[f][0],u))return f;return-1}function je(s){return s==null?s===void 0?"[object Undefined]":"[object Null]":Te&&Te in Object(s)?function(u){var f=re.call(u,Te),v=u[Te];try{u[Te]=void 0;var L=!0}catch{}var C=wn.call(u);return L&&(f?u[Te]=v:delete u[Te]),C}(s):function(u){return wn.call(u)}(s)}function jn(s){return Ve(s)&&je(s)==o}function Vn(s,u,f,v,L){return s===u||(s==null||u==null||!Ve(s)&&!Ve(u)?s!=s&&u!=u:function(C,A,R,te,k,U){var oe=dt(C),ue=dt(A),z=oe?i:ge(C),ce=ue?i:ge(A),Ae=(z=z==o?_:z)==_,pt=(ce=ce==o?_:ce)==_,we=z==ce;if(we&&qt(C)){if(!qt(A))return!1;oe=!0,Ae=!1}if(we&&!Ae)return U||(U=new he),oe||qn(C)?Bn(C,A,R,te,k,U):function(I,S,ft,ye,Ht,Q,le){switch(ft){case F:if(I.byteLength!=S.byteLength||I.byteOffset!=S.byteOffset)return!1;I=I.buffer,S=S.buffer;case V:return!(I.byteLength!=S.byteLength||!Q(new Rn(I),new Rn(S)));case a:case l:case p:return Jn(+I,+S);case d:return I.name==S.name&&I.message==S.message;case b:case c:return I==S+"";case g:var ve=kr;case w:var Ge=1&ye;if(ve||(ve=Ur),I.size!=S.size&&!Ge)return!1;var ht=le.get(I);if(ht)return ht==S;ye|=2,le.set(I,S);var Fe=Bn(ve(I),ve(S),ye,Ht,Q,le);return le.delete(I),Fe;case y:if($t)return $t.call(I)==$t.call(S)}return!1}(C,A,z,R,te,k,U);if(!(1&R)){var Be=Ae&&re.call(C,"__wrapped__"),Hn=pt&&re.call(A,"__wrapped__");if(Be||Hn){var ro=Be?C.value():C,oo=Hn?A.value():A;return U||(U=new he),k(ro,oo,R,te,U)}}return we?(U||(U=new he),function(I,S,ft,ye,Ht,Q){var le=1&ft,ve=Gn(I),Ge=ve.length,ht=Gn(S).length;if(Ge!=ht&&!le)return!1;for(var Fe=Ge;Fe--;){var Ie=ve[Fe];if(!(le?Ie in S:re.call(S,Ie)))return!1}var Xn=Q.get(I);if(Xn&&Q.get(S))return Xn==S;var gt=!0;Q.set(I,S),Q.set(S,I);for(var Xt=le;++Fe<Ge;){var yt=I[Ie=ve[Fe]],vt=S[Ie];if(ye)var Zn=le?ye(vt,yt,Ie,S,I,Q):ye(yt,vt,Ie,I,S,Q);if(!(Zn===void 0?yt===vt||Ht(yt,vt,ft,ye,Q):Zn)){gt=!1;break}Xt||(Xt=Ie=="constructor")}if(gt&&!Xt){var mt=I.constructor,_t=S.constructor;mt==_t||!("constructor"in I)||!("constructor"in S)||typeof mt=="function"&&mt instanceof mt&&typeof _t=="function"&&_t instanceof _t||(gt=!1)}return Q.delete(I),Q.delete(S),gt}(C,A,R,te,k,U)):!1}(s,u,f,v,Vn,L))}function Wr(s){return!(!$n(s)||function(u){return!!An&&An in u}(s))&&(zn(s)?Br:jt).test(Se(s))}function Kr(s){if(f=(u=s)&&u.constructor,v=typeof f=="function"&&f.prototype||at,u!==v)return zr(s);var u,f,v,L=[];for(var C in Object(s))re.call(s,C)&&C!="constructor"&&L.push(C);return L}function Bn(s,u,f,v,L,C){var A=1&f,R=s.length,te=u.length;if(R!=te&&!(A&&te>R))return!1;var k=C.get(s);if(k&&C.get(u))return k==u;var U=-1,oe=!0,ue=2&f?new ut:void 0;for(C.set(s,u),C.set(u,s);++U<R;){var z=s[U],ce=u[U];if(v)var Ae=A?v(ce,z,U,u,s,C):v(z,ce,U,s,u,C);if(Ae!==void 0){if(Ae)continue;oe=!1;break}if(ue){if(!Dr(u,function(pt,we){if(Be=we,!ue.has(Be)&&(z===pt||L(z,pt,f,v,C)))return ue.push(we);var Be})){oe=!1;break}}else if(z!==ce&&!L(z,ce,f,v,C)){oe=!1;break}}return C.delete(s),C.delete(u),oe}function Gn(s){return function(u,f,v){var L=f(u);return dt(u)?L:function(C,A){for(var R=-1,te=A.length,k=C.length;++R<te;)C[k+R]=A[R];return C}(L,v(u))}(s,no,Qr)}function lt(s,u){var f,v,L=s.__data__;return((v=typeof(f=u))=="string"||v=="number"||v=="symbol"||v=="boolean"?f!=="__proto__":f===null)?L[typeof u=="string"?"string":"hash"]:L.map}function Pe(s,u){var f=function(v,L){return v?.[L]}(s,u);return Wr(f)?f:void 0}Ce.prototype.clear=function(){this.__data__=Ue?Ue(null):{},this.size=0},Ce.prototype.delete=function(s){var u=this.has(s)&&delete this.__data__[s];return this.size-=u?1:0,u},Ce.prototype.get=function(s){var u=this.__data__;if(Ue){var f=u[s];return f===n?void 0:f}return re.call(u,s)?u[s]:void 0},Ce.prototype.has=function(s){var u=this.__data__;return Ue?u[s]!==void 0:re.call(u,s)},Ce.prototype.set=function(s,u){var f=this.__data__;return this.size+=this.has(s)?0:1,f[s]=Ue&&u===void 0?n:u,this},se.prototype.clear=function(){this.__data__=[],this.size=0},se.prototype.delete=function(s){var u=this.__data__,f=ct(u,s);return!(f<0)&&(f==u.length-1?u.pop():Gr.call(u,f,1),--this.size,!0)},se.prototype.get=function(s){var u=this.__data__,f=ct(u,s);return f<0?void 0:u[f][1]},se.prototype.has=function(s){return ct(this.__data__,s)>-1},se.prototype.set=function(s,u){var f=this.__data__,v=ct(f,s);return v<0?(++this.size,f.push([s,u])):f[v][1]=u,this},Oe.prototype.clear=function(){this.size=0,this.__data__={hash:new Ce,map:new(ke||se),string:new Ce}},Oe.prototype.delete=function(s){var u=lt(this,s).delete(s);return this.size-=u?1:0,u},Oe.prototype.get=function(s){return lt(this,s).get(s)},Oe.prototype.has=function(s){return lt(this,s).has(s)},Oe.prototype.set=function(s,u){var f=lt(this,s),v=f.size;return f.set(s,u),this.size+=f.size==v?0:1,this},ut.prototype.add=ut.prototype.push=function(s){return this.__data__.set(s,n),this},ut.prototype.has=function(s){return this.__data__.has(s)},he.prototype.clear=function(){this.__data__=new se,this.size=0},he.prototype.delete=function(s){var u=this.__data__,f=u.delete(s);return this.size=u.size,f},he.prototype.get=function(s){return this.__data__.get(s)},he.prototype.has=function(s){return this.__data__.has(s)},he.prototype.set=function(s,u){var f=this.__data__;if(f instanceof se){var v=f.__data__;if(!ke||v.length<199)return v.push([s,u]),this.size=++f.size,this;f=this.__data__=new Oe(v)}return f.set(s,u),this.size=f.size,this};var Qr=kn?function(s){return s==null?[]:(s=Object(s),function(u,f){for(var v=-1,L=u==null?0:u.length,C=0,A=[];++v<L;){var R=u[v];f(R,v,u)&&(A[C++]=R)}return A}(kn(s),function(u){return Dn.call(s,u)}))}:function(){return[]},ge=je;function eo(s,u){return!!(u=u??r)&&(typeof s=="number"||Fr.test(s))&&s>-1&&s%1==0&&s<u}function Se(s){if(s!=null){try{return Pn.call(s)}catch{}try{return s+""}catch{}}return""}function Jn(s,u){return s===u||s!=s&&u!=u}(Gt&&ge(new Gt(new ArrayBuffer(1)))!=F||ke&&ge(new ke)!=g||Jt&&ge(Jt.resolve())!=P||zt&&ge(new zt)!=w||Yt&&ge(new Yt)!=O)&&(ge=function(s){var u=je(s),f=u==_?s.constructor:void 0,v=f?Se(f):"";if(v)switch(v){case Yr:return F;case $r:return g;case qr:return P;case Hr:return w;case Xr:return O}return u});var to=jn(function(){return arguments}())?jn:function(s){return Ve(s)&&re.call(s,"callee")&&!Dn.call(s,"callee")},dt=Array.isArray,qt=Jr||function(){return!1};function zn(s){if(!$n(s))return!1;var u=je(s);return u==h||u=="[object GeneratorFunction]"||u=="[object AsyncFunction]"||u=="[object Proxy]"}function Yn(s){return typeof s=="number"&&s>-1&&s%1==0&&s<=r}function $n(s){var u=typeof s;return s!=null&&(u=="object"||u=="function")}function Ve(s){return s!=null&&typeof s=="object"}var qn=xn?function(s){return function(u){return s(u)}}(xn):function(s){return Ve(s)&&Yn(s.length)&&!!M[je(s)]};function no(s){return(u=s)!=null&&Yn(u.length)&&!zn(u)?Zr(s):Kr(s);var u}e.exports=function(s,u){return Vn(s,u)}})(Ut,Ut.exports);var bn=de(Ut.exports);function En(e,t){return e.length===t.length&&JSON.stringify(e.map(function(n){return n}).sort())===JSON.stringify(t.map(function(n){return n}).sort())}var Pr={Polygon:W,LineString:ie,Point:me,MultiPolygon:$,MultiLineString:$,MultiPoint:$},Ar=Object.freeze({__proto__:null,CommonSelectors:pr,constrainFeatureMovement:Dt,createMidPoint:cn,createSupplementaryPoints:We,createVertex:Le,doubleClickZoom:ee,euclideanDistance:xt,featuresAt:xe,getFeatureAtAndSetCursors:ze,isClick:Mt,isEventAtCoordinates:ot,isTap:Lt,mapEventToBoundingBox:tn,ModeHandler:Je,moveFeatures:kt,sortFeatures:en,stringSetsAreEqual:En,StringSet:Z,theme:sn,toDenseArray:Re}),wr=function(e,t){var n={options:e=function(o){o===void 0&&(o={});var i=pe(o);return o.controls||(i.controls={}),o.displayControlsDefault===!1?i.controls=pe(Nr,o.controls):i.controls=pe(Lr,o.controls),(i=pe(Mr,i)).styles=_n(i.styles,"cold").concat(_n(i.styles,"hot")),i}(e)};t=function(o,i){return i.modes=T,i.getFeatureIdsAt=function(a){return xe.click({point:a},null,o).map(function(l){return l.properties.id})},i.getSelectedIds=function(){return o.store.getSelectedIds()},i.getSelected=function(){return{type:m.FEATURE_COLLECTION,features:o.store.getSelectedIds().map(function(a){return o.store.get(a)}).map(function(a){return a.toGeoJSON()})}},i.getSelectedPoints=function(){return{type:m.FEATURE_COLLECTION,features:o.store.getSelectedCoordinates().map(function(a){return{type:m.FEATURE,properties:{},geometry:{type:m.POINT,coordinates:a.coordinates}}})}},i.set=function(a){if(a.type===void 0||a.type!==m.FEATURE_COLLECTION||!Array.isArray(a.features))throw new Error("Invalid FeatureCollection");var l=o.store.createRenderBatch(),d=o.store.getAllIds().slice(),h=i.add(a),g=new Z(h);return(d=d.filter(function(p){return!g.has(p)})).length&&i.delete(d),l(),h},i.add=function(a){var l=JSON.parse(JSON.stringify(yr(a))).features.map(function(d){if(d.id=d.id||Pt(),d.geometry===null)throw new Error("Invalid geometry: null");if(o.store.get(d.id)===void 0||o.store.get(d.id).type!==d.geometry.type){var h=Pr[d.geometry.type];if(h===void 0)throw new Error("Invalid geometry type: "+d.geometry.type+".");var g=new h(o,d);o.store.add(g)}else{var p=o.store.get(d.id);p.properties=d.properties,bn(p.properties,d.properties)||o.store.featureChanged(p.id),bn(p.getCoordinates(),d.geometry.coordinates)||p.incomingCoords(d.geometry.coordinates)}return d.id});return o.store.render(),l},i.get=function(a){var l=o.store.get(a);if(l)return l.toGeoJSON()},i.getAll=function(){return{type:m.FEATURE_COLLECTION,features:o.store.getAll().map(function(a){return a.toGeoJSON()})}},i.delete=function(a){return o.store.delete(a,{silent:!0}),i.getMode()!==T.DIRECT_SELECT||o.store.getSelectedIds().length?o.store.render():o.events.changeMode(T.SIMPLE_SELECT,void 0,{silent:!0}),i},i.deleteAll=function(){return o.store.delete(o.store.getAllIds(),{silent:!0}),i.getMode()===T.DIRECT_SELECT?o.events.changeMode(T.SIMPLE_SELECT,void 0,{silent:!0}):o.store.render(),i},i.changeMode=function(a,l){return l===void 0&&(l={}),a===T.SIMPLE_SELECT&&i.getMode()===T.SIMPLE_SELECT?(En(l.featureIds||[],o.store.getSelectedIds())||(o.store.setSelected(l.featureIds,{silent:!0}),o.store.render()),i):(a===T.DIRECT_SELECT&&i.getMode()===T.DIRECT_SELECT&&l.featureId===o.store.getSelectedIds()[0]||o.events.changeMode(a,l,{silent:!0}),i)},i.getMode=function(){return o.events.getMode()},i.trash=function(){return o.events.trash({silent:!0}),i},i.combineFeatures=function(){return o.events.combineFeatures({silent:!0}),i},i.uncombineFeatures=function(){return o.events.uncombineFeatures({silent:!0}),i},i.setFeatureProperty=function(a,l,d){return o.store.setFeatureProperty(a,l,d),i},i}(n,t),n.api=t;var r=dr(n);return t.onAdd=r.onAdd,t.onRemove=r.onRemove,t.types=Y,t.options=e,t};function it(e){wr(e,this)}return it.modes=mn,it.constants=tr,it.lib=Ar,it})}(Et.__module)),Et.__module.exports}exports.__require=ao;
|
|
744
2
|
//# sourceMappingURL=index.cjs71.js.map
|